Commit a1fd1ad2 authored by David Ahern's avatar David Ahern Committed by David S. Miller

ipv4: Pass original device to ip_rcv_finish_core

ip_route_input_rcu expects the original ingress device (e.g., for
proper multicast handling). The skb->dev can be changed by l3mdev_ip_rcv,
so dev needs to be saved prior to calling it. This was the behavior prior
to the listify changes.

Fixes: 5fa12739 ("net: ipv4: listify ip_rcv_finish")
Cc: Edward Cree <ecree@solarflare.com>
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e27775a4
...@@ -307,11 +307,10 @@ static inline bool ip_rcv_options(struct sk_buff *skb) ...@@ -307,11 +307,10 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
} }
static int ip_rcv_finish_core(struct net *net, struct sock *sk, static int ip_rcv_finish_core(struct net *net, struct sock *sk,
struct sk_buff *skb) struct sk_buff *skb, struct net_device *dev)
{ {
const struct iphdr *iph = ip_hdr(skb); const struct iphdr *iph = ip_hdr(skb);
int (*edemux)(struct sk_buff *skb); int (*edemux)(struct sk_buff *skb);
struct net_device *dev = skb->dev;
struct rtable *rt; struct rtable *rt;
int err; int err;
...@@ -400,6 +399,7 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk, ...@@ -400,6 +399,7 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk,
static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{ {
struct net_device *dev = skb->dev;
int ret; int ret;
/* if ingress device is enslaved to an L3 master device pass the /* if ingress device is enslaved to an L3 master device pass the
...@@ -409,7 +409,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) ...@@ -409,7 +409,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
if (!skb) if (!skb)
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
ret = ip_rcv_finish_core(net, sk, skb); ret = ip_rcv_finish_core(net, sk, skb, dev);
if (ret != NET_RX_DROP) if (ret != NET_RX_DROP)
ret = dst_input(skb); ret = dst_input(skb);
return ret; return ret;
...@@ -545,6 +545,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk, ...@@ -545,6 +545,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
INIT_LIST_HEAD(&sublist); INIT_LIST_HEAD(&sublist);
list_for_each_entry_safe(skb, next, head, list) { list_for_each_entry_safe(skb, next, head, list) {
struct net_device *dev = skb->dev;
struct dst_entry *dst; struct dst_entry *dst;
skb_list_del_init(skb); skb_list_del_init(skb);
...@@ -554,7 +555,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk, ...@@ -554,7 +555,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
skb = l3mdev_ip_rcv(skb); skb = l3mdev_ip_rcv(skb);
if (!skb) if (!skb)
continue; continue;
if (ip_rcv_finish_core(net, sk, skb) == NET_RX_DROP) if (ip_rcv_finish_core(net, sk, skb, dev) == NET_RX_DROP)
continue; continue;
dst = skb_dst(skb); dst = skb_dst(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment