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.c96
1 files changed, 39 insertions, 57 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index d883336f00..927df14fbe 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -275,7 +275,7 @@ static void zevpn_print_neigh_hash_all_evpn(struct hash_bucket *bucket,
* size, we try to be a bit more elegant in display by first computing
* the maximum width.
*/
- memset(&wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.addr_width = 15;
@@ -341,7 +341,7 @@ static void zevpn_print_neigh_hash_all_evpn_detail(struct hash_bucket *bucket,
return;
}
- memset(&wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.addr_width = 15;
@@ -625,7 +625,7 @@ static void zl3vni_print_nh_hash_all_vni(struct hash_bucket *bucket,
} else
json_object_int_add(json_evpn, "numNextHops", num_nh);
- memset(&wctx, 0, sizeof(struct nh_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty;
wctx.json = json_evpn;
hash_iterate(zl3vni->nh_table, zl3vni_print_nh_hash, &wctx);
@@ -668,7 +668,7 @@ static void zl3vni_print_rmac_hash_all_vni(struct hash_bucket *bucket,
* under the vni. Re-assign primary json object to fill
* next vni information.
*/
- memset(&wctx, 0, sizeof(struct rmac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty;
wctx.json = json_evpn;
hash_iterate(zl3vni->rmac_table, zl3vni_print_rmac_hash, &wctx);
@@ -928,9 +928,6 @@ static int zevpn_build_hash_table_zns(struct ns *ns,
zvrf = zebra_vrf_get_evpn();
- if (!zvrf)
- return NS_WALK_STOP;
-
/* Walk VxLAN interfaces and create EVPN hash. */
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
vni_t vni;
@@ -1078,9 +1075,7 @@ static int zevpn_build_hash_table_zns(struct ns *ns,
static void zevpn_build_hash_table(void)
{
- ns_walk_func(zevpn_build_hash_table_zns,
- (void *)NULL,
- (void **)NULL);
+ ns_walk_func(zevpn_build_hash_table_zns, NULL, NULL);
}
/*
@@ -1186,7 +1181,7 @@ static struct zebra_mac *zl3vni_rmac_add(struct zebra_l3vni *zl3vni,
struct zebra_mac tmp_rmac;
struct zebra_mac *zrmac = NULL;
- memset(&tmp_rmac, 0, sizeof(struct zebra_mac));
+ memset(&tmp_rmac, 0, sizeof(tmp_rmac));
memcpy(&tmp_rmac.macaddr, rmac, ETH_ALEN);
zrmac = hash_get(zl3vni->rmac_table, &tmp_rmac, zl3vni_rmac_alloc);
zrmac->nh_list = list_new();
@@ -1369,7 +1364,7 @@ static void zl3vni_remote_rmac_del(struct zebra_l3vni *zl3vni,
struct ipaddr ipv4_vtep;
if (!zl3vni_nh_lookup(zl3vni, vtep_ip)) {
- memset(&ipv4_vtep, 0, sizeof(struct ipaddr));
+ memset(&ipv4_vtep, 0, sizeof(ipv4_vtep));
ipv4_vtep.ipa_type = IPADDR_V4;
if (vtep_ip->ipa_type == IPADDR_V6)
ipv4_mapped_ipv6_to_ipv4(&vtep_ip->ipaddr_v6,
@@ -1461,7 +1456,7 @@ static struct zebra_neigh *zl3vni_nh_add(struct zebra_l3vni *zl3vni,
struct zebra_neigh tmp_n;
struct zebra_neigh *n = NULL;
- memset(&tmp_n, 0, sizeof(struct zebra_neigh));
+ memset(&tmp_n, 0, sizeof(tmp_n));
memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr));
n = hash_get(zl3vni->nh_table, &tmp_n, zl3vni_nh_alloc);
@@ -1674,7 +1669,7 @@ struct zebra_l3vni *zl3vni_lookup(vni_t vni)
struct zebra_l3vni tmp_l3vni;
struct zebra_l3vni *zl3vni = NULL;
- memset(&tmp_l3vni, 0, sizeof(struct zebra_l3vni));
+ memset(&tmp_l3vni, 0, sizeof(tmp_l3vni));
tmp_l3vni.vni = vni;
zl3vni = hash_lookup(zrouter.l3vni_table, &tmp_l3vni);
@@ -1689,7 +1684,7 @@ static struct zebra_l3vni *zl3vni_add(vni_t vni, vrf_id_t vrf_id)
struct zebra_l3vni tmp_zl3vni;
struct zebra_l3vni *zl3vni = NULL;
- memset(&tmp_zl3vni, 0, sizeof(struct zebra_l3vni));
+ memset(&tmp_zl3vni, 0, sizeof(tmp_zl3vni));
tmp_zl3vni.vni = vni;
zl3vni = hash_get(zrouter.l3vni_table, &tmp_zl3vni, zl3vni_alloc);
@@ -1747,9 +1742,6 @@ static int zl3vni_map_to_vxlan_if_ns(struct ns *ns,
zvrf = zebra_vrf_get_evpn();
- if (!zvrf)
- return NS_WALK_STOP;
-
assert(_pifp);
/* loop through all vxlan-interface */
@@ -1990,7 +1982,7 @@ static int zl3vni_send_add_to_client(struct zebra_l3vni *zl3vni)
assert(zvrf);
/* get the svi and vrr rmac values */
- memset(&svi_rmac, 0, sizeof(struct ethaddr));
+ memset(&svi_rmac, 0, sizeof(svi_rmac));
zl3vni_get_svi_rmac(zl3vni, &svi_rmac);
zl3vni_get_vrr_rmac(zl3vni, &vrr_rmac);
@@ -2123,7 +2115,7 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni,
zebra_evpn_mac_del_all(zevpn, 0, 0, DEL_ALL_MAC);
/* Free up all remote VTEPs, if any. */
- zebra_evpn_vtep_del_all(zevpn, 0);
+ zebra_evpn_vtep_del_all(zevpn, 1);
/* Delete the hash entry. */
if (zebra_evpn_vxlan_del(zevpn)) {
@@ -2278,7 +2270,7 @@ void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id, const struct ethaddr *rmac,
* address. Rmac is programmed against the ipv4 vtep because we only
* support ipv4 tunnels in the h/w right now
*/
- memset(&ipv4_vtep, 0, sizeof(struct ipaddr));
+ memset(&ipv4_vtep, 0, sizeof(ipv4_vtep));
ipv4_vtep.ipa_type = IPADDR_V4;
if (vtep_ip->ipa_type == IPADDR_V6)
ipv4_mapped_ipv6_to_ipv4(&vtep_ip->ipaddr_v6,
@@ -2388,7 +2380,7 @@ void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni, bool use_json)
if (use_json)
json = json_object_new_object();
- memset(&wctx, 0, sizeof(struct rmac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty;
wctx.json = json;
if (!use_json) {
@@ -2639,7 +2631,7 @@ void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf,
* size, we try to be a bit more elegant in display by first computing
* the maximum width.
*/
- memset(&wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.addr_width = 15;
@@ -2783,7 +2775,7 @@ void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf,
if (use_json)
json = json_object_new_object();
- memset(&wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.addr_width = 15;
@@ -2836,7 +2828,7 @@ void zebra_vxlan_print_neigh_vni_dad(struct vty *vty,
* size, we try to be a bit more elegant in display by first computing
* the maximum width.
*/
- memset(&wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.addr_width = 15;
@@ -2892,7 +2884,7 @@ void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf,
json_mac = json_object_new_object();
}
- memset(&wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.json = json_mac;
@@ -2933,7 +2925,7 @@ void zebra_vxlan_print_macs_all_vni(struct vty *vty, struct zebra_vrf *zvrf,
if (use_json)
json = json_object_new_object();
- memset(&wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty;
wctx.json = json;
wctx.print_dup = print_dup;
@@ -2961,7 +2953,7 @@ void zebra_vxlan_print_macs_all_vni_detail(struct vty *vty,
if (use_json)
json = json_object_new_object();
- memset(&wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty;
wctx.json = json;
wctx.print_dup = print_dup;
@@ -2988,7 +2980,7 @@ void zebra_vxlan_print_macs_all_vni_vtep(struct vty *vty,
if (use_json)
json = json_object_new_object();
- memset(&wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty;
wctx.flags = SHOW_REMOTE_MAC_FROM_VTEP;
wctx.r_vtep_ip = vtep_ip;
@@ -3073,7 +3065,7 @@ void zebra_vxlan_print_macs_vni_dad(struct vty *vty,
json_mac = json_object_new_object();
}
- memset(&wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.json = json_mac;
@@ -3322,7 +3314,7 @@ static void zevpn_clear_dup_detect_hash_vni_all(struct hash_bucket *bucket,
zvrf = (struct zebra_vrf *)args[0];
if (hashcount(zevpn->neigh_table)) {
- memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn;
n_wctx.zvrf = zvrf;
hash_iterate(zevpn->neigh_table,
@@ -3330,7 +3322,7 @@ static void zevpn_clear_dup_detect_hash_vni_all(struct hash_bucket *bucket,
}
if (num_valid_macs(zevpn)) {
- memset(&m_wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&m_wctx, 0, sizeof(m_wctx));
m_wctx.zevpn = zevpn;
m_wctx.zvrf = zvrf;
hash_iterate(zevpn->mac_table, zevpn_clear_dup_mac_hash, &m_wctx);
@@ -3370,7 +3362,7 @@ int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni)
}
if (hashcount(zevpn->neigh_table)) {
- memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn;
n_wctx.zvrf = zvrf;
hash_iterate(zevpn->neigh_table,
@@ -3378,7 +3370,7 @@ int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni)
}
if (num_valid_macs(zevpn)) {
- memset(&m_wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&m_wctx, 0, sizeof(m_wctx));
m_wctx.zevpn = zevpn;
m_wctx.zvrf = zvrf;
hash_iterate(zevpn->mac_table, zevpn_clear_dup_mac_hash, &m_wctx);
@@ -3419,7 +3411,7 @@ void zebra_vxlan_print_macs_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf,
json_mac = json_object_new_object();
}
- memset(&wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn;
wctx.vty = vty;
wctx.flags = SHOW_REMOTE_MAC_FROM_VTEP;
@@ -3498,8 +3490,6 @@ void zebra_vxlan_print_evpn(struct vty *vty, bool uj)
return;
zvrf = zebra_vrf_get_evpn();
- if (!zvrf)
- return;
num_l3vnis = hashcount(zrouter.l3vni_table);
num_l2vnis = hashcount(zvrf->evpn_table);
@@ -4201,12 +4191,6 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
}
zvrf = zebra_vrf_get_evpn();
- if (!zvrf) {
- if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug(" No Evpn Global Vrf found");
- return -1;
- }
-
return zebra_evpn_add_update_local_mac(zvrf, zevpn, ifp, macaddr, vid,
sticky, local_inactive,
dp_static, NULL);
@@ -4469,8 +4453,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, const struct prefix *p,
struct ethaddr macaddr;
struct zebra_evpn *zevpn = NULL;
- memset(&ip, 0, sizeof(struct ipaddr));
- memset(&macaddr, 0, sizeof(struct ethaddr));
+ memset(&ip, 0, sizeof(ip));
+ memset(&macaddr, 0, sizeof(macaddr));
/* Check if EVPN is enabled. */
if (!is_evpn_enabled())
@@ -4685,13 +4669,19 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if)
zebra_evpn_send_add_to_client(zevpn);
/* Install any remote neighbors for this VNI. */
- memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn;
hash_iterate(zevpn->neigh_table, zebra_evpn_install_neigh_hash,
&n_wctx);
/* Link the SVI from the access VLAN */
zebra_evpn_acc_bd_svi_set(ifp->info, link_if->info, true);
+
+ /* Update MACIP routes created by advertise-svi-ip */
+ if (advertise_svi_macip_enabled(zevpn)) {
+ zebra_evpn_del_macip_for_intf(ifp, zevpn);
+ zebra_evpn_add_macip_for_intf(ifp, zevpn);
+ }
}
return 0;
@@ -5155,12 +5145,12 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
zebra_evpn_read_mac_neigh(zevpn, ifp);
- memset(&m_wctx, 0, sizeof(struct mac_walk_ctx));
+ memset(&m_wctx, 0, sizeof(m_wctx));
m_wctx.zevpn = zevpn;
hash_iterate(zevpn->mac_table,
zebra_evpn_install_mac_hash, &m_wctx);
- memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
+ memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn;
hash_iterate(zevpn->neigh_table,
zebra_evpn_install_neigh_hash, &n_wctx);
@@ -5277,8 +5267,6 @@ int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf, vni_t vni,
struct zebra_vrf *zvrf_evpn = NULL;
zvrf_evpn = zebra_vrf_get_evpn();
- if (!zvrf_evpn)
- return -1;
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("vrf %s vni %u %s", zvrf_name(zvrf), vni,
@@ -5306,10 +5294,6 @@ int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf, vni_t vni,
/* add the L3-VNI to the global table */
zl3vni = zl3vni_add(vni, zvrf_id(zvrf));
- if (!zl3vni) {
- snprintf(err, err_str_sz, "Could not add L3-VNI");
- return -1;
- }
/* associate the vrf with vni */
zvrf->l3vni = vni;
@@ -5875,8 +5859,6 @@ void zebra_vxlan_cleanup_tables(struct zebra_vrf *zvrf)
{
struct zebra_vrf *evpn_zvrf = zebra_vrf_get_evpn();
- if (!zvrf)
- return;
hash_iterate(zvrf->evpn_table, zebra_evpn_vxlan_cleanup_all, zvrf);
zebra_vxlan_cleanup_sg_table(zvrf);
@@ -6254,7 +6236,7 @@ static int zebra_evpn_pim_cfg_clean_up(struct zserv *client)
{
struct zebra_vrf *zvrf = zebra_vrf_get_evpn();
- if (zvrf && CHECK_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG)) {
+ if (CHECK_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG)) {
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VxLAN SG updates to PIM, stop");
UNSET_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG);