summaryrefslogtreecommitdiff
path: root/zebra/zebra_vxlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vxlan.c')
-rw-r--r--zebra/zebra_vxlan.c212
1 files changed, 154 insertions, 58 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 1450072aa9..c7f2976ace 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -2515,9 +2515,7 @@ static int zvni_neigh_install(zebra_vni_t *zvni, zebra_neigh_t *n)
struct zebra_if *zif;
struct zebra_l2info_vxlan *vxl;
struct interface *vlan_if;
-#ifdef GNU_LINUX
- uint8_t flags;
-#endif
+ int flags;
int ret = 0;
if (!(n->flags & ZEBRA_NEIGH_REMOTE))
@@ -2531,13 +2529,14 @@ static int zvni_neigh_install(zebra_vni_t *zvni, zebra_neigh_t *n)
vlan_if = zvni_map_to_svi(vxl->access_vlan, zif->brslave_info.br_if);
if (!vlan_if)
return -1;
-#ifdef GNU_LINUX
- flags = NTF_EXT_LEARNED;
+
+ flags = DPLANE_NTF_EXT_LEARNED;
if (n->flags & ZEBRA_NEIGH_ROUTER_FLAG)
- flags |= NTF_ROUTER;
+ flags |= DPLANE_NTF_ROUTER;
ZEBRA_NEIGH_SET_ACTIVE(n);
- ret = kernel_add_neigh(vlan_if, &n->ip, &n->emac, flags);
-#endif
+
+ dplane_neigh_add(vlan_if, &n->ip, &n->emac, flags);
+
return ret;
}
@@ -2554,8 +2553,9 @@ static int zvni_neigh_uninstall(zebra_vni_t *zvni, zebra_neigh_t *n)
return 0;
if (!zvni->vxlan_if) {
- zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
@@ -2569,7 +2569,10 @@ static int zvni_neigh_uninstall(zebra_vni_t *zvni, zebra_neigh_t *n)
ZEBRA_NEIGH_SET_INACTIVE(n);
n->loc_seq = 0;
- return kernel_del_neigh(vlan_if, &n->ip);
+
+ dplane_neigh_delete(vlan_if, &n->ip);
+
+ return 0;
}
/*
@@ -2590,12 +2593,9 @@ static int zvni_neigh_probe(zebra_vni_t *zvni, zebra_neigh_t *n)
if (!vlan_if)
return -1;
-#ifdef GNU_LINUX
- return kernel_upd_neigh(vlan_if, &n->ip, &n->emac,
- 0, NUD_PROBE);
-#else
+ dplane_neigh_update(vlan_if, &n->ip, &n->emac);
+
return 0;
-#endif
}
/*
@@ -2844,9 +2844,12 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
/* mac entry should be present */
mac = zvni_mac_lookup(zvni, &n->emac);
if (!mac) {
- zlog_debug("MAC %s doesn't exist for neigh %s on VNI %u",
- prefix_mac2str(&n->emac, buf1, sizeof(buf1)),
- ipaddr2str(ip, buf2, sizeof(buf2)), zvni->vni);
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("MAC %s doesn't exist for neigh %s on VNI %u",
+ prefix_mac2str(&n->emac,
+ buf1, sizeof(buf1)),
+ ipaddr2str(ip, buf2, sizeof(buf2)),
+ zvni->vni);
return -1;
}
@@ -3733,13 +3736,16 @@ static struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if)
}
/*
- * Install remote MAC into the kernel.
+ * Install remote MAC into the forwarding plane.
*/
static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac)
{
- struct zebra_if *zif;
- struct zebra_l2info_vxlan *vxl;
+ const struct zebra_if *zif, *br_zif;
+ const struct zebra_l2info_vxlan *vxl;
bool sticky;
+ enum zebra_dplane_result res;
+ const struct interface *br_ifp;
+ vlanid_t vid;
if (!(mac->flags & ZEBRA_MAC_REMOTE))
return 0;
@@ -3747,43 +3753,78 @@ static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac)
zif = zvni->vxlan_if->info;
if (!zif)
return -1;
+
+ br_ifp = zif->brslave_info.br_if;
+ if (br_ifp == NULL)
+ return -1;
+
vxl = &zif->l2info.vxl;
sticky = !!CHECK_FLAG(mac->flags,
(ZEBRA_MAC_STICKY | ZEBRA_MAC_REMOTE_DEF_GW));
- return kernel_add_mac(zvni->vxlan_if, vxl->access_vlan, &mac->macaddr,
- mac->fwd_info.r_vtep_ip, sticky);
+ br_zif = (const struct zebra_if *)(br_ifp->info);
+
+ if (IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(br_zif))
+ vid = vxl->access_vlan;
+ else
+ vid = 0;
+
+ res = dplane_mac_add(zvni->vxlan_if, br_ifp, vid,
+ &mac->macaddr, mac->fwd_info.r_vtep_ip, sticky);
+ if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
+ return 0;
+ else
+ return -1;
}
/*
- * Uninstall remote MAC from the kernel.
+ * Uninstall remote MAC from the forwarding plane.
*/
static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac)
{
- struct zebra_if *zif;
- struct zebra_l2info_vxlan *vxl;
+ const struct zebra_if *zif, *br_zif;
+ const struct zebra_l2info_vxlan *vxl;
struct in_addr vtep_ip;
- struct interface *ifp;
+ const struct interface *ifp, *br_ifp;
+ vlanid_t vid;
+ enum zebra_dplane_result res;
if (!(mac->flags & ZEBRA_MAC_REMOTE))
return 0;
if (!zvni->vxlan_if) {
- zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
- zvni->vni, zvni);
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
+ zvni->vni, zvni);
return -1;
}
zif = zvni->vxlan_if->info;
if (!zif)
return -1;
+
+ br_ifp = zif->brslave_info.br_if;
+ if (br_ifp == NULL)
+ return -1;
+
vxl = &zif->l2info.vxl;
+ br_zif = (const struct zebra_if *)br_ifp->info;
+
+ if (IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(br_zif))
+ vid = vxl->access_vlan;
+ else
+ vid = 0;
+
ifp = zvni->vxlan_if;
vtep_ip = mac->fwd_info.r_vtep_ip;
- return kernel_del_mac(ifp, vxl->access_vlan, &mac->macaddr, vtep_ip);
+ res = dplane_mac_del(ifp, br_ifp, vid, &mac->macaddr, vtep_ip);
+ if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
+ return 0;
+ else
+ return -1;
}
/*
@@ -4281,9 +4322,13 @@ static int zvni_vtep_del_all(zebra_vni_t *zvni, int uninstall)
static int zvni_vtep_install(zebra_vni_t *zvni, zebra_vtep_t *zvtep)
{
if (is_vxlan_flooding_head_end() &&
- (zvtep->flood_control == VXLAN_FLOOD_HEAD_END_REPL))
- return kernel_add_vtep(zvni->vni, zvni->vxlan_if,
- &zvtep->vtep_ip);
+ (zvtep->flood_control == VXLAN_FLOOD_HEAD_END_REPL)) {
+ if (ZEBRA_DPLANE_REQUEST_FAILURE ==
+ dplane_vtep_add(zvni->vxlan_if,
+ &zvtep->vtep_ip, zvni->vni))
+ return -1;
+ }
+
return 0;
}
@@ -4298,7 +4343,11 @@ static int zvni_vtep_uninstall(zebra_vni_t *zvni, struct in_addr *vtep_ip)
return -1;
}
- return kernel_del_vtep(zvni->vni, zvni->vxlan_if, vtep_ip);
+ if (ZEBRA_DPLANE_REQUEST_FAILURE ==
+ dplane_vtep_delete(zvni->vxlan_if, vtep_ip, zvni->vni))
+ return -1;
+
+ return 0;
}
/*
@@ -4470,12 +4519,15 @@ static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
}
/*
- * Install remote RMAC into the kernel.
+ * Install remote RMAC into the forwarding plane.
*/
static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
{
- struct zebra_if *zif = NULL;
- struct zebra_l2info_vxlan *vxl = NULL;
+ const struct zebra_if *zif = NULL, *br_zif = NULL;
+ const struct zebra_l2info_vxlan *vxl = NULL;
+ const struct interface *br_ifp;
+ enum zebra_dplane_result res;
+ vlanid_t vid;
if (!(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE))
|| !(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE_RMAC)))
@@ -4485,30 +4537,50 @@ static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
if (!zif)
return -1;
+ br_ifp = zif->brslave_info.br_if;
+ if (br_ifp == NULL)
+ return -1;
+
vxl = &zif->l2info.vxl;
- return kernel_add_mac(zl3vni->vxlan_if, vxl->access_vlan,
- &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, 0);
+ br_zif = (const struct zebra_if *)br_ifp->info;
+
+ if (IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(br_zif))
+ vid = vxl->access_vlan;
+ else
+ vid = 0;
+
+ res = dplane_mac_add(zl3vni->vxlan_if, br_ifp, vid,
+ &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, 0);
+ if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
+ return 0;
+ else
+ return -1;
}
/*
- * Uninstall remote RMAC from the kernel.
+ * Uninstall remote RMAC from the forwarding plane.
*/
static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
{
char buf[ETHER_ADDR_STRLEN];
- struct zebra_if *zif = NULL;
- struct zebra_l2info_vxlan *vxl = NULL;
+ const struct zebra_if *zif = NULL, *br_zif;
+ const struct zebra_l2info_vxlan *vxl = NULL;
+ const struct interface *br_ifp;
+ vlanid_t vid;
+ enum zebra_dplane_result res;
if (!(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE))
|| !(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE_RMAC)))
return 0;
if (!zl3vni->vxlan_if) {
- zlog_debug(
- "RMAC %s on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if",
- prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)),
- zl3vni->vni, zl3vni);
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "RMAC %s on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if",
+ prefix_mac2str(&zrmac->macaddr,
+ buf, sizeof(buf)),
+ zl3vni->vni, zl3vni);
return -1;
}
@@ -4516,10 +4588,24 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
if (!zif)
return -1;
+ br_ifp = zif->brslave_info.br_if;
+ if (br_ifp == NULL)
+ return -1;
+
vxl = &zif->l2info.vxl;
- return kernel_del_mac(zl3vni->vxlan_if, vxl->access_vlan,
- &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip);
+ br_zif = (const struct zebra_if *)br_ifp->info;
+ if (IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(br_zif))
+ vid = vxl->access_vlan;
+ else
+ vid = 0;
+
+ res = dplane_mac_del(zl3vni->vxlan_if, br_ifp, vid,
+ &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip);
+ if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
+ return 0;
+ else
+ return -1;
}
/* handle rmac add */
@@ -4658,9 +4744,7 @@ static int zl3vni_nh_del(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
*/
static int zl3vni_nh_install(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
{
-#ifdef GNU_LINUX
uint8_t flags;
-#endif
int ret = 0;
if (!is_l3vni_oper_up(zl3vni))
@@ -4669,12 +4753,13 @@ static int zl3vni_nh_install(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
if (!(n->flags & ZEBRA_NEIGH_REMOTE)
|| !(n->flags & ZEBRA_NEIGH_REMOTE_NH))
return 0;
-#ifdef GNU_LINUX
- flags = NTF_EXT_LEARNED;
+
+ flags = DPLANE_NTF_EXT_LEARNED;
if (n->flags & ZEBRA_NEIGH_ROUTER_FLAG)
- flags |= NTF_ROUTER;
- ret = kernel_add_neigh(zl3vni->svi_if, &n->ip, &n->emac, flags);
-#endif
+ flags |= DPLANE_NTF_ROUTER;
+
+ dplane_neigh_add(zl3vni->svi_if, &n->ip, &n->emac, flags);
+
return ret;
}
@@ -4690,7 +4775,9 @@ static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
if (!zl3vni->svi_if || !if_is_operative(zl3vni->svi_if))
return 0;
- return kernel_del_neigh(zl3vni->svi_if, &n->ip);
+ dplane_neigh_delete(zl3vni->svi_if, &n->ip);
+
+ return 0;
}
/* add remote vtep as a neigh entry */
@@ -6772,7 +6859,7 @@ int zebra_vxlan_clear_dup_detect_vni_ip(struct vty *vty,
if (!CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) {
vty_out(vty,
- "%% Requsted host IP %s is not duplicate detected\n",
+ "%% Requested host IP %s is not duplicate detected\n",
buf);
return CMD_WARNING;
}
@@ -9913,6 +10000,15 @@ static int zebra_evpn_cfg_clean_up(struct zserv *client)
return 0;
}
+/*
+ * Handle results for vxlan dataplane operations.
+ */
+extern void zebra_vxlan_handle_result(struct zebra_dplane_ctx *ctx)
+{
+ /* TODO -- anything other than freeing the context? */
+ dplane_ctx_fini(&ctx);
+}
+
/* Cleanup BGP EVPN configuration upon client disconnect */
extern void zebra_evpn_init(void)
{