Add support for creating layer3 GRE. Signed-off-by: Eric Garver <e...@erig.me> --- lib/dpif-netlink-rtnl.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c index f02fe37e9a6a..32e220fc135c 100644 --- a/lib/dpif-netlink-rtnl.c +++ b/lib/dpif-netlink-rtnl.c @@ -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: - 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: return "geneve"; case OVS_VPORT_TYPE_NETDEV: @@ -232,7 +239,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; } @@ -342,16 +349,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; -- 2.12.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev