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