]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_circuit.h
*: Add camelCase JSON keys in addition to PascalCase
[mirror_frr.git] / isisd / isis_circuit.h
1 /*
2 * IS-IS Rout(e)ing protocol - isis_circuit.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 ISIS_CIRCUIT_H
24 #define ISIS_CIRCUIT_H
25
26 #include "vty.h"
27 #include "if.h"
28 #include "qobj.h"
29 #include "prefix.h"
30 #include "ferr.h"
31
32 #include "isis_constants.h"
33 #include "isis_common.h"
34 #include "isis_csm.h"
35
36 DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
37
38 struct isis_lsp;
39
40 struct password {
41 struct password *next;
42 int len;
43 uint8_t *pass;
44 };
45
46 struct metric {
47 uint8_t metric_default;
48 uint8_t metric_error;
49 uint8_t metric_expense;
50 uint8_t metric_delay;
51 };
52
53 struct isis_bcast_info {
54 uint8_t snpa[ETH_ALEN]; /* SNPA of this circuit */
55 char run_dr_elect[ISIS_LEVELS]; /* Should we run dr election ? */
56 struct thread *t_run_dr[ISIS_LEVELS]; /* DR election thread */
57 struct thread *t_send_lan_hello[ISIS_LEVELS]; /* send LAN IIHs in this
58 thread */
59 struct list *adjdb[ISIS_LEVELS]; /* adjacency dbs */
60 struct list *lan_neighs[ISIS_LEVELS]; /* list of lx neigh snpa */
61 char is_dr[ISIS_LEVELS]; /* Are we level x DR ? */
62 uint8_t l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
63 uint8_t l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
64 struct thread *t_refresh_pseudo_lsp[ISIS_LEVELS]; /* refresh pseudo-node
65 LSPs */
66 };
67
68 struct isis_p2p_info {
69 struct isis_adjacency *neighbor;
70 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
71 };
72
73 struct isis_circuit_arg {
74 int level;
75 struct isis_circuit *circuit;
76 };
77
78 struct isis_circuit {
79 enum isis_circuit_state state;
80 uint8_t circuit_id; /* l1/l2 bcast CircuitID */
81 time_t last_uptime;
82 struct isis *isis;
83 struct isis_area *area; /* back pointer to the area */
84 struct interface *interface; /* interface info from z */
85 int fd; /* IS-IS l1/2 socket */
86 int sap_length; /* SAP length for DLPI */
87 struct nlpids nlpids;
88 /*
89 * Threads
90 */
91 struct thread *t_read;
92 struct thread *t_send_csnp[ISIS_LEVELS];
93 struct thread *t_send_psnp[ISIS_LEVELS];
94 struct isis_tx_queue *tx_queue;
95 struct isis_circuit_arg
96 level_arg[ISIS_LEVELS]; /* used as argument for threads */
97
98 /* there is no real point in two streams, just for programming kicker */
99 int (*rx)(struct isis_circuit *circuit, uint8_t *ssnpa);
100 struct stream *rcv_stream; /* Stream for receiving */
101 int (*tx)(struct isis_circuit *circuit, int level);
102 struct stream *snd_stream; /* Stream for sending */
103 int idx; /* idx in S[RM|SN] flags */
104 #define CIRCUIT_T_UNKNOWN 0
105 #define CIRCUIT_T_BROADCAST 1
106 #define CIRCUIT_T_P2P 2
107 #define CIRCUIT_T_LOOPBACK 3
108 int circ_type; /* type of the physical interface */
109 int circ_type_config; /* config type of the physical interface */
110 union {
111 struct isis_bcast_info bc;
112 struct isis_p2p_info p2p;
113 } u;
114 uint8_t priority[ISIS_LEVELS]; /* l1/2 IS configured priority */
115 int pad_hellos; /* add padding to Hello PDUs ? */
116 char ext_domain; /* externalDomain (boolean) */
117 int lsp_regenerate_pending[ISIS_LEVELS];
118 uint64_t lsp_error_counter;
119
120 /*
121 * Configurables
122 */
123 char *tag; /* area tag */
124 struct isis_passwd passwd; /* Circuit rx/tx password */
125 int is_type_config; /* configured circuit is type */
126 int is_type; /* circuit is type == level of circuit
127 * differentiated from circuit type (media) */
128 uint32_t hello_interval[ISIS_LEVELS]; /* hello-interval in seconds */
129 uint16_t hello_multiplier[ISIS_LEVELS]; /* hello-multiplier */
130 uint16_t csnp_interval[ISIS_LEVELS]; /* csnp-interval in seconds */
131 uint16_t psnp_interval[ISIS_LEVELS]; /* psnp-interval in seconds */
132 uint8_t metric[ISIS_LEVELS];
133 uint32_t te_metric[ISIS_LEVELS];
134 struct isis_ext_subtlvs *ext; /* Extended parameters (TE + Adj SID */
135 int ip_router; /* Route IP ? */
136 int is_passive; /* Is Passive ? */
137 struct list *mt_settings; /* IS-IS MT Settings */
138 struct list *ip_addrs; /* our IP addresses */
139 int ipv6_router; /* Route IPv6 ? */
140 struct list *ipv6_link; /* our link local IPv6 addresses */
141 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
142 uint16_t upadjcount[ISIS_LEVELS];
143 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
144 uint8_t flags;
145 bool disable_threeway_adj;
146 struct {
147 bool enabled;
148 char *profile;
149 } bfd_config;
150 struct ldp_sync_info *ldp_sync_info;
151 bool lfa_protection[ISIS_LEVELS];
152 bool rlfa_protection[ISIS_LEVELS];
153 uint32_t rlfa_max_metric[ISIS_LEVELS];
154 struct hash *lfa_excluded_ifaces[ISIS_LEVELS];
155 bool tilfa_protection[ISIS_LEVELS];
156 bool tilfa_node_protection[ISIS_LEVELS];
157 bool tilfa_link_fallback[ISIS_LEVELS];
158 /*
159 * Counters as in 10589--11.2.5.9
160 */
161 uint32_t adj_state_changes; /* changesInAdjacencyState */
162 uint32_t init_failures; /* intialisationFailures */
163 uint32_t ctrl_pdus_rxed; /* controlPDUsReceived */
164 uint32_t ctrl_pdus_txed; /* controlPDUsSent */
165 uint32_t desig_changes[ISIS_LEVELS]; /* lanLxDesignatedIntermediateSystemChanges
166 */
167 uint32_t rej_adjacencies; /* rejectedAdjacencies */
168 /*
169 * Counters as in ietf-isis@2019-09-09.yang
170 */
171 uint32_t id_len_mismatches; /* id-len-mismatch */
172 uint32_t max_area_addr_mismatches; /* max-area-addresses-mismatch */
173 uint32_t auth_type_failures; /*authentication-type-fails */
174 uint32_t auth_failures; /* authentication-fails */
175
176 uint32_t snmp_id; /* Circuit id in snmp */
177
178 uint32_t snmp_adj_idx_gen; /* Create unique id for adjacency on creation
179 */
180 struct list *snmp_adj_list; /* List in id order */
181
182 QOBJ_FIELDS;
183 };
184 DECLARE_QOBJ_TYPE(isis_circuit);
185
186 void isis_circuit_init(void);
187 struct isis_circuit *isis_circuit_new(struct interface *ifp, const char *tag);
188 void isis_circuit_del(struct isis_circuit *circuit);
189 struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp);
190 void isis_circuit_configure(struct isis_circuit *circuit,
191 struct isis_area *area);
192 void isis_circuit_deconfigure(struct isis_circuit *circuit,
193 struct isis_area *area);
194 void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp);
195 void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp);
196 void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp);
197 void isis_circuit_if_unbind(struct isis_circuit *circuit,
198 struct interface *ifp);
199 void isis_circuit_add_addr(struct isis_circuit *circuit,
200 struct connected *conn);
201 void isis_circuit_del_addr(struct isis_circuit *circuit,
202 struct connected *conn);
203 void isis_circuit_prepare(struct isis_circuit *circuit);
204 int isis_circuit_up(struct isis_circuit *circuit);
205 void isis_circuit_down(struct isis_circuit *);
206 void circuit_update_nlpids(struct isis_circuit *circuit);
207 void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
208 char detail);
209 size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
210 void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
211
212 void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router,
213 bool ipv6_router);
214 ferr_r isis_circuit_passive_set(struct isis_circuit *circuit, bool passive);
215 void isis_circuit_is_type_set(struct isis_circuit *circuit, int is_type);
216 void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type);
217
218 ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
219 int metric);
220
221 ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit);
222 ferr_r isis_circuit_passwd_set(struct isis_circuit *circuit,
223 uint8_t passwd_type, const char *passwd);
224 ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
225 const char *passwd);
226 ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
227 const char *passwd);
228
229 int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
230 bool enabled);
231
232 #ifdef FABRICD
233 DECLARE_HOOK(isis_circuit_config_write,
234 (struct isis_circuit *circuit, struct vty *vty),
235 (circuit, vty));
236 #endif
237
238 DECLARE_HOOK(isis_circuit_add_addr_hook, (struct isis_circuit *circuit),
239 (circuit));
240
241 DECLARE_HOOK(isis_circuit_new_hook, (struct isis_circuit *circuit), (circuit));
242 DECLARE_HOOK(isis_circuit_del_hook, (struct isis_circuit *circuit), (circuit));
243
244 #endif /* _ZEBRA_ISIS_CIRCUIT_H */