Browse Source

bgpd: don't count a route with an unreachable nexthop in PfxRcd

When a route is received from a peer that we cannot
reach do not count that route as a received route.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Daniel Walton 4 years ago
parent
commit
e25a9741fb
2 changed files with 10 additions and 6 deletions
  1. 6 6
      bgpd/bgp_route.c
  2. 4 0
      bgpd/bgp_route.h

+ 6 - 6
bgpd/bgp_route.c

@@ -247,7 +247,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri)
       || ri->peer == ri->peer->bgp->peer_self)
     return;
     
-  if (BGP_INFO_HOLDDOWN (ri)
+  if (!BGP_INFO_COUNTABLE (ri)
       && CHECK_FLAG (ri->flags, BGP_INFO_COUNTED))
     {
           
@@ -264,7 +264,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri)
           zlog_warn ("%s: Please report to Quagga bugzilla", __func__);
         }      
     }
-  else if (!BGP_INFO_HOLDDOWN (ri) 
+  else if (BGP_INFO_COUNTABLE (ri)
            && !CHECK_FLAG (ri->flags, BGP_INFO_COUNTED))
     {
       SET_FLAG (ri->flags, BGP_INFO_COUNTED);
@@ -281,8 +281,8 @@ bgp_info_set_flag (struct bgp_node *rn, struct bgp_info *ri, u_int32_t flag)
 {
   SET_FLAG (ri->flags, flag);
   
-  /* early bath if we know it's not a flag that changes useability state */
-  if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_UNUSEABLE))
+  /* early bath if we know it's not a flag that changes countability state */
+  if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_HISTORY|BGP_INFO_REMOVED))
     return;
   
   bgp_pcount_adjust (rn, ri);
@@ -293,8 +293,8 @@ bgp_info_unset_flag (struct bgp_node *rn, struct bgp_info *ri, u_int32_t flag)
 {
   UNSET_FLAG (ri->flags, flag);
   
-  /* early bath if we know it's not a flag that changes useability state */
-  if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_UNUSEABLE))
+  /* early bath if we know it's not a flag that changes countability state */
+  if (!CHECK_FLAG (flag, BGP_INFO_VALID|BGP_INFO_HISTORY|BGP_INFO_REMOVED))
     return;
   
   bgp_pcount_adjust (rn, ri);

+ 4 - 0
bgpd/bgp_route.h

@@ -139,6 +139,10 @@ struct bgp_static
   u_char tag[3];
 };
 
+#define BGP_INFO_COUNTABLE(BI) \
+  (! CHECK_FLAG ((BI)->flags, BGP_INFO_HISTORY) \
+   && ! CHECK_FLAG ((BI)->flags, BGP_INFO_REMOVED))
+
 /* Flags which indicate a route is unuseable in some form */
 #define BGP_INFO_UNUSEABLE \
   (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED)