summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_ecommunity.c1
-rw-r--r--bgpd/bgp_evpn.c100
-rw-r--r--bgpd/bgp_evpn_private.h17
-rw-r--r--bgpd/bgp_evpn_vty.c20
-rw-r--r--bgpd/bgp_route.c13
-rw-r--r--lib/prefix.c1
-rw-r--r--lib/prefix.h2
-rw-r--r--lib/zclient.h6
8 files changed, 92 insertions, 68 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index d00a8dc2ec..8c5356c998 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -804,6 +804,7 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
} else if (*pnt
== ECOMMUNITY_EVPN_SUBTYPE_ES_IMPORT_RT) {
struct ethaddr mac;
+
pnt++;
memcpy(&mac, pnt, ETH_ALEN);
len = sprintf(
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index f448df13e5..991b70c9ca 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -955,8 +955,10 @@ static int is_vtep_present_in_list(struct list *list,
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,
@@ -974,8 +976,10 @@ static int evpn_es_install_vtep(struct bgp *bgp,
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,
@@ -1017,7 +1021,8 @@ static int evpn_es_route_select_install(struct bgp *bgp,
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
@@ -1039,7 +1044,8 @@ static int evpn_es_route_select_install(struct bgp *bgp,
/* 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)
@@ -1061,9 +1067,9 @@ static int evpn_es_route_select_install(struct bgp *bgp,
} 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. */
@@ -1411,8 +1417,9 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def,
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) {
@@ -1798,7 +1805,7 @@ static int delete_evpn_type4_route(struct bgp *bgp,
* 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.
@@ -2810,7 +2817,8 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
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
*/
@@ -2824,8 +2832,8 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
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)
@@ -2833,28 +2841,26 @@ static int install_uninstall_routes_for_es(struct bgp *bgp,
&& 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;
}
}
}
@@ -3309,8 +3315,10 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
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 */
@@ -3322,8 +3330,10 @@ static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf)
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 */
@@ -3776,8 +3786,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi,
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);
@@ -4596,7 +4605,8 @@ void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
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:
@@ -5509,7 +5519,7 @@ int bgp_evpn_local_es_del(struct bgp *bgp,
}
/* 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);
@@ -5536,7 +5546,7 @@ int bgp_evpn_local_es_add(struct bgp *bgp,
}
/* 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) {
diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h
index bafe81b253..bf6a24dea6 100644
--- a/bgpd/bgp_evpn_private.h
+++ b/bgpd/bgp_evpn_private.h
@@ -106,8 +106,10 @@ struct evpnes {
#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. */
@@ -119,8 +121,10 @@ struct evpnes {
/* 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
@@ -440,8 +444,9 @@ static inline int evpn_default_originate_set(struct bgp *bgp, afi_t afi,
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);
}
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 2f4349b325..f87196426c 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -426,12 +426,14 @@ static void display_es(struct vty *vty, struct evpnes *es, json_object *json)
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 {
@@ -444,7 +446,7 @@ static void display_es(struct vty *vty, struct evpnes *es, json_object *json)
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));
}
}
}
@@ -850,7 +852,8 @@ static void show_es_entry(struct hash_backet *backet, void *args[])
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))
@@ -2518,7 +2521,8 @@ static void evpn_show_es(struct vty *vty, struct bgp *bgp, esi_t *esi,
}
/* 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];
@@ -3917,7 +3921,7 @@ DEFUN(test_adv_evpn_type4_route,
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;
}
@@ -3956,7 +3960,7 @@ DEFUN(test_withdraw_evpn_type4_route,
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;
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index ff103bb770..7de1d23272 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2106,17 +2106,18 @@ int bgp_zebra_has_route_changed(struct bgp_node *rn, struct bgp_info *selected)
{
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)) {
diff --git a/lib/prefix.c b/lib/prefix.c
index 303b12e3a9..ead5444fd0 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -432,6 +432,7 @@ static const struct in6_addr maskbytes6[] = {
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));
diff --git a/lib/prefix.h b/lib/prefix.h
index fadaab1859..f5dbb22f79 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -40,7 +40,7 @@
#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)
/*
diff --git a/lib/zclient.h b/lib/zclient.h
index ceb4dc74f9..ad98b8db87 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -239,8 +239,10 @@ struct zclient {
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);