diff options
| author | Iqra Siddiqui <imujeebsiddi@vmware.com> | 2022-05-25 23:45:57 -0700 | 
|---|---|---|
| committer | ARShreenidhi <rshreenidhi@vmware.com> | 2022-07-06 05:38:35 +0000 | 
| commit | 46c4f05bb6bf7a3f708ce06cf400fe6a0c987366 (patch) | |
| tree | b62a411f70747f51fb35b84d6db13694a98ae6cc /bgpd/bgp_updgrp_packet.c | |
| parent | e894ef7e77157f0a5d7a2be7b572a949c645dbe3 (diff) | |
bgpd: Inconsistencies in SNT counters with default-originate
Description:
Change is intended for fixing the inconsistencies present
while adjusting the SNT counters with default originate.
- SNT counter gets incremented on every change of policy associated
  with default-originate, leading to inconsistencies.
- This fix has been added to ensure that the SNT counters gets
  incremented and decremented only once during the creation and
  deletion workflow of default-originate, and prevents
  incrementing the counter during update flow.
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.com>
Diffstat (limited to 'bgpd/bgp_updgrp_packet.c')
| -rw-r--r-- | bgpd/bgp_updgrp_packet.c | 14 | 
1 files changed, 12 insertions, 2 deletions
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index c4a3ca7500..88a81f255d 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -1142,7 +1142,12 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,  	(void)bpacket_queue_add(SUBGRP_PKTQ(subgrp), s, &vecarr);  	subgroup_trigger_write(subgrp); -	subgrp->scount++; + +	if (!CHECK_FLAG(subgrp->sflags, +			SUBGRP_STATUS_PEER_DEFAULT_ORIGINATED)) { +		subgrp->scount++; +		SET_FLAG(subgrp->sflags, SUBGRP_STATUS_PEER_DEFAULT_ORIGINATED); +	}  }  void subgroup_default_withdraw_packet(struct update_subgroup *subgrp) @@ -1235,7 +1240,12 @@ void subgroup_default_withdraw_packet(struct update_subgroup *subgrp)  	(void)bpacket_queue_add(SUBGRP_PKTQ(subgrp), s, NULL);  	subgroup_trigger_write(subgrp); -	subgrp->scount--; + +	if (CHECK_FLAG(subgrp->sflags, SUBGRP_STATUS_PEER_DEFAULT_ORIGINATED)) { +		subgrp->scount--; +		UNSET_FLAG(subgrp->sflags, +			   SUBGRP_STATUS_PEER_DEFAULT_ORIGINATED); +	}  }  static void  | 
