netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ip_tunnel: Use mark in skb by default
@ 2018-01-23  3:46 Thomas Winter
  2018-01-24 21:31 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Winter @ 2018-01-23  3:46 UTC (permalink / raw)
  To: netdev
  Cc: Thomas Winter, Thomas Winter, David S. Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI

This allows marks set by connmark in iptables
to be used for route lookups.

Signed-off-by: Thomas Winter <thomas.winter@alliedtelesis.co.nz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
---
 net/ipv4/ip_tunnel.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 5ddb1cb52bd4..141f5e865731 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -711,9 +711,16 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
 		}
 	}
 
-	init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr,
-			 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link,
-			 tunnel->fwmark);
+	if (tunnel->fwmark) {
+		init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr,
+				 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link,
+				 tunnel->fwmark);
+	}
+	else {
+		init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr,
+				 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link,
+				 skb->mark);
+	}
 
 	if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0)
 		goto tx_error;
-- 
2.15.1

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

* Re: [PATCH] ip_tunnel: Use mark in skb by default
  2018-01-23  3:46 [PATCH] ip_tunnel: Use mark in skb by default Thomas Winter
@ 2018-01-24 21:31 ` David Miller
  2018-02-14 21:26   ` Thomas Winter
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2018-01-24 21:31 UTC (permalink / raw)
  To: Thomas.Winter; +Cc: netdev, kuznet, yoshfuji

From: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
Date: Tue, 23 Jan 2018 16:46:24 +1300

> This allows marks set by connmark in iptables
> to be used for route lookups.
> 
> Signed-off-by: Thomas Winter <thomas.winter@alliedtelesis.co.nz>

Applied to net-next, thanks.

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

* Re: [PATCH] ip_tunnel: Use mark in skb by default
  2018-01-24 21:31 ` David Miller
@ 2018-02-14 21:26   ` Thomas Winter
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Winter @ 2018-02-14 21:26 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, kuznet, yoshfuji

Hello David Miller,

Would this patch be able to be reverted? We have found in further testing that this produces undesired results.

For example, using some PBR rule that uses conntrack to set the skb->mark and the desired nexthop is a tunnel then the tunnel route selection hits a routing loop as the skb->mark is the mark of the encapsulated traffic and route selected by init_tunnel_flow is via tunnel itself.

Regards,
Thomas Winter
________________________________________
From: David Miller <davem@davemloft.net>
Sent: 25 January 2018 10:31
To: Thomas Winter
Cc: netdev@vger.kernel.org; kuznet@ms2.inr.ac.ru; yoshfuji@linux-ipv6.org
Subject: Re: [PATCH] ip_tunnel: Use mark in skb by default

From: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
Date: Tue, 23 Jan 2018 16:46:24 +1300

> This allows marks set by connmark in iptables
> to be used for route lookups.
>
> Signed-off-by: Thomas Winter <thomas.winter@alliedtelesis.co.nz>

Applied to net-next, thanks.

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

end of thread, other threads:[~2018-02-14 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23  3:46 [PATCH] ip_tunnel: Use mark in skb by default Thomas Winter
2018-01-24 21:31 ` David Miller
2018-02-14 21:26   ` Thomas Winter

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).