Skip to content

Commit cebf412

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 e091795 commit cebf412

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
@@ -18348,12 +18348,23 @@ static bool peergroup_filter_check(struct peer *peer, afi_t afi, safi_t safi,
1834818348
uint8_t type, int direct)
1834918349
{
1835018350
struct bgp_filter *filter;
18351+
filter = &peer->filter[afi][safi];
1835118352

18352-
if (peer_group_active(peer))
18353+
if (peer_group_active(peer)) {
18354+
/* This is required because the filter_override stores only the filter type.
18355+
* To determine whether exist-map or non-exist-map is configured along with adv-map filter,
18356+
* 'advmap.condition == direct' is evaluated where 'direct' should be passed appropriately by the caller */
18357+
if (type == PEER_FT_ADVERTISE_MAP) {
18358+
if (CHECK_FLAG(peer->filter_override[afi][safi][RMAP_OUT], type)) {
18359+
/* Only return true if the condition matches what we're checking for */
18360+
return (filter->advmap.condition == direct);
18361+
}
18362+
return false;
18363+
}
1835318364
return !!CHECK_FLAG(peer->filter_override[afi][safi][direct],
1835418365
type);
18366+
}
1835518367

18356-
filter = &peer->filter[afi][safi];
1835718368
switch (type) {
1835818369
case PEER_FT_DISTRIBUTE_LIST:
1835918370
return !!(filter->dlist[direct].name);

0 commit comments

Comments
 (0)