ospfd: prevent stale LSA from corrupting local OSPF DB after reboot - #20601
Conversation
|
@Mergifyio backport stable/10.5 stable/10.4 |
π Waiting for conditions to matchDetails
|
Greptile SummaryThis PR adds detection of stale self-originated LSAs after a reboot and handles them per RFC 2328 Β§13.4: if no local copy exists (
Confidence Score: 4/5The fix is RFC 2328 Β§13.4 compliant and addresses the described reboot scenario correctly; the only findings are minor code clarity issues. The core logic β MaxAge-flooding when no local copy exists, and bumping the sequence number and refreshing when a local copy is present β follows the RFC correctly. The ospfd/ospf_packet.c β the new stale-LSA detection block around lines 2015β2069. Important Files Changed
Sequence DiagramsequenceDiagram
participant R1 as R1 (rebooted)
participant R2 as R2 (neighbor)
Note over R1,R2: R1 reboots and re-establishes adjacency
R2->>R1: "DBD (stale LSA seq=5, adv_router=R1)"
R1->>R2: LS Request
alt "current == NULL"
R2->>R1: "LS Update (seq=5)"
Note over R1: Set MaxAge, ACK, remove from request list
Note over R1: Fall through to step-5 ospf_flood()
R1->>R2: "LS Update (seq=5, MaxAge) flush"
Note over R1: ospf_process_self_originated_lsa schedules re-origination
else "current != NULL and lsa.seq > current.seq"
R2->>R1: "LS Update (seq=5)"
Note over R1: current.ls_seqnum=5, ospf_lsa_refresh() -> seq=6
R1->>R2: "LS Update (seq=6) via flooding"
R1->>R2: LS ACK (direct)
Note over R1: DISCARD stale LSA
end
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
ospfd/ospf_packet.c:2067
**Unreachable `continue` after `DISCARD_LSA`**
The `DISCARD_LSA` macro already ends with its own `continue` statement (see the macro definition at line 1816), so the `continue` on this line is never reached. It can be removed.
### Issue 2 of 2
ospfd/ospf_packet.c:2046-2047
**Intentional fall-through should be documented**
After `LS_AGE_SET(lsa, OSPF_LSA_MAXAGE)`, there is no `continue`, so execution falls through to the step-(5) block at line 2079. This is intentional: `ospf_flood` will install and re-flood the MaxAge LSA, and `ospf_process_self_originated_lsa` will then schedule re-origination. A short `/* fall through: ospf_flood() below will re-flood the MaxAge LSA */` comment would make the intent clear and avoid the appearance of a missing `continue`.
Reviews (6): Last reviewed commit: "ospfd: prevent stale LSA from corrupting..." | Re-trigger Greptile |
b1ec3b5 to
4a49e85
Compare
4a49e85 to
303d4c5
Compare
303d4c5 to
e86c50c
Compare
|
@greptileai review this draft |
4636540 to
14553eb
Compare
|
@greptile review |
9108394 to
7ca05d5
Compare
7ca05d5 to
82738c5
Compare
82738c5 to
aade230
Compare
β Backports have been createdDetails
|
aade230 to
294e030
Compare
|
@greptile review |
|
ci failures look related ... need to be cleaned up ... |
0693321 to
e3a5a0a
Compare
Ensure local LSA's have the highest sequence number and neighbors are refreshed in the event a stale LSA is detected. Current behavior assuming we have two ospf routers: R1 <β> R2 - R1 and R2 are ospf neighbors - R1 has a summary route being advertised to R2 This summary route has some LSA sequence number that is higher than 1 At this point everything is working fine. But then: - R1 reboots - R1 and R2 re-establish ospf neighborship - R2 sends R1 the summary route with R1 as the advertising router - R1 installs this summary route with the higher sequence number. It will also set all the flags from R1, including the LSA_RECEIVED flag. This prevents subsequent LSA refresh events from firing - The summary route eventually times out (age 3600) and it uninstalled on R2 - R1 never refreshes the summary route. It reaches age 3600, but never gets deleted Expected behavior: - R1 should override R2's LSA with R1's router-id Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
e3a5a0a to
e955c07
Compare
|
@greptile review |
|
@Mergifyio backport stable/10.6 |
β Backports have been createdDetails
|
ospfd: prevent stale LSA from corrupting local OSPF DB after reboot (backport #20601)
Ensure local LSA's have the highest sequence number and neighbors are refreshed in the event a stale LSA is detected.
Current behavior assuming we have two ospf routers: R1 <β> R2
At this point everything is working fine. But then:
Expected behavior: