Skip to contentSkip to conversation

possible bug in IPv6 MLD retransmissions

DISCUSSION Flavio Leitner 4 participants 11 messages May 17, 2013 – Jun 23, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

A tcpdump captured while adding an IPv6 link-local address shows two MLD reports. One with source ``::'' and another with the permanent address.

Well, if you increase dad_retransmits from 1 to 10, for instance, then both MLD reports are sent with source address ``::'' which according with specs should be ignored by the routers.

* 4759.429868 :: -> ff02::16 ICMPv6 90 Multicast Listener
Report Message v2
4759.890934 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4760.893868 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4761.895867 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4762.897873 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4763.899868 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
* 4764.237923 :: -> ff02::16 ICMPv6 90 Multicast Listener
Report Message v2
4764.901866 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4765.903878 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4766.905867 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4767.907864 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4768.909865 :: -> ff02::1:ffe5:a8aa ICMPv6 78 Neighbor
Solicitation for fe80::f2de:f1ff:fee5:a8aa
4769.911919 fe80::f2de:f1ff:fee5:a8aa -> ff02::2 ICMPv6 70 Router
Solicitation from f0:de:f1:e5:a8:a9
4773.917868 fe80::f2de:f1ff:fee5:a8aa -> ff02::2 ICMPv6 70 Router
Solicitation from f0:de:f1:e5:a8:a9
4777.925855 fe80::f2de:f1ff:fee5:a8aa -> ff02::2 ICMPv6 70 Router
Solicitation from f0:de:f1:e5:a8:a9

Therefore, I believe this is a bug in IPv6 MLD because it should sent at least 2 MLD reports after DAD is completed. The specs says:

rfc3810
5.2.13. Source Addresses for Reports

An MLDv2 Report MUST be sent with a valid IPv6 link-local source address, or the unspecified address (::), if the sending interface has not acquired a valid link-local address yet. Sending reports with the unspecified address is allowed to support the use of IP multicast in the Neighbor Discovery Protocol [RFC2461]. For stateless autoconfiguration, as defined in [RFC2462], a node is required to join several IPv6 multicast groups, in order to perform Duplicate Address Detection (DAD). Prior to DAD, the only address the reporting node has for the sending interface is a tentative one, which cannot be used for communication. Thus, the unspecified address must be used.

On the other hand, routers MUST silently discard a message that is not sent with a valid link-local address, without taking any action on the contents of the packet. Thus, a Report is discarded if the router cannot identify the source address of the packet as belonging to a link connected to the interface on which the packet was received. A Report sent with the unspecified address is also discarded by the router. This enhances security, as unidentified reporting nodes cannot influence the state of the MLDv2 router(s). Nevertheless, the reporting node has modified its listening state for multicast addresses that are contained in the Multicast Address Records of the Report message. From now on, it will treat packets sent to those multicast addresses according to this new listening state. ***Once a valid link-local address is available, a node
SHOULD
generate new MLDv2 Report messages for all multicast addresses joined on the interface****.
...

Does that make any sense?
Thanks,

Signature · 1 line
fbl
#1 lore raw
Quoted 10 lines · Flavio Leitner

A tcpdump captured while adding an IPv6 link-local address shows two MLD reports. One with source ``::'' and another with the permanent address.

Well, if you increase dad_retransmits from 1 to 10, for instance, then both MLD reports are sent with source address ``::'' which according with specs should be ignored by the routers.

[...]

Quoted 7 lines

Therefore, I believe this is a bug in IPv6 MLD because it should sent at least 2 MLD reports after DAD is completed. The specs says:

[..]

Does that make any sense?

Yes, this is unfortunate. RFC3590 clarifies this also for MLDv1 messages.

Could you try following patch I just came up with?

[PATCH RFC] ipv6: resend MLD report if a link-local address completes DAD

RFC3590/RFC3810 specifies we should resend MLD reports as soon as a valid link-local address is available. This patch always resends MLD reports if a link-local address completes dad (even a valid one was already available).

---
 include/net/addrconf.h |  2 ++
 net/ipv6/addrconf.c    |  9 ++++++++-
 net/ipv6/mcast.c       | 16 ++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
include/net/addrconf.h +2 -0
index 84a6440..0ec342c 100644
@@ -155,6 +155,8 @@ extern bool ipv6_chk_mcast_addr(struct net_device *dev,
 				const struct in6_addr *group,
 				const struct in6_addr *src_addr);
 
+extern void ipv6_mc_resend_report(struct inet6_dev *idev);
+
 /*
  * identify MLD packets for MLD filter exceptions
  */
net/ipv6/addrconf.c +8 -1
index d1ab6ab..c292723 100644
@@ -3272,6 +3272,7 @@ out:
 static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 {
 	struct net_device *dev = ifp->idev->dev;
+	int type = ipv6_addr_type(&ifp->addr);
 
 	/*
 	 *	Configure the address for reception. Now it is valid.
@@ -3279,6 +3280,12 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 
 	ipv6_ifa_notify(RTM_NEWADDR, ifp);
 
+	/* While dad is in progress mld report's source address is in6_addrany.
+	 * Resend with proper ll now.
+	 */
+	if (type & IPV6_ADDR_LINKLOCAL)
+		ipv6_mc_resend_report(ifp->idev);
+
 	/* If added prefix is link local and we are prepared to process
 	   router advertisements, start sending router solicitations.
 	 */
@@ -3286,7 +3293,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 	if (ipv6_accept_ra(ifp->idev) &&
 	    ifp->idev->cnf.rtr_solicits > 0 &&
 	    (dev->flags&IFF_LOOPBACK) == 0 &&
-	    (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
+	    (type & IPV6_ADDR_LINKLOCAL)) {
 		/*
 		 *	If a host as already performed a random delay
 		 *	[...] as part of DAD [...] there is no need
net/ipv6/mcast.c +16 -0
index bfa6cc3..5e3b62f 100644
@@ -1814,6 +1814,22 @@ err_out:
 	goto out;
 }
 
+void ipv6_mc_resend_report(struct inet6_dev *idev)
+{
+	if (MLD_V1_SEEN(idev)) {
+		struct ifmcaddr6 *mcaddr;
+		read_lock_bh(&idev->lock);
+		for (mcaddr = idev->mc_list; mcaddr; mcaddr = mcaddr->next) {
+			if (!(mcaddr->mca_flags & MAF_NOREPORT))
+				igmp6_send(&mcaddr->mca_addr, idev->dev,
+					   ICMPV6_MGM_REPORT);
+		}
+		read_unlock_bh(&idev->lock);
+	} else {
+		mld_send_report(idev, NULL);
+	}
+}
+
 static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
 	const struct in6_addr *psfsrc)
 {
Signature · 1 line
1.8.1.4
#2 lore raw
Quoted 15 lines · Hannes Frederic Sowa
Quoted 14 lines · Flavio Leitner

A tcpdump captured while adding an IPv6 link-local address shows two MLD reports. One with source ``::'' and another with the permanent address.

Well, if you increase dad_retransmits from 1 to 10, for instance, then both MLD reports are sent with source address ``::'' which according with specs should be ignored by the routers.

[...]

Therefore, I believe this is a bug in IPv6 MLD because it should sent at least 2 MLD reports after DAD is completed. The specs says:

Quoted 7 lines
Quoted 3 lines

[..]

Does that make any sense?

Yes, this is unfortunate. RFC3590 clarifies this also for MLDv1 messages.

Could you try following patch I just came up with?

It does work, but it would be better to send [Robustness Variable] times, right?
thanks!

[PATCH] ipv6: resend MLD report if a link-local address completes DAD

RFC3590/RFC3810 specifies we should resend MLD reports as soon as a valid link-local address is available. This patch always resends MLD reports if a link-local address completes dad (even a valid one was already available).

---
 include/net/addrconf.h |  1 +
 include/net/if_inet6.h |  2 ++
 net/ipv6/addrconf.c    |  9 ++++++++-
 net/ipv6/mcast.c       | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 1 deletion(-)
include/net/addrconf.h +1 -0
index 84a6440..ddd331c 100644
@@ -155,6 +155,7 @@ extern bool ipv6_chk_mcast_addr(struct net_device *dev,
 				const struct in6_addr *group,
 				const struct in6_addr *src_addr);
 
+extern void ipv6_mc_dad_complete(struct inet6_dev *idev);
 /*
  * identify MLD packets for MLD filter exceptions
  */
include/net/if_inet6.h +2 -0
index 100fb8c..5c195b1 100644
@@ -172,10 +172,12 @@ struct inet6_dev {
 	unsigned char		mc_qrv;
 	unsigned char		mc_gq_running;
 	unsigned char		mc_ifc_count;
+	unsigned char		mc_dad_count;
 	unsigned long		mc_v1_seen;
 	unsigned long		mc_maxdelay;
 	struct timer_list	mc_gq_timer;	/* general query timer */
 	struct timer_list	mc_ifc_timer;	/* interface change timer */
+	struct timer_list	mc_dad_timer;	/* dad complete mc timer */
 
 	struct ifacaddr6	*ac_list;
 	rwlock_t		lock;
net/ipv6/addrconf.c +8 -1
index d1ab6ab..800222b 100644
@@ -3272,6 +3272,7 @@ out:
 static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 {
 	struct net_device *dev = ifp->idev->dev;
+	int type = ipv6_addr_type(&ifp->addr);
 
 	/*
 	 *	Configure the address for reception. Now it is valid.
@@ -3279,6 +3280,12 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 
 	ipv6_ifa_notify(RTM_NEWADDR, ifp);
 
+	/* While dad is in progress mld report's source address is in6_addrany.
+	 * Resend with proper ll now.
+	 */
+	if (type & IPV6_ADDR_LINKLOCAL)
+		ipv6_mc_dad_complete(ifp->idev);
+
 	/* If added prefix is link local and we are prepared to process
 	   router advertisements, start sending router solicitations.
 	 */
@@ -3286,7 +3293,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
 	if (ipv6_accept_ra(ifp->idev) &&
 	    ifp->idev->cnf.rtr_solicits > 0 &&
 	    (dev->flags&IFF_LOOPBACK) == 0 &&
-	    (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
+	    (type & IPV6_ADDR_LINKLOCAL)) {
 		/*
 		 *	If a host as already performed a random delay
 		 *	[...] as part of DAD [...] there is no need
net/ipv6/mcast.c +47 -0

71 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#3 lore raw
Quoted 18 lines · Flavio Leitner
Quoted 17 lines · Hannes Frederic Sowa
Quoted 16 lines · Flavio Leitner

A tcpdump captured while adding an IPv6 link-local address shows two MLD reports. One with source ``::'' and another with the permanent address.

Well, if you increase dad_retransmits from 1 to 10, for instance, then both MLD reports are sent with source address ``::'' which according with specs should be ignored by the routers.

[...]

Therefore, I believe this is a bug in IPv6 MLD because it should sent at least 2 MLD reports after DAD is completed. The specs says:

[..]

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Does that make any sense?

Yes, this is unfortunate. RFC3590 clarifies this also for MLDv1 messages.

Could you try following patch I just came up with?

It does work, but it would be better to send [Robustness Variable] times, right?

Sure, this is the more robust approach.

Patch is tested and seems fine:

I tried to track if we actually used the unspecified address to send out mld reports, but doing this correctly (multiple link-local addresses in dad state) needed a bit of ugly lock handling and the code got bloated. So I do think it is not worth the effort.

Thanks,

Hannes

#4 lore raw

First, I wouldn't call this a "bug"; it is listed as a "SHOULD", not a "MUST", so
it is not required for compliance, though it is a good feature to add.

Second, I think doing this on all LL addresses unconditionally isn't a good
idea. If some configuration is using thousands of LL addrs for reasons of their
own, they would suddenly be blasted with unexpected MLD reports where they have none now. I don't see why tracking it would be such a problem -- if nothing else, you could simply add a counter for the number of valid LL addrs
incremented on DAD completion, and send these whenever it transitions from 0 to 1.

                                                +-DLS
#5 lore raw
Quoted 3 lines · David Stevens

First, I wouldn't call this a "bug"; it is listed as a "SHOULD", not a "MUST", so
it is not required for compliance, though it is a good feature to add.

Ok.

Quoted 10 lines

Second, I think doing this on all LL addresses unconditionally isn't a good
idea. If some configuration is using thousands of LL addrs for reasons of their
own, they would suddenly be blasted with unexpected MLD reports where they have none now. I don't see why tracking it would be such a problem -- if nothing else, you could simply add a counter for the number of valid LL addrs
incremented on DAD completion, and send these whenever it transitions from 0 to 1.

I understand your concerns and will revisit the patch and check if a dad_completed_counter would simplify the code.

Thanks,

Hannes

#6 lore raw
In reply to David Stevens
Quoted 4 lines · David Stevens

First, I wouldn't call this a "bug"; it is listed as a "SHOULD", not a "MUST", so
it is not required for compliance, though it is a good feature to add.

Quoted 10 lines

Second, I think doing this on all LL addresses unconditionally isn't a good
idea. If some configuration is using thousands of LL addrs for reasons of their
own, they would suddenly be blasted with unexpected MLD reports where they have none now. I don't see why tracking it would be such a problem -- if nothing else, you could simply add a counter for the number of valid LL addrs
incremented on DAD completion, and send these whenever it transitions from 0 to 1.

It becomes a bug (and that's why I started with 'possible') if dad completes after the two MLD reports sent with ``::'' source, because routers will ignore those initial reports and the system is left out.

Thanks,

Signature · 1 line
fbl
#7 lore raw

Flavio Leitner <[email protected]> wrote on 05/22/2013 01:27:11 PM:

Quoted 3 lines

It becomes a bug (and that's why I started with 'possible') if dad completes after the two MLD reports sent with ``::'' source, because routers will ignore those initial reports and the system is left out.

No, unsolicited reports are not necessary for MLD. If there are no other listeners for a group, the reports will be triggered within one query interval after a valid LL addr is there.

                                                                +-DLS
#8 lore raw
Quoted 9 lines · David Stevens

Flavio Leitner <[email protected]> wrote on 05/22/2013 01:27:11 PM:

Quoted 3 lines

It becomes a bug (and that's why I started with 'possible') if dad completes after the two MLD reports sent with ``::'' source, because routers will ignore those initial reports and the system is left out.

No, unsolicited reports are not necessary for MLD. If there are no other listeners for a group, the reports will be triggered within one query interval after a valid LL addr is there.

Agreed that they aren't necessary, but I also don't think it's a good solution to wait for the query interval.

Signature · 1 line
fbl
#9 lore raw
In reply to David Stevens
Quoted 10 lines · David Stevens

Second, I think doing this on all LL addresses unconditionally isn't a good
idea. If some configuration is using thousands of LL addrs for reasons of their
own, they would suddenly be blasted with unexpected MLD reports where they have none now. I don't see why tracking it would be such a problem -- if nothing else, you could simply add a counter for the number of valid LL addrs
incremented on DAD completion, and send these whenever it transitions from 0 to 1.

While testing some code, I noticed that we seem to have a similar problem with the generation of router soliciations. We send out MAX_RTR_SOLICITATIONS for each link-local address dad completion.

So the tracking could have some more users and I will move it to addrconf.c. I'll hope I cope with all the tiny races I found in my last version. :)

Greetings,

Hannes

#10 lore raw
Quoted 12 lines · Hannes Frederic Sowa
Quoted 10 lines · David Stevens

Second, I think doing this on all LL addresses unconditionally isn't a good
idea. If some configuration is using thousands of LL addrs for reasons of their
own, they would suddenly be blasted with unexpected MLD reports where they have none now. I don't see why tracking it would be such a problem -- if nothing else, you could simply add a counter for the number of valid LL addrs
incremented on DAD completion, and send these whenever it transitions from 0 to 1.

Quoted 7 lines

While testing some code, I noticed that we seem to have a similar problem with the generation of router soliciations. We send out MAX_RTR_SOLICITATIONS for each link-local address dad completion.

So the tracking could have some more users and I will move it to addrconf.c. I'll hope I cope with all the tiny races I found in my last version. :)

Sorry, I could not finish this patch before I got distracted with other things. I had a look at it again yesterday and came up with the following plan:

a) split up router advertisment and dad timer
b) remove src-argument from ndisc_send_rs and calculate it from the ll addresses of the interface when sending the RS
c) introduce ll_dad_completion counter
d) rebase the above patch onto this utilising the ll_dad_completion counter

Does this plan sound solid?

I plan to send out a patch for a) today.

Greetings,

Hannes