This patch is specific and work only with dnsmask static lease.

If we try to allocate an existing leased ip to a new mac,
we need to purge first the lease.

This patch is doing it directly in dhcp reply phase.


I have made a deb with the patch for testing:
https://mutulin1.odiso.net:/dnsmasq-base_2.89-1_amd64.deb


ex:

guest ask for ip 192.168.2.10 with mac 12:45:6f:39:c2:a6

Nov 15 22:45:05 formationkvm3 dnsmasq-dhcp[846333]: DHCPDISCOVER(vnetpve) 
192.168.2.10 12:45:6f:39:c2:a6
Nov 15 22:45:05 formationkvm3 dnsmasq-dhcp[846333]: DHCPOFFER(vnetpve) 
192.168.2.10 12:45:6f:39:c2:a6
Nov 15 22:45:05 formationkvm3 dnsmasq-dhcp[846333]: DHCPREQUEST(vnetpve) 
192.168.2.10 12:45:6f:39:c2:a6
Nov 15 22:45:05 formationkvm3 dnsmasq-dhcp[846333]: DHCPACK(vnetpve) 
192.168.2.10 12:45:6f:39:c2:a6 testovn1


remove remove nic from guest

create a new nic in another guest, 192.168.2.10 is allocated to new mac 
12:45:a3:ed:c8:36

we write ether file and reload dnsmasq

Nov 15 22:45:53 formationkvm3 systemd[1]: Reloading dnsmasq@simpve.service - 
dnsmasq (simpve) - A lightweight DHCP and caching DNS server...
Nov 15 22:45:53 formationkvm3 dnsmasq[846333]: cleared cache
Nov 15 22:45:53 formationkvm3 dnsmasq-dhcp[846333]: read 
/etc/dnsmasq.d/simpve/ethers
Nov 15 22:45:53 formationkvm3 systemd[1]: Reloaded dnsmasq@simpve.service - 
dnsmasq (simpve) - A lightweight DHCP and caching DNS server.

but the old mac:ip is still in lease memory of dnsmasq process


the guest is doing a dhcp query


here the patch: we purge the old lease
Nov 15 22:45:59 formationkvm3 dnsmasq-dhcp[846333]: workaround - pruning old 
lease

then the guest is able to retrieve the ip.
Nov 15 22:45:59 formationkvm3 dnsmasq-dhcp[846333]: DHCPDISCOVER(vnetpve) 
192.168.2.10 12:45:a3:ed:c8:36 no address available
Nov 15 22:46:02 formationkvm3 dnsmasq-dhcp[846333]: DHCPDISCOVER(vnetpve) 
192.168.2.10 12:45:a3:ed:c8:36
Nov 15 22:46:02 formationkvm3 dnsmasq-dhcp[846333]: DHCPOFFER(vnetpve) 
192.168.2.10 12:45:a3:ed:c8:36
Nov 15 22:46:02 formationkvm3 dnsmasq-dhcp[846333]: DHCPREQUEST(vnetpve) 
192.168.2.10 12:45:a3:ed:c8:36
Nov 15 22:46:02 formationkvm3 dnsmasq-dhcp[846333]: DHCPACK(vnetpve) 
192.168.2.10 12:45:a3:ed:c8:36 testovn1

Alexandre Derumier (1):
  purge old ip-mac lease  on dhcpreply

 src/rfc2131.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

-- 
2.39.2


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to