121368Sdist /* 2*61150Sbostic * Copyright (c) 1983, 1993 3*61150Sbostic * The Regents of the University of California. All rights reserved. 433676Sbostic * 542626Sbostic * %sccs.include.redist.c% 621368Sdist */ 78358Ssam 826613Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*61150Sbostic static char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 06/04/93"; 1033676Sbostic #endif /* LIBC_SCCS and not lint */ 1121368Sdist 1246604Sbostic #include <sys/param.h> 139192Ssam #include <netinet/in.h> 1446604Sbostic #include <arpa/inet.h> 158358Ssam 168358Ssam /* 178358Ssam * Return the local network address portion of an 188358Ssam * internet address; handles class a/b/c network 198358Ssam * number formats. 208358Ssam */ 2132317Sbostic u_long inet_lnaof(in)228370Ssaminet_lnaof(in) 238358Ssam struct in_addr in; 248358Ssam { 259192Ssam register u_long i = ntohl(in.s_addr); 269192Ssam 279192Ssam if (IN_CLASSA(i)) 289192Ssam return ((i)&IN_CLASSA_HOST); 299192Ssam else if (IN_CLASSB(i)) 309192Ssam return ((i)&IN_CLASSB_HOST); 319192Ssam else 329192Ssam return ((i)&IN_CLASSC_HOST); 338358Ssam } 34