summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_aspath.c20
-rw-r--r--bgpd/bgp_attr.c159
-rw-r--r--bgpd/bgp_attr.h16
-rw-r--r--bgpd/bgp_attr_evpn.c17
-rw-r--r--bgpd/bgp_community.c44
-rw-r--r--bgpd/bgp_damp.c2
-rw-r--r--bgpd/bgp_ecommunity.c5
-rw-r--r--bgpd/bgp_evpn.c331
-rw-r--r--bgpd/bgp_evpn.h17
-rw-r--r--bgpd/bgp_evpn_private.h72
-rw-r--r--bgpd/bgp_evpn_vty.c121
-rw-r--r--bgpd/bgp_fsm.c16
-rw-r--r--bgpd/bgp_io.c16
-rw-r--r--bgpd/bgp_lcommunity.c24
-rw-r--r--bgpd/bgp_main.c5
-rw-r--r--bgpd/bgp_mpath.c21
-rw-r--r--bgpd/bgp_network.c23
-rw-r--r--bgpd/bgp_nexthop.c50
-rw-r--r--bgpd/bgp_nht.c12
-rw-r--r--bgpd/bgp_packet.c5
-rw-r--r--bgpd/bgp_route.c55
-rw-r--r--bgpd/bgp_route.h6
-rw-r--r--bgpd/bgp_routemap.c12
-rw-r--r--bgpd/bgp_rpki.c133
-rw-r--r--bgpd/bgp_snmp.c2
-rw-r--r--bgpd/bgp_updgrp.c19
-rw-r--r--bgpd/bgp_updgrp.h15
-rw-r--r--bgpd/bgp_updgrp_packet.c11
-rw-r--r--bgpd/bgp_vty.c73
-rw-r--r--bgpd/bgp_zebra.c3
-rw-r--r--bgpd/bgpd.c36
-rw-r--r--bgpd/bgpd.h18
-rw-r--r--bgpd/rfapi/bgp_rfapi_cfg.c18
-rw-r--r--bgpd/rfapi/rfapi.c14
-rw-r--r--bgpd/rfapi/rfapi_import.c14
-rw-r--r--bgpd/rfapi/rfapi_monitor.c9
-rw-r--r--bgpd/rfapi/rfapi_private.h3
-rw-r--r--bgpd/rfapi/rfapi_rib.c10
-rw-r--r--bgpd/rfapi/rfapi_vty.c5
-rw-r--r--bgpd/rfapi/vnc_export_bgp.c108
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c2
41 files changed, 706 insertions, 836 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index caac385fb..c3bbb7168 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -498,7 +498,8 @@ static void aspath_make_str_count(struct aspath *as, bool make_json)
if (!as->segments) {
if (make_json) {
json_object_string_add(as->json, "string", "Local");
- json_object_object_add(as->json, "segments", jaspath_segments);
+ json_object_object_add(as->json, "segments",
+ jaspath_segments);
json_object_int_add(as->json, "length", 0);
}
as->str = XMALLOC(MTYPE_AS_STR, 1);
@@ -575,8 +576,9 @@ static void aspath_make_str_count(struct aspath *as, bool make_json)
/* write out the ASNs, with their seperators, bar the last one*/
for (i = 0; i < seg->length; i++) {
if (make_json)
- json_object_array_add(jseg_list,
- json_object_new_int(seg->as[i]));
+ json_object_array_add(
+ jseg_list,
+ json_object_new_int(seg->as[i]));
len += snprintf(str_buf + len, str_size - len, "%u",
seg->as[i]);
@@ -588,8 +590,9 @@ static void aspath_make_str_count(struct aspath *as, bool make_json)
if (make_json) {
jseg = json_object_new_object();
- json_object_string_add(jseg, "type",
- aspath_segment_type_str[seg->type]);
+ json_object_string_add(
+ jseg, "type",
+ aspath_segment_type_str[seg->type]);
json_object_object_add(jseg, "list", jseg_list);
json_object_array_add(jaspath_segments, jseg);
}
@@ -904,7 +907,8 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
assegment_data_put(s, seg->as, AS_SEGMENT_MAX,
use32bit);
written += AS_SEGMENT_MAX;
- bytes += ASSEGMENT_SIZE(AS_SEGMENT_MAX, use32bit);
+ bytes += ASSEGMENT_SIZE(AS_SEGMENT_MAX,
+ use32bit);
}
/* write the final segment, probably is also the first
@@ -2032,9 +2036,7 @@ int aspath_cmp(const void *arg1, const void *arg2)
/* AS path hash initialize. */
void aspath_init(void)
{
- ashash = hash_create_size(32768,
- aspath_key_make,
- aspath_cmp,
+ ashash = hash_create_size(32768, aspath_key_make, aspath_cmp,
"BGP AS Path");
}
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 3f3acbe0e..84b5de91f 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -83,15 +83,14 @@ static const struct message attr_str[] = {
{BGP_ATTR_PREFIX_SID, "PREFIX_SID"},
{0}};
-static const struct message attr_flag_str[] =
- {
- {BGP_ATTR_FLAG_OPTIONAL, "Optional"},
- {BGP_ATTR_FLAG_TRANS, "Transitive"},
- {BGP_ATTR_FLAG_PARTIAL, "Partial"},
- /* bgp_attr_flags_diagnose() relies on this bit being last in
- this list */
- {BGP_ATTR_FLAG_EXTLEN, "Extended Length"},
- {0}};
+static const struct message attr_flag_str[] = {
+ {BGP_ATTR_FLAG_OPTIONAL, "Optional"},
+ {BGP_ATTR_FLAG_TRANS, "Transitive"},
+ {BGP_ATTR_FLAG_PARTIAL, "Partial"},
+ /* bgp_attr_flags_diagnose() relies on this bit being last in
+ this list */
+ {BGP_ATTR_FLAG_EXTLEN, "Extended Length"},
+ {0}};
static struct hash *cluster_hash;
@@ -185,8 +184,7 @@ void cluster_unintern(struct cluster_list *cluster)
static void cluster_init(void)
{
- cluster_hash = hash_create(cluster_hash_key_make,
- cluster_hash_cmp,
+ cluster_hash = hash_create(cluster_hash_key_make, cluster_hash_cmp,
"BGP Cluster");
}
@@ -363,12 +361,10 @@ static int encap_hash_cmp(const void *p1, const void *p2)
static void encap_init(void)
{
- encap_hash = hash_create(encap_hash_key_make,
- encap_hash_cmp,
+ encap_hash = hash_create(encap_hash_key_make, encap_hash_cmp,
"BGP Encap Hash");
#if ENABLE_BGP_VNC
- vnc_hash = hash_create(encap_hash_key_make,
- encap_hash_cmp,
+ vnc_hash = hash_create(encap_hash_key_make, encap_hash_cmp,
"BGP VNC Hash");
#endif
}
@@ -454,8 +450,7 @@ static int transit_hash_cmp(const void *p1, const void *p2)
static void transit_init(void)
{
- transit_hash = hash_create(transit_hash_key_make,
- transit_hash_cmp,
+ transit_hash = hash_create(transit_hash_key_make, transit_hash_cmp,
"BGP Transit Hash");
}
@@ -496,7 +491,8 @@ unsigned int attrhash_key_make(void *p)
#define MIX3(a, b, c) key = jhash_3words((a), (b), (c), key)
MIX3(attr->origin, attr->nexthop.s_addr, attr->med);
- MIX3(attr->local_pref, attr->aggregator_as, attr->aggregator_addr.s_addr);
+ MIX3(attr->local_pref, attr->aggregator_as,
+ attr->aggregator_addr.s_addr);
MIX3(attr->weight, attr->mp_nexthop_global_in.s_addr,
attr->originator_id.s_addr);
MIX3(attr->tag, attr->label, attr->label_index);
@@ -571,9 +567,8 @@ int attrhash_cmp(const void *p1, const void *p2)
static void attrhash_init(void)
{
- attrhash = hash_create(attrhash_key_make,
- attrhash_cmp,
- "BGP Attributes");
+ attrhash =
+ hash_create(attrhash_key_make, attrhash_cmp, "BGP Attributes");
}
/*
@@ -747,8 +742,8 @@ struct attr *bgp_attr_aggregate_intern(struct bgp *bgp, u_char origin,
/* If we are not shutting down ourselves and we are
* aggregating a route that contains the GSHUT community we
* need to remove that community when creating the aggregate */
- if (!bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN) &&
- community_include(community, gshut)) {
+ if (!bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)
+ && community_include(community, gshut)) {
community_del_val(community, &gshut);
}
@@ -840,7 +835,6 @@ void bgp_attr_undup(struct attr *new, struct attr *old)
if (new->lcommunity != old->lcommunity)
lcommunity_free(&new->lcommunity);
-
}
/* Free bgp attribute and aspath. */
@@ -1661,14 +1655,14 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
case BGP_ATTR_NHLEN_VPNV4:
stream_getl(s); /* RD high */
stream_getl(s); /* RD low */
- /*
- * NOTE: intentional fall through
- * - for consistency in rx processing
- *
- * The following comment is to signal GCC this intention
- * and supress the warning
- */
- /* FALLTHRU */
+ /*
+ * NOTE: intentional fall through
+ * - for consistency in rx processing
+ *
+ * The following comment is to signal GCC this intention
+ * and supress the warning
+ */
+ /* FALLTHRU */
case BGP_ATTR_NHLEN_IPV4:
stream_get(&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
/* Probably needed for RFC 2283 */
@@ -1960,8 +1954,7 @@ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */
/* alloc and copy sub-tlv */
/* TBD make sure these are freed when attributes are released */
tlv = XCALLOC(MTYPE_ENCAP_TLV,
- sizeof(struct bgp_attr_encap_subtlv)
- + sublength);
+ sizeof(struct bgp_attr_encap_subtlv) + sublength);
tlv->type = subtype;
tlv->length = sublength;
stream_get(tlv->value, peer->curr, sublength);
@@ -2715,8 +2708,8 @@ void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi,
stream_put(s, &p->u.prefix, PSIZE(p->prefixlen));
} else if (afi == AFI_L2VPN && safi == SAFI_EVPN) {
/* EVPN prefix - contents depend on type */
- bgp_evpn_encode_prefix(s, p, prd, label, num_labels,
- attr, addpath_encode, addpath_tx_id);
+ bgp_evpn_encode_prefix(s, p, prd, label, num_labels, attr,
+ addpath_encode, addpath_tx_id);
} else if (safi == SAFI_LABELED_UNICAST) {
/* Prefix write with label. */
stream_put_labeled_prefix(s, p, label);
@@ -2799,8 +2792,9 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer,
if (attrlenfield > 0xff) {
/* 2-octet length field */
- stream_putc(s, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, attrtype);
stream_putw(s, attrlenfield & 0xffff);
} else {
@@ -2867,9 +2861,9 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
mpattrlen_pos = bgp_packet_mpattr_start(s, peer, afi, safi,
vecarr, attr);
- bgp_packet_mpattr_prefix(s, afi, safi, p, prd,
- label, num_labels,
- addpath_encode, addpath_tx_id, attr);
+ bgp_packet_mpattr_prefix(s, afi, safi, p, prd, label,
+ num_labels, addpath_encode,
+ addpath_tx_id, attr);
bgp_packet_mpattr_end(s, mpattrlen_pos);
}
@@ -3039,14 +3033,15 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES))) {
if (attr->community->size * 4 > 255) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putw(s, attr->community->size * 4);
} else {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putc(s, attr->community->size * 4);
}
@@ -3060,14 +3055,15 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
PEER_FLAG_SEND_LARGE_COMMUNITY)
&& (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES))) {
if (lcom_length(attr->lcommunity) > 255) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putw(s, lcom_length(attr->lcommunity));
} else {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putc(s, lcom_length(attr->lcommunity));
}
@@ -3119,14 +3115,16 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
if (peer->sort == BGP_PEER_IBGP
|| peer->sort == BGP_PEER_CONFED) {
if (attr->ecommunity->size * 8 > 255) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_EXT_COMMUNITIES);
stream_putw(s, attr->ecommunity->size * 8);
} else {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_EXT_COMMUNITIES);
stream_putc(s, attr->ecommunity->size * 8);
}
@@ -3192,8 +3190,9 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
label_index = attr->label_index;
if (label_index != BGP_INVALID_LABEL_INDEX) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_PREFIX_SID);
stream_putc(s, 10);
stream_putc(s, BGP_PREFIX_SID_LABEL_INDEX);
@@ -3221,8 +3220,9 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
*/
aspath = aspath_delete_confed_seq(aspath);
- stream_putc(s, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_AS4_PATH);
aspath_sizep = stream_get_endp(s);
stream_putw(s, 0);
@@ -3264,8 +3264,10 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
stream_putc(s, 9); // Length
stream_putc(s, 0); // Flags
stream_putc(s, 6); // Tunnel type: Ingress Replication (6)
- stream_put(s, &(attr->label), BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI
- stream_put_ipv4(s, attr->nexthop.s_addr); // Unicast tunnel endpoint IP address
+ stream_put(s, &(attr->label),
+ BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI
+ stream_put_ipv4(s, attr->nexthop.s_addr); // Unicast tunnel
+ // endpoint IP address
}
/* Unknown transit attribute. */
@@ -3311,8 +3313,7 @@ void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p, afi_t afi,
num_labels = 1;
}
- return bgp_packet_mpattr_prefix(s, afi, safi, p, prd,
- label, num_labels,
+ return bgp_packet_mpattr_prefix(s, afi, safi, p, prd, label, num_labels,
addpath_encode, addpath_tx_id, attr);
}
@@ -3422,14 +3423,15 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
/* Community attribute. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)) {
if (attr->community->size * 4 > 255) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putw(s, attr->community->size * 4);
} else {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_COMMUNITIES);
stream_putc(s, attr->community->size * 4);
}
@@ -3439,19 +3441,21 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
/* Large Community attribute. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)) {
if (lcom_length(attr->lcommunity) > 255) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS
- | BGP_ATTR_FLAG_EXTLEN);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS
+ | BGP_ATTR_FLAG_EXTLEN);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putw(s, lcom_length(attr->lcommunity));
} else {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_LARGE_COMMUNITIES);
stream_putc(s, lcom_length(attr->lcommunity));
}
- stream_put(s, attr->lcommunity->val, lcom_length(attr->lcommunity));
+ stream_put(s, attr->lcommunity->val,
+ lcom_length(attr->lcommunity));
}
/* Add a MP_NLRI attribute to dump the IPv6 next hop */
@@ -3490,8 +3494,9 @@ void bgp_dump_routes_attr(struct stream *s, struct attr *attr,
/* Prefix SID */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID)) {
if (attr->label_index != BGP_INVALID_LABEL_INDEX) {
- stream_putc(s, BGP_ATTR_FLAG_OPTIONAL
- | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s,
+ BGP_ATTR_FLAG_OPTIONAL
+ | BGP_ATTR_FLAG_TRANS);
stream_putc(s, BGP_ATTR_PREFIX_SID);
stream_putc(s, 10);
stream_putc(s, BGP_PREFIX_SID_LABEL_INDEX);
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index 1b1471a19..1a49e4ecf 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -215,10 +215,8 @@ struct transit {
/* "(void) 0" will generate a compiler error. this is a safety check to
* ensure we're not using a value that exceeds the bit size of attr->flag. */
-#define ATTR_FLAG_BIT(X) \
- __builtin_choose_expr((X) >= 1 && (X) <= 64, \
- 1ULL << ((X) - 1), \
- (void) 0)
+#define ATTR_FLAG_BIT(X) \
+ __builtin_choose_expr((X) >= 1 && (X) <= 64, 1ULL << ((X)-1), (void)0)
#define BGP_CLUSTER_LIST_LENGTH(attr) \
(((attr)->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) \
@@ -260,8 +258,8 @@ extern bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *,
struct bpacket_attr_vec_arr *vecarr,
struct prefix *, afi_t, safi_t,
struct peer *, struct prefix_rd *,
- mpls_label_t *, u_int32_t,
- int, u_int32_t);
+ mpls_label_t *, u_int32_t, int,
+ u_int32_t);
extern void bgp_dump_routes_attr(struct stream *, struct attr *,
struct prefix *);
extern int attrhash_cmp(const void *, const void *);
@@ -320,9 +318,9 @@ extern size_t bgp_packet_mpunreach_start(struct stream *s, afi_t afi,
safi_t safi);
extern void bgp_packet_mpunreach_prefix(struct stream *s, struct prefix *p,
afi_t afi, safi_t safi,
- struct prefix_rd *prd,
- mpls_label_t *, u_int32_t,
- int, u_int32_t, struct attr *);
+ struct prefix_rd *prd, mpls_label_t *,
+ u_int32_t, int, u_int32_t,
+ struct attr *);
extern void bgp_packet_mpunreach_end(struct stream *s, size_t attrlen_pnt);
static inline int bgp_rmap_nhop_changed(u_int32_t out_rmap_flags,
diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c
index e74fa5a2b..8d5eff9a6 100644
--- a/bgpd/bgp_attr_evpn.c
+++ b/bgpd/bgp_attr_evpn.c
@@ -106,8 +106,7 @@ char *ecom_mac2str(char *ecom_mac)
}
/* Fetch router-mac from extended community */
-void bgp_attr_rmac(struct attr *attr,
- struct ethaddr *rmac)
+void bgp_attr_rmac(struct attr *attr, struct ethaddr *rmac)
{
int i = 0;
struct ecommunity *ecom;
@@ -126,8 +125,8 @@ void bgp_attr_rmac(struct attr *attr,
type = *pnt++;
sub_type = *pnt++;
- if (!(type == ECOMMUNITY_ENCODE_EVPN &&
- sub_type == ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC))
+ if (!(type == ECOMMUNITY_ENCODE_EVPN
+ && sub_type == ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC))
continue;
memcpy(rmac, pnt, ETH_ALEN);
@@ -139,8 +138,8 @@ void bgp_attr_rmac(struct attr *attr,
*/
uint8_t bgp_attr_default_gw(struct attr *attr)
{
- struct ecommunity *ecom;
- int i;
+ struct ecommunity *ecom;
+ int i;
ecom = attr->ecommunity;
if (!ecom || !ecom->size)
@@ -149,15 +148,15 @@ uint8_t bgp_attr_default_gw(struct attr *attr)
/* If there is a default gw extendd community return true otherwise
* return 0 */
for (i = 0; i < ecom->size; i++) {
- u_char *pnt;
- u_char type, sub_type;
+ u_char *pnt;
+ u_char type, sub_type;
pnt = (ecom->val + (i * ECOMMUNITY_SIZE));
type = *pnt++;
sub_type = *pnt++;
if ((type == ECOMMUNITY_ENCODE_OPAQUE
- && sub_type == ECOMMUNITY_EVPN_SUBTYPE_DEF_GW))
+ && sub_type == ECOMMUNITY_EVPN_SUBTYPE_DEF_GW))
return 1;
}
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index 7c83eaa09..b78edcb2f 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -222,7 +222,8 @@ static void set_community_string(struct community *com, bool make_json)
if (make_json) {
json_object_string_add(com->json, "string", "");
- json_object_object_add(com->json, "list", json_community_list);
+ json_object_object_add(com->json, "list",
+ json_community_list);
}
com->str = str;
return;
@@ -277,24 +278,30 @@ static void set_community_string(struct community *com, bool make_json)
strcpy(pnt, "internet");
pnt += strlen("internet");
if (make_json) {
- json_string = json_object_new_string("internet");
- json_object_array_add(json_community_list, json_string);
+ json_string =
+ json_object_new_string("internet");
+ json_object_array_add(json_community_list,
+ json_string);
}
break;
case COMMUNITY_NO_EXPORT:
strcpy(pnt, "no-export");
pnt += strlen("no-export");
if (make_json) {
- json_string = json_object_new_string("noExport");
- json_object_array_add(json_community_list, json_string);
+ json_string =
+ json_object_new_string("noExport");
+ json_object_array_add(json_community_list,
+ json_string);
}
break;
case COMMUNITY_NO_ADVERTISE:
strcpy(pnt, "no-advertise");
pnt += strlen("no-advertise");
if (make_json) {
- json_string = json_object_new_string("noAdvertise");
- json_object_array_add(json_community_list, json_string);
+ json_string =
+ json_object_new_string("noAdvertise");
+ json_object_array_add(json_community_list,
+ json_string);
}
break;
case COMMUNITY_LOCAL_AS:
@@ -302,15 +309,18 @@ static void set_community_string(struct community *com, bool make_json)
pnt += strlen("local-AS");
if (make_json) {
json_string = json_object_new_string("localAs");
- json_object_array_add(json_community_list, json_string);
+ json_object_array_add(json_community_list,
+ json_string);
}
break;
case COMMUNITY_GSHUT:
strcpy(pnt, "graceful-shutdown");
pnt += strlen("graceful-shutdown");
if (make_json) {
- json_string = json_object_new_string("gracefulShutdown");
- json_object_array_add(json_community_list, json_string);
+ json_string = json_object_new_string(
+ "gracefulShutdown");
+ json_object_array_add(json_community_list,
+ json_string);
}
break;
default:
@@ -319,7 +329,8 @@ static void set_community_string(struct community *com, bool make_json)
sprintf(pnt, "%u:%d", as, val);
if (make_json) {
json_string = json_object_new_string(pnt);
- json_object_array_add(json_community_list, json_string);
+ json_object_array_add(json_community_list,
+ json_string);
}
pnt += strlen(pnt);
break;
@@ -545,7 +556,8 @@ community_gettoken(const char *buf, enum community_token *token, u_int32_t *val)
p += strlen("local-AS");
return p;
}
- if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown")) == 0) {
+ if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown"))
+ == 0) {
*val = COMMUNITY_GSHUT;
*token = community_token_gshut;
p += strlen("graceful-shutdown");
@@ -662,10 +674,10 @@ struct hash *community_hash(void)
/* Initialize comminity related hash. */
void community_init(void)
{
- comhash = hash_create(
- (unsigned int (*)(void *))community_hash_make,
- (int (*)(const void *, const void *))community_cmp,
- "BGP Community Hash");
+ comhash =
+ hash_create((unsigned int (*)(void *))community_hash_make,
+ (int (*)(const void *, const void *))community_cmp,
+ "BGP Community Hash");
}
void community_finish(void)
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index 36ffb0e9c..e2f97bf4f 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -542,7 +542,7 @@ static const char *bgp_get_reuse_time(unsigned int penalty, char *buf,
} else
reuse_time = 0;
-/* Making formatted timer strings. */
+ /* Making formatted timer strings. */
if (reuse_time == 0) {
if (use_json)
json_object_int_add(json, "reuseTimerMsecs", 0);
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 7dafde51a..cea1c6baa 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -260,8 +260,7 @@ int ecommunity_cmp(const void *arg1, const void *arg2)
/* Initialize Extended Comminities related hash. */
void ecommunity_init(void)
{
- ecomhash = hash_create(ecommunity_hash_make,
- ecommunity_cmp,
+ ecomhash = hash_create(ecommunity_hash_make, ecommunity_cmp,
"BGP ecommunity hash");
}
@@ -690,7 +689,7 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
tunneltype = ntohs(tunneltype);
len = sprintf(str_buf + str_pnt, "ET:%d",
tunneltype);
- } else if (*pnt == ECOMMUNITY_EVPN_SUBTYPE_DEF_GW) {
+ } else if (*pnt == ECOMMUNITY_EVPN_SUBTYPE_DEF_GW) {
len = sprintf(str_buf + str_pnt,
"Default Gateway");
} else
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index e5863e498..fc7549671 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -193,8 +193,7 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt)
/*
* Is specified VRF present on the RT's list of "importing" VRFs?
*/
-static int is_vrf_present_in_irt_vrfs(struct list *vrfs,
- struct bgp *bgp_vrf)
+static int is_vrf_present_in_irt_vrfs(struct list *vrfs, struct bgp *bgp_vrf)
{
struct listnode *node = NULL, *nnode = NULL;
struct bgp *tmp_bgp_vrf = NULL;
@@ -353,8 +352,7 @@ static inline void mask_ecom_global_admin(struct ecommunity_val *dst,
* Map one RT to specified VRF.
* bgp_vrf = BGP vrf instance
*/
-static void map_vrf_to_rt(struct bgp *bgp_vrf,
- struct ecommunity_val *eval)
+static void map_vrf_to_rt(struct bgp *bgp_vrf, struct ecommunity_val *eval)
{
struct vrf_irt_node *irt = NULL;
struct ecommunity_val eval_tmp;
@@ -365,8 +363,7 @@ static void map_vrf_to_rt(struct bgp *bgp_vrf,
* as the RT for EBGP peering too.
*/
memcpy(&eval_tmp, eval, ECOMMUNITY_SIZE);
- if (!CHECK_FLAG(bgp_vrf->vrf_flags,
- BGP_VRF_IMPORT_RT_CFGD))
+ if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD))
mask_ecom_global_admin(&eval_tmp, eval);
irt = lookup_vrf_import_rt(&eval_tmp);
@@ -389,8 +386,7 @@ static void map_vrf_to_rt(struct bgp *bgp_vrf,
* VRFs for this RT, then the RT hash is deleted.
* bgp_vrf: BGP VRF specific instance
*/
-static void unmap_vrf_from_rt(struct bgp *bgp_vrf,
- struct vrf_irt_node *irt)
+static void unmap_vrf_from_rt(struct bgp *bgp_vrf, struct vrf_irt_node *irt)
{
/* Delete VRF from list for this RT. */
listnode_delete(irt->vrfs, bgp_vrf);
@@ -503,9 +499,9 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
s = zclient->obuf;
stream_reset(s);
- zclient_create_header(s, add ? ZEBRA_REMOTE_MACIP_ADD
- : ZEBRA_REMOTE_MACIP_DEL,
- bgp->vrf_id);
+ zclient_create_header(
+ s, add ? ZEBRA_REMOTE_MACIP_ADD : ZEBRA_REMOTE_MACIP_DEL,
+ bgp->vrf_id);
stream_putl(s, vpn->vni);
stream_put(s, &p->prefix.mac.octet, ETH_ALEN); /* Mac Addr */
/* IP address length and IP address, if any. */
@@ -526,13 +522,13 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn,
stream_putw_at(s, 0, stream_get_endp(s));
if (bgp_debug_zebra(NULL))
- zlog_debug("Tx %s MACIP, VNI %u MAC %s IP %s (flags: 0x%x) remote VTEP %s",
- add ? "ADD" : "DEL", vpn->vni,
- prefix_mac2str(&p->prefix.mac, buf1, sizeof(buf1)),
- ipaddr2str(&p->prefix.ip, buf3, sizeof(buf3)),
- flags,
- inet_ntop(AF_INET, &remote_vtep_ip, buf2,
- sizeof(buf2)));
+ zlog_debug(
+ "Tx %s MACIP, VNI %u MAC %s IP %s (flags: 0x%x) remote VTEP %s",
+ add ? "ADD" : "DEL", vpn->vni,
+ prefix_mac2str(&p->prefix.mac, buf1, sizeof(buf1)),
+ ipaddr2str(&p->prefix.ip, buf3, sizeof(buf3)), flags,
+ inet_ntop(AF_INET, &remote_vtep_ip, buf2,
+ sizeof(buf2)));
return zclient_send_message(zclient);
}
@@ -556,9 +552,9 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
s = zclient->obuf;
stream_reset(s);
- zclient_create_header(s, add ? ZEBRA_REMOTE_VTEP_ADD
- : ZEBRA_REMOTE_VTEP_DEL,
- bgp->vrf_id);
+ zclient_create_header(
+ s, add ? ZEBRA_REMOTE_VTEP_ADD : ZEBRA_REMOTE_VTEP_DEL,
+ bgp->vrf_id);
stream_putl(s, vpn->vni);
if (IS_EVPN_PREFIX_IPADDR_V4(p))
stream_put_in_addr(s, &p->prefix.ip.ipaddr_v4);
@@ -608,8 +604,8 @@ static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf,
vrf_export_rtl = bgp_vrf->vrf_export_rtl;
if (vrf_export_rtl && !list_isempty(vrf_export_rtl)) {
for (ALL_LIST_ELEMENTS(vrf_export_rtl, node, nnode, ecom))
- attr->ecommunity = ecommunity_merge(attr->ecommunity,
- ecom);
+ attr->ecommunity =
+ ecommunity_merge(attr->ecommunity, ecom);
}
/* add the router mac extended community */
@@ -618,8 +614,8 @@ static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf,
encode_rmac_extcomm(&eval_rmac, &attr->rmac);
ecom_rmac.size = 1;
ecom_rmac.val = (uint8_t *)eval_rmac.val;
- attr->ecommunity = ecommunity_merge(attr->ecommunity,
- &ecom_rmac);
+ attr->ecommunity =
+ ecommunity_merge(attr->ecommunity, &ecom_rmac);
}
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
@@ -675,9 +671,8 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr,
if (vrf_export_rtl && !list_isempty(vrf_export_rtl)) {
for (ALL_LIST_ELEMENTS(vrf_export_rtl, node, nnode,
ecom))
- attr->ecommunity =
- ecommunity_merge(attr->ecommunity,
- ecom);
+ attr->ecommunity = ecommunity_merge(
+ attr->ecommunity, ecom);
}
}
@@ -695,14 +690,14 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr,
* only attach l3-vni rmac for ipv4 address family and if we are
* advertising both the labels in type-2 routes
*/
- if (afi == AFI_IP && !is_zero_mac(&attr->rmac) &&
- CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) {
+ if (afi == AFI_IP && !is_zero_mac(&attr->rmac)
+ && CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) {
memset(&ecom_rmac, 0, sizeof(ecom_rmac));
encode_rmac_extcomm(&eval_rmac, &attr->rmac);
ecom_rmac.size = 1;
ecom_rmac.val = (uint8_t *)eval_rmac.val;
- attr->ecommunity = ecommunity_merge(attr->ecommunity,
- &ecom_rmac);
+ attr->ecommunity =
+ ecommunity_merge(attr->ecommunity, &ecom_rmac);
}
if (attr->default_gw) {
@@ -710,8 +705,8 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr,
encode_default_gw_extcomm(&eval_default_gw);
ecom_default_gw.size = 1;
ecom_default_gw.val = (uint8_t *)eval_default_gw.val;
- attr->ecommunity = ecommunity_merge(attr->ecommunity,
- &ecom_default_gw);
+ attr->ecommunity =
+ ecommunity_merge(attr->ecommunity, &ecom_default_gw);
}
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES);
@@ -848,7 +843,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
int ret = 0;
- u_char flags = 0;
+ u_char flags = 0;
/* Compute the best path. */
bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi], &old_and_new,
@@ -871,10 +866,9 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
if (old_select->attr->default_gw)
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
- ret = evpn_zebra_install(bgp, vpn,
- (struct prefix_evpn *)&rn->p,
- old_select->attr->nexthop,
- flags);
+ ret = evpn_zebra_install(
+ bgp, vpn, (struct prefix_evpn *)&rn->p,
+ old_select->attr->nexthop, flags);
}
UNSET_FLAG(old_select->flags, BGP_INFO_MULTIPATH_CHG);
bgp_zebra_clear_route_change_flags(rn);
@@ -906,8 +900,7 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
if (new_select->attr->default_gw)
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
ret = evpn_zebra_install(bgp, vpn, (struct prefix_evpn *)&rn->p,
- new_select->attr->nexthop,
- flags);
+ new_select->attr->nexthop, flags);
/* If an old best existed and it was a "local" route, the only
* reason
* it would be supplanted is due to MAC mobility procedures. So,
@@ -942,8 +935,8 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
*/
static int evpn_route_is_def_gw(struct bgp *bgp, struct bgp_node *rn)
{
- struct bgp_info *tmp_ri = NULL;
- struct bgp_info *local_ri = NULL;
+ struct bgp_info *tmp_ri = NULL;
+ struct bgp_info *local_ri = NULL;
local_ri = NULL;
for (tmp_ri = rn->info; tmp_ri; tmp_ri = tmp_ri->next) {
@@ -1053,9 +1046,8 @@ static int update_evpn_type5_route_entry(struct bgp *bgp_def,
}
/* update evpn type-5 route entry */
-static int update_evpn_type5_route(struct bgp *bgp_vrf,
- struct prefix_evpn *evp,
- struct attr* src_attr)
+static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
+ struct attr *src_attr)
{
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -1088,14 +1080,12 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf,
/* get the route node in global table */
rn = bgp_afi_node_get(bgp_def->rib[afi][safi], afi, safi,
- (struct prefix *)evp,
- &bgp_vrf->vrf_prd);
+ (struct prefix *)evp, &bgp_vrf->vrf_prd);
assert(rn);
/* create or update the route entry within the route node */
- update_evpn_type5_route_entry(bgp_def, bgp_vrf,
- afi, safi,
- rn, &attr, &route_changed);
+ update_evpn_type5_route_entry(bgp_def, bgp_vrf, afi, safi, rn, &attr,
+ &route_changed);
/* schedule for processing and unlock node */
if (route_changed) {
@@ -1200,8 +1190,8 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
* Only attach second label if we are advertising two labels for
* type-2 routes.
*/
- if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE &&
- CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) {
+ if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
+ && CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) {
vni_t l3vni;
l3vni = bgpevpn_get_l3vni(vpn);
@@ -1225,8 +1215,9 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
* be advertised with right labels.
*/
vni2label(vpn->vni, &label[0]);
- if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE &&
- CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) {
+ if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
+ && CHECK_FLAG(vpn->flags,
+ VNI_FLAG_USE_TWO_LABELS)) {
vni_t l3vni;
l3vni = bgpevpn_get_l3vni(vpn);
@@ -1294,9 +1285,8 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
vni2label(vpn->vni, &(attr.label));
/* Set up RT and ENCAP extended community. */
- build_evpn_route_extcomm(vpn, &attr,
- IS_EVPN_PREFIX_IPADDR_V4(p) ?
- AFI_IP : AFI_IP6);
+ build_evpn_route_extcomm(
+ vpn, &attr, IS_EVPN_PREFIX_IPADDR_V4(p) ? AFI_IP : AFI_IP6);
/* First, create (or fetch) route node within the VNI. */
/* NOTE: There is no RD here. */
@@ -1340,9 +1330,8 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
/* Delete EVPN type5 route entry from global table */
static void delete_evpn_type5_route_entry(struct bgp *bgp_def,
- struct bgp *bgp_vrf,
- afi_t afi, safi_t safi,
- struct bgp_node *rn,
+ struct bgp *bgp_vrf, afi_t afi,
+ safi_t safi, struct bgp_node *rn,
struct bgp_info **ri)
{
struct bgp_info *tmp_ri = NULL;
@@ -1364,8 +1353,7 @@ static void delete_evpn_type5_route_entry(struct bgp *bgp_def,
}
/* Delete EVPN type5 route */
-static int delete_evpn_type5_route(struct bgp *bgp_vrf,
- struct prefix_evpn *evp)
+static int delete_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp)
{
afi_t afi = AFI_L2VPN;
safi_t safi = SAFI_EVPN;
@@ -1553,12 +1541,12 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
if (IS_EVPN_PREFIX_IPADDR_V4(evp)) {
if (evpn_route_is_sticky(bgp, rn))
update_evpn_route_entry(bgp, vpn, afi, safi, rn,
- &attr_sticky, 0, 1,
- &ri, 0);
+ &attr_sticky, 0, 1, &ri,
+ 0);
else if (evpn_route_is_def_gw(bgp, rn))
update_evpn_route_entry(bgp, vpn, afi, safi, rn,
- &attr_def_gw, 0, 1,
- &ri, 0);
+ &attr_def_gw, 0, 1, &ri,
+ 0);
else
update_evpn_route_entry(bgp, vpn, afi, safi, rn,
&attr, 0, 1, &ri, 0);
@@ -1573,8 +1561,8 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn)
&ri, 0);
else
update_evpn_route_entry(bgp, vpn, afi, safi, rn,
- &attr_ip6, 0, 1,
- &ri, 0);
+ &attr_ip6, 0, 1, &ri,
+ 0);
}
/* If a local route exists for this prefix, we need to update
@@ -1819,10 +1807,11 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
ip_prefix_from_type5_prefix(evp, pp);
if (bgp_debug_zebra(NULL)) {
- zlog_debug("installing evpn prefix %s as ip prefix %s in vrf %s",
- prefix2str(evp, buf, sizeof(buf)),
- prefix2str(pp, buf1, sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
+ zlog_debug(
+ "installing evpn prefix %s as ip prefix %s in vrf %s",
+ prefix2str(evp, buf, sizeof(buf)),
+ prefix2str(pp, buf1, sizeof(buf)),
+ vrf_id_to_name(bgp_vrf->vrf_id));
}
/* Create (or fetch) route within the VRF. */
@@ -1983,10 +1972,11 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
ip_prefix_from_type5_prefix(evp, pp);
if (bgp_debug_zebra(NULL)) {
- zlog_debug("uninstalling evpn prefix %s as ip prefix %s in vrf %s",
- prefix2str(evp, buf, sizeof(buf)),
- prefix2str(pp, buf1, sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
+ zlog_debug(
+ "uninstalling evpn prefix %s as ip prefix %s in vrf %s",
+ prefix2str(evp, buf, sizeof(buf)),
+ prefix2str(pp, buf1, sizeof(buf)),
+ vrf_id_to_name(bgp_vrf->vrf_id));
}
/* Locate route within the VRF. */
@@ -2068,8 +2058,7 @@ static int uninstall_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
* Given a route entry and a VRF, see if this route entry should be
* imported into the VRF i.e., RTs match.
*/
-static int is_route_matching_for_vrf(struct bgp *bgp_vrf,
- struct bgp_info *ri)
+static int is_route_matching_for_vrf(struct bgp *bgp_vrf, struct bgp_info *ri)
{
struct attr *attr = ri->attr;
struct ecommunity *ecom;
@@ -2202,8 +2191,7 @@ static int is_route_matching_for_vni(struct bgp *bgp, struct bgpevpn *vpn,
* Install or uninstall mac-ip routes are appropriate for this
* particular VRF.
*/
-static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf,
- int install)
+static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
{
afi_t afi;
safi_t safi;
@@ -2234,13 +2222,14 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf,
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
/* if not mac-ip route skip this route */
- if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE ||
- evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE))
+ if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
+ || evp->prefix.route_type
+ == BGP_EVPN_IP_PREFIX_ROUTE))
continue;
/* if not a mac+ip route skip this route */
- if (!(IS_EVPN_PREFIX_IPADDR_V4(evp) ||
- IS_EVPN_PREFIX_IPADDR_V6(evp)))
+ if (!(IS_EVPN_PREFIX_IPADDR_V4(evp)
+ || IS_EVPN_PREFIX_IPADDR_V6(evp)))
continue;
for (ri = rn->info; ri; ri = ri->next) {
@@ -2254,12 +2243,10 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf,
if (is_route_matching_for_vrf(bgp_vrf, ri)) {
if (install)
- ret =
- install_evpn_route_entry_in_vrf(
+ ret = install_evpn_route_entry_in_vrf(
bgp_vrf, evp, ri);
else
- ret =
- uninstall_evpn_route_entry_in_vrf(
+ ret = uninstall_evpn_route_entry_in_vrf(
bgp_vrf, evp, ri);
if (ret) {
@@ -2269,7 +2256,8 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf,
: "uninstall",
prefix2str(evp, buf,
sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
+ vrf_id_to_name(
+ bgp_vrf->vrf_id));
return ret;
}
}
@@ -2425,24 +2413,24 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi,
struct listnode *node, *nnode;
/* Only type-2/type-5 routes go into a VRF */
- if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE ||
- evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE))
+ if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
+ || evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE))
return 0;
/* if it is type-2 route and not a mac+ip route skip this route */
- if ((evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) &&
- !(IS_EVPN_PREFIX_IPADDR_V4(evp) || IS_EVPN_PREFIX_IPADDR_V6(evp)))
+ if ((evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
+ && !(IS_EVPN_PREFIX_IPADDR_V4(evp)
+ || IS_EVPN_PREFIX_IPADDR_V6(evp)))
return 0;
for (ALL_LIST_ELEMENTS(vrfs, node, nnode, bgp_vrf)) {
int ret;
if (install)
- ret = install_evpn_route_entry_in_vrf(bgp_vrf,
- evp, ri);
+ ret = install_evpn_route_entry_in_vrf(bgp_vrf, evp, ri);
else
- ret = uninstall_evpn_route_entry_in_vrf(bgp_vrf,
- evp, ri);
+ ret = uninstall_evpn_route_entry_in_vrf(bgp_vrf, evp,
+ ri);
if (ret) {
zlog_err("%u: Failed to %s prefix %s in VRF %s",
@@ -2529,7 +2517,7 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
u_char type, sub_type;
struct ecommunity_val *eval;
struct ecommunity_val eval_tmp;
- struct irt_node *irt; /* import rt for l2vni */
+ struct irt_node *irt; /* import rt for l2vni */
struct vrf_irt_node *vrf_irt; /* import rt for l3vni */
/* Only deal with RTs */
@@ -2577,9 +2565,8 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
install_uninstall_route_in_vnis(bgp, afi, safi, evp, ri,
irt->vnis, import);
if (vrf_irt && vrf_irt->vrfs)
- install_uninstall_route_in_vrfs(bgp, afi, safi, evp,
- ri, vrf_irt->vrfs,
- import);
+ install_uninstall_route_in_vrfs(bgp, afi, safi, evp, ri,
+ vrf_irt->vrfs, import);
}
return 0;
@@ -2897,7 +2884,8 @@ static int process_type2_route(struct peer *peer, afi_t afi, safi_t safi,
memcpy(&label[1], pfx, BGP_LABEL_BYTES);
/*
* If in future, we are required to access additional fields,
- * we MUST increment pfx by BGP_LABEL_BYTES in before reading the next field
+ * we MUST increment pfx by BGP_LABEL_BYTES in before reading
+ * the next field
*/
}
@@ -3057,7 +3045,8 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
/*
* If in future, we are required to access additional fields,
- * we MUST increment pfx by BGP_LABEL_BYTES in before reading the next field
+ * we MUST increment pfx by BGP_LABEL_BYTES in before reading the next
+ * field
*/
/* Process the route. */
@@ -3074,9 +3063,8 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
}
static void evpn_mpattr_encode_type5(struct stream *s, struct prefix *p,
- struct prefix_rd *prd,
- mpls_label_t *label, u_int32_t num_labels,
- struct attr *attr)
+ struct prefix_rd *prd, mpls_label_t *label,
+ u_int32_t num_labels, struct attr *attr)
{
int len;
char temp[16];
@@ -3234,16 +3222,14 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p,
ret = delete_evpn_type5_route(bgp_vrf, &evp);
if (ret) {
zlog_err(
- "%u failed to delete type-5 route for prefix %s in vrf %s",
- bgp_vrf->vrf_id,
- prefix2str(p, buf, sizeof(buf)),
- vrf_id_to_name(bgp_vrf->vrf_id));
+ "%u failed to delete type-5 route for prefix %s in vrf %s",
+ bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)),
+ vrf_id_to_name(bgp_vrf->vrf_id));
}
}
/* withdraw all type-5 routes for an address family */
-void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf,
- afi_t afi, safi_t safi)
+void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, afi_t afi, safi_t safi)
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
@@ -3258,8 +3244,8 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf,
/* Only care about "selected" routes - non-imported. */
/* TODO: Support for AddPath for EVPN. */
for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
- (!ri->extra || !ri->extra->parent)) {
+ if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)
+ && (!ri->extra || !ri->extra->parent)) {
bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p,
afi, safi);
break;
@@ -3275,8 +3261,8 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf,
* are advertising local subnets), the src_attr will be NULL.
*/
void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p,
- struct attr *src_attr,
- afi_t afi, safi_t safi)
+ struct attr *src_attr, afi_t afi,
+ safi_t safi)
{
int ret = 0;
struct prefix_evpn evp;
@@ -3289,18 +3275,16 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p,
build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret)
- zlog_err(
- "%u: Failed to create type-5 route for prefix %s",
- bgp_vrf->vrf_id,
- prefix2str(p, buf, sizeof(buf)));
+ zlog_err("%u: Failed to create type-5 route for prefix %s",
+ bgp_vrf->vrf_id, prefix2str(p, buf, sizeof(buf)));
}
/* Inject all prefixes of a particular address-family (currently, IPv4 or
* IPv6 unicast) into EVPN as type-5 routes. This is invoked when the
* advertisement is enabled.
*/
-void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
- afi_t afi, safi_t safi)
+void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi,
+ safi_t safi)
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
@@ -3317,31 +3301,29 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
* TODO: Support for AddPath for EVPN.
*/
for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
- (!ri->extra || !ri->extra->parent)) {
+ if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)
+ && (!ri->extra || !ri->extra->parent)) {
/* apply the route-map */
if (bgp_vrf->adv_cmd_rmap[afi][safi].map) {
int ret = 0;
- ret =
- route_map_apply(
- bgp_vrf->adv_cmd_rmap[afi][safi].map,
- &rn->p, RMAP_BGP, ri);
+ ret = route_map_apply(
+ bgp_vrf->adv_cmd_rmap[afi][safi]
+ .map,
+ &rn->p, RMAP_BGP, ri);
if (ret == RMAP_DENYMATCH)
continue;
}
- bgp_evpn_advertise_type5_route(bgp_vrf, &rn->p,
- ri->attr,
- afi, safi);
+ bgp_evpn_advertise_type5_route(
+ bgp_vrf, &rn->p, ri->attr, afi, safi);
break;
}
}
}
}
-void evpn_rt_delete_auto(struct bgp *bgp, vni_t vni,
- struct list *rtl)
+void evpn_rt_delete_auto(struct bgp *bgp, vni_t vni, struct list *rtl)
{
struct listnode *node, *nnode, *node_to_del;
struct ecommunity *ecom, *ecom_auto;
@@ -3437,7 +3419,6 @@ void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf,
SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_EXPORT_RT_CFGD);
bgp_evpn_handle_export_rt_change_for_vrf(bgp_vrf);
-
}
void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp *bgp_vrf,
@@ -3515,8 +3496,7 @@ int bgp_evpn_handle_export_rt_change(struct bgp *bgp, struct bgpevpn *vpn)
return update_routes_for_vni(bgp, vpn);
}
-void bgp_evpn_handle_vrf_rd_change(struct bgp *bgp_vrf,
- int withdraw)
+void bgp_evpn_handle_vrf_rd_change(struct bgp *bgp_vrf, int withdraw)
{
if (withdraw)
delete_withdraw_vrf_routes(bgp_vrf);
@@ -3560,14 +3540,14 @@ int bgp_evpn_uninstall_routes(struct bgp *bgp, struct bgpevpn *vpn)
/*
* TODO: Hardcoded for a maximum of 2 VNIs right now
*/
-char *bgp_evpn_label2str(mpls_label_t *label, u_int32_t num_labels,
- char *buf, int len)
+char *bgp_evpn_label2str(mpls_label_t *label, u_int32_t num_labels, char *buf,
+ int len)
{
vni_t vni1, vni2;
vni1 = label2vni(label);
if (num_labels == 2) {
- vni2 = label2vni(label+1);
+ vni2 = label2vni(label + 1);
snprintf(buf, len, "%u/%u", vni1, vni2);
} else
snprintf(buf, len, "%u", vni1);
@@ -3675,11 +3655,10 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len)
}
} else if (p->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE) {
snprintf(buf, len, "[%d]:[0]:[0]:[%d]:[%s]",
- p->prefix.route_type,
- p->prefix.ip_prefix_length,
- IS_EVPN_PREFIX_IPADDR_V4(p) ?
- inet_ntoa(p->prefix.ip.ipaddr_v4) :
- inet6_ntoa(p->prefix.ip.ipaddr_v6));
+ p->prefix.route_type, p->prefix.ip_prefix_length,
+ IS_EVPN_PREFIX_IPADDR_V4(p)
+ ? inet_ntoa(p->prefix.ip.ipaddr_v4)
+ : inet6_ntoa(p->prefix.ip.ipaddr_v6));
} else {
/* For EVPN route types not supported yet. */
snprintf(buf, len, "(unsupported route type %d)",
@@ -3693,10 +3672,9 @@ char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len)
* Encode EVPN prefix in Update (MP_REACH)
*/
void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
- struct prefix_rd *prd,
- mpls_label_t *label, u_int32_t num_labels,
- struct attr *attr, int addpath_encode,
- u_int32_t addpath_tx_id)
+ struct prefix_rd *prd, mpls_label_t *label,
+ u_int32_t num_labels, struct attr *attr,
+ int addpath_encode, u_int32_t addpath_tx_id)
{
struct prefix_evpn *evp = (struct prefix_evpn *)p;
int len, ipa_len = 0;
@@ -3718,19 +3696,19 @@ void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
if (ipa_len && num_labels > 1) /* There are 2 VNIs */
len += 3;
stream_putc(s, len);
- stream_put(s, prd->val, 8); /* RD */
- stream_put(s, 0, 10); /* ESI */
- stream_putl(s, 0); /* Ethernet Tag ID */
+ stream_put(s, prd->val, 8); /* RD */
+ stream_put(s, 0, 10); /* ESI */
+ stream_putl(s, 0); /* Ethernet Tag ID */
stream_putc(s, 8 * ETH_ALEN); /* Mac Addr Len - bits */
stream_put(s, evp->prefix.mac.octet, 6); /* Mac Addr */
stream_putc(s, 8 * ipa_len); /* IP address Length */
- if (ipa_len) /* IP */
+ if (ipa_len) /* IP */
stream_put(s, &evp->prefix.ip.ip.addr, ipa_len);
/* 1st label is the L2 VNI */
stream_put(s, label, BGP_LABEL_BYTES);
/* Include 2nd label (L3 VNI) if advertising MAC+IP */
if (ipa_len && num_labels > 1)
- stream_put(s, label+1, BGP_LABEL_BYTES);
+ stream_put(s, label + 1, BGP_LABEL_BYTES);
break;
case BGP_EVPN_IMET_ROUTE:
@@ -3914,7 +3892,6 @@ void bgp_evpn_unmap_vrf_from_its_rts(struct bgp *bgp_vrf)
}
-
/*
* Map the RTs (configured or automatically derived) of a VNI to the VNI.
* The mapping will be used during route processing.
@@ -4242,11 +4219,11 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac,
zlog_err(
"%u:Failed to create Type-2 route, VNI %u %s MAC %s IP %s (flags: 0x%x)",
bgp->vrf_id, vpn->vni,
- CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY) ? "sticky gateway"
- : "",
+ CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY)
+ ? "sticky gateway"
+ : "",
prefix_mac2str(mac, buf, sizeof(buf)),
- ipaddr2str(ip, buf2, sizeof(buf2)),
- flags);
+ ipaddr2str(ip, buf2, sizeof(buf2)), flags);
return -1;
}
@@ -4267,11 +4244,8 @@ static void link_l2vni_hash_to_l3vni(struct hash_backet *backet,
bgpevpn_link_to_l3vni(vpn);
}
-int bgp_evpn_local_l3vni_add(vni_t l3vni,
- vrf_id_t vrf_id,
- struct ethaddr *rmac,
- struct in_addr originator_ip,
- int filter)
+int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac,
+ struct in_addr originator_ip, int filter)
{
struct bgp *bgp_vrf = NULL; /* bgp VRF instance */
struct bgp *bgp_def = NULL; /* default bgp instance */
@@ -4284,8 +4258,9 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni,
*/
bgp_def = bgp_get_default();
if (!bgp_def) {
- zlog_err("Cannot process L3VNI %u ADD - default BGP instance not yet created",
- l3vni);
+ zlog_err(
+ "Cannot process L3VNI %u ADD - default BGP instance not yet created",
+ l3vni);
return -1;
}
as = bgp_def->as;
@@ -4336,8 +4311,8 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni,
/* link all corresponding l2vnis */
hash_iterate(bgp_def->vnihash,
- (void (*)(struct hash_backet *, void *))
- link_l2vni_hash_to_l3vni,
+ (void (*)(struct hash_backet *,
+ void *))link_l2vni_hash_to_l3vni,
bgp_vrf);
/* Only update all corresponding type-2 routes if we are advertising two
@@ -4357,8 +4332,7 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni,
return 0;
}
-int bgp_evpn_local_l3vni_del(vni_t l3vni,
- vrf_id_t vrf_id)
+int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id)
{
struct bgp *bgp_vrf = NULL; /* bgp vrf instance */
struct bgp *bgp_def = NULL; /* default bgp instance */
@@ -4367,15 +4341,17 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni,
bgp_vrf = bgp_lookup_by_vrf_id(vrf_id);
if (!bgp_vrf) {
- zlog_err("Cannot process L3VNI %u Del - Could not find BGP instance",
- l3vni);
+ zlog_err(
+ "Cannot process L3VNI %u Del - Could not find BGP instance",
+ l3vni);
return -1;
}
bgp_def = bgp_get_default();
if (!bgp_def) {
- zlog_err("Cannot process L3VNI %u Del - Could not find default BGP instance",
- l3vni);
+ zlog_err(
+ "Cannot process L3VNI %u Del - Could not find default BGP instance",
+ l3vni);
return -1;
}
@@ -4461,8 +4437,7 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni)
* about are for the local-tunnel-ip and the (tenant) VRF.
*/
int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
- struct in_addr originator_ip,
- vrf_id_t tenant_vrf_id)
+ struct in_addr originator_ip, vrf_id_t tenant_vrf_id)
{
struct bgpevpn *vpn;
struct prefix_evpn p;
@@ -4612,10 +4587,8 @@ void bgp_evpn_init(struct bgp *bgp)
bgp->vrf_export_rtl->cmp =
(int (*)(void *, void *))evpn_route_target_cmp;
bgp->l2vnis = list_new();
- bgp->l2vnis->cmp =
- (int (*)(void *, void *))vni_hash_cmp;
+ bgp->l2vnis->cmp = (int (*)(void *, void *))vni_hash_cmp;
bf_assign_index(bm->rd_idspace, bgp->vrf_rd_id);
-
}
void bgp_evpn_vrf_delete(struct bgp *bgp_vrf)
diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h
index d8d92618f..bf6150e64 100644
--- a/bgpd/bgp_evpn.h
+++ b/bgpd/bgp_evpn.h
@@ -57,10 +57,9 @@ static inline vni_t label2vni(mpls_label_t *label)
extern void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf,
struct prefix *p,
- struct attr *src_attr,
- afi_t afi, safi_t safi);
-extern void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf,
- struct prefix *p,
+ struct attr *src_attr, afi_t afi,
+ safi_t safi);
+extern void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p,
afi_t afi, safi_t safi);
extern void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, afi_t afi,
safi_t safi);
@@ -73,10 +72,9 @@ extern char *bgp_evpn_label2str(mpls_label_t *label, u_int32_t num_labels,
extern char *bgp_evpn_route2str(struct prefix_evpn *p, char *buf, int len);
extern void bgp_evpn_route2json(struct prefix_evpn *p, json_object *json);
extern void bgp_evpn_encode_prefix(struct stream *s, struct prefix *p,
- struct prefix_rd *prd,
- mpls_label_t *label, u_int32_t num_labels,
- struct attr *attr, int addpath_encode,
- u_int32_t addpath_tx_id);
+ struct prefix_rd *prd, mpls_label_t *label,
+ u_int32_t num_labels, struct attr *attr,
+ int addpath_encode, u_int32_t addpath_tx_id);
extern int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet, int withdraw);
extern int bgp_evpn_import_route(struct bgp *bgp, afi_t afi, safi_t safi,
@@ -91,8 +89,7 @@ extern int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni,
u_char flags);
extern int bgp_evpn_local_l3vni_add(vni_t vni, vrf_id_t vrf_id,
struct ethaddr *rmac,
- struct in_addr originator_ip,
- int filter);
+ struct in_addr originator_ip, int filter);
extern int bgp_evpn_local_l3vni_del(vni_t vni, vrf_id_t vrf_id);
extern int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni);
extern int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h
index 5d59ed5ae..63dd58184 100644
--- a/bgpd/bgp_evpn_private.h
+++ b/bgpd/bgp_evpn_private.h
@@ -66,29 +66,34 @@ struct bgpevpn {
struct bgp *bgp_vrf; /* back pointer to the vrf instance */
- /* Flag to indicate if we are advertising the g/w mac ip for this VNI*/
- u_int8_t advertise_gw_macip;
+ /* Flag to indicate if we are
+ * advertising the g/w mac ip for
+ * this VNI*/
+ u_int8_t advertise_gw_macip;
- /* Flag to indicate if we are advertising subnet for this VNI */
- u_int8_t advertise_subnet;
+ /* Flag to indicate if we are
+ * advertising subnet for this VNI */
+ u_int8_t advertise_subnet;
- /* Id for deriving the RD automatically for this VNI */
- u_int16_t rd_id;
+ /* Id for deriving the RD
+ * automatically for this VNI */
+ u_int16_t rd_id;
- /* RD for this VNI. */
- struct prefix_rd prd;
+ /* RD for this VNI. */
+ struct prefix_rd prd;
- /* Route type 3 field */
- struct in_addr originator_ip;
+ /* Route type 3 field */
+ struct in_addr originator_ip;
- /* Import and Export RTs. */
- struct list *import_rtl;
- struct list *export_rtl;
+ /* Import and Export RTs. */
+ struct list *import_rtl;
+ struct list *export_rtl;
- /* Route table for EVPN routes for this VNI. */
- struct bgp_table *route_table;
+ /* Route table for EVPN routes for
+ * this VNI. */
+ struct bgp_table *route_table;
- QOBJ_FIELDS
+ QOBJ_FIELDS
};
DECLARE_QOBJ_TYPE(bgpevpn)
@@ -124,8 +129,7 @@ struct vrf_irt_node {
static inline int is_vrf_rd_configured(struct bgp *bgp_vrf)
{
- return (CHECK_FLAG(bgp_vrf->vrf_flags,
- BGP_VRF_RD_CFGD));
+ return (CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_RD_CFGD));
}
static inline int bgp_evpn_vrf_rd_matches_existing(struct bgp *bgp_vrf,
@@ -168,10 +172,10 @@ static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn *vpn)
/* bail if vpn is not associated to bgp_vrf */
if (!vpn->bgp_vrf)
return;
-
+
UNSET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
listnode_delete(vpn->bgp_vrf->l2vnis, vpn);
-
+
/* remove the backpointer to the vrf instance */
vpn->bgp_vrf = NULL;
}
@@ -193,8 +197,7 @@ static inline void bgpevpn_link_to_l3vni(struct bgpevpn *vpn)
listnode_add_sort(bgp_vrf->l2vnis, vpn);
/* check if we are advertising two labels for this vpn */
- if (!CHECK_FLAG(bgp_vrf->vrf_flags,
- BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
+ if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
}
@@ -272,14 +275,12 @@ static inline void ip_prefix_from_type5_prefix(struct prefix_evpn *evp,
if (IS_EVPN_PREFIX_IPADDR_V4(evp)) {
ip->family = AF_INET;
ip->prefixlen = evp->prefix.ip_prefix_length;
- memcpy(&(ip->u.prefix4),
- &(evp->prefix.ip.ip),
+ memcpy(&(ip->u.prefix4), &(evp->prefix.ip.ip),
IPV4_MAX_BYTELEN);
} else if (IS_EVPN_PREFIX_IPADDR_V6(evp)) {
ip->family = AF_INET6;
ip->prefixlen = evp->prefix.ip_prefix_length;
- memcpy(&(ip->u.prefix6),
- &(evp->prefix.ip.ip),
+ memcpy(&(ip->u.prefix6), &(evp->prefix.ip.ip),
IPV6_MAX_BYTELEN);
}
}
@@ -291,14 +292,12 @@ static inline void ip_prefix_from_type2_prefix(struct prefix_evpn *evp,
if (IS_EVPN_PREFIX_IPADDR_V4(evp)) {
ip->family = AF_INET;
ip->prefixlen = IPV4_MAX_BITLEN;
- memcpy(&(ip->u.prefix4),
- &(evp->prefix.ip.ip),
+ memcpy(&(ip->u.prefix4), &(evp->prefix.ip.ip),
IPV4_MAX_BYTELEN);
} else if (IS_EVPN_PREFIX_IPADDR_V6(evp)) {
ip->family = AF_INET6;
ip->prefixlen = IPV6_MAX_BITLEN;
- memcpy(&(ip->u.prefix6),
- &(evp->prefix.ip.ip),
+ memcpy(&(ip->u.prefix6), &(evp->prefix.ip.ip),
IPV6_MAX_BYTELEN);
}
}
@@ -353,24 +352,23 @@ static inline void build_evpn_type3_prefix(struct prefix_evpn *p,
p->prefix.ip.ipaddr_v4 = originator_ip;
}
-static inline int advertise_type5_routes(struct bgp *bgp_vrf,
- afi_t afi)
+static inline int advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi)
{
if (!bgp_vrf->l3vni)
return 0;
- if (afi == AFI_IP &&
- CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN))
+ if (afi == AFI_IP
+ && CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN))
return 1;
- if (afi == AFI_IP6 &&
- CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
+ if (afi == AFI_IP6
+ && CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
return 1;
return 0;
}
-extern void evpn_rt_delete_auto(struct bgp*, vni_t, struct list*);
+extern void evpn_rt_delete_auto(struct bgp *, vni_t, struct list *);
extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf,
struct ecommunity *ecomadd);
extern void bgp_evpn_unconfigure_export_rt_for_vrf(struct bgp *bgp_vrf,
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index f519bb463..d42da23f5 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -53,8 +53,7 @@ struct vni_walk_ctx {
};
#if defined(HAVE_CUMULUS)
-static void display_vrf_import_rt(struct vty *vty,
- struct vrf_irt_node *irt,
+static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt,
json_object *json)
{
u_char *pnt;
@@ -138,8 +137,7 @@ static void display_vrf_import_rt(struct vty *vty,
json_object_array_add(
json_vrfs,
json_object_new_string(
- vrf_id_to_name(
- tmp_bgp_vrf->vrf_id)));
+ vrf_id_to_name(tmp_bgp_vrf->vrf_id)));
else
vty_out(vty, " %s\n",
vrf_id_to_name(tmp_bgp_vrf->vrf_id));
@@ -151,8 +149,7 @@ static void display_vrf_import_rt(struct vty *vty,
}
}
-static void show_vrf_import_rt_entry(struct hash_backet *backet,
- void *args[])
+static void show_vrf_import_rt_entry(struct hash_backet *backet, void *args[])
{
json_object *json = NULL;
struct vty *vty = NULL;
@@ -604,7 +601,7 @@ static void show_vni_routes_hash(struct hash_backet *backet, void *arg)
}
static void show_l3vni_entry(struct vty *vty, struct bgp *bgp,
- json_object *json)
+ json_object *json)
{
json_object *json_vni;
json_object *json_import_rtl;
@@ -639,8 +636,7 @@ static void show_l3vni_entry(struct vty *vty, struct bgp *bgp,
json_vni, "rd",
prefix_rd2str(&bgp->vrf_prd, buf2, RD_ADDRSTRLEN));
} else {
- vty_out(vty, "%-1s %-10u %-4s %-21s",
- buf1, bgp->l3vni, "L3",
+ vty_out(vty, "%-1s %-10u %-4s %-21s", buf1, bgp->l3vni, "L3",
prefix_rd2str(&bgp->vrf_prd, buf2, RD_ADDRSTRLEN));
}
@@ -748,8 +744,7 @@ static void show_vni_entry(struct hash_backet *backet, void *args[])
json_vni, "rd",
prefix_rd2str(&vpn->prd, buf2, sizeof(buf2)));
} else {
- vty_out(vty, "%-1s %-10u %-4s %-21s",
- buf1, vpn->vni, "L2",
+ vty_out(vty, "%-1s %-10u %-4s %-21s", buf1, vpn->vni, "L2",
prefix_rd2str(&vpn->prd, buf2, RD_ADDRSTRLEN));
}
@@ -1430,8 +1425,7 @@ DEFUN(evpnrt5_network,
return bgp_static_set_safi(
AFI_L2VPN, SAFI_EVPN, vty, argv[idx_ipv4_prefixlen]->arg,
- argv[idx_route_distinguisher]->arg, argv[idx_label]->arg,
- NULL,
+ argv[idx_route_distinguisher]->arg, argv[idx_label]->arg, NULL,
BGP_EVPN_IP_PREFIX_ROUTE, argv[idx_esi]->arg,
argv[idx_gwip]->arg, argv[idx_ethtag]->arg,
argv[idx_routermac]->arg);
@@ -1632,8 +1626,7 @@ static void evpn_unconfigure_export_rt(struct bgp *bgp, struct bgpevpn *vpn,
/*
* Configure RD for VRF
*/
-static void evpn_configure_vrf_rd(struct bgp *bgp_vrf,
- struct prefix_rd *rd)
+static void evpn_configure_vrf_rd(struct bgp *bgp_vrf, struct prefix_rd *rd)
{
/* If we have already advertise type-5 routes with a diffrent RD, we
* have to delete and withdraw them firs
@@ -1777,8 +1770,7 @@ static int evpn_delete_vni(struct bgp *bgp, struct bgpevpn *vpn)
* Display import RT mapping to VRFs (vty handler)
* bgp_def: default bgp instance
*/
-static void evpn_show_vrf_import_rts(struct vty *vty,
- struct bgp *bgp_def,
+static void evpn_show_vrf_import_rts(struct vty *vty, struct bgp *bgp_def,
json_object *json)
{
void *args[2];
@@ -1787,8 +1779,8 @@ static void evpn_show_vrf_import_rts(struct vty *vty,
args[1] = json;
hash_iterate(bgp_def->vrf_import_rt_hash,
- (void (*)(struct hash_backet *, void *))
- show_vrf_import_rt_entry,
+ (void (*)(struct hash_backet *,
+ void *))show_vrf_import_rt_entry,
args);
}
@@ -2364,8 +2356,7 @@ static void evpn_show_all_vnis(struct vty *vty, struct bgp *bgp,
if (!json) {
vty_out(vty, "Flags: * - Kernel\n");
vty_out(vty, " %-10s %-4s %-21s %-25s %-25s %-37s\n", "VNI",
- "Type", "RD", "Import RT",
- "Export RT", "Tenant VRF");
+ "Type", "RD", "Import RT", "Export RT", "Tenant VRF");
}
/* print all L2 VNIS */
@@ -2378,7 +2369,6 @@ static void evpn_show_all_vnis(struct vty *vty, struct bgp *bgp,
/* print all L3 VNIs */
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, bgp_temp))
show_l3vni_entry(vty, bgp_temp, json);
-
}
/*
@@ -2429,8 +2419,7 @@ static void evpn_unset_advertise_default_gw(struct bgp *bgp,
/*
* evpn - enable advertisement of default g/w
*/
-static void evpn_set_advertise_subnet(struct bgp *bgp,
- struct bgpevpn *vpn)
+static void evpn_set_advertise_subnet(struct bgp *bgp, struct bgpevpn *vpn)
{
if (vpn->advertise_subnet)
return;
@@ -2442,8 +2431,7 @@ static void evpn_set_advertise_subnet(struct bgp *bgp,
/*
* evpn - disable advertisement of default g/w
*/
-static void evpn_unset_advertise_subnet(struct bgp *bgp,
- struct bgpevpn *vpn)
+static void evpn_unset_advertise_subnet(struct bgp *bgp, struct bgpevpn *vpn)
{
if (!vpn->advertise_subnet)
return;
@@ -2643,8 +2631,8 @@ DEFUN (bgp_evpn_advertise_vni_subnet,
if (!bgp_vrf)
return CMD_WARNING;
- if (!(advertise_type5_routes(bgp_vrf, AFI_IP) ||
- advertise_type5_routes(bgp_vrf, AFI_IP6))) {
+ if (!(advertise_type5_routes(bgp_vrf, AFI_IP)
+ || advertise_type5_routes(bgp_vrf, AFI_IP6))) {
vty_out(vty,
"%%Please enable ip prefix advertisement under l2vpn evpn in %s",
vrf_id_to_name(bgp_vrf->vrf_id));
@@ -2699,7 +2687,8 @@ DEFUN (bgp_evpn_advertise_type5,
if (!bgp_vrf->adv_cmd_rmap[afi][safi].name)
rmap_changed = 1;
else if (strcmp(argv[idx_rmap + 1]->arg,
- bgp_vrf->adv_cmd_rmap[afi][safi].name) != 0)
+ bgp_vrf->adv_cmd_rmap[afi][safi].name)
+ != 0)
rmap_changed = 1;
} else if (bgp_vrf->adv_cmd_rmap[afi][safi].name) {
rmap_changed = 1;
@@ -2725,8 +2714,7 @@ DEFUN (bgp_evpn_advertise_type5,
if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags,
BGP_VRF_ADVERTISE_IPV4_IN_EVPN))
return CMD_WARNING;
- SET_FLAG(bgp_vrf->vrf_flags,
- BGP_VRF_ADVERTISE_IPV4_IN_EVPN);
+ SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN);
} else {
/* if we are already advertising ipv6 prefix as type-5
@@ -2735,8 +2723,7 @@ DEFUN (bgp_evpn_advertise_type5,
if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags,
BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
return CMD_WARNING;
- SET_FLAG(bgp_vrf->vrf_flags,
- BGP_VRF_ADVERTISE_IPV6_IN_EVPN);
+ SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN);
}
if (rmap_changed) {
@@ -2752,8 +2739,7 @@ DEFUN (bgp_evpn_advertise_type5,
/* set the route-map for advertise command */
if (ret && argv[idx_rmap + 1]->arg) {
bgp_vrf->adv_cmd_rmap[afi][safi].name =
- XSTRDUP(MTYPE_ROUTE_MAP_NAME,
- argv[idx_rmap + 1]->arg);
+ XSTRDUP(MTYPE_ROUTE_MAP_NAME, argv[idx_rmap + 1]->arg);
bgp_vrf->adv_cmd_rmap[afi][safi].map =
route_map_lookup_by_name(argv[idx_rmap + 1]->arg);
}
@@ -2879,16 +2865,15 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
? "Enabled"
: "Disabled");
json_object_string_add(json, "advertiseAllVnis",
- is_evpn_enabled()
- ? "Enabled"
- : "Disabled");
+ is_evpn_enabled() ? "Enabled"
+ : "Disabled");
json_object_int_add(json, "numVnis", num_vnis);
json_object_int_add(json, "numL2Vnis", num_l2vnis);
json_object_int_add(json, "numL3Vnis", num_l3vnis);
} else {
vty_out(vty, "Advertise Gateway Macip: %s\n",
bgp_def->advertise_gw_macip ? "Enabled"
- : "Disabled");
+ : "Disabled");
vty_out(vty, "Advertise All VNI flag: %s\n",
is_evpn_enabled() ? "Enabled" : "Disabled");
vty_out(vty, "Number of L2 VNIs: %u\n", num_l2vnis);
@@ -3478,8 +3463,7 @@ ALIAS_HIDDEN(show_bgp_l2vpn_evpn_vni, show_bgp_evpn_vni_cmd,
ALIAS_HIDDEN(show_bgp_l2vpn_evpn_summary, show_bgp_evpn_summary_cmd,
"show bgp evpn summary [json]", SHOW_STR BGP_STR EVPN_HELP_STR
- "Summary of BGP neighbor status\n"
- JSON_STR)
+ "Summary of BGP neighbor status\n" JSON_STR)
ALIAS_HIDDEN(show_bgp_l2vpn_evpn_route, show_bgp_evpn_route_cmd,
"show bgp evpn route [type <macip|multicast>]",
@@ -3855,13 +3839,11 @@ DEFUN (show_bgp_vrf_l3vni_info,
bgp = bgp_lookup_by_name(name);
if (!bgp) {
if (!uj)
- vty_out(vty, "BGP instance for VRF %s not found",
- name);
+ vty_out(vty, "BGP instance for VRF %s not found", name);
else {
json_object_string_add(json, "warning",
"BGP instance not found");
- vty_out(vty, "%s\n",
- json_object_to_json_string(json));
+ vty_out(vty, "%s\n", json_object_to_json_string(json));
json_object_free(json);
}
return CMD_WARNING;
@@ -3869,15 +3851,15 @@ DEFUN (show_bgp_vrf_l3vni_info,
if (!json) {
vty_out(vty, "BGP VRF: %s\n", name);
- vty_out(vty, " Local-Ip: %s\n",
- inet_ntoa(bgp->originator_ip));
+ vty_out(vty, " Local-Ip: %s\n", inet_ntoa(bgp->originator_ip));
vty_out(vty, " L3-VNI: %u\n", bgp->l3vni);
vty_out(vty, " Rmac: %s\n",
prefix_mac2str(&bgp->rmac, buf, sizeof(buf)));
vty_out(vty, " VNI Filter: %s\n",
CHECK_FLAG(bgp->vrf_flags,
- BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY) ?
- "prefix-routes-only" : "none");
+ BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY)
+ ? "prefix-routes-only"
+ : "none");
vty_out(vty, " L2-VNI List:\n");
vty_out(vty, " ");
for (ALL_LIST_ELEMENTS_RO(bgp->l2vnis, node, vpn))
@@ -3900,13 +3882,15 @@ DEFUN (show_bgp_vrf_l3vni_info,
json_object_string_add(json, "local-ip",
inet_ntoa(bgp->originator_ip));
json_object_int_add(json, "l3vni", bgp->l3vni);
- json_object_string_add(json, "rmac",
- prefix_mac2str(&bgp->rmac, buf,
- sizeof(buf)));
- json_object_string_add(json, "vniFilter",
- CHECK_FLAG(bgp->vrf_flags,
- BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY)
- ? "prefix-routes-only" : "none");
+ json_object_string_add(
+ json, "rmac",
+ prefix_mac2str(&bgp->rmac, buf, sizeof(buf)));
+ json_object_string_add(
+ json, "vniFilter",
+ CHECK_FLAG(bgp->vrf_flags,
+ BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY)
+ ? "prefix-routes-only"
+ : "none");
/* list of l2vnis */
for (ALL_LIST_ELEMENTS_RO(bgp->l2vnis, node, vpn))
json_object_array_add(json_vnis,
@@ -3915,21 +3899,20 @@ DEFUN (show_bgp_vrf_l3vni_info,
/* export rts */
for (ALL_LIST_ELEMENTS_RO(bgp->vrf_export_rtl, node, ecom))
- json_object_array_add(json_export_rts,
- json_object_new_string(
- ecommunity_str(ecom)));
+ json_object_array_add(
+ json_export_rts,
+ json_object_new_string(ecommunity_str(ecom)));
json_object_object_add(json, "export-rts", json_export_rts);
/* import rts */
for (ALL_LIST_ELEMENTS_RO(bgp->vrf_import_rtl, node, ecom))
- json_object_array_add(json_import_rts,
- json_object_new_string(
- ecommunity_str(ecom)));
+ json_object_array_add(
+ json_import_rts,
+ json_object_new_string(ecommunity_str(ecom)));
json_object_object_add(json, "import-rts", json_import_rts);
json_object_string_add(
json, "rd",
prefix_rd2str(&bgp->vrf_prd, buf1, RD_ADDRSTRLEN));
-
}
if (uj) {
@@ -3979,8 +3962,7 @@ DEFUN (bgp_evpn_vrf_rt,
ecommunity_str(ecomadd);
/* Do nothing if we already have this import route-target */
- if (!bgp_evpn_rt_matches_existing(bgp->vrf_import_rtl,
- ecomadd))
+ if (!bgp_evpn_rt_matches_existing(bgp->vrf_import_rtl, ecomadd))
bgp_evpn_configure_import_rt_for_vrf(bgp, ecomadd);
}
@@ -3995,8 +3977,7 @@ DEFUN (bgp_evpn_vrf_rt,
ecommunity_str(ecomadd);
/* Do nothing if we already have this export route-target */
- if (!bgp_evpn_rt_matches_existing(bgp->vrf_export_rtl,
- ecomadd))
+ if (!bgp_evpn_rt_matches_existing(bgp->vrf_export_rtl, ecomadd))
bgp_evpn_configure_export_rt_for_vrf(bgp, ecomadd);
}
@@ -4344,8 +4325,7 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi,
ecom)) {
ecom_str = ecommunity_ecom2str(
ecom, ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out(vty, " route-target import %s\n",
- ecom_str);
+ vty_out(vty, " route-target import %s\n", ecom_str);
XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
}
}
@@ -4360,8 +4340,7 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi,
ecom)) {
ecom_str = ecommunity_ecom2str(
ecom, ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out(vty, " route-target export %s\n",
- ecom_str);
+ vty_out(vty, " route-target export %s\n", ecom_str);
XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
}
}
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index de11a98a2..3255aff2a 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1056,8 +1056,8 @@ int bgp_stop(struct peer *peer)
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
for (afi = AFI_IP; afi < AFI_MAX; afi++)
- for (safi = SAFI_UNICAST;
- safi <= SAFI_MPLS_VPN; safi++)
+ for (safi = SAFI_UNICAST; safi <= SAFI_MPLS_VPN;
+ safi++)
peer->nsf[afi][safi] = 0;
}
@@ -1377,12 +1377,11 @@ int bgp_start(struct peer *peer)
return 0;
}
- if (peer->bgp &&
- peer->bgp->vrf_id == VRF_UNKNOWN) {
+ if (peer->bgp && peer->bgp->vrf_id == VRF_UNKNOWN) {
if (bgp_debug_neighbor_events(peer))
zlog_err(
- "%s [FSM] In a VRF that is not initialised yet",
- peer->host);
+ "%s [FSM] In a VRF that is not initialised yet",
+ peer->host);
return -1;
}
@@ -1518,9 +1517,8 @@ static int bgp_establish(struct peer *peer)
}
if (other == peer)
- ret =
- 1; /* bgp_establish specific code when xfer_conn
- happens. */
+ ret = 1; /* bgp_establish specific code when xfer_conn
+ happens. */
/* Reset capability open status flag. */
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN))
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index 59b2d1cda..862199741 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -290,8 +290,8 @@ static uint16_t bgp_write(struct peer *peer)
uint16_t status = 0;
uint32_t wpkt_quanta_old;
- wpkt_quanta_old =
- atomic_load_explicit(&peer->bgp->wpkt_quanta, memory_order_relaxed);
+ wpkt_quanta_old = atomic_load_explicit(&peer->bgp->wpkt_quanta,
+ memory_order_relaxed);
while (count < wpkt_quanta_old && (s = stream_fifo_head(peer->obuf))) {
int writenum;
@@ -402,7 +402,7 @@ static uint16_t bgp_read(struct peer *peer)
/* EAGAIN or EWOULDBLOCK; come back later */
if (nbytes < 0 && ERRNO_IO_RETRY(errno)) {
SET_FLAG(status, BGP_IO_TRANS_ERR);
- /* Fatal error; tear down session */
+ /* Fatal error; tear down session */
} else if (nbytes < 0) {
zlog_err("%s [Error] bgp_read_packet error: %s", peer->host,
safe_strerror(errno));
@@ -417,7 +417,7 @@ static uint16_t bgp_read(struct peer *peer)
BGP_EVENT_ADD(peer, TCP_fatal_error);
SET_FLAG(status, BGP_IO_FATAL_ERR);
- /* Received EOF / TCP session closed */
+ /* Received EOF / TCP session closed */
} else if (nbytes == 0) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s [Event] BGP connection closed fd %d",
@@ -485,8 +485,8 @@ static bool validate_header(struct peer *peer)
type);
bgp_notify_send_with_data(peer, BGP_NOTIFY_HEADER_ERR,
- BGP_NOTIFY_HEADER_BAD_MESTYPE,
- &type, 1);
+ BGP_NOTIFY_HEADER_BAD_MESTYPE, &type,
+ 1);
return false;
}
@@ -506,14 +506,14 @@ static bool validate_header(struct peer *peer)
zlog_debug("%s bad message length - %d for %s",
peer->host, size,
type == 128 ? "ROUTE-REFRESH"
- : bgp_type_str[(int) type]);
+ : bgp_type_str[(int)type]);
}
uint16_t nsize = htons(size);
bgp_notify_send_with_data(peer, BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESLEN,
- (unsigned char *) &nsize, 2);
+ (unsigned char *)&nsize, 2);
return false;
}
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c
index 54e9fd889..36980b7c2 100644
--- a/bgpd/bgp_lcommunity.c
+++ b/bgpd/bgp_lcommunity.c
@@ -174,13 +174,11 @@ struct lcommunity *lcommunity_merge(struct lcommunity *lcom1,
struct lcommunity *lcom2)
{
if (lcom1->val)
- lcom1->val =
- XREALLOC(MTYPE_LCOMMUNITY_VAL, lcom1->val,
- lcom_length(lcom1) + lcom_length(lcom2));
+ lcom1->val = XREALLOC(MTYPE_LCOMMUNITY_VAL, lcom1->val,
+ lcom_length(lcom1) + lcom_length(lcom2));
else
- lcom1->val =
- XMALLOC(MTYPE_LCOMMUNITY_VAL,
- lcom_length(lcom1) + lcom_length(lcom2));
+ lcom1->val = XMALLOC(MTYPE_LCOMMUNITY_VAL,
+ lcom_length(lcom1) + lcom_length(lcom2));
memcpy(lcom1->val + lcom_length(lcom1), lcom2->val, lcom_length(lcom2));
lcom1->size += lcom2->size;
@@ -243,8 +241,7 @@ int lcommunity_cmp(const void *arg1, const void *arg2)
const struct lcommunity *lcom2 = arg2;
return (lcom1->size == lcom2->size
- && memcmp(lcom1->val, lcom2->val, lcom_length(lcom1))
- == 0);
+ && memcmp(lcom1->val, lcom2->val, lcom_length(lcom1)) == 0);
}
/* Return communities hash. */
@@ -256,8 +253,7 @@ struct hash *lcommunity_hash(void)
/* Initialize Large Comminities related hash. */
void lcommunity_init(void)
{
- lcomhash = hash_create(lcommunity_hash_make,
- lcommunity_cmp,
+ lcomhash = hash_create(lcommunity_hash_make, lcommunity_cmp,
"BGP lcommunity hash");
}
@@ -462,8 +458,8 @@ int lcommunity_match(const struct lcommunity *lcom1,
/* Every community on com2 needs to be on com1 for this to match */
while (i < lcom1->size && j < lcom2->size) {
- if (memcmp(lcom1->val + (i * LCOMMUNITY_SIZE), lcom2->val + (j * LCOMMUNITY_SIZE),
- LCOMMUNITY_SIZE)
+ if (memcmp(lcom1->val + (i * LCOMMUNITY_SIZE),
+ lcom2->val + (j * LCOMMUNITY_SIZE), LCOMMUNITY_SIZE)
== 0)
j++;
i++;
@@ -499,8 +495,8 @@ void lcommunity_del_val(struct lcommunity *lcom, u_char *ptr)
if (lcom->size > 0)
lcom->val =
- XREALLOC(MTYPE_LCOMMUNITY_VAL, lcom->val,
- lcom_length(lcom));
+ XREALLOC(MTYPE_LCOMMUNITY_VAL,
+ lcom->val, lcom_length(lcom));
else {
XFREE(MTYPE_LCOMMUNITY_VAL, lcom->val);
lcom->val = NULL;
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 30b7afff9..703978601 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -105,9 +105,8 @@ static struct quagga_signal_t bgp_signals[] = {
static int retain_mode = 0;
/* privileges */
-static zebra_capabilities_t _caps_p[] = {
- ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN
-};
+static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_NET_RAW,
+ ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN};
struct zebra_privs_t bgpd_privs = {
#if defined(FRR_USER) && defined(FRR_GROUP)
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 5d83192a3..667be5084 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -141,16 +141,17 @@ int bgp_info_nexthop_cmp(struct bgp_info *bi1, struct bgp_info *bi2)
&bi2->attr->mp_nexthop_global);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
- addr1 = (bi1->attr->mp_nexthop_prefer_global) ?
- bi1->attr->mp_nexthop_global
- : bi1->attr->mp_nexthop_local;
- addr2 = (bi2->attr->mp_nexthop_prefer_global) ?
- bi2->attr->mp_nexthop_global
- : bi2->attr->mp_nexthop_local;
-
- if (!bi1->attr->mp_nexthop_prefer_global &&
- !bi2->attr->mp_nexthop_prefer_global)
- compare = !bgp_interface_same(bi1->peer->ifp, bi2->peer->ifp);
+ addr1 = (bi1->attr->mp_nexthop_prefer_global)
+ ? bi1->attr->mp_nexthop_global
+ : bi1->attr->mp_nexthop_local;
+ addr2 = (bi2->attr->mp_nexthop_prefer_global)
+ ? bi2->attr->mp_nexthop_global
+ : bi2->attr->mp_nexthop_local;
+
+ if (!bi1->attr->mp_nexthop_prefer_global
+ && !bi2->attr->mp_nexthop_prefer_global)
+ compare = !bgp_interface_same(
+ bi1->peer->ifp, bi2->peer->ifp);
if (!compare)
compare = IPV6_ADDR_CMP(&addr1, &addr2);
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 0ab583f44..71454dfe0 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -447,8 +447,8 @@ static char *bgp_get_bound_name(struct peer *peer)
{
char *name = NULL;
- if ((peer->bgp->vrf_id == VRF_DEFAULT) &&
- !peer->ifname && !peer->conf_if)
+ if ((peer->bgp->vrf_id == VRF_DEFAULT) && !peer->ifname
+ && !peer->conf_if)
return NULL;
if (peer->su.sa.sa_family != AF_INET
@@ -673,8 +673,7 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
listener->fd = sock;
/* this socket needs a change of ns. record bgp back pointer */
- if (bgp->vrf_id != VRF_DEFAULT &&
- vrf_is_mapped_on_netns(bgp->vrf_id))
+ if (bgp->vrf_id != VRF_DEFAULT && vrf_is_mapped_on_netns(bgp->vrf_id))
listener->bgp = bgp;
memcpy(&listener->su, sa, salen);
@@ -704,8 +703,8 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
if (bgpd_privs.change(ZPRIVS_RAISE))
zlog_err("Can't raise privileges");
- ret = vrf_getaddrinfo(address, port_str, &req,
- &ainfo_save, bgp->vrf_id);
+ ret = vrf_getaddrinfo(address, port_str, &req, &ainfo_save,
+ bgp->vrf_id);
if (bgpd_privs.change(ZPRIVS_LOWER))
zlog_err("Can't lower privileges");
if (ret != 0) {
@@ -723,8 +722,7 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
if (bgpd_privs.change(ZPRIVS_RAISE))
zlog_err("Can't raise privileges");
sock = vrf_socket(ainfo->ai_family, ainfo->ai_socktype,
- ainfo->ai_protocol, bgp->vrf_id,
- NULL);
+ ainfo->ai_protocol, bgp->vrf_id, NULL);
if (bgpd_privs.change(ZPRIVS_LOWER))
zlog_err("Can't lower privileges");
if (sock < 0) {
@@ -736,8 +734,8 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
* ttl=255 */
sockopt_ttl(ainfo->ai_family, sock, MAXTTL);
- ret = bgp_listener(sock, ainfo->ai_addr,
- ainfo->ai_addrlen, bgp);
+ ret = bgp_listener(sock, ainfo->ai_addr, ainfo->ai_addrlen,
+ bgp);
if (ret == 0)
++count;
else
@@ -745,8 +743,9 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
}
freeaddrinfo(ainfo_save);
if (count == 0) {
- zlog_err("%s: no usable addresses please check other programs usage of specified port %d",
- __func__, port);
+ zlog_err(
+ "%s: no usable addresses please check other programs usage of specified port %d",
+ __func__, port);
zlog_err("%s: Program cannot continue", __func__);
exit(-1);
}
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 870da22d2..79463ee14 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -122,8 +122,7 @@ static int bgp_tip_hash_cmp(const void *p1, const void *p2)
void bgp_tip_hash_init(struct bgp *bgp)
{
- bgp->tip_hash = hash_create(bgp_tip_hash_key_make,
- bgp_tip_hash_cmp,
+ bgp->tip_hash = hash_create(bgp_tip_hash_key_make, bgp_tip_hash_cmp,
"BGP TIP hash");
}
@@ -204,9 +203,9 @@ static int bgp_address_hash_cmp(const void *p1, const void *p2)
void bgp_address_init(struct bgp *bgp)
{
- bgp->address_hash = hash_create(bgp_address_hash_key_make,
- bgp_address_hash_cmp,
- "BGP Address Hash");
+ bgp->address_hash =
+ hash_create(bgp_address_hash_key_make, bgp_address_hash_cmp,
+ "BGP Address Hash");
}
void bgp_address_destroy(struct bgp *bgp)
@@ -448,16 +447,14 @@ int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
rn1 = rn2 = NULL;
bgp = SUBGRP_INST(subgrp);
- rn1 = bgp_node_match(bgp->connected_table[AFI_IP],
- &np);
+ rn1 = bgp_node_match(bgp->connected_table[AFI_IP], &np);
if (!rn1)
return 0;
- SUBGRP_FOREACH_PEER(subgrp, paf) {
+ SUBGRP_FOREACH_PEER (subgrp, paf) {
p.u.prefix4 = paf->peer->su.sin.sin_addr;
- rn2 = bgp_node_match(bgp->connected_table[AFI_IP],
- &p);
+ rn2 = bgp_node_match(bgp->connected_table[AFI_IP], &p);
if (rn1 == rn2) {
bgp_unlock_node(rn1);
bgp_unlock_node(rn2);
@@ -472,8 +469,7 @@ int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
return 0;
}
-static void bgp_show_nexthops_detail(struct vty *vty,
- struct bgp *bgp,
+static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp,
struct bgp_nexthop_cache *bnc)
{
char buf[PREFIX2STR_BUFFER];
@@ -483,39 +479,35 @@ static void bgp_show_nexthops_detail(struct vty *vty,
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV6:
vty_out(vty, " gate %s\n",
- inet_ntop(AF_INET6, &nexthop->gate.ipv6,
- buf, sizeof(buf)));
+ inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf,
+ sizeof(buf)));
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
vty_out(vty, " gate %s, if %s\n",
- inet_ntop(AF_INET6, &nexthop->gate.ipv6,
- buf, sizeof(buf)),
- ifindex2ifname(nexthop->ifindex,
- bgp->vrf_id));
+ inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf,
+ sizeof(buf)),
+ ifindex2ifname(nexthop->ifindex, bgp->vrf_id));
break;
case NEXTHOP_TYPE_IPV4:
vty_out(vty, " gate %s\n",
- inet_ntop(AF_INET, &nexthop->gate.ipv4,
- buf, sizeof(buf)));
+ inet_ntop(AF_INET, &nexthop->gate.ipv4, buf,
+ sizeof(buf)));
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out(vty, " if %s\n",
- ifindex2ifname(nexthop->ifindex,
- bgp->vrf_id));
+ ifindex2ifname(nexthop->ifindex, bgp->vrf_id));
break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
vty_out(vty, " gate %s, if %s\n",
- inet_ntop(AF_INET, &nexthop->gate.ipv4,
- buf, sizeof(buf)),
- ifindex2ifname(nexthop->ifindex,
- bgp->vrf_id));
+ inet_ntop(AF_INET, &nexthop->gate.ipv4, buf,
+ sizeof(buf)),
+ ifindex2ifname(nexthop->ifindex, bgp->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
vty_out(vty, " blackhole\n");
break;
default:
- vty_out(vty,
- " invalid nexthop type %u\n",
+ vty_out(vty, " invalid nexthop type %u\n",
nexthop->type);
}
}
@@ -549,7 +541,7 @@ static void bgp_show_nexthops(struct vty *vty, struct bgp *bgp, int detail)
bgp_show_nexthops_detail(vty, bgp, bnc);
- } else{
+ } else {
vty_out(vty, " %s invalid\n",
inet_ntop(rn->p.family,
&rn->p.u.prefix, buf,
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index d39fbec86..54c0f85cb 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -546,14 +546,14 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
return;
p = &(bnc->node->p);
- if ((command == ZEBRA_NEXTHOP_REGISTER ||
- command == ZEBRA_IMPORT_ROUTE_REGISTER) &&
- (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)
- || CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)))
+ if ((command == ZEBRA_NEXTHOP_REGISTER
+ || command == ZEBRA_IMPORT_ROUTE_REGISTER)
+ && (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)
+ || CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)))
exact_match = true;
- ret = zclient_send_rnh(zclient, command, p,
- exact_match, bnc->bgp->vrf_id);
+ ret = zclient_send_rnh(zclient, command, p, exact_match,
+ bnc->bgp->vrf_id);
/* TBD: handle the failure */
if (ret < 0)
zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 0ce2466f5..cb702d80d 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1573,9 +1573,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
* Non-MP IPv4/Unicast EoR is a completely empty UPDATE
* and MP EoR should have only an empty MP_UNREACH
*/
- if ((!update_len && !withdraw_len &&
- nlris[NLRI_MP_UPDATE].length == 0) ||
- (attr_parse_ret == BGP_ATTR_PARSE_EOR)) {
+ if ((!update_len && !withdraw_len && nlris[NLRI_MP_UPDATE].length == 0)
+ || (attr_parse_ret == BGP_ATTR_PARSE_EOR)) {
afi_t afi = 0;
safi_t safi;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 3dfc446b2..2dab3ce6a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1967,9 +1967,8 @@ int subgroup_process_announce_selected(struct update_subgroup *subgrp,
: NULL);
/* First update is deferred until ORF or ROUTE-REFRESH is received */
- if (onlypeer
- && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
- PEER_STATUS_ORF_WAIT_REFRESH))
+ if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[afi][safi],
+ PEER_STATUS_ORF_WAIT_REFRESH))
return 0;
memset(&attr, 0, sizeof(struct attr));
@@ -2228,13 +2227,12 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
/* advertise/withdraw type-5 routes */
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
- if (new_select &&
- (!new_select->extra || !new_select->extra->parent))
- bgp_evpn_advertise_type5_route(bgp, &rn->p,
- new_select->attr,
- afi, safi);
- else if (old_select &&
- (!old_select->extra || !old_select->extra->parent))
+ if (new_select
+ && (!new_select->extra || !new_select->extra->parent))
+ bgp_evpn_advertise_type5_route(
+ bgp, &rn->p, new_select->attr, afi, safi);
+ else if (old_select
+ && (!old_select->extra || !old_select->extra->parent))
bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi);
}
@@ -6842,10 +6840,9 @@ static void damp_route_vty_out(struct vty *vty, struct prefix *p,
bgp_damp_reuse_time_vty(vty, binfo, timebuf, BGP_UPTIME_LEN,
use_json, json);
else
- vty_out(vty, "%s ",
- bgp_damp_reuse_time_vty(vty, binfo, timebuf,
- BGP_UPTIME_LEN, use_json,
- json));
+ vty_out(vty, "%s ", bgp_damp_reuse_time_vty(vty, binfo, timebuf,
+ BGP_UPTIME_LEN,
+ use_json, json));
/* Print attribute */
attr = binfo->attr;
@@ -6924,9 +6921,8 @@ static void flap_route_vty_out(struct vty *vty, struct prefix *p,
peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, use_json,
json);
else
- vty_out(vty, "%s ",
- peer_uptime(bdi->start_time, timebuf, BGP_UPTIME_LEN, 0,
- NULL));
+ vty_out(vty, "%s ", peer_uptime(bdi->start_time, timebuf,
+ BGP_UPTIME_LEN, 0, NULL));
if (CHECK_FLAG(binfo->flags, BGP_INFO_DAMPED)
&& !CHECK_FLAG(binfo->flags, BGP_INFO_HISTORY)) {
@@ -8032,9 +8028,8 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
}
if (!use_json && header) {
- vty_out(vty,
- "BGP table version is %" PRIu64
- ", local router ID is %s\n",
+ vty_out(vty, "BGP table version is %" PRIu64
+ ", local router ID is %s\n",
table->version,
inet_ntoa(bgp->router_id));
vty_out(vty, BGP_SHOW_SCODE_HEADER);
@@ -8516,9 +8511,8 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp,
if (display)
json_object_object_add(json, "paths", json_paths);
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (!display) {
@@ -9593,9 +9587,8 @@ static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi,
json, "recommended",
"Please report this bug, with the above command output");
}
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
@@ -9829,9 +9822,8 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
"bgpOriginatingDefaultNetwork",
"0.0.0.0");
} else {
- vty_out(vty,
- "BGP table version is %" PRIu64
- ", local router ID is %s\n",
+ vty_out(vty, "BGP table version is %" PRIu64
+ ", local router ID is %s\n",
table->version, inet_ntoa(bgp->router_id));
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
@@ -9974,9 +9966,8 @@ static void show_adj_route(struct vty *vty, struct peer *peer, afi_t afi,
output_count);
}
if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
}
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 2d4034d77..dffe2b8dd 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -104,10 +104,8 @@ struct bgp_info_extra {
struct in6_addr addr6;
} un; /* cached un address */
time_t create_time;
- struct
- prefix
- aux_prefix; /* AFI_L2VPN: the IP addr,
- if family set */
+ struct prefix aux_prefix; /* AFI_L2VPN: the IP addr,
+ if family set */
} import;
} vnc;
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 4d5624d3b..5371b3723 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -742,8 +742,7 @@ static void route_match_evpn_route_type_free(void *rule)
/* Route map commands for evpn route-type matching. */
struct route_map_rule_cmd route_match_evpn_route_type_cmd = {
"evpn route-type", route_match_evpn_route_type,
- route_match_evpn_route_type_compile,
- route_match_evpn_route_type_free};
+ route_match_evpn_route_type_compile, route_match_evpn_route_type_free};
/* `match local-preference LOCAL-PREF' */
@@ -3079,12 +3078,13 @@ static void bgp_route_map_process_update(struct bgp *bgp, const char *rmap_name,
/* for type5 command route-maps */
FOREACH_AFI_SAFI (afi, safi) {
- if (bgp->adv_cmd_rmap[afi][safi].name &&
- strcmp(rmap_name, bgp->adv_cmd_rmap[afi][safi].name) == 0) {
+ if (bgp->adv_cmd_rmap[afi][safi].name
+ && strcmp(rmap_name, bgp->adv_cmd_rmap[afi][safi].name)
+ == 0) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug(
- "Processing route_map %s update on advertise type5 route command",
- rmap_name);
+ "Processing route_map %s update on advertise type5 route command",
+ rmap_name);
bgp_evpn_withdraw_type5_routes(bgp, afi, safi);
bgp_evpn_advertise_type5_routes(bgp, afi, safi);
}
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index 19d4769cd..1fb5bf19f 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -1,9 +1,12 @@
/*
* BGP RPKI
* Copyright (C) 2013 Michael Mester (m.mester@fu-berlin.de), for FU Berlin
- * Copyright (C) 2014-2017 Andreas Reuter (andreas.reuter@fu-berlin.de), for FU Berlin
- * Copyright (C) 2016-2017 Colin Sames (colin.sames@haw-hamburg.de), for HAW Hamburg
- * Copyright (C) 2017 Marcel Röthke (marcel.roethke@haw-hamburg.de), for HAW Hamburg
+ * Copyright (C) 2014-2017 Andreas Reuter (andreas.reuter@fu-berlin.de), for FU
+ * Berlin
+ * Copyright (C) 2016-2017 Colin Sames (colin.sames@haw-hamburg.de), for HAW
+ * Hamburg
+ * Copyright (C) 2017 Marcel Röthke (marcel.roethke@haw-hamburg.de), for HAW
+ * Hamburg
*
* This file is part of FRRouting.
*
@@ -77,14 +80,14 @@ DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE_GROUP, "BGP RPKI Cache server group")
#define RPKI_OUTPUT_STRING "Control rpki specific settings\n"
struct cache {
- enum { TCP, SSH } type;
- struct tr_socket *tr_socket;
- union {
+ enum { TCP, SSH } type;
+ struct tr_socket *tr_socket;
+ union {
struct tr_tcp_config *tcp_config;
struct tr_ssh_config *ssh_config;
- } tr_config;
- struct rtr_socket *rtr_socket;
- uint8_t preference;
+ } tr_config;
+ struct rtr_socket *rtr_socket;
+ uint8_t preference;
};
enum return_values { SUCCESS = 0, ERROR = -1 };
@@ -105,27 +108,22 @@ static void overwrite_exit_commands(void);
static void free_cache(struct cache *cache);
static struct rtr_mgr_group *get_groups(void);
#if defined(FOUND_SSH)
-static int add_ssh_cache(const char *host,
- const unsigned int port,
- const char *username,
- const char *client_privkey_path,
+static int add_ssh_cache(const char *host, const unsigned int port,
+ const char *username, const char *client_privkey_path,
const char *client_pubkey_path,
const char *server_pubkey_path,
const uint8_t preference);
#endif
static struct rtr_socket *create_rtr_socket(struct tr_socket *tr_socket);
static struct cache *find_cache(const uint8_t preference);
-static int add_tcp_cache(const char *host,
- const char *port,
+static int add_tcp_cache(const char *host, const char *port,
const uint8_t preference);
static void print_record(const struct pfx_record *record, void *data);
static int is_synchronized(void);
static int is_running(void);
static void route_match_free(void *rule);
-static route_map_result_t route_match(void *rule,
- struct prefix *prefix,
- route_map_object_t type,
- void *object);
+static route_map_result_t route_match(void *rule, struct prefix *prefix,
+ route_map_object_t type, void *object);
static void *route_match_compile(const char *arg);
static struct rtr_mgr_config *rtr_config;
@@ -139,9 +137,8 @@ static unsigned int timeout;
static unsigned int initial_synchronisation_timeout;
static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1};
-static struct route_map_rule_cmd route_match_rpki_cmd = {"rpki", route_match,
- route_match_compile,
- route_match_free};
+static struct route_map_rule_cmd route_match_rpki_cmd = {
+ "rpki", route_match, route_match_compile, route_match_free};
static void *malloc_wrapper(size_t size)
{
@@ -162,8 +159,7 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr,
struct prefix *prefix);
static route_map_result_t route_match(void *rule, struct prefix *prefix,
- route_map_object_t type,
- void *object)
+ route_map_object_t type, void *object)
{
int *rpki_status = rule;
struct bgp_info *bgp_info;
@@ -285,7 +281,7 @@ static int bgp_rpki_init(struct thread_master *master)
rtr_is_running = 0;
cache_list = list_new();
- cache_list->del = (void (*)(void *)) &free_cache;
+ cache_list->del = (void (*)(void *)) & free_cache;
polling_period = POLLING_PERIOD_DEFAULT;
expire_interval = EXPIRE_INTERVAL_DEFAULT;
@@ -307,9 +303,7 @@ static int bgp_rpki_fini(void)
static int bgp_rpki_module_init(void)
{
- lrtr_set_alloc_functions(malloc_wrapper,
- realloc_wrapper,
- free_wrapper);
+ lrtr_set_alloc_functions(malloc_wrapper, realloc_wrapper, free_wrapper);
hook_register(frr_late_init, bgp_rpki_init);
hook_register(frr_early_fini, &bgp_rpki_fini);
@@ -332,8 +326,8 @@ static int start(void)
struct rtr_mgr_group *groups = get_groups();
ret = rtr_mgr_init(&rtr_config, groups, groups_len, polling_period,
- expire_interval, retry_interval,
- NULL, NULL, NULL, NULL);
+ expire_interval, retry_interval, NULL, NULL, NULL,
+ NULL);
if (ret == RTR_ERROR) {
RPKI_DEBUG("Init rtr_mgr failed.");
return ERROR;
@@ -447,8 +441,8 @@ static int rpki_validate_prefix(struct peer *peer, struct attr *attr,
if (as_segment->type == AS_SEQUENCE) {
// Get rightmost asn
as_number = as_segment->as[as_segment->length - 1];
- } else if (as_segment->type == AS_CONFED_SEQUENCE ||
- as_segment->type == AS_CONFED_SET) {
+ } else if (as_segment->type == AS_CONFED_SEQUENCE
+ || as_segment->type == AS_CONFED_SET) {
// Set own as number
as_number = peer->bgp->as;
} else {
@@ -520,16 +514,15 @@ static int add_cache(struct cache *cache)
listnode_add(cache_list, cache);
- if (rtr_is_running &&
- rtr_mgr_add_group(rtr_config, &group) != RTR_SUCCESS) {
+ if (rtr_is_running
+ && rtr_mgr_add_group(rtr_config, &group) != RTR_SUCCESS) {
return ERROR;
}
return SUCCESS;
}
-static int add_tcp_cache(const char *host,
- const char *port,
+static int add_tcp_cache(const char *host, const char *port,
const uint8_t preference)
{
struct rtr_socket *rtr_socket;
@@ -556,10 +549,8 @@ static int add_tcp_cache(const char *host,
}
#if defined(FOUND_SSH)
-static int add_ssh_cache(const char *host,
- const unsigned int port,
- const char *username,
- const char *client_privkey_path,
+static int add_ssh_cache(const char *host, const unsigned int port,
+ const char *username, const char *client_privkey_path,
const char *client_pubkey_path,
const char *server_pubkey_path,
const uint8_t preference)
@@ -577,8 +568,8 @@ static int add_ssh_cache(const char *host,
ssh_config->bindaddr = NULL;
ssh_config->username = XSTRDUP(MTYPE_BGP_RPKI_CACHE, username);
- ssh_config->client_privkey_path = XSTRDUP(
- MTYPE_BGP_RPKI_CACHE, client_privkey_path);
+ ssh_config->client_privkey_path =
+ XSTRDUP(MTYPE_BGP_RPKI_CACHE, client_privkey_path);
ssh_config->server_hostkey_path =
XSTRDUP(MTYPE_BGP_RPKI_CACHE, server_pubkey_path);
@@ -597,16 +588,13 @@ static int add_ssh_cache(const char *host,
static void free_cache(struct cache *cache)
{
if (cache->type == TCP) {
- XFREE(MTYPE_BGP_RPKI_CACHE,
- cache->tr_config.tcp_config->host);
- XFREE(MTYPE_BGP_RPKI_CACHE,
- cache->tr_config.tcp_config->port);
+ XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config->host);
+ XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config->port);
XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config);
}
#if defined(FOUND_SSH)
else {
- XFREE(MTYPE_BGP_RPKI_CACHE,
- cache->tr_config.ssh_config->host);
+ XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.ssh_config->host);
XFREE(MTYPE_BGP_RPKI_CACHE,
cache->tr_config.ssh_config->username);
XFREE(MTYPE_BGP_RPKI_CACHE,
@@ -644,22 +632,17 @@ static int config_write(struct vty *vty)
#endif
case TCP:
tcp_config = cache->tr_config.tcp_config;
- vty_out(vty,
- " rpki cache %s %s ",
- tcp_config->host,
- tcp_config->port);
+ vty_out(vty, " rpki cache %s %s ",
+ tcp_config->host, tcp_config->port);
break;
#if defined(FOUND_SSH)
case SSH:
ssh_config = cache->tr_config.ssh_config;
- vty_out(vty,
- " rpki cache %s %u %s %s %s ",
- ssh_config->host,
- ssh_config->port,
+ vty_out(vty, " rpki cache %s %u %s %s %s ",
+ ssh_config->host, ssh_config->port,
ssh_config->username,
ssh_config->client_privkey_path,
- ssh_config->server_hostkey_path
- != NULL
+ ssh_config->server_hostkey_path != NULL
? ssh_config
->server_hostkey_path
: " ");
@@ -694,7 +677,8 @@ DEFUN (bgp_rpki_start,
"start rpki support\n")
{
if (listcount(cache_list) == 0)
- vty_out(vty, "Could not start rpki because no caches are configured\n");
+ vty_out(vty,
+ "Could not start rpki because no caches are configured\n");
if (!is_running()) {
if (start() == ERROR) {
@@ -855,9 +839,9 @@ DEFPY (rpki_cache,
// use ssh connection
if (ssh_uname) {
#if defined(FOUND_SSH)
- return_value = add_ssh_cache(
- cache, sshport, ssh_uname, ssh_privkey, ssh_pubkey,
- server_pubkey, preference);
+ return_value =
+ add_ssh_cache(cache, sshport, ssh_uname, ssh_privkey,
+ ssh_pubkey, server_pubkey, preference);
#else
vty_out(vty,
"ssh sockets are not supported. "
@@ -923,8 +907,7 @@ DEFUN (show_rpki_prefix_table,
struct cache *cache;
for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) {
- vty_out(vty,
- "host: %s port: %s\n",
+ vty_out(vty, "host: %s port: %s\n",
cache->tr_config.tcp_config->host,
cache->tr_config.tcp_config->port);
}
@@ -947,8 +930,7 @@ DEFUN (show_rpki_cache_server,
struct cache *cache;
for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) {
- vty_out(vty,
- "host: %s port: %s\n",
+ vty_out(vty, "host: %s port: %s\n",
cache->tr_config.tcp_config->host,
cache->tr_config.tcp_config->port);
}
@@ -973,8 +955,7 @@ DEFUN (show_rpki_cache_connection,
return CMD_SUCCESS;
}
vty_out(vty, "Connected to group %d\n", group->preference);
- for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node,
- cache)) {
+ for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) {
if (cache->preference == group->preference) {
struct tr_tcp_config *tcp_config;
#if defined(FOUND_SSH)
@@ -984,8 +965,7 @@ DEFUN (show_rpki_cache_connection,
switch (cache->type) {
case TCP:
tcp_config =
- cache->tr_config
- .tcp_config;
+ cache->tr_config.tcp_config;
vty_out(vty,
"rpki tcp cache %s %s pref %hhu\n",
tcp_config->host,
@@ -996,8 +976,7 @@ DEFUN (show_rpki_cache_connection,
#if defined(FOUND_SSH)
case SSH:
ssh_config =
- cache->tr_config
- .ssh_config;
+ cache->tr_config.ssh_config;
vty_out(vty,
"rpki ssh cache %s %u pref %hhu\n",
ssh_config->host,
@@ -1142,9 +1121,9 @@ static void overwrite_exit_commands(void)
for (i = 0; i < cmd_vector->active; ++i) {
struct cmd_element *cmd = vector_lookup(cmd_vector, i);
- if (strcmp(cmd->string, "exit") == 0 ||
- strcmp(cmd->string, "quit") == 0 ||
- strcmp(cmd->string, "end") == 0) {
+ if (strcmp(cmd->string, "exit") == 0
+ || strcmp(cmd->string, "quit") == 0
+ || strcmp(cmd->string, "end") == 0) {
uninstall_element(RPKI_NODE, cmd);
}
}
@@ -1156,7 +1135,7 @@ static void overwrite_exit_commands(void)
static void install_cli_commands(void)
{
- //TODO: make config write work
+ // TODO: make config write work
install_node(&rpki_node, &config_write);
install_default(RPKI_NODE);
overwrite_exit_commands();
@@ -1212,4 +1191,4 @@ static void install_cli_commands(void)
FRR_MODULE_SETUP(.name = "bgpd_rpki", .version = "0.3.6",
.description = "Enable RPKI support for FRR.",
- .init = bgp_rpki_module_init)
+ .init = bgp_rpki_module_init)
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 8317a252e..90ffa9da3 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -864,8 +864,6 @@ static u_char *bgp4PathAttrTable(struct variable *v, oid name[], size_t *length,
return SNMP_INTEGER(-1);
break;
case BGP4PATHATTRBEST: /* 13 */
- /* $FRR indent$ */
- /* clang-format off */
#define BGP4_PathAttrBest_false 1
#define BGP4_PathAttrBest_true 2
if (CHECK_FLAG(binfo->flags, BGP_INFO_SELECTED))
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 1c589f796..d2e89a678 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -85,9 +85,8 @@ static void sync_init(struct update_subgroup *subgrp)
BGP_ADV_FIFO_INIT(&subgrp->sync->update);
BGP_ADV_FIFO_INIT(&subgrp->sync->withdraw);
BGP_ADV_FIFO_INIT(&subgrp->sync->withdraw_low);
- subgrp->hash = hash_create(baa_hash_key,
- baa_hash_cmp,
- "BGP SubGroup Hash");
+ subgrp->hash =
+ hash_create(baa_hash_key, baa_hash_cmp, "BGP SubGroup Hash");
/* We use a larger buffer for subgrp->work in the event that:
* - We RX a BGP_UPDATE where the attributes alone are just
@@ -1545,8 +1544,7 @@ void update_bgp_group_init(struct bgp *bgp)
AF_FOREACH (afid)
bgp->update_groups[afid] =
- hash_create(updgrp_hash_key_make,
- updgrp_hash_cmp,
+ hash_create(updgrp_hash_key_make, updgrp_hash_cmp,
"BGP Update Group Hash");
}
@@ -1877,11 +1875,12 @@ void subgroup_trigger_write(struct update_subgroup *subgrp)
* the subgroup output queue into their own output queue. This action
* will trigger a write job on the I/O thread.
*/
- SUBGRP_FOREACH_PEER(subgrp, paf)
- if (paf->peer->status == Established)
- thread_add_timer_msec(bm->master, bgp_generate_updgrp_packets,
- paf->peer, 0,
- &paf->peer->t_generate_updgrp_packets);
+ SUBGRP_FOREACH_PEER (subgrp, paf)
+ if (paf->peer->status == Established)
+ thread_add_timer_msec(
+ bm->master, bgp_generate_updgrp_packets,
+ paf->peer, 0,
+ &paf->peer->t_generate_updgrp_packets);
}
int update_group_clear_update_dbg(struct update_group *updgrp, void *arg)
diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h
index e941fecb6..233fe5d14 100644
--- a/bgpd/bgp_updgrp.h
+++ b/bgpd/bgp_updgrp.h
@@ -287,7 +287,6 @@ struct update_subgroup {
*/
#define SUBGRP_DECR_STAT(subgrp, stat) SUBGRP_INCR_STAT_BY(subgrp, stat, -1)
-
typedef int (*updgrp_walkcb)(struct update_group *updgrp, void *ctx);
/* really a private structure */
@@ -341,23 +340,23 @@ struct updwalk_context {
* Walk all subgroups in an update group.
*/
#define UPDGRP_FOREACH_SUBGRP(updgrp, subgrp) \
- LIST_FOREACH(subgrp, &((updgrp)->subgrps), updgrp_train)
+ LIST_FOREACH (subgrp, &((updgrp)->subgrps), updgrp_train)
#define UPDGRP_FOREACH_SUBGRP_SAFE(updgrp, subgrp, tmp_subgrp) \
- LIST_FOREACH_SAFE(subgrp, &((updgrp)->subgrps), updgrp_train, \
- tmp_subgrp)
+ LIST_FOREACH_SAFE (subgrp, &((updgrp)->subgrps), updgrp_train, \
+ tmp_subgrp)
#define SUBGRP_FOREACH_PEER(subgrp, paf) \
- LIST_FOREACH(paf, &(subgrp->peers), subgrp_train)
+ LIST_FOREACH (paf, &(subgrp->peers), subgrp_train)
#define SUBGRP_FOREACH_PEER_SAFE(subgrp, paf, temp_paf) \
- LIST_FOREACH_SAFE(paf, &(subgrp->peers), subgrp_train, temp_paf)
+ LIST_FOREACH_SAFE (paf, &(subgrp->peers), subgrp_train, temp_paf)
#define SUBGRP_FOREACH_ADJ(subgrp, adj) \
- TAILQ_FOREACH(adj, &(subgrp->adjq), subgrp_adj_train)
+ TAILQ_FOREACH (adj, &(subgrp->adjq), subgrp_adj_train)
#define SUBGRP_FOREACH_ADJ_SAFE(subgrp, adj, adj_temp) \
- TAILQ_FOREACH_SAFE(adj, &(subgrp->adjq), subgrp_adj_train, adj_temp)
+ TAILQ_FOREACH_SAFE (adj, &(subgrp->adjq), subgrp_adj_train, adj_temp)
/* Prototypes. */
/* bgp_updgrp.c */
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 9fa733a72..1d50cb1ca 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -733,8 +733,9 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW;
- space_needed = BGP_NLRI_LENGTH + addpath_overhead +
- bgp_packet_mpattr_prefix_size(afi, safi, &rn->p);
+ space_needed =
+ BGP_NLRI_LENGTH + addpath_overhead
+ + bgp_packet_mpattr_prefix_size(afi, safi, &rn->p);
/* When remaining space can't include NLRI and it's length. */
if (space_remaining < space_needed)
@@ -778,9 +779,9 @@ struct bpacket *subgroup_update_packet(struct update_subgroup *subgrp)
space_remaining =
STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW;
- space_needed = BGP_NLRI_LENGTH + addpath_overhead +
- bgp_packet_mpattr_prefix_size(afi, safi,
- &rn->p);
+ space_needed = BGP_NLRI_LENGTH + addpath_overhead
+ + bgp_packet_mpattr_prefix_size(
+ afi, safi, &rn->p);
/* If the attributes alone do not leave any room for
* NLRI then
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 8fa5dc9c6..3bdd09c3c 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -832,8 +832,7 @@ DEFUN_NOSH (router_bgp,
}
if (listcount(bm->bgp) > 1) {
- vty_out(vty,
- "%% Please specify ASN and VRF\n");
+ vty_out(vty, "%% Please specify ASN and VRF\n");
return CMD_WARNING_CONFIG_FAILED;
}
}
@@ -908,8 +907,7 @@ DEFUN (no_router_bgp,
}
if (listcount(bm->bgp) > 1) {
- vty_out(vty,
- "%% Please specify ASN and VRF\n");
+ vty_out(vty, "%% Please specify ASN and VRF\n");
return CMD_WARNING_CONFIG_FAILED;
}
@@ -1540,8 +1538,7 @@ DEFUN (no_bgp_maxpaths,
}
ALIAS_HIDDEN(no_bgp_maxpaths, no_bgp_maxpaths_hidden_cmd,
- "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]",
- NO_STR
+ "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", NO_STR
"Forward packets over multiple paths\n"
"Number of paths\n")
@@ -6571,9 +6568,8 @@ DEFUN (show_bgp_vrfs,
json_object_int_add(json, "totalVrfs", count);
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (count)
@@ -6722,20 +6718,17 @@ DEFUN (show_bgp_memory,
/* Other attributes */
if ((count = community_count()))
vty_out(vty, "%ld BGP community entries, using %s of memory\n",
- count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct community)));
+ count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct community)));
if ((count = mtype_stats_alloc(MTYPE_ECOMMUNITY)))
vty_out(vty, "%ld BGP community entries, using %s of memory\n",
- count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct ecommunity)));
+ count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct ecommunity)));
if ((count = mtype_stats_alloc(MTYPE_LCOMMUNITY)))
vty_out(vty,
"%ld BGP large-community entries, using %s of memory\n",
- count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct lcommunity)));
+ count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(struct lcommunity)));
if ((count = mtype_stats_alloc(MTYPE_CLUSTER)))
vty_out(vty, "%ld Cluster lists, using %s of memory\n", count,
@@ -6764,9 +6757,8 @@ DEFUN (show_bgp_memory,
count * sizeof(struct hash_backet)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n",
- count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(regex_t)));
+ count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
+ count * sizeof(regex_t)));
return CMD_SUCCESS;
}
@@ -7018,9 +7010,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
json, "peerGroupCount", ents);
json_object_int_add(
json, "peerGroupMemory",
- ents
- * sizeof(struct
- peer_group));
+ ents * sizeof(struct
+ peer_group));
}
if (CHECK_FLAG(bgp->af_flags[afi][safi],
@@ -7043,11 +7034,10 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
vty_out(vty,
"RIB entries %ld, using %s of memory\n",
ents,
- mtype_memstr(
- memstrbuf, sizeof(memstrbuf),
- ents
- * sizeof(struct
- bgp_node)));
+ mtype_memstr(memstrbuf,
+ sizeof(memstrbuf),
+ ents * sizeof(struct
+ bgp_node)));
/* Peer related usage */
ents = listcount(bgp->peer);
@@ -7064,9 +7054,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
mtype_memstr(
memstrbuf,
sizeof(memstrbuf),
- ents
- * sizeof(struct
- peer_group)));
+ ents * sizeof(struct
+ peer_group)));
if (CHECK_FLAG(bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING))
@@ -7199,9 +7188,8 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
bgp_show_bestpath_json(bgp, json);
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
if (count)
@@ -7836,9 +7824,8 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
paf = peer_af_find(p, afi, safi);
if (paf && PAF_SUBGRP(paf)) {
- vty_out(vty,
- " Update group %" PRIu64 ", subgroup %" PRIu64
- "\n",
+ vty_out(vty, " Update group %" PRIu64
+ ", subgroup %" PRIu64 "\n",
PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id);
vty_out(vty, " Packet Queue length %d\n",
bpacket_queue_virtual_length(paf));
@@ -9638,9 +9625,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
} else
vty_out(vty,
" Reduce the no. of prefix from %s, will restart in %ld seconds\n",
- p->host,
- thread_timer_remain_second(
- p->t_pmax_restart));
+ p->host, thread_timer_remain_second(
+ p->t_pmax_restart));
} else {
if (use_json)
json_object_boolean_true_add(
@@ -9884,9 +9870,8 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
}
if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else {
vty_out(vty, "\n");
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 029b3d4d3..23f626e96 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1746,8 +1746,7 @@ static int bgp_zebra_process_local_l3vni(int cmd, struct zclient *zclient,
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Rx L3-VNI %s VRF %s VNI %u RMAC %s filter %s",
(cmd == ZEBRA_L3VNI_ADD) ? "add" : "del",
- vrf_id_to_name(vrf_id),
- l3vni,
+ vrf_id_to_name(vrf_id), l3vni,
prefix_mac2str(&rmac, buf, sizeof(buf)),
filter ? "prefix-routes-only" : "none");
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index c06339aad..c2fd125b7 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -3019,17 +3019,15 @@ struct bgp *bgp_lookup_by_vrf_id(vrf_id_t vrf_id)
/* handle socket creation or deletion, if necessary
* this is called for all new BGP instances
*/
-int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf,
- vrf_id_t old_vrf_id, bool create)
+int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf, vrf_id_t old_vrf_id,
+ bool create)
{
int ret = 0;
/* Create BGP server socket, if listen mode not disabled */
if (!bgp || bgp_option_check(BGP_OPT_NO_LISTEN))
return 0;
- if (bgp->name
- && bgp->inst_type == BGP_INSTANCE_TYPE_VRF
- && vrf) {
+ if (bgp->name && bgp->inst_type == BGP_INSTANCE_TYPE_VRF && vrf) {
/*
* suppress vrf socket
*/
@@ -3425,8 +3423,8 @@ struct peer *peer_lookup(struct bgp *bgp, union sockunion *su)
* invoked without an instance
* when examining VRFs.
*/
- if ((bgp->inst_type == BGP_INSTANCE_TYPE_VRF) &&
- !vrf_is_mapped_on_netns(bgp->vrf_id))
+ if ((bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
+ && !vrf_is_mapped_on_netns(bgp->vrf_id))
continue;
peer = hash_lookup(bgp->peerhash, &tmp_peer);
@@ -4070,9 +4068,8 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi,
}
/* Track if addpath TX is in use */
- if (flag
- & (PEER_FLAG_ADDPATH_TX_ALL_PATHS
- | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) {
+ if (flag & (PEER_FLAG_ADDPATH_TX_ALL_PATHS
+ | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) {
bgp = peer->bgp;
addpath_tx_used = 0;
@@ -6885,9 +6882,8 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
} else {
if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY)
- && (!g_peer
- || peer_af_flag_check(g_peer, afi, safi,
- PEER_FLAG_SEND_COMMUNITY))
+ && (!g_peer || peer_af_flag_check(g_peer, afi, safi,
+ PEER_FLAG_SEND_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_EXT_COMMUNITY)
&& (!g_peer
@@ -6895,10 +6891,9 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
PEER_FLAG_SEND_EXT_COMMUNITY))
&& !peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_LARGE_COMMUNITY)
- && (!g_peer
- || peer_af_flag_check(
- g_peer, afi, safi,
- PEER_FLAG_SEND_LARGE_COMMUNITY))) {
+ && (!g_peer || peer_af_flag_check(
+ g_peer, afi, safi,
+ PEER_FLAG_SEND_LARGE_COMMUNITY))) {
vty_out(vty, " no neighbor %s send-community all\n",
addr);
} else {
@@ -6926,10 +6921,9 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
if (!peer_af_flag_check(peer, afi, safi,
PEER_FLAG_SEND_COMMUNITY)
- && (!g_peer
- || peer_af_flag_check(
- g_peer, afi, safi,
- PEER_FLAG_SEND_COMMUNITY))) {
+ && (!g_peer || peer_af_flag_check(
+ g_peer, afi, safi,
+ PEER_FLAG_SEND_COMMUNITY))) {
vty_out(vty,
" no neighbor %s send-community\n",
addr);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index b3c741860..e265da803 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -133,8 +133,6 @@ struct bgp_master {
/* timer to dampen route map changes */
struct thread *t_rmap_update; /* Handle route map updates */
u_int32_t rmap_update_timer; /* Route map update timer */
- /* $FRR indent$ */
- /* clang-format off */
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
/* Id space for automatic RD derivation for an EVI/VRF */
@@ -249,8 +247,6 @@ struct bgp {
*t_startup; /* start-up timer on only once at the beginning */
u_int32_t v_maxmed_onstartup; /* Duration of max-med on start-up */
- /* $FRR indent$ */
- /* clang-format off */
#define BGP_MAXMED_ONSTARTUP_UNCONFIGURED 0 /* 0 means off, its the default */
u_int32_t maxmed_onstartup_value; /* Max-med value when active on
start-up */
@@ -259,17 +255,13 @@ struct bgp {
u_char maxmed_onstartup_over; /* Flag to make it effective only once */
u_char v_maxmed_admin; /* 1/0 if max-med administrative is on/off */
- /* $FRR indent$ */
- /* clang-format off */
#define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */
u_int32_t maxmed_admin_value; /* Max-med value when administrative in on
*/
- /* $FRR indent$ */
- /* clang-format off */
#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
- u_char maxmed_active; /* 1/0 if max-med is active or not */
- u_int32_t maxmed_value; /* Max-med value when its active */
+ u_char maxmed_active; /* 1/0 if max-med is active or not */
+ u_int32_t maxmed_value; /* Max-med value when its active */
/* BGP update delay on startup */
struct thread *t_update_delay;
@@ -680,8 +672,6 @@ struct peer {
unsigned short port; /* Destination port for peer */
char *host; /* Printable address of the peer. */
union sockunion su; /* Sockunion address of the peer. */
- /* $FRR indent$ */
- /* clang-format off */
#define BGP_PEER_SU_UNSPEC(peer) (peer->su.sa.sa_family == AF_UNSPEC)
time_t uptime; /* Last Up/Down time */
time_t readtime; /* Last read time */
@@ -898,8 +888,8 @@ struct peer {
memory_order_relaxed)
/* Statistics field */
- _Atomic uint32_t open_in; /* Open message input count */
- _Atomic uint32_t open_out; /* Open message output count */
+ _Atomic uint32_t open_in; /* Open message input count */
+ _Atomic uint32_t open_out; /* Open message output count */
_Atomic uint32_t update_in; /* Update message input count */
_Atomic uint32_t update_out; /* Update message ouput count */
_Atomic time_t update_time; /* Update message received time. */
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c
index f28b8a2ce..4c7c392ab 100644
--- a/bgpd/rfapi/bgp_rfapi_cfg.c
+++ b/bgpd/rfapi/bgp_rfapi_cfg.c
@@ -1636,9 +1636,8 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
idx += 2; /* skip afi and keyword */
if (is_bgp) {
- if (idx == argc
- || strmatch(argv[idx]->arg,
- rfg->plist_export_bgp_name[afi])) {
+ if (idx == argc || strmatch(argv[idx]->arg,
+ rfg->plist_export_bgp_name[afi])) {
if (rfg->plist_export_bgp_name[afi])
free(rfg->plist_export_bgp_name[afi]);
rfg->plist_export_bgp_name[afi] = NULL;
@@ -1768,9 +1767,8 @@ DEFUN (vnc_nve_group_export_no_routemap,
}
if (is_bgp) {
- if (idx == argc
- || strmatch(argv[idx]->arg,
- rfg->routemap_export_bgp_name)) {
+ if (idx == argc || strmatch(argv[idx]->arg,
+ rfg->routemap_export_bgp_name)) {
if (rfg->routemap_export_bgp_name)
free(rfg->routemap_export_bgp_name);
rfg->routemap_export_bgp_name = NULL;
@@ -1780,9 +1778,8 @@ DEFUN (vnc_nve_group_export_no_routemap,
vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6);
}
} else {
- if (idx == argc
- || strmatch(argv[idx]->arg,
- rfg->routemap_export_zebra_name)) {
+ if (idx == argc || strmatch(argv[idx]->arg,
+ rfg->routemap_export_zebra_name)) {
if (rfg->routemap_export_zebra_name)
free(rfg->routemap_export_zebra_name);
rfg->routemap_export_zebra_name = NULL;
@@ -2978,7 +2975,8 @@ DEFUN_NOSH (vnc_vrf_policy,
VTY_DECLVAR_CONTEXT(bgp, bgp);
if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) {
- vty_out(vty, "Can't configure vrf-policy within a BGP VRF instance\n");
+ vty_out(vty,
+ "Can't configure vrf-policy within a BGP VRF instance\n");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 9d169eed3..8d782864c 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -383,9 +383,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
vnc_zlog_debug_verbose(
"%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p",
- __func__, peer, buf,
- prefix_rd2str(prd, buf2, sizeof(buf2)), afi, safi, bn,
- (bn ? bn->info : NULL));
+ __func__, peer, buf, prefix_rd2str(prd, buf2, sizeof(buf2)),
+ afi, safi, bn, (bn ? bn->info : NULL));
for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) {
@@ -749,9 +748,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
if (lifetime && *lifetime != RFAPI_INFINITE_LIFETIME) {
uint32_t lt;
- encaptlv =
- XCALLOC(MTYPE_ENCAP_TLV,
- sizeof(struct bgp_attr_encap_subtlv) + 4);
+ encaptlv = XCALLOC(MTYPE_ENCAP_TLV,
+ sizeof(struct bgp_attr_encap_subtlv) + 4);
assert(encaptlv);
encaptlv->type =
BGP_VNC_SUBTLV_TYPE_LIFETIME; /* prefix lifetime */
@@ -795,8 +793,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
*/
encaptlv = XCALLOC(
MTYPE_ENCAP_TLV,
- sizeof(struct bgp_attr_encap_subtlv)
- + 2 + hop->length);
+ sizeof(struct bgp_attr_encap_subtlv) + 2
+ + hop->length);
assert(encaptlv);
encaptlv->type =
BGP_VNC_SUBTLV_TYPE_RFPOPTION; /* RFP
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index e1508dbd8..c7d64bf1e 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -1083,9 +1083,8 @@ int rfapiEcommunityGetEthernetTag(struct ecommunity *ecom, uint16_t *tag_id)
} else if (encode == ECOMMUNITY_ENCODE_AS) {
as = (*p++ << 8);
as |= (*p++);
- p +=
- 2; /* skip next two, tag/vid
- always in lowest bytes */
+ p += 2; /* skip next two, tag/vid
+ always in lowest bytes */
}
if (as == bgp->as) {
*tag_id = *p++ << 8;
@@ -1221,8 +1220,7 @@ static int rfapiVpnBiSamePtUn(struct bgp_info *bi1, struct bgp_info *bi2)
switch (pfx_un1.family) {
case AF_INET:
- if (!IPV4_ADDR_SAME(&pfx_un1.u.prefix4,
- &pfx_un2.u.prefix4))
+ if (!IPV4_ADDR_SAME(&pfx_un1.u.prefix4, &pfx_un2.u.prefix4))
return 0;
break;
case AF_INET6:
@@ -2235,9 +2233,9 @@ static struct bgp_info *rfapiItBiIndexSearch(
vnc_zlog_debug_verbose(
"%s: bi has prd=%s, peer=%p", __func__,
- prefix_rd2str(&bi_result->extra->vnc.import.rd,
- buf,
- sizeof(buf)),
+ prefix_rd2str(&bi_result->extra->vnc
+ .import.rd,
+ buf, sizeof(buf)),
bi_result->peer);
}
#endif
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index 5c222b6dd..30182ba7a 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -929,17 +929,14 @@ void rfapiMonitorItNodeChanged(
char buf_attach_pfx[PREFIX_STRLEN];
char buf_target_pfx[PREFIX_STRLEN];
- prefix2str(&m->node->p,
- buf_attach_pfx,
+ prefix2str(&m->node->p, buf_attach_pfx,
sizeof(buf_attach_pfx));
- prefix2str(&m->p,
- buf_target_pfx,
+ prefix2str(&m->p, buf_target_pfx,
sizeof(buf_target_pfx));
vnc_zlog_debug_verbose(
"%s: update rfd %p attached to pfx %s (targ=%s)",
__func__, m->rfd,
- buf_attach_pfx,
- buf_target_pfx);
+ buf_attach_pfx, buf_target_pfx);
/*
* update its RIB
diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h
index c82a0d6c6..9c759fc47 100644
--- a/bgpd/rfapi/rfapi_private.h
+++ b/bgpd/rfapi/rfapi_private.h
@@ -345,7 +345,8 @@ extern void rfapi_un_options_free(struct rfapi_un_option *goner);
extern void rfapi_vn_options_free(struct rfapi_vn_option *goner);
-extern void vnc_add_vrf_opener(struct bgp *bgp, struct rfapi_nve_group_cfg *rfg);
+extern void vnc_add_vrf_opener(struct bgp *bgp,
+ struct rfapi_nve_group_cfg *rfg);
extern void clear_vnc_vrf_closer(struct rfapi_nve_group_cfg *rfg);
/*------------------------------------------
* rfapi_extract_l2o
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 271c74851..2a8a465b7 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -511,7 +511,8 @@ void rfapiRibClear(struct rfapi_descriptor *rfd)
if (pn->info) {
if (pn->info != (void *)1) {
list_delete_and_null(
- (struct list **)(&pn->info));
+ (struct list *
+ *)(&pn->info));
}
pn->info = NULL;
/* linklist or 1 deleted */
@@ -1407,9 +1408,10 @@ callback:
vnc_zlog_debug_verbose(
"%s: move route to recently deleted list, rd=%s",
__func__,
- prefix_rd2str(&ri->rk.rd,
- buf_rd,
- sizeof(buf_rd)));
+ prefix_rd2str(
+ &ri->rk.rd,
+ buf_rd,
+ sizeof(buf_rd)));
}
#endif
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 28d068cc5..c5b3094b1 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -1163,8 +1163,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
* print that on the next line
*/
- if (bi->extra
- && bi->extra->vnc.import.aux_prefix.family) {
+ if (bi->extra && bi->extra->vnc.import.aux_prefix.family) {
const char *sp;
sp = rfapi_ntop(
@@ -4630,7 +4629,7 @@ notcfg:
************************************************************************/
void vnc_add_vrf_opener(struct bgp *bgp, struct rfapi_nve_group_cfg *rfg)
{
- if (rfg->rfd == NULL) { /* need new rfapi_handle */
+ if (rfg->rfd == NULL) { /* need new rfapi_handle */
/* based on rfapi_open */
struct rfapi_descriptor *rfd;
diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c
index e294cae07..c4d66bbc6 100644
--- a/bgpd/rfapi/vnc_export_bgp.c
+++ b/bgpd/rfapi/vnc_export_bgp.c
@@ -53,8 +53,7 @@
static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
struct rfapi_nve_group_cfg *rfg,
- struct route_node *rn,
- struct attr *attr,
+ struct route_node *rn, struct attr *attr,
afi_t afi,
struct rfapi_descriptor *irfd);
@@ -879,8 +878,9 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE,
- NULL, /* RD not used for unicast */
- NULL, 0, NULL); /* tag not used for unicast */
+ NULL, /* RD not used for unicast */
+ NULL, 0,
+ NULL); /* tag not used for unicast */
/*
* yuck!
* - but consistent with rest of function
@@ -908,8 +908,9 @@ void vnc_direct_bgp_del_prefix(struct bgp *bgp,
NULL, /* attr, ignored */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
BGP_ROUTE_REDISTRIBUTE,
- NULL, /* RD not used for unicast */
- NULL, 0, NULL); /* tag not used for unicast */
+ NULL, /* RD not used for unicast */
+ NULL, 0,
+ NULL); /* tag not used for unicast */
}
}
}
@@ -1151,10 +1152,8 @@ void vnc_direct_bgp_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
struct rfapi_nve_group_cfg *rfg,
- struct route_node *rn,
- struct attr *attr,
- afi_t afi,
- struct rfapi_descriptor *irfd)
+ struct route_node *rn, struct attr *attr,
+ afi_t afi, struct rfapi_descriptor *irfd)
{
struct prefix nhp;
struct bgp_info info;
@@ -1167,23 +1166,26 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
assert(rfg->rfd == NULL);
if (!rfg->rt_export_list || !rfg->rfapi_import_table) {
- vnc_zlog_debug_verbose("%s: VRF \"%s\" is missing RT import/export configuration.\n",
- __func__, rfg->name);
+ vnc_zlog_debug_verbose(
+ "%s: VRF \"%s\" is missing RT import/export configuration.\n",
+ __func__, rfg->name);
return;
}
if (!rfg->rd.prefixlen) {
- vnc_zlog_debug_verbose("%s: VRF \"%s\" is missing RD configuration.\n",
- __func__, rfg->name);
+ vnc_zlog_debug_verbose(
+ "%s: VRF \"%s\" is missing RD configuration.\n",
+ __func__, rfg->name);
return;
}
if (rfg->label > MPLS_LABEL_MAX) {
- vnc_zlog_debug_verbose("%s: VRF \"%s\" is missing defaul label configuration.\n",
- __func__, rfg->name);
+ vnc_zlog_debug_verbose(
+ "%s: VRF \"%s\" is missing defaul label configuration.\n",
+ __func__, rfg->name);
return;
}
irfd = XCALLOC(MTYPE_RFAPI_DESC,
- sizeof(struct rfapi_descriptor));
+ sizeof(struct rfapi_descriptor));
irfd->bgp = bgp;
rfg->rfd = irfd;
/*
@@ -1219,11 +1221,9 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
return;
if (VNC_DEBUG(EXPORT_BGP_DIRECT_ADD)) {
- vnc_zlog_debug_any("%s: attr follows",
- __func__);
+ vnc_zlog_debug_any("%s: attr follows", __func__);
rfapiPrintAttrPtrs(NULL, attr);
- vnc_zlog_debug_any("%s: hattr follows",
- __func__);
+ vnc_zlog_debug_any("%s: hattr follows", __func__);
rfapiPrintAttrPtrs(NULL, &hattr);
}
@@ -1232,12 +1232,13 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
info.peer = irfd->peer;
info.attr = &hattr;
- ret = route_map_apply(rfg->routemap_export_bgp,
- &rn->p, RMAP_BGP, &info);
+ ret = route_map_apply(rfg->routemap_export_bgp, &rn->p,
+ RMAP_BGP, &info);
if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr);
- vnc_zlog_debug_verbose("%s: route map says DENY, so not calling bgp_update",
- __func__);
+ vnc_zlog_debug_verbose(
+ "%s: route map says DENY, so not calling bgp_update",
+ __func__);
return;
}
}
@@ -1252,13 +1253,11 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp,
bgp_update(irfd->peer, &rn->p, /* prefix */
0, /* addpath_id */
- iattr, /* bgp_update copies it */
- afi, SAFI_UNICAST,
- ZEBRA_ROUTE_VNC_DIRECT,
- BGP_ROUTE_REDISTRIBUTE,
- NULL, /* RD not used for unicast */
- NULL, /* tag not used for unicast */
- 0, 0, NULL); /* EVPN not used */
+ iattr, /* bgp_update copies it */
+ afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
+ BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
+ NULL, /* tag not used for unicast */
+ 0, 0, NULL); /* EVPN not used */
bgp_attr_unintern(&iattr);
@@ -1338,7 +1337,8 @@ static void vnc_direct_bgp_add_group_afi(struct bgp *bgp,
for (ln = listhead(rfg->nves); ln;
ln = listnextnode(ln)) {
vnc_direct_add_rn_group_rd(bgp, rfg, rn, &attr,
- afi, listgetdata(ln));
+ afi,
+ listgetdata(ln));
}
}
}
@@ -1359,21 +1359,17 @@ void vnc_direct_bgp_add_group(struct bgp *bgp, struct rfapi_nve_group_cfg *rfg)
static void vnc_direct_del_rn_group_rd(struct bgp *bgp,
struct rfapi_nve_group_cfg *rfg,
- struct route_node *rn,
- afi_t afi,
+ struct route_node *rn, afi_t afi,
struct rfapi_descriptor *irfd)
{
if (irfd == NULL)
return;
bgp_withdraw(irfd->peer, &rn->p, /* prefix */
- 0, /* addpath_id */
- NULL, /* attr, ignored */
- afi, SAFI_UNICAST,
- ZEBRA_ROUTE_VNC_DIRECT,
- BGP_ROUTE_REDISTRIBUTE,
- NULL, /* RD not used for unicast */
- NULL, 0,
- NULL); /* tag not used for unicast */
+ 0, /* addpath_id */
+ NULL, /* attr, ignored */
+ afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT,
+ BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
+ NULL, 0, NULL); /* tag not used for unicast */
return;
}
@@ -1412,20 +1408,22 @@ static void vnc_direct_bgp_del_group_afi(struct bgp *bgp,
for (rn = route_top(rt); rn; rn = route_next(rn))
if (rn->info) {
if (rfg->type == RFAPI_GROUP_CFG_VRF)
- vnc_direct_del_rn_group_rd(bgp, rfg, rn,
- afi, rfg->rfd);
+ vnc_direct_del_rn_group_rd(bgp, rfg, rn, afi,
+ rfg->rfd);
else {
struct listnode *ln;
/*
- * For each NVE that is assigned to the export nve
+ * For each NVE that is assigned to the export
+ * nve
* group, generate
* a route with that NVE as its next hop
*/
for (ln = listhead(rfg->nves); ln;
ln = listnextnode(ln))
- vnc_direct_del_rn_group_rd(bgp, rfg, rn,
- afi, listgetdata(ln));
+ vnc_direct_del_rn_group_rd(
+ bgp, rfg, rn, afi,
+ listgetdata(ln));
}
}
}
@@ -1529,8 +1527,8 @@ static void import_table_to_nve_list_direct_bgp(struct bgp *bgp,
if (rfgn->rfg && rfgn->rfg->rfapi_import_table == it) {
if (rfgn->rfg->nves)
nve_group_to_nve_list(rfgn->rfg, nves, family);
- else if (rfgn->rfg->rfd &&
- rfgn->rfg->type == RFAPI_GROUP_CFG_VRF) {
+ else if (rfgn->rfg->rfd
+ && rfgn->rfg->type == RFAPI_GROUP_CFG_VRF) {
if (!*nves)
*nves = list_new();
listnode_add(*nves, rfgn->rfg->rfd);
@@ -1716,7 +1714,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi,
iattr, /* bgp_update copies this attr */
afi, SAFI_UNICAST, ZEBRA_ROUTE_VNC_DIRECT_RH,
BGP_ROUTE_REDISTRIBUTE, NULL, /* RD not used for unicast */
- NULL, /* tag not used for unicast, EVPN neither */
+ NULL, /* tag not used for unicast, EVPN neither */
0, 0, NULL); /* EVPN not used */
bgp_attr_unintern(&iattr);
}
@@ -1732,7 +1730,8 @@ static int vncExportWithdrawTimer(struct thread *t)
NULL, /* attr, ignored */
family2afi(eti->node->p.family), SAFI_UNICAST, eti->type,
eti->subtype, NULL, /* RD not used for unicast */
- NULL, 0, NULL); /* tag not used for unicast, EVPN neither */
+ NULL, 0,
+ NULL); /* tag not used for unicast, EVPN neither */
/*
* Free the eti
@@ -1855,9 +1854,8 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi)
prefix2str(&rn->p, prefixstr,
sizeof(prefixstr));
- vnc_zlog_debug_verbose(
- "%s: checking prefix %s", __func__,
- prefixstr);
+ vnc_zlog_debug_verbose("%s: checking prefix %s",
+ __func__, prefixstr);
}
/*
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index cfa4c599f..4f5416643 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -2557,7 +2557,7 @@ void vnc_import_bgp_exterior_del_route_interior(
if (bi->extra) {
prd = &bi->extra->vnc.import.rd;
label = decode_label(
- &bi->extra->label[0]);
+ &bi->extra->label[0]);
} else
prd = NULL;