1*8359Ssam /* inet_makeaddr.c 4.1 82/10/07 */ 2*8359Ssam 3*8359Ssam #include <sys/types.h> 4*8359Ssam #include <net/in.h> 5*8359Ssam 6*8359Ssam /* 7*8359Ssam * Formulate an Internet address from network + host. Used in 8*8359Ssam * building addresses stored in the ifnet structure. 9*8359Ssam */ 10*8359Ssam struct in_addr 11*8359Ssam if_makeaddr(net, host) 12*8359Ssam int net, host; 13*8359Ssam { 14*8359Ssam u_long addr; 15*8359Ssam 16*8359Ssam if (net < 128) 17*8359Ssam addr = (net << 24) | host; 18*8359Ssam else if (net < 65536) 19*8359Ssam addr = (net << 16) | host; 20*8359Ssam else 21*8359Ssam addr = (net << 8) | host; 22*8359Ssam addr = htonl(addr); 23*8359Ssam return (*(struct in_addr *)&addr); 24*8359Ssam } 25