]>
Commit | Line | Data |
---|---|---|
7ef5fefc CF |
1 | /* |
2 | * IS-IS TLV Serializer/Deserializer | |
3 | * | |
4 | * Copyright (C) 2015,2017 Christian Franke | |
1b3f47d0 OD |
5 | |
6 | * Copyright (C) 2019 Olivier Dugeon - Orange Labs (for TE and SR) | |
7ef5fefc CF |
7 | * |
8 | * This file is part of FRR. | |
9 | * | |
10 | * FRR is free software; you can redistribute it and/or modify it | |
11 | * under the terms of the GNU General Public License as published by the | |
12 | * Free Software Foundation; either version 2, or (at your option) any | |
13 | * later version. | |
14 | * | |
15 | * FRR is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with FRR; see the file COPYING. If not, write to the Free | |
22 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
23 | * 02111-1307, USA. | |
24 | */ | |
841791b6 CF |
25 | #ifndef ISIS_TLVS_H |
26 | #define ISIS_TLVS_H | |
7ef5fefc CF |
27 | |
28 | #include "openbsd-tree.h" | |
29 | #include "prefix.h" | |
7ef5fefc | 30 | |
4bef0ec4 | 31 | struct lspdb_head; |
7ef5fefc CF |
32 | struct isis_subtlvs; |
33 | ||
34 | struct isis_area_address; | |
35 | struct isis_area_address { | |
36 | struct isis_area_address *next; | |
37 | ||
38 | uint8_t addr[20]; | |
39 | uint8_t len; | |
40 | }; | |
41 | ||
42 | struct isis_oldstyle_reach; | |
43 | struct isis_oldstyle_reach { | |
44 | struct isis_oldstyle_reach *next; | |
45 | ||
46 | uint8_t id[7]; | |
47 | uint8_t metric; | |
48 | }; | |
49 | ||
50 | struct isis_oldstyle_ip_reach; | |
51 | struct isis_oldstyle_ip_reach { | |
52 | struct isis_oldstyle_ip_reach *next; | |
53 | ||
54 | uint8_t metric; | |
55 | struct prefix_ipv4 prefix; | |
56 | }; | |
57 | ||
58 | struct isis_lsp_entry; | |
59 | struct isis_lsp_entry { | |
60 | struct isis_lsp_entry *next; | |
61 | ||
62 | uint16_t rem_lifetime; | |
63 | uint8_t id[8]; | |
64 | uint16_t checksum; | |
65 | uint32_t seqno; | |
66 | ||
67 | struct isis_lsp *lsp; | |
68 | }; | |
69 | ||
70 | struct isis_extended_reach; | |
1b3f47d0 | 71 | struct isis_ext_subtlvs; |
7ef5fefc CF |
72 | struct isis_extended_reach { |
73 | struct isis_extended_reach *next; | |
74 | ||
75 | uint8_t id[7]; | |
76 | uint32_t metric; | |
77 | ||
1b3f47d0 | 78 | struct isis_ext_subtlvs *subtlvs; |
7ef5fefc CF |
79 | }; |
80 | ||
81 | struct isis_extended_ip_reach; | |
82 | struct isis_extended_ip_reach { | |
83 | struct isis_extended_ip_reach *next; | |
84 | ||
85 | uint32_t metric; | |
86 | bool down; | |
87 | struct prefix_ipv4 prefix; | |
bd507085 CF |
88 | |
89 | struct isis_subtlvs *subtlvs; | |
7ef5fefc CF |
90 | }; |
91 | ||
92 | struct isis_ipv6_reach; | |
93 | struct isis_ipv6_reach { | |
94 | struct isis_ipv6_reach *next; | |
95 | ||
96 | uint32_t metric; | |
97 | bool down; | |
98 | bool external; | |
99 | ||
100 | struct prefix_ipv6 prefix; | |
101 | ||
102 | struct isis_subtlvs *subtlvs; | |
103 | }; | |
104 | ||
105 | struct isis_protocols_supported { | |
106 | uint8_t count; | |
107 | uint8_t *protocols; | |
108 | }; | |
109 | ||
41a145f1 CF |
110 | #define ISIS_TIER_UNDEFINED 15 |
111 | ||
112 | struct isis_spine_leaf { | |
113 | uint8_t tier; | |
114 | ||
115 | bool has_tier; | |
116 | bool is_leaf; | |
117 | bool is_spine; | |
118 | bool is_backup; | |
119 | }; | |
120 | ||
9fe21208 CF |
121 | enum isis_threeway_state { |
122 | ISIS_THREEWAY_DOWN = 2, | |
123 | ISIS_THREEWAY_INITIALIZING = 1, | |
124 | ISIS_THREEWAY_UP = 0 | |
125 | }; | |
126 | ||
127 | struct isis_threeway_adj { | |
128 | enum isis_threeway_state state; | |
129 | uint32_t local_circuit_id; | |
130 | bool neighbor_set; | |
131 | uint8_t neighbor_id[6]; | |
132 | uint32_t neighbor_circuit_id; | |
133 | }; | |
134 | ||
1b3f47d0 OD |
135 | /* |
136 | * Segment Routing subTLV's as per | |
137 | * draft-ietf-isis-segment-routing-extension-25 | |
138 | */ | |
139 | #define ISIS_SUBTLV_SRGB_FLAG_I 0x80 | |
140 | #define ISIS_SUBTLV_SRGB_FLAG_V 0x40 | |
141 | #define IS_SR_IPV4(srgb) (srgb.flags & ISIS_SUBTLV_SRGB_FLAG_I) | |
142 | #define IS_SR_IPV6(srgb) (srgb.flags & ISIS_SUBTLV_SRGB_FLAG_V) | |
143 | ||
144 | /* Structure aggregating SRGB info */ | |
145 | struct isis_srgb { | |
146 | uint8_t flags; | |
147 | uint32_t range_size; | |
148 | uint32_t lower_bound; | |
149 | }; | |
150 | ||
151 | /* Prefix-SID sub-TLVs flags */ | |
152 | #define ISIS_PREFIX_SID_READVERTISED 0x80 | |
153 | #define ISIS_PREFIX_SID_NODE 0x40 | |
154 | #define ISIS_PREFIX_SID_NO_PHP 0x20 | |
155 | #define ISIS_PREFIX_SID_EXPLICIT_NULL 0x10 | |
156 | #define ISIS_PREFIX_SID_VALUE 0x08 | |
157 | #define ISIS_PREFIX_SID_LOCAL 0x04 | |
158 | ||
159 | struct isis_prefix_sid; | |
160 | struct isis_prefix_sid { | |
161 | struct isis_prefix_sid *next; | |
162 | ||
163 | uint8_t flags; | |
164 | uint8_t algorithm; | |
165 | uint32_t value; | |
166 | }; | |
167 | ||
168 | /* Adj-SID and LAN-Ajd-SID sub-TLVs flags */ | |
169 | #define EXT_SUBTLV_LINK_ADJ_SID_FFLG 0x80 | |
170 | #define EXT_SUBTLV_LINK_ADJ_SID_BFLG 0x40 | |
171 | #define EXT_SUBTLV_LINK_ADJ_SID_VFLG 0x20 | |
172 | #define EXT_SUBTLV_LINK_ADJ_SID_LFLG 0x10 | |
173 | #define EXT_SUBTLV_LINK_ADJ_SID_SFLG 0x08 | |
174 | #define EXT_SUBTLV_LINK_ADJ_SID_PFLG 0x04 | |
175 | ||
176 | struct isis_adj_sid; | |
177 | struct isis_adj_sid { | |
178 | struct isis_adj_sid *next; | |
179 | ||
180 | uint8_t family; | |
181 | uint8_t flags; | |
182 | uint8_t weight; | |
183 | uint32_t sid; | |
184 | }; | |
185 | ||
186 | struct isis_lan_adj_sid; | |
187 | struct isis_lan_adj_sid { | |
188 | struct isis_lan_adj_sid *next; | |
189 | ||
190 | uint8_t family; | |
191 | uint8_t flags; | |
192 | uint8_t weight; | |
193 | uint8_t neighbor_id[ISIS_SYS_ID_LEN]; | |
194 | uint32_t sid; | |
195 | }; | |
196 | ||
197 | /* RFC 4971 & RFC 7981 */ | |
198 | #define ISIS_ROUTER_CAP_FLAG_S 0x01 | |
199 | #define ISIS_ROUTER_CAP_FLAG_D 0x02 | |
200 | #define ISIS_ROUTER_CAP_SIZE 5 | |
201 | ||
202 | /* Number of supported algorithm for Segment Routing. | |
203 | * Right now only 2 have been standardized: | |
204 | * - 0: SPF | |
205 | * - 1: Strict SPF | |
206 | */ | |
207 | #define SR_ALGORITHM_COUNT 2 | |
208 | #define SR_ALGORITHM_SPF 0 | |
209 | #define SR_ALGORITHM_STRICT_SPF 1 | |
210 | #define SR_ALGORITHM_UNSET 255 | |
211 | ||
212 | struct isis_router_cap { | |
213 | struct in_addr router_id; | |
214 | uint8_t flags; | |
215 | ||
216 | /* draft-ietf-segment-routing-extensions-25 */ | |
217 | struct isis_srgb srgb; | |
218 | uint8_t algo[SR_ALGORITHM_COUNT]; | |
219 | /* RFC 8491 */ | |
220 | #define MSD_TYPE_BASE_MPLS_IMPOSITION 0x01 | |
221 | uint8_t msd; | |
222 | }; | |
223 | ||
7ef5fefc CF |
224 | struct isis_item; |
225 | struct isis_item { | |
226 | struct isis_item *next; | |
227 | }; | |
228 | ||
229 | struct isis_lan_neighbor; | |
230 | struct isis_lan_neighbor { | |
231 | struct isis_lan_neighbor *next; | |
232 | ||
233 | uint8_t mac[6]; | |
234 | }; | |
235 | ||
236 | struct isis_ipv4_address; | |
237 | struct isis_ipv4_address { | |
238 | struct isis_ipv4_address *next; | |
239 | ||
240 | struct in_addr addr; | |
241 | }; | |
242 | ||
243 | struct isis_ipv6_address; | |
244 | struct isis_ipv6_address { | |
245 | struct isis_ipv6_address *next; | |
246 | ||
247 | struct in6_addr addr; | |
248 | }; | |
249 | ||
250 | struct isis_mt_router_info; | |
251 | struct isis_mt_router_info { | |
252 | struct isis_mt_router_info *next; | |
253 | ||
254 | bool overload; | |
255 | bool attached; | |
256 | uint16_t mtid; | |
257 | }; | |
258 | ||
259 | struct isis_auth; | |
260 | struct isis_auth { | |
261 | struct isis_auth *next; | |
262 | ||
263 | uint8_t type; | |
264 | uint8_t length; | |
265 | uint8_t value[256]; | |
266 | ||
267 | uint8_t plength; | |
268 | uint8_t passwd[256]; | |
269 | ||
270 | size_t offset; /* Only valid after packing */ | |
271 | }; | |
272 | ||
273 | struct isis_item_list; | |
274 | struct isis_item_list { | |
275 | struct isis_item *head; | |
276 | struct isis_item **tail; | |
277 | ||
278 | RB_ENTRY(isis_item_list) mt_tree; | |
279 | uint16_t mtid; | |
280 | unsigned int count; | |
281 | }; | |
282 | ||
5f77d901 CF |
283 | struct isis_purge_originator { |
284 | bool sender_set; | |
285 | ||
286 | uint8_t generator[6]; | |
287 | uint8_t sender[6]; | |
288 | }; | |
289 | ||
3380c990 EDP |
290 | enum isis_auth_result { |
291 | ISIS_AUTH_OK = 0, | |
292 | ISIS_AUTH_TYPE_FAILURE, | |
293 | ISIS_AUTH_FAILURE, | |
294 | ISIS_AUTH_NO_VALIDATOR, | |
295 | }; | |
296 | ||
7ef5fefc CF |
297 | RB_HEAD(isis_mt_item_list, isis_item_list); |
298 | ||
299 | struct isis_item_list *isis_get_mt_items(struct isis_mt_item_list *m, | |
300 | uint16_t mtid); | |
301 | struct isis_item_list *isis_lookup_mt_items(struct isis_mt_item_list *m, | |
302 | uint16_t mtid); | |
303 | ||
304 | struct isis_tlvs { | |
305 | struct isis_item_list isis_auth; | |
5f77d901 | 306 | struct isis_purge_originator *purge_originator; |
7ef5fefc CF |
307 | struct isis_item_list area_addresses; |
308 | struct isis_item_list oldstyle_reach; | |
309 | struct isis_item_list lan_neighbor; | |
310 | struct isis_item_list lsp_entries; | |
311 | struct isis_item_list extended_reach; | |
312 | struct isis_mt_item_list mt_reach; | |
313 | struct isis_item_list oldstyle_ip_reach; | |
314 | struct isis_protocols_supported protocols_supported; | |
315 | struct isis_item_list oldstyle_ip_reach_ext; | |
316 | struct isis_item_list ipv4_address; | |
317 | struct isis_item_list ipv6_address; | |
318 | struct isis_item_list mt_router_info; | |
319 | bool mt_router_info_empty; | |
320 | struct in_addr *te_router_id; | |
321 | struct isis_item_list extended_ip_reach; | |
322 | struct isis_mt_item_list mt_ip_reach; | |
323 | char *hostname; | |
324 | struct isis_item_list ipv6_reach; | |
325 | struct isis_mt_item_list mt_ipv6_reach; | |
9fe21208 | 326 | struct isis_threeway_adj *threeway_adj; |
1b3f47d0 | 327 | struct isis_router_cap *router_cap; |
41a145f1 | 328 | struct isis_spine_leaf *spine_leaf; |
7ef5fefc CF |
329 | }; |
330 | ||
7ef5fefc CF |
331 | enum isis_tlv_context { |
332 | ISIS_CONTEXT_LSP, | |
333 | ISIS_CONTEXT_SUBTLV_NE_REACH, | |
334 | ISIS_CONTEXT_SUBTLV_IP_REACH, | |
335 | ISIS_CONTEXT_SUBTLV_IPV6_REACH, | |
336 | ISIS_CONTEXT_MAX | |
337 | }; | |
338 | ||
bd507085 CF |
339 | struct isis_subtlvs { |
340 | enum isis_tlv_context context; | |
341 | ||
342 | /* draft-baker-ipv6-isis-dst-src-routing-06 */ | |
343 | struct prefix_ipv6 *source_prefix; | |
1b3f47d0 | 344 | /* draft-ietf-isis-segment-routing-extensions-25 */ |
bd507085 CF |
345 | struct isis_item_list prefix_sids; |
346 | }; | |
347 | ||
7ef5fefc | 348 | enum isis_tlv_type { |
1b3f47d0 | 349 | /* TLVs code point */ |
7ef5fefc CF |
350 | ISIS_TLV_AREA_ADDRESSES = 1, |
351 | ISIS_TLV_OLDSTYLE_REACH = 2, | |
352 | ISIS_TLV_LAN_NEIGHBORS = 6, | |
353 | ISIS_TLV_PADDING = 8, | |
354 | ISIS_TLV_LSP_ENTRY = 9, | |
355 | ISIS_TLV_AUTH = 10, | |
5f77d901 | 356 | ISIS_TLV_PURGE_ORIGINATOR = 13, |
7ef5fefc CF |
357 | ISIS_TLV_EXTENDED_REACH = 22, |
358 | ||
359 | ISIS_TLV_OLDSTYLE_IP_REACH = 128, | |
360 | ISIS_TLV_PROTOCOLS_SUPPORTED = 129, | |
361 | ISIS_TLV_OLDSTYLE_IP_REACH_EXT = 130, | |
362 | ISIS_TLV_IPV4_ADDRESS = 132, | |
363 | ISIS_TLV_TE_ROUTER_ID = 134, | |
364 | ISIS_TLV_EXTENDED_IP_REACH = 135, | |
365 | ISIS_TLV_DYNAMIC_HOSTNAME = 137, | |
41a145f1 | 366 | ISIS_TLV_SPINE_LEAF_EXT = 150, |
7ef5fefc CF |
367 | ISIS_TLV_MT_REACH = 222, |
368 | ISIS_TLV_MT_ROUTER_INFO = 229, | |
369 | ISIS_TLV_IPV6_ADDRESS = 232, | |
370 | ISIS_TLV_MT_IP_REACH = 235, | |
371 | ISIS_TLV_IPV6_REACH = 236, | |
372 | ISIS_TLV_MT_IPV6_REACH = 237, | |
9fe21208 | 373 | ISIS_TLV_THREE_WAY_ADJ = 240, |
1b3f47d0 | 374 | ISIS_TLV_ROUTER_CAPABILITY = 242, |
7ef5fefc CF |
375 | ISIS_TLV_MAX = 256, |
376 | ||
1b3f47d0 OD |
377 | /* subTLVs code point */ |
378 | ISIS_SUBTLV_IPV6_SOURCE_PREFIX = 22, | |
379 | ||
380 | /* RFC 5305 & RFC 6119 */ | |
381 | ISIS_SUBTLV_ADMIN_GRP = 3, | |
382 | ISIS_SUBTLV_LOCAL_IPADDR = 6, | |
383 | ISIS_SUBTLV_RMT_IPADDR = 8, | |
384 | ISIS_SUBTLV_MAX_BW = 9, | |
385 | ISIS_SUBTLV_MAX_RSV_BW = 10, | |
386 | ISIS_SUBTLV_UNRSV_BW = 11, | |
387 | ISIS_SUBTLV_LOCAL_IPADDR6 = 12, | |
388 | ISIS_SUBTLV_RMT_IPADDR6 = 13, | |
389 | ISIS_SUBTLV_TE_METRIC = 18, | |
390 | ||
391 | /* RFC 5307 */ | |
392 | ISIS_SUBTLV_LLRI = 4, | |
393 | ||
394 | /* RFC 5316 */ | |
395 | ISIS_SUBTLV_RAS = 24, | |
396 | ISIS_SUBTLV_RIP = 25, | |
397 | ||
398 | /* draft-isis-segment-routing-extension-25 */ | |
399 | ISIS_SUBTLV_SID_LABEL = 1, | |
400 | ISIS_SUBTLV_SID_LABEL_RANGE = 2, | |
401 | ISIS_SUBTLV_ALGORITHM = 19, | |
402 | ISIS_SUBTLV_NODE_MSD = 23, | |
bd507085 | 403 | ISIS_SUBTLV_PREFIX_SID = 3, |
1b3f47d0 OD |
404 | ISIS_SUBTLV_ADJ_SID = 31, |
405 | ISIS_SUBTLV_LAN_ADJ_SID = 32, | |
406 | ||
407 | /* RFC 7810 */ | |
408 | ISIS_SUBTLV_AV_DELAY = 33, | |
409 | ISIS_SUBTLV_MM_DELAY = 34, | |
410 | ISIS_SUBTLV_DELAY_VAR = 35, | |
411 | ISIS_SUBTLV_PKT_LOSS = 36, | |
412 | ISIS_SUBTLV_RES_BW = 37, | |
413 | ISIS_SUBTLV_AVA_BW = 38, | |
414 | ISIS_SUBTLV_USE_BW = 39, | |
415 | ||
416 | ISIS_SUBTLV_MAX = 40 | |
417 | }; | |
418 | ||
419 | /* subTLVs size for TE and SR */ | |
420 | enum ext_subtlv_size { | |
421 | ISIS_SUBTLV_LLRI_SIZE = 8, | |
422 | ||
423 | ISIS_SUBTLV_UNRSV_BW_SIZE = 32, | |
424 | ISIS_SUBTLV_TE_METRIC_SIZE = 3, | |
425 | ISIS_SUBTLV_IPV6_ADDR_SIZE = 16, | |
426 | ||
427 | /* draft-isis-segment-routing-extension-25 */ | |
428 | ISIS_SUBTLV_SID_LABEL_SIZE = 3, | |
429 | ISIS_SUBTLV_SID_LABEL_RANGE_SIZE = 9, | |
430 | ISIS_SUBTLV_ALGORITHM_SIZE = 4, | |
431 | ISIS_SUBTLV_NODE_MSD_SIZE = 2, | |
432 | ISIS_SUBTLV_ADJ_SID_SIZE = 5, | |
433 | ISIS_SUBTLV_LAN_ADJ_SID_SIZE = 11, | |
434 | ISIS_SUBTLV_PREFIX_SID_SIZE = 5, | |
435 | ||
436 | ISIS_SUBTLV_MM_DELAY_SIZE = 8, | |
437 | ||
438 | ISIS_SUBTLV_HDR_SIZE = 2, | |
439 | ISIS_SUBTLV_DEF_SIZE = 4, | |
440 | ||
441 | ISIS_SUBTLV_MAX_SIZE = 180 | |
442 | }; | |
443 | ||
444 | /* Macros to manage the optional presence of EXT subTLVs */ | |
445 | #define SET_SUBTLV(s, t) ((s->status) |= (t)) | |
446 | #define UNSET_SUBTLV(s, t) ((s->status) &= ~(t)) | |
447 | #define IS_SUBTLV(s, t) (s->status & t) | |
448 | ||
449 | #define EXT_DISABLE 0x000000 | |
450 | #define EXT_ADM_GRP 0x000001 | |
451 | #define EXT_LLRI 0x000002 | |
452 | #define EXT_LOCAL_ADDR 0x000004 | |
453 | #define EXT_NEIGH_ADDR 0x000008 | |
454 | #define EXT_LOCAL_ADDR6 0x000010 | |
455 | #define EXT_NEIGH_ADDR6 0x000020 | |
456 | #define EXT_MAX_BW 0x000040 | |
457 | #define EXT_MAX_RSV_BW 0x000080 | |
458 | #define EXT_UNRSV_BW 0x000100 | |
459 | #define EXT_TE_METRIC 0x000200 | |
460 | #define EXT_RMT_AS 0x000400 | |
461 | #define EXT_RMT_IP 0x000800 | |
462 | #define EXT_ADJ_SID 0x001000 | |
463 | #define EXT_LAN_ADJ_SID 0x002000 | |
464 | #define EXT_DELAY 0x004000 | |
465 | #define EXT_MM_DELAY 0x008000 | |
466 | #define EXT_DELAY_VAR 0x010000 | |
467 | #define EXT_PKT_LOSS 0x020000 | |
468 | #define EXT_RES_BW 0x040000 | |
469 | #define EXT_AVA_BW 0x080000 | |
470 | #define EXT_USE_BW 0x100000 | |
471 | ||
472 | /* | |
473 | * This structure groups all Extended IS Reachability subTLVs. | |
474 | * | |
475 | * Each bit of the status field indicates if a subTLVs is valid or not. | |
476 | * SubTLVs values use following units: | |
477 | * - Bandwidth in bytes/sec following IEEE format, | |
478 | * - Delay in micro-seconds with only 24 bits significant | |
479 | * - Packet Loss in percentage of total traffic with only 24 bits (2^24 - 2) | |
480 | * | |
481 | * For Delay and packet Loss, upper bit (A) indicates if the value is | |
482 | * normal (0) or anomalous (1). | |
483 | */ | |
484 | #define IS_ANORMAL(v) (v & 0x80000000) | |
485 | ||
486 | struct isis_ext_subtlvs { | |
487 | ||
488 | uint32_t status; | |
489 | ||
490 | uint32_t adm_group; /* Resource Class/Color - RFC 5305 */ | |
491 | /* Link Local/Remote Identifiers - RFC 5307 */ | |
492 | uint32_t local_llri; | |
493 | uint32_t remote_llri; | |
494 | struct in_addr local_addr; /* Local IP Address - RFC 5305 */ | |
495 | struct in_addr neigh_addr; /* Neighbor IP Address - RFC 5305 */ | |
496 | struct in6_addr local_addr6; /* Local IPv6 Address - RFC 6119 */ | |
497 | struct in6_addr neigh_addr6; /* Neighbor IPv6 Address - RFC 6119 */ | |
498 | float max_bw; /* Maximum Bandwidth - RFC 5305 */ | |
499 | float max_rsv_bw; /* Maximum Reservable Bandwidth - RFC 5305 */ | |
500 | float unrsv_bw[8]; /* Unreserved Bandwidth - RFC 5305 */ | |
501 | uint32_t te_metric; /* Traffic Engineering Metric - RFC 5305 */ | |
502 | uint32_t remote_as; /* Remote AS Number sub-TLV - RFC5316 */ | |
503 | struct in_addr remote_ip; /* IPv4 Remote ASBR ID Sub-TLV - RFC5316 */ | |
504 | ||
505 | uint32_t delay; /* Average Link Delay - RFC 8570 */ | |
506 | uint32_t min_delay; /* Low Link Delay - RFC 8570 */ | |
507 | uint32_t max_delay; /* High Link Delay - RFC 8570 */ | |
508 | uint32_t delay_var; /* Link Delay Variation i.e. Jitter - RFC 8570 */ | |
509 | uint32_t pkt_loss; /* Unidirectional Link Packet Loss - RFC 8570 */ | |
510 | float res_bw; /* Unidirectional Residual Bandwidth - RFC 8570 */ | |
511 | float ava_bw; /* Unidirectional Available Bandwidth - RFC 8570 */ | |
512 | float use_bw; /* Unidirectional Utilized Bandwidth - RFC 8570 */ | |
513 | ||
514 | /* Segment Routing Adjacency & LAN Adjacency Segment ID */ | |
515 | struct isis_item_list adj_sid; | |
516 | struct isis_item_list lan_sid; | |
7ef5fefc CF |
517 | }; |
518 | ||
519 | #define IS_COMPAT_MT_TLV(tlv_type) \ | |
520 | ((tlv_type == ISIS_TLV_MT_REACH) || (tlv_type == ISIS_TLV_MT_IP_REACH) \ | |
521 | || (tlv_type == ISIS_TLV_MT_IPV6_REACH)) | |
522 | ||
523 | struct stream; | |
524 | int isis_pack_tlvs(struct isis_tlvs *tlvs, struct stream *stream, | |
525 | size_t len_pointer, bool pad, bool is_lsp); | |
526 | void isis_free_tlvs(struct isis_tlvs *tlvs); | |
527 | struct isis_tlvs *isis_alloc_tlvs(void); | |
528 | int isis_unpack_tlvs(size_t avail_len, struct stream *stream, | |
529 | struct isis_tlvs **dest, const char **error_log); | |
530 | const char *isis_format_tlvs(struct isis_tlvs *tlvs); | |
531 | struct isis_tlvs *isis_copy_tlvs(struct isis_tlvs *tlvs); | |
532 | struct list *isis_fragment_tlvs(struct isis_tlvs *tlvs, size_t size); | |
533 | ||
534 | #define ISIS_EXTENDED_IP_REACH_DOWN 0x80 | |
535 | #define ISIS_EXTENDED_IP_REACH_SUBTLV 0x40 | |
536 | ||
537 | #define ISIS_IPV6_REACH_DOWN 0x80 | |
538 | #define ISIS_IPV6_REACH_EXTERNAL 0x40 | |
539 | #define ISIS_IPV6_REACH_SUBTLV 0x20 | |
540 | ||
541 | #ifndef ISIS_MT_MASK | |
542 | #define ISIS_MT_MASK 0x0fff | |
543 | #define ISIS_MT_OL_MASK 0x8000 | |
544 | #define ISIS_MT_AT_MASK 0x4000 | |
545 | #endif | |
546 | ||
7ef5fefc CF |
547 | void isis_tlvs_add_auth(struct isis_tlvs *tlvs, struct isis_passwd *passwd); |
548 | void isis_tlvs_add_area_addresses(struct isis_tlvs *tlvs, | |
549 | struct list *addresses); | |
550 | void isis_tlvs_add_lan_neighbors(struct isis_tlvs *tlvs, | |
551 | struct list *neighbors); | |
552 | void isis_tlvs_set_protocols_supported(struct isis_tlvs *tlvs, | |
553 | struct nlpids *nlpids); | |
554 | void isis_tlvs_add_mt_router_info(struct isis_tlvs *tlvs, uint16_t mtid, | |
555 | bool overload, bool attached); | |
556 | void isis_tlvs_add_ipv4_address(struct isis_tlvs *tlvs, struct in_addr *addr); | |
557 | void isis_tlvs_add_ipv4_addresses(struct isis_tlvs *tlvs, | |
558 | struct list *addresses); | |
559 | void isis_tlvs_add_ipv6_addresses(struct isis_tlvs *tlvs, | |
560 | struct list *addresses); | |
3380c990 EDP |
561 | int isis_tlvs_auth_is_valid(struct isis_tlvs *tlvs, struct isis_passwd *passwd, |
562 | struct stream *stream, bool is_lsp); | |
7ef5fefc CF |
563 | bool isis_tlvs_area_addresses_match(struct isis_tlvs *tlvs, |
564 | struct list *addresses); | |
565 | struct isis_adjacency; | |
566 | void isis_tlvs_to_adj(struct isis_tlvs *tlvs, struct isis_adjacency *adj, | |
567 | bool *changed); | |
568 | bool isis_tlvs_own_snpa_found(struct isis_tlvs *tlvs, uint8_t *snpa); | |
569 | void isis_tlvs_add_lsp_entry(struct isis_tlvs *tlvs, struct isis_lsp *lsp); | |
570 | void isis_tlvs_add_csnp_entries(struct isis_tlvs *tlvs, uint8_t *start_id, | |
571 | uint8_t *stop_id, uint16_t num_lsps, | |
4bef0ec4 DL |
572 | struct lspdb_head *lspdb, |
573 | struct isis_lsp **last_lsp); | |
7ef5fefc CF |
574 | void isis_tlvs_set_dynamic_hostname(struct isis_tlvs *tlvs, |
575 | const char *hostname); | |
1b3f47d0 OD |
576 | void isis_tlvs_set_router_capability(struct isis_tlvs *tlvs, |
577 | const struct isis_router_cap *cap); | |
7ef5fefc CF |
578 | void isis_tlvs_set_te_router_id(struct isis_tlvs *tlvs, |
579 | const struct in_addr *id); | |
580 | void isis_tlvs_add_oldstyle_ip_reach(struct isis_tlvs *tlvs, | |
581 | struct prefix_ipv4 *dest, uint8_t metric); | |
582 | void isis_tlvs_add_extended_ip_reach(struct isis_tlvs *tlvs, | |
583 | struct prefix_ipv4 *dest, uint32_t metric); | |
584 | void isis_tlvs_add_ipv6_reach(struct isis_tlvs *tlvs, uint16_t mtid, | |
585 | struct prefix_ipv6 *dest, uint32_t metric); | |
d43d2df5 CF |
586 | void isis_tlvs_add_ipv6_dstsrc_reach(struct isis_tlvs *tlvs, uint16_t mtid, |
587 | struct prefix_ipv6 *dest, | |
588 | struct prefix_ipv6 *src, | |
589 | uint32_t metric); | |
1b3f47d0 OD |
590 | struct isis_ext_subtlvs *isis_alloc_ext_subtlvs(void); |
591 | void isis_tlvs_add_adj_sid(struct isis_ext_subtlvs *exts, | |
592 | struct isis_adj_sid *adj); | |
593 | void isis_tlvs_del_adj_sid(struct isis_ext_subtlvs *exts, | |
594 | struct isis_adj_sid *adj); | |
595 | void isis_tlvs_add_lan_adj_sid(struct isis_ext_subtlvs *exts, | |
596 | struct isis_lan_adj_sid *lan); | |
597 | void isis_tlvs_del_lan_adj_sid(struct isis_ext_subtlvs *exts, | |
598 | struct isis_lan_adj_sid *lan); | |
599 | ||
7ef5fefc CF |
600 | void isis_tlvs_add_oldstyle_reach(struct isis_tlvs *tlvs, uint8_t *id, |
601 | uint8_t metric); | |
602 | void isis_tlvs_add_extended_reach(struct isis_tlvs *tlvs, uint16_t mtid, | |
603 | uint8_t *id, uint32_t metric, | |
1b3f47d0 | 604 | struct isis_ext_subtlvs *subtlvs); |
7ef5fefc | 605 | |
9fe21208 CF |
606 | const char *isis_threeway_state_name(enum isis_threeway_state state); |
607 | ||
608 | void isis_tlvs_add_threeway_adj(struct isis_tlvs *tlvs, | |
609 | enum isis_threeway_state state, | |
610 | uint32_t local_circuit_id, | |
611 | const uint8_t *neighbor_id, | |
612 | uint32_t neighbor_circuit_id); | |
613 | ||
41a145f1 CF |
614 | void isis_tlvs_add_spine_leaf(struct isis_tlvs *tlvs, uint8_t tier, |
615 | bool has_tier, bool is_leaf, bool is_spine, | |
616 | bool is_backup); | |
617 | ||
7ef5fefc CF |
618 | struct isis_mt_router_info * |
619 | isis_tlvs_lookup_mt_router_info(struct isis_tlvs *tlvs, uint16_t mtid); | |
2c92bee4 CF |
620 | |
621 | void isis_tlvs_set_purge_originator(struct isis_tlvs *tlvs, | |
622 | const uint8_t *generator, | |
623 | const uint8_t *sender); | |
7ef5fefc | 624 | #endif |