1 /* packet-bgp.c
2 * Routines for BGP packet dissection.
3 * Copyright 1999, Jun-ichiro itojun Hagino <itojun@itojun.org>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11 /* Supports:
12 * RFC1771 A Border Gateway Protocol 4 (BGP-4)
13 * RFC1965 Autonomous System Confederations for BGP
14 * RFC1997 BGP Communities Attribute
15 * RFC2547 BGP/MPLS VPNs
16 * RFC2796 BGP Route Reflection An alternative to full mesh IBGP
17 * RFC2842 Capabilities Advertisement with BGP-4
18 * RFC2858 Multiprotocol Extensions for BGP-4
19 * RFC2918 Route Refresh Capability for BGP-4
20 * RFC3107 Carrying Label Information in BGP-4
21 * RFC4360 BGP Extended Communities Attribute
22 * RFC4486 Subcodes for BGP Cease Notification Message
23 * RFC4724 Graceful Restart Mechanism for BGP
24 * RFC5512 The BGP Encapsulation Subsequent Address Family Identifier (SAFI)
25 * RFC5575 Dissemination of flow specification rules
26 * RFC5640 Load-Balancing for Mesh Softwires
27 * RFC6368 Internal BGP as the Provider/Customer Edge Protocol for
28 BGP/MPLS IP Virtual Private Networks (VPNs)
29 * RFC6608 Subcodes for BGP Finite State Machine Error
30 * RFC6793 BGP Support for Four-Octet Autonomous System (AS) Number Space
31 * RFC7311 The Accumulated IGP Metric Attribute for BGP
32 * RFC7432 BGP MPLS-Based Ethernet VPN
33 * RFC7752 North-Bound Distribution of Link-State and Traffic Engineering (TE)
34 Information Using BGP
35 * RFC8092 BGP Large Communities Attribute
36 * RFC8214 Virtual Private Wire Service Support in Ethernet VPN
37 * draft-ietf-idr-dynamic-cap
38 * draft-ietf-idr-bgp-enhanced-route-refresh-02
39 * draft-knoll-idr-qos-attribute-03
40 * draft-nalawade-kapoor-tunnel-safi-05
41 * draft-ietf-idr-add-paths-04 Additional-Path for BGP-4
42 * draft-gredler-idr-bgp-ls-segment-routing-ext-01
43 * draft-ietf-idr-custom-decision-07 BGP Custom Decision Process
44 * draft-rabadan-l2vpn-evpn-prefix-advertisement IP Prefix Advertisement
45 * in EVPN
46 * RFC8669 Segment Routing Prefix Segment Identifier Extensions for BGP
47 * http://www.iana.org/assignments/bgp-parameters/ (last updated 2012-04-26)
48 * RFC8538 Notification Message Support for BGP Graceful Restart
49 * draft-ietf-bess-evpn-igmp-mld-proxy-03
50 * draft-ietf-idr-tunnel-encaps-15
51 * draft-ietf-idr-segment-routing-te-policy-08
52 * draft-yu-bess-evpn-l2-attributes-04
53 * draft-ietf-bess-srv6-services-05
54 * RFC9104 Distribution of Traffic Engineering Extended Administrative Groups
55 Using the Border Gateway Protocol - Link State
56
57 * TODO:
58 * Destination Preference Attribute for BGP (work in progress)
59 * RFC1863 A BGP/IDRP Route Server alternative to a full mesh routing
60 */
61 /* (c) Copyright 2015, Pratik Yeole <pyeole@ncsu.edu>
62 - Fixed incorrect decoding of Network Layer Reachability Information (NLRI) in BGP UPDATE message with add-path support
63 */
64
65 #include "config.h"
66
67 #include <epan/packet.h>
68 #include <epan/exceptions.h>
69 #include <epan/addr_and_mask.h>
70 #include <epan/show_exception.h>
71 #include <epan/afn.h>
72 #include <epan/prefs.h>
73 #include <epan/expert.h>
74 #include <epan/etypes.h>
75 #include <epan/to_str.h>
76 #include <epan/proto_data.h>
77 #include <epan/ipproto.h>
78 #include <wsutil/str_util.h>
79 #include "packet-ip.h"
80 #include "packet-ldp.h"
81 #include "packet-bgp.h"
82 #include "packet-eigrp.h"
83
84 void proto_register_bgp(void);
85 void proto_reg_handoff_bgp(void);
86
87 static dissector_handle_t bgp_handle;
88
89 /* #define MAX_STR_LEN 256 */
90
91 /* some handy things to know */
92 #define BGP_MAX_PACKET_SIZE 4096
93 #define BGP_MARKER_SIZE 16 /* size of BGP marker */
94 #define BGP_HEADER_SIZE 19 /* size of BGP header, including marker */
95 #define BGP_MIN_OPEN_MSG_SIZE 29
96 #define BGP_MIN_UPDATE_MSG_SIZE 23
97 #define BGP_MIN_NOTIFICATION_MSG_SIZE 21
98 #define BGP_MIN_KEEPALVE_MSG_SIZE BGP_HEADER_SIZE
99 #define BGP_TCP_PORT 179
100 #define BGP_ROUTE_DISTINGUISHER_SIZE 8
101
102 /* BGP message types */
103 #define BGP_OPEN 1
104 #define BGP_UPDATE 2
105 #define BGP_NOTIFICATION 3
106 #define BGP_KEEPALIVE 4
107 #define BGP_ROUTE_REFRESH 5
108 #define BGP_CAPABILITY 6
109 #define BGP_ROUTE_REFRESH_CISCO 0x80
110
111 #define BGP_SIZE_OF_PATH_ATTRIBUTE 2
112
113
114 /* attribute flags, from RFC1771 */
115 #define BGP_ATTR_FLAG_OPTIONAL 0x80
116 #define BGP_ATTR_FLAG_TRANSITIVE 0x40
117 #define BGP_ATTR_FLAG_PARTIAL 0x20
118 #define BGP_ATTR_FLAG_EXTENDED_LENGTH 0x10
119 #define BGP_ATTR_FLAG_UNUSED 0x0F
120
121
122 /* SSA flags */
123 #define BGP_SSA_TRANSITIVE 0x8000
124 #define BGP_SSA_TYPE 0x7FFF
125
126 /* SSA Types */
127 #define BGP_SSA_L2TPv3 1
128 #define BGP_SSA_mGRE 2
129 #define BGP_SSA_IPSec 3
130 #define BGP_SSA_MPLS 4
131 #define BGP_SSA_L2TPv3_IN_IPSec 5
132 #define BGP_SSA_mGRE_IN_IPSec 6
133
134 /* BGP MPLS information */
135 #define BGP_MPLS_BOTTOM_L_STACK 0x000001
136 #define BGP_MPLS_TRAFFIC_CLASS 0x00000E
137 #define BGP_MPLS_LABEL 0xFFFFF0
138
139 /* AS_PATH segment types */
140 #define AS_SET 1 /* RFC1771 */
141 #define AS_SEQUENCE 2 /* RFC1771 */
142 #define AS_CONFED_SET 4 /* RFC1965 has the wrong values, corrected in */
143 #define AS_CONFED_SEQUENCE 3 /* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
144
145 /* BGPsec_PATH attributes */
146 #define SEC_PATH_SEG_SIZE 6
147
148 /* OPEN message Optional Parameter types */
149 #define BGP_OPTION_AUTHENTICATION 1 /* RFC1771 */
150 #define BGP_OPTION_CAPABILITY 2 /* RFC2842 */
151
152 /* https://www.iana.org/assignments/capability-codes/capability-codes.xhtml (last updated 2018-08-21) */
153 /* BGP capability code */
154 #define BGP_CAPABILITY_RESERVED 0 /* RFC5492 */
155 #define BGP_CAPABILITY_MULTIPROTOCOL 1 /* RFC2858 */
156 #define BGP_CAPABILITY_ROUTE_REFRESH 2 /* RFC2918 */
157 #define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING 3 /* RFC5291 */
158 #define BGP_CAPABILITY_MULTIPLE_ROUTE_DEST 4 /* RFC8277 Deprecated */
159 #define BGP_CAPABILITY_EXTENDED_NEXT_HOP 5 /* RFC5549 */
160 #define BGP_CAPABILITY_EXTENDED_MESSAGE 6 /* draft-ietf-idr-bgp-extended-messages */
161 #define BGP_CAPABILITY_BGPSEC 7 /* RFC8205 */
162 #define BGP_CAPABILITY_MULTIPLE_LABELS 8 /* RFC8277 */
163 #define BGP_CAPABILITY_BGP_ROLE 9 /* draft-ietf-idr-bgp-open-policy */
164 #define BGP_CAPABILITY_GRACEFUL_RESTART 64 /* RFC4724 */
165 #define BGP_CAPABILITY_4_OCTET_AS_NUMBER 65 /* RFC6793 */
166 #define BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO 66 /* Cisco Dynamic capabaility*/
167 #define BGP_CAPABILITY_DYNAMIC_CAPABILITY 67 /* draft-ietf-idr-dynamic-cap */
168 #define BGP_CAPABILITY_MULTISESSION 68 /* draft-ietf-idr-bgp-multisession */
169 #define BGP_CAPABILITY_ADDITIONAL_PATHS 69 /* [RFC7911] */
170 #define BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH 70 /* [RFC7313] */
171 #define BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART 71 /* draft-uttaro-idr-bgp-persistence */
172 #define BGP_CAPABILITY_CP_ORF 72 /* [RFC7543] */
173 #define BGP_CAPABILITY_FQDN 73 /* draft-walton-bgp-hostname-capability */
174 #define BGP_CAPABILITY_ROUTE_REFRESH_CISCO 128 /* Cisco */
175 #define BGP_CAPABILITY_ORF_CISCO 130 /* Cisco */
176 #define BGP_CAPABILITY_MULTISESSION_CISCO 131 /* Cisco */
177
178 #define BGP_ORF_PREFIX_CISCO 0x80 /* Cisco */
179 #define BGP_ORF_COMM_CISCO 0x81 /* Cisco */
180 #define BGP_ORF_EXTCOMM_CISCO 0x82 /* Cisco */
181 #define BGP_ORF_ASPATH_CISCO 0x83 /* Cisco */
182
183 #define BGP_ORF_COMM 0x02 /* RFC5291 */
184 #define BGP_ORF_EXTCOMM 0x03 /* RFC5291 */
185 #define BGP_ORF_ASPATH 0x04 /* draft-ietf-idr-aspath-orf-02.txt */
186 /* RFC5291 */
187 #define BGP_ORF_ACTION 0xc0
188 #define BGP_ORF_ADD 0x00
189 #define BGP_ORF_REMOVE 0x01
190 #define BGP_ORF_REMOVEALL 0x02
191
192 #define BGP_ORF_MATCH 0x20
193 #define BGP_ORF_PERMIT 0x00
194 #define BGP_ORF_DENY 0x01
195
196 /* well-known communities, as defined by IANA */
197 /* https://www.iana.org/assignments/bgp-well-known-communities/bgp-well-known-communities.xhtml */
198 #define BGP_COMM_GRACEFUL_SHUTDOWN 0xFFFF0000
199 #define BGP_COMM_ACCEPT_OWN 0xFFFF0001
200 #define BGP_COMM_BLACKHOLE 0xFFFF029A
201 #define BGP_COMM_NO_EXPORT 0xFFFFFF01
202 #define BGP_COMM_NO_ADVERTISE 0xFFFFFF02
203 #define BGP_COMM_NO_EXPORT_SUBCONFED 0xFFFFFF03
204 #define BGP_COMM_NOPEER 0xFFFFFF04
205 #define FOURHEX0 0x00000000
206 #define FOURHEXF 0xFFFF0000
207
208 /* IANA assigned AS */
209 #define BGP_AS_TRANS 23456
210
211 /* attribute types */
212 #define BGPTYPE_ORIGIN 1 /* RFC4271 */
213 #define BGPTYPE_AS_PATH 2 /* RFC4271 */
214 #define BGPTYPE_NEXT_HOP 3 /* RFC4271 */
215 #define BGPTYPE_MULTI_EXIT_DISC 4 /* RFC4271 */
216 #define BGPTYPE_LOCAL_PREF 5 /* RFC4271 */
217 #define BGPTYPE_ATOMIC_AGGREGATE 6 /* RFC4271 */
218 #define BGPTYPE_AGGREGATOR 7 /* RFC4271 */
219 #define BGPTYPE_COMMUNITIES 8 /* RFC1997 */
220 #define BGPTYPE_ORIGINATOR_ID 9 /* RFC4456 */
221 #define BGPTYPE_CLUSTER_LIST 10 /* RFC4456 */
222 #define BGPTYPE_DPA 11 /* DPA (deprecated) [RFC6938] */
223 #define BGPTYPE_ADVERTISER 12 /* ADVERTISER (historic) (deprecated) [RFC1863][RFC4223][RFC6938] */
224 #define BGPTYPE_RCID_PATH 13 /* RCID_PATH / CLUSTER_ID (historic) (deprecated) [RFC1863][RFC4223][RFC6938] */
225 #define BGPTYPE_MP_REACH_NLRI 14 /* RFC4760 */
226 #define BGPTYPE_MP_UNREACH_NLRI 15 /* RFC4760 */
227 #define BGPTYPE_EXTENDED_COMMUNITY 16 /* RFC4360 */
228 #define BGPTYPE_AS4_PATH 17 /* RFC 6793 */
229 #define BGPTYPE_AS4_AGGREGATOR 18 /* RFC 6793 */
230 #define BGPTYPE_SAFI_SPECIFIC_ATTR 19 /* SAFI Specific Attribute (SSA) (deprecated) draft-kapoor-nalawade-idr-bgp-ssa-00.txt */
231 #define BGPTYPE_CONNECTOR_ATTRIBUTE 20 /* Connector Attribute (deprecated) [RFC6037] */
232 #define BGPTYPE_AS_PATHLIMIT 21 /* AS_PATHLIMIT (deprecated) [draft-ietf-idr-as-pathlimit] */
233 #define BGPTYPE_PMSI_TUNNEL_ATTR 22 /* RFC6514 */
234 #define BGPTYPE_TUNNEL_ENCAPS_ATTR 23 /* RFC5512 */
235 #define BGPTYPE_TRAFFIC_ENGINEERING 24 /* Traffic Engineering [RFC5543] */
236 #define BGPTYPE_IPV6_ADDR_SPEC_EC 25 /* IPv6 Address Specific Extended Community [RFC5701] */
237 #define BGPTYPE_AIGP 26 /* RFC7311 */
238 #define BGPTYPE_PE_DISTING_LABLES 27 /* PE Distinguisher Labels [RFC6514] */
239 #define BGPTYPE_BGP_ENTROPY_LABEL 28 /* BGP Entropy Label Capability Attribute (deprecated) [RFC6790][RFC7447] */
240 #define BGPTYPE_LINK_STATE_ATTR 29 /* RFC7752 */
241 #define BGPTYPE_30 30 /* Deprecated [RFC8093] */
242 #define BGPTYPE_31 31 /* Deprecated [RFC8093] */
243 #define BGPTYPE_LARGE_COMMUNITY 32 /* RFC8092 */
244 #define BGPTYPE_BGPSEC_PATH 33 /* BGPsec_PATH [RFC8205] */
245 #define BGPTYPE_D_PATH 36 /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
246 #define BGPTYPE_BGP_PREFIX_SID 40 /* BGP Prefix-SID [RFC8669] */
247 #define BGPTYPE_LINK_STATE_OLD_ATTR 99 /* squatted value used by at least 2
248 implementations before IANA assignment */
249 #define BGPTYPE_ATTR_SET 128 /* RFC6368 */
250 #define BGPTYPE_129 129 /* Deprecated [RFC8093] */
251 #define BGPTYPE_241 241 /* Deprecated [RFC8093] */
252 #define BGPTYPE_242 242 /* Deprecated [RFC8093] */
253 #define BGPTYPE_243 243 /* Deprecated [RFC8093] */
254
255 /*EVPN Route Types */
256 #define EVPN_AD_ROUTE 1
257 #define EVPN_MAC_ROUTE 2
258 #define EVPN_INC_MCAST_TREE 3
259 #define EVPN_ETH_SEGMENT_ROUTE 4
260 #define EVPN_IP_PREFIX_ROUTE 5 /* draft-rabadan-l2vpn-evpn-prefix-advertisement */
261 #define EVPN_MC_ETHER_TAG_ROUTE 6 /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
262 #define EVPN_IGMP_JOIN_ROUTE 7 /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
263 #define EVPN_IGMP_LEAVE_ROUTE 8 /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
264 #define EVPN_S_PMSI_A_D_ROUTE 10 /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
265
266 #define EVPN_IGMP_MC_FLAG_V1 0x01
267 #define EVPN_IGMP_MC_FLAG_V2 0x02
268 #define EVPN_IGMP_MC_FLAG_V3 0x04
269 #define EVPN_IGMP_MC_FLAG_IE 0x08
270 #define EVPN_IGMP_MC_FLAG_RESERVED 0xF0
271
272 /* NLRI type as define in BGP flow spec RFC */
273 #define BGPNLRI_FSPEC_DST_PFIX 1 /* RFC 5575 */
274 #define BGPNLRI_FSPEC_SRC_PFIX 2 /* RFC 5575 */
275 #define BGPNLRI_FSPEC_IP_PROTO 3 /* RFC 5575 */
276 #define BGPNLRI_FSPEC_PORT 4 /* RFC 5575 */
277 #define BGPNLRI_FSPEC_DST_PORT 5 /* RFC 5575 */
278 #define BGPNLRI_FSPEC_SRC_PORT 6 /* RFC 5575 */
279 #define BGPNLRI_FSPEC_ICMP_TP 7 /* RFC 5575 */
280 #define BGPNLRI_FSPEC_ICMP_CD 8 /* RFC 5575 */
281 #define BGPNLRI_FSPEC_TCP_FLAGS 9 /* RFC 5575 */
282 #define BGPNLRI_FSPEC_PCK_LEN 10 /* RFC 5575 */
283 #define BGPNLRI_FSPEC_DSCP 11 /* RFC 5575 */
284 #define BGPNLRI_FSPEC_FRAGMENT 12 /* RFC 5575 */
285
286 /* BGP flow spec NLRI operator bitmask */
287 #define BGPNLRI_FSPEC_END_OF_LST 0x80
288 #define BGPNLRI_FSPEC_AND_BIT 0x40
289 #define BGPNLRI_FSPEC_VAL_LEN 0x30
290 #define BGPNLRI_FSPEC_UNUSED_BIT4 0x08
291 #define BGPNLRI_FSPEC_UNUSED_BIT5 0x04
292 #define BGPNLRI_FSPEC_LESS_THAN 0x04
293 #define BGPNLRI_FSPEC_GREATER_THAN 0x02
294 #define BGPNLRI_FSPEC_EQUAL 0x01
295 #define BGPNLRI_FSPEC_TCPF_NOTBIT 0x02
296 #define BGPNLRI_FSPEC_TCPF_MATCHBIT 0x01
297 #define BGPNLRI_FSPEC_DSCP_BITMASK 0x3F
298
299 /* BGP flow spec specific filter value: TCP flags, Packet fragment ... */
300 #define BGPNLRI_FSPEC_TH_FIN 0x01
301 #define BGPNLRI_FSPEC_TH_SYN 0x02
302 #define BGPNLRI_FSPEC_TH_RST 0x04
303 #define BGPNLRI_FSPEC_TH_PUSH 0x08
304 #define BGPNLRI_FSPEC_TH_ACK 0x10
305 #define BGPNLRI_FSPEC_TH_URG 0x20
306 #define BGPNLRI_FSPEC_TH_ECN 0x40
307 #define BGPNLRI_FSPEC_TH_CWR 0x80
308
309 #define BGPNLRI_FSPEC_FG_DF 0x01
310 #define BGPNLRI_FSPEC_FG_ISF 0x02
311 #define BGPNLRI_FSPEC_FG_FF 0x04
312 #define BGPNLRI_FSPEC_FG_LF 0x08
313
314 /* Extended community type */
315 /* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
316 /* BGP transitive extended community type high octet */
317 /* Range 0x00-0x3f First Come First Served */
318 /* Range 0x80-0x8f Reserved for Experimental */
319 /* Range 0x90-0xbf Standards Action */
320
321 #define BGP_EXT_COM_TYPE_AUTH 0x80 /* FCFS or Standard/Early/Experimental allocated */
322 #define BGP_EXT_COM_TYPE_TRAN 0x40 /* Non-transitive or Transitive */
323
324 #define BGP_EXT_COM_TYPE_HIGH_TR_AS2 0x00 /* Transitive Two-Octet AS-Specific Extended Community */
325 #define BGP_EXT_COM_TYPE_HIGH_TR_IP4 0x01 /* Transitive IPv4-Address-specific Extended Community */
326 #define BGP_EXT_COM_TYPE_HIGH_TR_AS4 0x02 /* Transitive Four-Octet AS-Specific Extended Community */
327 #define BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE 0x03 /* Transitive Opaque Extended Community */
328 #define BGP_EXT_COM_TYPE_HIGH_TR_QOS 0x04 /* QoS Marking [Thomas_Martin_Knoll] */
329 #define BGP_EXT_COM_TYPE_HIGH_TR_COS 0x05 /* CoS Capability [Thomas_Martin_Knoll] */
330 #define BGP_EXT_COM_TYPE_HIGH_TR_EVPN 0x06 /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
331 #define BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I 0x07 /* FlowSpec Transitive Extended Communities [draft-ietf-idr-flowspec-interfaceset] */
332 #define BGP_EXT_COM_TYPE_HIGH_TR_FLOW 0x08 /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
333 #define BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R 0x09 /* FlowSpec Redirect to indirection-id Extended Community [draft-ietf-idr-flowspec-path-redirect] */
334 #define BGP_EXT_COM_TYPE_HIGH_TR_EXP 0x80 /* Generic Transitive Experimental Extended Community */
335 #define BGP_EXT_COM_TYPE_HIGH_TR_EXP_2 0x81 /* Generic Transitive Experimental Use Extended Community Part 2 [RFC7674] */
336 #define BGP_EXT_COM_TYPE_HIGH_TR_EXP_3 0x82 /* Generic Transitive Experimental Use Extended Community Part 3 [RFC7674] */
337 #define BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP 0x88 /* EIGRP attributes - http://www.cisco.com/c/en/us/td/docs/ios/12_0s/feature/guide/seipecec.html */
338
339 /* BGP non transitive extended community type high octet */
340 /* 0x40-0x7f First Come First Served */
341 /* 0xc0-0xcf Reserved for Experimental Use (see [RFC4360]) */
342 /* 0xd0-0xff Standards Action */
343 /* 0x45-0x7f Unassigned */
344 #define BGP_EXT_COM_TYPE_HIGH_NTR_AS2 0x40 /* Non-Transitive Two-Octet AS-Specific Extended Community */
345 #define BGP_EXT_COM_TYPE_HIGH_NTR_IP4 0x41 /* Non-Transitive IPv4-Address-specific Extended Community */
346 #define BGP_EXT_COM_TYPE_HIGH_NTR_AS4 0x42 /* Non-Transitive Four-Octet AS-Specific Extended Community */
347 #define BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE 0x43 /* Non-Transitive Opaque Extended Community */
348 #define BGP_EXT_COM_TYPE_HIGH_NTR_QOS 0x44 /* QoS Marking [Thomas_Martin_Knoll] */
349
350
351 /* EVPN Extended Community Sub-Types */
352 #define BGP_EXT_COM_STYPE_EVPN_MMAC 0x00 /* MAC Mobility [draft-ietf-l2vpn-pbb-evpn] */
353 #define BGP_EXT_COM_STYPE_EVPN_LABEL 0x01 /* ESI MPLS Label [draft-ietf-l2vpn-evpn] */
354 #define BGP_EXT_COM_STYPE_EVPN_IMP 0x02 /* ES Import [draft-sajassi-l2vpn-evpn-segment-route] */
355 #define BGP_EXT_COM_STYPE_EVPN_ROUTERMAC 0x03 /* draft-sajassi-l2vpn-evpn-inter-subnet-forwarding */
356 #define BGP_EXT_COM_STYPE_EVPN_L2ATTR 0x04 /* RFC 8214 */
357 #define BGP_EXT_COM_STYPE_EVPN_ETREE 0x05 /* RFC 8317 */
358 #define BGP_EXT_COM_STYPE_EVPN_DF 0x06 /* RFC 8584 */
359 #define BGP_EXT_COM_STYPE_EVPN_ISID 0x07 /* draft-sajassi-bess-evpn-virtual-eth-segment */
360 #define BGP_EXT_COM_STYPE_EVPN_ND 0x08 /* draft-snr-bess-evpn-na-flags */
361 #define BGP_EXT_COM_STYPE_EVPN_MCFLAGS 0x09 /* draft-ietf-bess-evpn-igmp-mld-proxy */
362 #define BGP_EXT_COM_STYPE_EVPN_EVIRT0 0x0a /* draft-ietf-bess-evpn-igmp-mld-proxy */
363 #define BGP_EXT_COM_STYPE_EVPN_EVIRT1 0x0b /* draft-ietf-bess-evpn-igmp-mld-proxy */
364 #define BGP_EXT_COM_STYPE_EVPN_EVIRT2 0x0c /* draft-ietf-bess-evpn-igmp-mld-proxy */
365 #define BGP_EXT_COM_STYPE_EVPN_EVIRT3 0x0d /* draft-ietf-bess-evpn-igmp-mld-proxy */
366 #define BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT 0x0e /* draft-sajassi-bess-evpn-ac-aware-bundling */
367
368 /* RFC 7432 Flag single active mode */
369 #define BGP_EXT_COM_ESI_LABEL_FLAGS 0x01 /* bitmask: set for single active multi-homing site */
370
371 /* RFC 7432 Flag Sticky/Static MAC */
372 #define BGP_EXT_COM_EVPN_MMAC_STICKY 0x01 /* Bitmask: Set for sticky/static MAC address */
373
374 /* RFC 8214 Flags EVPN L2 Attributes */
375 #define BGP_EXT_COM_EVPN_L2ATTR_FLAG_B 0x01 /* Backup PE */
376 #define BGP_EXT_COM_EVPN_L2ATTR_FLAG_P 0x02 /* Primary PE */
377 #define BGP_EXT_COM_EVPN_L2ATTR_FLAG_C 0x04 /* Control word required */
378 /* draft-yu-bess-evpn-l2-attributes-04 */
379 #define BGP_EXT_COM_EVPN_L2ATTR_FLAG_F 0x08 /* Send and receive flow label */
380 #define BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI 0x10 /* CWI extended community can be included */
381 #define BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED 0xFFE0 /* Reserved */
382
383 /* RFC 8317 Flags EVPN E-Tree Attributes */
384 #define BGP_EXT_COM_EVPN_ETREE_FLAG_L 0x01 /* Leaf-Indication */
385 #define BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED 0xFE /* Reserved */
386
387 /* EPVN route AD NLRI ESI type */
388 #define BGP_NLRI_EVPN_ESI_VALUE 0x00 /* ESI type 0, 9 bytes interger */
389 #define BGP_NLRI_EVPN_ESI_LACP 0x01 /* ESI type 1, LACP 802.1AX */
390 #define BGP_NLRI_EVPN_ESI_MSTP 0x02 /* ESI type 2, MSTP defined ESI */
391 #define BGP_NLRI_EVPN_ESI_MAC 0x03 /* ESI type 3, MAC allocated value */
392 #define BGP_NLRI_EVPN_ESI_RID 0x04 /* ESI type 4, Router ID as ESI */
393 #define BGP_NLRI_EVPN_ESI_ASN 0x05 /* ESI type 5, ASN as ESI */
394 #define BGP_NLRI_EVPN_ESI_RES 0xFF /* ESI 0xFF reserved */
395
396
397 /* Transitive Two-Octet AS-Specific Extended Community Sub-Types */
398 /* 0x04 Unassigned */
399 /* 0x06-0x07 Unassigned */
400 /* 0x0b-0x0f Unassigned */
401 /* 0x11-0xff Unassigned */
402 #define BGP_EXT_COM_STYPE_AS2_RT 0x02 /* Route Target [RFC4360] */
403 #define BGP_EXT_COM_STYPE_AS2_RO 0x03 /* Route Origin [RFC4360] */
404 #define BGP_EXT_COM_STYPE_AS2_OSPF_DID 0x05 /* OSPF Domain Identifier [RFC4577] */
405 #define BGP_EXT_COM_STYPE_AS2_DCOLL 0x08 /* BGP Data Collection [RFC4384] */
406 #define BGP_EXT_COM_STYPE_AS2_SRC_AS 0x09 /* Source AS [RFC6514] */
407 #define BGP_EXT_COM_STYPE_AS2_L2VPN 0x0a /* L2VPN Identifier [RFC6074] */
408 #define BGP_EXT_COM_STYPE_AS2_CVPND 0x0010 /* Cisco VPN-Distinguisher [Eric_Rosen] */
409
410 /* Non-Transitive Two-Octet AS-Specific Extended Community Sub-Types */
411 /* 0x00-0xbf First Come First Served */
412 /* 0xc0-0xff IETF Review*/
413
414 #define BGP_EXT_COM_STYPE_AS2_LBW 0x04 /* Link Bandwidth Extended Community [draft-ietf-idr-link-bandwidth-00] */
415 #define BGP_EXT_COM_STYPE_AS2_VNI 0x80 /* Virtual-Network Identifier Extended Community [draft-drao-bgp-l3vpn-virtual-network-overlays] */
416
417 /* Transitive Four-Octet AS-Specific Extended Community Sub-Types */
418 /* 0x00-0xbf First Come First Served */
419 /* 0xc0-0xff IETF Review */
420
421 #define BGP_EXT_COM_STYPE_AS4_RT 0x02 /* Route Target [RFC5668] */
422 #define BGP_EXT_COM_STYPE_AS4_RO 0x03 /* Route Origin [RFC5668] */
423 #define BGP_EXT_COM_STYPE_AS4_GEN 0x04 /* Generic (deprecated) [draft-ietf-idr-as4octet-extcomm-generic-subtype] */
424 #define BGP_EXT_COM_STYPE_AS4_OSPF_DID 0x05 /* OSPF Domain Identifier [RFC4577] */
425 #define BGP_EXT_COM_STYPE_AS4_BGP_DC 0x08 /* BGP Data Collection [RFC4384] */
426 #define BGP_EXT_COM_STYPE_AS4_S_AS 0x09 /* Source AS [RFC6514] */
427 #define BGP_EXT_COM_STYPE_AS4_CIS_V 0x10 /* Cisco VPN Identifier [Eric_Rosen] */
428 #define BGP_EXT_COM_STYPE_AS4_RT_REC 0x13 /* Route-Target Record [draft-ietf-bess-service-chaining] */
429
430 /* Non-Transitive Four-Octet AS-Specific Extended Community Sub-Types */
431
432 /*
433 * #define BGP_EXT_COM_STYPE_AS4_GEN 0x04
434 * Generic (deprecated) [draft-ietf-idr-as4octet-extcomm-generic-subtype]
435 */
436
437 /* Transitive IPv4-Address-Specific Extended Community Sub-Types */
438
439 #define BGP_EXT_COM_STYPE_IP4_RT 0x02 /* Route Target [RFC4360] */
440 #define BGP_EXT_COM_STYPE_IP4_RO 0x03 /* Route Origin [RFC4360] */
441 #define BGP_EXT_COM_STYPE_IP4_OSPF_DID 0x05 /* OSPF Domain Identifier [RFC4577] */
442 #define BGP_EXT_COM_STYPE_IP4_OSPF_RID 0x07 /* OSPF Router ID [RFC4577] */
443 #define BGP_EXT_COM_STYPE_IP4_L2VPN 0x0a /* L2VPN Identifier [RFC6074] */
444 #define BGP_EXT_COM_STYPE_IP4_VRF_I 0x0b /* VRF Route Import [RFC6514] */
445 #define BGP_EXT_COM_STYPE_IP4_CIS_D 0x10 /* Cisco VPN-Distinguisher [Eric_Rosen] */
446 #define BGP_EXT_COM_STYPE_IP4_SEG_NH 0x12 /* Inter-area P2MP Segmented Next-Hop [draft-ietf-mpls-seamless-mcast] */
447
448 /* Transitive Opaque Extended Community Sub-Types */
449
450 #define BGP_EXT_COM_STYPE_OPA_COST 0x01 /* Cost Community [draft-ietf-idr-custom-decision] */
451 #define BGP_EXT_COM_STYPE_OPA_OSPF_RT 0x06 /* OSPF Route Type [RFC4577] */
452 #define BGP_EXT_COM_STYPE_OPA_COLOR 0x0b /* Color Extended Community [RFC5512] */
453 #define BGP_EXT_COM_STYPE_OPA_ENCAP 0x0c /* Encapsulation Extended Community [RFC5512] */
454 #define BGP_EXT_COM_STYPE_OPA_DGTW 0x0d /* Default Gateway [Yakov_Rekhter] */
455
456 /* BGP Cost Community Point of Insertion Types */
457
458 #define BGP_EXT_COM_COST_POI_ORIGIN 1 /* Evaluate after "Prefer lowest Origin" step */
459 #define BGP_EXT_COM_COST_POI_ASPATH 2 /* Evaluate after "Prefer shortest AS_PATH" step */
460 #define BGP_EXT_COM_COST_POI_MED 4 /* Evaluate after "Prefer lowest MED" step */
461 #define BGP_EXT_COM_COST_POI_LP 5 /* Evaluate after "Prefer highest Local Preference" step */
462 #define BGP_EXT_COM_COST_POI_AIGP 26 /* Evaluate after "Prefer lowest Accumulated IGP Cost" step */
463 #define BGP_EXT_COM_COST_POI_ABS 128 /* Pre-bestpath POI */
464 #define BGP_EXT_COM_COST_POI_IGP 129 /* Evaluate after "Prefer smallest IGP metric to next-hop" step */
465 #define BGP_EXT_COM_COST_POI_EI 130 /* Evaluate after "Prefer eBGP to iBGP" step */
466 #define BGP_EXT_COM_COST_POI_RID 131 /* Evaluate after "Prefer lowest BGP RID" step */
467
468 #define BGP_EXT_COM_COST_CID_REP 0x80 /* Bitmask - value replace/evaluate after bit */
469
470 /* BGP Tunnel Encapsulation Attribute Tunnel Types */
471
472 #define BGP_EXT_COM_TUNNEL_RESERVED 0 /* Reserved [RFC5512] */
473 #define BGP_EXT_COM_TUNNEL_L2TPV3 1 /* L2TPv3 over IP [RFC5512] */
474 #define BGP_EXT_COM_TUNNEL_GRE 2 /* GRE [RFC5512] */
475 #define BGP_EXT_COM_TUNNEL_ENDP 3 /* Transmit tunnel endpoint [RFC5566] */
476 #define BGP_EXT_COM_TUNNEL_IPSEC 4 /* IPsec in Tunnel-mode [RFC5566] */
477 #define BGP_EXT_COM_TUNNEL_IPIPSEC 5 /* IP in IP tunnel with IPsec Transport Mode [RFC5566] */
478 #define BGP_EXT_COM_TUNNEL_MPLSIP 6 /* MPLS-in-IP tunnel with IPsec Transport Mode [RFC5566] */
479 #define BGP_EXT_COM_TUNNEL_IPIP 7 /* IP in IP [RFC5512] */
480 #define BGP_EXT_COM_TUNNEL_VXLAN 8 /* VXLAN Encapsulation [draft-sd-l2vpn-evpn-overlay] */
481 #define BGP_EXT_COM_TUNNEL_NVGRE 9 /* NVGRE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
482 #define BGP_EXT_COM_TUNNEL_MPLS 10 /* MPLS Encapsulation [draft-sd-l2vpn-evpn-overlay] */
483 #define BGP_EXT_COM_TUNNEL_MPLSGRE 11 /* MPLS in GRE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
484 #define BGP_EXT_COM_TUNNEL_VXLANGPE 12 /* VxLAN GPE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
485 #define BGP_EXT_COM_TUNNEL_MPLSUDP 13 /* MPLS in UDP Encapsulation [draft-ietf-l3vpn-end-system] */
486
487 /* Non-Transitive Opaque Extended Community Sub-Types */
488
489 #define BGP_EXT_COM_STYPE_OPA_OR_VAL_ST 0x00 /* BGP Origin Validation State [draft-ietf-sidr-origin-validation-signaling] */
490
491 /* BGP Generic Transitive Experimental Use Extended Community Sub-Types */
492
493 #define BGP_EXT_COM_STYPE_EXP_OSPF_RT 0x00 /* OSPF Route Type, deprecated [RFC4577] */
494 #define BGP_EXT_COM_STYPE_EXP_OSPF_RID 0x01 /* OSPF Router ID, deprecated [RFC4577] */
495 #define BGP_EXT_COM_STYPE_EXP_SEC_GROUP 0x04 /* Security Group [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#security-group] */
496 #define BGP_EXT_COM_STYPE_EXP_OSPF_DID 0x05 /* OSPF Domain ID, deprecated [RFC4577] */
497 #define BGP_EXT_COM_STYPE_EXP_F_TR 0x06 /* Flow spec traffic-rate [RFC5575] */
498 #define BGP_EXT_COM_STYPE_EXP_F_TA 0x07 /* Flow spec traffic-action [RFC5575] */
499 #define BGP_EXT_COM_STYPE_EXP_F_RED 0x08 /* Flow spec redirect [RFC5575] */
500 #define BGP_EXT_COM_STYPE_EXP_F_RMARK 0x09 /* Flow spec traffic-remarking [RFC5575] */
501 #define BGP_EXT_COM_STYPE_EXP_L2 0x0a /* Layer2 Info Extended Community [RFC4761] */
502 #define BGP_EXT_COM_STYPE_EXP_ETREE 0x0b /* E-Tree Info [RFC7796] */
503 #define BGP_EXT_COM_STYPE_EXP_TAG 0x84 /* Tag [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#tag] */
504 #define BGP_EXT_COM_STYPE_EXP_SUB_CLUS 0x85 /* Origin Sub-Cluster [https://github.com/robric/wiki-contrail-controller/blob/master/BGP-Extended-Communities.md] */
505
506 /* BGP Generic Transitive Experimental Use Extended Community Part 2 */
507
508 #define BGP_EXT_COM_STYPE_EXP_2_FLOW_RED 0x08
509
510 /* BGP Generic Transitive Experimental Use Extended Community Part 3 */
511
512 #define BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP 0x04
513 #define BGP_EXT_COM_STYPE_EXP_3_FLOW_RED 0x08
514 #define BGP_EXT_COM_STYPE_EXP_3_TAG4 0x84
515 #define BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS 0x85
516
517 /* BGP Transitive Experimental EIGRP route attribute Sub-Types */
518
519 #define BGP_EXT_COM_STYPE_EXP_EIGRP_FT 0x00 /* Route Flags, Route Tag */
520 #define BGP_EXT_COM_STYPE_EXP_EIGRP_AD 0x01 /* ASN, Delay */
521 #define BGP_EXT_COM_STYPE_EXP_EIGRP_RHB 0x02 /* Reliability, Hop Count, Bandwidth */
522 #define BGP_EXT_COM_STYPE_EXP_EIGRP_LM 0x03 /* Load, MTU */
523 #define BGP_EXT_COM_STYPE_EXP_EIGRP_EAR 0x04 /* External ASN, RID of the redistributing router */
524 #define BGP_EXT_COM_STYPE_EXP_EIGRP_EPM 0x05 /* External Protocol ID, metric */
525 #define BGP_EXT_COM_STYPE_EXP_EIGRP_RID 0x06 /* Originating EIGRP Router ID of the route */
526
527 #define BGP_EXT_COM_EXP_EIGRP_FLAG_RT 0x8000 /* Route flag - Internal/External */
528
529
530 /* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
531
532 /* RFC 4360 */
533 #define BGP_EXT_COM_RT_AS2 0x0002 /* Route Target,Format AS(2bytes):AN(4bytes) */
534 #define BGP_EXT_COM_RT_IP4 0x0102 /* Route Target,Format IP address:AN(2bytes) */
535 #define BGP_EXT_COM_RT_AS4 0x0202 /* Route Target,Format AS(4bytes):AN(2bytes) */
536
537 /* extended community option flow flec action bit S and T */
538 #define BGP_EXT_COM_FSPEC_ACT_S 0x02
539 #define BGP_EXT_COM_FSPEC_ACT_T 0x01
540
541 /* extended community l2vpn flags */
542
543 #define BGP_EXT_COM_L2_FLAG_D 0x80
544 #define BGP_EXT_COM_L2_FLAG_Z1 0x40
545 #define BGP_EXT_COM_L2_FLAG_F 0x20
546 #define BGP_EXT_COM_L2_FLAG_Z345 0x1c
547 #define BGP_EXT_COM_L2_FLAG_C 0x02
548 #define BGP_EXT_COM_L2_FLAG_S 0x01
549
550 /* extended community E-Tree Info flags */
551
552 #define BGP_EXT_COM_ETREE_FLAG_RESERVED 0xFFFC
553 #define BGP_EXT_COM_ETREE_FLAG_P 0x0002
554 #define BGP_EXT_COM_ETREE_FLAG_V 0x0001
555
556 /* Extended community QoS Marking technology type */
557 #define QOS_TECH_TYPE_DSCP 0x00 /* DiffServ enabled IP (DSCP encoding) */
558 #define QOS_TECH_TYPE_802_1q 0x01 /* Ethernet using 802.1q priority tag */
559 #define QOS_TECH_TYPE_E_LSP 0x02 /* MPLS using E-LSP */
560 #define QOS_TECH_TYPE_VC 0x03 /* Virtual Channel (VC) encoding using separate channels for */
561 /* QoS forwarding / one channel per class (e.g. ATM VCs, FR */
562 /* VCs, MPLS L-LSPs) */
563 #define QOS_TECH_TYPE_GMPLS_TIME 0x04 /* GMPLS - time slot encoding */
564 #define QOS_TECH_TYPE_GMPLS_LAMBDA 0x05 /* GMPLS - lambda encoding */
565 #define QOS_TECH_TYPE_GMPLS_FIBRE 0x06 /* GMPLS - fibre encoding */
566
567 /* OSPF codes for BGP_EXT_COM_OSPF_RTYPE draft-rosen-vpns-ospf-bgp-mpls */
568 #define BGP_OSPF_RTYPE_RTR 1 /* OSPF Router LSA */
569 #define BGP_OSPF_RTYPE_NET 2 /* OSPF Network LSA */
570 #define BGP_OSPF_RTYPE_SUM 3 /* OSPF Summary LSA */
571 #define BGP_OSPF_RTYPE_EXT 5 /* OSPF External LSA, note that ASBR doesn't apply to MPLS-VPN */
572 #define BGP_OSPF_RTYPE_NSSA 7 /* OSPF NSSA External*/
573 #define BGP_OSPF_RTYPE_SHAM 129 /* OSPF-MPLS-VPN Sham link */
574 #define BGP_OSPF_RTYPE_METRIC_TYPE 0x1 /* Type-1 (clear) or Type-2 (set) external metric */
575
576 /* Extended community & Route distinguisher formats */
577 #define FORMAT_AS2_LOC 0x00 /* Format AS(2bytes):AN(4bytes) */
578 #define FORMAT_IP_LOC 0x01 /* Format IP address:AN(2bytes) */
579 #define FORMAT_AS4_LOC 0x02 /* Format AS(4bytes):AN(2bytes) */
580
581 /* RFC 4760 subsequent address family numbers (last updated 2021-03-23)
582 * https://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml
583 */
584 #define SAFNUM_UNICAST 1 /* RFC4760 */
585 #define SAFNUM_MULCAST 2 /* RFC4760 */
586 #define SAFNUM_UNIMULC 3 /* Deprecated, see RFC4760 */
587 #define SAFNUM_MPLS_LABEL 4 /* RFC8277 */
588 #define SAFNUM_MCAST_VPN 5 /* RFC6514 */
589 #define SAFNUM_MULTISEG_PW 6 /* RFC7267 */
590 #define SAFNUM_ENCAPSULATION 7 /* RFC5512, obsolete and never deployed, see draft-ietf-idr-tunnel-encaps-22 */
591 #define SAFNUM_MCAST_VPLS 8 /* RFC7117 */
592 #define SAFNUM_TUNNEL 64 /* draft-nalawade-kapoor-tunnel-safi-05.txt (Expired) */
593 #define SAFNUM_VPLS 65 /* RFC4761, RFC6074 */
594 #define SAFNUM_MDT 66 /* RFC6037 */
595 #define SAFNUM_4OVER6 67 /* RFC5747 */
596 #define SAFNUM_6OVER4 68 /* Never specified? Cf. RFC5747 */
597 #define SAFNUM_L1VPN 69 /* RFC5195 */
598 #define SAFNUM_EVPN 70 /* RFC7432 */
599 #define SAFNUM_BGP_LS 71 /* RFC7752 */
600 #define SAFNUM_BGP_LS_VPN 72 /* RFC7752 */
601 #define SAFNUM_SR_POLICY 73 /* draft-ietf-idr-segment-routing-te-policy-11 */
602 #define SAFNUM_SD_WAN 74 /* draft-dunbar-idr-sdwan-port-safi-06, expired */
603 #define SAFNUM_RPD 75 /* draft-ietf-idr-rpd-10 */
604 #define SAFNUM_CT 76 /* draft-kaliraj-idr-bgp-classful-transport-planes-07 */
605 #define SAFNUM_FLOWSPEC 77 /* draft-ietf-idr-flowspec-nvo3-13 */
606 #define SAFNUM_MCAST_TREE 78 /* draft-ietf-bess-bgp-multicast-03 */
607 #define SAFNUM_LAB_VPNUNICAST 128 /* RFC4364, RFC8277 */
608 #define SAFNUM_LAB_VPNMULCAST 129 /* RFC6513, RFC6514 */
609 #define SAFNUM_LAB_VPNUNIMULC 130 /* Obsolete and reserved, see RFC4760 */
610 #define SAFNUM_ROUTE_TARGET 132 /* RFC 4684 Constrained Route Distribution for BGP/MPLS IP VPN */
611 #define SAFNUM_FSPEC_RULE 133 /* RFC 8955 BGP flow spec SAFI */
612 #define SAFNUM_FSPEC_VPN_RULE 134 /* RFC 8955 BGP flow spec SAFI VPN */
613 #define SAFNUM_L3VPN 140 /* Withdrawn, draft-ietf-l3vpn-bgpvpn-auto-09 */
614
615 /* BGP Additional Paths Capability */
616 #define BGP_ADDPATH_RECEIVE 0x01
617 #define BGP_ADDPATH_SEND 0x02
618
619 /* mcast-vpn route types draft-ietf-l3vpn-2547bis-mcast-bgp-08.txt */
620 #define MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD 1
621 #define MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD 2
622 #define MCAST_VPN_RTYPE_SPMSI_AD 3
623 #define MCAST_VPN_RTYPE_LEAF_AD 4
624 #define MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD 5
625 #define MCAST_VPN_RTYPE_SHARED_TREE_JOIN 6
626 #define MCAST_VPN_RTYPE_SOURCE_TREE_JOIN 7
627
628 /* RFC 5512 Tunnel Types */
629 #define TUNNEL_TYPE_L2TP_OVER_IP 1
630 #define TUNNEL_TYPE_GRE 2
631 #define TUNNEL_TYPE_TTE 3
632 #define TUNNEL_TYPE_IPSEC_IN_TM 4
633 #define TUNNEL_TYPE_IP_IN_IP_IPSEC 5
634 #define TUNNEL_TYPE_MPLS_IN_IP_IPSEC 6
635 #define TUNNEL_TYPE_IP_IN_IP 7
636 #define TUNNEL_TYPE_VXLAN 8
637 #define TUNNEL_TYPE_NVGRE 9
638 #define TUNNEL_TYPE_MPLS 10
639 #define TUNNEL_TYPE_MPLS_IN_GRE 11
640 #define TUNNEL_TYPE_VXLAN_GPE 12
641 #define TUNNEL_TYPE_MPLS_IN_UDP 13
642 #define TUNNEL_TYPE_IPV6_TUNNEL 14
643 #define TUNNEL_TYPE_SR_TE_POLICY 15
644 #define TUNNEL_TYPE_BARE 16
645 #define TUNNEL_TYPE_SR_TUNNEL 17
646
647 /*RFC 6514 PMSI Tunnel Types */
648 #define PMSI_TUNNEL_NOPRESENT 0
649 #define PMSI_TUNNEL_RSVPTE_P2MP 1
650 #define PMSI_TUNNEL_MLDP_P2MP 2
651 #define PMSI_TUNNEL_PIMSSM 3
652 #define PMSI_TUNNEL_PIMSM 4
653 #define PMSI_TUNNEL_BIDIR_PIM 5
654 #define PMSI_TUNNEL_INGRESS 6
655 #define PMSI_TUNNEL_MLDP_MP2MP 7
656
657 #define PMSI_MLDP_FEC_TYPE_RSVD 0
658 #define PMSI_MLDP_FEC_TYPE_GEN_LSP 1
659 #define PMSI_MLDP_FEC_TYPE_EXT_TYPE 255
660 #define PMSI_MLDP_FEC_ETYPE_RSVD 0
661
662 /* RFC 7311 AIGP types */
663 #define AIGP_TLV_TYPE 1
664
665 /* RFC 5512/5640 Sub-TLV Types */
666 #define TUNNEL_SUBTLV_ENCAPSULATION 1
667 #define TUNNEL_SUBTLV_PROTO_TYPE 2
668 #define TUNNEL_SUBTLV_IPSEC_TA 3
669 #define TUNNEL_SUBTLV_COLOR 4
670 #define TUNNEL_SUBTLV_LOAD_BALANCE 5
671 #define TUNNEL_SUBTLV_REMOTE_ENDPOINT 6
672 #define TUNNEL_SUBTLV_IPV4_DS_FIELD 7
673 #define TUNNEL_SUBTLV_UDP_DST_PORT 8
674 #define TUNNEL_SUBTLV_EMBEDDED_LABEL 9
675 #define TUNNEL_SUBTLV_MPLS_LABEL 10
676 #define TUNNEL_SUBTLV_PREFIX_SID 11
677 #define TUNNEL_SUBTLV_PREFERENCE 12
678 #define TUNNEL_SUBTLV_BINDING_SID 13
679 #define TUNNEL_SUBTLV_ENLP 14
680 #define TUNNEL_SUBTLV_PRIORITY 15
681 #define TUNNEL_SUBTLV_SEGMENT_LIST 128
682 #define TUNNEL_SUBTLV_POLICY_NAME 129
683
684 /* BGP Tunnel SubTLV VXLAN Flags bitmask */
685 #define TUNNEL_SUBTLV_VXLAN_VALID_VNID 0x80
686 #define TUNNEL_SUBTLV_VXLAN_VALID_MAC 0x40
687 #define TUNNEL_SUBTLV_VXLAN_RESERVED 0x3F
688
689 /* BGP Tunnel SubTLV VXLAN GPE Flags bitmask */
690 #define TUNNEL_SUBTLV_VXLAN_GPE_VERSION 0xC0
691 #define TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID 0x20
692 #define TUNNEL_SUBTLV_VXLAN_GPE_RESERVED 0x1F
693
694 /* BGP Tunnel SubTLV NVGRE Flags bitmask */
695 #define TUNNEL_SUBTLV_NVGRE_VALID_VNID 0x80
696 #define TUNNEL_SUBTLV_NVGRE_VALID_MAC 0x40
697 #define TUNNEL_SUBTLV_NVGRE_RESERVED 0x3F
698
699 /* BGP Tunnel SubTLV Binding SID Flags bitmask */
700 #define TUNNEL_SUBTLV_BINDING_SPECIFIED 0x80
701 #define TUNNEL_SUBTLV_BINDING_INVALID 0x40
702 #define TUNNEL_SUBTLV_BINDING_RESERVED 0x3F
703
704 /* BGP Segment List SubTLV Types */
705 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A 1
706 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B 2
707 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C 3
708 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D 4
709 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E 5
710 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F 6
711 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G 7
712 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H 8
713 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT 9
714 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I 10
715 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J 11
716 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K 12
717
718 /* BGP Tunnel SubTLV Segment List SubTLV Flags bitmask */
719 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION 0x80
720 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM 0x40
721 #define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED 0x3F
722
723 /* Link-State NLRI types */
724 #define LINK_STATE_NODE_NLRI 1
725 #define LINK_STATE_LINK_NLRI 2
726 #define LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI 3
727 #define LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI 4
728
729 /* Link-State NLRI Protocol-ID values */
730 #define BGP_LS_NLRI_PROTO_ID_UNKNOWN 0
731 #define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 1
732 #define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2 2
733 #define BGP_LS_NLRI_PROTO_ID_OSPF 3
734 #define BGP_LS_NLRI_PROTO_ID_DIRECT 4
735 #define BGP_LS_NLRI_PROTO_ID_STATIC 5
736 #define BGP_LS_NLRI_PROTO_ID_BGP 7
737
738 /* Link-State routing universes */
739 #define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3 0
740 #define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1 1
741
742 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN 0
743 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA 1
744 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA 2
745 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1 3
746 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2 4
747 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1 5
748 #define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2 6
749
750 /* RFC7752 */
751 #define BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS 256
752 #define BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS 257
753 #define BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS 258
754 #define BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS 259
755 #define BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS 260
756 #define BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS 261
757 #define BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS 262
758 #define BGP_NLRI_TLV_MULTI_TOPOLOGY_ID 263
759 #define BGP_NLRI_TLV_OSPF_ROUTE_TYPE 264
760 #define BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION 265
761 #define BGP_NLRI_TLV_NODE_MSD 266
762 #define BGP_NLRI_TLV_LINK_MSD 267
763
764 #define BGP_NLRI_TLV_AUTONOMOUS_SYSTEM 512
765 #define BGP_NLRI_TLV_BGP_LS_IDENTIFIER 513
766 #define BGP_NLRI_TLV_AREA_ID 514
767 #define BGP_NLRI_TLV_IGP_ROUTER_ID 515
768 #define BGP_NLRI_TLV_BGP_ROUTER_ID 516
769
770 #define BGP_NLRI_TLV_NODE_FLAG_BITS 1024
771 #define BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES 1025
772 #define BGP_NLRI_TLV_NODE_NAME 1026
773 #define BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER 1027
774 #define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE 1028
775 #define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE 1029
776 #define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE 1030
777 #define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE 1031
778
779 #define BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR 1088
780 #define BGP_NLRI_TLV_MAX_LINK_BANDWIDTH 1089
781 #define BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH 1090
782 #define BGP_NLRI_TLV_UNRESERVED_BANDWIDTH 1091
783 #define BGP_NLRI_TLV_TE_DEFAULT_METRIC 1092
784 #define BGP_NLRI_TLV_LINK_PROTECTION_TYPE 1093
785 #define BGP_NLRI_TLV_MPLS_PROTOCOL_MASK 1094
786 #define BGP_NLRI_TLV_METRIC 1095
787 #define BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP 1096
788 #define BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE 1097
789 #define BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE 1098
790
791 #define BGP_NLRI_TLV_IGP_FLAGS 1152
792 #define BGP_NLRI_TLV_ROUTE_TAG 1153
793 #define BGP_NLRI_TLV_EXTENDED_TAG 1154
794 #define BGP_NLRI_TLV_PREFIX_METRIC 1155
795 #define BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS 1156
796 #define BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE 1157
797 #define BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP 1173
798
799
800 /* Link-State NLRI TLV lengths */
801 #define BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM 4
802 #define BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER 4
803 #define BGP_NLRI_TLV_LEN_AREA_ID 4
804 #define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID 4
805 #define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID 16
806 #define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
807 #define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
808 #define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
809 #define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
810 #define BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS 8
811 #define BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS 4
812 #define BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS 4
813 #define BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS 16
814 #define BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS 16
815 #define BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID 2
816 #define BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR 4
817 #define BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH 4
818 #define BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH 4
819 #define BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH 32
820 #define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD 3
821 #define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW 4
822 #define BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE 2
823 #define BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK 1
824 #define BGP_NLRI_TLV_LEN_MAX_METRIC 3
825 #define BGP_NLRI_TLV_LEN_IGP_FLAGS 1
826 #define BGP_NLRI_TLV_LEN_PREFIX_METRIC 4
827 #define BGP_NLRI_TLV_LEN_NODE_FLAG_BITS 1
828
829 /* draft-gredler-idr-bgp-ls-segment-routing-ext-01 */
830 #define BGP_LS_SR_TLV_SR_CAPABILITY 1034
831 #define BGP_LS_SR_TLV_SR_ALGORITHM 1035
832 #define BGP_LS_SR_TLV_SR_LOCAL_BLOCK 1036
833 #define BGP_LS_SR_TLV_FLEX_ALGO_DEF 1039
834 #define BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY 1040
835 #define BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY 1041
836 #define BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY 1042
837 #define BGP_LS_SR_TLV_ADJ_SID 1099
838 #define BGP_LS_SR_TLV_LAN_ADJ_SID 1100
839 #define BGP_LS_SR_TLV_PEER_NODE_SID 1101
840 #define BGP_LS_SR_TLV_PEER_ADJ_SID 1102
841 #define BGP_LS_SR_TLV_PEER_SET_SID 1103
842 #define BGP_LS_SR_TLV_PREFIX_SID 1158
843 #define BGP_LS_SR_TLV_RANGE 1159
844 #define BGP_LS_SR_TLV_BINDING_SID 1160
845 #define BGP_LS_SR_SUBTLV_BINDING_SID_LABEL 1161
846 #define BGP_LS_SR_SUBTLV_BINDING_ERO_METRIC 1162
847 #define BGP_LS_SR_SUBTLV_BINDING_IPV4_ERO 1163
848 #define BGP_LS_SR_SUBTLV_BINDING_IPV6_ERO 1164
849 #define BGP_LS_SR_SUBTLV_BINDING_UNNUM_IFID_ERO 1165
850 #define BGP_LS_SR_SUBTLV_BINDING_IPV4_BAK_ERO 1166
851 #define BGP_LS_SR_SUBTLV_BINDING_IPV6_BAK_ERO 1167
852 #define BGP_LS_SR_SUBTLV_BINDING_UNNUM_IFID_BAK_ERO 1168
853 #define BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS 1170
854
855 /* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
856 #define BGP_LS_IGP_TE_METRIC_DELAY 1114
857 #define BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX 1115
858 #define BGP_LS_IGP_TE_METRIC_DELAY_VARIATION 1116
859 #define BGP_LS_IGP_TE_METRIC_LOSS 1117
860 #define BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL 1118
861 #define BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE 1119
862 #define BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED 1120
863
864 #define BGP_LS_IGP_TE_METRIC_FLAG_A 0x80
865 #define BGP_LS_IGP_TE_METRIC_FLAG_RESERVED 0x7F
866
867 /* draft-ietf-idr-bgp-ls-app-specific-attr-07 */
868 #define BGP_LS_APP_SPEC_LINK_ATTR 1122
869
870 /* Prefix-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext-01:
871
872 0 1 2 3 4 5 6 7
873 +--+--+--+--+--+--+--+--+
874 if Protocol-ID is IS-IS |R |N |P |E |V |L | | |
875 +--+--+--+--+--+--+--+--+
876
877 0 1 2 3 4 5 6 7
878 +--+--+--+--+--+--+--+--+
879 if Protocol-ID is OSPF | |NP|M |E |V |L | | |
880 +--+--+--+--+--+--+--+--+
881 */
882 #define BGP_LS_SR_PREFIX_SID_FLAG_R 0x80
883 #define BGP_LS_SR_PREFIX_SID_FLAG_N 0x40
884 #define BGP_LS_SR_PREFIX_SID_FLAG_NP 0x40
885 #define BGP_LS_SR_PREFIX_SID_FLAG_P 0x20
886 #define BGP_LS_SR_PREFIX_SID_FLAG_M 0x20
887 #define BGP_LS_SR_PREFIX_SID_FLAG_E 0x10
888 #define BGP_LS_SR_PREFIX_SID_FLAG_V 0x08
889 #define BGP_LS_SR_PREFIX_SID_FLAG_L 0x04
890
891 /* Adjacency-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext-01:
892
893 0 1 2 3 4 5 6 7
894 +--+--+--+--+--+--+--+--+
895 if Protocol-ID is IS-IS |F |B |V |L |S | | | |
896 +--+--+--+--+--+--+--+--+
897
898 0 1 2 3 4 5 6 7
899 +--+--+--+--+--+--+--+--+
900 if Protocol-ID is OSPF |B |V |L |S | | | | |
901 +--+--+--+--+--+--+--+--+
902 */
903 #define BGP_LS_SR_ADJACENCY_SID_FLAG_FI 0x80
904 #define BGP_LS_SR_ADJACENCY_SID_FLAG_BO 0x80
905 #define BGP_LS_SR_ADJACENCY_SID_FLAG_BI 0x40
906 #define BGP_LS_SR_ADJACENCY_SID_FLAG_VO 0x40
907 #define BGP_LS_SR_ADJACENCY_SID_FLAG_VI 0x20
908 #define BGP_LS_SR_ADJACENCY_SID_FLAG_LO 0x20
909 #define BGP_LS_SR_ADJACENCY_SID_FLAG_LI 0x10
910 #define BGP_LS_SR_ADJACENCY_SID_FLAG_SO 0x10
911 #define BGP_LS_SR_ADJACENCY_SID_FLAG_SI 0x08
912
913 /* BGP Peering SIDs TLV flags, rfc9086:
914
915 0 1 2 3 4 5 6 7
916 +--+--+--+--+--+--+--+--+
917 |V |L |B |P | | | | | rfc9086
918 +--+--+--+--+--+--+--+--+
919 */
920 #define BGP_LS_SR_PEER_SID_FLAG_V 0x80
921 #define BGP_LS_SR_PEER_SID_FLAG_L 0x40
922 #define BGP_LS_SR_PEER_SID_FLAG_B 0x20
923 #define BGP_LS_SR_PEER_SID_FLAG_P 0x10
924
925 /* SR-Capabilities TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext-01:
926
927 0 1 2 3 4 5 6 7
928 +--+--+--+--+--+--+--+--+
929 if Protocol-ID is IS-IS |I |V |H | | | | | |
930 +--+--+--+--+--+--+--+--+
931 */
932 #define BGP_LS_SR_CAPABILITY_FLAG_I 0x80
933 #define BGP_LS_SR_CAPABILITY_FLAG_V 0x40
934 #define BGP_LS_SR_CAPABILITY_FLAG_H 0x20
935
936 /* Prefix Attribute Flags TLV flags, rfc9085:
937
938 0 1 2 3 4 5 6 7
939 +--+--+--+--+--+--+--+--+
940 if Protocol-ID is IS-IS |X |R |N |E | | | | | rfc7794,rfc9088
941 +--+--+--+--+--+--+--+--+
942
943 0 1 2 3 4 5 6 7
944 +--+--+--+--+--+--+--+--+
945 if Protocol-ID is OSPF |A |N |E | | | | | | rfc7684,rfc9089
946 +--+--+--+--+--+--+--+--+
947 */
948 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI 0x80
949 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI 0x40
950 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI 0x20
951 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI 0x10
952 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO 0x80
953 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO 0x40
954 #define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO 0x20
955
956 /* Link Attribute Application Identifiers, https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml:
957
958 0 1 2 3 4 5 6 7
959 +--+--+--+--+--+--+--+--+
960 |R |S |F |X | | | | | rfc8919,rfc8920
961 +--+--+--+--+--+--+--+--+
962 */
963 #define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R 0x80000000
964 #define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S 0x40000000
965 #define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F 0x20000000
966 #define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X 0x10000000
967
968
969 /* BGP Prefix-SID TLV type */
970 #define BGP_PREFIX_SID_TLV_LABEL_INDEX 1 /* Label-Index [RFC8669] */
971 #define BGP_PREFIX_SID_TLV_2 2 /* Deprecated [RFC8669] */
972 #define BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB 3 /* Originator SRGB [RFC8669] */
973 #define BGP_PREFIX_SID_TLV_4 4 /* Deprecated [draft-ietf-bess-srv6-services] */
974 #define BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE 5 /* SRv6 L3 Service [draft-ietf-bess-srv6-services] */
975 #define BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE 6 /* SRv6 L2 Service [draft-ietf-bess-srv6-services] */
976
977 /* BGP_PREFIX_SID TLV lengths */
978 #define BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX 7
979
980 /* BGP SRv6 Service Sub-TLV */
981 #define SRV6_SERVICE_SRV6_SID_INFORMATION 1
982
983 /* BGP SRv6 Service Data Sub-Sub-TLV */
984 #define SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE 1
985
986 /* SRv6 Endpoint behavior */
987 #define SRV6_ENDPOINT_BEHAVIOR_END 0x0001 /* End [draft-ietf-spring-srv6-network-programming] */
988 #define SRV6_ENDPOINT_BEHAVIOR_END_PSP 0x0002 /* End with PSP [draft-ietf-spring-srv6-network-programming] */
989 #define SRV6_ENDPOINT_BEHAVIOR_END_USP 0x0003 /* End with USP [draft-ietf-spring-srv6-network-programming] */
990 #define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP 0x0004 /* End with PSP & USP [draft-ietf-spring-srv6-network-programming] */
991 #define SRV6_ENDPOINT_BEHAVIOR_END_X 0x0005 /* End.X [draft-ietf-spring-srv6-network-programming] */
992 #define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP 0x0006 /* End.X with PSP [draft-ietf-spring-srv6-network-programming] */
993 #define SRV6_ENDPOINT_BEHAVIOR_END_X_USP 0x0007 /* End.X with UPS [draft-ietf-spring-srv6-network-programming] */
994 #define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP 0x0008 /* End.X with PSP & USP [draft-ietf-spring-srv6-network-programming] */
995 #define SRV6_ENDPOINT_BEHAVIOR_END_T 0x0009 /* End.T [draft-ietf-spring-srv6-network-programming] */
996 #define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP 0x000A /* End.T with PSP [draft-ietf-spring-srv6-network-programming] */
997 #define SRV6_ENDPOINT_BEHAVIOR_END_T_USP 0x000B /* End.T with USP [draft-ietf-spring-srv6-network-programming] */
998 #define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP 0x000C /* End.T with PSP & USP [draft-ietf-spring-srv6-network-programming] */
999 #define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS 0x000E /* End.B6.Encaps [draft-ietf-spring-srv6-network-programming] */
1000 #define SRV6_ENDPOINT_BEHAVIOR_END_BM 0x000F /* End.BM [draft-ietf-spring-srv6-network-programming] */
1001 #define SRV6_ENDPOINT_BEHAVIOR_END_DX6 0x0010 /* End.DX6 [draft-ietf-spring-srv6-network-programming] */
1002 #define SRV6_ENDPOINT_BEHAVIOR_END_DX4 0x0011 /* End.DX4 [draft-ietf-spring-srv6-network-programming] */
1003 #define SRV6_ENDPOINT_BEHAVIOR_END_DT6 0x0012 /* End.DT6 [draft-ietf-spring-srv6-network-programming] */
1004 #define SRV6_ENDPOINT_BEHAVIOR_END_DT4 0x0013 /* End.DT4 [draft-ietf-spring-srv6-network-programming] */
1005 #define SRV6_ENDPOINT_BEHAVIOR_END_DT46 0x0014 /* End.DT46 [draft-ietf-spring-srv6-network-programming] */
1006 #define SRV6_ENDPOINT_BEHAVIOR_END_DX2 0x0015 /* End.DX2 [draft-ietf-spring-srv6-network-programming] */
1007 #define SRV6_ENDPOINT_BEHAVIOR_END_DX2V 0x0016 /* End.DX2V [draft-ietf-spring-srv6-network-programming] */
1008 #define SRV6_ENDPOINT_BEHAVIOR_END_DT2U 0x0017 /* End.DX2U [draft-ietf-spring-srv6-network-programming] */
1009 #define SRV6_ENDPOINT_BEHAVIOR_END_DT2M 0x0018 /* End.DT2M [draft-ietf-spring-srv6-network-programming] */
1010 #define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED 0x001B /* End.B6.Encaps.Red [draft-ietf-spring-srv6-network-programming] */
1011 #define SRV6_ENDPOINT_BEHAVIOR_END_USD 0x001C /* End with USD [draft-ietf-spring-srv6-network-programming] */
1012 #define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD 0x001D /* End with PSP & USD [draft-ietf-spring-srv6-network-programming] */
1013 #define SRV6_ENDPOINT_BEHAVIOR_END_USP_USD 0x001E /* End with USP & USD [draft-ietf-spring-srv6-network-programming] */
1014 #define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD 0x001F /* End with PSP, USP & USD [draft-ietf-spring-srv6-network-programming] */
1015 #define SRV6_ENDPOINT_BEHAVIOR_END_X_USD 0x0020 /* End.X with USD [draft-ietf-spring-srv6-network-programming] */
1016 #define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD 0x0021 /* End.X with PSP & USD [draft-ietf-spring-srv6-network-programming] */
1017 #define SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD 0x0022 /* End.X with USP & USD [draft-ietf-spring-srv6-network-programming] */
1018 #define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD 0x0023 /* End.X with PSP, USP & USD [draft-ietf-spring-srv6-network-programming] */
1019 #define SRV6_ENDPOINT_BEHAVIOR_END_T_USD 0x0024 /* End.T with USD [draft-ietf-spring-srv6-network-programming] */
1020 #define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD 0x0025 /* End.T with PSP & USD [draft-ietf-spring-srv6-network-programming] */
1021 #define SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD 0x0026 /* End.T with USP & USD [draft-ietf-spring-srv6-network-programming] */
1022 #define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD 0x0027 /* End.T with PSP, USP & USD [draft-ietf-spring-srv6-network-programming] */
1023 #define SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID 0x002A /* End with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1024 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID 0x002B /* End with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1025 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP 0x002C /* End with NEXT-CSID & PSP [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1026 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP 0x002D /* End with NEXT-CSID & USP [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1027 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP 0x002E /* End with NEXT-CSID, PSP & USP [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1028 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD 0x002F /* End with NEXT-CSID & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1029 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD 0x0030 /* End with NEXT-CSID, PSP & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1030 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD 0x0031 /* End with NEXT-CSID, USP & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1031 #define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD 0x0032 /* End with NEXT-CSID, PSP, USP & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1032 #define SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID 0x0033 /* End.X with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1033 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID 0x0034 /* End.X with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1034 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP 0x0035 /* End.X with NEXT-CSID & PSP [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1035 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP 0x0036 /* End.X with NEXT-CSID & USP [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1036 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP 0x0037 /* End.X with NEXT-CSID, PSP & USP [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1037 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD 0x0038 /* End.X with NEXT-CSID & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1038 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD 0x0039 /* End.X with NEXT-CSID, PSP & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1039 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD 0x003A /* End.X with NEXT-CSID, USP & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1040 #define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP_USD 0x003B /* End.X with NEXT-CSID, PSP, USP & USD [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1041 #define SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID 0x003C /* End.DX6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1042 #define SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID 0x003D /* End.DX4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1043 #define SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID 0x003E /* End.DT6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1044 #define SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID 0x003F /* End.DT4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1045 #define SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID 0x0040 /* End.DT46 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1046 #define SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID 0x0041 /* End.DX2 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1047 #define SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID 0x0042 /* End.DX2V with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1048 #define SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID 0x0043 /* End.DT2U with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1049 #define SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID 0x0044 /* End.DT2M with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid] */
1050 #define SRV6_ENDPOINT_BEHAVIOR_OPAQUE 0xFFFF /* Opaque [draft-ietf-spring-srv6-network-programming] */
1051
1052 static const value_string bgptypevals[] = {
1053 { BGP_OPEN, "OPEN Message" },
1054 { BGP_UPDATE, "UPDATE Message" },
1055 { BGP_NOTIFICATION, "NOTIFICATION Message" },
1056 { BGP_KEEPALIVE, "KEEPALIVE Message" },
1057 { BGP_ROUTE_REFRESH, "ROUTE-REFRESH Message" },
1058 { BGP_CAPABILITY, "CAPABILITY Message" },
1059 { BGP_ROUTE_REFRESH_CISCO, "Cisco ROUTE-REFRESH Message" },
1060 { 0, NULL }
1061 };
1062
1063 static const value_string evpnrtypevals[] = {
1064 { EVPN_AD_ROUTE, "Ethernet AD Route" },
1065 { EVPN_MAC_ROUTE, "MAC Advertisement Route" },
1066 { EVPN_INC_MCAST_TREE, "Inclusive Multicast Route" },
1067 { EVPN_ETH_SEGMENT_ROUTE, "Ethernet Segment Route" },
1068 { EVPN_IP_PREFIX_ROUTE, "IP Prefix route" },
1069 { EVPN_MC_ETHER_TAG_ROUTE, "Selective Multicast Ethernet Tag Route" },
1070 { EVPN_IGMP_JOIN_ROUTE, "IGMP Join Synch Route" },
1071 { EVPN_IGMP_LEAVE_ROUTE, "IGMP Leave Synch Route" },
1072 { EVPN_S_PMSI_A_D_ROUTE, "S-PMSI A-D Route" },
1073 { 0, NULL }
1074 };
1075
1076 static const value_string evpn_nlri_esi_type[] = {
1077 { BGP_NLRI_EVPN_ESI_VALUE, "ESI 9 bytes value" },
1078 { BGP_NLRI_EVPN_ESI_LACP, "ESI LACP 802.1AX defined" },
1079 { BGP_NLRI_EVPN_ESI_MSTP, "ESI MSTP defined" },
1080 { BGP_NLRI_EVPN_ESI_MAC, "ESI MAC address defined" },
1081 { BGP_NLRI_EVPN_ESI_RID, "ESI Router ID" },
1082 { BGP_NLRI_EVPN_ESI_ASN, "ESI Autonomous System" },
1083 { BGP_NLRI_EVPN_ESI_RES, "ESI reserved" },
1084 { 0, NULL }
1085 };
1086
1087 #define BGP_MAJOR_ERROR_MSG_HDR 1
1088 #define BGP_MAJOR_ERROR_OPEN_MSG 2
1089 #define BGP_MAJOR_ERROR_UPDATE_MSG 3
1090 #define BGP_MAJOR_ERROR_HT_EXPIRED 4
1091 #define BGP_MAJOR_ERROR_STATE_MACHINE 5
1092 #define BGP_MAJOR_ERROR_CEASE 6
1093 #define BGP_MAJOR_ERROR_CAP_MSG 7
1094
1095 static const value_string bgpnotify_major[] = {
1096 { BGP_MAJOR_ERROR_MSG_HDR, "Message Header Error" },
1097 { BGP_MAJOR_ERROR_OPEN_MSG, "OPEN Message Error" },
1098 { BGP_MAJOR_ERROR_UPDATE_MSG, "UPDATE Message Error" },
1099 { BGP_MAJOR_ERROR_HT_EXPIRED, "Hold Timer Expired" },
1100 { BGP_MAJOR_ERROR_STATE_MACHINE, "Finite State Machine Error" },
1101 { BGP_MAJOR_ERROR_CEASE, "Cease" },
1102 { BGP_MAJOR_ERROR_CAP_MSG, "CAPABILITY Message Error" },
1103 { 0, NULL }
1104 };
1105
1106 static const value_string bgpnotify_minor_msg_hdr[] = {
1107 { 1, "Connection Not Synchronized" },
1108 { 2, "Bad Message Length" },
1109 { 3, "Bad Message Type" },
1110 { 0, NULL }
1111 };
1112
1113 static const value_string bgpnotify_minor_open_msg[] = {
1114 { 1, "Unsupported Version Number" },
1115 { 2, "Bad Peer AS" },
1116 { 3, "Bad BGP Identifier" },
1117 { 4, "Unsupported Optional Parameter" },
1118 { 5, "Authentication Failure [Deprecated]" },
1119 { 6, "Unacceptable Hold Time" },
1120 { 7, "Unsupported Capability" },
1121 { 8, "No supported AFI/SAFI (Cisco)" },
1122 { 0, NULL }
1123 };
1124
1125 static const value_string bgpnotify_minor_update_msg[] = {
1126 { 1, "Malformed Attribute List" },
1127 { 2, "Unrecognized Well-known Attribute" },
1128 { 3, "Missing Well-known Attribute" },
1129 { 4, "Attribute Flags Error" },
1130 { 5, "Attribute Length Error" },
1131 { 6, "Invalid ORIGIN Attribute" },
1132 { 7, "AS Routing Loop [Deprecated]" },
1133 { 8, "Invalid NEXT_HOP Attribute" },
1134 { 9, "Optional Attribute Error" },
1135 { 10, "Invalid Network Field" },
1136 { 11, "Malformed AS_PATH" },
1137 { 0, NULL }
1138 };
1139 /* RFC6608 Subcodes for BGP Finite State Machine Error */
1140 static const value_string bgpnotify_minor_state_machine[] = {
1141 { 1, "Receive Unexpected Message in OpenSent State" },
1142 { 2, "Receive Unexpected Message in OpenConfirm State" },
1143 { 3, "Receive Unexpected Message in Established State" },
1144 { 0, NULL }
1145 };
1146
1147 #define BGP_CEASE_MINOR_MAX_REACHED 1
1148 #define BGP_CEASE_MINOR_ADMIN_SHUTDOWN 2
1149 #define BGP_CEASE_MINOR_PEER_DE_CONF 3
1150 #define BGP_CEASE_MINOR_ADMIN_RESET 4
1151 #define BGP_CEASE_MINOR_CONN_RESET 5
1152 #define BGP_CEASE_MINOR_OTHER_CONF_CHANGE 6
1153 #define BGP_CEASE_MINOR_CONN_COLLISION 7
1154 #define BGP_CEASE_MINOR_OUT_RESOURCES 8
1155 #define BGP_CEASE_MINOR_HARD_RESET 9
1156
1157 /* RFC4486 Subcodes for BGP Cease Notification Message */
1158 static const value_string bgpnotify_minor_cease[] = {
1159 { BGP_CEASE_MINOR_MAX_REACHED, "Maximum Number of Prefixes Reached"},
1160 { BGP_CEASE_MINOR_ADMIN_SHUTDOWN, "Administratively Shutdown"},
1161 { BGP_CEASE_MINOR_PEER_DE_CONF, "Peer De-configured"},
1162 { BGP_CEASE_MINOR_ADMIN_RESET, "Administratively Reset"},
1163 { BGP_CEASE_MINOR_CONN_RESET, "Connection Rejected"},
1164 { BGP_CEASE_MINOR_OTHER_CONF_CHANGE, "Other Configuration Change"},
1165 { BGP_CEASE_MINOR_CONN_COLLISION, "Connection Collision Resolution"},
1166 { BGP_CEASE_MINOR_OUT_RESOURCES, "Out of Resources"},
1167 { BGP_CEASE_MINOR_HARD_RESET, "Hard Reset"},
1168 { 0, NULL }
1169 };
1170
1171 static const value_string bgpnotify_minor_cap_msg[] = {
1172 { 1, "Invalid Action Value" },
1173 { 2, "Invalid Capability Length" },
1174 { 3, "Malformed Capability Value" },
1175 { 4, "Unsupported Capability Code" },
1176 { 0, NULL }
1177 };
1178
1179 static const value_string bgpattr_origin[] = {
1180 { 0, "IGP" },
1181 { 1, "EGP" },
1182 { 2, "INCOMPLETE" },
1183 { 0, NULL }
1184 };
1185
1186 static const value_string bgp_open_opt_vals[] = {
1187 { BGP_OPTION_AUTHENTICATION, "Authentication" },
1188 { BGP_OPTION_CAPABILITY, "Capability" },
1189 { 0, NULL }
1190 };
1191
1192 static const value_string as_segment_type[] = {
1193 { 1, "AS_SET" },
1194 { 2, "AS_SEQUENCE" },
1195 /* RFC1965 has the wrong values, corrected in */
1196 /* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
1197 { 4, "AS_CONFED_SET" },
1198 { 3, "AS_CONFED_SEQUENCE" },
1199 { 0, NULL }
1200 };
1201
1202 static const value_string bgpattr_type[] = {
1203 { BGPTYPE_ORIGIN, "ORIGIN" },
1204 { BGPTYPE_AS_PATH, "AS_PATH" },
1205 { BGPTYPE_NEXT_HOP, "NEXT_HOP" },
1206 { BGPTYPE_MULTI_EXIT_DISC, "MULTI_EXIT_DISC" },
1207 { BGPTYPE_LOCAL_PREF, "LOCAL_PREF" },
1208 { BGPTYPE_ATOMIC_AGGREGATE, "ATOMIC_AGGREGATE" },
1209 { BGPTYPE_AGGREGATOR, "AGGREGATOR" },
1210 { BGPTYPE_COMMUNITIES, "COMMUNITIES" },
1211 { BGPTYPE_ORIGINATOR_ID, "ORIGINATOR_ID" },
1212 { BGPTYPE_CLUSTER_LIST, "CLUSTER_LIST" },
1213 { BGPTYPE_DPA, "DPA" },
1214 { BGPTYPE_ADVERTISER, "ADVERTISER" },
1215 { BGPTYPE_RCID_PATH, "RCID_PATH / CLUSTER_ID" },
1216 { BGPTYPE_MP_REACH_NLRI, "MP_REACH_NLRI" },
1217 { BGPTYPE_MP_UNREACH_NLRI, "MP_UNREACH_NLRI" },
1218 { BGPTYPE_EXTENDED_COMMUNITY, "EXTENDED_COMMUNITIES" },
1219 { BGPTYPE_AS4_PATH, "AS4_PATH" },
1220 { BGPTYPE_AS4_AGGREGATOR, "AS4_AGGREGATOR" },
1221 { BGPTYPE_SAFI_SPECIFIC_ATTR, "SAFI_SPECIFIC_ATTRIBUTE" },
1222 { BGPTYPE_CONNECTOR_ATTRIBUTE, "Connector Attribute" },
1223 { BGPTYPE_AS_PATHLIMIT, "AS_PATHLIMIT "},
1224 { BGPTYPE_TUNNEL_ENCAPS_ATTR, "TUNNEL_ENCAPSULATION_ATTRIBUTE" },
1225 { BGPTYPE_PMSI_TUNNEL_ATTR, "PMSI_TUNNEL_ATTRIBUTE" },
1226 { BGPTYPE_TRAFFIC_ENGINEERING, "Traffic Engineering" },
1227 { BGPTYPE_IPV6_ADDR_SPEC_EC, "IPv6 Address Specific Extended Community" },
1228 { BGPTYPE_AIGP, "AIGP" },
1229 { BGPTYPE_PE_DISTING_LABLES, "PE Distinguisher Labels" },
1230 { BGPTYPE_BGP_ENTROPY_LABEL, "BGP Entropy Label Capability Attribute" },
1231 { BGPTYPE_LINK_STATE_ATTR, "BGP-LS Attribute" },
1232 { BGPTYPE_30, "Deprecated" },
1233 { BGPTYPE_31, "Deprecated" },
1234 { BGPTYPE_LARGE_COMMUNITY, "LARGE_COMMUNITY" },
1235 { BGPTYPE_BGPSEC_PATH, "BGPsec_PATH" },
1236 { BGPTYPE_D_PATH, "D_PATH" },
1237 { BGPTYPE_BGP_PREFIX_SID, "BGP Prefix-SID" },
1238 { BGPTYPE_LINK_STATE_OLD_ATTR, "LINK_STATE (unofficial code point)" },
1239 { BGPTYPE_ATTR_SET, "ATTR_SET" },
1240 { BGPTYPE_129, "Deprecated" },
1241 { BGPTYPE_241, "Deprecated" },
1242 { BGPTYPE_242, "Deprecated" },
1243 { BGPTYPE_243, "Deprecated" },
1244 { 0, NULL }
1245 };
1246
1247 static const value_string pmsi_tunnel_type[] = {
1248 { PMSI_TUNNEL_NOPRESENT, "Type is not present" },
1249 { PMSI_TUNNEL_RSVPTE_P2MP, "RSVP-TE P2MP LSP" },
1250 { PMSI_TUNNEL_MLDP_P2MP, "mLDP P2MP LSP" },
1251 { PMSI_TUNNEL_PIMSSM, "PIM SSM Tree" },
1252 { PMSI_TUNNEL_PIMSM, "PIM SM Tree" },
1253 { PMSI_TUNNEL_BIDIR_PIM, "BIDIR-PIM Tree" },
1254 { PMSI_TUNNEL_INGRESS, "Ingress Replication" },
1255 { PMSI_TUNNEL_MLDP_MP2MP, "mLDP MP2MP LSP" },
1256 { 0, NULL }
1257 };
1258
1259 static const value_string aigp_tlv_type[] = {
1260 { AIGP_TLV_TYPE, "Type AIGP TLV" },
1261 { 0, NULL }
1262 };
1263
1264 static const value_string pmsi_mldp_fec_opaque_value_type[] = {
1265 { PMSI_MLDP_FEC_TYPE_RSVD, "Reserved" },
1266 { PMSI_MLDP_FEC_TYPE_GEN_LSP, "Generic LSP Identifier" },
1267 { PMSI_MLDP_FEC_TYPE_EXT_TYPE, "Extended Type field in the following two bytes" },
1268 { 0, NULL}
1269 };
1270
1271 static const value_string pmsi_mldp_fec_opa_extented_type[] = {
1272 { PMSI_MLDP_FEC_ETYPE_RSVD, "Reserved" },
1273 { 0, NULL}
1274 };
1275
1276 static const value_string bgp_attr_tunnel_type[] = {
1277 { TUNNEL_TYPE_L2TP_OVER_IP, "L2TPv2 over IP" },
1278 { TUNNEL_TYPE_GRE, "GRE" },
1279 { TUNNEL_TYPE_TTE, "Transmit tunnel endpoint" },
1280 { TUNNEL_TYPE_IPSEC_IN_TM, "IPsec in Tunnel-mode" },
1281 { TUNNEL_TYPE_IP_IN_IP_IPSEC, "IP in IP tunnel with IPsec Transport Mode" },
1282 { TUNNEL_TYPE_MPLS_IN_IP_IPSEC, "MPLS-in-IP tunnel with IPsec Transport Mode" },
1283 { TUNNEL_TYPE_IP_IN_IP, "IP in IP" },
1284 { TUNNEL_TYPE_VXLAN, "VXLAN Encapsulation" },
1285 { TUNNEL_TYPE_NVGRE, "NVGRE Encapsulation" },
1286 { TUNNEL_TYPE_MPLS, "MPLS Encapsulation" },
1287 { TUNNEL_TYPE_MPLS_IN_GRE, "MPLS in GRE Encapsulation" },
1288 { TUNNEL_TYPE_VXLAN_GPE, "VXLAN GPE Encapsulation" },
1289 { TUNNEL_TYPE_MPLS_IN_UDP, "MPLS in UDP Encapsulation" },
1290 { TUNNEL_TYPE_IPV6_TUNNEL, "IPv6 Tunnel" },
1291 { TUNNEL_TYPE_SR_TE_POLICY, "SR TE Policy Type" },
1292 { TUNNEL_TYPE_BARE, "Bare" },
1293 { TUNNEL_TYPE_SR_TUNNEL, "SR Tunnel" },
1294 { 0, NULL }
1295 };
1296
1297 static const value_string subtlv_type[] = {
1298 { TUNNEL_SUBTLV_ENCAPSULATION, "ENCAPSULATION" },
1299 { TUNNEL_SUBTLV_PROTO_TYPE, "PROTOCOL_TYPE" },
1300 { TUNNEL_SUBTLV_IPSEC_TA, "IPsec Tunnel Authenticator" },
1301 { TUNNEL_SUBTLV_COLOR, "COLOR" },
1302 { TUNNEL_SUBTLV_LOAD_BALANCE, "LOAD_BALANCE" },
1303 { TUNNEL_SUBTLV_REMOTE_ENDPOINT,"Tunnel Egress Endpoint" },
1304 { TUNNEL_SUBTLV_IPV4_DS_FIELD, "IPv4 DS Field" },
1305 { TUNNEL_SUBTLV_UDP_DST_PORT, "UDP Destination Port" },
1306 { TUNNEL_SUBTLV_EMBEDDED_LABEL, "Embedded Label Handling" },
1307 { TUNNEL_SUBTLV_MPLS_LABEL, "MPLS Label Stack" },
1308 { TUNNEL_SUBTLV_PREFIX_SID, "Prefix SID" },
1309 { TUNNEL_SUBTLV_PREFERENCE, "Preference" },
1310 { TUNNEL_SUBTLV_BINDING_SID, "Binding SID" },
1311 { TUNNEL_SUBTLV_ENLP, "ENLP" },
1312 { TUNNEL_SUBTLV_PRIORITY, "Priority" },
1313 { TUNNEL_SUBTLV_SEGMENT_LIST, "Segment List" },
1314 { TUNNEL_SUBTLV_POLICY_NAME, "Policy Name" },
1315 { 0, NULL }
1316 };
1317
1318 static const value_string bgp_enlp_type[] = {
1319 { 0 , "Reserved" },
1320 { 1 , "Push IPv4, do not push IPv6" },
1321 { 2 , "Push IPv6, do not push IPv4" },
1322 { 3 , "Push IPv4, push IPv6" },
1323 { 4 , "Do not push" },
1324 { 0, NULL }
1325 };
1326
1327 static const value_string bgp_sr_policy_list_type[] = {
1328 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A, "Type A MPLS SID sub-TLV" },
1329 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B, "Type B SRv6 SID sub-TLV" },
1330 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C, "Type C IPv4 Node and SID sub-TLV" },
1331 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D, "Type D IPv6 Node and SID for SR-MPLS sub-TLV" },
1332 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E, "Type E IPv4 Node, index and SID sub-TLV" },
1333 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F, "Type F IPv4 Local/Remote addresses and SID sub-TLV" },
1334 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G, "Type G IPv6 Node, index for remote and local pair and SID for SR-MPLS sub-TLV" },
1335 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H, "Type H IPv6 Local/Remote addresses and SID sub-TLV" },
1336 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT, "Weight sub-TLV" },
1337 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I, "Type I IPv6 Node and SID for SRv6 sub-TLV" },
1338 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J, "Type J IPv6 Node, index for remote and local pair and SID for SRv6 sub-TLV" },
1339 { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K, "Type K IPv6 Local/Remote addresses and SID for SRv6 sub-TLV" },
1340 { 0, NULL }
1341 };
1342
1343 static const true_false_string tfs_bgpext_com_type_auth = {
1344 "Allocated on First Come First Serve Basis",
1345 "Allocated on Standard Action, Early Allocation or Experimental Basis"
1346 };
1347
1348 static const value_string bgpext_com_type_high[] = {
1349 { BGP_EXT_COM_TYPE_HIGH_TR_AS2, "Transitive 2-Octet AS-Specific" },
1350 { BGP_EXT_COM_TYPE_HIGH_TR_IP4, "Transitive IPv4-Address-Specific" },
1351 { BGP_EXT_COM_TYPE_HIGH_TR_AS4, "Transitive 4-Octet AS-Specific" },
1352 { BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE, "Transitive Opaque" },
1353 { BGP_EXT_COM_TYPE_HIGH_TR_QOS, "Transitive QoS Marking" },
1354 { BGP_EXT_COM_TYPE_HIGH_TR_COS, "Transitive CoS Capability" },
1355 { BGP_EXT_COM_TYPE_HIGH_TR_EVPN, "Transitive EVPN" },
1356 { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I, "FlowSpec Transitive" },
1357 { BGP_EXT_COM_TYPE_HIGH_TR_FLOW, "Transitive Flow spec redirect/mirror to IP next-hop" },
1358 { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R, "Transitive FlowSpec Redirect to indirection-id" },
1359 { BGP_EXT_COM_TYPE_HIGH_TR_EXP, "Generic Transitive Experimental Use"},
1360 { BGP_EXT_COM_TYPE_HIGH_TR_EXP_2, "Generic Transitive Experimental Use Part 2"},
1361 { BGP_EXT_COM_TYPE_HIGH_TR_EXP_3, "Generic Transitive Experimental Use Part 3 "},
1362 { BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP, "Transitive Experimental EIGRP" },
1363 { BGP_EXT_COM_TYPE_HIGH_NTR_AS2, "Non-Transitive 2-Octet AS-Specific" },
1364 { BGP_EXT_COM_TYPE_HIGH_NTR_IP4, "Non-Transitive IPv4-Address-Specific" },
1365 { BGP_EXT_COM_TYPE_HIGH_NTR_AS4, "Non-Transitive 4-Octet AS-Specific" },
1366 { BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE, "Non-Transitive Opaque" },
1367 { BGP_EXT_COM_TYPE_HIGH_NTR_QOS, "Non-Transitive QoS Marking" },
1368 { 0, NULL}
1369 };
1370
1371 static const value_string bgpext_com_stype_tr_exp_2[] = {
1372 { BGP_EXT_COM_STYPE_EXP_2_FLOW_RED, "Flow spec redirect IPv4 format"},
1373 { 0, NULL}
1374 };
1375
1376 static const value_string bgpext_com_stype_tr_exp_3[] = {
1377 { BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP, "Security Group AS4"},
1378 { BGP_EXT_COM_STYPE_EXP_3_FLOW_RED, "Flow spec redirect AS-4byte format"},
1379 { BGP_EXT_COM_STYPE_EXP_3_TAG4, "Tag4"},
1380 { BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS, "Origin Sub-Cluster4"},
1381 { 0, NULL}
1382 };
1383
1384 static const value_string bgpext_com_stype_tr_evpn[] = {
1385 { BGP_EXT_COM_STYPE_EVPN_MMAC, "MAC Mobility" },
1386 { BGP_EXT_COM_STYPE_EVPN_LABEL, "ESI MPLS Label" },
1387 { BGP_EXT_COM_STYPE_EVPN_IMP, "ES Import" },
1388 { BGP_EXT_COM_STYPE_EVPN_ROUTERMAC, "EVPN Router MAC" },
1389 { BGP_EXT_COM_STYPE_EVPN_L2ATTR, "Layer 2 Attributes" },
1390 { BGP_EXT_COM_STYPE_EVPN_ETREE, "E-Tree" },
1391 { BGP_EXT_COM_STYPE_EVPN_DF, "DF Election" },
1392 { BGP_EXT_COM_STYPE_EVPN_ISID, "I-SID" },
1393 { BGP_EXT_COM_STYPE_EVPN_ND, "ND" },
1394 { BGP_EXT_COM_STYPE_EVPN_MCFLAGS, "Multicast Flags Extended Community" },
1395 { BGP_EXT_COM_STYPE_EVPN_EVIRT0, "EVI-RT Type 0 Extended Community" },
1396 { BGP_EXT_COM_STYPE_EVPN_EVIRT1, "EVI-RT Type 1 Extended Community" },
1397 { BGP_EXT_COM_STYPE_EVPN_EVIRT2, "EVI-RT Type 2 Extended Community" },
1398 { BGP_EXT_COM_STYPE_EVPN_EVIRT3, "EVI-RT Type 3 Extended Community" },
1399 { BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT, "EVPN Attachment Circuit" },
1400 { 0, NULL}
1401 };
1402
1403 static const value_string bgpext_com_stype_tr_as2[] = {
1404 { BGP_EXT_COM_STYPE_AS2_RT, "Route Target" },
1405 { BGP_EXT_COM_STYPE_AS2_RO, "Route Origin" },
1406 { BGP_EXT_COM_STYPE_AS2_OSPF_DID, "OSPF Domain Identifier" },
1407 { BGP_EXT_COM_STYPE_AS2_DCOLL, "BGP Data Collection" },
1408 { BGP_EXT_COM_STYPE_AS2_SRC_AS, "Source AS" },
1409 { BGP_EXT_COM_STYPE_AS2_L2VPN, "L2VPN Identifier" },
1410 { BGP_EXT_COM_STYPE_AS2_CVPND, "Cisco VPN-Distinguisher" },
1411 { 0, NULL}
1412 };
1413
1414 static const value_string bgpext_com_stype_ntr_as2[] = {
1415 { BGP_EXT_COM_STYPE_AS2_LBW, "Link Bandwidth" },
1416 { BGP_EXT_COM_STYPE_AS2_VNI, "Virtual-Network Identifier" },
1417 { 0, NULL}
1418 };
1419
1420 static const value_string bgpext_com_stype_tr_as4[] = {
1421 { BGP_EXT_COM_STYPE_AS4_RT, "Route Target" },
1422 { BGP_EXT_COM_STYPE_AS4_RO, "Route Origin" },
1423 { BGP_EXT_COM_STYPE_AS4_GEN, "Generic" },
1424 { BGP_EXT_COM_STYPE_AS4_BGP_DC, "BGP Data Collection"},
1425 { BGP_EXT_COM_STYPE_AS4_OSPF_DID, "OSPF Domain Identifier" },
1426 { BGP_EXT_COM_STYPE_AS4_S_AS, "Source AS" },
1427 { BGP_EXT_COM_STYPE_AS4_CIS_V, "Cisco VPN Identifier" },
1428 { BGP_EXT_COM_STYPE_AS4_RT_REC, "Route-Target Record"},
1429 { 0, NULL}
1430 };
1431
1432 static const value_string bgpext_com_stype_ntr_as4[] = {
1433 { BGP_EXT_COM_STYPE_AS4_GEN, "Generic" },
1434 { 0, NULL}
1435 };
1436
1437 static const value_string bgpext_com_stype_tr_IP4[] = {
1438 { BGP_EXT_COM_STYPE_IP4_RT, "Route Target" },
1439 { BGP_EXT_COM_STYPE_IP4_RO, "Route Origin" },
1440 { BGP_EXT_COM_STYPE_IP4_OSPF_DID, "OSPF Domain Identifier" },
1441 { BGP_EXT_COM_STYPE_IP4_OSPF_RID, "OSPF Router ID" },
1442 { BGP_EXT_COM_STYPE_IP4_L2VPN, "L2VPN Identifier" },
1443 { BGP_EXT_COM_STYPE_IP4_VRF_I, "VRF Route Import" },
1444 { BGP_EXT_COM_STYPE_IP4_CIS_D, "Cisco VPN-Distinguisher" },
1445 { BGP_EXT_COM_STYPE_IP4_SEG_NH, "Inter-area P2MP Segmented Next-Hop" },
1446 { 0, NULL}
1447 };
1448
1449 static const value_string bgpext_com_stype_ntr_IP4[] = {
1450 { 0, NULL}
1451 };
1452
1453 static const value_string bgpext_com_stype_tr_opaque[] = {
1454 { BGP_EXT_COM_STYPE_OPA_COST, "Cost" },
1455 { BGP_EXT_COM_STYPE_OPA_OSPF_RT, "OSPF Route Type" },
1456 { BGP_EXT_COM_STYPE_OPA_COLOR, "Color" },
1457 { BGP_EXT_COM_STYPE_OPA_ENCAP, "Encapsulation" },
1458 { BGP_EXT_COM_STYPE_OPA_DGTW, "Default Gateway" },
1459 { 0, NULL}
1460 };
1461
1462 static const value_string bgpext_com_cost_poi_type[] = {
1463 { BGP_EXT_COM_COST_POI_ORIGIN, "\"Lowest Origin code\" step" },
1464 { BGP_EXT_COM_COST_POI_ASPATH, "\"Shortest AS_PATH\" step" },
1465 { BGP_EXT_COM_COST_POI_MED, "\"Lowest MED\" step" },
1466 { BGP_EXT_COM_COST_POI_LP, "\"Highest Local Preference\" step" },
1467 { BGP_EXT_COM_COST_POI_AIGP, "\"Lowest Accumulated IGP Cost\" step" },
1468 { BGP_EXT_COM_COST_POI_ABS, "Before BGP Best Path algorithm" },
1469 { BGP_EXT_COM_COST_POI_IGP, "\"Smallest IGP Metric\" step" },
1470 { BGP_EXT_COM_COST_POI_EI, "\"Prefer eBGP to iBGP\" step" },
1471 { BGP_EXT_COM_COST_POI_RID, "\"Smallest BGP RID\" step" },
1472 { 0,NULL}
1473 };
1474
1475 static const value_string bgpext_com_tunnel_type[] = {
1476 { BGP_EXT_COM_TUNNEL_RESERVED, "Reserved" },
1477 { BGP_EXT_COM_TUNNEL_L2TPV3, "L2TPv3 over IP" },
1478 { BGP_EXT_COM_TUNNEL_GRE, "GRE" },
1479 { BGP_EXT_COM_TUNNEL_ENDP, "Transmit tunnel endpoint" },
1480 { BGP_EXT_COM_TUNNEL_IPSEC, "IPsec in Tunnel-mode" },
1481 { BGP_EXT_COM_TUNNEL_IPIPSEC, "IP in IP tunnel with IPsec Transport Mode" },
1482 { BGP_EXT_COM_TUNNEL_MPLSIP, "MPLS-in-IP tunnel with IPsec Transport Mode" },
1483 { BGP_EXT_COM_TUNNEL_IPIP, "IP in IP" },
1484 { BGP_EXT_COM_TUNNEL_VXLAN, "VXLAN Encapsulation" },
1485 { BGP_EXT_COM_TUNNEL_NVGRE, "NVGRE Encapsulation" },
1486 { BGP_EXT_COM_TUNNEL_MPLS, "MPLS Encapsulation" },
1487 { BGP_EXT_COM_TUNNEL_MPLSGRE, "MPLS in GRE Encapsulation" },
1488 { BGP_EXT_COM_TUNNEL_VXLANGPE, "VxLAN GPE Encapsulation" },
1489 { BGP_EXT_COM_TUNNEL_MPLSUDP, "MPLS in UDP Encapsulation" },
1490 { 0, NULL}
1491 };
1492
1493 static const value_string bgpext_com_stype_ntr_opaque[] = {
1494 { BGP_EXT_COM_STYPE_OPA_COST, "Cost" },
1495 { BGP_EXT_COM_STYPE_OPA_OR_VAL_ST, "BGP Origin Validation state" },
1496 { 0, NULL}
1497 };
1498
1499 static const value_string bgpext_com_stype_tr_exp[] = {
1500 { BGP_EXT_COM_STYPE_EXP_OSPF_RT, "OSPF Route Type" },
1501 { BGP_EXT_COM_STYPE_EXP_OSPF_RID, "OSPF Router ID" },
1502 { BGP_EXT_COM_STYPE_EXP_SEC_GROUP, "Security Group" },
1503 { BGP_EXT_COM_STYPE_EXP_OSPF_DID, "OSPF Domain Identifier" },
1504 { BGP_EXT_COM_STYPE_EXP_F_TR, "Flow spec traffic-rate" },
1505 { BGP_EXT_COM_STYPE_EXP_F_TA, "Flow spec traffic-action" },
1506 { BGP_EXT_COM_STYPE_EXP_F_RED, "Flow spec redirect AS 2 bytes" },
1507 { BGP_EXT_COM_STYPE_EXP_F_RMARK, "Flow spec traffic-remarking" },
1508 { BGP_EXT_COM_STYPE_EXP_L2, "Layer2 Info" },
1509 { BGP_EXT_COM_STYPE_EXP_ETREE, "E-Tree Info" },
1510 { BGP_EXT_COM_STYPE_EXP_TAG, "Tag" },
1511 { BGP_EXT_COM_STYPE_EXP_SUB_CLUS, "Origin Sub-Cluster" },
1512 { 0, NULL}
1513 };
1514
1515 static const value_string bgpext_com_stype_tr_eigrp[] = {
1516 { BGP_EXT_COM_STYPE_EXP_EIGRP_FT, "EIGRP Route Flags, Route Tag" },
1517 { BGP_EXT_COM_STYPE_EXP_EIGRP_AD, "EIGRP AS Number, Delay" },
1518 { BGP_EXT_COM_STYPE_EXP_EIGRP_RHB, "EIGRP Reliability, Hop Count, Bandwidth" },
1519 { BGP_EXT_COM_STYPE_EXP_EIGRP_LM, "EIGRP Load, MTU" },
1520 { BGP_EXT_COM_STYPE_EXP_EIGRP_EAR, "EIGRP External AS Number, Router ID" },
1521 { BGP_EXT_COM_STYPE_EXP_EIGRP_EPM, "EIGRP External Protocol, Metric" },
1522 { BGP_EXT_COM_STYPE_EXP_EIGRP_RID, "EIGRP Originating Router ID" },
1523 { 0, NULL}
1524 };
1525
1526 static const value_string flow_spec_op_len_val[] = {
1527 { 0, "1 byte: 1 <<" },
1528 { 1, "2 bytes: 1 <<" },
1529 { 2, "4 bytes: 1 <<" },
1530 { 3, "8 bytes: 1 <<" },
1531 { 0, NULL }
1532 };
1533
1534 static const value_string qos_tech_type[] = {
1535 { QOS_TECH_TYPE_DSCP, "DiffServ enabled IP (DSCP encoding)" },
1536 { QOS_TECH_TYPE_802_1q, "Ethernet using 802.1q priority tag" },
1537 { QOS_TECH_TYPE_E_LSP, "MPLS using E-LSP" },
1538 { QOS_TECH_TYPE_VC, "Virtual Channel (VC) encoding" },
1539 { QOS_TECH_TYPE_GMPLS_TIME, "GMPLS - time slot encoding" },
1540 { QOS_TECH_TYPE_GMPLS_LAMBDA, "GMPLS - lambda encoding" },
1541 { QOS_TECH_TYPE_GMPLS_FIBRE, "GMPLS - fibre encoding" },
1542 { 0, NULL }
1543 };
1544
1545 static const value_string bgp_ssa_type[] = {
1546 { BGP_SSA_L2TPv3 , "L2TPv3 Tunnel" },
1547 { BGP_SSA_mGRE , "mGRE Tunnel" },
1548 { BGP_SSA_IPSec , "IPSec Tunnel" },
1549 { BGP_SSA_MPLS , "MPLS Tunnel" },
1550 { BGP_SSA_L2TPv3_IN_IPSec , "L2TPv3 in IPSec Tunnel" },
1551 { BGP_SSA_mGRE_IN_IPSec , "mGRE in IPSec Tunnel" },
1552 { 0, NULL }
1553 };
1554
1555 /*
1556 * BGP Layer 2 Encapsulation Types
1557 *
1558 * RFC 6624
1559 *
1560 * http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-l2-encapsulation-types-registry
1561 */
1562 static const value_string bgp_l2vpn_encaps[] = {
1563 { 0, "Reserved"},
1564 { 1, "Frame Relay"},
1565 { 2, "ATM AAL5 SDU VCC transport"},
1566 { 3, "ATM transparent cell transport"},
1567 { 4, "Ethernet (VLAN) Tagged mode"},
1568 { 5, "Ethernet raw mode"},
1569 { 6, "Cisco-HDLC"},
1570 { 7, "PPP"},
1571 { 8, "SONET/SDH CES"},
1572 { 9, "ATM n-to-one VCC cell transport"},
1573 { 10, "ATM n-to-one VPC cell transport"},
1574 { 11, "IP layer 2 transport"},
1575 { 15, "Frame relay port mode"},
1576 { 17, "Structure agnostic E1 over packet"},
1577 { 18, "Structure agnostic T1 over packet"},
1578 { 19, "VPLS"},
1579 { 20, "Structure agnostic T3 over packet"},
1580 { 21, "Nx64kbit/s Basic Service using Structure-aware"},
1581 { 25, "Frame Relay DLCI"},
1582 { 40, "Structure agnostic E3 over packet"},
1583 { 41, "Octet-aligned playload for structure-agnostic DS1 circuits"},
1584 { 42, "E1 Nx64kbit/s with CAS using Structure-aware"},
1585 { 43, "DS1 (ESF) Nx64kbit/s with CAS using Structure-aware"},
1586 { 44, "DS1 (SF) Nx64kbit/s with CAS using Structure-aware"},
1587 { 64, "IP-interworking"},
1588 { 0, NULL }
1589 };
1590
1591 static const value_string bgpext_com_ospf_rtype[] = {
1592 { BGP_OSPF_RTYPE_RTR, "Router" },
1593 { BGP_OSPF_RTYPE_NET, "Network" },
1594 { BGP_OSPF_RTYPE_SUM, "Summary" },
1595 { BGP_OSPF_RTYPE_EXT, "External" },
1596 { BGP_OSPF_RTYPE_NSSA,"NSSA External" },
1597 { BGP_OSPF_RTYPE_SHAM,"MPLS-VPN Sham" },
1598 { 0, NULL }
1599 };
1600
1601 /* Subsequent address family identifier, RFC4760 */
1602 static const value_string bgpattr_nlri_safi[] = {
1603 { 0, "Reserved" },
1604 { SAFNUM_UNICAST, "Unicast" },
1605 { SAFNUM_MULCAST, "Multicast" },
1606 { SAFNUM_UNIMULC, "Unicast+Multicast (Deprecated)" },
1607 { SAFNUM_MPLS_LABEL, "Labeled Unicast" },
1608 { SAFNUM_MCAST_VPN, "MCAST-VPN" },
1609 { SAFNUM_MULTISEG_PW, "Multi-Segment Pseudowires" },
1610 { SAFNUM_ENCAPSULATION, "Encapsulation (Deprecated)" },
1611 { SAFNUM_MCAST_VPLS, "MCAST-VPLS" },
1612 { SAFNUM_TUNNEL, "Tunnel (Deprecated)" },
1613 { SAFNUM_VPLS, "VPLS" },
1614 { SAFNUM_MDT, "Cisco MDT" },
1615 { SAFNUM_4OVER6, "4over6" },
1616 { SAFNUM_6OVER4, "6over4" },
1617 { SAFNUM_L1VPN, "Layer-1 VPN" },
1618 { SAFNUM_EVPN, "EVPN" },
1619 { SAFNUM_BGP_LS, "BGP-LS" },
1620 { SAFNUM_BGP_LS_VPN, "BGP-LS-VPN" },
1621 { SAFNUM_SR_POLICY, "SR Policy" },
1622 { SAFNUM_SD_WAN, "SD-WAN" },
1623 { SAFNUM_RPD, "Routing Policy Distribution" },
1624 { SAFNUM_CT, "Classful Transport Planes" },
1625 { SAFNUM_FLOWSPEC, "Tunneled Traffic Flowspec" },
1626 { SAFNUM_MCAST_TREE, "MCAST-TREE" },
1627 { SAFNUM_LAB_VPNUNICAST, "Labeled VPN Unicast" },
1628 { SAFNUM_LAB_VPNMULCAST, "Labeled VPN Multicast" },
1629 { SAFNUM_LAB_VPNUNIMULC, "Labeled VPN Unicast+Multicast (Deprecated)" },
1630 { SAFNUM_ROUTE_TARGET, "Route Target Filter" },
1631 { SAFNUM_FSPEC_RULE, "Flow Spec Filter" },
1632 { SAFNUM_FSPEC_VPN_RULE, "Flow Spec Filter VPN" },
1633 { SAFNUM_L3VPN, "Layer-3 VPN (Deprecated)" },
1634 { 0, NULL }
1635 };
1636
1637 /* ORF Type, RFC5291 */
1638 static const value_string orf_type_vals[] = {
1639 { 2, "Communities ORF-Type" },
1640 { 3, "Extended Communities ORF-Type" },
1641 { 128, "Cisco PrefixList ORF-Type" },
1642 { 129, "Cisco CommunityList ORF-Type" },
1643 { 130, "Cisco Extended CommunityList ORF-Type" },
1644 { 131, "Cisco AsPathList ORF-Type" },
1645 { 0, NULL }
1646 };
1647
1648 /* ORF Send/Receive, RFC5291 */
1649 static const value_string orf_send_recv_vals[] = {
1650 { 1, "Receive" },
1651 { 2, "Send" },
1652 { 3, "Both" },
1653 { 0, NULL }
1654 };
1655
1656 /* ORF Send/Receive, RFC5291 */
1657 static const value_string orf_when_vals[] = {
1658 { 1, "Immediate" },
1659 { 2, "Defer" },
1660 { 0, NULL }
1661 };
1662
1663 static const value_string orf_entry_action_vals[] = {
1664 { BGP_ORF_ADD, "Add" },
1665 { BGP_ORF_REMOVE, "Remove" },
1666 { BGP_ORF_REMOVEALL, "RemoveAll" },
1667 { 0, NULL }
1668 };
1669
1670 static const value_string orf_entry_match_vals[] = {
1671 { BGP_ORF_PERMIT, "Permit" },
1672 { BGP_ORF_DENY, "Deny" },
1673 { 0, NULL }
1674 };
1675
1676 /* BGPsec Send/Receive, RFC8205 */
1677 static const value_string bgpsec_send_receive_vals[] = {
1678 { 0, "Receive" },
1679 { 1, "Send" },
1680 { 0, NULL }
1681 };
1682
1683 static const value_string capability_vals[] = {
1684 { BGP_CAPABILITY_RESERVED, "Reserved capability" },
1685 { BGP_CAPABILITY_MULTIPROTOCOL, "Multiprotocol extensions capability" },
1686 { BGP_CAPABILITY_ROUTE_REFRESH, "Route refresh capability" },
1687 { BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING, "Cooperative route filtering capability" },
1688 { BGP_CAPABILITY_MULTIPLE_ROUTE_DEST, "Multiple routes to a destination capability" },
1689 { BGP_CAPABILITY_EXTENDED_NEXT_HOP, "Extended Next Hop Encoding" },
1690 { BGP_CAPABILITY_EXTENDED_MESSAGE, "BGP-Extended Message" },
1691 { BGP_CAPABILITY_BGPSEC, "BGPsec capability" },
1692 { BGP_CAPABILITY_MULTIPLE_LABELS, "Multiple Labels capability" },
1693 { BGP_CAPABILITY_BGP_ROLE, "BGP Role" },
1694 { BGP_CAPABILITY_GRACEFUL_RESTART, "Graceful Restart capability" },
1695 { BGP_CAPABILITY_4_OCTET_AS_NUMBER, "Support for 4-octet AS number capability" },
1696 { BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO, "Deprecated Dynamic Capability (Cisco)" },
1697 { BGP_CAPABILITY_DYNAMIC_CAPABILITY, "Support for Dynamic capability" },
1698 { BGP_CAPABILITY_MULTISESSION, "Multisession BGP Capability" },
1699 { BGP_CAPABILITY_ADDITIONAL_PATHS, "Support for Additional Paths" },
1700 { BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH, "Enhanced route refresh capability" },
1701 { BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART, "Long-Lived Graceful Restart (LLGR) Capability" },
1702 { BGP_CAPABILITY_CP_ORF, "CP-ORF Capability" },
1703 { BGP_CAPABILITY_FQDN, "FQDN Capability" },
1704 { BGP_CAPABILITY_ROUTE_REFRESH_CISCO, "Route refresh capability (Cisco)" },
1705 { BGP_CAPABILITY_ORF_CISCO, "Cooperative route filtering capability (Cisco)" },
1706 { BGP_CAPABILITY_MULTISESSION_CISCO, "Multisession BGP Capability (Cisco)" },
1707 { 0, NULL }
1708 };
1709
1710 static const value_string community_vals[] = {
1711 { BGP_COMM_GRACEFUL_SHUTDOWN, "GRACEFUL_SHUTDOWN" },
1712 { BGP_COMM_ACCEPT_OWN, "ACCEPT_OWN" },
1713 { BGP_COMM_BLACKHOLE, "BLACKHOLE" },
1714 { BGP_COMM_NO_EXPORT, "NO_EXPORT" },
1715 { BGP_COMM_NO_ADVERTISE, "NO_ADVERTISE" },
1716 { BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
1717 { BGP_COMM_NOPEER, "NOPEER" },
1718 { 0, NULL }
1719 };
1720
1721 /* Capability Message action code */
1722 static const value_string bgpcap_action[] = {
1723 { 0, "advertising a capability" },
1724 { 1, "removing a capability" },
1725 { 0, NULL }
1726 };
1727
1728 static const value_string mcast_vpn_route_type[] = {
1729 { MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD, "Intra-AS I-PMSI A-D route" },
1730 { MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD, "Inter-AS I-PMSI A-D route" },
1731 { MCAST_VPN_RTYPE_SPMSI_AD , "S-PMSI A-D route" },
1732 { MCAST_VPN_RTYPE_LEAF_AD , "Leaf A-D route" },
1733 { MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD , "Source Active A-D route" },
1734 { MCAST_VPN_RTYPE_SHARED_TREE_JOIN , "Shared Tree Join route" },
1735 { MCAST_VPN_RTYPE_SOURCE_TREE_JOIN , "Source Tree Join route" },
1736 { 0, NULL }
1737 };
1738
1739 /* NLRI type value_string as defined in idr-ls */
1740 static const value_string bgp_ls_nlri_type_vals[] = {
1741 { LINK_STATE_LINK_NLRI, "Link NLRI" },
1742 { LINK_STATE_NODE_NLRI, "Node NLRI" },
1743 { LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI, "IPv4 Topology Prefix NLRI" },
1744 { LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI, "IPv6 Topology Prefix NLRI" },
1745 {0, NULL },
1746 };
1747
1748 /* Link-State NLRI Protocol-ID value strings */
1749 static const value_string link_state_nlri_protocol_id_values[] = {
1750 {BGP_LS_NLRI_PROTO_ID_UNKNOWN, "Unknown" },
1751 {BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1, "IS-IS Level 1"},
1752 {BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2, "IS-IS Level 2"},
1753 {BGP_LS_NLRI_PROTO_ID_OSPF, "OSPF"},
1754 {BGP_LS_NLRI_PROTO_ID_DIRECT, "Direct"},
1755 {BGP_LS_NLRI_PROTO_ID_STATIC, "Static"},
1756 {BGP_LS_NLRI_PROTO_ID_BGP, "BGP"},
1757 {0, NULL},
1758 };
1759
1760 /* Link-State routing universes */
1761 static const val64_string link_state_nlri_routing_universe_values[] = {
1762 {BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3, "L3 packet topology" },
1763 {BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1, "L1 optical topology"},
1764 {0, NULL}
1765 };
1766
1767 /* Link state prefix NLRI OSPF Route Type */
1768 static const value_string link_state_prefix_descriptors_ospf_route_type[] = {
1769 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN, "Unknown" },
1770 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA, "Intra-Area"},
1771 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA, "Inter Area"},
1772 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1, "External 1"},
1773 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2, "External 2"},
1774 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1, "NSSA 1"},
1775 {BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2, "NSSA 2"},
1776 {0, NULL}
1777 };
1778
1779 /* Link state Flex Algo Metric Type: draft-ietf-lsr-flex-algo-17 */
1780 static const value_string flex_algo_metric_types[] = {
1781 { 0, "IGP Metric"},
1782 { 1, "Min Unidirectional Link Delay"},
1783 { 2, "TE Metric"},
1784 { 0, NULL }
1785 };
1786
1787 /* Link state IGP Algorithm Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
1788 static const value_string igp_algo_types[] = {
1789 { 0, "Shortest Path First (SPF)" },
1790 { 1, "Strict Shortest Path First (Strict SPF)" },
1791 { 0, NULL }
1792 };
1793
1794 /* Link state IGP MSD Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
1795 static const value_string igp_msd_types[] = {
1796 { 0, "Reserved" },
1797 { 1, "Base MPLS Imposition MSD" },
1798 { 2, "ERLD-MSD" },
1799 { 41, "SRH Max SL" },
1800 { 42, "SRH Max End Pop" },
1801 { 44, "SRH Max H.Encaps" },
1802 { 45, "SRH Max End D" },
1803 { 0, NULL }
1804 };
1805
1806 /* NLRI type value_string as define in BGP flow spec RFC */
1807
1808 static const value_string flowspec_nlri_opvaluepair_type[] = {
1809 { BGPNLRI_FSPEC_DST_PFIX, "Destination prefix filter" },
1810 { BGPNLRI_FSPEC_SRC_PFIX, "Source prefix filter" },
1811 { BGPNLRI_FSPEC_IP_PROTO, "Protocol / Next Header filter" },
1812 { BGPNLRI_FSPEC_PORT, "Port filter" },
1813 { BGPNLRI_FSPEC_DST_PORT, "Destination port filter" },
1814 { BGPNLRI_FSPEC_SRC_PORT, "Source port filter" },
1815 { BGPNLRI_FSPEC_ICMP_TP, "ICMP type filter" },
1816 { BGPNLRI_FSPEC_ICMP_CD, "ICMP code filter" },
1817 { BGPNLRI_FSPEC_TCP_FLAGS,"TCP flags filter" },
1818 { BGPNLRI_FSPEC_PCK_LEN, "Packet Length filter" },
1819 { BGPNLRI_FSPEC_DSCP, "DSCP marking filter" },
1820 { BGPNLRI_FSPEC_FRAGMENT, "IP fragment filter" },
1821 {0, NULL },
1822 };
1823
1824 /* Subtype Route Refresh, draft-ietf-idr-bgp-enhanced-route-refresh-02 */
1825 static const value_string route_refresh_subtype_vals[] = {
1826 { 0, "Normal route refresh request [RFC2918] with/without ORF [RFC5291]" },
1827 { 1, "Demarcation of the beginning of a route refresh" },
1828 { 2, "Demarcation of the ending of a route refresh" },
1829 { 0, NULL }
1830 };
1831
1832 static const value_string bgp_prefix_sid_type[] = {
1833 { BGP_PREFIX_SID_TLV_LABEL_INDEX, "Label-Index" },
1834 { BGP_PREFIX_SID_TLV_2, "Deprecated" },
1835 { BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB, "Originator SRGB" },
1836 { BGP_PREFIX_SID_TLV_4, "Deprecated" },
1837 { BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE, "SRv6 L3 Service" },
1838 { BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE, "SRv6 L2 Service" },
1839 { 0, NULL }
1840 };
1841
1842 static const value_string srv6_service_sub_tlv_type[] = {
1843 { SRV6_SERVICE_SRV6_SID_INFORMATION, "SRv6 SID Information" },
1844 { 0, NULL }
1845 };
1846
1847 static const value_string srv6_service_data_sub_sub_tlv_type[] = {
1848 { SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE, "SRv6 SID Structure" },
1849 { 0, NULL }
1850 };
1851
1852 /* SRv6 Endpoint behavior value_string [draft-ietf-spring-srv6-network-programming-24]. */
1853 static const value_string srv6_endpoint_behavior[] = {
1854 { SRV6_ENDPOINT_BEHAVIOR_END, "End" },
1855 { SRV6_ENDPOINT_BEHAVIOR_END_PSP, "End with PSP" },
1856 { SRV6_ENDPOINT_BEHAVIOR_END_USP, "End with USP" },
1857 { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP, "End with PSP & USP" },
1858 { SRV6_ENDPOINT_BEHAVIOR_END_X, "End.X" },
1859 { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP, "End.X with PSP" },
1860 { SRV6_ENDPOINT_BEHAVIOR_END_X_USP, "End.X with USP" },
1861 { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP, "End.X with PSP & USP" },
1862 { SRV6_ENDPOINT_BEHAVIOR_END_T, "End.T" },
1863 { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP, "End.T with PSP" },
1864 { SRV6_ENDPOINT_BEHAVIOR_END_T_USP, "End.T with USP" },
1865 { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP, "End.T with PSP & USP" },
1866 { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS, "End.B6.Encaps" },
1867 { SRV6_ENDPOINT_BEHAVIOR_END_BM, "End.BM" },
1868 { SRV6_ENDPOINT_BEHAVIOR_END_DX6, "End.DX6" },
1869 { SRV6_ENDPOINT_BEHAVIOR_END_DX4, "End.DX4" },
1870 { SRV6_ENDPOINT_BEHAVIOR_END_DT6, "End.DT6" },
1871 { SRV6_ENDPOINT_BEHAVIOR_END_DT4, "End.DT4" },
1872 { SRV6_ENDPOINT_BEHAVIOR_END_DT46, "End.DT46" },
1873 { SRV6_ENDPOINT_BEHAVIOR_END_DX2, "End.DX2" },
1874 { SRV6_ENDPOINT_BEHAVIOR_END_DX2V, "End.DX2V" },
1875 { SRV6_ENDPOINT_BEHAVIOR_END_DT2U, "End.DT2U" },
1876 { SRV6_ENDPOINT_BEHAVIOR_END_DT2M, "End.DT2M" },
1877 { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED, "End.B6.Encaps.Red" },
1878 { SRV6_ENDPOINT_BEHAVIOR_END_USD, "End with USD" },
1879 { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD, "End with PSP & USD" },
1880 { SRV6_ENDPOINT_BEHAVIOR_END_USP_USD, "End with USP & USD" },
1881 { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD, "End with PSP, USP & USD" },
1882 { SRV6_ENDPOINT_BEHAVIOR_END_X_USD, "End.X with USD" },
1883 { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD, "End.X with PSP & USD" },
1884 { SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD, "End.X with USP & USD" },
1885 { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD, "End.X with PSP, USP & USD" },
1886 { SRV6_ENDPOINT_BEHAVIOR_END_T_USD, "End.T with USD" },
1887 { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD, "End.T with PSP & USD" },
1888 { SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD, "End.T with USP & USD" },
1889 { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD, "End.T with PSP, USP & USD" },
1890 { SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID, "End with NEXT-ONLY-CSID" },
1891 { SRV6_ENDPOINT_BEHAVIOR_END_CSID, "End with NEXT-CSID" },
1892 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP, "End with NEXT-CSID & PSP" },
1893 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP, "End with NEXT-CSID & USP" },
1894 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP, "End with NEXT-CSID, PSP & USP" },
1895 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD, "End with NEXT-CSID & USD" },
1896 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD, "End with NEXT-CSID, PSP & USD" },
1897 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD, "End with NEXT-CSID, USP & USD" },
1898 { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD, "End with NEXT-CSID, PSP, USP & USD" },
1899 { SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID, "End.X with NEXT-ONLY-CSID" },
1900 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID, "End.X with NEXT-CSID" },
1901 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP, "End.X with NEXT-CSID & PSP" },
1902 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP, "End.X with NEXT-CSID & USP" },
1903 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP, "End.X with NEXT-CSID, PSP & USP" },
1904 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD, "End.X with NEXT-CSID & USD" },
1905 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD, "End.X with NEXT-CSID, PSP & USD" },
1906 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD, "End.X with NEXT-CSID, USP & USD" },
1907 { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP_USD, "End.X with NEXT-CSID, PSP, USP & USD" },
1908 { SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID, "End.DX6 with NEXT-CSID" },
1909 { SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID, "End.DX4 with NEXT-CSID" },
1910 { SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID, "End.DT6 with NEXT-CSID" },
1911 { SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID, "End.DT4 with NEXT-CSID" },
1912 { SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID, "End.DT46 with NEXT-CSID" },
1913 { SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID, "End.DX2 with NEXT-CSID" },
1914 { SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID, "End.DX2V with NEXT-CSID" },
1915 { SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID, "End.DT2U with NEXT-CSID" },
1916 { SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID, "End.DT2M with NEXT-CSID" },
1917 { SRV6_ENDPOINT_BEHAVIOR_OPAQUE, "Opaque" },
1918 { 0, NULL }
1919 };
1920
1921 static const true_false_string tfs_non_transitive_transitive = { "Non-transitive", "Transitive" };
1922 static const true_false_string tfs_esi_label_flag = { "Single-Active redundancy", "All-Active redundancy" };
1923 static const true_false_string tfs_ospf_rt_mt = { "Type-2", "Type-1" };
1924 static const true_false_string tfs_eigrp_rtype = { "Internal" , "External" };
1925 static const true_false_string tfs_cost_replace = { "Replaces the original attribute value", "Evaluated after the original attribute value" };
1926 static const true_false_string tfs_exclude_include = { "Exclude", "Include" };
1927
1928 /* Maximal size of an IP address string */
1929 #define MAX_SIZE_OF_IP_ADDR_STRING 16
1930
1931 static int proto_bgp = -1;
1932
1933 /* BGP header field initialisation */
1934
1935 /* global BGP header filed */
1936
1937 static int hf_bgp_marker = -1;
1938 static int hf_bgp_length = -1;
1939 static int hf_bgp_prefix_length = -1;
1940 static int hf_bgp_rd = -1;
1941 static int hf_bgp_continuation = -1;
1942 static int hf_bgp_originating_as = -1;
1943 static int hf_bgp_community_prefix = -1;
1944 static int hf_bgp_endpoint_address = -1;
1945 static int hf_bgp_endpoint_address_ipv6 = -1;
1946 static int hf_bgp_label_stack = -1;
1947 static int hf_bgp_large_communities = -1;
1948 static int hf_bgp_large_communities_ga = -1;
1949 static int hf_bgp_large_communities_ldp1 = -1;
1950 static int hf_bgp_large_communities_ldp2 = -1;
1951 static int hf_bgp_vplsad_length = -1;
1952 static int hf_bgp_vplsad_rd = -1;
1953 static int hf_bgp_bgpad_pe_addr = -1;
1954 static int hf_bgp_vplsbgp_ce_id = -1;
1955 static int hf_bgp_vplsbgp_labelblock_offset = -1;
1956 static int hf_bgp_vplsbgp_labelblock_size = -1;
1957 static int hf_bgp_vplsbgp_labelblock_base = -1;
1958 static int hf_bgp_wildcard_route_target = -1;
1959 static int hf_bgp_type = -1;
1960
1961 /* BGP open message header filed */
1962
1963 static int hf_bgp_open_version = -1;
1964 static int hf_bgp_open_myas = -1;
1965 static int hf_bgp_open_holdtime = -1;
1966 static int hf_bgp_open_identifier = -1;
1967 static int hf_bgp_open_opt_len = -1;
1968 static int hf_bgp_open_opt_params = -1;
1969 static int hf_bgp_open_opt_param = -1;
1970 static int hf_bgp_open_opt_param_type = -1;
1971 static int hf_bgp_open_opt_param_len = -1;
1972 static int hf_bgp_open_opt_param_auth = -1;
1973 static int hf_bgp_open_opt_param_unknown = -1;
1974
1975 /* BGP notify header field */
1976
1977 static int hf_bgp_notify_major_error = -1;
1978 static int hf_bgp_notify_minor_msg_hdr = -1;
1979 static int hf_bgp_notify_minor_open_msg = -1;
1980 static int hf_bgp_notify_minor_update_msg = -1;
1981 static int hf_bgp_notify_minor_ht_expired = -1;
1982 static int hf_bgp_notify_minor_state_machine = -1;
1983 static int hf_bgp_notify_minor_cease = -1;
1984 static int hf_bgp_notify_minor_cap_msg = -1;
1985 static int hf_bgp_notify_minor_unknown = -1;
1986 static int hf_bgp_notify_data = -1;
1987 static int hf_bgp_notify_error_open_bad_peer_as = -1;
1988 static int hf_bgp_notify_communication_length = -1;
1989 static int hf_bgp_notify_communication = -1;
1990
1991 /* BGP route refresh header field */
1992
1993 static int hf_bgp_route_refresh_afi = -1;
1994 static int hf_bgp_route_refresh_subtype = -1;
1995 static int hf_bgp_route_refresh_safi = -1;
1996 static int hf_bgp_route_refresh_orf = -1;
1997 static int hf_bgp_route_refresh_orf_flag = -1;
1998 static int hf_bgp_route_refresh_orf_type = -1;
1999 static int hf_bgp_route_refresh_orf_length = -1;
2000 static int hf_bgp_route_refresh_orf_entry_prefixlist = -1;
2001 static int hf_bgp_route_refresh_orf_entry_action = -1;
2002 static int hf_bgp_route_refresh_orf_entry_match = -1;
2003 static int hf_bgp_route_refresh_orf_entry_sequence = -1;
2004 static int hf_bgp_route_refresh_orf_entry_prefixmask_lower = -1;
2005 static int hf_bgp_route_refresh_orf_entry_prefixmask_upper = -1;
2006 static int hf_bgp_route_refresh_orf_entry_ip = -1;
2007
2008 /* BGP capabilities header field */
2009
2010 static int hf_bgp_cap = -1;
2011 static int hf_bgp_cap_type = -1;
2012 static int hf_bgp_cap_length = -1;
2013 static int hf_bgp_cap_action = -1;
2014 static int hf_bgp_cap_unknown = -1;
2015 static int hf_bgp_cap_reserved = -1;
2016 static int hf_bgp_cap_mp_afi = -1;
2017 static int hf_bgp_cap_mp_safi = -1;
2018 static int hf_bgp_cap_enh_afi = -1;
2019 static int hf_bgp_cap_enh_safi = -1;
2020 static int hf_bgp_cap_enh_nhafi = -1;
2021 static int hf_bgp_cap_gr_timers = -1;
2022 static int hf_bgp_cap_gr_timers_restart_flag = -1;
2023 static int hf_bgp_cap_gr_timers_notification_flag = -1;
2024 static int hf_bgp_cap_gr_timers_restart_time = -1;
2025 static int hf_bgp_cap_gr_afi = -1;
2026 static int hf_bgp_cap_gr_safi = -1;
2027 static int hf_bgp_cap_gr_flag = -1;
2028 static int hf_bgp_cap_gr_flag_pfs = -1;
2029 static int hf_bgp_cap_4as = -1;
2030 static int hf_bgp_cap_dc = -1;
2031 static int hf_bgp_cap_ap_afi = -1;
2032 static int hf_bgp_cap_ap_safi = -1;
2033 static int hf_bgp_cap_ap_sendreceive = -1;
2034 static int hf_bgp_cap_orf_afi = -1;
2035 static int hf_bgp_cap_orf_safi = -1;
2036 static int hf_bgp_cap_orf_number = -1;
2037 static int hf_bgp_cap_orf_type = -1;
2038 static int hf_bgp_cap_orf_sendreceive = -1;
2039 static int hf_bgp_cap_fqdn_hostname_len = -1;
2040 static int hf_bgp_cap_fqdn_hostname = -1;
2041 static int hf_bgp_cap_fqdn_domain_name_len = -1;
2042 static int hf_bgp_cap_fqdn_domain_name = -1;
2043 static int hf_bgp_cap_multisession_flags = -1;
2044 static int hf_bgp_cap_bgpsec_flags = -1;
2045 static int hf_bgp_cap_bgpsec_version = -1;
2046 static int hf_bgp_cap_bgpsec_sendreceive = -1;
2047 static int hf_bgp_cap_bgpsec_reserved = -1;
2048 static int hf_bgp_cap_bgpsec_afi = -1;
2049
2050 /* BGP update global header field */
2051 static int hf_bgp_update_withdrawn_routes_length = -1;
2052 static int hf_bgp_update_withdrawn_routes = -1;
2053
2054
2055 /* BGP update path attribute header field */
2056 static int hf_bgp_update_total_path_attribute_length = -1;
2057 static int hf_bgp_update_path_attributes = -1;
2058 static int hf_bgp_update_path_attributes_unknown = -1;
2059 static int hf_bgp_update_path_attribute_communities = -1;
2060 static int hf_bgp_update_path_attribute_community_well_known = -1;
2061 static int hf_bgp_update_path_attribute_community = -1;
2062 static int hf_bgp_update_path_attribute_community_as = -1;
2063 static int hf_bgp_update_path_attribute_community_value = -1;
2064 static int hf_bgp_update_path_attribute = -1;
2065 static int hf_bgp_update_path_attribute_flags = -1;
2066 static int hf_bgp_update_path_attribute_flags_optional = -1;
2067 static int hf_bgp_update_path_attribute_flags_transitive = -1;
2068 static int hf_bgp_update_path_attribute_flags_partial = -1;
2069 static int hf_bgp_update_path_attribute_flags_extended_length = -1;
2070 static int hf_bgp_update_path_attribute_flags_unused = -1;
2071 static int hf_bgp_update_path_attribute_type_code = -1;
2072 static int hf_bgp_update_path_attribute_length = -1;
2073 static int hf_bgp_update_path_attribute_next_hop = -1;
2074 static int hf_bgp_update_path_attribute_as_path_segment = -1;
2075 static int hf_bgp_update_path_attribute_as_path_segment_type = -1;
2076 static int hf_bgp_update_path_attribute_as_path_segment_length = -1;
2077 static int hf_bgp_update_path_attribute_as_path_segment_as2 = -1;
2078 static int hf_bgp_update_path_attribute_as_path_segment_as4 = -1;
2079 static int hf_bgp_update_path_attribute_origin = -1;
2080 static int hf_bgp_update_path_attribute_cluster_list = -1;
2081 static int hf_bgp_update_path_attribute_cluster_id = -1;
2082 static int hf_bgp_update_path_attribute_originator_id = -1;
2083 static int hf_bgp_update_path_attribute_local_pref = -1;
2084 static int hf_bgp_update_path_attribute_attrset_origin_as = -1;
2085 static int hf_bgp_update_path_attribute_multi_exit_disc = -1;
2086 static int hf_bgp_update_path_attribute_aggregator_as = -1;
2087 static int hf_bgp_update_path_attribute_aggregator_origin = -1;
2088 static int hf_bgp_update_path_attribute_link_state = -1;
2089 static int hf_bgp_update_path_attribute_mp_reach_nlri_address_family = -1;
2090 static int hf_bgp_update_path_attribute_mp_reach_nlri_safi = -1;
2091 static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop = -1;
2092 static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd = -1;
2093 static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4 = -1;
2094 static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6 = -1;
2095 static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local = -1;
2096 static int hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa = -1;
2097 static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length = -1;
2098 static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa = -1;
2099 static int hf_bgp_update_path_attribute_mp_reach_nlri = -1;
2100 static int hf_bgp_update_path_attribute_mp_unreach_nlri_address_family = -1;
2101 static int hf_bgp_update_path_attribute_mp_unreach_nlri_safi = -1;
2102 static int hf_bgp_update_path_attribute_mp_unreach_nlri = -1;
2103 static int hf_bgp_update_path_attribute_aigp = -1;
2104 static int hf_bgp_update_path_attribute_bgpsec_sb_len = -1;
2105 static int hf_bgp_update_path_attribute_bgpsec_algo_id = -1;
2106 static int hf_bgp_update_path_attribute_bgpsec_sps_pcount = -1;
2107 static int hf_bgp_update_path_attribute_bgpsec_sps_flags = -1;
2108 static int hf_bgp_update_path_attribute_bgpsec_sps_as = -1;
2109 static int hf_bgp_update_path_attribute_bgpsec_sp_len = -1;
2110 static int hf_bgp_update_path_attribute_bgpsec_ski = -1;
2111 static int hf_bgp_update_path_attribute_bgpsec_sig_len = -1;
2112 static int hf_bgp_update_path_attribute_bgpsec_sig = -1;
2113 static int hf_bgp_update_path_attribute_d_path = -1;
2114 static int hf_bgp_d_path_ga = -1;
2115 static int hf_bgp_d_path_la = -1;
2116 static int hf_bgp_d_path_length = -1;
2117 static int hf_bgp_d_path_isf_safi = -1;
2118 static int hf_bgp_evpn_nlri = -1;
2119 static int hf_bgp_evpn_nlri_rt = -1;
2120 static int hf_bgp_evpn_nlri_len = -1;
2121 static int hf_bgp_evpn_nlri_rd = -1;
2122 static int hf_bgp_evpn_nlri_esi = -1;
2123 static int hf_bgp_evpn_nlri_esi_type = -1;
2124 static int hf_bgp_evpn_nlri_esi_lacp_mac = -1;
2125 static int hf_bgp_evpn_nlri_esi_portk = -1;
2126 static int hf_bgp_evpn_nlri_esi_remain = -1;
2127 static int hf_bgp_evpn_nlri_esi_value = -1;
2128 static int hf_bgp_evpn_nlri_esi_value_type0 = -1;
2129 static int hf_bgp_evpn_nlri_esi_rb_mac = -1;
2130 static int hf_bgp_evpn_nlri_esi_rbprio = -1;
2131 static int hf_bgp_evpn_nlri_esi_sys_mac = -1;
2132 static int hf_bgp_evpn_nlri_esi_mac_discr = -1;
2133 static int hf_bgp_evpn_nlri_esi_router_id = -1;
2134 static int hf_bgp_evpn_nlri_esi_router_discr = -1;
2135 static int hf_bgp_evpn_nlri_esi_asn = -1;
2136 static int hf_bgp_evpn_nlri_esi_asn_discr = -1;
2137 static int hf_bgp_evpn_nlri_esi_reserved = -1;
2138 static int hf_bgp_evpn_nlri_etag = -1;
2139 static int hf_bgp_evpn_nlri_mpls_ls1 = -1;
2140 static int hf_bgp_evpn_nlri_mpls_ls2 = -1;
2141 static int hf_bgp_evpn_nlri_vni = -1;
2142 static int hf_bgp_evpn_nlri_maclen = -1;
2143 static int hf_bgp_evpn_nlri_mac_addr = -1;
2144 static int hf_bgp_evpn_nlri_iplen = -1;
2145 static int hf_bgp_evpn_nlri_prefix_len = -1;
2146 static int hf_bgp_evpn_nlri_ip_addr = -1;
2147 static int hf_bgp_evpn_nlri_ipv6_addr = -1;
2148 static int hf_bgp_evpn_nlri_ipv4_gtw = -1;
2149 static int hf_bgp_evpn_nlri_ipv6_gtw = -1;
2150 static int hf_bgp_evpn_nlri_igmp_mc_or_length = -1;
2151 static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4 = -1;
2152 static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6 = -1;
2153 static int hf_bgp_evpn_nlri_igmp_mc_flags = -1;
2154 static int hf_bgp_evpn_nlri_igmp_mc_flags_v1 = -1;
2155 static int hf_bgp_evpn_nlri_igmp_mc_flags_v2 = -1;
2156 static int hf_bgp_evpn_nlri_igmp_mc_flags_v3 = -1;
2157 static int hf_bgp_evpn_nlri_igmp_mc_flags_ie = -1;
2158 static int hf_bgp_evpn_nlri_igmp_mc_flags_reserved = -1;
2159
2160 static int * const evpn_nlri_igmp_mc_flags[] = {
2161 &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
2162 &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
2163 &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
2164 &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
2165 &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
2166 NULL
2167 };
2168
2169 /* BGP update tunnel encaps attribute RFC 5512 */
2170
2171 static int hf_bgp_update_encaps_tunnel_tlv_len = -1;
2172 static int hf_bgp_update_encaps_tunnel_tlv_type = -1;
2173 static int hf_bgp_update_encaps_tunnel_subtlv_len = -1;
2174 static int hf_bgp_update_encaps_tunnel_subtlv_type = -1;
2175 static int hf_bgp_update_encaps_tunnel_subtlv_session_id = -1;
2176 static int hf_bgp_update_encaps_tunnel_subtlv_cookie = -1;
2177 static int hf_bgp_update_encaps_tunnel_subtlv_gre_key = -1;
2178 static int hf_bgp_update_encaps_tunnel_subtlv_color_value = -1;
2179 static int hf_bgp_update_encaps_tunnel_subtlv_lb_block_length = -1;
2180 static int hf_bgp_update_encaps_tunnel_subtlv_value = -1;
2181
2182 /* draft-ietf-idr-tunnel-encaps */
2183 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags = -1;
2184 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid = -1;
2185 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac = -1;
2186 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved = -1;
2187 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid = -1;
2188 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac = -1;
2189 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved = -1;
2190 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags = -1;
2191 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version = -1;
2192 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid = -1;
2193 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved = -1;
2194 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid = -1;
2195 static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved = -1;
2196 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags = -1;
2197 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid = -1;
2198 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac = -1;
2199 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved = -1;
2200 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid = -1;
2201 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac = -1;
2202 static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved = -1;
2203
2204 /* draft-ietf-idr-segment-routing-te-policy */
2205 static int hf_bgp_update_encaps_tunnel_subtlv_pref_flags = -1;
2206 static int hf_bgp_update_encaps_tunnel_subtlv_pref_reserved = -1;
2207 static int hf_bgp_update_encaps_tunnel_subtlv_pref_preference = -1;
2208 static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags = -1;
2209 static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified = -1;
2210 static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid = -1;
2211 static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved = -1;
2212 static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved = -1;
2213 static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid= -1;
2214 static int hf_bgp_update_encaps_tunnel_subtlv_enlp_flags = -1;
2215 static int hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved = -1;
2216 static int hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp = -1;
2217 static int hf_bgp_update_encaps_tunnel_subtlv_priority_priority = -1;
2218 static int hf_bgp_update_encaps_tunnel_subtlv_priority_reserved = -1;
2219 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved = -1;
2220 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv = -1;
2221 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type = -1;
2222 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length = -1;
2223 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data = -1;
2224 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags = -1;
2225 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification = -1;
2226 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm = -1;
2227 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved = -1;
2228 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved = -1;
2229 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label = -1;
2230 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class = -1;
2231 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack = -1;
2232 static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl = -1;
2233 static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved = -1;
2234 static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_name = -1;
2235
2236 /* RFC 6514 PMSI Tunnel Attribute */
2237 static int hf_bgp_pmsi_tunnel_flags = -1;
2238 static int hf_bgp_pmsi_tunnel_type = -1;
2239 static int hf_bgp_pmsi_tunnel_id = -1;
2240 static int hf_bgp_pmsi_tunnel_not_present = -1;
2241 static int hf_bgp_pmsi_tunnel_rsvp_p2mp_id = -1; /* RFC4875 section 19 */
2242 static int hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id = -1;
2243 static int hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4 = -1;
2244 static int hf_bgp_pmsi_tunnel_mldp_fec_el_type = -1; /* RFC 6388 section 2.3 */
2245 static int hf_bgp_pmsi_tunnel_mldp_fec_el_afi = -1;
2246 static int hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len = -1;
2247 static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4 = -1;
2248 static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6 = -1;
2249 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len = -1;
2250 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type = -1;
2251 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len = -1;
2252 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn = -1;
2253 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str = -1;
2254 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type = -1;
2255 static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len = -1;
2256 static int hf_bgp_pmsi_tunnel_pimsm_sender = -1;
2257 static int hf_bgp_pmsi_tunnel_pimsm_pmc_group = -1;
2258 static int hf_bgp_pmsi_tunnel_pimssm_root_node = -1;
2259 static int hf_bgp_pmsi_tunnel_pimssm_pmc_group = -1;
2260 static int hf_bgp_pmsi_tunnel_pimbidir_sender = -1;
2261 static int hf_bgp_pmsi_tunnel_pimbidir_pmc_group = -1;
2262 static int hf_bgp_pmsi_tunnel_ingress_rep_addr = -1;
2263
2264 /* RFC 7311 attribute */
2265 static int hf_bgp_aigp_type = -1;
2266 static int hf_bgp_aigp_tlv_length = -1;
2267 static int hf_bgp_aigp_accu_igp_metric = -1;
2268
2269
2270 /* MPLS labels decoding */
2271 static int hf_bgp_update_mpls_label = -1;
2272 static int hf_bgp_update_mpls_label_value = -1;
2273 static int hf_bgp_update_mpls_label_value_20bits = -1;
2274 static int hf_bgp_update_mpls_traffic_class = -1;
2275 static int hf_bgp_update_mpls_bottom_stack = -1;
2276
2277 /* BGP update path attribute SSA SAFI Specific attribute (deprecated should we keep it ?) */
2278
2279 static int hf_bgp_ssa_t = -1;
2280 static int hf_bgp_ssa_type = -1;
2281 static int hf_bgp_ssa_len = -1;
2282 static int hf_bgp_ssa_value = -1;
2283 static int hf_bgp_ssa_l2tpv3_pref = -1;
2284 static int hf_bgp_ssa_l2tpv3_s = -1;
2285 static int hf_bgp_ssa_l2tpv3_unused = -1;
2286 static int hf_bgp_ssa_l2tpv3_cookie_len = -1;
2287 static int hf_bgp_ssa_l2tpv3_session_id = -1;
2288 static int hf_bgp_ssa_l2tpv3_cookie = -1;
2289
2290 /* BGP NLRI head field */
2291 static int hf_bgp_update_nlri = -1;
2292
2293 static int hf_bgp_mp_reach_nlri_ipv4_prefix = -1;
2294 static int hf_bgp_mp_unreach_nlri_ipv4_prefix = -1;
2295 static int hf_bgp_mp_reach_nlri_ipv6_prefix = -1;
2296 static int hf_bgp_mp_unreach_nlri_ipv6_prefix = -1;
2297 static int hf_bgp_mp_nlri_tnl_id = -1;
2298 static int hf_bgp_withdrawn_prefix = -1;
2299 static int hf_bgp_nlri_prefix = -1;
2300 static int hf_bgp_nlri_path_id = -1;
2301
2302 /* BGP mcast IP VPN nlri header field */
2303
2304 static int hf_bgp_mcast_vpn_nlri_t = -1;
2305 static int hf_bgp_mcast_vpn_nlri_route_type = -1;
2306 static int hf_bgp_mcast_vpn_nlri_length = -1;
2307 static int hf_bgp_mcast_vpn_nlri_rd = -1;
2308 static int hf_bgp_mcast_vpn_nlri_origin_router_ipv4 = -1;
2309 static int hf_bgp_mcast_vpn_nlri_origin_router_ipv6 = -1;
2310 static int hf_bgp_mcast_vpn_nlri_source_as = -1;
2311 static int hf_bgp_mcast_vpn_nlri_source_length = -1;
2312 static int hf_bgp_mcast_vpn_nlri_group_length = -1;
2313 static int hf_bgp_mcast_vpn_nlri_source_addr_ipv4 = -1;
2314 static int hf_bgp_mcast_vpn_nlri_source_addr_ipv6 = -1;
2315 static int hf_bgp_mcast_vpn_nlri_group_addr_ipv4 = -1;
2316 static int hf_bgp_mcast_vpn_nlri_group_addr_ipv6 = -1;
2317 static int hf_bgp_mcast_vpn_nlri_route_key = -1;
2318
2319 /* BGP SR policy nlri field */
2320 static int hf_bgp_sr_policy_nlri_length = - 1;
2321 static int hf_bgp_sr_policy_nlri_distinguisher = - 1;
2322 static int hf_bgp_sr_policy_nlri_policy_color = - 1;
2323 static int hf_bgp_sr_policy_nlri_endpoint_v4 = - 1;
2324 static int hf_bgp_sr_policy_nlri_endpoint_v6 = - 1;
2325
2326 /* BGP-LS */
2327
2328 static int hf_bgp_ls_type = -1;
2329 static int hf_bgp_ls_length = -1;
2330
2331 static int hf_bgp_ls_nlri = -1;
2332 static int hf_bgp_ls_safi128_nlri = -1;
2333 static int hf_bgp_ls_safi128_nlri_route_distinguisher = -1;
2334 static int hf_bgp_ls_safi128_nlri_route_distinguisher_type = -1;
2335 static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2 = -1;
2336 static int hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4 = -1;
2337 static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4 = -1;
2338 static int hf_bgp_ls_safi128_nlri_route_dist_asnum_2 = -1;
2339 static int hf_bgp_ls_safi128_nlri_route_dist_asnum_4 = -1;
2340 static int hf_bgp_ls_nlri_type = -1;
2341 static int hf_bgp_ls_nlri_length = -1;
2342 static int hf_bgp_ls_nlri_link_nlri_type = -1;
2343 static int hf_bgp_ls_nlri_link_descriptors_tlv = -1;
2344 static int hf_bgp_ls_nlri_prefix_descriptors_tlv = -1;
2345 static int hf_bgp_ls_nlri_link_local_identifier = -1;
2346 static int hf_bgp_ls_nlri_link_remote_identifier = -1;
2347 static int hf_bgp_ls_nlri_ipv4_interface_address = -1;
2348 static int hf_bgp_ls_nlri_ipv4_neighbor_address = -1;
2349 static int hf_bgp_ls_nlri_ipv6_interface_address = -1;
2350 static int hf_bgp_ls_nlri_ipv6_neighbor_address = -1;
2351 static int hf_bgp_ls_nlri_multi_topology_id = -1;
2352 static int hf_bgp_ls_nlri_ospf_route_type = -1;
2353 static int hf_bgp_ls_nlri_ip_reachability_prefix_ip = -1;
2354 static int hf_bgp_ls_nlri_ip_reachability_prefix_ip6 = -1;
2355 static int hf_bgp_ls_nlri_node_nlri_type = -1;
2356 static int hf_bgp_ls_nlri_node_protocol_id = -1;
2357 static int hf_bgp_ls_nlri_node_identifier = -1;
2358 static int hf_bgp_ls_ipv4_topology_prefix_nlri_type = -1;
2359 static int hf_bgp_ls_ipv6_topology_prefix_nlri_type = -1;
2360
2361 /* BGP-LS + SR */
2362 static int hf_bgp_ls_sr_tlv_capabilities = -1;
2363 static int hf_bgp_ls_sr_tlv_capabilities_range_size = -1;
2364 static int hf_bgp_ls_sr_tlv_capabilities_flags = -1;
2365 static int hf_bgp_ls_sr_tlv_capabilities_flags_i = -1;
2366 static int hf_bgp_ls_sr_tlv_capabilities_flags_v = -1;
2367 static int hf_bgp_ls_sr_tlv_capabilities_flags_h = -1;
2368 static int hf_bgp_ls_sr_tlv_capabilities_flags_reserved = -1;
2369 static int hf_bgp_ls_sr_tlv_capabilities_sid_label = -1;
2370 static int hf_bgp_ls_sr_tlv_capabilities_sid_index = -1;
2371 static int hf_bgp_ls_sr_tlv_algorithm = -1;
2372 static int hf_bgp_ls_sr_tlv_algorithm_value = -1;
2373 static int hf_bgp_ls_sr_tlv_local_block = -1; /* 1036 */
2374 static int hf_bgp_ls_sr_tlv_local_block_flags = -1;
2375 static int hf_bgp_ls_sr_tlv_local_block_range_size = -1;
2376 static int hf_bgp_ls_sr_tlv_local_block_sid_label = -1;
2377 static int hf_bgp_ls_sr_tlv_local_block_sid_index = -1;
2378 static int hf_bgp_ls_sr_tlv_flex_algo_def = -1; /* 1039 */
2379 static int hf_bgp_ls_sr_tlv_flex_algo_algorithm = -1;
2380 static int hf_bgp_ls_sr_tlv_flex_algo_metric_type = -1;
2381 static int hf_bgp_ls_sr_tlv_flex_algo_calc_type = -1;
2382 static int hf_bgp_ls_sr_tlv_flex_algo_priority = -1;
2383 static int hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity = -1; /* 1040 */
2384 static int hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity = -1; /* 1041 */
2385 static int hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity = -1; /* 1042 */
2386 static int hf_bgp_ls_sr_tlv_prefix_sid = -1;
2387 static int hf_bgp_ls_sr_tlv_prefix_sid_flags = -1;
2388 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_r = -1;
2389 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_n = -1;
2390 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_np = -1;
2391 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_p = -1;
2392 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_m = -1;
2393 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_e = -1;
2394 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_v = -1;
2395 static int hf_bgp_ls_sr_tlv_prefix_sid_flags_l = -1;
2396 static int hf_bgp_ls_sr_tlv_prefix_sid_algo = -1;
2397 static int hf_bgp_ls_sr_tlv_prefix_sid_label = -1;
2398 static int hf_bgp_ls_sr_tlv_prefix_sid_index = -1;
2399 static int hf_bgp_ls_sr_tlv_adjacency_sid = -1;
2400 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags = -1;
2401 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi = -1;
2402 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi = -1;
2403 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo = -1;
2404 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi = -1;
2405 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo = -1;
2406 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_li = -1;
2407 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo = -1;
2408 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_si = -1;
2409 static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_so = -1;
2410 static int hf_bgp_ls_sr_tlv_adjacency_sid_weight = -1;
2411 static int hf_bgp_ls_sr_tlv_adjacency_sid_label = -1;
2412 static int hf_bgp_ls_sr_tlv_adjacency_sid_index = -1;
2413 static int hf_bgp_ls_sr_tlv_peer_node_sid = -1; /* 1101 */
2414 static int hf_bgp_ls_sr_tlv_peer_adj_sid = -1; /* 1102 */
2415 static int hf_bgp_ls_sr_tlv_peer_set_sid = -1; /* 1103 */
2416 static int hf_bgp_ls_sr_tlv_peer_sid_flags = -1;
2417 static int hf_bgp_ls_sr_tlv_peer_sid_flags_v = -1;
2418 static int hf_bgp_ls_sr_tlv_peer_sid_flags_l = -1;
2419 static int hf_bgp_ls_sr_tlv_peer_sid_flags_b = -1;
2420 static int hf_bgp_ls_sr_tlv_peer_sid_flags_p = -1;
2421 static int hf_bgp_ls_sr_tlv_peer_sid_weight = -1;
2422 static int hf_bgp_ls_sr_tlv_peer_sid_label = -1;
2423 static int hf_bgp_ls_sr_tlv_peer_sid_index = -1;
2424 static int hf_bgp_ls_sr_tlv_prefix_attr_flags = -1; /* 1170 */
2425 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags = -1;
2426 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown= -1;
2427 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao = -1;
2428 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no = -1;
2429 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo = -1;
2430 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi = -1;
2431 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri = -1;
2432 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni = -1;
2433 static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei = -1;
2434
2435 /* RFC7752 TLVs */
2436 static int hf_bgp_ls_tlv_local_node_descriptors = -1; /* 256 */
2437 static int hf_bgp_ls_tlv_remote_node_descriptors = -1; /* 257 */
2438 static int hf_bgp_ls_tlv_link_local_remote_identifiers = -1; /* 258 */
2439 static int hf_bgp_ls_tlv_ipv4_interface_address = -1; /* 259 */
2440 static int hf_bgp_ls_tlv_ipv4_neighbor_address = -1; /* 260 */
2441 static int hf_bgp_ls_tlv_ipv6_interface_address = -1; /* 261 */
2442 static int hf_bgp_ls_tlv_ipv6_neighbor_address = -1; /* 262 */
2443 static int hf_bgp_ls_tlv_multi_topology_id = -1; /* 263 */
2444 static int hf_bgp_ls_tlv_ospf_route_type = -1; /* 264 */
2445 static int hf_bgp_ls_tlv_ip_reachability_information = -1; /* 265 */
2446 static int hf_bgp_ls_tlv_node_msd = -1; /* 266 */
2447 static int hf_bgp_ls_tlv_link_msd = -1; /* 267 */
2448 static int hf_bgp_ls_tlv_igp_msd_type = -1;
2449 static int hf_bgp_ls_tlv_igp_msd_value = -1;
2450
2451 static int hf_bgp_ls_tlv_autonomous_system = -1; /* 512 */
2452 static int hf_bgp_ls_tlv_autonomous_system_id = -1;
2453 static int hf_bgp_ls_tlv_bgp_ls_identifier = -1; /* 513 */
2454 static int hf_bgp_ls_tlv_bgp_ls_identifier_id = -1;
2455 static int hf_bgp_ls_tlv_area_id = -1; /* 514 */
2456 static int hf_bgp_ls_tlv_area_id_id = -1;
2457 static int hf_bgp_ls_tlv_igp_router = -1; /* 515 */
2458 static int hf_bgp_ls_tlv_igp_router_id = -1;
2459 static int hf_bgp_ls_tlv_bgp_router_id = -1; /* 516 */
2460 static int hf_bgp_ls_tlv_bgp_router_id_id = -1;
2461
2462 static int hf_bgp_ls_tlv_node_flags_bits = -1; /* 1024 */
2463 static int hf_bgp_ls_tlv_opaque_node_properties = -1; /* 1025 */
2464 static int hf_bgp_ls_tlv_opaque_node_properties_value = -1;
2465 static int hf_bgp_ls_tlv_node_name = -1; /* 1026 */
2466 static int hf_bgp_ls_tlv_node_name_value = -1;
2467 static int hf_bgp_ls_tlv_is_is_area_identifier = -1; /* 1027 */
2468 static int hf_bgp_ls_tlv_is_is_area_identifier_value = -1;
2469 static int hf_bgp_ls_tlv_ipv4_router_id_of_local_node = -1; /* 1028 */
2470 static int hf_bgp_ls_tlv_ipv4_router_id_value = -1;
2471 static int hf_bgp_ls_tlv_ipv6_router_id_value = -1;
2472 static int hf_bgp_ls_tlv_ipv6_router_id_of_local_node = -1; /* 1029 */
2473 static int hf_bgp_ls_tlv_ipv4_router_id_of_remote_node = -1; /* 1030 */
2474 static int hf_bgp_ls_tlv_ipv6_router_id_of_remote_node = -1; /* 1031 */
2475
2476 static int hf_bgp_ls_tlv_administrative_group_color = -1; /* 1088 */
2477 static int hf_bgp_ls_tlv_administrative_group_color_value = -1;
2478 static int hf_bgp_ls_tlv_administrative_group = -1;
2479 static int hf_bgp_ls_tlv_max_link_bandwidth = -1; /* 1089 */
2480 static int hf_bgp_ls_tlv_max_reservable_link_bandwidth = -1; /* 1090 */
2481 static int hf_bgp_ls_tlv_unreserved_bandwidth = -1; /* 1091 */
2482 static int hf_bgp_ls_bandwidth_value = -1;
2483 static int hf_bgp_ls_tlv_te_default_metric = -1; /* 1092 */
2484 static int hf_bgp_ls_tlv_te_default_metric_value_old = -1;
2485 static int hf_bgp_ls_tlv_te_default_metric_value = -1;
2486 static int hf_bgp_ls_tlv_link_protection_type = -1; /* 1093 */
2487 static int hf_bgp_ls_tlv_link_protection_type_value = -1;
2488 static int hf_bgp_ls_tlv_mpls_protocol_mask = -1; /* 1094 */
2489 static int hf_bgp_ls_tlv_metric = -1; /* 1095 */
2490 static int hf_bgp_ls_tlv_metric_value1 = -1;
2491 static int hf_bgp_ls_tlv_metric_value2 = -1;
2492 static int hf_bgp_ls_tlv_metric_value3 = -1;
2493 static int hf_bgp_ls_tlv_shared_risk_link_group = -1; /* 1096 */
2494 static int hf_bgp_ls_tlv_shared_risk_link_group_value = -1;
2495 static int hf_bgp_ls_tlv_opaque_link_attribute = -1; /* 1097 */
2496 static int hf_bgp_ls_tlv_opaque_link_attribute_value = -1;
2497 static int hf_bgp_ls_tlv_link_name_attribute = -1; /* 1098 */
2498 static int hf_bgp_ls_tlv_link_name_attribute_value = -1;
2499 static int hf_bgp_ls_tlv_app_spec_link_attrs = -1; /* 1122 */
2500 static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len = -1;
2501 static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len = -1;
2502 static int hf_bgp_ls_tlv_app_spec_link_attrs_reserved = -1;
2503 static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm = -1;
2504 static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r = -1;
2505 static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s = -1;
2506 static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f = -1;
2507 static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x = -1;
2508 static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm = -1;
2509
2510 static int hf_bgp_ls_tlv_igp_flags = -1; /* 1152 */
2511 static int hf_bgp_ls_tlv_route_tag = -1; /* 1153 */
2512 static int hf_bgp_ls_tlv_route_tag_value = -1;
2513 static int hf_bgp_ls_tlv_route_extended_tag = -1; /* 1154 */
2514 static int hf_bgp_ls_tlv_route_extended_tag_value = -1;
2515 static int hf_bgp_ls_tlv_prefix_metric = -1; /* 1155 */
2516 static int hf_bgp_ls_tlv_prefix_metric_value = -1;
2517 static int hf_bgp_ls_ospf_forwarding_address = -1; /* 1156 */
2518 static int hf_bgp_ls_ospf_forwarding_address_ipv4_address = -1;
2519 static int hf_bgp_ls_ospf_forwarding_address_ipv6_address = -1;
2520 static int hf_bgp_ls_opaque_prefix_attribute = -1; /* 1157 */
2521 static int hf_bgp_ls_opaque_prefix_attribute_value = -1;
2522 static int hf_bgp_ls_extended_administrative_group = -1; /* 1173 */
2523 static int hf_bgp_ls_extended_administrative_group_value = -1;
2524
2525
2526 /* Link Protection Types */
2527 static int hf_bgp_ls_link_protection_type_extra_traffic = -1;
2528 static int hf_bgp_ls_link_protection_type_unprotected = -1;
2529 static int hf_bgp_ls_link_protection_type_shared = -1;
2530 static int hf_bgp_ls_link_protection_type_dedicated_1to1 = -1;
2531 static int hf_bgp_ls_link_protection_type_dedicated_1plus1 = -1;
2532 static int hf_bgp_ls_link_protection_type_enhanced = -1;
2533 /* MPLS Protocol Mask flags */
2534 static int hf_bgp_ls_mpls_protocol_mask_flag_l = -1;
2535 static int hf_bgp_ls_mpls_protocol_mask_flag_r = -1;
2536 /* BGP-LS IGP Flags */
2537 static int hf_bgp_ls_igp_flags_flag_d = -1;
2538 /* Node Flag Bits TLV's flags */
2539 static int hf_bgp_ls_node_flag_bits_overload = -1;
2540 static int hf_bgp_ls_node_flag_bits_attached = -1;
2541 static int hf_bgp_ls_node_flag_bits_external = -1;
2542 static int hf_bgp_ls_node_flag_bits_abr = -1;
2543
2544 /* RFC8669 BGP Prefix-SID header field */
2545 static int hf_bgp_prefix_sid_unknown = -1;
2546 static int hf_bgp_prefix_sid_label_index = -1;
2547 static int hf_bgp_prefix_sid_label_index_value = -1;
2548 static int hf_bgp_prefix_sid_label_index_flags = -1;
2549 static int hf_bgp_prefix_sid_originator_srgb = -1;
2550 static int hf_bgp_prefix_sid_originator_srgb_blocks = -1;
2551 static int hf_bgp_prefix_sid_originator_srgb_block = -1;
2552 static int hf_bgp_prefix_sid_originator_srgb_flags = -1;
2553 static int hf_bgp_prefix_sid_originator_srgb_base = -1;
2554 static int hf_bgp_prefix_sid_originator_srgb_range = -1;
2555 static int hf_bgp_prefix_sid_type = -1;
2556 static int hf_bgp_prefix_sid_length = -1;
2557 static int hf_bgp_prefix_sid_value = -1;
2558 static int hf_bgp_prefix_sid_reserved = -1;
2559
2560 /* draft-ietf-bess-srv6-services-05 header field */
2561 static int hf_bgp_prefix_sid_srv6_l3vpn = -1;
2562 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs = -1;
2563 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv = -1;
2564 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type = -1;
2565 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length = -1;
2566 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value = -1;
2567 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved = -1;
2568 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_value = -1;
2569 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_flags = -1;
2570 static int hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior = -1;
2571 static int hf_bgp_prefix_sid_srv6_l3vpn_reserved = -1;
2572 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs = -1;
2573 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv = -1;
2574 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type = -1;
2575 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length = -1;
2576 static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value = -1;
2577 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len = -1;
2578 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len = -1;
2579 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len = -1;
2580 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len = -1;
2581 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len = -1;
2582 static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset = -1;
2583 static int hf_bgp_prefix_sid_srv6_l2vpn = -1;
2584 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs = -1;
2585 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv = -1;
2586 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type = -1;
2587 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length = -1;
2588 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value = -1;
2589 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved = -1;
2590 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_value = -1;
2591 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_flags = -1;
2592 static int hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior = -1;
2593 static int hf_bgp_prefix_sid_srv6_l2vpn_reserved = -1;
2594 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs = -1;
2595 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv = -1;
2596 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type = -1;
2597 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length = -1;
2598 static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value = -1;
2599 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len = -1;
2600 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len = -1;
2601 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len = -1;
2602 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len = -1;
2603 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len = -1;
2604 static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset = -1;
2605
2606 /* BGP flow spec nlri header field */
2607
2608 static int hf_bgp_flowspec_nlri_t = -1;
2609 static int hf_bgp_flowspec_nlri_route_distinguisher = -1;
2610 static int hf_bgp_flowspec_nlri_route_distinguisher_type = -1;
2611 static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_2 = -1;
2612 static int hf_bgp_flowspec_nlri_route_dist_admin_ipv4 = -1;
2613 static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_4 = -1;
2614 static int hf_bgp_flowspec_nlri_route_dist_asnum_2 = -1;
2615 static int hf_bgp_flowspec_nlri_route_dist_asnum_4 = -1;
2616 static int hf_bgp_flowspec_nlri_filter = -1;
2617 static int hf_bgp_flowspec_nlri_filter_type = -1;
2618 static int hf_bgp_flowspec_nlri_length = -1;
2619 static int hf_bgp_flowspec_nlri_dst_pref_ipv4 = -1;
2620 static int hf_bgp_flowspec_nlri_src_pref_ipv4 = -1;
2621 static int hf_bgp_flowspec_nlri_op_flags = -1;
2622 static int hf_bgp_flowspec_nlri_op_eol = -1;
2623 static int hf_bgp_flowspec_nlri_op_and = -1;
2624 static int hf_bgp_flowspec_nlri_op_val_len = -1;
2625 static int hf_bgp_flowspec_nlri_op_un_bit4 = -1;
2626 static int hf_bgp_flowspec_nlri_op_un_bit5 = -1;
2627 static int hf_bgp_flowspec_nlri_op_lt = -1;
2628 static int hf_bgp_flowspec_nlri_op_gt = -1;
2629 static int hf_bgp_flowspec_nlri_op_eq = -1;
2630 static int hf_bgp_flowspec_nlri_dec_val_8 = -1;
2631 static int hf_bgp_flowspec_nlri_dec_val_16 = -1;
2632 static int hf_bgp_flowspec_nlri_dec_val_32 = -1;
2633 static int hf_bgp_flowspec_nlri_dec_val_64 = -1;
2634 static int hf_bgp_flowspec_nlri_op_flg_not = -1;
2635 static int hf_bgp_flowspec_nlri_op_flg_match = -1;
2636 static int hf_bgp_flowspec_nlri_tcp_flags = -1;
2637 static int hf_bgp_flowspec_nlri_tcp_flags_cwr = -1;
2638 static int hf_bgp_flowspec_nlri_tcp_flags_ecn = -1;
2639 static int hf_bgp_flowspec_nlri_tcp_flags_urg = -1;
2640 static int hf_bgp_flowspec_nlri_tcp_flags_ack = -1;
2641 static int hf_bgp_flowspec_nlri_tcp_flags_push = -1;
2642 static int hf_bgp_flowspec_nlri_tcp_flags_reset = -1;
2643 static int hf_bgp_flowspec_nlri_tcp_flags_syn = -1;
2644 static int hf_bgp_flowspec_nlri_tcp_flags_fin = -1;
2645 static int hf_bgp_flowspec_nlri_fflag = -1;
2646 static int hf_bgp_flowspec_nlri_fflag_lf = -1;
2647 static int hf_bgp_flowspec_nlri_fflag_ff = -1;
2648 static int hf_bgp_flowspec_nlri_fflag_isf = -1;
2649 static int hf_bgp_flowspec_nlri_fflag_df = -1;
2650 static int hf_bgp_flowspec_nlri_dscp = -1;
2651 static int hf_bgp_flowspec_nlri_src_ipv6_pref = -1;
2652 static int hf_bgp_flowspec_nlri_dst_ipv6_pref = -1;
2653 static int hf_bgp_flowspec_nlri_ipv6_pref_len = -1;
2654 static int hf_bgp_flowspec_nlri_ipv6_pref_offset = -1;
2655
2656 /* BGP update safi ndt nlri draft-nalawade-idr-mdt-safi-03 */
2657
2658 static int hf_bgp_mdt_nlri_safi_rd = -1;
2659 static int hf_bgp_mdt_nlri_safi_ipv4_addr = -1;
2660 static int hf_bgp_mdt_nlri_safi_group_addr = -1;
2661
2662 /* BGP update extended community header field */
2663
2664 static int hf_bgp_ext_communities = -1;
2665 static int hf_bgp_ext_community = -1;
2666 static int hf_bgp_ext_com_type_auth = -1;
2667 static int hf_bgp_ext_com_type_tran = -1;
2668
2669 static int hf_bgp_ext_com_type_high = -1;
2670 static int hf_bgp_ext_com_stype_low_unknown = -1;
2671 static int hf_bgp_ext_com_stype_tr_evpn = -1;
2672 static int hf_bgp_ext_com_stype_tr_as2 = -1;
2673 static int hf_bgp_ext_com_stype_ntr_as2 = -1;
2674 static int hf_bgp_ext_com_stype_tr_as4 = -1;
2675 static int hf_bgp_ext_com_stype_ntr_as4 = -1;
2676 static int hf_bgp_ext_com_stype_tr_IP4 = -1;
2677 static int hf_bgp_ext_com_stype_ntr_IP4 = -1;
2678 static int hf_bgp_ext_com_stype_tr_opaque = -1;
2679 static int hf_bgp_ext_com_stype_ntr_opaque = -1;
2680 static int hf_bgp_ext_com_tunnel_type = -1;
2681 static int hf_bgp_ext_com_stype_tr_exp = -1;
2682 static int hf_bgp_ext_com_stype_tr_exp_2 = -1;
2683 static int hf_bgp_ext_com_stype_tr_exp_3 = -1;
2684
2685 static int hf_bgp_ext_com_value_as2 = -1;
2686 static int hf_bgp_ext_com_value_as4 = -1;
2687 static int hf_bgp_ext_com_value_IP4 = -1;
2688 static int hf_bgp_ext_com_value_an2 = -1;
2689 static int hf_bgp_ext_com_value_an4 = -1;
2690 static int hf_bgp_ext_com_value_raw = -1;
2691 static int hf_bgp_ext_com_value_link_bw = -1;
2692 static int hf_bgp_ext_com_value_ospf_rt_area = -1;
2693 static int hf_bgp_ext_com_value_ospf_rt_type = -1;
2694 static int hf_bgp_ext_com_value_ospf_rt_options = -1;
2695 static int hf_bgp_ext_com_value_ospf_rt_options_mt = -1;
2696 static int hf_bgp_ext_com_value_ospf_rid = -1;
2697 static int hf_bgp_ext_com_value_fs_remark = -1;
2698
2699 /* BGP QoS propagation draft-knoll-idr-qos-attribute */
2700
2701 static int hf_bgp_ext_com_qos_flags = -1;
2702 static int hf_bgp_ext_com_qos_flags_remarking = -1;
2703 static int hf_bgp_ext_com_qos_flags_ignore_remarking = -1;
2704 static int hf_bgp_ext_com_qos_flags_agg_marking = -1;
2705 static int hf_bgp_ext_com_cos_flags = -1;
2706 static int hf_bgp_ext_com_cos_flags_be = -1;
2707 static int hf_bgp_ext_com_cos_flags_ef = -1;
2708 static int hf_bgp_ext_com_cos_flags_af = -1;
2709 static int hf_bgp_ext_com_cos_flags_le = -1;
2710 static int hf_bgp_ext_com_qos_set_number = -1;
2711 static int hf_bgp_ext_com_qos_tech_type = -1;
2712 static int hf_bgp_ext_com_qos_marking_o = -1;
2713 static int hf_bgp_ext_com_qos_marking_a = -1;
2714 static int hf_bgp_ext_com_qos_default_to_zero = -1;
2715
2716 /* BGP Flow spec extended community RFC 5575 */
2717
2718 static int hf_bgp_ext_com_flow_rate_float = -1;
2719 static int hf_bgp_ext_com_flow_act_allset = -1;
2720 static int hf_bgp_ext_com_flow_act_term_act = -1;
2721 static int hf_bgp_ext_com_flow_act_samp_act = -1;
2722
2723 /* BGP L2 extended community RFC 4761, RFC 6624 */
2724 /* draft-ietf-l2vpn-vpls-multihoming */
2725
2726 static int hf_bgp_ext_com_l2_encaps = -1;
2727 static int hf_bgp_ext_com_l2_c_flags = -1;
2728 static int hf_bgp_ext_com_l2_mtu = -1;
2729 static int hf_bgp_ext_com_l2_flag_d = -1;
2730 static int hf_bgp_ext_com_l2_flag_z1 = -1;
2731 static int hf_bgp_ext_com_l2_flag_f = -1;
2732 static int hf_bgp_ext_com_l2_flag_z345 = -1;
2733 static int hf_bgp_ext_com_l2_flag_c = -1;
2734 static int hf_bgp_ext_com_l2_flag_s = -1;
2735 static int hf_bgp_ext_com_l2_esi_label_flag = -1;
2736 static int hf_bgp_ext_com_evpn_mmac_flag = -1;
2737 static int hf_bgp_ext_com_evpn_mmac_seq = -1;
2738 static int hf_bgp_ext_com_evpn_esirt = -1;
2739 static int hf_bgp_ext_com_evpn_routermac = -1;
2740 static int hf_bgp_ext_com_evpn_mmac_flag_sticky = -1;
2741
2742 /* BGP E-Tree Info extended community RFC 7796 */
2743
2744 static int hf_bgp_ext_com_etree_flags = -1;
2745 static int hf_bgp_ext_com_etree_root_vlan = -1;
2746 static int hf_bgp_ext_com_etree_leaf_vlan = -1;
2747 static int hf_bgp_ext_com_etree_flag_reserved = -1;
2748 static int hf_bgp_ext_com_etree_flag_p = -1;
2749 static int hf_bgp_ext_com_etree_flag_v = -1;
2750
2751 /* VPWS Support in EVPN RFC 8214 */
2752 /* draft-yu-bess-evpn-l2-attributes-04 */
2753
2754 static int hf_bgp_ext_com_evpn_l2attr_flags = -1;
2755 static int hf_bgp_ext_com_evpn_l2attr_flag_reserved = -1;
2756 static int hf_bgp_ext_com_evpn_l2attr_flag_ci = -1;
2757 static int hf_bgp_ext_com_evpn_l2attr_flag_f = -1;
2758 static int hf_bgp_ext_com_evpn_l2attr_flag_c = -1;
2759 static int hf_bgp_ext_com_evpn_l2attr_flag_p = -1;
2760 static int hf_bgp_ext_com_evpn_l2attr_flag_b = -1;
2761 static int hf_bgp_ext_com_evpn_l2attr_l2_mtu = -1;
2762 static int hf_bgp_ext_com_evpn_l2attr_reserved = -1;
2763
2764 /* E-Tree RFC8317 */
2765
2766 static int hf_bgp_ext_com_evpn_etree_flags = -1;
2767 static int hf_bgp_ext_com_evpn_etree_flag_reserved = -1;
2768 static int hf_bgp_ext_com_evpn_etree_flag_l = -1;
2769 static int hf_bgp_ext_com_evpn_etree_reserved = -1;
2770
2771 /* BGP Cost Community */
2772
2773 static int hf_bgp_ext_com_cost_poi = -1;
2774 static int hf_bgp_ext_com_cost_cid = -1;
2775 static int hf_bgp_ext_com_cost_cost = -1;
2776 static int hf_bgp_ext_com_cost_cid_rep = -1;
2777
2778 /* EIGRP route attributes extended communities */
2779
2780 static int hf_bgp_ext_com_stype_tr_exp_eigrp = -1;
2781 static int hf_bgp_ext_com_eigrp_flags = -1;
2782 static int hf_bgp_ext_com_eigrp_flags_rt = -1;
2783 static int hf_bgp_ext_com_eigrp_rtag = -1;
2784 static int hf_bgp_ext_com_eigrp_asn = -1;
2785 static int hf_bgp_ext_com_eigrp_delay = -1;
2786 static int hf_bgp_ext_com_eigrp_rly = -1;
2787 static int hf_bgp_ext_com_eigrp_hops = -1;
2788 static int hf_bgp_ext_com_eigrp_bw = -1;
2789 static int hf_bgp_ext_com_eigrp_load = -1;
2790 static int hf_bgp_ext_com_eigrp_mtu = -1;
2791 static int hf_bgp_ext_com_eigrp_rid = -1;
2792 static int hf_bgp_ext_com_eigrp_e_asn = -1;
2793 static int hf_bgp_ext_com_eigrp_e_rid = -1;
2794 static int hf_bgp_ext_com_eigrp_e_pid = -1;
2795 static int hf_bgp_ext_com_eigrp_e_m = -1;
2796
2797 /* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
2798 static int hf_bgp_ls_igp_te_metric_flags = -1;
2799 static int hf_bgp_ls_igp_te_metric_flags_a = -1;
2800 static int hf_bgp_ls_igp_te_metric_flags_reserved = -1;
2801 static int hf_bgp_ls_igp_te_metric_delay = -1;
2802 static int hf_bgp_ls_igp_te_metric_delay_value = -1;
2803 static int hf_bgp_ls_igp_te_metric_delay_min_max = -1;
2804 static int hf_bgp_ls_igp_te_metric_delay_min = -1;
2805 static int hf_bgp_ls_igp_te_metric_delay_max = -1;
2806 static int hf_bgp_ls_igp_te_metric_delay_variation = -1;
2807 static int hf_bgp_ls_igp_te_metric_delay_variation_value = -1;
2808 static int hf_bgp_ls_igp_te_metric_link_loss = -1;
2809 static int hf_bgp_ls_igp_te_metric_link_loss_value = -1;
2810 static int hf_bgp_ls_igp_te_metric_bandwidth_residual = -1;
2811 static int hf_bgp_ls_igp_te_metric_bandwidth_residual_value = -1;
2812 static int hf_bgp_ls_igp_te_metric_bandwidth_available = -1;
2813 static int hf_bgp_ls_igp_te_metric_bandwidth_available_value = -1;
2814 static int hf_bgp_ls_igp_te_metric_bandwidth_utilized = -1;
2815 static int hf_bgp_ls_igp_te_metric_bandwidth_utilized_value = -1;
2816 static int hf_bgp_ls_igp_te_metric_reserved = -1;
2817
2818 static int * const ls_igp_te_metric_flags[] = {
2819 &hf_bgp_ls_igp_te_metric_flags_a,
2820 &hf_bgp_ls_igp_te_metric_flags_reserved,
2821 NULL
2822 };
2823
2824 static gint ett_bgp = -1;
2825 static gint ett_bgp_prefix = -1;
2826 static gint ett_bgp_unfeas = -1;
2827 static gint ett_bgp_attrs = -1;
2828 static gint ett_bgp_attr = -1;
2829 static gint ett_bgp_attr_flags = -1;
2830 static gint ett_bgp_mp_nhna = -1;
2831 static gint ett_bgp_mp_reach_nlri = -1;
2832 static gint ett_bgp_mp_unreach_nlri = -1;
2833 static gint ett_bgp_mp_snpa = -1;
2834 static gint ett_bgp_nlri = -1;
2835 static gint ett_bgp_open = -1;
2836 static gint ett_bgp_update = -1;
2837 static gint ett_bgp_notification = -1;
2838 static gint ett_bgp_route_refresh = -1; /* ROUTE-REFRESH message tree */
2839 static gint ett_bgp_capability = -1;
2840 static gint ett_bgp_as_path_segment = -1;
2841 static gint ett_bgp_as_path_segment_asn = -1;
2842 static gint ett_bgp_communities = -1;
2843 static gint ett_bgp_community = -1;
2844 static gint ett_bgp_cluster_list = -1; /* cluster list tree */
2845 static gint ett_bgp_options = -1; /* optional parameters tree */
2846 static gint ett_bgp_option = -1; /* an optional parameter tree */
2847 static gint ett_bgp_cap = -1; /* an cap parameter tree */
2848 static gint ett_bgp_extended_communities = -1; /* extended communities list tree */
2849 static gint ett_bgp_extended_community = -1; /* extended community tree for each community of BGP update */
2850 static gint ett_bgp_ext_com_type = -1; /* Extended Community Type High tree (IANA, Transitive bits) */
2851 static gint ett_bgp_extended_com_fspec_redir = -1; /* extended communities BGP flow act redirect */
2852 static gint ett_bgp_ext_com_flags = -1; /* extended communities flags tree */
2853 static gint ett_bgp_ext_com_l2_flags = -1; /* extended commuties tree for l2 services flags */
2854 static gint ett_bgp_ext_com_etree_flags = -1;
2855 static gint ett_bgp_ext_com_evpn_mmac_flags = -1;
2856 static gint ett_bgp_ext_com_evpn_l2attr_flags = -1;
2857 static gint ett_bgp_ext_com_evpn_etree_flags = -1;
2858 static gint ett_bgp_ext_com_cost_cid = -1; /* Cost community CommunityID tree (replace/evaluate after bit) */
2859 static gint ett_bgp_ext_com_ospf_rt_opt = -1; /* Tree for Options bitfield of OSPF Route Type extended community */
2860 static gint ett_bgp_ext_com_eigrp_flags = -1; /* Tree for EIGRP route flags */
2861 static gint ett_bgp_ssa = -1; /* safi specific attribute */
2862 static gint ett_bgp_ssa_subtree = -1; /* safi specific attribute Subtrees */
2863 static gint ett_bgp_orf = -1; /* orf (outbound route filter) tree */
2864 static gint ett_bgp_orf_entry = -1; /* orf entry tree */
2865 static gint ett_bgp_mcast_vpn_nlri = -1;
2866 static gint ett_bgp_flow_spec_nlri = -1;
2867 static gint ett_bgp_flow_spec_nlri_filter = -1; /* tree decoding multiple op and value pairs */
2868 static gint ett_bgp_flow_spec_nlri_op_flags = -1; /* tree decoding each op and val pair within the op and value set */
2869 static gint ett_bgp_flow_spec_nlri_tcp = -1;
2870 static gint ett_bgp_flow_spec_nlri_ff = -1;
2871 static gint ett_bgp_tunnel_tlv = -1;
2872 static gint ett_bgp_tunnel_tlv_subtree = -1;
2873 static gint ett_bgp_tunnel_subtlv = -1;
2874 static gint ett_bgp_tunnel_subtlv_subtree = -1;
2875 static gint ett_bgp_link_state = -1;
2876 static gint ett_bgp_evpn_nlri = -1;
2877 static gint ett_bgp_evpn_nlri_esi = -1;
2878 static gint ett_bgp_evpn_nlri_mc = -1;
2879 static gint ett_bgp_mpls_labels = -1;
2880 static gint ett_bgp_pmsi_tunnel_id = -1;
2881 static gint ett_bgp_aigp_attr = -1;
2882 static gint ett_bgp_large_communities = -1;
2883 static gint ett_bgp_dpath = -1;
2884 static gint ett_bgp_prefix_sid_originator_srgb = -1;
2885 static gint ett_bgp_prefix_sid_originator_srgb_block = -1;
2886 static gint ett_bgp_prefix_sid_originator_srgb_blocks = -1;
2887 static gint ett_bgp_prefix_sid_label_index = -1;
2888 static gint ett_bgp_prefix_sid_ipv6 = -1;
2889 static gint ett_bgp_bgpsec_secure_path = -1;
2890 static gint ett_bgp_bgpsec_secure_path_segment = -1;
2891 static gint ett_bgp_bgpsec_signature_block = -1;
2892 static gint ett_bgp_bgpsec_signature_segment = -1;
2893 static gint ett_bgp_vxlan = -1;
2894 static gint ett_bgp_binding_sid = -1;
2895 static gint ett_bgp_segment_list = -1;
2896 static gint ett_bgp_prefix_sid_unknown = -1;
2897 static gint ett_bgp_prefix_sid_srv6_l3vpn = -1;
2898 static gint ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs = -1;
2899 static gint ett_bgp_prefix_sid_srv6_l3vpn_sid_information = -1;
2900 static gint ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs = -1;
2901 static gint ett_bgp_prefix_sid_srv6_l3vpn_sid_structure = -1;
2902 static gint ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown = -1;
2903 static gint ett_bgp_prefix_sid_srv6_l3vpn_unknown = -1;
2904 static gint ett_bgp_prefix_sid_srv6_l2vpn = -1;
2905 static gint ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs = -1;
2906 static gint ett_bgp_prefix_sid_srv6_l2vpn_sid_information = -1;
2907 static gint ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs = -1;
2908 static gint ett_bgp_prefix_sid_srv6_l2vpn_sid_structure = -1;
2909 static gint ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown = -1;
2910 static gint ett_bgp_prefix_sid_srv6_l2vpn_unknown = -1;
2911
2912 static expert_field ei_bgp_marker_invalid = EI_INIT;
2913 static expert_field ei_bgp_cap_len_bad = EI_INIT;
2914 static expert_field ei_bgp_cap_gr_helper_mode_only = EI_INIT;
2915 static expert_field ei_bgp_notify_minor_unknown = EI_INIT;
2916 static expert_field ei_bgp_route_refresh_orf_type_unknown = EI_INIT;
2917 static expert_field ei_bgp_length_invalid = EI_INIT;
2918 static expert_field ei_bgp_prefix_length_invalid = EI_INIT;
2919 static expert_field ei_bgp_afi_type_not_supported = EI_INIT;
2920 static expert_field ei_bgp_unknown_afi = EI_INIT;
2921 static expert_field ei_bgp_unknown_safi = EI_INIT;
2922 static expert_field ei_bgp_unknown_label_vpn = EI_INIT;
2923 static expert_field ei_bgp_ls_error = EI_INIT;
2924 static expert_field ei_bgp_ls_warn = EI_INIT;
2925 static expert_field ei_bgp_ext_com_len_bad = EI_INIT;
2926 static expert_field ei_bgp_attr_pmsi_opaque_type = EI_INIT;
2927 static expert_field ei_bgp_attr_pmsi_tunnel_type = EI_INIT;
2928 static expert_field ei_bgp_prefix_length_err = EI_INIT;
2929 static expert_field ei_bgp_attr_aigp_type = EI_INIT;
2930 static expert_field ei_bgp_attr_as_path_as_len_err = EI_INIT;
2931 static expert_field ei_bgp_next_hop_ipv6_scope = EI_INIT;
2932 static expert_field ei_bgp_next_hop_rd_nonzero = EI_INIT;
2933
2934 static expert_field ei_bgp_evpn_nlri_rt_type_err = EI_INIT;
2935 static expert_field ei_bgp_evpn_nlri_rt_len_err = EI_INIT;
2936 static expert_field ei_bgp_evpn_nlri_esi_type_err = EI_INIT;
2937 static expert_field ei_bgp_evpn_nlri_rt4_no_ip = EI_INIT;
2938
2939 /* desegmentation */
2940 static gboolean bgp_desegment = TRUE;
2941
2942 static gint bgp_asn_len = 0;
2943
2944 /* FF: BGP-LS is just a collector of IGP link state information. Some
2945 fields are encoded "as-is" from the IGP, hence in order to dissect
2946 them properly we must be aware of their origin, e.g. IS-IS or OSPF.
2947 So, *before* dissecting LINK_STATE attributes we must get the
2948 'Protocol-ID' field that is present in the MP_[UN]REACH_NLRI
2949 attribute. The tricky thing is that there is no strict order
2950 for path attributes on the wire, hence we have to keep track
2951 of 1) the 'Protocol-ID' from the MP_[UN]REACH_NLRI and 2)
2952 the offset/len of the LINK_STATE attribute. We store them in
2953 per-packet proto_data and once we got both we are ready for the
2954 LINK_STATE attribute dissection.
2955 */
2956 typedef struct _link_state_data {
2957 /* Link/Node NLRI Protocol-ID (e.g. OSPF or IS-IS) */
2958 guint8 protocol_id;
2959 /* LINK_STATE attribute coordinates */
2960 gint ostart; /* offset at which the LINK_STATE path attribute starts */
2961 gint oend; /* offset at which the LINK_STATE path attribute ends */
2962 guint16 tlen; /* length of the LINK_STATE path attribute */
2963 /* presence flag */
2964 gboolean link_state_attr_present;
2965 /* tree where add LINK_STATE items */
2966 proto_tree *subtree2;
2967 } link_state_data;
2968
2969 #define LINK_STATE_DATA_KEY 0
2970
2971 static void
save_link_state_protocol_id(packet_info * pinfo,guint8 protocol_id)2972 save_link_state_protocol_id(packet_info *pinfo, guint8 protocol_id) {
2973 link_state_data *data =
2974 (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
2975 if (!data) {
2976 data = wmem_new0(pinfo->pool, link_state_data);
2977 data->ostart = -1;
2978 data->oend = -1;
2979 data->tlen = 0;
2980 data->link_state_attr_present = FALSE;
2981 data->subtree2 = NULL;
2982 }
2983 data->protocol_id = protocol_id;
2984 p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
2985 return;
2986 }
2987
2988 static void
save_link_state_attr_position(packet_info * pinfo,gint ostart,gint oend,guint16 tlen,proto_tree * subtree2)2989 save_link_state_attr_position(packet_info *pinfo, gint ostart, gint oend, guint16 tlen, proto_tree *subtree2) {
2990 link_state_data *data =
2991 (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
2992 if (!data) {
2993 data = wmem_new0(pinfo->pool, link_state_data);
2994 data->protocol_id = BGP_LS_NLRI_PROTO_ID_UNKNOWN;
2995 }
2996 data->ostart = ostart;
2997 data->oend = oend;
2998 data->tlen = tlen;
2999 data->link_state_attr_present = TRUE;
3000 data->subtree2 = subtree2;
3001 p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3002 return;
3003 }
3004
3005 static link_state_data*
load_link_state_data(packet_info * pinfo)3006 load_link_state_data(packet_info *pinfo) {
3007 link_state_data *data =
3008 (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3009 return data;
3010 }
3011
3012 typedef struct _path_attr_data {
3013 gboolean encaps_community_present;
3014 guint16 encaps_tunnel_type;
3015 } path_attr_data;
3016
3017 #define PATH_ATTR_DATA_KEY 1
3018
3019 static void
save_path_attr_encaps_tunnel_type(packet_info * pinfo,guint32 encaps_tunnel_type)3020 save_path_attr_encaps_tunnel_type(packet_info *pinfo, guint32 encaps_tunnel_type) {
3021 path_attr_data *data =
3022 (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3023 if (!data) {
3024 data = wmem_new0(wmem_file_scope(), path_attr_data);
3025 }
3026 data->encaps_community_present = TRUE;
3027 data->encaps_tunnel_type = encaps_tunnel_type;
3028 p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY, data);
3029 return;
3030 }
3031
3032 static path_attr_data*
load_path_attr_data(packet_info * pinfo)3033 load_path_attr_data(packet_info *pinfo) {
3034 path_attr_data *data =
3035 (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3036 return data;
3037 }
3038
3039 /*
3040 * Detect IPv4/IPv6 prefixes conform to BGP Additional Path but NOT conform to standard BGP
3041 *
3042 * A real BGP speaker would rely on the BGP Additional Path in the BGP Open messages.
3043 * But it is not suitable for a packet analyse because the BGP sessions are not supposed to
3044 * restart very often, and Open messages from both sides of the session would be needed
3045 * to determine the result of the capability negociation.
3046 * Code inspired from the decode_prefix4 function
3047 */
3048 static int
detect_add_path_prefix46(tvbuff_t * tvb,gint offset,gint end,gint max_bit_length)3049 detect_add_path_prefix46(tvbuff_t *tvb, gint offset, gint end, gint max_bit_length) {
3050 guint32 addr_len;
3051 guint8 prefix_len;
3052 gint o;
3053 /* Must be compatible with BGP Additional Path */
3054 for (o = offset + 4; o < end; o += 4) {
3055 prefix_len = tvb_get_guint8(tvb, o);
3056 if( prefix_len > max_bit_length) {
3057 return 0; /* invalid prefix length - not BGP add-path */
3058 }
3059 addr_len = (prefix_len + 7) / 8;
3060 o += 1 + addr_len;
3061 if( o > end ) {
3062 return 0; /* invalid offset - not BGP add-path */
3063 }
3064 if (prefix_len % 8) {
3065 /* detect bits set after the end of the prefix */
3066 if( tvb_get_guint8(tvb, o - 1 ) & (0xFF >> (prefix_len % 8)) ) {
3067 return 0; /* invalid prefix content - not BGP add-path */
3068 }
3069 }
3070 }
3071 /* Must NOT be compatible with standard BGP */
3072 for (o = offset; o < end; ) {
3073 prefix_len = tvb_get_guint8(tvb, o);
3074 if( prefix_len == 0 && end - offset > 1 ) {
3075 return 1; /* prefix length is zero (i.e. matching all IP prefixes) and remaining bytes within the NLRI is greater than or equal to 1 - may be BGP add-path */
3076 }
3077 if( prefix_len > max_bit_length) {
3078 return 1; /* invalid prefix length - may be BGP add-path */
3079 }
3080 addr_len = (prefix_len + 7) / 8;
3081 o += 1 + addr_len;
3082 if( o > end ) {
3083 return 1; /* invalid offset - may be BGP add-path */
3084 }
3085 if (prefix_len % 8) {
3086 /* detect bits set after the end of the prefix */
3087 if( tvb_get_guint8(tvb, o - 1 ) & (0xFF >> (prefix_len % 8)) ) {
3088 return 1; /* invalid prefix content - may be BGP add-path (or a bug) */
3089 }
3090 }
3091 }
3092 return 0; /* valid - do not assume Additional Path */
3093 }
3094 static int
detect_add_path_prefix4(tvbuff_t * tvb,gint offset,gint end)3095 detect_add_path_prefix4(tvbuff_t *tvb, gint offset, gint end) {
3096 return detect_add_path_prefix46(tvb, offset, end, 32);
3097 }
3098 static int
detect_add_path_prefix6(tvbuff_t * tvb,gint offset,gint end)3099 detect_add_path_prefix6(tvbuff_t *tvb, gint offset, gint end) {
3100 return detect_add_path_prefix46(tvb, offset, end, 128);
3101 }
3102 /*
3103 * Decode an IPv4 prefix with Path Identifier
3104 * Code inspired from the decode_prefix4 function
3105 */
3106 static int
decode_path_prefix4(proto_tree * tree,packet_info * pinfo,int hf_path_id,int hf_addr,tvbuff_t * tvb,gint offset,const char * tag)3107 decode_path_prefix4(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, gint offset,
3108 const char *tag)
3109 {
3110 proto_tree *prefix_tree;
3111 ws_in4_addr ip_addr; /* IP address */
3112 guint8 plen; /* prefix length */
3113 int length; /* number of octets needed for prefix */
3114 guint32 path_identifier;
3115 address addr;
3116
3117 /* snarf path identifier length and prefix */
3118 path_identifier = tvb_get_ntohl(tvb, offset);
3119 plen = tvb_get_guint8(tvb, offset + 4);
3120 length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 4 + 1, &ip_addr, plen);
3121 if (length < 0) {
3122 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4 , 1, "%s length %u invalid (> 32)",
3123 tag, plen);
3124 return -1;
3125 }
3126 /* put prefix into protocol tree */
3127 set_address(&addr, AT_IPv4, 4, &ip_addr);
3128 prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 + 1 + length,
3129 ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3130 address_to_str(pinfo->pool, &addr), plen, path_identifier);
3131 proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3132 proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
3133 proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, ip_addr);
3134 return(4 + 1 + length);
3135 }
3136
3137 /*
3138 * Decode an IPv4 prefix.
3139 */
3140 static int
decode_prefix4(proto_tree * tree,packet_info * pinfo,proto_item * parent_item,int hf_addr,tvbuff_t * tvb,gint offset,const char * tag)3141 decode_prefix4(proto_tree *tree, packet_info *pinfo, proto_item *parent_item, int hf_addr, tvbuff_t *tvb, gint offset,
3142 const char *tag)
3143 {
3144 proto_tree *prefix_tree;
3145 ws_in4_addr ip_addr; /* IP address */
3146 guint8 plen; /* prefix length */
3147 int length; /* number of octets needed for prefix */
3148 address addr;
3149
3150 /* snarf length and prefix */
3151 plen = tvb_get_guint8(tvb, offset);
3152 length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 1, &ip_addr, plen);
3153 if (length < 0) {
3154 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid (> 32)",
3155 tag, plen);
3156 return -1;
3157 }
3158
3159 /* put prefix into protocol tree */
3160 set_address(&addr, AT_IPv4, 4, &ip_addr);
3161 prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3162 1 + length, ett_bgp_prefix, NULL,
3163 "%s/%u", address_to_str(pinfo->pool, &addr), plen);
3164
3165 proto_item_append_text(parent_item, " (%s/%u)",
3166 address_to_str(pinfo->pool, &addr), plen);
3167
3168 proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3169 tag, plen);
3170 proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 1, length, ip_addr);
3171 return(1 + length);
3172 }
3173
3174 /*
3175 * Decode an IPv6 prefix with path ID.
3176 */
3177 static int
decode_path_prefix6(proto_tree * tree,packet_info * pinfo,int hf_path_id,int hf_addr,tvbuff_t * tvb,gint offset,const char * tag)3178 decode_path_prefix6(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, gint offset,
3179 const char *tag)
3180 {
3181 proto_tree *prefix_tree;
3182 guint32 path_identifier;
3183 ws_in6_addr addr; /* IPv6 address */
3184 address addr_str;
3185 int plen; /* prefix length */
3186 int length; /* number of octets needed for prefix */
3187
3188 /* snarf length and prefix */
3189 path_identifier = tvb_get_ntohl(tvb, offset);
3190 plen = tvb_get_guint8(tvb, offset + 4);
3191 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 4 + 1, &addr, plen);
3192 if (length < 0) {
3193 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4, 1, "%s length %u invalid",
3194 tag, plen);
3195 return -1;
3196 }
3197
3198 /* put prefix into protocol tree */
3199 set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3200 prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 + 1 + length,
3201 ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3202 address_to_str(pinfo->pool, &addr_str), plen, path_identifier);
3203
3204 proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3205 proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, plen, "%s prefix length: %u",
3206 tag, plen);
3207 proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, &addr);
3208
3209 return(4 + 1 + length);
3210 }
3211
3212 /*
3213 * Decode an IPv6 prefix.
3214 */
3215 static int
decode_prefix6(proto_tree * tree,packet_info * pinfo,int hf_addr,tvbuff_t * tvb,gint offset,guint16 tlen,const char * tag)3216 decode_prefix6(proto_tree *tree, packet_info *pinfo, int hf_addr, tvbuff_t *tvb, gint offset,
3217 guint16 tlen, const char *tag)
3218 {
3219 proto_tree *prefix_tree;
3220 ws_in6_addr addr; /* IPv6 address */
3221 address addr_str;
3222 int plen; /* prefix length */
3223 int length; /* number of octets needed for prefix */
3224
3225 /* snarf length and prefix */
3226 plen = tvb_get_guint8(tvb, offset);
3227 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 1, &addr, plen);
3228 if (length < 0) {
3229 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid",
3230 tag, plen);
3231 return -1;
3232 }
3233
3234 /* put prefix into protocol tree */
3235 set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3236 prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3237 tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3238 address_to_str(pinfo->pool, &addr_str), plen);
3239 proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3240 tag, plen);
3241 proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 1, length, &addr);
3242 return(1 + length);
3243 }
3244
3245 static int
decode_fspec_match_prefix6(proto_tree * tree,proto_item * parent_item,int hf_addr,tvbuff_t * tvb,gint offset,guint16 tlen,packet_info * pinfo)3246 decode_fspec_match_prefix6(proto_tree *tree, proto_item *parent_item, int hf_addr,
3247 tvbuff_t *tvb, gint offset, guint16 tlen, packet_info *pinfo)
3248 {
3249 proto_tree *prefix_tree;
3250 ws_in6_addr addr; /* IPv6 address */
3251 address addr_str;
3252 int plen; /* prefix length */
3253 int length; /* number of octets needed for prefix */
3254 int poffset_place = 1;
3255 int plength_place = 0;
3256
3257 /* snarf length and prefix */
3258 plen = tvb_get_guint8(tvb, offset);
3259 if (plen == 0) /* I should be facing a draft 04 version where the prefix offset is switched with length */
3260 {
3261 plen = tvb_get_guint8(tvb, offset+1);
3262 poffset_place = 0;
3263 plength_place = 1;
3264 }
3265 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 2, &addr, plen);
3266 if (length < 0) {
3267 expert_add_info_format(pinfo, parent_item, &ei_bgp_prefix_length_err, "Length is invalid %u", plen);
3268 return -1;
3269 }
3270
3271 /* put prefix into protocol tree */
3272 set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3273 prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3274 tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3275 address_to_str(pinfo->pool, &addr_str), plen);
3276 proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_len, tvb, offset + plength_place, 1, ENC_BIG_ENDIAN);
3277 proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_offset, tvb, offset + poffset_place, 1, ENC_BIG_ENDIAN);
3278 proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 2, length, &addr);
3279 if (parent_item != NULL)
3280 proto_item_append_text(parent_item, " (%s/%u)",
3281 address_to_str(pinfo->pool, &addr_str), plen);
3282 return(2 + length);
3283 }
3284
3285 const char*
decode_bgp_rd(wmem_allocator_t * pool,tvbuff_t * tvb,gint offset)3286 decode_bgp_rd(wmem_allocator_t *pool, tvbuff_t *tvb, gint offset)
3287 {
3288 guint16 rd_type;
3289 wmem_strbuf_t *strbuf;
3290
3291 rd_type = tvb_get_ntohs(tvb,offset);
3292 strbuf = wmem_strbuf_new_label(pool);
3293
3294 switch (rd_type) {
3295 case FORMAT_AS2_LOC:
3296 wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohs(tvb, offset + 2),
3297 tvb_get_ntohl(tvb, offset + 4));
3298 break;
3299 case FORMAT_IP_LOC:
3300 wmem_strbuf_append_printf(strbuf, "%s:%u", tvb_ip_to_str(pool, tvb, offset + 2),
3301 tvb_get_ntohs(tvb, offset + 6));
3302 break ;
3303 case FORMAT_AS4_LOC:
3304 wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohl(tvb, offset + 2),
3305 tvb_get_ntohs(tvb, offset + 6));
3306 break ;
3307 default:
3308 wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) RD type",rd_type);
3309 break;
3310 } /* switch (rd_type) */
3311
3312 return wmem_strbuf_get_str(strbuf);
3313 }
3314
3315 static int
decode_mcast_vpn_nlri_addresses(proto_tree * tree,tvbuff_t * tvb,gint offset)3316 decode_mcast_vpn_nlri_addresses(proto_tree *tree, tvbuff_t *tvb,
3317 gint offset)
3318 {
3319 guint8 addr_len;
3320
3321 /* Multicast Source Address */
3322 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_length, tvb, offset,
3323 1, ENC_BIG_ENDIAN);
3324 addr_len = tvb_get_guint8(tvb, offset);
3325 if (addr_len != 0 && addr_len != 32 && addr_len != 128)
3326 return -1;
3327 offset++;
3328 switch (addr_len) {
3329 case 32:
3330 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv4, tvb,
3331 offset, 4, ENC_BIG_ENDIAN);
3332 offset += 4;
3333 break;
3334 case 128:
3335 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv6, tvb,
3336 offset, 16, ENC_NA);
3337 offset += 16;
3338 break;
3339 }
3340
3341 /* Multicast Group Address */
3342 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_length, tvb, offset,
3343 1, ENC_BIG_ENDIAN);
3344 addr_len = tvb_get_guint8(tvb, offset);
3345 if (addr_len != 0 && addr_len != 32 && addr_len != 128)
3346 return -1;
3347 offset++;
3348 switch(addr_len) {
3349 case 32:
3350 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv4, tvb,
3351 offset, 4, ENC_BIG_ENDIAN);
3352 offset += 4;
3353 break;
3354 case 128:
3355 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv6, tvb,
3356 offset, 16, ENC_NA);
3357 offset += 16;
3358 break;
3359 }
3360
3361 return offset;
3362 }
3363
3364 /*
3365 * function to decode operator in BGP flow spec NLRI when it address decimal values (TCP ports, UDP ports, ports, ...)
3366 */
3367
3368 static void
decode_bgp_flow_spec_dec_operator(proto_tree * tree,tvbuff_t * tvb,gint offset)3369 decode_bgp_flow_spec_dec_operator(proto_tree *tree, tvbuff_t *tvb, gint offset)
3370 {
3371 static int * const flags[] = {
3372 &hf_bgp_flowspec_nlri_op_eol,
3373 &hf_bgp_flowspec_nlri_op_and,
3374 &hf_bgp_flowspec_nlri_op_val_len,
3375 &hf_bgp_flowspec_nlri_op_un_bit4,
3376 &hf_bgp_flowspec_nlri_op_lt,
3377 &hf_bgp_flowspec_nlri_op_gt,
3378 &hf_bgp_flowspec_nlri_op_eq,
3379 NULL
3380 };
3381
3382 proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
3383 }
3384
3385 /*
3386 * Decode an operator and decimal values of BGP flow spec NLRI
3387 */
3388 static int
decode_bgp_nlri_op_dec_value(proto_tree * parent_tree,proto_item * parent_item,tvbuff_t * tvb,gint offset)3389 decode_bgp_nlri_op_dec_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, gint offset)
3390 {
3391 guint8 nlri_operator;
3392 guint cursor_op_val=0;
3393 guint8 value_len=0;
3394 guint value=0;
3395 guint8 shift_amount=0;
3396 guint first_loop=0;
3397
3398 proto_item_append_text(parent_item," (");
3399
3400 do {
3401 nlri_operator = tvb_get_guint8(tvb, offset+cursor_op_val);
3402 shift_amount = nlri_operator&0x30;
3403 shift_amount = shift_amount >> 4;
3404 value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
3405 /* call to a operator decode function */
3406 decode_bgp_flow_spec_dec_operator(parent_tree, tvb, offset+cursor_op_val);
3407 if (first_loop == 0)
3408 {
3409 /* If first operator we remoe a white space and or (||) is not relevant */
3410 /* BGP flow spec NLRI operator bitmask */
3411 proto_item_append_text(parent_item,"%s%s%s%s",
3412 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
3413 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3414 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3415 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3416 first_loop = 1;
3417 }
3418 else
3419 {
3420 proto_item_append_text(parent_item," %s%s%s%s",
3421 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
3422 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3423 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3424 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3425 }
3426 cursor_op_val++; /* we manage this operator we move to the value */
3427 switch (value_len) {
3428 case 1:
3429 proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_8, tvb, offset+cursor_op_val, 1,ENC_BIG_ENDIAN);
3430 value = tvb_get_guint8(tvb,offset+cursor_op_val);
3431 break;
3432 case 2:
3433 proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_16, tvb, offset+cursor_op_val, 2,ENC_BIG_ENDIAN);
3434 value = tvb_get_ntohs(tvb,offset+cursor_op_val);
3435 break;
3436 case 3:
3437 proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_32, tvb, offset+cursor_op_val, 4, ENC_BIG_ENDIAN);
3438 value = tvb_get_ntohl(tvb,offset+cursor_op_val);
3439 break;
3440 case 4:
3441 proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_64, tvb, offset+cursor_op_val, 8, ENC_BIG_ENDIAN);
3442 break;
3443 default:
3444 return -1;
3445 }
3446 cursor_op_val = cursor_op_val + value_len;
3447 proto_item_append_text(parent_item,"%u", value);
3448 } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
3449 proto_item_append_text(parent_item,")");
3450 return (cursor_op_val);
3451 }
3452
3453
3454 /*
3455 * function to decode operator in BGP flow spec NLRI when it address a bitmask values (TCP flags, fragmentation flags,...)
3456 */
3457
3458 static void
decode_bgp_flow_spec_bitmask_operator(proto_tree * tree,tvbuff_t * tvb,gint offset)3459 decode_bgp_flow_spec_bitmask_operator(proto_tree *tree, tvbuff_t *tvb, gint offset)
3460 {
3461 static int * const flags[] = {
3462 &hf_bgp_flowspec_nlri_op_eol,
3463 &hf_bgp_flowspec_nlri_op_and,
3464 &hf_bgp_flowspec_nlri_op_val_len,
3465 &hf_bgp_flowspec_nlri_op_un_bit4,
3466 &hf_bgp_flowspec_nlri_op_un_bit5,
3467 &hf_bgp_flowspec_nlri_op_flg_not,
3468 &hf_bgp_flowspec_nlri_op_flg_match,
3469 NULL
3470 };
3471
3472 proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
3473 }
3474
3475 /*
3476 * Decode an operator and tcp flags bitmask of BGP flow spec NLRI
3477 */
3478 static int
decode_bgp_nlri_op_tcpf_value(proto_tree * parent_tree,proto_item * parent_item,tvbuff_t * tvb,gint offset)3479 decode_bgp_nlri_op_tcpf_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, gint offset)
3480 {
3481 guint8 nlri_operator;
3482 guint8 tcp_flags;
3483 guint cursor_op_val=0;
3484 guint8 value_len=0;
3485 guint8 shift_amount=0;
3486 guint first_loop=0;
3487
3488 static int * const nlri_tcp_flags[] = {
3489 &hf_bgp_flowspec_nlri_tcp_flags_cwr,
3490 &hf_bgp_flowspec_nlri_tcp_flags_ecn,
3491 &hf_bgp_flowspec_nlri_tcp_flags_urg,
3492 &hf_bgp_flowspec_nlri_tcp_flags_ack,
3493 &hf_bgp_flowspec_nlri_tcp_flags_push,
3494 &hf_bgp_flowspec_nlri_tcp_flags_reset,
3495 &hf_bgp_flowspec_nlri_tcp_flags_syn,
3496 &hf_bgp_flowspec_nlri_tcp_flags_fin,
3497 NULL
3498 };
3499
3500 proto_item_append_text(parent_item," (");
3501
3502 do {
3503 nlri_operator = tvb_get_guint8(tvb, offset+cursor_op_val);
3504 shift_amount = nlri_operator&0x30;
3505 shift_amount = shift_amount >> 4;
3506 value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
3507 decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val); /* call to a operator decode function */
3508 if (first_loop == 0)
3509 {
3510 /* If first operator we remove a white space and or (||) is not relevant */
3511 proto_item_append_text(parent_item,"%s%s%s%s",
3512 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
3513 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3514 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3515 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3516 first_loop = 1;
3517 }
3518 else
3519 {
3520 proto_item_append_text(parent_item," %s%s%s%s",
3521 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
3522 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3523 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3524 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3525 }
3526 cursor_op_val++; /* we manage this operator we move to the value */
3527 if (value_len == 2) {
3528 cursor_op_val++; /* tcp flags are coded over 2 bytes only the second one is significant, we move to second byte */
3529 }
3530
3531 proto_tree_add_bitmask(parent_tree, tvb, offset+cursor_op_val, hf_bgp_flowspec_nlri_tcp_flags, ett_bgp_flow_spec_nlri_tcp, nlri_tcp_flags, ENC_NA);
3532 tcp_flags = tvb_get_guint8(tvb,offset+cursor_op_val);
3533
3534 proto_item_append_text(parent_item," %s%s%s%s%s%s",
3535 ((tcp_flags & BGPNLRI_FSPEC_TH_URG) == 0) ? "" : "U",
3536 ((tcp_flags & BGPNLRI_FSPEC_TH_ACK) == 0) ? "" : "A",
3537 ((tcp_flags & BGPNLRI_FSPEC_TH_PUSH) == 0) ? "" : "P",
3538 ((tcp_flags & BGPNLRI_FSPEC_TH_RST) == 0) ? "" : "R",
3539 ((tcp_flags & BGPNLRI_FSPEC_TH_SYN) == 0) ? "" : "S",
3540 ((tcp_flags & BGPNLRI_FSPEC_TH_FIN) == 0) ? "" : "F");
3541 cursor_op_val = cursor_op_val + value_len;
3542 } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
3543 proto_item_append_text(parent_item,")");
3544 return (cursor_op_val);
3545 }
3546
3547
3548 /*
3549 * Decode an operator and fragmentation bitmask of BGP flow spec NLRI
3550 */
3551 static int
decode_bgp_nlri_op_fflag_value(proto_tree * parent_tree,proto_item * parent_item,tvbuff_t * tvb,gint offset)3552 decode_bgp_nlri_op_fflag_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, gint offset)
3553 {
3554 guint8 nlri_operator;
3555 guint8 fragment_flags;
3556 guint cursor_op_val=0;
3557 guint8 value_len=0;
3558 guint8 shift_amount=0;
3559 guint first_loop=0;
3560
3561 static int * const nlri_flags[] = {
3562 &hf_bgp_flowspec_nlri_fflag_lf,
3563 &hf_bgp_flowspec_nlri_fflag_ff,
3564 &hf_bgp_flowspec_nlri_fflag_isf,
3565 &hf_bgp_flowspec_nlri_fflag_df,
3566 NULL
3567 };
3568
3569 proto_item_append_text(parent_item," (");
3570
3571 do {
3572 nlri_operator = tvb_get_guint8(tvb, offset+cursor_op_val);
3573 shift_amount = nlri_operator&0x30;
3574 shift_amount = shift_amount >> 4;
3575 value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
3576 /* call a function to decode operator addressing bitmaks */
3577 decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
3578 if (first_loop == 0)
3579 {
3580 /* If first operator we remove a white space and or (||) is not relevant */
3581 proto_item_append_text(parent_item,"%s%s%s%s",
3582 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
3583 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3584 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3585 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3586 first_loop = 1;
3587 }
3588 else
3589 {
3590 proto_item_append_text(parent_item," %s%s%s%s",
3591 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
3592 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3593 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3594 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3595 }
3596 cursor_op_val++; /* we manage this operator we move to the value */
3597 if (value_len != 1) {
3598 return -1; /* frag flags have to be coded in 1 byte */
3599 }
3600 fragment_flags = tvb_get_guint8(tvb,offset+cursor_op_val);
3601
3602 proto_tree_add_bitmask(parent_tree, tvb, offset+cursor_op_val, hf_bgp_flowspec_nlri_fflag, ett_bgp_flow_spec_nlri_ff, nlri_flags, ENC_NA);
3603
3604 proto_item_append_text(parent_item," %s%s%s%s",
3605 ((fragment_flags & BGPNLRI_FSPEC_FG_DF) == 0) ? "" : "DF",
3606 ((fragment_flags & BGPNLRI_FSPEC_FG_ISF) == 0) ? "" : "IsF",
3607 ((fragment_flags & BGPNLRI_FSPEC_FG_FF) == 0) ? "" : "FF",
3608 ((fragment_flags & BGPNLRI_FSPEC_FG_LF) == 0) ? "" : "LF");
3609 cursor_op_val = cursor_op_val + value_len;
3610 } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
3611 proto_item_append_text(parent_item,")");
3612 return (cursor_op_val);
3613 }
3614
3615 /*
3616 * Decode an operator and DSCP value of BGP flow spec NLRI
3617 */
3618 static int
decode_bgp_nlri_op_dscp_value(proto_tree * parent_tree,proto_item * parent_item,tvbuff_t * tvb,gint offset)3619 decode_bgp_nlri_op_dscp_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, gint offset)
3620 {
3621 guint8 nlri_operator;
3622 guint8 dscp_flags;
3623 guint cursor_op_val=0;
3624 guint8 value_len=0;
3625 guint8 shift_amount=0;
3626 guint first_loop=0;
3627
3628 proto_item_append_text(parent_item," (");
3629
3630 do {
3631 nlri_operator = tvb_get_guint8(tvb, offset+cursor_op_val);
3632 shift_amount = nlri_operator&0x30;
3633 shift_amount = shift_amount >> 4;
3634 value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
3635 /* call a function to decode operator addressing bitmaks */
3636 decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
3637 if (first_loop == 0)
3638 {
3639 /* If first operator we remove a white space and or (||) is not relevant */
3640 proto_item_append_text(parent_item,"%s%s%s%s",
3641 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
3642 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3643 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3644 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3645 first_loop = 1;
3646 }
3647 else
3648 {
3649 proto_item_append_text(parent_item," %s%s%s%s",
3650 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
3651 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3652 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3653 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3654 }
3655 cursor_op_val++; /* we manage this operator we move to the value */
3656 if (value_len != 1) {
3657 return -1; /* frag flags have to be coded in 1 byte */
3658 }
3659 dscp_flags = tvb_get_guint8(tvb,offset+cursor_op_val);
3660 proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dscp, tvb, offset+cursor_op_val, 1, ENC_BIG_ENDIAN);
3661 proto_item_append_text(parent_item,"%s",val_to_str_ext_const(dscp_flags,&dscp_vals_ext, "Unknown DSCP"));
3662 cursor_op_val = cursor_op_val + value_len;
3663 } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
3664 proto_item_append_text(parent_item,")");
3665 return (cursor_op_val);
3666 }
3667
3668
3669
3670 /*
3671 * Decode an FLOWSPEC nlri as define in RFC 5575
3672 */
3673 static int
decode_flowspec_nlri(proto_tree * tree,tvbuff_t * tvb,gint offset,guint16 afi,guint8 safi,packet_info * pinfo)3674 decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 afi, guint8 safi, packet_info *pinfo)
3675 {
3676 guint tot_flow_len; /* total length of the flow spec NLRI */
3677 guint offset_len; /* offset of the flow spec NLRI itself could be 1 or 2 bytes */
3678 guint cursor_fspec; /* cursor to move into flow spec nlri */
3679 gint filter_len = -1;
3680 guint16 len_16;
3681 guint32 rd_type;
3682 proto_item *item;
3683 proto_item *filter_item;
3684 proto_item *disting_item;
3685 proto_tree *nlri_tree;
3686 proto_tree *disting_tree;
3687 proto_tree *filter_tree;
3688
3689
3690 if (afi != AFNUM_INET && afi != AFNUM_INET6)
3691 {
3692 expert_add_info(pinfo, NULL, &ei_bgp_afi_type_not_supported);
3693 return(-1);
3694 }
3695
3696 tot_flow_len = tvb_get_guint8(tvb, offset);
3697 /* if nlri length is greater than 240 bytes, it is encoded over 2 bytes */
3698 /* with most significant nibble all in one. 240 is encoded 0xf0f0, 241 0xf0f1 */
3699 /* max possible value value is 4095 Oxffff */
3700
3701 if (tot_flow_len >= 240)
3702 {
3703 len_16 = tvb_get_ntohs(tvb, offset);
3704 tot_flow_len = len_16 & 0x0FFF; /* remove most significant nibble */
3705 offset_len = 2;
3706 } else {
3707 offset_len = 1;
3708 }
3709
3710 item = proto_tree_add_item(tree, hf_bgp_flowspec_nlri_t, tvb, offset,
3711 tot_flow_len+offset_len, ENC_NA);
3712 proto_item_set_text(item, "FLOW_SPEC_NLRI (%u byte%s)",
3713 tot_flow_len+offset_len, plurality(tot_flow_len+offset_len, "", "s"));
3714
3715 nlri_tree = proto_item_add_subtree(item, ett_bgp_flow_spec_nlri);
3716
3717 proto_tree_add_uint(nlri_tree, hf_bgp_flowspec_nlri_length, tvb, offset,
3718 offset_len, tot_flow_len);
3719
3720 offset = offset + offset_len;
3721 cursor_fspec = 0;
3722
3723 /* when SAFI is VPN Flow Spec, then write route distinguisher */
3724 if (safi == SAFNUM_FSPEC_VPN_RULE)
3725 {
3726 disting_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_route_distinguisher,
3727 tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
3728 disting_tree = proto_item_add_subtree(disting_item, ett_bgp_flow_spec_nlri);
3729 proto_tree_add_item_ret_uint(disting_tree, hf_bgp_flowspec_nlri_route_distinguisher_type,
3730 tvb, offset, 2, ENC_BIG_ENDIAN, &rd_type);
3731 /* Route Distinguisher Type */
3732 switch (rd_type) {
3733 case FORMAT_AS2_LOC:
3734 proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
3735 tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3736 proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_4,
3737 tvb, offset + 4, 4, ENC_BIG_ENDIAN);
3738 break;
3739
3740 case FORMAT_IP_LOC:
3741 proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
3742 tvb, offset + 2, 4, ENC_BIG_ENDIAN);
3743 proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
3744 tvb, offset + 6, 2, ENC_BIG_ENDIAN);
3745 break;
3746
3747 case FORMAT_AS4_LOC:
3748 proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
3749 tvb, offset + 2, 4, ENC_BIG_ENDIAN);
3750 proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
3751 tvb, offset + 6, 2, ENC_BIG_ENDIAN);
3752 break;
3753
3754 default:
3755 expert_add_info_format(pinfo, disting_tree, &ei_bgp_length_invalid,
3756 "Unknown Route Distinguisher type (%u)", rd_type);
3757 }
3758 cursor_fspec += BGP_ROUTE_DISTINGUISHER_SIZE;
3759 }
3760
3761 while (cursor_fspec < tot_flow_len)
3762 {
3763 filter_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_filter, tvb, offset+cursor_fspec, 1, ENC_NA);
3764 filter_tree = proto_item_add_subtree(filter_item, ett_bgp_flow_spec_nlri_filter);
3765 proto_tree_add_item(filter_tree, hf_bgp_flowspec_nlri_filter_type, tvb, offset+cursor_fspec, 1, ENC_BIG_ENDIAN);
3766 proto_item_append_text(filter_item, ": %s", val_to_str(tvb_get_guint8(tvb,offset+cursor_fspec), flowspec_nlri_opvaluepair_type, "Unknown filter %d"));
3767 switch (tvb_get_guint8(tvb,offset+cursor_fspec)) {
3768 case BGPNLRI_FSPEC_DST_PFIX:
3769 cursor_fspec++;
3770 if (afi == AFNUM_INET)
3771 filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_dst_pref_ipv4,
3772 tvb, offset+cursor_fspec, "Destination IP filter");
3773 else /* AFNUM_INET6 */
3774 filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_dst_ipv6_pref,
3775 tvb, offset+cursor_fspec, 0, pinfo);
3776 if (filter_len == -1)
3777 cursor_fspec= tot_flow_len;
3778 break;
3779 case BGPNLRI_FSPEC_SRC_PFIX:
3780 cursor_fspec++;
3781 if (afi == AFNUM_INET)
3782 filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_src_pref_ipv4,
3783 tvb, offset+cursor_fspec, "Source IP filter");
3784 else /* AFNUM_INET6 */
3785 filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_src_ipv6_pref,
3786 tvb, offset+cursor_fspec, 0, pinfo);
3787 if (filter_len == -1)
3788 cursor_fspec= tot_flow_len;
3789 break;
3790 case BGPNLRI_FSPEC_IP_PROTO:
3791 cursor_fspec++;
3792 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3793 break;
3794 case BGPNLRI_FSPEC_PORT:
3795 cursor_fspec++;
3796 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3797 break;
3798 case BGPNLRI_FSPEC_DST_PORT:
3799 cursor_fspec++;
3800 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3801 break;
3802 case BGPNLRI_FSPEC_SRC_PORT:
3803 cursor_fspec++;
3804 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3805 break;
3806 case BGPNLRI_FSPEC_ICMP_TP:
3807 cursor_fspec++;
3808 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3809 break;
3810 case BGPNLRI_FSPEC_ICMP_CD:
3811 cursor_fspec++;
3812 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3813 break;
3814 case BGPNLRI_FSPEC_TCP_FLAGS:
3815 cursor_fspec++;
3816 filter_len = decode_bgp_nlri_op_tcpf_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3817 break;
3818 case BGPNLRI_FSPEC_PCK_LEN:
3819 cursor_fspec++;
3820 filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3821 break;
3822 case BGPNLRI_FSPEC_DSCP:
3823 cursor_fspec++;
3824 filter_len = decode_bgp_nlri_op_dscp_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3825 break;
3826 case BGPNLRI_FSPEC_FRAGMENT:
3827 cursor_fspec++;
3828 filter_len = decode_bgp_nlri_op_fflag_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
3829 break;
3830 default:
3831 return -1;
3832 }
3833 if (filter_len>0)
3834 cursor_fspec += filter_len;
3835 else
3836 break;
3837 proto_item_set_len(filter_item,filter_len+1);
3838 }
3839 return(tot_flow_len+offset_len-1);
3840 }
3841
3842 /*
3843 * Decode an MCAST-VPN nlri as defined in draft-ietf-l3vpn-2547bis-mcast-bgp-08.txt .
3844 */
3845 static int
decode_mcast_vpn_nlri(proto_tree * tree,tvbuff_t * tvb,gint offset,guint16 afi,packet_info * pinfo)3846 decode_mcast_vpn_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 afi, packet_info *pinfo)
3847 {
3848 guint8 route_type, length, ip_length;
3849 proto_item *item;
3850 proto_tree *nlri_tree;
3851 guint32 route_key_length;
3852 int ret;
3853
3854 ip_length = (afi == AFNUM_INET) ? 4 : 16;
3855
3856 route_type = tvb_get_guint8(tvb, offset);
3857 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_route_type, tvb,
3858 offset, 1, ENC_BIG_ENDIAN);
3859 offset++;
3860
3861 length = tvb_get_guint8(tvb, offset);
3862 proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_length, tvb, offset,
3863 1, ENC_BIG_ENDIAN);
3864 offset++;
3865
3866 if (length > tvb_reported_length_remaining(tvb, offset))
3867 return -1;
3868
3869 item = proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_t, tvb, offset,
3870 length, ENC_NA);
3871 proto_item_set_text(item, "%s (%u byte%s)",
3872 val_to_str_const(route_type, mcast_vpn_route_type, "Unknown"),
3873 length, plurality(length, "", "s"));
3874
3875 nlri_tree = proto_item_add_subtree(item, ett_bgp_mcast_vpn_nlri);
3876
3877 switch (route_type) {
3878 case MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD:
3879 item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
3880 offset, BGP_ROUTE_DISTINGUISHER_SIZE,
3881 ENC_NA);
3882 proto_item_set_text(item, "Route Distinguisher: %s",
3883 decode_bgp_rd(pinfo->pool, tvb, offset));
3884 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
3885
3886 if (afi == AFNUM_INET)
3887 proto_tree_add_item(nlri_tree,
3888 hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
3889 tvb, offset, ip_length, ENC_BIG_ENDIAN);
3890 else
3891 proto_tree_add_item(nlri_tree,
3892 hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
3893 tvb, offset, ip_length, ENC_NA);
3894 break;
3895
3896 case MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD:
3897 item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
3898 offset, BGP_ROUTE_DISTINGUISHER_SIZE,
3899 ENC_NA);
3900 proto_item_set_text(item, "Route Distinguisher: %s",
3901 decode_bgp_rd(pinfo->pool, tvb, offset));
3902 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
3903
3904 proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
3905 offset, 4, ENC_BIG_ENDIAN);
3906 break;
3907
3908 case MCAST_VPN_RTYPE_SPMSI_AD:
3909 item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
3910 offset, BGP_ROUTE_DISTINGUISHER_SIZE,
3911 ENC_NA);
3912 proto_item_set_text(item, "Route Distinguisher: %s",
3913 decode_bgp_rd(pinfo->pool, tvb, offset));
3914 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
3915
3916 ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
3917 if (ret < 0)
3918 return -1;
3919
3920 offset = ret;
3921
3922 if (afi == AFNUM_INET)
3923 proto_tree_add_item(nlri_tree,
3924 hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
3925 tvb, offset, ip_length, ENC_BIG_ENDIAN);
3926 else
3927 proto_tree_add_item(nlri_tree,
3928 hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
3929 tvb, offset, ip_length, ENC_NA);
3930 break;
3931
3932 case MCAST_VPN_RTYPE_LEAF_AD:
3933 route_key_length = length - ip_length;
3934 item = proto_tree_add_item(nlri_tree,
3935 hf_bgp_mcast_vpn_nlri_route_key, tvb,
3936 offset, route_key_length, ENC_NA);
3937 proto_item_set_text(item, "Route Key (%u byte%s)", route_key_length,
3938 plurality(route_key_length, "", "s"));
3939 offset += route_key_length;
3940
3941 if (afi == AFNUM_INET)
3942 proto_tree_add_item(nlri_tree,
3943 hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
3944 tvb, offset, ip_length, ENC_BIG_ENDIAN);
3945 else
3946 proto_tree_add_item(nlri_tree,
3947 hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
3948 tvb, offset, ip_length, ENC_NA);
3949 break;
3950
3951 case MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD:
3952 item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
3953 offset, BGP_ROUTE_DISTINGUISHER_SIZE,
3954 ENC_NA);
3955 proto_item_set_text(item, "Route Distinguisher: %s",
3956 decode_bgp_rd(pinfo->pool, tvb, offset));
3957 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
3958
3959 ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
3960 if (ret < 0)
3961 return -1;
3962 break;
3963
3964 case MCAST_VPN_RTYPE_SHARED_TREE_JOIN:
3965 case MCAST_VPN_RTYPE_SOURCE_TREE_JOIN:
3966 item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
3967 offset, BGP_ROUTE_DISTINGUISHER_SIZE,
3968 ENC_NA);
3969 proto_item_set_text(item, "Route Distinguisher: %s",
3970 decode_bgp_rd(pinfo->pool, tvb, offset));
3971 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
3972
3973 proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
3974 offset, 4, ENC_BIG_ENDIAN);
3975 offset += 4;
3976
3977 ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
3978 if (ret < 0)
3979 return -1;
3980 break;
3981 }
3982
3983 /* route type field (1 byte) + length field (1 byte) + length */
3984 return 2 + length;
3985 }
3986
3987 /*
3988 * Decode an SR Policy SAFI as defined in draft-ietf-idr-segment-routing-te-policy-08
3989 */
3990 static int
decode_sr_policy_nlri(proto_tree * tree,tvbuff_t * tvb,gint offset,guint16 afi)3991 decode_sr_policy_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 afi)
3992 {
3993 proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_length, tvb, offset, 1, ENC_BIG_ENDIAN);
3994 offset += 1;
3995 proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_distinguisher, tvb, offset, 4, ENC_NA);
3996 offset += 4;
3997 proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_policy_color, tvb, offset, 4, ENC_NA);
3998 offset += 4;
3999 if (afi == AFNUM_INET) {
4000 proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
4001 return 13;
4002 } else {
4003 proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v6, tvb, offset, 4, ENC_NA);
4004 return 25;
4005 }
4006 }
4007
4008 /*
4009 * Decodes an MDT-SAFI message.
4010 */
4011 static guint
decode_mdt_safi(packet_info * pinfo,proto_tree * tree,tvbuff_t * tvb,gint offset)4012 decode_mdt_safi(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, gint offset)
4013 {
4014 const guint ip_length = 4;
4015 const guint mdt_safi_nlri_length_bits = 128;
4016 guint length; /* length in bits */
4017 gint orig_offset = offset;
4018 proto_item *item;
4019
4020 length = tvb_get_guint8(tvb, offset);
4021 if (length != mdt_safi_nlri_length_bits)
4022 return -1;
4023 offset++;
4024
4025 item = proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_rd, tvb,
4026 offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4027 proto_item_set_text(item, "Route Distinguisher: %s",
4028 decode_bgp_rd(pinfo->pool, tvb, offset));
4029 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4030
4031 proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_ipv4_addr, tvb,
4032 offset, ip_length, ENC_BIG_ENDIAN);
4033 offset += ip_length;
4034
4035 proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_group_addr, tvb,
4036 offset, ip_length, ENC_BIG_ENDIAN);
4037 offset += ip_length;
4038
4039 return offset - orig_offset;
4040 }
4041
4042 /*
4043 * Decode an MPLS label stack
4044 * XXX - We should change *buf to **buf, use wmem_alloc() and drop the buflen
4045 * argument.
4046 */
4047 static guint
decode_MPLS_stack(tvbuff_t * tvb,gint offset,wmem_strbuf_t * stack_strbuf)4048 decode_MPLS_stack(tvbuff_t *tvb, gint offset, wmem_strbuf_t *stack_strbuf)
4049 {
4050 guint32 label_entry; /* an MPLS label entry (label + COS field + stack bit */
4051 gint indx; /* index for the label stack */
4052
4053 indx = offset ;
4054 label_entry = 0x000000 ;
4055
4056 wmem_strbuf_truncate(stack_strbuf, 0);
4057
4058 while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4059
4060 label_entry = tvb_get_ntoh24(tvb, indx) ;
4061
4062 /* withdrawn routes may contain 0 or 0x800000 in the first label */
4063 if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4064 wmem_strbuf_append(stack_strbuf, "0 (withdrawn)");
4065 return (1);
4066 }
4067
4068 wmem_strbuf_append_printf(stack_strbuf, "%u%s", label_entry >> 4,
4069 ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4070
4071 indx += 3 ;
4072 }
4073
4074 return((indx - offset) / 3);
4075 }
4076
4077 static guint
decode_MPLS_stack_tree(tvbuff_t * tvb,gint offset,proto_tree * parent_tree)4078 decode_MPLS_stack_tree(tvbuff_t *tvb, gint offset, proto_tree *parent_tree)
4079 {
4080 guint32 label_entry=0; /* an MPLS label entry (label + COS field + stack bit) */
4081 gint indx; /* index for the label stack */
4082 proto_tree *labels_tree=NULL;
4083 proto_item *labels_item=NULL;
4084 proto_item *label_item=NULL;
4085 indx = offset ;
4086 label_entry = 0x000000 ;
4087
4088 labels_item = proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label, tvb, offset, 3, ENC_NA);
4089 proto_item_append_text(labels_item, ": ");
4090 labels_tree = proto_item_add_subtree(labels_item, ett_bgp_mpls_labels);
4091 while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4092
4093 label_entry = tvb_get_ntoh24(tvb, indx);
4094 label_item = proto_tree_add_item(labels_tree, hf_bgp_update_mpls_label_value, tvb, indx, 3, ENC_BIG_ENDIAN);
4095 /* withdrawn routes may contain 0 or 0x800000 in the first label */
4096 if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4097 proto_item_append_text(labels_item, " (withdrawn)");
4098 proto_item_append_text(label_item, " (withdrawn)");
4099 return (1);
4100 }
4101
4102 proto_item_append_text(labels_item, "%u%s", label_entry >> 4,
4103 ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4104 proto_item_append_text(label_item, "%u%s", label_entry >> 4,
4105 ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4106 indx += 3 ;
4107
4108 if ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4109 /* real MPLS multi-label stack in BGP? - maybe later; for now, it must be a bogus packet */
4110 proto_item_append_text(labels_item, " (BOGUS: Bottom of Stack NOT set!)");
4111 break;
4112 }
4113 }
4114 proto_item_set_len(labels_item, (indx - offset));
4115 return((indx - offset) / 3);
4116 }
4117
4118 /*
4119 * Decode a multiprotocol next hop address that expected to be IPv4.
4120 * Returns 0 on failure (invalid length).
4121 */
4122 static int
decode_mp_next_hop_ipv4(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo _U_,wmem_strbuf_t * strbuf,gint nhlen)4123 decode_mp_next_hop_ipv4(tvbuff_t *tvb, proto_tree *tree, gint offset, packet_info *pinfo _U_, wmem_strbuf_t *strbuf, gint nhlen)
4124 {
4125 switch (nhlen) {
4126 case (FT_IPv4_LEN):
4127 proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4128 wmem_strbuf_append(strbuf, tvb_ip_to_str(pinfo->pool, tvb, offset));
4129 break;
4130 default:
4131 return 0;
4132 }
4133 return nhlen;
4134 }
4135
4136 /*
4137 * Decode a multiprotocol next hop address expected to be VPN-IPv4.
4138 * Note that the Route Distinguisher is always 0. Returns 0 on failure
4139 * (invalid length).
4140 */
4141 static int
decode_mp_next_hop_vpn_ipv4(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,wmem_strbuf_t * strbuf,gint nhlen)4142 decode_mp_next_hop_vpn_ipv4(tvbuff_t *tvb, proto_tree *tree, gint offset, packet_info *pinfo, wmem_strbuf_t *strbuf, gint nhlen)
4143 {
4144 proto_item *ti;
4145 const char *rd_string;
4146 const guint8 rd_zero[] = {0x00, 0x00, 0x00, 0x00,
4147 0x00, 0x00, 0x00, 0x00 };
4148
4149 switch (nhlen) {
4150 case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv4_LEN):
4151 rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4152 ti = proto_tree_add_string(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd, tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, rd_string);
4153 if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4154 expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4155 }
4156 wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4157 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4158 proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4159 wmem_strbuf_append_printf(strbuf, " IPv4=%s", tvb_ip_to_str(pinfo->pool, tvb, offset));
4160 break;
4161 default:
4162 return 0;
4163 }
4164 return nhlen;
4165 }
4166
4167 /*
4168 * Decode a multiprotocol next hop address that is expected to be IPv6,
4169 * optionally including a second, link-local, address, differentiating by
4170 * length. Returns 0 on failure (invalid length).
4171 */
4172 static int
decode_mp_next_hop_ipv6(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,wmem_strbuf_t * strbuf,gint nhlen)4173 decode_mp_next_hop_ipv6(tvbuff_t *tvb, proto_tree *tree, gint offset, packet_info *pinfo, wmem_strbuf_t *strbuf, gint nhlen)
4174 {
4175 proto_item *ti;
4176 ws_in6_addr ipv6_addr;
4177 char ipv6_buffer[WS_INET6_ADDRSTRLEN];
4178
4179 switch (nhlen) {
4180 case (FT_IPv6_LEN):
4181 proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4182 wmem_strbuf_append(strbuf, tvb_ip6_to_str(pinfo->pool, tvb, offset));
4183 break;
4184 case (2*FT_IPv6_LEN):
4185 /* global address followed by link-local */
4186 proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4187 wmem_strbuf_append_printf(strbuf, "IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4188 offset += FT_IPv6_LEN;
4189 ti = proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local, tvb, offset, FT_IPv6_LEN, ENC_NA);
4190 tvb_get_ipv6(tvb, offset, &ipv6_addr);
4191 if (!in6_addr_is_linklocal(&ipv6_addr)) {
4192 expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4193 }
4194 ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4195 wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4196 break;
4197 default:
4198 return 0;
4199 }
4200 return nhlen;
4201 }
4202
4203 /*
4204 * Decode a multiprotocol next hop address that is expected to be VPN-IPv6,
4205 * optionally including a second, link-local, address. Note that the Route
4206 * Distinguisher is always 0. Returns 0 on failure (invalid length).
4207 */
4208 static int
decode_mp_next_hop_vpn_ipv6(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,wmem_strbuf_t * strbuf,gint nhlen)4209 decode_mp_next_hop_vpn_ipv6(tvbuff_t *tvb, proto_tree *tree, gint offset, packet_info *pinfo, wmem_strbuf_t *strbuf, gint nhlen)
4210 {
4211 proto_item *ti;
4212 const char *rd_string;
4213 const guint8 rd_zero[] = {0x00, 0x00, 0x00, 0x00,
4214 0x00, 0x00, 0x00, 0x00 };
4215 ws_in6_addr ipv6_addr;
4216 char ipv6_buffer[WS_INET6_ADDRSTRLEN];
4217
4218 switch (nhlen) {
4219 case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN):
4220 rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4221 ti = proto_tree_add_string(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd, tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, rd_string);
4222 if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4223 expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4224 }
4225 wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4226 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4227 proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4228 wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4229 break;
4230 case (2*(BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN)):
4231 rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4232 ti = proto_tree_add_string(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd, tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, rd_string);
4233 if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4234 expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4235 }
4236 wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4237 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4238 proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4239 wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4240 offset += FT_IPv6_LEN;
4241 rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4242 ti = proto_tree_add_string(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd, tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, rd_string);
4243 if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4244 expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4245 }
4246 wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4247 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4248 ti = proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local, tvb, offset, FT_IPv6_LEN, ENC_NA);
4249 tvb_get_ipv6(tvb, offset, &ipv6_addr);
4250 if (!in6_addr_is_linklocal(&ipv6_addr)) {
4251 expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4252 }
4253 ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4254 wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4255 break;
4256 default:
4257 return 0;
4258 }
4259 return nhlen;
4260 }
4261
4262 /*
4263 * Decode a multiprotocol next hop address
4264 */
4265 static int
decode_mp_next_hop(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo,guint16 afi,guint8 safi,gint nhlen)4266 decode_mp_next_hop(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint16 afi, guint8 safi, gint nhlen)
4267 {
4268 proto_item *ti;
4269 proto_tree *next_hop_t;
4270 int length, offset = 0;
4271 wmem_strbuf_t *strbuf;
4272
4273 strbuf = wmem_strbuf_new_label(pinfo->pool);
4274
4275 /* BGP Multiprotocol Next Hop Principles
4276 *
4277 * BGP Multiprotocol support is specified over a large variety of
4278 * RFCs for different <AFI, SAFI> pairs, which leaves some theoretical
4279 * pairings undefined (e.g., the Abstract of RFC 4760 contemplates
4280 * supporting the IPX address family) as well as leading to some
4281 * omissions, contradictions, and inconsistencies. However, some general
4282 * principles that apply across (nearly) all extant pairs exist.
4283 *
4284 * 1. Global IPv6 addresses can be followed by a link-local IPv6 address
4285 *
4286 * RFC 2545 specifies in section 3, "Constructing the Next Hop field,"
4287 * that when the next hop address type is IPv6, the address given should
4288 * be in global (or site-local) unicast address scope, and it shall be
4289 * followed by the link-local address if and only if the BGP speaker shares
4290 * a common subnet with the address and the peer the route is being
4291 * advertised to.
4292 *
4293 * The wording implies that this holds for any <AFI, SAFI> pair where
4294 * a IPv6 address is used, and RFCs 5549, 7752, and 8950 demonstrate that
4295 * this explicitly holds for the most common ones, including for VPN-IPv6
4296 * addresses (where the route distinguisher field also appears, see
4297 * RFC 4659). Sometimes the possibility is elided where it is known to
4298 * exist e.g. RFC 7606 7.11 MP_REACH_NLRI "For example, if RFC5549 is in
4299 * use, then the next hop would have to have a length of 4 or 16." Thus
4300 * it is possible that its omission in other RFCs covering new <AFI, SAFI>
4301 * pairs is an oversight.
4302 *
4303 * 2. [VPN-]IPv4 NLRI can have [VPN-]IPv6 Next Hop addresses
4304 *
4305 * RFCs 5549 and 8950 declare that the next hop address may not necessarily
4306 * belong to the address family specified by the AFI, updating RFC 2858,
4307 * specifically addressing the case of IPv6 islands across a IPv4 core
4308 * and vice versa.
4309 *
4310 * IPv4 addresses can easily be mapped into IPv6 addresses, and that
4311 * is the solution for one case, but in the other the Next Hop must be an
4312 * IPv6 (or VPN-IPv6) address even though the NLRI is IPv4.
4313 *
4314 * The wording of RFC 8950 strongly implies that the intent is to allow
4315 * IPv6 Net Hop addresses for any case of IPv4 or VPN-IPv4 NLRI, providing
4316 * a BGP Capability to declare that the BGP speakers supports a different
4317 * Next Hop AFI for <AFI, SAFI> pairs defined without this capability,
4318 * and noting those (like <1, 132>, SAFNUM_ROUTE_TARGET, RFC 4684) that
4319 * consider the possibility from the start.
4320 *
4321 * 3. Next Hop Route Distinguisher (RD) is 0 or omitted
4322 *
4323 * RDs do not have a meaning in the Next Hop network address. However, when
4324 * RFC 2547 introduced the VPN-IPv4 address family, at that point the Next
4325 * Hop address family had to be the same as the NLRI address family, so the
4326 * RD was set to all 0. Later defined <AFI, SAFI> pairs with RDs in their
4327 * NLRI have either used this custom of a 0 RD, or else omitted it and
4328 * only had the IP address in the Next Hop.
4329 */
4330
4331 ti = proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop, tvb, offset, nhlen + 1, ENC_NA);
4332 next_hop_t = proto_item_add_subtree(ti, ett_bgp_mp_nhna);
4333 offset += 1;
4334
4335 switch (afi) {
4336 case AFNUM_INET:
4337 switch (safi) {
4338 case SAFNUM_UNICAST: /* RFC 8950 */
4339 case SAFNUM_MULCAST: /* RFC 8950 */
4340 case SAFNUM_UNIMULC: /* Deprecated, but as above */
4341 case SAFNUM_MPLS_LABEL: /* RFC 8277 */
4342 case SAFNUM_MCAST_VPN: /* RFC 6514 */
4343 case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used"
4344 * according to
4345 * draft-ietf-idr-tunnel-encaps-22
4346 */
4347 case SAFNUM_ROUTE_TARGET: /* RFC 4684 */
4348 /* IPv4 or IPv6, differentiated by field length, according
4349 * to the RFCs cited above. RFC 8950 explicitly addresses
4350 * the possible link-local IPv6 address. RFC 6514 depending
4351 * on the situation either the Next Hop MUST be the same
4352 * as in the IP Address field lower in the network stack,
4353 * or simply SHOULD be "a routeable address" of the ASBR/
4354 * local PE. */
4355 if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4356 length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4357 }
4358 break;
4359 case SAFNUM_TUNNEL:
4360 /* Internet Draft draft-nalawade-kapoor-tunnel-safi-05
4361 * long expired, but "[NLRI] network address... SHOULD be
4362 * the same as the [Next Hop] network address."
4363 */
4364 length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4365 break;
4366 case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
4367 case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
4368 case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
4369 /* RFC 8950 indicates that the next hop can be VPN-IPv4 or
4370 * VPN-IPv6 (with RD all 0), and in the latter case the
4371 * link-local IPv6 address can be included. Note that RFC
4372 * 5549 incorrectly did not include the RD in the Next Hop
4373 * for VPN-IPv6 (see Erratum ID 5253), but according to
4374 * RFC 8950 2. "Changes Compared to RFC 5549":
4375 * "As all known and deployed implementations are
4376 * interoperable today and use the new proposed encoding,
4377 * the change does not break existing interoperability,"
4378 * and thus we need not test for a missing RD.
4379 */
4380 if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4381 length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4382 }
4383 break;
4384 default:
4385 length = 0;
4386 expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
4387 "Unknown SAFI (%u) for AFI %u", safi, afi);
4388 break;
4389 } /* switch (safi) */
4390 break;
4391 case AFNUM_INET6:
4392 switch (safi) {
4393 case SAFNUM_UNICAST: /* RFC 8950 */
4394 case SAFNUM_MULCAST: /* RFC 8950 */
4395 case SAFNUM_UNIMULC: /* Deprecated, but as above */
4396 case SAFNUM_MPLS_LABEL: /* RFC 8277 */
4397 case SAFNUM_MCAST_VPN: /* RFC 6514 */
4398 case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used" */
4399 case SAFNUM_TUNNEL: /* Expired Internet Draft */
4400 /* IPv6 address, possibly followed by link-local address */
4401 length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4402 break;
4403 case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
4404 case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
4405 case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
4406 /* VPN-IPv6 address, possibly followed by link-local addr */
4407 length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4408 break;
4409 default:
4410 length = 0;
4411 expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
4412 "Unknown SAFI (%u) for AFI %u", safi, afi);
4413 break;
4414 } /* switch (safi) */
4415 break;
4416 case AFNUM_L2VPN:
4417 case AFNUM_L2VPN_OLD:
4418 switch (safi) {
4419 /* XXX: Do these first three really appear with L2VPN AFI? */
4420 case SAFNUM_LAB_VPNUNICAST:
4421 case SAFNUM_LAB_VPNMULCAST:
4422 case SAFNUM_LAB_VPNUNIMULC:
4423 case SAFNUM_VPLS: /* RFC 4761 (VPLS) and RFC 6074 (BGP-AD) */
4424 case SAFNUM_EVPN: /* RFC 7432 */
4425 /* The RFCs above specify that the next-hop is simply the
4426 * address of the PE (loopback address in some cases for
4427 * BGP-AD), either IPv4 or IPv6, differentiated by length.
4428 * A RD is included in the NLRI in these cases, but not in
4429 * the Next Hop address unlike in AFI 1 or 2.
4430 */
4431 if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen) == 0)) {
4432 length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4433 }
4434 break;
4435 default:
4436 length = 0;
4437 expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
4438 "Unknown SAFI (%u) for AFI %u", safi, afi);
4439 break;
4440 } /* switch (safi) */
4441 break;
4442 case AFNUM_BGP_LS:
4443 /* RFC 7752 section 3.4 "BGP Next-Hop Information" explains that
4444 * the next-hop address length field specifes the next-hop address
4445 * family. "If the next-hop length is 4, then the next hop is an
4446 * IPv4 address; if the next-hop length is 16, then it is a global
4447 * IPv6 address; and if the next-hop length is 32, then there is
4448 * one global IPv6 address followed by a link-local IPv6 address"
4449 */
4450 switch (safi) {
4451 case SAFNUM_BGP_LS:
4452 if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4453 length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4454 }
4455 break;
4456 case SAFNUM_BGP_LS_VPN:
4457 /* RFC 7752 3.4: "For VPN SAFI, as per custom, an 8-byte
4458 * Route Distinguisher set to all zero is prepended to the
4459 * next hop."
4460 */
4461 if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4462 length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4463 }
4464 break;
4465 default:
4466 length = 0;
4467 expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
4468 "Unknown SAFI (%u) for AFI %u", safi, afi);
4469 break;
4470 } /* switch (safi) */
4471 break;
4472 default:
4473 length = 0;
4474 expert_add_info(pinfo, ti, &ei_bgp_unknown_afi);
4475 break;
4476 } /* switch (af) */
4477
4478 if (length) {
4479 proto_item_append_text(ti, ": %s", wmem_strbuf_get_str(strbuf));
4480 } else {
4481 expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid, "Unknown Next Hop length (%u byte%s)", nhlen, plurality(nhlen, "", "s"));
4482 proto_item_append_text(ti, ": %s", tvb_bytes_to_str(pinfo->pool, tvb, offset, nhlen));
4483 }
4484
4485 return length;
4486 }
4487
decode_bgp_link_node_descriptor(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,int length)4488 static int decode_bgp_link_node_descriptor(tvbuff_t *tvb, proto_tree *tree, gint offset, packet_info *pinfo, int length)
4489 {
4490 guint16 sub_length;
4491 guint16 type;
4492 guint16 diss_length;
4493
4494 proto_item* tlv_item;
4495 proto_tree* tlv_tree;
4496
4497 diss_length = 0;
4498
4499 while (length > 0 ) {
4500 if (length < 4) {
4501 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4502 "Unknown data in Link-State Link NLRI!");
4503 diss_length += length;
4504 break;
4505 }
4506 type = tvb_get_ntohs(tvb, offset);
4507 sub_length = tvb_get_ntohs(tvb, offset + 2);
4508
4509 switch (type) {
4510 case BGP_NLRI_TLV_AUTONOMOUS_SYSTEM:
4511 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_autonomous_system, tvb, offset, sub_length+4, ENC_NA);
4512 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4513 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4514 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4515 if (sub_length != BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM) {
4516 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4517 "Autonomous system TLV length should be %u bytes! (%u)",
4518 BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM, sub_length);
4519 break;
4520 }
4521 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_autonomous_system_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4522 break;
4523 case BGP_NLRI_TLV_BGP_LS_IDENTIFIER:
4524 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_ls_identifier, tvb, offset, sub_length+4, ENC_NA);
4525 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4526 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4527 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4528 if (sub_length != BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER) {
4529 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4530 "BGP-LS TLV length should be %u bytes! (%u)",
4531 BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER, sub_length);
4532 break;
4533 }
4534 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_ls_identifier_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4535 break;
4536 case BGP_NLRI_TLV_AREA_ID:
4537 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_area_id, tvb, offset, sub_length+4, ENC_NA);
4538 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4539 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4540 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4541 if (sub_length != BGP_NLRI_TLV_LEN_AREA_ID) {
4542 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4543 "Area ID TLV length should be %u bytes! (%u)",
4544 BGP_NLRI_TLV_LEN_AREA_ID, sub_length);
4545 break;
4546 }
4547 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_area_id_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4548 break;
4549 case BGP_NLRI_TLV_IGP_ROUTER_ID:
4550 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_router, tvb, offset, sub_length+4, ENC_NA);
4551 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4552 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4553 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4554 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_router_id, tvb, offset + 4, sub_length, ENC_NA);
4555 break;
4556 case BGP_NLRI_TLV_BGP_ROUTER_ID:
4557 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_router_id, tvb, offset, sub_length+4, ENC_NA);
4558 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4559 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4560 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4561 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_router_id_id, tvb, offset + 4, sub_length, ENC_NA);
4562 break;
4563 default:
4564 expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn, "Undefined node Descriptor Sub-TLV type (%u)!", type);
4565 }
4566
4567 length -= 4 + sub_length;
4568 offset += 4 + sub_length;
4569 diss_length += 4 + sub_length;
4570 }
4571 return diss_length;
4572 }
4573
4574
4575 /*
4576 * Decode BGP Link State Local and Remote NODE Descriptors
4577 */
decode_bgp_link_node_nlri_tlvs(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,guint16 expected_sub_tlv)4578 static int decode_bgp_link_node_nlri_tlvs(tvbuff_t *tvb, proto_tree *tree, gint offset, packet_info *pinfo, guint16 expected_sub_tlv)
4579 {
4580 guint16 length;
4581 guint16 type;
4582 proto_tree* tlv_tree;
4583 proto_item* tlv_item;
4584
4585 type = tvb_get_ntohs(tvb, offset);
4586 length = tvb_get_ntohs(tvb, offset + 2);
4587
4588 if (expected_sub_tlv != type) {
4589 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error, "Expected/actual tlv mismatch, expected: %u, actual: %u", expected_sub_tlv, type);
4590 }
4591
4592 switch(type){
4593
4594 /*local and remote node descriptors */
4595 case BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS:
4596 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_local_node_descriptors, tvb, offset, length+4, ENC_NA);
4597 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4598 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4599 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4600 decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
4601 break;
4602
4603 case BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS:
4604 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_remote_node_descriptors, tvb, offset, length+4, ENC_NA);
4605 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4606 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4607 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4608 decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
4609 break;
4610 }
4611
4612 return length +4 ;
4613 }
4614
4615 /*
4616 * Dissect Link and Node NLRI common fields (Protocol-ID, Identifier, Local Node Desc.)
4617 */
decode_bgp_link_node_nlri_common_fields(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,int length)4618 static int decode_bgp_link_node_nlri_common_fields(tvbuff_t *tvb,
4619 proto_tree *tree, gint offset, packet_info *pinfo, int length) {
4620 int dissected_length;
4621 int tmp_length;
4622
4623 /* dissect Link NLRI header */
4624 if (length < 12) {
4625 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4626 "Link State NLRI length is lower than 12 bytes! (%d)", length);
4627 return length;
4628 }
4629
4630 proto_tree_add_item(tree, hf_bgp_ls_nlri_node_protocol_id, tvb, offset, 1, ENC_BIG_ENDIAN);
4631 save_link_state_protocol_id(pinfo, tvb_get_guint8(tvb, offset));
4632 proto_tree_add_item(tree, hf_bgp_ls_nlri_node_identifier, tvb, offset + 1, 8, ENC_BIG_ENDIAN);
4633
4634 dissected_length = 9;
4635 offset += dissected_length;
4636 length -= dissected_length;
4637
4638 /* dissect Local Node Descriptors TLV */
4639 if (length > 0 && length < 4) {
4640 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4641 "Unknown data in Link-State Link NLRI! length = %d bytes", length);
4642 return dissected_length;
4643 }
4644
4645 tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, tree, offset, pinfo,
4646 BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS);
4647 if (tmp_length < 0) {
4648 return -1;
4649 }
4650 dissected_length += tmp_length;
4651
4652 return dissected_length;
4653 }
4654
4655
4656 /*
4657 * Decode Link Descriptors
4658 */
decode_bgp_link_nlri_link_descriptors(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,int length)4659 static int decode_bgp_link_nlri_link_descriptors(tvbuff_t *tvb,
4660 proto_tree *tree, gint offset, packet_info *pinfo, int length) {
4661
4662 guint16 sub_length;
4663 guint16 type;
4664 guint16 diss_length;
4665 guint16 tmp16;
4666
4667 proto_item* tlv_item;
4668 proto_tree* tlv_tree;
4669 proto_item* tlv_sub_item;
4670 proto_tree* tlv_sub_tree;
4671
4672 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_link_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
4673 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4674
4675 diss_length = 0;
4676 while (length > 0) {
4677 if (length < 4) {
4678 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4679 "Unknown data in Link-State Link NLRI!");
4680 diss_length += length;
4681 break;
4682 }
4683
4684 type = tvb_get_ntohs(tvb, offset);
4685 sub_length = tvb_get_ntohs(tvb, offset + 2);
4686 switch (type) {
4687 case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
4688 if(sub_length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS){
4689 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4690 "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
4691 sub_length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
4692 return -1;
4693 }
4694 tlv_sub_item = proto_tree_add_item(tlv_tree,
4695 hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
4696 sub_length + 4, ENC_NA);
4697 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4698 break;
4699
4700 case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
4701 if(sub_length != BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS){
4702 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4703 "Unexpected IPv4 Interface Address TLV's length (%u), it must be %u bytes!",
4704 sub_length, BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS);
4705 return -1;
4706 }
4707 tlv_sub_item = proto_tree_add_item(tlv_tree,
4708 hf_bgp_ls_tlv_ipv4_interface_address, tvb, offset,
4709 sub_length + 4, ENC_NA);
4710 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4711 break;
4712
4713 case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
4714 if(sub_length != BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS){
4715 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4716 "Unexpected IPv4 Neighbor Address TLV's length (%u), it must be %u bytes!",
4717 sub_length, BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS);
4718 return -1;
4719 }
4720 tlv_sub_item = proto_tree_add_item(tlv_tree,
4721 hf_bgp_ls_tlv_ipv4_neighbor_address, tvb, offset,
4722 sub_length + 4, ENC_NA);
4723 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4724 break;
4725
4726 case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
4727 if(sub_length != BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS){
4728 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4729 "Unexpected IPv6 Interface Address TLV's length (%u), it must be %u bytes!",
4730 sub_length, BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS);
4731 return -1;
4732 }
4733 tlv_sub_item = proto_tree_add_item(tlv_tree,
4734 hf_bgp_ls_tlv_ipv6_interface_address, tvb, offset,
4735 sub_length + 4, ENC_NA);
4736 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4737 break;
4738
4739 case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
4740 if(sub_length != BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS){
4741 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4742 "Unexpected IPv6 Neighbor Address TLV's length (%u), it must be %u bytes!",
4743 sub_length, BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS);
4744 return -1;
4745 }
4746 tlv_sub_item = proto_tree_add_item(tlv_tree,
4747 hf_bgp_ls_tlv_ipv6_neighbor_address, tvb, offset,
4748 sub_length + 4, ENC_NA);
4749 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4750 break;
4751
4752 case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
4753 if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
4754 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4755 "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
4756 sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
4757 return -1;
4758 }
4759 tlv_sub_item = proto_tree_add_item(tlv_tree,
4760 hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
4761 ENC_NA);
4762 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4763 break;
4764
4765 default:
4766 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4767 "Unknown Link Descriptor TLV Code (%u)!", type);
4768 return -1;
4769 }
4770
4771 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4772 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4773
4774 switch (type) {
4775 case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
4776 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4777 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
4778 break;
4779
4780 case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
4781 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_interface_address, tvb, offset + 4,
4782 BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
4783 break;
4784
4785 case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
4786 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_neighbor_address, tvb, offset + 4,
4787 BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
4788 break;
4789
4790 case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
4791 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_interface_address, tvb, offset + 4,
4792 BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
4793 break;
4794
4795 case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
4796 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_neighbor_address, tvb, offset + 4,
4797 BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
4798 break;
4799
4800 case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
4801 tmp16 = tvb_get_ntohs(tvb, offset + 4);
4802 tmp16 >>= 12;
4803 if(tmp16){
4804 expert_add_info_format(pinfo, tlv_sub_tree, &ei_bgp_ls_error, "Reserved bits of Multi Topology ID must be set to zero! (%u)", tmp16);
4805 }
4806 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
4807 BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
4808 break;
4809 }
4810
4811 length -= 4 + sub_length;
4812 offset += 4 + sub_length;
4813 diss_length += 4 + sub_length;
4814 }
4815 return diss_length;
4816 }
4817
4818 /*
4819 * Decode Prefix Descriptors
4820 */
decode_bgp_link_nlri_prefix_descriptors(tvbuff_t * tvb,proto_tree * tree,gint offset,packet_info * pinfo,int length,int proto)4821 static int decode_bgp_link_nlri_prefix_descriptors(tvbuff_t *tvb,
4822 proto_tree *tree, gint offset, packet_info *pinfo, int length, int proto) {
4823
4824 guint16 sub_length;
4825 guint16 type;
4826 guint16 diss_length;
4827 guint16 tmp16;
4828
4829 proto_item* tlv_item;
4830 proto_tree* tlv_tree;
4831 proto_item* tlv_sub_item;
4832 proto_tree* tlv_sub_tree;
4833
4834 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_prefix_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
4835 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
4836
4837 diss_length = 0;
4838 while (length > 0) {
4839 if (length < 4) {
4840 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
4841 "Unknown data in Link-State Link NLRI!");
4842 diss_length += length;
4843 break;
4844 }
4845
4846 type = tvb_get_ntohs(tvb, offset);
4847 sub_length = tvb_get_ntohs(tvb, offset + 2);
4848 switch (type) {
4849 case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
4850 if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
4851 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4852 "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
4853 sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
4854 return -1;
4855 }
4856 tlv_sub_item = proto_tree_add_item(tlv_tree,
4857 hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
4858 ENC_NA);
4859 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4860 break;
4861
4862 case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
4863 tlv_sub_item = proto_tree_add_item(tlv_tree,
4864 hf_bgp_ls_tlv_ospf_route_type, tvb, offset, sub_length + 4,
4865 ENC_NA);
4866 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4867 break;
4868 case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
4869 tlv_sub_item = proto_tree_add_item(tlv_tree,
4870 hf_bgp_ls_tlv_ip_reachability_information, tvb, offset, sub_length + 4,
4871 ENC_NA);
4872 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
4873 break;
4874
4875 default:
4876 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
4877 "Unknown Prefix Descriptor TLV Code (%u)!", type);
4878 return -1;
4879 }
4880
4881 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4882 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4883
4884 switch (type) {
4885 case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
4886 tmp16 = tvb_get_ntohs(tvb, offset + 4);
4887 tmp16 >>= 12;
4888 if(tmp16){
4889 expert_add_info_format(pinfo, tlv_sub_tree, &ei_bgp_ls_error, "Reserved bits of Multi Topology ID must be set to zero! (%u)", tmp16);
4890 }
4891 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
4892 BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
4893 break;
4894
4895 case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
4896
4897 if (sub_length != 1) {
4898 expert_add_info_format(pinfo, tlv_sub_tree, &ei_bgp_ls_error, "OSPF Route Type length must be \"1\"");
4899 break;
4900 }
4901 proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ospf_route_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
4902 break;
4903
4904 case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
4905 if (( proto == IP_PROTO_IPV4 ) && (decode_prefix4(tlv_sub_tree, pinfo, tlv_sub_item, hf_bgp_ls_nlri_ip_reachability_prefix_ip,
4906 tvb, offset + 4, "Reachability") == -1))
4907 return diss_length;
4908 if (( proto == IP_PROTO_IPV6 ) && (decode_prefix6(tlv_sub_tree, pinfo, hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
4909 tvb, offset + 4, 0, "Reachability") == -1))
4910 return diss_length;
4911 break;
4912 }
4913
4914 length -= 4 + sub_length;
4915 offset += 4 + sub_length;
4916 diss_length += 4 + sub_length;
4917 }
4918 return diss_length;
4919 }
4920
4921 /*
4922 * Decode Flex Algo sub-TLVs in BGP-LS attributes
4923 */
4924 static int
decode_link_state_attribute_flex_algo_subtlv(proto_tree * tree,tvbuff_t * tvb,gint offset,packet_info * pinfo,guint8 _U_ protocol_id)4925 decode_link_state_attribute_flex_algo_subtlv(proto_tree *tree, tvbuff_t *tvb, gint offset, packet_info *pinfo, guint8 _U_ protocol_id)
4926 {
4927 guint16 type;
4928 guint16 length;
4929 guint16 tmp16;
4930
4931 proto_item* tlv_item;
4932 proto_tree* tlv_tree;
4933
4934 type = tvb_get_ntohs(tvb, offset);
4935 length = tvb_get_ntohs(tvb, offset + 2);
4936
4937 switch (type) {
4938 case BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY:
4939 case BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY:
4940 case BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY:
4941 tlv_item = proto_tree_add_item(tree,
4942 (type == BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY) ?
4943 hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity :
4944 ((type == BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY) ?
4945 hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity :
4946 hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity),
4947 tvb, offset, length + 4, ENC_NA);
4948 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
4949 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
4950 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4951 if (length % 4 != 0) {
4952 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Extended Administrative Group TLV's length (%u mod 4 != 0)",
4953 length);
4954 break;
4955 }
4956 tmp16 = length;
4957 while (tmp16) {
4958 proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
4959 tmp16 -= 4;
4960 }
4961 break;
4962
4963 default:
4964 expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
4965 "Unknown BGP-LS Flex-Algo sub-TLV Code (%u)!", type);
4966 break;
4967 }
4968
4969 return length + 4;
4970 }
4971
4972 /*
4973 * Decode a multiprotocol prefix
4974 */
4975 static int
decode_link_state_attribute_tlv(proto_tree * tree,tvbuff_t * tvb,gint offset,packet_info * pinfo,guint8 protocol_id)4976 decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, gint offset, packet_info *pinfo, guint8 protocol_id)
4977 {
4978 guint16 type;
4979 guint16 length;
4980 guint8 tmp8;
4981 guint16 tmp16;
4982 guint32 tmp32;
4983 gfloat tmp_float;
4984 guint32 mask;
4985 gint local_offset, local_length;
4986 int n;
4987 guint8 sabm_len, udabm_len;
4988 int advance;
4989
4990 proto_item* tlv_item;
4991 proto_tree* tlv_tree;
4992 proto_item* tlv_sub_item;
4993 proto_tree* tlv_sub_tree;
4994 proto_item* ti;
4995
4996 type = tvb_get_ntohs(tvb, offset);
4997 length = tvb_get_ntohs(tvb, offset + 2);
4998
4999 switch (type) {
5000
5001 /* NODE ATTRIBUTE TLVs */
5002 case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5003 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_multi_topology_id, tvb, offset, length + 4, ENC_NA);
5004 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5005
5006 for (n = 0; n < (length / BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID); n++) {
5007 tmp16 = tvb_get_ntohs(tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID));
5008 tmp16 >>= 12;
5009 if(tmp16){
5010 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved bits of Multi Topology ID must be set to zero! (%u)", tmp16);
5011 }
5012 proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID),
5013 BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5014 }
5015 break;
5016
5017 case BGP_NLRI_TLV_NODE_FLAG_BITS:
5018 {
5019 static int * const flags[] = {
5020 &hf_bgp_ls_node_flag_bits_overload,
5021 &hf_bgp_ls_node_flag_bits_attached,
5022 &hf_bgp_ls_node_flag_bits_external,
5023 &hf_bgp_ls_node_flag_bits_abr,
5024 NULL
5025 };
5026
5027 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_flags_bits, tvb, offset, length+4, ENC_NA);
5028 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5029 if(length != BGP_NLRI_TLV_LEN_NODE_FLAG_BITS){
5030 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Node Flags Bits TLV's length (%u), it must be %u bytes!",
5031 length, BGP_NLRI_TLV_LEN_NODE_FLAG_BITS);
5032 break;
5033 }
5034 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5035 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5036 proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
5037 tmp8 = tvb_get_guint8(tvb, offset+4) & 0x0f;
5038 if(tmp8){
5039 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flag bits are not set to zero (%u).", tmp8);
5040 }
5041 }
5042 break;
5043
5044 case BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES:
5045 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_node_properties, tvb, offset, length+4, ENC_NA);
5046 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5047 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5048 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5049 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_node_properties_value, tvb, offset + 4, length, ENC_NA);
5050 break;
5051
5052 case BGP_NLRI_TLV_NODE_NAME:
5053 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_name, tvb, offset, length+4, ENC_NA);
5054 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5055 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5056 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5057 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_node_name_value, tvb, offset + 4, length, ENC_ASCII|ENC_NA);
5058 break;
5059
5060 case BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER:
5061 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_is_is_area_identifier, tvb, offset, length+4, ENC_NA);
5062 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5063 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5064 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5065 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_is_is_area_identifier_value, tvb, offset + 4, length, ENC_NA);
5066 break;
5067
5068 case BGP_LS_SR_TLV_SR_CAPABILITY:
5069 {
5070 /*
5071 0 1 2 3 4 5 6 7
5072 +--+--+--+--+--+--+--+--+
5073 |I |V |H | | | | | |
5074 +--+--+--+--+--+--+--+--+
5075 */
5076 static int * const sr_capabilities_flags[] = {
5077 &hf_bgp_ls_sr_tlv_capabilities_flags_i,
5078 &hf_bgp_ls_sr_tlv_capabilities_flags_v,
5079 &hf_bgp_ls_sr_tlv_capabilities_flags_h,
5080 &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
5081 NULL
5082 };
5083 gint offset2;
5084 gint remaining_data;
5085 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_capabilities, tvb, offset, length + 4, ENC_NA);
5086 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5087 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5088 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5089 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_capabilities_flags,
5090 ett_bgp_link_state, sr_capabilities_flags, ENC_BIG_ENDIAN);
5091 /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
5092 offset2 = offset + 4 + 2;
5093 remaining_data = length - 2;
5094 while (remaining_data > 0) {
5095 guint16 sid_len = 0;
5096 /* parse and consume the range field */
5097 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
5098 offset2 += 3;
5099 /* parse and consume type/len fields */
5100 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
5101 offset2 += 2;
5102 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
5103 sid_len = tvb_get_ntohs(tvb, offset2);
5104 offset2 += 2;
5105 if (sid_len == 3) {
5106 /* parse and consume the SID/Label field */
5107 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
5108 offset2 += 3;
5109 remaining_data -= 10;
5110 } else {
5111 /* parse and consume the SID/Index field */
5112 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
5113 offset2 += 4;
5114 remaining_data -= 11;
5115 }
5116 }
5117 }
5118 break;
5119
5120 case BGP_LS_SR_TLV_SR_LOCAL_BLOCK:
5121 {
5122 gint offset2;
5123 gint remaining_data;
5124 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_local_block, tvb, offset, length + 4, ENC_NA);
5125 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5126 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5127 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5128 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_flags, tvb, offset + 4, 1, ENC_NA);
5129 /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
5130 offset2 = offset + 4 + 2;
5131 remaining_data = length - 2;
5132 while (remaining_data > 0) {
5133 guint16 sid_len = 0;
5134 /* parse and consume the range field */
5135 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
5136 offset2 += 3;
5137 /* parse and consume type/len fields */
5138 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
5139 offset2 += 2;
5140 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
5141 sid_len = tvb_get_ntohs(tvb, offset2);
5142 offset2 += 2;
5143 if (sid_len == 3) {
5144 /* parse and consume the SID/Label field */
5145 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
5146 offset2 += 3;
5147 remaining_data -= 10;
5148 } else {
5149 /* parse and consume the SID/Index field */
5150 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
5151 offset2 += 4;
5152 remaining_data -= 11;
5153 }
5154 }
5155 }
5156 break;
5157
5158 case BGP_LS_SR_TLV_SR_ALGORITHM:
5159 {
5160 gint offset2;
5161 gint remaining_data;
5162 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_algorithm, tvb, offset, length+4, ENC_NA);
5163 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5164 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5165 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5166 /* past type-length fields, we got one or more 'Algorithm N' value */
5167 offset2 = offset + 4;
5168 remaining_data = length;
5169 while (remaining_data > 0) {
5170 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_algorithm_value, tvb, offset2, 1, ENC_NA);
5171 offset2 += 1;
5172 remaining_data -= 1;
5173 }
5174 }
5175 break;
5176
5177 case BGP_LS_SR_TLV_FLEX_ALGO_DEF:
5178 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def, tvb, offset, length+4, ENC_NA);
5179 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5180 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5181 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5182 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
5183 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_metric_type, tvb, offset + 5, 1, ENC_NA);
5184 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_calc_type, tvb, offset + 6, 1, ENC_NA);
5185 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_priority, tvb, offset + 7, 1, ENC_NA);
5186 local_offset = offset + 8;
5187 while (local_offset < offset + length) {
5188 advance = decode_link_state_attribute_flex_algo_subtlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
5189 if (advance < 0) {
5190 break;
5191 }
5192 local_offset += advance;
5193 }
5194 break;
5195
5196 /* NODE & LINK ATTRIBUTE TLVs */
5197 case BGP_NLRI_TLV_NODE_MSD:
5198 case BGP_NLRI_TLV_LINK_MSD:
5199 tlv_item = proto_tree_add_item(tree,
5200 (type == BGP_NLRI_TLV_NODE_MSD ?
5201 hf_bgp_ls_tlv_node_msd : hf_bgp_ls_tlv_link_msd),
5202 tvb, offset, length + 4, ENC_NA);
5203 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5204 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5205 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5206 local_offset = offset + 4;
5207 local_length = length;
5208 while (local_length >= 2) {
5209 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_type, tvb, local_offset, 1, ENC_NA);
5210 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_value, tvb, local_offset+1, 1, ENC_NA);
5211 local_length -= 2;
5212 local_offset += 2;
5213 }
5214 break;
5215
5216 case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE:
5217 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
5218 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5219 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5220 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5221 if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE){
5222 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
5223 length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE);
5224 break;
5225 }
5226 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5227 break;
5228 case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE:
5229 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
5230 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5231 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5232 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5233 if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE){
5234 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
5235 length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE);
5236 break;
5237 }
5238 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv6_router_id_value, tvb, offset + 4, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE, ENC_NA);
5239 break;
5240
5241 /* Link Attribute TLVs */
5242 case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5243 if (length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS) {
5244 expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5245 "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
5246 length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
5247 break;
5248 }
5249 tlv_item = proto_tree_add_item(tree,
5250 hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
5251 length + 4, ENC_NA);
5252 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5253 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5254 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5255 proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5256 proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5257 break;
5258
5259 case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE:
5260 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
5261 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5262 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5263 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5264 if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE){
5265 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
5266 length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE);
5267 break;
5268 }
5269 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5270 break;
5271
5272 case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE:
5273 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
5274 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5275 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5276 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5277 if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE){
5278 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
5279 length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE);
5280 break;
5281 }
5282 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv6_router_id_value, tvb, offset + 4, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE, ENC_NA);
5283 break;
5284
5285 case BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR:
5286 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_administrative_group_color, tvb, offset, length+4, ENC_NA);
5287 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5288 if(length != BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR){
5289 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Administrative group (color) TLV's length (%u), it must be %u bytes!",
5290 length, BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR);
5291 break;
5292 }
5293 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5294 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5295 tmp32 = tvb_get_ntohl(tvb, offset + 4);
5296 tlv_sub_item = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_administrative_group_color_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5297 tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_prefix);
5298 mask = 1;
5299 for(n = 0; n<32; n++){
5300 if( tmp32 & mask ) proto_tree_add_uint(tlv_sub_tree, hf_bgp_ls_tlv_administrative_group, tvb, offset + 4, 4, n);
5301 mask <<= 1;
5302 }
5303 break;
5304
5305 case BGP_NLRI_TLV_MAX_LINK_BANDWIDTH:
5306 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_link_bandwidth, tvb, offset, length+4, ENC_NA);
5307 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5308 if(length != BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH){
5309 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Maximum link bandwidth TLV's length (%u), it must be %u bytes!",
5310 length, BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH);
5311 break;
5312 }
5313 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5314 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5315 tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
5316 proto_tree_add_float_format(tlv_tree, hf_bgp_ls_bandwidth_value, tvb, offset + 4, 4, tmp_float, "Maximum link bandwidth: %.2f Mbps", tmp_float);
5317 break;
5318
5319 case BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH:
5320 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_reservable_link_bandwidth, tvb, offset, length+4, ENC_NA);
5321 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5322 if(length != BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH){
5323 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Maximum reservable link bandwidth TLV's length (%u), it must be %u bytes!",
5324 length, BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH);
5325 break;
5326 }
5327 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5328 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5329 tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
5330 proto_tree_add_float_format(tlv_tree, hf_bgp_ls_bandwidth_value, tvb, offset + 4, 4, tmp_float, "Maximum reservable link bandwidth: %.2f Mbps", tmp_float);
5331 break;
5332
5333 case BGP_NLRI_TLV_UNRESERVED_BANDWIDTH:
5334 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_unreserved_bandwidth, tvb, offset, length+4, ENC_NA);
5335 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5336 if(length != BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH){
5337 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Unreserved bandwidth TLV's length (%u), it must be %u bytes!",
5338 length, BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH);
5339 break;
5340 }
5341 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5342 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5343 for(n = 0; n<8; n++){
5344 tmp_float = tvb_get_ntohieee_float(tvb, offset + 4 + (4 * n))*8/1000000;
5345 tlv_sub_item = proto_tree_add_float_format(tlv_tree, hf_bgp_ls_bandwidth_value, tvb, offset + 4 + (4 * n), 4, tmp_float, "Unreserved Bandwidth: %.2f Mbps", tmp_float);
5346 proto_item_prepend_text(tlv_sub_item, "Priority %u, ", n);
5347 }
5348 break;
5349
5350 case BGP_NLRI_TLV_TE_DEFAULT_METRIC:
5351 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_te_default_metric, tvb, offset, length+4, ENC_NA);
5352 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5353 /* FF: The 'TE Default Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 04
5354 was 3 bytes as per RFC5305/3.7, since version 05 is 4 bytes. Here we try to parse both formats
5355 without complain because there are real implementations out there based on the 3 bytes size. At
5356 the same time we clearly highlight that 3 is "old" and 4 is correct via expert info. */
5357 if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
5358 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
5359 "Old TE Default Metric TLV's length (%u), it should be %u bytes!",
5360 length,
5361 BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
5362 /* just a warning do not give up dissection */
5363 }
5364 if (length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD && length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
5365 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5366 "Unexpected TE Default Metric TLV's length (%u), it must be %u or %u bytes!",
5367 length,
5368 BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD,
5369 BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
5370 /* major error give up dissection */
5371 break;
5372 }
5373 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5374 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5375 if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
5376 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value_old, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
5377 } else if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
5378 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5379 }
5380 break;
5381
5382 case BGP_NLRI_TLV_LINK_PROTECTION_TYPE:
5383 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_protection_type, tvb, offset, length+4, ENC_NA);
5384 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5385 if(length != BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE){
5386 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Link Protection Type TLV's length (%u), it must be %u bytes!",
5387 length, BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE);
5388 break;
5389 }
5390 else {
5391 static int * const nlri_flags[] = {
5392 &hf_bgp_ls_link_protection_type_extra_traffic,
5393 &hf_bgp_ls_link_protection_type_unprotected,
5394 &hf_bgp_ls_link_protection_type_shared,
5395 &hf_bgp_ls_link_protection_type_dedicated_1to1,
5396 &hf_bgp_ls_link_protection_type_dedicated_1plus1,
5397 &hf_bgp_ls_link_protection_type_enhanced,
5398 NULL
5399 };
5400
5401 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5402 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5403 tmp8 = tvb_get_guint8(tvb, offset + 4);
5404
5405 tlv_sub_item = proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_tlv_link_protection_type_value, ett_bgp_mp_reach_nlri, nlri_flags, ENC_NA);
5406 tmp8 >>= 6;
5407 if(tmp8){
5408 expert_add_info_format(pinfo, tlv_sub_item, &ei_bgp_ls_error, "Reserved Protection Capabilities bits are not set to zero (%u).", tmp8);
5409 }
5410 tmp8 = tvb_get_guint8(tvb, offset + 4 + 1);
5411 if(tmp8){
5412 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved field is not set to zero. (%u)", tmp8);
5413 }
5414 }
5415 break;
5416 case BGP_NLRI_TLV_MPLS_PROTOCOL_MASK:
5417 {
5418 static int * const flags[] = {
5419 &hf_bgp_ls_mpls_protocol_mask_flag_l,
5420 &hf_bgp_ls_mpls_protocol_mask_flag_r,
5421 NULL
5422 };
5423
5424 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_mpls_protocol_mask, tvb, offset, length+4, ENC_NA);
5425 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5426 if(length != BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK){
5427 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected MPLS Protocol Mask TLV's length (%u), it must be %u bytes!",
5428 length, BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK);
5429 break;
5430 }
5431 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5432 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5433 proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
5434 tmp8 = tvb_get_guint8(tvb, offset + 4) & 0x3f;
5435 if(tmp8){
5436 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error, tvb, offset + 4, 1,
5437 "Reserved flags are not set to zero (%u).", tmp8);
5438 }
5439 }
5440 break;
5441 case BGP_NLRI_TLV_METRIC:
5442 /* FF: The IGP 'Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 02
5443 was fixed at 3 bytes, since version 03 is variable 1/2/3 bytes. We cannot complain if
5444 length is not fixed at 3. */
5445 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_metric, tvb, offset, length + 4, ENC_NA);
5446 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5447 if (length > BGP_NLRI_TLV_LEN_MAX_METRIC) {
5448 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5449 "Unexpected Metric TLV's length (%u), it must be less than %u bytes!",
5450 length, BGP_NLRI_TLV_LEN_MAX_METRIC);
5451 break;
5452 }
5453 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5454 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5455 if (length == 1) {
5456 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value1, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5457 } else if (length == 2) {
5458 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value2, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
5459 } else if (length == 3) {
5460 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value3, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
5461 }
5462 break;
5463 case BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP:
5464 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_shared_risk_link_group, tvb, offset, length+4, ENC_NA);
5465 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5466 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5467 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5468 tmp16 = length;
5469 n = 0;
5470 while(tmp16 > 0){
5471 if(tmp16 < 4) {
5472 proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error,
5473 tvb, offset + 4 + (n * 4), tmp16,
5474 "Shared Risk Link Group Value must be 4 bytes long (%u).", tmp16);
5475 break;
5476 }
5477 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
5478 tmp16 -= 4;
5479 n++;
5480 }
5481 break;
5482
5483 case BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE:
5484 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_link_attribute, tvb, offset, length+4, ENC_NA);
5485 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5486 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5487 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5488 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_link_attribute_value, tvb, offset + 4, length, ENC_NA);
5489 break;
5490
5491 case BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE:
5492 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_name_attribute, tvb, offset, length+4, ENC_NA);
5493 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5494 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5495 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5496 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_link_name_attribute_value, tvb, offset + 4, length, ENC_ASCII|ENC_NA);
5497 break;
5498
5499 case BGP_LS_SR_TLV_ADJ_SID:
5500 {
5501 /*
5502 0 1 2 3 4 5 6 7
5503 +--+--+--+--+--+--+--+--+
5504 |F |B |V |L |S | | | |
5505 +--+--+--+--+--+--+--+--+
5506 */
5507 static int * const adj_sid_isis_flags[] = {
5508 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
5509 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
5510 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
5511 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
5512 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
5513 NULL
5514 };
5515 /*
5516 0 1 2 3 4 5 6 7
5517 +--+--+--+--+--+--+--+--+
5518 |B |V |L |S | | | | |
5519 +--+--+--+--+--+--+--+--+
5520 */
5521 static int * const adj_sid_ospf_flags[] = {
5522 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
5523 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
5524 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
5525 &hf_bgp_ls_sr_tlv_adjacency_sid_flags_so,
5526 NULL
5527 };
5528
5529 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_adjacency_sid, tvb, offset, length + 4, ENC_NA);
5530 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5531 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5532 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5533 if (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF) {
5534 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
5535 ett_bgp_link_state, adj_sid_ospf_flags, ENC_BIG_ENDIAN);
5536 } else {
5537 /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
5538 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
5539 ett_bgp_link_state, adj_sid_isis_flags, ENC_BIG_ENDIAN);
5540 }
5541 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
5542 if (length == 7) {
5543 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
5544 } else {
5545 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5546 }
5547 }
5548 break;
5549
5550 case BGP_LS_SR_TLV_LAN_ADJ_SID:
5551 break;
5552
5553 case BGP_LS_SR_TLV_PEER_NODE_SID:
5554 case BGP_LS_SR_TLV_PEER_ADJ_SID:
5555 case BGP_LS_SR_TLV_PEER_SET_SID:
5556 {
5557 /*
5558 0 1 2 3 4 5 6 7
5559 +--+--+--+--+--+--+--+--+
5560 |V |L |B |P | | | | | rfc9086
5561 +--+--+--+--+--+--+--+--+
5562 */
5563 static int * const peer_sid_flags[] = {
5564 &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
5565 &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
5566 &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
5567 &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
5568 NULL
5569 };
5570
5571 tlv_item = proto_tree_add_item(tree,
5572 (type == BGP_LS_SR_TLV_PEER_NODE_SID ?
5573 hf_bgp_ls_sr_tlv_peer_node_sid :
5574 (type == BGP_LS_SR_TLV_PEER_ADJ_SID ?
5575 hf_bgp_ls_sr_tlv_peer_adj_sid :
5576 hf_bgp_ls_sr_tlv_peer_set_sid)),
5577 tvb, offset, length + 4, ENC_NA);
5578 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5579 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5580 ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5581 if (length != 7 && length != 8) {
5582 expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
5583 "Unexpected TLV Length (%u) in BGP-LS Peer SID TLV, it must be either 7 or 8 bytes!",
5584 length);
5585 break;
5586 }
5587 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_peer_sid_flags,
5588 ett_bgp_link_state, peer_sid_flags, ENC_BIG_ENDIAN);
5589 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
5590 if (length == 7) {
5591 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
5592 } else {
5593 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5594 }
5595 }
5596 break;
5597
5598 case BGP_LS_APP_SPEC_LINK_ATTR:
5599 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_app_spec_link_attrs, tvb, offset, length + 4, ENC_NA);
5600 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5601 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5602 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5603 sabm_len = tvb_get_guint8(tvb, offset + 4);
5604 ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len, tvb, offset + 4, 1, ENC_NA);
5605 if (sabm_len != 0 && sabm_len != 4 && sabm_len != 8) {
5606 expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
5607 "Unexpected SABM Length (%u) in BGP-LS Application-Specific Link Attributes TLV, it must be 0/4/8 bytes!",
5608 sabm_len);
5609 break;
5610 }
5611 udabm_len = tvb_get_guint8(tvb, offset + 5);
5612 ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len, tvb, offset + 5, 1, ENC_NA);
5613 if (udabm_len != 0 && udabm_len != 4 && udabm_len != 8) {
5614 expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
5615 "Unexpected UDABM Length (%u) in BGP-LS Application Specific Link Attributes TLV, it must be 0/4/8 bytes!",
5616 sabm_len);
5617 break;
5618 }
5619 tmp16 = tvb_get_guint16(tvb, offset + 6, ENC_BIG_ENDIAN);
5620 ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
5621 if (tmp16 != 0) {
5622 expert_add_info_format(pinfo, ti, &ei_bgp_ls_warn,
5623 "Reserved field must be 0 in BGP-LS Application-Specific Link Attributes TLV");
5624 }
5625 if (sabm_len > 0) {
5626 static int * const app_spec_link_attrs_sabm[] = {
5627 &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
5628 &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
5629 &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
5630 &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
5631 NULL
5632 };
5633 proto_tree_add_bitmask(tlv_tree, tvb, offset + 8, hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
5634 ett_bgp_link_state, app_spec_link_attrs_sabm, ENC_BIG_ENDIAN);
5635 }
5636 if (udabm_len > 0) {
5637 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
5638 tvb, offset + 8 + sabm_len, udabm_len, ENC_NA);
5639 }
5640 /* Decode Link Attribute sub-TLVs */
5641 local_offset = offset + 8 + sabm_len + udabm_len;
5642 while (local_offset < offset + length) {
5643 advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
5644 if (advance < 0) {
5645 break;
5646 }
5647 local_offset += advance;
5648 }
5649 break;
5650
5651 /* Prefix Attribute TLVs */
5652 case BGP_NLRI_TLV_IGP_FLAGS:
5653 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_flags, tvb, offset, length+4, ENC_NA);
5654 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5655 if(length != BGP_NLRI_TLV_LEN_IGP_FLAGS){
5656 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IGP Flags TLV's length (%u), it must be %u bytes!",
5657 length, BGP_NLRI_TLV_IGP_FLAGS);
5658 break;
5659 }
5660 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5661 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5662 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_flags_flag_d, tvb, offset + 4, 1, ENC_NA);
5663 tmp8 = tvb_get_guint8(tvb, offset + 4) & 0x7F;
5664 if(tmp8){
5665 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flags are not set to zero (%u).", tmp8);
5666 }
5667 break;
5668
5669 case BGP_NLRI_TLV_ROUTE_TAG:
5670 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_tag, tvb, offset, length+4, ENC_NA);
5671 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5672 if(length % 4 != 0) {
5673 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Tag TLV's length (%u mod 4 != 0) ",
5674 length);
5675 break;
5676 }
5677 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5678 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5679 tmp16 = length;
5680 n = 0;
5681 while(tmp16){
5682 if(tmp16 < 4) {
5683 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Tag must be 4 bytes long (%u).", tmp16);
5684 break;
5685 }
5686 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_tag_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
5687 tmp16 -= 4;
5688 n++;
5689 }
5690 break;
5691
5692 case BGP_NLRI_TLV_EXTENDED_TAG:
5693 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_extended_tag, tvb, offset, length+4, ENC_NA);
5694 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5695 if(length % 8 != 0) {
5696 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Extended Tag TLV's length (%u mod 8 != 0) ",
5697 length);
5698 break;
5699 }
5700 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5701 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5702 tmp16 = length;
5703 n = 0;
5704 while(tmp16){
5705 if(tmp16 < 8) {
5706 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Extended Tag must be 8 bytes long (%u).", tmp16);
5707 break;
5708 }
5709 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_extended_tag_value, tvb, offset + 4 + (n * 8), 8, ENC_BIG_ENDIAN);
5710 tmp16 -= 8;
5711 n++;
5712 }
5713 break;
5714
5715 case BGP_NLRI_TLV_PREFIX_METRIC:
5716 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_prefix_metric, tvb, offset, length+4, ENC_NA);
5717 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5718 if(length != BGP_NLRI_TLV_LEN_PREFIX_METRIC){
5719 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Prefix Metric TLV's length (%u), it must be %u bytes!",
5720 length, BGP_NLRI_TLV_LEN_PREFIX_METRIC);
5721 break;
5722 }
5723 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5724 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5725 proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_prefix_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5726 break;
5727
5728 case BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS:
5729 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_ospf_forwarding_address, tvb, offset, length+4, ENC_NA);
5730 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5731 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5732 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5733 if (length == 4) {
5734 proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv4_address, tvb, offset + 4, length, ENC_BIG_ENDIAN);
5735 }
5736 else if (length == 16) {
5737 proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv6_address, tvb, offset + 4, length, ENC_NA);
5738 }
5739 else {
5740 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Prefix Metric TLV's length (%u), it must be 4 or 16 bytes!", length);
5741 break;
5742 }
5743 break;
5744
5745 case BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE:
5746 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_opaque_prefix_attribute, tvb, offset, length+4, ENC_NA);
5747 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5748 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5749 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5750 proto_tree_add_item(tlv_tree, hf_bgp_ls_opaque_prefix_attribute_value, tvb, offset + 4, length, ENC_NA);
5751 break;
5752
5753 case BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP:
5754 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_extended_administrative_group, tvb, offset, length+4, ENC_NA);
5755 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5756 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5757 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5758 if(length % 4 != 0) {
5759 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Extended Administrative Group TLV's length (%u mod 4 != 0)",
5760 length);
5761 break;
5762 }
5763 tmp16 = length;
5764 while(tmp16){
5765 proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
5766 tmp16 -= 4;
5767 }
5768 break;
5769
5770 case BGP_LS_SR_TLV_PREFIX_SID:
5771 {
5772 /*
5773 0 1 2 3 4 5 6 7
5774 +--+--+--+--+--+--+--+--+
5775 |R |N |P |E |V |L | | |
5776 +--+--+--+--+--+--+--+--+
5777 */
5778 static int * const prefix_sid_isis_flags[] = {
5779 &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
5780 &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
5781 &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
5782 &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
5783 &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
5784 &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
5785 NULL
5786 };
5787 /*
5788 0 1 2 3 4 5 6 7
5789 +--+--+--+--+--+--+--+--+
5790 | |NP|M |E |V |L | | |
5791 +--+--+--+--+--+--+--+--+
5792 */
5793 static int * const prefix_sid_ospf_flags[] = {
5794 &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
5795 &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
5796 &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
5797 &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
5798 &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
5799 NULL
5800 };
5801
5802 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_sid, tvb, offset, length + 4, ENC_NA);
5803 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5804 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5805 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5806 if (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF) {
5807 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
5808 ett_bgp_link_state, prefix_sid_ospf_flags, ENC_BIG_ENDIAN);
5809 } else {
5810 /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
5811 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
5812 ett_bgp_link_state, prefix_sid_isis_flags, ENC_BIG_ENDIAN);
5813 }
5814 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
5815 if (length == 7) {
5816 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
5817 } else {
5818 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5819 }
5820 }
5821 break;
5822
5823 case BGP_LS_SR_TLV_RANGE:
5824 break;
5825
5826 case BGP_LS_SR_TLV_BINDING_SID:
5827 break;
5828
5829 case BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS:
5830 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_attr_flags, tvb, offset, length+4, ENC_NA);
5831 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5832 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5833 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5834 if (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF) {
5835 /* rfc7684, rfc9089 */
5836 static int * const prefix_attr_ospf_flags[] = {
5837 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
5838 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
5839 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
5840 NULL
5841 };
5842 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
5843 ett_bgp_link_state, prefix_attr_ospf_flags, ENC_BIG_ENDIAN);
5844 } else if (protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
5845 protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) {
5846 /* rfc7794, rfc9088 */
5847 static int * const prefix_attr_isis_flags[] = {
5848 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
5849 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
5850 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
5851 &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
5852 NULL
5853 };
5854 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
5855 ett_bgp_link_state, prefix_attr_isis_flags, ENC_BIG_ENDIAN);
5856 } else {
5857 proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
5858 tvb, offset + 4, tvb_get_guint16(tvb, offset + 2, ENC_BIG_ENDIAN), ENC_NA);
5859 expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
5860 "Unknown Protocol-ID (%u) for Prefix Attribute Flags TLV",
5861 protocol_id);
5862 }
5863 break;
5864
5865 case BGP_LS_IGP_TE_METRIC_DELAY:
5866 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay, tvb, offset, length+4, ENC_NA);
5867 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5868 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5869 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5870 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
5871 ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
5872 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
5873 break;
5874 case BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX:
5875 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_min_max, tvb, offset, length+4, ENC_NA);
5876 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5877 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5878 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5879 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
5880 ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
5881 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_min, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
5882 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
5883 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_max, tvb, offset + 9, 3, ENC_BIG_ENDIAN);
5884 break;
5885 case BGP_LS_IGP_TE_METRIC_DELAY_VARIATION:
5886 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_variation, tvb, offset, length+4, ENC_NA);
5887 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5888 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5889 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5890 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5891 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_variation_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
5892 break;
5893 case BGP_LS_IGP_TE_METRIC_LOSS:
5894 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_link_loss, tvb, offset, length+4, ENC_NA);
5895 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5896 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5897 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5898 proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
5899 ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
5900 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_link_loss_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
5901 break;
5902 case BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL:
5903 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_residual, tvb, offset, length+4, ENC_NA);
5904 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5905 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5906 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5907 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_residual_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5908 break;
5909 case BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE:
5910 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_available, tvb, offset, length+4, ENC_NA);
5911 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5912 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5913 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5914 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_available_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5915 break;
5916 case BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED:
5917 tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized, tvb, offset, length+4, ENC_NA);
5918 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5919 proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5920 proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5921 proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5922 break;
5923
5924 default:
5925 expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
5926 "Unknown BGP-LS Attribute TLV Code (%u)!", type);
5927 break;
5928 }
5929 return length + 4;
5930 }
5931
decode_evpn_nlri_esi(proto_tree * tree,tvbuff_t * tvb,gint offset,packet_info * pinfo)5932 static int decode_evpn_nlri_esi(proto_tree *tree, tvbuff_t *tvb, gint offset, packet_info *pinfo) {
5933 guint8 esi_type = 0;
5934 proto_tree *esi_tree;
5935 proto_item *ti;
5936
5937 ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri_esi, tvb, offset, 10, ENC_NA);
5938 esi_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri_esi);
5939 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_type, tvb, offset, 1, ENC_BIG_ENDIAN);
5940 esi_type = tvb_get_guint8(tvb, offset);
5941 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value, tvb, offset+1, 9, ENC_NA);
5942 switch (esi_type) {
5943 case BGP_NLRI_EVPN_ESI_VALUE :
5944 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value_type0, tvb,
5945 offset+1, 9, ENC_NA);
5946 break;
5947 case BGP_NLRI_EVPN_ESI_LACP :
5948 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_lacp_mac, tvb,
5949 offset+1, 6, ENC_NA);
5950 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_portk, tvb,
5951 offset+7, 2, ENC_NA);
5952 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
5953 offset+9, 1, ENC_NA);
5954 break;
5955 case BGP_NLRI_EVPN_ESI_MSTP :
5956 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rb_mac, tvb,
5957 offset+1, 6, ENC_NA);
5958 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rbprio, tvb,
5959 offset+7, 2, ENC_NA);
5960 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
5961 offset+9, 1, ENC_NA);
5962 break;
5963 case BGP_NLRI_EVPN_ESI_MAC :
5964 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_sys_mac, tvb,
5965 offset+1, 6, ENC_NA);
5966 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_mac_discr, tvb,
5967 offset+7, 2, ENC_NA);
5968 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
5969 offset+9, 1, ENC_NA);
5970 break;
5971 case BGP_NLRI_EVPN_ESI_RID :
5972 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_id, tvb,
5973 offset+1, 4, ENC_BIG_ENDIAN);
5974 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_discr, tvb,
5975 offset+5, 4, ENC_NA);
5976 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
5977 offset+9, 1, ENC_NA);
5978 break;
5979 case BGP_NLRI_EVPN_ESI_ASN :
5980 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn, tvb,
5981 offset+1, 4, ENC_BIG_ENDIAN);
5982 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn_discr, tvb,
5983 offset+5, 4, ENC_NA);
5984 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
5985 offset+9, 1, ENC_NA);
5986 break;
5987 case BGP_NLRI_EVPN_ESI_RES :
5988 proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_reserved, tvb,
5989 offset+1, 9, ENC_NA);
5990 break;
5991 default :
5992 expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_esi_type_err,
5993 "Invalid EVPN ESI (%u)!", esi_type);
5994 return (-1);
5995 }
5996 return(0);
5997 }
5998
5999 /*
6000 * Decode EVPN NLRI, RFC 7432 section 7.7
6001 */
decode_evpn_nlri(proto_tree * tree,tvbuff_t * tvb,gint offset,packet_info * pinfo)6002 static int decode_evpn_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, packet_info *pinfo) {
6003 int reader_offset = offset;
6004 int start_offset = offset+2;
6005 proto_tree *prefix_tree;
6006 proto_item *ti;
6007 guint8 route_type;
6008 guint8 nlri_len;
6009 guint8 ip_len;
6010 guint32 total_length = 0;
6011 guint32 or_length;
6012 path_attr_data *data = NULL;
6013 proto_item *item;
6014 int ret;
6015
6016 route_type = tvb_get_guint8(tvb, offset);
6017
6018 nlri_len = tvb_get_guint8(tvb, offset + 1);
6019
6020 ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri, tvb, reader_offset,
6021 nlri_len+2, ENC_NA);
6022
6023 prefix_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri);
6024
6025 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rt, tvb, reader_offset,
6026 1, ENC_BIG_ENDIAN);
6027 proto_item_append_text(ti, ": %s", val_to_str(tvb_get_guint8(tvb, offset), evpnrtypevals, "Unknown capability %d"));
6028 /* moving to next field */
6029 reader_offset++;
6030
6031 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_len, tvb, reader_offset,
6032 1, ENC_BIG_ENDIAN);
6033 reader_offset++;
6034
6035 switch (route_type) {
6036 case EVPN_AD_ROUTE:
6037 /*
6038 +---------------------------------------+
6039 | RD (8 octets) |
6040 +---------------------------------------+
6041 |Ethernet Segment Identifier (10 octets)|
6042 +---------------------------------------+
6043 | Ethernet Tag ID (4 octets) |
6044 +---------------------------------------+
6045 | MPLS Label (3 octets) |
6046 +---------------------------------------+
6047 */
6048
6049 if (nlri_len < 25) {
6050 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6051 "Invalid length (%u) of EVPN NLRI Route Type 1 (Ethernet Auto-discovery Route)", nlri_len);
6052 return -1;
6053 }
6054 item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6055 8, ENC_NA);
6056 proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6057 reader_offset += 8;
6058
6059 decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
6060 reader_offset += 10;
6061 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
6062 4, ENC_BIG_ENDIAN);
6063 reader_offset += 4;
6064 data = load_path_attr_data(pinfo);
6065 if (data && data->encaps_community_present &&
6066 (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
6067 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6068 reader_offset += 3;
6069 } else {
6070 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6071 reader_offset += 3;
6072 }
6073 total_length = reader_offset - offset;
6074 break;
6075
6076 case EVPN_MAC_ROUTE:
6077 /*
6078 +---------------------------------------+
6079 | RD (8 octets) |
6080 +---------------------------------------+
6081 |Ethernet Segment Identifier (10 octets)|
6082 +---------------------------------------+
6083 | Ethernet Tag ID (4 octets) |
6084 +---------------------------------------+
6085 | MAC Address Length (1 octet) |
6086 +---------------------------------------+
6087 | MAC Address (6 octets) |
6088 +---------------------------------------+
6089 | IP Address Length (1 octet) |
6090 +---------------------------------------+
6091 | IP Address (0 or 4 or 16 octets) |
6092 +---------------------------------------+
6093 | MPLS Label1 (3 octets) |
6094 +---------------------------------------+
6095 | MPLS Label2 (0 or 3 octets) |
6096 +---------------------------------------+
6097
6098 */
6099
6100 if (nlri_len < 33) {
6101 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6102 "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
6103 return -1;
6104 }
6105 item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6106 8, ENC_NA);
6107 proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6108 reader_offset += 8;
6109
6110 decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
6111 reader_offset += 10;
6112
6113 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
6114 4, ENC_BIG_ENDIAN);
6115 reader_offset += 4;
6116
6117 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_maclen, tvb, reader_offset,
6118 1, ENC_BIG_ENDIAN);
6119 reader_offset += 1;
6120
6121 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mac_addr, tvb, reader_offset,
6122 6, ENC_NA);
6123 reader_offset += 6;
6124
6125 ip_len = tvb_get_guint8(tvb, reader_offset) / 8;
6126 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
6127 1, ENC_BIG_ENDIAN);
6128 reader_offset++;
6129
6130 if (ip_len == 4) {
6131 /*IPv4 address*/
6132 if (nlri_len < 37) {
6133 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6134 "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
6135 return -1;
6136 }
6137 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
6138 4, ENC_NA);
6139 reader_offset += 4;
6140 } else if (ip_len == 16) {
6141 /*IPv6 address*/
6142 if (nlri_len < 49) {
6143 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6144 "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
6145 return -1;
6146 }
6147 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
6148 16, ENC_NA);
6149 reader_offset += 16;
6150 } else if (ip_len == 0) {
6151 /*IP not included*/
6152 proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset-1, 1);
6153 } else {
6154 return -1;
6155 }
6156 data = load_path_attr_data(pinfo);
6157 if (data && data->encaps_community_present &&
6158 (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
6159 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6160 reader_offset += 3;
6161 if (reader_offset - start_offset < nlri_len) {
6162 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6163 reader_offset += 3;
6164 }
6165 } else {
6166 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6167 reader_offset += 3;
6168 /* we check if we reached the end of the nlri reading fields one by one */
6169 /* if not, the second optional label is in the payload */
6170 if (reader_offset - start_offset < nlri_len) {
6171 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls2, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6172 reader_offset += 3;
6173 }
6174 }
6175 total_length = reader_offset - offset;
6176 break;
6177
6178 case EVPN_INC_MCAST_TREE:
6179 /*
6180 +---------------------------------------+
6181 | RD (8 octets) |
6182 +---------------------------------------+
6183 | Ethernet Tag ID (4 octets) |
6184 +---------------------------------------+
6185 | IP Address Length (1 octet) |
6186 +---------------------------------------+
6187 | Originating Router's IP Addr |
6188 | (4 or 16 octets) |
6189 +---------------------------------------+
6190 */
6191
6192 if (nlri_len < 13) {
6193 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6194 "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
6195 return -1;
6196 }
6197 item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6198 8, ENC_NA);
6199 proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6200 reader_offset += 8;
6201
6202 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
6203 4, ENC_BIG_ENDIAN);
6204 /* move to next field */
6205 reader_offset += 4;
6206 ip_len = tvb_get_guint8(tvb, reader_offset) / 8;
6207 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
6208 1, ENC_BIG_ENDIAN);
6209 reader_offset += 1;
6210
6211 if (ip_len == 4) {
6212 /*IPv4 address*/
6213 if (nlri_len < 17) {
6214 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6215 "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
6216 return -1;
6217 }
6218 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
6219 4, ENC_NA);
6220 reader_offset += 4;
6221 } else if (ip_len == 16) {
6222 /*IPv6 address*/
6223 if (nlri_len < 29) {
6224 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6225 "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
6226 return -1;
6227 }
6228 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
6229 16, ENC_NA);
6230 reader_offset += 16;
6231 } else if (ip_len == 0) {
6232 /*IP not included*/
6233 proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
6234 } else {
6235 return -1;
6236 }
6237 total_length = reader_offset - offset;
6238 break;
6239
6240 case EVPN_ETH_SEGMENT_ROUTE:
6241 /*
6242 +---------------------------------------+
6243 | RD (8 octets) |
6244 +---------------------------------------+
6245 |Ethernet Segment Identifier (10 octets)|
6246 +---------------------------------------+
6247 | IP Address Length (1 octet) |
6248 +---------------------------------------+
6249 | Originating Router's IP Addr |
6250 | (4 or 16 octets) |
6251 +---------------------------------------+
6252 */
6253
6254 if (nlri_len < 19) {
6255 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6256 "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
6257 return -1;
6258 }
6259 item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6260 8, ENC_NA);
6261 proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6262 reader_offset += 8;
6263
6264 decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
6265 /* move to next field */
6266 reader_offset += 10;
6267
6268 ip_len = tvb_get_guint8(tvb, reader_offset) / 8;
6269 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
6270 1, ENC_BIG_ENDIAN);
6271 reader_offset++;
6272
6273 if (ip_len == 4) {
6274 /*IPv4 address*/
6275 if (nlri_len < 23) {
6276 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6277 "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
6278 return -1;
6279 }
6280 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
6281 4, ENC_NA);
6282 reader_offset += 4;
6283 } else if (ip_len == 16) {
6284 /*IPv6 address*/
6285 if (nlri_len < 35) {
6286 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6287 "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
6288 return -1;
6289 }
6290 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
6291 16, ENC_NA);
6292 reader_offset += 16;
6293 } else if (ip_len == 0) {
6294 /*IP not included*/
6295 proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
6296 } else {
6297 return -1;
6298 }
6299 total_length = reader_offset - offset;
6300 break;
6301 case EVPN_IP_PREFIX_ROUTE:
6302
6303 /*
6304 +---------------------------------------+
6305 | RD (8 octets) |
6306 +---------------------------------------+
6307 |Ethernet Segment Identifier (10 octets)|
6308 +---------------------------------------+
6309 | Ethernet Tag ID (4 octets) |
6310 +---------------------------------------+
6311 | IP Prefix Length (1 octet) |
6312 +---------------------------------------+
6313 | IP Prefix (4 or 16 octets) |
6314 +---------------------------------------+
6315 | GW IP Address (4 or 16 octets) |
6316 +---------------------------------------+
6317 | MPLS Label (3 octets) |
6318 +---------------------------------------+
6319 */
6320
6321 if (nlri_len < 26) {
6322 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6323 "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
6324 return -1;
6325 }
6326 item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6327 8, ENC_NA);
6328 proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6329 reader_offset += 8;
6330
6331 decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
6332 reader_offset += 10;
6333
6334 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
6335 4, ENC_BIG_ENDIAN);
6336 reader_offset += 4;
6337
6338 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_prefix_len, tvb, reader_offset,
6339 1, ENC_BIG_ENDIAN);
6340 reader_offset++;
6341
6342 switch (nlri_len) {
6343 case 34 :
6344 /* IPv4 address */
6345 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
6346 4, ENC_NA);
6347 reader_offset += 4;
6348
6349 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv4_gtw, tvb, reader_offset,
6350 4, ENC_NA);
6351 reader_offset += 4;
6352
6353 data = load_path_attr_data(pinfo);
6354 if (data && data->encaps_community_present &&
6355 (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
6356 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6357 } else {
6358 decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
6359 }
6360 total_length = 36;
6361 break;
6362 case 58 :
6363 /* IPv6 address */
6364 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
6365 16, ENC_NA);
6366 reader_offset += 16;
6367
6368 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_gtw, tvb, reader_offset,
6369 16, ENC_NA);
6370 reader_offset += 16;
6371
6372 data = load_path_attr_data(pinfo);
6373 if (data && data->encaps_community_present &&
6374 (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
6375 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6376 } else {
6377 decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
6378 }
6379 total_length = 60;
6380 break;
6381 default :
6382 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6383 "Invalid length (%u) of EVPN NLRI Route Type 5 (IP Prefix Route)", nlri_len);
6384 return -1;
6385 }
6386 break;
6387
6388 case EVPN_MC_ETHER_TAG_ROUTE:
6389 case EVPN_IGMP_JOIN_ROUTE:
6390 case EVPN_IGMP_LEAVE_ROUTE:
6391 case EVPN_S_PMSI_A_D_ROUTE:
6392 /*
6393 +---------------------------------------+
6394 | RD (8 octets) |
6395 +---------------------------------------+
6396 | Ethernet Tag ID (4 octets) |
6397 +---------------------------------------+
6398 | Multicast Source Length (1 octet) |
6399 +---------------------------------------+
6400 | Multicast Source Address (variable) |
6401 +---------------------------------------+
6402 | Multicast Group Length (1 octet) |
6403 +---------------------------------------+
6404 | Multicast Group Address (Variable) |
6405 +---------------------------------------+
6406 | Originator Router Length (1 octet) |
6407 +---------------------------------------+
6408 | Originator Router Address (variable) |
6409 +---------------------------------------+
6410 | Flags (1 octets) (optional) |
6411 +---------------------------------------+
6412
6413 +--------------------------------------------------+
6414 | RD (8 octets) |
6415 +--------------------------------------------------+
6416 | Ethernet Segment Identifier (10 octets) |
6417 +--------------------------------------------------+
6418 | Ethernet Tag ID (4 octets) |
6419 +--------------------------------------------------+
6420 | Multicast Source Length (1 octet) |
6421 +--------------------------------------------------+
6422 | Multicast Source Address (variable) |
6423 +--------------------------------------------------+
6424 | Multicast Group Length (1 octet) |
6425 +--------------------------------------------------+
6426 | Multicast Group Address (Variable) |
6427 +--------------------------------------------------+
6428 | Originator Router Length (1 octet) |
6429 +--------------------------------------------------+
6430 | Originator Router Address (variable) |
6431 +--------------------------------------------------+
6432 | Flags (1 octet) |
6433 +--------------------------------------------------+
6434 */
6435
6436 if (nlri_len < 15) {
6437 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6438 "Invalid length (%u) of EVPN NLRI Route Type %u", nlri_len, route_type);
6439 return -1;
6440 }
6441 item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6442 8, ENC_NA);
6443 proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6444 reader_offset += 8;
6445
6446 if (route_type == EVPN_IGMP_JOIN_ROUTE || route_type == EVPN_IGMP_LEAVE_ROUTE) {
6447 decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
6448 reader_offset += 10;
6449 }
6450
6451 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
6452 4, ENC_BIG_ENDIAN);
6453 reader_offset += 4;
6454
6455 ret = decode_mcast_vpn_nlri_addresses(prefix_tree, tvb, reader_offset);
6456 if (ret < 0)
6457 return -1;
6458
6459 reader_offset = ret;
6460 proto_tree_add_item_ret_uint(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_length, tvb,
6461 reader_offset, 1, ENC_BIG_ENDIAN, &or_length);
6462 reader_offset += 1;
6463 switch(or_length) {
6464 case 32:
6465 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4, tvb,
6466 reader_offset, 4, ENC_BIG_ENDIAN);
6467 reader_offset += 4;
6468 break;
6469 case 128:
6470 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6, tvb,
6471 reader_offset, 16, ENC_NA);
6472 offset += 16;
6473 break;
6474 }
6475 if (reader_offset - start_offset < nlri_len) {
6476 proto_tree_add_bitmask(prefix_tree, tvb, offset, hf_bgp_evpn_nlri_igmp_mc_flags,
6477 ett_bgp_evpn_nlri_mc, evpn_nlri_igmp_mc_flags, ENC_BIG_ENDIAN);
6478 reader_offset += 1;
6479 }
6480 total_length = reader_offset - offset;
6481 break;
6482
6483 default:
6484 expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_rt_type_err,
6485 "Invalid EVPN Route Type (%u)", route_type);
6486 return -1;
6487 }
6488
6489 return total_length;
6490 }
6491
6492
6493 /*
6494 * Decode a multiprotocol prefix
6495 */
6496 static int
decode_prefix_MP(proto_tree * tree,int hf_path_id,int hf_addr4,int hf_addr6,guint16 afi,guint8 safi,gint tlen,tvbuff_t * tvb,gint offset,const char * tag,packet_info * pinfo)6497 decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
6498 guint16 afi, guint8 safi, gint tlen, tvbuff_t *tvb, gint offset,
6499 const char *tag, packet_info *pinfo)
6500 {
6501 int start_offset = offset;
6502 proto_item *ti;
6503 proto_tree *prefix_tree;
6504 proto_item *nlri_ti;
6505 proto_tree *nlri_tree;
6506 proto_item *disting_item;
6507 proto_tree *disting_tree;
6508
6509 int total_length=0; /* length of the entire item */
6510 int length; /* length of the prefix address, in bytes */
6511 int tmp_length;
6512 guint plen; /* length of the prefix address, in bits */
6513 guint labnum; /* number of labels */
6514 guint16 tnl_id; /* Tunnel Identifier */
6515 ws_in4_addr ip4addr; /* IPv4 address */
6516 address addr;
6517 ws_in6_addr ip6addr; /* IPv6 address */
6518 guint16 rd_type; /* Route Distinguisher type */
6519 guint16 nlri_type; /* NLRI Type */
6520 guint16 tmp16;
6521 guint32 path_identifier=0;
6522 gint end=0; /* Message End */
6523
6524 wmem_strbuf_t *stack_strbuf; /* label stack */
6525 wmem_strbuf_t *comm_strbuf;
6526
6527 switch (afi) {
6528
6529 case AFNUM_INET:
6530 switch (safi) {
6531
6532 case SAFNUM_UNICAST:
6533 case SAFNUM_MULCAST:
6534 case SAFNUM_UNIMULC:
6535 /* parse each prefix */
6536
6537 end = offset + tlen;
6538
6539 /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
6540 if( detect_add_path_prefix4(tvb, offset, end) ) {
6541 /* IPv4 prefixes with Path Id */
6542 total_length = decode_path_prefix4(tree, pinfo, hf_path_id, hf_addr4, tvb, offset, tag);
6543 } else {
6544 total_length = decode_prefix4(tree, pinfo, NULL,hf_addr4, tvb, offset, tag);
6545 }
6546 if (total_length < 0)
6547 return -1;
6548 break;
6549
6550 case SAFNUM_MPLS_LABEL:
6551 end = offset + tlen;
6552 /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
6553 if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
6554 /* snarf path identifier */
6555 path_identifier = tvb_get_ntohl(tvb, offset);
6556 offset += 4;
6557 total_length += 4;
6558 }
6559 /* snarf length */
6560 plen = tvb_get_guint8(tvb, offset);
6561 stack_strbuf = wmem_strbuf_new_label(pinfo->pool);
6562 labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
6563
6564 offset += (1 + labnum * 3);
6565 if (plen <= (labnum * 3*8)) {
6566 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6567 "%s Labeled IPv4 prefix length %u invalid",
6568 tag, plen);
6569 return -1;
6570 }
6571 plen -= (labnum * 3*8);
6572 length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
6573 if (length < 0) {
6574 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6575 "%s Labeled IPv4 prefix length %u invalid",
6576 tag, plen + (labnum * 3*8));
6577 return -1;
6578 }
6579
6580 set_address(&addr, AT_IPv4, 4, &ip4addr);
6581 if (total_length > 0) {
6582 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6583 (offset + length) - start_offset,
6584 ett_bgp_prefix, NULL,
6585 "Label Stack=%s IPv4=%s/%u PathID %u",
6586 wmem_strbuf_get_str(stack_strbuf),
6587 address_to_str(pinfo->pool, &addr), plen, path_identifier);
6588 proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
6589 start_offset += 4;
6590 } else {
6591 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6592 (offset + length) - start_offset,
6593 ett_bgp_prefix, NULL,
6594 "Label Stack=%s IPv4=%s/%u",
6595 wmem_strbuf_get_str(stack_strbuf),
6596 address_to_str(pinfo->pool, &addr), plen);
6597 }
6598 proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
6599 "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
6600 proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
6601 "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
6602 total_length += (1 + labnum*3) + length;
6603 proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
6604 break;
6605 case SAFNUM_MCAST_VPN:
6606 total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
6607 if (total_length < 0)
6608 return -1;
6609 break;
6610 case SAFNUM_MDT:
6611 total_length = decode_mdt_safi(pinfo, tree, tvb, offset);
6612 if (total_length < 0)
6613 return -1;
6614 break;
6615 case SAFNUM_ROUTE_TARGET:
6616 plen = tvb_get_guint8(tvb, offset);
6617
6618 if (plen == 0) {
6619 proto_tree_add_string(tree, hf_bgp_wildcard_route_target, tvb, offset, 1, tag);
6620 total_length = 1;
6621 break;
6622 }
6623
6624 if ((plen < 32) || (plen > 96)) {
6625 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
6626 "%s Route target length %u invalid",
6627 tag, plen);
6628 return -1;
6629 }
6630
6631 length = (plen + 7)/8;
6632 comm_strbuf = wmem_strbuf_new_label(pinfo->pool);
6633
6634 switch (tvb_get_ntohs(tvb, offset + 1 + 4)) {
6635 case BGP_EXT_COM_RT_AS2:
6636 wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
6637 tvb_get_ntohs(tvb, offset + 1 + 6),
6638 tvb_get_ntohl(tvb, offset + 1 + 8));
6639 break;
6640 case BGP_EXT_COM_RT_IP4:
6641 wmem_strbuf_append_printf(comm_strbuf, "%s:%u",
6642 tvb_ip_to_str(pinfo->pool, tvb, offset + 1 + 6),
6643 tvb_get_ntohs(tvb, offset + 1 + 10));
6644 break;
6645 case BGP_EXT_COM_RT_AS4:
6646 wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
6647 tvb_get_ntohl(tvb, 6),
6648 tvb_get_ntohs(tvb, offset + 1 + 10));
6649 break;
6650 default:
6651 wmem_strbuf_append_printf(comm_strbuf, "Invalid RT type");
6652 break;
6653 }
6654 prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset + 1, length,
6655 ett_bgp_prefix, NULL, "%s %u:%s/%u",
6656 tag, tvb_get_ntohl(tvb, offset + 1 + 0),
6657 wmem_strbuf_get_str(comm_strbuf),
6658 plen);
6659 proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6660 proto_tree_add_item(prefix_tree, hf_bgp_originating_as, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6661 proto_tree_add_string(prefix_tree, hf_bgp_community_prefix, tvb, offset + 1 + 4, length - 4, wmem_strbuf_get_str(comm_strbuf));
6662 total_length = 1 + length;
6663 break;
6664 case SAFNUM_ENCAPSULATION:
6665 plen = tvb_get_guint8(tvb, offset);
6666 if (plen != 32){
6667 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
6668 "%s IPv4 address length %u invalid",
6669 tag, plen);
6670 return -1;
6671 }
6672 offset += 1;
6673
6674 proto_tree_add_item(tree, hf_bgp_endpoint_address, tvb, offset, 4, ENC_NA);
6675
6676 total_length = 5; /* length(1 octet) + address(4 octets) */
6677 break;
6678 case SAFNUM_TUNNEL:
6679 plen = tvb_get_guint8(tvb, offset);
6680 if (plen <= 16){
6681 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6682 "%s Tunnel IPv4 prefix length %u invalid",
6683 tag, plen);
6684 return -1;
6685 }
6686 tnl_id = tvb_get_ntohs(tvb, offset + 1);
6687 offset += 3; /* Length + Tunnel Id */
6688 plen -= 16; /* 2-octet Identifier */
6689 length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
6690 if (length < 0) {
6691 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6692 "%s Tunnel IPv4 prefix length %u invalid",
6693 tag, plen + 16);
6694 return -1;
6695 }
6696 set_address(&addr, AT_IPv4, 4, &ip4addr);
6697 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6698 (offset + length) - start_offset,
6699 ett_bgp_prefix, NULL,
6700 "Tunnel Identifier=0x%x IPv4=%s/%u",
6701 tnl_id, address_to_str(pinfo->pool, &addr), plen);
6702
6703 proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
6704
6705 proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
6706 start_offset + 1, 2, ENC_BIG_ENDIAN);
6707 proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
6708 total_length = 1 + 2 + length; /* length field + Tunnel Id + IPv4 len */
6709 break;
6710 case SAFNUM_SR_POLICY:
6711 total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
6712 if (total_length < 0)
6713 return -1;
6714 break;
6715 case SAFNUM_LAB_VPNUNICAST:
6716 case SAFNUM_LAB_VPNMULCAST:
6717 case SAFNUM_LAB_VPNUNIMULC:
6718 plen = tvb_get_guint8(tvb, offset);
6719 stack_strbuf = wmem_strbuf_new_label(pinfo->pool);
6720 labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
6721
6722 offset += (1 + labnum * 3);
6723 if (plen <= (labnum * 3*8)) {
6724 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6725 "%s Labeled VPN IPv4 prefix length %u invalid",
6726 tag, plen);
6727 return -1;
6728 }
6729 plen -= (labnum * 3*8);
6730
6731 if (plen < 8*8) {
6732 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6733 "%s Labeled VPN IPv4 prefix length %u invalid",
6734 tag, plen + (labnum * 3*8));
6735 return -1;
6736 }
6737 plen -= 8*8;
6738
6739 length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 8, &ip4addr, plen);
6740 if (length < 0) {
6741 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6742 "%s Labeled VPN IPv4 prefix length %u invalid",
6743 tag, plen + (labnum * 3*8) + 8*8);
6744 return -1;
6745 }
6746 set_address(&addr, AT_IPv4, 4, &ip4addr);
6747 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6748 (offset + 8 + length) - start_offset,
6749 ett_bgp_prefix, NULL, "BGP Prefix");
6750
6751 proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
6752 proto_tree_add_string(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf));
6753 proto_tree_add_string(prefix_tree, hf_bgp_rd, tvb, start_offset + 1 + 3 * labnum, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
6754
6755 proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset + 8, length, ip4addr);
6756
6757 total_length = (1 + labnum * 3 + 8) + length;
6758 break;
6759
6760 case SAFNUM_FSPEC_RULE:
6761 case SAFNUM_FSPEC_VPN_RULE:
6762 total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
6763 if(total_length < 0)
6764 return(-1);
6765 total_length++;
6766 break;
6767 default:
6768 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
6769 "Unknown SAFI (%u) for AFI %u", safi, afi);
6770 return -1;
6771 } /* switch (safi) */
6772 break;
6773
6774 case AFNUM_INET6:
6775 switch (safi) {
6776
6777 case SAFNUM_UNICAST:
6778 case SAFNUM_MULCAST:
6779 case SAFNUM_UNIMULC:
6780 /* parse each prefix */
6781
6782 end = offset + tlen;
6783
6784 /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
6785 if( detect_add_path_prefix6(tvb, offset, end) ) {
6786 /* IPv6 prefixes with Path Id */
6787 total_length = decode_path_prefix6(tree, pinfo, hf_path_id, hf_addr6, tvb, offset, tag);
6788 } else {
6789 total_length = decode_prefix6(tree, pinfo, hf_addr6, tvb, offset, 0, tag);
6790 }
6791 if (total_length < 0)
6792 return -1;
6793 break;
6794
6795 case SAFNUM_MPLS_LABEL:
6796 end = offset + tlen;
6797 /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
6798 if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
6799 /* snarf path identifier */
6800 path_identifier = tvb_get_ntohl(tvb, offset);
6801 offset += 4;
6802 total_length += 4;
6803 }
6804 /* snarf length */
6805 plen = tvb_get_guint8(tvb, offset);
6806 stack_strbuf = wmem_strbuf_new_label(pinfo->pool);
6807 labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
6808
6809 offset += (1 + labnum * 3);
6810 if (plen <= (labnum * 3*8)) {
6811 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6812 "%s Labeled IPv6 prefix length %u invalid", tag, plen);
6813 return -1;
6814 }
6815 plen -= (labnum * 3*8);
6816
6817 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
6818 if (length < 0) {
6819 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6820 "%s Labeled IPv6 prefix length %u invalid",
6821 tag, plen + (labnum * 3*8));
6822 return -1;
6823 }
6824
6825 set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
6826 if (total_length > 0) {
6827 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6828 (offset + length) - start_offset,
6829 ett_bgp_prefix, NULL,
6830 "Label Stack=%s, IPv6=%s/%u PathId %u",
6831 wmem_strbuf_get_str(stack_strbuf),
6832 address_to_str(pinfo->pool, &addr), plen, path_identifier);
6833 proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
6834 start_offset += 4;
6835 } else {
6836 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6837 (offset + length) - start_offset,
6838 ett_bgp_prefix, NULL,
6839 "Label Stack=%s, IPv6=%s/%u",
6840 wmem_strbuf_get_str(stack_strbuf),
6841 address_to_str(pinfo->pool, &addr), plen);
6842 }
6843 proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
6844 "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
6845 proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
6846 "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
6847 total_length += (1 + labnum*3) + length;
6848 proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
6849 break;
6850 case SAFNUM_MCAST_VPN:
6851 total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
6852 if (total_length < 0)
6853 return -1;
6854 break;
6855 case SAFNUM_ENCAPSULATION:
6856 plen = tvb_get_guint8(tvb, offset);
6857 if (plen != 128){
6858 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
6859 "%s IPv6 address length %u invalid",
6860 tag, plen);
6861 return -1;
6862 }
6863 offset += 1;
6864
6865 proto_tree_add_item(tree, hf_bgp_endpoint_address_ipv6, tvb, offset, 16, ENC_NA);
6866
6867 total_length = 17; /* length(1 octet) + address(16 octets) */
6868 break;
6869 case SAFNUM_TUNNEL:
6870 plen = tvb_get_guint8(tvb, offset);
6871 if (plen <= 16){
6872 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6873 "%s Tunnel IPv6 prefix length %u invalid",
6874 tag, plen);
6875 return -1;
6876 }
6877 tnl_id = tvb_get_ntohs(tvb, offset + 1);
6878 offset += 3; /* Length + Tunnel Id */
6879 plen -= 16; /* 2-octet Identifier */
6880 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
6881 if (length < 0) {
6882 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6883 "%s Tunnel IPv6 prefix length %u invalid",
6884 tag, plen + 16);
6885 return -1;
6886 }
6887 set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
6888 prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
6889 (offset + length) - start_offset,
6890 ett_bgp_prefix, NULL,
6891 "Tunnel Identifier=0x%x IPv6=%s/%u",
6892 tnl_id, address_to_str(pinfo->pool, &addr), plen);
6893 proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
6894
6895 proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
6896 start_offset + 1, 2, ENC_BIG_ENDIAN);
6897 proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
6898
6899 total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */
6900 break;
6901
6902 case SAFNUM_SR_POLICY:
6903 total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
6904 if (total_length < 0)
6905 return -1;
6906 break;
6907
6908 case SAFNUM_LAB_VPNUNICAST:
6909 case SAFNUM_LAB_VPNMULCAST:
6910 case SAFNUM_LAB_VPNUNIMULC:
6911 plen = tvb_get_guint8(tvb, offset);
6912 stack_strbuf = wmem_strbuf_new_label(pinfo->pool);
6913 labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
6914
6915 offset += (1 + labnum * 3);
6916 if (plen <= (labnum * 3*8)) {
6917 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6918 "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
6919 return -1;
6920 }
6921 plen -= (labnum * 3*8);
6922
6923 rd_type = tvb_get_ntohs(tvb,offset);
6924 if (plen < 8*8) {
6925 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6926 "%s Labeled VPN IPv6 prefix length %u invalid",
6927 tag, plen + (labnum * 3*8));
6928 return -1;
6929 }
6930 plen -= 8*8;
6931
6932 switch (rd_type) {
6933
6934 case FORMAT_AS2_LOC:
6935 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 8, &ip6addr, plen);
6936 if (length < 0) {
6937 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6938 "%s Labeled VPN IPv6 prefix length %u invalid",
6939 tag, plen + (labnum * 3*8) + 8*8);
6940 return -1;
6941 }
6942
6943 /* XXX - break up into multiple fields */
6944 set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
6945 proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset,
6946 (offset + 8 + length) - start_offset,
6947 wmem_strbuf_get_str(stack_strbuf), "Label Stack=%s RD=%u:%u, IPv6=%s/%u",
6948 wmem_strbuf_get_str(stack_strbuf),
6949 tvb_get_ntohs(tvb, offset + 2),
6950 tvb_get_ntohl(tvb, offset + 4),
6951 address_to_str(pinfo->pool, &addr), plen);
6952 total_length = (1 + labnum * 3 + 8) + length;
6953 break;
6954
6955 case FORMAT_IP_LOC:
6956 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 8, &ip6addr, plen);
6957 if (length < 0) {
6958 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6959 "%s Labeled VPN IPv6 prefix length %u invalid",
6960 tag, plen + (labnum * 3*8) + 8*8);
6961 return -1;
6962 }
6963
6964 /* XXX - break up into multiple fields */
6965 set_address(&addr, AT_IPv6, 16, &ip6addr);
6966 proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset,
6967 (offset + 8 + length) - start_offset,
6968 wmem_strbuf_get_str(stack_strbuf), "Label Stack=%s RD=%s:%u, IPv6=%s/%u",
6969 wmem_strbuf_get_str(stack_strbuf),
6970 tvb_ip_to_str(pinfo->pool, tvb, offset + 2),
6971 tvb_get_ntohs(tvb, offset + 6),
6972 address_to_str(pinfo->pool, &addr), plen);
6973 total_length = (1 + labnum * 3 + 8) + length;
6974 break;
6975
6976 case FORMAT_AS4_LOC:
6977 length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 8, &ip6addr, plen);
6978 if (length < 0) {
6979 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
6980 "%s Labeled VPN IPv6 prefix length %u invalid",
6981 tag, plen + (labnum * 3*8) + 8*8);
6982 return -1;
6983 }
6984
6985 /* XXX - break up into multiple fields */
6986 set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
6987 proto_tree_add_string_format(tree, hf_bgp_label_stack, tvb, start_offset,
6988 (offset + 8 + length) - start_offset,
6989 "Label Stack=%s RD=%u.%u:%u, IPv6=%s/%u",
6990 wmem_strbuf_get_str(stack_strbuf),
6991 tvb_get_ntohs(tvb, offset + 2),
6992 tvb_get_ntohs(tvb, offset + 4),
6993 tvb_get_ntohs(tvb, offset + 6),
6994 address_to_str(pinfo->pool, &addr), plen);
6995 total_length = (1 + labnum * 3 + 8) + length;
6996 break;
6997 default:
6998 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_label_vpn, tvb, start_offset, 0,
6999 "Unknown labeled VPN IPv6 address format %u", rd_type);
7000 return -1;
7001 } /* switch (rd_type) */
7002 break;
7003 case SAFNUM_FSPEC_RULE:
7004 case SAFNUM_FSPEC_VPN_RULE:
7005 total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
7006 if(total_length < 0)
7007 return(-1);
7008 total_length++;
7009 break;
7010 default:
7011 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
7012 "Unknown SAFI (%u) for AFI %u", safi, afi);
7013 return -1;
7014 } /* switch (safi) */
7015 break;
7016
7017 case AFNUM_L2VPN:
7018 case AFNUM_L2VPN_OLD:
7019 switch (safi) {
7020
7021 case SAFNUM_LAB_VPNUNICAST:
7022 case SAFNUM_LAB_VPNMULCAST:
7023 case SAFNUM_LAB_VPNUNIMULC:
7024 case SAFNUM_VPLS:
7025 plen = tvb_get_ntohs(tvb,offset);
7026 proto_tree_add_item(tree, hf_bgp_vplsad_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7027
7028 proto_tree_add_string(tree, hf_bgp_vplsad_rd, tvb, offset+2, 8, decode_bgp_rd(pinfo->pool, tvb, offset+2));
7029 /* RFC6074 Section 7 BGP-AD and VPLS-BGP Interoperability
7030 Both BGP-AD and VPLS-BGP [RFC4761] use the same AFI/SAFI. In order
7031 for both BGP-AD and VPLS-BGP to co-exist, the NLRI length must be
7032 used as a demultiplexer.
7033
7034 The BGP-AD NLRI has an NLRI length of 12 bytes, containing only an
7035 8-byte RD and a 4-byte VSI-ID. VPLS-BGP [RFC4761] uses a 17-byte
7036 NLRI length. Therefore, implementations of BGP-AD must ignore NLRI
7037 that are greater than 12 bytes.
7038 */
7039 if(plen == 12) /* BGP-AD */
7040 {
7041 proto_tree_add_item(tree, hf_bgp_bgpad_pe_addr, tvb, offset+10, 4, ENC_NA);
7042 }else{ /* VPLS-BGP */
7043
7044 proto_tree_add_item(tree, hf_bgp_vplsbgp_ce_id, tvb, offset+10, 2, ENC_BIG_ENDIAN);
7045
7046 proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_offset, tvb, offset+12, 2, ENC_BIG_ENDIAN);
7047 proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_size, tvb, offset+14, 2, ENC_BIG_ENDIAN);
7048 stack_strbuf = wmem_strbuf_new_label(pinfo->pool);
7049 decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
7050 proto_tree_add_string(tree, hf_bgp_vplsbgp_labelblock_base, tvb, offset+16, plen-14, wmem_strbuf_get_str(stack_strbuf));
7051
7052 }
7053 /* FIXME there are subTLVs left to decode ... for now lets omit them */
7054 total_length = plen+2;
7055 break;
7056
7057 case SAFNUM_EVPN:
7058 total_length = decode_evpn_nlri(tree, tvb, offset, pinfo);
7059 break;
7060
7061 default:
7062 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
7063 "Unknown SAFI (%u) for AFI %u", safi, afi);
7064 return -1;
7065 } /* switch (safi) */
7066 break;
7067 case AFNUM_BGP_LS:
7068 nlri_type = tvb_get_ntohs(tvb, offset);
7069 total_length = tvb_get_ntohs(tvb, offset + 2);
7070 length = total_length;
7071 total_length += 4;
7072
7073 if (safi == SAFNUM_BGP_LS || safi == SAFNUM_BGP_LS_VPN) {
7074 ti = proto_tree_add_item(tree, hf_bgp_ls_nlri, tvb, offset, total_length , ENC_NA);
7075 } else if (safi == SAFNUM_LAB_VPNUNICAST) {
7076 ti = proto_tree_add_item(tree, hf_bgp_ls_safi128_nlri, tvb, offset, total_length , ENC_NA);
7077 } else
7078 return -1;
7079
7080 prefix_tree = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
7081 proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_type, tvb, offset, 2, ENC_BIG_ENDIAN);
7082 proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7083 offset += 4;
7084
7085 /* when SAFI 128, then write route distinguisher */
7086 if (safi == SAFNUM_LAB_VPNUNICAST) {
7087 if (length < BGP_ROUTE_DISTINGUISHER_SIZE) {
7088 if (length == 0) {
7089 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
7090 "Unexpected end of SAFI 128 NLRI, Route Distinguisher field is required!");
7091 }
7092 if (length > 0) {
7093 expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
7094 "Unexpected Route Distinguisher length (%u)!",
7095 length);
7096 }
7097 break;
7098 }
7099 disting_item = proto_tree_add_item(prefix_tree, hf_bgp_ls_safi128_nlri_route_distinguisher,
7100 tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
7101 disting_tree = proto_item_add_subtree(disting_item, ett_bgp_mp_reach_nlri);
7102 tmp16 = tvb_get_ntohs(tvb, offset);
7103 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_distinguisher_type,
7104 tvb, offset, 2, ENC_BIG_ENDIAN);
7105 /* Route Distinguisher Type */
7106 switch (tmp16) {
7107 case 0:
7108 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
7109 tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7110 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
7111 tvb, offset + 4, 4, ENC_BIG_ENDIAN);
7112 break;
7113
7114 case 1:
7115 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
7116 tvb, offset + 2, 4, ENC_BIG_ENDIAN);
7117 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
7118 tvb, offset + 6, 2, ENC_BIG_ENDIAN);
7119 break;
7120
7121 case 2:
7122 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
7123 tvb, offset + 2, 4, ENC_BIG_ENDIAN);
7124 proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
7125 tvb, offset + 6, 2, ENC_BIG_ENDIAN);
7126 break;
7127
7128 default:
7129 expert_add_info_format(pinfo, disting_tree, &ei_bgp_ls_error,
7130 "Unknown Route Distinguisher type (%u)", tmp16);
7131 }
7132 offset += BGP_ROUTE_DISTINGUISHER_SIZE;
7133 length -= BGP_ROUTE_DISTINGUISHER_SIZE;
7134 }
7135
7136 switch (nlri_type) {
7137 case LINK_STATE_LINK_NLRI:
7138
7139 nlri_ti = proto_tree_add_item(prefix_tree,
7140 hf_bgp_ls_nlri_link_nlri_type, tvb, offset, length,
7141 ENC_NA);
7142 nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
7143 tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
7144 offset, pinfo, length);
7145 if (tmp_length < 1)
7146 return -1;
7147
7148 offset += tmp_length;
7149 length -= tmp_length;
7150
7151 /* dissect Remote Node descriptors TLV */
7152 if (length > 0 && length < 4) {
7153 expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
7154 "Unknown data in Link-State Link NLRI!");
7155 break;
7156 }
7157 if (length < 1)
7158 break;
7159
7160 tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, nlri_tree, offset,
7161 pinfo, BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS);
7162 if (tmp_length < 1)
7163 return -1;
7164
7165 offset += tmp_length;
7166 length -= tmp_length;
7167
7168 /* dissect Link Descriptor NLRI */
7169 if (length > 0 && length < 4) {
7170 expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
7171 "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
7172 break;
7173 }
7174 if (length < 1)
7175 break;
7176
7177 tmp_length = decode_bgp_link_nlri_link_descriptors(tvb, nlri_tree,
7178 offset, pinfo, length);
7179 if (tmp_length < 1)
7180 return -1;
7181
7182 break;
7183
7184 case LINK_STATE_NODE_NLRI:
7185 nlri_ti = proto_tree_add_item(prefix_tree,
7186 hf_bgp_ls_nlri_node_nlri_type, tvb, offset, length,
7187 ENC_NA);
7188 nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
7189 tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
7190 offset, pinfo, length);
7191 if (tmp_length < 1)
7192 return -1;
7193
7194 break;
7195
7196 case LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI:
7197 nlri_ti = proto_tree_add_item(prefix_tree,
7198 hf_bgp_ls_ipv4_topology_prefix_nlri_type, tvb, offset, length,
7199 ENC_NA);
7200 nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
7201 tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
7202 offset, pinfo, length);
7203 if (tmp_length < 1)
7204 return -1;
7205
7206 offset += tmp_length;
7207 length -= tmp_length;
7208
7209 /* dissect Prefix Descriptors NLRI */
7210 if (length > 0 && length < 4) {
7211 expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
7212 "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
7213 break;
7214 }
7215 if (length < 1)
7216 break;
7217
7218 tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
7219 offset, pinfo, length, IP_PROTO_IPV4);
7220 if (tmp_length < 1)
7221 return -1;
7222
7223 break;
7224
7225 case LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI:
7226 nlri_ti = proto_tree_add_item(prefix_tree,
7227 hf_bgp_ls_ipv6_topology_prefix_nlri_type, tvb, offset, length,
7228 ENC_NA);
7229 nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
7230 tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
7231 offset, pinfo, length);
7232 if (tmp_length < 1)
7233 return -1;
7234
7235 offset += tmp_length;
7236 length -= tmp_length;
7237
7238 /* dissect Prefix Descriptors NLRI */
7239 if (length > 0 && length < 4) {
7240 expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
7241 "Unknown data in Link-State Link NLRI!");
7242 break;
7243 }
7244 if (length < 1)
7245 break;
7246
7247 tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
7248 offset, pinfo, length, IP_PROTO_IPV6);
7249 if (tmp_length < 1)
7250 return -1;
7251
7252 break;
7253
7254 default:
7255 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_ls_error, tvb, start_offset, 0,
7256 "Unknown Link-State NLRI type (%u)", afi);
7257
7258 }
7259 break;
7260
7261 default:
7262 proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_afi, tvb, start_offset, 0,
7263 "Unknown AFI (%u) value", afi);
7264 return -1;
7265 } /* switch (afi) */
7266 return(total_length);
7267 }
7268
7269 /*
7270 * Dissect a BGP capability.
7271 */
7272 static int
dissect_bgp_capability_item(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo,int offset,gboolean action)7273 dissect_bgp_capability_item(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, gboolean action)
7274 {
7275 proto_tree *cap_tree;
7276 proto_item *ti;
7277 proto_item *ti_len;
7278 guint8 ctype;
7279 guint8 clen;
7280
7281 ti = proto_tree_add_item(tree, hf_bgp_cap, tvb, offset, -1, ENC_NA);
7282 cap_tree = proto_item_add_subtree(ti, ett_bgp_cap);
7283
7284 proto_tree_add_item(cap_tree, hf_bgp_cap_type, tvb, offset, 1, ENC_BIG_ENDIAN);
7285 ctype = tvb_get_guint8(tvb, offset);
7286 proto_item_append_text(ti, ": %s", val_to_str(ctype, capability_vals, "Unknown capability %d"));
7287 offset += 1;
7288
7289 ti_len = proto_tree_add_item(cap_tree, hf_bgp_cap_length, tvb, offset, 1, ENC_BIG_ENDIAN);
7290 clen = tvb_get_guint8(tvb, offset);
7291 proto_item_set_len(ti, clen+2);
7292 offset += 1;
7293
7294 if(action){
7295 proto_tree_add_item(cap_tree, hf_bgp_cap_action, tvb, offset, 1, ENC_BIG_ENDIAN);
7296 proto_item_set_len(ti, clen+3);
7297 offset += 1;
7298 }
7299
7300 /* check the capability type */
7301 switch (ctype) {
7302 case BGP_CAPABILITY_RESERVED:
7303 if (clen != 0) {
7304 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
7305 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7306 }
7307 offset += clen;
7308 break;
7309 case BGP_CAPABILITY_MULTIPROTOCOL:
7310 if (clen != 4) {
7311 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
7312 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7313 offset += clen;
7314 }
7315 else {
7316 /* AFI */
7317 proto_tree_add_item(cap_tree, hf_bgp_cap_mp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
7318 offset += 2;
7319
7320 /* Reserved */
7321 proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
7322 offset += 1;
7323
7324 /* SAFI */
7325 proto_tree_add_item(cap_tree, hf_bgp_cap_mp_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
7326 offset += 1;
7327 }
7328 break;
7329 case BGP_CAPABILITY_EXTENDED_NEXT_HOP: {
7330 int eclen = offset + clen;
7331 while (offset <= eclen - 6) {
7332 /* AFI */
7333 proto_tree_add_item(cap_tree, hf_bgp_cap_enh_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
7334 offset += 2;
7335
7336 /* SAFI */
7337 proto_tree_add_item(cap_tree, hf_bgp_cap_enh_safi, tvb, offset, 2, ENC_BIG_ENDIAN);
7338 offset += 2;
7339
7340 /* AFI */
7341 proto_tree_add_item(cap_tree, hf_bgp_cap_enh_nhafi, tvb, offset, 2, ENC_BIG_ENDIAN);
7342 offset += 2;
7343 }
7344 if (offset != eclen) {
7345 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of 6", clen);
7346 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, eclen - offset, ENC_NA);
7347 offset = eclen;
7348 }
7349 }
7350 break;
7351 case BGP_CAPABILITY_GRACEFUL_RESTART:
7352 if ((clen < 6) && (clen != 2)) {
7353 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
7354 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7355 offset += clen;
7356 }
7357 else {
7358 int eclen = offset + clen;
7359
7360 static int * const timer_flags[] = {
7361 &hf_bgp_cap_gr_timers_restart_flag,
7362 &hf_bgp_cap_gr_timers_notification_flag,
7363 &hf_bgp_cap_gr_timers_restart_time,
7364 NULL
7365 };
7366
7367 if (clen == 2){
7368 expert_add_info(pinfo, ti_len, &ei_bgp_cap_gr_helper_mode_only);
7369 }
7370
7371 /* Timers */
7372 proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_timers, ett_bgp_cap, timer_flags, ENC_BIG_ENDIAN);
7373 offset += 2;
7374
7375 /*
7376 * what follows is alist of AFI/SAFI/flag triplets
7377 * read it until the TLV ends
7378 */
7379 while (offset < eclen) {
7380 static int * const flags[] = {
7381 &hf_bgp_cap_gr_flag_pfs,
7382 NULL
7383 };
7384
7385 /* AFI */
7386 proto_tree_add_item(cap_tree, hf_bgp_cap_gr_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
7387 offset += 2;
7388
7389 /* SAFI */
7390 proto_tree_add_item(cap_tree, hf_bgp_cap_gr_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
7391 offset += 1;
7392
7393 /* Flags */
7394 proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_flag, ett_bgp_cap, flags, ENC_BIG_ENDIAN);
7395 offset += 1;
7396 }
7397 }
7398 break;
7399 case BGP_CAPABILITY_4_OCTET_AS_NUMBER:
7400 if (clen != 4) {
7401 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
7402 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7403 offset += clen;
7404 }
7405 else {
7406 proto_tree_add_item(cap_tree, hf_bgp_cap_4as, tvb, offset, 4, ENC_BIG_ENDIAN);
7407 offset += 4;
7408 }
7409 break;
7410 case BGP_CAPABILITY_DYNAMIC_CAPABILITY:
7411 if (clen > 0) {
7412 int eclen = offset + clen;
7413
7414 while (offset < eclen) {
7415 proto_tree_add_item(cap_tree, hf_bgp_cap_dc, tvb, offset, 1, ENC_BIG_ENDIAN);
7416 offset += 1;
7417 }
7418 }
7419 break;
7420 case BGP_CAPABILITY_ADDITIONAL_PATHS:
7421 if (clen % 4 != 0) {
7422 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of 4", clen);
7423 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7424 offset += clen;
7425 }
7426 else { /* AFI SAFI Send-receive*/
7427 int eclen = offset + clen;
7428
7429 while (offset < eclen){
7430 /* AFI */
7431 proto_tree_add_item(cap_tree, hf_bgp_cap_ap_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
7432 offset += 2;
7433
7434 /* SAFI */
7435 proto_tree_add_item(cap_tree, hf_bgp_cap_ap_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
7436 offset += 1;
7437
7438 /* Send-Receive */
7439 proto_tree_add_item(cap_tree, hf_bgp_cap_ap_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
7440 offset += 1;
7441 }
7442 }
7443 break;
7444
7445 case BGP_CAPABILITY_FQDN:{
7446 guint8 hostname_len, domain_name_len;
7447
7448 proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_hostname_len, tvb, offset, 1, ENC_NA);
7449 hostname_len = tvb_get_guint8(tvb, offset);
7450 offset += 1;
7451
7452 proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_hostname, tvb, offset, hostname_len, ENC_ASCII|ENC_NA);
7453 offset += hostname_len;
7454
7455 proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_domain_name_len, tvb, offset, 1, ENC_NA);
7456 domain_name_len = tvb_get_guint8(tvb, offset);
7457 offset += 1;
7458
7459 proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_domain_name, tvb, offset, domain_name_len, ENC_ASCII|ENC_NA);
7460 offset += domain_name_len;
7461
7462 }
7463 break;
7464
7465 case BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH:
7466 case BGP_CAPABILITY_ROUTE_REFRESH_CISCO:
7467 case BGP_CAPABILITY_ROUTE_REFRESH:
7468 case BGP_CAPABILITY_CP_ORF:
7469 if (clen != 0) {
7470 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
7471 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7472 }
7473 offset += clen;
7474 break;
7475 case BGP_CAPABILITY_ORF_CISCO:
7476 case BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING:
7477 if (clen < 6) {
7478 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
7479 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7480 offset += clen;
7481 }
7482 else {
7483 guint8 orfnum; /* number of ORFs */
7484 int i;
7485 /* AFI */
7486 proto_tree_add_item(cap_tree, hf_bgp_cap_orf_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
7487 offset += 2;
7488
7489 /* Reserved */
7490 proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
7491 offset += 1;
7492
7493 /* SAFI */
7494 proto_tree_add_item(cap_tree, hf_bgp_cap_orf_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
7495 offset += 1;
7496
7497 /* Number of ORFs */
7498 orfnum = tvb_get_guint8(tvb, offset);
7499 proto_tree_add_item(cap_tree, hf_bgp_cap_orf_number, tvb, offset, 1, ENC_BIG_ENDIAN);
7500 offset += 1;
7501 for (i=0; i<orfnum; i++) {
7502 /* ORF Type */
7503 proto_tree_add_item(cap_tree, hf_bgp_cap_orf_type, tvb, offset, 1, ENC_BIG_ENDIAN);
7504 offset += 1;
7505
7506 /* Send/Receive */
7507 proto_tree_add_item(cap_tree, hf_bgp_cap_orf_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
7508 offset += 1;
7509 }
7510 }
7511
7512 break;
7513 case BGP_CAPABILITY_MULTISESSION_CISCO:
7514 if (clen < 1) {
7515 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 1", clen);
7516 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7517 offset += clen;
7518 }
7519 else {
7520 proto_tree_add_item(cap_tree, hf_bgp_cap_multisession_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
7521 offset += 1;
7522 }
7523
7524 break;
7525 case BGP_CAPABILITY_BGPSEC:
7526 if (clen != 3) {
7527 expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 3", clen);
7528 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7529 offset += clen;
7530 }
7531 else {
7532 static int * const bgpsec_flags[] = {
7533 &hf_bgp_cap_bgpsec_version,
7534 &hf_bgp_cap_bgpsec_sendreceive,
7535 &hf_bgp_cap_bgpsec_reserved,
7536 NULL
7537 };
7538
7539 /* BGPsec Flags */
7540 proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_bgpsec_flags, ett_bgp_cap, bgpsec_flags, ENC_BIG_ENDIAN);
7541 offset += 1;
7542
7543 /* BGPsec AFI */
7544 proto_tree_add_item(cap_tree, hf_bgp_cap_bgpsec_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
7545 offset += 2;
7546 }
7547
7548 break;
7549 /* unknown capability */
7550 default:
7551 if (clen != 0) {
7552 proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
7553 }
7554 offset += clen;
7555 break;
7556 } /* switch (ctype) */
7557 return offset;
7558 }
7559
7560 /*
7561 * Dissect a BGP OPEN message.
7562 */
7563
7564 static void
dissect_bgp_open(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo)7565 dissect_bgp_open(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
7566 {
7567 guint8 optlen; /* Option Length */
7568 int ptype; /* parameter type */
7569 int plen; /* parameter length */
7570 int cend; /* capabilities end */
7571 int oend; /* options end */
7572 int offset; /* tvb offset counter */
7573 guint32 as_num; /* AS Number */
7574 proto_item *ti; /* tree item */
7575 proto_tree *opt_tree; /* subtree for options */
7576 proto_tree *par_tree; /* subtree for par options */
7577
7578 offset = BGP_MARKER_SIZE + 2 + 1;
7579
7580 proto_tree_add_item(tree, hf_bgp_open_version, tvb, offset, 1, ENC_BIG_ENDIAN);
7581 offset += 1;
7582
7583 ti = proto_tree_add_item_ret_uint(tree, hf_bgp_open_myas, tvb, offset, 2, ENC_BIG_ENDIAN, &as_num);
7584 if (as_num == BGP_AS_TRANS) {
7585 proto_item_append_text(ti, " (AS_TRANS)");
7586 }
7587 offset += 2;
7588
7589 proto_tree_add_item(tree, hf_bgp_open_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN);
7590 offset += 2;
7591
7592 proto_tree_add_item(tree, hf_bgp_open_identifier, tvb, offset, 4, ENC_NA);
7593 offset += 4;
7594
7595 proto_tree_add_item(tree, hf_bgp_open_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN);
7596 optlen = tvb_get_guint8(tvb, offset);
7597 offset += 1;
7598
7599 /* optional parameters */
7600 if (optlen > 0) {
7601 oend = offset + optlen;
7602
7603 /* add a subtree */
7604 ti = proto_tree_add_item(tree, hf_bgp_open_opt_params, tvb, offset, optlen, ENC_NA);
7605 opt_tree = proto_item_add_subtree(ti, ett_bgp_options);
7606
7607 /* step through all of the optional parameters */
7608 while (offset < oend) {
7609
7610 /* add a subtree */
7611 ti = proto_tree_add_item(opt_tree, hf_bgp_open_opt_param, tvb, offset, -1, ENC_NA);
7612 par_tree = proto_item_add_subtree(ti, ett_bgp_options);
7613
7614 /* display and grab the type ... */
7615 proto_tree_add_item(par_tree, hf_bgp_open_opt_param_type, tvb, offset, 1, ENC_BIG_ENDIAN);
7616 ptype = tvb_get_guint8(tvb, offset);
7617 proto_item_append_text(ti, ": %s", val_to_str(ptype, bgp_open_opt_vals, "Unknown Parameter %d"));
7618 offset += 1;
7619
7620 /* ... and length */
7621 proto_tree_add_item(par_tree, hf_bgp_open_opt_param_len, tvb, offset, 1, ENC_BIG_ENDIAN);
7622 plen = tvb_get_guint8(tvb, offset);
7623 proto_item_set_len(ti, plen+2);
7624 offset += 1;
7625
7626 /* check the type */
7627 switch (ptype) {
7628 case BGP_OPTION_AUTHENTICATION:
7629 proto_tree_add_item(par_tree, hf_bgp_open_opt_param_auth, tvb, offset, plen, ENC_NA);
7630 offset += plen;
7631 break;
7632 case BGP_OPTION_CAPABILITY:
7633 /* grab the capability code */
7634 cend = offset + plen;
7635
7636 /* step through all of the capabilities */
7637 while (offset < cend) {
7638 offset = dissect_bgp_capability_item(tvb, par_tree, pinfo, offset, FALSE);
7639 }
7640 break;
7641 default:
7642 proto_tree_add_item(opt_tree, hf_bgp_open_opt_param_unknown, tvb, offset, plen, ENC_NA);
7643 break;
7644 } /* switch (ptype) */
7645 }
7646 }
7647 }
7648
7649 /*
7650 * Heuristic for auto-detection of ASN length 2 or 4 bytes
7651 */
7652
7653 static guint8
heuristic_as2_or_4_from_as_path(tvbuff_t * tvb,gint as_path_offset,gint end_attr_offset,guint8 bgpa_type,gint * number_as_segment)7654 heuristic_as2_or_4_from_as_path(tvbuff_t *tvb, gint as_path_offset, gint end_attr_offset, guint8 bgpa_type, gint *number_as_segment)
7655 {
7656 gint counter_as_segment=0;
7657 gint offset_check=0;
7658 guint8 assumed_as_len=0;
7659 gint asn_is_null=0;
7660 gint j=0;
7661 gint k=0;
7662 gint k_save=0;
7663 guint8 next_type=0;
7664 guint8 length=0;
7665 /* Heuristic is done in two phases
7666 * First we try to identify the as length (2 or 4 bytes)
7667 * then we do check that our assumption is ok
7668 * recalculating the offset and checking we end up with the right result
7669 * k is used to navigate into the AS_PATH */
7670 k = as_path_offset;
7671 /* case of AS_PATH type being explicitly 4 bytes ASN */
7672 if (bgpa_type == BGPTYPE_AS4_PATH) {
7673 /* We calculate numbers of segments and return the as length */
7674 assumed_as_len = 4;
7675 while (k < end_attr_offset)
7676 {
7677 /* we skip segment type and point to length */
7678 k++;
7679 length = tvb_get_guint8(tvb, k);
7680 /* length read let's move to first ASN */
7681 k++;
7682 /* we move to the next segment */
7683 k = k + (length*assumed_as_len);
7684 counter_as_segment++;
7685 }
7686 *number_as_segment = counter_as_segment;
7687 return(4);
7688 }
7689 /* case of user specified ASN length */
7690 if (bgp_asn_len != 0) {
7691 /* We calculate numbers of segments and return the as length */
7692 assumed_as_len = bgp_asn_len;
7693 while (k < end_attr_offset)
7694 {
7695 /* we skip segment type and point to length */
7696 k++;
7697 length = tvb_get_guint8(tvb, k);
7698 /* length read let's move to first ASN */
7699 k++;
7700 /* we move to the next segment */
7701 k = k + (length*assumed_as_len);
7702 /* if I am not facing the last segment k need to point to next length */
7703 counter_as_segment++;
7704 }
7705 *number_as_segment = counter_as_segment;
7706 return(bgp_asn_len);
7707 }
7708 /* case of a empty path attribute */
7709 if (as_path_offset == end_attr_offset)
7710 {
7711 *number_as_segment = 0;
7712 return(bgp_asn_len);
7713 }
7714 /* case of we run the heuristic to find the as length */
7715 k_save = k;
7716 /* we do run the heuristic on first segment and look at next segment if it exists */
7717 k++;
7718 length = tvb_get_guint8(tvb, k++);
7719 /* let's do some checking with an as length 2 bytes */
7720 offset_check = k + 2*length;
7721 next_type = tvb_get_guint8(tvb, offset_check);
7722 /* we do have one segment made of 2 bytes ASN we do reach the end of the attribute taking
7723 * 2 bytes ASN for our calculation */
7724 if (offset_check == end_attr_offset)
7725 assumed_as_len = 2;
7726 /* else we do check if we see a valid AS segment type after (length * AS 2 bytes) */
7727 else if (next_type == AS_SET ||
7728 next_type == AS_SEQUENCE ||
7729 next_type == AS_CONFED_SEQUENCE ||
7730 next_type == AS_CONFED_SET) {
7731 /* that's a good sign to assume ASN 2 bytes let's check that 2 first bytes of each ASN doesn't eq 0 to confirm */
7732 for (j=0; j < length && !asn_is_null; j++) {
7733 if(tvb_get_ntohs(tvb, k+(2*j)) == 0) {
7734 asn_is_null = 1;
7735 }
7736 }
7737 if (asn_is_null == 0)
7738 assumed_as_len = 2;
7739 else
7740 assumed_as_len = 4;
7741 }
7742 else
7743 /* we didn't find a valid AS segment type in the next coming segment assuming 2 bytes ASN */
7744 assumed_as_len = 4;
7745 /* now that we have our assumed as length let's check we can calculate the attribute length properly */
7746 k = k_save;
7747 while (k < end_attr_offset)
7748 {
7749 /* we skip the AS type */
7750 k++;
7751 /* we get the length of the AS segment */
7752 length = tvb_get_guint8(tvb, k);
7753 /* let's point to the fist byte of the AS segment */
7754 k++;
7755 /* we move to the next segment */
7756 k = k + (length*assumed_as_len);
7757 counter_as_segment++;
7758 }
7759 if (k == end_attr_offset) {
7760 /* success */
7761 *number_as_segment = counter_as_segment;
7762 return(assumed_as_len);
7763 } else
7764 /* we are in trouble */
7765 return(-1);
7766 }
7767
7768 /*
7769 * Dissect BGP update extended communities
7770 */
7771
7772 static int
dissect_bgp_update_ext_com(proto_tree * parent_tree,tvbuff_t * tvb,guint16 tlen,guint tvb_off,packet_info * pinfo)7773 dissect_bgp_update_ext_com(proto_tree *parent_tree, tvbuff_t *tvb, guint16 tlen, guint tvb_off, packet_info *pinfo)
7774 {
7775 int offset=0;
7776 int end=0;
7777 guint8 com_type_high_byte;
7778 guint8 com_stype_low_byte;
7779 proto_tree *communities_tree;
7780 proto_tree *community_tree;
7781 proto_tree *community_type_tree;
7782 proto_item *communities_item=NULL;
7783 proto_item *community_item=NULL;
7784 proto_item *community_type_item=NULL;
7785 guint32 encaps_tunnel_type;
7786
7787 offset = tvb_off ;
7788 end = tvb_off + tlen ;
7789 communities_item = proto_tree_add_item(parent_tree, hf_bgp_ext_communities, tvb, offset, tlen, ENC_NA);
7790 communities_tree = proto_item_add_subtree(communities_item, ett_bgp_extended_communities);
7791 proto_item_append_text(communities_item, ": (%u communit%s)", tlen/8, plurality(tlen/8, "y", "ies"));
7792 while (offset < end) {
7793 com_type_high_byte = tvb_get_guint8(tvb,offset); /* high community type octet */
7794 com_stype_low_byte = tvb_get_guint8(tvb,offset+1); /* sub type low community type octet */
7795 community_item = proto_tree_add_item(communities_tree, hf_bgp_ext_community, tvb, offset, 8, ENC_NA);
7796 community_tree = proto_item_add_subtree(community_item,ett_bgp_extended_community);
7797
7798 /* Add the Type octet as a decoded item to the community_tree right away,
7799 * and also dissect its two top bits in a subtree.
7800 */
7801
7802 community_type_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_type_high, tvb, offset, 1, ENC_BIG_ENDIAN);
7803 community_type_tree = proto_item_add_subtree(community_type_item, ett_bgp_ext_com_type);
7804 proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_auth, tvb, offset, 1, ENC_BIG_ENDIAN);
7805 proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_tran, tvb, offset, 1, ENC_BIG_ENDIAN);
7806
7807 /* In the switch(), handlers of individual types and subtypes should
7808 * add and dissect the remaining 7 octets. Dissectors should use the
7809 * proto_item_set_text() on the community_item to set the community
7810 * name in the displayed label as specifically as possible, and
7811 * proto_item_append_text() to add reasonable details.
7812 *
7813 * The intended text label of the community_item for each extended
7814 * community attribute is:
7815 *
7816 * Community Name: Values [General Community Type Name]
7817 *
7818 * For example:
7819 * Route Target: 1:1 [Transitive 2-Octet AS-Specific]
7820 * Unknown subtype 0x01: 0x8081 0x0000 0x2800 [Non-Transitive Opaque]
7821 * Unknown type 0x88 subtype 0x00: 0x0000 0x0000 0x0000 [Unknown community]
7822 *
7823 * The [] part with general community name is added at the end
7824 * of the switch().
7825 *
7826 * The first option (Route Target) shows a fully recognized and
7827 * dissected extended community. Note that the line immediately calls
7828 * the community by its most specific known type (Route Target), while
7829 * the general type is shown in the brackets. The second option shows a
7830 * community whose Type is recognized (Non-Transitive Opaque) but whose
7831 * Subtype is not known. The third option shows an unrecognized
7832 * extended community.
7833 *
7834 * Printing out the community raw value as 3 short ints is intentional:
7835 * With an unknown community, we cannot assume any particular internal
7836 * value format, and dumping the value in short ints provides for easy
7837 * readability.
7838 */
7839
7840 switch (com_type_high_byte) {
7841 case BGP_EXT_COM_TYPE_HIGH_TR_AS2: /* Transitive Two-Octet AS-Specific Extended Community */
7842 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7843 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
7844 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
7845
7846 proto_item_set_text(community_item, "%s: %u:%u",
7847 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_as2, "Unknown subtype 0x%02x"),
7848 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
7849 break;
7850
7851 case BGP_EXT_COM_TYPE_HIGH_NTR_AS2: /* Non-Transitive Two-Octet AS-Specific Extended Community */
7852 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7853 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
7854
7855 proto_item_set_text(community_item, "%s:",
7856 val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_as2, "Unknown subtype 0x%02x"));
7857
7858 switch (com_stype_low_byte) {
7859 case BGP_EXT_COM_STYPE_AS2_LBW:
7860 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_link_bw, tvb, offset+4, 4, ENC_BIG_ENDIAN);
7861
7862 proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
7863 tvb_get_ntohs(tvb,offset+2),
7864 tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
7865 break;
7866
7867 default:
7868 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
7869
7870 proto_item_append_text(community_item, " %u:%u",
7871 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
7872 break;
7873 }
7874 break;
7875
7876 case BGP_EXT_COM_TYPE_HIGH_TR_IP4: /* Transitive IPv4-Address-specific Extended Community */
7877 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7878
7879 proto_item_set_text(community_item, "%s: %s:%u",
7880 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_IP4, "Unknown subtype 0x%02x"),
7881 tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
7882
7883 switch(com_stype_low_byte) {
7884 case BGP_EXT_COM_STYPE_IP4_OSPF_RID:
7885 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
7886 break;
7887
7888 default:
7889 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
7890 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
7891 break;
7892 }
7893 break;
7894
7895 case BGP_EXT_COM_TYPE_HIGH_NTR_IP4: /* Non-Transitive IPv4-Address-specific Extended Community */
7896 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7897 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
7898 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
7899
7900 proto_item_set_text(community_item, "%s: %s:%u",
7901 val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_IP4, "Unknown subtype 0x%02x"),
7902 tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
7903 break;
7904
7905 case BGP_EXT_COM_TYPE_HIGH_TR_AS4: /* Transitive Four-Octet AS-Specific Extended Community */
7906 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7907 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
7908 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
7909
7910 proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
7911 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_as4, "Unknown subtype 0x%02x"),
7912 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
7913 tvb_get_ntohs(tvb,offset+6));
7914 break;
7915
7916 case BGP_EXT_COM_TYPE_HIGH_NTR_AS4: /* Non-Transitive Four-Octet AS-Specific Extended Community */
7917 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7918 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
7919 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
7920
7921 proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
7922 val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_as4, "Unknown subtype 0x%02x"),
7923 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
7924 tvb_get_ntohs(tvb,offset+6));
7925 break;
7926
7927 case BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE: /* Transitive Opaque Extended Community */
7928 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
7929
7930 proto_item_set_text(community_item, "%s:",
7931 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_opaque, "Unknown subtype 0x%02x"));
7932
7933 switch(com_stype_low_byte) {
7934 case BGP_EXT_COM_STYPE_OPA_COST:
7935 {
7936 proto_item *cost_com_item;
7937 proto_tree *cost_com_cid_tree;
7938
7939 proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
7940 cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
7941 cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
7942 proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
7943 cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
7944 offset+4, 4, ENC_BIG_ENDIAN);
7945 proto_item_append_text(cost_com_item, " (%s)",
7946 tfs_get_string(tvb_get_guint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
7947
7948 proto_item_append_text(community_item, " %u, POI: %s (%s)",
7949 tvb_get_ntohl(tvb, offset+4),
7950 val_to_str(tvb_get_guint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
7951 (tvb_get_guint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
7952 }
7953 break;
7954
7955 case BGP_EXT_COM_STYPE_OPA_OSPF_RT:
7956 {
7957 proto_item *ospf_rt_opt_item;
7958 proto_tree *ospf_rt_opt_tree;
7959
7960 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
7961 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
7962 ospf_rt_opt_item = proto_tree_add_item(community_tree,
7963 hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
7964 ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
7965 proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
7966 tvb, offset+7, 1, ENC_BIG_ENDIAN);
7967 proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
7968 tfs_get_string(tvb_get_guint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
7969
7970 proto_item_append_text(community_item, " Area: %s, Type: %s",
7971 tvb_ip_to_str(pinfo->pool, tvb,offset+2),
7972 val_to_str_const(tvb_get_guint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
7973 }
7974 break;
7975
7976 case BGP_EXT_COM_STYPE_OPA_ENCAP:
7977 /* Community octets 2 through 5 are reserved and carry no useful value according to RFC 5512. */
7978 proto_tree_add_item_ret_uint(community_tree, hf_bgp_ext_com_tunnel_type, tvb, offset+6, 2, ENC_BIG_ENDIAN, &encaps_tunnel_type);
7979 save_path_attr_encaps_tunnel_type(pinfo, encaps_tunnel_type);
7980
7981 proto_item_append_text(community_item, " %s",
7982 val_to_str_const(tvb_get_ntohs(tvb,offset+6), bgpext_com_tunnel_type, "Unknown"));
7983 break;
7984
7985 case BGP_EXT_COM_STYPE_OPA_COLOR:
7986 case BGP_EXT_COM_STYPE_OPA_DGTW:
7987 default:
7988 /* The particular Opaque subtype is unknown or the
7989 * dissector is not written yet. We will dump the
7990 * entire community value in 2-byte short words.
7991 */
7992 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
7993 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
7994 tvb_get_ntohs(tvb,offset+2),
7995 tvb_get_ntohs(tvb,offset+4),
7996 tvb_get_ntohs(tvb,offset+6));
7997
7998 proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
7999 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8000 break;
8001 }
8002 break;
8003
8004 case BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE: /* Non-Transitive Opaque Extended Community */
8005 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8006
8007 proto_item_set_text(community_item, "%s:",
8008 val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_opaque, "Unknown subtype 0x%02x"));
8009
8010 switch(com_stype_low_byte) {
8011 case BGP_EXT_COM_STYPE_OPA_COST:
8012 {
8013 proto_item *cost_com_item;
8014 proto_tree *cost_com_cid_tree;
8015
8016 proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
8017 cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
8018 cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
8019 proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
8020 cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
8021 offset+4, 4, ENC_BIG_ENDIAN);
8022 proto_item_append_text(cost_com_item, " (%s)",
8023 tfs_get_string(tvb_get_guint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
8024
8025 proto_item_append_text(community_item, " %u, POI: %s (%s)",
8026 tvb_get_ntohl(tvb, offset+4),
8027 val_to_str(tvb_get_guint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
8028 (tvb_get_guint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
8029 }
8030 break;
8031
8032 default:
8033 /* The particular Opaque subtype is unknown or the
8034 * dissector is not written yet. We will dump the
8035 * entire community value in 2-byte short words.
8036 */
8037 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
8038 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
8039 tvb_get_ntohs(tvb,offset+2),
8040 tvb_get_ntohs(tvb,offset+4),
8041 tvb_get_ntohs(tvb,offset+6));
8042
8043 proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
8044 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8045 break;
8046 }
8047 break;
8048
8049 case BGP_EXT_COM_TYPE_HIGH_TR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
8050 case BGP_EXT_COM_TYPE_HIGH_NTR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
8051 {
8052 static int * const qos_flags[] = {
8053 &hf_bgp_ext_com_qos_flags_remarking,
8054 &hf_bgp_ext_com_qos_flags_ignore_remarking,
8055 &hf_bgp_ext_com_qos_flags_agg_marking,
8056 NULL
8057 };
8058
8059 proto_item_set_text(community_item, "QoS Marking");
8060
8061 proto_tree_add_bitmask(community_tree, tvb, offset, hf_bgp_ext_com_qos_flags,
8062 ett_bgp_ext_com_flags, qos_flags, ENC_BIG_ENDIAN);
8063
8064 proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_set_number, tvb, offset+2, 1, ENC_BIG_ENDIAN);
8065 proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_tech_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
8066 proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_o, tvb, offset+4, 2, ENC_BIG_ENDIAN);
8067 proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_a, tvb, offset+6, 1, ENC_BIG_ENDIAN);
8068 proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_default_to_zero, tvb, offset+7, 1, ENC_BIG_ENDIAN);
8069 }
8070 break;
8071
8072 case BGP_EXT_COM_TYPE_HIGH_TR_COS: /* CoS Capability [Thomas_Martin_Knoll] */
8073 {
8074 int i;
8075
8076 proto_item_set_text(community_item, "CoS Capability");
8077
8078 for (i=1; i < 8; i++) {
8079 static int * const cos_flags[] = {
8080 &hf_bgp_ext_com_cos_flags_be,
8081 &hf_bgp_ext_com_cos_flags_ef,
8082 &hf_bgp_ext_com_cos_flags_af,
8083 &hf_bgp_ext_com_cos_flags_le,
8084 NULL
8085 };
8086
8087 proto_tree_add_bitmask(community_tree, tvb, offset+i, hf_bgp_ext_com_cos_flags,
8088 ett_bgp_ext_com_flags, cos_flags, ENC_BIG_ENDIAN);
8089 }
8090 }
8091 break;
8092
8093 case BGP_EXT_COM_TYPE_HIGH_TR_EVPN: /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
8094 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_evpn, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8095
8096 proto_item_set_text(community_item, "%s:",
8097 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_evpn, "Unknown subtype 0x%02x"));
8098
8099 switch (com_stype_low_byte) {
8100 case BGP_EXT_COM_STYPE_EVPN_MMAC:
8101 {
8102 proto_tree *evpn_mmac_flag_tree;
8103 proto_item *evpn_mmac_flag_item;
8104
8105 evpn_mmac_flag_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
8106 evpn_mmac_flag_tree = proto_item_add_subtree(evpn_mmac_flag_item, ett_bgp_ext_com_evpn_mmac_flags);
8107 proto_tree_add_item (evpn_mmac_flag_tree, hf_bgp_ext_com_evpn_mmac_flag_sticky, tvb, offset+2, 1, ENC_BIG_ENDIAN);
8108 /* Octet at offset 3 is reserved per RFC 7432 Section 7.7 */
8109 proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_seq, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8110
8111 proto_item_append_text(community_item, " %s MAC",
8112 (tvb_get_guint8(tvb,offset+2) & BGP_EXT_COM_EVPN_MMAC_STICKY) ? "Sticky" : "Movable");
8113 }
8114 break;
8115
8116 case BGP_EXT_COM_STYPE_EVPN_LABEL:
8117 {
8118 proto_item *ti;
8119
8120 proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_esi_label_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
8121 /* Octets at offsets 3 and 4 are reserved perf RFC 7432 Section 7.5 */
8122 proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8123 ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8124 proto_item_set_generated(ti);
8125 ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8126 proto_item_set_generated(ti);
8127 ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8128 proto_item_set_generated(ti);
8129
8130 proto_item_append_text(community_item, " %s, Label: %u",
8131 tfs_get_string(tvb_get_guint8(tvb, offset+2) & BGP_EXT_COM_ESI_LABEL_FLAGS, &tfs_esi_label_flag),
8132 tvb_get_ntoh24(tvb,offset+5) >> 4);
8133 }
8134 break;
8135
8136 case BGP_EXT_COM_STYPE_EVPN_IMP:
8137 proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_esirt, tvb, offset+2, 6, ENC_NA);
8138
8139 proto_item_append_text(community_item, " RT: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
8140 break;
8141
8142 case BGP_EXT_COM_STYPE_EVPN_ROUTERMAC:
8143 proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_routermac, tvb, offset+2, 6, ENC_NA);
8144
8145 proto_item_append_text(community_item, " Router MAC: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
8146 break;
8147
8148 case BGP_EXT_COM_STYPE_EVPN_L2ATTR:
8149 {
8150 static int * const l2attr_flags[] = {
8151 &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
8152 &hf_bgp_ext_com_evpn_l2attr_flag_ci,
8153 &hf_bgp_ext_com_evpn_l2attr_flag_f,
8154 &hf_bgp_ext_com_evpn_l2attr_flag_c,
8155 &hf_bgp_ext_com_evpn_l2attr_flag_p,
8156 &hf_bgp_ext_com_evpn_l2attr_flag_b,
8157 NULL
8158 };
8159
8160 proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_l2attr_flags,
8161 ett_bgp_ext_com_evpn_l2attr_flags, l2attr_flags, ENC_BIG_ENDIAN);
8162 proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
8163 proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_reserved, tvb, offset+6, 2, ENC_NA);
8164
8165 proto_item_append_text(community_item, " flags: 0x%04x, L2 MTU: %u", tvb_get_ntohs(tvb, offset+2), tvb_get_ntohs(tvb, offset+4));
8166 }
8167 break;
8168
8169 case BGP_EXT_COM_STYPE_EVPN_ETREE:
8170 {
8171 static int * const etree_flags[] = {
8172 &hf_bgp_ext_com_evpn_etree_flag_reserved,
8173 &hf_bgp_ext_com_evpn_etree_flag_l,
8174 NULL
8175 };
8176
8177 proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_etree_flags,
8178 ett_bgp_ext_com_evpn_etree_flags, etree_flags, ENC_BIG_ENDIAN);
8179 proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_etree_reserved, tvb, offset+3, 2, ENC_NA);
8180
8181 proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8182 proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8183 proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
8184 }
8185 break;
8186
8187 default:
8188 /* The particular EVPN subtype is unknown or the
8189 * dissector is not written yet. We will dump the
8190 * entire community value in 2-byte short words.
8191 */
8192 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
8193 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
8194 tvb_get_ntohs(tvb,offset+2),
8195 tvb_get_ntohs(tvb,offset+4),
8196 tvb_get_ntohs(tvb,offset+6));
8197
8198 proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
8199 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8200 break;
8201 }
8202 break;
8203
8204 case BGP_EXT_COM_TYPE_HIGH_TR_EXP: /* Generic Transitive Experimental Extended Community */
8205 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8206
8207 proto_item_set_text(community_item, "%s:",
8208 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"));
8209
8210 switch (com_stype_low_byte) {
8211 case BGP_EXT_COM_STYPE_EXP_OSPF_RT:
8212 {
8213 proto_item *ospf_rt_opt_item;
8214 proto_tree *ospf_rt_opt_tree;
8215
8216 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
8217 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
8218 ospf_rt_opt_item = proto_tree_add_item(community_tree,
8219 hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
8220 ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
8221 proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
8222 tvb, offset+7, 1, ENC_BIG_ENDIAN);
8223 proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
8224 tfs_get_string(tvb_get_guint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
8225
8226 proto_item_append_text(community_item, " Area: %s, Type: %s",
8227 tvb_ip_to_str(pinfo->pool, tvb,offset+2),
8228 val_to_str_const(tvb_get_guint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
8229 }
8230 break;
8231
8232 case BGP_EXT_COM_STYPE_EXP_OSPF_RID:
8233 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
8234
8235 proto_item_append_text(community_item, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+2));
8236 break;
8237
8238 case BGP_EXT_COM_STYPE_EXP_OSPF_DID:
8239 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8240 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8241 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8242
8243 proto_item_set_text(community_item, "%s: %u:%u",
8244 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"),
8245 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
8246 break;
8247
8248 case BGP_EXT_COM_STYPE_EXP_F_TR: /* Flow spec traffic-rate [RFC5575] */
8249 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2,
8250 tvb, offset+2, 2, ENC_BIG_ENDIAN);
8251 /* remaining 4 bytes gives traffic rate in IEEE floating point */
8252 proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_rate_float, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8253
8254 proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
8255 tvb_get_ntohs(tvb,offset+2),
8256 tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
8257 break;
8258
8259 case BGP_EXT_COM_STYPE_EXP_F_TA: /* Flow spec traffic-action [RFC5575] */
8260 proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_allset, tvb, offset+2, 5, ENC_NA);
8261 proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_samp_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
8262 proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_term_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
8263
8264 proto_item_append_text(community_item, " Sample: %s, Terminal: %s",
8265 tfs_get_string(tvb_get_guint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_S, &tfs_yes_no),
8266 tfs_get_string(tvb_get_guint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_T, &tfs_yes_no));
8267 break;
8268
8269 case BGP_EXT_COM_STYPE_EXP_F_RED: /* Flow spec redirect [RFC5575] */
8270 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8271 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8272
8273 proto_item_append_text(community_item, " RT %u:%u",
8274 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
8275 break;
8276
8277 case BGP_EXT_COM_STYPE_EXP_F_RMARK: /* Flow spec traffic-remarking [RFC5575] */
8278 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_fs_remark, tvb, offset+7, 1, ENC_BIG_ENDIAN);
8279
8280 proto_item_append_text(community_item, " %s",
8281 val_to_str_ext_const(tvb_get_guint8(tvb,offset+7), &dscp_vals_ext, "Unknown DSCP"));
8282 break;
8283
8284 case BGP_EXT_COM_STYPE_EXP_L2:
8285 {
8286 static int * const com_l2_flags[] = {
8287 &hf_bgp_ext_com_l2_flag_d,
8288 &hf_bgp_ext_com_l2_flag_z1,
8289 &hf_bgp_ext_com_l2_flag_f,
8290 &hf_bgp_ext_com_l2_flag_z345,
8291 &hf_bgp_ext_com_l2_flag_c,
8292 &hf_bgp_ext_com_l2_flag_s,
8293 NULL
8294 };
8295
8296 proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_encaps,tvb,offset+2, 1, ENC_BIG_ENDIAN);
8297
8298 proto_tree_add_bitmask(community_tree, tvb, offset+3, hf_bgp_ext_com_l2_c_flags, ett_bgp_ext_com_l2_flags, com_l2_flags, ENC_BIG_ENDIAN);
8299 proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
8300 }
8301 break;
8302
8303 case BGP_EXT_COM_STYPE_EXP_ETREE:
8304 {
8305 static int * const com_etree_flags[] = {
8306 &hf_bgp_ext_com_etree_flag_reserved,
8307 &hf_bgp_ext_com_etree_flag_p,
8308 &hf_bgp_ext_com_etree_flag_v,
8309 NULL
8310 };
8311
8312 proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_root_vlan,tvb,offset+2, 2, ENC_BIG_ENDIAN);
8313 proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_leaf_vlan,tvb,offset+4, 2, ENC_BIG_ENDIAN);
8314 proto_tree_add_bitmask(community_tree, tvb, offset+6, hf_bgp_ext_com_etree_flags, ett_bgp_ext_com_etree_flags, com_etree_flags, ENC_BIG_ENDIAN);
8315 }
8316 break;
8317
8318 default:
8319 /* The particular Experimental subtype is unknown or
8320 * the dissector is not written yet. We will dump the
8321 * entire community value in 2-byte short words.
8322 */
8323 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
8324 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
8325 tvb_get_ntohs(tvb,offset+2),
8326 tvb_get_ntohs(tvb,offset+4),
8327 tvb_get_ntohs(tvb,offset+6));
8328
8329 proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
8330 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8331 break;
8332 }
8333 break;
8334
8335 case BGP_EXT_COM_TYPE_HIGH_TR_EXP_2:
8336 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8337
8338 proto_item_set_text(community_item, "%s:",
8339 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp_2, "Unknown subtype 0x%02x"));
8340
8341 switch (com_stype_low_byte) {
8342 case BGP_EXT_COM_STYPE_EXP_2_FLOW_RED:
8343 {
8344 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_NA);
8345 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
8346 }
8347 break;
8348
8349 default:
8350 /* The particular Experimental subtype is unknown or
8351 * the dissector is not written yet. We will dump the
8352 * entire community value in 2-byte short words.
8353 */
8354 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
8355 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
8356 tvb_get_ntohs(tvb,offset+2),
8357 tvb_get_ntohs(tvb,offset+4),
8358 tvb_get_ntohs(tvb,offset+6));
8359
8360 proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
8361 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8362 break;
8363 }
8364 break;
8365
8366 case BGP_EXT_COM_TYPE_HIGH_TR_EXP_3:
8367 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_3, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8368
8369 proto_item_set_text(community_item, "%s:",
8370 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp_3, "Unknown subtype 0x%02x"));
8371
8372 switch (com_stype_low_byte) {
8373 case BGP_EXT_COM_STYPE_EXP_3_FLOW_RED:
8374 {
8375 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
8376 proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
8377 }
8378 break;
8379
8380 default:
8381 /* The particular Experimental subtype is unknown or
8382 * the dissector is not written yet. We will dump the
8383 * entire community value in 2-byte short words.
8384 */
8385 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
8386 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
8387 tvb_get_ntohs(tvb,offset+2),
8388 tvb_get_ntohs(tvb,offset+4),
8389 tvb_get_ntohs(tvb,offset+6));
8390
8391 proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
8392 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8393 break;
8394 }
8395 break;
8396
8397 case BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP:
8398 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_eigrp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8399
8400 proto_item_set_text(community_item, "%s:",
8401 val_to_str(com_stype_low_byte, bgpext_com_stype_tr_eigrp, "Unknown subtype 0x%02x"));
8402
8403 switch(com_stype_low_byte) {
8404 case BGP_EXT_COM_STYPE_EXP_EIGRP_FT:
8405 {
8406 proto_item *eigrp_flags_item;
8407 proto_tree *eigrp_flags_tree;
8408
8409 eigrp_flags_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_flags, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8410 eigrp_flags_tree = proto_item_add_subtree(eigrp_flags_item, ett_bgp_ext_com_eigrp_flags);
8411
8412 proto_tree_add_item(eigrp_flags_tree, hf_bgp_ext_com_eigrp_flags_rt, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8413 proto_item_append_text(eigrp_flags_tree, " (%s)",
8414 tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
8415 proto_item_append_text(community_tree, " %s route",
8416 tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
8417
8418 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rtag, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8419 proto_item_append_text(community_tree, ", Tag: %u", tvb_get_ntohl(tvb, offset+4));
8420 }
8421 break;
8422
8423 case BGP_EXT_COM_STYPE_EXP_EIGRP_AD:
8424 {
8425 guint32 raw_value;
8426
8427 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8428
8429 raw_value = tvb_get_ntohl(tvb, offset+4);
8430 proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_delay,
8431 tvb, offset+4, 4, raw_value, "%u (%u usec)", raw_value, raw_value * 10 / 256);
8432
8433 proto_item_append_text(community_item, " ASN: %u, D: %u",
8434 tvb_get_ntohs(tvb, offset+2), raw_value);
8435 }
8436 break;
8437
8438 case BGP_EXT_COM_STYPE_EXP_EIGRP_RHB:
8439 {
8440 guint32 raw_value;
8441
8442 raw_value = tvb_get_guint8(tvb, offset+2);
8443 proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_rly,
8444 tvb, offset+2, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
8445 proto_item_append_text(community_item, " R: %u", raw_value);
8446
8447 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_hops, tvb, offset+3, 1, ENC_BIG_ENDIAN);
8448 proto_item_append_text(community_tree, ", H: %u", tvb_get_guint8(tvb, offset+3));
8449
8450 raw_value = tvb_get_ntohl(tvb, offset+4);
8451 proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_bw,
8452 tvb, offset+4, 4, raw_value, "%u (%u Kbps)", raw_value, raw_value ? (2560000000U / raw_value) : 0);
8453 proto_item_append_text(community_tree, ", B: %u", raw_value);
8454 }
8455 break;
8456
8457 case BGP_EXT_COM_STYPE_EXP_EIGRP_LM:
8458 {
8459 guint32 raw_value;
8460
8461 raw_value = tvb_get_guint8(tvb, offset+3);
8462 proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_load,
8463 tvb, offset+3, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
8464 proto_item_append_text(community_tree, " L: %u", raw_value);
8465
8466 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_mtu, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8467 proto_item_append_text(community_tree, ", M: %u", tvb_get_ntohl(tvb, offset+4));
8468 }
8469 break;
8470
8471 case BGP_EXT_COM_STYPE_EXP_EIGRP_EAR:
8472 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8473 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8474
8475 proto_item_append_text(community_tree, " ASN: %u, RID: %s",
8476 tvb_get_ntohs(tvb, offset+2), tvb_ip_to_str(pinfo->pool, tvb, offset+4));
8477 break;
8478
8479 case BGP_EXT_COM_STYPE_EXP_EIGRP_EPM:
8480 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_pid, tvb, offset+2, 2, ENC_BIG_ENDIAN);
8481 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_m, tvb, offset+4, 4, ENC_BIG_ENDIAN);
8482
8483 proto_item_append_text(community_tree, " %s, Metric: %u",
8484 val_to_str(tvb_get_ntohs(tvb, offset+2), eigrp_proto2string, "Unknown protocol %u"),
8485 tvb_get_ntohl(tvb, offset+4));
8486 break;
8487
8488 case BGP_EXT_COM_STYPE_EXP_EIGRP_RID:
8489 proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rid, tvb, offset+4, 4, ENC_NA);
8490 proto_item_append_text(community_tree, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+4));
8491 break;
8492 }
8493 break;
8494
8495 case BGP_EXT_COM_TYPE_HIGH_TR_FLOW: /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
8496 default:
8497 proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_low_unknown, tvb, offset+1, 1, ENC_BIG_ENDIAN);
8498
8499 proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
8500 tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
8501 tvb_get_ntohs(tvb,offset+2),
8502 tvb_get_ntohs(tvb,offset+4),
8503 tvb_get_ntohs(tvb,offset+6));
8504
8505 proto_item_set_text(community_item, "Unknown type 0x%02x subtype 0x%02x: 0x%04x 0x%04x 0x%04x",
8506 com_type_high_byte, com_stype_low_byte,
8507 tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
8508 break;
8509 }
8510 proto_item_append_text (community_item, " [%s]", val_to_str(com_type_high_byte, bgpext_com_type_high, "Unknown community"));
8511 offset = offset + 8;
8512 }
8513 return(0);
8514 }
8515
8516 static int
dissect_bgp_update_pmsi_attr(packet_info * pinfo,proto_tree * parent_tree,tvbuff_t * tvb,guint16 tlen,guint tvb_off)8517 dissect_bgp_update_pmsi_attr(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, guint16 tlen, guint tvb_off)
8518 {
8519 int offset=0;
8520 guint8 tunnel_type=0;
8521 guint8 opaque_value_type=0;
8522 guint8 rn_addr_length=0;
8523 guint16 tunnel_id_len=0;
8524 guint16 opaque_value_length=0;
8525 proto_item *tunnel_id_item=NULL;
8526 proto_item *opaque_value_type_item=NULL;
8527 proto_item *pmsi_tunnel_type_item=NULL;
8528 proto_tree *tunnel_id_tree=NULL;
8529 path_attr_data *data = NULL;
8530
8531 offset = tvb_off ;
8532 tunnel_id_len = tlen - 5;
8533
8534 proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_flags, tvb, offset,
8535 1, ENC_BIG_ENDIAN);
8536
8537 pmsi_tunnel_type_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_type, tvb, offset+1,
8538 1, ENC_BIG_ENDIAN);
8539
8540 data = load_path_attr_data(pinfo);
8541 if (data && data->encaps_community_present &&
8542 (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
8543 proto_tree_add_item(parent_tree, hf_bgp_evpn_nlri_vni, tvb, offset+2, 3, ENC_BIG_ENDIAN);
8544 } else {
8545 proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+2, 3, ENC_BIG_ENDIAN);
8546 }
8547
8548 tunnel_id_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_id, tvb, offset+5,
8549 tunnel_id_len, ENC_NA);
8550 tunnel_id_tree = proto_item_add_subtree(tunnel_id_item, ett_bgp_pmsi_tunnel_id);
8551
8552 tunnel_type = tvb_get_guint8(tvb, offset+1);
8553 switch(tunnel_type) {
8554 case PMSI_TUNNEL_NOPRESENT:
8555 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_not_present, tvb, offset+1, 1, ENC_NA);
8556 break;
8557 case PMSI_TUNNEL_RSVPTE_P2MP:
8558 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_id, tvb, offset+5, 4, ENC_NA);
8559 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id, tvb, offset+11, 2, ENC_BIG_ENDIAN);
8560 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4, tvb, offset+13, 4, ENC_NA);
8561 proto_item_append_text(tunnel_id_item, ": Id %u, Ext Id %s",
8562 tvb_get_ntohs(tvb, offset+11), tvb_ip_to_str(pinfo->pool, tvb, offset+13));
8563 break;
8564 case PMSI_TUNNEL_MLDP_P2MP:
8565 case PMSI_TUNNEL_MLDP_MP2MP:
8566 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_type, tvb, offset+5, 1, ENC_BIG_ENDIAN);
8567 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_afi, tvb, offset+6, 2, ENC_BIG_ENDIAN);
8568 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len, tvb, offset+8, 1, ENC_BIG_ENDIAN);
8569 rn_addr_length = tvb_get_guint8(tvb, offset+8);
8570 if( rn_addr_length ==4)
8571 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4, tvb, offset+9, 4, ENC_NA);
8572 else
8573 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6, tvb, offset+9, 4, ENC_NA);
8574
8575 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len, tvb, offset+9+rn_addr_length, 2, ENC_BIG_ENDIAN);
8576 opaque_value_type_item = proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
8577 tvb, offset+11+rn_addr_length, 1, ENC_BIG_ENDIAN);
8578 opaque_value_type = tvb_get_guint8(tvb, offset+11+rn_addr_length);
8579 if(opaque_value_type == PMSI_MLDP_FEC_TYPE_GEN_LSP) {
8580 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len, tvb, offset+12+rn_addr_length, 2, ENC_BIG_ENDIAN);
8581 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn, tvb, offset+14+rn_addr_length, 4, ENC_BIG_ENDIAN);
8582 proto_item_append_text(tunnel_id_item, ": Type: %s root node: %s Id: %u",
8583 val_to_str_const(tvb_get_guint8(tvb, offset+5), fec_types_vals, "Unknown"),
8584 tvb_ip_to_str(pinfo->pool, tvb, offset+9),
8585 tvb_get_ntohl(tvb, offset+14+rn_addr_length));
8586 } else if (opaque_value_type == PMSI_MLDP_FEC_TYPE_EXT_TYPE) {
8587 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type, tvb, offset+12+rn_addr_length, 2, ENC_BIG_ENDIAN);
8588 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len, tvb, offset+14+rn_addr_length, 2, ENC_BIG_ENDIAN);
8589 opaque_value_length = tvb_get_ntohs(tvb, offset+14+rn_addr_length);
8590 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str, tvb, offset+16+rn_addr_length,
8591 opaque_value_length, ENC_ASCII|ENC_NA);
8592 }
8593 else {
8594 /* This covers situation when opaque id is 0 (reserved) or any other value */
8595 expert_add_info_format(pinfo, opaque_value_type_item, &ei_bgp_attr_pmsi_opaque_type,
8596 "Opaque Value type %u wrong, must be modulo 1 or 255", opaque_value_type);
8597 }
8598 break;
8599 case PMSI_TUNNEL_PIMSSM:
8600 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_root_node, tvb, offset+5, 4, ENC_BIG_ENDIAN);
8601 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
8602 proto_item_append_text(tunnel_id_item, ": < %s, %s >",
8603 tvb_ip_to_str(pinfo->pool, tvb, offset+5),
8604 tvb_ip_to_str(pinfo->pool, tvb, offset+9));
8605 break;
8606 case PMSI_TUNNEL_PIMSM:
8607 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
8608 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
8609 proto_item_append_text(tunnel_id_item, ": < %s, %s >",
8610 tvb_ip_to_str(pinfo->pool, tvb, offset+5),
8611 tvb_ip_to_str(pinfo->pool, tvb, offset+9));
8612 break;
8613 case PMSI_TUNNEL_BIDIR_PIM:
8614 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
8615 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
8616 proto_item_append_text(tunnel_id_item, ": < %s, %s >",
8617 tvb_ip_to_str(pinfo->pool, tvb, offset+5),
8618 tvb_ip_to_str(pinfo->pool, tvb, offset+9));
8619 break;
8620 case PMSI_TUNNEL_INGRESS:
8621 proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr, tvb, offset+5, 4, ENC_BIG_ENDIAN);
8622 proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
8623 tvb_ip_to_str(pinfo->pool, tvb, offset+5));
8624 break;
8625 default:
8626 expert_add_info_format(pinfo, pmsi_tunnel_type_item, &ei_bgp_attr_pmsi_tunnel_type,
8627 "Tunnel type %u wrong", tunnel_type);
8628 break;
8629 }
8630
8631
8632 return(0);
8633 }
8634
8635 /*
8636 * Dissect BGP path attributes
8637 *
8638 */
8639 void
dissect_bgp_path_attr(proto_tree * subtree,tvbuff_t * tvb,guint16 path_attr_len,guint tvb_off,packet_info * pinfo)8640 dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len, guint tvb_off, packet_info *pinfo)
8641 {
8642 guint8 bgpa_flags; /* path attributes */
8643 guint8 bgpa_type;
8644 gint o; /* packet offset */
8645 gint q=0; /* tmp */
8646 gint end=0; /* message end */
8647 int advance; /* tmp */
8648 proto_item *ti; /* tree item */
8649 proto_item *ti_communities; /* tree communities */
8650 proto_item *ti_community; /* tree for each community */
8651 proto_item *ti_as; /* tree for each as */
8652 proto_item *attr_len_item;
8653 proto_item *aigp_type_item;
8654 proto_tree *subtree2; /* path attribute subtree */
8655 proto_tree *subtree3; /* subtree for attributes */
8656 proto_tree *subtree4; /* subtree for attributes */
8657 proto_tree *subtree5; /* subtree for attributes */
8658 proto_tree *subtree6; /* subtree for attributes */
8659 proto_tree *subtree7; /* subtree for attributes */
8660 proto_tree *subtree8; /* subtree for attributes */
8661 proto_tree *attr_set_subtree; /* subtree for attr_set */
8662 proto_tree *as_path_segment_tree; /* subtree for AS_PATH segments */
8663 gint number_as_segment=0; /* Number As segment */
8664 proto_tree *communities_tree; /* subtree for COMMUNITIES */
8665 proto_tree *community_tree; /* subtree for a community */
8666 proto_tree *cluster_list_tree; /* subtree for CLUSTER_LIST */
8667 int i=0, j, k; /* tmp */
8668 guint8 type=0; /* AS_PATH segment type */
8669 guint8 length=0; /* AS_PATH segment length */
8670 guint32 aggregator_as;
8671 guint16 ssa_type; /* SSA T + Type */
8672 guint16 ssa_len; /* SSA TLV Length */
8673 guint8 ssa_v3_len; /* SSA L2TPv3 Cookie Length */
8674 guint16 encaps_tunnel_type; /* Encapsulation Tunnel Type */
8675 guint16 encaps_tunnel_len; /* Encapsulation TLV Length */
8676 guint8 encaps_tunnel_subtype; /* Encapsulation Tunnel Sub-TLV Type */
8677 guint16 encaps_tunnel_sublen; /* Encapsulation TLV Sub-TLV Length */
8678 guint16 encaps_tunnel_sub_totallen; /* Encapsulation TLV Sub-TLV Length + Type + Length field */
8679 guint8 aigp_type; /* AIGP TLV type from AIGP attribute */
8680 guint8 prefix_sid_subtype; /* BGP Prefix-SID TLV Type */
8681 guint16 prefix_sid_sublen; /* BGP Prefix-SID TLV Length */
8682 gint prefix_sid_sub_tlv_offset; /* BGP Prefix-SID SRGB Length */
8683 gint check_srgb; /* BGP Prefix-SID SRGB counter */
8684 guint16 secpathlen; /* BGPsec Secure Path length */
8685 guint16 sigblocklen; /* BGPsec Signature Block length */
8686 guint8 secpathcount; /* Number of Secure Path Segments */
8687 guint16 sig_len; /* Length of BGPsec Signature */
8688 guint32 segment_subtlv_type; /* Segment List SubTLV Type */
8689 guint32 segment_subtlv_length; /* Segment List SubTLV Length */
8690 guint8 srv6_service_subtlv_type; /* SRv6 Service Sub-TLV type */
8691 guint16 srv6_service_subtlv_len; /* SRv6 Service Sub-TLV length */
8692 guint8 srv6_service_data_subsubtlv_type; /* SRv6 Service Data Sub-Sub-TLV type */
8693 guint16 srv6_service_data_subsubtlv_len; /* SRv6 Service Data Sub-Sub-TLV length */
8694
8695 o = tvb_off;
8696
8697 while (i < path_attr_len) {
8698 proto_item *ti_pa, *ti_flags;
8699 int off;
8700 gint alen, aoff, tlen, aoff_save;
8701 guint8 snpa;
8702 guint8 nexthop_len;
8703 guint8 asn_len = 0;
8704 guint32 af, saf, as_num;
8705
8706 static int * const path_flags[] = {
8707 &hf_bgp_update_path_attribute_flags_optional,
8708 &hf_bgp_update_path_attribute_flags_transitive,
8709 &hf_bgp_update_path_attribute_flags_partial,
8710 &hf_bgp_update_path_attribute_flags_extended_length,
8711 &hf_bgp_update_path_attribute_flags_unused,
8712 NULL
8713 };
8714
8715 bgpa_flags = tvb_get_guint8(tvb, o + i);
8716 bgpa_type = tvb_get_guint8(tvb, o + i+1);
8717
8718 /* check for the Extended Length bit */
8719 if (bgpa_flags & BGP_ATTR_FLAG_EXTENDED_LENGTH) {
8720 alen = tvb_get_ntohs(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
8721 aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+2;
8722 } else {
8723 alen = tvb_get_guint8(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
8724 aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+1;
8725 }
8726 tlen = alen;
8727
8728 ti_pa = proto_tree_add_item(subtree, hf_bgp_update_path_attribute, tvb, o + i, tlen + aoff, ENC_NA);
8729 proto_item_append_text(ti_pa, " - %s", val_to_str(bgpa_type, bgpattr_type, "Unknown (%u)"));
8730
8731 subtree2 = proto_item_add_subtree(ti_pa, ett_bgp_attr);
8732
8733 ti_flags = proto_tree_add_bitmask(subtree2, tvb, o + i, hf_bgp_update_path_attribute_flags, ett_bgp_attr_flags, path_flags, ENC_NA);
8734
8735 if ((bgpa_flags & BGP_ATTR_FLAG_OPTIONAL) == 0)
8736 proto_item_append_text(ti_flags, "%s", ", Well-known");
8737 if ((bgpa_flags & BGP_ATTR_FLAG_TRANSITIVE) == 0)
8738 proto_item_append_text(ti_flags, "%s", ", Non-transitive");
8739 if ((bgpa_flags & BGP_ATTR_FLAG_PARTIAL) == 0)
8740 proto_item_append_text(ti_flags, "%s", ", Complete");
8741
8742 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_type_code, tvb, o + i + 1, 1, ENC_BIG_ENDIAN);
8743
8744 attr_len_item = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_length, tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE,
8745 aoff - BGP_SIZE_OF_PATH_ATTRIBUTE, ENC_BIG_ENDIAN);
8746 if (aoff + tlen > path_attr_len - i) {
8747 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8748 "Path attribute length is invalid: %u byte%s", tlen,
8749 plurality(tlen, "", "s"));
8750 return;
8751 }
8752
8753 /* Path Attribute Type */
8754 switch (bgpa_type) {
8755 case BGPTYPE_ORIGIN:
8756 if (tlen != 1) {
8757 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8758 "Origin (invalid): %u byte%s", tlen,
8759 plurality(tlen, "", "s"));
8760 } else {
8761 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_origin, tvb,
8762 o + i + aoff, 1, ENC_BIG_ENDIAN);
8763 proto_item_append_text(ti_pa, ": %s", val_to_str_const(tvb_get_guint8(tvb, o + i + aoff), bgpattr_origin, "Unknown"));
8764 }
8765 break;
8766 case BGPTYPE_AS_PATH:
8767 case BGPTYPE_AS4_PATH:
8768 /* Apply heuristic to guess if we are facing 2 or 4 bytes ASN
8769 (o + i + aoff) =
8770 (o + current attribute + aoff bytes to first tuple)
8771 heuristic also tell us how many AS segments we have */
8772 asn_len = heuristic_as2_or_4_from_as_path(tvb, o+i+aoff, o+i+aoff+tlen,
8773 bgpa_type, &number_as_segment);
8774 if (asn_len == 255)
8775 {
8776 expert_add_info_format(pinfo, ti_pa, &ei_bgp_attr_as_path_as_len_err,
8777 "ASN length uncalculated by heuristic : %u", asn_len);
8778 break;
8779 }
8780 proto_item_append_text(ti_pa,": ");
8781 if(tlen == 0) {
8782 proto_item_append_text(ti_pa,"empty");
8783 }
8784 q = o + i + aoff;
8785 for (k=0; k < number_as_segment; k++)
8786 {
8787 type = tvb_get_guint8(tvb, q);
8788 length = tvb_get_guint8(tvb, q+1);
8789 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_as_path_segment, tvb,
8790 q, length * asn_len + 2, ENC_NA);
8791 proto_item_append_text(ti,": ");
8792 as_path_segment_tree = proto_item_add_subtree(ti, ett_bgp_as_path_segment);
8793 proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_type, tvb,
8794 q, 1, ENC_BIG_ENDIAN);
8795 proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_length, tvb,
8796 q+1, 1, ENC_BIG_ENDIAN);
8797 switch(type)
8798 {
8799 case AS_SET:
8800 proto_item_append_text(ti_pa, "{");
8801 proto_item_append_text(ti, "{");
8802 break;
8803 case AS_CONFED_SET:
8804 proto_item_append_text(ti_pa, "[");
8805 proto_item_append_text(ti, "[");
8806 break;
8807 case AS_CONFED_SEQUENCE:
8808 proto_item_append_text(ti_pa, "(");
8809 proto_item_append_text(ti, "(");
8810 break;
8811 }
8812
8813 q = q + 2;
8814 for (j = 0; j < length; j++)
8815 {
8816 if(asn_len == 2) {
8817 ti_as = proto_tree_add_item_ret_uint(as_path_segment_tree,
8818 hf_bgp_update_path_attribute_as_path_segment_as2,
8819 tvb, q, 2, ENC_BIG_ENDIAN, &as_num);
8820 if (as_num == BGP_AS_TRANS) {
8821 proto_item_append_text(ti_as, " (AS_TRANS)");
8822 }
8823 proto_item_append_text(ti_pa, "%u",
8824 tvb_get_ntohs(tvb, q));
8825 proto_item_append_text(ti, "%u",
8826 tvb_get_ntohs(tvb, q));
8827 }
8828 else if (asn_len == 4) {
8829 proto_tree_add_item(as_path_segment_tree,
8830 hf_bgp_update_path_attribute_as_path_segment_as4,
8831 tvb, q, 4, ENC_BIG_ENDIAN);
8832 proto_item_append_text(ti_pa, "%u",
8833 tvb_get_ntohl(tvb, q));
8834 proto_item_append_text(ti, "%u",
8835 tvb_get_ntohl(tvb, q));
8836 }
8837 if (j != length-1)
8838 {
8839 proto_item_append_text(ti_pa, "%s",
8840 (type == AS_SET || type == AS_CONFED_SET) ?
8841 ", " : " ");
8842 proto_item_append_text(ti, "%s",
8843 (type == AS_SET || type == AS_CONFED_SET) ?
8844 ", " : " ");
8845 }
8846 q += asn_len;
8847 }
8848 switch(type)
8849 {
8850 case AS_SET:
8851 proto_item_append_text(ti_pa, "} ");
8852 proto_item_append_text(ti, "}");
8853 break;
8854 case AS_CONFED_SET:
8855 proto_item_append_text(ti_pa, "] ");
8856 proto_item_append_text(ti, "]");
8857 break;
8858 case AS_CONFED_SEQUENCE:
8859 proto_item_append_text(ti_pa, ") ");
8860 proto_item_append_text(ti, ")");
8861 break;
8862 default:
8863 proto_item_append_text(ti_pa, " ");
8864 break;
8865 }
8866 }
8867
8868 break;
8869 case BGPTYPE_NEXT_HOP:
8870 if (tlen != 4) {
8871 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8872 "Next hop (invalid): %u byte%s", tlen,
8873 plurality(tlen, "", "s"));
8874 } else {
8875 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_next_hop, tvb,
8876 o + i + aoff, 4, ENC_BIG_ENDIAN);
8877 proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
8878 }
8879 break;
8880 case BGPTYPE_MULTI_EXIT_DISC:
8881 if (tlen != 4) {
8882 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8883 "Multiple exit discriminator (invalid): %u byte%s",
8884 tlen, plurality(tlen, "", "s"));
8885 } else {
8886 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_multi_exit_disc, tvb,
8887 o + i + aoff, tlen, ENC_BIG_ENDIAN);
8888 proto_item_append_text(ti_pa,": %u", tvb_get_ntohl(tvb, o + i + aoff));
8889 }
8890 break;
8891 case BGPTYPE_LOCAL_PREF:
8892 if (tlen != 4) {
8893 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8894 "Local preference (invalid): %u byte%s", tlen,
8895 plurality(tlen, "", "s"));
8896 } else {
8897 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_local_pref, tvb,
8898 o + i + aoff, tlen, ENC_BIG_ENDIAN);
8899 proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
8900 }
8901 break;
8902 case BGPTYPE_ATOMIC_AGGREGATE:
8903 if (tlen != 0) {
8904 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8905 "Atomic aggregate (invalid): %u byte%s", tlen,
8906 plurality(tlen, "", "s"));
8907 }
8908 break;
8909 case BGPTYPE_AGGREGATOR:
8910 if (tlen != 6 && tlen != 8) {
8911 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8912 "Aggregator (invalid): %u byte%s", tlen,
8913 plurality(tlen, "", "s"));
8914 break;
8915 }
8916 /* FALL THROUGH */
8917 case BGPTYPE_AS4_AGGREGATOR:
8918 if (bgpa_type == BGPTYPE_AS4_AGGREGATOR && tlen != 8)
8919 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8920 "Aggregator (invalid): %u byte%s", tlen,
8921 plurality(tlen, "", "s"));
8922 else {
8923 asn_len = tlen - 4;
8924 aggregator_as = (asn_len == 2) ?
8925 tvb_get_ntohs(tvb, o + i + aoff) :
8926 tvb_get_ntohl(tvb, o + i + aoff);
8927 proto_tree_add_uint(subtree2, hf_bgp_update_path_attribute_aggregator_as, tvb,
8928 o + i + aoff, asn_len, aggregator_as);
8929 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aggregator_origin, tvb,
8930 o + i + aoff + asn_len, 4, ENC_BIG_ENDIAN);
8931
8932 proto_item_append_text(ti_pa, ": AS: %u origin: %s", aggregator_as,
8933 tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff + asn_len));
8934 }
8935 break;
8936 case BGPTYPE_COMMUNITIES:
8937 if (tlen % 4 != 0) {
8938 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8939 "Communities (invalid): %u byte%s", tlen,
8940 plurality(tlen, "", "s"));
8941 break;
8942 }
8943
8944 proto_item_append_text(ti_pa, ": ");
8945
8946 ti_communities = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_communities,
8947 tvb, o + i + aoff, tlen, ENC_NA);
8948
8949 communities_tree = proto_item_add_subtree(ti_communities,
8950 ett_bgp_communities);
8951 proto_item_append_text(ti_communities, ": ");
8952 /* (o + i + aoff) =
8953 (o + current attribute + aoff bytes to first tuple) */
8954 q = o + i + aoff;
8955 end = q + tlen;
8956
8957 /* snarf each community */
8958 while (q < end) {
8959 /* check for reserved values */
8960 guint32 community = tvb_get_ntohl(tvb, q);
8961 if ((community & 0xFFFF0000) == FOURHEX0 ||
8962 (community & 0xFFFF0000) == FOURHEXF) {
8963 proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community_well_known,
8964 tvb, q, 4, ENC_BIG_ENDIAN);
8965 proto_item_append_text(ti_pa, "%s ", val_to_str_const(community, community_vals, "Reserved"));
8966 proto_item_append_text(ti_communities, "%s ", val_to_str_const(community, community_vals, "Reserved"));
8967 }
8968 else {
8969 ti_community = proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community, tvb,
8970 q, 4, ENC_NA);
8971 community_tree = proto_item_add_subtree(ti_community,
8972 ett_bgp_community);
8973 proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_as,
8974 tvb, q, 2, ENC_BIG_ENDIAN);
8975 proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_value,
8976 tvb, q+2, 2, ENC_BIG_ENDIAN);
8977 proto_item_append_text(ti_pa, "%u:%u ",tvb_get_ntohs(tvb, q),
8978 tvb_get_ntohs(tvb, q+2));
8979 proto_item_append_text(ti_communities, "%u:%u ",tvb_get_ntohs(tvb, q),
8980 tvb_get_ntohs(tvb, q+2));
8981 proto_item_append_text(ti_community, ": %u:%u ",tvb_get_ntohs(tvb, q),
8982 tvb_get_ntohs(tvb, q+2));
8983 }
8984
8985 q += 4;
8986 }
8987
8988
8989 break;
8990 case BGPTYPE_ORIGINATOR_ID:
8991 if (tlen != 4) {
8992 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
8993 "Originator identifier (invalid): %u byte%s", tlen,
8994 plurality(tlen, "", "s"));
8995 } else {
8996 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_originator_id, tvb,
8997 o + i + aoff, tlen, ENC_BIG_ENDIAN);
8998 proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
8999 }
9000 break;
9001 case BGPTYPE_MP_REACH_NLRI:
9002 /* RFC 2283 says that a MP_[UN]REACH_NLRI path attribute can
9003 * have more than one <AFI, SAFI, Next Hop, ..., NLRI> tuple.
9004 * However, that doesn't work because the NLRI is also a
9005 * variable number of <length, prefix> fields without a field
9006 * for the overall length of the NLRI. Thus one would have to
9007 * guess whether a particular byte were the length of the next
9008 * prefix or a new AFI. So no one ever implemented that, and
9009 * RFC 2858, obsoleting 2283, says you can't do that.
9010 */
9011 proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_address_family, tvb,
9012 o + i + aoff, 2, ENC_BIG_ENDIAN, &af);
9013 proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_safi, tvb,
9014 o + i + aoff+2, 1, ENC_BIG_ENDIAN, &saf);
9015 nexthop_len = tvb_get_guint8(tvb, o + i + aoff + 3);
9016
9017 decode_mp_next_hop(tvb_new_subset_length(tvb, o + i + aoff + 3, nexthop_len + 1), subtree2, pinfo, af, saf, nexthop_len);
9018
9019 aoff_save = aoff;
9020 tlen -= nexthop_len + 4;
9021 aoff += nexthop_len + 4;
9022
9023 off = 0;
9024 snpa = tvb_get_guint8(tvb, o + i + aoff);
9025 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa, tvb,
9026 o + i + aoff, 1, ENC_BIG_ENDIAN);
9027 off++;
9028 if (snpa) {
9029 subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_snpa);
9030 for (/*nothing*/; snpa > 0; snpa--) {
9031 guint8 snpa_length = tvb_get_guint8(tvb, o + i + aoff + off);
9032 proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length, tvb,
9033 o + i + aoff + off, 1, ENC_BIG_ENDIAN);
9034 off++;
9035 proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa, tvb,
9036 o + i + aoff + off, snpa_length, ENC_NA);
9037 off += snpa_length;
9038 }
9039 }
9040 tlen -= off;
9041 aoff += off;
9042
9043 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri, tvb, o + i + aoff, tlen, ENC_NA);
9044 subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
9045
9046 if (tlen) {
9047 if (af != AFNUM_INET && af != AFNUM_INET6 && af != AFNUM_L2VPN && af != AFNUM_BGP_LS) {
9048 proto_tree_add_expert(subtree3, pinfo, &ei_bgp_unknown_afi, tvb, o + i + aoff, tlen);
9049 } else {
9050 while (tlen > 0) {
9051 advance = decode_prefix_MP(subtree3,
9052 hf_bgp_nlri_path_id,
9053 hf_bgp_mp_reach_nlri_ipv4_prefix,
9054 hf_bgp_mp_reach_nlri_ipv6_prefix,
9055 af, saf, tlen,
9056 tvb, o + i + aoff, "MP Reach NLRI", pinfo);
9057 if (advance < 0)
9058 break;
9059 tlen -= advance;
9060 aoff += advance;
9061 }
9062 }
9063 }
9064 aoff = aoff_save;
9065 break;
9066 case BGPTYPE_MP_UNREACH_NLRI:
9067 af = tvb_get_ntohs(tvb, o + i + aoff);
9068 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_address_family, tvb,
9069 o + i + aoff, 2, ENC_BIG_ENDIAN);
9070 saf = tvb_get_guint8(tvb, o + i + aoff + 2) ;
9071 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_safi, tvb,
9072 o + i + aoff+2, 1, ENC_BIG_ENDIAN);
9073
9074 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri, tvb, o + i + aoff + 3, tlen - 3, ENC_NA);
9075 subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_unreach_nlri);
9076
9077 aoff_save = aoff;
9078 tlen -= 3;
9079 aoff += 3;
9080 if (tlen > 0) {
9081
9082 while (tlen > 0) {
9083 advance = decode_prefix_MP(subtree3,
9084 hf_bgp_nlri_path_id,
9085 hf_bgp_mp_unreach_nlri_ipv4_prefix,
9086 hf_bgp_mp_unreach_nlri_ipv6_prefix,
9087 af, saf, tlen,
9088 tvb, o + i + aoff, "MP Unreach NLRI", pinfo);
9089 if (advance < 0)
9090 break;
9091 tlen -= advance;
9092 aoff += advance;
9093 }
9094 }
9095 aoff = aoff_save;
9096 break;
9097 case BGPTYPE_CLUSTER_LIST:
9098 if (tlen % 4 != 0) {
9099 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
9100 "Cluster list (invalid): %u byte%s", tlen,
9101 plurality(tlen, "", "s"));
9102 break;
9103 }
9104
9105 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_cluster_list,
9106 tvb, o + i + aoff, tlen, ENC_NA);
9107 cluster_list_tree = proto_item_add_subtree(ti,
9108 ett_bgp_cluster_list);
9109
9110 /* (o + i + aoff) =
9111 (o + current attribute + aoff bytes to first tuple) */
9112 q = o + i + aoff;
9113 end = q + tlen;
9114 proto_item_append_text(ti, ":");
9115 proto_item_append_text(ti_pa, ":");
9116 /* snarf each cluster identifier */
9117 while (q < end) {
9118 proto_tree_add_item(cluster_list_tree, hf_bgp_update_path_attribute_cluster_id,
9119 tvb, q - 3 + aoff, 4, ENC_NA);
9120 proto_item_append_text(ti, " %s", tvb_ip_to_str(pinfo->pool, tvb, q-3+aoff));
9121 proto_item_append_text(ti_pa, " %s", tvb_ip_to_str(pinfo->pool, tvb, q-3+aoff));
9122 q += 4;
9123 }
9124
9125 break;
9126 case BGPTYPE_EXTENDED_COMMUNITY:
9127 if (tlen %8 != 0) {
9128 expert_add_info_format(pinfo, attr_len_item, &ei_bgp_ext_com_len_bad,
9129 "Community length %u wrong, must be modulo 8", tlen);
9130 } else {
9131 dissect_bgp_update_ext_com(subtree2, tvb, tlen, o+i+aoff, pinfo);
9132 }
9133 break;
9134 case BGPTYPE_SAFI_SPECIFIC_ATTR:
9135 q = o + i + aoff;
9136 end = o + i + aoff + tlen ;
9137
9138 while(q < end) {
9139 ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
9140 ssa_len = tvb_get_ntohs(tvb, q + 2);
9141
9142 subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, MIN(ssa_len + 4, end - q),
9143 ett_bgp_ssa, NULL, "%s Information",
9144 val_to_str_const(ssa_type, bgp_ssa_type, "Unknown SSA"));
9145
9146 proto_tree_add_item(subtree3, hf_bgp_ssa_t, tvb,
9147 q, 1, ENC_BIG_ENDIAN);
9148 proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb, q, 2, ENC_BIG_ENDIAN);
9149
9150 proto_tree_add_item(subtree3, hf_bgp_ssa_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
9151
9152 if ((ssa_len == 0) || (q + ssa_len > end)) {
9153 proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 2,
9154 end - q - 2, "Invalid Length of %u", ssa_len);
9155 break;
9156 }
9157
9158 switch (ssa_type) {
9159 case BGP_SSA_L2TPv3:
9160 proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_pref, tvb,
9161 q + 4, 2, ENC_BIG_ENDIAN);
9162
9163 subtree4 = proto_tree_add_subtree(subtree3, tvb, q + 6, 1, ett_bgp_ssa_subtree, NULL, "Flags");
9164 proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_s, tvb,
9165 q + 6, 1, ENC_BIG_ENDIAN);
9166 proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_unused, tvb,
9167 q + 6, 1, ENC_BIG_ENDIAN);
9168
9169 ssa_v3_len = tvb_get_guint8(tvb, q + 7);
9170 if (ssa_v3_len + 8 == ssa_len){
9171 proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie_len, tvb,
9172 q + 7, 1, ENC_BIG_ENDIAN);
9173 } else {
9174 proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 7, 1,
9175 "Invalid Cookie Length of %u", ssa_v3_len);
9176 q += ssa_len + 4; /* 4 from type and length */
9177 break;
9178 }
9179 proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_session_id, tvb,
9180 q + 8, 4, ENC_BIG_ENDIAN);
9181 if (ssa_v3_len)
9182 proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie, tvb,
9183 q + 12, ssa_v3_len, ENC_NA);
9184 q += ssa_len + 4; /* 4 from type and length */
9185 break;
9186 case BGP_SSA_mGRE:
9187 case BGP_SSA_IPSec:
9188 case BGP_SSA_MPLS:
9189 default:
9190 proto_tree_add_item(subtree3, hf_bgp_ssa_value, tvb,
9191 q + 4, ssa_len, ENC_NA);
9192 q += ssa_len + 4; /* 4 from type and length */
9193 break;
9194 case BGP_SSA_L2TPv3_IN_IPSec:
9195 case BGP_SSA_mGRE_IN_IPSec:
9196 /* These contain BGP_SSA_IPSec and BGP_SSA_L2TPv3/BGP_SSA_mGRE */
9197 q += 4; /* 4 from type and length */
9198 break;
9199 } /* switch (bgpa.bgpa_type) */
9200 }
9201 break;
9202 case BGPTYPE_TUNNEL_ENCAPS_ATTR:
9203 q = o + i + aoff;
9204 end = o + i + aoff + tlen;
9205
9206 subtree3 = proto_tree_add_subtree(subtree2, tvb, q, tlen, ett_bgp_tunnel_tlv, NULL, "TLV Encodings");
9207
9208 while (q < end) {
9209 encaps_tunnel_type = tvb_get_ntohs(tvb, q);
9210 encaps_tunnel_len = tvb_get_ntohs(tvb, q + 2);
9211
9212 subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, encaps_tunnel_len + 4,
9213 ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
9214 val_to_str_const(encaps_tunnel_type, bgp_attr_tunnel_type, "Unknown"), encaps_tunnel_len + 4);
9215
9216 proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_type, tvb, q, 2, ENC_BIG_ENDIAN);
9217 proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
9218
9219 subtree5 = proto_tree_add_subtree(subtree4, tvb, q + 4, encaps_tunnel_len, ett_bgp_tunnel_subtlv, NULL, "Sub-TLV Encodings");
9220
9221 q += 4;
9222 j = q + encaps_tunnel_len;
9223 while ( q < j ) {
9224 encaps_tunnel_subtype = tvb_get_guint8(tvb, q);
9225 if (encaps_tunnel_subtype < 128) {
9226 encaps_tunnel_sublen = tvb_get_guint8(tvb, q + 1);
9227 encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 2;
9228 } else {
9229 encaps_tunnel_sublen = tvb_get_ntohs(tvb, q + 1);
9230 encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 3;
9231 }
9232 subtree6 = proto_tree_add_subtree_format(subtree5, tvb, q, encaps_tunnel_sub_totallen,
9233 ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
9234 val_to_str_const(encaps_tunnel_subtype, subtlv_type, "Unknown"), encaps_tunnel_sub_totallen);
9235 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
9236 q += 1;
9237 if (encaps_tunnel_subtype < 128) {
9238 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 1, ENC_BIG_ENDIAN);
9239 q += 1;
9240 } else {
9241 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 2, ENC_BIG_ENDIAN);
9242 q += 2;
9243 }
9244
9245 switch (encaps_tunnel_subtype) {
9246 case TUNNEL_SUBTLV_ENCAPSULATION:
9247 {
9248 static int * const vxlan_flags[] = {
9249 &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
9250 &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
9251 &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
9252 NULL
9253 };
9254 static int * const vxlan_gpe_flags[] = {
9255 &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
9256 &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
9257 &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
9258 NULL
9259 };
9260 static int * const nvgre_flags[] = {
9261 &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
9262 &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
9263 &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
9264 NULL
9265 };
9266 if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP) {
9267 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_session_id, tvb, q, 4, ENC_BIG_ENDIAN);
9268 q += 4;
9269 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_cookie, tvb, q, encaps_tunnel_sublen - 4, ENC_NA);
9270 q += (encaps_tunnel_sublen - 4);
9271 } else if (encaps_tunnel_type == TUNNEL_TYPE_GRE || encaps_tunnel_type == TUNNEL_TYPE_MPLS_IN_GRE) {
9272 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 4, ENC_BIG_ENDIAN);
9273 q += 4;
9274 } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN) {
9275 proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
9276 ett_bgp_vxlan, vxlan_flags, ENC_BIG_ENDIAN);
9277 q += 1;
9278 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
9279 q += 3;
9280 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac, tvb, q, 6, ENC_NA);
9281 q += 6;
9282 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
9283 q += 2;
9284 } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN_GPE) {
9285 proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
9286 ett_bgp_vxlan, vxlan_gpe_flags, ENC_BIG_ENDIAN);
9287 q += 1;
9288 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
9289 q += 2;
9290 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
9291 q += 3;
9292 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
9293 q += 1;
9294 } else if (encaps_tunnel_type == TUNNEL_TYPE_NVGRE) {
9295 proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
9296 ett_bgp_vxlan, nvgre_flags, ENC_BIG_ENDIAN);
9297 q += 1;
9298 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
9299 q += 3;
9300 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac, tvb, q, 6, ENC_NA);
9301 q += 6;
9302 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
9303 q += 2;
9304 }
9305 }
9306 break;
9307 case TUNNEL_SUBTLV_PROTO_TYPE:
9308 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 2, ENC_BIG_ENDIAN);
9309 q += 2;
9310 break;
9311 case TUNNEL_SUBTLV_COLOR:
9312 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_color_value, tvb, q, 4, ENC_BIG_ENDIAN);
9313 q += 4;
9314 break;
9315 case TUNNEL_SUBTLV_LOAD_BALANCE:
9316 if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP || encaps_tunnel_type == TUNNEL_TYPE_GRE) {
9317 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_lb_block_length, tvb, q, 4, ENC_BIG_ENDIAN);
9318 q += 4;
9319 }
9320 break;
9321 case TUNNEL_SUBTLV_PREFERENCE:
9322 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_flags, tvb, q, 1, ENC_BIG_ENDIAN);
9323 q += 1;
9324 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
9325 q += 1;
9326 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_preference, tvb, q, 4, ENC_NA);
9327 q += 4;
9328 break;
9329 case TUNNEL_SUBTLV_BINDING_SID:
9330 {
9331 static int * const flags[] = {
9332 &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
9333 &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
9334 &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
9335 NULL
9336 };
9337
9338 proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
9339 ett_bgp_binding_sid, flags, ENC_BIG_ENDIAN);
9340 q += 1;
9341 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
9342 tvb, q, 1, ENC_BIG_ENDIAN);
9343 q += 1;
9344 if (encaps_tunnel_sublen > 2) {
9345 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid, tvb, q,
9346 encaps_tunnel_sublen - 2, ENC_NA);
9347 q += (encaps_tunnel_sublen - 2);
9348 }
9349 }
9350 break;
9351 case TUNNEL_SUBTLV_ENLP:
9352 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_flags, tvb, q, 1, ENC_BIG_ENDIAN);
9353 q += 1;
9354 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
9355 q += 1;
9356 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp, tvb, q, 1, ENC_BIG_ENDIAN);
9357 q += 1;
9358 break;
9359 case TUNNEL_SUBTLV_PRIORITY:
9360 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_priority, tvb, q, 1, ENC_BIG_ENDIAN);
9361 q += 1;
9362 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
9363 q += 1;
9364 break;
9365 case TUNNEL_SUBTLV_SEGMENT_LIST:
9366 {
9367 static int * const flags[] = {
9368 &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
9369 &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
9370 &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
9371 NULL
9372 };
9373
9374 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
9375 q += 1;
9376 ti = proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv, tvb, q,
9377 encaps_tunnel_sublen - 1, ENC_NA);
9378 encaps_tunnel_sublen -= 1;
9379 subtree7 = proto_item_add_subtree(ti, ett_bgp_segment_list);
9380 while (encaps_tunnel_sublen > 2) {
9381 segment_subtlv_type = tvb_get_guint8(tvb, q);
9382 segment_subtlv_length = tvb_get_guint8(tvb, q + 1);
9383 subtree8 = proto_tree_add_subtree_format(subtree7, tvb, q, segment_subtlv_length + 2,
9384 ett_bgp_segment_list, NULL, "SubTLV: %s", val_to_str_const(segment_subtlv_type,
9385 bgp_sr_policy_list_type, "Unknown"));
9386 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
9387 q += 1;
9388 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length, tvb, q, 1, ENC_BIG_ENDIAN);
9389 q += 1;
9390 if (segment_subtlv_length > 0) {
9391 switch(segment_subtlv_type) {
9392 /* TODO: Dissect further subTLVs data as defined in draft-ietf-idr-segment-routing-te-policy-08 section 2.4.3.2 */
9393 case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A:
9394 proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
9395 ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
9396 q += 1;
9397 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
9398 tvb, q, 1, ENC_NA);
9399 q += 1;
9400 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
9401 tvb, q, 3, ENC_BIG_ENDIAN);
9402 q += 2;
9403 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
9404 tvb, q, 1, ENC_BIG_ENDIAN);
9405 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
9406 tvb, q, 1, ENC_BIG_ENDIAN);
9407 q += 1;
9408 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
9409 tvb, q, 1, ENC_BIG_ENDIAN);
9410 q += 1;
9411 break;
9412 default:
9413 proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
9414 tvb, q, segment_subtlv_length, ENC_NA);
9415 q += segment_subtlv_length;
9416 break;
9417 }
9418 }
9419 encaps_tunnel_sublen -= (segment_subtlv_length + 2);
9420 }
9421 }
9422 break;
9423 case TUNNEL_SUBTLV_POLICY_NAME:
9424 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
9425 q += 1;
9426 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_name, tvb, q,
9427 encaps_tunnel_sublen - 1, ENC_ASCII|ENC_NA);
9428 q += (encaps_tunnel_sublen - 1);
9429 break;
9430 default:
9431 proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_value, tvb, q, encaps_tunnel_sublen, ENC_NA);
9432 q += encaps_tunnel_sublen;
9433 break;
9434 } /* switch (encaps_tunnel_subtype) */
9435 }
9436 }
9437 break;
9438 case BGPTYPE_AIGP:
9439 q = o + i + aoff;
9440 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aigp, tvb, q, tlen, ENC_NA);
9441 subtree3 = proto_item_add_subtree(ti, ett_bgp_aigp_attr);
9442 aigp_type_item = proto_tree_add_item(subtree3, hf_bgp_aigp_type, tvb, q, 1, ENC_BIG_ENDIAN);
9443 aigp_type = tvb_get_guint8(tvb,q);
9444 switch (aigp_type) {
9445 case AIGP_TLV_TYPE :
9446 proto_tree_add_item(subtree3, hf_bgp_aigp_tlv_length, tvb, q+1, 2, ENC_BIG_ENDIAN);
9447 proto_tree_add_item(subtree3, hf_bgp_aigp_accu_igp_metric, tvb, q+3, 8, ENC_BIG_ENDIAN);
9448 proto_item_append_text(ti, ": %" G_GINT64_MODIFIER "u", tvb_get_ntoh64(tvb, q+3));
9449 proto_item_append_text(ti_pa, ": %" G_GINT64_MODIFIER "u", tvb_get_ntoh64(tvb, q+3));
9450 break;
9451 default :
9452 expert_add_info_format(pinfo, aigp_type_item, &ei_bgp_attr_aigp_type,
9453 "AIGP type %u unknown", aigp_type);
9454 }
9455 break;
9456 case BGPTYPE_LINK_STATE_ATTR:
9457 case BGPTYPE_LINK_STATE_OLD_ATTR:
9458 q = o + i + aoff;
9459 end = o + i + aoff + tlen;
9460 /* FF: BGPTYPE_LINK_STATE_ATTR body dissection is moved after the while.
9461 Here we just save the TLV coordinates and the subtree. */
9462 save_link_state_attr_position(pinfo, q, end, tlen, subtree2);
9463 break;
9464
9465 case BGPTYPE_LARGE_COMMUNITY:
9466 if(tlen == 0 || tlen % 12){
9467 break;
9468 }
9469 q = o + i + aoff;
9470 end = q + tlen;
9471 wmem_strbuf_t *comm_strbuf;
9472 comm_strbuf = wmem_strbuf_new_label(pinfo->pool);
9473 while (q < end) {
9474 guint32 ga, ldp1, ldp2;
9475 ga = tvb_get_ntohl(tvb, q);
9476 ldp1 = tvb_get_ntohl(tvb, q+4);
9477 ldp2 = tvb_get_ntohl(tvb, q+8);
9478 ti = proto_tree_add_string_format(subtree2, hf_bgp_large_communities, tvb, q, 12, NULL, "Large communities: %u:%u:%u", ga, ldp1, ldp2);
9479 subtree3 = proto_item_add_subtree(ti, ett_bgp_large_communities);
9480 proto_tree_add_item(subtree3, hf_bgp_large_communities_ga, tvb,
9481 q, 4, ENC_BIG_ENDIAN);
9482 proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp1, tvb,
9483 q + 4, 4, ENC_BIG_ENDIAN);
9484 proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp2, tvb,
9485 q + 8, 4, ENC_BIG_ENDIAN);
9486 wmem_strbuf_append_printf(comm_strbuf, " %u:%u:%u", ga, ldp1, ldp2);
9487 q += 12;
9488 }
9489
9490 proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(comm_strbuf));
9491
9492 break;
9493 case BGPTYPE_BGPSEC_PATH:
9494 q = o + i + aoff;
9495 end = q + tlen;
9496 secpathlen = tvb_get_ntohs(tvb, q); /* Secure Path Length */
9497
9498 if (((secpathlen - 2) % SEC_PATH_SEG_SIZE) != 0) { /* SEC_PATH_SEG_SIZE = 6 */
9499 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
9500 "Invalid BGPsec Secure Path length: %u bytes", secpathlen);
9501 }
9502
9503 subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, secpathlen,
9504 ett_bgp_bgpsec_secure_path,
9505 NULL,
9506 "Secure Path (%d byte%s)",
9507 secpathlen,
9508 plurality(secpathlen, "", "s"));
9509
9510 /* Secure Path Length */
9511 proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sp_len, tvb, q, 2, ENC_BIG_ENDIAN);
9512 q += 2;
9513
9514 secpathcount = (secpathlen - 2) / SEC_PATH_SEG_SIZE; /* Amount of Secure Path Segments */
9515 j = 0;
9516 while (j < secpathcount) {
9517 subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, SEC_PATH_SEG_SIZE,
9518 ett_bgp_bgpsec_secure_path_segment,
9519 NULL,
9520 "Secure Path Segment (%d byte%s)",
9521 SEC_PATH_SEG_SIZE,
9522 plurality(SEC_PATH_SEG_SIZE, "", "s"));
9523
9524 /* pCount field */
9525 proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_pcount, tvb,
9526 q, 1, ENC_BIG_ENDIAN);
9527 q += 1;
9528
9529 /* Flags field */
9530 proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_flags, tvb,
9531 q, 1, ENC_BIG_ENDIAN);
9532 q += 1;
9533
9534 /* ASN field */
9535 proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_as, tvb,
9536 q, 4, ENC_BIG_ENDIAN);
9537 q += 4;
9538 j++;
9539 }
9540
9541 sigblocklen = tvb_get_ntohs(tvb, q); /* Signature Block Length */
9542
9543 subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, sigblocklen,
9544 ett_bgp_bgpsec_signature_block,
9545 NULL,
9546 "Signature Block (%d byte%s)",
9547 sigblocklen,
9548 plurality(sigblocklen, "", "s"));
9549
9550 /* Signature Block Length */
9551 proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sb_len, tvb, q, 2, ENC_BIG_ENDIAN);
9552 q += 2;
9553
9554 /* Algorithm Suite ID */
9555 proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_algo_id, tvb, q, 1, ENC_BIG_ENDIAN);
9556 q += 1;
9557
9558 while (q < end) {
9559 sig_len = tvb_get_ntohs(tvb, q+20); /* Signature Length of current Segment */
9560
9561 subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, 22+sig_len,
9562 ett_bgp_bgpsec_signature_segment,
9563 NULL,
9564 "Signature Segment (%d byte%s)",
9565 22+sig_len,
9566 plurality(22+sig_len, "", "s"));
9567
9568 /* Subject Key Identifier */
9569 proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_ski, tvb,
9570 q, 20, ENC_NA);
9571 q += 20;
9572
9573 /* Signature Length */
9574 proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig_len, tvb,
9575 q, 2, ENC_BIG_ENDIAN);
9576 q += 2;
9577
9578 /* Signature */
9579 proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig, tvb,
9580 q, sig_len, ENC_NA);
9581 q += sig_len;
9582 }
9583
9584 break;
9585 case BGPTYPE_BGP_PREFIX_SID:
9586 q = o + i + aoff;
9587 end = q + tlen;
9588 proto_item *tlv_item, *stlv_item, *sstlv_item;
9589 proto_tree *tlv_tree, *stlv_tree, *sstlv_tree;
9590 proto_item *srgb_tlv_item;
9591 proto_tree *srgb_tlv_tree;
9592 proto_item *srv6_stlv_item;
9593 proto_tree *srv6_stlv_tree;
9594 proto_item *srv6_data_sstlv_item;
9595 proto_tree *srv6_data_sstlv_tree;
9596 gint sub_pnt, sub_end;
9597 gint sub_sub_pnt, sub_sub_end;
9598 while (q < end) {
9599 prefix_sid_subtype = tvb_get_guint8(tvb, q);
9600 prefix_sid_sublen = tvb_get_ntohs(tvb, q + 1);
9601 switch (prefix_sid_subtype) {
9602 case BGP_PREFIX_SID_TLV_LABEL_INDEX:
9603 tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_label_index, tvb, q , prefix_sid_sublen + 3, ENC_NA);
9604 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_label_index);
9605 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
9606 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
9607 if (prefix_sid_sublen != BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX){
9608 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
9609 "Invalid BGP Prefix-SID Label Index length: %u bytes", prefix_sid_sublen);
9610 q += 3 + prefix_sid_sublen;
9611 break;
9612 }
9613 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
9614 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_flags, tvb, q + 4, 2, ENC_BIG_ENDIAN);
9615 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_value, tvb, q + 6, 4, ENC_BIG_ENDIAN);
9616 proto_item_append_text(tlv_tree, ": %u ", tvb_get_ntohl(tvb, q + 6));
9617 q += 10;
9618 break;
9619 case BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB:
9620 check_srgb = prefix_sid_sublen - 2;
9621 prefix_sid_sub_tlv_offset = 0;
9622 tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_originator_srgb, tvb, q , prefix_sid_sublen + 3, ENC_NA);
9623 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb);
9624 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
9625 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
9626 if(check_srgb % 3 || check_srgb % 2){
9627 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
9628 "Invalid BGP Prefix-SID SRGB Originator length: %u bytes", prefix_sid_sublen);
9629 q += 3 + prefix_sid_sublen;
9630 break;
9631 }
9632 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_flags, tvb, q + 3, 2, ENC_BIG_ENDIAN);
9633 q += 2;
9634 tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_blocks, tvb, q , prefix_sid_sublen - 2, ENC_NA);
9635 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb_blocks);
9636 while (prefix_sid_sublen > prefix_sid_sub_tlv_offset + 2) {
9637 srgb_tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_block, tvb, q , prefix_sid_sublen - 2, ENC_NA);
9638 srgb_tlv_tree = proto_item_add_subtree(srgb_tlv_item, ett_bgp_prefix_sid_originator_srgb_block);
9639 prefix_sid_sub_tlv_offset += 3;
9640 proto_tree_add_item(srgb_tlv_tree, hf_bgp_prefix_sid_originator_srgb_base, tvb, q + prefix_sid_sub_tlv_offset, 3, ENC_BIG_ENDIAN);
9641 prefix_sid_sub_tlv_offset += 3;
9642 proto_tree_add_item(srgb_tlv_tree, hf_bgp_prefix_sid_originator_srgb_range, tvb, q + prefix_sid_sub_tlv_offset, 3, ENC_BIG_ENDIAN);
9643 proto_item_append_text(srgb_tlv_tree, "(%u:%u)", tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset - 3),
9644 tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset));
9645 }
9646 q += 3 + prefix_sid_sublen;
9647 break;
9648 case BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE:
9649 tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l3vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
9650 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l3vpn);
9651 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
9652 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
9653 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
9654
9655 srv6_stlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs, tvb, q + 4, prefix_sid_sublen - 1, ENC_NA);
9656 srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs);
9657
9658 sub_pnt = q + 4;
9659 sub_end = q + 3 + prefix_sid_sublen;
9660 while (sub_pnt < sub_end) {
9661 srv6_service_subtlv_type = tvb_get_guint8(tvb, sub_pnt);
9662 srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
9663
9664 switch (srv6_service_subtlv_type) {
9665 case SRV6_SERVICE_SRV6_SID_INFORMATION:
9666 stlv_item = proto_tree_add_item(srv6_stlv_tree,
9667 hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
9668 tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
9669 proto_item_append_text(stlv_item, " - %s",
9670 val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
9671 stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_information);
9672
9673 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
9674 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9675 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
9676 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
9677 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
9678 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_NA);
9679 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
9680
9681 srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
9682 hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
9683 tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
9684 srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs);
9685
9686 sub_sub_pnt = sub_pnt + 24;
9687 sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
9688 while (sub_sub_pnt < sub_sub_end) {
9689 srv6_service_data_subsubtlv_type = tvb_get_guint8(tvb, sub_sub_pnt);
9690 srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
9691
9692 switch (srv6_service_data_subsubtlv_type) {
9693 case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
9694 sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
9695 hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
9696 tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
9697 proto_item_append_text(sstlv_item, " - %s",
9698 val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
9699 sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_structure);
9700
9701 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
9702 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length, tvb, sub_sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9703 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len, tvb, sub_sub_pnt + 3, 1, ENC_BIG_ENDIAN);
9704 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len, tvb, sub_sub_pnt + 4, 1, ENC_BIG_ENDIAN);
9705 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
9706 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
9707 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
9708 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
9709 break;
9710 default:
9711 sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
9712 hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
9713 tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
9714 proto_item_append_text(sstlv_item, " - %s",
9715 val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
9716 sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown);
9717
9718 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
9719 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length, tvb, sub_sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9720 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value, tvb, sub_sub_pnt + 3, srv6_service_data_subsubtlv_len, ENC_NA);
9721 break;
9722 }
9723 sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
9724 }
9725 break;
9726 default:
9727 stlv_item = proto_tree_add_item(srv6_stlv_tree,
9728 hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
9729 tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
9730 proto_item_append_text(stlv_item, " - %s", val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
9731 stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_unknown);
9732
9733 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
9734 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9735 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value, tvb, sub_pnt + 3, srv6_service_subtlv_len, ENC_NA);
9736 break;
9737 }
9738 sub_pnt += 3 + srv6_service_subtlv_len;
9739 }
9740 q += (3 + prefix_sid_sublen);
9741 break;
9742 case BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE:
9743 tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l2vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
9744 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l2vpn);
9745 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
9746 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
9747 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
9748
9749 srv6_stlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs, tvb, q + 4, prefix_sid_sublen - 1, ENC_NA);
9750 srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs);
9751
9752 sub_pnt = q + 4;
9753 sub_end = q + 3 + prefix_sid_sublen;
9754 while (sub_pnt < sub_end) {
9755 srv6_service_subtlv_type = tvb_get_guint8(tvb, sub_pnt);
9756 srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
9757
9758 switch (srv6_service_subtlv_type) {
9759 case SRV6_SERVICE_SRV6_SID_INFORMATION:
9760 stlv_item = proto_tree_add_item(srv6_stlv_tree,
9761 hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
9762 tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
9763 proto_item_append_text(stlv_item, " - %s",
9764 val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
9765 stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_information);
9766
9767 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
9768 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9769 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
9770 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
9771 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
9772 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_NA);
9773 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
9774
9775 srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
9776 hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
9777 tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
9778 srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs);
9779
9780 sub_sub_pnt = sub_pnt + 24;
9781 sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
9782 while (sub_sub_pnt < sub_sub_end) {
9783 srv6_service_data_subsubtlv_type = tvb_get_guint8(tvb, sub_sub_pnt);
9784 srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
9785
9786 switch (srv6_service_data_subsubtlv_type) {
9787 case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
9788 sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
9789 hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
9790 tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
9791 proto_item_append_text(sstlv_item, " - %s",
9792 val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
9793 sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_structure);
9794
9795 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
9796 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length, tvb, sub_sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9797 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len, tvb, sub_sub_pnt + 3, 1, ENC_BIG_ENDIAN);
9798 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len, tvb, sub_sub_pnt + 4, 1, ENC_BIG_ENDIAN);
9799 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
9800 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
9801 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
9802 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
9803 break;
9804 default:
9805 sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
9806 hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
9807 tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
9808 proto_item_append_text(sstlv_item, " - %s",
9809 val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
9810 sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown);
9811
9812 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
9813 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length, tvb, sub_sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9814 proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value, tvb, sub_sub_pnt + 3, srv6_service_data_subsubtlv_len, ENC_NA);
9815 break;
9816 }
9817 sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
9818 }
9819 break;
9820 default:
9821 stlv_item = proto_tree_add_item(srv6_stlv_tree,
9822 hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
9823 tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
9824 proto_item_append_text(stlv_item, " - %s", val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
9825 stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_unknown);
9826
9827 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
9828 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
9829 proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value, tvb, sub_pnt + 3, srv6_service_subtlv_len, ENC_NA);
9830 break;
9831 }
9832 sub_pnt += 3 + srv6_service_subtlv_len;
9833 }
9834 q += (3 + prefix_sid_sublen);
9835 break;
9836 default:
9837 tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_unknown, tvb, q, prefix_sid_sublen + 3, ENC_NA);
9838 proto_item_append_text(tlv_item, " (%s)", val_to_str(prefix_sid_subtype, bgp_prefix_sid_type, "%u"));
9839 tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_unknown);
9840 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
9841 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
9842 proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_value, tvb, q + 3, prefix_sid_sublen - 3, ENC_NA);
9843 q += (3 + prefix_sid_sublen);
9844 break;
9845 }
9846 }
9847 break;
9848 case BGPTYPE_PMSI_TUNNEL_ATTR:
9849 dissect_bgp_update_pmsi_attr(pinfo, subtree2, tvb, tlen, o+i+aoff);
9850 break;
9851
9852 case BGPTYPE_ATTR_SET:
9853 if (alen >= 4) {
9854 proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_attrset_origin_as, tvb,
9855 o + i + aoff, 4, ENC_BIG_ENDIAN);
9856 if (alen > 4) {
9857 ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attributes, tvb, o+i+aoff+4, alen-4, ENC_NA);
9858 attr_set_subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
9859 dissect_bgp_path_attr(attr_set_subtree, tvb, alen-4, o+i+aoff+4, pinfo);
9860 }
9861 } else {
9862 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
9863 "Attribute set (invalid): %u bytes%s",
9864 alen, plurality(alen, "", "s"));
9865 }
9866 break;
9867 case BGPTYPE_D_PATH:
9868 if(tlen < 8){
9869 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
9870 "D-PATH attribute has invalid length (invalid): %u byte%s", tlen,
9871 plurality(tlen, "", "s"));
9872 break;
9873 }
9874 q = o + i + aoff;
9875 end = q + tlen;
9876 wmem_strbuf_t *dpath_strbuf;
9877 dpath_strbuf = wmem_strbuf_new_label(pinfo->pool);
9878 guint8 dpath_len;
9879 dpath_len = tvb_get_guint8(tvb, q);
9880 proto_tree_add_item(subtree2, hf_bgp_d_path_length, tvb,
9881 q, 1, ENC_BIG_ENDIAN);
9882 q += 1;
9883 while (dpath_len > 0 && q < end) {
9884 guint32 ad;
9885 guint16 ld;
9886 ad = tvb_get_ntohl(tvb, q);
9887 ld = tvb_get_ntohs(tvb, q+4);
9888 ti = proto_tree_add_string_format(subtree2, hf_bgp_update_path_attribute_d_path, tvb, q, 6, NULL, "Domain ID: %u:%u", ad, ld);
9889 subtree3 = proto_item_add_subtree(ti, ett_bgp_dpath);
9890 proto_tree_add_item(subtree3, hf_bgp_d_path_ga, tvb,
9891 q, 4, ENC_BIG_ENDIAN);
9892 proto_tree_add_item(subtree3, hf_bgp_d_path_la, tvb,
9893 q + 4, 2, ENC_BIG_ENDIAN);
9894 wmem_strbuf_append_printf(dpath_strbuf, " %u:%u", ad, ld);
9895 q += 6;
9896 dpath_len -= 1;
9897 }
9898 if (dpath_len != 0 || q >= end) {
9899 proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
9900 "D-PATH list (invalid): %u byte%s", tlen,
9901 plurality(tlen, "", "s"));
9902 break;
9903 }
9904 proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(dpath_strbuf));
9905
9906 proto_tree_add_item(subtree2, hf_bgp_d_path_isf_safi, tvb,
9907 q, 1, ENC_BIG_ENDIAN);
9908 break;
9909 default:
9910 proto_tree_add_item(subtree2, hf_bgp_update_path_attributes_unknown, tvb, o + i + aoff, tlen, ENC_NA);
9911 break;
9912 } /* switch (bgpa.bgpa_type) */ /* end of second switch */
9913
9914 i += alen + aoff;
9915 }
9916 {
9917 /* FF: postponed BGPTYPE_LINK_STATE_ATTR dissection */
9918 link_state_data *data = load_link_state_data(pinfo);
9919 if (data && data->link_state_attr_present) {
9920 ti = proto_tree_add_item(data->subtree2, hf_bgp_update_path_attribute_link_state, tvb, data->ostart, data->tlen, ENC_NA);
9921 subtree3 = proto_item_add_subtree(ti, ett_bgp_link_state);
9922 while (data->ostart < data->oend) {
9923 advance = decode_link_state_attribute_tlv(subtree3, tvb, data->ostart, pinfo, data->protocol_id);
9924 if (advance < 0) {
9925 break;
9926 }
9927 data->ostart += advance;
9928 }
9929 }
9930 }
9931 }
9932 /*
9933 * Dissect a BGP UPDATE message.
9934 */
9935 static void
dissect_bgp_update(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo)9936 dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
9937 {
9938 guint16 hlen; /* message length */
9939 gint o; /* packet offset */
9940 gint end=0; /* message end */
9941 guint16 len; /* tmp */
9942 proto_item *ti; /* tree item */
9943 proto_tree *subtree; /* subtree for attributes */
9944 int i; /* tmp */
9945
9946 hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
9947 o = BGP_HEADER_SIZE;
9948
9949
9950 /* check for withdrawals */
9951 len = tvb_get_ntohs(tvb, o);
9952 proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes_length, tvb, o, 2, ENC_BIG_ENDIAN);
9953 o += 2;
9954
9955 /* parse unfeasible prefixes */
9956 if (len > 0) {
9957 ti = proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes, tvb, o, len, ENC_NA);
9958 subtree = proto_item_add_subtree(ti, ett_bgp_unfeas);
9959
9960 /* parse each prefix */
9961 end = o + len;
9962
9963 /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
9964 if( detect_add_path_prefix4(tvb, o, end) ) {
9965 /* IPv4 prefixes with Path Id */
9966 while (o < end) {
9967 i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_withdrawn_prefix, tvb, o,
9968 "Withdrawn route");
9969 if (i < 0)
9970 return;
9971 o += i;
9972 }
9973 } else {
9974 while (o < end) {
9975 i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_withdrawn_prefix, tvb, o,
9976 "Withdrawn route");
9977 if (i < 0)
9978 return;
9979 o += i;
9980 }
9981 }
9982 }
9983
9984 /* check for advertisements */
9985 len = tvb_get_ntohs(tvb, o);
9986 proto_tree_add_item(tree, hf_bgp_update_total_path_attribute_length, tvb, o, 2, ENC_BIG_ENDIAN);
9987
9988 /* path attributes */
9989 if (len > 0) {
9990 ti = proto_tree_add_item(tree, hf_bgp_update_path_attributes, tvb, o+2, len, ENC_NA);
9991 subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
9992
9993 dissect_bgp_path_attr(subtree, tvb, len, o+2, pinfo);
9994
9995 o += 2 + len;
9996
9997 /* NLRI */
9998 len = hlen - o;
9999
10000 /* parse prefixes */
10001 if (len > 0) {
10002 ti = proto_tree_add_item(tree, hf_bgp_update_nlri, tvb, o, len, ENC_NA);
10003 subtree = proto_item_add_subtree(ti, ett_bgp_nlri);
10004 end = o + len;
10005 /*
10006 * Heuristic to detect if IPv4 prefix are using Path Identifiers
10007 * we need at least 5 bytes for Add-path prefixes
10008 */
10009 if( len > 4 && detect_add_path_prefix4(tvb, o, end) ) {
10010 /* IPv4 prefixes with Path Id */
10011 while (o < end) {
10012 i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_nlri_prefix, tvb, o,
10013 "NLRI");
10014 if (i < 0)
10015 return;
10016 o += i;
10017 }
10018 } else {
10019 /* Standard prefixes */
10020 while (o < end) {
10021 i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_nlri_prefix, tvb, o, "NLRI");
10022 if (i < 0)
10023 return;
10024 o += i;
10025 }
10026 }
10027 }
10028 }
10029 }
10030
10031 /*
10032 * Dissect a BGP CAPABILITY message.
10033 */
10034 static void
dissect_bgp_capability(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo)10035 dissect_bgp_capability(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
10036 {
10037 int offset = 0;
10038 int mend;
10039
10040 mend = offset + tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
10041 offset += BGP_HEADER_SIZE;
10042 /* step through all of the capabilities */
10043 while (offset < mend) {
10044 offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, TRUE);
10045 }
10046 }
10047
10048 /*
10049 * Dissect a BGP NOTIFICATION message.
10050 */
10051 static void
dissect_bgp_notification(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo)10052 dissect_bgp_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
10053 {
10054 int hlen; /* message length */
10055 int offset;
10056 guint major_error;
10057 proto_item *ti;
10058 guint8 clen;
10059 guint8 minor_cease;
10060
10061
10062 hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
10063 offset = BGP_MARKER_SIZE + 2 + 1;
10064
10065
10066 /* print error code */
10067 proto_tree_add_item(tree, hf_bgp_notify_major_error, tvb, offset, 1, ENC_BIG_ENDIAN);
10068 major_error = tvb_get_guint8(tvb, offset);
10069 offset += 1;
10070
10071 switch(major_error){
10072 case BGP_MAJOR_ERROR_MSG_HDR:
10073 proto_tree_add_item(tree, hf_bgp_notify_minor_msg_hdr, tvb, offset, 1, ENC_BIG_ENDIAN);
10074 break;
10075 case BGP_MAJOR_ERROR_OPEN_MSG:
10076 proto_tree_add_item(tree, hf_bgp_notify_minor_open_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
10077 break;
10078 case BGP_MAJOR_ERROR_UPDATE_MSG:
10079 proto_tree_add_item(tree,hf_bgp_notify_minor_update_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
10080 break;
10081 case BGP_MAJOR_ERROR_HT_EXPIRED:
10082 proto_tree_add_item(tree, hf_bgp_notify_minor_ht_expired, tvb, offset, 1, ENC_BIG_ENDIAN);
10083 break;
10084 case BGP_MAJOR_ERROR_STATE_MACHINE:
10085 proto_tree_add_item(tree, hf_bgp_notify_minor_state_machine, tvb, offset, 1, ENC_BIG_ENDIAN);
10086 break;
10087 case BGP_MAJOR_ERROR_CEASE:
10088 proto_tree_add_item(tree, hf_bgp_notify_minor_cease, tvb, offset, 1, ENC_BIG_ENDIAN);
10089 break;
10090 case BGP_MAJOR_ERROR_CAP_MSG:
10091 proto_tree_add_item(tree, hf_bgp_notify_minor_cap_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
10092 break;
10093 default:
10094 ti = proto_tree_add_item(tree, hf_bgp_notify_minor_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
10095 expert_add_info_format(pinfo, ti, &ei_bgp_notify_minor_unknown, "Unknown notification error (%d)",major_error);
10096 break;
10097 }
10098 offset += 1;
10099
10100 /* only print if there is optional data */
10101 if (hlen > BGP_MIN_NOTIFICATION_MSG_SIZE) {
10102 minor_cease = tvb_get_guint8(tvb, offset - 1);
10103 clen = tvb_get_guint8(tvb, offset);
10104 /* Might be a idr-shutdown communication, first byte is length */
10105 if (hlen - BGP_MIN_NOTIFICATION_MSG_SIZE - 1 == clen && major_error == BGP_MAJOR_ERROR_CEASE &&
10106 (minor_cease == BGP_CEASE_MINOR_ADMIN_SHUTDOWN || minor_cease == BGP_CEASE_MINOR_ADMIN_RESET) ) {
10107 proto_tree_add_item(tree, hf_bgp_notify_communication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
10108 offset += 1;
10109 proto_tree_add_item(tree, hf_bgp_notify_communication, tvb, offset, clen, ENC_UTF_8|ENC_NA);
10110 /* otherwise just dump the hex data */
10111 } else if ( major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 7 ) {
10112 while (offset < hlen) {
10113 offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, FALSE);
10114 }
10115 } else if (major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 2 ) { /* Display Bad Peer AS Number */
10116 proto_tree_add_item(tree, hf_bgp_notify_error_open_bad_peer_as, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_NA);
10117 } else {
10118 proto_tree_add_item(tree, hf_bgp_notify_data, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_NA);
10119 }
10120 }
10121 }
10122
10123 /*
10124 * Dissect a BGP ROUTE-REFRESH message.
10125 */
10126 static void
dissect_bgp_route_refresh(tvbuff_t * tvb,proto_tree * tree,packet_info * pinfo)10127 dissect_bgp_route_refresh(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
10128 {
10129 int p; /* tvb offset counter */
10130 int pend; /* end of list of entries for one orf type */
10131 guint16 hlen; /* tvb RR msg length */
10132 proto_item *ti; /* tree item */
10133 proto_item *ti1; /* tree item */
10134 proto_tree *subtree; /* tree for orf */
10135 proto_tree *subtree1; /* tree for orf entry */
10136 guint8 orftype; /* ORF Type */
10137 guint16 orflen; /* ORF len */
10138 guint8 entryflag; /* ORF Entry flag: action(add,del,delall) match(permit,deny) */
10139 int entrylen; /* ORF Entry length */
10140 int advance; /* tmp */
10141
10142
10143 /*
10144 example 1
10145 00 1c 05 hlen=28
10146 00 01 00 01 afi,safi= ipv4-unicast
10147 02 80 00 01 defer, prefix-orf, len=1
10148 80 removeall
10149 example 2
10150 00 25 05 hlen=37
10151 00 01 00 01 afi,saif= ipv4-unicast
10152 01 80 00 0a immediate, prefix-orf, len=10
10153 00 add
10154 00 00 00 05 seqno = 5
10155 12 ge = 18
10156 18 le = 24
10157 10 07 02 prefix = 7.2.0.0/16
10158 */
10159 if (!tree)
10160 return;
10161
10162 hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
10163 p = BGP_HEADER_SIZE;
10164
10165 /* AFI */
10166 proto_tree_add_item(tree, hf_bgp_route_refresh_afi, tvb, p, 2, ENC_BIG_ENDIAN);
10167 p += 2;
10168
10169 /* Subtype in draft-ietf-idr-bgp-enhanced-route-refresh-02 (for Enhanced Route Refresh Capability) before Reserved*/
10170 proto_tree_add_item(tree, hf_bgp_route_refresh_subtype, tvb, p, 1, ENC_BIG_ENDIAN);
10171 p++;
10172
10173 /* SAFI */
10174 proto_tree_add_item(tree, hf_bgp_route_refresh_safi, tvb, p, 1, ENC_BIG_ENDIAN);
10175 p++;
10176
10177 if ( hlen == BGP_HEADER_SIZE + 4 )
10178 return;
10179 while (p < hlen) {
10180 /* ORF type */
10181
10182 ti = proto_tree_add_item(tree, hf_bgp_route_refresh_orf, tvb, p, 4, ENC_NA);
10183 subtree = proto_item_add_subtree(ti, ett_bgp_orf);
10184
10185 proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_flag, tvb, p, 1, ENC_BIG_ENDIAN);
10186 p += 1;
10187
10188 ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_type, tvb, p , 1, ENC_BIG_ENDIAN);
10189 orftype = tvb_get_guint8(tvb, p);
10190 p += 1;
10191
10192 proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_length, tvb, p , 2, ENC_BIG_ENDIAN);
10193 orflen = tvb_get_ntohs(tvb, p);
10194 proto_item_set_len(ti, orflen + 4);
10195 p += 2;
10196
10197 if (orftype != BGP_ORF_PREFIX_CISCO) {
10198 expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unknown, "ORFEntry-Unknown (type %u)", orftype);
10199 p += orflen;
10200 continue;
10201 }
10202 pend = p + orflen;
10203 while (p < pend) {
10204
10205 ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_entry_prefixlist, tvb, p, 1, ENC_NA);
10206 subtree1 = proto_item_add_subtree(ti1, ett_bgp_orf_entry);
10207 proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_action, tvb, p, 1, ENC_BIG_ENDIAN);
10208 entryflag = tvb_get_guint8(tvb, p);
10209 if (((entryflag & BGP_ORF_ACTION) >> 6) == BGP_ORF_REMOVEALL) {
10210 p++;
10211 continue;
10212 }
10213 proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_match, tvb, p, 1, ENC_BIG_ENDIAN);
10214 p++;
10215
10216 proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_sequence, tvb, p, 4, ENC_BIG_ENDIAN);
10217 p +=4;
10218
10219 proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_lower, tvb, p, 1, ENC_BIG_ENDIAN);
10220 p++;
10221
10222 proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_upper, tvb, p, 1, ENC_BIG_ENDIAN);
10223 p++;
10224
10225 advance = decode_prefix4(subtree1, pinfo, NULL, hf_bgp_route_refresh_orf_entry_ip, tvb, p, "ORF");
10226 if (advance < 0)
10227 break;
10228 entrylen = 7 + 1 + advance;
10229
10230 proto_item_set_len(ti1, entrylen);
10231 p += advance;
10232
10233 }
10234 }
10235 }
10236
10237 static void
dissect_bgp_pdu(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,gboolean first)10238 dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
10239 gboolean first)
10240 {
10241 guint16 bgp_len; /* Message length */
10242 guint8 bgp_type; /* Message type */
10243 const char *typ; /* Message type (string) */
10244 proto_item *ti_marker = NULL;/* marker item */
10245 proto_item *ti_len = NULL; /* length item */
10246 proto_tree *bgp_tree = NULL; /* BGP packet tree */
10247 static const guint8 valid_marker[BGP_MARKER_SIZE] = {
10248 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
10249 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
10250 };
10251
10252 bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
10253 bgp_type = tvb_get_guint8(tvb, BGP_MARKER_SIZE + 2);
10254 typ = val_to_str(bgp_type, bgptypevals, "Unknown message type (0x%02x)");
10255
10256 if (first)
10257 col_add_str(pinfo->cinfo, COL_INFO, typ);
10258 else
10259 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", typ);
10260
10261 if (tree) {
10262 proto_item *ti;
10263 ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, ENC_NA);
10264 proto_item_append_text(ti, " - %s", typ);
10265
10266 /* add a different tree for each message type */
10267 switch (bgp_type) {
10268 case BGP_OPEN:
10269 bgp_tree = proto_item_add_subtree(ti, ett_bgp_open);
10270 break;
10271 case BGP_UPDATE:
10272 bgp_tree = proto_item_add_subtree(ti, ett_bgp_update);
10273 break;
10274 case BGP_NOTIFICATION:
10275 bgp_tree = proto_item_add_subtree(ti, ett_bgp_notification);
10276 break;
10277 case BGP_KEEPALIVE:
10278 bgp_tree = proto_item_add_subtree(ti, ett_bgp);
10279 break;
10280 case BGP_ROUTE_REFRESH_CISCO:
10281 case BGP_ROUTE_REFRESH:
10282 bgp_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh);
10283 break;
10284 case BGP_CAPABILITY:
10285 bgp_tree = proto_item_add_subtree(ti, ett_bgp_capability);
10286 break;
10287 default:
10288 bgp_tree = proto_item_add_subtree(ti, ett_bgp);
10289 break;
10290 }
10291
10292 ti_marker = proto_tree_add_item(bgp_tree, hf_bgp_marker, tvb, 0,
10293 BGP_MARKER_SIZE, ENC_NA);
10294 if (tvb_memeql(tvb, 0, valid_marker, BGP_MARKER_SIZE) != 0) {
10295 expert_add_info(pinfo, ti_marker, &ei_bgp_marker_invalid);
10296 }
10297
10298 ti_len = proto_tree_add_item(bgp_tree, hf_bgp_length, tvb, 16, 2, ENC_BIG_ENDIAN);
10299 }
10300
10301 if (bgp_len < BGP_HEADER_SIZE || bgp_len > BGP_MAX_PACKET_SIZE) {
10302 expert_add_info_format(pinfo, ti_len, &ei_bgp_length_invalid, "Length is invalid %u", bgp_len);
10303 return;
10304 }
10305
10306 proto_tree_add_item(bgp_tree, hf_bgp_type, tvb, 16 + 2, 1, ENC_BIG_ENDIAN);
10307
10308 switch (bgp_type) {
10309 case BGP_OPEN:
10310 dissect_bgp_open(tvb, bgp_tree, pinfo);
10311 break;
10312 case BGP_UPDATE:
10313 dissect_bgp_update(tvb, bgp_tree, pinfo);
10314 break;
10315 case BGP_NOTIFICATION:
10316 dissect_bgp_notification(tvb, bgp_tree, pinfo);
10317 break;
10318 case BGP_KEEPALIVE:
10319 /* no data in KEEPALIVE messages */
10320 break;
10321 case BGP_ROUTE_REFRESH_CISCO:
10322 case BGP_ROUTE_REFRESH:
10323 dissect_bgp_route_refresh(tvb, bgp_tree, pinfo);
10324 break;
10325 case BGP_CAPABILITY:
10326 dissect_bgp_capability(tvb, bgp_tree, pinfo);
10327 break;
10328 default:
10329 break;
10330 }
10331 }
10332
10333 /*
10334 * Dissect a BGP packet.
10335 */
10336 static int
dissect_bgp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)10337 dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
10338 {
10339 volatile int offset = 0; /* offset into the tvbuff */
10340 gint reported_length_remaining;
10341 guint8 bgp_marker[BGP_MARKER_SIZE]; /* Marker (should be all ones */
10342 static guchar marker[] = { /* BGP message marker */
10343 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
10344 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
10345 };
10346 proto_item *ti; /* tree item */
10347 proto_tree *bgp_tree; /* BGP packet tree */
10348 guint16 bgp_len; /* Message length */
10349 int offset_before;
10350 guint length_remaining;
10351 guint length;
10352 volatile gboolean first = TRUE; /* TRUE for the first BGP message in packet */
10353 tvbuff_t *volatile next_tvb;
10354
10355 col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP");
10356 col_clear(pinfo->cinfo, COL_INFO);
10357
10358 /*
10359 * Scan through the TCP payload looking for a BGP marker.
10360 */
10361 while ((reported_length_remaining = tvb_reported_length_remaining(tvb, offset))
10362 > 0) {
10363 /*
10364 * "reported_length_remaining" is the number of bytes of TCP payload
10365 * remaining. If it's more than the length of a BGP marker,
10366 * we check only the number of bytes in a BGP marker.
10367 */
10368 if (reported_length_remaining > BGP_MARKER_SIZE)
10369 reported_length_remaining = BGP_MARKER_SIZE;
10370
10371 /*
10372 * OK, is there a BGP marker starting at the specified offset -
10373 * or, at least, the beginning of a BGP marker running to the end
10374 * of the TCP payload?
10375 *
10376 * This will throw an exception if the frame is short; that's what
10377 * we want.
10378 */
10379 tvb_memcpy(tvb, bgp_marker, offset, reported_length_remaining);
10380 if (memcmp(bgp_marker, marker, reported_length_remaining) == 0) {
10381 /*
10382 * Yes - stop scanning and start processing BGP packets.
10383 */
10384 break;
10385 }
10386
10387 /*
10388 * No - keep scanning through the tvbuff to try to find a marker.
10389 */
10390 offset++;
10391 }
10392
10393 /*
10394 * If we skipped any bytes, mark it as a BGP continuation.
10395 */
10396 if (offset > 0) {
10397 ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, ENC_NA);
10398 bgp_tree = proto_item_add_subtree(ti, ett_bgp);
10399
10400 proto_tree_add_item(bgp_tree, hf_bgp_continuation, tvb, 0, offset, ENC_NA);
10401 }
10402
10403 /*
10404 * Now process the BGP packets in the TCP payload.
10405 *
10406 * XXX - perhaps "tcp_dissect_pdus()" should take a starting
10407 * offset, in which case we can replace the loop below with
10408 * a call to "tcp_dissect_pdus()".
10409 */
10410 while (tvb_reported_length_remaining(tvb, offset) > 0) {
10411 /*
10412 * This will throw an exception if we don't have any data left.
10413 * That's what we want. (See "tcp_dissect_pdus()", which is
10414 * similar.)
10415 */
10416 length_remaining = tvb_ensure_captured_length_remaining(tvb, offset);
10417
10418 /*
10419 * Can we do reassembly?
10420 */
10421 if (bgp_desegment && pinfo->can_desegment) {
10422 /*
10423 * Yes - would a BGP header starting at this offset be split
10424 * across segment boundaries?
10425 */
10426 if (length_remaining < BGP_HEADER_SIZE) {
10427 /*
10428 * Yes. Tell the TCP dissector where the data for this message
10429 * starts in the data it handed us and that we need "some more
10430 * data." Don't tell it exactly how many bytes we need because
10431 * if/when we ask for even more (after the header) that will
10432 * break reassembly.
10433 */
10434 pinfo->desegment_offset = offset;
10435 pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
10436 return tvb_captured_length(tvb);
10437 }
10438 }
10439
10440 /*
10441 * Get the length and type from the BGP header.
10442 */
10443 bgp_len = tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
10444 if (bgp_len < BGP_HEADER_SIZE) {
10445 /*
10446 * The BGP length doesn't include the BGP header; report that
10447 * as an error.
10448 */
10449 show_reported_bounds_error(tvb, pinfo, tree);
10450 return tvb_captured_length(tvb);
10451 }
10452
10453 /*
10454 * Can we do reassembly?
10455 */
10456 if (bgp_desegment && pinfo->can_desegment) {
10457 /*
10458 * Yes - is the PDU split across segment boundaries?
10459 */
10460 if (length_remaining < bgp_len) {
10461 /*
10462 * Yes. Tell the TCP dissector where the data for this
10463 * message starts in the data it handed us, and how many
10464 * more bytes we need, and return.
10465 */
10466 pinfo->desegment_offset = offset;
10467 pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
10468 return tvb_captured_length(tvb);
10469 }
10470 }
10471
10472 /*
10473 * Construct a tvbuff containing the amount of the payload we have
10474 * available. Make its reported length the amount of data in the PDU.
10475 *
10476 * XXX - if reassembly isn't enabled. the subdissector will throw a
10477 * BoundsError exception, rather than a ReportedBoundsError exception.
10478 * We really want a tvbuff where the length is "length", the reported
10479 * length is "plen", and the "if the snapshot length were infinite"
10480 * length is the minimum of the reported length of the tvbuff handed
10481 * to us and "plen", with a new type of exception thrown if the offset
10482 * is within the reported length but beyond that third length, with
10483 * that exception getting the "Unreassembled Packet" error.
10484 */
10485 length = length_remaining;
10486 if (length > bgp_len)
10487 length = bgp_len;
10488 next_tvb = tvb_new_subset_length_caplen(tvb, offset, length, bgp_len);
10489
10490 /*
10491 * Dissect the PDU.
10492 *
10493 * If it gets an error that means there's no point in
10494 * dissecting any more PDUs, rethrow the exception in
10495 * question.
10496 *
10497 * If it gets any other error, report it and continue, as that
10498 * means that PDU got an error, but that doesn't mean we should
10499 * stop dissecting PDUs within this frame or chunk of reassembled
10500 * data.
10501 */
10502 TRY {
10503 dissect_bgp_pdu(next_tvb, pinfo, tree, first);
10504 }
10505 CATCH_NONFATAL_ERRORS {
10506 show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
10507 }
10508 ENDTRY;
10509
10510 first = FALSE;
10511
10512 /*
10513 * Step to the next PDU.
10514 * Make sure we don't overflow.
10515 */
10516 offset_before = offset;
10517 offset += bgp_len;
10518 if (offset <= offset_before)
10519 break;
10520 }
10521 return tvb_captured_length(tvb);
10522 }
10523
10524 /*
10525 * Register ourselves.
10526 */
10527 void
proto_register_bgp(void)10528 proto_register_bgp(void)
10529 {
10530
10531 static hf_register_info hf[] = {
10532 /* BGP Header */
10533 { &hf_bgp_marker,
10534 { "Marker", "bgp.marker", FT_BYTES, BASE_NONE,
10535 NULL, 0x0, "Must be set to all ones (16 Bytes)", HFILL }},
10536 { &hf_bgp_length,
10537 { "Length", "bgp.length", FT_UINT16, BASE_DEC,
10538 NULL, 0x0, "The total length of the message, including the header in octets", HFILL }},
10539 { &hf_bgp_prefix_length,
10540 { "Prefix Length", "bgp.prefix_length", FT_UINT8, BASE_DEC,
10541 NULL, 0x0, NULL, HFILL }},
10542 { &hf_bgp_rd,
10543 { "Route Distinguisher", "bgp.rd", FT_STRING, BASE_NONE,
10544 NULL, 0x0, NULL, HFILL }},
10545 { &hf_bgp_continuation,
10546 { "Continuation", "bgp.continuation", FT_NONE, BASE_NONE,
10547 NULL, 0x0, NULL, HFILL }},
10548 { &hf_bgp_originating_as,
10549 { "Originating AS", "bgp.originating_as", FT_UINT32, BASE_DEC,
10550 NULL, 0x0, NULL, HFILL }},
10551 { &hf_bgp_community_prefix,
10552 { "Community Prefix", "bgp.community_prefix", FT_STRING, BASE_NONE,
10553 NULL, 0x0, NULL, HFILL }},
10554 { &hf_bgp_endpoint_address,
10555 { "Endpoint Address", "bgp.endpoint_address", FT_IPv4, BASE_NONE,
10556 NULL, 0x0, NULL, HFILL }},
10557 { &hf_bgp_endpoint_address_ipv6,
10558 { "Endpoint Address", "bgp.endpoint_address_ipv6", FT_IPv6, BASE_NONE,
10559 NULL, 0x0, NULL, HFILL }},
10560 { &hf_bgp_label_stack,
10561 { "Label Stack", "bgp.label_stack", FT_STRING, BASE_NONE,
10562 NULL, 0x0, NULL, HFILL }},
10563 { &hf_bgp_vplsad_length,
10564 { "Length", "bgp.vplsad.length", FT_UINT16, BASE_DEC,
10565 NULL, 0x0, NULL, HFILL }},
10566 { &hf_bgp_vplsad_rd,
10567 { "RD", "bgp.vplsad.rd", FT_STRING, BASE_NONE,
10568 NULL, 0x0, NULL, HFILL }},
10569 { &hf_bgp_bgpad_pe_addr,
10570 { "PE Addr", "bgp.ad.pe_addr", FT_IPv4, BASE_NONE,
10571 NULL, 0x0, NULL, HFILL }},
10572 { &hf_bgp_vplsbgp_ce_id,
10573 { "CE-ID", "bgp.vplsbgp.ce_id", FT_UINT16, BASE_DEC,
10574 NULL, 0x0, NULL, HFILL }},
10575 { &hf_bgp_vplsbgp_labelblock_offset,
10576 { "Label Block Offset", "bgp.vplsbgp.labelblock.offset", FT_UINT16, BASE_DEC,
10577 NULL, 0x0, NULL, HFILL }},
10578 { &hf_bgp_vplsbgp_labelblock_size,
10579 { "Label Block Size", "bgp.vplsbgp.labelblock.size", FT_UINT16, BASE_DEC,
10580 NULL, 0x0, NULL, HFILL }},
10581 { &hf_bgp_vplsbgp_labelblock_base,
10582 { "Label Block Base", "bgp.vplsbgp.labelblock.base", FT_STRING, BASE_NONE,
10583 NULL, 0x0, NULL, HFILL }},
10584 { &hf_bgp_wildcard_route_target,
10585 { "Wildcard route target", "bgp.wildcard_route_target", FT_STRING, BASE_NONE,
10586 NULL, 0x0, NULL, HFILL }},
10587 { &hf_bgp_type,
10588 { "Type", "bgp.type", FT_UINT8, BASE_DEC,
10589 VALS(bgptypevals), 0x0, "BGP message type", HFILL }},
10590 /* Open Message */
10591 { &hf_bgp_open_version,
10592 { "Version", "bgp.open.version", FT_UINT8, BASE_DEC,
10593 NULL, 0x0, "The protocol version number", HFILL }},
10594 { &hf_bgp_open_myas,
10595 { "My AS", "bgp.open.myas", FT_UINT16, BASE_DEC,
10596 NULL, 0x0, "The Autonomous System number of the sender", HFILL }},
10597 { &hf_bgp_open_holdtime,
10598 { "Hold Time", "bgp.open.holdtime", FT_UINT16, BASE_DEC,
10599 NULL, 0x0, "The number of seconds the sender proposes for Hold Time", HFILL }},
10600 { &hf_bgp_open_identifier,
10601 { "BGP Identifier", "bgp.open.identifier", FT_IPv4, BASE_NONE,
10602 NULL, 0x0, "The BGP Identifier of the sender", HFILL }},
10603 { &hf_bgp_open_opt_len,
10604 { "Optional Parameters Length", "bgp.open.opt.len", FT_UINT8, BASE_DEC,
10605 NULL, 0x0, "The total length of the Optional Parameters field in octets", HFILL }},
10606 { &hf_bgp_open_opt_params,
10607 { "Optional Parameters", "bgp.open.opt", FT_NONE, BASE_NONE,
10608 NULL, 0x0, "List of optional parameters", HFILL }},
10609 { &hf_bgp_open_opt_param,
10610 { "Optional Parameter", "bgp.open.opt.param", FT_NONE, BASE_NONE,
10611 NULL, 0x0, NULL, HFILL }},
10612 { &hf_bgp_open_opt_param_type,
10613 { "Parameter Type", "bgp.open.opt.param.type", FT_UINT8, BASE_DEC,
10614 VALS(bgp_open_opt_vals), 0x0, "Unambiguously identifies individual parameters", HFILL }},
10615 { &hf_bgp_open_opt_param_len,
10616 { "Parameter Length", "bgp.open.opt.param.len", FT_UINT8, BASE_DEC,
10617 NULL, 0x0, "Length of the Parameter Value", HFILL }},
10618 { &hf_bgp_open_opt_param_auth,
10619 { "Authentication Data", "bgp.open.opt.param.auth", FT_BYTES, BASE_NONE,
10620 NULL, 0x0, "Deprecated", HFILL }},
10621 { &hf_bgp_open_opt_param_unknown,
10622 { "Unknown", "bgp.open.opt.param.unknown", FT_BYTES, BASE_NONE,
10623 NULL, 0x0, "Unknown Parameter", HFILL }},
10624 /* Notification error */
10625 { &hf_bgp_notify_major_error,
10626 { "Major error Code", "bgp.notify.major_error", FT_UINT8, BASE_DEC,
10627 VALS(bgpnotify_major), 0x0, NULL, HFILL }},
10628 { &hf_bgp_notify_minor_msg_hdr,
10629 { "Minor error Code (Message Header)", "bgp.notify.minor_error", FT_UINT8, BASE_DEC,
10630 VALS(bgpnotify_minor_msg_hdr), 0x0, NULL, HFILL }},
10631 { &hf_bgp_notify_minor_open_msg,
10632 { "Minor error Code (Open Message)", "bgp.notify.minor_error_open", FT_UINT8, BASE_DEC,
10633 VALS(bgpnotify_minor_open_msg), 0x0, NULL, HFILL }},
10634 { &hf_bgp_notify_minor_update_msg,
10635 { "Minor error Code (Update Message)", "bgp.notify.minor_error_update", FT_UINT8, BASE_DEC,
10636 VALS(bgpnotify_minor_update_msg), 0x0, NULL, HFILL }},
10637 { &hf_bgp_notify_minor_ht_expired,
10638 { "Minor error Code (Hold Timer Expired)", "bgp.notify.minor_error_expired", FT_UINT8, BASE_DEC,
10639 NULL, 0x0, NULL, HFILL }},
10640 { &hf_bgp_notify_minor_state_machine,
10641 { "Minor error Code (State Machine)", "bgp.notify.minor_error_state", FT_UINT8, BASE_DEC,
10642 VALS(bgpnotify_minor_state_machine), 0x0, NULL, HFILL }},
10643 { &hf_bgp_notify_minor_cease,
10644 { "Minor error Code (Cease)", "bgp.notify.minor_error_cease", FT_UINT8, BASE_DEC,
10645 VALS(bgpnotify_minor_cease), 0x0, NULL, HFILL }},
10646 { &hf_bgp_notify_minor_cap_msg,
10647 { "Minor error Code (Capability Message)", "bgp.notify.minor_error_capability", FT_UINT8, BASE_DEC,
10648 VALS(bgpnotify_minor_cap_msg), 0x0, NULL, HFILL }},
10649 { &hf_bgp_notify_minor_unknown,
10650 { "Minor error Code (Unknown)", "bgp.notify.minor_error_unknown", FT_UINT8, BASE_DEC,
10651 NULL, 0x0, NULL, HFILL }},
10652 { &hf_bgp_notify_data,
10653 { "Data", "bgp.notify.minor_data", FT_BYTES, BASE_NONE,
10654 NULL, 0x0, NULL, HFILL }},
10655 { &hf_bgp_notify_error_open_bad_peer_as,
10656 { "Bad Peer AS", "bgp.notify.error_open.bad_peer_as", FT_UINT32, BASE_DEC,
10657 NULL, 0x0, NULL, HFILL }},
10658 { &hf_bgp_notify_communication_length,
10659 { "BGP Shutdown Communication Length", "bgp.notify.communication_length", FT_UINT8, BASE_DEC,
10660 NULL, 0x0, NULL, HFILL }},
10661 { &hf_bgp_notify_communication,
10662 { "Shutdown Communication", "bgp.notify.communication", FT_STRING, STR_UNICODE,
10663 NULL, 0x0, NULL, HFILL }},
10664
10665 /* Route Refresh */
10666 { &hf_bgp_route_refresh_afi,
10667 { "Address family identifier (AFI)", "bgp.route_refresh.afi", FT_UINT16, BASE_DEC,
10668 VALS(afn_vals), 0x0, NULL, HFILL }},
10669 { &hf_bgp_route_refresh_subtype,
10670 { "Subtype", "bgp.route_refresh.subtype", FT_UINT8, BASE_DEC,
10671 VALS(route_refresh_subtype_vals), 0x0, NULL, HFILL }},
10672 { &hf_bgp_route_refresh_safi,
10673 { "Subsequent address family identifier (SAFI)", "bgp.route_refresh.safi", FT_UINT8, BASE_DEC,
10674 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10675 { &hf_bgp_route_refresh_orf,
10676 { "ORF information", "bgp.route_refresh.orf", FT_NONE, BASE_NONE,
10677 NULL, 0x0, NULL, HFILL }},
10678 { &hf_bgp_route_refresh_orf_flag,
10679 { "ORF flag", "bgp.route_refresh.orf.flag", FT_UINT8, BASE_DEC,
10680 VALS(orf_when_vals), 0x0, NULL, HFILL }},
10681 { &hf_bgp_route_refresh_orf_type,
10682 { "ORF type", "bgp.route_refresh.orf.type", FT_UINT8, BASE_DEC,
10683 VALS(orf_type_vals), 0x0, NULL, HFILL }},
10684 { &hf_bgp_route_refresh_orf_length,
10685 { "ORF length", "bgp.route_refresh.orf.length", FT_UINT8, BASE_DEC,
10686 NULL, 0x0, NULL, HFILL }},
10687 { &hf_bgp_route_refresh_orf_entry_prefixlist,
10688 { "ORFEntry PrefixList", "bgp.route_refresh.orf.entry", FT_NONE, BASE_NONE,
10689 NULL, 0x0, NULL, HFILL }},
10690 { &hf_bgp_route_refresh_orf_entry_action,
10691 { "ORFEntry Action", "bgp.route_refresh.orf.entry.action", FT_UINT8, BASE_DEC,
10692 VALS(orf_entry_action_vals), BGP_ORF_ACTION, NULL, HFILL }},
10693 { &hf_bgp_route_refresh_orf_entry_match,
10694 { "ORFEntry Match", "bgp.route_refresh.orf.entry.match", FT_UINT8, BASE_DEC,
10695 VALS(orf_entry_match_vals), BGP_ORF_MATCH, NULL, HFILL }},
10696 { &hf_bgp_route_refresh_orf_entry_sequence,
10697 { "ORFEntry Sequence", "bgp.route_refresh.orf.entry.sequence", FT_UINT32, BASE_DEC,
10698 NULL, 0x0, NULL, HFILL }},
10699 { &hf_bgp_route_refresh_orf_entry_prefixmask_lower,
10700 { "ORFEntry PrefixMask length lower bound", "bgp.route_refresh.orf.entry.prefixmask_lower", FT_UINT8, BASE_DEC,
10701 NULL, 0x0, NULL, HFILL }},
10702 { &hf_bgp_route_refresh_orf_entry_prefixmask_upper,
10703 { "ORFEntry PrefixMask length upper bound", "bgp.route_refresh.orf.entry.prefixmask_upper", FT_UINT8, BASE_DEC,
10704 NULL, 0x0, NULL, HFILL }},
10705 { &hf_bgp_route_refresh_orf_entry_ip,
10706 { "ORFEntry IP address", "bgp.route_refresh.orf.entry.ip", FT_IPv4, BASE_NONE,
10707 NULL, 0x0, NULL, HFILL }},
10708
10709 /* Capability */
10710 { &hf_bgp_cap,
10711 { "Capability", "bgp.cap", FT_NONE, BASE_NONE,
10712 NULL, 0x0, NULL, HFILL }},
10713 { &hf_bgp_cap_type,
10714 { "Type", "bgp.cap.type", FT_UINT8, BASE_DEC,
10715 VALS(capability_vals), 0x0, NULL, HFILL }},
10716 { &hf_bgp_cap_length,
10717 { "Length", "bgp.cap.length", FT_UINT8, BASE_DEC,
10718 NULL, 0x0, NULL, HFILL }},
10719 { &hf_bgp_cap_action,
10720 { "Action", "bgp.cap.action", FT_UINT8, BASE_DEC,
10721 VALS(bgpcap_action), 0x0, NULL, HFILL }},
10722 { &hf_bgp_cap_unknown,
10723 { "Unknown", "bgp.cap.unknown", FT_BYTES, BASE_NONE,
10724 NULL, 0x0, NULL, HFILL }},
10725 { &hf_bgp_cap_reserved,
10726 { "Reserved", "bgp.cap.reserved", FT_BYTES, BASE_NONE,
10727 NULL, 0x0, "Must be Zero", HFILL }},
10728 { &hf_bgp_cap_mp_afi,
10729 { "AFI", "bgp.cap.mp.afi", FT_UINT16, BASE_DEC,
10730 VALS(afn_vals), 0x0, NULL, HFILL }},
10731 { &hf_bgp_cap_mp_safi,
10732 { "SAFI", "bgp.cap.mp.safi", FT_UINT8, BASE_DEC,
10733 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10734 { &hf_bgp_cap_enh_afi,
10735 { "AFI", "bgp.cap.enh.afi", FT_UINT16, BASE_DEC,
10736 VALS(afn_vals), 0x0, NULL, HFILL }},
10737 { &hf_bgp_cap_enh_safi,
10738 { "SAFI", "bgp.cap.enh.safi", FT_UINT16, BASE_DEC,
10739 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10740 { &hf_bgp_cap_enh_nhafi,
10741 { "Next hop AFI", "bgp.cap.enh.nhafi", FT_UINT16, BASE_DEC,
10742 VALS(afn_vals), 0x0, NULL, HFILL }},
10743 { &hf_bgp_cap_gr_timers,
10744 { "Restart Timers", "bgp.cap.gr.timers", FT_UINT16, BASE_HEX,
10745 NULL, 0x0, NULL, HFILL }},
10746 { &hf_bgp_cap_gr_timers_restart_flag,
10747 { "Restart state", "bgp.cap.gr.timers.restart_flag", FT_BOOLEAN, 16,
10748 TFS(&tfs_yes_no), 0x8000, NULL, HFILL }},
10749 { &hf_bgp_cap_gr_timers_notification_flag,
10750 { "Graceful notification", "bgp.cap.gr.timers.notification_flag", FT_BOOLEAN, 16,
10751 TFS(&tfs_yes_no), 0x4000, NULL, HFILL }},
10752 { &hf_bgp_cap_gr_timers_restart_time,
10753 { "Time", "bgp.cap.gr.timers.restart_time", FT_UINT16, BASE_DEC,
10754 NULL, 0x0FFF, "in us", HFILL }},
10755 { &hf_bgp_cap_gr_afi,
10756 { "AFI", "bgp.cap.gr.afi", FT_UINT16, BASE_DEC,
10757 VALS(afn_vals), 0x0, NULL, HFILL }},
10758 { &hf_bgp_cap_gr_safi,
10759 { "SAFI", "bgp.cap.gr.safi", FT_UINT8, BASE_DEC,
10760 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10761 { &hf_bgp_cap_gr_flag,
10762 { "Flag", "bgp.cap.gr.flag", FT_UINT8, BASE_HEX,
10763 NULL, 0x0, NULL, HFILL }},
10764 { &hf_bgp_cap_gr_flag_pfs,
10765 { "Preserve forwarding state", "bgp.cap.gr.flag.pfs", FT_BOOLEAN, 8,
10766 TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
10767 { &hf_bgp_cap_4as,
10768 { "AS Number", "bgp.cap.4as", FT_UINT32, BASE_DEC,
10769 NULL, 0x0, NULL, HFILL }},
10770 { &hf_bgp_cap_dc,
10771 { "Capability Dynamic", "bgp.cap.dc", FT_UINT8, BASE_DEC,
10772 VALS(capability_vals), 0x0, NULL, HFILL }},
10773 { &hf_bgp_cap_ap_afi,
10774 { "AFI", "bgp.cap.ap.afi", FT_UINT16, BASE_DEC,
10775 VALS(afn_vals), 0x0, NULL, HFILL }},
10776 { &hf_bgp_cap_ap_safi,
10777 { "SAFI", "bgp.cap.ap.safi", FT_UINT8, BASE_DEC,
10778 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10779 { &hf_bgp_cap_ap_sendreceive,
10780 { "Send/Receive", "bgp.cap.ap.sendreceive", FT_UINT8, BASE_DEC,
10781 VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
10782 { &hf_bgp_cap_orf_afi,
10783 { "AFI", "bgp.cap.orf.afi", FT_UINT16, BASE_DEC,
10784 VALS(afn_vals), 0x0, NULL, HFILL }},
10785 { &hf_bgp_cap_orf_safi,
10786 { "SAFI", "bgp.cap.orf.safi", FT_UINT8, BASE_DEC,
10787 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10788 { &hf_bgp_cap_orf_number,
10789 { "Number", "bgp.cap.orf.number", FT_UINT8, BASE_DEC,
10790 NULL, 0x0, NULL, HFILL }},
10791 { &hf_bgp_cap_orf_type,
10792 { "Type", "bgp.cap.orf.type", FT_UINT8, BASE_DEC,
10793 VALS(orf_type_vals), 0x0, NULL, HFILL }},
10794 { &hf_bgp_cap_orf_sendreceive,
10795 { "Send Receive", "bgp.cap.orf.sendreceive", FT_UINT8, BASE_DEC,
10796 VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
10797 { &hf_bgp_cap_fqdn_hostname_len,
10798 { "Hostname Length", "bgp.cap.orf.fqdn.hostname.len", FT_UINT8, BASE_DEC,
10799 NULL, 0x0, NULL, HFILL }},
10800 { &hf_bgp_cap_fqdn_hostname,
10801 { "Hostname", "bgp.cap.orf.fqdn.hostname", FT_STRING, BASE_NONE,
10802 NULL, 0x0, NULL, HFILL }},
10803 { &hf_bgp_cap_fqdn_domain_name_len,
10804 { "Domain Name Length", "bgp.cap.orf.fqdn.domain_name.len", FT_UINT8, BASE_DEC,
10805 NULL, 0x0, NULL, HFILL }},
10806 { &hf_bgp_cap_fqdn_domain_name,
10807 { "Domain Name", "bgp.cap.orf.fqdn.domain_name", FT_STRING, BASE_NONE,
10808 NULL, 0x0, NULL, HFILL }},
10809 { &hf_bgp_cap_multisession_flags,
10810 { "Flag", "bgp.cap.multisession.flags", FT_UINT8, BASE_HEX,
10811 NULL, 0x0, NULL, HFILL }},
10812 { &hf_bgp_cap_bgpsec_flags,
10813 { "Flag", "bgp.cap.bgpsec.flags", FT_UINT8, BASE_HEX,
10814 NULL, 0x0, NULL, HFILL }},
10815 { &hf_bgp_cap_bgpsec_version,
10816 { "Version", "bgp.cap.bgpsec.version", FT_UINT8, BASE_DEC,
10817 NULL, 0xF0, NULL, HFILL }},
10818 { &hf_bgp_cap_bgpsec_sendreceive,
10819 { "Send/Receive", "bgp.cap.bgpsec.sendreceive", FT_UINT8, BASE_DEC,
10820 VALS(bgpsec_send_receive_vals), 0x8, NULL, HFILL }},
10821 { &hf_bgp_cap_bgpsec_reserved,
10822 { "Reserved", "bgp.cap.bgpsec.reserved", FT_UINT8, BASE_HEX,
10823 NULL, 0x7, "Must be Zero", HFILL }},
10824 { &hf_bgp_cap_bgpsec_afi,
10825 { "AFI", "bgp.cap.bgpsec.afi", FT_UINT16, BASE_DEC,
10826 VALS(afn_vals), 0x0, NULL, HFILL }},
10827 /* BGP update */
10828
10829 { &hf_bgp_update_withdrawn_routes_length,
10830 { "Withdrawn Routes Length", "bgp.update.withdrawn_routes.length", FT_UINT16, BASE_DEC,
10831 NULL, 0x0, NULL, HFILL}},
10832 { &hf_bgp_update_withdrawn_routes,
10833 { "Withdrawn Routes", "bgp.update.withdrawn_routes", FT_NONE, BASE_NONE,
10834 NULL, 0x0, NULL, HFILL}},
10835
10836 { &hf_bgp_update_path_attribute_aggregator_as,
10837 { "Aggregator AS", "bgp.update.path_attribute.aggregator_as", FT_UINT32, BASE_DEC,
10838 NULL, 0x0, NULL, HFILL}},
10839 /* BGP update path attributes */
10840 { &hf_bgp_update_path_attributes,
10841 { "Path attributes", "bgp.update.path_attributes", FT_NONE, BASE_NONE,
10842 NULL, 0x0, NULL, HFILL}},
10843 { &hf_bgp_update_path_attributes_unknown,
10844 { "Unknown Path attributes", "bgp.update.path_attributes.unknown", FT_NONE, BASE_NONE,
10845 NULL, 0x0, NULL, HFILL}},
10846 { &hf_bgp_update_total_path_attribute_length,
10847 { "Total Path Attribute Length", "bgp.update.path_attributes.length", FT_UINT16, BASE_DEC,
10848 NULL, 0x0, NULL, HFILL}},
10849 { &hf_bgp_update_path_attribute_aggregator_origin,
10850 { "Aggregator origin", "bgp.update.path_attribute.aggregator_origin", FT_IPv4, BASE_NONE,
10851 NULL, 0x0, NULL, HFILL}},
10852 { &hf_bgp_update_path_attribute_as_path_segment,
10853 { "AS Path segment", "bgp.update.path_attribute.as_path_segment", FT_NONE, BASE_NONE,
10854 NULL, 0x0, NULL, HFILL}},
10855 { &hf_bgp_update_path_attribute_as_path_segment_type,
10856 { "Segment type", "bgp.update.path_attribute.as_path_segment.type", FT_UINT8, BASE_DEC,
10857 VALS(as_segment_type), 0x0, NULL, HFILL}},
10858 { &hf_bgp_update_path_attribute_as_path_segment_length,
10859 { "Segment length (number of ASN)", "bgp.update.path_attribute.as_path_segment.length", FT_UINT8, BASE_DEC,
10860 NULL, 0x0, NULL, HFILL}},
10861 { &hf_bgp_update_path_attribute_as_path_segment_as2,
10862 { "AS2", "bgp.update.path_attribute.as_path_segment.as2", FT_UINT16, BASE_DEC,
10863 NULL, 0x0, NULL, HFILL}},
10864 { &hf_bgp_update_path_attribute_as_path_segment_as4,
10865 { "AS4", "bgp.update.path_attribute.as_path_segment.as4", FT_UINT32, BASE_DEC,
10866 NULL, 0x0, NULL, HFILL}},
10867 { &hf_bgp_update_path_attribute_communities,
10868 { "Communities", "bgp.update.path_attribute.communities", FT_NONE, BASE_NONE,
10869 NULL, 0x0, NULL, HFILL}},
10870 { &hf_bgp_update_path_attribute_community,
10871 { "Community", "bgp.update.path_attribute.community", FT_NONE, BASE_NONE,
10872 NULL, 0x0, NULL, HFILL}},
10873 { &hf_bgp_update_path_attribute_community_well_known,
10874 { "Community Well-known", "bgp.update.path_attribute.community_wellknown", FT_UINT32, BASE_HEX,
10875 VALS(community_vals), 0x0, "Reserved", HFILL}},
10876 { &hf_bgp_update_path_attribute_community_as,
10877 { "Community AS", "bgp.update.path_attribute.community_as", FT_UINT16, BASE_DEC,
10878 NULL, 0x0, NULL, HFILL}},
10879 { &hf_bgp_update_path_attribute_community_value,
10880 { "Community value", "bgp.update.path_attribute.community_value", FT_UINT16, BASE_DEC,
10881 NULL, 0x0, NULL, HFILL}},
10882 { &hf_bgp_update_path_attribute_local_pref,
10883 { "Local preference", "bgp.update.path_attribute.local_pref", FT_UINT32, BASE_DEC,
10884 NULL, 0x0, NULL, HFILL}},
10885 { &hf_bgp_update_path_attribute_attrset_origin_as,
10886 { "Origin AS", "bgp.update.path_attribute.attr_set.origin_as", FT_UINT32, BASE_DEC,
10887 NULL, 0x0, NULL, HFILL}},
10888 { &hf_bgp_update_path_attribute_multi_exit_disc,
10889 { "Multiple exit discriminator", "bgp.update.path_attribute.multi_exit_disc", FT_UINT32, BASE_DEC,
10890 NULL, 0x0, NULL, HFILL}},
10891 { &hf_bgp_update_path_attribute_next_hop,
10892 { "Next hop", "bgp.update.path_attribute.next_hop", FT_IPv4, BASE_NONE,
10893 NULL, 0x0, NULL, HFILL}},
10894 { &hf_bgp_update_path_attribute_origin,
10895 { "Origin", "bgp.update.path_attribute.origin", FT_UINT8, BASE_DEC,
10896 VALS(bgpattr_origin), 0x0, NULL, HFILL}},
10897 { &hf_bgp_update_path_attribute,
10898 { "Path Attribute", "bgp.update.path_attribute", FT_NONE, BASE_NONE,
10899 NULL, 0x0, NULL, HFILL}},
10900 { &hf_bgp_update_path_attribute_flags,
10901 { "Flags", "bgp.update.path_attribute.flags", FT_UINT8, BASE_HEX,
10902 NULL, 0x0, NULL, HFILL}},
10903 { &hf_bgp_update_path_attribute_flags_optional,
10904 { "Optional", "bgp.update.path_attribute.flags.optional", FT_BOOLEAN, 8,
10905 TFS(&tfs_set_notset), BGP_ATTR_FLAG_OPTIONAL, NULL, HFILL}},
10906 { &hf_bgp_update_path_attribute_flags_transitive,
10907 { "Transitive", "bgp.update.path_attribute.flags.transitive", FT_BOOLEAN, 8,
10908 TFS(&tfs_set_notset), BGP_ATTR_FLAG_TRANSITIVE, NULL, HFILL}},
10909 { &hf_bgp_update_path_attribute_flags_partial,
10910 { "Partial", "bgp.update.path_attribute.flags.partial", FT_BOOLEAN, 8,
10911 TFS(&tfs_set_notset), BGP_ATTR_FLAG_PARTIAL, NULL, HFILL}},
10912 { &hf_bgp_update_path_attribute_flags_extended_length,
10913 { "Extended-Length", "bgp.update.path_attribute.flags.extended_length", FT_BOOLEAN, 8,
10914 TFS(&tfs_set_notset), BGP_ATTR_FLAG_EXTENDED_LENGTH, NULL, HFILL}},
10915 { &hf_bgp_update_path_attribute_flags_unused,
10916 { "Unused", "bgp.update.path_attribute.flags.unused", FT_UINT8, BASE_HEX,
10917 NULL, BGP_ATTR_FLAG_UNUSED, NULL, HFILL}},
10918 { &hf_bgp_update_path_attribute_type_code,
10919 { "Type Code", "bgp.update.path_attribute.type_code", FT_UINT8, BASE_DEC,
10920 VALS(bgpattr_type), 0x0, NULL, HFILL}},
10921 { &hf_bgp_update_path_attribute_length,
10922 { "Length", "bgp.update.path_attribute.length", FT_UINT16, BASE_DEC,
10923 NULL, 0x0, NULL, HFILL}},
10924 { &hf_bgp_update_path_attribute_link_state,
10925 { "Link State", "bgp.update.path_attribute.link_state", FT_NONE, BASE_NONE,
10926 NULL, 0x0, NULL, HFILL}},
10927
10928 /* BGPsec Path Attributes, RFC8205*/
10929 { &hf_bgp_update_path_attribute_bgpsec_sp_len,
10930 { "Length", "bgp.update.path_attribute.bgpsec.sp.length", FT_UINT16, BASE_DEC,
10931 NULL, 0x0, NULL, HFILL}},
10932 { &hf_bgp_update_path_attribute_bgpsec_sps_pcount,
10933 { "pCount", "bgp.update.path_attribute.bgpsec.sps.pcount", FT_UINT8, BASE_DEC,
10934 NULL, 0x0, NULL, HFILL}},
10935 { &hf_bgp_update_path_attribute_bgpsec_sps_flags,
10936 { "Flags", "bgp.update.path_attribute.bgpsec.sps.flags", FT_UINT8, BASE_DEC,
10937 NULL, 0x0, NULL, HFILL}},
10938 { &hf_bgp_update_path_attribute_bgpsec_sps_as,
10939 { "AS Number", "bgp.update.path_attribute.bgpsec.sps.as", FT_UINT32, BASE_DEC,
10940 NULL, 0x0, NULL, HFILL}},
10941 { &hf_bgp_update_path_attribute_bgpsec_sb_len,
10942 { "Length", "bgp.update.path_attribute.bgpsec.sb.length", FT_UINT16, BASE_DEC,
10943 NULL, 0x0, NULL, HFILL}},
10944 { &hf_bgp_update_path_attribute_bgpsec_algo_id,
10945 { "Algo ID", "bgp.update.path_attribute.bgpsec.sb.algo_id", FT_UINT8, BASE_DEC,
10946 NULL, 0x0, NULL, HFILL}},
10947 { &hf_bgp_update_path_attribute_bgpsec_ski,
10948 { "SKI", "bgp.update.path_attribute.bgpsec.ss.ski", FT_BYTES, SEP_SPACE,
10949 NULL, 0x0, NULL, HFILL}},
10950 { &hf_bgp_update_path_attribute_bgpsec_sig_len,
10951 { "Length", "bgp.update.path_attribute.bgpsec.ss.length", FT_UINT16, BASE_DEC,
10952 NULL, 0x0, NULL, HFILL}},
10953 { &hf_bgp_update_path_attribute_bgpsec_sig,
10954 { "Signature", "bgp.update.path_attribute.bgpsec.ss.sig", FT_BYTES, SEP_SPACE,
10955 NULL, 0x0, NULL, HFILL}},
10956
10957 { &hf_bgp_update_path_attribute_mp_reach_nlri_address_family,
10958 { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_reach_nlri.afi", FT_UINT16, BASE_DEC,
10959 VALS(afn_vals), 0x0, NULL, HFILL }},
10960 { &hf_bgp_update_path_attribute_mp_reach_nlri_safi,
10961 { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_reach_nlri.safi", FT_UINT8, BASE_DEC,
10962 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10963 { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop,
10964 { "Next hop", "bgp.update.path_attribute.mp_reach_nlri.next_hop", FT_BYTES, BASE_NO_DISPLAY_VALUE,
10965 NULL, 0x0, NULL, HFILL }},
10966 { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd,
10967 { "Route Distinguisher", "bgp.update.path_attribute.mp_reach_nlri.next_hop.rd", FT_STRING, BASE_NONE,
10968 NULL, 0x0, "RD is always zero in the Next Hop", HFILL }},
10969 { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4,
10970 { "IPv4 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv4", FT_IPv4, BASE_NONE,
10971 NULL, 0x0, NULL, HFILL}},
10972 { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6,
10973 { "IPv6 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6", FT_IPv6, BASE_NONE,
10974 NULL, 0x0, NULL, HFILL}},
10975 { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local,
10976 { "Link-local Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6.link_local", FT_IPv6, BASE_NONE,
10977 NULL, 0x0, NULL, HFILL}},
10978 { &hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa,
10979 { "Number of Subnetwork points of attachment (SNPA)", "bgp.update.path_attribute.mp_reach_nlri.nbr_snpa", FT_UINT8, BASE_DEC,
10980 NULL, 0x0, NULL, HFILL }},
10981 { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length,
10982 { "SNPA Length", "bgp.update.path_attribute.mp_reach_nlri.snpa_length", FT_UINT8, BASE_DEC,
10983 NULL, 0x0, NULL, HFILL }},
10984 { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa,
10985 { "SNPA", "bgp.update.path_attribute.mp_reach_nlri.snpa", FT_BYTES, BASE_NONE,
10986 NULL, 0x0, NULL, HFILL }},
10987 { &hf_bgp_update_path_attribute_mp_reach_nlri,
10988 { "Network Layer Reachability Information (NLRI)", "bgp.update.path_attribute.mp_reach_nlri", FT_NONE, BASE_NONE,
10989 NULL, 0x0, NULL, HFILL}},
10990
10991 { &hf_bgp_update_path_attribute_mp_unreach_nlri_address_family,
10992 { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_unreach_nlri.afi", FT_UINT16, BASE_DEC,
10993 VALS(afn_vals), 0x0, NULL, HFILL }},
10994 { &hf_bgp_update_path_attribute_mp_unreach_nlri_safi,
10995 { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_unreach_nlri.safi", FT_UINT8, BASE_DEC,
10996 VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
10997 { &hf_bgp_update_path_attribute_mp_unreach_nlri,
10998 { "Withdrawn Routes", "bgp.update.path_attribute.mp_unreach_nlri", FT_NONE, BASE_NONE,
10999 NULL, 0x0, NULL, HFILL}},
11000
11001 { &hf_bgp_pmsi_tunnel_flags,
11002 { "Flags", "bgp.update.path_attribute.pmsi.tunnel.flags", FT_UINT8, BASE_DEC,
11003 NULL, 0x0, NULL, HFILL}},
11004 { &hf_bgp_pmsi_tunnel_type,
11005 { "Tunnel Type", "bgp.update.path_attribute.pmsi.tunnel.type", FT_UINT8, BASE_DEC,
11006 VALS(pmsi_tunnel_type), 0x0, NULL, HFILL}},
11007 { &hf_bgp_pmsi_tunnel_id,
11008 { "Tunnel ID", "bgp.update.path_attribute.pmsi.tunnel.id", FT_NONE, BASE_NONE,
11009 NULL, 0x0, NULL, HFILL}},
11010 { &hf_bgp_pmsi_tunnel_not_present,
11011 { "Tunnel ID not present", "bgp.update.path_attribute.pmsi.tunnel_id.not_present", FT_NONE, BASE_NONE,
11012 NULL, 0x0, NULL, HFILL}},
11013 { &hf_bgp_update_mpls_label,
11014 { "MPLS Label Stack", "bgp.update.path_attribute.mpls_label", FT_NONE,
11015 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11016 { &hf_bgp_update_mpls_label_value_20bits,
11017 { "MPLS Label", "bgp.update.path_attribute.mpls_label_value_20bits", FT_UINT24,
11018 BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
11019 { &hf_bgp_update_mpls_label_value,
11020 { "MPLS Label", "bgp.update.path_attribute.mpls_label_value", FT_UINT24,
11021 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11022 { &hf_bgp_update_mpls_traffic_class,
11023 { "Traffic Class", "bgp.update.path_attribute.mpls_traffic_class", FT_UINT24,
11024 BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
11025 { &hf_bgp_update_mpls_bottom_stack,
11026 { "Bottom-of-Stack", "bgp.update.path_attribute.mpls_bottom_stack", FT_BOOLEAN,
11027 24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
11028 { &hf_bgp_pmsi_tunnel_rsvp_p2mp_id, /* RFC4875 section 19 */
11029 { "RSVP P2MP id", "bgp.update.path_attribute.pmsi.rsvp.id", FT_IPv4, BASE_NONE,
11030 NULL, 0x0, NULL, HFILL}},
11031 { &hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id,
11032 { "RSVP P2MP tunnel id", "bgp.update.path_attribute.pmsi.rsvp.tunnel_id", FT_UINT16, BASE_DEC,
11033 NULL, 0x0, NULL, HFILL}},
11034 { &hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4,
11035 { "RSVP P2MP extended tunnel id", "bgp.update.path_attribute.pmsi.rsvp.ext_tunnel_idv4", FT_IPv4, BASE_NONE,
11036 NULL, 0x0, NULL, HFILL}},
11037 { &hf_bgp_pmsi_tunnel_mldp_fec_el_type,
11038 { "mLDP P2MP FEC element type", "bgp.update.path_attribute.pmsi.mldp.fec.type", FT_UINT8, BASE_DEC,
11039 VALS(fec_types_vals), 0x0, NULL, HFILL}},
11040 { &hf_bgp_pmsi_tunnel_mldp_fec_el_afi,
11041 {"mLDP P2MP FEC element address family", "bgp.update.path_attribute.pmsi.mldp.fec.address_family", FT_UINT16, BASE_DEC,
11042 VALS(afn_vals), 0x0, NULL, HFILL}},
11043 { &hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len,
11044 {"mLDP P2MP FEC element address length", "bgp.update.path_attribute.pmsi.mldp.fec.address_length", FT_UINT8, BASE_DEC,
11045 NULL, 0x0, NULL, HFILL}},
11046 { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4,
11047 {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev4", FT_IPv4, BASE_NONE,
11048 NULL, 0x0, NULL, HFILL}},
11049 { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6,
11050 {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev6", FT_IPv6, BASE_NONE,
11051 NULL, 0x0, NULL, HFILL}},
11052 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len,
11053 {"mLDP P2MP FEC element opaque length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_length", FT_UINT16, BASE_DEC,
11054 NULL, 0x0, NULL, HFILL}},
11055 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
11056 {"mLDP P2MP FEC element opaque value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_type", FT_UINT8, BASE_DEC,
11057 VALS(pmsi_mldp_fec_opaque_value_type), 0x0, NULL, HFILL}},
11058 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len,
11059 {"mLDP P2MP FEC element opaque value length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_length", FT_UINT16, BASE_DEC,
11060 NULL, 0x0, NULL, HFILL}},
11061 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn,
11062 {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_rn", FT_UINT32, BASE_DEC,
11063 NULL, 0x0, NULL, HFILL}},
11064 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str,
11065 {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_str", FT_STRING, BASE_NONE,
11066 NULL, 0x0, NULL, HFILL}},
11067 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type,
11068 {"mLDP P2MP FEC element opaque extended value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_value_type", FT_UINT16, BASE_DEC,
11069 VALS(pmsi_mldp_fec_opa_extented_type), 0x0, NULL, HFILL}},
11070 { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len,
11071 {"mLDP P2MP FEC element opaque extended length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_length", FT_UINT16, BASE_DEC,
11072 NULL, 0x0, NULL, HFILL}},
11073 { &hf_bgp_pmsi_tunnel_pimsm_sender,
11074 {"PIM-SM Tree tunnel sender address", "bgp.update.path_attribute.pmsi.pimsm.sender_address", FT_IPv4, BASE_NONE,
11075 NULL, 0x0, NULL, HFILL}},
11076 { &hf_bgp_pmsi_tunnel_pimsm_pmc_group,
11077 {"PIM-SM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimsm.pmulticast_group", FT_IPv4, BASE_NONE,
11078 NULL, 0x0, NULL, HFILL}},
11079 { &hf_bgp_pmsi_tunnel_pimssm_root_node,
11080 {"PIM-SSM Tree tunnel Root Node", "bgp.update.path_attribute.pmsi.pimssm.root_node", FT_IPv4, BASE_NONE,
11081 NULL, 0x0, NULL, HFILL}},
11082 { &hf_bgp_pmsi_tunnel_pimssm_pmc_group,
11083 {"PIM-SSM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimssm.pmulticast_group", FT_IPv4, BASE_NONE,
11084 NULL, 0x0, NULL, HFILL}},
11085 { &hf_bgp_pmsi_tunnel_pimbidir_sender,
11086 {"BIDIR-PIM Tree Tunnel sender address", "bgp.update.path_attribute.pmsi.bidir_pim_tree.sender", FT_IPv4, BASE_NONE,
11087 NULL, 0x0, NULL, HFILL}},
11088 { &hf_bgp_pmsi_tunnel_pimbidir_pmc_group,
11089 {"BIDIR-PIM Tree Tunnel P-multicast group", "bgp.update.path_attribute.pmsi.bidir_pim_tree.pmulticast_group", FT_IPv4, BASE_NONE,
11090 NULL, 0x0, NULL, HFILL}},
11091 { &hf_bgp_pmsi_tunnel_ingress_rep_addr,
11092 {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip", FT_IPv4, BASE_NONE,
11093 NULL, 0x0, NULL, HFILL}},
11094
11095 /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
11096 { &hf_bgp_update_path_attribute_d_path,
11097 { "Domain Path Attribute", "bgp.update.path_attribute.dpath", FT_STRING, BASE_NONE,
11098 NULL, 0x0, NULL, HFILL}},
11099 { &hf_bgp_d_path_length,
11100 {"Domain Path Attribute length", "bgp.update.attribute.dpath.length", FT_UINT16, BASE_DEC,
11101 NULL, 0x0, NULL, HFILL}},
11102 { &hf_bgp_d_path_ga,
11103 { "Global Administrator", "bgp.update.attribute.dpath.ga", FT_UINT32, BASE_DEC,
11104 NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
11105 { &hf_bgp_d_path_la,
11106 { "Local Administrator", "bgp.update.attribute.dpath.la", FT_UINT16, BASE_DEC,
11107 NULL, 0x0, "A two-octet operator-defined value", HFILL }},
11108 { &hf_bgp_d_path_isf_safi,
11109 { "Inter-Subnet Forwarding SAFI type", "bgp.update.attribute.dpath.isf.safi", FT_UINT8, BASE_DEC,
11110 NULL, 0x0, NULL, HFILL }},
11111
11112 /* RFC7311 */
11113 { &hf_bgp_update_path_attribute_aigp,
11114 { "AIGP Attribute", "bgp.update.path_attribute.aigp", FT_NONE, BASE_NONE,
11115 NULL, 0x0, NULL, HFILL}},
11116 { &hf_bgp_aigp_type,
11117 {"AIGP attribute type", "bgp.update.attribute.aigp.type", FT_UINT8, BASE_DEC,
11118 VALS(aigp_tlv_type), 0x0, NULL, HFILL }},
11119 { &hf_bgp_aigp_tlv_length,
11120 {"AIGP TLV length", "bgp.update.attribute.aigp.length", FT_UINT16, BASE_DEC,
11121 NULL, 0x0, NULL, HFILL}},
11122 { &hf_bgp_aigp_accu_igp_metric,
11123 {"AIGP Accumulated IGP Metric", "bgp.update.attribute.aigp.accu_igp_metric", FT_UINT64, BASE_DEC,
11124 NULL, 0x0, NULL, HFILL}},
11125
11126 /* RFC8092 */
11127 { &hf_bgp_large_communities,
11128 { "Large Communities", "bgp.large_communities", FT_STRING, BASE_NONE,
11129 NULL, 0x0, NULL, HFILL }},
11130 { &hf_bgp_large_communities_ga,
11131 { "Global Administrator", "bgp.large_communities.ga", FT_UINT32, BASE_DEC,
11132 NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
11133 { &hf_bgp_large_communities_ldp1,
11134 { "Local Data Part 1", "bgp.large_communities.ldp1", FT_UINT32, BASE_DEC,
11135 NULL, 0x0, "A four-octet operator-defined value", HFILL }},
11136 { &hf_bgp_large_communities_ldp2,
11137 { "Local Data Part 2", "bgp.large_communities.ldp2", FT_UINT32, BASE_DEC,
11138 NULL, 0x0, "A four-octet operator-defined value", HFILL }},
11139
11140 /* RFC4456 */
11141 { &hf_bgp_update_path_attribute_originator_id,
11142 { "Originator identifier", "bgp.update.path_attribute.originator_id", FT_IPv4, BASE_NONE,
11143 NULL, 0x0, NULL, HFILL}},
11144 { &hf_bgp_update_path_attribute_cluster_list,
11145 { "Cluster List", "bgp.path_attribute.cluster_list", FT_NONE, BASE_NONE,
11146 NULL, 0x0, NULL, HFILL}},
11147 { &hf_bgp_update_path_attribute_cluster_id,
11148 { "Cluster ID", "bgp.path_attribute.cluster_id", FT_IPv4, BASE_NONE,
11149 NULL, 0x0, NULL, HFILL}},
11150
11151 /* RFC8669 */
11152 { &hf_bgp_prefix_sid_unknown,
11153 { "Unknown TLV", "bgp.prefix_sid.unknown", FT_NONE, BASE_NONE,
11154 NULL, 0x0, NULL, HFILL }},
11155 { &hf_bgp_prefix_sid_label_index,
11156 { "Label-Index", "bgp.prefix_sid.label_index", FT_NONE, BASE_NONE,
11157 NULL, 0x0, NULL, HFILL }},
11158 { &hf_bgp_prefix_sid_label_index_value,
11159 { "Label-Index Value", "bgp.prefix_sid.label_index.value", FT_UINT32, BASE_DEC,
11160 NULL, 0x0, "4-octet label index value", HFILL }},
11161 { &hf_bgp_prefix_sid_label_index_flags,
11162 { "Label-Index Flags", "bgp.prefix_sid.label_index.flags", FT_UINT16, BASE_HEX,
11163 NULL, 0x0, "2-octet flags, None is defined", HFILL }},
11164 { &hf_bgp_prefix_sid_originator_srgb_flags,
11165 { "Originator SRGB Flags", "bgp.prefix_sid.originator_srgb.flags", FT_UINT16, BASE_HEX,
11166 NULL, 0x0, "2-octet flags, None is defined", HFILL }},
11167 { &hf_bgp_prefix_sid_originator_srgb,
11168 { "Originator SRGB", "bgp.prefix_sid.originator_srgb", FT_NONE, BASE_NONE,
11169 NULL, 0x0, NULL, HFILL }},
11170 { &hf_bgp_prefix_sid_originator_srgb_blocks,
11171 { "SRGB Blocks", "bgp.prefix_sid.originator_srgb_blocks", FT_NONE, BASE_NONE,
11172 NULL, 0x0, NULL, HFILL }},
11173 { &hf_bgp_prefix_sid_originator_srgb_block,
11174 { "SRGB Block", "bgp.prefix_sid.originator_srgb_block", FT_NONE, BASE_NONE,
11175 NULL, 0x0, NULL, HFILL }},
11176 { &hf_bgp_prefix_sid_originator_srgb_base,
11177 { "SRGB Base", "bgp.prefix_sid.originator_srgb_base", FT_UINT24, BASE_DEC,
11178 NULL, 0x0, "A three-octet value", HFILL }},
11179 { &hf_bgp_prefix_sid_originator_srgb_range,
11180 { "SRGB Range", "bgp.prefix_sid.originator_srgb_range", FT_UINT24, BASE_DEC,
11181 NULL, 0x0, "A three-octet value", HFILL }},
11182 { &hf_bgp_prefix_sid_type,
11183 { "Type", "bgp.prefix_sid.type", FT_UINT8, BASE_DEC,
11184 VALS(bgp_prefix_sid_type), 0x0, "BGP Prefix-SID message type", HFILL }},
11185 { &hf_bgp_prefix_sid_length,
11186 { "Length", "bgp.prefix_sid.length", FT_UINT16, BASE_DEC,
11187 NULL, 0x0, "BGP Prefix-SID message payload", HFILL }},
11188 { &hf_bgp_prefix_sid_value,
11189 { "Value", "bgp.prefix_sid.value", FT_BYTES, BASE_NONE,
11190 NULL, 0x0, "BGP Prefix-SID message value", HFILL }},
11191 { &hf_bgp_prefix_sid_reserved,
11192 { "Reserved", "bgp.prefix_sid.reserved", FT_BYTES,
11193 BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
11194
11195 /* draft-ietf-bess-srv6-services-05 */
11196 { &hf_bgp_prefix_sid_srv6_l3vpn,
11197 { "SRv6 L3 Service", "bgp.prefix_sid.srv6_l3vpn", FT_NONE, BASE_NONE,
11198 NULL, 0x0, NULL, HFILL }},
11199 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
11200 { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_tlvs", FT_NONE, BASE_NONE,
11201 NULL, 0x0, NULL, HFILL }},
11202 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11203 { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_tlv", FT_NONE, BASE_NONE,
11204 NULL, 0x0, NULL, HFILL }},
11205 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type,
11206 { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
11207 VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
11208 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length,
11209 { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
11210 NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
11211 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value,
11212 { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
11213 NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
11214 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved,
11215 { "Reserved", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.reserved", FT_BYTES,
11216 BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
11217 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_value,
11218 { "SRv6 SID Value", "bgp.prefix_sid.srv6_l3vpn.sid_value", FT_IPv6, BASE_NONE,
11219 NULL, 0x0, NULL, HFILL }},
11220 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_flags,
11221 { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l3vpn.sid_flags", FT_UINT8, BASE_HEX,
11222 NULL, 0x0, NULL, HFILL }},
11223 { &hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior,
11224 { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l3vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
11225 VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
11226 { &hf_bgp_prefix_sid_srv6_l3vpn_reserved,
11227 { "Reserved", "bgp.prefix_sid.srv6_l3vpn.reserved", FT_BYTES,
11228 BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
11229 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
11230 { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
11231 NULL, 0x0, NULL, HFILL }},
11232 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11233 { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
11234 NULL, 0x0, NULL, HFILL }},
11235 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type,
11236 { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
11237 VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
11238 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length,
11239 { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
11240 NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
11241 { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value,
11242 { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
11243 NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
11244 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len,
11245 { "Locator Block Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
11246 NULL, 0x0, NULL, HFILL }},
11247 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len,
11248 { "Locator Node Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
11249 NULL, 0x0, NULL, HFILL }},
11250 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len,
11251 { "Function Length", "bgp.prefix_sid.srv6_l3vpn.sid.func_len", FT_UINT8, BASE_DEC,
11252 NULL, 0x0, NULL, HFILL }},
11253 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len,
11254 { "Argument Length", "bgp.prefix_sid.srv6_l3vpn.sid.arg_len", FT_UINT8, BASE_DEC,
11255 NULL, 0x0, NULL, HFILL }},
11256 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len,
11257 { "Transposition Length", "bgp.prefix_sid.srv6_l3vpn.sid.trans_len", FT_UINT8, BASE_DEC,
11258 NULL, 0x0, NULL, HFILL }},
11259 { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset,
11260 { "Transposition Offset", "bgp.prefix_sid.srv6_l3vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
11261 NULL, 0x0, NULL, HFILL }},
11262 { &hf_bgp_prefix_sid_srv6_l2vpn,
11263 { "SRv6 L3 Service", "bgp.prefix_sid.srv6_l2vpn", FT_NONE, BASE_NONE,
11264 NULL, 0x0, NULL, HFILL }},
11265 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
11266 { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_tlvs", FT_NONE, BASE_NONE,
11267 NULL, 0x0, NULL, HFILL }},
11268 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11269 { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_tlv", FT_NONE, BASE_NONE,
11270 NULL, 0x0, NULL, HFILL }},
11271 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type,
11272 { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
11273 VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
11274 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length,
11275 { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
11276 NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
11277 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value,
11278 { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
11279 NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
11280 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved,
11281 { "Reserved", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.reserved", FT_BYTES,
11282 BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
11283 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_value,
11284 { "SRv6 SID Value", "bgp.prefix_sid.srv6_l2vpn.sid_value", FT_IPv6, BASE_NONE,
11285 NULL, 0x0, NULL, HFILL }},
11286 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_flags,
11287 { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l2vpn.sid_flags", FT_UINT8, BASE_HEX,
11288 NULL, 0x0, NULL, HFILL }},
11289 { &hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior,
11290 { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l2vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
11291 VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
11292 { &hf_bgp_prefix_sid_srv6_l2vpn_reserved,
11293 { "Reserved", "bgp.prefix_sid.srv6_l2vpn.reserved", FT_BYTES,
11294 BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
11295 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
11296 { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
11297 NULL, 0x0, NULL, HFILL }},
11298 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11299 { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
11300 NULL, 0x0, NULL, HFILL }},
11301 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type,
11302 { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
11303 VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
11304 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length,
11305 { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
11306 NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
11307 { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value,
11308 { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
11309 NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
11310 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len,
11311 { "Locator Block Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
11312 NULL, 0x0, NULL, HFILL }},
11313 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len,
11314 { "Locator Node Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
11315 NULL, 0x0, NULL, HFILL }},
11316 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len,
11317 { "Function Length", "bgp.prefix_sid.srv6_l2vpn.sid.func_len", FT_UINT8, BASE_DEC,
11318 NULL, 0x0, NULL, HFILL }},
11319 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len,
11320 { "Argument Length", "bgp.prefix_sid.srv6_l2vpn.sid.arg_len", FT_UINT8, BASE_DEC,
11321 NULL, 0x0, NULL, HFILL }},
11322 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len,
11323 { "Transposition Length", "bgp.prefix_sid.srv6_l2vpn.sid.trans_len", FT_UINT8, BASE_DEC,
11324 NULL, 0x0, NULL, HFILL }},
11325 { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset,
11326 { "Transposition Offset", "bgp.prefix_sid.srv6_l2vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
11327 NULL, 0x0, NULL, HFILL }},
11328
11329 /* RFC5512 : BGP Encapsulation SAFI and the BGP Tunnel Encapsulation Attribute */
11330 { &hf_bgp_update_encaps_tunnel_tlv_len,
11331 { "length", "bgp.update.encaps_tunnel_tlv_len", FT_UINT16,
11332 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11333 { &hf_bgp_update_encaps_tunnel_tlv_type,
11334 { "Type code", "bgp.update.encaps_tunnel_tlv_type", FT_UINT16, BASE_DEC,
11335 VALS(bgp_attr_tunnel_type), 0x0, NULL, HFILL}},
11336 { &hf_bgp_update_encaps_tunnel_subtlv_len,
11337 { "length", "bgp.update.encaps_tunnel_tlv_sublen", FT_UINT16,
11338 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11339 { &hf_bgp_update_encaps_tunnel_subtlv_type,
11340 { "Type code", "bgp.update.encaps_tunnel_subtlv_type", FT_UINT8, BASE_DEC,
11341 VALS(subtlv_type), 0x0, NULL, HFILL}},
11342 { &hf_bgp_update_encaps_tunnel_subtlv_session_id,
11343 { "Session ID", "bgp.update.encaps_tunnel_tlv_subtlv_session_id", FT_UINT32,
11344 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11345 { &hf_bgp_update_encaps_tunnel_subtlv_cookie,
11346 { "Cookie", "bgp.update.encaps_tunnel_tlv_subtlv_cookie", FT_BYTES,
11347 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11348 { &hf_bgp_update_encaps_tunnel_subtlv_gre_key,
11349 { "GRE Key", "bgp.update.encaps_tunnel_tlv_subtlv_gre_key", FT_UINT32,
11350 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11351 { &hf_bgp_update_encaps_tunnel_subtlv_color_value,
11352 { "Color Value", "bgp.update.encaps_tunnel_tlv_subtlv_color_value", FT_UINT32,
11353 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11354 { &hf_bgp_update_encaps_tunnel_subtlv_lb_block_length,
11355 { "Load-balancing block length", "bgp.update.encaps_tunnel_tlv_subtlv_lb_block_length", FT_UINT32,
11356 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11357 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
11358 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags", FT_UINT8,
11359 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11360 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
11361 { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_vnid", FT_BOOLEAN,
11362 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_VNID, NULL, HFILL }},
11363 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
11364 { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_mac", FT_BOOLEAN,
11365 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_MAC, NULL, HFILL }},
11366 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
11367 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.reserved", FT_UINT8,
11368 BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_RESERVED, NULL, HFILL }},
11369 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid,
11370 { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.vnid", FT_UINT24,
11371 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11372 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac,
11373 { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.mac", FT_ETHER,
11374 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11375 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved,
11376 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.reserved", FT_UINT16,
11377 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11378 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
11379 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags", FT_UINT8,
11380 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11381 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
11382 { "Version", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.version", FT_UINT8,
11383 BASE_DEC, NULL, TUNNEL_SUBTLV_VXLAN_GPE_VERSION, NULL, HFILL }},
11384 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
11385 { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.valid_vnid", FT_BOOLEAN,
11386 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID, NULL, HFILL }},
11387 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
11388 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.reserved", FT_UINT8,
11389 BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_GPE_RESERVED, NULL, HFILL }},
11390 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid,
11391 { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.vnid", FT_UINT24,
11392 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11393 { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved,
11394 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.reserved", FT_UINT16,
11395 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11396 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
11397 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags", FT_UINT8,
11398 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11399 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
11400 { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_vnid", FT_BOOLEAN,
11401 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_VNID, NULL, HFILL }},
11402 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
11403 { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_mac", FT_BOOLEAN,
11404 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_MAC, NULL, HFILL }},
11405 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
11406 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.reserved", FT_UINT8,
11407 BASE_HEX, NULL, TUNNEL_SUBTLV_NVGRE_RESERVED, NULL, HFILL }},
11408 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid,
11409 { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.vnid", FT_UINT24,
11410 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11411 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac,
11412 { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.mac", FT_ETHER,
11413 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11414 { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved,
11415 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.reserved", FT_UINT16,
11416 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11417 { &hf_bgp_update_encaps_tunnel_subtlv_value,
11418 { "Value", "bgp.update.encaps_tunnel_tlv_subtlv.value", FT_BYTES,
11419 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11420 { &hf_bgp_update_encaps_tunnel_subtlv_pref_flags,
11421 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.pref.flags", FT_UINT8,
11422 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11423 { &hf_bgp_update_encaps_tunnel_subtlv_pref_reserved,
11424 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.pref.reserved", FT_UINT8,
11425 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11426 { &hf_bgp_update_encaps_tunnel_subtlv_pref_preference,
11427 { "Preference", "bgp.update.encaps_tunnel_tlv_subtlv.pref.preference", FT_BYTES,
11428 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11429 { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
11430 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags", FT_UINT8,
11431 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11432 { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
11433 { "Specified-BSID-only", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.specified", FT_BOOLEAN,
11434 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_SPECIFIED, NULL, HFILL }},
11435 { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
11436 { "Drop Upon Invalid", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.invalid", FT_BOOLEAN,
11437 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_INVALID, NULL, HFILL }},
11438 { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
11439 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.reserved", FT_UINT8,
11440 BASE_HEX, NULL, TUNNEL_SUBTLV_BINDING_RESERVED, NULL, HFILL }},
11441 { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
11442 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.reserved", FT_UINT8,
11443 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11444 { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid,
11445 { "Binding SID", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.sid", FT_BYTES,
11446 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11447 { &hf_bgp_update_encaps_tunnel_subtlv_enlp_flags,
11448 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.flags", FT_UINT8,
11449 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11450 { &hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved,
11451 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.reserved", FT_UINT8,
11452 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11453 { &hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp,
11454 { "ENLP", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.preference", FT_UINT8,
11455 BASE_DEC, VALS(bgp_enlp_type), 0x0, NULL, HFILL}},
11456 { &hf_bgp_update_encaps_tunnel_subtlv_priority_priority,
11457 { "Priority", "bgp.update.encaps_tunnel_tlv_subtlv.priority.priority", FT_UINT8,
11458 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11459 { &hf_bgp_update_encaps_tunnel_subtlv_priority_reserved,
11460 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.priority.reserved", FT_UINT8,
11461 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11462 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved,
11463 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.reserved", FT_UINT8,
11464 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11465 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv,
11466 { "sub-TLVs", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv", FT_BYTES,
11467 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11468 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type,
11469 { "Type", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.type", FT_UINT8,
11470 BASE_DEC, VALS(bgp_sr_policy_list_type), 0x0, NULL, HFILL}},
11471 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length,
11472 { "Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.length", FT_UINT8,
11473 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11474 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11475 { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags", FT_UINT8,
11476 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11477 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
11478 { "SID verification", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.verification", FT_BOOLEAN,
11479 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION, NULL, HFILL }},
11480 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
11481 { "SR Algorithm id", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.algorithm", FT_BOOLEAN,
11482 8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM, NULL, HFILL }},
11483 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
11484 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.reserved", FT_UINT8,
11485 BASE_HEX, NULL, TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED, NULL, HFILL }},
11486 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11487 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.reserved", FT_BYTES,
11488 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11489 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
11490 { "MPLS Label", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.mpls_label", FT_UINT24,
11491 BASE_HEX, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
11492 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
11493 { "Traffic Class", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.traffic_class", FT_UINT8,
11494 BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
11495 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
11496 { "Bottom-of-Stack", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.bottom_stack", FT_BOOLEAN,
11497 8, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
11498 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
11499 { "TTL", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ttl", FT_UINT8,
11500 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11501 { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
11502 { "Data", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.data", FT_BYTES,
11503 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11504 { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved,
11505 { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.reserved", FT_UINT8,
11506 BASE_HEX, NULL, 0x0, NULL, HFILL}},
11507 { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_name,
11508 { "Policy name", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.name", FT_STRING,
11509 STR_ASCII, NULL, 0x0, NULL, HFILL}},
11510
11511 /* BGP update path attribut SSA SAFI (deprecated IETF draft) */
11512 { &hf_bgp_ssa_t,
11513 { "Transitive bit", "bgp.ssa_t", FT_BOOLEAN, 8,
11514 NULL, 0x80, "SSA Transitive bit", HFILL}},
11515 { &hf_bgp_ssa_type,
11516 { "SSA Type", "bgp.ssa_type", FT_UINT16, BASE_DEC,
11517 VALS(bgp_ssa_type), 0x7FFF, NULL, HFILL}},
11518 { &hf_bgp_ssa_len,
11519 { "Length", "bgp.ssa_len", FT_UINT16, BASE_DEC,
11520 NULL, 0x0, "SSA Length", HFILL}},
11521 { &hf_bgp_ssa_value,
11522 { "Value", "bgp.ssa_value", FT_BYTES, BASE_NONE,
11523 NULL, 0x0, "SSA Value", HFILL}},
11524 { &hf_bgp_ssa_l2tpv3_pref,
11525 { "Preference", "bgp.ssa_l2tpv3_pref", FT_UINT16, BASE_DEC,
11526 NULL, 0x0, NULL, HFILL}},
11527 { &hf_bgp_ssa_l2tpv3_s,
11528 { "Sequencing bit", "bgp.ssa_l2tpv3_s", FT_BOOLEAN, 8,
11529 NULL, 0x80, "Sequencing S-bit", HFILL}},
11530 { &hf_bgp_ssa_l2tpv3_unused,
11531 { "Unused", "bgp.ssa_l2tpv3_Unused", FT_BOOLEAN, 8,
11532 NULL, 0x7F, "Unused Flags", HFILL}},
11533 { &hf_bgp_ssa_l2tpv3_cookie_len,
11534 { "Cookie Length", "bgp.ssa_l2tpv3_cookie_len", FT_UINT8, BASE_DEC,
11535 NULL, 0x0, NULL, HFILL}},
11536 { &hf_bgp_ssa_l2tpv3_session_id,
11537 { "Session ID", "bgp.ssa_l2tpv3_session_id", FT_UINT32, BASE_DEC,
11538 NULL, 0x0, NULL, HFILL}},
11539 { &hf_bgp_ssa_l2tpv3_cookie,
11540 { "Cookie", "bgp.ssa_l2tpv3_cookie", FT_BYTES, BASE_NONE,
11541 NULL, 0x0, NULL, HFILL}},
11542 { &hf_bgp_withdrawn_prefix,
11543 { "Withdrawn prefix", "bgp.withdrawn_prefix", FT_IPv4, BASE_NONE,
11544 NULL, 0x0, NULL, HFILL}},
11545
11546 /* NLRI header description */
11547 { &hf_bgp_update_nlri,
11548 { "Network Layer Reachability Information (NLRI)", "bgp.update.nlri", FT_NONE, BASE_NONE,
11549 NULL, 0x0, NULL, HFILL}},
11550 /* Global NLRI description */
11551 { &hf_bgp_mp_reach_nlri_ipv4_prefix,
11552 { "MP Reach NLRI IPv4 prefix", "bgp.mp_reach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
11553 NULL, 0x0, NULL, HFILL}},
11554 { &hf_bgp_mp_unreach_nlri_ipv4_prefix,
11555 { "MP Unreach NLRI IPv4 prefix", "bgp.mp_unreach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
11556 NULL, 0x0, NULL, HFILL}},
11557 { &hf_bgp_mp_reach_nlri_ipv6_prefix,
11558 { "MP Reach NLRI IPv6 prefix", "bgp.mp_reach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
11559 NULL, 0x0, NULL, HFILL}},
11560 { &hf_bgp_mp_unreach_nlri_ipv6_prefix,
11561 { "MP Unreach NLRI IPv6 prefix", "bgp.mp_unreach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
11562 NULL, 0x0, NULL, HFILL}},
11563 { &hf_bgp_mp_nlri_tnl_id,
11564 { "MP Reach NLRI Tunnel Identifier", "bgp.mp_nlri_tnl_id", FT_UINT16, BASE_HEX,
11565 NULL, 0x0, NULL, HFILL}},
11566 { &hf_bgp_nlri_prefix,
11567 { "NLRI prefix", "bgp.nlri_prefix", FT_IPv4, BASE_NONE,
11568 NULL, 0x0, NULL, HFILL}},
11569 { &hf_bgp_nlri_path_id,
11570 { "NLRI path id", "bgp.nlri_path_id", FT_UINT32, BASE_DEC,
11571 NULL, 0x0, NULL, HFILL}},
11572
11573 /* mcast vpn nlri and capability */
11574 { &hf_bgp_mcast_vpn_nlri_t,
11575 { "MCAST-VPN nlri", "bgp.mcast_vpn_nlri", FT_BYTES, BASE_NONE,
11576 NULL, 0x0, NULL, HFILL}},
11577 { &hf_bgp_mcast_vpn_nlri_route_type,
11578 { "Route Type", "bgp.mcast_vpn_nlri_route_type", FT_UINT8,
11579 BASE_DEC, VALS(mcast_vpn_route_type), 0x0, NULL, HFILL}},
11580 { &hf_bgp_mcast_vpn_nlri_length,
11581 { "Length", "bgp.mcast_vpn_nlri_length", FT_UINT8,
11582 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11583 { &hf_bgp_mcast_vpn_nlri_rd,
11584 { "Route Distinguisher", "bgp.mcast_vpn_nlri_rd", FT_BYTES,
11585 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11586 { &hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
11587 { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv4", FT_IPv4,
11588 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11589 { &hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
11590 { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv6", FT_IPv6,
11591 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11592 { &hf_bgp_mcast_vpn_nlri_source_as,
11593 { "Source AS", "bgp.mcast_vpn_nlri_source_as", FT_UINT16,
11594 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11595 { &hf_bgp_mcast_vpn_nlri_source_length,
11596 { "Multicast Source Length", "bgp.mcast_vpn_nlri_source_length", FT_UINT8,
11597 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11598 { &hf_bgp_mcast_vpn_nlri_group_length,
11599 { "Multicast Group Length", "bgp.mcast_vpn_nlri_group_length", FT_UINT8,
11600 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11601 { &hf_bgp_mcast_vpn_nlri_source_addr_ipv4,
11602 { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv4", FT_IPv4,
11603 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11604 { &hf_bgp_mcast_vpn_nlri_source_addr_ipv6,
11605 { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv6", FT_IPv6,
11606 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11607 { &hf_bgp_mcast_vpn_nlri_group_addr_ipv4,
11608 { "Multicast Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv4", FT_IPv4,
11609 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11610 { &hf_bgp_mcast_vpn_nlri_group_addr_ipv6,
11611 { "Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv6", FT_IPv6,
11612 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11613 { &hf_bgp_mcast_vpn_nlri_route_key,
11614 { "Route Key", "bgp.mcast_vpn_nlri_route_key", FT_BYTES,
11615 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11616 /* sr policy nlri*/
11617 { &hf_bgp_sr_policy_nlri_length,
11618 { "NLRI length", "bgp.sr_policy_nlri_length", FT_UINT8,
11619 BASE_DEC, NULL, 0x0, "NLRI length in bits", HFILL}},
11620 { &hf_bgp_sr_policy_nlri_distinguisher,
11621 { "Distinguisher", "bgp.sr_policy_nlri_distinguisher", FT_BYTES,
11622 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11623 { &hf_bgp_sr_policy_nlri_policy_color,
11624 { "Policy color", "bgp.sr_policy_nlri_policy_color", FT_BYTES,
11625 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11626 { &hf_bgp_sr_policy_nlri_endpoint_v4,
11627 { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv4", FT_IPv4,
11628 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11629 { &hf_bgp_sr_policy_nlri_endpoint_v6,
11630 { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv6", FT_IPv6,
11631 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11632 /* Bgp flow spec nlri and capability */
11633 { &hf_bgp_flowspec_nlri_t,
11634 { "FLOW-SPEC nlri", "bgp.flowspec_nlri", FT_BYTES, BASE_NONE,
11635 NULL, 0x0, NULL, HFILL}},
11636 { &hf_bgp_flowspec_nlri_route_distinguisher,
11637 { "Route Distinguisher", "bgp.flowspec_route_distinguisher", FT_NONE,
11638 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11639 { &hf_bgp_flowspec_nlri_route_distinguisher_type,
11640 { "Route Distinguisher Type", "bgp.flowspec_route_distinguisher_type", FT_UINT16,
11641 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11642 { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
11643 { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_2", FT_UINT16,
11644 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11645 { &hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
11646 { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_ipv4", FT_IPv4,
11647 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11648 { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
11649 { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_4", FT_UINT32,
11650 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
11651 { &hf_bgp_flowspec_nlri_route_dist_asnum_2,
11652 { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_2", FT_UINT16,
11653 BASE_DEC, NULL, 0x0, NULL, HFILL}},
11654 { &hf_bgp_flowspec_nlri_route_dist_asnum_4,
11655 { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_4", FT_UINT32,
11656 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
11657 { &hf_bgp_flowspec_nlri_filter,
11658 { "Filter", "bgp.flowspec_nlri.filter", FT_NONE, BASE_NONE,
11659 NULL, 0x0, NULL, HFILL }},
11660 { &hf_bgp_flowspec_nlri_filter_type,
11661 { "Filter type", "bgp.flowspec_nlri.filter_type", FT_UINT8, BASE_DEC,
11662 VALS(flowspec_nlri_opvaluepair_type), 0x0, NULL, HFILL }},
11663 { &hf_bgp_flowspec_nlri_length,
11664 { "NRLI length", "bgp.flowspec_nlri.length", FT_UINT16, BASE_DEC,
11665 NULL, 0x0, NULL, HFILL }},
11666 { &hf_bgp_flowspec_nlri_op_flags,
11667 { "Operator flags", "bgp.flowspec_nlri.opflags", FT_UINT8, BASE_HEX,
11668 NULL, 0x0, NULL, HFILL }},
11669 { &hf_bgp_flowspec_nlri_dst_pref_ipv4,
11670 { "Destination IP filter", "bgp.flowspec_nlri.dst_prefix_filter", FT_IPv4,
11671 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11672 { &hf_bgp_flowspec_nlri_src_pref_ipv4,
11673 { "Source IP filter", "bgp.flowspec_nlri.src_prefix_filter", FT_IPv4,
11674 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11675 { &hf_bgp_flowspec_nlri_op_eol,
11676 { "end-of-list", "bgp.flowspec_nlri.op.eol", FT_BOOLEAN, 8,
11677 TFS(&tfs_set_notset), BGPNLRI_FSPEC_END_OF_LST, NULL, HFILL }},
11678 { &hf_bgp_flowspec_nlri_op_and,
11679 { "and", "bgp.flowspec_nlri.op.and", FT_BOOLEAN, 8,
11680 TFS(&tfs_set_notset), BGPNLRI_FSPEC_AND_BIT, NULL, HFILL }},
11681 { &hf_bgp_flowspec_nlri_op_val_len,
11682 { "Value length", "bgp.flowspec_nlri.op.val_len", FT_UINT8, BASE_DEC,
11683 VALS(flow_spec_op_len_val), BGPNLRI_FSPEC_VAL_LEN, NULL, HFILL }},
11684 { &hf_bgp_flowspec_nlri_op_un_bit4,
11685 { "Reserved", "bgp.flowspec_nlri.op.un_bit4", FT_BOOLEAN, 8,
11686 TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT4, "Unused (must be zero)",HFILL}},
11687 { &hf_bgp_flowspec_nlri_op_un_bit5,
11688 { "Reserved", "bgp.flowspec_nlri.op.un_bit5", FT_BOOLEAN, 8,
11689 TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT5, "Unused (must be zero)", HFILL}},
11690 { &hf_bgp_flowspec_nlri_dec_val_8,
11691 { "Decimal value", "bgp.flowspec_nlri.dec_val_8", FT_UINT8, BASE_DEC,
11692 NULL, 0X0, NULL, HFILL }},
11693 { &hf_bgp_flowspec_nlri_dec_val_16,
11694 { "Decimal value", "bgp.flowspec_nlri.dec_val_16", FT_UINT16, BASE_DEC,
11695 NULL, 0X0, NULL, HFILL }},
11696 { &hf_bgp_flowspec_nlri_dec_val_32,
11697 { "Decimal value", "bgp.flowspec_nlri.dec_val_32", FT_UINT32, BASE_DEC,
11698 NULL, 0X0, NULL, HFILL }},
11699 { &hf_bgp_flowspec_nlri_dec_val_64,
11700 { "Decimal value", "bgp.flowspec_nlri.dec_val_64", FT_UINT64, BASE_DEC,
11701 NULL, 0X0, NULL, HFILL }},
11702 { &hf_bgp_flowspec_nlri_op_lt,
11703 { "less than", "bgp.flowspec_nlri.op.lt", FT_BOOLEAN, 8,
11704 TFS(&tfs_set_notset), BGPNLRI_FSPEC_LESS_THAN, NULL, HFILL }},
11705 { &hf_bgp_flowspec_nlri_op_gt,
11706 { "greater than", "bgp.flowspec_nlri.op.gt", FT_BOOLEAN, 8,
11707 TFS(&tfs_set_notset), BGPNLRI_FSPEC_GREATER_THAN, NULL, HFILL }},
11708 { &hf_bgp_flowspec_nlri_op_eq,
11709 { "equal", "bgp.flowspec_nlri.op.equal", FT_BOOLEAN, 8,
11710 TFS(&tfs_set_notset), BGPNLRI_FSPEC_EQUAL, NULL, HFILL }},
11711 { &hf_bgp_flowspec_nlri_op_flg_not,
11712 { "logical negation", "bgp.flowspec_nlri.op.flg_not", FT_BOOLEAN, 8,
11713 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_NOTBIT, NULL, HFILL }},
11714 { &hf_bgp_flowspec_nlri_op_flg_match,
11715 { "Match bit", "bgp.flowspec_nlri.op.flg_match", FT_BOOLEAN, 8,
11716 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_MATCHBIT, NULL, HFILL }},
11717 { &hf_bgp_flowspec_nlri_tcp_flags,
11718 { "TCP flags", "bgp.flowspec_nlri.val_tcp.flags", FT_UINT8, BASE_HEX,
11719 NULL, 0x0, NULL, HFILL }},
11720 { &hf_bgp_flowspec_nlri_tcp_flags_cwr,
11721 { "Congestion Window Reduced (CWR)", "bgp.flowspec_nlri.val_tcp.flags.cwr", FT_BOOLEAN, 8,
11722 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_CWR, NULL, HFILL }},
11723 { &hf_bgp_flowspec_nlri_tcp_flags_ecn,
11724 { "ECN-Echo", "bgp.flowspec_nlri.val_tcp.flags.ecn", FT_BOOLEAN, 8,
11725 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ECN, NULL, HFILL }},
11726 { &hf_bgp_flowspec_nlri_tcp_flags_urg,
11727 { "Urgent", "bgp.flowspec_nlri.val_tcp.flags.urg", FT_BOOLEAN, 8,
11728 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_URG, NULL, HFILL }},
11729 { &hf_bgp_flowspec_nlri_tcp_flags_ack,
11730 { "Acknowledgment", "bgp.flowspec_nlri.val_tcp.flags.ack", FT_BOOLEAN, 8,
11731 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ACK, NULL, HFILL }},
11732 { &hf_bgp_flowspec_nlri_tcp_flags_push,
11733 { "Push", "bgp.flowspec_nlri.val_tcp.flags.push", FT_BOOLEAN, 8,
11734 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_PUSH, NULL, HFILL }},
11735 { &hf_bgp_flowspec_nlri_tcp_flags_reset,
11736 { "Reset", "bgp.flowspec_nlri.val_tcp.flags.reset", FT_BOOLEAN, 8,
11737 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_RST, NULL, HFILL }},
11738 { &hf_bgp_flowspec_nlri_tcp_flags_syn,
11739 { "Syn", "bgp.flowspec_nlri.val_tcp.flags.syn", FT_BOOLEAN, 8,
11740 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_SYN, NULL, HFILL }},
11741 { &hf_bgp_flowspec_nlri_tcp_flags_fin,
11742 { "Fin", "bgp.flowspec_nlri.val_tcp.flags.fin", FT_BOOLEAN, 8,
11743 TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_FIN, NULL, HFILL }},
11744 { &hf_bgp_flowspec_nlri_fflag,
11745 { "Fragment Flag", "bgp.flowspec_nlri.val_frag", FT_UINT8, BASE_HEX,
11746 NULL, 0x0, NULL, HFILL }},
11747 { &hf_bgp_flowspec_nlri_fflag_lf,
11748 { "Last fragment", "bgp.flowspec_nlri.val_frag_lf", FT_BOOLEAN, 8,
11749 TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_LF, NULL, HFILL }},
11750 { &hf_bgp_flowspec_nlri_fflag_ff,
11751 { "First fragment", "bgp.flowspec_nlri.val_frag_ff", FT_BOOLEAN, 8,
11752 TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_FF, NULL, HFILL }},
11753 { &hf_bgp_flowspec_nlri_fflag_isf,
11754 { "Is a fragment", "bgp.flowspec_nlri.val_frag_isf", FT_BOOLEAN, 8,
11755 TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_ISF, NULL, HFILL }},
11756 { &hf_bgp_flowspec_nlri_fflag_df,
11757 { "Don't fragment", "bgp.flowspec_nlri.val_frag_df", FT_BOOLEAN, 8,
11758 TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_DF, NULL, HFILL }},
11759 { &hf_bgp_flowspec_nlri_dscp,
11760 { "Differentiated Services Codepoint", "bgp.flowspec_nlri.val_dsfield", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
11761 &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
11762 { &hf_bgp_flowspec_nlri_src_ipv6_pref,
11763 { "Source IPv6 prefix", "bgp.flowspec_nlri.src_ipv6_pref", FT_IPv6, BASE_NONE,
11764 NULL, 0x0, NULL, HFILL}},
11765 { &hf_bgp_flowspec_nlri_dst_ipv6_pref,
11766 { "Destination IPv6 prefix", "bgp.flowspec_nlri.dst_ipv6_pref", FT_IPv6, BASE_NONE,
11767 NULL, 0x0, NULL, HFILL}},
11768 { &hf_bgp_flowspec_nlri_ipv6_pref_len,
11769 { "IPv6 prefix length", "bgp.flowspec_nlri.ipv6_pref_length", FT_UINT8, BASE_DEC,
11770 NULL, 0x0, NULL, HFILL}},
11771 { &hf_bgp_flowspec_nlri_ipv6_pref_offset,
11772 { "IPv6 prefix offset", "bgp.flowspec_nlri.ipv6_pref_offset", FT_UINT8, BASE_DEC,
11773 NULL, 0x0, NULL, HFILL}},
11774 /* end of bgp flow spec */
11775 /* BGP update safi ndt nlri draft-nalawade-idr-mdt-safi-03 */
11776 { &hf_bgp_mdt_nlri_safi_rd,
11777 { "Route Distinguisher", "bgp.mdt_safi_rd", FT_BYTES,
11778 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11779 { &hf_bgp_mdt_nlri_safi_ipv4_addr,
11780 { "IPv4 Address", "bgp.mdt_safi_ipv4_addr", FT_IPv4,
11781 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11782 { &hf_bgp_mdt_nlri_safi_group_addr,
11783 { "Group Address", "bgp.mdt_safi_group_addr", FT_IPv4,
11784 BASE_NONE, NULL, 0x0, NULL, HFILL}},
11785 /* BGP update extended community header field */
11786 { &hf_bgp_ext_communities,
11787 { "Carried extended communities", "bgp.ext_communities", FT_NONE, BASE_NONE,
11788 NULL, 0x0, NULL, HFILL }},
11789 { &hf_bgp_ext_community,
11790 { "Community", "bgp.ext_community", FT_NONE, BASE_NONE,
11791 NULL, 0x0, "Extended Community attribute", HFILL }},
11792 { &hf_bgp_ext_com_type_high,
11793 { "Type", "bgp.ext_com.type", FT_UINT8, BASE_HEX,
11794 VALS(bgpext_com_type_high), 0x0, "Extended Community type", HFILL }},
11795 { &hf_bgp_ext_com_type_auth,
11796 { "IANA Authority", "bgp.ext_com.type.auth", FT_BOOLEAN, 8,
11797 TFS(&tfs_bgpext_com_type_auth), BGP_EXT_COM_TYPE_AUTH, "IANA Type Allocation Policy", HFILL }},
11798 {&hf_bgp_ext_com_type_tran,
11799 { "Transitive across AS", "bgp.ext_com.type.tran", FT_BOOLEAN, 8,
11800 TFS(&tfs_non_transitive_transitive), BGP_EXT_COM_TYPE_TRAN, "Transitivity of the attribute across autonomous systems", HFILL }},
11801 { &hf_bgp_ext_com_stype_low_unknown,
11802 { "Subtype", "bgp.ext_com.stype_unknown", FT_UINT8, BASE_HEX,
11803 NULL, 0x0, "Extended Community subtype", HFILL }},
11804 { &hf_bgp_ext_com_stype_tr_evpn,
11805 { "Subtype (EVPN)", "bgp.ext_com.stype_tr_evpn", FT_UINT8, BASE_HEX,
11806 VALS(bgpext_com_stype_tr_evpn), 0x0, "EVPN Extended Community subtype", HFILL}},
11807 { &hf_bgp_ext_com_stype_tr_as2,
11808 { "Subtype (AS2)", "bgp.ext_com.stype_tr_as2", FT_UINT8, BASE_HEX,
11809 VALS(bgpext_com_stype_tr_as2), 0x0, "2-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
11810 { &hf_bgp_ext_com_stype_ntr_as2,
11811 { "Subtype (Non-transitive AS2)", "bgp.ext_com.stype_ntr_as2", FT_UINT8, BASE_HEX,
11812 VALS(bgpext_com_stype_ntr_as2), 0x0, "2-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
11813 { &hf_bgp_ext_com_stype_tr_as4,
11814 { "Subtype (AS4)", "bgp.ext_com.stype_tr_as4", FT_UINT8, BASE_HEX,
11815 VALS(bgpext_com_stype_tr_as4), 0x0, "4-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
11816 { &hf_bgp_ext_com_stype_ntr_as4,
11817 { "Subtype (Non-transitive AS4)", "bgp.ext_com.stype_ntr_as4", FT_UINT8, BASE_HEX,
11818 VALS(bgpext_com_stype_ntr_as4), 0x0, "4-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
11819 { &hf_bgp_ext_com_stype_tr_IP4,
11820 { "Subtype (IPv4)", "bgp.ext_com.stype_tr_IP4", FT_UINT8, BASE_HEX,
11821 VALS(bgpext_com_stype_tr_IP4), 0x0, "IPv4-Address-Specific Transitive Extended Community subtype", HFILL}},
11822 { &hf_bgp_ext_com_stype_ntr_IP4,
11823 { "Subtype (Non-transitive IPv4)", "bgp.ext_com.stype_ntr_IP4", FT_UINT8, BASE_HEX,
11824 VALS(bgpext_com_stype_ntr_IP4), 0x0, "IPv4-Address-Specific Non-transitive Extended Community subtype", HFILL}},
11825 { &hf_bgp_ext_com_stype_tr_opaque,
11826 { "Subtype (Opaque)", "bgp.ext_com.stype_tr_opaque", FT_UINT8, BASE_HEX,
11827 VALS(bgpext_com_stype_tr_opaque), 0x0, "Opaque Transitive Extended Community subtype", HFILL}},
11828 { &hf_bgp_ext_com_stype_ntr_opaque,
11829 { "Subtype (Non-transitive Opaque)", "bgp.ext_com.stype_ntr_opaque", FT_UINT8, BASE_HEX,
11830 VALS(bgpext_com_stype_ntr_opaque), 0x0, "Opaque Non-transitive Extended Community subtype", HFILL}},
11831 { &hf_bgp_ext_com_tunnel_type,
11832 { "Tunnel type", "bgp.ext_com.tunnel_type", FT_UINT16, BASE_DEC,
11833 VALS(bgpext_com_tunnel_type), 0x0, "Tunnel encapsulation type", HFILL}},
11834 { &hf_bgp_ext_com_stype_tr_exp,
11835 { "Subtype (Experimental)", "bgp.ext_com.stype_tr_exp", FT_UINT8, BASE_HEX,
11836 VALS(bgpext_com_stype_tr_exp), 0x0, "Experimental Transitive Extended Community subtype", HFILL}},
11837 { &hf_bgp_ext_com_stype_tr_exp_2,
11838 { "Subtype (Experimental Part 2)", "bgp.ext_com.stype_tr_exp_2", FT_UINT8, BASE_HEX,
11839 VALS(bgpext_com_stype_tr_exp_2), 0x0, "Generic Transitive Experimental Use Extended Community Part 2 Sub-Types", HFILL}},
11840 { &hf_bgp_ext_com_stype_tr_exp_3,
11841 { "Subtype (Experimental Part 3)", "bgp.ext_com.stype_tr_exp_3", FT_UINT8, BASE_HEX,
11842 VALS(bgpext_com_stype_tr_exp_3), 0x0, "Generic Transitive Experimental Use Extended Community Part 3 Sub-Types", HFILL}},
11843 { &hf_bgp_ext_com_value_as2,
11844 { "2-Octet AS", "bgp.ext_com.value_as2", FT_UINT16, BASE_DEC,
11845 NULL, 0x0, "Global Administrator Field value (2B Autonomous System Number)", HFILL }},
11846 { &hf_bgp_ext_com_value_as4,
11847 { "4-Octet AS", "bgp.ext_com.value_as4", FT_UINT32, BASE_DEC,
11848 NULL, 0x0, "Global Administrator Field value (4B Autonomous System Number)", HFILL }},
11849 { &hf_bgp_ext_com_value_IP4,
11850 { "IPv4 address", "bgp.ext_com.value_IP4", FT_IPv4, BASE_NONE,
11851 NULL, 0x0, "Global Administrator Field value (IPv4 Address)", HFILL }},
11852 { &hf_bgp_ext_com_value_an2,
11853 { "2-Octet AN", "bgp.ext_com.value_an2", FT_UINT16, BASE_DEC,
11854 NULL, 0x0, "Local Administrator Field value (2B Assigned Number)", HFILL }},
11855 { &hf_bgp_ext_com_value_an4,
11856 { "4-Octet AN", "bgp.ext_com.value_an4", FT_UINT32, BASE_DEC,
11857 NULL, 0x0, "Local Administrator Field value (4B Assigned Number)", HFILL }},
11858 { &hf_bgp_ext_com_value_link_bw,
11859 { "Link bandwidth", "bgp.ext_com.value_link_bw", FT_FLOAT, BASE_NONE,
11860 NULL, 0x0, NULL, HFILL}},
11861 { &hf_bgp_ext_com_value_ospf_rt_area,
11862 { "Area ID", "bgp.ext_com.value_ospf_rtype.area", FT_IPv4, BASE_NONE,
11863 NULL, 0x0, "Original OSPF Area ID this route comes from", HFILL }},
11864 { &hf_bgp_ext_com_value_ospf_rt_type,
11865 { "Route type", "bgp.ext_com.value_ospf_rtype.type", FT_UINT8, BASE_DEC,
11866 VALS(bgpext_com_ospf_rtype), 0x0, "Original OSPF LSA Type that carried this route", HFILL}},
11867 { &hf_bgp_ext_com_value_ospf_rt_options,
11868 { "Options", "bgp.ext_com.value_ospf_rtype.options", FT_UINT8, BASE_HEX,
11869 NULL, 0x0, "OSPF Route Type Options bitfield", HFILL }},
11870 { &hf_bgp_ext_com_value_ospf_rt_options_mt,
11871 { "Metric type", "bgp.ext_com.value_ospf_rtype.options.mt", FT_BOOLEAN, 8,
11872 TFS(&tfs_ospf_rt_mt), BGP_OSPF_RTYPE_METRIC_TYPE, "OSPF metric type (Type-1 or Type-2) of the original route", HFILL }},
11873 { &hf_bgp_ext_com_value_ospf_rid,
11874 { "Router ID", "bgp.ext_com.value_ospf_rid", FT_IPv4, BASE_NONE,
11875 NULL, 0x0, "OSPF Router ID of the redistributing PE router", HFILL }},
11876 { &hf_bgp_ext_com_value_fs_remark,
11877 { "Remarking value", "bgp.ext_com.value_fs_dscp", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
11878 &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
11879 { &hf_bgp_ext_com_value_raw,
11880 { "Raw Value", "bgp.ext_com.value_raw", FT_UINT48, BASE_HEX,
11881 NULL, 0x0, "Raw value of the lowmost 6 octets of the Extended Community attribute", HFILL }},
11882 /* BGP update extended community flow spec RFC 5575 */
11883 { &hf_bgp_ext_com_flow_act_samp_act,
11884 { "Sample", "bgp.ext_com_flow.sample", FT_BOOLEAN, 8,
11885 TFS(&tfs_set_notset), BGP_EXT_COM_FSPEC_ACT_S, NULL, HFILL }},
11886 { &hf_bgp_ext_com_flow_act_term_act,
11887 { "Terminal action", "bgp.ext_com_flow.traff_act", FT_BOOLEAN, 8,
11888 TFS(&tfs_set_notset),BGP_EXT_COM_FSPEC_ACT_T,NULL, HFILL}},
11889 { &hf_bgp_ext_com_flow_rate_float,
11890 { "Rate shaper", "bgp.ext_com_flow.rate_limit", FT_FLOAT, BASE_NONE,
11891 NULL, 0x0, NULL, HFILL}},
11892 { &hf_bgp_ext_com_flow_act_allset,
11893 { "5 Bytes", "bgp.flowspec_ext_com.emptybytes", FT_BYTES, BASE_NONE,
11894 NULL, 0x0, "Must be set to all 0", HFILL }},
11895 /* BGP QoS propagation draft-knoll-idr-qos-attribute */
11896 { &hf_bgp_ext_com_qos_flags,
11897 { "Flags", "bgp.ext_com_qos.flags", FT_UINT8, BASE_HEX,
11898 NULL, 0, NULL, HFILL}},
11899 { &hf_bgp_ext_com_qos_flags_remarking,
11900 { "Remarking", "bgp.ext_com_qos.flags.remarking", FT_BOOLEAN, 8,
11901 TFS(&tfs_yes_no), 0x10, NULL, HFILL}},
11902 { &hf_bgp_ext_com_qos_flags_ignore_remarking,
11903 { "Ignore remarking", "bgp.ext_com_qos.flags.ignore_remarking", FT_BOOLEAN, 8,
11904 TFS(&tfs_yes_no), 0x08, NULL, HFILL}},
11905 { &hf_bgp_ext_com_qos_flags_agg_marking,
11906 { "Aggregation of markins", "bgp.ext_com_qos.flags.agg_marking", FT_BOOLEAN, 8,
11907 TFS(&tfs_yes_no), 0x04, NULL, HFILL}},
11908 { &hf_bgp_ext_com_cos_flags,
11909 { "Flags byte", "bgp.ext_com_cos.flags", FT_UINT8, BASE_HEX,
11910 NULL, 0, NULL, HFILL}},
11911 { &hf_bgp_ext_com_cos_flags_be,
11912 { "BE class", "bgp.ext_com_cos.flags.be", FT_BOOLEAN, 8,
11913 TFS(&tfs_supported_not_supported), 0x80, NULL, HFILL}},
11914 { &hf_bgp_ext_com_cos_flags_ef,
11915 { "EF class", "bgp.ext_com_cos.flags.ef", FT_BOOLEAN, 8,
11916 TFS(&tfs_supported_not_supported), 0x40, NULL, HFILL}},
11917 { &hf_bgp_ext_com_cos_flags_af,
11918 { "AF class", "bgp.ext_com_cos.flags.af", FT_BOOLEAN, 8,
11919 TFS(&tfs_supported_not_supported), 0x20, NULL, HFILL}},
11920 { &hf_bgp_ext_com_cos_flags_le,
11921 { "LE class", "bgp.ext_com_cos.flags.le", FT_BOOLEAN, 8,
11922 TFS(&tfs_supported_not_supported), 0x10, NULL, HFILL}},
11923 { &hf_bgp_ext_com_qos_set_number,
11924 { "QoS Set Number", "bgp.ext_com_qos.set_number", FT_UINT8, BASE_HEX,
11925 NULL, 0, NULL, HFILL}},
11926 { &hf_bgp_ext_com_qos_tech_type,
11927 { "Technology Type", "bgp.ext_com_qos.tech_type", FT_UINT8, BASE_HEX,
11928 VALS(qos_tech_type), 0, NULL, HFILL}},
11929 { &hf_bgp_ext_com_qos_marking_o,
11930 { "QoS Marking O", "bgp.ext_com_qos.marking_o", FT_UINT16, BASE_HEX,
11931 NULL, 0, NULL, HFILL}},
11932 { &hf_bgp_ext_com_qos_marking_a,
11933 { "QoS Marking A", "bgp.ext_com_qos.marking_a", FT_UINT8, BASE_HEX_DEC,
11934 NULL, 0, NULL, HFILL}},
11935 { &hf_bgp_ext_com_qos_default_to_zero,
11936 { "Defaults to zero", "bgp.ext_com_qos.default_to_zero", FT_UINT8, BASE_HEX,
11937 NULL, 0, NULL, HFILL}},
11938 /* BGP L2 extended community RFC 4761, RFC 6624 */
11939 /* draft-ietf-l2vpn-vpls-multihoming */
11940 { &hf_bgp_ext_com_l2_encaps,
11941 { "Encaps Type", "bgp.ext_com_l2.encaps_type", FT_UINT8, BASE_DEC,
11942 VALS(bgp_l2vpn_encaps), 0, NULL, HFILL}},
11943 { &hf_bgp_ext_com_l2_c_flags,
11944 { "Control Flags", "bgp.ext_com_l2.c_flags", FT_UINT8, BASE_HEX,
11945 NULL, 0x0, NULL, HFILL }},
11946 { &hf_bgp_ext_com_l2_flag_d,
11947 { "Down flag", "bgp.ext_com_l2.flag_d",FT_BOOLEAN, 8,
11948 TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_D, NULL, HFILL }},
11949 { &hf_bgp_ext_com_l2_flag_z1,
11950 { "Unassigned", "bgp.ext_com_l2.flag_z1",FT_UINT8, BASE_DEC,
11951 NULL, BGP_EXT_COM_L2_FLAG_Z1, "Must be Zero", HFILL }},
11952 { &hf_bgp_ext_com_l2_flag_f,
11953 { "Flush flag", "bgp.ext_com_l2.flag_f",FT_BOOLEAN, 8,
11954 TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_F, NULL, HFILL }},
11955 { &hf_bgp_ext_com_l2_flag_z345,
11956 { "Unassigned", "bgp.ext_com_l2.flag_z345",FT_UINT8, BASE_DEC,
11957 NULL, BGP_EXT_COM_L2_FLAG_Z345, "Must be Zero", HFILL }},
11958 { &hf_bgp_ext_com_l2_flag_c,
11959 { "C flag", "bgp.ext_com_l2.flag_c",FT_BOOLEAN, 8,
11960 TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_C, NULL, HFILL }},
11961 { &hf_bgp_ext_com_l2_flag_s,
11962 { "S flag", "bgp.ext_com_l2.flag_s",FT_BOOLEAN, 8,
11963 TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_S, NULL, HFILL }},
11964 { &hf_bgp_ext_com_l2_mtu,
11965 { "Layer-2 MTU", "bgp.ext_com_l2.l2_mtu", FT_UINT16, BASE_DEC,
11966 NULL, 0x0, NULL, HFILL}},
11967 { &hf_bgp_ext_com_l2_esi_label_flag,
11968 { "Single active bit", "bgp.ext_com_l2.esi_label_flag",FT_BOOLEAN, 8,
11969 TFS(&tfs_esi_label_flag), BGP_EXT_COM_ESI_LABEL_FLAGS, NULL, HFILL }},
11970 { &hf_bgp_ext_com_etree_root_vlan,
11971 { "Root VLAN", "bgp.ext_com_etree.root_vlan", FT_UINT16, BASE_DEC,
11972 NULL, 0x0FFF, NULL, HFILL }},
11973 { &hf_bgp_ext_com_etree_leaf_vlan,
11974 { "Leaf VLAN", "bgp.ext_com_etree.leaf_vlan", FT_UINT16, BASE_DEC,
11975 NULL, 0x0FFF, NULL, HFILL }},
11976 { &hf_bgp_ext_com_etree_flags,
11977 { "Flags", "bgp.ext_com_etree.flags", FT_UINT16, BASE_HEX,
11978 NULL, 0x0, NULL, HFILL }},
11979 { &hf_bgp_ext_com_etree_flag_reserved,
11980 { "Reserved", "bgp.ext_com_etree.flag_reserved",FT_UINT16, BASE_HEX,
11981 NULL, BGP_EXT_COM_ETREE_FLAG_RESERVED, NULL, HFILL }},
11982 { &hf_bgp_ext_com_etree_flag_p,
11983 { "P", "bgp.ext_com_etree.flag_p",FT_BOOLEAN, 8,
11984 TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_P, "PE is attached with leaf nodes only", HFILL }},
11985 { &hf_bgp_ext_com_etree_flag_v,
11986 { "V", "bgp.ext_com_etree.flag_v",FT_BOOLEAN, 8,
11987 TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_V, "VLAN mapping", HFILL }},
11988 { &hf_bgp_ext_com_evpn_mmac_flag,
11989 { "Flags", "bgp.ext_com_evpn.mmac.flags", FT_UINT8, BASE_HEX,
11990 NULL, 0x0, "MAC Mobility flags", HFILL }},
11991 { &hf_bgp_ext_com_evpn_mmac_flag_sticky,
11992 { "Sticky/Static MAC", "bgp.ext_com_evpn.mmac.flags.sticky", FT_BOOLEAN, 8,
11993 TFS(&tfs_yes_no), BGP_EXT_COM_EVPN_MMAC_STICKY, "Indicates whether the MAC address is fixed or movable", HFILL }},
11994 { &hf_bgp_ext_com_evpn_mmac_seq,
11995 { "Sequence number", "bgp.ext_com_evpn.mmac.seq", FT_UINT32, BASE_DEC,
11996 NULL, 0x0, "MAC Mobility Update Sequence number", HFILL }},
11997 { &hf_bgp_ext_com_evpn_esirt,
11998 { "ES-Import Route Target", "bgp.ext_com_evpn.esi.rt", FT_ETHER, BASE_NONE,
11999 NULL, 0x0, "Route Target as a MAC Address", HFILL }},
12000 { &hf_bgp_ext_com_evpn_routermac,
12001 { "Router MAC", "bgp.ext_com_evpn.esi.router_mac", FT_ETHER, BASE_NONE,
12002 NULL, 0x0, "Router MAC Address", HFILL }},
12003 { &hf_bgp_ext_com_evpn_l2attr_flags,
12004 { "Flags", "bgp.ext_com_evpn.l2attr.flags", FT_UINT16, BASE_HEX,
12005 NULL, 0x0, "EVPN L2 attribute flags", HFILL }},
12006 { &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
12007 { "Reserved", "bgp.ext_com_evpn.l2attr.flag_reserved", FT_UINT16, BASE_HEX,
12008 NULL, BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED, NULL, HFILL }},
12009 { &hf_bgp_ext_com_evpn_l2attr_flag_ci,
12010 { "CI flag", "bgp.ext_com_evpn.l2attr.flag_ci", FT_BOOLEAN, 16,
12011 TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI, "Control Word Indicator Extended Community can be advertised", HFILL }},
12012 { &hf_bgp_ext_com_evpn_l2attr_flag_f,
12013 { "F flag", "bgp.ext_com_evpn.l2attr.flag_f", FT_BOOLEAN, 16,
12014 TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_F, "PE is capable to send and receive flow label", HFILL }},
12015 { &hf_bgp_ext_com_evpn_l2attr_flag_c,
12016 { "C flag", "bgp.ext_com_evpn.l2attr.flag_c", FT_BOOLEAN, 16,
12017 TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_C, "Control word must be present when sending EVPN packets to this PE", HFILL }},
12018 { &hf_bgp_ext_com_evpn_l2attr_flag_p,
12019 { "P flag", "bgp.ext_com_evpn.l2attr.flag_p", FT_BOOLEAN, 16,
12020 TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_P, "Primary PE", HFILL }},
12021 { &hf_bgp_ext_com_evpn_l2attr_flag_b,
12022 { "B flag", "bgp.ext_com_evpn.l2attr.flag_b", FT_BOOLEAN, 16,
12023 TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_B, "Backup PE", HFILL }},
12024 { &hf_bgp_ext_com_evpn_l2attr_l2_mtu,
12025 { "L2 MTU", "bgp.ext_com_evpn.l2attr.l2_mtu", FT_UINT16, BASE_DEC,
12026 NULL, 0x0, NULL, HFILL }},
12027 { &hf_bgp_ext_com_evpn_l2attr_reserved,
12028 { "Reserved", "bgp.ext_com_evpn.l2attr.reserved", FT_BYTES, BASE_NONE,
12029 NULL, 0x0, NULL, HFILL }},
12030 { &hf_bgp_ext_com_evpn_etree_flags,
12031 { "Flags", "bgp.ext_com_evpn.etree.flags", FT_UINT8, BASE_HEX,
12032 NULL, 0x0, "EVPN E-Tree attribute flags", HFILL }},
12033 { &hf_bgp_ext_com_evpn_etree_flag_reserved,
12034 { "Reserved", "bgp.ext_com_evpn.etree.flag_reserved", FT_UINT8, BASE_HEX,
12035 NULL, BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED, NULL, HFILL }},
12036 { &hf_bgp_ext_com_evpn_etree_flag_l,
12037 { "L flag", "bgp.ext_com_evpn.etree.flag_l", FT_BOOLEAN, 8,
12038 TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_ETREE_FLAG_L, "Leaf-Indication", HFILL }},
12039 { &hf_bgp_ext_com_evpn_etree_reserved,
12040 { "Reserved", "bgp.ext_com_evpn.etree.reserved", FT_BYTES, BASE_NONE,
12041 NULL, 0x0, NULL, HFILL }},
12042 /* BGP Cost Community */
12043 { &hf_bgp_ext_com_cost_poi,
12044 { "Point of insertion", "bgp.ext_com_cost.poi", FT_UINT8, BASE_DEC,
12045 VALS(bgpext_com_cost_poi_type), 0x0, "Placement of the Cost value in the BGP Best Path algorithm", HFILL }},
12046 { &hf_bgp_ext_com_cost_cid,
12047 { "Community ID", "bgp.ext_com_cost.cid", FT_UINT8, BASE_DEC,
12048 NULL, 0x0, "Community instance ID to distinguish between multiple Cost communities", HFILL }},
12049 { &hf_bgp_ext_com_cost_cost,
12050 { "Cost", "bgp.ext_com_cost.cost", FT_UINT32, BASE_DEC,
12051 NULL, 0x0, "Cost value", HFILL }},
12052 { &hf_bgp_ext_com_cost_cid_rep,
12053 { "Cost use", "bgp.ext_com_cost.cid.use", FT_BOOLEAN, 8,
12054 TFS(&tfs_cost_replace), BGP_EXT_COM_COST_CID_REP, "Indicates whether the Cost value will replace the original attribute value", HFILL }},
12055 /* EIGRP Route Metrics Extended Communities */
12056 { &hf_bgp_ext_com_stype_tr_exp_eigrp,
12057 { "Route Attributes", "bgp.ext_com_eigrp", FT_UINT8, BASE_DEC,
12058 VALS(bgpext_com_stype_tr_eigrp), 0x0, "Original EIGRP route attributes", HFILL }},
12059 { &hf_bgp_ext_com_eigrp_flags,
12060 { "Route flags", "bgp.ext_com_eigrp.flags", FT_UINT16, BASE_HEX,
12061 NULL, 0x0, "EIGRP Route flags bitfield", HFILL }},
12062 { &hf_bgp_ext_com_eigrp_flags_rt,
12063 { "Route type", "bgp.ext_com_eigrp.flags.rt", FT_BOOLEAN, 16,
12064 TFS(&tfs_eigrp_rtype), BGP_EXT_COM_EXP_EIGRP_FLAG_RT, "Original EIGRP route type (internal/external)", HFILL }},
12065 { &hf_bgp_ext_com_eigrp_rtag,
12066 { "Route tag", "bgp.ext_com_eigrp.rtag", FT_UINT32, BASE_DEC,
12067 NULL, 0x0, "Original EIGRP route tag", HFILL }},
12068 { &hf_bgp_ext_com_eigrp_asn,
12069 { "AS Number", "bgp.ext_com_eigrp.asn", FT_UINT16, BASE_DEC,
12070 NULL, 0x0, "Original EIGRP Autonomous System Number this route comes from", HFILL }},
12071 { &hf_bgp_ext_com_eigrp_delay,
12072 { "Delay", "bgp.ext_com_eigrp.dly", FT_UINT32, BASE_DEC,
12073 NULL, 0x0, "Original EIGRP route delay metric", HFILL }},
12074 { &hf_bgp_ext_com_eigrp_rly,
12075 { "Reliability", "bgp.ext_com_eigrp.rly", FT_UINT8, BASE_DEC,
12076 NULL, 0x0, "Original EIGRP route reliability metric", HFILL }},
12077 { &hf_bgp_ext_com_eigrp_hops,
12078 { "Hop count", "bgp.ext_com_eigrp.hops", FT_UINT8, BASE_DEC,
12079 NULL, 0x0, "Original EIGRP route hop count", HFILL }},
12080 { &hf_bgp_ext_com_eigrp_bw,
12081 { "Bandwidth", "bgp.ext_com_eigrp.bw", FT_UINT32, BASE_DEC,
12082 NULL, 0x0, "Original EIGRP route bandwidth metric", HFILL }},
12083 { &hf_bgp_ext_com_eigrp_load,
12084 { "Load", "bgp.ext_com_eigrp.load", FT_UINT8, BASE_DEC,
12085 NULL, 0x0, "Original EIGRP route load metric", HFILL }},
12086 { &hf_bgp_ext_com_eigrp_mtu,
12087 { "MTU", "bgp.ext_com_eigrp.mtu", FT_UINT32, BASE_DEC,
12088 NULL, 0x0, "Original EIGRP route path MTU", HFILL }},
12089 { &hf_bgp_ext_com_eigrp_rid,
12090 { "Router ID", "bgp.ext_com_eigrp.rid", FT_IPv4, BASE_NONE,
12091 NULL, 0x0, "EIGRP Router ID of the router that originated the route", HFILL }},
12092 { &hf_bgp_ext_com_eigrp_e_asn,
12093 { "External AS Number", "bgp.ext_com_eigrp.e_asn", FT_UINT16, BASE_DEC,
12094 NULL, 0x0, "Original AS Number of the route before its redistribution into EIGRP", HFILL }},
12095 { &hf_bgp_ext_com_eigrp_e_rid,
12096 { "External Router ID", "bgp.ext_com_eigrp.e_rid", FT_IPv4, BASE_NONE,
12097 NULL, 0x0, "EIGRP Router ID of the router that redistributed this route into EIGRP", HFILL }},
12098 { &hf_bgp_ext_com_eigrp_e_pid,
12099 { "External protocol", "bgp.ext_com_eigrp.e_pid", FT_UINT16, BASE_DEC,
12100 VALS(eigrp_proto2string), 0x0, "Original routing protocol from which this route was redistributed into EIGRP", HFILL }},
12101 { &hf_bgp_ext_com_eigrp_e_m,
12102 { "External metric", "bgp.ext_com_eigrp.e_metric", FT_UINT32, BASE_DEC,
12103 NULL, 0x0, "Original metric of the route before its redistribution into EIGRP", HFILL }},
12104 /* idr-ls-03 */
12105 { &hf_bgp_ls_type,
12106 { "Type", "bgp.ls.type", FT_UINT16, BASE_DEC,
12107 NULL, 0x0, "BGP-LS message type", HFILL }},
12108 { &hf_bgp_ls_length,
12109 { "Length", "bgp.ls.length", FT_UINT16, BASE_DEC,
12110 NULL, 0x0, "The total length of the message payload in octets", HFILL }},
12111 { &hf_bgp_ls_nlri,
12112 { "BGP-LS NLRI", "bgp.ls.nlri", FT_NONE,
12113 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12114 { &hf_bgp_ls_safi128_nlri,
12115 { "Link State SAFI 128 NLRI", "bgp.ls.nlri_safi128", FT_NONE,
12116 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12117 { &hf_bgp_ls_safi128_nlri_route_distinguisher,
12118 { "Route Distinguisher", "bgp.ls.nlri_safi128_route_distinguisher", FT_NONE,
12119 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12120 { &hf_bgp_ls_safi128_nlri_route_distinguisher_type,
12121 { "Route Distinguisher Type", "bgp.ls.nlri_safi128_route_distinguisher_type", FT_UINT16,
12122 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12123 { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
12124 { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_2", FT_UINT16,
12125 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12126 { &hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
12127 { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_ipv4", FT_IPv4,
12128 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12129 { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
12130 { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_4", FT_UINT32,
12131 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12132 { &hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
12133 { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_2", FT_UINT16,
12134 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12135 { &hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
12136 { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_4", FT_UINT32,
12137 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12138 { &hf_bgp_ls_nlri_type,
12139 { "NLRI Type", "bgp.ls.nlri_type", FT_UINT16,
12140 BASE_DEC, VALS(bgp_ls_nlri_type_vals), 0x0, NULL, HFILL}},
12141 { &hf_bgp_ls_nlri_length,
12142 { "NLRI Length", "bgp.ls.nlri_length", FT_UINT16,
12143 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12144 { &hf_bgp_ls_nlri_link_nlri_type,
12145 { "Link-State NLRI Link NLRI", "bgp.ls.nlri_link", FT_NONE,
12146 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12147 { &hf_bgp_ls_nlri_link_descriptors_tlv,
12148 { "Link Descriptors TLV", "bgp.ls.nlri_link_descriptors_tlv", FT_NONE,
12149 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12150 { &hf_bgp_ls_nlri_prefix_descriptors_tlv,
12151 { "Prefix Descriptors TLV", "bgp.ls.nlri_prefix_descriptors_tlv", FT_NONE,
12152 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12153 { &hf_bgp_ls_nlri_link_local_identifier,
12154 { "Link Local Identifier", "bgp.ls.nlri_link_local_identifier", FT_UINT32,
12155 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12156 { &hf_bgp_ls_nlri_link_remote_identifier,
12157 { "Link Remote Identifier", "bgp.ls.nlri_link_remote_identifier", FT_UINT32,
12158 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12159 { &hf_bgp_ls_nlri_ipv4_interface_address,
12160 { "IPv4 Interface Address", "bgp.ls.nlri_ipv4_interface_address", FT_IPv4,
12161 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12162 { &hf_bgp_ls_nlri_ipv4_neighbor_address,
12163 { "IPv4 Neighbor Address", "bgp.ls.nlri_ipv4_neighbor_address", FT_IPv4,
12164 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12165 { &hf_bgp_ls_nlri_ipv6_interface_address,
12166 { "IPv6 Interface Address", "bgp.ls.nlri_ipv6_interface_address", FT_IPv6,
12167 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12168 { &hf_bgp_ls_nlri_ipv6_neighbor_address,
12169 { "IPv6 Neighbor Address", "bgp.ls.nlri_ipv6_neighbor_address", FT_IPv6,
12170 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12171 { &hf_bgp_ls_nlri_multi_topology_id,
12172 { "Multi Topology ID", "bgp.ls.nlri_multi_topology_id", FT_UINT16,
12173 BASE_DEC_HEX, NULL, 0x0fff, NULL, HFILL}},
12174 { &hf_bgp_ls_nlri_ospf_route_type,
12175 { "OSPF Route Type", "bgp.ls.nlri_ospf_route_type", FT_UINT8,
12176 BASE_DEC, VALS(link_state_prefix_descriptors_ospf_route_type), 0x0, NULL, HFILL}},
12177 { &hf_bgp_ls_nlri_ip_reachability_prefix_ip,
12178 { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip", FT_IPv4,
12179 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12180 { &hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
12181 { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip6", FT_IPv6,
12182 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12183 { &hf_bgp_ls_nlri_node_nlri_type,
12184 { "Link-State NLRI Node NLRI", "bgp.ls.nlri_node", FT_NONE,
12185 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12186 { &hf_bgp_ls_nlri_node_protocol_id,
12187 { "Protocol ID", "bgp.ls.nlri_node.protocol_id", FT_UINT8,
12188 BASE_DEC, VALS(link_state_nlri_protocol_id_values), 0x0, NULL, HFILL }},
12189 { &hf_bgp_ls_nlri_node_identifier,
12190 { "Identifier", "bgp.ls.nlri_node.identifier", FT_UINT64,
12191 BASE_DEC | BASE_VAL64_STRING, VALS64(link_state_nlri_routing_universe_values), 0x0, NULL, HFILL }},
12192 { &hf_bgp_ls_ipv4_topology_prefix_nlri_type,
12193 { "Link-State NLRI IPv4 Topology Prefix", "bgp.ls.ipv4_topology_prefix", FT_NONE,
12194 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12195 { &hf_bgp_ls_ipv6_topology_prefix_nlri_type,
12196 { "Link-State NLRI IPv6 Topology Prefix", "bgp.ls.ipv6_topology_prefix", FT_NONE,
12197 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12198 /* NLRI TLVs */
12199 { &hf_bgp_ls_tlv_local_node_descriptors,
12200 { "Local Node Descriptors TLV", "bgp.ls.tlv.local_node_descriptors", FT_NONE,
12201 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12202 { &hf_bgp_ls_tlv_remote_node_descriptors,
12203 { "Remote Node Descriptors TLV", "bgp.ls.tlv.remote_node_descriptors", FT_NONE,
12204 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12205 { &hf_bgp_ls_tlv_autonomous_system,
12206 { "Autonomous System TLV", "bgp.ls.tlv.autonomous_system", FT_NONE,
12207 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12208 { &hf_bgp_ls_tlv_autonomous_system_id,
12209 { "AS ID", "bgp.ls.tlv.autonomous_system.id", FT_UINT32,
12210 BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
12211 { &hf_bgp_ls_tlv_bgp_ls_identifier,
12212 { "BGP-LS Identifier TLV", "bgp.ls.tlv.bgp_ls_identifier", FT_NONE,
12213 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12214 { &hf_bgp_ls_tlv_bgp_ls_identifier_id,
12215 { "BGP-LS ID", "bgp.ls.tlv.bgp_ls_identifier_id", FT_UINT32,
12216 BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
12217 { &hf_bgp_ls_tlv_area_id,
12218 { "Area ID TLV", "bgp.ls.tlv.area_id", FT_NONE,
12219 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12220 { &hf_bgp_ls_tlv_area_id_id,
12221 { "Area ID", "bgp.ls.tlv.area_id.id", FT_UINT32,
12222 BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
12223 { &hf_bgp_ls_tlv_ipv4_router_id_of_local_node,
12224 { "IPv4 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv4_router_id_of_local_node", FT_NONE,
12225 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12226 { &hf_bgp_ls_tlv_ipv4_router_id_value,
12227 { "IPv4 Router-ID", "bgp.ls.tlv.ipv4_router_id_value", FT_IPv4,
12228 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12229 { &hf_bgp_ls_tlv_ipv6_router_id_of_local_node,
12230 { "IPv6 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv6_router_id_of_local_node", FT_NONE,
12231 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12232 { &hf_bgp_ls_tlv_ipv6_router_id_value,
12233 { "IPv6 Router-ID", "bgp.ls.tlv.ipv6_router_id_of_local_node_value", FT_IPv6,
12234 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12235 { &hf_bgp_ls_tlv_ipv4_router_id_of_remote_node,
12236 { "IPv4 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv4_router_id_of_remote_node", FT_NONE,
12237 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12238 { &hf_bgp_ls_tlv_ipv6_router_id_of_remote_node,
12239 { "IPv6 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv6_router_id_of_remote_node", FT_NONE,
12240 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12241 { &hf_bgp_ls_tlv_link_local_remote_identifiers,
12242 { "Link Local/Remote Identifiers TLV", "bgp.ls.tlv.link_local_remote_identifiers", FT_NONE,
12243 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12244 { &hf_bgp_ls_tlv_ipv4_interface_address,
12245 { "IPv4 interface address TLV", "bgp.ls.tlv.ipv4_interface_address", FT_NONE,
12246 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12247 { &hf_bgp_ls_tlv_ipv4_neighbor_address,
12248 { "IPv4 neighbor address TLV", "bgp.ls.tlv.ipv4_neighbor_address", FT_NONE,
12249 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12250 { &hf_bgp_ls_tlv_ipv6_interface_address,
12251 { "IPv6 interface address TLV", "bgp.ls.tlv.ipv6_interface_address", FT_NONE,
12252 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12253 { &hf_bgp_ls_tlv_ipv6_neighbor_address,
12254 { "IPv6 neighbor address TLV", "bgp.ls.tlv.ipv6_neighbor_address", FT_NONE,
12255 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12256 { &hf_bgp_ls_tlv_node_msd,
12257 { "Node MSD", "bgp.ls.tlv.node_msd", FT_NONE,
12258 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12259 { &hf_bgp_ls_tlv_link_msd,
12260 { "Link MSD", "bgp.ls.tlv.link_msd", FT_NONE,
12261 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12262 { &hf_bgp_ls_tlv_igp_msd_type,
12263 { "MSD Type", "bgp.ls.tlv.igp_msd_type", FT_UINT8,
12264 BASE_DEC, VALS(igp_msd_types), 0x0, NULL, HFILL }},
12265 { &hf_bgp_ls_tlv_igp_msd_value,
12266 { "MSD Value", "bgp.ls.tlv.igp_msd_value", FT_UINT8,
12267 BASE_DEC, NULL, 0x0, NULL, HFILL }},
12268 { &hf_bgp_ls_tlv_multi_topology_id,
12269 { "Multi Topology ID TLV", "bgp.ls.tlv.multi_topology_id", FT_NONE,
12270 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12271 { &hf_bgp_ls_tlv_ospf_route_type,
12272 { "OSPF Route Type TLV", "bgp.ls.tlv.ospf_route_type", FT_NONE,
12273 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12274 { &hf_bgp_ls_tlv_ip_reachability_information,
12275 { "IP Reachability Information TLV", "bgp.ls.tlv.ip_reachability_information", FT_NONE,
12276 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12277 { &hf_bgp_ls_tlv_administrative_group_color,
12278 { "Administrative group (color) TLV", "bgp.ls.tlv.administrative_group_color", FT_NONE,
12279 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12280 { &hf_bgp_ls_tlv_administrative_group_color_value,
12281 { "Group Mask", "bgp.ls.tlv.administrative_group_color_value", FT_UINT32,
12282 BASE_DEC, NULL, 0xffff, NULL, HFILL}},
12283 { &hf_bgp_ls_tlv_administrative_group,
12284 { "Group", "bgp.ls.tlv.administrative_group", FT_UINT32,
12285 BASE_DEC, NULL, 0xffff, NULL, HFILL}},
12286 { &hf_bgp_ls_tlv_max_link_bandwidth,
12287 { "Maximum link bandwidth TLV", "bgp.ls.tlv.maximum_link_bandwidth", FT_NONE,
12288 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12289 { &hf_bgp_ls_tlv_max_reservable_link_bandwidth,
12290 { "Maximum reservable link bandwidth TLV", "bgp.ls.tlv.maximum_reservable_link_bandwidth", FT_NONE,
12291 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12292 { &hf_bgp_ls_tlv_unreserved_bandwidth,
12293 { "Unreserved bandwidth TLV", "bgp.ls.tlv.unreserved_bandwidth", FT_NONE,
12294 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12295 { &hf_bgp_ls_bandwidth_value,
12296 {"Bandwidth", "bgp.ls.bandwidth_value", FT_FLOAT,
12297 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12298 { &hf_bgp_ls_tlv_te_default_metric,
12299 { "TE Default Metric TLV", "bgp.ls.tlv.te_default_metric", FT_NONE,
12300 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12301 { &hf_bgp_ls_tlv_te_default_metric_value_old,
12302 { "TE Default Metric (old format)", "bgp.ls.tlv.te_default_metric_value", FT_UINT24,
12303 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12304 { &hf_bgp_ls_tlv_te_default_metric_value,
12305 { "TE Default Metric", "bgp.ls.tlv.te_default_metric_value", FT_UINT32,
12306 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12307 { &hf_bgp_ls_tlv_link_protection_type,
12308 { "Link Protection Type TLV", "bgp.ls.tlv.link_protection_type", FT_NONE,
12309 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12310 { &hf_bgp_ls_tlv_link_protection_type_value,
12311 { "Protection Capabilities", "bgp.ls.tlv.link_protection_type_value", FT_UINT8,
12312 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12313 { &hf_bgp_ls_tlv_mpls_protocol_mask,
12314 { "MPLS Protocol Mask TLV", "bgp.ls.tlv.mpls_protocol_mask", FT_NONE,
12315 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12316 { &hf_bgp_ls_tlv_metric,
12317 { "Metric TLV", "bgp.ls.tlv.metric", FT_NONE,
12318 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12319 { &hf_bgp_ls_tlv_metric_value1,
12320 { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT8,
12321 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12322 { &hf_bgp_ls_tlv_metric_value2,
12323 { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT16,
12324 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12325 { &hf_bgp_ls_tlv_metric_value3,
12326 { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT24,
12327 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12328 { &hf_bgp_ls_tlv_shared_risk_link_group,
12329 { "Shared Risk Link Group TLV", "bgp.ls.tlv.shared_risk_link_group", FT_NONE,
12330 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12331 { &hf_bgp_ls_tlv_shared_risk_link_group_value,
12332 { "Shared Risk Link Group Value", "bgp.ls.tlv.shared_risk_link_group_value", FT_UINT32,
12333 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12334 { &hf_bgp_ls_tlv_opaque_link_attribute,
12335 { "Opaque Link Attribute TLV", "bgp.ls.tlv.opaque_link_attribute", FT_NONE,
12336 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12337 { &hf_bgp_ls_tlv_opaque_link_attribute_value,
12338 { "Opaque link attributes", "bgp.ls.tlv.opaque_link_attribute_value", FT_NONE,
12339 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12340 { &hf_bgp_ls_tlv_link_name_attribute,
12341 { "Opaque Link Attribute TLV", "bgp.ls.tlv.link_name_attribute", FT_NONE,
12342 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12343 { &hf_bgp_ls_tlv_link_name_attribute_value,
12344 {"Link Name", "bgp.ls.tlv.link_name_attribute_value", FT_STRING,
12345 STR_ASCII, NULL, 0, NULL, HFILL }},
12346 { &hf_bgp_ls_tlv_igp_flags,
12347 { "IGP Flags TLV", "bgp.ls.tlv.igp_flags", FT_NONE,
12348 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12349 { &hf_bgp_ls_tlv_route_tag,
12350 { "Route Tag TLV", "bgp.ls.tlv.route_tag", FT_NONE,
12351 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12352 { &hf_bgp_ls_tlv_route_tag_value,
12353 { "Route Tag Value", "bgp.ls.tlv.route_tag_value", FT_UINT32,
12354 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12355 { &hf_bgp_ls_tlv_route_extended_tag,
12356 { "Extended Route Tag TLV", "bgp.ls.tlv.route_extended_tag", FT_NONE,
12357 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12358 { &hf_bgp_ls_tlv_route_extended_tag_value,
12359 {"Extended Route Tag", "bgp.ls.tlv.extended_route_tag_value", FT_UINT64,
12360 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12361 { &hf_bgp_ls_tlv_prefix_metric,
12362 { "Prefix Metric TLV", "bgp.ls.tlv.prefix_metric", FT_NONE,
12363 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12364 { &hf_bgp_ls_tlv_prefix_metric_value,
12365 { "Prefix Metric", "bgp.ls.tlv.prefix_metric_value", FT_UINT32,
12366 BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
12367 { &hf_bgp_ls_ospf_forwarding_address,
12368 { "OSPF Forwarding Address TLV", "bgp.ls.tlv.ospf_forwarding_address", FT_NONE,
12369 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12370 { &hf_bgp_ls_ospf_forwarding_address_ipv4_address,
12371 { "OSPF forwarding IPv4 address", "bgp.ls.tlv.ospf_forwarding_address_ipv4", FT_IPv4,
12372 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12373 { &hf_bgp_ls_ospf_forwarding_address_ipv6_address,
12374 { "OSPF forwarding IPv6 address", "bgp.ls.tlv.ospf_forwarding_address_ipv6", FT_IPv6,
12375 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12376 { &hf_bgp_ls_opaque_prefix_attribute,
12377 { "Opaque Prefix Attribute TLV", "bgp.ls.tlv.opaque_prefix_attribute", FT_NONE,
12378 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12379 { &hf_bgp_ls_opaque_prefix_attribute_value,
12380 { "Opaque prefix attributes", "bgp.ls.tlv.opaque_prefix_attribute_value", FT_NONE,
12381 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12382 { &hf_bgp_ls_extended_administrative_group,
12383 { "Extended Administrative Group TLV", "bgp.ls.tlv.extended_administrative_group", FT_NONE,
12384 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12385 { &hf_bgp_ls_extended_administrative_group_value,
12386 { "Extended Administrative Group", "bgp.ls.tlv.extended_administrative_group_value", FT_BYTES,
12387 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12388 { &hf_bgp_ls_tlv_igp_router,
12389 { "IGP Router-ID", "bgp.ls.tlv.igp_router", FT_NONE,
12390 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12391 { &hf_bgp_ls_tlv_igp_router_id,
12392 { "IGP ID", "bgp.ls.tlv.igp_router_id", FT_BYTES,
12393 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12394 { &hf_bgp_ls_tlv_bgp_router_id,
12395 { "BGP Router-ID TLV", "bgp.ls.tlv.bgp_router_id", FT_NONE,
12396 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12397 { &hf_bgp_ls_tlv_bgp_router_id_id,
12398 { "BGP Router-ID", "bgp.ls.tlv.bgp_router_id.id", FT_IPv4,
12399 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12400 { &hf_bgp_ls_tlv_node_flags_bits,
12401 { "Node Flags Bits TLV", "bgp.ls.tlv.node_flags_bits", FT_NONE,
12402 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12403 { &hf_bgp_ls_tlv_opaque_node_properties,
12404 { "Opaque Node Properties TLV", "bgp.ls.tlv.opaque_node_properties", FT_NONE,
12405 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12406 { &hf_bgp_ls_tlv_opaque_node_properties_value,
12407 { "Opaque Node Properties", "bgp.ls.tlv.opaque_node_properties_value", FT_NONE,
12408 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12409 { &hf_bgp_ls_tlv_node_name,
12410 { "Node Name TLV", "bgp.ls.tlv.node_name", FT_NONE,
12411 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12412 { &hf_bgp_ls_tlv_node_name_value,
12413 {"Node name", "bgp.ls.tlv.node_name_value", FT_STRING,
12414 STR_ASCII, NULL, 0, NULL, HFILL }},
12415 { &hf_bgp_ls_tlv_is_is_area_identifier,
12416 { "IS-IS Area Identifier TLV", "bgp.ls.tlv.is_is_area_identifier", FT_NONE,
12417 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12418 { &hf_bgp_ls_tlv_is_is_area_identifier_value,
12419 { "IS-IS Area Identifier", "bgp.ls.tlv.is_is_area_identifier_value", FT_BYTES,
12420 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12421 /* Link Protection Types */
12422 { &hf_bgp_ls_link_protection_type_enhanced,
12423 { "Enhanced", "bgp.ls.link_protection_type.enhanced", FT_BOOLEAN, 8,
12424 TFS(&tfs_capable_not_capable), 0x20, NULL, HFILL }},
12425 { &hf_bgp_ls_link_protection_type_dedicated_1plus1,
12426 { "Dedicated 1+1", "bgp.ls.link_protection_type.dedicated_1plus1", FT_BOOLEAN, 8,
12427 TFS(&tfs_capable_not_capable), 0x10, NULL, HFILL }},
12428 { &hf_bgp_ls_link_protection_type_dedicated_1to1,
12429 { "Dedicated 1:1", "bgp.ls.link_protection_type.dedicated_1colon1", FT_BOOLEAN, 8,
12430 TFS(&tfs_capable_not_capable), 0x08, NULL, HFILL }},
12431 { &hf_bgp_ls_link_protection_type_shared,
12432 { "Shared", "bgp.ls.link_protection_type.shared", FT_BOOLEAN, 8,
12433 TFS(&tfs_capable_not_capable), 0x04, NULL, HFILL }},
12434 { &hf_bgp_ls_link_protection_type_unprotected,
12435 { "Unprotected", "bgp.ls.link_protection_type.unprotected", FT_BOOLEAN, 8,
12436 TFS(&tfs_capable_not_capable), 0x02, NULL, HFILL }},
12437 { &hf_bgp_ls_link_protection_type_extra_traffic,
12438 { "Extra Traffic", "bgp.ls.link_protection_type.extra_traffic", FT_BOOLEAN, 8,
12439 TFS(&tfs_capable_not_capable), 0x01, NULL, HFILL }},
12440 /* MPLS Protocol Mask flags */
12441 { &hf_bgp_ls_mpls_protocol_mask_flag_l,
12442 { "Label Distribution Protocol (LDP)", "bgp.ls.protocol_mask_tlv.mpls_protocol.l", FT_BOOLEAN, 8,
12443 TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
12444 { &hf_bgp_ls_mpls_protocol_mask_flag_r,
12445 { "Extension to RSVP for LSP Tunnels (RSVP-TE)", "bgp.ls.protocol_mask_tlv.mpls_protocol.r", FT_BOOLEAN, 8,
12446 TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
12447 /* IGP Flags TLV */
12448 { &hf_bgp_ls_igp_flags_flag_d,
12449 { "IS-IS Up/Down Bit", "bgp.ls.protocol_mask_tlv.igp_flags_flag_d.d", FT_BOOLEAN, 8,
12450 TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
12451 /* Node Flag Bits TLV flags */
12452 { &hf_bgp_ls_node_flag_bits_overload,
12453 { "Overload Bit", "bgp.ls.node_flag_bits.overload", FT_BOOLEAN, 8,
12454 TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
12455 { &hf_bgp_ls_node_flag_bits_attached,
12456 { "Attached Bit", "bgp.ls.node_flag_bits.attached", FT_BOOLEAN, 8,
12457 TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
12458 { &hf_bgp_ls_node_flag_bits_external,
12459 { "External Bit", "bgp.ls.node_flag_bits.external", FT_BOOLEAN, 8,
12460 TFS(&tfs_set_notset), 0x20, NULL, HFILL}},
12461 { &hf_bgp_ls_node_flag_bits_abr,
12462 { "ABR Bit", "bgp.ls.node_flag_bits.abr", FT_BOOLEAN, 8,
12463 TFS(&tfs_set_notset), 0x10, NULL, HFILL}},
12464 { &hf_bgp_evpn_nlri,
12465 { "EVPN NLRI", "bgp.evpn.nlri", FT_NONE,
12466 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12467 { &hf_bgp_evpn_nlri_rt,
12468 { "Route Type", "bgp.evpn.nlri.rt", FT_UINT8, BASE_DEC,
12469 VALS(evpnrtypevals), 0x0, NULL, HFILL }},
12470 { &hf_bgp_evpn_nlri_len,
12471 { "Length", "bgp.evpn.nlri.len", FT_UINT8,
12472 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12473 { &hf_bgp_evpn_nlri_rd,
12474 { "Route Distinguisher", "bgp.evpn.nlri.rd", FT_BYTES,
12475 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12476 { &hf_bgp_evpn_nlri_esi,
12477 { "ESI", "bgp.evpn.nlri.esi", FT_BYTES,
12478 SEP_COLON, NULL, 0x0, NULL, HFILL }},
12479 { &hf_bgp_evpn_nlri_esi_type,
12480 { "ESI Type", "bgp.evpn.nlri.esi.type", FT_UINT8,
12481 BASE_DEC, VALS(evpn_nlri_esi_type), 0x0, "EVPN ESI type", HFILL }},
12482 { &hf_bgp_evpn_nlri_esi_lacp_mac,
12483 { "CE LACP system MAC", "bgp.evpn.nlri.esi.lacp_mac", FT_ETHER,
12484 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12485 { &hf_bgp_evpn_nlri_esi_portk,
12486 { "LACP port key", "bgp.evpn.nlri.esi.lacp_portkey", FT_UINT16,
12487 BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
12488 { &hf_bgp_evpn_nlri_esi_remain,
12489 { "Remaining bytes", "bgp.evpn.nlri.esi.remaining", FT_BYTES,
12490 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12491 { &hf_bgp_evpn_nlri_esi_reserved,
12492 { "Reserved value all 0xff", "bgp.evpn.nlri.esi.reserved", FT_BYTES,
12493 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12494 { &hf_bgp_evpn_nlri_esi_value,
12495 { "ESI Value", "bgp.evpn.nlri.esi.value", FT_BYTES,
12496 SEP_SPACE, NULL, 0x0, NULL, HFILL }},
12497 { &hf_bgp_evpn_nlri_esi_value_type0,
12498 { "ESI 9 bytes value", "bgp.evpn.nlri.esi.type0", FT_BYTES,
12499 SEP_SPACE, NULL, 0x0, NULL, HFILL }},
12500 { &hf_bgp_evpn_nlri_esi_rb_mac,
12501 { "ESI root bridge MAC", "bgp.evpn.nlri.esi.root_bridge", FT_ETHER,
12502 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12503 { &hf_bgp_evpn_nlri_esi_rbprio,
12504 { "ESI root bridge priority", "bgp.evpn.nlri.esi.rb_prio", FT_UINT16,
12505 BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
12506 { &hf_bgp_evpn_nlri_esi_sys_mac,
12507 { "ESI system MAC", "bgp.evpn.nlri.esi.system_mac", FT_ETHER,
12508 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12509 { &hf_bgp_evpn_nlri_esi_mac_discr,
12510 { "ESI system mac discriminator", "bgp.evpn.nlri.esi.system_mac_discr", FT_BYTES,
12511 SEP_SPACE, NULL, 0x0, NULL, HFILL }},
12512 { &hf_bgp_evpn_nlri_esi_router_id,
12513 { "ESI router ID", "bgp.evpn.nlri.esi.router_id", FT_IPv4,
12514 BASE_NONE, NULL, 0x0, NULL, HFILL }},
12515 { &hf_bgp_evpn_nlri_esi_router_discr,
12516 { "ESI router discriminator", "bgp.evpn.nlri.esi.router_discr", FT_BYTES,
12517 SEP_SPACE, NULL, 0x0, NULL, HFILL }},
12518 { &hf_bgp_evpn_nlri_esi_asn,
12519 { "ESI ASN", "bgp.evpn.nlri.esi.asn", FT_UINT32,
12520 BASE_DEC, NULL, 0x0, NULL, HFILL }},
12521 { &hf_bgp_evpn_nlri_esi_asn_discr,
12522 { "ESI ASN discriminator", "bgp.evpn.nlri.esi.asn_discr", FT_BYTES,
12523 SEP_SPACE, NULL, 0x0, NULL, HFILL }},
12524 { &hf_bgp_evpn_nlri_etag,
12525 { "Ethernet Tag ID", "bgp.evpn.nlri.etag", FT_UINT32,
12526 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12527 { &hf_bgp_evpn_nlri_mpls_ls1,
12528 { "MPLS Label 1", "bgp.evpn.nlri.mpls_ls1", FT_UINT24,
12529 BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
12530 { &hf_bgp_evpn_nlri_mpls_ls2,
12531 { "MPLS Label 2", "bgp.evpn.nlri.mpls_ls2", FT_UINT24,
12532 BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
12533 { &hf_bgp_evpn_nlri_vni,
12534 { "VNI", "bgp.evpn.nlri.vni", FT_UINT24,
12535 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12536 { &hf_bgp_evpn_nlri_maclen,
12537 { "MAC Address Length", "bgp.evpn.nlri.maclen", FT_UINT8,
12538 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12539 { &hf_bgp_evpn_nlri_mac_addr,
12540 { "MAC Address", "bgp.evpn.nlri.mac_addr", FT_ETHER,
12541 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12542 { &hf_bgp_evpn_nlri_iplen,
12543 { "IP Address Length", "bgp.evpn.nlri.iplen", FT_UINT8,
12544 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12545 { &hf_bgp_evpn_nlri_prefix_len,
12546 { "IP prefix length", "bgp.evpn.nlri.prefix_len", FT_UINT8,
12547 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12548 { &hf_bgp_evpn_nlri_ip_addr,
12549 { "IPv4 address", "bgp.evpn.nlri.ip.addr", FT_IPv4,
12550 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12551 { &hf_bgp_evpn_nlri_ipv6_addr,
12552 { "IPv6 address", "bgp.evpn.nlri.ipv6.addr", FT_IPv6,
12553 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12554 { &hf_bgp_evpn_nlri_ipv4_gtw,
12555 { "IPv4 Gateway address", "bgp.evpn.nlri.ipv4.gtw_addr", FT_IPv4,
12556 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12557 { &hf_bgp_evpn_nlri_ipv6_gtw,
12558 { "IPv6 Gateway address", "bgp.evpn.nlri.ipv6.gtw_addr", FT_IPv6,
12559 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12560 /* segment routing extentions to link state */
12561 /* Node Attributes TLVs */
12562 { &hf_bgp_ls_sr_tlv_capabilities,
12563 { "SR Capabilities", "bgp.ls.sr.tlv.capabilities", FT_NONE,
12564 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12565 { &hf_bgp_ls_sr_tlv_capabilities_flags,
12566 { "Flags", "bgp.ls.sr.tlv.capabilities.flags", FT_UINT8,
12567 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12568 { &hf_bgp_ls_sr_tlv_capabilities_flags_i,
12569 { "MPLS IPv4 flag (I)", "bgp.ls.sr.tlv.capabilities.flags.i", FT_BOOLEAN,
12570 8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_I, NULL, HFILL}},
12571 { &hf_bgp_ls_sr_tlv_capabilities_flags_v,
12572 { "MPLS IPv6 flag (V)", "bgp.ls.sr.tlv.capabilities.flags.v", FT_BOOLEAN,
12573 8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_V, NULL, HFILL}},
12574 { &hf_bgp_ls_sr_tlv_capabilities_flags_h,
12575 { "SR-IPv6 flag (H)", "bgp.ls.sr.tlv.capabilities.flags.h", FT_BOOLEAN,
12576 8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_H, NULL, HFILL}},
12577 { &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
12578 { "Reserved", "bgp.ls.sr.tlv.capabilities.flags.reserved", FT_UINT8,
12579 BASE_HEX, NULL, 0x1F, NULL, HFILL}},
12580 { &hf_bgp_ls_sr_tlv_capabilities_range_size,
12581 { "Range Size", "bgp.ls.sr.tlv.capabilities.range_size", FT_UINT24,
12582 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12583 { &hf_bgp_ls_sr_tlv_capabilities_sid_label,
12584 { "From Label", "bgp.ls.sr.tlv.capabilities.sid.label", FT_UINT24,
12585 BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
12586 { &hf_bgp_ls_sr_tlv_capabilities_sid_index,
12587 { "From Index", "bgp.ls.sr.tlv.capabilities.sid.index", FT_UINT32,
12588 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12589 { &hf_bgp_ls_sr_tlv_algorithm,
12590 { "SR Algorithm", "bgp.ls.sr.tlv.algorithm", FT_NONE,
12591 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12592 { &hf_bgp_ls_sr_tlv_algorithm_value,
12593 { "SR Algorithm", "bgp.ls.sr.tlv.algorithm.value", FT_UINT8,
12594 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12595 { &hf_bgp_ls_sr_tlv_local_block,
12596 { "SR Local Block", "bgp.ls.sr.tlv.local_block", FT_NONE,
12597 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12598 { &hf_bgp_ls_sr_tlv_local_block_flags,
12599 { "Flags", "bgp.ls.sr.tlv.local_block.flags", FT_UINT8,
12600 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12601 { &hf_bgp_ls_sr_tlv_local_block_range_size,
12602 { "Range Size", "bgp.ls.sr.tlv.local_block.range_size", FT_UINT24,
12603 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12604 { &hf_bgp_ls_sr_tlv_local_block_sid_label,
12605 { "From Label", "bgp.ls.sr.tlv.local_block.sid.label", FT_UINT24,
12606 BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
12607 { &hf_bgp_ls_sr_tlv_local_block_sid_index,
12608 { "From Index", "bgp.ls.sr.tlv.local_block.sid.index", FT_UINT32,
12609 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12610 { &hf_bgp_ls_sr_tlv_flex_algo_def,
12611 { "Flexible Algorithm Definition TLV", "bgp.ls.sr.tlv.flex_algo", FT_NONE,
12612 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12613 { &hf_bgp_ls_sr_tlv_flex_algo_algorithm,
12614 { "Flex-Algorithm", "bgp.ls.sr.tlv.flex_algo.flex_algorithm", FT_UINT8,
12615 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12616 { &hf_bgp_ls_sr_tlv_flex_algo_metric_type,
12617 { "Metric-Type", "bgp.ls.sr.tlv.flex_algo.metric_type", FT_UINT8,
12618 BASE_DEC, VALS(flex_algo_metric_types), 0x0, NULL, HFILL}},
12619 { &hf_bgp_ls_sr_tlv_flex_algo_calc_type,
12620 { "Calculation-Type", "bgp.ls.sr.tlv.flex_algo.calculation_type", FT_UINT8,
12621 BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
12622 { &hf_bgp_ls_sr_tlv_flex_algo_priority,
12623 { "Priority", "bgp.ls.sr.tlv.flex_algo.priority", FT_UINT8,
12624 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12625 { &hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity,
12626 { "Flex Algo Exclude Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.exclude_any_affinity", FT_NONE,
12627 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12628 { &hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity,
12629 { "Flex Algo Include Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_any_affinity", FT_NONE,
12630 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12631 { &hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity,
12632 { "Flex Algo Include All Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_all_affinity", FT_NONE,
12633 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12634 /* Prefix Attribute TLVs */
12635 { &hf_bgp_ls_sr_tlv_prefix_sid,
12636 { "Prefix SID TLV", "bgp.ls.sr.tlv.prefix.sid", FT_NONE,
12637 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12638 { &hf_bgp_ls_sr_tlv_prefix_sid_flags,
12639 { "Flags", "bgp.ls.sr.tlv.prefix.sid.flags", FT_UINT8,
12640 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12641 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
12642 { "Re-advertisement (R)", "bgp.ls.sr.tlv.prefix.sid.flags.r", FT_BOOLEAN,
12643 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_R, NULL, HFILL}},
12644 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
12645 { "Node-SID (N)", "bgp.ls.sr.tlv.prefix.sid.flags.n", FT_BOOLEAN,
12646 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_N, NULL, HFILL}},
12647 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
12648 { "No-PHP (NP)", "bgp.ls.sr.tlv.prefix.sid.flags.np", FT_BOOLEAN,
12649 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_NP, NULL, HFILL}},
12650 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
12651 { "No-PHP (P)", "bgp.ls.sr.tlv.prefix.sid.flags.p", FT_BOOLEAN,
12652 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_P, NULL, HFILL}},
12653 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
12654 { "Mapping Server Flag (M)", "bgp.ls.sr.tlv.prefix.sid.flags.m", FT_BOOLEAN,
12655 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_M, NULL, HFILL}},
12656 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
12657 { "Explicit-Null (E)", "bgp.ls.sr.tlv.prefix.sid.flags.e", FT_BOOLEAN,
12658 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_E, NULL, HFILL}},
12659 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
12660 { "Value (V)", "bgp.ls.sr.tlv.prefix.sid.flags.v", FT_BOOLEAN,
12661 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_V, NULL, HFILL}},
12662 { &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
12663 { "Local (L)", "bgp.ls.sr.tlv.prefix.sid.flags.l", FT_BOOLEAN,
12664 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_L, NULL, HFILL}},
12665 { &hf_bgp_ls_sr_tlv_prefix_sid_algo,
12666 { "Algorithm", "bgp.ls.sr.tlv.prefix.sid.algo", FT_UINT8,
12667 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12668 { &hf_bgp_ls_sr_tlv_prefix_sid_label,
12669 { "SID/Label", "bgp.ls.sr.tlv.prefix.sid.label", FT_UINT24,
12670 BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
12671 { &hf_bgp_ls_sr_tlv_prefix_sid_index,
12672 { "SID/Index", "bgp.ls.sr.tlv.prefix.sid.index", FT_UINT32,
12673 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12674 { &hf_bgp_ls_sr_tlv_prefix_attr_flags,
12675 { "Prefix Attribute Flags TLV", "bgp.ls.sr.tlv.prefix.attribute_flags", FT_NONE,
12676 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12677 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
12678 { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags", FT_UINT8,
12679 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12680 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
12681 { "Flags", "bgp.ls.sr.tlv_prefix.attribute_flags.flags.unknown", FT_BYTES,
12682 SEP_SPACE, NULL, 0x0,NULL, HFILL }},
12683 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
12684 { "Attach (A)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.a", FT_BOOLEAN,
12685 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO, NULL, HFILL}},
12686 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
12687 { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
12688 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO, NULL, HFILL}},
12689 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
12690 { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
12691 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO, NULL, HFILL}},
12692 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
12693 { "External Prefix (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.x", FT_BOOLEAN,
12694 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI, NULL, HFILL}},
12695 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
12696 { "Re-advertisement (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.r", FT_BOOLEAN,
12697 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI, NULL, HFILL}},
12698 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
12699 { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
12700 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI, NULL, HFILL}},
12701 { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
12702 { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
12703 8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI, NULL, HFILL}},
12704 /* Adjacency Attribute TLVs */
12705 { &hf_bgp_ls_sr_tlv_adjacency_sid,
12706 { "Adjacency SID TLV", "bgp.ls.sr.tlv.adjacency.sid", FT_NONE,
12707 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12708 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags,
12709 { "Flags", "bgp.ls.sr.tlv.adjacency.sid.flags", FT_UINT8,
12710 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12711 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
12712 { "Address-Family flag (F)", "bgp.ls.sr.tlv.adjacency.sid.flags.f", FT_BOOLEAN,
12713 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_FI, NULL, HFILL}},
12714 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
12715 { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
12716 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BO, NULL, HFILL}},
12717 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
12718 { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
12719 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BI, NULL, HFILL}},
12720 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
12721 { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
12722 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VO, NULL, HFILL}},
12723 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
12724 { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
12725 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VI, NULL, HFILL}},
12726 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
12727 { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
12728 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LO, NULL, HFILL}},
12729 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
12730 { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
12731 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LI, NULL, HFILL}},
12732 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_so,
12733 { "Set Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.s", FT_BOOLEAN,
12734 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_SO, NULL, HFILL}},
12735 { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
12736 { "Set Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.s", FT_BOOLEAN,
12737 8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_SI, NULL, HFILL}},
12738 { &hf_bgp_ls_sr_tlv_adjacency_sid_weight,
12739 { "Weight", "bgp.ls.sr.tlv.adjacency.sid.weight", FT_UINT8,
12740 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12741 { &hf_bgp_ls_sr_tlv_adjacency_sid_label,
12742 { "SID/Label", "bgp.ls.sr.tlv.adjacency.sid.label", FT_UINT24,
12743 BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
12744 { &hf_bgp_ls_sr_tlv_adjacency_sid_index,
12745 { "SID/Index", "bgp.ls.sr.tlv.adjacency.sid.index", FT_UINT32,
12746 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12747 { &hf_bgp_ls_sr_tlv_peer_node_sid,
12748 { "PeerNode SID TLV", "bgp.ls.sr.tlv.peer_node.sid", FT_NONE,
12749 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12750 { &hf_bgp_ls_sr_tlv_peer_adj_sid,
12751 { "PeerAdj SID TLV", "bgp.ls.sr.tlv.peer_adj.sid", FT_NONE,
12752 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12753 { &hf_bgp_ls_sr_tlv_peer_set_sid,
12754 { "PeerSet SID TLV", "bgp.ls.sr.tlv.peer_set.sid", FT_NONE,
12755 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12756 { &hf_bgp_ls_sr_tlv_peer_sid_flags,
12757 { "Flags", "bgp.ls.sr.tlv.peer.sid.flags", FT_UINT8,
12758 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12759 { &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
12760 { "Value flag (V)", "bgp.ls.sr.tlv.peer.sid.flags.v", FT_BOOLEAN,
12761 8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_V, NULL, HFILL}},
12762 { &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
12763 { "Local flag (L)", "bgp.ls.sr.tlv.peer.sid.flags.l", FT_BOOLEAN,
12764 8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_L, NULL, HFILL}},
12765 { &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
12766 { "Backup flag (B)", "bgp.ls.sr.tlv.peer.sid.flags.b", FT_BOOLEAN,
12767 8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_B, NULL, HFILL}},
12768 { &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
12769 { "Persistent flag (P)", "bgp.ls.sr.tlv.peer.sid.flags.p", FT_BOOLEAN,
12770 8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_P, NULL, HFILL}},
12771 { &hf_bgp_ls_sr_tlv_peer_sid_weight,
12772 { "Weight", "bgp.ls.sr.tlv.peer.sid.weight", FT_UINT8,
12773 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12774 { &hf_bgp_ls_sr_tlv_peer_sid_label,
12775 { "SID/Label", "bgp.ls.sr.tlv.peer.sid.label", FT_UINT24,
12776 BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
12777 { &hf_bgp_ls_sr_tlv_peer_sid_index,
12778 { "SID/Index", "bgp.ls.sr.tlv.peer.sid.index", FT_UINT32,
12779 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12780 { &hf_bgp_ls_igp_te_metric_flags,
12781 { "TE Metric Flags", "bgp.ls.igp_te_metric.flags", FT_UINT8,
12782 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12783 { &hf_bgp_ls_igp_te_metric_flags_a,
12784 { "Anomalous (A) bit", "bgp.ls.igp_te_metric.flags.a", FT_BOOLEAN,
12785 8, TFS(&tfs_set_notset), BGP_LS_IGP_TE_METRIC_FLAG_A, NULL, HFILL}},
12786 { &hf_bgp_ls_igp_te_metric_flags_reserved,
12787 { "Reserved", "bgp.ls.igp_te_metric.flags.reserved", FT_UINT8,
12788 BASE_HEX, NULL, BGP_LS_IGP_TE_METRIC_FLAG_RESERVED, NULL, HFILL}},
12789 { &hf_bgp_ls_igp_te_metric_delay,
12790 { "Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay", FT_NONE,
12791 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12792 { &hf_bgp_ls_igp_te_metric_delay_value,
12793 { "Delay", "bgp.ls.igp_te_metric.delay_value", FT_UINT24,
12794 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12795 { &hf_bgp_ls_igp_te_metric_delay_min_max,
12796 { "Min/Max Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay_min_max", FT_NONE,
12797 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12798 { &hf_bgp_ls_igp_te_metric_delay_min,
12799 { "Min Delay", "bgp.ls.igp_te_metric.delay_min", FT_UINT24,
12800 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12801 { &hf_bgp_ls_igp_te_metric_delay_max,
12802 { "Max Delay", "bgp.ls.igp_te_metric.delay_max", FT_UINT24,
12803 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12804 { &hf_bgp_ls_igp_te_metric_delay_variation,
12805 { "Unidirectional Delay Variation TLV", "bgp.ls.igp_te_metric.delay_variation", FT_NONE,
12806 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12807 { &hf_bgp_ls_igp_te_metric_delay_variation_value,
12808 { "Delay Variation", "bgp.ls.igp_te_metric.delay_variation_value", FT_UINT24,
12809 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12810 { &hf_bgp_ls_igp_te_metric_link_loss,
12811 { "Unidirectional Link Loss TLV", "bgp.ls.igp_te_metric.link_loss", FT_NONE,
12812 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12813 { &hf_bgp_ls_igp_te_metric_link_loss_value,
12814 { "Link Loss", "bgp.ls.igp_te_metric.link_loss_value", FT_UINT24,
12815 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12816 { &hf_bgp_ls_igp_te_metric_bandwidth_residual,
12817 { "Unidirectional Residual Bandwidth TLV", "bgp.ls.igp_te_metric.residual_bandwidth", FT_NONE,
12818 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12819 { &hf_bgp_ls_igp_te_metric_bandwidth_residual_value,
12820 { "Residual Bandwidth", "bgp.ls.igp_te_metric.residual_bandwidth_value", FT_UINT32,
12821 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12822 { &hf_bgp_ls_igp_te_metric_bandwidth_available,
12823 { "Unidirectional Available Bandwidth TLV", "bgp.ls.igp_te_metric.available_bandwidth", FT_NONE,
12824 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12825 { &hf_bgp_ls_igp_te_metric_bandwidth_available_value,
12826 { "Residual Bandwidth", "bgp.ls.igp_te_metric.available_bandwidth_value", FT_UINT32,
12827 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12828 { &hf_bgp_ls_igp_te_metric_bandwidth_utilized,
12829 { "Unidirectional Utilized Bandwidth TLV", "bgp.ls.igp_te_metric.utilized_bandwidth", FT_NONE,
12830 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12831 { &hf_bgp_ls_igp_te_metric_bandwidth_utilized_value,
12832 { "Utilized Bandwidth", "bgp.ls.igp_te_metric.utilized_bandwidth_value", FT_UINT32,
12833 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12834 { &hf_bgp_ls_igp_te_metric_reserved,
12835 { "Reserved", "bgp.ls.igp_te_metric.reserved", FT_UINT8,
12836 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12837 { &hf_bgp_ls_tlv_app_spec_link_attrs,
12838 { "Application-Specific Link Attributes TLV", "bgp.ls.tlv.application_specific_link_attributes", FT_NONE,
12839 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12840 { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len,
12841 { "SABM Length", "bgp.ls.tlv.application_specific_link_attributes.sabm_length", FT_UINT8,
12842 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12843 { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len,
12844 { "UDABM Length", "bgp.ls.tlv.application_specific_link_attributes.udabm_length", FT_UINT8,
12845 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12846 { &hf_bgp_ls_tlv_app_spec_link_attrs_reserved,
12847 { "Reserved", "bgp.ls.tlv.application_specific_link_attributes.reserved", FT_UINT16,
12848 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12849 { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
12850 { "Standard Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.sabm", FT_UINT32,
12851 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12852 { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
12853 { "RSVP-TE (R)", "bgp.ls.tlv.application_specific_link_attributes.sabm.r", FT_BOOLEAN,
12854 32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R, NULL, HFILL}},
12855 { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
12856 { "Segment Routing Policy (S)", "bgp.ls.tlv.application_specific_link_attributes.sabm.s", FT_BOOLEAN,
12857 32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S, NULL, HFILL}},
12858 { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
12859 { "Loop Free Alternate (F)", "bgp.ls.tlv.application_specific_link_attributes.sabm.f", FT_BOOLEAN,
12860 32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F, NULL, HFILL}},
12861 { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
12862 { "Flexible Algorithm (X)", "bgp.ls.tlv.application_specific_link_attributes.sabm.x", FT_BOOLEAN,
12863 32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X, NULL, HFILL}},
12864 { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
12865 { "User-Defined Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.udabm", FT_BYTES,
12866 SEP_SPACE, NULL, 0x0,NULL, HFILL }},
12867
12868 { &hf_bgp_evpn_nlri_igmp_mc_or_length,
12869 { "Originator Router Length", "bgp.evpn.nlri.or_length", FT_UINT8,
12870 BASE_DEC, NULL, 0x0, NULL, HFILL}},
12871 { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4,
12872 { "Originator Router Address IPv4", "bgp.evpn.nlri.or_addr_ipv4", FT_IPv4,
12873 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12874 { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6,
12875 { "Originator Router Address IPv6", "bgp.evpn.nlri.or_addr_ipv6", FT_IPv6,
12876 BASE_NONE, NULL, 0x0, NULL, HFILL}},
12877 { &hf_bgp_evpn_nlri_igmp_mc_flags,
12878 { "Flags", "bgp.evpn.nlri.igmp_mc_flags", FT_UINT8,
12879 BASE_HEX, NULL, 0x0, NULL, HFILL}},
12880 { &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
12881 { "IGMP Version 1", "bgp.evpn.nlri.igmp_mc_flags.v1", FT_BOOLEAN,
12882 8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V1, NULL, HFILL}},
12883 { &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
12884 { "IGMP Version 2", "bgp.evpn.nlri.igmp_mc_flags.v2", FT_BOOLEAN,
12885 8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V2, NULL, HFILL}},
12886 { &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
12887 { "IGMP Version 3", "bgp.evpn.nlri.igmp_mc_flags.v3", FT_BOOLEAN,
12888 8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V3, NULL, HFILL}},
12889 { &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
12890 { "Group Type (IE Flag)", "bgp.evpn.nlri.igmp_mc_flags.ie", FT_BOOLEAN,
12891 8, TFS(&tfs_exclude_include), EVPN_IGMP_MC_FLAG_IE, "Group Type (Include/Exclude Flag)", HFILL}},
12892 { &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
12893 { "Reserved", "bgp.evpn.nlri.igmp_mc_flags.reserved", FT_UINT8,
12894 BASE_HEX, NULL, EVPN_IGMP_MC_FLAG_RESERVED, NULL, HFILL}}
12895 };
12896
12897 static gint *ett[] = {
12898 &ett_bgp,
12899 &ett_bgp_prefix,
12900 &ett_bgp_unfeas,
12901 &ett_bgp_attrs,
12902 &ett_bgp_attr,
12903 &ett_bgp_attr_flags,
12904 &ett_bgp_mp_nhna,
12905 &ett_bgp_mp_reach_nlri,
12906 &ett_bgp_mp_unreach_nlri,
12907 &ett_bgp_mp_snpa,
12908 &ett_bgp_nlri,
12909 &ett_bgp_open,
12910 &ett_bgp_update,
12911 &ett_bgp_notification,
12912 &ett_bgp_route_refresh,
12913 &ett_bgp_capability,
12914 &ett_bgp_as_path_segment,
12915 &ett_bgp_as_path_segment_asn,
12916 &ett_bgp_communities,
12917 &ett_bgp_community,
12918 &ett_bgp_cluster_list,
12919 &ett_bgp_options,
12920 &ett_bgp_option,
12921 &ett_bgp_cap,
12922 &ett_bgp_extended_communities,
12923 &ett_bgp_extended_community,
12924 &ett_bgp_ext_com_type,
12925 &ett_bgp_extended_com_fspec_redir,
12926 &ett_bgp_ext_com_flags,
12927 &ett_bgp_ext_com_l2_flags,
12928 &ett_bgp_ext_com_etree_flags,
12929 &ett_bgp_ext_com_evpn_mmac_flags,
12930 &ett_bgp_ext_com_evpn_l2attr_flags,
12931 &ett_bgp_ext_com_evpn_etree_flags,
12932 &ett_bgp_ext_com_cost_cid,
12933 &ett_bgp_ext_com_ospf_rt_opt,
12934 &ett_bgp_ext_com_eigrp_flags,
12935 &ett_bgp_ssa,
12936 &ett_bgp_ssa_subtree,
12937 &ett_bgp_orf,
12938 &ett_bgp_orf_entry,
12939 &ett_bgp_mcast_vpn_nlri,
12940 &ett_bgp_flow_spec_nlri,
12941 &ett_bgp_flow_spec_nlri_filter,
12942 &ett_bgp_flow_spec_nlri_op_flags,
12943 &ett_bgp_flow_spec_nlri_tcp,
12944 &ett_bgp_flow_spec_nlri_ff,
12945 &ett_bgp_tunnel_tlv,
12946 &ett_bgp_tunnel_tlv_subtree,
12947 &ett_bgp_tunnel_subtlv,
12948 &ett_bgp_tunnel_subtlv_subtree,
12949 &ett_bgp_link_state,
12950 &ett_bgp_evpn_nlri,
12951 &ett_bgp_evpn_nlri_esi,
12952 &ett_bgp_evpn_nlri_mc,
12953 &ett_bgp_mpls_labels,
12954 &ett_bgp_pmsi_tunnel_id,
12955 &ett_bgp_aigp_attr,
12956 &ett_bgp_large_communities,
12957 &ett_bgp_dpath,
12958 &ett_bgp_prefix_sid_label_index,
12959 &ett_bgp_prefix_sid_ipv6,
12960 &ett_bgp_prefix_sid_originator_srgb,
12961 &ett_bgp_prefix_sid_originator_srgb_block,
12962 &ett_bgp_prefix_sid_originator_srgb_blocks,
12963 &ett_bgp_bgpsec_secure_path,
12964 &ett_bgp_bgpsec_secure_path_segment,
12965 &ett_bgp_bgpsec_signature_block,
12966 &ett_bgp_bgpsec_signature_segment,
12967 &ett_bgp_vxlan,
12968 &ett_bgp_binding_sid,
12969 &ett_bgp_segment_list,
12970 &ett_bgp_prefix_sid_unknown,
12971 &ett_bgp_prefix_sid_srv6_l3vpn,
12972 &ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
12973 &ett_bgp_prefix_sid_srv6_l3vpn_sid_information,
12974 &ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
12975 &ett_bgp_prefix_sid_srv6_l3vpn_sid_structure,
12976 &ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown,
12977 &ett_bgp_prefix_sid_srv6_l3vpn_unknown,
12978 &ett_bgp_prefix_sid_srv6_l2vpn,
12979 &ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
12980 &ett_bgp_prefix_sid_srv6_l2vpn_sid_information,
12981 &ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
12982 &ett_bgp_prefix_sid_srv6_l2vpn_sid_structure,
12983 &ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown,
12984 &ett_bgp_prefix_sid_srv6_l2vpn_unknown,
12985 };
12986 static ei_register_info ei[] = {
12987 { &ei_bgp_marker_invalid, { "bgp.marker_invalid", PI_MALFORMED, PI_ERROR, "Marker is not all ones", EXPFILL }},
12988 { &ei_bgp_cap_len_bad, { "bgp.cap.length.bad", PI_MALFORMED, PI_ERROR, "Capability length is wrong", EXPFILL }},
12989 { &ei_bgp_cap_gr_helper_mode_only, { "bgp.cap.gr.helper_mode_only", PI_REQUEST_CODE, PI_CHAT, "Graceful Restart Capability supported in Helper mode only", EXPFILL }},
12990 { &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }},
12991 { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_MALFORMED, PI_ERROR, "ORFEntry-Unknown", EXPFILL }},
12992 { &ei_bgp_length_invalid, { "bgp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
12993 { &ei_bgp_prefix_length_invalid, { "bgp.prefix_length.invalid", PI_MALFORMED, PI_ERROR, "Prefix length is invalid", EXPFILL }},
12994 { &ei_bgp_afi_type_not_supported, { "bgp.afi_type_not_supported", PI_PROTOCOL, PI_ERROR, "AFI Type not supported", EXPFILL }},
12995 { &ei_bgp_unknown_afi, { "bgp.unknown_afi", PI_PROTOCOL, PI_ERROR, "Unknown Address Family", EXPFILL }},
12996 { &ei_bgp_unknown_safi, { "bgp.unknown_safi", PI_PROTOCOL, PI_ERROR, "Unknown SAFI", EXPFILL }},
12997 { &ei_bgp_unknown_label_vpn, { "bgp.unknown_label", PI_PROTOCOL, PI_ERROR, "Unknown Label VPN", EXPFILL }},
12998 { &ei_bgp_ls_error, { "bgp.ls.error", PI_PROTOCOL, PI_ERROR, "Link State error", EXPFILL }},
12999 { &ei_bgp_ls_warn, { "bgp.ls.warn", PI_PROTOCOL, PI_WARN, "Link State warning", EXPFILL }},
13000 { &ei_bgp_ext_com_len_bad, { "bgp.ext_com.length.bad", PI_PROTOCOL, PI_ERROR, "Extended community length is wrong", EXPFILL }},
13001 { &ei_bgp_evpn_nlri_rt_type_err, { "bgp.evpn.type", PI_MALFORMED, PI_ERROR, "EVPN Route Type is invalid", EXPFILL }},
13002 { &ei_bgp_evpn_nlri_rt_len_err, { "bgp.evpn.len", PI_MALFORMED, PI_ERROR, "EVPN Length is invalid", EXPFILL }},
13003 { &ei_bgp_evpn_nlri_esi_type_err, { "bgp.evpn.esi_type", PI_MALFORMED, PI_ERROR, "EVPN ESI Type is invalid", EXPFILL }},
13004 { &ei_bgp_evpn_nlri_rt4_no_ip, { "bgp.evpn.no_ip", PI_PROTOCOL, PI_NOTE, "IP Address: NOT INCLUDED", EXPFILL }},
13005 { &ei_bgp_attr_pmsi_tunnel_type, { "bgp.attr.pmsi.tunnel_type", PI_PROTOCOL, PI_ERROR, "Unknown Tunnel type", EXPFILL }},
13006 { &ei_bgp_attr_pmsi_opaque_type, { "bgp.attr.pmsi.opaque_type", PI_PROTOCOL, PI_ERROR, "Invalid pmsi opaque type", EXPFILL }},
13007 { &ei_bgp_attr_aigp_type, { "bgp.attr.aigp.type", PI_MALFORMED, PI_NOTE, "Unknown AIGP attribute type", EXPFILL}},
13008 { &ei_bgp_prefix_length_err, { "bgp.prefix.length", PI_MALFORMED, PI_ERROR, "Invalid IPv6 prefix length", EXPFILL}},
13009 { &ei_bgp_attr_as_path_as_len_err, { "bgp.attr.as_path.as_len", PI_UNDECODED, PI_ERROR, "unable to determine 4 or 2 bytes ASN", EXPFILL}},
13010 { &ei_bgp_next_hop_ipv6_scope, { "bgp.next_hop.ipv6.scope", PI_PROTOCOL, PI_WARN, "Invalid IPv6 address scope", EXPFILL}},
13011 { &ei_bgp_next_hop_rd_nonzero, { "bgp.next_hop.rd.nonzero", PI_PROTOCOL, PI_WARN, "Route Distinguisher in Next Hop Network Address nonzero", EXPFILL}},
13012 };
13013
13014 module_t *bgp_module;
13015 expert_module_t* expert_bgp;
13016
13017 static const enum_val_t asn_len[] = {
13018 {"auto-detect", "Auto-detect", 0},
13019 {"2", "2 octet", 2},
13020 {"4", "4 octet", 4},
13021 {NULL, NULL, -1}
13022 };
13023
13024 proto_bgp = proto_register_protocol("Border Gateway Protocol",
13025 "BGP", "bgp");
13026 proto_register_field_array(proto_bgp, hf, array_length(hf));
13027 proto_register_subtree_array(ett, array_length(ett));
13028 expert_bgp = expert_register_protocol(proto_bgp);
13029 expert_register_field_array(expert_bgp, ei, array_length(ei));
13030
13031 bgp_module = prefs_register_protocol(proto_bgp, NULL);
13032 prefs_register_bool_preference(bgp_module, "desegment",
13033 "Reassemble BGP messages spanning multiple TCP segments",
13034 "Whether the BGP dissector should reassemble messages spanning multiple TCP segments."
13035 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
13036 &bgp_desegment);
13037 prefs_register_enum_preference(bgp_module, "asn_len",
13038 "Length of the AS number",
13039 "BGP dissector detect the length of the AS number in AS_PATH attributes automatically or manually (NOTE: Automatic detection is not 100% accurate)",
13040 &bgp_asn_len, asn_len, FALSE);
13041
13042 bgp_handle = register_dissector("bgp", dissect_bgp, proto_bgp);
13043 }
13044
13045 void
proto_reg_handoff_bgp(void)13046 proto_reg_handoff_bgp(void)
13047 {
13048 dissector_add_uint_with_preference("tcp.port", BGP_TCP_PORT, bgp_handle);
13049 }
13050 /*
13051 * Editor modelines - https://www.wireshark.org/tools/modelines.html
13052 *
13053 * Local variables:
13054 * c-basic-offset: 4
13055 * tab-width: 8
13056 * indent-tabs-mode: nil
13057 * End:
13058 *
13059 * ex: set shiftwidth=4 tabstop=8 expandtab:
13060 * :indentSize=4:tabSize=8:noTabs=true:
13061 */
13062