Commit a1632e96 authored by David Ahern's avatar David Ahern Committed by Greg Kroah-Hartman

net: icmp_route_lookup should use rt dev to determine L3 domain

[ Upstream commit 9d1a6c4e ]

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: 613d09b3 ("net: Use VRF device index for lookups on TX")
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9885f474
...@@ -477,7 +477,7 @@ static struct rtable *icmp_route_lookup(struct net *net, ...@@ -477,7 +477,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
fl4->flowi4_proto = IPPROTO_ICMP; fl4->flowi4_proto = IPPROTO_ICMP;
fl4->fl4_icmp_type = type; fl4->fl4_icmp_type = type;
fl4->fl4_icmp_code = code; fl4->fl4_icmp_code = code;
fl4->flowi4_oif = l3mdev_master_ifindex(skb_in->dev); fl4->flowi4_oif = l3mdev_master_ifindex(skb_dst(skb_in)->dev);
security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4)); security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4));
rt = __ip_route_output_key_hash(net, fl4, rt = __ip_route_output_key_hash(net, fl4,
...@@ -502,7 +502,7 @@ static struct rtable *icmp_route_lookup(struct net *net, ...@@ -502,7 +502,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
if (err) if (err)
goto relookup_failed; goto relookup_failed;
if (inet_addr_type_dev_table(net, skb_in->dev, if (inet_addr_type_dev_table(net, skb_dst(skb_in)->dev,
fl4_dec.saddr) == RTN_LOCAL) { fl4_dec.saddr) == RTN_LOCAL) {
rt2 = __ip_route_output_key(net, &fl4_dec); rt2 = __ip_route_output_key(net, &fl4_dec);
if (IS_ERR(rt2)) if (IS_ERR(rt2))
......
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