summaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorStephen Suryaputra <ssuryaextr@gmail.com>2018-02-28 12:20:44 -0500
committerDavid S. Miller <davem@davemloft.net>2018-03-01 21:40:22 -0500
commite2c0dc1f1d8e31eabed412b6f154ad549986bc28 (patch)
tree622fa812bb38c1729e1b7b6179dfb03c91991791 /net/ipv4/route.c
parent50d629e7a843d1635ecb1658335279503c4ec9a8 (diff)
downloadop-kernel-dev-e2c0dc1f1d8e31eabed412b6f154ad549986bc28.zip
op-kernel-dev-e2c0dc1f1d8e31eabed412b6f154ad549986bc28.tar.gz
vrf: check forwarding on the original netdevice when generating ICMP dest unreachable
When ip_error() is called the device is the l3mdev master instead of the original device. So the forwarding check should be on the original one. Changes from v2: - Handle the original device disappearing (per David Ahern) - Minimize the change in code order Changes from v1: - Only need to reset the device on which __in_dev_get_rcu() is done (per David Ahern). Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com> Acked-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 465196e..860b3fd 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -931,14 +931,23 @@ out_put_peer:
static int ip_error(struct sk_buff *skb)
{
- struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
struct rtable *rt = skb_rtable(skb);
+ struct net_device *dev = skb->dev;
+ struct in_device *in_dev;
struct inet_peer *peer;
unsigned long now;
struct net *net;
bool send;
int code;
+ if (netif_is_l3_master(skb->dev)) {
+ dev = __dev_get_by_index(dev_net(skb->dev), IPCB(skb)->iif);
+ if (!dev)
+ goto out;
+ }
+
+ in_dev = __in_dev_get_rcu(dev);
+
/* IP on this device is disabled. */
if (!in_dev)
goto out;
OpenPOWER on IntegriCloud