bgpd: Remove #if 0 code

Remove all dead #if 0 code from bgpd.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-01-28 13:53:03 -05:00
parent 9a290f679a
commit 62e0464d73
8 changed files with 0 additions and 134 deletions

View File

@ -1420,19 +1420,6 @@ int bgp_stop(struct peer *peer)
peer->update_time = 0;
/* Until we are sure that there is no problem about prefix count
this should be commented out.*/
#if 0
/* Reset prefix count */
peer->pcount[AFI_IP][SAFI_UNICAST] = 0;
peer->pcount[AFI_IP][SAFI_MULTICAST] = 0;
peer->pcount[AFI_IP][SAFI_LABELED_UNICAST] = 0;
peer->pcount[AFI_IP][SAFI_MPLS_VPN] = 0;
peer->pcount[AFI_IP6][SAFI_UNICAST] = 0;
peer->pcount[AFI_IP6][SAFI_MULTICAST] = 0;
peer->pcount[AFI_IP6][SAFI_LABELED_UNICAST] = 0;
#endif /* 0 */
if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)
&& !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
peer_delete(peer);

View File

@ -2845,19 +2845,6 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
zlog_warn("PBR: Sample action Ignored");
}
}
#if 0
if (api->actions[i].u.za.filter
& TRAFFIC_ACTION_DISTRIBUTE) {
if (BGP_DEBUG(pbr, PBR)) {
bgp_pbr_print_policy_route(api);
zlog_warn("PBR: Distribute action Applies");
}
continue_loop = 0;
/* continue forwarding entry as before
* no action
*/
}
#endif /* XXX to confirm behaviour of traffic action. for now , ignore */
/* terminate action: run other filters
*/
break;

View File

@ -12314,22 +12314,6 @@ struct bgp_table_stats {
double total_space;
};
#if 0
#define TALLY_SIGFIG 100000
static unsigned long
ravg_tally (unsigned long count, unsigned long oldavg, unsigned long newval)
{
unsigned long newtot = (count-1) * oldavg + (newval * TALLY_SIGFIG);
unsigned long res = (newtot * TALLY_SIGFIG) / count;
unsigned long ret = newtot / count;
if ((res % TALLY_SIGFIG) > (TALLY_SIGFIG/2))
return ret + 1;
else
return ret;
}
#endif
static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
struct bgp_table_stats *ts, unsigned int space)
{
@ -12344,13 +12328,6 @@ static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
ts->counts[BGP_STATS_PREFIXES]++;
ts->counts[BGP_STATS_TOTPLEN] += rn_p->prefixlen;
#if 0
ts->counts[BGP_STATS_AVGPLEN]
= ravg_tally (ts->counts[BGP_STATS_PREFIXES],
ts->counts[BGP_STATS_AVGPLEN],
rn_p->prefixlen);
#endif
/* check if the prefix is included by any other announcements */
while (pdest && !bgp_dest_has_bgp_path_info_data(pdest))
pdest = bgp_dest_parent_nolock(pdest);
@ -12387,16 +12364,6 @@ static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top,
ts->counts[BGP_STATS_ASPATH_TOTHOPS] += hops;
ts->counts[BGP_STATS_ASPATH_TOTSIZE] += size;
#if 0
ts->counts[BGP_STATS_ASPATH_AVGHOPS]
= ravg_tally (ts->counts[BGP_STATS_ASPATH_COUNT],
ts->counts[BGP_STATS_ASPATH_AVGHOPS],
hops);
ts->counts[BGP_STATS_ASPATH_AVGSIZE]
= ravg_tally (ts->counts[BGP_STATS_ASPATH_COUNT],
ts->counts[BGP_STATS_ASPATH_AVGSIZE],
size);
#endif
if (highest > ts->counts[BGP_STATS_ASN_HIGHEST])
ts->counts[BGP_STATS_ASN_HIGHEST] = highest;
}
@ -12506,15 +12473,6 @@ static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
continue;
switch (i) {
#if 0
case BGP_STATS_ASPATH_AVGHOPS:
case BGP_STATS_ASPATH_AVGSIZE:
case BGP_STATS_AVGPLEN:
vty_out (vty, "%-30s: ", table_stats_strs[i]);
vty_out (vty, "%12.2f",
(float)ts.counts[i] / (float)TALLY_SIGFIG);
break;
#endif
case BGP_STATS_ASPATH_TOTHOPS:
case BGP_STATS_ASPATH_TOTSIZE:
if (!json) {

View File

@ -909,7 +909,6 @@ static void update_subgroup_add_peer(struct update_subgroup *subgrp,
bpacket_add_peer(pkt, paf);
bpacket_queue_sanity_check(SUBGRP_PKTQ(subgrp));
if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
zlog_debug("peer %s added to subgroup s%" PRIu64,
paf->peer->host, subgrp->id);
@ -1229,8 +1228,6 @@ static int update_subgroup_copy_packets(struct update_subgroup *dest,
pkt = bpacket_next(pkt);
}
bpacket_queue_sanity_check(SUBGRP_PKTQ(dest));
return count;
}

View File

@ -109,12 +109,6 @@ struct bpacket {
struct bpacket_queue {
TAILQ_HEAD(pkt_queue, bpacket) pkts;
#if 0
/* A dummy packet that is used to thread all peers that have
completed their work */
struct bpacket sentinel;
#endif
unsigned int conf_max_count;
unsigned int curr_count;
unsigned int hwm_count;

View File

@ -87,39 +87,6 @@ void bpacket_queue_init(struct bpacket_queue *q)
TAILQ_INIT(&(q->pkts));
}
/*
* bpacket_queue_sanity_check
*/
void bpacket_queue_sanity_check(struct bpacket_queue __attribute__((__unused__))
* q)
{
#if 0
struct bpacket *pkt;
pkt = bpacket_queue_last (q);
assert (pkt);
assert (!pkt->buffer);
/*
* Make sure the count of packets is correct.
*/
int num_pkts = 0;
pkt = bpacket_queue_first (q);
while (pkt)
{
num_pkts++;
if (num_pkts > q->curr_count)
assert (0);
pkt = TAILQ_NEXT (pkt, pkt_train);
}
assert (num_pkts == q->curr_count);
#endif
}
/*
* bpacket_queue_add_packet
*
@ -168,7 +135,6 @@ struct bpacket *bpacket_queue_add(struct bpacket_queue *q, struct stream *s,
else
bpacket_attr_vec_arr_reset(&pkt->arr);
bpacket_queue_add_packet(q, pkt);
bpacket_queue_sanity_check(q);
return pkt;
}
@ -176,7 +142,6 @@ struct bpacket *bpacket_queue_add(struct bpacket_queue *q, struct stream *s,
* Fill in the new information into the current sentinel and create a
* new sentinel.
*/
bpacket_queue_sanity_check(q);
last_pkt = bpacket_queue_last(q);
assert(last_pkt->buffer == NULL);
last_pkt->buffer = s;
@ -190,7 +155,6 @@ struct bpacket *bpacket_queue_add(struct bpacket_queue *q, struct stream *s,
pkt->ver++;
bpacket_queue_add_packet(q, pkt);
bpacket_queue_sanity_check(q);
return last_pkt;
}
@ -290,7 +254,6 @@ static int bpacket_queue_compact(struct bpacket_queue *q)
num_deleted++;
}
bpacket_queue_sanity_check(q);
return num_deleted;
}

View File

@ -578,9 +578,6 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct bgp_attr_encap_subtlv *encaptlv;
char buf[PREFIX_STRLEN];
char buf2[RD_ADDRSTRLEN];
#if 0 /* unused? */
struct prefix pfx_buf;
#endif
struct rfapi_nexthop *lnh = NULL; /* local nexthop */
struct rfapi_vn_option *vo;
@ -603,20 +600,6 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
return;
}
#if 0 /* unused? */
if ((safi == SAFI_MPLS_VPN) && (flags & RFAPI_AHR_SET_PFX_TO_NEXTHOP))
{
if (rfapiRaddr2Qprefix (nexthop, &pfx_buf))
{
vnc_zlog_debug_verbose
("%s: can't set pfx to vn addr, not adding SAFI_MPLS_VPN route",
__func__);
return;
}
p = &pfx_buf;
}
#endif
for (vo = options_vn; vo; vo = vo->next) {
if (RFAPI_VN_OPTION_TYPE_L2ADDR == vo->type) {
l2o = &vo->v.l2addr;

View File

@ -289,9 +289,6 @@ add_vnc_route(struct rfapi_descriptor *rfd, /* cookie + UN addr for VPN */
uint8_t type, uint8_t sub_type, int flags);
#define RFAPI_AHR_NO_TUNNEL_SUBTLV 0x00000001
#define RFAPI_AHR_RFPOPT_IS_VNCTLV 0x00000002 /* hack! */
#if 0 /* unused? */
# define RFAPI_AHR_SET_PFX_TO_NEXTHOP 0x00000004
#endif
extern void del_vnc_route(struct rfapi_descriptor *rfd, struct peer *peer,
struct bgp *bgp, safi_t safi, const struct prefix *p,