Skip to contentSkip to conversation

udp: restore UDPlite many-cast delivery

PATCH In review Pablo Neira Ayuso 3 participants 3 messages Nov 14, 2016 – Nov 16, 2016

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

PATCH 1/1 udp: restore UDPlite many-cast delivery

Honor udptable parameter that is passed to __udp*_lib_mcast_deliver(), otherwise udplite broadcast/multicast use the wrong table and it breaks.

Fixes 2dc41cff7545 ("udp: Use hash2 for long hash1 chains in __udp*_lib_mcast_deliver.")

---
It looks like UDPlite accidentally broke when dealing with long UDP many-cast chains, give the wrong table is used for udplite. Compile tested only.

 net/ipv4/udp.c | 6 +++---
 net/ipv6/udp.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/udp.c +3 -3
index 195992e0440d..5b5a552a2804 100644
@@ -1731,10 +1731,10 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 
 	if (use_hash2) {
 		hash2_any = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum) &
-			    udp_table.mask;
-		hash2 = udp4_portaddr_hash(net, daddr, hnum) & udp_table.mask;
+			    udptable->mask;
+		hash2 = udp4_portaddr_hash(net, daddr, hnum) & udptable->mask;
 start_lookup:
-		hslot = &udp_table.hash2[hash2];
+		hslot = &udptable->hash2[hash2];
 		offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
 	}
 
net/ipv6/udp.c +3 -3
index a7700bbf6788..a9dd23d5c3c4 100644
@@ -688,10 +688,10 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 
 	if (use_hash2) {
 		hash2_any = udp6_portaddr_hash(net, &in6addr_any, hnum) &
-			    udp_table.mask;
-		hash2 = udp6_portaddr_hash(net, daddr, hnum) & udp_table.mask;
+			    udptable->mask;
+		hash2 = udp6_portaddr_hash(net, daddr, hnum) & udptable->mask;
 start_lookup:
-		hslot = &udp_table.hash2[hash2];
+		hslot = &udptable->hash2[hash2];
 		offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
 	}
 
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Pablo Neira Ayuso

Honor udptable parameter that is passed to __udp*_lib_mcast_deliver(), otherwise udplite broadcast/multicast use the wrong table and it breaks.

Fixes 2dc41cff7545 ("udp: Use hash2 for long hash1 chains in __udp*_lib_mcast_deliver.")

---
It looks like UDPlite accidentally broke when dealing with long UDP many-cast chains, give the wrong table is used for udplite. Compile tested only.

Good catch. Looks like some people actually use UDPlite ;)

Thanks Pablo.

maintainer
#2 lore raw
In reply to Pablo Neira Ayuso

From: Pablo Neira Ayuso <[email protected]>
Date: Mon, 14 Nov 2016 23:40:30 +0100

Quoted 5 lines

Honor udptable parameter that is passed to __udp*_lib_mcast_deliver(), otherwise udplite broadcast/multicast use the wrong table and it breaks.

Fixes 2dc41cff7545 ("udp: Use hash2 for long hash1 chains in __udp*_lib_mcast_deliver.")

Applied and queued up for -stable, thanks Pablo.