]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Remove #if 0 code
authorDonald Sharp <sharpd@nvidia.com>
Thu, 28 Jan 2021 18:53:03 +0000 (13:53 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 28 Jan 2021 18:57:49 +0000 (13:57 -0500)
Remove all dead #if 0 code from bgpd.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_fsm.c
bgpd/bgp_pbr.c
bgpd/bgp_route.c
bgpd/bgp_updgrp.c
bgpd/bgp_updgrp.h
bgpd/bgp_updgrp_packet.c
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_private.h

index 29573a1957df7e9f8d1e29adc1b33096bd75e5ab..b69e2d71b653121d0f73a237e8cd49f12c6cdc8d 100644 (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);
index 4f22f5bcfeb9a93b526453bf44d7e164cf9a946a..171522f8ae114a914b1f709e53390d6d12ee3c13 100644 (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;
index 76d500f2dfe19f7090e4f040348a169dff813438..0ac9a42dc5172b9493aaeb7bb14b89330f532d5f 100644 (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) {
index 059e05ef71d06f3148755a5fe13b50925e9b498e..621a14014fce4b52a4d3cc028020d15c00908538 100644 (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;
 }
 
index 7261933dc98b0c6c4b21c27fce804a22e701ee3d..694636ef3d9d984e5a4951baa4f8de1693057be9 100644 (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;
index 866bf8178a6c791613b78aa6daee1695236769ac..0a3ecc584e2e41d0ff99227a2f1a5cf94232ee84 100644 (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;
 }
 
index f7bbd44512b724c56051f31e6cfd9e8ca303e039..8c455c6ea5e88ee4834f49a0c48faf3775df5ae5 100644 (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;
index e24d62def4446a405aec28896e30a2811b2271ba..af563679552dc81ee685b70c12f2b1158dfcc242 100644 (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,