2 * This is an implementation of RFC7684 OSPFv2 Prefix/Link Attribute
5 * Module name: Extended Prefix/Link Opaque LSA header definition
7 * Author: Olivier Dugeon <olivier.dugeon@orange.com>
8 * Author: Anselme Sawadogo <anselmesawadogo@gmail.com>
10 * Copyright (C) 2016 - 2018 Orange Labs http://www.orange.com
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
22 * You should have received a copy of the GNU General Public License along
23 * with this program; see the file COPYING; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #ifndef _FRR_OSPF_EXT_PREF_H_
28 #define _FRR_OSPF_EXT_PREF_H_
31 * Opaque LSA's link state ID for Extended Prefix/Link is
32 * structured as follows.
35 * +--------+--------+--------+--------+
36 * | 7/8 |........|........|........|
37 * +--------+--------+--------+--------+
38 * |<-Type->|<------- Instance ------->|
41 * Type: IANA has assigned '7' for Extended Prefix Opaque LSA
42 * and '8' for Extended Link Opaque LSA
43 * Instance: User may select arbitrary 24-bit values to identify
44 * different instances of Extended Prefix/Link Opaque LSA
50 * +--------+--------+--------+--------+ ---
51 * | LS age |Options | 10,11 | A
52 * +--------+--------+--------+--------+ | Standard (Opaque) LSA header;
53 * | 7/8 | Instance | |
54 * +--------+--------+--------+--------+ | Type 10 or 11 are used for Extended
55 * | Advertising router | | Prefix Opaque LSA
56 * +--------+--------+--------+--------+ |
57 * | LS sequence number | | Type 10 only is used for Extended
58 * +--------+--------+--------+--------+ | Link Opaque LSA
59 * | LS checksum | Length | V
60 * +--------+--------+--------+--------+ ---
62 * +--------+--------+--------+--------+ | TLV part for Extended Prefix/Link
64 * ~ Values ... ~ | Values might be structured as a set
66 * +--------+--------+--------+--------+ ---
69 /* Global use constant numbers */
71 #define MAX_LEGAL_EXT_INSTANCE_NUM (0xffff)
72 #define LEGAL_EXT_INSTANCE_RANGE(i) (0 <= (i) && (i) <= 0xffff)
74 /* Flags to manage Extended Link/Prefix Opaque LSA */
75 #define EXT_LPFLG_LSA_INACTIVE 0x00
76 #define EXT_LPFLG_LSA_ACTIVE 0x01
77 #define EXT_LPFLG_LSA_ENGAGED 0x02
78 #define EXT_LPFLG_LSA_LOOKUP_DONE 0x04
79 #define EXT_LPFLG_LSA_FORCED_REFRESH 0x08
80 #define EXT_LPFLG_FIB_ENTRY_SET 0x10
83 * Following section defines TLV (tag, length, value) structures,
84 * used in Extended Prefix/Link Opaque LSA.
87 /* Extended Prefix TLV Route Types */
88 #define EXT_TLV_PREF_ROUTE_UNSPEC 0
89 #define EXT_TLV_PREF_ROUTE_INTRA_AREA 1
90 #define EXT_TLV_PREF_ROUTE_INTER_AREA 3
91 #define EXT_TLV_PREF_ROUTE_AS_EXT 5
92 #define EXT_TLV_PREF_ROUTE_NSSA_EXT 7
95 * Extended Prefix and Extended Prefix Range TLVs'
96 * Address family flag for IPv4
98 #define EXT_TLV_PREF_AF_IPV4 0
100 /* Extended Prefix TLV Flags */
101 #define EXT_TLV_PREF_AFLG 0x80
102 #define EXT_TLV_PREF_NFLG 0x40
104 /* Extended Prefix Range TLV Flags */
105 #define EXT_TLV_PREF_RANGE_IAFLG 0x80
107 /* ERO subtlvs Flags */
108 #define EXT_SUBTLV_ERO_LFLG 0x80
110 /* Extended Prefix TLV see RFC 7684 section 2.1 */
111 #define EXT_TLV_PREFIX 1
112 #define EXT_TLV_PREFIX_SIZE 8
113 struct ext_tlv_prefix
{
114 struct tlv_header header
;
119 struct in_addr address
;
122 /* Extended Link TLV see RFC 7684 section 3.1 */
123 #define EXT_TLV_LINK 1
124 #define EXT_TLV_LINK_SIZE 12
125 struct ext_tlv_link
{
126 struct tlv_header header
;
129 struct in_addr link_id
;
130 struct in_addr link_data
;
133 /* Remote Interface Address Sub-TLV, Cisco experimental use Sub-TLV */
134 #define EXT_SUBTLV_RMT_ITF_ADDR 32768
135 #define EXT_SUBTLV_RMT_ITF_ADDR_SIZE 4
136 struct ext_subtlv_rmt_itf_addr
{
137 struct tlv_header header
;
138 struct in_addr value
;
141 /* Internal structure to manage Extended Link/Prefix Opaque LSA */
145 /* Flags to manage this Extended Prefix/Link Opaque LSA */
149 * Scope is area Opaque Type 10 or AS Opaque LSA Type 11 for
150 * Extended Prefix and area Opaque Type 10 for Extended Link
154 /* List of interface with Segment Routing enable */
158 /* Structure to aggregate interfaces information for Extended Prefix/Link */
160 /* 24-bit Opaque-ID field value according to RFC 7684 specification */
162 uint8_t type
; /* Extended Prefix (7) or Link (8) */
164 /* Reference pointer to a Zebra-interface. */
165 struct interface
*ifp
;
167 /* Area info in which this SR link belongs to. */
168 struct ospf_area
*area
;
170 /* Flags to manage this link parameters. */
173 /* SID type: Node, Adjacency or LAN Adjacency */
176 /* extended link/prefix TLV information */
177 struct ext_tlv_prefix prefix
;
178 struct ext_subtlv_prefix_sid node_sid
;
179 struct ext_tlv_link link
;
180 struct ext_subtlv_adj_sid adj_sid
[2];
181 struct ext_subtlv_lan_adj_sid lan_sid
[2];
183 /* cisco experimental subtlv */
184 struct ext_subtlv_rmt_itf_addr rmt_itf_addr
;
188 extern int ospf_ext_init(void);
189 extern void ospf_ext_term(void);
190 extern void ospf_ext_finish(void);
191 extern void ospf_ext_update_sr(bool enable
);
192 extern void ospf_ext_link_srlb_update(void);
193 extern uint32_t ospf_ext_schedule_prefix_index(struct interface
*ifp
,
195 struct prefix_ipv4
*p
,
197 #endif /* _FRR_OSPF_EXT_PREF_H_ */