Skip to content

Commit

Permalink
Merge pull request FRRouting#7974 from donaldsharp/more_if_zero
Browse files Browse the repository at this point in the history
More if zero
  • Loading branch information
ton31337 authored Jan 29, 2021
2 parents 79ea628 + 153bdb3 commit 6772501
Show file tree
Hide file tree
Showing 36 changed files with 1 addition and 1,123 deletions.
4 changes: 0 additions & 4 deletions bfdd/bfdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,6 @@ int main(int argc, char *argv[])
snprintf(ctl_path, sizeof(ctl_path), BFDD_CONTROL_SOCKET,
"/", bfdd_di.pathspace);

#if 0 /* TODO add support for JSON configuration files. */
parse_config(conf);
#endif

/* Initialize FRR infrastructure. */
master = frr_init();

Expand Down
13 changes: 0 additions & 13 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 0 additions & 13 deletions bgpd/bgp_pbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
42 changes: 0 additions & 42 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions bgpd/bgp_updgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 0 additions & 6 deletions bgpd/bgp_updgrp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 0 additions & 37 deletions bgpd/bgp_updgrp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -168,15 +135,13 @@ 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;
}

/*
* 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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -290,7 +254,6 @@ static int bpacket_queue_compact(struct bpacket_queue *q)
num_deleted++;
}

bpacket_queue_sanity_check(q);
return num_deleted;
}

Expand Down
17 changes: 0 additions & 17 deletions bgpd/rfapi/rfapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions bgpd/rfapi/rfapi_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
63 changes: 0 additions & 63 deletions eigrpd/eigrp_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,39 +124,6 @@ void eigrp_distribute_update(struct distribute_ctx *ctx,
} else
e->prefix[EIGRP_FILTER_OUT] = NULL;

// This is commented out, because the distribute.[ch] code
// changes looked poorly written from first glance
// commit was 133bdf2d
// TODO: DBS
#if 0
/* route-map IN for whole process */
if (dist->route[DISTRIBUTE_V4_IN])
{
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
if (routemap)
e->routemap[EIGRP_FILTER_IN] = routemap;
else
e->routemap[EIGRP_FILTER_IN] = NULL;
}
else
{
e->routemap[EIGRP_FILTER_IN] = NULL;
}

/* route-map OUT for whole process */
if (dist->route[DISTRIBUTE_V4_OUT])
{
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
if (routemap)
e->routemap[EIGRP_FILTER_OUT] = routemap;
else
e->routemap[EIGRP_FILTER_OUT] = NULL;
}
else
{
e->routemap[EIGRP_FILTER_OUT] = NULL;
}
#endif
// TODO: check Graceful restart after 10sec

/* cancel GR scheduled */
Expand Down Expand Up @@ -232,36 +199,6 @@ void eigrp_distribute_update(struct distribute_ctx *ctx,
} else
ei->prefix[EIGRP_FILTER_OUT] = NULL;

#if 0
/* route-map IN for whole process */
if (dist->route[DISTRIBUTE_V4_IN])
{
zlog_info("<DEBUG ACL ALL in");
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_IN]);
if (routemap)
ei->routemap[EIGRP_FILTER_IN] = routemap;
else
ei->routemap[EIGRP_FILTER_IN] = NULL;
}
else
{
ei->routemap[EIGRP_FILTER_IN] = NULL;
}

/* route-map OUT for whole process */
if (dist->route[DISTRIBUTE_V4_OUT])
{
routemap = route_map_lookup_by_name (dist->route[DISTRIBUTE_V4_OUT]);
if (routemap)
ei->routemap[EIGRP_FILTER_OUT] = routemap;
else
ei->routemap[EIGRP_FILTER_OUT] = NULL;
}
else
{
ei->routemap[EIGRP_FILTER_OUT] = NULL;
}
#endif
// TODO: check Graceful restart after 10sec

/* Cancel GR scheduled */
Expand Down
6 changes: 0 additions & 6 deletions isisd/isis_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ uint8_t *readbuff = NULL;

static const uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
static const uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
#if 0
/* missing support for P2P-over-LAN / ES-IS on BSD */
static const uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
static const uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
#endif

static char sock_buff[16384];

static int open_bpf_dev(struct isis_circuit *circuit)
Expand Down
5 changes: 0 additions & 5 deletions isisd/isis_dlpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ static t_uscalar_t dlpi_ctl[1024]; /* DLPI control messages */
static const uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
static const uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
static const uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
#if 0
/* missing support for ES-IS on Solaris */
static const uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
#endif

static uint8_t sock_buff[16384];

static unsigned short pf_filter[] = {
Expand Down
10 changes: 0 additions & 10 deletions lib/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,16 +468,6 @@ buffer_status_t buffer_write(struct buffer *b, int fd, const void *p,
{
ssize_t nbytes;

#if 0
/*
* Should we attempt to drain any previously buffered data?
* This could help reduce latency in pushing out the data if
* we are stuck in a long-running thread that is preventing
* the main select loop from calling the flush thread...
*/
if (b->head && (buffer_flush_available(b, fd) == BUFFER_ERROR))
return BUFFER_ERROR;
#endif
if (b->head)
/* Buffer is not empty, so do not attempt to write the new data.
*/
Expand Down
Loading

0 comments on commit 6772501

Please sign in to comment.