pespin has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40551?usp=email )
Change subject: Fix combined linkset lookup when inserting route
......................................................................
Fix combined linkset lookup when inserting route
The early loop termiantion logic was wrong, which meant
ss7_route_table_find_combined_linkset() may return earlier than expected
and hence a new combined linkset may have been created when adding a
route instead of adding it to a previous existing matching one.
The fix can be spotted by the fact that now "show cs7 instance 0 route"
shows the 3 3.2.0/11 prio=1 routes properly in the same combined linkset
in osmo_stp_route_prio.vty.
Change-Id: I44d7545a3c6a3ea4839e983104112f8afa6b981a
---
M src/ss7_route_table.c
M tests/vty/osmo_stp_route_prio.vty
2 files changed, 12 insertions(+), 5 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
diff --git a/src/ss7_route_table.c b/src/ss7_route_table.c
index fb10df4..c816e36 100644
--- a/src/ss7_route_table.c
+++ b/src/ss7_route_table.c
@@ -184,12 +184,13 @@
/* we assume the combined_links are sorted by mask length, i.e. more
* specific routes first, and less specific routes with shorter
- * mask later */
+ * mask later. Finally, ordered based on priority (lower prio value means higher prio).
+ */
llist_for_each_entry(clset, &rtbl->combined_linksets, list) {
- if (mask < clset->cfg.mask)
+ if (mask > clset->cfg.mask)
break;
if (dpc == clset->cfg.pc && mask == clset->cfg.mask) {
- if (prio > clset->cfg.priority)
+ if (prio < clset->cfg.priority)
break;
if (prio == clset->cfg.priority)
return clset;
diff --git a/tests/vty/osmo_stp_route_prio.vty b/tests/vty/osmo_stp_route_prio.vty
index fe89e44..f2bfd1e 100644
--- a/tests/vty/osmo_stp_route_prio.vty
+++ b/tests/vty/osmo_stp_route_prio.vty
@@ -97,9 +97,11 @@
3.2.1/14 INACC 7 6 as1 UNAVAIL ? UNAVAIL
OsmoSTP(config-cs7-rt)# ! NOW ADD MORE GENERIC ROUTES (SMALLER BITMASK LENGTH)
+OsmoSTP(config-cs7-rt)# update route 3.2.0 7.255.0 linkset as3 priority 3
OsmoSTP(config-cs7-rt)# update route 3.2.0 7.255.0 linkset as1 priority 1
OsmoSTP(config-cs7-rt)# update route 3.2.0 7.255.0 linkset as2 priority 1
OsmoSTP(config-cs7-rt)# update route 3.2.0 7.255.0 linkset as3 priority 1
+OsmoSTP(config-cs7-rt)# update route 3.2.0 7.255.0 linkset as3 priority 2
OsmoSTP(config-cs7-rt)# show running-config
...
cs7 instance 0
@@ -111,6 +113,8 @@
update route 3.2.0 7.255.0 linkset as1 priority 1
update route 3.2.0 7.255.0 linkset as2 priority 1
update route 3.2.0 7.255.0 linkset as3 priority 1
+ update route 3.2.0 7.255.0 linkset as3 priority 2
+ update route 3.2.0 7.255.0 linkset as3 priority 3
...
OsmoSTP(config-cs7-rt)# do show cs7 instance 0 route
Routing table = system
@@ -122,8 +126,10 @@
3.2.1/14 INACC 0 5 as2 UNAVAIL ? UNAVAIL
3.2.1/14 INACC 7 6 as1 UNAVAIL ? UNAVAIL
3.2.0/11 INACC 0 1 as1 UNAVAIL ? UNAVAIL
-3.2.0/11 INACC 0 1 as2 UNAVAIL ? UNAVAIL
-3.2.0/11 INACC 0 1 as3 UNAVAIL ? UNAVAIL
+ INACC 0 1 as2 UNAVAIL ? UNAVAIL
+ INACC 0 1 as3 UNAVAIL ? UNAVAIL
+3.2.0/11 INACC 0 2 as3 UNAVAIL ? UNAVAIL
+3.2.0/11 INACC 0 3 as3 UNAVAIL ? UNAVAIL
OsmoSTP(config-cs7-rt)# do show cs7 instance 0 route binding-table 3.2.1
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40551?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I44d7545a3c6a3ea4839e983104112f8afa6b981a
Gerrit-Change-Number: 40551
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>