On Sun, Nov 05, 2017 at 09:34:53PM +0100, Reyk Floeter wrote:
> On Thu, Nov 02, 2017 at 10:26:55PM +0100, Reyk Floeter wrote:
> > Hi,
> > 
> > the problem got reported a few times and a similar diff was floating
> > around: vmd's "local interface" implements a simple auto-magic BOOTP
> > server, but udhcpc doesn't support BOOTP, which is the predecessor and
> > a valid subset of DHCP.  udhcpc is used by busybox and many embedded
> > Linux distributions, maybe even by Android.
> > 
> > The following diff adds minimal DHCP support which works with udhcpc.
> > 
> 
> Thanks Carlos and Mike, I just committed the change.
> 
> Here is a practical example of the actual difference:
> 
> 1. Before the change in simple stateless BOOTP mode:
> 
> ```
> # dhclient vio0
> DHCPDISCOVER on vio0 - interval 1
> BOOTREPLY from 100.64.1.2 (fe:e1:bb:d1:a9:65)
> bound to 100.64.1.3 -- renewal in 8000 seconds.
> 
> # cat /var/db/dhclient.leases.vio0
> lease {
>   bootp;
>   interface "vio0";
>   fixed-address 100.64.1.3;
>   next-server 100.64.1.2;
>   option subnet-mask 255.255.255.254;
>   option routers 100.64.1.2;
>   option domain-name-servers 100.64.1.2;
>   option dhcp-lease-time 12000;
>   option dhcp-renewal-time 8000;
>   option dhcp-rebinding-time 10000;
>   renew 0 2017/11/05 22:03:14 UTC;
>   rebind 0 2017/11/05 22:36:34 UTC;
>   expire 0 2017/11/05 23:09:54 UTC;
> }
> ```
> 
> 2. After the change in minimal DHCP mode:
> 
> ```
> # dhclient vio0
> DHCPDISCOVER on vio0 - interval 1
> DHCPOFFER from 100.64.1.2 (fe:e1:bb:d1:09:1f)
> DHCPREQUEST on vio0 to 255.255.255.255
> DHCPACK from 100.64.1.2 (fe:e1:bb:d1:09:1f)
> bound to 100.64.1.3 -- renewal in 2147483647 seconds.
> 
> # cat /var/db/dhclient.leases.vio0
> lease {
>   interface "vio0";
>   fixed-address 100.64.1.3;
>   next-server 100.64.1.2;
>   option subnet-mask 255.255.255.254;
>   option routers 100.64.1.2;
>   option domain-name-servers 100.64.1.2,100.64.1.2;
>   option dhcp-lease-time 4294967295;
>   option dhcp-message-type 5;
>   option dhcp-server-identifier 100.64.1.2;
>   renew 5 2085/11/23 23:02:27 UTC;
>   rebind 6 2136/12/08 07:28:03 UTC;
>   expire 4 2153/12/13 02:16:35 UTC;
> }
> ```
> 
> As the lease never changes, I'm setting the lease time to 0xffffffff,
> as RFC 2132 section 9.2 defines it as "The time is in units of
> seconds, and is specified as a 32-bit unsigned integer".  This doesn't
> seem to cause any problems on dhclient or udhpc but it would be
> interesting to find out if there is any other DHCP implementation that
> handles it as "int" ...
> 
> Reyk
> 

Thanks reyk for taking the time here to fix this.

-ml

Reply via email to