From: Stephen Suryaputra <ssuryaextr@gmail.com>
To: netdev@vger.kernel.org
Cc: Stephen Suryaputra <ssuryaextr@gmail.com>
Subject: [PATCH net,v2] vrf: check forwarding on the original netdevice when generating ICMP dest unreachable
Date: Wed, 28 Feb 2018 09:46:59 -0500 [thread overview]
Message-ID: <1519829219-29623-1-git-send-email-ssuryaextr@gmail.com> (raw)
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 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>
---
net/ipv4/route.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a4f44d8..89c020f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -930,19 +930,26 @@ void ip_rt_send_redirect(struct sk_buff *skb)
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;
+ net = dev_net(rt->dst.dev);
+
+ if (netif_is_l3_master(skb->dev))
+ dev = __dev_get_by_index(net, IPCB(skb)->iif);
+
+ in_dev = __in_dev_get_rcu(dev);
+
/* IP on this device is disabled. */
if (!in_dev)
goto out;
- net = dev_net(rt->dst.dev);
if (!IN_DEV_FORWARD(in_dev)) {
switch (rt->dst.error) {
case EHOSTUNREACH:
--
2.7.4
next reply other threads:[~2018-02-28 14:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 14:46 Stephen Suryaputra [this message]
2018-02-28 15:49 ` [PATCH net,v2] vrf: check forwarding on the original netdevice when generating ICMP dest unreachable David Ahern
2018-02-28 16:55 ` Stephen Suryaputra
2018-02-28 17:39 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519829219-29623-1-git-send-email-ssuryaextr@gmail.com \
--to=ssuryaextr@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.