* Function to convert evpn route to json format.
* NOTE: We don't use prefix2str as the output here is a bit different.
*/
-void
-bgp_evpn_route2json(struct prefix_evpn *p, json_object *json)
+void bgp_evpn_route2json(struct prefix_evpn *p, json_object *json)
{
char buf1[ETHER_ADDR_STRLEN];
char buf2[PREFIX2STR_BUFFER];
if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) {
json_object_int_add(json, "routeType", p->prefix.route_type);
json_object_int_add(json, "ethTag", 0);
- json_object_int_add(json,
- "ipLen",
- IS_EVPN_PREFIX_IPADDR_V4 (p) ?
- IPV4_MAX_BITLEN : IPV6_MAX_BITLEN);
+ json_object_int_add(json, "ipLen",
+ IS_EVPN_PREFIX_IPADDR_V4(p)
+ ? IPV4_MAX_BITLEN
+ : IPV6_MAX_BITLEN);
json_object_string_add(json, "ip",
- inet_ntoa (p->prefix.ip.ipaddr_v4));
- }
- else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
+ inet_ntoa(p->prefix.ip.ipaddr_v4));
+ } else if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
if (IS_EVPN_PREFIX_IPADDR_NONE(p)) {
- json_object_int_add(json, "routeType", p->prefix.route_type);
- json_object_int_add(json, "esi", 0); /* TODO: we don't support esi yet */
- json_object_int_add(json, "ethTag", 0);
- json_object_int_add(json, "macLen", 8 * ETH_ALEN);
- json_object_string_add(json, "mac",
- prefix_mac2str (&p->prefix.mac,
- buf1, sizeof (buf1)));
+ json_object_int_add(json, "routeType",
+ p->prefix.route_type);
+ json_object_int_add(
+ json, "esi",
+ 0); /* TODO: we don't support esi yet */
+ json_object_int_add(json, "ethTag", 0);
+ json_object_int_add(json, "macLen", 8 * ETH_ALEN);
+ json_object_string_add(json, "mac",
+ prefix_mac2str(&p->prefix.mac,
+ buf1,
+ sizeof(buf1)));
} else {
u_char family;
- family = IS_EVPN_PREFIX_IPADDR_V4(p) ? \
- AF_INET : AF_INET6;
+ family = IS_EVPN_PREFIX_IPADDR_V4(p) ? AF_INET
+ : AF_INET6;
json_object_int_add(json, "routeType",
- p->prefix.route_type);
- json_object_int_add(json, "esi", 0); /* TODO: we don't support esi yet */
+ p->prefix.route_type);
+ json_object_int_add(
+ json, "esi",
+ 0); /* TODO: we don't support esi yet */
json_object_int_add(json, "ethTag", 0);
- json_object_int_add(json, "macLen",
- 8 * ETH_ALEN);
+ json_object_int_add(json, "macLen", 8 * ETH_ALEN);
json_object_string_add(json, "mac",
- prefix_mac2str (&p->prefix.mac,
- buf1,
- sizeof (buf1)));
+ prefix_mac2str(&p->prefix.mac,
+ buf1,
+ sizeof(buf1)));
json_object_int_add(json, "ipLen",
- IS_EVPN_PREFIX_IPADDR_V4 (p) ?
- IPV4_MAX_BITLEN :
- IPV6_MAX_BITLEN);
- json_object_string_add(json, "ip",
- inet_ntop (family,
- &p->prefix.ip.ip.addr,
- buf2,
- PREFIX2STR_BUFFER));
+ IS_EVPN_PREFIX_IPADDR_V4(p)
+ ? IPV4_MAX_BITLEN
+ : IPV6_MAX_BITLEN);
+ json_object_string_add(
+ json, "ip",
+ inet_ntop(family, &p->prefix.ip.ip.addr, buf2,
+ PREFIX2STR_BUFFER));
}
} else {
/* Currently, this is to cater to other AF_ETHERNET code. */
}
-
- return;
}
-
/*
* Function to convert evpn route to string.
* NOTE: We don't use prefix2str as the output here is a bit different.
for (rn = bgp_table_top(bgp->nexthop_cache_table[afi]); rn;
rn = bgp_route_next(rn)) {
- if ((bnc = rn->info) == NULL)
+ bnc = rn->info;
+ if (!bnc)
continue;
/* Clear relevant flags. */
len = vty_out(vty, "%s", buf);
} else if (p->family == AF_EVPN) {
#if defined(HAVE_CUMULUS)
- if (!json)
- len = vty_out(vty, "%s",
- bgp_evpn_route2str((struct prefix_evpn *)p,
- buf, BUFSIZ));
- else
- bgp_evpn_route2json((struct prefix_evpn *) p, json);
+ if (!json)
+ len = vty_out(vty, "%s",
+ bgp_evpn_route2str((struct prefix_evpn *)p,
+ buf, BUFSIZ));
+ else
+ bgp_evpn_route2json((struct prefix_evpn *) p, json);
#else
prefix2str(p, buf, PREFIX_STRLEN);
len = vty_out(vty, "%s", buf);
" Hostname Capability:");
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV)) {
- vty_out(vty, " advertised (name: %s,domain name: %s)",
+ vty_out(vty,
+ " advertised (name: %s,domain name: %s)",
bgp->peer_self->hostname ?
bgp->peer_self->hostname
: "n/a",
}
if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) {
- vty_out(vty, " received (name: %s,domain name: %s)",
+ vty_out(vty,
+ " received (name: %s,domain name: %s)",
p->hostname ?
p->hostname : "n/a",
p->domainname ?
if (zif->zif_type == ZEBRA_IF_VXLAN)
zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
} else if (old_bridge_ifindex != IFINDEX_INTERNAL) {
- /* In the case of VxLAN, invoke the handler for EVPN.
- * Note that this should be done *prior* to unmapping the interface
- * from the bridge.
+ /*
+ * In the case of VxLAN, invoke the handler for EVPN.
+ * Note that this should be done *prior*
+ * to unmapping the interface from the bridge.
*/
if (zif->zif_type == ZEBRA_IF_VXLAN)
zebra_vxlan_if_update(ifp, ZEBRA_VXLIF_MASTER_CHANGE);
*/
n->ifindex = ifp->ifindex;
return 0;
- } else {
- /* If the MAC has changed,
- * need to issue a delete first
- * as this means a different MACIP route.
- * Also, need to do some unlinking/relinking.
- */
- zvni_neigh_send_del_to_client(zvrf, zvni->vni,
- &n->ip, &n->emac,
- 0);
- old_zmac = zvni_mac_lookup(zvni, &n->emac);
- if (old_zmac) {
- listnode_delete(old_zmac->neigh_list,
- n);
- zvni_deref_ip2mac(zvni, old_zmac, 0);
- }
-
- /* Set "local" forwarding info. */
- SET_FLAG(n->flags, ZEBRA_NEIGH_LOCAL);
- n->ifindex = ifp->ifindex;
- memcpy(&n->emac, macaddr, ETH_ALEN);
+ }
- /* Link to new MAC */
- listnode_add_sort(zmac->neigh_list, n);
+ /* If the MAC has changed,
+ * need to issue a delete first
+ * as this means a different MACIP route.
+ * Also, need to do some unlinking/relinking.
+ */
+ zvni_neigh_send_del_to_client(zvrf, zvni->vni,
+ &n->ip, &n->emac,
+ 0);
+ old_zmac = zvni_mac_lookup(zvni, &n->emac);
+ if (old_zmac) {
+ listnode_delete(old_zmac->neigh_list,
+ n);
+ zvni_deref_ip2mac(zvni, old_zmac, 0);
}
+
+ /* Set "local" forwarding info. */
+ SET_FLAG(n->flags, ZEBRA_NEIGH_LOCAL);
+ n->ifindex = ifp->ifindex;
+ memcpy(&n->emac, macaddr, ETH_ALEN);
+
+ /* Link to new MAC */
+ listnode_add_sort(zmac->neigh_list, n);
} else if (ext_learned)
/* The neighbor is remote and that is the notification we got.
*/