Hi,

As with the other email on the BGP INFO flags changing patch. Maybe we need to rationalise a bit. It's getting hard to follow what flag means what and overlaps with other flag. ?

Paul

On Fri, 11 Dec 2015, Donald Sharp wrote:

From: Daniel Walton <[email protected]>

Signed-off-by: Daniel Walton <[email protected]>
---
bgpd/bgp_route.c | 12 ++++++------
bgpd/bgp_route.h |  4 ++++
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index fa89b6c..5cc9809 100644
--- a/bgpd/bgp_route.c
+++ b/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);
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 7bd9ee2..ef7ffe2 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -136,6 +136,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)


--
Paul Jakma | [email protected] | @pjakma | Key ID: 0xD86BF79464A2FF6A
Fortune:
Are Linux users lemmings collectively jumping off of the cliff of
reliable, well-engineered commercial software?
        -- Matt Welsh

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to