diff options
author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2022-01-27 08:51:59 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2022-02-01 12:31:16 +0100 |
commit | be92fc9f1aae0f59e3d9f35bf9a557180b8ee7c6 (patch) | |
tree | 6cce785cde9a740ab1432119c9054e4f88e3288e /bgpd/bgp_dump.c | |
parent | build: FRR 8.3 development version (diff) | |
download | frr-be92fc9f1aae0f59e3d9f35bf9a557180b8ee7c6.tar.xz frr-be92fc9f1aae0f59e3d9f35bf9a557180b8ee7c6.zip |
bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int
Rename addpath_encode[d] to addpath_capable to be consistent.
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'bgpd/bgp_dump.c')
-rw-r--r-- | bgpd/bgp_dump.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 2f0b87aa3..9ddfe7bb5 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -298,14 +298,6 @@ static void bgp_dump_routes_index_table(struct bgp *bgp) fflush(bgp_dump_routes.fp); } -static int bgp_addpath_encode_rx(struct peer *peer, afi_t afi, safi_t safi) -{ - - return (CHECK_FLAG(peer->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) - && CHECK_FLAG(peer->af_cap[afi][safi], - PEER_CAP_ADDPATH_AF_TX_RCV)); -} - static struct bgp_path_info * bgp_dump_route_node_record(int afi, struct bgp_dest *dest, struct bgp_path_info *path, unsigned int seq) @@ -313,16 +305,16 @@ bgp_dump_route_node_record(int afi, struct bgp_dest *dest, struct stream *obuf; size_t sizep; size_t endp; - int addpath_encoded; + bool addpath_capable; const struct prefix *p = bgp_dest_get_prefix(dest); obuf = bgp_dump_obuf; stream_reset(obuf); - addpath_encoded = bgp_addpath_encode_rx(path->peer, afi, SAFI_UNICAST); + addpath_capable = bgp_addpath_encode_rx(path->peer, afi, SAFI_UNICAST); /* MRT header */ - if (afi == AFI_IP && addpath_encoded) + if (afi == AFI_IP && addpath_capable) bgp_dump_header(obuf, MSG_TABLE_DUMP_V2, TABLE_DUMP_V2_RIB_IPV4_UNICAST_ADDPATH, BGP_DUMP_ROUTES); @@ -330,7 +322,7 @@ bgp_dump_route_node_record(int afi, struct bgp_dest *dest, bgp_dump_header(obuf, MSG_TABLE_DUMP_V2, TABLE_DUMP_V2_RIB_IPV4_UNICAST, BGP_DUMP_ROUTES); - else if (afi == AFI_IP6 && addpath_encoded) + else if (afi == AFI_IP6 && addpath_capable) bgp_dump_header(obuf, MSG_TABLE_DUMP_V2, TABLE_DUMP_V2_RIB_IPV6_UNICAST_ADDPATH, BGP_DUMP_ROUTES); @@ -378,7 +370,7 @@ bgp_dump_route_node_record(int afi, struct bgp_dest *dest, stream_putl(obuf, time(NULL) - (bgp_clock() - path->uptime)); /*Path Identifier*/ - if (addpath_encoded) { + if (addpath_capable) { stream_putl(obuf, path->addpath_rx_id); } @@ -549,15 +541,15 @@ static void bgp_dump_packet_func(struct bgp_dump *bgp_dump, struct peer *peer, struct stream *packet) { struct stream *obuf; - int addpath_encoded = 0; + bool addpath_capable = false; /* If dump file pointer is disabled return immediately. */ if (bgp_dump->fp == NULL) return; if (peer->su.sa.sa_family == AF_INET) { - addpath_encoded = + addpath_capable = bgp_addpath_encode_rx(peer, AFI_IP, SAFI_UNICAST); } else if (peer->su.sa.sa_family == AF_INET6) { - addpath_encoded = + addpath_capable = bgp_addpath_encode_rx(peer, AFI_IP6, SAFI_UNICAST); } @@ -566,13 +558,13 @@ static void bgp_dump_packet_func(struct bgp_dump *bgp_dump, struct peer *peer, stream_reset(obuf); /* Dump header and common part. */ - if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && addpath_encoded) { + if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && addpath_capable) { bgp_dump_header(obuf, MSG_PROTOCOL_BGP4MP, BGP4MP_MESSAGE_AS4_ADDPATH, bgp_dump->type); } else if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV)) { bgp_dump_header(obuf, MSG_PROTOCOL_BGP4MP, BGP4MP_MESSAGE_AS4, bgp_dump->type); - } else if (addpath_encoded) { + } else if (addpath_capable) { bgp_dump_header(obuf, MSG_PROTOCOL_BGP4MP, BGP4MP_MESSAGE_ADDPATH, bgp_dump->type); } else { |