From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f193.google.com ([209.85.220.193]:45567 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbeB0TGj (ORCPT ); Tue, 27 Feb 2018 14:06:39 -0500 Received: by mail-qk0-f193.google.com with SMTP id g2so24934645qkd.12 for ; Tue, 27 Feb 2018 11:06:39 -0800 (PST) From: Stephen Suryaputra To: netdev@vger.kernel.org Cc: Stephen Suryaputra Subject: [PATCH net] vrf: check forwarding on the original netdevice when generating ICMP dest unreachable Date: Tue, 27 Feb 2018 13:36:53 -0500 Message-Id: <1519756613-11962-1-git-send-email-ssuryaextr@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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. Signed-off-by: Stephen Suryaputra --- net/ipv4/route.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a4f44d8..2274503 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -933,6 +933,7 @@ 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 inet_peer *peer; + int in_dev_forward; unsigned long now; struct net *net; bool send; @@ -943,7 +944,13 @@ static int ip_error(struct sk_buff *skb) goto out; net = dev_net(rt->dst.dev); - if (!IN_DEV_FORWARD(in_dev)) { + if (netif_is_l3_master(skb->dev)) { + in_dev_forward = IN_DEV_FORWARD( + __in_dev_get_rcu(__dev_get_by_index(net, IPCB(skb)->iif))); + } else { + in_dev_forward = IN_DEV_FORWARD(in_dev); + } + if (!in_dev_forward) { switch (rt->dst.error) { case EHOSTUNREACH: __IP_INC_STATS(net, IPSTATS_MIB_INADDRERRORS); -- 2.7.4