Skip to content

Commit 9d1a6c4

Browse files
David Aherndavem330
authored andcommitted
net: icmp_route_lookup should use rt dev to determine L3 domain
icmp_send is called in response to some event. The skb may not have the device set (skb->dev is NULL), but it is expected to have an rt. Update icmp_route_lookup to use the rt on the skb to determine L3 domain. Fixes: 613d09b ("net: Use VRF device index for lookups on TX") Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fd6f24d commit 9d1a6c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv4/icmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
477477
fl4->flowi4_proto = IPPROTO_ICMP;
478478
fl4->fl4_icmp_type = type;
479479
fl4->fl4_icmp_code = code;
480-
fl4->flowi4_oif = l3mdev_master_ifindex(skb_in->dev);
480+
fl4->flowi4_oif = l3mdev_master_ifindex(skb_dst(skb_in)->dev);
481481

482482
security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4));
483483
rt = __ip_route_output_key_hash(net, fl4,
@@ -502,7 +502,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
502502
if (err)
503503
goto relookup_failed;
504504

505-
if (inet_addr_type_dev_table(net, skb_in->dev,
505+
if (inet_addr_type_dev_table(net, skb_dst(skb_in)->dev,
506506
fl4_dec.saddr) == RTN_LOCAL) {
507507
rt2 = __ip_route_output_key(net, &fl4_dec);
508508
if (IS_ERR(rt2))

0 commit comments

Comments
 (0)