1*9192Ssam /* inet_makeaddr.c 4.3 82/11/14 */ 28359Ssam 38359Ssam #include <sys/types.h> 4*9192Ssam #include <netinet/in.h> 58359Ssam 68359Ssam /* 78359Ssam * Formulate an Internet address from network + host. Used in 88359Ssam * building addresses stored in the ifnet structure. 98359Ssam */ 108359Ssam struct in_addr 118370Ssam inet_makeaddr(net, host) 128359Ssam int net, host; 138359Ssam { 148359Ssam u_long addr; 158359Ssam 168359Ssam if (net < 128) 17*9192Ssam addr = (net << IN_CLASSA_NSHIFT) | host; 188359Ssam else if (net < 65536) 19*9192Ssam addr = (net << IN_CLASSB_NSHIFT) | host; 208359Ssam else 21*9192Ssam addr = (net << IN_CLASSC_NSHIFT) | host; 228359Ssam addr = htonl(addr); 238359Ssam return (*(struct in_addr *)&addr); 248359Ssam } 25