netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] vrf: check the original netdevice for generating redirect
@ 2018-06-01  4:05 Stephen Suryaputra
  2018-06-03 14:34 ` David Miller
  2018-06-03 15:31 ` David Ahern
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Suryaputra @ 2018-06-01  4:05 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Suryaputra

Use the right device to determine if redirect should be sent especially
when using vrf. Same as well as when sending the redirect.

Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
---
 net/ipv6/ip6_output.c | 3 ++-
 net/ipv6/ndisc.c      | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 7b6d168..af49f6c 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -507,7 +507,8 @@ int ip6_forward(struct sk_buff *skb)
 	   send redirects to source routed frames.
 	   We don't send redirects to frames decapsulated from IPsec.
 	 */
-	if (skb->dev == dst->dev && opt->srcrt == 0 && !skb_sec_path(skb)) {
+	if (IP6CB(skb)->iif == dst->dev->ifindex &&
+	    opt->srcrt == 0 && !skb_sec_path(skb)) {
 		struct in6_addr *target = NULL;
 		struct inet_peer *peer;
 		struct rt6_info *rt;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 9de4dfb1..525051a 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1576,6 +1576,12 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 	   ops_data_buf[NDISC_OPS_REDIRECT_DATA_SPACE], *ops_data = NULL;
 	bool ret;
 
+	if (netif_is_l3_master(skb->dev)) {
+		dev = __dev_get_by_index(dev_net(skb->dev), IPCB(skb)->iif);
+		if (!dev)
+			return;
+	}
+
 	if (ipv6_get_lladdr(dev, &saddr_buf, IFA_F_TENTATIVE)) {
 		ND_PRINTK(2, warn, "Redirect: no link-local address on %s\n",
 			  dev->name);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] vrf: check the original netdevice for generating redirect
  2018-06-01  4:05 [PATCH net] vrf: check the original netdevice for generating redirect Stephen Suryaputra
@ 2018-06-03 14:34 ` David Miller
  2018-06-03 15:31 ` David Ahern
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-06-03 14:34 UTC (permalink / raw)
  To: ssuryaextr; +Cc: netdev, dsa

From: Stephen Suryaputra <ssuryaextr@gmail.com>
Date: Fri,  1 Jun 2018 00:05:21 -0400

> Use the right device to determine if redirect should be sent especially
> when using vrf. Same as well as when sending the redirect.
> 
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>

David A., please review.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] vrf: check the original netdevice for generating redirect
  2018-06-01  4:05 [PATCH net] vrf: check the original netdevice for generating redirect Stephen Suryaputra
  2018-06-03 14:34 ` David Miller
@ 2018-06-03 15:31 ` David Ahern
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-06-03 15:31 UTC (permalink / raw)
  To: Stephen Suryaputra, netdev

On 5/31/18 10:05 PM, Stephen Suryaputra wrote:
> Use the right device to determine if redirect should be sent especially
> when using vrf. Same as well as when sending the redirect.
> 
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
> ---
>  net/ipv6/ip6_output.c | 3 ++-
>  net/ipv6/ndisc.c      | 6 ++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)

skb->dev in this path is set to the vrf device if applicable, so yes the
change is needed. Thanks for the fix.

Acked-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-03 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01  4:05 [PATCH net] vrf: check the original netdevice for generating redirect Stephen Suryaputra
2018-06-03 14:34 ` David Miller
2018-06-03 15:31 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).