121368Sdist /* 221368Sdist * Copyright (c) 1983 Regents of the University of California. 3*33676Sbostic * All rights reserved. 4*33676Sbostic * 5*33676Sbostic * Redistribution and use in source and binary forms are permitted 6*33676Sbostic * provided that this notice is preserved and that due credit is given 7*33676Sbostic * to the University of California at Berkeley. The name of the University 8*33676Sbostic * may not be used to endorse or promote products derived from this 9*33676Sbostic * software without specific prior written permission. This software 10*33676Sbostic * is provided ``as is'' without express or implied warranty. 1121368Sdist */ 128358Ssam 1326613Sdonn #if defined(LIBC_SCCS) && !defined(lint) 14*33676Sbostic static char sccsid[] = "@(#)inet_lnaof.c 5.4 (Berkeley) 03/07/88"; 15*33676Sbostic #endif /* LIBC_SCCS and not lint */ 1621368Sdist 178358Ssam #include <sys/types.h> 189192Ssam #include <netinet/in.h> 198358Ssam 208358Ssam /* 218358Ssam * Return the local network address portion of an 228358Ssam * internet address; handles class a/b/c network 238358Ssam * number formats. 248358Ssam */ 2532317Sbostic u_long 268370Ssam inet_lnaof(in) 278358Ssam struct in_addr in; 288358Ssam { 299192Ssam register u_long i = ntohl(in.s_addr); 309192Ssam 319192Ssam if (IN_CLASSA(i)) 329192Ssam return ((i)&IN_CLASSA_HOST); 339192Ssam else if (IN_CLASSB(i)) 349192Ssam return ((i)&IN_CLASSB_HOST); 359192Ssam else 369192Ssam return ((i)&IN_CLASSC_HOST); 378358Ssam } 38