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.c690
1 files changed, 295 insertions, 395 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index e07dc6059f..d3ede66fb0 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -58,9 +58,8 @@ DEFINE_MTYPE_STATIC(ZEBRA, NEIGH, "VNI Neighbor");
/* static function declarations */
-static int ip_prefix_send_to_client(vrf_id_t vrf_id,
- struct prefix *p,
- uint16_t cmd);
+static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,
+ uint16_t cmd);
static void zvni_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json);
static void zvni_print_neigh_hash(struct hash_backet *backet, void *ctxt);
static void zvni_print_neigh_hash_all_vni(struct hash_backet *backet,
@@ -75,8 +74,7 @@ static void zvni_print_mac_hash_all_vni(struct hash_backet *backet, void *ctxt);
static void zvni_print(zebra_vni_t *zvni, void **ctxt);
static void zvni_print_hash(struct hash_backet *backet, void *ctxt[]);
-static int zvni_macip_send_msg_to_client(vni_t vni,
- struct ethaddr *macaddr,
+static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr,
struct ipaddr *ip, u_char flags,
u_int16_t cmd);
static unsigned int neigh_hash_keymake(void *p);
@@ -88,21 +86,18 @@ static int zvni_neigh_del(zebra_vni_t *zvni, zebra_neigh_t *n);
static int zvni_neigh_del_hash_entry(struct hash_backet *backet, void *arg);
static void zvni_neigh_del_from_vtep(zebra_vni_t *zvni, int uninstall,
struct in_addr *r_vtep_ip);
-static void zvni_neigh_del_all(zebra_vni_t *zvni,
- int uninstall, int upd_client, u_int32_t flags);
+static void zvni_neigh_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
+ u_int32_t flags);
static zebra_neigh_t *zvni_neigh_lookup(zebra_vni_t *zvni, struct ipaddr *ip);
-static int zvni_neigh_send_add_to_client(vni_t vni,
- struct ipaddr *ip,
+static int zvni_neigh_send_add_to_client(vni_t vni, struct ipaddr *ip,
struct ethaddr *macaddr, u_char flags);
-static int zvni_neigh_send_del_to_client(vni_t vni,
- struct ipaddr *ip,
+static int zvni_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip,
struct ethaddr *macaddr, u_char flags);
static int zvni_neigh_install(zebra_vni_t *zvni, zebra_neigh_t *n);
static int zvni_neigh_uninstall(zebra_vni_t *zvni, zebra_neigh_t *n);
static zebra_vni_t *zvni_from_svi(struct interface *ifp,
- struct interface *br_if);
-static struct interface *zvni_map_to_svi(vlanid_t vid,
- struct interface *br_if);
+ struct interface *br_if);
+static struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if);
/* l3-vni next-hop neigh related APIs */
static zebra_neigh_t *zl3vni_nh_lookup(zebra_l3vni_t *zl3vni,
@@ -124,8 +119,7 @@ static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni,
struct ethaddr *rmac);
static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac);
static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac);
-static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni,
- zebra_mac_t *zrmac);
+static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac);
/* l3-vni related APIs*/
static zebra_l3vni_t *zl3vni_lookup(vni_t vni);
@@ -146,13 +140,13 @@ static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac);
static int zvni_mac_del_hash_entry(struct hash_backet *backet, void *arg);
static void zvni_mac_del_from_vtep(zebra_vni_t *zvni, int uninstall,
struct in_addr *r_vtep_ip);
-static void zvni_mac_del_all(zebra_vni_t *zvni,
- int uninstall, int upd_client, u_int32_t flags);
+static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
+ u_int32_t flags);
static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *macaddr);
-static int zvni_mac_send_add_to_client(vni_t vni,
- struct ethaddr *macaddr, u_char flags);
-static int zvni_mac_send_del_to_client(vni_t vni,
- struct ethaddr *macaddr, u_char flags);
+static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr,
+ u_char flags);
+static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr,
+ u_char flags);
static zebra_vni_t *zvni_map_vlan(struct interface *ifp,
struct interface *br_if, vlanid_t vid);
static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac);
@@ -434,8 +428,7 @@ static void zvni_print_neigh_hash_all_vni(struct hash_backet *backet,
}
/* print a specific next hop for an l3vni */
-static void zl3vni_print_nh(zebra_neigh_t *n,
- struct vty *vty,
+static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty,
json_object *json)
{
char buf1[ETHER_ADDR_STRLEN];
@@ -448,7 +441,7 @@ static void zl3vni_print_nh(zebra_neigh_t *n,
vty_out(vty, "Ip: %s\n",
ipaddr2str(&n->ip, buf2, sizeof(buf2)));
vty_out(vty, " RMAC: %s\n",
- prefix_mac2str(&n->emac, buf1, sizeof(buf1)));
+ prefix_mac2str(&n->emac, buf1, sizeof(buf1)));
vty_out(vty, " Refcount: %d\n", listcount(n->host_list));
vty_out(vty, " Prefixes:\n");
for (ALL_LIST_ELEMENTS_RO(n->host_list, node, p))
@@ -456,25 +449,22 @@ static void zl3vni_print_nh(zebra_neigh_t *n,
prefix2str(p, buf2, sizeof(buf2)));
} else {
json_hosts = json_object_new_array();
- json_object_string_add(json, "ip",
- ipaddr2str(&(n->ip), buf2,
- sizeof(buf2)));
- json_object_string_add(json, "routerMac",
- prefix_mac2str(&n->emac, buf2,
- sizeof(buf2)));
+ json_object_string_add(
+ json, "ip", ipaddr2str(&(n->ip), buf2, sizeof(buf2)));
+ json_object_string_add(
+ json, "routerMac",
+ prefix_mac2str(&n->emac, buf2, sizeof(buf2)));
json_object_int_add(json, "refCount", listcount(n->host_list));
for (ALL_LIST_ELEMENTS_RO(n->host_list, node, p))
json_object_array_add(json_hosts,
- json_object_new_string(
- prefix2str(p, buf2,
- sizeof(buf2))));
+ json_object_new_string(prefix2str(
+ p, buf2, sizeof(buf2))));
json_object_object_add(json, "prefixList", json_hosts);
}
}
/* Print a specific RMAC entry */
-static void zl3vni_print_rmac(zebra_mac_t *zrmac,
- struct vty *vty,
+static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty,
json_object *json)
{
char buf1[ETHER_ADDR_STRLEN];
@@ -495,19 +485,17 @@ static void zl3vni_print_rmac(zebra_mac_t *zrmac,
prefix2str(p, buf2, sizeof(buf2)));
} else {
json_hosts = json_object_new_array();
- json_object_string_add(json, "routerMac",
- prefix_mac2str(&zrmac->macaddr,
- buf1,
- sizeof(buf1)));
+ json_object_string_add(
+ json, "routerMac",
+ prefix_mac2str(&zrmac->macaddr, buf1, sizeof(buf1)));
json_object_string_add(json, "vtepIp",
inet_ntoa(zrmac->fwd_info.r_vtep_ip));
json_object_int_add(json, "refCount",
listcount(zrmac->host_list));
for (ALL_LIST_ELEMENTS_RO(zrmac->host_list, node, p))
json_object_array_add(json_hosts,
- json_object_new_string(
- prefix2str(p, buf2,
- sizeof(buf2))));
+ json_object_new_string(prefix2str(
+ p, buf2, sizeof(buf2))));
json_object_object_add(json, "prefixList", json_hosts);
}
}
@@ -736,8 +724,7 @@ static void zvni_print_mac_hash_all_vni(struct hash_backet *backet, void *ctxt)
}
}
-static void zl3vni_print_nh_hash(struct hash_backet *backet,
- void *ctx)
+static void zl3vni_print_nh_hash(struct hash_backet *backet, void *ctx)
{
struct nh_walk_ctx *wctx = NULL;
struct vty *vty = NULL;
@@ -763,9 +750,9 @@ static void zl3vni_print_nh_hash(struct hash_backet *backet,
} else {
json_object_string_add(json_nh, "nexthopIp",
ipaddr2str(&n->ip, buf2, sizeof(buf2)));
- json_object_string_add(json_nh, "routerMac",
- prefix_mac2str(&n->emac, buf1,
- sizeof(buf1)));
+ json_object_string_add(
+ json_nh, "routerMac",
+ prefix_mac2str(&n->emac, buf1, sizeof(buf1)));
json_object_object_add(json_vni,
ipaddr2str(&(n->ip), buf2, sizeof(buf2)),
json_nh);
@@ -803,8 +790,7 @@ static void zl3vni_print_nh_hash_all_vni(struct hash_backet *backet,
}
if (json == NULL) {
- vty_out(vty, "\nVNI %u #Next-Hops %u\n\n",
- zl3vni->vni, num_nh);
+ vty_out(vty, "\nVNI %u #Next-Hops %u\n\n", zl3vni->vni, num_nh);
vty_out(vty, "%-15s %-17s\n", "IP", "RMAC");
} else
json_object_int_add(json_vni, "numNextHops", num_nh);
@@ -848,8 +834,7 @@ static void zl3vni_print_rmac_hash_all_vni(struct hash_backet *backet,
}
if (json == NULL) {
- vty_out(vty, "\nVNI %u #RMACs %u\n\n",
- zl3vni->vni, num_rmacs);
+ vty_out(vty, "\nVNI %u #RMACs %u\n\n", zl3vni->vni, num_rmacs);
vty_out(vty, "%-17s %-21s\n", "RMAC", "Remote VTEP");
} else
json_object_int_add(json_vni, "numRmacs", num_rmacs);
@@ -866,8 +851,7 @@ static void zl3vni_print_rmac_hash_all_vni(struct hash_backet *backet,
json_object_object_add(json, vni_str, json_vni);
}
-static void zl3vni_print_rmac_hash(struct hash_backet *backet,
- void *ctx)
+static void zl3vni_print_rmac_hash(struct hash_backet *backet, void *ctx)
{
zebra_mac_t *zrmac = NULL;
struct rmac_walk_ctx *wctx = NULL;
@@ -888,17 +872,16 @@ static void zl3vni_print_rmac_hash(struct hash_backet *backet,
if (!json) {
vty_out(vty, "%-17s %-21s\n",
prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)),
- inet_ntoa(zrmac->fwd_info.r_vtep_ip));
+ inet_ntoa(zrmac->fwd_info.r_vtep_ip));
} else {
- json_object_string_add(json_rmac, "routerMac",
- prefix_mac2str(&zrmac->macaddr, buf,
- sizeof(buf)));
+ json_object_string_add(
+ json_rmac, "routerMac",
+ prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)));
json_object_string_add(json_rmac, "vtepIp",
inet_ntoa(zrmac->fwd_info.r_vtep_ip));
- json_object_object_add(json,
- prefix_mac2str(&zrmac->macaddr, buf,
- sizeof(buf)),
- json_rmac);
+ json_object_object_add(
+ json, prefix_mac2str(&zrmac->macaddr, buf, sizeof(buf)),
+ json_rmac);
}
}
@@ -918,19 +901,17 @@ static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
if (!json) {
vty_out(vty, "VNI: %u\n", zl3vni->vni);
vty_out(vty, " Type: %s\n", "L3");
- vty_out(vty, " Tenant VRF: %s\n",
- zl3vni_vrf_name(zl3vni));
+ vty_out(vty, " Tenant VRF: %s\n", zl3vni_vrf_name(zl3vni));
vty_out(vty, " Local Vtep Ip: %s\n",
inet_ntoa(zl3vni->local_vtep_ip));
vty_out(vty, " Vxlan-Intf: %s\n",
zl3vni_vxlan_if_name(zl3vni));
- vty_out(vty, " SVI-If: %s\n",
- zl3vni_svi_if_name(zl3vni));
- vty_out(vty, " State: %s\n",
- zl3vni_state2str(zl3vni));
+ vty_out(vty, " SVI-If: %s\n", zl3vni_svi_if_name(zl3vni));
+ vty_out(vty, " State: %s\n", zl3vni_state2str(zl3vni));
vty_out(vty, " VNI Filter: %s\n",
- CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY) ?
- "prefix-routes-only" : "none");
+ CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY)
+ ? "prefix-routes-only"
+ : "none");
vty_out(vty, " Router MAC: %s\n",
zl3vni_rmac2str(zl3vni, buf, sizeof(buf)));
vty_out(vty, " L2 VNIs: ");
@@ -947,17 +928,16 @@ static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
zl3vni_vxlan_if_name(zl3vni));
json_object_string_add(json, "sviIntf",
zl3vni_svi_if_name(zl3vni));
- json_object_string_add(json, "state",
- zl3vni_state2str(zl3vni));
- json_object_string_add(json, "vrf",
- zl3vni_vrf_name(zl3vni));
- json_object_string_add(json, "routerMac",
- zl3vni_rmac2str(zl3vni, buf,
- sizeof(buf)));
- json_object_string_add(json, "vniFilter",
- CHECK_FLAG(zl3vni->filter,
- PREFIX_ROUTES_ONLY) ?
- "prefix-routes-only" : "none");
+ json_object_string_add(json, "state", zl3vni_state2str(zl3vni));
+ json_object_string_add(json, "vrf", zl3vni_vrf_name(zl3vni));
+ json_object_string_add(
+ json, "routerMac",
+ zl3vni_rmac2str(zl3vni, buf, sizeof(buf)));
+ json_object_string_add(
+ json, "vniFilter",
+ CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY)
+ ? "prefix-routes-only"
+ : "none");
for (ALL_LIST_ELEMENTS(zl3vni->l2vnis, node, nnode, zvni)) {
json_object_array_add(json_vni_list,
json_object_new_int(zvni->vni));
@@ -1001,10 +981,9 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt)
num_macs = num_valid_macs(zvni);
num_neigh = hashcount(zvni->neigh_table);
if (json == NULL) {
- vty_out(vty, " VxLAN interface: %s\n",
- zvni->vxlan_if->name);
+ vty_out(vty, " VxLAN interface: %s\n", zvni->vxlan_if->name);
vty_out(vty, " VxLAN ifIndex: %u\n", zvni->vxlan_if->ifindex);
- vty_out(vty," Local VTEP IP: %s\n",
+ vty_out(vty, " Local VTEP IP: %s\n",
inet_ntoa(zvni->local_vtep_ip));
} else {
json_object_string_add(json, "vxlanInterface",
@@ -1054,8 +1033,7 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt)
}
/* print a L3 VNI hash entry */
-static void zl3vni_print_hash(struct hash_backet *backet,
- void *ctx[])
+static void zl3vni_print_hash(struct hash_backet *backet, void *ctx[])
{
struct vty *vty = NULL;
json_object *json = NULL;
@@ -1070,13 +1048,10 @@ static void zl3vni_print_hash(struct hash_backet *backet,
return;
if (!json) {
- vty_out(vty,
- "%-10u %-4s %-21s %-8lu %-8lu %-15s %-37s\n",
- zl3vni->vni, "L3",
- zl3vni_vxlan_if_name(zl3vni),
+ vty_out(vty, "%-10u %-4s %-21s %-8lu %-8lu %-15s %-37s\n",
+ zl3vni->vni, "L3", zl3vni_vxlan_if_name(zl3vni),
hashcount(zl3vni->rmac_table),
- hashcount(zl3vni->nh_table),
- "n/a",
+ hashcount(zl3vni->nh_table), "n/a",
zl3vni_vrf_name(zl3vni));
} else {
char vni_str[VNI_STR_LEN];
@@ -1096,7 +1071,6 @@ static void zl3vni_print_hash(struct hash_backet *backet,
zl3vni_vrf_name(zl3vni));
json_object_object_add(json, vni_str, json_vni);
}
-
}
/*
@@ -1131,12 +1105,10 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[])
num_macs = num_valid_macs(zvni);
num_neigh = hashcount(zvni->neigh_table);
if (json == NULL)
- vty_out(vty,
- "%-10u %-4s %-21s %-8u %-8u %-15u %-37s\n",
+ vty_out(vty, "%-10u %-4s %-21s %-8u %-8u %-15u %-37s\n",
zvni->vni, "L2",
zvni->vxlan_if ? zvni->vxlan_if->name : "unknown",
- num_macs, num_neigh,
- num_vteps,
+ num_macs, num_neigh, num_vteps,
vrf_id_to_name(zvni->vrf_id));
else {
char vni_str[VNI_STR_LEN];
@@ -1170,8 +1142,7 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[])
/*
* Inform BGP about local MACIP.
*/
-static int zvni_macip_send_msg_to_client(vni_t vni,
- struct ethaddr *macaddr,
+static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr,
struct ipaddr *ip, u_char flags,
u_int16_t cmd)
{
@@ -1214,8 +1185,8 @@ static int zvni_macip_send_msg_to_client(vni_t vni,
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"Send MACIP %s flags 0x%x MAC %s IP %s L2-VNI %u to %s",
- (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del",
- flags, prefix_mac2str(macaddr, buf, sizeof(buf)),
+ (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del", flags,
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
ipaddr2str(ip, buf2, sizeof(buf2)), vni,
zebra_route_string(client->proto));
@@ -1372,8 +1343,8 @@ static void zvni_neigh_del_from_vtep(zebra_vni_t *zvni, int uninstall,
/*
* Delete all neighbor entries for this VNI.
*/
-static void zvni_neigh_del_all(zebra_vni_t *zvni,
- int uninstall, int upd_client, u_int32_t flags)
+static void zvni_neigh_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
+ u_int32_t flags)
{
struct neigh_walk_ctx wctx;
@@ -1471,8 +1442,8 @@ static void zvni_process_neigh_on_local_mac_del(zebra_vni_t *zvni,
zvni->vni);
ZEBRA_NEIGH_SET_INACTIVE(n);
- zvni_neigh_send_del_to_client(
- zvni->vni, &n->ip, &n->emac, 0);
+ zvni_neigh_send_del_to_client(zvni->vni, &n->ip,
+ &n->emac, 0);
}
} else if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)) {
if (IS_ZEBRA_DEBUG_VXLAN)
@@ -1508,8 +1479,8 @@ static void zvni_process_neigh_on_remote_mac_add(zebra_vni_t *zvni,
zvni->vni);
ZEBRA_NEIGH_SET_INACTIVE(n);
- zvni_neigh_send_del_to_client(
- zvni->vni, &n->ip, &n->emac, 0);
+ zvni_neigh_send_del_to_client(zvni->vni, &n->ip,
+ &n->emac, 0);
}
}
}
@@ -1540,12 +1511,11 @@ static void zvni_process_neigh_on_remote_mac_del(zebra_vni_t *zvni,
/*
* Inform BGP about local neighbor addition.
*/
-static int zvni_neigh_send_add_to_client(vni_t vni,
- struct ipaddr *ip,
+static int zvni_neigh_send_add_to_client(vni_t vni, struct ipaddr *ip,
struct ethaddr *macaddr,
u_char neigh_flags)
{
- u_char flags = 0;
+ u_char flags = 0;
if (CHECK_FLAG(neigh_flags, ZEBRA_NEIGH_DEF_GW))
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
@@ -1557,8 +1527,7 @@ static int zvni_neigh_send_add_to_client(vni_t vni,
/*
* Inform BGP about local neighbor deletion.
*/
-static int zvni_neigh_send_del_to_client(vni_t vni,
- struct ipaddr *ip,
+static int zvni_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip,
struct ethaddr *macaddr, u_char flags)
{
return zvni_macip_send_msg_to_client(vni, macaddr, ip, flags,
@@ -1725,8 +1694,7 @@ static int zvni_add_macip_for_intf(struct interface *ifp, zebra_vni_t *zvni)
}
-static int zvni_advertise_subnet(zebra_vni_t *zvni,
- struct interface *ifp,
+static int zvni_advertise_subnet(zebra_vni_t *zvni, struct interface *ifp,
int advertise)
{
struct listnode *cnode = NULL, *cnnode = NULL;
@@ -1747,7 +1715,7 @@ static int zvni_advertise_subnet(zebra_vni_t *zvni,
apply_mask(&p);
if (advertise)
ip_prefix_send_to_client(ifp->vrf_id, &p,
- ZEBRA_IP_PREFIX_ROUTE_ADD);
+ ZEBRA_IP_PREFIX_ROUTE_ADD);
else
ip_prefix_send_to_client(ifp->vrf_id, &p,
ZEBRA_IP_PREFIX_ROUTE_DEL);
@@ -1823,8 +1791,7 @@ static int zvni_gw_macip_add(struct interface *ifp, zebra_vni_t *zvni,
prefix_mac2str(macaddr, buf, sizeof(buf)),
ipaddr2str(ip, buf2, sizeof(buf2)));
- zvni_neigh_send_add_to_client(zvni->vni, ip, macaddr,
- n->flags);
+ zvni_neigh_send_add_to_client(zvni->vni, ip, macaddr, n->flags);
return 0;
}
@@ -1860,13 +1827,11 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
/* only need to delete the entry from bgp if we sent it before */
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
- ifp->vrf_id, ifp->name,
- ifp->ifindex, zvni->vni,
- prefix_mac2str(&(n->emac),
- NULL,
- ETHER_ADDR_STRLEN),
- ipaddr2str(ip, buf2, sizeof(buf2)));
+ zlog_debug(
+ "%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
+ ifp->vrf_id, ifp->name, ifp->ifindex, zvni->vni,
+ prefix_mac2str(&(n->emac), NULL, ETHER_ADDR_STRLEN),
+ ipaddr2str(ip, buf2, sizeof(buf2)));
/* Remove neighbor from BGP. */
zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac,
@@ -1908,7 +1873,8 @@ static void zvni_gw_macip_del_for_vni_hash(struct hash_backet *backet,
zl2_info = zif->l2info.vxl;
- vlan_if = zvni_map_to_svi(zl2_info.access_vlan, zif->brslave_info.br_if);
+ vlan_if =
+ zvni_map_to_svi(zl2_info.access_vlan, zif->brslave_info.br_if);
if (!vlan_if)
return;
@@ -1947,8 +1913,8 @@ static void zvni_gw_macip_add_for_vni_hash(struct hash_backet *backet,
return;
zl2_info = zif->l2info.vxl;
- vlan_if = zvni_map_to_svi(zl2_info.access_vlan,
- zif->brslave_info.br_if);
+ vlan_if =
+ zvni_map_to_svi(zl2_info.access_vlan, zif->brslave_info.br_if);
if (!vlan_if)
return;
@@ -1988,8 +1954,7 @@ static int mac_cmp(const void *p1, const void *p2)
if (pmac1 == NULL || pmac2 == NULL)
return 0;
- return (memcmp(pmac1->macaddr.octet, pmac2->macaddr.octet,
- ETH_ALEN)
+ return (memcmp(pmac1->macaddr.octet, pmac2->macaddr.octet, ETH_ALEN)
== 0);
}
@@ -2059,9 +2024,8 @@ static int zvni_mac_del_hash_entry(struct hash_backet *backet, void *arg)
&& IPV4_ADDR_SAME(&mac->fwd_info.r_vtep_ip,
&wctx->r_vtep_ip))) {
if (wctx->upd_client && (mac->flags & ZEBRA_MAC_LOCAL)) {
- zvni_mac_send_del_to_client(
- wctx->zvni->vni, &mac->macaddr,
- mac->flags);
+ zvni_mac_send_del_to_client(wctx->zvni->vni,
+ &mac->macaddr, mac->flags);
}
if (wctx->uninstall)
@@ -2098,8 +2062,8 @@ static void zvni_mac_del_from_vtep(zebra_vni_t *zvni, int uninstall,
/*
* Delete all MAC entries for this VNI.
*/
-static void zvni_mac_del_all(zebra_vni_t *zvni,
- int uninstall, int upd_client, u_int32_t flags)
+static void zvni_mac_del_all(zebra_vni_t *zvni, int uninstall, int upd_client,
+ u_int32_t flags)
{
struct mac_walk_ctx wctx;
@@ -2135,11 +2099,10 @@ static zebra_mac_t *zvni_mac_lookup(zebra_vni_t *zvni, struct ethaddr *mac)
/*
* Inform BGP about local MAC addition.
*/
-static int zvni_mac_send_add_to_client(vni_t vni,
- struct ethaddr *macaddr,
+static int zvni_mac_send_add_to_client(vni_t vni, struct ethaddr *macaddr,
u_char mac_flags)
{
- u_char flags = 0;
+ u_char flags = 0;
if (CHECK_FLAG(mac_flags, ZEBRA_MAC_STICKY))
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
@@ -2153,11 +2116,10 @@ static int zvni_mac_send_add_to_client(vni_t vni,
/*
* Inform BGP about local MAC deletion.
*/
-static int zvni_mac_send_del_to_client(vni_t vni,
- struct ethaddr *macaddr,
+static int zvni_mac_send_del_to_client(vni_t vni, struct ethaddr *macaddr,
u_char mac_flags)
{
- u_char flags = 0;
+ u_char flags = 0;
if (CHECK_FLAG(mac_flags, ZEBRA_MAC_STICKY))
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
@@ -2448,8 +2410,7 @@ static void zvni_deref_ip2mac(zebra_vni_t *zvni, zebra_mac_t *mac,
/*
* Read and populate local MACs and neighbors corresponding to this VNI.
*/
-static void zvni_read_mac_neigh(zebra_vni_t *zvni,
- struct interface *ifp)
+static void zvni_read_mac_neigh(zebra_vni_t *zvni, struct interface *ifp)
{
struct zebra_ns *zns;
struct zebra_if *zif;
@@ -2616,8 +2577,8 @@ static int zvni_send_add_to_client(zebra_vni_t *zvni)
stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Send VNI_ADD %u %s tenant vrf %s to %s",
- zvni->vni, inet_ntoa(zvni->local_vtep_ip),
+ zlog_debug("Send VNI_ADD %u %s tenant vrf %s to %s", zvni->vni,
+ inet_ntoa(zvni->local_vtep_ip),
vrf_id_to_name(zvni->vrf_id),
zebra_route_string(client->proto));
@@ -2689,8 +2650,9 @@ static void zvni_build_hash_table()
if (zl3vni) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("create L3-VNI hash for Intf %s(%u) L3-VNI %u",
- ifp->name, ifp->ifindex, vni);
+ zlog_debug(
+ "create L3-VNI hash for Intf %s(%u) L3-VNI %u",
+ ifp->name, ifp->ifindex, vni);
/* associate with vxlan_if */
zl3vni->local_vtep_ip = vxl->vtep_ip;
@@ -2892,8 +2854,7 @@ static void zvni_cleanup_all(struct hash_backet *backet, void *arg)
}
/* cleanup L3VNI */
-static void zl3vni_cleanup_all(struct hash_backet *backet,
- void *args)
+static void zl3vni_cleanup_all(struct hash_backet *backet, void *args)
{
zebra_l3vni_t *zl3vni = NULL;
@@ -2904,8 +2865,7 @@ static void zl3vni_cleanup_all(struct hash_backet *backet,
zebra_vxlan_process_l3vni_oper_down(zl3vni);
}
-static int is_host_present_in_host_list(struct list *list,
- struct prefix *host)
+static int is_host_present_in_host_list(struct list *list, struct prefix *host)
{
struct listnode *node = NULL;
struct prefix *p = NULL;
@@ -2917,8 +2877,7 @@ static int is_host_present_in_host_list(struct list *list,
return 0;
}
-static void host_list_add_host(struct list *list,
- struct prefix *host)
+static void host_list_add_host(struct list *list, struct prefix *host)
{
struct prefix *p = NULL;
@@ -2928,8 +2887,7 @@ static void host_list_add_host(struct list *list,
listnode_add_sort(list, p);
}
-static void host_list_delete_host(struct list *list,
- struct prefix *host)
+static void host_list_delete_host(struct list *list, struct prefix *host)
{
struct listnode *node = NULL, *nnode = NULL, *node_to_del = NULL;
struct prefix *p = NULL;
@@ -2978,8 +2936,7 @@ static void *zl3vni_rmac_alloc(void *p)
/*
* Add RMAC entry to l3-vni
*/
-static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni,
- struct ethaddr *rmac)
+static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, struct ethaddr *rmac)
{
zebra_mac_t tmp_rmac;
zebra_mac_t *zrmac = NULL;
@@ -3001,8 +2958,7 @@ static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni,
/*
* Delete MAC entry.
*/
-static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni,
- zebra_mac_t *zrmac)
+static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
{
zebra_mac_t *tmp_rmac;
@@ -3020,14 +2976,13 @@ static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni,
/*
* Install remote RMAC into the kernel.
*/
-static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni,
- zebra_mac_t *zrmac)
+static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
{
struct zebra_if *zif = NULL;
struct zebra_l2info_vxlan *vxl = NULL;
- if (!(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE)) ||
- !(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE_RMAC)))
+ if (!(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE))
+ || !(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE_RMAC)))
return 0;
zif = zl3vni->vxlan_if->info;
@@ -3037,29 +2992,27 @@ static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni,
vxl = &zif->l2info.vxl;
return kernel_add_mac(zl3vni->vxlan_if, vxl->access_vlan,
- &zrmac->macaddr,
- zrmac->fwd_info.r_vtep_ip, 0);
+ &zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, 0);
}
/*
* Uninstall remote RMAC from the kernel.
*/
-static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni,
- zebra_mac_t *zrmac)
+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;
- if (!(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE)) ||
- !(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE_RMAC)))
+ if (!(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE))
+ || !(CHECK_FLAG(zrmac->flags, ZEBRA_MAC_REMOTE_RMAC)))
return 0;
if (!zl3vni->vxlan_if) {
zlog_err(
- "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);
+ "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;
}
@@ -3074,8 +3027,7 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni,
}
/* handle rmac add */
-static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
- struct ethaddr *rmac,
+static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, struct ethaddr *rmac,
struct ipaddr *vtep_ip,
struct prefix *host_prefix)
{
@@ -3090,10 +3042,9 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
if (!zrmac) {
zlog_warn(
"Failed to add RMAC %s L3VNI %u Remote VTEP %s",
- prefix_mac2str(rmac, buf,
- sizeof(buf)),
- zl3vni->vni, ipaddr2str(vtep_ip, buf1,
- sizeof(buf1)));
+ prefix_mac2str(rmac, buf, sizeof(buf)),
+ zl3vni->vni,
+ ipaddr2str(vtep_ip, buf1, sizeof(buf1)));
return -1;
}
memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info));
@@ -3110,8 +3061,7 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,
/* handle rmac delete */
-static int zl3vni_remote_rmac_del(zebra_l3vni_t *zl3vni,
- struct ethaddr *rmac,
+static int zl3vni_remote_rmac_del(zebra_l3vni_t *zl3vni, struct ethaddr *rmac,
struct prefix *host_prefix)
{
zebra_mac_t *zrmac = NULL;
@@ -3135,8 +3085,7 @@ static int zl3vni_remote_rmac_del(zebra_l3vni_t *zl3vni,
/*
* Look up nh hash entry on a l3-vni.
*/
-static zebra_neigh_t *zl3vni_nh_lookup(zebra_l3vni_t *zl3vni,
- struct ipaddr *ip)
+static zebra_neigh_t *zl3vni_nh_lookup(zebra_l3vni_t *zl3vni, struct ipaddr *ip)
{
zebra_neigh_t tmp;
zebra_neigh_t *n;
@@ -3166,8 +3115,7 @@ static void *zl3vni_nh_alloc(void *p)
/*
* Add neighbor entry.
*/
-static zebra_neigh_t *zl3vni_nh_add(zebra_l3vni_t *zl3vni,
- struct ipaddr *ip,
+static zebra_neigh_t *zl3vni_nh_add(zebra_l3vni_t *zl3vni, struct ipaddr *ip,
struct ethaddr *mac)
{
zebra_neigh_t tmp_n;
@@ -3191,8 +3139,7 @@ static zebra_neigh_t *zl3vni_nh_add(zebra_l3vni_t *zl3vni,
/*
* Delete neighbor entry.
*/
-static int zl3vni_nh_del(zebra_l3vni_t *zl3vni,
- zebra_neigh_t *n)
+static int zl3vni_nh_del(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
{
zebra_neigh_t *tmp_n;
@@ -3210,14 +3157,13 @@ static int zl3vni_nh_del(zebra_l3vni_t *zl3vni,
/*
* Install remote nh as neigh into the kernel.
*/
-static int zl3vni_nh_install(zebra_l3vni_t *zl3vni,
- zebra_neigh_t *n)
+static int zl3vni_nh_install(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
{
if (!is_l3vni_oper_up(zl3vni))
return -1;
- if (!(n->flags & ZEBRA_NEIGH_REMOTE) ||
- !(n->flags & ZEBRA_NEIGH_REMOTE_NH))
+ if (!(n->flags & ZEBRA_NEIGH_REMOTE)
+ || !(n->flags & ZEBRA_NEIGH_REMOTE_NH))
return 0;
return kernel_add_neigh(zl3vni->svi_if, &n->ip, &n->emac);
@@ -3226,11 +3172,10 @@ static int zl3vni_nh_install(zebra_l3vni_t *zl3vni,
/*
* Uninstall remote nh from the kernel.
*/
-static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni,
- zebra_neigh_t *n)
+static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
{
- if (!(n->flags & ZEBRA_NEIGH_REMOTE) ||
- !(n->flags & ZEBRA_NEIGH_REMOTE_NH))
+ if (!(n->flags & ZEBRA_NEIGH_REMOTE)
+ || !(n->flags & ZEBRA_NEIGH_REMOTE_NH))
return 0;
if (!zl3vni->svi_if || !if_is_operative(zl3vni->svi_if))
@@ -3240,8 +3185,7 @@ static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni,
}
/* add remote vtep as a neigh entry */
-static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
- struct ipaddr *vtep_ip,
+static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, struct ipaddr *vtep_ip,
struct ethaddr *rmac,
struct prefix *host_prefix)
{
@@ -3256,10 +3200,8 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
zlog_warn(
"Failed to add NH as Neigh (IP %s MAC %s L3-VNI %u)",
- ipaddr2str(vtep_ip, buf1,
- sizeof(buf1)),
- prefix_mac2str(rmac, buf,
- sizeof(buf)),
+ ipaddr2str(vtep_ip, buf1, sizeof(buf1)),
+ prefix_mac2str(rmac, buf, sizeof(buf)),
zl3vni->vni);
return -1;
}
@@ -3275,8 +3217,7 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,
}
/* handle nh neigh delete */
-static int zl3vni_remote_nh_del(zebra_l3vni_t *zl3vni,
- struct ipaddr *vtep_ip,
+static int zl3vni_remote_nh_del(zebra_l3vni_t *zl3vni, struct ipaddr *vtep_ip,
struct prefix *host_prefix)
{
zebra_neigh_t *nh = NULL;
@@ -3301,8 +3242,8 @@ static int zl3vni_remote_nh_del(zebra_l3vni_t *zl3vni,
/* handle neigh update from kernel - the only thing of interest is to
* readd stale entries.
*/
-static int zl3vni_local_nh_add_update(zebra_l3vni_t *zl3vni,
- struct ipaddr *ip, u_int16_t state)
+static int zl3vni_local_nh_add_update(zebra_l3vni_t *zl3vni, struct ipaddr *ip,
+ u_int16_t state)
{
#ifdef GNU_LINUX
zebra_neigh_t *n = NULL;
@@ -3321,8 +3262,7 @@ static int zl3vni_local_nh_add_update(zebra_l3vni_t *zl3vni,
}
/* handle neigh delete from kernel */
-static int zl3vni_local_nh_del(zebra_l3vni_t *zl3vni,
- struct ipaddr *ip)
+static int zl3vni_local_nh_del(zebra_l3vni_t *zl3vni, struct ipaddr *ip)
{
zebra_neigh_t *n = NULL;
@@ -3416,13 +3356,12 @@ static zebra_l3vni_t *zl3vni_add(vni_t vni, vrf_id_t vrf_id)
zl3vni->l2vnis->cmp = (int (*)(void *, void *))vni_hash_cmp;
/* Create hash table for remote RMAC */
- zl3vni->rmac_table =
- hash_create(mac_hash_keymake, mac_cmp,
- "Zebra L3-VNI RMAC-Table");
+ zl3vni->rmac_table = hash_create(mac_hash_keymake, mac_cmp,
+ "Zebra L3-VNI RMAC-Table");
/* Create hash table for neighbors */
zl3vni->nh_table = hash_create(neigh_hash_keymake, neigh_cmp,
- "Zebra L3-VNI next-hop table");
+ "Zebra L3-VNI next-hop table");
return zl3vni;
}
@@ -3491,7 +3430,7 @@ static struct interface *zl3vni_map_to_vxlan_if(zebra_l3vni_t *zl3vni)
static struct interface *zl3vni_map_to_svi_if(zebra_l3vni_t *zl3vni)
{
- struct zebra_if *zif = NULL; /* zebra_if for vxlan_if */
+ struct zebra_if *zif = NULL; /* zebra_if for vxlan_if */
struct zebra_l2info_vxlan *vxl = NULL; /* l2 info for vxlan_if */
if (!zl3vni)
@@ -3614,8 +3553,7 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni)
s = client->obuf;
stream_reset(s);
- zclient_create_header(s, ZEBRA_L3VNI_ADD,
- zl3vni_vrf_id(zl3vni));
+ zclient_create_header(s, ZEBRA_L3VNI_ADD, zl3vni_vrf_id(zl3vni));
stream_putl(s, zl3vni->vni);
stream_put(s, &rmac, sizeof(struct ethaddr));
stream_put_in_addr(s, &zl3vni->local_vtep_ip);
@@ -3626,13 +3564,14 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni)
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
- "Send L3_VNI_ADD %u VRF %s RMAC %s local-ip %s filter %s to %s",
- zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
- prefix_mac2str(&rmac, buf, sizeof(buf)),
- inet_ntoa(zl3vni->local_vtep_ip),
- CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY) ?
- "prefix-routes-only" : "none",
- zebra_route_string(client->proto));
+ "Send L3_VNI_ADD %u VRF %s RMAC %s local-ip %s filter %s to %s",
+ zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
+ prefix_mac2str(&rmac, buf, sizeof(buf)),
+ inet_ntoa(zl3vni->local_vtep_ip),
+ CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY)
+ ? "prefix-routes-only"
+ : "none",
+ zebra_route_string(client->proto));
client->l3vniadd_cnt++;
return zebra_server_send_message(client);
@@ -3654,16 +3593,14 @@ static int zl3vni_send_del_to_client(zebra_l3vni_t *zl3vni)
s = client->obuf;
stream_reset(s);
- zclient_create_header(s, ZEBRA_L3VNI_DEL,
- zl3vni_vrf_id(zl3vni));
+ zclient_create_header(s, ZEBRA_L3VNI_DEL, zl3vni_vrf_id(zl3vni));
stream_putl(s, zl3vni->vni);
/* Write packet size. */
stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Send L3_VNI_DEL %u VRF %s to %s",
- zl3vni->vni,
+ zlog_debug("Send L3_VNI_DEL %u VRF %s to %s", zl3vni->vni,
vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
zebra_route_string(client->proto));
@@ -3689,11 +3626,10 @@ static void zebra_vxlan_process_l3vni_oper_down(zebra_l3vni_t *zl3vni)
zl3vni_send_del_to_client(zl3vni);
}
-static void zvni_add_to_l3vni_list(struct hash_backet *backet,
- void *ctxt)
+static void zvni_add_to_l3vni_list(struct hash_backet *backet, void *ctxt)
{
- zebra_vni_t *zvni = (zebra_vni_t *) backet->data;
- zebra_l3vni_t *zl3vni = (zebra_l3vni_t *) ctxt;
+ zebra_vni_t *zvni = (zebra_vni_t *)backet->data;
+ zebra_l3vni_t *zl3vni = (zebra_l3vni_t *)ctxt;
if (zvni->vrf_id == zl3vni_vrf_id(zl3vni))
listnode_add_sort(zl3vni->l2vnis, zvni);
@@ -3702,8 +3638,8 @@ static void zvni_add_to_l3vni_list(struct hash_backet *backet,
/*
* handle transition of vni from l2 to l3 and vice versa
*/
-static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf,
- vni_t vni, int add)
+static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni,
+ int add)
{
zebra_vni_t *zvni = NULL;
@@ -3722,8 +3658,7 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf,
return 0;
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Del L2-VNI %u - transition to L3-VNI",
- vni);
+ zlog_debug("Del L2-VNI %u - transition to L3-VNI", vni);
/* Delete VNI from BGP. */
zvni_send_del_to_client(zvni->vni);
@@ -3737,8 +3672,8 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf,
/* Delete the hash entry. */
if (zvni_del(zvni)) {
- zlog_err("Failed to del VNI hash %p, VNI %u",
- zvni, zvni->vni);
+ zlog_err("Failed to del VNI hash %p, VNI %u", zvni,
+ zvni->vni);
return -1;
}
} else {
@@ -3753,8 +3688,7 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf,
}
/* delete and uninstall rmac hash entry */
-static void zl3vni_del_rmac_hash_entry(struct hash_backet *backet,
- void *ctx)
+static void zl3vni_del_rmac_hash_entry(struct hash_backet *backet, void *ctx)
{
zebra_mac_t *zrmac = NULL;
zebra_l3vni_t *zl3vni = NULL;
@@ -3766,8 +3700,7 @@ static void zl3vni_del_rmac_hash_entry(struct hash_backet *backet,
}
/* delete and uninstall nh hash entry */
-static void zl3vni_del_nh_hash_entry(struct hash_backet *backet,
- void *ctx)
+static void zl3vni_del_nh_hash_entry(struct hash_backet *backet, void *ctx)
{
zebra_neigh_t *n = NULL;
zebra_l3vni_t *zl3vni = NULL;
@@ -3778,9 +3711,8 @@ static void zl3vni_del_nh_hash_entry(struct hash_backet *backet,
zl3vni_nh_del(zl3vni, n);
}
-static int ip_prefix_send_to_client(vrf_id_t vrf_id,
- struct prefix *p,
- uint16_t cmd)
+static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,
+ uint16_t cmd)
{
struct zserv *client = NULL;
struct stream *s = NULL;
@@ -3801,8 +3733,7 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id,
stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug(
- "Send ip prefix %s %s on vrf %s",
+ zlog_debug("Send ip prefix %s %s on vrf %s",
prefix2str(p, buf, sizeof(buf)),
(cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",
vrf_id_to_name(vrf_id));
@@ -3817,7 +3748,7 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id,
/* re-add remote rmac if needed */
static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni,
- struct ethaddr *rmac)
+ struct ethaddr *rmac)
{
char buf[ETHER_ADDR_STRLEN];
zebra_mac_t *zrmac = NULL;
@@ -3828,8 +3759,7 @@ static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni,
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Del remote RMAC %s L3VNI %u - readd",
- prefix_mac2str(rmac, buf, sizeof(buf)),
- zl3vni->vni);
+ prefix_mac2str(rmac, buf, sizeof(buf)), zl3vni->vni);
zl3vni_rmac_install(zl3vni, zrmac);
return 0;
@@ -3849,10 +3779,9 @@ int is_l3vni_for_prefix_routes_only(vni_t vni)
}
/* handle evpn route in vrf table */
-void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id,
- struct ethaddr *rmac,
- struct ipaddr *vtep_ip,
- struct prefix *host_prefix)
+void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id, struct ethaddr *rmac,
+ struct ipaddr *vtep_ip,
+ struct prefix *host_prefix)
{
zebra_l3vni_t *zl3vni = NULL;
@@ -3868,10 +3797,9 @@ void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id,
}
/* handle evpn vrf route delete */
-void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
- struct ethaddr *rmac,
- struct ipaddr *vtep_ip,
- struct prefix *host_prefix)
+void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id, struct ethaddr *rmac,
+ struct ipaddr *vtep_ip,
+ struct prefix *host_prefix)
{
zebra_l3vni_t *zl3vni = NULL;
@@ -3886,8 +3814,7 @@ void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,
zl3vni_remote_rmac_del(zl3vni, rmac, host_prefix);
}
-void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty,
- vni_t l3vni,
+void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni,
struct ethaddr *rmac,
u_char use_json)
{
@@ -3909,8 +3836,7 @@ void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty,
if (use_json)
vty_out(vty, "{}\n");
else
- vty_out(vty, "%% L3-VNI %u doesnt exist\n",
- l3vni);
+ vty_out(vty, "%% L3-VNI %u doesnt exist\n", l3vni);
return;
}
@@ -3934,8 +3860,7 @@ void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty,
}
}
-void zebra_vxlan_print_rmacs_l3vni(struct vty *vty,
- vni_t l3vni,
+void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni,
u_char use_json)
{
zebra_l3vni_t *zl3vni;
@@ -3965,8 +3890,7 @@ void zebra_vxlan_print_rmacs_l3vni(struct vty *vty,
wctx.vty = vty;
wctx.json = json;
if (!use_json) {
- vty_out(vty,
- "Number of Remote RMACs known for this VNI: %u\n",
+ vty_out(vty, "Number of Remote RMACs known for this VNI: %u\n",
num_rmacs);
vty_out(vty, "%-17s %-21s\n", "MAC", "Remote VTEP");
} else
@@ -3981,8 +3905,7 @@ void zebra_vxlan_print_rmacs_l3vni(struct vty *vty,
}
}
-void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty,
- u_char use_json)
+void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, u_char use_json)
{
struct zebra_ns *zns = NULL;
json_object *json = NULL;
@@ -4018,10 +3941,8 @@ void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty,
}
}
-void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty,
- vni_t l3vni,
- struct ipaddr *ip,
- u_char use_json)
+void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni,
+ struct ipaddr *ip, u_char use_json)
{
zebra_l3vni_t *zl3vni = NULL;
zebra_neigh_t *n = NULL;
@@ -4065,9 +3986,7 @@ void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty,
}
}
-void zebra_vxlan_print_nh_l3vni(struct vty *vty,
- vni_t l3vni,
- u_char use_json)
+void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t l3vni, u_char use_json)
{
u_int32_t num_nh;
struct nh_walk_ctx wctx;
@@ -4096,8 +4015,7 @@ void zebra_vxlan_print_nh_l3vni(struct vty *vty,
wctx.vty = vty;
wctx.json = json;
if (!use_json) {
- vty_out(vty,
- "Number of NH Neighbors known for this VNI: %u\n",
+ vty_out(vty, "Number of NH Neighbors known for this VNI: %u\n",
num_nh);
vty_out(vty, "%-15s %-17s\n", "IP", "RMAC");
} else
@@ -4112,8 +4030,7 @@ void zebra_vxlan_print_nh_l3vni(struct vty *vty,
}
}
-void zebra_vxlan_print_nh_all_l3vni(struct vty *vty,
- u_char use_json)
+void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, u_char use_json)
{
struct zebra_ns *zns = NULL;
json_object *json = NULL;
@@ -4197,17 +4114,14 @@ void zebra_vxlan_print_vrf_vni(struct vty *vty, struct zebra_vrf *zvrf,
if (!json_vrfs) {
vty_out(vty, "%-37s %-10u %-20s %-20s %-5s %-18s\n",
- zvrf_name(zvrf),
- zl3vni->vni,
+ zvrf_name(zvrf), zl3vni->vni,
zl3vni_vxlan_if_name(zl3vni),
- zl3vni_svi_if_name(zl3vni),
- zl3vni_state2str(zl3vni),
+ zl3vni_svi_if_name(zl3vni), zl3vni_state2str(zl3vni),
zl3vni_rmac2str(zl3vni, buf, sizeof(buf)));
} else {
json_object *json_vrf = NULL;
json_vrf = json_object_new_object();
- json_object_string_add(json_vrf, "vrf",
- zvrf_name(zvrf));
+ json_object_string_add(json_vrf, "vrf", zvrf_name(zvrf));
json_object_int_add(json_vrf, "vni", zl3vni->vni);
json_object_string_add(json_vrf, "vxlanIntf",
zl3vni_vxlan_if_name(zl3vni));
@@ -4215,9 +4129,9 @@ void zebra_vxlan_print_vrf_vni(struct vty *vty, struct zebra_vrf *zvrf,
zl3vni_svi_if_name(zl3vni));
json_object_string_add(json_vrf, "state",
zl3vni_state2str(zl3vni));
- json_object_string_add(json_vrf, "routerMac",
- zl3vni_rmac2str(zl3vni, buf,
- sizeof(buf)));
+ json_object_string_add(
+ json_vrf, "routerMac",
+ zl3vni_rmac2str(zl3vni, buf, sizeof(buf)));
json_object_array_add(json_vrfs, json_vrf);
}
}
@@ -4690,10 +4604,9 @@ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
if (use_json)
json = json_object_new_object();
else
- vty_out(vty,
- "%-10s %-4s %-21s %-8s %-8s %-15s %-37s\n",
- "VNI", "Type", "VxLAN IF", "# MACs",
- "# ARPs", "# Remote VTEPs", "Tenant VRF");
+ vty_out(vty, "%-10s %-4s %-21s %-8s %-8s %-15s %-37s\n", "VNI",
+ "Type", "VxLAN IF", "# MACs", "# ARPs",
+ "# Remote VTEPs", "Tenant VRF");
args[0] = vty;
args[1] = json;
@@ -4754,8 +4667,8 @@ int zebra_vxlan_local_neigh_del(struct interface *ifp,
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Del neighbor %s intf %s(%u) -> L2-VNI %u",
- ipaddr2str(ip, buf, sizeof(buf)),
- ifp->name, ifp->ifindex, zvni->vni);
+ ipaddr2str(ip, buf, sizeof(buf)), ifp->name,
+ ifp->ifindex, zvni->vni);
/* If entry doesn't exist, nothing to do. */
n = zvni_neigh_lookup(zvni, ip);
@@ -4784,8 +4697,7 @@ int zebra_vxlan_local_neigh_del(struct interface *ifp,
/* Remove neighbor from BGP. */
if (IS_ZEBRA_NEIGH_ACTIVE(n))
- zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac,
- 0);
+ zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac, 0);
/* Delete this neighbor entry. */
zvni_neigh_del(zvni, n);
@@ -4841,10 +4753,10 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
zmac = zvni_mac_lookup(zvni, macaddr);
if (!zmac) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug(
- "AUTO MAC %s created for neigh %s on VNI %u",
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- ipaddr2str(ip, buf2, sizeof(buf2)), zvni->vni);
+ zlog_debug("AUTO MAC %s created for neigh %s on VNI %u",
+ prefix_mac2str(macaddr, buf, sizeof(buf)),
+ ipaddr2str(ip, buf2, sizeof(buf2)),
+ zvni->vni);
zmac = zvni_mac_add(zvni, macaddr);
if (!zmac) {
@@ -4865,8 +4777,7 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp,
n = zvni_neigh_lookup(zvni, ip);
if (n) {
if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL)) {
- if (memcmp(n->emac.octet, macaddr->octet,
- ETH_ALEN)
+ if (memcmp(n->emac.octet, macaddr->octet, ETH_ALEN)
== 0) {
/* Update any params and return - client doesn't
* care about a purely local change.
@@ -5042,10 +4953,9 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length,
n = zvni_neigh_lookup(zvni, &ip);
if (n && !mac) {
- zlog_err(
- "Failed to locate MAC %s for neigh %s VNI %u",
- prefix_mac2str(&macaddr, buf, sizeof(buf)),
- ipaddr2str(&ip, buf1, sizeof(buf1)), vni);
+ zlog_err("Failed to locate MAC %s for neigh %s VNI %u",
+ prefix_mac2str(&macaddr, buf, sizeof(buf)),
+ ipaddr2str(&ip, buf1, sizeof(buf1)), vni);
continue;
}
@@ -5057,13 +4967,13 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length,
continue;
/* Ignore the delete if this mac is a gateway mac-ip */
- if (mac && CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL) &&
- CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW)) {
- zlog_err("%u: Ignore Del for MAC %s neigh %s on VNI %u as it is configured as a default gateway",
- zvrf_id(zvrf),
- prefix_mac2str(&macaddr, buf, sizeof(buf)),
- ipaddr2str(&ip, buf1, sizeof(buf1)),
- vni);
+ if (mac && CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL)
+ && CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW)) {
+ zlog_err(
+ "%u: Ignore Del for MAC %s neigh %s on VNI %u as it is configured as a default gateway",
+ zvrf_id(zvrf),
+ prefix_mac2str(&macaddr, buf, sizeof(buf)),
+ ipaddr2str(&ip, buf1, sizeof(buf1)), vni);
continue;
}
@@ -5078,8 +4988,7 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length,
* if the MAC matches.
*/
if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)
- && (memcmp(n->emac.octet, macaddr.octet,
- ETH_ALEN)
+ && (memcmp(n->emac.octet, macaddr.octet, ETH_ALEN)
== 0)) {
zvni_neigh_uninstall(zvni, n);
zvni_neigh_del(zvni, n);
@@ -5087,8 +4996,7 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length,
}
} else {
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)) {
- zvni_process_neigh_on_remote_mac_del(zvni,
- mac);
+ zvni_process_neigh_on_remote_mac_del(zvni, mac);
if (list_isempty(mac->neigh_list)) {
zvni_mac_uninstall(zvni, mac, 0);
@@ -5134,8 +5042,9 @@ int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length,
memset(&vtep_ip, 0, sizeof(struct in_addr));
if (!EVPN_ENABLED(zvrf)) {
- zlog_warn("%s: EVPN Not turned on yet we have received a remote_macip add zapi callback",
- __PRETTY_FUNCTION__);
+ zlog_warn(
+ "%s: EVPN Not turned on yet we have received a remote_macip add zapi callback",
+ __PRETTY_FUNCTION__);
return -1;
}
@@ -5218,15 +5127,16 @@ int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length,
/* Ignore the update if the mac is already present
as a gateway mac */
- if (mac && CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW) &&
- CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) {
+ if (mac && CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW)
+ && CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("%u:Ignore MAC %s IP %s on VNI %u as MAC is already configured as gateway mac",
- zvrf_id(zvrf),
- prefix_mac2str(&macaddr,
- buf, sizeof(buf)),
- ipaddr2str(&ip, buf1,
- sizeof(buf1)), vni);
+ zlog_debug(
+ "%u:Ignore MAC %s IP %s on VNI %u as MAC is already configured as gateway mac",
+ zvrf_id(zvrf),
+ prefix_mac2str(&macaddr, buf,
+ sizeof(buf)),
+ ipaddr2str(&ip, buf1, sizeof(buf1)),
+ vni);
continue;
}
@@ -5375,8 +5285,8 @@ int zebra_vxlan_check_del_local_mac(struct interface *ifp,
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"Add/update remote MAC %s intf %s(%u) VNI %u - del local",
- prefix_mac2str(macaddr, buf, sizeof(buf)),
- ifp->name, ifp->ifindex, vni);
+ prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name,
+ ifp->ifindex, vni);
/* Remove MAC from BGP. */
zvni_mac_send_del_to_client(zvni->vni, macaddr, mac->flags);
@@ -5540,11 +5450,10 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
}
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug(
- "Add/Update %sMAC %s intf %s(%u) VID %u -> VNI %u",
- sticky ? "sticky " : "",
- prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name,
- ifp->ifindex, vid, zvni->vni);
+ zlog_debug("Add/Update %sMAC %s intf %s(%u) VID %u -> VNI %u",
+ sticky ? "sticky " : "",
+ prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name,
+ ifp->ifindex, vid, zvni->vni);
/* If same entry already exists, nothing to do. */
mac = zvni_mac_lookup(zvni, macaddr);
@@ -5647,8 +5556,9 @@ int zebra_vxlan_remote_vtep_del(struct zserv *client, u_short length,
struct zebra_if *zif;
if (!is_evpn_enabled()) {
- zlog_warn("%s: EVPN is not enabled yet we have received a vtep del command",
- __PRETTY_FUNCTION__);
+ zlog_warn(
+ "%s: EVPN is not enabled yet we have received a vtep del command",
+ __PRETTY_FUNCTION__);
return -1;
}
@@ -5731,8 +5641,9 @@ int zebra_vxlan_remote_vtep_add(struct zserv *client, u_short length,
struct zebra_if *zif;
if (!is_evpn_enabled()) {
- zlog_warn("%s: EVPN not enabled yet we received a vtep_add zapi call",
- __PRETTY_FUNCTION__);
+ zlog_warn(
+ "%s: EVPN not enabled yet we received a vtep_add zapi call",
+ __PRETTY_FUNCTION__);
return -1;
}
@@ -5785,9 +5696,8 @@ int zebra_vxlan_remote_vtep_add(struct zserv *client, u_short length,
continue;
if (zvni_vtep_add(zvni, &vtep_ip) == NULL) {
- zlog_err(
- "Failed to add remote VTEP, VNI %u zvni %p",
- vni, zvni);
+ zlog_err("Failed to add remote VTEP, VNI %u zvni %p",
+ vni, zvni);
continue;
}
@@ -5986,9 +5896,10 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if)
}
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("SVI %s(%u) VNI %u VRF %s is UP, installing neighbors",
- ifp->name, ifp->ifindex, zvni->vni,
- vrf_id_to_name(ifp->vrf_id));
+ zlog_debug(
+ "SVI %s(%u) VNI %u VRF %s is UP, installing neighbors",
+ ifp->name, ifp->ifindex, zvni->vni,
+ vrf_id_to_name(ifp->vrf_id));
/* update the vrf information for l2-vni and inform bgp */
zvni->vrf_id = ifp->vrf_id;
@@ -5997,8 +5908,7 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if)
/* Install any remote neighbors for this VNI. */
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
n_wctx.zvni = zvni;
- hash_iterate(zvni->neigh_table,
- zvni_install_neigh_hash,
+ hash_iterate(zvni->neigh_table, zvni_install_neigh_hash,
&n_wctx);
}
@@ -6029,15 +5939,15 @@ int zebra_vxlan_if_down(struct interface *ifp)
if (zl3vni) {
/* process-if-down for l3-vni */
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Intf %s(%u) L3-VNI %u is DOWN",
- ifp->name, ifp->ifindex, vni);
+ zlog_debug("Intf %s(%u) L3-VNI %u is DOWN", ifp->name,
+ ifp->ifindex, vni);
zebra_vxlan_process_l3vni_oper_down(zl3vni);
} else {
/* process if-down for l2-vni */
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Intf %s(%u) L2-VNI %u is DOWN",
- ifp->name, ifp->ifindex, vni);
+ zlog_debug("Intf %s(%u) L2-VNI %u is DOWN", ifp->name,
+ ifp->ifindex, vni);
/* Locate hash entry; it is expected to exist. */
zvni = zvni_lookup(vni);
@@ -6087,8 +5997,8 @@ int zebra_vxlan_if_up(struct interface *ifp)
if (zl3vni) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Intf %s(%u) L3-VNI %u is UP",
- ifp->name, ifp->ifindex, vni);
+ zlog_debug("Intf %s(%u) L3-VNI %u is UP", ifp->name,
+ ifp->ifindex, vni);
/* we need to associate with SVI, if any, we can associate with
* svi-if only after association with vxlan-intf is complete
@@ -6102,8 +6012,8 @@ int zebra_vxlan_if_up(struct interface *ifp)
struct interface *vlan_if = NULL;
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Intf %s(%u) L2-VNI %u is UP",
- ifp->name, ifp->ifindex, vni);
+ zlog_debug("Intf %s(%u) L2-VNI %u is UP", ifp->name,
+ ifp->ifindex, vni);
/* Locate hash entry; it is expected to exist. */
zvni = zvni_lookup(vni);
@@ -6160,8 +6070,8 @@ int zebra_vxlan_if_del(struct interface *ifp)
if (zl3vni) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Del L3-VNI %u intf %s(%u)",
- vni, ifp->name, ifp->ifindex);
+ zlog_debug("Del L3-VNI %u intf %s(%u)", vni, ifp->name,
+ ifp->ifindex);
/* process oper-down for l3-vni */
zebra_vxlan_process_l3vni_oper_down(zl3vni);
@@ -6173,8 +6083,8 @@ int zebra_vxlan_if_del(struct interface *ifp)
/* process if-del for l2-vni*/
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Del L2-VNI %u intf %s(%u)",
- vni, ifp->name, ifp->ifindex);
+ zlog_debug("Del L2-VNI %u intf %s(%u)", vni, ifp->name,
+ ifp->ifindex);
/* Locate hash entry; it is expected to exist. */
zvni = zvni_lookup(vni);
@@ -6236,8 +6146,8 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"Update L3-VNI %u intf %s(%u) VLAN %u local IP %s master %u chg 0x%x",
- vni, ifp->name, ifp->ifindex,
- vxl->access_vlan, inet_ntoa(vxl->vtep_ip),
+ vni, ifp->name, ifp->ifindex, vxl->access_vlan,
+ inet_ntoa(vxl->vtep_ip),
zif->brslave_info.bridge_ifindex, chgflags);
/* Removed from bridge? Cleanup and return */
@@ -6258,7 +6168,7 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
zl3vni->local_vtep_ip = vxl->vtep_ip;
if (is_l3vni_oper_up(zl3vni))
zebra_vxlan_process_l3vni_oper_up(
- zl3vni);
+ zl3vni);
}
}
@@ -6272,7 +6182,7 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
zl3vni->local_vtep_ip = vxl->vtep_ip;
if (is_l3vni_oper_up(zl3vni))
zebra_vxlan_process_l3vni_oper_up(
- zl3vni);
+ zl3vni);
}
}
@@ -6298,8 +6208,8 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"Update L2-VNI %u intf %s(%u) VLAN %u local IP %s master %u chg 0x%x",
- vni, ifp->name, ifp->ifindex,
- vxl->access_vlan, inet_ntoa(vxl->vtep_ip),
+ vni, ifp->name, ifp->ifindex, vxl->access_vlan,
+ inet_ntoa(vxl->vtep_ip),
zif->brslave_info.bridge_ifindex, chgflags);
/* Removed from bridge? Cleanup and return */
@@ -6353,8 +6263,7 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
memset(&m_wctx, 0, sizeof(struct mac_walk_ctx));
m_wctx.zvni = zvni;
- hash_iterate(zvni->mac_table,
- zvni_install_mac_hash,
+ hash_iterate(zvni->mac_table, zvni_install_mac_hash,
&m_wctx);
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx));
@@ -6394,8 +6303,8 @@ int zebra_vxlan_if_add(struct interface *ifp)
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"Add L3-VNI %u intf %s(%u) VLAN %u local IP %s master %u",
- vni, ifp->name, ifp->ifindex,
- vxl->access_vlan, inet_ntoa(vxl->vtep_ip),
+ vni, ifp->name, ifp->ifindex, vxl->access_vlan,
+ inet_ntoa(vxl->vtep_ip),
zif->brslave_info.bridge_ifindex);
/* associate with vxlan_if */
@@ -6440,10 +6349,10 @@ int zebra_vxlan_if_add(struct interface *ifp)
zlog_debug(
"Add L2-VNI %u VRF %s intf %s(%u) VLAN %u local IP %s master %u",
vni,
- vlan_if ? vrf_id_to_name(vlan_if->vrf_id) :
- "Default",
- ifp->name, ifp->ifindex,
- vxl->access_vlan, inet_ntoa(vxl->vtep_ip),
+ vlan_if ? vrf_id_to_name(vlan_if->vrf_id)
+ : "Default",
+ ifp->name, ifp->ifindex, vxl->access_vlan,
+ inet_ntoa(vxl->vtep_ip),
zif->brslave_info.bridge_ifindex);
/* If down or not mapped to a bridge, we're done. */
@@ -6460,10 +6369,9 @@ int zebra_vxlan_if_add(struct interface *ifp)
return 0;
}
-int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf,
- vni_t vni,
- char *err, int err_str_sz,
- int filter, int add)
+int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf, vni_t vni,
+ char *err, int err_str_sz, int filter,
+ int add)
{
zebra_l3vni_t *zl3vni = NULL;
struct zebra_vrf *zvrf_default = NULL;
@@ -6473,9 +6381,7 @@ int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf,
return -1;
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("vrf %s vni %u %s",
- zvrf_name(zvrf),
- vni,
+ zlog_debug("vrf %s vni %u %s", zvrf_name(zvrf), vni,
add ? "ADD" : "DEL");
if (add) {
@@ -6500,8 +6406,7 @@ int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf,
/* 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");
+ snprintf(err, err_str_sz, "Could not add L3-VNI");
return -1;
}
@@ -6526,8 +6431,8 @@ int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf,
zl3vni->svi_if = zl3vni_map_to_svi_if(zl3vni);
/* formulate l2vni list */
- hash_iterate(zvrf_default->vni_table,
- zvni_add_to_l3vni_list, zl3vni);
+ hash_iterate(zvrf_default->vni_table, zvni_add_to_l3vni_list,
+ zl3vni);
if (is_l3vni_oper_up(zl3vni))
zebra_vxlan_process_l3vni_oper_up(zl3vni);
@@ -6542,13 +6447,11 @@ int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf,
zebra_vxlan_process_l3vni_oper_down(zl3vni);
/* delete and uninstall all rmacs */
- hash_iterate(zl3vni->rmac_table,
- zl3vni_del_rmac_hash_entry,
+ hash_iterate(zl3vni->rmac_table, zl3vni_del_rmac_hash_entry,
zl3vni);
/* delete and uninstall all next-hops */
- hash_iterate(zl3vni->nh_table,
- zl3vni_del_nh_hash_entry,
+ hash_iterate(zl3vni->nh_table, zl3vni_del_nh_hash_entry,
zl3vni);
zvrf->l3vni = 0;
@@ -6639,10 +6542,9 @@ int zebra_vxlan_advertise_subnet(struct zserv *client, u_short length,
return 0;
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug(
- "EVPN subnet Adv %s on VNI %d , currently %s",
- advertise ? "enabled" : "disabled", vni,
- zvni->advertise_subnet ? "enabled" : "disabled");
+ zlog_debug("EVPN subnet Adv %s on VNI %d , currently %s",
+ advertise ? "enabled" : "disabled", vni,
+ zvni->advertise_subnet ? "enabled" : "disabled");
zvni->advertise_subnet = advertise;
@@ -6659,8 +6561,8 @@ int zebra_vxlan_advertise_subnet(struct zserv *client, u_short length,
zl2_info = zif->l2info.vxl;
- vlan_if = zvni_map_to_svi(zl2_info.access_vlan,
- zif->brslave_info.br_if);
+ vlan_if =
+ zvni_map_to_svi(zl2_info.access_vlan, zif->brslave_info.br_if);
if (!vlan_if)
return 0;
@@ -6729,9 +6631,8 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length,
zlog_debug(
"EVPN gateway macip Adv %s on VNI %d , currently %s",
advertise ? "enabled" : "disabled", vni,
- advertise_gw_macip_enabled(zvni)
- ? "enabled"
- : "disabled");
+ advertise_gw_macip_enabled(zvni) ? "enabled"
+ : "disabled");
if (zvni->advertise_gw_macip == advertise)
return 0;
@@ -6785,16 +6686,15 @@ stream_failure:
* when disabled, the entries should be deleted and remote VTEPs and MACs
* uninstalled from the kernel.
*/
-int zebra_vxlan_advertise_all_vni(struct zserv *client,
- u_short length, struct zebra_vrf *zvrf)
+int zebra_vxlan_advertise_all_vni(struct zserv *client, u_short length,
+ struct zebra_vrf *zvrf)
{
struct stream *s = NULL;
int advertise = 0;
struct zebra_ns *zns = NULL;
if (zvrf_id(zvrf) != VRF_DEFAULT) {
- zlog_err("EVPN VNI Adv for non-default VRF %u",
- zvrf_id(zvrf));
+ zlog_err("EVPN VNI Adv for non-default VRF %u", zvrf_id(zvrf));
return -1;
}