[Dnsmasq-discuss] Don't reply to requests for DHCPv6 addresses when M flag is off

Win King Wan pinwing+dnsmasq at gmail.com
Mon Jan 19 21:30:25 GMT 2015


Hi,

In https://github.com/RMerl/asuswrt-merlin/pull/854 I patched the dnsmasq
version of my router's firmware to not send out replies to DHCPv6 queries
when dhcp-range mode is ra-stateless.

Even though the M flag is off in the router advertisement, Windows 8 (and
newer) clients will still request an address via DHCPv6. When it receives a
reply that no addresses are available, it tries a few more time before
giving up for several minutes. After several minutes however it retries.
This causes the syslog to be filled up with noise stating that there are no
DHCPv6 addresses available for a specific MAC address. (--quiet-dhcp6 does
not help much as the "no addresses  available" message is always logged.)

My changes basically stops dnsmasq from sending this reply. Since the O
flag is on, Windows 8 will try to get other information from the DHCPv6
server if it does not get an reply for its initial request for an address
(which seems to still work, as it is able to get the IPv6 DNS server).

After running Wireshark for quite some time, it appears that Windows 8 will
not send out subsequent requests for an IPv6 address to the DHCPv6 server
(after my patch), at least not within several minutes.

I have included the patch for completeness sake.
Would it be possible to apply it? Or perhaps there is a better or more
elegant solution to this problem?

diff --git a/src/rfc3315.c b/src/rfc3315.c
index ddb390b..1f3646a 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -824,6 +824,19 @@ static int dhcp6_no_relay(struct state *state,
int msg_type, void *inbuff, size_
 	  }
 	else
 	  {
+	    int all_stateless = 1;
+	    for (c = state->context; c; c = c->current)
+		if (!(c->flags & CONTEXT_RA_STATELESS))
+		  {
+		    all_stateless = 0;
+		    break;
+		 }
+	    if (all_stateless)
+		/* Windows 8 always requests an address even if the Managed bit
+		   in RA is 0 and it keeps retrying if it receives a reply
+		   stating that no addresses are available */
+		return 0;
+
 	    /* no address, return error */
 	    o1 = new_opt6(OPTION6_STATUS_CODE);
 	    put_opt6_short(DHCP6NOADDRS);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20150119/a980ece3/attachment.html>


More information about the Dnsmasq-discuss mailing list