Skip to content

Commit 91d41b6

Browse files
committed
dnsmasq: backport tweak ICMP ping logic for DHCPv4
Don't start ping-check of address in DHCP discover if there already exists a lease for the address. It has been reported under some circumstances android and netbooted windows devices can reply to ICMP pings if they have a lease and thus block the allocation of the IP address the device already has during boot. Signed-off-by: Hans Dedecker <[email protected]>
1 parent cca765f commit 91d41b6

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

package/network/services/dnsmasq/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
99

1010
PKG_NAME:=dnsmasq
1111
PKG_VERSION:=2.77
12-
PKG_RELEASE:=1
12+
PKG_RELEASE:=2
1313

1414
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
1515
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 4bb68866a8aeb31db8100492bceae051e33be5d0 Mon Sep 17 00:00:00 2001
2+
From: Simon Kelley <[email protected]>
3+
Date: Thu, 15 Jun 2017 23:18:44 +0100
4+
Subject: [PATCH] Tweak ICMP ping check logic for DHCPv4.
5+
6+
---
7+
src/rfc2131.c | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/rfc2131.c b/src/rfc2131.c
11+
index 1c850e5..75792da 100644
12+
--- a/src/rfc2131.c
13+
+++ b/src/rfc2131.c
14+
@@ -1040,7 +1040,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
15+
else if (have_config(config, CONFIG_DECLINED) &&
16+
difftime(now, config->decline_time) < (float)DECLINE_BACKOFF)
17+
my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it was previously declined"), addrs);
18+
- else if (!do_icmp_ping(now, config->addr, 0, loopback))
19+
+ else if ((!lease || lease->addr.s_addr != config->addr.s_addr) && !do_icmp_ping(now, config->addr, 0, loopback))
20+
my_syslog(MS_DHCP | LOG_WARNING, _("not using configured address %s because it is in use by another host"), addrs);
21+
else
22+
conf = config->addr;
23+
--
24+
1.9.1
25+

0 commit comments

Comments
 (0)