1*21368Sdist /* 2*21368Sdist * Copyright (c) 1983 Regents of the University of California. 3*21368Sdist * All rights reserved. The Berkeley software License Agreement 4*21368Sdist * specifies the terms and conditions for redistribution. 5*21368Sdist */ 68358Ssam 7*21368Sdist #ifndef lint 8*21368Sdist static char sccsid[] = "@(#)inet_lnaof.c 5.1 (Berkeley) 05/30/85"; 9*21368Sdist #endif not lint 10*21368Sdist 118358Ssam #include <sys/types.h> 129192Ssam #include <netinet/in.h> 138358Ssam 148358Ssam /* 158358Ssam * Return the local network address portion of an 168358Ssam * internet address; handles class a/b/c network 178358Ssam * number formats. 188358Ssam */ 198370Ssam inet_lnaof(in) 208358Ssam struct in_addr in; 218358Ssam { 229192Ssam register u_long i = ntohl(in.s_addr); 239192Ssam 249192Ssam if (IN_CLASSA(i)) 259192Ssam return ((i)&IN_CLASSA_HOST); 269192Ssam else if (IN_CLASSB(i)) 279192Ssam return ((i)&IN_CLASSB_HOST); 289192Ssam else 299192Ssam return ((i)&IN_CLASSC_HOST); 308358Ssam } 31