2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 07:15:17 +00:00

dpif-netlink-rtnl: Support layer3 GRE

Add support for creating layer3 GRE.

Signed-off-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
This commit is contained in:
Eric Garver
2017-07-10 15:39:54 -04:00
committed by Joe Stringer
parent c33c412fb1
commit 2fd3d5eda5

View File

@@ -82,13 +82,20 @@ static const struct nl_policy geneve_policy[] = {
}; };
static const char * static const char *
vport_type_to_kind(enum ovs_vport_type type) vport_type_to_kind(enum ovs_vport_type type,
const struct netdev_tunnel_config *tnl_cfg)
{ {
switch (type) { switch (type) {
case OVS_VPORT_TYPE_VXLAN: case OVS_VPORT_TYPE_VXLAN:
return "vxlan"; return "vxlan";
case OVS_VPORT_TYPE_GRE: case OVS_VPORT_TYPE_GRE:
return "gretap"; if (tnl_cfg->pt_mode == NETDEV_PT_LEGACY_L3) {
return "gre";
} else if (tnl_cfg->pt_mode == NETDEV_PT_LEGACY_L2) {
return "gretap";
} else {
return NULL;
}
case OVS_VPORT_TYPE_GENEVE: case OVS_VPORT_TYPE_GENEVE:
return "geneve"; return "geneve";
case OVS_VPORT_TYPE_NETDEV: case OVS_VPORT_TYPE_NETDEV:
@@ -230,7 +237,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg,
const char *kind; const char *kind;
int err; int err;
kind = vport_type_to_kind(type); kind = vport_type_to_kind(type, tnl_cfg);
if (!kind) { if (!kind) {
return EOPNOTSUPP; return EOPNOTSUPP;
} }
@@ -340,16 +347,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
int err; int err;
type = netdev_to_ovs_vport_type(netdev_get_type(netdev)); type = netdev_to_ovs_vport_type(netdev_get_type(netdev));
kind = vport_type_to_kind(type);
if (!kind) {
return EOPNOTSUPP;
}
tnl_cfg = netdev_get_tunnel_config(netdev); tnl_cfg = netdev_get_tunnel_config(netdev);
if (!tnl_cfg) { if (!tnl_cfg) {
return EINVAL; return EINVAL;
} }
kind = vport_type_to_kind(type, tnl_cfg);
if (!kind) {
return EOPNOTSUPP;
}
name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf); name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL; flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL;