aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/udp.c9
-rw-r--r--net/ipv6/udp.c12
2 files changed, 14 insertions, 7 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d8f527d15701..6b0acb438f34 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1059,7 +1059,7 @@ drop:
1059 * Note: called only from the BH handler context, 1059 * Note: called only from the BH handler context,
1060 * so we don't need to lock the hashes. 1060 * so we don't need to lock the hashes.
1061 */ 1061 */
1062static int __udp4_lib_mcast_deliver(struct sk_buff *skb, 1062static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1063 struct udphdr *uh, 1063 struct udphdr *uh,
1064 __be32 saddr, __be32 daddr, 1064 __be32 saddr, __be32 daddr,
1065 struct hlist_head udptable[]) 1065 struct hlist_head udptable[])
@@ -1156,6 +1156,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1156 struct rtable *rt = (struct rtable*)skb->dst; 1156 struct rtable *rt = (struct rtable*)skb->dst;
1157 __be32 saddr = ip_hdr(skb)->saddr; 1157 __be32 saddr = ip_hdr(skb)->saddr;
1158 __be32 daddr = ip_hdr(skb)->daddr; 1158 __be32 daddr = ip_hdr(skb)->daddr;
1159 struct net *net;
1159 1160
1160 /* 1161 /*
1161 * Validate the packet. 1162 * Validate the packet.
@@ -1177,10 +1178,12 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1177 if (udp4_csum_init(skb, uh, proto)) 1178 if (udp4_csum_init(skb, uh, proto))
1178 goto csum_error; 1179 goto csum_error;
1179 1180
1181 net = dev_net(skb->dev);
1180 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) 1182 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
1181 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); 1183 return __udp4_lib_mcast_deliver(net, skb, uh,
1184 saddr, daddr, udptable);
1182 1185
1183 sk = __udp4_lib_lookup(dev_net(skb->dev), saddr, uh->source, daddr, 1186 sk = __udp4_lib_lookup(net, saddr, uh->source, daddr,
1184 uh->dest, inet_iif(skb), udptable); 1187 uh->dest, inet_iif(skb), udptable);
1185 1188
1186 if (sk != NULL) { 1189 if (sk != NULL) {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 6e4a822ba651..80fb72c48976 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -353,8 +353,9 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
353 * Note: called only from the BH handler context, 353 * Note: called only from the BH handler context,
354 * so we don't need to lock the hashes. 354 * so we don't need to lock the hashes.
355 */ 355 */
356static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr, 356static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
357 struct in6_addr *daddr, struct hlist_head udptable[]) 357 struct in6_addr *saddr, struct in6_addr *daddr,
358 struct hlist_head udptable[])
358{ 359{
359 struct sock *sk, *sk2; 360 struct sock *sk, *sk2;
360 const struct udphdr *uh = udp_hdr(skb); 361 const struct udphdr *uh = udp_hdr(skb);
@@ -435,6 +436,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
435 struct net_device *dev = skb->dev; 436 struct net_device *dev = skb->dev;
436 struct in6_addr *saddr, *daddr; 437 struct in6_addr *saddr, *daddr;
437 u32 ulen = 0; 438 u32 ulen = 0;
439 struct net *net;
438 440
439 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 441 if (!pskb_may_pull(skb, sizeof(struct udphdr)))
440 goto short_packet; 442 goto short_packet;
@@ -469,11 +471,13 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
469 if (udp6_csum_init(skb, uh, proto)) 471 if (udp6_csum_init(skb, uh, proto))
470 goto discard; 472 goto discard;
471 473
474 net = dev_net(skb->dev);
472 /* 475 /*
473 * Multicast receive code 476 * Multicast receive code
474 */ 477 */
475 if (ipv6_addr_is_multicast(daddr)) 478 if (ipv6_addr_is_multicast(daddr))
476 return __udp6_lib_mcast_deliver(skb, saddr, daddr, udptable); 479 return __udp6_lib_mcast_deliver(net, skb,
480 saddr, daddr, udptable);
477 481
478 /* Unicast */ 482 /* Unicast */
479 483
@@ -481,7 +485,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
481 * check socket cache ... must talk to Alan about his plans 485 * check socket cache ... must talk to Alan about his plans
482 * for sock caches... i'll skip this for now. 486 * for sock caches... i'll skip this for now.
483 */ 487 */
484 sk = __udp6_lib_lookup(dev_net(skb->dev), saddr, uh->source, 488 sk = __udp6_lib_lookup(net, saddr, uh->source,
485 daddr, uh->dest, inet6_iif(skb), udptable); 489 daddr, uh->dest, inet6_iif(skb), udptable);
486 490
487 if (sk == NULL) { 491 if (sk == NULL) {