2 * IS-IS Rout(e)ing protocol - isisd.h
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
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)
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
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
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"
36 #include "isis_memory.h"
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
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);
58 extern struct zebra_privs_t isisd_privs
;
60 /* uncomment if you are a developer in bug hunt */
61 /* #define EXTREME_DEBUG */
67 unsigned long process_id
;
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 */
79 struct route_table
*ext_info
[REDIST_PROTOCOL_COUNT
];
84 extern struct isis
*isis
;
85 DECLARE_QOBJ_TYPE(isis_area
)
94 struct lsp_refresh_arg
{
95 struct isis_area
*area
;
99 /* for yang configuration */
100 enum isis_metric_style
{
101 ISIS_NARROW_METRIC
= 0,
103 ISIS_TRANSITION_METRIC
,
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 */
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
121 * The lsp_regenerate_pending flag tracks whether the timer is active
122 * for the a) or the b) case.
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.
128 int lsp_regenerate_pending
[ISIS_LEVELS
];
130 struct fabricd
*fabricd
;
135 struct isis_passwd area_passwd
;
136 struct isis_passwd domain_passwd
;
137 /* do we support dynamic hostnames? */
139 /* do we support new style metrics? */
142 /* identifies the routing instance */
144 /* area addresses for this area */
145 struct list
*area_addrs
;
146 uint16_t max_lsp_lifetime
[ISIS_LEVELS
];
147 char is_type
; /* level-1 level-1-2 or level-2-only */
148 /* are we overloaded? */
150 /* L1/L2 router identifier for inter-area traffic */
152 uint16_t lsp_refresh
[ISIS_LEVELS
];
153 /* minimum time allowed before lsp retransmission */
154 uint16_t lsp_gen_interval
[ISIS_LEVELS
];
155 /* min interval between between consequtive SPFs */
156 uint16_t min_spf_interval
[ISIS_LEVELS
];
157 /* the percentage of LSP mtu size used, before generating a new frag */
158 int lsp_frag_threshold
;
159 uint64_t lsp_gen_count
[ISIS_LEVELS
];
160 uint64_t lsp_purge_count
[ISIS_LEVELS
];
162 /* logging adjacency changes? */
163 uint8_t log_adj_changes
;
164 /* multi topology settings */
165 struct list
*mt_settings
;
166 /* MPLS-TE settings */
167 struct mpls_te_area
*mta
;
168 /* Segment Routing information */
169 struct isis_sr_db srdb
;
171 bool purge_originator
;
173 uint32_t circuit_state_changes
;
174 struct isis_redist redist_settings
[REDIST_PROTOCOL_COUNT
]
175 [ZEBRA_ROUTE_MAX
+ 1][ISIS_LEVELS
];
176 struct route_table
*ext_reach
[REDIST_PROTOCOL_COUNT
][ISIS_LEVELS
];
178 struct spf_backoff
*spf_delay_ietf
[ISIS_LEVELS
]; /*Structure with IETF
181 struct thread
*spf_timer
[ISIS_LEVELS
];
183 struct lsp_refresh_arg lsp_refresh_arg
[ISIS_LEVELS
];
185 pdu_counter_t pdu_tx_counters
;
186 pdu_counter_t pdu_rx_counters
;
187 uint64_t lsp_rxmt_count
;
191 DECLARE_QOBJ_TYPE(isis_area
)
193 void isis_init(void);
194 void isis_new(unsigned long process_id
, vrf_id_t vrf_id
);
195 struct isis_area
*isis_area_create(const char *);
196 struct isis_area
*isis_area_lookup(const char *);
197 int isis_area_get(struct vty
*vty
, const char *area_tag
);
198 int isis_area_destroy(const char *area_tag
);
199 void print_debug(struct vty
*, int, int);
200 struct isis_lsp
*lsp_for_arg(struct lspdb_head
*head
, const char *argv
);
202 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
);
203 void isis_area_verify_routes(struct isis_area
*area
);
205 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
);
206 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
);
207 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
);
208 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
210 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
);
211 void isis_area_is_type_set(struct isis_area
*area
, int is_type
);
212 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
213 uint16_t max_lsp_lifetime
);
214 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
215 uint16_t lsp_refresh
);
216 /* IS_LEVEL_1 sets area_passwd, IS_LEVEL_2 domain_passwd */
217 int isis_area_passwd_unset(struct isis_area
*area
, int level
);
218 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
219 const char *passwd
, uint8_t snp_auth
);
220 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
221 const char *passwd
, uint8_t snp_auth
);
224 #define ISIS_INSTANCE "/frr-isisd:isis/instance"
225 #define ISIS_SR "/frr-isisd:isis/instance/segment-routing"
227 /* Master of threads. */
228 extern struct thread_master
*master
;
230 extern unsigned long debug_adj_pkt
;
231 extern unsigned long debug_snp_pkt
;
232 extern unsigned long debug_update_pkt
;
233 extern unsigned long debug_spf_events
;
234 extern unsigned long debug_rte_events
;
235 extern unsigned long debug_events
;
236 extern unsigned long debug_pkt_dump
;
237 extern unsigned long debug_lsp_gen
;
238 extern unsigned long debug_lsp_sched
;
239 extern unsigned long debug_flooding
;
240 extern unsigned long debug_bfd
;
241 extern unsigned long debug_tx_queue
;
242 extern unsigned long debug_sr
;
244 #define DEBUG_ADJ_PACKETS (1<<0)
245 #define DEBUG_SNP_PACKETS (1<<1)
246 #define DEBUG_UPDATE_PACKETS (1<<2)
247 #define DEBUG_SPF_EVENTS (1<<3)
248 #define DEBUG_RTE_EVENTS (1<<4)
249 #define DEBUG_EVENTS (1<<5)
250 #define DEBUG_PACKET_DUMP (1<<6)
251 #define DEBUG_LSP_GEN (1<<7)
252 #define DEBUG_LSP_SCHED (1<<8)
253 #define DEBUG_FLOODING (1<<9)
254 #define DEBUG_BFD (1<<10)
255 #define DEBUG_TX_QUEUE (1<<11)
256 #define DEBUG_SR (1<<12)
258 /* Debug related macro. */
259 #define IS_DEBUG_ADJ_PACKETS (debug_adj_pkt & DEBUG_ADJ_PACKETS)
260 #define IS_DEBUG_SNP_PACKETS (debug_snp_pkt & DEBUG_SNP_PACKETS)
261 #define IS_DEBUG_UPDATE_PACKETS (debug_update_pkt & DEBUG_UPDATE_PACKETS)
262 #define IS_DEBUG_SPF_EVENTS (debug_spf_events & DEBUG_SPF_EVENTS)
263 #define IS_DEBUG_RTE_EVENTS (debug_rte_events & DEBUG_RTE_EVENTS)
264 #define IS_DEBUG_EVENTS (debug_events & DEBUG_EVENTS)
265 #define IS_DEBUG_PACKET_DUMP (debug_pkt_dump & DEBUG_PACKET_DUMP)
266 #define IS_DEBUG_LSP_GEN (debug_lsp_gen & DEBUG_LSP_GEN)
267 #define IS_DEBUG_LSP_SCHED (debug_lsp_sched & DEBUG_LSP_SCHED)
268 #define IS_DEBUG_FLOODING (debug_flooding & DEBUG_FLOODING)
269 #define IS_DEBUG_BFD (debug_bfd & DEBUG_BFD)
270 #define IS_DEBUG_TX_QUEUE (debug_tx_queue & DEBUG_TX_QUEUE)
271 #define IS_DEBUG_SR (debug_sr & DEBUG_SR)
273 #define lsp_debug(...) \
275 if (IS_DEBUG_LSP_GEN) \
276 zlog_debug(__VA_ARGS__); \
279 #define sched_debug(...) \
281 if (IS_DEBUG_LSP_SCHED) \
282 zlog_debug(__VA_ARGS__); \
285 #define sr_debug(...) \
288 zlog_debug(__VA_ARGS__); \
291 #define DEBUG_TE DEBUG_LSP_GEN