Skip to content

Commit a1fd1ad

Browse files
dsaherndavem330
authored andcommitted
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: 5fa1273 ("net: ipv4: listify ip_rcv_finish") Cc: Edward Cree <ecree@solarflare.com> Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e27775a commit a1fd1ad

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/ipv4/ip_input.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,10 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
307307
}
308308

309309
static int ip_rcv_finish_core(struct net *net, struct sock *sk,
310-
struct sk_buff *skb)
310+
struct sk_buff *skb, struct net_device *dev)
311311
{
312312
const struct iphdr *iph = ip_hdr(skb);
313313
int (*edemux)(struct sk_buff *skb);
314-
struct net_device *dev = skb->dev;
315314
struct rtable *rt;
316315
int err;
317316

@@ -400,6 +399,7 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk,
400399

401400
static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
402401
{
402+
struct net_device *dev = skb->dev;
403403
int ret;
404404

405405
/* 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)
409409
if (!skb)
410410
return NET_RX_SUCCESS;
411411

412-
ret = ip_rcv_finish_core(net, sk, skb);
412+
ret = ip_rcv_finish_core(net, sk, skb, dev);
413413
if (ret != NET_RX_DROP)
414414
ret = dst_input(skb);
415415
return ret;
@@ -545,6 +545,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
545545

546546
INIT_LIST_HEAD(&sublist);
547547
list_for_each_entry_safe(skb, next, head, list) {
548+
struct net_device *dev = skb->dev;
548549
struct dst_entry *dst;
549550

550551
skb_list_del_init(skb);
@@ -554,7 +555,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
554555
skb = l3mdev_ip_rcv(skb);
555556
if (!skb)
556557
continue;
557-
if (ip_rcv_finish_core(net, sk, skb) == NET_RX_DROP)
558+
if (ip_rcv_finish_core(net, sk, skb, dev) == NET_RX_DROP)
558559
continue;
559560

560561
dst = skb_dst(skb);

0 commit comments

Comments
 (0)