summaryrefslogtreecommitdiff
path: root/networking/udhcp/dumpleases.c
diff options
context:
space:
mode:
authorDenis Vlasenko2009-04-01 12:36:09 +0000
committerDenis Vlasenko2009-04-01 12:36:09 +0000
commitbd79c3d337304a96dcce4ae4f97b36143919af10 (patch)
tree75115aadc65ea14c8b038be883abfe74ca5f4ced /networking/udhcp/dumpleases.c
parent3266aa9ec285dbcf254daa17c103bf69dc755967 (diff)
downloadbusybox-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/dumpleases.c')
-rw-r--r--networking/udhcp/dumpleases.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index c0d515d..1558f88 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -47,8 +47,9 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
fd = xopen(file, O_RDONLY);
- printf("Mac Address IP-Address Expires %s\n", (opt & OPT_a) ? "at" : "in");
- /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */
+ printf("Mac Address IP Address Host Name Expires %s\n", (opt & OPT_a) ? "at" : "in");
+ /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */
+ /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */
if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at))
return 0;
@@ -64,7 +65,9 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
fmt = ":%02x";
}
addr.s_addr = lease.yiaddr;
- printf(" %-15s ", inet_ntoa(addr));
+ /* actually, 15+1 and 19+1, +1 is a space between columns */
+ /* lease.hostname is char[20] and is always NUL terminated */
+ printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname);
expires_abs = ntohl(lease.expires) + written_at;
if (expires_abs <= curr) {
puts("expired");