diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-01 12:36:09 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-01 12:36:09 +0000 |
commit | bd79c3d337304a96dcce4ae4f97b36143919af10 (patch) | |
tree | 75115aadc65ea14c8b038be883abfe74ca5f4ced /networking/udhcp/dumpleases.c | |
parent | 3266aa9ec285dbcf254daa17c103bf69dc755967 (diff) | |
download | busybox-w32-bd79c3d337304a96dcce4ae4f97b36143919af10.tar.gz busybox-w32-bd79c3d337304a96dcce4ae4f97b36143919af10.tar.bz2 busybox-w32-bd79c3d337304a96dcce4ae4f97b36143919af10.zip |
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/dumpleases.c')
-rw-r--r-- | networking/udhcp/dumpleases.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index c0d515d28..1558f8848 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c | |||
@@ -47,8 +47,9 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
47 | 47 | ||
48 | fd = xopen(file, O_RDONLY); | 48 | fd = xopen(file, O_RDONLY); |
49 | 49 | ||
50 | printf("Mac Address IP-Address Expires %s\n", (opt & OPT_a) ? "at" : "in"); | 50 | printf("Mac Address IP Address Host Name Expires %s\n", (opt & OPT_a) ? "at" : "in"); |
51 | /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */ | 51 | /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */ |
52 | /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */ | ||
52 | 53 | ||
53 | if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at)) | 54 | if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at)) |
54 | return 0; | 55 | return 0; |
@@ -64,7 +65,9 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
64 | fmt = ":%02x"; | 65 | fmt = ":%02x"; |
65 | } | 66 | } |
66 | addr.s_addr = lease.yiaddr; | 67 | addr.s_addr = lease.yiaddr; |
67 | printf(" %-15s ", inet_ntoa(addr)); | 68 | /* actually, 15+1 and 19+1, +1 is a space between columns */ |
69 | /* lease.hostname is char[20] and is always NUL terminated */ | ||
70 | printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname); | ||
68 | expires_abs = ntohl(lease.expires) + written_at; | 71 | expires_abs = ntohl(lease.expires) + written_at; |
69 | if (expires_abs <= curr) { | 72 | if (expires_abs <= curr) { |
70 | puts("expired"); | 73 | puts("expired"); |