[Bug 262821] dhclient keeps contradicting leases

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 26 Mar 2022 08:34:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262821

            Bug ID: 262821
           Summary: dhclient keeps contradicting leases
           Product: Base System
           Version: 12.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: bsd@volki.at

According to the dhclient(8) manpage, "Old leases are kept around in case the
DHCP server is unavailable when dhclient is first invoked (generally during the
initial system boot process).  In that event, old leases from the
dhclient.leases.IFNAME file which have not yet expired are tested, and if they
are determined to be valid, they are used until either they expire or the DHCP
server becomes available."

Now the problem is that even after the new lease becomes available and active,
the old lease is still kept in /var/db/dhclient.leases.<interface>. This looks
like a bug:

~# killall dhclient
~# rm /var/db/dhclient.leases.em0 
~# dhclient em0
DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 5
DHCPOFFER from 100.64.0.1
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 100.64.0.1
bound to 100.64.122.132 -- renewal in 43140 seconds.
~# killall dhclient
~# cat /var/db/dhclient.leases.em0 
lease {
  interface "em0";
  fixed-address 100.64.122.132;
  option subnet-mask 255.255.128.0;
  option routers 100.64.0.1;
  option domain-name-servers 213.143.111.122,8.8.8.8;
  option domain-name "ve1.innonet.at";
  option dhcp-lease-time 86281;
  option dhcp-message-type 5;
  option dhcp-server-identifier 172.26.0.120;
  renew 6 2022/3/26 20:04:52;
  rebind 0 2022/3/27 05:04:07;
  expire 0 2022/3/27 08:03:53;
}
~# dhclient em0
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 100.64.0.1
bound to 100.64.122.132 -- renewal in 43130 seconds.
~# cat /var/db/dhclient.leases.em0 
lease {
  interface "em0";
  fixed-address 100.64.122.132;
  option subnet-mask 255.255.128.0;
  option routers 100.64.0.1;
  option domain-name-servers 213.143.111.122,8.8.8.8;
  option domain-name "ve1.innonet.at";
  option dhcp-lease-time 86281;
  option dhcp-message-type 5;
  option dhcp-server-identifier 172.26.0.120;
  renew 6 2022/3/26 20:04:52;
  rebind 0 2022/3/27 05:04:07;
  expire 0 2022/3/27 08:03:53;
}
lease {
  interface "em0";
  fixed-address 100.64.122.132;
  option subnet-mask 255.255.128.0;
  option routers 100.64.0.1;
  option domain-name-servers 213.143.111.122,8.8.8.8;
  option domain-name "ve1.innonet.at";
  option dhcp-lease-time 86261;
  option dhcp-message-type 5;
  option dhcp-server-identifier 172.26.0.120;
  renew 6 2022/3/26 20:05:02;
  rebind 0 2022/3/27 05:04:06;
  expire 0 2022/3/27 08:03:53;
}

This is confusing, because the two entries are essentially the same but with
different renew and rebind dates, so it remains unclear when the renew and
rebind are actually scheduled to happen.

-- 
You are receiving this mail because:
You are the assignee for the bug.