Skip to content

Commit aa012d8

Browse files
krishna-samyton31337
authored andcommitted
bgpd: fix to show exist/non-exist-map in 'show run' properly
Currently, peergroup_filter_check() does not check whether exist-map or non-exist-map is configured along with advertise-map. This check is missing only when the peer is part of peergroup and having the exist/non-exist-map. So the 'show run' does not show the configured exist/non-exist-map as expected. This new check is needed because, unlike other filter type the adv-map can have exist/non-exist-map additionally and we don't store this in the filter_override but store only the adv-map. So, a specific check is required to account the exist/non-exist-map while printing the adv-map config. Fixing the same by adding a check. Signed-off-by: Krishnasamy <[email protected]>
1 parent eb45741 commit aa012d8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

bgpd/bgp_vty.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18478,12 +18478,23 @@ static bool peergroup_filter_check(struct peer *peer, afi_t afi, safi_t safi,
1847818478
uint8_t type, int direct)
1847918479
{
1848018480
struct bgp_filter *filter;
18481+
filter = &peer->filter[afi][safi];
1848118482

18482-
if (peer_group_active(peer))
18483+
if (peer_group_active(peer)) {
18484+
/* This is required because the filter_override stores only the filter type.
18485+
* To determine whether exist-map or non-exist-map is configured along with adv-map filter,
18486+
* 'advmap.condition == direct' is evaluated where 'direct' should be passed appropriately by the caller */
18487+
if (type == PEER_FT_ADVERTISE_MAP) {
18488+
if (CHECK_FLAG(peer->filter_override[afi][safi][RMAP_OUT], type)) {
18489+
/* Only return true if the condition matches what we're checking for */
18490+
return (filter->advmap.condition == direct);
18491+
}
18492+
return false;
18493+
}
1848318494
return !!CHECK_FLAG(peer->filter_override[afi][safi][direct],
1848418495
type);
18496+
}
1848518497

18486-
filter = &peer->filter[afi][safi];
1848718498
switch (type) {
1848818499
case PEER_FT_DISTRIBUTE_LIST:
1848918500
return !!(filter->dlist[direct].name);

0 commit comments

Comments
 (0)