]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isisd.h
Merge pull request #6530 from mjstapp/backup_nhg_notify
[mirror_frr.git] / isisd / isisd.h
1 /*
2 * IS-IS Rout(e)ing protocol - isisd.h
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef ISISD_H
24 #define ISISD_H
25
26 #include "vty.h"
27
28 #include "isisd/isis_constants.h"
29 #include "isisd/isis_common.h"
30 #include "isisd/isis_redist.h"
31 #include "isisd/isis_pdu_counter.h"
32 #include "isisd/isis_circuit.h"
33 #include "isisd/isis_sr.h"
34 #include "isis_flags.h"
35 #include "isis_lsp.h"
36 #include "isis_memory.h"
37 #include "qobj.h"
38
39 #ifdef FABRICD
40 static const bool fabricd = true;
41 #define PROTO_TYPE ZEBRA_ROUTE_OPENFABRIC
42 #define PROTO_NAME "openfabric"
43 #define PROTO_HELP "OpenFabric routing protocol\n"
44 #define PROTO_REDIST_STR FRR_REDIST_STR_FABRICD
45 #define PROTO_REDIST_HELP FRR_REDIST_HELP_STR_FABRICD
46 #define ROUTER_NODE OPENFABRIC_NODE
47 #else
48 static const bool fabricd = false;
49 #define PROTO_TYPE ZEBRA_ROUTE_ISIS
50 #define PROTO_NAME "isis"
51 #define PROTO_HELP "IS-IS routing protocol\n"
52 #define PROTO_REDIST_STR FRR_REDIST_STR_ISISD
53 #define PROTO_REDIST_HELP FRR_REDIST_HELP_STR_ISISD
54 #define ROUTER_NODE ISIS_NODE
55 extern void isis_cli_init(void);
56 #endif
57
58 extern struct zebra_privs_t isisd_privs;
59
60 /* uncomment if you are a developer in bug hunt */
61 /* #define EXTREME_DEBUG */
62
63 struct fabricd;
64
65 struct isis {
66 vrf_id_t vrf_id;
67 unsigned long process_id;
68 int sysid_set;
69 uint8_t sysid[ISIS_SYS_ID_LEN]; /* SystemID for this IS */
70 uint32_t router_id; /* Router ID from zebra */
71 struct list *area_list; /* list of IS-IS areas */
72 struct list *init_circ_list;
73 uint8_t max_area_addrs; /* maximumAreaAdresses */
74 struct area_addr *man_area_addrs; /* manualAreaAddresses */
75 time_t uptime; /* when did we start */
76 struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */
77 uint32_t circuit_ids_used[8]; /* 256 bits to track circuit ids 1 through 255 */
78
79 struct route_table *ext_info[REDIST_PROTOCOL_COUNT];
80
81 QOBJ_FIELDS
82 };
83
84 extern struct isis *isis;
85 DECLARE_QOBJ_TYPE(isis_area)
86
87 enum spf_tree_id {
88 SPFTREE_IPV4 = 0,
89 SPFTREE_IPV6,
90 SPFTREE_DSTSRC,
91 SPFTREE_COUNT
92 };
93
94 struct lsp_refresh_arg {
95 struct isis_area *area;
96 int level;
97 };
98
99 /* for yang configuration */
100 enum isis_metric_style {
101 ISIS_NARROW_METRIC = 0,
102 ISIS_WIDE_METRIC,
103 ISIS_TRANSITION_METRIC,
104 };
105
106 struct isis_area {
107 struct isis *isis; /* back pointer */
108 struct lspdb_head lspdb[ISIS_LEVELS]; /* link-state dbs */
109 struct isis_spftree *spftree[SPFTREE_COUNT][ISIS_LEVELS];
110 #define DEFAULT_LSP_MTU 1497
111 unsigned int lsp_mtu; /* Size of LSPs to generate */
112 struct list *circuit_list; /* IS-IS circuits */
113 struct flags flags;
114 struct thread *t_tick; /* LSP walker */
115 struct thread *t_lsp_refresh[ISIS_LEVELS];
116 struct timeval last_lsp_refresh_event[ISIS_LEVELS];
117 /* t_lsp_refresh is used in two ways:
118 * a) regular refresh of LSPs
119 * b) (possibly throttled) updates to LSPs
120 *
121 * The lsp_regenerate_pending flag tracks whether the timer is active
122 * for the a) or the b) case.
123 *
124 * It is of utmost importance to clear this flag when the timer is
125 * rescheduled for normal refresh, because otherwise, updates will
126 * be delayed until the next regular refresh.
127 */
128 int lsp_regenerate_pending[ISIS_LEVELS];
129
130 bool bfd_signalled_down;
131 bool bfd_force_spf_refresh;
132
133 struct fabricd *fabricd;
134
135 /*
136 * Configurables
137 */
138 struct isis_passwd area_passwd;
139 struct isis_passwd domain_passwd;
140 /* do we support dynamic hostnames? */
141 char dynhostname;
142 /* do we support new style metrics? */
143 char newmetric;
144 char oldmetric;
145 /* identifies the routing instance */
146 char *area_tag;
147 /* area addresses for this area */
148 struct list *area_addrs;
149 uint16_t max_lsp_lifetime[ISIS_LEVELS];
150 char is_type; /* level-1 level-1-2 or level-2-only */
151 /* are we overloaded? */
152 char overload_bit;
153 /* L1/L2 router identifier for inter-area traffic */
154 char attached_bit;
155 uint16_t lsp_refresh[ISIS_LEVELS];
156 /* minimum time allowed before lsp retransmission */
157 uint16_t lsp_gen_interval[ISIS_LEVELS];
158 /* min interval between between consequtive SPFs */
159 uint16_t min_spf_interval[ISIS_LEVELS];
160 /* the percentage of LSP mtu size used, before generating a new frag */
161 int lsp_frag_threshold;
162 uint64_t lsp_gen_count[ISIS_LEVELS];
163 uint64_t lsp_purge_count[ISIS_LEVELS];
164 int ip_circuits;
165 /* logging adjacency changes? */
166 uint8_t log_adj_changes;
167 /* multi topology settings */
168 struct list *mt_settings;
169 /* MPLS-TE settings */
170 struct mpls_te_area *mta;
171 /* Segment Routing information */
172 struct isis_sr_db srdb;
173 int ipv6_circuits;
174 bool purge_originator;
175 /* Counters */
176 uint32_t circuit_state_changes;
177 struct isis_redist redist_settings[REDIST_PROTOCOL_COUNT]
178 [ZEBRA_ROUTE_MAX + 1][ISIS_LEVELS];
179 struct route_table *ext_reach[REDIST_PROTOCOL_COUNT][ISIS_LEVELS];
180
181 struct spf_backoff *spf_delay_ietf[ISIS_LEVELS]; /*Structure with IETF
182 SPF algo
183 parameters*/
184 struct thread *spf_timer[ISIS_LEVELS];
185
186 struct lsp_refresh_arg lsp_refresh_arg[ISIS_LEVELS];
187
188 pdu_counter_t pdu_tx_counters;
189 pdu_counter_t pdu_rx_counters;
190 uint64_t lsp_rxmt_count;
191
192 QOBJ_FIELDS
193 };
194 DECLARE_QOBJ_TYPE(isis_area)
195
196 void isis_init(void);
197 void isis_new(unsigned long process_id, vrf_id_t vrf_id);
198 struct isis_area *isis_area_create(const char *);
199 struct isis_area *isis_area_lookup(const char *);
200 int isis_area_get(struct vty *vty, const char *area_tag);
201 int isis_area_destroy(const char *area_tag);
202 void print_debug(struct vty *, int, int);
203 struct isis_lsp *lsp_for_arg(struct lspdb_head *head, const char *argv);
204
205 void isis_area_invalidate_routes(struct isis_area *area, int levels);
206 void isis_area_verify_routes(struct isis_area *area);
207
208 void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit);
209 void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit);
210 void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname);
211 void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
212 bool new_metric);
213 void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu);
214 void isis_area_is_type_set(struct isis_area *area, int is_type);
215 void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
216 uint16_t max_lsp_lifetime);
217 void isis_area_lsp_refresh_set(struct isis_area *area, int level,
218 uint16_t lsp_refresh);
219 /* IS_LEVEL_1 sets area_passwd, IS_LEVEL_2 domain_passwd */
220 int isis_area_passwd_unset(struct isis_area *area, int level);
221 int isis_area_passwd_cleartext_set(struct isis_area *area, int level,
222 const char *passwd, uint8_t snp_auth);
223 int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level,
224 const char *passwd, uint8_t snp_auth);
225
226 /* YANG paths */
227 #define ISIS_INSTANCE "/frr-isisd:isis/instance"
228 #define ISIS_SR "/frr-isisd:isis/instance/segment-routing"
229
230 /* Master of threads. */
231 extern struct thread_master *master;
232
233 extern unsigned long debug_adj_pkt;
234 extern unsigned long debug_snp_pkt;
235 extern unsigned long debug_update_pkt;
236 extern unsigned long debug_spf_events;
237 extern unsigned long debug_rte_events;
238 extern unsigned long debug_events;
239 extern unsigned long debug_pkt_dump;
240 extern unsigned long debug_lsp_gen;
241 extern unsigned long debug_lsp_sched;
242 extern unsigned long debug_flooding;
243 extern unsigned long debug_bfd;
244 extern unsigned long debug_tx_queue;
245 extern unsigned long debug_sr;
246
247 #define DEBUG_ADJ_PACKETS (1<<0)
248 #define DEBUG_SNP_PACKETS (1<<1)
249 #define DEBUG_UPDATE_PACKETS (1<<2)
250 #define DEBUG_SPF_EVENTS (1<<3)
251 #define DEBUG_RTE_EVENTS (1<<4)
252 #define DEBUG_EVENTS (1<<5)
253 #define DEBUG_PACKET_DUMP (1<<6)
254 #define DEBUG_LSP_GEN (1<<7)
255 #define DEBUG_LSP_SCHED (1<<8)
256 #define DEBUG_FLOODING (1<<9)
257 #define DEBUG_BFD (1<<10)
258 #define DEBUG_TX_QUEUE (1<<11)
259 #define DEBUG_SR (1<<12)
260
261 /* Debug related macro. */
262 #define IS_DEBUG_ADJ_PACKETS (debug_adj_pkt & DEBUG_ADJ_PACKETS)
263 #define IS_DEBUG_SNP_PACKETS (debug_snp_pkt & DEBUG_SNP_PACKETS)
264 #define IS_DEBUG_UPDATE_PACKETS (debug_update_pkt & DEBUG_UPDATE_PACKETS)
265 #define IS_DEBUG_SPF_EVENTS (debug_spf_events & DEBUG_SPF_EVENTS)
266 #define IS_DEBUG_RTE_EVENTS (debug_rte_events & DEBUG_RTE_EVENTS)
267 #define IS_DEBUG_EVENTS (debug_events & DEBUG_EVENTS)
268 #define IS_DEBUG_PACKET_DUMP (debug_pkt_dump & DEBUG_PACKET_DUMP)
269 #define IS_DEBUG_LSP_GEN (debug_lsp_gen & DEBUG_LSP_GEN)
270 #define IS_DEBUG_LSP_SCHED (debug_lsp_sched & DEBUG_LSP_SCHED)
271 #define IS_DEBUG_FLOODING (debug_flooding & DEBUG_FLOODING)
272 #define IS_DEBUG_BFD (debug_bfd & DEBUG_BFD)
273 #define IS_DEBUG_TX_QUEUE (debug_tx_queue & DEBUG_TX_QUEUE)
274 #define IS_DEBUG_SR (debug_sr & DEBUG_SR)
275
276 #define lsp_debug(...) \
277 do { \
278 if (IS_DEBUG_LSP_GEN) \
279 zlog_debug(__VA_ARGS__); \
280 } while (0)
281
282 #define sched_debug(...) \
283 do { \
284 if (IS_DEBUG_LSP_SCHED) \
285 zlog_debug(__VA_ARGS__); \
286 } while (0)
287
288 #define sr_debug(...) \
289 do { \
290 if (IS_DEBUG_SR) \
291 zlog_debug(__VA_ARGS__); \
292 } while (0)
293
294 #define DEBUG_TE DEBUG_LSP_GEN
295
296 #endif /* ISISD_H */