summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_sr.c
diff options
context:
space:
mode:
authorGalaxyGorilla <sascha@netdef.org>2020-10-22 12:05:39 +0200
committerGalaxyGorilla <sascha@netdef.org>2021-01-19 16:32:13 +0100
commitcc1725bd3437dfb93084960c4a347133c0c5fe19 (patch)
treece9058a603691694328dc5c1875e18b9523ab2af /ospfd/ospf_sr.c
parentospfd: Add support for reverse SPF (P2P only) (diff)
downloadfrr-cc1725bd3437dfb93084960c4a347133c0c5fe19.tar.xz
frr-cc1725bd3437dfb93084960c4a347133c0c5fe19.zip
ospfd: Make use of adjacency SIDs in TI-LFA
When P and Q spaces are adjacent then it makes sense to use adjacency SIDs to from the P node to the Q node. There are some other corner cases where this makes also sense like when a P/Q node adjacent to root node. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
Diffstat (limited to 'ospfd/ospf_sr.c')
-rw-r--r--ospfd/ospf_sr.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index f3bb4cef8..efe07e141 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -687,6 +687,32 @@ mpls_label_t ospf_sr_get_prefix_sid_by_id(struct in_addr *id)
return label;
}
+/* Get the adjacency sid for a specific 'root' id and 'neighbor' id */
+mpls_label_t ospf_sr_get_adj_sid_by_id(struct in_addr *root_id,
+ struct in_addr *neighbor_id)
+{
+ struct sr_node *srn;
+ struct sr_link *srl;
+ mpls_label_t label;
+ struct listnode *node;
+
+ srn = (struct sr_node *)hash_lookup(OspfSR.neighbors, root_id);
+
+ label = MPLS_INVALID_LABEL;
+
+ if (srn) {
+ for (ALL_LIST_ELEMENTS_RO(srn->ext_link, node, srl)) {
+ if (srl->type == ADJ_SID
+ && srl->remote_id.s_addr == neighbor_id->s_addr) {
+ label = srl->sid[0];
+ break;
+ }
+ }
+ }
+
+ return label;
+}
+
/* Get neighbor full structure from address */
static struct ospf_neighbor *get_neighbor_by_addr(struct ospf *top,
struct in_addr addr)
@@ -1596,6 +1622,7 @@ void ospf_sr_ext_itf_add(struct ext_itf *exti)
srl->itf_addr = exti->link.link_data;
srl->instance =
SET_OPAQUE_LSID(OPAQUE_TYPE_EXTENDED_LINK_LSA, exti->instance);
+ srl->remote_id = exti->link.link_id;
switch (exti->stype) {
case ADJ_SID:
srl->type = ADJ_SID;