All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel
@ 2019-08-23 17:51 Alexey Kodanev
  2019-08-23 17:59 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexey Kodanev @ 2019-08-23 17:51 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, David Miller, Alexey Kodanev

When using mpls over gre/gre6 setup, rt->rt_gw4 address is not set, the
same for rt->rt_gw_family.  Therefore, when rt->rt_gw_family is checked
in mpls_xmit(), neigh_xmit() call is skipped. As a result, such setup
doesn't work anymore.

This issue was found with LTP mpls03 tests.

Fixes: 1550c171935d ("ipv4: Prepare rtable for IPv6 gateway")
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 net/mpls/mpls_iptunnel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index d25e91d..44b6750 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -133,12 +133,12 @@ static int mpls_xmit(struct sk_buff *skb)
 	mpls_stats_inc_outucastpkts(out_dev, skb);
 
 	if (rt) {
-		if (rt->rt_gw_family == AF_INET)
-			err = neigh_xmit(NEIGH_ARP_TABLE, out_dev, &rt->rt_gw4,
-					 skb);
-		else if (rt->rt_gw_family == AF_INET6)
+		if (rt->rt_gw_family == AF_INET6)
 			err = neigh_xmit(NEIGH_ND_TABLE, out_dev, &rt->rt_gw6,
 					 skb);
+		else
+			err = neigh_xmit(NEIGH_ARP_TABLE, out_dev, &rt->rt_gw4,
+					 skb);
 	} else if (rt6) {
 		if (ipv6_addr_v4mapped(&rt6->rt6i_gateway)) {
 			/* 6PE (RFC 4798) */
-- 
1.8.3.1


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

* Re: [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel
  2019-08-23 17:51 [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel Alexey Kodanev
@ 2019-08-23 17:59 ` David Ahern
  2019-08-23 22:12   ` David Miller
  2019-08-25 16:23 ` David Ahern
  2019-08-25 21:35 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2019-08-23 17:59 UTC (permalink / raw)
  To: Alexey Kodanev, netdev; +Cc: David Miller

On 8/23/19 1:51 PM, Alexey Kodanev wrote:
> When using mpls over gre/gre6 setup, rt->rt_gw4 address is not set, the
> same for rt->rt_gw_family.  Therefore, when rt->rt_gw_family is checked
> in mpls_xmit(), neigh_xmit() call is skipped. As a result, such setup
> doesn't work anymore.
> 
> This issue was found with LTP mpls03 tests.
> 
> Fixes: 1550c171935d ("ipv4: Prepare rtable for IPv6 gateway")
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
>  net/mpls/mpls_iptunnel.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Thanks for the report and patch. On first glance, it seems odd that
neigh_xmit could be called with rt_gw4 (formerly rt_gateway) set to 0
and if it is non-zero, why isn't family set.

I am traveling today and doubt I will be able to take a deep look at
this until Monday.

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

* Re: [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel
  2019-08-23 17:59 ` David Ahern
@ 2019-08-23 22:12   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-08-23 22:12 UTC (permalink / raw)
  To: dsahern; +Cc: alexey.kodanev, netdev

From: David Ahern <dsahern@gmail.com>
Date: Fri, 23 Aug 2019 13:59:05 -0400

> I am traveling today and doubt I will be able to take a deep look at
> this until Monday.

I'll wait until you've had a chance to review this properly.

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

* Re: [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel
  2019-08-23 17:51 [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel Alexey Kodanev
  2019-08-23 17:59 ` David Ahern
@ 2019-08-25 16:23 ` David Ahern
  2019-08-25 21:35 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2019-08-25 16:23 UTC (permalink / raw)
  To: Alexey Kodanev, netdev; +Cc: David Miller

On 8/23/19 11:51 AM, Alexey Kodanev wrote:
> When using mpls over gre/gre6 setup, rt->rt_gw4 address is not set, the
> same for rt->rt_gw_family.  Therefore, when rt->rt_gw_family is checked
> in mpls_xmit(), neigh_xmit() call is skipped. As a result, such setup
> doesn't work anymore.
> 
> This issue was found with LTP mpls03 tests.
> 
> Fixes: 1550c171935d ("ipv4: Prepare rtable for IPv6 gateway")
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
>  net/mpls/mpls_iptunnel.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

ok, I see now. This is a device only route with MPLS encap:

10.23.0.1  encap mpls  60 dev ltp_v0 scope link

and the change reverts to 5.1 behavior unless the gateway is IPv6 (new
behavior). Thanks for the patch.

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

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

* Re: [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel
  2019-08-23 17:51 [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel Alexey Kodanev
  2019-08-23 17:59 ` David Ahern
  2019-08-25 16:23 ` David Ahern
@ 2019-08-25 21:35 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-08-25 21:35 UTC (permalink / raw)
  To: alexey.kodanev; +Cc: netdev, dsahern

From: Alexey Kodanev <alexey.kodanev@oracle.com>
Date: Fri, 23 Aug 2019 20:51:43 +0300

> When using mpls over gre/gre6 setup, rt->rt_gw4 address is not set, the
> same for rt->rt_gw_family.  Therefore, when rt->rt_gw_family is checked
> in mpls_xmit(), neigh_xmit() call is skipped. As a result, such setup
> doesn't work anymore.
> 
> This issue was found with LTP mpls03 tests.
> 
> Fixes: 1550c171935d ("ipv4: Prepare rtable for IPv6 gateway")
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>

Applied and queued up for v5.2 -stable.

Thanks.

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

end of thread, other threads:[~2019-08-25 21:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23 17:51 [PATCH net] ipv4: mpls: fix mpls_xmit for iptunnel Alexey Kodanev
2019-08-23 17:59 ` David Ahern
2019-08-23 22:12   ` David Miller
2019-08-25 16:23 ` David Ahern
2019-08-25 21:35 ` David Miller

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.