public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH dnsmasq 0/1] purge previous ip/mac lease of dhcp reply
@ 2023-11-15 21:58 Alexandre Derumier
  2023-11-15 21:58 ` [pve-devel] [PATCH dnsmasq 1/1] purge old ip-mac lease on dhcpreply Alexandre Derumier
  2023-11-16  9:43 ` [pve-devel] [PATCH dnsmasq 0/1] purge previous ip/mac lease of dhcp reply Stefan Hanreich
  0 siblings, 2 replies; 11+ messages in thread
From: Alexandre Derumier @ 2023-11-15 21:58 UTC (permalink / raw)
  To: pve-devel

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




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-11-17 10:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 21:58 [pve-devel] [PATCH dnsmasq 0/1] purge previous ip/mac lease of dhcp reply Alexandre Derumier
2023-11-15 21:58 ` [pve-devel] [PATCH dnsmasq 1/1] purge old ip-mac lease on dhcpreply Alexandre Derumier
2023-11-16  9:43 ` [pve-devel] [PATCH dnsmasq 0/1] purge previous ip/mac lease of dhcp reply Stefan Hanreich
2023-11-16 13:47   ` DERUMIER, Alexandre
2023-11-17  6:49     ` DERUMIER, Alexandre
2023-11-17  8:55       ` Wolfgang Bumiller
2023-11-17  9:19         ` DERUMIER, Alexandre
2023-11-17  9:42           ` DERUMIER, Alexandre
2023-11-17 10:46             ` DERUMIER, Alexandre
2023-11-17 10:49               ` Stefan Hanreich
2023-11-17 10:52                 ` DERUMIER, Alexandre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal