1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * IS-IS Rout(e)ing protocol - isis_circuit.h
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
10 #ifndef ISIS_CIRCUIT_H
11 #define ISIS_CIRCUIT_H
20 #include "isis_constants.h"
21 #include "isis_common.h"
24 DECLARE_HOOK(isis_if_new_hook
, (struct interface
*ifp
), (ifp
));
29 struct password
*next
;
35 uint8_t metric_default
;
37 uint8_t metric_expense
;
41 struct isis_bcast_info
{
42 uint8_t snpa
[ETH_ALEN
]; /* SNPA of this circuit */
43 char run_dr_elect
[ISIS_LEVELS
]; /* Should we run dr election ? */
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
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 ? */
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 */
52 struct event
*t_refresh_pseudo_lsp
[ISIS_LEVELS
]; /* refresh pseudo-node
56 struct isis_p2p_info
{
57 struct isis_adjacency
*neighbor
;
58 struct event
*t_send_p2p_hello
; /* send P2P IIHs in this thread */
61 struct isis_circuit_arg
{
63 struct isis_circuit
*circuit
;
69 enum isis_hello_padding
{
70 ISIS_HELLO_PADDING_ALWAYS
,
71 ISIS_HELLO_PADDING_DISABLED
,
72 ISIS_HELLO_PADDING_DURING_ADJACENCY_FORMATION
76 enum isis_circuit_state state
;
77 uint8_t circuit_id
; /* l1/l2 bcast CircuitID */
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 */
89 struct event
*t_send_csnp
[ISIS_LEVELS
];
90 struct event
*t_send_psnp
[ISIS_LEVELS
];
91 struct isis_tx_queue
*tx_queue
;
92 struct isis_circuit_arg
93 level_arg
[ISIS_LEVELS
]; /* used as argument for threads */
95 /* there is no real point in two streams, just for programming kicker */
96 int (*rx
)(struct isis_circuit
*circuit
, uint8_t *ssnpa
);
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 */
101 #define CIRCUIT_T_UNKNOWN 0
102 #define CIRCUIT_T_BROADCAST 1
103 #define CIRCUIT_T_P2P 2
104 #define CIRCUIT_T_LOOPBACK 3
105 int circ_type
; /* type of the physical interface */
106 int circ_type_config
; /* config type of the physical interface */
108 struct isis_bcast_info bc
;
109 struct isis_p2p_info p2p
;
111 uint8_t priority
[ISIS_LEVELS
]; /* l1/2 IS configured priority */
112 enum isis_hello_padding pad_hellos
; /* type of Hello PDUs padding */
113 char ext_domain
; /* externalDomain (boolean) */
114 int lsp_regenerate_pending
[ISIS_LEVELS
];
115 uint64_t lsp_error_counter
;
120 char *tag
; /* area tag */
121 struct isis_passwd passwd
; /* Circuit rx/tx password */
122 int is_type_config
; /* configured circuit is type */
123 int is_type
; /* circuit is type == level of circuit
124 * differentiated from circuit type (media) */
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
];
131 struct isis_ext_subtlvs
*ext
; /* Extended parameters (TE + Adj SID */
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 */
139 uint16_t upadjcount
[ISIS_LEVELS
];
140 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
141 #define ISIS_CIRCUIT_IF_DOWN_FROM_Z 0x02
143 bool disable_threeway_adj
;
148 struct ldp_sync_info
*ldp_sync_info
;
149 bool lfa_protection
[ISIS_LEVELS
];
150 bool rlfa_protection
[ISIS_LEVELS
];
151 uint32_t rlfa_max_metric
[ISIS_LEVELS
];
152 struct hash
*lfa_excluded_ifaces
[ISIS_LEVELS
];
153 bool tilfa_protection
[ISIS_LEVELS
];
154 bool tilfa_node_protection
[ISIS_LEVELS
];
155 bool tilfa_link_fallback
[ISIS_LEVELS
];
157 * Counters as in 10589--11.2.5.9
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 */
163 uint32_t desig_changes
[ISIS_LEVELS
]; /* lanLxDesignatedIntermediateSystemChanges
165 uint32_t rej_adjacencies
; /* rejectedAdjacencies */
167 * Counters as in ietf-isis@2019-09-09.yang
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 */
174 uint32_t snmp_id
; /* Circuit id in snmp */
176 uint32_t snmp_adj_idx_gen
; /* Create unique id for adjacency on creation
178 struct list
*snmp_adj_list
; /* List in id order */
182 DECLARE_QOBJ_TYPE(isis_circuit
);
184 void isis_circuit_init(void);
185 struct isis_circuit
*isis_circuit_new(struct interface
*ifp
, const char *tag
);
186 void isis_circuit_del(struct isis_circuit
*circuit
);
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
,
207 void isis_circuit_print_json(struct isis_circuit
*circuit
,
208 struct json_object
*json
, char detail
);
209 size_t isis_circuit_pdu_size(struct isis_circuit
*circuit
);
210 void isis_circuit_switchover_routes(struct isis_circuit
*circuit
, int family
,
211 union g_addr
*nexthop_ip
,
213 void isis_circuit_stream(struct isis_circuit
*circuit
, struct stream
**stream
);
215 void isis_circuit_af_set(struct isis_circuit
*circuit
, bool ip_router
,
217 ferr_r
isis_circuit_passive_set(struct isis_circuit
*circuit
, bool passive
);
218 void isis_circuit_is_type_set(struct isis_circuit
*circuit
, int is_type
);
219 void isis_circuit_circ_type_set(struct isis_circuit
*circuit
, int circ_type
);
221 ferr_r
isis_circuit_metric_set(struct isis_circuit
*circuit
, int level
,
224 ferr_r
isis_circuit_passwd_unset(struct isis_circuit
*circuit
);
225 ferr_r
isis_circuit_passwd_set(struct isis_circuit
*circuit
,
226 uint8_t passwd_type
, const char *passwd
);
227 ferr_r
isis_circuit_passwd_cleartext_set(struct isis_circuit
*circuit
,
229 ferr_r
isis_circuit_passwd_hmac_md5_set(struct isis_circuit
*circuit
,
232 int isis_circuit_mt_enabled_set(struct isis_circuit
*circuit
, uint16_t mtid
,
236 DECLARE_HOOK(isis_circuit_config_write
,
237 (struct isis_circuit
*circuit
, struct vty
*vty
),
241 DECLARE_HOOK(isis_circuit_add_addr_hook
, (struct isis_circuit
*circuit
),
244 DECLARE_HOOK(isis_circuit_new_hook
, (struct isis_circuit
*circuit
), (circuit
));
245 DECLARE_HOOK(isis_circuit_del_hook
, (struct isis_circuit
*circuit
), (circuit
));
247 #endif /* _ZEBRA_ISIS_CIRCUIT_H */