* [PATCH next v2 5/7] raw: Use l3_dev for L3 ingress raw packet delivery
@ 2016-03-09 21:50 Mahesh Bandewar
0 siblings, 0 replies; only message in thread
From: Mahesh Bandewar @ 2016-03-09 21:50 UTC (permalink / raw)
To: David Miller
Cc: Mahesh Bandewar, Eric Dumazet, netdev, Tim Hockin, Alex Pollitt,
Matthew Dupre
From: Mahesh Bandewar <maheshb@google.com>
Use the in-dev passed by the packet dispatcher for the L3 phase. If
there are places where code uses skb->dev, use the netif_get_l3_dev()
helper to get l3_dev.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
CC: Eric Dumazet <edumazet@google.com>
CC: Tim Hockin <thockin@google.com>
CC: Alex Pollitt <alex.pollitt@metaswitch.com>
CC: Matthew Dupre <matthew.dupre@metaswitch.com>
---
net/ipv4/raw.c | 11 +++++------
net/ipv6/raw.c | 2 +-
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 8d22de74080c..7802ce24a42d 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -173,22 +173,22 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash)
struct hlist_head *head;
int delivered = 0;
struct net *net;
+ struct net_device *dev = netif_get_l3_dev(skb->dev);
read_lock(&raw_v4_hashinfo.lock);
head = &raw_v4_hashinfo.ht[hash];
if (hlist_empty(head))
goto out;
- net = dev_net(skb->dev);
+ net = dev_net(dev);
sk = __raw_v4_lookup(net, __sk_head(head), iph->protocol,
iph->saddr, iph->daddr,
- skb->dev->ifindex);
+ dev->ifindex);
while (sk) {
delivered = 1;
if ((iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) &&
- ip_mc_sf_allow(sk, iph->daddr, iph->saddr,
- skb->dev->ifindex)) {
+ ip_mc_sf_allow(sk, iph->daddr, iph->saddr, dev->ifindex)) {
struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
/* Not releasing hash table! */
@@ -196,8 +196,7 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash)
raw_rcv(sk, clone);
}
sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol,
- iph->saddr, iph->daddr,
- skb->dev->ifindex);
+ iph->saddr, iph->daddr, dev->ifindex);
}
out:
read_unlock(&raw_v4_hashinfo.lock);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index fa59dd7a427e..22d001f0645d 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -175,7 +175,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
if (!sk)
goto out;
- net = dev_net(skb->dev);
+ net = dev_net(netif_get_l3_dev(skb->dev));
sk = __raw_v6_lookup(net, sk, nexthdr, daddr, saddr, inet6_iif(skb));
while (sk) {
--
2.7.0.rc3.207.g0ac5344
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-09 21:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 21:50 [PATCH next v2 5/7] raw: Use l3_dev for L3 ingress raw packet delivery Mahesh Bandewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).