Make the CI system happy.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
} else if (*pnt
== ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT) {
struct ethaddr mac;
+
pnt++;
memcpy(&mac, pnt, ETH_ALEN);
len = sprintf(
return 0;
}
-/* Best path for ES route was changed,
- update the list of VTEPs for this ES */
+/*
+ * Best path for ES route was changed,
+ * update the list of VTEPs for this ES
+ */
static int evpn_es_install_vtep(struct bgp *bgp,
struct evpnes *es,
struct prefix_evpn *p,
return 0;
}
-/* Best path for ES route was changed,
- update the list of VTEPs for this ES */
+/*
+ * Best path for ES route was changed,
+ * update the list of VTEPs for this ES
+ */
static int evpn_es_uninstall_vtep(struct bgp *bgp,
struct evpnes *es,
struct prefix_evpn *p,
old_select = old_and_new.old;
new_select = old_and_new.new;
- /* If the best path hasn't changed - see if something needs to be
+ /*
+ * If the best path hasn't changed - see if something needs to be
* updated
*/
if (old_select && old_select == new_select
/* If the user did a "clear" this flag will be set */
UNSET_FLAG(rn->flags, BGP_NODE_USER_CLEAR);
- /* bestpath has changed; update relevant fields and install or uninstall
+ /*
+ * bestpath has changed; update relevant fields and install or uninstall
* into the zebra RIB.
*/
if (old_select || new_select)
} else {
if (old_select && old_select->type == ZEBRA_ROUTE_BGP
&& old_select->sub_type == BGP_ROUTE_IMPORTED)
- ret = evpn_es_uninstall_vtep(bgp, es,
- (struct prefix_evpn *)&rn->p,
- old_select->attr->nexthop);
+ ret = evpn_es_uninstall_vtep(
+ bgp, es, (struct prefix_evpn *)&rn->p,
+ old_select->attr->nexthop);
}
/* Clear any route change flags. */
local_ri = tmp_ri;
}
- /* create a new route entry if one doesnt exist.
- Otherwise see if route attr has changed
+ /*
+ * create a new route entry if one doesnt exist.
+ * Otherwise see if route attr has changed
*/
if (!local_ri) {
* Note: there is no RD here.
*/
rn = bgp_node_lookup(es->route_table, (struct prefix *)p);
- if (!rn )
+ if (!rn)
return 0;
/* Next, locate route node in the global EVPN routing table.
afi = AFI_L2VPN;
safi = SAFI_EVPN;
- /* Walk entire global routing table and evaluate routes which could be
+ /*
+ * Walk entire global routing table and evaluate routes which could be
* imported into this VRF. Note that we need to loop through all global
* routes to determine which route matches the import rt on vrf
*/
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
for (ri = rn->info; ri; ri = ri->next) {
-
- /* Consider "valid" remote routes applicable for
+ /*
+ * Consider "valid" remote routes applicable for
* this ES.
*/
if (!(CHECK_FLAG(ri->flags, BGP_INFO_VALID)
&& ri->sub_type == BGP_ROUTE_NORMAL))
continue;
- if (is_prefix_matching_for_es(evp, es)) {
- if (install)
- ret =
- install_evpn_route_entry_in_es(
- bgp, es, evp, ri);
- else
- ret =
- uninstall_evpn_route_entry_in_es(
- bgp, es, evp, ri);
+ if (!is_prefix_matching_for_es(evp, es))
+ continue;
- if (ret) {
- zlog_err(
- "Failed to %s EVPN %s route in ESI %s",
- install ? "install"
- : "uninstall",
- prefix2str(evp, buf,
- sizeof(buf)),
- esi_to_str(&es->esi,
- buf1,
- sizeof(buf1)));
- return ret;
- }
+ if (install)
+ ret = install_evpn_route_entry_in_es(
+ bgp, es, evp, ri);
+ else
+ ret = uninstall_evpn_route_entry_in_es(
+ bgp, es, evp, ri);
+
+ if (ret) {
+ zlog_err(
+ "Failed to %s EVPN %s route in ESI %s",
+ install ? "install"
+ : "uninstall",
+ prefix2str(evp, buf,
+ sizeof(buf)),
+ esi_to_str(&es->esi, buf1,
+ sizeof(buf1)));
+ return ret;
}
}
}
return 0;
}
-/* delete and withdraw all ipv4 and ipv6 routes in the vrf table as type-5
- * routes */
+/*
+ * delete and withdraw all ipv4 and ipv6 routes in the vrf table as type-5
+ * routes
+ */
static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf)
{
/* delete all ipv4 routes and withdraw from peers */
bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST);
}
-/* update and advertise all ipv4 and ipv6 routes in thr vrf table as type-5
- * routes */
+/*
+ * update and advertise all ipv4 and ipv6 routes in thr vrf table as type-5
+ * routes
+ */
static void update_advertise_vrf_routes(struct bgp *bgp_vrf)
{
/* update all ipv4 routes */
ret = bgp_update(peer, (struct prefix *)&p, addpath_id, attr,
afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
&prd, NULL, 0, 0, NULL);
- }
- else {
+ } else {
ret = bgp_withdraw(peer, (struct prefix *)&p, addpath_id, attr,
afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
&prd, NULL, 0, NULL);
stream_put(s, prd->val, 8); /* RD */
stream_put(s, evp->prefix.es_addr.esi.val, 10); /* ESI */
stream_putc(s, IPV4_MAX_BITLEN); /* IP address Length - bits */
- stream_put_in_addr(s, &evp->prefix.es_addr.ip.ipaddr_v4); /* VTEP IP*/
+ /* VTEP IP */
+ stream_put_in_addr(s, &evp->prefix.es_addr.ip.ipaddr_v4);
break;
case BGP_EVPN_IP_PREFIX_ROUTE:
}
/* Delete all local EVPN ES routes from ESI table
- * and schedule for processing (to withdraw from peers))
+ * and schedule for processing (to withdraw from peers))
*/
delete_routes_for_es(bgp, es);
}
/* create the new es */
- es = bgp_evpn_lookup_es(bgp,esi);
+ es = bgp_evpn_lookup_es(bgp, esi);
if (!es) {
es = bgp_evpn_es_new(bgp, esi, originator_ip);
if (!es) {
#define EVPNES_LOCAL 0x01
#define EVPNES_REMOTE 0x02
- /* Id for deriving the RD
- * automatically for this ESI */
+ /*
+ * Id for deriving the RD
+ * automatically for this ESI
+ */
uint16_t rd_id;
/* RD for this VNI. */
/* list of VTEPs in the same site */
struct list *vtep_list;
- /* Route table for EVPN routes for
- * this ESI. - type4 routes */
+ /*
+ * Route table for EVPN routes for
+ * this ESI. - type4 routes
+ */
struct bgp_table *route_table;
QOBJ_FIELDS
static inline void es_get_system_mac(esi_t *esi,
struct ethaddr *mac)
{
- /* for type-1 and type-3 ESIs,
- the system mac starts at val[1]
+ /*
+ * for type-1 and type-3 ESIs,
+ * the system mac starts at val[1]
*/
memcpy(mac, &esi->val[1], ETH_ALEN);
}
json_object_string_add(json, "rd",
prefix_rd2str(&es->prd, buf1,
sizeof(buf1)));
- json_object_string_add(json,"originatorIp",
+ json_object_string_add(
+ json, "originatorIp",
ipaddr2str(&es->originator_ip, buf2, sizeof(buf2)));
if (es->vtep_list) {
for (ALL_LIST_ELEMENTS_RO(es->vtep_list, node, vtep))
- json_object_array_add(json_vteps,
- json_object_new_string(inet_ntoa(*vtep)));
+ json_object_array_add(
+ json_vteps, json_object_new_string(
+ inet_ntoa(*vtep)));
}
json_object_object_add(json, "vteps", json_vteps);
} else {
if (es->vtep_list) {
vty_out(vty, " VTEP List:\n");
for (ALL_LIST_ELEMENTS_RO(es->vtep_list, node, vtep))
- vty_out(vty," %s\n", inet_ntoa(*vtep));
+ vty_out(vty, " %s\n", inet_ntoa(*vtep));
}
}
}
json_object_string_add(json, "rd",
prefix_rd2str(&es->prd, buf1,
sizeof(buf1)));
- json_object_string_add(json,"originatorIp",
+ json_object_string_add(
+ json, "originatorIp",
ipaddr2str(&es->originator_ip, buf2, sizeof(buf2)));
if (es->vtep_list) {
for (ALL_LIST_ELEMENTS_RO(es->vtep_list, node, vtep))
}
/* Display all ESs */
-static void evpn_show_all_es(struct vty *vty, struct bgp *bgp, json_object *json)
+static void evpn_show_all_es(struct vty *vty, struct bgp *bgp,
+ json_object *json)
{
void *args[2];
return CMD_WARNING;
}
- if(!str_to_esi(argv[2]->arg, &esi)) {
+ if (!str_to_esi(argv[2]->arg, &esi)) {
vty_out(vty, "%%Malformed ESI\n");
return CMD_WARNING;
}
return CMD_WARNING;
}
- if(!str_to_esi(argv[2]->arg, &esi)) {
+ if (!str_to_esi(argv[2]->arg, &esi)) {
vty_out(vty, "%%Malformed ESI\n");
return CMD_WARNING;
}
{
struct bgp_info *mpinfo;
- /* If this is multipath, check all selected paths for any nexthop change
- * or attribute change. Some attribute changes (e.g., community) aren't of
- * relevance to the RIB, but we'll update zebra to ensure we handle the
- * case of BGP nexthop change. This is the behavior when the best path
- * has an attribute change anyway.
+ /* If this is multipath, check all selected paths for any nexthop
+ * change or attribute change. Some attribute changes (e.g., community)
+ * aren't of relevance to the RIB, but we'll update zebra to ensure
+ * we handle the case of BGP nexthop change. This is the behavior
+ * when the best path has an attribute change anyway.
*/
if (CHECK_FLAG(selected->flags, BGP_INFO_IGP_CHANGED)
|| CHECK_FLAG(selected->flags, BGP_INFO_MULTIPATH_CHG))
return 1;
- /* If this is multipath, check all selected paths for any nexthop change
+ /*
+ * If this is multipath, check all selected paths for any nexthop change
*/
for (mpinfo = bgp_info_mpath_first(selected); mpinfo;
mpinfo = bgp_info_mpath_next(mpinfo)) {
void prefix_hexdump(const struct prefix *p)
{
char buf[PREFIX_STRLEN];
+
zlog_debug("prefix: %s",
prefix2str(p, buf, sizeof(buf)));
zlog_hexdump(p, sizeof(struct prefix));
#endif
#define ESI_BYTES 10
-#define ESI_STR_LEN (3* ESI_BYTES)
+#define ESI_STR_LEN (3 * ESI_BYTES)
#define ETHER_ADDR_STRLEN (3*ETH_ALEN)
/*
int (*redistribute_route_del)(int, struct zclient *, uint16_t,
vrf_id_t);
int (*fec_update)(int, struct zclient *, uint16_t);
- int (*local_es_add)(int, struct zclient *, uint16_t, vrf_id_t);
- int (*local_es_del)(int, struct zclient *, uint16_t, vrf_id_t);
+ int (*local_es_add)(int command, struct zclient *zclient,
+ uint16_t length, vrf_id_t vrf_id);
+ int (*local_es_del)(int command, struct zclient *zclient,
+ uint16_t length, vrf_id_t vrf_id);
int (*local_vni_add)(int, struct zclient *, uint16_t, vrf_id_t);
int (*local_vni_del)(int, struct zclient *, uint16_t, vrf_id_t);
int (*local_l3vni_add)(int, struct zclient *, uint16_t, vrf_id_t);