Skip to content

Commit 2613888

Browse files
authored
Merge pull request FRRouting#19745 from anlancs/fix/ospfd-rcv-changed-lsid
ospfd: fix the inconsistency between lsdb and route table
2 parents cff2068 + 6399f7e commit 2613888

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

ospfd/ospf_lsa.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3060,8 +3060,15 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,
30603060
}
30613061

30623062
/* discard old LSA from LSDB */
3063-
if (old != NULL)
3063+
if (old != NULL) {
3064+
if (rt_recalc && !IS_LSA_SELF(lsa) && (lsa->data->type == OSPF_AS_EXTERNAL_LSA) &&
3065+
!IS_LSA_SELF(old) && (old->data->type == OSPF_AS_EXTERNAL_LSA)) {
3066+
old->data->ls_age = htons(OSPF_LSA_MAXAGE);
3067+
ospf_ase_incremental_update(ospf, old);
3068+
}
3069+
30643070
ospf_discard_from_db(ospf, lsdb, lsa);
3071+
}
30653072

30663073
/* Calculate Checksum if self-originated?. */
30673074
if (IS_LSA_SELF(lsa))

tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,15 @@
8080
"12.0.20.5/32",
8181
]
8282
}
83-
SUMMARY = {"ipv4": ["11.0.0.0/8", "12.0.0.0/8", "11.0.0.0/24"]}
83+
84+
NETWORK3 = {
85+
"ipv4": [
86+
"13.0.0.0/16",
87+
]
88+
}
89+
90+
SUMMARY = {"ipv4": ["11.0.0.0/8", "12.0.0.0/8", "11.0.0.0/24", "13.0.0.0/8"]}
91+
8492
"""
8593
TOPOOLOGY =
8694
Please view in a fixed-width font such as Courier.
@@ -676,6 +684,7 @@ def test_ospf_type5_summary_tc42_p0(request):
676684
"static_routes": [
677685
{"network": NETWORK["ipv4"], "next_hop": "blackhole"},
678686
{"network": NETWORK2["ipv4"], "next_hop": "blackhole"},
687+
{"network": NETWORK3["ipv4"], "next_hop": "blackhole"},
679688
]
680689
}
681690
}
@@ -704,7 +713,8 @@ def test_ospf_type5_summary_tc42_p0(request):
704713
"r0": {
705714
"ospf": {
706715
"summary-address": [
707-
{"prefix": SUMMARY["ipv4"][0].split("/")[0], "mask": "8"}
716+
{"prefix": SUMMARY["ipv4"][0].split("/")[0], "mask": "8"},
717+
{"prefix": SUMMARY["ipv4"][3].split("/")[0], "mask": "8"},
708718
],
709719
"aggr_timer": 6,
710720
}
@@ -764,6 +774,31 @@ def test_ospf_type5_summary_tc42_p0(request):
764774
"Error: Routes still present in RIB".format(tc_name)
765775
)
766776

777+
input_dict_summary3 = {"r0": {"static_routes": [{"network": SUMMARY["ipv4"][3]}]}}
778+
dut = "r1"
779+
result = verify_ospf_rib(tgen, dut, input_dict_summary3)
780+
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
781+
782+
result = verify_rib(tgen, "ipv4", dut, input_dict_summary3, protocol=protocol)
783+
assert (
784+
result is True
785+
), "Testcase {} : Failed. Error: Routes is missing in RIB".format(tc_name)
786+
787+
input_dict3 = {"r0": {"static_routes": [{"network": NETWORK3["ipv4"]}]}}
788+
result = verify_ospf_rib(tgen, dut, input_dict3, expected=False)
789+
assert result is not True, (
790+
"Testcase {} : Failed\n Expected: Routes should not be present in OSPF RIB. \n Error: "
791+
"Routes still present in OSPF RIB {}".format(tc_name, result)
792+
)
793+
794+
result = verify_rib(
795+
tgen, "ipv4", dut, input_dict3, protocol=protocol, expected=False
796+
)
797+
assert result is not True, (
798+
"Testcase {} : Failed \n Expected: Routes should not be present in RIB"
799+
"Error: Routes still present in RIB".format(tc_name)
800+
)
801+
767802
step("Delete the configured summary")
768803
ospf_summ_r1 = {
769804
"r0": {
@@ -774,7 +809,13 @@ def test_ospf_type5_summary_tc42_p0(request):
774809
"mask": "8",
775810
"del_aggr_timer": True,
776811
"delete": True,
777-
}
812+
},
813+
{
814+
"prefix": SUMMARY["ipv4"][3].split("/")[0],
815+
"mask": "8",
816+
"del_aggr_timer": True,
817+
"delete": True,
818+
},
778819
]
779820
}
780821
}

0 commit comments

Comments
 (0)