]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
f8c06e2c OD |
2 | /* |
3 | * IS-IS Rout(e)ing protocol - isis_te.c | |
4 | * | |
68558b13 | 5 | * This is an implementation of RFC5305, RFC 5307 and RFC 7810 |
f8c06e2c | 6 | * |
1b3f47d0 OD |
7 | * Author: Olivier Dugeon <olivier.dugeon@orange.com> |
8 | * | |
9 | * Copyright (C) 2014 - 2019 Orange Labs http://www.orange.com | |
f8c06e2c OD |
10 | */ |
11 | ||
12 | #ifndef _ZEBRA_ISIS_MPLS_TE_H | |
13 | #define _ZEBRA_ISIS_MPLS_TE_H | |
14 | ||
15 | /* | |
16 | * Traffic Engineering information are transport through LSP: | |
17 | * - Extended IS Reachability TLV = 22 | |
18 | * - Traffic Engineering Router ID TLV = 134 | |
19 | * - Extended IP Reachability TLV = 135 | |
20 | * - Inter-AS Reachability Information TLV = 141 | |
21 | * | |
22 | * and support following sub-TLV: | |
23 | * | |
24 | * Name Value Status | |
25 | * _________________________________________________ | |
26 | * Administartive group (color) 3 RFC5305 | |
27 | * Link Local/Remote Identifiers 4 RFC5307 | |
28 | * IPv4 interface address 6 RFC5305 | |
29 | * IPv4 neighbor address 8 RFC5305 | |
30 | * Maximum link bandwidth 9 RFC5305 | |
31 | * Reservable link bandwidth 10 RFC5305 | |
32 | * Unreserved bandwidth 11 RFC5305 | |
33 | * TE Default metric 18 RFC5305 | |
34 | * Link Protection Type 20 RFC5307 | |
35 | * Interface Switching Capability 21 RFC5307 | |
36 | * Remote AS number 24 RFC5316 | |
37 | * IPv4 Remote ASBR identifier 25 RFC5316 | |
38 | * | |
1b3f47d0 OD |
39 | * NOTE: RFC5316 is not fully supported in this version |
40 | * only subTLVs decoding is provided | |
f8c06e2c OD |
41 | */ |
42 | ||
f8c06e2c OD |
43 | /* Following define the type of TE link regarding the various RFC */ |
44 | #define STD_TE 0x01 | |
45 | #define GMPLS 0x02 | |
46 | #define INTER_AS 0x04 | |
47 | #define FLOOD_L1 0x10 | |
48 | #define FLOOD_L2 0x20 | |
49 | #define FLOOD_AS 0x40 | |
50 | #define EMULATED 0x80 | |
51 | ||
52 | #define IS_STD_TE(x) (x & STD_TE) | |
53 | #define IS_INTER_AS(x) (x & INTER_AS) | |
54 | #define IS_EMULATED(x) (x & EMULATED) | |
55 | #define IS_FLOOD_L1(x) (x & FLOOD_L1) | |
56 | #define IS_FLOOD_L2(x) (x & FLOOD_L2) | |
57 | #define IS_FLOOD_AS(x) (x & FLOOD_AS) | |
58 | #define IS_INTER_AS_EMU(x) (x & INTER_AS & EMULATED) | |
59 | #define IS_INTER_AS_AS(x) (x & INTER_AS & FLOOD_AS) | |
60 | ||
61 | /* | |
1b3f47d0 OD |
62 | * Note (since release 7.2), subTLVs definition, serialization |
63 | * and de-serialization have mode to isis_tlvs.[c,h] | |
f8c06e2c | 64 | */ |
f8c06e2c OD |
65 | |
66 | /* Following declaration concerns the MPLS-TE and LINk-TE management */ | |
67 | typedef enum _status_t { disable, enable, learn } status_t; | |
68 | ||
69 | /* Mode for Inter-AS LSP */ /* TODO: Check how if LSP is flooded in RFC5316 */ | |
70 | typedef enum _interas_mode_t { off, region, as, emulate } interas_mode_t; | |
71 | ||
1b3f47d0 OD |
72 | #define IS_EXT_TE(e) (e && e->status != 0 \ |
73 | && e->status != EXT_ADJ_SID \ | |
74 | && e->status != EXT_LAN_ADJ_SID) | |
75 | #define IS_MPLS_TE(a) (a && a->status == enable) | |
ed6189a9 | 76 | #define IS_EXPORT_TE(a) (a->export) |
f8c06e2c | 77 | |
2e2a8b91 | 78 | /* Per area MPLS-TE parameters */ |
ed6189a9 | 79 | struct ls_ted; |
2e2a8b91 | 80 | struct mpls_te_area { |
d62a17ae | 81 | /* Status of MPLS-TE: enable or disable */ |
82 | status_t status; | |
f8c06e2c | 83 | |
d62a17ae | 84 | /* L1, L1-L2, L2-Only */ |
d7c0a89a | 85 | uint8_t level; |
f8c06e2c | 86 | |
d62a17ae | 87 | /* RFC5316 */ |
88 | interas_mode_t inter_as; | |
89 | struct in_addr interas_areaid; | |
f8c06e2c | 90 | |
173f8887 | 91 | /* MPLS_TE IPv4 & IPv6 Router IDs */ |
d62a17ae | 92 | struct in_addr router_id; |
173f8887 | 93 | struct in6_addr router_id_ipv6; |
ed6189a9 OD |
94 | |
95 | /* Link State Database */ | |
96 | struct ls_ted *ted; | |
97 | bool export; | |
98 | }; | |
99 | ||
100 | /* Structure to provide parameters to lsp iterate callback function */ | |
101 | struct isis_te_args { | |
102 | struct ls_ted *ted; | |
103 | struct ls_vertex *vertex; | |
104 | bool export; | |
f8c06e2c OD |
105 | }; |
106 | ||
ed6189a9 OD |
107 | enum lsp_event { LSP_UNKNOWN, LSP_ADD, LSP_UPD, LSP_DEL, LSP_INC, LSP_TICK }; |
108 | ||
f8c06e2c | 109 | /* Prototypes. */ |
d62a17ae | 110 | void isis_mpls_te_init(void); |
1fa63850 OD |
111 | void isis_mpls_te_create(struct isis_area *area); |
112 | void isis_mpls_te_disable(struct isis_area *area); | |
113 | void isis_mpls_te_term(struct isis_area *area); | |
f8c06e2c | 114 | void isis_link_params_update(struct isis_circuit *, struct interface *); |
1b3f47d0 | 115 | int isis_mpls_te_update(struct interface *); |
ed6189a9 OD |
116 | void isis_te_lsp_event(struct isis_lsp *lsp, enum lsp_event event); |
117 | int isis_te_sync_ted(struct zapi_opaque_reg_info dst); | |
118 | void isis_te_init_ted(struct isis_area *area); | |
f8c06e2c OD |
119 | |
120 | #endif /* _ZEBRA_ISIS_MPLS_TE_H */ |