2 * This is an implementation of RFC7684 OSPFv2 Prefix/Link Attribute
5 * Module name: Extended Prefix/Link Opaque LSA header definition
7 * Author: Anselme Sawadogo <anselmesawadogo@gmail.com>
8 * Author: Olivier Dugeon <olivier.dugeon@orange.com>
10 * Copyright (C) 2016 - 2017 Orange Labs http://www.orange.com
12 * This file is part of FRR.
14 * FRR is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2, or (at your option) any
19 * FRR is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with FRR; see the file COPYING. If not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30 #ifndef _FRR_OSPF_EXT_PREF_H_
31 #define _FRR_OSPF_EXT_PREF_H_
34 * Opaque LSA's link state ID for Extended Prefix/Link is
35 * structured as follows.
38 * +--------+--------+--------+--------+
39 * | 7/8 |........|........|........|
40 * +--------+--------+--------+--------+
41 * |<-Type->|<------- Instance ------->|
44 * Type: IANA has assigned '7' for Extended Prefix Opaque LSA
45 * and '8' for Extended Link Opaque LSA
46 * Instance: User may select arbitrary 24-bit values to identify
47 * different instances of Extended Prefix/Link Opaque LSA
53 * +--------+--------+--------+--------+ ---
54 * | LS age |Options | 10,11 | A
55 * +--------+--------+--------+--------+ | Standard (Opaque) LSA header;
56 * | 7/8 | Instance | |
57 * +--------+--------+--------+--------+ | Type 10 or 11 are used for Extended
58 * | Advertising router | | Prefix Opaque LSA
59 * +--------+--------+--------+--------+ |
60 * | LS sequence number | | Type 10 only is used for Extended
61 * +--------+--------+--------+--------+ | Link Opaque LSA
62 * | LS checksum | Length | V
63 * +--------+--------+--------+--------+ ---
65 * +--------+--------+--------+--------+ | TLV part for Extended Prefix/Link
67 * ~ Values ... ~ | Values might be structured as a set
69 * +--------+--------+--------+--------+ ---
72 /* Global use constant numbers */
74 #define MAX_LEGAL_EXT_INSTANCE_NUM (0xffff)
75 #define LEGAL_EXT_INSTANCE_RANGE(i) (0 <= (i) && (i) <= 0xffff)
77 /* Flags to manage Extended Link/Prefix Opaque LSA */
78 #define EXT_LPFLG_LSA_INACTIVE 0x00
79 #define EXT_LPFLG_LSA_ACTIVE 0x01
80 #define EXT_LPFLG_LSA_ENGAGED 0x02
81 #define EXT_LPFLG_LSA_LOOKUP_DONE 0x04
82 #define EXT_LPFLG_LSA_FORCED_REFRESH 0x08
83 #define EXT_LPFLG_FIB_ENTRY_SET 0x10
86 * Following section defines TLV (tag, length, value) structures,
87 * used in Extended Prefix/Link Opaque LSA.
90 /* Extended Prefix TLV Route Types */
91 #define EXT_TLV_PREF_ROUTE_UNSPEC 0
92 #define EXT_TLV_PREF_ROUTE_INTRA_AREA 1
93 #define EXT_TLV_PREF_ROUTE_INTER_AREA 3
94 #define EXT_TLV_PREF_ROUTE_AS_EXT 5
95 #define EXT_TLV_PREF_ROUTE_NSSA_EXT 7
97 /* Extended Prefix and Extended Prefix Range TLVs'
98 * Address family flag for IPv4 */
99 #define EXT_TLV_PREF_AF_IPV4 0
101 /* Extended Prefix TLV Flags */
102 #define EXT_TLV_PREF_AFLG 0x80
103 #define EXT_TLV_PREF_NFLG 0x40
105 /* Extended Prefix Range TLV Flags */
106 #define EXT_TLV_PREF_RANGE_IAFLG 0x80
108 /* ERO subtlvs Flags */
109 #define EXT_SUBTLV_ERO_LFLG 0x80
111 /* Extended Prefix TLV see RFC 7684 section 2.1 */
112 #define EXT_TLV_PREFIX 1
113 #define EXT_TLV_PREFIX_SIZE 8
114 struct ext_tlv_prefix
{
115 struct tlv_header header
;
120 struct in_addr address
;
123 /* Extended Link TLV see RFC 7684 section 3.1 */
124 #define EXT_TLV_LINK 1
125 #define EXT_TLV_LINK_SIZE 12
126 struct ext_tlv_link
{
127 struct tlv_header header
;
130 struct in_addr link_id
;
131 struct in_addr link_data
;
134 /* Remote Interface Address Sub-TLV, Cisco experimental use Sub-TLV */
135 #define EXT_SUBTLV_RMT_ITF_ADDR 32768
136 #define EXT_SUBTLV_RMT_ITF_ADDR_SIZE 4
137 struct ext_subtlv_rmt_itf_addr
{
138 struct tlv_header header
;
139 struct in_addr value
;
142 /* Internal structure to manage Extended Link/Prefix Opaque LSA */
146 /* 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 */
153 /* area pointer if flooding is Type 10 Null if flooding is AS scope */
154 struct ospf_area
*area
;
155 struct in_addr area_id
;
157 /* List of interface with Segment Routing enable */
161 /* Structure to aggregate interfaces information for Extended Prefix/Link */
163 /* 24-bit Opaque-ID field value according to RFC 7684 specification */
165 uint8_t type
; /* Extended Prefix (7) or Link (8) */
167 /* Reference pointer to a Zebra-interface. */
168 struct interface
*ifp
;
170 /* Area info in which this SR link belongs to. */
171 struct ospf_area
*area
;
173 /* Flags to manage this link parameters. */
176 /* SID type: Node, Adjacency or LAN Adjacency */
179 /* extended link/prefix TLV information */
180 struct ext_tlv_prefix prefix
;
181 struct ext_subtlv_prefix_sid node_sid
;
182 struct ext_tlv_link link
;
183 struct ext_subtlv_adj_sid adj_sid
[2];
184 struct ext_subtlv_lan_adj_sid lan_sid
[2];
186 /* cisco experimental subtlv */
187 struct ext_subtlv_rmt_itf_addr rmt_itf_addr
;
191 extern int ospf_ext_init(void);
192 extern void ospf_ext_term(void);
193 extern void ospf_ext_update_sr(bool);
194 extern int ospf_ext_schedule_prefix_index(struct interface
*, uint32_t,
195 struct prefix_ipv4
*);
196 #endif /* _FRR_OSPF_EXT_PREF_H_ */