summaryrefslogtreecommitdiffstats
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
authorGalaxyGorilla <sascha@netdef.org>2020-10-26 12:27:09 +0100
committerGalaxyGorilla <sascha@netdef.org>2021-01-19 16:32:13 +0100
commit385a1e07b13e53f2d9b3ec06eadd82b3e8bb64fa (patch)
tree45732b91744550cb3050eab0eafa601fb4d07ff6 /ospfd/ospfd.c
parentospfd: Make use of adjacency SIDs in TI-LFA (diff)
downloadfrr-385a1e07b13e53f2d9b3ec06eadd82b3e8bb64fa.tar.xz
frr-385a1e07b13e53f2d9b3ec06eadd82b3e8bb64fa.zip
ospfd: Add support for TI-LFA node protection
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index a0a746488..56424abec 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -89,8 +89,18 @@ static void ospf_finish_final(struct ospf *);
int p_spaces_compare_func(const struct p_space *a, const struct p_space *b)
{
- return (a->protected_link->link_id.s_addr
- - b->protected_link->link_id.s_addr);
+ if (a->protected_resource->type == OSPF_TI_LFA_LINK_PROTECTION
+ && b->protected_resource->type == OSPF_TI_LFA_LINK_PROTECTION)
+ return (a->protected_resource->link->link_id.s_addr
+ - b->protected_resource->link->link_id.s_addr);
+
+ if (a->protected_resource->type == OSPF_TI_LFA_NODE_PROTECTION
+ && b->protected_resource->type == OSPF_TI_LFA_NODE_PROTECTION)
+ return (a->protected_resource->router_id.s_addr
+ - b->protected_resource->router_id.s_addr);
+
+ /* This should not happen */
+ return 0;
}
int q_spaces_compare_func(const struct q_space *a, const struct q_space *b)