121368Sdist /* 221368Sdist * Copyright (c) 1983 Regents of the University of California. 333676Sbostic * All rights reserved. 433676Sbostic * 5*42626Sbostic * %sccs.include.redist.c% 621368Sdist */ 78358Ssam 826613Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*42626Sbostic static char sccsid[] = "@(#)inet_lnaof.c 5.6 (Berkeley) 06/01/90"; 1033676Sbostic #endif /* LIBC_SCCS and not lint */ 1121368Sdist 128358Ssam #include <sys/types.h> 139192Ssam #include <netinet/in.h> 148358Ssam 158358Ssam /* 168358Ssam * Return the local network address portion of an 178358Ssam * internet address; handles class a/b/c network 188358Ssam * number formats. 198358Ssam */ 2032317Sbostic u_long 218370Ssam inet_lnaof(in) 228358Ssam struct in_addr in; 238358Ssam { 249192Ssam register u_long i = ntohl(in.s_addr); 259192Ssam 269192Ssam if (IN_CLASSA(i)) 279192Ssam return ((i)&IN_CLASSA_HOST); 289192Ssam else if (IN_CLASSB(i)) 299192Ssam return ((i)&IN_CLASSB_HOST); 309192Ssam else 319192Ssam return ((i)&IN_CLASSC_HOST); 328358Ssam } 33