[pve-devel] [PATCH dnsmasq 1/1] purge old ip-mac lease on dhcpreply

Alexandre Derumier aderumier at odiso.com
Wed Nov 15 22:58:43 CET 2023


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

diff --git a/src/rfc2131.c b/src/rfc2131.c
index 17e97b5..2a4ce76 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -1095,7 +1095,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
 
 	  if ((opt = option_find(mess, sz, OPTION_REQUESTED_IP, INADDRSZ)))	 
 	    addr = option_addr(opt);
-	  
+
 	  if (have_config(config, CONFIG_ADDR))
 	    {
 	      inet_ntop(AF_INET, &config->addr, daemon->addrbuff, ADDRSTRLEN);
@@ -1104,11 +1104,14 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
 		  ltmp != lease &&
 		  !config_has_mac(config, ltmp->hwaddr, ltmp->hwaddr_len, ltmp->hwaddr_type))
 		{
-		  int len;
-		  unsigned char *mac = extended_hwaddr(ltmp->hwaddr_type, ltmp->hwaddr_len,
-						       ltmp->hwaddr, ltmp->clid_len, ltmp->clid, &len);
-		  my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it is leased to %s"),
-			    daemon->addrbuff, print_mac(daemon->namebuff, mac, len));
+		  lease_prune(ltmp, now);
+		  my_syslog(MS_DHCP | LOG_WARNING, _("workaround - pruning old lease"));
+
+		  //int len;
+		  //unsigned char *mac = extended_hwaddr(ltmp->hwaddr_type, ltmp->hwaddr_len,
+		  //				       ltmp->hwaddr, ltmp->clid_len, ltmp->clid, &len);
+		  //my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it is leased to %s"),
+		  //	    daemon->addrbuff, print_mac(daemon->namebuff, mac, len));
 		}
 	      else
 		{
-- 
2.39.2





More information about the pve-devel mailing list