Skip to contentSkip to conversation

net: igmp: Use ingress interface rather than vrf device

PATCH In review David Ahern 3 participants 3 messages Aug 16, 2017

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

PATCH 1/1 net: igmp: Use ingress interface rather than vrf device

Anuradha reported that statically added groups for interfaces enslaved to a VRF device were not persisting. The problem is that igmp queries and reports need to use the data in the in_dev for the real ingress device rather than the VRF device. Update igmp_rcv accordingly.

Fixes e58e41596811 ("net: Enable support for VRF with ipv4 multicast")
---
 net/ipv4/igmp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
net/ipv4/igmp.c +9 -1
index 9f86b5133605..ab183af0b5b6 100644
@@ -1007,10 +1007,18 @@ int igmp_rcv(struct sk_buff *skb)
 {
 	/* This basically follows the spec line by line -- see RFC1112 */
 	struct igmphdr *ih;
-	struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
+	struct net_device *dev = skb->dev;
+	struct in_device *in_dev;
 	int len = skb->len;
 	bool dropped = true;
 
+	if (netif_is_l3_master(dev)) {
+		dev = dev_get_by_index_rcu(dev_net(dev), IPCB(skb)->iif);
+		if (!dev)
+			goto drop;
+	}
+
+	in_dev = __in_dev_get_rcu(dev);
 	if (!in_dev)
 		goto drop;
 
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · David Ahern

Anuradha reported that statically added groups for interfaces enslaved to a VRF device were not persisting. The problem is that igmp queries and reports need to use the data in the in_dev for the real ingress device rather than the VRF device. Update igmp_rcv accordingly.

Fixes e58e41596811 ("net: Enable support for VRF with ipv4 multicast")
---
 net/ipv4/igmp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
net/ipv4/igmp.c +2 -1
index 9f86b5133605..ab183af0b5b6 100644
@@ -1007,10 +1007,18 @@ int igmp_rcv(struct sk_buff *skb)
 {
 	/* This basically follows the spec line by line -- see RFC1112 */
 	struct igmphdr *ih;
-	struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
+	struct net_device *dev = skb->dev;
+	struct in_device *in_dev;
 	int len = skb->len;
 	bool dropped = true;
 

net/ipv4/igmp.c int igmp_rcv(struct sk_buff *skb) · line 1024

Quoted 10 lines
net/ipv4/igmp.c +7 -0
+	if (netif_is_l3_master(dev)) {
+		dev = dev_get_by_index_rcu(dev_net(dev), IPCB(skb)->iif);
+		if (!dev)
+			goto drop;
+	}
+
+	in_dev = __in_dev_get_rcu(dev);
 	if (!in_dev)
 		goto drop;
 
maintainer
#2 lore raw
In reply to David Ahern

From: David Ahern <[email protected]>
Date: Tue, 15 Aug 2017 18:38:42 -0700

Quoted 8 lines

Anuradha reported that statically added groups for interfaces enslaved to a VRF device were not persisting. The problem is that igmp queries and reports need to use the data in the in_dev for the real ingress device rather than the VRF device. Update igmp_rcv accordingly.

Fixes e58e41596811 ("net: Enable support for VRF with ipv4 multicast")

Applied and queued up for -stable, thanks.