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