Skip to contentSkip to conversation

net/ipv6/udp: Fix ipv6 multicast socket filter regression

PATCH In review Henning Rogge 3 participants 3 messages May 18, 2015 – May 19, 2015

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

PATCH 1/1 net/ipv6/udp: Fix ipv6 multicast socket filter regression

Commit <5cf3d46192fc> ("udp: Simplify__udp*_lib_mcast_deliver") simplified the filter for incoming IPv6 multicast but removed the check of the local socket address and the UDP destination address.

This patch restores the filter to prevent sockets bound to a IPv6 multicast IP to receive other UDP traffic link unicast.

Fixes 5cf3d46192fc ("udp: Simplify__udp*_lib_mcast_deliver")
Cc "David S. Miller" <[email protected]>

---
The commit above was found by me with a git bisect. I think the patch should be included into the stable kernel trees.

---
 net/ipv6/udp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/udp.c +3 -1
index 3477c919fcc8..c2ec41617a35 100644
@@ -731,7 +731,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk,
 	    (inet->inet_dport && inet->inet_dport != rmt_port) ||
 	    (!ipv6_addr_any(&sk->sk_v6_daddr) &&
 		    !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) ||
-	    (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
+	    (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) ||
+	    (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) &&
+		    !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr)))
 		return false;
 	if (!inet6_mc_check(sk, loc_addr, rmt_addr))
 		return false;
Signature · 1 line
2.1.0
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Henning Rogge

Commit <5cf3d46192fc> ("udp: Simplify__udp*_lib_mcast_deliver") simplified the filter for incoming IPv6 multicast but removed the check of the local socket address and the UDP destination address.

This patch restores the filter to prevent sockets bound to a IPv6 multicast IP to receive other UDP traffic link unicast.

Fixes 5cf3d46192fc ("udp: Simplify__udp*_lib_mcast_deliver")
Cc "David S. Miller" <[email protected]>

---
The commit above was found by me with a git bisect. I think the patch should be included into the stable kernel trees.

---
 net/ipv6/udp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/udp.c +0 -0
index 3477c919fcc8..c2ec41617a35 100644

net/ipv6/udp.c static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk, · line 739

Quoted 10 lines
net/ipv6/udp.c +3 -1
@@ -731,7 +731,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk,
 	    (inet->inet_dport && inet->inet_dport != rmt_port) ||
 	    (!ipv6_addr_any(&sk->sk_v6_daddr) &&
 		    !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) ||
-	    (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
+	    (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) ||
+	    (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) &&
+		    !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr)))
 		return false;
 	if (!inet6_mc_check(sk, loc_addr, rmt_addr))
 		return false;

Nice catch. I've CC faulty commit author.

maintainer
#2 lore raw
In reply to Henning Rogge

From: Henning Rogge <[email protected]>
Date: Mon, 18 May 2015 21:08:49 +0200

Quoted 10 lines

Commit <5cf3d46192fc> ("udp: Simplify__udp*_lib_mcast_deliver") simplified the filter for incoming IPv6 multicast but removed the check of the local socket address and the UDP destination address.

This patch restores the filter to prevent sockets bound to a IPv6 multicast IP to receive other UDP traffic link unicast.

Fixes 5cf3d46192fc ("udp: Simplify__udp*_lib_mcast_deliver")

Applied and queued up for -stable, thanks.