bgpd: Fallback to destination peer when using match src-peer ...

If using at incoming direction, e.g.:

route-map test permit 10
 match src-peer 10.0.0.1
!
router bgp 65000
 neighbor 10.0.0.1 route-map test in
!

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2024-09-26 14:06:08 +03:00
parent 791e34258f
commit f153998874

View File

@ -348,6 +348,15 @@ static enum route_map_cmd_result_t route_match_src_peer(void *rule, const struct
bpi = object; bpi = object;
peer = bpi->from; peer = bpi->from;
/* Fallback to destination (current) peer. This is mostly
* happens if `match src-peer ...` is used at incoming direction.
*/
if (!peer)
peer = bpi->peer;
if (!peer)
return RMAP_NOMATCH;
if (pc->interface) { if (pc->interface) {
if (!peer->conf_if && !peer->group) if (!peer->conf_if && !peer->group)
return RMAP_NOMATCH; return RMAP_NOMATCH;