diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-26 09:32:09 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-26 09:32:09 +0100 |
commit | 7724c766bdfba5f3af5cdf5d869bcf03f45149e3 (patch) | |
tree | d1cb0db7b683bdc9c9ecb954cc83dea7d53ae440 /networking/udhcp/dhcpd.c | |
parent | a8f6b9998727ad67db4b812270a1bbceea011dde (diff) | |
download | busybox-w32-7724c766bdfba5f3af5cdf5d869bcf03f45149e3.tar.gz busybox-w32-7724c766bdfba5f3af5cdf5d869bcf03f45149e3.tar.bz2 busybox-w32-7724c766bdfba5f3af5cdf5d869bcf03f45149e3.zip |
udhcp: pass pointer to whole packet to "add option" functions
This is needed for "overflow option" support
function old new delta
udhcp_find_option - 34 +34
udhcp_add_binary_option 94 106 +12
write_leases 227 223 -4
udhcp_init_header 86 82 -4
send_release 104 99 -5
init_packet 87 81 -6
add_client_options 160 154 -6
add_server_options 100 92 -8
udhcpd_main 1964 1954 -10
udhcpc_main 2859 2837 -22
find_option 34 - -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/8 up/down: 46/-99) Total: -53 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/dhcpd.c')
-rw-r--r-- | networking/udhcp/dhcpd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 32f351f52..4ab32de90 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c | |||
@@ -93,7 +93,7 @@ static void init_packet(struct dhcp_packet *packet, struct dhcp_packet *oldpacke | |||
93 | packet->flags = oldpacket->flags; | 93 | packet->flags = oldpacket->flags; |
94 | packet->gateway_nip = oldpacket->gateway_nip; | 94 | packet->gateway_nip = oldpacket->gateway_nip; |
95 | packet->ciaddr = oldpacket->ciaddr; | 95 | packet->ciaddr = oldpacket->ciaddr; |
96 | udhcp_add_simple_option(packet->options, DHCP_SERVER_ID, server_config.server_nip); | 96 | udhcp_add_simple_option(packet, DHCP_SERVER_ID, server_config.server_nip); |
97 | } | 97 | } |
98 | 98 | ||
99 | /* Fill options field, siaddr_nip, and sname and boot_file fields. | 99 | /* Fill options field, siaddr_nip, and sname and boot_file fields. |
@@ -105,7 +105,7 @@ static void add_server_options(struct dhcp_packet *packet) | |||
105 | 105 | ||
106 | while (curr) { | 106 | while (curr) { |
107 | if (curr->data[OPT_CODE] != DHCP_LEASE_TIME) | 107 | if (curr->data[OPT_CODE] != DHCP_LEASE_TIME) |
108 | udhcp_add_binary_option(packet->options, curr->data); | 108 | udhcp_add_binary_option(packet, curr->data); |
109 | curr = curr->next; | 109 | curr = curr->next; |
110 | } | 110 | } |
111 | 111 | ||
@@ -194,7 +194,7 @@ static void send_offer(struct dhcp_packet *oldpacket, uint32_t static_lease_nip, | |||
194 | } | 194 | } |
195 | 195 | ||
196 | lease_time_sec = select_lease_time(oldpacket); | 196 | lease_time_sec = select_lease_time(oldpacket); |
197 | udhcp_add_simple_option(packet.options, DHCP_LEASE_TIME, htonl(lease_time_sec)); | 197 | udhcp_add_simple_option(&packet, DHCP_LEASE_TIME, htonl(lease_time_sec)); |
198 | add_server_options(&packet); | 198 | add_server_options(&packet); |
199 | 199 | ||
200 | addr.s_addr = packet.yiaddr; | 200 | addr.s_addr = packet.yiaddr; |
@@ -224,7 +224,7 @@ static void send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr) | |||
224 | packet.yiaddr = yiaddr; | 224 | packet.yiaddr = yiaddr; |
225 | 225 | ||
226 | lease_time_sec = select_lease_time(oldpacket); | 226 | lease_time_sec = select_lease_time(oldpacket); |
227 | udhcp_add_simple_option(packet.options, DHCP_LEASE_TIME, htonl(lease_time_sec)); | 227 | udhcp_add_simple_option(&packet, DHCP_LEASE_TIME, htonl(lease_time_sec)); |
228 | 228 | ||
229 | add_server_options(&packet); | 229 | add_server_options(&packet); |
230 | 230 | ||
@@ -324,7 +324,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv) | |||
324 | 324 | ||
325 | bb_info_msg("%s (v"BB_VER") started", applet_name); | 325 | bb_info_msg("%s (v"BB_VER") started", applet_name); |
326 | 326 | ||
327 | option = find_option(server_config.options, DHCP_LEASE_TIME); | 327 | option = udhcp_find_option(server_config.options, DHCP_LEASE_TIME); |
328 | server_config.max_lease_sec = DEFAULT_LEASE_TIME; | 328 | server_config.max_lease_sec = DEFAULT_LEASE_TIME; |
329 | if (option) { | 329 | if (option) { |
330 | move_from_unaligned32(server_config.max_lease_sec, option->data + OPT_DATA); | 330 | move_from_unaligned32(server_config.max_lease_sec, option->data + OPT_DATA); |