[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: udhcpd host name issue
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2009-04-21 8:23:13
Message-ID: 200904211023.13384.vda.linux () googlemail ! com
[Download RAW message or body]
On Tuesday 21 April 2009 09:03, Mahavir Jain wrote:
> On Tue, Apr 21, 2009 at 6:07 AM, Denys Vlasenko
> <vda.linux@googlemail.com> wrote:
> > > In networking/udhcp/leases.c
> > >
> > > - hostname = (uint8_t*) safe_strncpy((char*)oldest->hostname,
> > > (char*)hostname, hostname_length );
> > > + hostname = (uint8_t*) safe_strncpy((char*)oldest->hostname,
> > > (char*)hostname, hostname_length + 1);
> > >
> > > As safe_strncpy makes string to truncate last character to null, it
> > > makes host name not to display last character.
> >
> > Can you show the problematic output of dumpleases?
> > --
>
> Yes Sure.
>
> Wireshark log on client side:-
>
> Bootstrap Protocol
> 1 0.000000 192.168.1.100 255.255.255.255 DHCP DHCP Request -
> Transaction ID 0x8f6113b7
>
> Bootp flags: 0x0000 (Unicast)
> Option: (t=53,l=1) DHCP Message Type = DHCP Request
> Option: (t=61,l=7) Client identifier
> Option: (t=12,l=8) Host Name = "pe-lt231"
>
>
> At shell :
>
> $ dumpleases -f /var/lib/udhcpd.leases
> Mac Address IP Address Host Name Expires in
> 00:1c:25:91:3b:2a 192.168.1.100 pe-lt23 00:15:45
Thanks, I fixed it like this:
hostname_length = hostname[-1] + 1; <=====
if (hostname_length > sizeof(oldest->hostname))
hostname_length = sizeof(oldest->hostname);
hostname = (uint8_t*) safe_strncpy((char*)oldest->hostname, \
(char*)hostname, hostname_length);
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic