]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isisd.h
ISIS VRF: ISIS Debug structure modifications
[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 struct fabricd *fabricd;
131
132 /*
133 * Configurables
134 */
135 struct isis_passwd area_passwd;
136 struct isis_passwd domain_passwd;
137 /* do we support dynamic hostnames? */
138 char dynhostname;
139 /* do we support new style metrics? */
140 char newmetric;
141 char oldmetric;
142 /* identifies the routing instance */
143 char *area_tag;
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? */
149 char overload_bit;
150 /* L1/L2 router identifier for inter-area traffic */
151 char attached_bit;
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];
161 int ip_circuits;
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;
170 int ipv6_circuits;
171 bool purge_originator;
172 /* Counters */
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];
177
178 struct spf_backoff *spf_delay_ietf[ISIS_LEVELS]; /*Structure with IETF
179 SPF algo
180 parameters*/
181 struct thread *spf_timer[ISIS_LEVELS];
182
183 struct lsp_refresh_arg lsp_refresh_arg[ISIS_LEVELS];
184
185 pdu_counter_t pdu_tx_counters;
186 pdu_counter_t pdu_rx_counters;
187 uint64_t lsp_rxmt_count;
188
189 QOBJ_FIELDS
190 };
191 DECLARE_QOBJ_TYPE(isis_area)
192
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);
201
202 void isis_area_invalidate_routes(struct isis_area *area, int levels);
203 void isis_area_verify_routes(struct isis_area *area);
204
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,
209 bool new_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);
222
223 /* YANG paths */
224 #define ISIS_INSTANCE "/frr-isisd:isis/instance"
225 #define ISIS_SR "/frr-isisd:isis/instance/segment-routing"
226
227 /* Master of threads. */
228 extern struct thread_master *master;
229
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;
243
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)
257
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)
272
273 #define lsp_debug(...) \
274 do { \
275 if (IS_DEBUG_LSP_GEN) \
276 zlog_debug(__VA_ARGS__); \
277 } while (0)
278
279 #define sched_debug(...) \
280 do { \
281 if (IS_DEBUG_LSP_SCHED) \
282 zlog_debug(__VA_ARGS__); \
283 } while (0)
284
285 #define sr_debug(...) \
286 do { \
287 if (IS_DEBUG_SR) \
288 zlog_debug(__VA_ARGS__); \
289 } while (0)
290
291 #define DEBUG_TE DEBUG_LSP_GEN
292
293 #endif /* ISISD_H */