diff options
author | Denis Vlasenko | 2009-04-01 12:36:09 +0000 |
---|---|---|
committer | Denis Vlasenko | 2009-04-01 12:36:09 +0000 |
commit | bd79c3d337304a96dcce4ae4f97b36143919af10 (patch) | |
tree | 75115aadc65ea14c8b038be883abfe74ca5f4ced /networking/udhcp/serverpacket.c | |
parent | 3266aa9ec285dbcf254daa17c103bf69dc755967 (diff) | |
download | busybox-bd79c3d337304a96dcce4ae4f97b36143919af10.zip busybox-bd79c3d337304a96dcce4ae4f97b36143919af10.tar.gz |
dhcpd: remember and record hostnames; optimize get_option
dumpleases: show hostnames
function old new delta
add_lease 230 292 +62
send_offer 403 421 +18
send_ACK 232 249 +17
read_leases 249 258 +9
dumpleases_main 604 609 +5
nobody_responds_to_arp 84 86 +2
udhcp_end_option 32 30 -2
udhcp_get_option 222 171 -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 113/-53) Total: 60 bytes
Diffstat (limited to 'networking/udhcp/serverpacket.c')
-rw-r--r-- | networking/udhcp/serverpacket.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c index afc0fb4..8b0f185 100644 --- a/networking/udhcp/serverpacket.c +++ b/networking/udhcp/serverpacket.c @@ -105,7 +105,7 @@ int FAST_FUNC send_offer(struct dhcpMessage *oldpacket) uint32_t req_align; uint32_t lease_time_aligned = server_config.lease; uint32_t static_lease_ip; - uint8_t *req, *lease_time; + uint8_t *req, *lease_time, *p_host_name; struct option_set *curr; struct in_addr addr; @@ -146,7 +146,8 @@ int FAST_FUNC send_offer(struct dhcpMessage *oldpacket) bb_error_msg("no IP addresses to give - OFFER abandoned"); return -1; } - if (!add_lease(packet.chaddr, packet.yiaddr, server_config.offer_time)) { + p_host_name = get_option(oldpacket, DHCP_HOST_NAME); + if (!add_lease(packet.chaddr, packet.yiaddr, server_config.offer_time, p_host_name)) { bb_error_msg("lease pool is full - OFFER abandoned"); return -1; } @@ -201,6 +202,7 @@ int FAST_FUNC send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) uint8_t *lease_time; uint32_t lease_time_aligned = server_config.lease; struct in_addr addr; + uint8_t *p_host_name; init_packet(&packet, oldpacket, DHCPACK); packet.yiaddr = yiaddr; @@ -232,7 +234,8 @@ int FAST_FUNC send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) if (send_packet(&packet, 0) < 0) return -1; - add_lease(packet.chaddr, packet.yiaddr, lease_time_aligned); + p_host_name = get_option(oldpacket, DHCP_HOST_NAME); + add_lease(packet.chaddr, packet.yiaddr, lease_time_aligned, p_host_name); if (ENABLE_FEATURE_UDHCPD_WRITE_LEASES_EARLY) { /* rewrite the file with leases at every new acceptance */ write_leases(); |