]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isisd.h
Merge pull request #12601 from opensourcerouting/feature/bgp_neighbor_path-attribute_...
[mirror_frr.git] / isisd / isisd.h
CommitLineData
eb5d44eb 1/*
d62a17ae 2 * IS-IS Rout(e)ing protocol - isisd.h
eb5d44eb 3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 5 * Tampere University of Technology
eb5d44eb 6 * Institute of Communications Engineering
7 *
d62a17ae 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)
eb5d44eb 11 * any later version.
12 *
d62a17ae 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
eb5d44eb 16 * more details.
896014f4
DL
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
eb5d44eb 21 */
22
23#ifndef ISISD_H
24#define ISISD_H
25
91283e76 26#include "vty.h"
66b9a381 27#include "memory.h"
91283e76 28
65f9a9a8
DL
29#include "isisd/isis_constants.h"
30#include "isisd/isis_common.h"
f3ccedaa 31#include "isisd/isis_redist.h"
39bb53d6 32#include "isisd/isis_pdu_counter.h"
aaf2fd21 33#include "isisd/isis_circuit.h"
26f6acaf 34#include "isisd/isis_sr.h"
65f9a9a8 35#include "isis_flags.h"
4bef0ec4 36#include "isis_lsp.h"
e886416f 37#include "isis_lfa.h"
676a4ea3 38#include "qobj.h"
1cbf96a8 39#include "ldp_sync.h"
f3ccedaa 40
66b9a381
DL
41DECLARE_MGROUP(ISISD);
42
7c0cbd0e
CF
43#ifdef FABRICD
44static const bool fabricd = true;
45#define PROTO_TYPE ZEBRA_ROUTE_OPENFABRIC
46#define PROTO_NAME "openfabric"
47#define PROTO_HELP "OpenFabric routing protocol\n"
48#define PROTO_REDIST_STR FRR_REDIST_STR_FABRICD
1bfee936
IR
49#define PROTO_IP_REDIST_STR FRR_IP_REDIST_STR_FABRICD
50#define PROTO_IP6_REDIST_STR FRR_IP6_REDIST_STR_FABRICD
7c0cbd0e 51#define PROTO_REDIST_HELP FRR_REDIST_HELP_STR_FABRICD
1bfee936
IR
52#define PROTO_IP_REDIST_HELP FRR_IP_REDIST_HELP_STR_FABRICD
53#define PROTO_IP6_REDIST_HELP FRR_IP6_REDIST_HELP_STR_FABRICD
7c0cbd0e
CF
54#define ROUTER_NODE OPENFABRIC_NODE
55#else
56static const bool fabricd = false;
57#define PROTO_TYPE ZEBRA_ROUTE_ISIS
58#define PROTO_NAME "isis"
59#define PROTO_HELP "IS-IS routing protocol\n"
60#define PROTO_REDIST_STR FRR_REDIST_STR_ISISD
1bfee936
IR
61#define PROTO_IP_REDIST_STR FRR_IP_REDIST_STR_ISISD
62#define PROTO_IP6_REDIST_STR FRR_IP6_REDIST_STR_ISISD
7c0cbd0e 63#define PROTO_REDIST_HELP FRR_REDIST_HELP_STR_ISISD
1bfee936
IR
64#define PROTO_IP_REDIST_HELP FRR_IP_REDIST_HELP_STR_ISISD
65#define PROTO_IP6_REDIST_HELP FRR_IP6_REDIST_HELP_STR_ISISD
7c0cbd0e 66#define ROUTER_NODE ISIS_NODE
20bd27e2 67extern void isis_cli_init(void);
7c0cbd0e
CF
68#endif
69
eab88f36
K
70#define ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \
71 if (argv_find(argv, argc, "vrf", &idx_vrf)) { \
72 vrf_name = argv[idx_vrf + 1]->arg; \
73 all_vrf = strmatch(vrf_name, "all"); \
74 }
75
76e292f9
DS
76extern struct zebra_privs_t isisd_privs;
77
eb5d44eb 78/* uncomment if you are a developer in bug hunt */
79/* #define EXTREME_DEBUG */
eb5d44eb 80
8e6fb83b
CF
81struct fabricd;
82
eab88f36
K
83struct isis_master {
84 /* ISIS instance. */
85 struct list *isis;
86 /* ISIS thread master. */
87 struct thread_master *master;
eab88f36
K
88 uint8_t options;
89};
52a7c25e 90#define F_ISIS_UNIT_TEST 0x01
eab88f36 91
a2cac12a
JG
92#define ISIS_DEFAULT_MAX_AREA_ADDRESSES 3
93
d62a17ae 94struct isis {
260fcb95 95 vrf_id_t vrf_id;
eab88f36 96 char *name;
d7c0a89a 97 unsigned long process_id;
d62a17ae 98 int sysid_set;
d7c0a89a
QY
99 uint8_t sysid[ISIS_SYS_ID_LEN]; /* SystemID for this IS */
100 uint32_t router_id; /* Router ID from zebra */
d62a17ae 101 struct list *area_list; /* list of IS-IS areas */
d7c0a89a 102 uint8_t max_area_addrs; /* maximumAreaAdresses */
d62a17ae 103 struct area_addr *man_area_addrs; /* manualAreaAddresses */
d62a17ae 104 time_t uptime; /* when did we start */
98c5bc15 105 struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */
c59f88c8 106 uint32_t circuit_ids_used[8]; /* 256 bits to track circuit ids 1 through 255 */
1ee746d9 107 int snmp_notifications;
240f48b3 108 struct list *dyn_cache;
d62a17ae 109
110 struct route_table *ext_info[REDIST_PROTOCOL_COUNT];
eb5d44eb 111};
112
eab88f36 113extern struct isis_master *im;
3f045a08 114
be985ba0
CF
115enum spf_tree_id {
116 SPFTREE_IPV4 = 0,
117 SPFTREE_IPV6,
321c1bbb 118 SPFTREE_DSTSRC,
be985ba0
CF
119 SPFTREE_COUNT
120};
121
9196731f
CF
122struct lsp_refresh_arg {
123 struct isis_area *area;
124 int level;
125};
126
e0df3206
EDP
127/* for yang configuration */
128enum isis_metric_style {
129 ISIS_NARROW_METRIC = 0,
130 ISIS_WIDE_METRIC,
131 ISIS_TRANSITION_METRIC,
132};
133
d62a17ae 134struct isis_area {
135 struct isis *isis; /* back pointer */
4bef0ec4 136 struct lspdb_head lspdb[ISIS_LEVELS]; /* link-state dbs */
be985ba0 137 struct isis_spftree *spftree[SPFTREE_COUNT][ISIS_LEVELS];
b20ccb3a 138#define DEFAULT_LSP_MTU 1497
d62a17ae 139 unsigned int lsp_mtu; /* Size of LSPs to generate */
140 struct list *circuit_list; /* IS-IS circuits */
75eddbc3 141 struct list *adjacency_list; /* IS-IS adjacencies */
d62a17ae 142 struct flags flags;
143 struct thread *t_tick; /* LSP walker */
144 struct thread *t_lsp_refresh[ISIS_LEVELS];
49b27ea2 145 struct thread *t_overload_on_startup_timer;
f93025e1 146 struct timeval last_lsp_refresh_event[ISIS_LEVELS];
16fe8cff 147 struct thread *t_rlfa_rib_update;
d62a17ae 148 /* t_lsp_refresh is used in two ways:
149 * a) regular refresh of LSPs
150 * b) (possibly throttled) updates to LSPs
151 *
152 * The lsp_regenerate_pending flag tracks whether the timer is active
153 * for the a) or the b) case.
154 *
155 * It is of utmost importance to clear this flag when the timer is
156 * rescheduled for normal refresh, because otherwise, updates will
157 * be delayed until the next regular refresh.
158 */
159 int lsp_regenerate_pending[ISIS_LEVELS];
160
690497fb
G
161 bool bfd_signalled_down;
162 bool bfd_force_spf_refresh;
163
8e6fb83b
CF
164 struct fabricd *fabricd;
165
d62a17ae 166 /*
167 * Configurables
168 */
169 struct isis_passwd area_passwd;
170 struct isis_passwd domain_passwd;
171 /* do we support dynamic hostnames? */
172 char dynhostname;
173 /* do we support new style metrics? */
174 char newmetric;
175 char oldmetric;
176 /* identifies the routing instance */
177 char *area_tag;
178 /* area addresses for this area */
179 struct list *area_addrs;
d7c0a89a 180 uint16_t max_lsp_lifetime[ISIS_LEVELS];
d62a17ae 181 char is_type; /* level-1 level-1-2 or level-2-only */
182 /* are we overloaded? */
183 char overload_bit;
4afc7836 184 bool overload_configured;
1ee746d9 185 uint32_t overload_counter;
01ea9b03 186 uint32_t overload_on_startup_time;
d62a17ae 187 /* L1/L2 router identifier for inter-area traffic */
f3abc412 188 char attached_bit_send;
189 char attached_bit_rcv_ignore;
d7c0a89a 190 uint16_t lsp_refresh[ISIS_LEVELS];
d62a17ae 191 /* minimum time allowed before lsp retransmission */
d7c0a89a 192 uint16_t lsp_gen_interval[ISIS_LEVELS];
d62a17ae 193 /* min interval between between consequtive SPFs */
d7c0a89a 194 uint16_t min_spf_interval[ISIS_LEVELS];
d62a17ae 195 /* the percentage of LSP mtu size used, before generating a new frag */
196 int lsp_frag_threshold;
062f4d36 197 uint64_t lsp_gen_count[ISIS_LEVELS];
6f004b60 198 uint64_t lsp_purge_count[ISIS_LEVELS];
1ee746d9 199 uint32_t lsp_exceeded_max_counter;
200 uint32_t lsp_seqno_skipped_counter;
201 uint64_t spf_run_count[ISIS_LEVELS];
d62a17ae 202 int ip_circuits;
203 /* logging adjacency changes? */
d7c0a89a 204 uint8_t log_adj_changes;
d62a17ae 205 /* multi topology settings */
206 struct list *mt_settings;
2e2a8b91
OD
207 /* MPLS-TE settings */
208 struct mpls_te_area *mta;
26f6acaf
RW
209 /* Segment Routing information */
210 struct isis_sr_db srdb;
d62a17ae 211 int ipv6_circuits;
2c92bee4 212 bool purge_originator;
e886416f
RW
213 /* SPF prefix priorities. */
214 struct spf_prefix_priority_acl
215 spf_prefix_priorities[SPF_PREFIX_PRIO_MAX];
c951ee6e
RW
216 /* Fast Re-Route information. */
217 size_t lfa_protected_links[ISIS_LEVELS];
e886416f
RW
218 size_t lfa_load_sharing[ISIS_LEVELS];
219 enum spf_prefix_priority lfa_priority_limit[ISIS_LEVELS];
220 struct lfa_tiebreaker_tree_head lfa_tiebreakers[ISIS_LEVELS];
16fe8cff
RW
221 char *rlfa_plist_name[ISIS_LEVELS];
222 struct prefix_list *rlfa_plist[ISIS_LEVELS];
223 size_t rlfa_protected_links[ISIS_LEVELS];
e886416f 224 size_t tilfa_protected_links[ISIS_LEVELS];
ec62fbaa
IR
225 /* MPLS LDP-IGP Sync */
226 struct ldp_sync_info_cmd ldp_sync_cmd;
d62a17ae 227 /* Counters */
d7c0a89a 228 uint32_t circuit_state_changes;
d62a17ae 229 struct isis_redist redist_settings[REDIST_PROTOCOL_COUNT]
230 [ZEBRA_ROUTE_MAX + 1][ISIS_LEVELS];
231 struct route_table *ext_reach[REDIST_PROTOCOL_COUNT][ISIS_LEVELS];
232
233 struct spf_backoff *spf_delay_ietf[ISIS_LEVELS]; /*Structure with IETF
234 SPF algo
235 parameters*/
236 struct thread *spf_timer[ISIS_LEVELS];
9196731f
CF
237
238 struct lsp_refresh_arg lsp_refresh_arg[ISIS_LEVELS];
d62a17ae 239
39bb53d6
CF
240 pdu_counter_t pdu_tx_counters;
241 pdu_counter_t pdu_rx_counters;
86d6f80d 242 uint64_t lsp_rxmt_count;
39bb53d6 243
1ee746d9 244 /* Area counters */
245 uint64_t rej_adjacencies[2];
246 uint64_t auth_type_failures[2];
247 uint64_t auth_failures[2];
248 uint64_t id_len_mismatches[2];
249 uint64_t lsp_error_counter[2];
250
96244aca 251 QOBJ_FIELDS;
eb5d44eb 252};
96244aca 253DECLARE_QOBJ_TYPE(isis_area);
eb5d44eb 254
66b9a381
DL
255DECLARE_MTYPE(ISIS_ACL_NAME); /* isis_area->spf_prefix_prioritites */
256DECLARE_MTYPE(ISIS_AREA_ADDR); /* isis_area->area_addrs */
dcfe3c16 257DECLARE_MTYPE(ISIS_PLIST_NAME);
66b9a381 258
8451921b 259DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area));
1ee746d9 260
eab88f36 261void isis_terminate(void);
eab88f36
K
262void isis_master_init(struct thread_master *master);
263void isis_vrf_link(struct isis *isis, struct vrf *vrf);
264void isis_vrf_unlink(struct isis *isis, struct vrf *vrf);
eab88f36
K
265struct isis *isis_lookup_by_vrfid(vrf_id_t vrf_id);
266struct isis *isis_lookup_by_vrfname(const char *vrfname);
36944791 267struct isis *isis_lookup_by_sysid(const uint8_t *sysid);
eab88f36 268
d62a17ae 269void isis_init(void);
65251ce8 270void isis_vrf_init(void);
271
272struct isis *isis_new(const char *vrf_name);
bcf22081
IR
273void isis_finish(struct isis *isis);
274
275void isis_area_add_circuit(struct isis_area *area,
276 struct isis_circuit *circuit);
277void isis_area_del_circuit(struct isis_area *area,
278 struct isis_circuit *circuit);
279
eab88f36
K
280struct isis_area *isis_area_create(const char *, const char *);
281struct isis_area *isis_area_lookup(const char *, vrf_id_t vrf_id);
65251ce8 282struct isis_area *isis_area_lookup_by_vrf(const char *area_tag,
283 const char *vrf_name);
d62a17ae 284int isis_area_get(struct vty *vty, const char *area_tag);
14c6e772 285void isis_area_destroy(struct isis_area *area);
e886416f 286void isis_filter_update(struct access_list *access);
16fe8cff 287void isis_prefix_list_update(struct prefix_list *plist);
3f045a08 288void print_debug(struct vty *, int, int);
1d88e63a
DS
289struct isis_lsp *lsp_for_sysid(struct lspdb_head *head, const char *sysid_str,
290 struct isis *isis);
3f045a08 291
3dace42d
CF
292void isis_area_invalidate_routes(struct isis_area *area, int levels);
293void isis_area_verify_routes(struct isis_area *area);
694fa867
LS
294void isis_area_switchover_routes(struct isis_area *area, int family,
295 union g_addr *nexthop_ip, ifindex_t ifindex,
296 int level);
3dace42d 297
a38a72db 298void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit);
01ea9b03
IL
299void isis_area_overload_on_startup_set(struct isis_area *area,
300 uint32_t startup_time);
f3abc412 301void isis_area_attached_bit_send_set(struct isis_area *area, bool attached_bit);
302void isis_area_attached_bit_receive_set(struct isis_area *area,
303 bool attached_bit);
a38a72db
CF
304void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname);
305void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
306 bool new_metric);
6754fc66
CF
307void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu);
308void isis_area_is_type_set(struct isis_area *area, int is_type);
466ed406 309void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
d62a17ae 310 uint16_t max_lsp_lifetime);
466ed406
CF
311void isis_area_lsp_refresh_set(struct isis_area *area, int level,
312 uint16_t lsp_refresh);
9093b230 313/* IS_LEVEL_1 sets area_passwd, IS_LEVEL_2 domain_passwd */
d62a17ae 314int isis_area_passwd_unset(struct isis_area *area, int level);
315int isis_area_passwd_cleartext_set(struct isis_area *area, int level,
d7c0a89a 316 const char *passwd, uint8_t snp_auth);
d62a17ae 317int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level,
d7c0a89a 318 const char *passwd, uint8_t snp_auth);
a2cac12a
JG
319void show_isis_database_lspdb_json(struct json_object *json,
320 struct isis_area *area, int level,
321 struct lspdb_head *lspdb, const char *argv,
322 int ui_level);
323void show_isis_database_lspdb_vty(struct vty *vty, struct isis_area *area,
324 int level, struct lspdb_head *lspdb,
325 const char *argv, int ui_level);
450841fe
IL
326char *isis_restart_filepath(void);
327void isis_restart_write_overload_time(struct isis_area *isis_area,
328 uint32_t overload_time);
329uint32_t isis_restart_read_overload_time(struct isis_area *isis_area);
26f6acaf
RW
330/* YANG paths */
331#define ISIS_INSTANCE "/frr-isisd:isis/instance"
332#define ISIS_SR "/frr-isisd:isis/instance/segment-routing"
333
3f045a08
JB
334/* Master of threads. */
335extern struct thread_master *master;
eb5d44eb 336
e740f9c1 337extern unsigned long debug_adj_pkt;
338extern unsigned long debug_snp_pkt;
339extern unsigned long debug_update_pkt;
340extern unsigned long debug_spf_events;
341extern unsigned long debug_rte_events;
342extern unsigned long debug_events;
343extern unsigned long debug_pkt_dump;
344extern unsigned long debug_lsp_gen;
345extern unsigned long debug_lsp_sched;
346extern unsigned long debug_flooding;
347extern unsigned long debug_bfd;
348extern unsigned long debug_tx_queue;
349extern unsigned long debug_sr;
1cbf96a8 350extern unsigned long debug_ldp_sync;
2866b119 351extern unsigned long debug_lfa;
d9884a75 352extern unsigned long debug_te;
e740f9c1 353
eb5d44eb 354#define DEBUG_ADJ_PACKETS (1<<0)
26687d25
CF
355#define DEBUG_SNP_PACKETS (1<<1)
356#define DEBUG_UPDATE_PACKETS (1<<2)
357#define DEBUG_SPF_EVENTS (1<<3)
358#define DEBUG_RTE_EVENTS (1<<4)
359#define DEBUG_EVENTS (1<<5)
360#define DEBUG_PACKET_DUMP (1<<6)
361#define DEBUG_LSP_GEN (1<<7)
362#define DEBUG_LSP_SCHED (1<<8)
ddb33326 363#define DEBUG_FLOODING (1<<9)
26687d25 364#define DEBUG_BFD (1<<10)
161fa356 365#define DEBUG_TX_QUEUE (1<<11)
26f6acaf 366#define DEBUG_SR (1<<12)
c951ee6e 367#define DEBUG_LDP_SYNC (1<<13)
2866b119 368#define DEBUG_LFA (1<<14)
d9884a75 369#define DEBUG_TE (1<<15)
14872644 370
e740f9c1 371/* Debug related macro. */
372#define IS_DEBUG_ADJ_PACKETS (debug_adj_pkt & DEBUG_ADJ_PACKETS)
373#define IS_DEBUG_SNP_PACKETS (debug_snp_pkt & DEBUG_SNP_PACKETS)
374#define IS_DEBUG_UPDATE_PACKETS (debug_update_pkt & DEBUG_UPDATE_PACKETS)
375#define IS_DEBUG_SPF_EVENTS (debug_spf_events & DEBUG_SPF_EVENTS)
376#define IS_DEBUG_RTE_EVENTS (debug_rte_events & DEBUG_RTE_EVENTS)
377#define IS_DEBUG_EVENTS (debug_events & DEBUG_EVENTS)
378#define IS_DEBUG_PACKET_DUMP (debug_pkt_dump & DEBUG_PACKET_DUMP)
379#define IS_DEBUG_LSP_GEN (debug_lsp_gen & DEBUG_LSP_GEN)
380#define IS_DEBUG_LSP_SCHED (debug_lsp_sched & DEBUG_LSP_SCHED)
381#define IS_DEBUG_FLOODING (debug_flooding & DEBUG_FLOODING)
382#define IS_DEBUG_BFD (debug_bfd & DEBUG_BFD)
383#define IS_DEBUG_TX_QUEUE (debug_tx_queue & DEBUG_TX_QUEUE)
384#define IS_DEBUG_SR (debug_sr & DEBUG_SR)
1cbf96a8 385#define IS_DEBUG_LDP_SYNC (debug_ldp_sync & DEBUG_LDP_SYNC)
2866b119 386#define IS_DEBUG_LFA (debug_lfa & DEBUG_LFA)
d9884a75 387#define IS_DEBUG_TE (debug_te & DEBUG_TE)
e740f9c1 388
d62a17ae 389#define lsp_debug(...) \
390 do { \
e740f9c1 391 if (IS_DEBUG_LSP_GEN) \
d62a17ae 392 zlog_debug(__VA_ARGS__); \
393 } while (0)
394
395#define sched_debug(...) \
396 do { \
e740f9c1 397 if (IS_DEBUG_LSP_SCHED) \
d62a17ae 398 zlog_debug(__VA_ARGS__); \
399 } while (0)
414766a1 400
b407c77a
OD
401#define sr_debug(...) \
402 do { \
e740f9c1 403 if (IS_DEBUG_SR) \
b407c77a
OD
404 zlog_debug(__VA_ARGS__); \
405 } while (0)
406
d9884a75
OD
407#define te_debug(...) \
408 do { \
409 if (IS_DEBUG_TE) \
410 zlog_debug(__VA_ARGS__); \
411 } while (0)
f8c06e2c 412
eb5d44eb 413#endif /* ISISD_H */