Commit | Line | Data |
---|---|---|
4c0cb882 SL |
1 | /* in_local.c 4.1 83/03/13 */ |
2 | ||
3 | /* | |
4 | * Site specific Internet routines. | |
5 | */ | |
6 | ||
7 | #ifndef if_localmakeaddr | |
8 | /* | |
9 | * Formulate an Internet address from network + host. Handle | |
10 | * local subnet interpretation. Used in building addresses | |
11 | * stored in the ifnet structure. | |
12 | */ | |
13 | struct in_addr | |
14 | if_localmakeaddr(net, host) | |
15 | int net, host; | |
16 | { | |
17 | u_long addr, subnet; | |
18 | ||
19 | subnet = net >> 24, net &= 0xffffff; | |
20 | if (net < 128) | |
21 | addr = (net << IN_CLASSA_NSHIFT) | host | | |
22 | (subnet << IN_CLASSA_NSHIFT - 8); | |
23 | else if (net < 65536) | |
24 | addr = (net << IN_CLASSB_NSHIFT) | host | | |
25 | (subnet << IN_CLASSB_NSHIFT - 8); | |
26 | else | |
27 | addr = (net << IN_CLASSC_NSHIFT) | host; | |
28 | addr = htonl(addr); | |
29 | return (*(struct in_addr *)&addr); | |
30 | } | |
31 | #endif |