ospfd,tests: fix OSPF connected overlapping prefix bug#21510
ospfd,tests: fix OSPF connected overlapping prefix bug#21510rzalamena wants to merge 2 commits intoFRRouting:masterfrom
Conversation
Greptile SummaryFixes the OSPF connected-route suppression logic in Confidence Score: 5/5Safe to merge; the fix is correct and the test suite covers both the regression and the suppression guard The No files require special attention Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["ospf_distribute_check_connected(ospf, ei)"] --> B["for each oi in ospf->oiflist"]
B --> C["prefix_copy(&address, oi->address)\napply_mask(&address)\n(zeros host bits: 10.0.0.1/24 → 10.0.0.0/24)"]
C --> D{"prefix_same(address, ei->p)?"}
D -- "Yes\n(exact network match)\ne.g. 10.0.0.0/24 == 10.0.0.0/24" --> E["return 0\n(suppress redistribution)"]
D -- "No\n(different network or prefix len)\ne.g. 10.0.0.0/24 ≠ 10.0.0.128/30" --> F["next oi"]
F --> B
B -- "exhausted" --> G["return 1\n(allow redistribution)"]
style E fill:#f99,color:#000
style G fill:#9f9,color:#000
Reviews (3): Last reviewed commit: "ospfd: fix redistribution for overlappin..." | Re-trigger Greptile |
tests/topotests/ospf_connected_overlapping_prefix/test_ospf_connected_overlapping_prefix.py
Show resolved
Hide resolved
19186b6 to
8f7b6c8
Compare
8f7b6c8 to
56a9ead
Compare
Add test for the OSPF connected overlapping prefix bug where an external route is ommited because a connected route overlaps the prefix. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
OSPF should not originate AS-external LSAs for networks that are already advertised internally (i.e. via OSPF-enabled interfaces). The redistribution check for connected routes used `prefix_match()`, which incorrectly suppressed routes whose prefixes only overlap with an OSPF-enabled interface. Use `prefix_same()` instead, so only identical prefixes are skipped and distinct connected networks are correctly redistributed. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
56a9ead to
57b1005
Compare
When two distinct interfaces have overlapping prefixes (example: 10.0.0.1/24 and 10.0.0.129/30) the more specific prefix gets omitted due to the wrong comparison in
ospf_distribute_check_connected:if (prefix_match(oi->address, (struct prefix *)&ei->p)).Fix the
ospf_distribute_check_connectedto useprefix_same()in order to rightfully generate the external route for this case.