Commit 9cd7d59
committed
bgpd: don't advertise LLGR stale routes to non-LLGR peers
When a BGP peer goes down, an LLGR helper keeps the routes it learned from
that peer, tags them with the LLGR_STALE community, and holds them as a
last resort. RFC 9494 (4.3) says a stale route like that shouldn't be
advertised to any neighbor that hasn't advertised the LLGR capability to
us - a speaker that doesn't implement LLGR has no notion of staleness and
would treat the route as a normal, live path.
The advertise check only withheld a stale route when LLGR had been
negotiated in neither direction (!RCV && !ADV), but since we advertise the
LLGR capability to every peer, ADV is effectively always set and the route
went out anyway. The capability that matters here is the neighbor's, so key
the decision off whether they advertised it to us (RCV) - which is what the
comment sitting right above that check already says we do.
That alone isn't enough: the advertise decision is made once per
update-subgroup, and an LLGR peer and a non-LLGR peer with the same outbound
policy land in the same subgroup, so there's no way to send the route to one
but not the other. Add PEER_CAP_LLGR_RCV to PEER_UPDGRP_CAP_FLAGS so the
received capability feeds both the update-group hash key and the cmp
function - keying off the same axis the advertise check uses - so a non-LLGR
peer gets its own update-group and is never merged back in on a hash
collision.
The new bgp_llgr_no_capability topotest covers it: kill the peer that
advertised the route, then confirm r2 keeps feeding the stale route to its
LLGR-capable peer r3 while withdrawing it from the non-LLGR peer r4. Worth
noting in the config - FRR advertises LLGR whenever it advertises graceful
restart, and the default helper mode counts too, so r4 has to set
"bgp graceful-restart-disable" to actually be a non-LLGR peer.
Signed-off-by: Inder Pooni <inder@nexthop.ai>1 parent de5eb9e commit 9cd7d59
12 files changed
Lines changed: 270 additions & 3 deletions
File tree
- bgpd
- tests/topotests/bgp_llgr_no_capability
- r1
- r2
- r3
- r4
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2957 | 2957 | | |
2958 | 2958 | | |
2959 | 2959 | | |
2960 | | - | |
2961 | | - | |
| 2960 | + | |
2962 | 2961 | | |
2963 | 2962 | | |
2964 | 2963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
| |||
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments