openvswitch: add IPv6 tunneling support
Subsystems (4)
v2 cover openvswitch: add IPv6 tunneling support
This builds on the previous work that added IPv6 support to lwtunnels and adds IPv6 tunneling support to ovs.
To use IPv6 tunneling, there needs to be a metadata based tunnel net_device created and added to the ovs bridge. Currently, only vxlan is supported by the kernel, with geneve to follow shortly. There's no need nor intent to add a support for this into the vport-vxlan (etc.) compat layer.
Jiri Benc (4):
openvswitch: add tunnel protocol to sw_flow_key
openvswitch: netlink attributes for IPv6 tunneling
ip_tunnels: introduce ip6_tunnel_key_init
openvswitch: IPv6 support for ovs_tunnel_get_egress_info
include/net/dst_metadata.h | 18 ++---- include/net/ip_tunnels.h | 40 +++++++++--- include/uapi/linux/openvswitch.h | 2 + net/openvswitch/flow.c | 4 +- net/openvswitch/flow.h | 1 + net/openvswitch/flow_netlink.c | 129 +++++++++++++++++++++++++++------------ net/openvswitch/flow_table.c | 2 +- net/openvswitch/vport-geneve.c | 4 +- net/openvswitch/vport-gre.c | 4 +- net/openvswitch/vport-vxlan.c | 6 +- net/openvswitch/vport.c | 62 +++++++++++++------ net/openvswitch/vport.h | 26 ++++++++ 12 files changed, 211 insertions(+), 87 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/4 openvswitch: add tunnel protocol to sw_flow_key
Store tunnel protocol (AF_INET or AF_INET6) in sw_flow_key. This field now also acts as an indicator whether the flow contains tunnel data (this was previously indicated by tun_key.u.ipv4.dst being set but with IPv6 addresses in an union with IPv4 ones this won't work anymore).
The new field was added to a hole in sw_flow_key.
---
v2: Set the tun_proto mask to 0xff in ip_tun_from_nlattr.
--- net/openvswitch/flow.c | 4 ++-- net/openvswitch/flow.h | 1 + net/openvswitch/flow_netlink.c | 10 ++++++++-- net/openvswitch/flow_table.c | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-)
net/openvswitch/flow.c +2 -2
@@ -698,8 +698,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, {/* Extract metadata from packet. */ if (tun_info) { -if (ip_tunnel_info_af (tun_info) !=AF_INET ) -return -EINVAL ; + key->tun_proto =ip_tunnel_info_af (tun_info);memcpy (&key->tun_key, &tun_info->key,sizeof (key->tun_key));if (tun_info->options_len) {
@@ -714,6 +713,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, key->tun_opts_len =0 ; } }else { + key->tun_proto =0 ; key->tun_opts_len =0 ;memset (&key->tun_key,0 ,sizeof (key->tun_key)); }
net/openvswitch/flow.h +1 -0
@@ -63,6 +63,7 @@ struct sw_flow_key {u32 skb_mark;/* SKB mark. */ u16 in_port;/* Input switch port (or DP_MAX_PORTS). */ }__packed phy;/* Safe when right after 'tun_key'. */ +u8 tun_proto;/* Protocol of encapsulating tunnel. */ u32 ovs_flow_hash;/* Datapath computed hash value. */ u32 recirc_id;/* Recirculation ID. */ struct {
net/openvswitch/flow_netlink.c +8 -2
@@ -643,6 +643,10 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr, }SW_FLOW_KEY_PUT (match, tun_key.tun_flags, tun_flags, is_mask); +if (is_mask) +SW_FLOW_KEY_MEMSET_FIELD (match, tun_proto,0xff , true); +else +SW_FLOW_KEY_PUT (match, tun_proto,AF_INET , false);if (rem >0 ) { OVS_NLERR(log, "IPv4 tunnel attribute has %d unknown bytes.",
@@ -1194,7 +1198,7 @@ int ovs_nla_get_match(struct net *net, struct sw_flow_match *match,/* The userspace does not send tunnel attributes that * are 0, but we should not wildcard them nonetheless. */ -if (match->key->tun_key.u.ipv4.dst) +if (match->key->tun_proto)SW_FLOW_KEY_MEMSET_FIELD (match, tun_key,0xff , true);
@@ -1367,7 +1371,7 @@ static int __ovs_nla_put_key(const struct sw_flow_key *swkey,if (nla_put_u32 (skb,OVS_KEY_ATTR_PRIORITY , output->phy.priority)) goto nla_put_failure; -if ((swkey->tun_key.u.ipv4.dst || is_mask)) { +if ((swkey->tun_proto || is_mask)) {const void *opts =NULL ;if (output->tun_key.tun_flags &TUNNEL_OPTIONS_PRESENT )
@@ -1913,6 +1917,8 @@ static int validate_and_copy_set_tun(const struct nlattr *attr, tun_info = &tun_dst->u.tun_info; tun_info->mode =IP_TUNNEL_INFO_TX ; +if (key.tun_proto ==AF_INET6 ) + tun_info->mode |=IP_TUNNEL_INFO_IPV6 ; tun_info->key = key.tun_key;/* We need to store the options in the action itself since
net/openvswitch/flow_table.c +1 -1
@@ -427,7 +427,7 @@ static u32 flow_hash(const struct sw_flow_key *key,static int flow_key_start (const struct sw_flow_key *key) { -if (key->tun_key.u.ipv4.dst) +if (key->tun_proto)return 0 ;else return rounddown(offsetof(struct sw_flow_key, phy),
Signature · 1 line
1.8.3.1
Re: [PATCH net-next v2 1/4] openvswitch: add tunnel protocol to sw_flow_key
Quoted 11 lines · Jiri Benc
Store tunnel protocol (
AF_INETorAF_INET6) insw_flow_key. This field now also acts as an indicator whether the flow contains tunnel data (this was previously indicated by tun_key.u.ipv4.dst being set but with IPv6 addresses in an union with IPv4 ones this won't work anymore).The new field was added to a hole in
sw_flow_key.Signed-off-by Jiri Benc <[email protected]>---
v2: Set thetun_protomask to0xffinip_tun_from_nlattr.
---
PATCH v2 2/4 openvswitch: netlink attributes for IPv6 tunneling
In reply to Jiri BencAdd netlink attributes for IPv6 tunnel addresses. This enables IPv6 support for tunnels.
---
v2: Changed description. Rebased tun_proto assignment in ip_tun_from_nlattr
to accomodate changes in the previous patch.
--- include/uapi/linux/openvswitch.h | 2 + net/openvswitch/flow_netlink.c | 121 +++++++++++++++++++++++++++------------ 2 files changed, 86 insertions(+), 37 deletions(-)
include/uapi/linux/openvswitch.h +2 -0
@@ -349,6 +349,8 @@ enum ovs_tunnel_key_attr {OVS_TUNNEL_KEY_ATTR_TP_SRC ,/* be16 src Transport Port. */ OVS_TUNNEL_KEY_ATTR_TP_DST ,/* be16 dst Transport Port. */ OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS ,/* Nested OVS_VXLAN_EXT_* */ +OVS_TUNNEL_KEY_ATTR_IPV6_SRC ,/* struct in6_addr src IPv6 address. */ +OVS_TUNNEL_KEY_ATTR_IPV6_DST ,/* struct in6_addr dst IPv6 address. */ __OVS_TUNNEL_KEY_ATTR_MAX };
net/openvswitch/flow_netlink.c +84 -37
230 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH net-next v2 2/4] openvswitch: netlink attributes for IPv6 tunneling
Quoted 8 lines · Jiri Benc
Add netlink attributes for IPv6 tunnel addresses. This enables IPv6 support for tunnels.
Signed-off-by Jiri Benc <[email protected]>---
v2: Changed description. Rebasedtun_protoassignment inip_tun_from_nlattr
to accomodate changes in the previous patch.
---
PATCH v2 3/4 ip_tunnels: introduce ip6_tunnel_key_init
In reply to Jiri BencWe already have ip_tunnel_key_init, this does the same for IPv6. Will be used also by openvswitch in the next patch.
---
New patch in v2 of the set.
--- include/net/dst_metadata.h | 18 ++++++------------ include/net/ip_tunnels.h | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 21 deletions(-)
include/net/dst_metadata.h +6 -12
@@ -85,23 +85,17 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb, {const struct ipv6hdr *ip6h =ipv6_hdr (skb);struct metadata_dst *tun_dst; -struct ip_tunnel_info *info; tun_dst =tun_rx_dst (md_size);if (!tun_dst)return NULL ; - info = &tun_dst->u.tun_info; - info->mode =IP_TUNNEL_INFO_IPV6 ; - info->key.tun_flags = flags; - info->key.tun_id = tunnel_id; - info->key.tp_src =0 ; - info->key.tp_dst =0 ; - - info->key.u.ipv6.src = ip6h->saddr; - info->key.u.ipv6.dst = ip6h->daddr; - info->key.tos =ipv6_get_dsfield (ip6h); - info->key.ttl = ip6h->hop_limit; + tun_dst->u.tun_info.mode =IP_TUNNEL_INFO_IPV6 ; +ip6_tunnel_key_init (&tun_dst->u.tun_info.key, + &ip6h->saddr, &ip6h->daddr, +ipv6_get_dsfield (ip6h), ip6h->hop_limit, +0 ,0 , tunnel_id, flags); +return tun_dst; }
include/net/ip_tunnels.h +31 -9
@@ -179,17 +179,12 @@ int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,int ip_tunnel_encap_del_ops (const struct ip_tunnel_encap_ops *op,unsigned int num); -static inline void ip_tunnel_key_init (struct ip_tunnel_key *key, -__be32 saddr,__be32 daddr, -u8 tos,u8 ttl, -__be16 tp_src,__be16 tp_dst, -__be64 tun_id,__be16 tun_flags) +static inline void __ip_tunnel_key_init (struct ip_tunnel_key *key, +u8 tos,u8 ttl, +__be16 tp_src,__be16 tp_dst, +__be64 tun_id,__be16 tun_flags) { key->tun_id = tun_id; - key->u.ipv4.src = saddr; - key->u.ipv4.dst = daddr; -memset ((unsigned char *)key +IP_TUNNEL_KEY_IPV4_PAD , -0 ,IP_TUNNEL_KEY_IPV4_PAD_LEN ); key->tos = tos; key->ttl = ttl; key->tun_flags = tun_flags;
@@ -207,6 +202,33 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE); } +static inline void ip_tunnel_key_init (struct ip_tunnel_key *key, +__be32 saddr,__be32 daddr, +u8 tos,u8 ttl, +__be16 tp_src,__be16 tp_dst, +__be64 tun_id,__be16 tun_flags) +{ +__ip_tunnel_key_init (key, tos, ttl, tp_src, tp_dst, tun_id, + tun_flags); + key->u.ipv4.src = saddr; + key->u.ipv4.dst = daddr; +memset ((unsigned char *)key +IP_TUNNEL_KEY_IPV4_PAD , +0 ,IP_TUNNEL_KEY_IPV4_PAD_LEN ); +} + +static inline void ip6_tunnel_key_init (struct ip_tunnel_key *key, +const struct in6_addr *saddr, +const struct in6_addr *daddr, +u8 tos,u8 ttl, +__be16 tp_src,__be16 tp_dst, +__be64 tun_id,__be16 tun_flags) +{ +__ip_tunnel_key_init (key, tos, ttl, tp_src, tp_dst, tun_id, + tun_flags); + key->u.ipv6.src = *saddr; + key->u.ipv6.dst = *daddr; +} +static inline unsigned short ip_tunnel_info_af (const struct ip_tunnel_info *tun_info) {
Signature · 1 line
1.8.3.1
Re: [PATCH net-next v2 3/4] ip_tunnels: introduce ip6_tunnel_key_init
Quoted 77 lines · Jiri Benc
We already have
ip_tunnel_key_init, this does the same for IPv6. Will be used also by openvswitch in the next patch.Signed-off-by Jiri Benc <[email protected]>---
New patch in v2 of the set.--- include/net/dst_metadata.h | 18 ++++++------------ include/net/ip_tunnels.h | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 21 deletions(-)include/net/dst_metadata.h +6
-12@@ -85,23 +85,17 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb, {const struct ipv6hdr *ip6h =ipv6_hdr (skb);struct metadata_dst *tun_dst; -struct ip_tunnel_info *info; tun_dst =tun_rx_dst (md_size);if (!tun_dst)return NULL ; - info = &tun_dst->u.tun_info; - info->mode =IP_TUNNEL_INFO_IPV6 ; - info->key.tun_flags = flags; - info->key.tun_id = tunnel_id; - info->key.tp_src =0 ; - info->key.tp_dst =0 ; - - info->key.u.ipv6.src = ip6h->saddr; - info->key.u.ipv6.dst = ip6h->daddr; - info->key.tos =ipv6_get_dsfield (ip6h); - info->key.ttl = ip6h->hop_limit; + tun_dst->u.tun_info.mode =IP_TUNNEL_INFO_IPV6 ; +ip6_tunnel_key_init (&tun_dst->u.tun_info.key, + &ip6h->saddr, &ip6h->daddr, +ipv6_get_dsfield (ip6h), ip6h->hop_limit, +0 ,0 , tunnel_id, flags); +return tun_dst; }include/net/ip_tunnels.h +6
-9@@ -179,17 +179,12 @@ int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,int ip_tunnel_encap_del_ops (const struct ip_tunnel_encap_ops *op,unsigned int num); -static inline void ip_tunnel_key_init (struct ip_tunnel_key *key, -__be32 saddr,__be32 daddr, -u8 tos,u8 ttl, -__be16 tp_src,__be16 tp_dst, -__be64 tun_id,__be16 tun_flags) +static inline void __ip_tunnel_key_init (struct ip_tunnel_key *key, +u8 tos,u8 ttl, +__be16 tp_src,__be16 tp_dst, +__be64 tun_id,__be16 tun_flags) { key->tun_id = tun_id; - key->u.ipv4.src = saddr; - key->u.ipv4.dst = daddr; -memset ((unsigned char *)key +IP_TUNNEL_KEY_IPV4_PAD , -0 ,IP_TUNNEL_KEY_IPV4_PAD_LEN ); key->tos = tos; key->ttl = ttl; key->tun_flags = tun_flags;@@ -207,6 +202,33 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE); } +static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, + __be32 saddr, __be32 daddr,
include/net/ip_tunnels.h static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, · line 216
Quoted 10 lines
include/net/ip_tunnels.h +10
-0+ u8 tos, u8 ttl, + __be16 tp_src, __be16 tp_dst, + __be64 tun_id, __be16 tun_flags) +{ +__ip_tunnel_key_init (key ,tos ,ttl ,tp_src ,tp_dst ,tun_id , +tun_flags ); + key->u.ipv4.src = saddr; + key->u.ipv4.dst = daddr; +memset ((unsigned char *)key +IP_TUNNEL_KEY_IPV4_PAD , +0 ,IP_TUNNEL_KEY_IPV4_PAD_LEN );
neat: since IP_TUNNEL_KEY_IPV4_PAD not really IPv4 tunnel key padding anymore, This also needs to be renamed.
otherwise looks good.
Re: [PATCH net-next v2 3/4] ip_tunnels: introduce ip6_tunnel_key_init
Quoted 15 lines · Pravin Shelar
include/net/ip_tunnels.h static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, · line 216
Quoted 12 lines · Jiri Benc
include/net/ip_tunnels.h +12
-0+static inline void ip_tunnel_key_init (struct ip_tunnel_key *key, +__be32 saddr,__be32 daddr, +u8 tos,u8 ttl, +__be16 tp_src,__be16 tp_dst, +__be64 tun_id,__be16 tun_flags) +{ +__ip_tunnel_key_init (key, tos, ttl, tp_src, tp_dst, tun_id, + tun_flags); + key->u.ipv4.src = saddr; + key->u.ipv4.dst = daddr; +memset ((unsigned char *)key +IP_TUNNEL_KEY_IPV4_PAD , +0 ,IP_TUNNEL_KEY_IPV4_PAD_LEN );neat: since
IP_TUNNEL_KEY_IPV4_PADnot really IPv4 tunnel key padding anymore, This also needs to be renamed.
It is IPv4 address padding. It is used to zero out the part of the union of IPv6 and IPv4 addresses that is not occupied by IPv4 addresses. The name was just too long to include "ADDR", too.
The original pad constant was renamed to IP_TUNNEL_KEY_SIZE, thus is not referencing IPv4 anymore.
Quoted 3 lines
otherwise looks good.
Acked-by Pravin B Shelar <[email protected]>
Thanks,
Jiri
Signature · 1 line
Jiri Benc
PATCH v2 4/4 openvswitch: IPv6 support for ovs_tunnel_get_egress_info
In reply to Jiri BencFor compat tunnel interfaces, reject IPv6 keys.
Also fixes a related thinko in vport-vxlan: upcall->egress_tun_info is not yet set at the point where it is used, thus the obtained family is incorrect. As this is IPv4 anyway, just use AF_INET.
---
New patch in v2 of the set.
--- net/openvswitch/vport-geneve.c | 4 ++- net/openvswitch/vport-gre.c | 4 ++- net/openvswitch/vport-vxlan.c | 6 ++-- net/openvswitch/vport.c | 62 ++++++++++++++++++++++++++++-------------- net/openvswitch/vport.h | 26 ++++++++++++++++++ 5 files changed, 77 insertions(+), 25 deletions(-)
net/openvswitch/vport-geneve.c +3 -1
@@ -60,7 +60,9 @@ static int geneve_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,__be16 dport =htons (geneve_port->port_no);__be16 sport =udp_flow_src_port (net, skb,1 ,USHRT_MAX , true); -return ovs_tunnel_get_egress_info (upcall,ovs_dp_get_net (vport->dp), +/* Only IPv4 supported in the compat layer. Pass NULL ipv6 socket. */ +return ovs_tunnel_get_egress_info (upcall, +ovs_dp_get_net (vport->dp),NULL , skb,IPPROTO_UDP , sport, dport); }
net/openvswitch/vport-gre.c +3 -1
@@ -87,7 +87,9 @@ static struct vport *gre_create(const struct vport_parms *parms)static int gre_get_egress_tun_info (struct vport *vport,struct sk_buff *skb,struct dp_upcall_info *upcall) { -return ovs_tunnel_get_egress_info (upcall,ovs_dp_get_net (vport->dp), +/* Only IPv4 supported. Pass NULL ipv6 socket. */ +return ovs_tunnel_get_egress_info (upcall, +ovs_dp_get_net (vport->dp),NULL , skb,IPPROTO_GRE ,0 ,0 ); }
net/openvswitch/vport-vxlan.c +3 -3
@@ -151,8 +151,7 @@ static int vxlan_get_egress_tun_info(struct vport *vport, struct sk_buff *skb, {struct vxlan_dev *vxlan =netdev_priv (vport->dev);struct net *net =ovs_dp_get_net (vport->dp); -unsigned short family =ip_tunnel_info_af (upcall->egress_tun_info); -__be16 dst_port =vxlan_dev_dst_port (vxlan, family); +__be16 dst_port =vxlan_dev_dst_port (vxlan,AF_INET );__be16 src_port;int port_min;int port_max;
@@ -160,7 +159,8 @@ static int vxlan_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,inet_get_local_port_range (net, &port_min, &port_max); src_port =udp_flow_src_port (net, skb,0 ,0 , true); -return ovs_tunnel_get_egress_info (upcall, net, +/* Only IPv4 supported in the compat layer. Pass NULL ipv6 socket. */ +return ovs_tunnel_get_egress_info (upcall, net,NULL , skb,IPPROTO_UDP , src_port, dst_port); }
net/openvswitch/vport.c +42 -20
83 lines not on this page · raw message
net/openvswitch/vport.h +26 -0
@@ -27,6 +27,8 @@#include <linux/skbuff.h> #include <linux/spinlock.h> #include <linux/u64_stats_sync.h> +#include <net/addrconf.h> +#include <net/ipv6.h> #include <net/route.h> #include "datapath.h"
@@ -55,6 +57,7 @@ u32 ovs_vport_find_upcall_portid(const struct vport *, struct sk_buff *); int ovs_tunnel_get_egress_info(struct dp_upcall_info *upcall, struct net *net, + struct sock *ipv6_sk, struct sk_buff *, u8 ipproto, __be16 tp_src,
@@ -234,6 +237,29 @@ static inline struct rtable *ovs_tunnel_route_lookup(struct net *net,return rt; } +static inline struct dst_entry *ovs_tunnel6_route_lookup (struct net *net, +struct sock *sk, +const struct ip_tunnel_key *key, +u32 mark, +struct flowi6 *fl6, +u8 protocol) +{ +struct dst_entry *dst; +int err; + +memset (fl6,0 ,sizeof (*fl6)); + fl6->daddr = key->u.ipv6.dst; + fl6->saddr = key->u.ipv6.src; + fl6->flowi6_tos =RT_TOS (key->tos); + fl6->flowi6_mark = mark; + fl6->flowi6_proto = protocol; + + err = ipv6_stub->ipv6_dst_lookup (net, sk, &dst, fl6); +if (err) +return ERR_PTR (err); +return dst; +} +static inline void ovs_vport_send (struct vport *vport,struct sk_buff *skb) { vport->ops->send (vport, skb);
Signature · 1 line
1.8.3.1
Re: [PATCH net-next v2 4/4] openvswitch: IPv6 support for ovs_tunnel_get_egress_info
Quoted 17 lines · Jiri Benc
For compat tunnel interfaces, reject IPv6 keys.
Also fixes a related thinko in vport-vxlan:
upcall->egress_tun_infois not yet set at the point where it is used, thus the obtained family is incorrect. As this is IPv4 anyway, just useAF_INET.Signed-off-by Jiri Benc <[email protected]>---
New patch in v2 of the set.--- net/openvswitch/vport-geneve.c | 4 ++- net/openvswitch/vport-gre.c | 4 ++- net/openvswitch/vport-vxlan.c | 6 ++-- net/openvswitch/vport.c | 62 ++++++++++++++++++++++++++++-------------- net/openvswitch/vport.h | 26 ++++++++++++++++++ 5 files changed, 77 insertions(+), 25 deletions(-)
...
Quoted 101 lines
net/openvswitch/vport-vxlan.c +3
-3@@ -151,8 +151,7 @@ static int vxlan_get_egress_tun_info(struct vport *vport, struct sk_buff *skb, {struct vxlan_dev *vxlan =netdev_priv (vport->dev);struct net *net =ovs_dp_get_net (vport->dp); -unsigned short family =ip_tunnel_info_af (upcall->egress_tun_info); -__be16 dst_port =vxlan_dev_dst_port (vxlan, family); +__be16 dst_port =vxlan_dev_dst_port (vxlan,AF_INET );__be16 src_port;int port_min;int port_max;@@ -160,7 +159,8 @@ static int vxlan_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,inet_get_local_port_range (net, &port_min, &port_max); src_port =udp_flow_src_port (net, skb,0 ,0 , true); -return ovs_tunnel_get_egress_info (upcall, net, +/* Only IPv4 supported in the compat layer. Pass NULL ipv6 socket. */ +return ovs_tunnel_get_egress_info (upcall, net,NULL , skb,IPPROTO_UDP , src_port, dst_port); }net/openvswitch/vport.c +32
-20@@ -489,6 +489,7 @@ EXPORT_SYMBOL_GPL(ovs_vport_deferred_free); int ovs_tunnel_get_egress_info(struct dp_upcall_info *upcall, struct net *net, + struct sock *ipv6_sk, struct sk_buff *skb, u8 ipproto, __be16 tp_src,@@ -498,13 +499,9 @@ int ovs_tunnel_get_egress_info(struct dp_upcall_info *upcall,const struct ip_tunnel_info *tun_info =skb_tunnel_info (skb);const struct ip_tunnel_key *tun_key;u32 skb_mark = skb->mark; -struct rtable *rt; -struct flowi4 fl;if (unlikely (!tun_info))return -EINVAL ; -if (ip_tunnel_info_af (tun_info) !=AF_INET ) -return -EINVAL ; tun_key = &tun_info->key;@@ -512,22 +509,47 @@ int ovs_tunnel_get_egress_info(struct dp_upcall_info *upcall,* The process may need to be changed if the corresponding process * in vports ops changed. */ - rt =ovs_tunnel_route_lookup (net, tun_key, skb_mark, &fl, ipproto); -if (IS_ERR (rt)) -return PTR_ERR (rt); - -ip_rt_put (rt); - -/* Generate egress_tun_info based on tun_info, -* saddr, tp_src and tp_dst -*/ -ip_tunnel_key_init (&egress_tun_info->key, - fl.saddr, tun_key->u.ipv4.dst, - tun_key->tos, - tun_key->ttl, - tp_src, tp_dst, - tun_key->tun_id, - tun_key->tun_flags); +if (ip_tunnel_info_af (tun_info) ==AF_INET ) { +struct rtable *rt; +struct flowi4 fl; + + rt =ovs_tunnel_route_lookup (net, tun_key, skb_mark, &fl, ipproto); +if (IS_ERR (rt)) +return PTR_ERR (rt); + +ip_rt_put (rt); + +/* Generate egress_tun_info based on tun_info, +* saddr, tp_src and tp_dst +*/ +ip_tunnel_key_init (&egress_tun_info->key, + fl.saddr, tun_key->u.ipv4.dst, + tun_key->tos, + tun_key->ttl, + tp_src, tp_dst, + tun_key->tun_id, + tun_key->tun_flags); + }else { +struct dst_entry *ndst; +struct flowi6 fl6; + +if (!ipv6_sk) +return -EPFNOSUPPORT ; + + ndst =ovs_tunnel6_route_lookup (net, ipv6_sk, tun_key, + skb_mark, &fl6, ipproto); +if (IS_ERR (ndst)) +return PTR_ERR (ndst);
net/openvswitch/vport.c int ovs_tunnel_get_egress_info(struct dp_upcall_info *upcall, · line 552
Quoted 10 lines
net/openvswitch/vport.c +10
-0+dst_release (ndst); + +ip6_tunnel_key_init (&egress_tun_info->key, + &fl6.saddr, &tun_key->u.ipv6.dst, + tun_key->tos, + tun_key->ttl, + tp_src, tp_dst, + tun_key->tun_id, + tun_key->tun_flags); + }
I dont see point of adding this code when IPv6 sampling not support by the patch series.
Re: [PATCH net-next v2 4/4] openvswitch: IPv6 support for ovs_tunnel_get_egress_info
Quoted 2 lines · Pravin Shelar
I dont see point of adding this code when IPv6 sampling not support by the patch series.
It was requested by Jesse:
http://article.gmane.org/gmane.linux.network/380348
I don't mind leaving this and the previous patch out, it's actually what I did in v1.
Jiri
Signature · 1 line
Jiri Benc
Re: [PATCH net-next v2 4/4] openvswitch: IPv6 support for ovs_tunnel_get_egress_info
Quoted 7 lines · Jiri Benc
Quoted 2 lines · Pravin Shelar
I dont see point of adding this code when IPv6 sampling not support by the patch series.
It was requested by Jesse:
http://article.gmane.org/gmane.linux.network/380348
I don't think we can use this function, lwtunnel device need new ndo_ operation to export this information. So lets defer this patch till we have solution for retrieving egress info from lwtunnel devices.
Quoted 7 lines
I don't mind leaving this and the previous patch out, it's actually what I did in v1.
Jiri
--
Jiri Benc
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev
A message that is not in the archive (sent off-list or not yet received): CALnjE+qn7PrEYxKZ6c03-Bz63BcROVuqmwdp8sqi2eXvxY-yeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH net-next v2 4/4] openvswitch: IPv6 support for ovs_tunnel_get_egress_info
Quoted 5 lines · Pravin Shelar
Quoted 4 lines · Jiri Benc
Quoted 2 lines · Pravin Shelar
I dont see point of adding this code when IPv6 sampling not support by the patch series.
Quoted 7 lines
Quoted 3 lines
It was requested by Jesse:
http://article.gmane.org/gmane.linux.network/380348I don't think we can use this function, lwtunnel device need new
ndo_operation to export this information. So lets defer this patch till we have solution for retrieving egress info from lwtunnel devices.
I don't entirely disagree with this but I'm also nervous about completely leaving it out. It seems like when this issue does get fixed, it is likely that the person who does it will just convert whatever code is there and not necessarily think about IPv6 since it's not an IPv6 feature. If that happens, we'll have a hidden problem in IPv6, which is somewhat unfortunately as try to advance IPv6 forward.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev
Re: [PATCH net-next v2 4/4] openvswitch: IPv6 support for ovs_tunnel_get_egress_info
Quoted 14 lines · Jesse Gross
Quoted 5 lines · Pravin Shelar
Quoted 4 lines · Jiri Benc
Quoted 2 lines · Pravin Shelar
I dont see point of adding this code when IPv6 sampling not support by the patch series.
Quoted 7 lines
Quoted 3 lines
It was requested by Jesse:
http://article.gmane.org/gmane.linux.network/380348I don't think we can use this function, lwtunnel device need new
ndo_operation to export this information. So lets defer this patch till we have solution for retrieving egress info from lwtunnel devices.
Quoted 6 lines
I don't entirely disagree with this but I'm also nervous about completely leaving it out. It seems like when this issue does get fixed, it is likely that the person who does it will just convert whatever code is there and not necessarily think about IPv6 since it's not an IPv6 feature. If that happens, we'll have a hidden problem in IPv6, which is somewhat unfortunately as try to advance IPv6 forward.
The code is pretty different for different tunnel. It is possible to take the code and reuse it. But that would involve lot of refactoring into existing code for every flow tunnel based tunnel implementation. I do not want to do it as part of fix to net branch.
I have sent out patch to fix the egress tunnel info issue with lwtunnel. Once that is merged we can have complete IPv6 tunnel support on net-next.