Im`m set hotname = 3M on client PC and up network. dumpleases at router show only 3 in host name for this PC: ~ # dumpleases Mac Address IP Address Host Name Expires in 00:19:21:92:4e:84 192.168.1.4 3 23:48:38 If set hostname for 3MM dumpleases show only 3M. Always cut end symbol at hostname string.
Im`m copy lease file to PC and view in hexedit, hostname = hostname printed dumpleases. And dumpleases and in lease file client hostname dom`t include one symbol at end name. Any ideas ? leases.c ? udhcpd.c ???
This patch fix it: --- leases.c.orig 2010-04-30 22:12:47.000000000 +0700 +++ leases.c 2010-04-30 22:05:18.143207528 +0700 @@ -66,7 +66,7 @@ char *p; if (hostname_len > sizeof(oldest->hostname)) hostname_len = sizeof(oldest->hostname); - p = safe_strncpy(oldest->hostname, hostname, hostname_len); + p = safe_strncpy(oldest->hostname, hostname, hostname_len + 1); /* sanitization (s/non-ASCII/^/g) */ while (*p) { if (*p < ' ' || *p > 126)
Created attachment 1609 [details] patch to fix cut end symbol at hostname in udhcpd lease file
what will happen if hostname_len == sizeof(oldest->hostname) ??
(In reply to comment #4) > what will happen if hostname_len == sizeof(oldest->hostname) ?? dumpleases show garbage (rt3052 mips LE) or segfault on dhcp client send hotsname (rtl8672 mips BE)
(In reply to comment #5) > (In reply to comment #4) > > what will happen if hostname_len == sizeof(oldest->hostname) ?? > dumpleases show garbage (rt3052 mips LE) or segfault on dhcp client send > hotsname (rtl8672 mips BE) Is it an answer to my question?
Fix is here: http://busybox.net/downloads/fixes-1.16.1/busybox-1.16.1-dhcpd.patch