Skip to content

Commit

Permalink
bgpd: Fallback to destination peer when using match src-peer ...
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ton31337 authored and zice312963205 committed Nov 28, 2024
1 parent 4d1d443 commit 36806fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bgpd/bgp_routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,15 @@ static enum route_map_cmd_result_t route_match_src_peer(void *rule, const struct
bpi = object;
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 (!peer->conf_if && !peer->group)
return RMAP_NOMATCH;
Expand Down

0 comments on commit 36806fd

Please sign in to comment.