[ovs-dev] [RFC PATCH kernel 04/10] openvswitch: IPv6 type of tunnel vports
Jiri Benc
jbenc at redhat.com
Thu May 14 18:10:46 UTC 2015
Allow tunnel vports to be configured as tunnels over IPv6 by using
OVS_TUNNEL_ATTR_OVER_IPV6 option. For now, reject such tunnels. The support
to individual tunnel types will be added by subsequent patches.
Signed-off-by: Jiri Benc <jbenc at redhat.com>
---
include/uapi/linux/openvswitch.h | 1 +
net/openvswitch/vport-geneve.c | 5 +++++
net/openvswitch/vport-gre.c | 3 +++
net/openvswitch/vport-vxlan.c | 5 +++++
4 files changed, 14 insertions(+)
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 4d26da40b01f..ba7ae3b05308 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -267,6 +267,7 @@ enum {
OVS_TUNNEL_ATTR_UNSPEC,
OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */
OVS_TUNNEL_ATTR_EXTENSION,
+ OVS_TUNNEL_ATTR_OVER_IPV6,/* when present, tunneling over IPv6 */
__OVS_TUNNEL_ATTR_MAX
};
diff --git a/net/openvswitch/vport-geneve.c b/net/openvswitch/vport-geneve.c
index 2e5bf299ac4c..893f03b3f864 100644
--- a/net/openvswitch/vport-geneve.c
+++ b/net/openvswitch/vport-geneve.c
@@ -142,6 +142,11 @@ static struct vport *geneve_tnl_create(const struct vport_parms *parms)
err = -EINVAL;
goto error;
}
+ a = nla_find_nested(options, OVS_TUNNEL_ATTR_OVER_IPV6);
+ if (a) {
+ err = -EAFNOSUPPORT;
+ goto error;
+ }
vport = ovs_vport_alloc(sizeof(struct geneve_port),
&ovs_geneve_vport_ops, parms);
diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c
index 715bd1bc3328..a34a2da15d43 100644
--- a/net/openvswitch/vport-gre.c
+++ b/net/openvswitch/vport-gre.c
@@ -237,10 +237,13 @@ static const char *gre_get_name(const struct vport *vport)
static struct vport *gre_create(const struct vport_parms *parms)
{
struct net *net = ovs_dp_get_net(parms->dp);
+ struct nlattr *options = parms->options;
struct ovs_net *ovs_net;
struct vport *vport;
int err;
+ if (options && nla_find_nested(options, OVS_TUNNEL_ATTR_OVER_IPV6))
+ return ERR_PTR(-EAFNOSUPPORT);
err = gre_init();
if (err)
return ERR_PTR(err);
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
index c7e5e61779d4..2a3e5a663e08 100644
--- a/net/openvswitch/vport-vxlan.c
+++ b/net/openvswitch/vport-vxlan.c
@@ -171,6 +171,11 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms)
err = -EINVAL;
goto error;
}
+ a = nla_find_nested(options, OVS_TUNNEL_ATTR_OVER_IPV6);
+ if (a) {
+ err = -EAFNOSUPPORT;
+ goto error;
+ }
vport = ovs_vport_alloc(sizeof(struct vxlan_port),
&ovs_vxlan_vport_ops, parms);
--
1.8.3.1
More information about the dev
mailing list