udp: provide a struct net pointer for __udp[46]_lib_mcast_deliver
They both calculate the hash chain, but currently do not have a struct net pointer, so pass one there via additional argument, all the more so their callers already have such. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d6266281f8
commit
e31634931d
|
@ -1059,7 +1059,7 @@ drop:
|
||||||
* Note: called only from the BH handler context,
|
* Note: called only from the BH handler context,
|
||||||
* so we don't need to lock the hashes.
|
* 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,
|
struct udphdr *uh,
|
||||||
__be32 saddr, __be32 daddr,
|
__be32 saddr, __be32 daddr,
|
||||||
struct hlist_head udptable[])
|
struct hlist_head udptable[])
|
||||||
|
@ -1156,6 +1156,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
||||||
struct rtable *rt = (struct rtable*)skb->dst;
|
struct rtable *rt = (struct rtable*)skb->dst;
|
||||||
__be32 saddr = ip_hdr(skb)->saddr;
|
__be32 saddr = ip_hdr(skb)->saddr;
|
||||||
__be32 daddr = ip_hdr(skb)->daddr;
|
__be32 daddr = ip_hdr(skb)->daddr;
|
||||||
|
struct net *net;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate the packet.
|
* Validate the packet.
|
||||||
|
@ -1177,10 +1178,12 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
||||||
if (udp4_csum_init(skb, uh, proto))
|
if (udp4_csum_init(skb, uh, proto))
|
||||||
goto csum_error;
|
goto csum_error;
|
||||||
|
|
||||||
|
net = dev_net(skb->dev);
|
||||||
if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
|
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);
|
uh->dest, inet_iif(skb), udptable);
|
||||||
|
|
||||||
if (sk != NULL) {
|
if (sk != NULL) {
|
||||||
|
|
|
@ -353,8 +353,9 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
|
||||||
* Note: called only from the BH handler context,
|
* Note: called only from the BH handler context,
|
||||||
* so we don't need to lock the hashes.
|
* so we don't need to lock the hashes.
|
||||||
*/
|
*/
|
||||||
static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
|
static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
|
||||||
struct in6_addr *daddr, struct hlist_head udptable[])
|
struct in6_addr *saddr, struct in6_addr *daddr,
|
||||||
|
struct hlist_head udptable[])
|
||||||
{
|
{
|
||||||
struct sock *sk, *sk2;
|
struct sock *sk, *sk2;
|
||||||
const struct udphdr *uh = udp_hdr(skb);
|
const struct udphdr *uh = udp_hdr(skb);
|
||||||
|
@ -435,6 +436,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
||||||
struct net_device *dev = skb->dev;
|
struct net_device *dev = skb->dev;
|
||||||
struct in6_addr *saddr, *daddr;
|
struct in6_addr *saddr, *daddr;
|
||||||
u32 ulen = 0;
|
u32 ulen = 0;
|
||||||
|
struct net *net;
|
||||||
|
|
||||||
if (!pskb_may_pull(skb, sizeof(struct udphdr)))
|
if (!pskb_may_pull(skb, sizeof(struct udphdr)))
|
||||||
goto short_packet;
|
goto short_packet;
|
||||||
|
@ -469,11 +471,13 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
||||||
if (udp6_csum_init(skb, uh, proto))
|
if (udp6_csum_init(skb, uh, proto))
|
||||||
goto discard;
|
goto discard;
|
||||||
|
|
||||||
|
net = dev_net(skb->dev);
|
||||||
/*
|
/*
|
||||||
* Multicast receive code
|
* Multicast receive code
|
||||||
*/
|
*/
|
||||||
if (ipv6_addr_is_multicast(daddr))
|
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 */
|
/* Unicast */
|
||||||
|
|
||||||
|
@ -481,7 +485,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
||||||
* check socket cache ... must talk to Alan about his plans
|
* check socket cache ... must talk to Alan about his plans
|
||||||
* for sock caches... i'll skip this for now.
|
* 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);
|
daddr, uh->dest, inet6_iif(skb), udptable);
|
||||||
|
|
||||||
if (sk == NULL) {
|
if (sk == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue