diff options
Diffstat (limited to 'bgpd')
37 files changed, 476 insertions, 392 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 4e55c5f26..1e68c7d53 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -878,8 +878,9 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit) * The general assumption here is that many things tested will * never happen. And, in real live, up to now, they have not. */ - while (seg && (ASSEGMENT_LEN(seg, use32bit) - <= STREAM_WRITEABLE(s))) { + while (seg + && (ASSEGMENT_LEN(seg, use32bit) + <= STREAM_WRITEABLE(s))) { struct assegment *next = seg->next; int written = 0; int asns_packed = 0; @@ -1584,12 +1585,14 @@ int aspath_cmp_left(const struct aspath *aspath1, const struct aspath *aspath2) return 1; /* find first non-confed segments for each */ - while (seg1 && ((seg1->type == AS_CONFED_SEQUENCE) - || (seg1->type == AS_CONFED_SET))) + while (seg1 + && ((seg1->type == AS_CONFED_SEQUENCE) + || (seg1->type == AS_CONFED_SET))) seg1 = seg1->next; - while (seg2 && ((seg2->type == AS_CONFED_SEQUENCE) - || (seg2->type == AS_CONFED_SET))) + while (seg2 + && ((seg2->type == AS_CONFED_SEQUENCE) + || (seg2->type == AS_CONFED_SET))) seg2 = seg2->next; /* Check as1's */ @@ -2066,7 +2069,8 @@ static void aspath_show_all_iterator(struct hash_backet *backet, `show [ip] bgp paths' command. */ void aspath_print_all_vty(struct vty *vty) { - hash_iterate(ashash, (void (*)(struct hash_backet *, - void *))aspath_show_all_iterator, + hash_iterate(ashash, + (void (*)(struct hash_backet *, + void *))aspath_show_all_iterator, vty); } diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 79d215f1b..508deb1d3 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -82,15 +82,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; @@ -680,9 +679,10 @@ static void attr_show_all_iterator(struct hash_backet *backet, struct vty *vty) void attr_show_all(struct vty *vty) { - hash_iterate(attrhash, (void (*)(struct hash_backet *, - void *))attr_show_all_iterator, - vty); + hash_iterate( + attrhash, + (void (*)(struct hash_backet *, void *))attr_show_all_iterator, + vty); } static void *bgp_attr_hash_alloc(void *p) @@ -1055,7 +1055,7 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, u_char subcode, static void bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, u_int8_t desired_flags /* how RFC says it must be */ - ) +) { u_char seen = 0, i; u_char real_flags = args->flags; @@ -1087,30 +1087,26 @@ bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args, * as will PARTIAL for optional+transitive attributes. */ const u_int8_t attr_flags_values[] = { - [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AGGREGATOR] = - BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_COMMUNITIES] = - BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, - [BGP_ATTR_EXT_COMMUNITIES] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AS4_PATH] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_AS4_AGGREGATOR] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_LARGE_COMMUNITIES] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, - [BGP_ATTR_PREFIX_SID] = - BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_ORIGIN] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AS_PATH] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_NEXT_HOP] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_MULTI_EXIT_DISC] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_LOCAL_PREF] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_ATOMIC_AGGREGATE] = BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AGGREGATOR] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_COMMUNITIES] = BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_ORIGINATOR_ID] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_CLUSTER_LIST] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_MP_REACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_MP_UNREACH_NLRI] = BGP_ATTR_FLAG_OPTIONAL, + [BGP_ATTR_EXT_COMMUNITIES] = + BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AS4_PATH] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_AS4_AGGREGATOR] = + BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_LARGE_COMMUNITIES] = + BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, + [BGP_ATTR_PREFIX_SID] = BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS, }; static const size_t attr_flags_values_max = array_size(attr_flags_values) - 1; @@ -2755,9 +2751,10 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer, struct bgp_attr_encap_subtlv *st; const char *attrname; - if (!attr || (attrtype == BGP_ATTR_ENCAP - && (!attr->encap_tunneltype - || attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS))) + if (!attr + || (attrtype == BGP_ATTR_ENCAP + && (!attr->encap_tunneltype + || attr->encap_tunneltype == BGP_ENCAP_TYPE_MPLS))) return; switch (attrtype) { @@ -2804,9 +2801,8 @@ 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 { @@ -3044,15 +3040,14 @@ 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); } @@ -3066,15 +3061,14 @@ 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 (attr->lcommunity->size * 12 > 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, attr->lcommunity->size * 12); } 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, attr->lcommunity->size * 12); } @@ -3126,16 +3120,14 @@ 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); } @@ -3201,9 +3193,8 @@ 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); @@ -3231,9 +3222,8 @@ 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); @@ -3418,15 +3408,14 @@ 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); } @@ -3436,15 +3425,14 @@ 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 (attr->lcommunity->size * 12 > 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, attr->lcommunity->size * 12); } 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, attr->lcommunity->size * 12); } @@ -3489,9 +3477,8 @@ 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 324813c08..c9f0d6f4e 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -220,7 +220,7 @@ typedef enum { BGP_ATTR_PARSE_WITHDRAW = -2, /* only used internally, send notify + convert to BGP_ATTR_PARSE_ERROR - */ + */ BGP_ATTR_PARSE_ERROR_NOTIFYPLS = -3, } bgp_attr_parse_ret_t; diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 2e277bfa5..9b5202ff9 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -212,8 +212,9 @@ static void bgp_bfd_update_type(struct peer *peer) if ((multihop && !CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_TYPE_MULTIHOP)) - || (!multihop && CHECK_FLAG(bfd_info->flags, - BFD_FLAG_BFD_TYPE_MULTIHOP))) { + || (!multihop + && CHECK_FLAG(bfd_info->flags, + BFD_FLAG_BFD_TYPE_MULTIHOP))) { bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER); bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_REGISTER); } diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c index 4faebb538..e29f72b74 100644 --- a/bgpd/bgp_btoa.c +++ b/bgpd/bgp_btoa.c @@ -36,7 +36,9 @@ /* privileges */ static zebra_capabilities_t _caps_p[] = { - ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN, + ZCAP_BIND, + ZCAP_NET_RAW, + ZCAP_NET_ADMIN, }; struct zebra_privs_t bgpd_privs = { diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index bd3ae27c0..e3ab94379 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -369,10 +369,9 @@ static void bgp_damp_parameter_set(int hlife, int reuse, int sup, int maxsup) /* Initialize params per bgp_damp_config. */ damp->reuse_index_size = REUSE_ARRAY_SIZE; - damp->ceiling = - (int)(damp->reuse_limit * (pow(2, - (double)damp->max_suppress_time - / damp->half_life))); + damp->ceiling = (int)(damp->reuse_limit + * (pow(2, (double)damp->max_suppress_time + / damp->half_life))); /* Decay-array computations */ damp->decay_array_size = @@ -414,9 +413,11 @@ static void bgp_damp_parameter_set(int hlife, int reuse, int sup, int maxsup) for (i = 0; i < damp->reuse_index_size; i++) { damp->reuse_index[i] = (int)(((double)damp->half_life / DELTA_REUSE) - * log10(1.0 / (damp->reuse_limit - * (1.0 + ((double)i - / damp->scale_factor)))) + * log10(1.0 + / (damp->reuse_limit + * (1.0 + + ((double)i + / damp->scale_factor)))) / log10(0.5)); } } diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 083136906..d1d06f36b 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -244,9 +244,8 @@ static void bgp_dump_routes_index_table(struct bgp *bgp) /* Populate fake peer at index 0, for locally originated routes */ /* Peer type (IPv4) */ - stream_putc(obuf, - TABLE_DUMP_V2_PEER_INDEX_TABLE_AS4 - + TABLE_DUMP_V2_PEER_INDEX_TABLE_IP); + stream_putc(obuf, TABLE_DUMP_V2_PEER_INDEX_TABLE_AS4 + + TABLE_DUMP_V2_PEER_INDEX_TABLE_IP); /* Peer BGP ID (0.0.0.0) */ stream_putl(obuf, 0); /* Peer IP address (0.0.0.0) */ diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index f0081e6d0..4d1e690f9 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2718,9 +2718,10 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, */ void bgp_evpn_cleanup_on_disable(struct bgp *bgp) { - hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *, - void *))cleanup_vni_on_disable, - bgp); + hash_iterate( + bgp->vnihash, + (void (*)(struct hash_backet *, void *))cleanup_vni_on_disable, + bgp); } /* @@ -2730,9 +2731,10 @@ void bgp_evpn_cleanup_on_disable(struct bgp *bgp) void bgp_evpn_cleanup(struct bgp *bgp) { if (bgp->vnihash) - hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *, - void *))free_vni_entry, - bgp); + hash_iterate( + bgp->vnihash, + (void (*)(struct hash_backet *, void *))free_vni_entry, + bgp); if (bgp->import_rt_hash) hash_free(bgp->import_rt_hash); bgp->import_rt_hash = NULL; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 4b39ee862..0e16fa2ea 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -1301,9 +1301,10 @@ static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp, wctx.bgp = bgp; wctx.vty = vty; wctx.vtep_ip = vtep_ip; - hash_iterate(bgp->vnihash, (void (*)(struct hash_backet *, - void *))show_vni_routes_hash, - &wctx); + hash_iterate( + bgp->vnihash, + (void (*)(struct hash_backet *, void *))show_vni_routes_hash, + &wctx); } /* diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index cf1cb1868..8275f3e89 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1394,9 +1394,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_label.c b/bgpd/bgp_label.c index ad7411990..88c77d978 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -283,7 +283,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr, * an error SHOULD * be logged locally, and the prefix SHOULD be * ignored. - */ + */ zlog_err( "%s: IPv4 labeled-unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntoa(p.u.prefix4)); diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 25a562ed6..319d28f3f 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -101,7 +101,9 @@ static int retain_mode = 0; /* privileges */ static zebra_capabilities_t _caps_p[] = { - ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN, + ZCAP_BIND, + ZCAP_NET_RAW, + ZCAP_NET_ADMIN, }; struct zebra_privs_t bgpd_privs = { diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 6dc6dc676..a9346582b 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -675,8 +675,9 @@ void bgp_info_mpath_aggregate_update(struct bgp_info *new_best, bgp_attr_dup(&attr, new_best->attr); - if (new_best->peer && bgp_flag_check(new_best->peer->bgp, - BGP_FLAG_MULTIPATH_RELAX_AS_SET)) { + if (new_best->peer + && bgp_flag_check(new_best->peer->bgp, + BGP_FLAG_MULTIPATH_RELAX_AS_SET)) { /* aggregate attribute from multipath constituents */ aspath = aspath_dup(attr.aspath); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5d2966d1a..d56d62e6b 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -612,8 +612,9 @@ int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd, if (use_json) { json_object_object_add(json, "routes", json_nroute); - 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 (output_count == 0) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 70299ea45..9c1386920 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -158,8 +158,9 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (ret) { zlog_err( "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", - __func__, inet_ntop(AF_INET, &peer->remote_id, - buf, sizeof(buf)), + __func__, + inet_ntop(AF_INET, &peer->remote_id, buf, + sizeof(buf)), errno); return ret; } @@ -172,8 +173,9 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (ret) { zlog_err( "%s: Can't set TxTTL on peer (rtrid %s) socket, err = %d", - __func__, inet_ntop(AF_INET, &peer->remote_id, - buf, sizeof(buf)), + __func__, + inet_ntop(AF_INET, &peer->remote_id, buf, + sizeof(buf)), errno); return ret; } @@ -182,8 +184,9 @@ int bgp_set_socket_ttl(struct peer *peer, int bgp_sock) if (ret) { zlog_err( "%s: Can't set MinTTL on peer (rtrid %s) socket, err = %d", - __func__, inet_ntop(AF_INET, &peer->remote_id, - buf, sizeof(buf)), + __func__, + inet_ntop(AF_INET, &peer->remote_id, buf, + sizeof(buf)), errno); return ret; } diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index b18a4b7c4..d31e54c67 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -744,18 +744,18 @@ static const struct message capcode_str[] = { /* Minimum sizes for length field of each cap (so not inc. the header) */ static const size_t cap_minsizes[] = { - [CAPABILITY_CODE_MP] = CAPABILITY_CODE_MP_LEN, - [CAPABILITY_CODE_REFRESH] = CAPABILITY_CODE_REFRESH_LEN, - [CAPABILITY_CODE_ORF] = CAPABILITY_CODE_ORF_LEN, - [CAPABILITY_CODE_RESTART] = CAPABILITY_CODE_RESTART_LEN, - [CAPABILITY_CODE_AS4] = CAPABILITY_CODE_AS4_LEN, - [CAPABILITY_CODE_ADDPATH] = CAPABILITY_CODE_ADDPATH_LEN, - [CAPABILITY_CODE_DYNAMIC] = CAPABILITY_CODE_DYNAMIC_LEN, - [CAPABILITY_CODE_DYNAMIC_OLD] = CAPABILITY_CODE_DYNAMIC_LEN, - [CAPABILITY_CODE_ENHE] = CAPABILITY_CODE_ENHE_LEN, - [CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN, - [CAPABILITY_CODE_ORF_OLD] = CAPABILITY_CODE_ORF_LEN, - [CAPABILITY_CODE_FQDN] = CAPABILITY_CODE_MIN_FQDN_LEN, + [CAPABILITY_CODE_MP] = CAPABILITY_CODE_MP_LEN, + [CAPABILITY_CODE_REFRESH] = CAPABILITY_CODE_REFRESH_LEN, + [CAPABILITY_CODE_ORF] = CAPABILITY_CODE_ORF_LEN, + [CAPABILITY_CODE_RESTART] = CAPABILITY_CODE_RESTART_LEN, + [CAPABILITY_CODE_AS4] = CAPABILITY_CODE_AS4_LEN, + [CAPABILITY_CODE_ADDPATH] = CAPABILITY_CODE_ADDPATH_LEN, + [CAPABILITY_CODE_DYNAMIC] = CAPABILITY_CODE_DYNAMIC_LEN, + [CAPABILITY_CODE_DYNAMIC_OLD] = CAPABILITY_CODE_DYNAMIC_LEN, + [CAPABILITY_CODE_ENHE] = CAPABILITY_CODE_ENHE_LEN, + [CAPABILITY_CODE_REFRESH_OLD] = CAPABILITY_CODE_REFRESH_LEN, + [CAPABILITY_CODE_ORF_OLD] = CAPABILITY_CODE_ORF_LEN, + [CAPABILITY_CODE_FQDN] = CAPABILITY_CODE_MIN_FQDN_LEN, }; /* value the capability must be a multiple of. @@ -764,18 +764,12 @@ static const size_t cap_minsizes[] = { * table should be set to 1. */ static const size_t cap_modsizes[] = { - [CAPABILITY_CODE_MP] = 4, - [CAPABILITY_CODE_REFRESH] = 1, - [CAPABILITY_CODE_ORF] = 1, - [CAPABILITY_CODE_RESTART] = 1, - [CAPABILITY_CODE_AS4] = 4, - [CAPABILITY_CODE_ADDPATH] = 4, - [CAPABILITY_CODE_DYNAMIC] = 1, - [CAPABILITY_CODE_DYNAMIC_OLD] = 1, - [CAPABILITY_CODE_ENHE] = 6, - [CAPABILITY_CODE_REFRESH_OLD] = 1, - [CAPABILITY_CODE_ORF_OLD] = 1, - [CAPABILITY_CODE_FQDN] = 1, + [CAPABILITY_CODE_MP] = 4, [CAPABILITY_CODE_REFRESH] = 1, + [CAPABILITY_CODE_ORF] = 1, [CAPABILITY_CODE_RESTART] = 1, + [CAPABILITY_CODE_AS4] = 4, [CAPABILITY_CODE_ADDPATH] = 4, + [CAPABILITY_CODE_DYNAMIC] = 1, [CAPABILITY_CODE_DYNAMIC_OLD] = 1, + [CAPABILITY_CODE_ENHE] = 6, [CAPABILITY_CODE_REFRESH_OLD] = 1, + [CAPABILITY_CODE_ORF_OLD] = 1, [CAPABILITY_CODE_FQDN] = 1, }; /** @@ -1315,9 +1309,8 @@ void bgp_open_capability(struct stream *s, struct peer *peer) */ SET_FLAG(peer->cap, PEER_CAP_ENHE_ADV); stream_putc(s, BGP_OPEN_OPT_CAP); - stream_putc(s, - CAPABILITY_CODE_ENHE_LEN - + 2); + stream_putc(s, CAPABILITY_CODE_ENHE_LEN + + 2); stream_putc(s, CAPABILITY_CODE_ENHE); stream_putc(s, CAPABILITY_CODE_ENHE_LEN); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 2860113d1..30b85d25c 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -547,9 +547,8 @@ void bgp_open_send(struct peer *peer) /* Set open packet values. */ stream_putc(s, BGP_VERSION_4); /* BGP version */ - stream_putw(s, - (local_as <= BGP_AS_MAX) ? (u_int16_t)local_as - : BGP_AS_TRANS); + stream_putw(s, (local_as <= BGP_AS_MAX) ? (u_int16_t)local_as + : BGP_AS_TRANS); stream_putw(s, send_holdtime); /* Hold Time */ stream_put_in_addr(s, &peer->local_id); /* BGP Identifier */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 38ad7a6e0..1c1c95525 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1916,8 +1916,9 @@ 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)); @@ -3868,7 +3869,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, * an error SHOULD * be logged locally, and the prefix SHOULD be * ignored. - */ + */ zlog_err( "%s: IPv4 unicast NLRI is multicast address %s, ignoring", peer->host, inet_ntoa(p.u.prefix4)); @@ -5209,14 +5210,16 @@ DEFUN (no_bgp_network_mask_natural, } ALIAS(no_bgp_network, no_bgp_network_label_index_cmd, - "no network A.B.C.D/M label-index (0-1048560)", NO_STR + "no network A.B.C.D/M label-index (0-1048560)", + NO_STR "Specify a network to announce via BGP\n" "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" "Label index to associate with the prefix\n" "Label index value\n") ALIAS(no_bgp_network, no_bgp_network_label_index_route_map_cmd, - "no network A.B.C.D/M label-index (0-1048560) route-map WORD", NO_STR + "no network A.B.C.D/M label-index (0-1048560) route-map WORD", + NO_STR "Specify a network to announce via BGP\n" "IP prefix\n" "Label index to associate with the prefix\n" @@ -5298,14 +5301,16 @@ DEFUN (no_ipv6_bgp_network, } ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_cmd, - "no network X:X::X:X/M label-index (0-1048560)", NO_STR + "no network X:X::X:X/M label-index (0-1048560)", + NO_STR "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>\n" "Label index to associate with the prefix\n" "Label index value\n") ALIAS(no_ipv6_bgp_network, no_ipv6_bgp_network_label_index_route_map_cmd, - "no network X:X::X:X/M label-index (0-1048560) route-map WORD", NO_STR + "no network X:X::X:X/M label-index (0-1048560) route-map WORD", + NO_STR "Specify a network to announce via BGP\n" "IPv6 prefix\n" "Label index to associate with the prefix\n" @@ -6505,11 +6510,10 @@ void route_vty_out(struct vty *vty, struct prefix *p, struct bgp_info *binfo, len = vty_out( vty, "%s", binfo->peer->conf_if); - len = - 7 - len; /* len of IPv6 - addr + max - len of def - ifname */ + len = 7 - len; /* len of IPv6 + addr + max + len of def + ifname */ if (len < 1) vty_out(vty, "\n%*s", @@ -6996,9 +7000,10 @@ 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; @@ -7077,8 +7082,9 @@ 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)) { @@ -8598,8 +8604,9 @@ 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) { @@ -9269,21 +9276,20 @@ enum bgp_stats { }; static const char *table_stats_strs[] = { - [BGP_STATS_PREFIXES] = "Total Prefixes", - [BGP_STATS_TOTPLEN] = "Average prefix length", - [BGP_STATS_RIB] = "Total Advertisements", - [BGP_STATS_UNAGGREGATEABLE] = "Unaggregateable prefixes", - [BGP_STATS_MAX_AGGREGATEABLE] = - "Maximum aggregateable prefixes", - [BGP_STATS_AGGREGATES] = "BGP Aggregate advertisements", - [BGP_STATS_SPACE] = "Address space advertised", - [BGP_STATS_ASPATH_COUNT] = "Advertisements with paths", - [BGP_STATS_ASPATH_MAXHOPS] = "Longest AS-Path (hops)", - [BGP_STATS_ASPATH_MAXSIZE] = "Largest AS-Path (bytes)", - [BGP_STATS_ASPATH_TOTHOPS] = "Average AS-Path length (hops)", - [BGP_STATS_ASPATH_TOTSIZE] = "Average AS-Path size (bytes)", - [BGP_STATS_ASN_HIGHEST] = "Highest public ASN", - [BGP_STATS_MAX] = NULL, + [BGP_STATS_PREFIXES] = "Total Prefixes", + [BGP_STATS_TOTPLEN] = "Average prefix length", + [BGP_STATS_RIB] = "Total Advertisements", + [BGP_STATS_UNAGGREGATEABLE] = "Unaggregateable prefixes", + [BGP_STATS_MAX_AGGREGATEABLE] = "Maximum aggregateable prefixes", + [BGP_STATS_AGGREGATES] = "BGP Aggregate advertisements", + [BGP_STATS_SPACE] = "Address space advertised", + [BGP_STATS_ASPATH_COUNT] = "Advertisements with paths", + [BGP_STATS_ASPATH_MAXHOPS] = "Longest AS-Path (hops)", + [BGP_STATS_ASPATH_MAXSIZE] = "Largest AS-Path (bytes)", + [BGP_STATS_ASPATH_TOTHOPS] = "Average AS-Path length (hops)", + [BGP_STATS_ASPATH_TOTSIZE] = "Average AS-Path size (bytes)", + [BGP_STATS_ASN_HIGHEST] = "Highest public ASN", + [BGP_STATS_MAX] = NULL, }; struct bgp_table_stats { @@ -9518,16 +9524,11 @@ enum bgp_pcounts { }; static const char *pcount_strs[] = { - [PCOUNT_ADJ_IN] = "Adj-in", - [PCOUNT_DAMPED] = "Damped", - [PCOUNT_REMOVED] = "Removed", - [PCOUNT_HISTORY] = "History", - [PCOUNT_STALE] = "Stale", - [PCOUNT_VALID] = "Valid", - [PCOUNT_ALL] = "All RIB", - [PCOUNT_COUNTED] = "PfxCt counted", - [PCOUNT_PFCNT] = "Useable", - [PCOUNT_MAX] = NULL, + [PCOUNT_ADJ_IN] = "Adj-in", [PCOUNT_DAMPED] = "Damped", + [PCOUNT_REMOVED] = "Removed", [PCOUNT_HISTORY] = "History", + [PCOUNT_STALE] = "Stale", [PCOUNT_VALID] = "Valid", + [PCOUNT_ALL] = "All RIB", [PCOUNT_COUNTED] = "PfxCt counted", + [PCOUNT_PFCNT] = "Useable", [PCOUNT_MAX] = NULL, }; struct peer_pcounts { @@ -9628,9 +9629,9 @@ static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi, pcounts.table = peer->bgp->rib[afi][safi]; /* in-place call via thread subsystem so as to record execution time - * * stats for the thread-walk (i.e. ensure this can't be blamed on - * * on just vty_read()). - * */ + * * stats for the thread-walk (i.e. ensure this can't be blamed on + * * on just vty_read()). + * */ thread_execute(bm->master, bgp_peer_count_walker, &pcounts, 0); if (use_json) { @@ -9887,8 +9888,9 @@ 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); diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 1a1817bad..cb4c9a21e 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -97,10 +97,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 285bb9a80..8a9bd764e 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -652,7 +652,10 @@ static route_map_result_t route_match_metric(void *rule, struct prefix *prefix, /* Route map commands for metric matching. */ struct route_map_rule_cmd route_match_metric_cmd = { - "metric", route_match_metric, route_value_compile, route_value_free, + "metric", + route_match_metric, + route_value_compile, + route_value_free, }; /* `match as-path ASPATH' */ @@ -1047,7 +1050,9 @@ static route_map_result_t route_match_tag(void *rule, struct prefix *prefix, /* Route map commands for tag matching. */ static struct route_map_rule_cmd route_match_tag_cmd = { - "tag", route_match_tag, route_map_rule_tag_compile, + "tag", + route_match_tag, + route_map_rule_tag_compile, route_map_rule_tag_free, }; @@ -1192,7 +1197,9 @@ static route_map_result_t route_set_local_pref(void *rule, /* Set local preference rule structure. */ struct route_map_rule_cmd route_set_local_pref_cmd = { - "local-preference", route_set_local_pref, route_value_compile, + "local-preference", + route_set_local_pref, + route_value_compile, route_value_free, }; @@ -1221,7 +1228,10 @@ static route_map_result_t route_set_weight(void *rule, struct prefix *prefix, /* Set local preference rule structure. */ struct route_map_rule_cmd route_set_weight_cmd = { - "weight", route_set_weight, route_value_compile, route_value_free, + "weight", + route_set_weight, + route_value_compile, + route_value_free, }; /* `set metric METRIC' */ @@ -1253,7 +1263,10 @@ static route_map_result_t route_set_metric(void *rule, struct prefix *prefix, /* Set metric rule structure. */ struct route_map_rule_cmd route_set_metric_cmd = { - "metric", route_set_metric, route_value_compile, route_value_free, + "metric", + route_set_metric, + route_value_compile, + route_value_free, }; /* `set as-path prepend ASPATH' */ @@ -1311,8 +1324,10 @@ static void route_set_aspath_prepend_free(void *rule) /* Set as-path prepend rule structure. */ struct route_map_rule_cmd route_set_aspath_prepend_cmd = { - "as-path prepend", route_set_aspath_prepend, - route_set_aspath_prepend_compile, route_set_aspath_prepend_free, + "as-path prepend", + route_set_aspath_prepend, + route_set_aspath_prepend_compile, + route_set_aspath_prepend_free, }; /* `set as-path exclude ASn' */ @@ -1345,7 +1360,9 @@ static route_map_result_t route_set_aspath_exclude(void *rule, /* Set ASn exlude rule structure. */ struct route_map_rule_cmd route_set_aspath_exclude_cmd = { - "as-path exclude", route_set_aspath_exclude, route_aspath_compile, + "as-path exclude", + route_set_aspath_exclude, + route_aspath_compile, route_aspath_free, }; @@ -1458,7 +1475,9 @@ static void route_set_community_free(void *rule) /* Set community rule structure. */ struct route_map_rule_cmd route_set_community_cmd = { - "community", route_set_community, route_set_community_compile, + "community", + route_set_community, + route_set_community_compile, route_set_community_free, }; @@ -1576,7 +1595,9 @@ static void route_set_lcommunity_free(void *rule) /* Set community rule structure. */ struct route_map_rule_cmd route_set_lcommunity_cmd = { - "large-community", route_set_lcommunity, route_set_lcommunity_compile, + "large-community", + route_set_lcommunity, + route_set_lcommunity_compile, route_set_lcommunity_free, }; @@ -1659,8 +1680,10 @@ static void route_set_lcommunity_delete_free(void *rule) /* Set lcommunity rule structure. */ struct route_map_rule_cmd route_set_lcommunity_delete_cmd = { - "large-comm-list", route_set_lcommunity_delete, - route_set_lcommunity_delete_compile, route_set_lcommunity_delete_free, + "large-comm-list", + route_set_lcommunity_delete, + route_set_lcommunity_delete_compile, + route_set_lcommunity_delete_free, }; @@ -1743,8 +1766,10 @@ static void route_set_community_delete_free(void *rule) /* Set community rule structure. */ struct route_map_rule_cmd route_set_community_delete_cmd = { - "comm-list", route_set_community_delete, - route_set_community_delete_compile, route_set_community_delete_free, + "comm-list", + route_set_community_delete, + route_set_community_delete_compile, + route_set_community_delete_free, }; /* `set extcommunity rt COMMUNITY' */ @@ -1811,8 +1836,10 @@ static void route_set_ecommunity_free(void *rule) /* Set community rule structure. */ struct route_map_rule_cmd route_set_ecommunity_rt_cmd = { - "extcommunity rt", route_set_ecommunity, - route_set_ecommunity_rt_compile, route_set_ecommunity_free, + "extcommunity rt", + route_set_ecommunity, + route_set_ecommunity_rt_compile, + route_set_ecommunity_free, }; /* `set extcommunity soo COMMUNITY' */ @@ -1831,8 +1858,10 @@ static void *route_set_ecommunity_soo_compile(const char *arg) /* Set community rule structure. */ struct route_map_rule_cmd route_set_ecommunity_soo_cmd = { - "extcommunity soo", route_set_ecommunity, - route_set_ecommunity_soo_compile, route_set_ecommunity_free, + "extcommunity soo", + route_set_ecommunity, + route_set_ecommunity_soo_compile, + route_set_ecommunity_free, }; /* `set origin ORIGIN' */ @@ -1880,7 +1909,9 @@ static void route_set_origin_free(void *rule) /* Set origin rule structure. */ struct route_map_rule_cmd route_set_origin_cmd = { - "origin", route_set_origin, route_set_origin_compile, + "origin", + route_set_origin, + route_set_origin_compile, route_set_origin_free, }; @@ -1917,8 +1948,10 @@ static void route_set_atomic_aggregate_free(void *rule) /* Set atomic aggregate rule structure. */ struct route_map_rule_cmd route_set_atomic_aggregate_cmd = { - "atomic-aggregate", route_set_atomic_aggregate, - route_set_atomic_aggregate_compile, route_set_atomic_aggregate_free, + "atomic-aggregate", + route_set_atomic_aggregate, + route_set_atomic_aggregate_compile, + route_set_atomic_aggregate_free, }; /* `set aggregator as AS A.B.C.D' */ @@ -1973,8 +2006,10 @@ static void route_set_aggregator_as_free(void *rule) } struct route_map_rule_cmd route_set_aggregator_as_cmd = { - "aggregator as", route_set_aggregator_as, - route_set_aggregator_as_compile, route_set_aggregator_as_free, + "aggregator as", + route_set_aggregator_as, + route_set_aggregator_as_compile, + route_set_aggregator_as_free, }; /* Set tag to object. object must be pointer to struct bgp_info */ @@ -1997,7 +2032,9 @@ static route_map_result_t route_set_tag(void *rule, struct prefix *prefix, /* Route map commands for tag set. */ static struct route_map_rule_cmd route_set_tag_cmd = { - "tag", route_set_tag, route_map_rule_tag_compile, + "tag", + route_set_tag, + route_map_rule_tag_compile, route_map_rule_tag_free, }; @@ -2030,7 +2067,9 @@ static route_map_result_t route_set_label_index(void *rule, /* Route map commands for label-index set. */ static struct route_map_rule_cmd route_set_label_index_cmd = { - "label-index", route_set_label_index, route_value_compile, + "label-index", + route_set_label_index, + route_value_compile, route_value_free, }; @@ -2557,8 +2596,10 @@ static void route_set_originator_id_free(void *rule) /* Set originator-id rule structure. */ struct route_map_rule_cmd route_set_originator_id_cmd = { - "originator-id", route_set_originator_id, - route_set_originator_id_compile, route_set_originator_id_free, + "originator-id", + route_set_originator_id, + route_set_originator_id_compile, + route_set_originator_id_free, }; /* Add bgp route map rule. */ diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 8a9d61f30..50ced8164 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 77e615715..b791bc1a1 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1121,8 +1121,8 @@ int update_subgroup_check_merge(struct update_subgroup *subgrp, } /* -* update_subgroup_merge_check_thread_cb -*/ + * update_subgroup_merge_check_thread_cb + */ static int update_subgroup_merge_check_thread_cb(struct thread *thread) { struct update_subgroup *subgrp; diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index 52a21679b..d6c8055b6 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -267,7 +267,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 */ diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 0a33fa5ed..a0961d8ce 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -646,9 +646,10 @@ void subgroup_announce_route(struct update_subgroup *subgrp) */ onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer : NULL); - if (onlypeer && CHECK_FLAG(onlypeer->af_sflags[SUBGRP_AFI(subgrp)] - [SUBGRP_SAFI(subgrp)], - PEER_STATUS_ORF_WAIT_REFRESH)) + if (onlypeer + && CHECK_FLAG(onlypeer->af_sflags[SUBGRP_AFI(subgrp)] + [SUBGRP_SAFI(subgrp)], + PEER_STATUS_ORF_WAIT_REFRESH)) return; if (SUBGRP_SAFI(subgrp) != SAFI_MPLS_VPN diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index d7a4a3698..53d695167 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -732,8 +732,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 + bgp_packet_mpattr_prefix_size( - afi, safi, &rn->p); + space_needed = + BGP_NLRI_LENGTH + + 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) @@ -777,9 +778,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 + bgp_packet_mpattr_prefix_size( - afi, safi, &rn->p); + space_needed = BGP_NLRI_LENGTH + + 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_vpn.c b/bgpd/bgp_vpn.c index ca98ff066..c9baf5af3 100644 --- a/bgpd/bgp_vpn.c +++ b/bgpd/bgp_vpn.c @@ -242,8 +242,9 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer, } if (use_json) { json_object_object_add(json, "routes", json_routes); - 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); } return CMD_SUCCESS; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 8ae015173..353a3425a 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1470,7 +1470,8 @@ 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") @@ -6376,8 +6377,9 @@ 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) @@ -6471,17 +6473,20 @@ 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, @@ -6510,8 +6515,9 @@ 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; } @@ -6736,8 +6742,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, 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], @@ -6768,8 +6775,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, mtype_memstr( memstrbuf, sizeof(memstrbuf), - ents * sizeof(struct - bgp_node))); + ents + * sizeof(struct + bgp_node))); /* Peer related usage */ ents = listcount(bgp->peer); @@ -6779,8 +6787,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, mtype_memstr( memstrbuf, sizeof(memstrbuf), - ents * sizeof(struct - peer))); + ents + * sizeof(struct + peer))); if ((ents = listcount(bgp->group))) vty_out(vty, @@ -6789,8 +6798,9 @@ 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)) @@ -6908,8 +6918,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, vty_out(vty, "%*s", max_neighbor_width - len, " "); - vty_out(vty, "4 %10u %7d %7d %8" PRIu64 - " %4d %4zd %8s", + vty_out(vty, + "4 %10u %7d %7d %8" PRIu64 + " %4d %4zd %8s", peer->as, peer->open_in + peer->update_in + peer->keepalive_in @@ -6957,8 +6968,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, json_object_int_add(json, "totalPeers", count); json_object_int_add(json, "dynamicPeers", dn_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) @@ -7053,10 +7065,9 @@ static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi, } safi++; if (safi == SAFI_RESERVED_4 - || safi - == SAFI_RESERVED_5) /* handle special - cases to match - zebra.h */ + || safi == SAFI_RESERVED_5) /* handle special + cases to match + zebra.h */ safi++; if (!safi_wildcard) safi = SAFI_MAX; @@ -7615,8 +7626,9 @@ 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)); @@ -9382,8 +9394,9 @@ 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( @@ -9623,8 +9636,9 @@ 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"); @@ -11079,31 +11093,45 @@ int bgp_config_write_redistribute(struct vty *vty, struct bgp *bgp, afi_t afi, /* BGP node structure. */ static struct cmd_node bgp_node = { - BGP_NODE, "%s(config-router)# ", 1, + BGP_NODE, + "%s(config-router)# ", + 1, }; static struct cmd_node bgp_ipv4_unicast_node = { - BGP_IPV4_NODE, "%s(config-router-af)# ", 1, + BGP_IPV4_NODE, + "%s(config-router-af)# ", + 1, }; static struct cmd_node bgp_ipv4_multicast_node = { - BGP_IPV4M_NODE, "%s(config-router-af)# ", 1, + BGP_IPV4M_NODE, + "%s(config-router-af)# ", + 1, }; static struct cmd_node bgp_ipv4_labeled_unicast_node = { - BGP_IPV4L_NODE, "%s(config-router-af)# ", 1, + BGP_IPV4L_NODE, + "%s(config-router-af)# ", + 1, }; static struct cmd_node bgp_ipv6_unicast_node = { - BGP_IPV6_NODE, "%s(config-router-af)# ", 1, + BGP_IPV6_NODE, + "%s(config-router-af)# ", + 1, }; static struct cmd_node bgp_ipv6_multicast_node = { - BGP_IPV6M_NODE, "%s(config-router-af)# ", 1, + BGP_IPV6M_NODE, + "%s(config-router-af)# ", + 1, }; static struct cmd_node bgp_ipv6_labeled_unicast_node = { - BGP_IPV6L_NODE, "%s(config-router-af)# ", 1, + BGP_IPV6L_NODE, + "%s(config-router-af)# ", + 1, }; static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE, diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 8bf5477a6..be3c6eea3 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -621,10 +621,12 @@ static int zebra_read_ipv4(int command, struct zclient *zclient, zlog_debug( "Rx IPv4 route add VRF %u %s[%d] %s/%d nexthop %s metric %u tag %" ROUTE_TAG_PRI, vrf_id, zebra_route_string(api.type), - api.instance, inet_ntop(AF_INET, &p.prefix, - buf[0], sizeof(buf[0])), - p.prefixlen, inet_ntop(AF_INET, &nexthop, - buf[1], sizeof(buf[1])), + api.instance, + inet_ntop(AF_INET, &p.prefix, buf[0], + sizeof(buf[0])), + p.prefixlen, + inet_ntop(AF_INET, &nexthop, buf[1], + sizeof(buf[1])), api.metric, api.tag); } @@ -655,10 +657,12 @@ static int zebra_read_ipv4(int command, struct zclient *zclient, "Rx IPv4 route delete VRF %u %s[%d] %s/%d " "nexthop %s metric %u tag %" ROUTE_TAG_PRI, vrf_id, zebra_route_string(api.type), - api.instance, inet_ntop(AF_INET, &p.prefix, - buf[0], sizeof(buf[0])), - p.prefixlen, inet_ntop(AF_INET, &nexthop, - buf[1], sizeof(buf[1])), + api.instance, + inet_ntop(AF_INET, &p.prefix, buf[0], + sizeof(buf[0])), + p.prefixlen, + inet_ntop(AF_INET, &nexthop, buf[1], + sizeof(buf[1])), api.metric, api.tag); } bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type, @@ -748,10 +752,12 @@ static int zebra_read_ipv6(int command, struct zclient *zclient, zlog_debug( "Rx IPv6 route add VRF %u %s[%d] %s/%d nexthop %s metric %u tag %" ROUTE_TAG_PRI, vrf_id, zebra_route_string(api.type), - api.instance, inet_ntop(AF_INET6, &p.prefix, - buf[0], sizeof(buf[0])), - p.prefixlen, inet_ntop(AF_INET, &nexthop, - buf[1], sizeof(buf[1])), + api.instance, + inet_ntop(AF_INET6, &p.prefix, buf[0], + sizeof(buf[0])), + p.prefixlen, + inet_ntop(AF_INET, &nexthop, buf[1], + sizeof(buf[1])), api.metric, api.tag); } @@ -781,10 +787,12 @@ static int zebra_read_ipv6(int command, struct zclient *zclient, "Rx IPv6 route delete VRF %u %s[%d] %s/%d " "nexthop %s metric %u tag %" ROUTE_TAG_PRI, vrf_id, zebra_route_string(api.type), - api.instance, inet_ntop(AF_INET6, &p.prefix, - buf[0], sizeof(buf[0])), - p.prefixlen, inet_ntop(AF_INET6, &nexthop, - buf[1], sizeof(buf[1])), + api.instance, + inet_ntop(AF_INET6, &p.prefix, buf[0], + sizeof(buf[0])), + p.prefixlen, + inet_ntop(AF_INET6, &nexthop, buf[1], + sizeof(buf[1])), api.metric, api.tag); } bgp_redistribute_delete(bgp, (struct prefix *)&p, api.type, @@ -1316,8 +1324,9 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, "Tx IPv4 route %s VRF %u %s/%d metric %u tag %" ROUTE_TAG_PRI " count %d", (valid_nh_count ? "add" : "delete"), - bgp->vrf_id, inet_ntop(AF_INET, &p->u.prefix4, - buf[0], sizeof(buf[0])), + bgp->vrf_id, + inet_ntop(AF_INET, &p->u.prefix4, buf[0], + sizeof(buf[0])), p->prefixlen, api.metric, api.tag, api.nexthop_num); for (i = 0; i < api.nexthop_num; i++) { diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 3453da665..0c5b88d74 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3886,8 +3886,9 @@ 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; @@ -6757,8 +6758,9 @@ 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 @@ -6766,9 +6768,10 @@ 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))) { afi_header_vty_out( vty, afi, safi, write, " no neighbor %s send-community all\n", addr); @@ -6799,9 +6802,10 @@ 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))) { afi_header_vty_out( vty, afi, safi, write, " no neighbor %s send-community\n", diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 67b8289c7..c6c14420e 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -251,13 +251,14 @@ struct bgp { /* $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 + 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; diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 8a93d3984..ba4c703e9 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -503,9 +503,8 @@ DEFUN (vnc_defaults_responselifetime, } else { rspint = strtoul(argv[1]->arg, NULL, 10); if (rspint > INT32_MAX) - rspint = - INT32_MAX; /* is really an int, not an unsigned - int */ + rspint = INT32_MAX; /* is really an int, not an unsigned + int */ } bgp->rfapi_cfg->default_response_lifetime = rspint; @@ -1674,8 +1673,9 @@ DEFUN (vnc_nve_group_export_no_prefixlist, } if (argv[2]->arg[0] == 'b') { - if (((argc > 5) && strmatch(argv[5]->text, - rfg->plist_export_bgp_name[afi])) + if (((argc > 5) + && strmatch(argv[5]->text, + rfg->plist_export_bgp_name[afi])) || (argc <= 5)) { if (rfg->plist_export_bgp_name[afi]) @@ -1686,8 +1686,9 @@ DEFUN (vnc_nve_group_export_no_prefixlist, vnc_direct_bgp_reexport_group_afi(bgp, rfg, afi); } } else { - if (((argc > 5) && strmatch(argv[5]->text, - rfg->plist_export_zebra_name[afi])) + if (((argc > 5) + && strmatch(argv[5]->text, + rfg->plist_export_zebra_name[afi])) || (argc <= 5)) { if (rfg->plist_export_zebra_name[afi]) free(rfg->plist_export_zebra_name[afi]); @@ -1791,8 +1792,9 @@ DEFUN (vnc_nve_group_export_no_routemap, vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6); } } else { - if (((argc > 4) && strmatch(argv[4]->text, - rfg->routemap_export_zebra_name)) + if (((argc > 4) + && strmatch(argv[4]->text, + rfg->routemap_export_zebra_name)) || (argc <= 4)) { if (rfg->routemap_export_zebra_name) free(rfg->routemap_export_zebra_name); @@ -2445,8 +2447,9 @@ bgp_rfapi_delete_named_nve_group(struct vty *vty, /* NULL = no output */ */ for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_direct_bgp_l, node, rfgn)) { - if (rfg_name == NULL || (type == RFAPI_GROUP_CFG_NVE - && !strcmp(rfgn->name, rfg_name))) { + if (rfg_name == NULL + || (type == RFAPI_GROUP_CFG_NVE + && !strcmp(rfgn->name, rfg_name))) { rfgn->rfg = NULL; /* remove exported routes from this group */ vnc_direct_bgp_del_group(bgp, rfg); @@ -2460,8 +2463,9 @@ bgp_rfapi_delete_named_nve_group(struct vty *vty, /* NULL = no output */ for (ALL_LIST_ELEMENTS_RO(bgp->rfapi_cfg->rfg_export_zebra_l, node, rfgn)) { - if (rfg_name == NULL || (type == RFAPI_GROUP_CFG_NVE - && !strcmp(rfgn->name, rfg_name))) { + if (rfg_name == NULL + || (type == RFAPI_GROUP_CFG_NVE + && !strcmp(rfgn->name, rfg_name))) { rfgn->rfg = NULL; /* remove exported routes from this group */ vnc_zebra_del_group(bgp, rfg); diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 3a2a608a7..f80962112 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -2603,8 +2603,9 @@ int rfapi_register(void *handle, struct rfapi_ip_prefix *prefix, ZEBRA_ROUTE_BGP, BGP_ROUTE_RFP, NULL, action == RFAPI_REGISTER_KILL); - if (0 == rfapiApDelete(bgp, rfd, &p, pfx_mac, &prd, - &adv_tunnel)) { + if (0 + == rfapiApDelete(bgp, rfd, &p, pfx_mac, &prd, + &adv_tunnel)) { if (adv_tunnel) rfapiTunnelRouteAnnounce( bgp, rfd, &rfd->max_prefix_lifetime); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index d0379e1ef..d16d578ac 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -1,22 +1,22 @@ /* -* -* Copyright 2009-2016, LabN Consulting, L.L.C. -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; see the file COPYING; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + * + * Copyright 2009-2016, LabN Consulting, L.L.C. + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ /* * File: rfapi_import.c @@ -1086,9 +1086,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; @@ -2011,8 +2010,9 @@ static void rfapiBgpInfoAttachSorted(struct route_node *rn, for (prev = NULL, next = rn->info; next; prev = next, next = next->next) { - if (!bgp || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED) - && CHECK_FLAG(next->flags, BGP_INFO_REMOVED)) + if (!bgp + || (!CHECK_FLAG(info_new->flags, BGP_INFO_REMOVED) + && CHECK_FLAG(next->flags, BGP_INFO_REMOVED)) || bgp_info_cmp_compatible(bgp, info_new, next, pfx_buf, afi, safi) == -1) { /* -1 if 1st is better */ @@ -3554,9 +3554,10 @@ void rfapiBgpInfoFilteredImportVPN( vnc_zlog_debug_verbose( "%s: withdrawing at prefix %s/%d%s", - __func__, rfapi_ntop(rn->p.family, - &rn->p.u.prefix, - buf, BUFSIZ), + __func__, + rfapi_ntop(rn->p.family, + &rn->p.u.prefix, buf, + BUFSIZ), rn->p.prefixlen, (washolddown ? " (already being withdrawn)" @@ -4023,7 +4024,7 @@ void rfapiProcessWithdraw(struct peer *peer, void *rfd, struct prefix *p, p, /* aux_prefix: IP */ AFI_L2VPN, prd, attr, type, 0, NULL); /* sub_type & label unused for withdraw - */ + */ } } @@ -4310,9 +4311,8 @@ void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h) void *cursor; int rc; - for (cursor = NULL, - rc = skiplist_next(h->import_mac, NULL, (void **)&it, - &cursor); + for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL, + (void **)&it, &cursor); !rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it, &cursor)) { @@ -4711,9 +4711,8 @@ void rfapiDeleteRemotePrefixes(struct prefix *un, struct prefix *vn, void *cursor = NULL; int rc; - for (cursor = NULL, - rc = skiplist_next(h->import_mac, NULL, (void **)&it, - &cursor); + for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL, + (void **)&it, &cursor); !rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it, &cursor)) { @@ -4806,9 +4805,8 @@ void rfapiCountAllItRoutes(int *pALRcount, /* active local routes */ int rc; if (h->import_mac) { - for (cursor = NULL, - rc = skiplist_next(h->import_mac, NULL, (void **)&it, - &cursor); + for (cursor = NULL, rc = skiplist_next(h->import_mac, NULL, + (void **)&it, &cursor); !rc; rc = skiplist_next(h->import_mac, NULL, (void **)&it, &cursor)) { diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index 9c0d9da6f..5a1b29e59 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -1339,10 +1339,11 @@ struct route_node *rfapiMonitorEthAdd(struct bgp *bgp, { char buf[BUFSIZ]; - vnc_zlog_debug_verbose( - "%s: LNI=%d: rfd=%p, pfx=%s", __func__, logical_net_id, - rfd, rfapi_ntop(pfx_mac_buf.family, pfx_mac_buf.u.val, - buf, BUFSIZ)); + vnc_zlog_debug_verbose("%s: LNI=%d: rfd=%p, pfx=%s", __func__, + logical_net_id, rfd, + rfapi_ntop(pfx_mac_buf.family, + pfx_mac_buf.u.val, buf, + BUFSIZ)); } diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index a414df1ab..58da84ea3 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -527,11 +527,11 @@ void rfapiRibClear(struct rfapi_descriptor *rfd) struct rfapi_info *ri; - while (0 == skiplist_first( - (struct skiplist *) - rn->info, - NULL, - (void **)&ri)) { + while (0 + == skiplist_first( + (struct skiplist *) + rn->info, + NULL, (void **)&ri)) { rfapi_info_free(ri); skiplist_delete_first( @@ -2449,7 +2449,7 @@ void rfapiRibShowResponses(void *stream, struct prefix *pfx_match, #else "Remaining" #endif - ); + ); } if (!printednve) { char str_vn[BUFSIZ]; diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 117d4fbfd..0fab2e700 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -2009,7 +2009,7 @@ void vnc_import_bgp_exterior_del_route( bgp_info_unlock(info); route_unlock_node( rn); /* sl entry - */ + */ } if (skiplist_empty( RFAPI_MONITOR_EXTERIOR( diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 3075d4109..69529c722 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -375,8 +375,9 @@ static int vnc_zebra_read_ipv4(int command, struct zclient *zclient, __func__, zebra_route_string(api.type), inet_ntop(AF_INET, &p.prefix, buf[0], sizeof(buf[0])), - p.prefixlen, inet_ntop(AF_INET, &nexthop, - buf[1], sizeof(buf[1])), + p.prefixlen, + inet_ntop(AF_INET, &nexthop, buf[1], + sizeof(buf[1])), api.metric); } vnc_redistribute_add((struct prefix *)&p, &nexthop, api.metric, @@ -390,8 +391,9 @@ static int vnc_zebra_read_ipv4(int command, struct zclient *zclient, __func__, zebra_route_string(api.type), inet_ntop(AF_INET, &p.prefix, buf[0], sizeof(buf[0])), - p.prefixlen, inet_ntop(AF_INET, &nexthop, - buf[1], sizeof(buf[1])), + p.prefixlen, + inet_ntop(AF_INET, &nexthop, buf[1], + sizeof(buf[1])), api.metric); } vnc_redistribute_delete((struct prefix *)&p, api.type); |