dpif-netlink-rtnl: Support layer3 GRE
Add support for creating layer3 GRE.
@@ -82,13 +82,20 @@ static const struct nl_policy geneve_policy[] = {
};
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) {
case OVS_VPORT_TYPE_VXLAN:
return "vxlan";
case OVS_VPORT_TYPE_GRE:
+ 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:
return "geneve";
case OVS_VPORT_TYPE_NETDEV:
@@ -230,7 +237,7 @@ dpif_netlink_rtnl_verify(const struct netdev_tunnel_config *tnl_cfg,
const char *kind;
int err;
- kind = vport_type_to_kind(type);
+ kind = vport_type_to_kind(type, tnl_cfg);
if (!kind) {
return EOPNOTSUPP;
}
@@ -340,16 +347,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
int err;
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);
if (!tnl_cfg) {
return EINVAL;
}
+ kind = vport_type_to_kind(type, tnl_cfg);
+ if (!kind) {
+ return EOPNOTSUPP;
+ }
+
name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL;
