From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH dnsmasq 0/1] purge previous ip/mac lease of dhcp reply
Date: Wed, 15 Nov 2023 22:58:42 +0100 [thread overview]
Message-ID: <20231115215843.856752-1-aderumier@odiso.com> (raw)
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
next reply other threads:[~2023-11-15 21:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 21:58 Alexandre Derumier [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231115215843.856752-1-aderumier@odiso.com \
--to=aderumier@odiso.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.