]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_route.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / isisd / isis_route.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * IS-IS Rout(e)ing protocol - isis_route.h
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
8 *
9 * based on ../ospf6d/ospf6_route.[ch]
10 * by Yasuhiro Ohara
11 */
12 #ifndef _ZEBRA_ISIS_ROUTE_H
13 #define _ZEBRA_ISIS_ROUTE_H
14
15 #include "lib/nexthop.h"
16
17 struct isis_nexthop {
18 ifindex_t ifindex;
19 int family;
20 union g_addr ip;
21 uint8_t sysid[ISIS_SYS_ID_LEN];
22 struct isis_sr_psid_info sr;
23 struct mpls_label_stack *label_stack;
24 };
25
26 struct isis_route_info {
27 #define ISIS_ROUTE_FLAG_ACTIVE 0x01 /* active route for the prefix */
28 #define ISIS_ROUTE_FLAG_ZEBRA_SYNCED 0x02 /* set when route synced to zebra */
29 #define ISIS_ROUTE_FLAG_ZEBRA_RESYNC 0x04 /* set when route needs to sync */
30 uint8_t flag;
31 uint32_t cost;
32 uint32_t depth;
33 struct isis_sr_psid_info sr_algo[SR_ALGORITHM_COUNT];
34 struct isis_sr_psid_info sr_algo_previous[SR_ALGORITHM_COUNT];
35 struct list *nexthops;
36 struct isis_route_info *backup;
37 };
38
39 struct isis_route_table_info {
40 uint8_t algorithm;
41 };
42
43 DECLARE_HOOK(isis_route_update_hook,
44 (struct isis_area * area, struct prefix *prefix,
45 struct isis_route_info *route_info),
46 (area, prefix, route_info));
47
48 void isis_nexthop_delete(struct isis_nexthop *nexthop);
49 void adjinfo2nexthop(int family, struct list *nexthops,
50 struct isis_adjacency *adj, struct isis_sr_psid_info *sr,
51 struct mpls_label_stack *label_stack);
52 struct isis_route_info *
53 isis_route_create(struct prefix *prefix, struct prefix_ipv6 *src_p,
54 uint32_t cost, uint32_t depth, struct isis_sr_psid_info *sr,
55 struct list *adjacencies, bool allow_ecmp,
56 struct isis_area *area, struct route_table *table);
57 void isis_route_delete(struct isis_area *area, struct route_node *rode,
58 struct route_table *table);
59
60 /* Walk the given table and install new routes to zebra and remove old ones.
61 * route status is tracked using ISIS_ROUTE_FLAG_ACTIVE */
62 void isis_route_verify_table(struct isis_area *area, struct route_table *table,
63 struct route_table *table_backup, int tree);
64
65 /* Same as isis_route_verify_table, but merge L1 and L2 routes before */
66 void isis_route_verify_merge(struct isis_area *area,
67 struct route_table *level1_table,
68 struct route_table *level1_table_backup,
69 struct route_table *level2_table,
70 struct route_table *level2_table_backup, int tree);
71
72 /* Unset ISIS_ROUTE_FLAG_ACTIVE on all routes. Used before running spf. */
73 void isis_route_invalidate_table(struct isis_area *area,
74 struct route_table *table);
75
76 /* Cleanup route node when freeing routing table. */
77 void isis_route_node_cleanup(struct route_table *table,
78 struct route_node *node);
79
80
81 void isis_route_switchover_nexthop(struct isis_area *area,
82 struct route_table *table, int family,
83 union g_addr *nexthop_addr,
84 ifindex_t ifindex);
85
86 struct isis_route_table_info *isis_route_table_info_alloc(uint8_t algorithm);
87 void isis_route_table_info_free(void *info);
88 uint8_t isis_route_table_algorithm(const struct route_table *table);
89
90 #endif /* _ZEBRA_ISIS_ROUTE_H */