]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_circuit.h
zebra: Fix label manager memory leak (#5680)
[mirror_frr.git] / isisd / isis_circuit.h
CommitLineData
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
35DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
36
58e16237
CF
37struct isis_lsp;
38
d62a17ae 39struct password {
40 struct password *next;
41 int len;
d7c0a89a 42 uint8_t *pass;
eb5d44eb 43};
44
d62a17ae 45struct 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 52struct isis_bcast_info {
d7c0a89a 53 uint8_t snpa[ETH_ALEN]; /* SNPA of this circuit */
d62a17ae 54 char run_dr_elect[2]; /* Should we run dr election ? */
55 struct thread *t_run_dr[2]; /* DR election thread */
56 struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
57 struct list *adjdb[2]; /* adjacency dbs */
58 struct list *lan_neighs[2]; /* list of lx neigh snpa */
59 char is_dr[2]; /* Are we level x DR ? */
d7c0a89a
QY
60 uint8_t l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
61 uint8_t l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
d62a17ae 62 struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
eb5d44eb 63};
64
d62a17ae 65struct isis_p2p_info {
66 struct isis_adjacency *neighbor;
67 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
eb5d44eb 68};
69
215eccb0
CF
70struct bfd_info;
71
7da4aa3c
CF
72struct isis_circuit_arg {
73 int level;
74 struct isis_circuit *circuit;
75};
76
d62a17ae 77struct isis_circuit {
78 int state;
d7c0a89a 79 uint8_t circuit_id; /* l1/l2 bcast CircuitID */
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;
89 struct thread *t_send_csnp[2];
90 struct thread *t_send_psnp[2];
9b39405f 91 struct isis_tx_queue *tx_queue;
7da4aa3c 92 struct isis_circuit_arg level_arg[2]; /* used as argument for threads */
9b39405f 93
d62a17ae 94 /* there is no real point in two streams, just for programming kicker */
d7c0a89a 95 int (*rx)(struct isis_circuit *circuit, uint8_t *ssnpa);
d62a17ae 96 struct stream *rcv_stream; /* Stream for receiving */
97 int (*tx)(struct isis_circuit *circuit, int level);
98 struct stream *snd_stream; /* Stream for sending */
99 int idx; /* idx in S[RM|SN] flags */
3f045a08
JB
100#define CIRCUIT_T_UNKNOWN 0
101#define CIRCUIT_T_BROADCAST 1
102#define CIRCUIT_T_P2P 2
103#define CIRCUIT_T_LOOPBACK 3
d62a17ae 104 int circ_type; /* type of the physical interface */
105 int circ_type_config; /* config type of the physical interface */
106 union {
107 struct isis_bcast_info bc;
108 struct isis_p2p_info p2p;
109 } u;
d7c0a89a 110 uint8_t priority[2]; /* l1/2 IS configured priority */
d62a17ae 111 int pad_hellos; /* add padding to Hello PDUs ? */
112 char ext_domain; /* externalDomain (boolean) */
113 int lsp_regenerate_pending[ISIS_LEVELS];
114 /*
115 * Configurables
116 */
117 struct isis_passwd passwd; /* Circuit rx/tx password */
118 int is_type; /* circuit is type == level of circuit
119 * differentiated from circuit type (media) */
ef020087
CF
120 uint32_t hello_interval[2]; /* hello-interval in seconds */
121 uint16_t hello_multiplier[2]; /* hello-multiplier */
122 uint16_t csnp_interval[2]; /* csnp-interval in seconds */
123 uint16_t psnp_interval[2]; /* psnp-interval in seconds */
d7c0a89a
QY
124 uint8_t metric[2];
125 uint32_t te_metric[2];
1b3f47d0 126 struct isis_ext_subtlvs *ext; /* Extended parameters (TE + Adj SID */
d62a17ae 127 int ip_router; /* Route IP ? */
128 int is_passive; /* Is Passive ? */
129 struct list *mt_settings; /* IS-IS MT Settings */
130 struct list *ip_addrs; /* our IP addresses */
131 int ipv6_router; /* Route IPv6 ? */
132 struct list *ipv6_link; /* our link local IPv6 addresses */
133 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
d7c0a89a 134 uint16_t upadjcount[2];
3f045a08 135#define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
d7c0a89a 136 uint8_t flags;
58e5d748 137 bool disable_threeway_adj;
215eccb0 138 struct bfd_info *bfd_info;
d62a17ae 139 /*
140 * Counters as in 10589--11.2.5.9
141 */
d7c0a89a
QY
142 uint32_t adj_state_changes; /* changesInAdjacencyState */
143 uint32_t init_failures; /* intialisationFailures */
144 uint32_t ctrl_pdus_rxed; /* controlPDUsReceived */
145 uint32_t ctrl_pdus_txed; /* controlPDUsSent */
146 uint32_t
d62a17ae 147 desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
d7c0a89a 148 uint32_t rej_adjacencies; /* rejectedAdjacencies */
c32496ee
RW
149 /*
150 * Counters as in ietf-isis@2019-09-09.yang
151 */
152 uint32_t id_len_mismatches; /* id-len-mismatch */
153 uint32_t max_area_addr_mismatches; /* max-area-addresses-mismatch */
154 uint32_t auth_type_failures; /*authentication-type-fails */
155 uint32_t auth_failures; /* authentication-fails */
d62a17ae 156
157 QOBJ_FIELDS
eb5d44eb 158};
676a4ea3 159DECLARE_QOBJ_TYPE(isis_circuit)
eb5d44eb 160
d62a17ae 161void isis_circuit_init(void);
162struct isis_circuit *isis_circuit_new(void);
163void isis_circuit_del(struct isis_circuit *circuit);
164struct isis_circuit *circuit_lookup_by_ifp(struct interface *ifp,
165 struct list *list);
166struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp);
167void isis_circuit_configure(struct isis_circuit *circuit,
168 struct isis_area *area);
169void isis_circuit_deconfigure(struct isis_circuit *circuit,
170 struct isis_area *area);
171void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp);
172void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp);
173void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp);
174void isis_circuit_if_unbind(struct isis_circuit *circuit,
175 struct interface *ifp);
176void isis_circuit_add_addr(struct isis_circuit *circuit,
177 struct connected *conn);
178void isis_circuit_del_addr(struct isis_circuit *circuit,
179 struct connected *conn);
180void isis_circuit_prepare(struct isis_circuit *circuit);
181int isis_circuit_up(struct isis_circuit *circuit);
182void isis_circuit_down(struct isis_circuit *);
183void circuit_update_nlpids(struct isis_circuit *circuit);
184void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
185 char detail);
b20ccb3a
CF
186size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
187void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
3f045a08 188
d62a17ae 189struct isis_circuit *isis_circuit_create(struct isis_area *area,
190 struct interface *ifp);
191void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router,
192 bool ipv6_router);
64dd3ffe 193ferr_r isis_circuit_passive_set(struct isis_circuit *circuit, bool passive);
d62a17ae 194void isis_circuit_is_type_set(struct isis_circuit *circuit, int is_type);
d0820765 195void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type);
d62a17ae 196
64dd3ffe
DL
197ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
198 int metric);
d62a17ae 199
64dd3ffe 200ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit);
e28544ed
QY
201ferr_r isis_circuit_passwd_set(struct isis_circuit *circuit,
202 uint8_t passwd_type, const char *passwd);
64dd3ffe
DL
203ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
204 const char *passwd);
205ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
206 const char *passwd);
d62a17ae 207
208int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
209 bool enabled);
064f4896 210
d56afe53
CF
211DECLARE_HOOK(isis_circuit_config_write,
212 (struct isis_circuit *circuit, struct vty *vty),
213 (circuit, vty))
214
eb5d44eb 215#endif /* _ZEBRA_ISIS_CIRCUIT_H */