]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_route.h
*: auto-convert to SPDX License IDs
[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;
34 struct isis_sr_psid_info sr_previous;
35 struct list *nexthops;
36 struct isis_route_info *backup;
37 };
38
39 DECLARE_HOOK(isis_route_update_hook,
40 (struct isis_area * area, struct prefix *prefix,
41 struct isis_route_info *route_info),
42 (area, prefix, route_info));
43
44 void isis_nexthop_delete(struct isis_nexthop *nexthop);
45 void adjinfo2nexthop(int family, struct list *nexthops,
46 struct isis_adjacency *adj, struct isis_sr_psid_info *sr,
47 struct mpls_label_stack *label_stack);
48 struct isis_route_info *
49 isis_route_create(struct prefix *prefix, struct prefix_ipv6 *src_p,
50 uint32_t cost, uint32_t depth, struct isis_sr_psid_info *sr,
51 struct list *adjacencies, bool allow_ecmp,
52 struct isis_area *area, struct route_table *table);
53 void isis_route_delete(struct isis_area *area, struct route_node *rode,
54 struct route_table *table);
55
56 /* Walk the given table and install new routes to zebra and remove old ones.
57 * route status is tracked using ISIS_ROUTE_FLAG_ACTIVE */
58 void isis_route_verify_table(struct isis_area *area, struct route_table *table,
59 struct route_table *table_backup);
60
61 /* Same as isis_route_verify_table, but merge L1 and L2 routes before */
62 void isis_route_verify_merge(struct isis_area *area,
63 struct route_table *level1_table,
64 struct route_table *level1_table_backup,
65 struct route_table *level2_table,
66 struct route_table *level2_table_backup);
67
68 /* Unset ISIS_ROUTE_FLAG_ACTIVE on all routes. Used before running spf. */
69 void isis_route_invalidate_table(struct isis_area *area,
70 struct route_table *table);
71
72 /* Cleanup route node when freeing routing table. */
73 void isis_route_node_cleanup(struct route_table *table,
74 struct route_node *node);
75
76 void isis_route_switchover_nexthop(struct isis_area *area,
77 struct route_table *table, int family,
78 union g_addr *nexthop_addr,
79 ifindex_t ifindex);
80
81 #endif /* _ZEBRA_ISIS_ROUTE_H */