Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102977
b: refs/heads/master
c: e316349
h: refs/heads/master
i:
  102975: 447ad72
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jun 17, 2008
1 parent 8af4ea8 commit 9f6dc69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d6266281f8175e3ad68c28b20a609b278b47ade5
refs/heads/master: e31634931d00081c75e3fb3f3ec51a50dbf108bb
9 changes: 6 additions & 3 deletions trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
* Note: called only from the BH handler context,
* so we don't need to lock the hashes.
*/
static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
struct udphdr *uh,
__be32 saddr, __be32 daddr,
struct hlist_head udptable[])
Expand Down Expand Up @@ -1156,6 +1156,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
struct rtable *rt = (struct rtable*)skb->dst;
__be32 saddr = ip_hdr(skb)->saddr;
__be32 daddr = ip_hdr(skb)->daddr;
struct net *net;

/*
* Validate the packet.
Expand All @@ -1177,10 +1178,12 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
if (udp4_csum_init(skb, uh, proto))
goto csum_error;

net = dev_net(skb->dev);
if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
return __udp4_lib_mcast_deliver(net, skb, uh,
saddr, daddr, udptable);

sk = __udp4_lib_lookup(dev_net(skb->dev), saddr, uh->source, daddr,
sk = __udp4_lib_lookup(net, saddr, uh->source, daddr,
uh->dest, inet_iif(skb), udptable);

if (sk != NULL) {
Expand Down
12 changes: 8 additions & 4 deletions trunk/net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,9 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
* Note: called only from the BH handler context,
* so we don't need to lock the hashes.
*/
static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
struct in6_addr *daddr, struct hlist_head udptable[])
static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
struct in6_addr *saddr, struct in6_addr *daddr,
struct hlist_head udptable[])
{
struct sock *sk, *sk2;
const struct udphdr *uh = udp_hdr(skb);
Expand Down Expand Up @@ -435,6 +436,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
struct net_device *dev = skb->dev;
struct in6_addr *saddr, *daddr;
u32 ulen = 0;
struct net *net;

if (!pskb_may_pull(skb, sizeof(struct udphdr)))
goto short_packet;
Expand Down Expand Up @@ -469,19 +471,21 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
if (udp6_csum_init(skb, uh, proto))
goto discard;

net = dev_net(skb->dev);
/*
* Multicast receive code
*/
if (ipv6_addr_is_multicast(daddr))
return __udp6_lib_mcast_deliver(skb, saddr, daddr, udptable);
return __udp6_lib_mcast_deliver(net, skb,
saddr, daddr, udptable);

/* Unicast */

/*
* check socket cache ... must talk to Alan about his plans
* for sock caches... i'll skip this for now.
*/
sk = __udp6_lib_lookup(dev_net(skb->dev), saddr, uh->source,
sk = __udp6_lib_lookup(net, saddr, uh->source,
daddr, uh->dest, inet6_iif(skb), udptable);

if (sk == NULL) {
Expand Down

0 comments on commit 9f6dc69

Please sign in to comment.