diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-16 10:23:55 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-16 10:23:55 +0200 |
commit | 990a617edfd9040594c0889d2dd23eb7ef91c695 (patch) | |
tree | 25a41246927426fa64ffb10217332bc065df8887 | |
parent | 1d924f59b1854e9638c63a743642e63c1bef38b9 (diff) | |
download | busybox-w32-990a617edfd9040594c0889d2dd23eb7ef91c695.tar.gz busybox-w32-990a617edfd9040594c0889d2dd23eb7ef91c695.tar.bz2 busybox-w32-990a617edfd9040594c0889d2dd23eb7ef91c695.zip |
udhcp: rename giaddr to gateway_nip and server to server_nip
"nip" stands for "IP in network order"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/udhcp/common.h | 4 | ||||
-rw-r--r-- | networking/udhcp/dhcpd.c | 4 | ||||
-rw-r--r-- | networking/udhcp/dhcpd.h | 2 | ||||
-rw-r--r-- | networking/udhcp/dhcprelay.c | 8 | ||||
-rw-r--r-- | networking/udhcp/leases.c | 2 | ||||
-rw-r--r-- | networking/udhcp/serverpacket.c | 14 | ||||
-rw-r--r-- | networking/udhcp/socket.c | 6 |
7 files changed, 20 insertions, 20 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index ca96847a7..fef0b66a8 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h | |||
@@ -36,7 +36,7 @@ struct dhcpMessage { | |||
36 | uint32_t yiaddr; /* 'your' (client) IP address */ | 36 | uint32_t yiaddr; /* 'your' (client) IP address */ |
37 | uint32_t siaddr; /* IP address of next server to use in bootstrap, | 37 | uint32_t siaddr; /* IP address of next server to use in bootstrap, |
38 | * returned in DHCPOFFER, DHCPACK by server */ | 38 | * returned in DHCPOFFER, DHCPACK by server */ |
39 | uint32_t giaddr; /* relay agent IP address */ | 39 | uint32_t gateway_nip; /* relay agent IP address */ |
40 | uint8_t chaddr[16];/* link-layer client hardware address (MAC) */ | 40 | uint8_t chaddr[16];/* link-layer client hardware address (MAC) */ |
41 | uint8_t sname[64]; /* server host name (ASCIZ) */ | 41 | uint8_t sname[64]; /* server host name (ASCIZ) */ |
42 | uint8_t file[128]; /* boot file name (ASCIZ) */ | 42 | uint8_t file[128]; /* boot file name (ASCIZ) */ |
@@ -88,7 +88,7 @@ void udhcp_run_script(struct dhcpMessage *packet, const char *name) FAST_FUNC; | |||
88 | void udhcp_sp_setup(void) FAST_FUNC; | 88 | void udhcp_sp_setup(void) FAST_FUNC; |
89 | int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC; | 89 | int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC; |
90 | int udhcp_sp_read(const fd_set *rfds) FAST_FUNC; | 90 | int udhcp_sp_read(const fd_set *rfds) FAST_FUNC; |
91 | int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) FAST_FUNC; | 91 | int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *arp) FAST_FUNC; |
92 | int udhcp_raw_socket(int ifindex) FAST_FUNC; | 92 | int udhcp_raw_socket(int ifindex) FAST_FUNC; |
93 | int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC; | 93 | int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC; |
94 | /* Returns 1 if no reply received */ | 94 | /* Returns 1 if no reply received */ |
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 61e4a1d95..09524e29c 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c | |||
@@ -94,7 +94,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv) | |||
94 | read_leases(server_config.lease_file); | 94 | read_leases(server_config.lease_file); |
95 | 95 | ||
96 | if (udhcp_read_interface(server_config.interface, &server_config.ifindex, | 96 | if (udhcp_read_interface(server_config.interface, &server_config.ifindex, |
97 | &server_config.server, server_config.arp)) { | 97 | &server_config.server_nip, server_config.arp)) { |
98 | retval = 1; | 98 | retval = 1; |
99 | goto ret; | 99 | goto ret; |
100 | } | 100 | } |
@@ -202,7 +202,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv) | |||
202 | if (server_id) { | 202 | if (server_id) { |
203 | /* SELECTING State */ | 203 | /* SELECTING State */ |
204 | DEBUG("server_id = %08x", ntohl(server_id_aligned)); | 204 | DEBUG("server_id = %08x", ntohl(server_id_aligned)); |
205 | if (server_id_aligned == server_config.server | 205 | if (server_id_aligned == server_config.server_nip |
206 | && requested | 206 | && requested |
207 | && requested_aligned == lease->lease_nip | 207 | && requested_aligned == lease->lease_nip |
208 | ) { | 208 | ) { |
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h index a3ace92d4..bb281c51b 100644 --- a/networking/udhcp/dhcpd.h +++ b/networking/udhcp/dhcpd.h | |||
@@ -28,7 +28,7 @@ struct static_lease { | |||
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct server_config_t { | 30 | struct server_config_t { |
31 | uint32_t server; /* Our IP, in network order */ | 31 | uint32_t server_nip; /* Our IP, in network order */ |
32 | #if ENABLE_FEATURE_UDHCP_PORT | 32 | #if ENABLE_FEATURE_UDHCP_PORT |
33 | uint16_t port; | 33 | uint16_t port; |
34 | #endif | 34 | #endif |
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index 53540d1ab..2fee49a41 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c | |||
@@ -247,7 +247,7 @@ int dhcprelay_main(int argc, char **argv) | |||
247 | char **client_ifaces; | 247 | char **client_ifaces; |
248 | int *fds; | 248 | int *fds; |
249 | int num_sockets, max_socket; | 249 | int num_sockets, max_socket; |
250 | uint32_t our_ip; | 250 | uint32_t our_nip; |
251 | 251 | ||
252 | server_addr.sin_family = AF_INET; | 252 | server_addr.sin_family = AF_INET; |
253 | server_addr.sin_port = htons(SERVER_PORT); | 253 | server_addr.sin_port = htons(SERVER_PORT); |
@@ -272,7 +272,7 @@ int dhcprelay_main(int argc, char **argv) | |||
272 | max_socket = init_sockets(client_ifaces, num_sockets, argv[2], fds); | 272 | max_socket = init_sockets(client_ifaces, num_sockets, argv[2], fds); |
273 | 273 | ||
274 | /* Get our IP on server_iface */ | 274 | /* Get our IP on server_iface */ |
275 | if (udhcp_read_interface(argv[2], NULL, &our_ip, NULL)) | 275 | if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL)) |
276 | return 1; | 276 | return 1; |
277 | 277 | ||
278 | /* Main loop */ | 278 | /* Main loop */ |
@@ -309,10 +309,10 @@ int dhcprelay_main(int argc, char **argv) | |||
309 | 309 | ||
310 | /* Get our IP on corresponding client_iface */ | 310 | /* Get our IP on corresponding client_iface */ |
311 | //why? what if server can't route such IP? | 311 | //why? what if server can't route such IP? |
312 | if (udhcp_read_interface(client_ifaces[i-1], NULL, &dhcp_msg.giaddr, NULL)) { | 312 | if (udhcp_read_interface(client_ifaces[i-1], NULL, &dhcp_msg.gateway_nip, NULL)) { |
313 | /* Fall back to our server_iface's IP */ | 313 | /* Fall back to our server_iface's IP */ |
314 | //this makes more sense! | 314 | //this makes more sense! |
315 | dhcp_msg.giaddr = our_ip; | 315 | dhcp_msg.gateway_nip = our_nip; |
316 | } | 316 | } |
317 | //maybe set dhcp_msg.flags |= BROADCAST_FLAG too? | 317 | //maybe set dhcp_msg.flags |= BROADCAST_FLAG too? |
318 | pass_to_server(&dhcp_msg, packlen, i, fds, &client_addr, &server_addr); | 318 | pass_to_server(&dhcp_msg, packlen, i, fds, &client_addr, &server_addr); |
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index 040126fe8..403a8bca6 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c | |||
@@ -128,7 +128,7 @@ static int nobody_responds_to_arp(uint32_t addr, const uint8_t *safe_mac) | |||
128 | int r; | 128 | int r; |
129 | 129 | ||
130 | r = arpping(addr, safe_mac, | 130 | r = arpping(addr, safe_mac, |
131 | server_config.server, server_config.arp, | 131 | server_config.server_nip, server_config.arp, |
132 | server_config.interface); | 132 | server_config.interface); |
133 | if (r) | 133 | if (r) |
134 | return r; | 134 | return r; |
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c index 6aa2d34fa..55ed4a833 100644 --- a/networking/udhcp/serverpacket.c +++ b/networking/udhcp/serverpacket.c | |||
@@ -26,14 +26,14 @@ | |||
26 | #include "options.h" | 26 | #include "options.h" |
27 | 27 | ||
28 | 28 | ||
29 | /* send a packet to giaddr using the kernel ip stack */ | 29 | /* send a packet to gateway_nip using the kernel ip stack */ |
30 | static int send_packet_to_relay(struct dhcpMessage *payload) | 30 | static int send_packet_to_relay(struct dhcpMessage *payload) |
31 | { | 31 | { |
32 | DEBUG("Forwarding packet to relay"); | 32 | DEBUG("Forwarding packet to relay"); |
33 | 33 | ||
34 | return udhcp_send_kernel_packet(payload, | 34 | return udhcp_send_kernel_packet(payload, |
35 | server_config.server, SERVER_PORT, | 35 | server_config.server_nip, SERVER_PORT, |
36 | payload->giaddr, SERVER_PORT); | 36 | payload->gateway_nip, SERVER_PORT); |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
@@ -69,7 +69,7 @@ static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcas | |||
69 | } | 69 | } |
70 | 70 | ||
71 | return udhcp_send_raw_packet(payload, | 71 | return udhcp_send_raw_packet(payload, |
72 | /*src*/ server_config.server, SERVER_PORT, | 72 | /*src*/ server_config.server_nip, SERVER_PORT, |
73 | /*dst*/ ciaddr, CLIENT_PORT, chaddr, | 73 | /*dst*/ ciaddr, CLIENT_PORT, chaddr, |
74 | server_config.ifindex); | 74 | server_config.ifindex); |
75 | } | 75 | } |
@@ -78,7 +78,7 @@ static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcas | |||
78 | /* send a dhcp packet, if force broadcast is set, the packet will be broadcast to the client */ | 78 | /* send a dhcp packet, if force broadcast is set, the packet will be broadcast to the client */ |
79 | static int send_packet(struct dhcpMessage *payload, int force_broadcast) | 79 | static int send_packet(struct dhcpMessage *payload, int force_broadcast) |
80 | { | 80 | { |
81 | if (payload->giaddr) | 81 | if (payload->gateway_nip) |
82 | return send_packet_to_relay(payload); | 82 | return send_packet_to_relay(payload); |
83 | return send_packet_to_client(payload, force_broadcast); | 83 | return send_packet_to_client(payload, force_broadcast); |
84 | } | 84 | } |
@@ -90,9 +90,9 @@ static void init_packet(struct dhcpMessage *packet, struct dhcpMessage *oldpacke | |||
90 | packet->xid = oldpacket->xid; | 90 | packet->xid = oldpacket->xid; |
91 | memcpy(packet->chaddr, oldpacket->chaddr, 16); | 91 | memcpy(packet->chaddr, oldpacket->chaddr, 16); |
92 | packet->flags = oldpacket->flags; | 92 | packet->flags = oldpacket->flags; |
93 | packet->giaddr = oldpacket->giaddr; | 93 | packet->gateway_nip = oldpacket->gateway_nip; |
94 | packet->ciaddr = oldpacket->ciaddr; | 94 | packet->ciaddr = oldpacket->ciaddr; |
95 | add_simple_option(packet->options, DHCP_SERVER_ID, server_config.server); | 95 | add_simple_option(packet->options, DHCP_SERVER_ID, server_config.server_nip); |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index edf4355b5..449fcb7aa 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include "common.h" | 37 | #include "common.h" |
38 | 38 | ||
39 | 39 | ||
40 | int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) | 40 | int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *arp) |
41 | { | 41 | { |
42 | int fd; | 42 | int fd; |
43 | struct ifreq ifr; | 43 | struct ifreq ifr; |
@@ -48,7 +48,7 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t | |||
48 | 48 | ||
49 | ifr.ifr_addr.sa_family = AF_INET; | 49 | ifr.ifr_addr.sa_family = AF_INET; |
50 | strncpy_IFNAMSIZ(ifr.ifr_name, interface); | 50 | strncpy_IFNAMSIZ(ifr.ifr_name, interface); |
51 | if (addr) { | 51 | if (nip) { |
52 | if (ioctl_or_perror(fd, SIOCGIFADDR, &ifr, | 52 | if (ioctl_or_perror(fd, SIOCGIFADDR, &ifr, |
53 | "is interface %s up and configured?", interface) | 53 | "is interface %s up and configured?", interface) |
54 | ) { | 54 | ) { |
@@ -56,7 +56,7 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t | |||
56 | return -1; | 56 | return -1; |
57 | } | 57 | } |
58 | our_ip = (struct sockaddr_in *) &ifr.ifr_addr; | 58 | our_ip = (struct sockaddr_in *) &ifr.ifr_addr; |
59 | *addr = our_ip->sin_addr.s_addr; | 59 | *nip = our_ip->sin_addr.s_addr; |
60 | DEBUG("ip of %s = %s", interface, inet_ntoa(our_ip->sin_addr)); | 60 | DEBUG("ip of %s = %s", interface, inet_ntoa(our_ip->sin_addr)); |
61 | } | 61 | } |
62 | 62 | ||