netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Benc <jbenc@redhat.com>
To: netdev@vger.kernel.org
Cc: Thomas Graf <tgraf@suug.ch>
Subject: [PATCH v3 net-next 12/13] ipv6: route: extend flow representation with tunnel key
Date: Thu, 20 Aug 2015 13:56:31 +0200	[thread overview]
Message-ID: <00cd2390e8d169755cc1a208f535726b9edb3adc.1440071726.git.jbenc@redhat.com> (raw)
In-Reply-To: <cover.1440071726.git.jbenc@redhat.com>

Use flowi_tunnel in flowi6 similarly to what is done with IPv4.
This complements commit 1b7179d3adff ("route: Extend flow representation
with tunnel key").

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
---
 include/net/flow.h | 1 +
 net/ipv6/route.c   | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/include/net/flow.h b/include/net/flow.h
index f305588fc162..9e0297c4c11d 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -130,6 +130,7 @@ struct flowi6 {
 #define flowi6_proto		__fl_common.flowic_proto
 #define flowi6_flags		__fl_common.flowic_flags
 #define flowi6_secid		__fl_common.flowic_secid
+#define flowi6_tun_key		__fl_common.flowic_tun_key
 	struct in6_addr		daddr;
 	struct in6_addr		saddr;
 	__be32			flowlabel;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c4f3b9fcca9d..6c0fe4c7ce8d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -54,11 +54,13 @@
 #include <net/tcp.h>
 #include <linux/rtnetlink.h>
 #include <net/dst.h>
+#include <net/dst_metadata.h>
 #include <net/xfrm.h>
 #include <net/netevent.h>
 #include <net/netlink.h>
 #include <net/nexthop.h>
 #include <net/lwtunnel.h>
+#include <net/ip_tunnels.h>
 
 #include <asm/uaccess.h>
 
@@ -1131,6 +1133,7 @@ void ip6_route_input(struct sk_buff *skb)
 	const struct ipv6hdr *iph = ipv6_hdr(skb);
 	struct net *net = dev_net(skb->dev);
 	int flags = RT6_LOOKUP_F_HAS_SADDR;
+	struct ip_tunnel_info *tun_info;
 	struct flowi6 fl6 = {
 		.flowi6_iif = skb->dev->ifindex,
 		.daddr = iph->daddr,
@@ -1140,6 +1143,9 @@ void ip6_route_input(struct sk_buff *skb)
 		.flowi6_proto = iph->nexthdr,
 	};
 
+	tun_info = skb_tunnel_info(skb);
+	if (tun_info && tun_info->mode == IP_TUNNEL_INFO_RX)
+		fl6.flowi6_tun_key.tun_id = tun_info->key.tun_id;
 	skb_dst_drop(skb);
 	skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags));
 }
-- 
1.8.3.1

  parent reply	other threads:[~2015-08-20 11:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 11:56 [PATCH v3 net-next 00/13] lwtunnel: per route ipv6 support for vxlan Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 01/13] ip_tunnels: remove custom alignment and packing Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 02/13] ip_tunnels: use u8/u16/u32 Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 03/13] ip_tunnels: use offsetofend Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 04/13] ip_tunnels: add IPv6 addresses to ip_tunnel_key Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 05/13] ip_tunnels: use tos and ttl fields also for IPv6 Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 06/13] route: move lwtunnel state to dst_entry Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 07/13] ipv6: drop metadata dst in ip6_route_input Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 08/13] ipv6: ndisc: inherit metadata dst when creating ndisc requests Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 09/13] vxlan: provide access function for vxlan socket address family Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 10/13] vxlan: do not shadow flags variable Jiri Benc
2015-08-20 11:56 ` [PATCH v3 net-next 11/13] vxlan: metadata based tunneling for IPv6 Jiri Benc
2015-08-20 11:56 ` Jiri Benc [this message]
2015-08-20 11:56 ` [PATCH v3 net-next 13/13] ipv6: route: per route IP tunnel metadata via lightweight tunnel Jiri Benc
2015-08-20 22:42 ` [PATCH v3 net-next 00/13] lwtunnel: per route ipv6 support for vxlan David Miller

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=00cd2390e8d169755cc1a208f535726b9edb3adc.1440071726.git.jbenc@redhat.com \
    --to=jbenc@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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 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).