2 * IS-IS Rout(e)ing protocol - isis_circuit.h
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
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)
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
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
23 #ifndef ISIS_CIRCUIT_H
24 #define ISIS_CIRCUIT_H
32 #include "isis_constants.h"
33 #include "isis_common.h"
35 DECLARE_HOOK(isis_if_new_hook
, (struct interface
*ifp
), (ifp
));
40 struct password
*next
;
46 uint8_t metric_default
;
48 uint8_t metric_expense
;
52 struct isis_bcast_info
{
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
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 ? */
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 */
63 struct thread
*t_refresh_pseudo_lsp
[ISIS_LEVELS
]; /* refresh pseudo-node
67 struct isis_p2p_info
{
68 struct isis_adjacency
*neighbor
;
69 struct thread
*t_send_p2p_hello
; /* send P2P IIHs in this thread */
74 struct isis_circuit_arg
{
76 struct isis_circuit
*circuit
;
81 uint8_t circuit_id
; /* l1/l2 bcast CircuitID */
82 struct isis_area
*area
; /* back pointer to the area */
83 struct interface
*interface
; /* interface info from z */
84 int fd
; /* IS-IS l1/2 socket */
85 int sap_length
; /* SAP length for DLPI */
90 struct thread
*t_read
;
91 struct thread
*t_send_csnp
[ISIS_LEVELS
];
92 struct thread
*t_send_psnp
[ISIS_LEVELS
];
93 struct isis_tx_queue
*tx_queue
;
94 struct isis_circuit_arg
95 level_arg
[ISIS_LEVELS
]; /* used as argument for threads */
97 /* there is no real point in two streams, just for programming kicker */
98 int (*rx
)(struct isis_circuit
*circuit
, uint8_t *ssnpa
);
99 struct stream
*rcv_stream
; /* Stream for receiving */
100 int (*tx
)(struct isis_circuit
*circuit
, int level
);
101 struct stream
*snd_stream
; /* Stream for sending */
102 int idx
; /* idx in S[RM|SN] flags */
103 #define CIRCUIT_T_UNKNOWN 0
104 #define CIRCUIT_T_BROADCAST 1
105 #define CIRCUIT_T_P2P 2
106 #define CIRCUIT_T_LOOPBACK 3
107 int circ_type
; /* type of the physical interface */
108 int circ_type_config
; /* config type of the physical interface */
110 struct isis_bcast_info bc
;
111 struct isis_p2p_info p2p
;
113 uint8_t priority
[ISIS_LEVELS
]; /* l1/2 IS configured priority */
114 int pad_hellos
; /* add padding to Hello PDUs ? */
115 char ext_domain
; /* externalDomain (boolean) */
116 int lsp_regenerate_pending
[ISIS_LEVELS
];
120 struct isis_passwd passwd
; /* Circuit rx/tx password */
121 int is_type
; /* circuit is type == level of circuit
122 * differentiated from circuit type (media) */
123 uint32_t hello_interval
[ISIS_LEVELS
]; /* hello-interval in seconds */
124 uint16_t hello_multiplier
[ISIS_LEVELS
]; /* hello-multiplier */
125 uint16_t csnp_interval
[ISIS_LEVELS
]; /* csnp-interval in seconds */
126 uint16_t psnp_interval
[ISIS_LEVELS
]; /* psnp-interval in seconds */
127 uint8_t metric
[ISIS_LEVELS
];
128 uint32_t te_metric
[ISIS_LEVELS
];
129 struct isis_ext_subtlvs
*ext
; /* Extended parameters (TE + Adj SID */
130 int ip_router
; /* Route IP ? */
131 int is_passive
; /* Is Passive ? */
132 struct list
*mt_settings
; /* IS-IS MT Settings */
133 struct list
*ip_addrs
; /* our IP addresses */
134 int ipv6_router
; /* Route IPv6 ? */
135 struct list
*ipv6_link
; /* our link local IPv6 addresses */
136 struct list
*ipv6_non_link
; /* our non-link local IPv6 addresses */
137 uint16_t upadjcount
[ISIS_LEVELS
];
138 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
140 bool disable_threeway_adj
;
141 struct bfd_info
*bfd_info
;
142 struct ldp_sync_info
*ldp_sync_info
;
144 * Counters as in 10589--11.2.5.9
146 uint32_t adj_state_changes
; /* changesInAdjacencyState */
147 uint32_t init_failures
; /* intialisationFailures */
148 uint32_t ctrl_pdus_rxed
; /* controlPDUsReceived */
149 uint32_t ctrl_pdus_txed
; /* controlPDUsSent */
150 uint32_t desig_changes
[ISIS_LEVELS
]; /* lanLxDesignatedIntermediateSystemChanges
152 uint32_t rej_adjacencies
; /* rejectedAdjacencies */
154 * Counters as in ietf-isis@2019-09-09.yang
156 uint32_t id_len_mismatches
; /* id-len-mismatch */
157 uint32_t max_area_addr_mismatches
; /* max-area-addresses-mismatch */
158 uint32_t auth_type_failures
; /*authentication-type-fails */
159 uint32_t auth_failures
; /* authentication-fails */
163 DECLARE_QOBJ_TYPE(isis_circuit
)
165 void isis_circuit_init(void);
166 struct isis_circuit
*isis_circuit_new(void);
167 void isis_circuit_del(struct isis_circuit
*circuit
);
168 struct isis_circuit
*circuit_lookup_by_ifp(struct interface
*ifp
,
170 struct isis_circuit
*circuit_scan_by_ifp(struct interface
*ifp
);
171 void isis_circuit_configure(struct isis_circuit
*circuit
,
172 struct isis_area
*area
);
173 void isis_circuit_deconfigure(struct isis_circuit
*circuit
,
174 struct isis_area
*area
);
175 void isis_circuit_if_add(struct isis_circuit
*circuit
, struct interface
*ifp
);
176 void isis_circuit_if_del(struct isis_circuit
*circuit
, struct interface
*ifp
);
177 void isis_circuit_if_bind(struct isis_circuit
*circuit
, struct interface
*ifp
);
178 void isis_circuit_if_unbind(struct isis_circuit
*circuit
,
179 struct interface
*ifp
);
180 void isis_circuit_add_addr(struct isis_circuit
*circuit
,
181 struct connected
*conn
);
182 void isis_circuit_del_addr(struct isis_circuit
*circuit
,
183 struct connected
*conn
);
184 void isis_circuit_prepare(struct isis_circuit
*circuit
);
185 int isis_circuit_up(struct isis_circuit
*circuit
);
186 void isis_circuit_down(struct isis_circuit
*);
187 void circuit_update_nlpids(struct isis_circuit
*circuit
);
188 void isis_circuit_print_vty(struct isis_circuit
*circuit
, struct vty
*vty
,
190 size_t isis_circuit_pdu_size(struct isis_circuit
*circuit
);
191 void isis_circuit_stream(struct isis_circuit
*circuit
, struct stream
**stream
);
193 struct isis_circuit
*isis_circuit_create(struct isis_area
*area
,
194 struct interface
*ifp
);
195 void isis_circuit_af_set(struct isis_circuit
*circuit
, bool ip_router
,
197 ferr_r
isis_circuit_passive_set(struct isis_circuit
*circuit
, bool passive
);
198 void isis_circuit_is_type_set(struct isis_circuit
*circuit
, int is_type
);
199 void isis_circuit_circ_type_set(struct isis_circuit
*circuit
, int circ_type
);
201 ferr_r
isis_circuit_metric_set(struct isis_circuit
*circuit
, int level
,
204 ferr_r
isis_circuit_passwd_unset(struct isis_circuit
*circuit
);
205 ferr_r
isis_circuit_passwd_set(struct isis_circuit
*circuit
,
206 uint8_t passwd_type
, const char *passwd
);
207 ferr_r
isis_circuit_passwd_cleartext_set(struct isis_circuit
*circuit
,
209 ferr_r
isis_circuit_passwd_hmac_md5_set(struct isis_circuit
*circuit
,
212 int isis_circuit_mt_enabled_set(struct isis_circuit
*circuit
, uint16_t mtid
,
216 DECLARE_HOOK(isis_circuit_config_write
,
217 (struct isis_circuit
*circuit
, struct vty
*vty
),
221 #endif /* _ZEBRA_ISIS_CIRCUIT_H */