]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_circuit.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / isisd / isis_circuit.h
CommitLineData
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
24DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
25
58e16237
CF
26struct isis_lsp;
27
d62a17ae 28struct password {
29 struct password *next;
30 int len;
d7c0a89a 31 uint8_t *pass;
eb5d44eb 32};
33
d62a17ae 34struct 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 41struct 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 ? */
e6685141
DS
44 struct event *t_run_dr[ISIS_LEVELS]; /* DR election thread */
45 struct event *t_send_lan_hello[ISIS_LEVELS]; /* send LAN IIHs in this
46 thread */
981cc629
RW
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 */
e6685141 52 struct event *t_refresh_pseudo_lsp[ISIS_LEVELS]; /* refresh pseudo-node
981cc629 53 LSPs */
eb5d44eb 54};
55
d62a17ae 56struct isis_p2p_info {
57 struct isis_adjacency *neighbor;
e6685141 58 struct event *t_send_p2p_hello; /* send P2P IIHs in this thread */
eb5d44eb 59};
60
7da4aa3c
CF
61struct isis_circuit_arg {
62 int level;
63 struct isis_circuit *circuit;
64};
65
e36ec6ac
DO
66/*
67 * Hello padding types
68 */
69enum isis_hello_padding {
70 ISIS_HELLO_PADDING_ALWAYS,
71 ISIS_HELLO_PADDING_DISABLED,
06fbbf29 72 ISIS_HELLO_PADDING_DURING_ADJACENCY_FORMATION
e36ec6ac
DO
73};
74
d62a17ae 75struct 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 */
e6685141
DS
88 struct event *t_read;
89 struct event *t_send_csnp[ISIS_LEVELS];
90 struct event *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 182DECLARE_QOBJ_TYPE(isis_circuit);
eb5d44eb 183
d62a17ae 184void isis_circuit_init(void);
bcf22081 185struct isis_circuit *isis_circuit_new(struct interface *ifp, const char *tag);
d62a17ae 186void isis_circuit_del(struct isis_circuit *circuit);
d62a17ae 187struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp);
188void isis_circuit_configure(struct isis_circuit *circuit,
189 struct isis_area *area);
190void isis_circuit_deconfigure(struct isis_circuit *circuit,
191 struct isis_area *area);
192void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp);
193void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp);
194void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp);
195void isis_circuit_if_unbind(struct isis_circuit *circuit,
196 struct interface *ifp);
197void isis_circuit_add_addr(struct isis_circuit *circuit,
198 struct connected *conn);
199void isis_circuit_del_addr(struct isis_circuit *circuit,
200 struct connected *conn);
201void isis_circuit_prepare(struct isis_circuit *circuit);
202int isis_circuit_up(struct isis_circuit *circuit);
203void isis_circuit_down(struct isis_circuit *);
204void circuit_update_nlpids(struct isis_circuit *circuit);
205void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
206 char detail);
9fee4d4c
JG
207void isis_circuit_print_json(struct isis_circuit *circuit,
208 struct json_object *json, char detail);
b20ccb3a 209size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
694fa867
LS
210void isis_circuit_switchover_routes(struct isis_circuit *circuit, int family,
211 union g_addr *nexthop_ip,
212 ifindex_t ifindex);
b20ccb3a 213void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
3f045a08 214
d62a17ae 215void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router,
216 bool ipv6_router);
64dd3ffe 217ferr_r isis_circuit_passive_set(struct isis_circuit *circuit, bool passive);
d62a17ae 218void isis_circuit_is_type_set(struct isis_circuit *circuit, int is_type);
d0820765 219void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type);
d62a17ae 220
64dd3ffe
DL
221ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
222 int metric);
d62a17ae 223
64dd3ffe 224ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit);
e28544ed
QY
225ferr_r isis_circuit_passwd_set(struct isis_circuit *circuit,
226 uint8_t passwd_type, const char *passwd);
64dd3ffe
DL
227ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
228 const char *passwd);
229ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
230 const char *passwd);
d62a17ae 231
232int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
233 bool enabled);
064f4896 234
05e4ec37 235#ifdef FABRICD
d56afe53
CF
236DECLARE_HOOK(isis_circuit_config_write,
237 (struct isis_circuit *circuit, struct vty *vty),
8451921b 238 (circuit, vty));
05e4ec37 239#endif
d56afe53 240
2bec0447 241DECLARE_HOOK(isis_circuit_add_addr_hook, (struct isis_circuit *circuit),
8451921b 242 (circuit));
2bec0447 243
e2b5b7d6
IR
244DECLARE_HOOK(isis_circuit_new_hook, (struct isis_circuit *circuit), (circuit));
245DECLARE_HOOK(isis_circuit_del_hook, (struct isis_circuit *circuit), (circuit));
246
eb5d44eb 247#endif /* _ZEBRA_ISIS_CIRCUIT_H */