BGP doesn't count a route with an unreachable nexthop in PfxRcd

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-05-19 17:40:38 -07:00
parent 1ff9a34058
commit 80e0ad24f9
2 changed files with 10 additions and 6 deletions

View File

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

View File

@ -136,6 +136,10 @@ struct bgp_static
u_char tag[3]; 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 */ /* Flags which indicate a route is unuseable in some form */
#define BGP_INFO_UNUSEABLE \ #define BGP_INFO_UNUSEABLE \
(BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED) (BGP_INFO_HISTORY|BGP_INFO_DAMPED|BGP_INFO_REMOVED)