Coverage Report

Created: 2026-06-30 07:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-bgp.c
Line
Count
Source
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
 * RFC9234 Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages
38
 * draft-ietf-idr-dynamic-cap
39
 * draft-ietf-idr-bgp-enhanced-route-refresh-02
40
 * draft-knoll-idr-qos-attribute-03
41
 * draft-nalawade-kapoor-tunnel-safi-05
42
 * draft-ietf-idr-add-paths-04 Additional-Path for BGP-4
43
 * RFC9085 Border Gateway Protocol - Link State (BGP-LS) Extensions for Segment Routing
44
 * draft-ietf-idr-custom-decision-07 BGP Custom Decision Process
45
 * draft-rabadan-l2vpn-evpn-prefix-advertisement IP Prefix Advertisement
46
 *     in EVPN
47
 * RFC8669 Segment Routing Prefix Segment Identifier Extensions for BGP
48
 * http://www.iana.org/assignments/bgp-parameters/ (last updated 2012-04-26)
49
 * RFC8538 Notification Message Support for BGP Graceful Restart
50
 * RFC9251 Internet Group Management Protocol (IGMP) and Multicast Listener
51
 *         Discovery (MLD) Proxies for Ethernet VPN (EVPN)
52
 * draft-ietf-idr-tunnel-encaps-15
53
 * draft-ietf-idr-segment-routing-te-policy-08
54
 * draft-yu-bess-evpn-l2-attributes-04
55
 * draft-ietf-bess-srv6-services-05
56
 * RFC9104 Distribution of Traffic Engineering Extended Administrative Groups
57
           Using the Border Gateway Protocol - Link State
58
 * RFC8365 A Network Virtualization Overlay Solution Using Ethernet VPN (EVPN)
59
 * draft-abraitis-bgp-version-capability-13
60
 * draft-ietf-idr-bgp-bfd-strict-mode
61
 * RFC8654 Extended Message Support for BGP
62
63
 * TODO:
64
 * Destination Preference Attribute for BGP (work in progress)
65
 * RFC1863 A BGP/IDRP Route Server alternative to a full mesh routing
66
 */
67
/* (c) Copyright 2015, Pratik Yeole <pyeole@ncsu.edu>
68
   -  Fixed incorrect decoding of Network Layer Reachability Information (NLRI) in BGP UPDATE message with add-path support
69
 */
70
71
#include "config.h"
72
73
#include <epan/packet.h>
74
#include <epan/prefs.h>
75
#include <epan/expert.h>
76
#include <epan/to_str.h>
77
#include <epan/proto_data.h>
78
#include <epan/tfs.h>
79
#include <epan/exceptions.h>
80
#include <wsutil/str_util.h>
81
#include <epan/iana-info.h>
82
#include "packet-ip.h"
83
#include "packet-tcp.h"
84
#include "packet-ldp.h"
85
#include "packet-bgp.h"
86
#include "packet-eigrp.h"
87
88
void proto_register_bgp(void);
89
void proto_reg_handoff_bgp(void);
90
91
static dissector_handle_t bgp_handle;
92
93
/* #define MAX_STR_LEN 256 */
94
95
/* some handy things to know */
96
1.00k
#define BGP_MAX_PACKET_SIZE            4096
97
13.0k
#define BGP_MAX_PACKET_SIZE_EXTENDED  65535
98
100k
#define BGP_MARKER_SIZE                  16    /* size of BGP marker */
99
39.4k
#define BGP_HEADER_SIZE                  19    /* size of BGP header, including marker */
100
#define BGP_MIN_OPEN_MSG_SIZE            29
101
#define BGP_MIN_UPDATE_MSG_SIZE          23
102
2.42k
#define BGP_MIN_NOTIFICATION_MSG_SIZE    21
103
#define BGP_MIN_KEEPALVE_MSG_SIZE       BGP_HEADER_SIZE
104
14
#define BGP_TCP_PORT                    179
105
53.8k
#define BGP_ROUTE_DISTINGUISHER_SIZE      8
106
107
/* BGP message types */
108
1.39k
#define BGP_OPEN          1
109
33.3k
#define BGP_UPDATE        2
110
15.0k
#define BGP_NOTIFICATION  3
111
863
#define BGP_KEEPALIVE     4
112
14.1k
#define BGP_ROUTE_REFRESH 5
113
2.07k
#define BGP_CAPABILITY    6
114
13.4k
#define BGP_ROUTE_REFRESH_CISCO 0x80
115
116
247k
#define BGP_SIZE_OF_PATH_ATTRIBUTE       2
117
118
119
/* attribute flags, from RFC1771 */
120
61.8k
#define BGP_ATTR_FLAG_OPTIONAL        0x80
121
61.8k
#define BGP_ATTR_FLAG_TRANSITIVE      0x40
122
61.8k
#define BGP_ATTR_FLAG_PARTIAL         0x20
123
61.8k
#define BGP_ATTR_FLAG_EXTENDED_LENGTH 0x10
124
14
#define BGP_ATTR_FLAG_UNUSED          0x0F
125
126
127
/* SSA flags */
128
#define BGP_SSA_TRANSITIVE    0x8000
129
1.55k
#define BGP_SSA_TYPE          0x7FFF
130
131
/* SSA Types */
132
467
#define BGP_SSA_L2TPv3          1
133
8
#define BGP_SSA_mGRE            2
134
145
#define BGP_SSA_IPSec           3
135
147
#define BGP_SSA_MPLS            4
136
201
#define BGP_SSA_L2TPv3_IN_IPSec 5
137
399
#define BGP_SSA_mGRE_IN_IPSec   6
138
139
/* BGP MPLS information */
140
84.8k
#define BGP_MPLS_BOTTOM_L_STACK 0x000001
141
28
#define BGP_MPLS_TRAFFIC_CLASS  0x00000E
142
56
#define BGP_MPLS_LABEL          0xFFFFF0
143
144
/* AS_PATH segment types */
145
13.4k
#define AS_SET             1   /* RFC1771 */
146
2.49k
#define AS_SEQUENCE        2   /* RFC1771 */
147
5.91k
#define AS_CONFED_SET      4   /* RFC1965 has the wrong values, corrected in  */
148
2.75k
#define AS_CONFED_SEQUENCE 3   /* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
149
150
/* BGPsec_PATH attributes */
151
26.7k
#define SEC_PATH_SEG_SIZE 6
152
153
/* OPEN message Optional Parameter types  */
154
231
#define BGP_OPTION_AUTHENTICATION    1   /* RFC1771 */
155
531
#define BGP_OPTION_CAPABILITY        2   /* RFC2842 */
156
217
#define BGP_OPTION_EXTENDED_LEN        255     /* RFC9072 */
157
158
/* https://www.iana.org/assignments/capability-codes/capability-codes.xhtml (last updated 2024-01-23) */
159
/* BGP capability code */
160
875
#define BGP_CAPABILITY_RESERVED                      0  /* RFC5492 */
161
464
#define BGP_CAPABILITY_MULTIPROTOCOL                 1  /* RFC2858 */
162
1.26k
#define BGP_CAPABILITY_ROUTE_REFRESH                 2  /* RFC2918 */
163
717
#define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING   3  /* RFC5291 */
164
#define BGP_CAPABILITY_MULTIPLE_ROUTE_DEST           4  /* RFC8277 Deprecated */
165
488
#define BGP_CAPABILITY_EXTENDED_NEXT_HOP             5  /* RFC5549 */
166
#define BGP_CAPABILITY_EXTENDED_MESSAGE              6  /* draft-ietf-idr-bgp-extended-messages */
167
468
#define BGP_CAPABILITY_BGPSEC                        7  /* RFC8205 */
168
#define BGP_CAPABILITY_MULTIPLE_LABELS               8  /* RFC8277 */
169
283
#define BGP_CAPABILITY_BGP_ROLE                      9  /* RFC9234 */
170
707
#define BGP_CAPABILITY_GRACEFUL_RESTART             64  /* RFC4724 */
171
407
#define BGP_CAPABILITY_4_OCTET_AS_NUMBER            65  /* RFC6793 */
172
#define BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO     66  /* Cisco Dynamic capability*/
173
343
#define BGP_CAPABILITY_DYNAMIC_CAPABILITY           67  /* draft-ietf-idr-dynamic-cap */
174
#define BGP_CAPABILITY_MULTISESSION                 68  /* draft-ietf-idr-bgp-multisession */
175
452
#define BGP_CAPABILITY_ADDITIONAL_PATHS             69  /* [RFC7911] */
176
399
#define BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH       70  /* [RFC7313] */
177
#define BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART  71  /* draft-uttaro-idr-bgp-persistence */
178
1.46k
#define BGP_CAPABILITY_CP_ORF                       72  /* [RFC7543] */
179
210
#define BGP_CAPABILITY_FQDN                         73  /* draft-walton-bgp-hostname-capability */
180
400
#define BGP_CAPABILITY_BFD_STRICT                   74  /* draft-ietf-idr-bgp-bfd-strict-mode */
181
267
#define BGP_CAPABILITY_SOFT_VERSION                 75  /* draft-abraitis-bgp-version-capability */
182
#define BGP_CAPABILITY_PATHS_LIMIT                  76  /* draft-abraitis-idr-addpath-paths-limit */
183
203
#define BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP          77  /* draft-white-linklocal-capability */
184
603
#define BGP_CAPABILITY_ROUTE_REFRESH_CISCO         128  /* Cisco, RFC8810 */
185
#define BGP_CAPABILITY_RPD_CISCO                   129  /* Cisco, RFC8810 */
186
232
#define BGP_CAPABILITY_ORF_CISCO                   130  /* Cisco, RFC8810 */
187
427
#define BGP_CAPABILITY_MULTISESSION_CISCO          131  /* Cisco, RFC8810 */
188
#define BGP_CAPABILITY_FQDN_CISCO                  184  /* Cisco, RFC8810 */
189
#define BGP_CAPABILITY_OPERATIONAL_MSG_CISCO       185  /* Cisco, RFC8810 */
190
191
/* Technically not defined by IANA */
192
23.2k
#define AFNUM_AFI_FOR_L2VPN_INFORMATION_OLD        196
193
194
197
#define BGP_ORF_COMM            0x02 /* unknown */
195
264
#define BGP_ORF_EXTCOMM         0x03 /* unknown */
196
332
#define BGP_ORF_ASPATH          0x04 /* draft-ietf-idr-aspath-orf (expired) */
197
74
#define BGP_ORF_PREFIX          0x40 /* RFC5292 */
198
195
#define BGP_ORF_CP_ORF          0x41 /* RFC7543 */
199
261
#define BGP_ORF_VPN_PREFIX      0x42 /* draft-ietf-idr-vpn-prefix-orf-06 */
200
651
#define BGP_ORF_PREFIX_CISCO    0x80 /* Cisco, same as 0x40 */
201
476
#define BGP_ORF_COMM_CISCO      0x81 /* Cisco */
202
671
#define BGP_ORF_EXTCOMM_CISCO   0x82 /* Cisco */
203
865
#define BGP_ORF_ASPATH_CISCO    0x83 /* Cisco */
204
205
/* RFC5291 */
206
1.76k
#define BGP_ORF_ACTION      0xc0
207
#define BGP_ORF_ADD         0x00
208
#define BGP_ORF_REMOVE      0x01
209
1.75k
#define BGP_ORF_REMOVEALL   0x02
210
211
14
#define BGP_ORF_MATCH       0x20
212
#define BGP_ORF_PERMIT      0x00
213
#define BGP_ORF_DENY        0x01
214
215
/* well-known communities, as defined by IANA  */
216
/* https://www.iana.org/assignments/bgp-well-known-communities/bgp-well-known-communities.xhtml */
217
#define BGP_COMM_GRACEFUL_SHUTDOWN   0xFFFF0000
218
#define BGP_COMM_ACCEPT_OWN          0xFFFF0001
219
#define BGP_COMM_RT_FLTR_XLTD_V4     0xFFFF0002
220
#define BGP_COMM_RT_FLTR_V4          0xFFFF0003
221
#define BGP_COMM_RT_FLTR_XLTD_V6     0xFFFF0004
222
#define BGP_COMM_RT_FLTR_V6          0xFFFF0005
223
#define BGP_COMM_LLGR_STALE          0xFFFF0006
224
#define BGP_COMM_NO_LLGR             0xFFFF0007
225
#define BGP_COMM_ACCEPT_OWN_HOP      0xFFFF0008
226
#define BGP_COMM_STANDBY_PE          0xFFFF0009
227
#define BGP_COMM_BLACKHOLE           0xFFFF029A
228
#define BGP_COMM_NO_EXPORT           0xFFFFFF01
229
#define BGP_COMM_NO_ADVERTISE        0xFFFFFF02
230
#define BGP_COMM_NO_EXPORT_SUBCONFED 0xFFFFFF03
231
#define BGP_COMM_NOPEER              0xFFFFFF04
232
2.19k
#define FOURHEX0                     0x00000000
233
766
#define FOURHEXF                     0xFFFF0000
234
235
/* IANA assigned AS */
236
1.51k
#define BGP_AS_TRANS        23456
237
238
/* attribute types */
239
1.75k
#define BGPTYPE_ORIGIN               1 /* RFC4271           */
240
2.23k
#define BGPTYPE_AS_PATH              2 /* RFC4271           */
241
625
#define BGPTYPE_NEXT_HOP             3 /* RFC4271           */
242
1.50k
#define BGPTYPE_MULTI_EXIT_DISC      4 /* RFC4271           */
243
510
#define BGPTYPE_LOCAL_PREF           5 /* RFC4271           */
244
871
#define BGPTYPE_ATOMIC_AGGREGATE     6 /* RFC4271           */
245
529
#define BGPTYPE_AGGREGATOR           7 /* RFC4271           */
246
579
#define BGPTYPE_COMMUNITIES          8 /* RFC1997           */
247
482
#define BGPTYPE_ORIGINATOR_ID        9 /* RFC4456           */
248
351
#define BGPTYPE_CLUSTER_LIST        10 /* RFC4456           */
249
#define BGPTYPE_DPA                 11 /* DPA (deprecated) [RFC6938]  */
250
#define BGPTYPE_ADVERTISER          12 /* ADVERTISER (historic) (deprecated) [RFC1863][RFC4223][RFC6938] */
251
#define BGPTYPE_RCID_PATH           13 /* RCID_PATH / CLUSTER_ID (historic) (deprecated) [RFC1863][RFC4223][RFC6938] */
252
10.9k
#define BGPTYPE_MP_REACH_NLRI       14 /* RFC4760           */
253
12.6k
#define BGPTYPE_MP_UNREACH_NLRI     15 /* RFC4760           */
254
1.47k
#define BGPTYPE_EXTENDED_COMMUNITY  16 /* RFC4360           */
255
5.54k
#define BGPTYPE_AS4_PATH            17 /* RFC 6793          */
256
1.88k
#define BGPTYPE_AS4_AGGREGATOR      18 /* RFC 6793          */
257
1.19k
#define BGPTYPE_SAFI_SPECIFIC_ATTR  19 /* SAFI Specific Attribute (SSA) (deprecated) draft-kapoor-nalawade-idr-bgp-ssa-00.txt */
258
#define BGPTYPE_CONNECTOR_ATTRIBUTE 20 /* Connector Attribute (deprecated) [RFC6037] */
259
#define BGPTYPE_AS_PATHLIMIT        21 /* AS_PATHLIMIT (deprecated) [draft-ietf-idr-as-pathlimit] */
260
2.63k
#define BGPTYPE_PMSI_TUNNEL_ATTR    22 /* RFC6514 */
261
1.82k
#define BGPTYPE_TUNNEL_ENCAPS_ATTR  23 /* RFC5512 */
262
#define BGPTYPE_TRAFFIC_ENGINEERING 24 /* Traffic Engineering [RFC5543] */
263
#define BGPTYPE_IPV6_ADDR_SPEC_EC   25 /* IPv6 Address Specific Extended Community [RFC5701] */
264
381
#define BGPTYPE_AIGP                26 /* RFC7311 */
265
#define BGPTYPE_PE_DISTING_LABLES   27 /* PE Distinguisher Labels [RFC6514] */
266
#define BGPTYPE_BGP_ENTROPY_LABEL   28 /* BGP Entropy Label Capability Attribute (deprecated) [RFC6790][RFC7447] */
267
2.37k
#define BGPTYPE_LINK_STATE_ATTR     29 /* RFC7752 */
268
#define BGPTYPE_30                  30 /* Deprecated [RFC8093] */
269
#define BGPTYPE_31                  31 /* Deprecated [RFC8093] */
270
494
#define BGPTYPE_LARGE_COMMUNITY     32 /* RFC8092 */
271
777
#define BGPTYPE_BGPSEC_PATH         33 /* BGPsec_PATH [RFC8205] */
272
312
#define BGPTYPE_OTC                 35 /* BGP Only to Customer [RFC9234] */
273
489
#define BGPTYPE_D_PATH              36 /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
274
#define BGPTYPE_SFP_ATTRIBUTE       37 /* SFP Attribute [RFC9015] */
275
#define BGPTYPE_BFD_DISCRIMINATOR   38 /* BFD Discriminator [RFC9026] */
276
#define BGPTYPE_NEXT_HOP_DEP_CAP    39 /* BGP Next Hop Dependent Capabilities draft-ietf-idr-entropy-label-13 */
277
2.12k
#define BGPTYPE_BGP_PREFIX_SID      40 /* BGP Prefix-SID [RFC8669] */
278
2.96k
#define BGPTYPE_LINK_STATE_OLD_ATTR 99 /* squatted value used by at least 2
279
                                          implementations before IANA assignment */
280
1.06k
#define BGPTYPE_ATTR_SET           128 /* RFC6368           */
281
#define BGPTYPE_129                129 /* Deprecated [RFC8093] */
282
#define BGPTYPE_241                241 /* Deprecated [RFC8093] */
283
#define BGPTYPE_242                242 /* Deprecated [RFC8093] */
284
#define BGPTYPE_243                243 /* Deprecated [RFC8093] */
285
286
/*EVPN Route Types */
287
1.83k
#define EVPN_AD_ROUTE                   1
288
4.73k
#define EVPN_MAC_ROUTE                  2
289
1.66k
#define EVPN_INC_MCAST_TREE             3
290
1.35k
#define EVPN_ETH_SEGMENT_ROUTE          4
291
3.46k
#define EVPN_IP_PREFIX_ROUTE            5  /* draft-rabadan-l2vpn-evpn-prefix-advertisement */
292
545
#define EVPN_MC_ETHER_TAG_ROUTE         6  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
293
7.59k
#define EVPN_IGMP_JOIN_ROUTE            7  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
294
6.86k
#define EVPN_IGMP_LEAVE_ROUTE           8  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
295
#define EVPN_PER_REG_I_PMSI_A_D_ROUTE   9  /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
296
47.0k
#define EVPN_S_PMSI_A_D_ROUTE           10 /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
297
#define EVPN_LEAF_A_D_ROUTE             11 /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
298
299
14
#define EVPN_IGMP_MC_FLAG_V1                0x01
300
14
#define EVPN_IGMP_MC_FLAG_V2                0x02
301
14
#define EVPN_IGMP_MC_FLAG_V3                0x04
302
14
#define EVPN_IGMP_MC_FLAG_IE                0x08
303
14
#define EVPN_IGMP_MC_FLAG_RESERVED          0xF0
304
305
/* NLRI type as define in BGP flow spec RFC */
306
2.51k
#define BGPNLRI_FSPEC_DST_PFIX      1 /* RFC 5575         */
307
736
#define BGPNLRI_FSPEC_SRC_PFIX      2 /* RFC 5575         */
308
261
#define BGPNLRI_FSPEC_IP_PROTO      3 /* RFC 5575         */
309
423
#define BGPNLRI_FSPEC_PORT          4 /* RFC 5575         */
310
284
#define BGPNLRI_FSPEC_DST_PORT      5 /* RFC 5575         */
311
3.00k
#define BGPNLRI_FSPEC_SRC_PORT      6 /* RFC 5575         */
312
452
#define BGPNLRI_FSPEC_ICMP_TP       7 /* RFC 5575         */
313
215
#define BGPNLRI_FSPEC_ICMP_CD       8 /* RFC 5575         */
314
1.96k
#define BGPNLRI_FSPEC_TCP_FLAGS     9 /* RFC 5575         */
315
267
#define BGPNLRI_FSPEC_PCK_LEN      10 /* RFC 5575         */
316
1.23k
#define BGPNLRI_FSPEC_DSCP         11 /* RFC 5575         */
317
1.24k
#define BGPNLRI_FSPEC_FRAGMENT     12 /* RFC 5575         */
318
319
/* BGP flow spec NLRI operator bitmask */
320
482k
#define BGPNLRI_FSPEC_END_OF_LST         0x80
321
486k
#define BGPNLRI_FSPEC_AND_BIT            0x40
322
14
#define BGPNLRI_FSPEC_VAL_LEN            0x30
323
14
#define BGPNLRI_FSPEC_UNUSED_BIT4        0x08
324
14
#define BGPNLRI_FSPEC_UNUSED_BIT5        0x04
325
486k
#define BGPNLRI_FSPEC_LESS_THAN          0x04
326
486k
#define BGPNLRI_FSPEC_GREATER_THAN       0x02
327
486k
#define BGPNLRI_FSPEC_EQUAL              0x01
328
14
#define BGPNLRI_FSPEC_TCPF_NOTBIT        0x02
329
14
#define BGPNLRI_FSPEC_TCPF_MATCHBIT      0x01
330
28
#define BGPNLRI_FSPEC_DSCP_BITMASK       0x3F
331
332
/* BGP flow spec specific filter value: TCP flags, Packet fragment ... */
333
294k
#define BGPNLRI_FSPEC_TH_FIN  0x01
334
294k
#define BGPNLRI_FSPEC_TH_SYN  0x02
335
294k
#define BGPNLRI_FSPEC_TH_RST  0x04
336
294k
#define BGPNLRI_FSPEC_TH_PUSH 0x08
337
294k
#define BGPNLRI_FSPEC_TH_ACK  0x10
338
294k
#define BGPNLRI_FSPEC_TH_URG  0x20
339
14
#define BGPNLRI_FSPEC_TH_ECN  0x40
340
14
#define BGPNLRI_FSPEC_TH_CWR  0x80
341
342
43.8k
#define BGPNLRI_FSPEC_FG_DF   0x01
343
43.8k
#define BGPNLRI_FSPEC_FG_ISF  0x02
344
43.8k
#define BGPNLRI_FSPEC_FG_FF   0x04
345
43.8k
#define BGPNLRI_FSPEC_FG_LF   0x08
346
347
/* Extended community type */
348
/* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
349
/* BGP transitive extended community type high octet */
350
/* Range 0x00-0x3f First Come First Served */
351
/* Range 0x80-0x8f Reserved for Experimental */
352
/* Range 0x90-0xbf Standards Action */
353
354
14
#define BGP_EXT_COM_TYPE_AUTH               0x80    /* FCFS or Standard/Early/Experimental allocated */
355
14
#define BGP_EXT_COM_TYPE_TRAN               0x40    /* Non-transitive or Transitive */
356
357
568
#define BGP_EXT_COM_TYPE_HIGH_TR_AS2        0x00    /* Transitive Two-Octet AS-Specific Extended Community */
358
248
#define BGP_EXT_COM_TYPE_HIGH_TR_IP4        0x01    /* Transitive IPv4-Address-specific Extended Community */
359
91
#define BGP_EXT_COM_TYPE_HIGH_TR_AS4        0x02    /* Transitive Four-Octet AS-Specific Extended Community */
360
578
#define BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE     0x03    /* Transitive Opaque Extended Community */
361
76
#define BGP_EXT_COM_TYPE_HIGH_TR_QOS        0x04    /* QoS Marking [Thomas_Martin_Knoll] */
362
94
#define BGP_EXT_COM_TYPE_HIGH_TR_COS        0x05    /* CoS Capability [Thomas_Martin_Knoll] */
363
609
#define BGP_EXT_COM_TYPE_HIGH_TR_EVPN       0x06    /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
364
#define BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I     0x07    /* FlowSpec Transitive Extended Communities [draft-ietf-idr-flowspec-interfaceset] */
365
13
#define BGP_EXT_COM_TYPE_HIGH_TR_FLOW       0x08    /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
366
#define BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R     0x09    /* FlowSpec Redirect to indirection-id Extended Community [draft-ietf-idr-flowspec-path-redirect] */
367
#define BGP_EXT_COM_TYPE_HIGH_TR_TP_CLASS   0x0a    /* Transitive Transport Class [draft-ietf-idr-bgp-ct-30] */
368
#define BGP_EXT_COM_TYPE_HIGH_TR_SFC        0x0b    /* Transitive SFC [RFC9015] */
369
140
#define BGP_EXT_COM_TYPE_HIGH_TR_MUP        0x0c    /* Transitive MUP Extended Community */
370
682
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT        0x80    /* Generic Transitive Extended Community [RFC7153][RFC9184] */
371
201
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT_2      0x81    /* Generic Transitive Extended Community Part 2 [RFC8955][RFC9184] */
372
181
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT_3      0x82    /* Generic Transitive Extended Community Part 3 [RFC8955][RFC9184] */
373
885
#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 */
374
375
/* BGP non transitive extended community type high octet */
376
/* 0x40-0x7f First Come First Served */
377
/* 0xc0-0xcf Reserved for Experimental Use (see [RFC4360]) */
378
/* 0xd0-0xff Standards Action */
379
/* 0x45-0x7f Unassigned */
380
170
#define BGP_EXT_COM_TYPE_HIGH_NTR_AS2       0x40    /* Non-Transitive Two-Octet AS-Specific Extended Community [RFC7153] */
381
68
#define BGP_EXT_COM_TYPE_HIGH_NTR_IP4       0x41    /* Non-Transitive IPv4-Address-specific Extended Community [RFC7153] */
382
73
#define BGP_EXT_COM_TYPE_HIGH_NTR_AS4       0x42    /* Non-Transitive Four-Octet AS-Specific Extended Community [RFC7153] */
383
170
#define BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE    0x43    /* Non-Transitive Opaque Extended Community [RFC7153] */
384
144
#define BGP_EXT_COM_TYPE_HIGH_NTR_QOS       0x44    /* QoS Marking [Thomas_Martin_Knoll] */
385
#define BGP_EXT_COM_TYPE_HIGH_NTR_FLOWSPEC  0x47    /* FlowSpec Non-Transitive Extended Communities [draft-ietf-idr-flowspec-interfaceset] */
386
#define BGP_EXT_COM_TYPE_HIGH_NTR_TRANSPORT 0x4a    /* Non-Transitive Transport Class [draft-ietf-idr-bgp-ct-30] */
387
388
/* EVPN Extended Community Sub-Types */
389
76
#define BGP_EXT_COM_STYPE_EVPN_MMAC         0x00    /* MAC Mobility [draft-ietf-l2vpn-pbb-evpn] */
390
71
#define BGP_EXT_COM_STYPE_EVPN_LABEL        0x01    /* ESI MPLS Label [draft-ietf-l2vpn-evpn] */
391
90
#define BGP_EXT_COM_STYPE_EVPN_IMP          0x02    /* ES Import [draft-sajassi-l2vpn-evpn-segment-route] */
392
68
#define BGP_EXT_COM_STYPE_EVPN_ROUTERMAC    0x03    /* draft-sajassi-l2vpn-evpn-inter-subnet-forwarding */
393
68
#define BGP_EXT_COM_STYPE_EVPN_L2ATTR       0x04    /* RFC 8214 */
394
67
#define BGP_EXT_COM_STYPE_EVPN_ETREE        0x05    /* RFC 8317 */
395
#define BGP_EXT_COM_STYPE_EVPN_DF           0x06    /* RFC 8584 */
396
#define BGP_EXT_COM_STYPE_EVPN_ISID         0x07    /* draft-sajassi-bess-evpn-virtual-eth-segment */
397
#define BGP_EXT_COM_STYPE_EVPN_ND           0x08    /* draft-snr-bess-evpn-na-flags */
398
#define BGP_EXT_COM_STYPE_EVPN_MCFLAGS      0x09    /* draft-ietf-bess-evpn-igmp-mld-proxy */
399
#define BGP_EXT_COM_STYPE_EVPN_EVIRT0       0x0a    /* draft-ietf-bess-evpn-igmp-mld-proxy */
400
#define BGP_EXT_COM_STYPE_EVPN_EVIRT1       0x0b    /* draft-ietf-bess-evpn-igmp-mld-proxy */
401
#define BGP_EXT_COM_STYPE_EVPN_EVIRT2       0x0c    /* draft-ietf-bess-evpn-igmp-mld-proxy */
402
#define BGP_EXT_COM_STYPE_EVPN_EVIRT3       0x0d    /* draft-ietf-bess-evpn-igmp-mld-proxy */
403
#define BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT   0x0e    /* draft-sajassi-bess-evpn-ac-aware-bundling */
404
#define BGP_EXT_COM_STYPE_EVPN_SVC_CARV_TS  0x0f    /* draft-ietf-bess-evpn-fast-df-recovery */
405
#define BGP_EXT_COM_STYPE_EVPN_LINK_BW      0x10    /* draft-ietf-bess-evpn-unequal-lb */
406
#define BGP_EXT_COM_STYPE_EVPN_RT_EC        0x15    /* draft-zzhang-idr-rt-derived-community */
407
408
/* RFC 7432 Flag single active mode */
409
85
#define BGP_EXT_COM_ESI_LABEL_FLAGS         0x01    /* bitmask: set for single active multi-homing site */
410
411
/* RFC 7432 Flag Sticky/Static MAC */
412
90
#define BGP_EXT_COM_EVPN_MMAC_STICKY        0x01    /* Bitmask: Set for sticky/static MAC address */
413
414
/* RFC 8214 Flags EVPN L2 Attributes */
415
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_B         0x0001  /* Backup PE */
416
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_P         0x0002  /* Primary PE */
417
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_C         0x0004  /* Control word required */
418
/* draft-yu-bess-evpn-l2-attributes-04 */
419
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_F         0x0008  /* Send and receive flow label */
420
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI        0x0010  /* CWI extended community can be included */
421
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED  0xFFE0  /* Reserved */
422
423
/* RFC 8317 Flags EVPN E-Tree Attributes */
424
14
#define BGP_EXT_COM_EVPN_ETREE_FLAG_L         0x01  /* Leaf-Indication */
425
14
#define BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED  0xFE  /* Reserved */
426
427
/* EPVN route AD NLRI ESI type */
428
1.87k
#define BGP_NLRI_EVPN_ESI_VALUE             0x00    /* ESI type 0, 9 bytes integer */
429
483
#define BGP_NLRI_EVPN_ESI_LACP              0x01    /* ESI type 1, LACP 802.1AX */
430
429
#define BGP_NLRI_EVPN_ESI_MSTP              0x02    /* ESI type 2, MSTP defined ESI */
431
486
#define BGP_NLRI_EVPN_ESI_MAC               0x03    /* ESI type 3, MAC allocated value */
432
4.84k
#define BGP_NLRI_EVPN_ESI_RID               0x04    /* ESI type 4, Router ID as ESI */
433
232
#define BGP_NLRI_EVPN_ESI_ASN               0x05    /* ESI type 5, ASN as ESI */
434
508
#define BGP_NLRI_EVPN_ESI_RES               0xFF    /* ESI 0xFF reserved */
435
436
437
/* Transitive Two-Octet AS-Specific Extended Community Sub-Types */
438
#define BGP_EXT_COM_STYPE_AS2_RT        0x02    /* Route Target [RFC4360] */
439
#define BGP_EXT_COM_STYPE_AS2_RO        0x03    /* Route Origin [RFC4360] */
440
//#define BGP_EXT_COM_STYPE_AS2_LBW       0x04    /* Juniper Transitive Link Bandwidth */
441
#define BGP_EXT_COM_STYPE_AS2_OSPF_DID  0x05    /* OSPF Domain Identifier [RFC4577] */
442
#define BGP_EXT_COM_STYPE_AS2_RT_AGG_P  0x06    /* Route Aggregation Parameter */
443
#define BGP_EXT_COM_STYPE_AS2_DCOLL     0x08    /* BGP Data Collection [RFC4384] */
444
#define BGP_EXT_COM_STYPE_AS2_SRC_AS    0x09    /* Source AS [RFC6514] */
445
#define BGP_EXT_COM_STYPE_AS2_L2VPN     0x0a    /* L2VPN Identifier [RFC6074] */
446
#define BGP_EXT_COM_STYPE_AS2_CVPND     0x10    /* Cisco VPN-Distinguisher [Eric_Rosen] */
447
#define BGP_EXT_COM_STYPE_AS2_RT_REC    0x13    /* Route-Target Record [draft-ietf-bess-service-chaining] */
448
#define BGP_EXT_COM_STYPE_AS2_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community] */
449
//#define BGP_EXT_COM_STYPE_AS2_VNI       0x80    /* Virtual-Network Identifier Extended Community */
450
451
/* Non-Transitive Two-Octet AS-Specific Extended Community Sub-Types */
452
66
#define BGP_EXT_COM_STYPE_AS2_LBW       0x04    /* Link Bandwidth Extended Community [draft-ietf-idr-link-bandwidth-00] */
453
#define BGP_EXT_COM_STYPE_AS2_VNI       0x80    /* Virtual-Network Identifier Extended Community [draft-drao-bgp-l3vpn-virtual-network-overlays] */
454
455
/* Transitive Four-Octet AS-Specific Extended Community Sub-Types */
456
#define BGP_EXT_COM_STYPE_AS4_RT        0x02    /* Route Target [RFC5668] */
457
#define BGP_EXT_COM_STYPE_AS4_RO        0x03    /* Route Origin [RFC5668] */
458
#define BGP_EXT_COM_STYPE_AS4_GEN       0x04    /* Generic (deprecated) [draft-ietf-idr-as4octet-extcomm-generic-subtype] */
459
#define BGP_EXT_COM_STYPE_AS4_OSPF_DID  0x05    /* OSPF Domain Identifier [RFC4577] */
460
#define BGP_EXT_COM_STYPE_AS4_BGP_DC    0x08    /* BGP Data Collection [RFC4384] */
461
#define BGP_EXT_COM_STYPE_AS4_S_AS      0x09    /* Source AS [RFC6514] */
462
#define BGP_EXT_COM_STYPE_AS4_CIS_V     0x10    /* Cisco VPN Identifier [Eric_Rosen] */
463
#define BGP_EXT_COM_STYPE_AS4_RT_REC    0x13    /* Route-Target Record [draft-ietf-bess-service-chaining] */
464
#define BGP_EXT_COM_STYPE_AS4_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community] */
465
466
/* Non-Transitive Four-Octet AS-Specific Extended Community Sub-Types */
467
468
/*
469
 * #define BGP_EXT_COM_STYPE_AS4_GEN       0x04
470
 * Generic (deprecated) [draft-ietf-idr-as4octet-extcomm-generic-subtype]
471
*/
472
473
/* Transitive IPv4-Address-Specific Extended Community Sub-Types */
474
475
#define BGP_EXT_COM_STYPE_IP4_RT        0x02    /* Route Target [RFC4360] */
476
#define BGP_EXT_COM_STYPE_IP4_RO        0x03    /* Route Origin [RFC4360] */
477
#define BGP_EXT_COM_STYPE_IP4_IFIT_TAIL 0x04    /* IPv4-Address-Specific IFIT Tail Community [draft-wang-idr-bgp-ifit-capabilities] */
478
#define BGP_EXT_COM_STYPE_IP4_OSPF_DID  0x05    /* OSPF Domain Identifier [RFC4577] */
479
69
#define BGP_EXT_COM_STYPE_IP4_OSPF_RID  0x07    /* OSPF Router ID [RFC4577] */
480
#define BGP_EXT_COM_STYPE_IP4_NODE_TGT  0x09    /* Node Target Extended Community [draft-ietf-idr-node-target-ext-comm] */
481
#define BGP_EXT_COM_STYPE_IP4_L2VPN     0x0a    /* L2VPN Identifier [RFC6074] */
482
#define BGP_EXT_COM_STYPE_IP4_VRF_I     0x0b    /* VRF Route Import [RFC6514] */
483
#define BGP_EXT_COM_STYPE_IP4_FLOW_RDR  0x0c    /* Flow-spec Redirect to IPv4 [draft-ietf-idr-flowspec-redirect] */
484
#define BGP_EXT_COM_STYPE_IP4_CIS_D     0x10    /* Cisco VPN-Distinguisher [Eric_Rosen] */
485
#define BGP_EXT_COM_STYPE_IP4_SEG_NH    0x12    /* Inter-area P2MP Segmented Next-Hop [RFC7524] */
486
#define BGP_EXT_COM_STYPE_IP4_RT_REC    0x13    /* Route-Target Record [draft-ietf-bess-service-chaining] */
487
#define BGP_EXT_COM_STYPE_IP4_VRF_RNH   0x14    /* VRF-Recursive-Next-Hop-Extended-Community */
488
#define BGP_EXT_COM_STYPE_IP4_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community-00] */
489
#define BGP_EXT_COM_STYPE_IP4_MVPN_RP   0x20    /* MVPN SA RP-address Extended Community [RFC9081] */
490
491
/* Transitive Opaque Extended Community Sub-Types */
492
493
#define BGP_EXT_COM_STYPE_OPA_COST      0x01    /* Cost Community [draft-ietf-idr-custom-decision] */
494
#define BGP_EXT_COM_STYPE_OPA_CP_OSPF   0x03    /* CP-ORF [RFC7543] */
495
#define BGP_EXT_COM_STYPE_OPA_EXTN_SRC  0x04    /* Extranet Source Extended Community [RFC7900] */
496
#define BGP_EXT_COM_STYPE_OPA_EXTN_SEP  0x05    /* Extranet Separation Extended Community [RFC7900] */
497
69
#define BGP_EXT_COM_STYPE_OPA_OSPF_RT   0x06    /* OSPF Route Type [RFC4577] */
498
#define BGP_EXT_COM_STYPE_OPA_PMSI_ATTR 0x07    /* Additional PMSI Tunnel Attribute Flags [RFC7902] */
499
#define BGP_EXT_COM_STYPE_OPA_CTX_LBL   0x08    /* Context-Specific Label Space ID Extended Community [RFC9573] */
500
0
#define BGP_EXT_COM_STYPE_OPA_COLOR     0x0b    /* Color Extended Community [RFC5512] */
501
341
#define BGP_EXT_COM_STYPE_OPA_ENCAP     0x0c    /* Encapsulation Extended Community [RFC5512] */
502
0
#define BGP_EXT_COM_STYPE_OPA_DGTW      0x0d    /* Default Gateway  [Yakov_Rekhter] */
503
#define BGP_EXT_COM_STYPE_OPA_PPMP_LBL  0x0e    /* Point-to-Point-to-Multipoint (PPMP) Label [Rishabh_Parekh] */
504
#define BGP_EXT_COM_STYPE_OPA_GRP_TAG   0x0f    /* BGP Group Policy Class Tag Extended Community [Dhananjaya_Rao] */
505
#define BGP_EXT_COM_STYPE_OPA_HSH_SRT   0x14    /* Consistent Hash Sort Order [draft-ietf-bess-service-chaining] */
506
#define BGP_EXT_COM_STYPE_OPA_GRP_PID   0x17    /* Group Policy ID Extended Community [draft-wlin-bess-group-policy-id-extended-community] */
507
#define BGP_EXT_COM_STYPE_OPA_LCM       0x1b    /* Local Color Mapping (LCM) [draft-ietf-idr-bgp-car-05] */
508
#define BGP_EXT_COM_STYPE_OPA_LOADBAL   0xaa    /* LoadBalance [draft-ietf-bess-service-chaining] */
509
510
/* BGP Cost Community Point of Insertion Types */
511
512
#define BGP_EXT_COM_COST_POI_ORIGIN     1       /* Evaluate after "Prefer lowest Origin" step */
513
#define BGP_EXT_COM_COST_POI_ASPATH     2       /* Evaluate after "Prefer shortest AS_PATH" step */
514
#define BGP_EXT_COM_COST_POI_MED        4       /* Evaluate after "Prefer lowest MED" step */
515
#define BGP_EXT_COM_COST_POI_LP         5       /* Evaluate after "Prefer highest Local Preference" step */
516
#define BGP_EXT_COM_COST_POI_AIGP       26      /* Evaluate after "Prefer lowest Accumulated IGP Cost" step */
517
#define BGP_EXT_COM_COST_POI_ABS        128     /* Pre-bestpath POI */
518
#define BGP_EXT_COM_COST_POI_IGP        129     /* Evaluate after "Prefer smallest IGP metric to next-hop" step */
519
#define BGP_EXT_COM_COST_POI_EI         130     /* Evaluate after "Prefer eBGP to iBGP" step */
520
#define BGP_EXT_COM_COST_POI_RID        131     /* Evaluate after "Prefer lowest BGP RID" step */
521
522
390
#define BGP_EXT_COM_COST_CID_REP        0x80    /* Bitmask - value replace/evaluate after bit */
523
524
/* BGP Tunnel Encapsulation Attribute Tunnel Types */
525
526
#define BGP_EXT_COM_TUNNEL_RESERVED     0       /* Reserved [RFC5512] */
527
#define BGP_EXT_COM_TUNNEL_L2TPV3       1       /* L2TPv3 over IP [RFC5512] */
528
#define BGP_EXT_COM_TUNNEL_GRE          2       /* GRE [RFC5512] */
529
#define BGP_EXT_COM_TUNNEL_ENDP         3       /* Transmit tunnel endpoint [RFC5566] */
530
#define BGP_EXT_COM_TUNNEL_IPSEC        4       /* IPsec in Tunnel-mode [RFC5566] */
531
#define BGP_EXT_COM_TUNNEL_IPIPSEC      5       /* IP in IP tunnel with IPsec Transport Mode [RFC5566] */
532
#define BGP_EXT_COM_TUNNEL_MPLSIP       6       /* MPLS-in-IP tunnel with IPsec Transport Mode [RFC5566] */
533
#define BGP_EXT_COM_TUNNEL_IPIP         7       /* IP in IP [RFC5512] */
534
7.55k
#define BGP_EXT_COM_TUNNEL_VXLAN        8       /* VXLAN Encapsulation [draft-sd-l2vpn-evpn-overlay] */
535
#define BGP_EXT_COM_TUNNEL_NVGRE        9       /* NVGRE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
536
#define BGP_EXT_COM_TUNNEL_MPLS         10      /* MPLS Encapsulation [draft-sd-l2vpn-evpn-overlay] */
537
#define BGP_EXT_COM_TUNNEL_MPLSGRE      11      /* MPLS in GRE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
538
2.03k
#define BGP_EXT_COM_TUNNEL_VXLANGPE     12      /* VxLAN GPE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
539
#define BGP_EXT_COM_TUNNEL_MPLSUDP      13      /* MPLS in UDP Encapsulation [draft-ietf-l3vpn-end-system] */
540
#define BGP_EXT_COM_TUNNEL_IPV6_TUNNEL  14      /* IPv6 Tunnel  [Martin_Djernaes] */
541
#define BGP_EXT_COM_TUNNEL_SE_TE_POLICY 15      /* SR TE Policy Type [draft-ietf-idr-sr-policy-safi-04] */
542
#define BGP_EXT_COM_TUNNEL_BARE         16      /* Bare [Nischal_Sheth] */
543
#define BGP_EXT_COM_TUNNEL_SR_TUNNEL    17      /* SR Tunnel [RFC9125] */
544
#define BGP_EXT_COM_TUNNEL_CLOUD_SEC    18      /* Cloud Security [Ramesh_Babu_Yakkala] */
545
#define BGP_EXT_COM_TUNNEL_GENEVE_ENCAP 19      /* Geneve Encapsulation [RFC8926] */
546
#define BGP_EXT_COM_TUNNEL_ANY_ENCAP    20      /* Any Encapsulation [draft-ietf-bess-bgp-multicast-controller-06] */
547
#define BGP_EXT_COM_TUNNEL_GTP_TUNNEL   21      /* GTP Tunnel Type [Keyur_Patel][Tetsuya_Murakami] */
548
#define BGP_EXT_COM_TUNNEL_DPS_TUNNEL   22      /* Dynamic Path Selection (DPS) Tunnel Encapsulation [Venkit_Kasiviswanathan] */
549
#define BGP_EXT_COM_TUNNEL_OPE          23      /* Originating PE (OPE) [draft-heitz-bess-evpn-option-b-01] */
550
#define BGP_EXT_COM_TUNNEL_DYN_DPS_POL  24      /* Dynamic Path Selection (DPS) Policy [Sarah_Chen] */
551
#define BGP_EXT_COM_TUNNEL_SDWAN_HYB    25      /* SDWAN-Hybrid [draft-ietf-idr-sdwan-edge-discovery-04] */
552
#define BGP_EXT_COM_TUNNEL_X_OVER_UDP   26      /* X-over-UDP [Jeffrey_Haas] */
553
#define BGP_EXT_COM_TUNNEL_DES_ENCAP    27      /* Distributed Etherlink Switch (DES) Tunnel Encapsulation [David_Cronin] */
554
555
/* Non-Transitive Opaque Extended Community Sub-Types */
556
557
#define BGP_EXT_COM_STYPE_OPA_OR_VAL_ST 0x00    /* BGP Origin Validation State [draft-ietf-sidr-origin-validation-signaling] */
558
188
#define BGP_EXT_COM_STYPE_OPA_COST      0x01    /* Cost Community [draft-ietf-idr-custom-decision] */
559
#define BGP_EXT_COM_STYPE_OPA_RT        0x02    /* Route Target [Nischal_Sheth] */
560
#define BGP_EXT_COM_STYPE_OPA_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community-00] */
561
562
/* Transitive MUP Extended Community Sub-Types */
563
66
#define BGP_EXT_COM_STYPE_MUP_DIRECT_SEG 0x00
564
565
/* BGP Generic Transitive Experimental Use Extended Community Sub-Types */
566
567
66
#define BGP_EXT_COM_STYPE_EXP_OSPF_RT   0x00    /* OSPF Route Type, deprecated [RFC4577] */
568
68
#define BGP_EXT_COM_STYPE_EXP_OSPF_RID  0x01    /* OSPF Router ID, deprecated [RFC4577] */
569
#define BGP_EXT_COM_STYPE_EXP_SEC_GROUP 0x04    /* Security Group [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#security-group] */
570
67
#define BGP_EXT_COM_STYPE_EXP_OSPF_DID  0x05    /* OSPF Domain ID, deprecated [RFC4577] */
571
67
#define BGP_EXT_COM_STYPE_EXP_F_TR      0x06    /* Flow spec traffic-rate [RFC5575] */
572
74
#define BGP_EXT_COM_STYPE_EXP_F_TA      0x07    /* Flow spec traffic-action [RFC5575] */
573
66
#define BGP_EXT_COM_STYPE_EXP_F_RED     0x08    /* Flow spec redirect [RFC5575] */
574
69
#define BGP_EXT_COM_STYPE_EXP_F_RMARK   0x09    /* Flow spec traffic-remarking [RFC5575] */
575
67
#define BGP_EXT_COM_STYPE_EXP_L2        0x0a    /* Layer2 Info Extended Community [RFC4761] */
576
67
#define BGP_EXT_COM_STYPE_EXP_ETREE     0x0b    /* E-Tree Info [RFC7796] */
577
#define BGP_EXT_COM_STYPE_EXP_FLOW_RATE 0x0c    /* Flow spec traffic-rate-packets [RFC8955] */
578
#define BGP_EXT_COM_STYPE_EXP_FLOW_SFC  0x0d    /* Flow Specification for SFC Classifiers [RFC9015] */
579
#define BGP_EXT_COM_STYPE_EXP_TAG       0x84    /* Tag [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#tag] */
580
#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] */
581
582
/* BGP Generic Transitive Experimental Use Extended Community Part 2 */
583
584
66
#define BGP_EXT_COM_STYPE_EXP_2_FLOW_RED 0x08
585
586
/* BGP Generic Transitive Experimental Use Extended Community Part 3 */
587
588
#define BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP 0x04
589
67
#define BGP_EXT_COM_STYPE_EXP_3_FLOW_RED  0x08
590
#define BGP_EXT_COM_STYPE_EXP_3_TAG4      0x84
591
#define BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS  0x85
592
593
/* BGP Transitive Experimental EIGRP route attribute Sub-Types */
594
595
255
#define BGP_EXT_COM_STYPE_EXP_EIGRP_FT  0x00    /* Route Flags, Route Tag */
596
87
#define BGP_EXT_COM_STYPE_EXP_EIGRP_AD  0x01    /* ASN, Delay */
597
176
#define BGP_EXT_COM_STYPE_EXP_EIGRP_RHB 0x02    /* Reliability, Hop Count, Bandwidth */
598
67
#define BGP_EXT_COM_STYPE_EXP_EIGRP_LM  0x03    /* Load, MTU */
599
67
#define BGP_EXT_COM_STYPE_EXP_EIGRP_EAR 0x04    /* External ASN, RID of the redistributing router */
600
87
#define BGP_EXT_COM_STYPE_EXP_EIGRP_EPM 0x05    /* External Protocol ID, metric */
601
66
#define BGP_EXT_COM_STYPE_EXP_EIGRP_RID 0x06    /* Originating EIGRP Router ID of the route */
602
603
524
#define BGP_EXT_COM_EXP_EIGRP_FLAG_RT   0x8000  /* Route flag - Internal/External */
604
605
606
/* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
607
608
                                        /* RFC 4360 */
609
194
#define BGP_EXT_COM_RT_AS2        0x0002  /* Route Target,Format AS(2bytes):AN(4bytes) */
610
98
#define BGP_EXT_COM_RT_IP4        0x0102  /* Route Target,Format IP address:AN(2bytes) */
611
196
#define BGP_EXT_COM_RT_AS4        0x0202  /* Route Target,Format AS(4bytes):AN(2bytes) */
612
613
/* extended community option flow flec action bit S and T */
614
88
#define BGP_EXT_COM_FSPEC_ACT_S 0x02
615
88
#define BGP_EXT_COM_FSPEC_ACT_T 0x01
616
617
/* extended community l2vpn flags */
618
619
14
#define BGP_EXT_COM_L2_FLAG_D     0x80
620
14
#define BGP_EXT_COM_L2_FLAG_Z1    0x40
621
14
#define BGP_EXT_COM_L2_FLAG_F     0x20
622
14
#define BGP_EXT_COM_L2_FLAG_Z345  0x1c
623
14
#define BGP_EXT_COM_L2_FLAG_C     0x02
624
14
#define BGP_EXT_COM_L2_FLAG_S     0x01
625
626
/* extended community E-Tree Info flags */
627
628
14
#define BGP_EXT_COM_ETREE_FLAG_RESERVED   0xFFFC
629
14
#define BGP_EXT_COM_ETREE_FLAG_P          0x0002
630
14
#define BGP_EXT_COM_ETREE_FLAG_V          0x0001
631
632
/* Extended community QoS Marking technology type */
633
#define QOS_TECH_TYPE_DSCP         0x00  /* DiffServ enabled IP (DSCP encoding) */
634
#define QOS_TECH_TYPE_802_1q       0x01  /* Ethernet using 802.1q priority tag */
635
#define QOS_TECH_TYPE_E_LSP        0x02  /* MPLS using E-LSP */
636
#define QOS_TECH_TYPE_VC           0x03  /* Virtual Channel (VC) encoding using separate channels for */
637
                                         /* QoS forwarding / one channel per class (e.g. ATM VCs, FR  */
638
                                         /* VCs, MPLS L-LSPs) */
639
#define QOS_TECH_TYPE_GMPLS_TIME   0x04   /* GMPLS - time slot encoding */
640
#define QOS_TECH_TYPE_GMPLS_LAMBDA 0x05  /* GMPLS - lambda encoding */
641
#define QOS_TECH_TYPE_GMPLS_FIBRE  0x06  /* GMPLS - fibre encoding */
642
643
/* OSPF codes for  BGP_EXT_COM_OSPF_RTYPE draft-rosen-vpns-ospf-bgp-mpls  */
644
#define BGP_OSPF_RTYPE_RTR      1 /* OSPF Router LSA */
645
#define BGP_OSPF_RTYPE_NET      2 /* OSPF Network LSA */
646
#define BGP_OSPF_RTYPE_SUM      3 /* OSPF Summary LSA */
647
#define BGP_OSPF_RTYPE_EXT      5 /* OSPF External LSA, note that ASBR doesn't apply to MPLS-VPN */
648
#define BGP_OSPF_RTYPE_NSSA     7 /* OSPF NSSA External*/
649
#define BGP_OSPF_RTYPE_SHAM     129 /* OSPF-MPLS-VPN Sham link */
650
149
#define BGP_OSPF_RTYPE_METRIC_TYPE 0x1 /* Type-1 (clear) or Type-2 (set) external metric */
651
652
/* Extended community & Route distinguisher formats */
653
3.23k
#define FORMAT_AS2_LOC      0x00    /* Format AS(2bytes):AN(4bytes) */
654
3.89k
#define FORMAT_IP_LOC       0x01    /* Format IP address:AN(2bytes) */
655
940
#define FORMAT_AS4_LOC      0x02    /* Format AS(4bytes):AN(2bytes) */
656
657
/* RFC 4760 subsequent address family numbers (last updated 2024-03-19)
658
 * https://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml
659
 */
660
23.0k
#define SAFNUM_UNICAST          1  /* RFC4760 */
661
57.8k
#define SAFNUM_MULCAST          2  /* RFC4760 */
662
61.9k
#define SAFNUM_UNIMULC          3  /* Deprecated, see RFC4760 */
663
3.63k
#define SAFNUM_MPLS_LABEL       4  /* RFC8277 */
664
12.6k
#define SAFNUM_MCAST_VPN        5  /* RFC6514 */
665
#define SAFNUM_MULTISEG_PW      6  /* RFC7267 */
666
3.81k
#define SAFNUM_ENCAPSULATION    7  /* RFC5512, obsolete and never deployed, see draft-ietf-idr-tunnel-encaps-22 */
667
#define SAFNUM_MCAST_VPLS       8  /* RFC7117 */
668
#define SAFNUM_BGP_SFC          9  /* RFC9015 */
669
3.12k
#define SAFNUM_TUNNEL          64  /* draft-nalawade-kapoor-tunnel-safi-05.txt (Expired) */
670
836
#define SAFNUM_VPLS            65  /* RFC4761, RFC6074 */
671
653
#define SAFNUM_MDT             66  /* RFC6037 */
672
#define SAFNUM_4OVER6          67  /* RFC5747 */
673
#define SAFNUM_6OVER4          68  /* Never specified? Cf. RFC5747 */
674
#define SAFNUM_L1VPN           69  /* RFC5195 */
675
22.3k
#define SAFNUM_EVPN            70  /* RFC7432 */
676
41.6k
#define SAFNUM_BGP_LS          71  /* RFC7752 */
677
14.4k
#define SAFNUM_BGP_LS_VPN      72  /* RFC7752 */
678
2.05k
#define SAFNUM_SR_POLICY       73  /* draft-ietf-idr-segment-routing-te-policy-11 */
679
#define SAFNUM_SD_WAN          74  /* draft-dunbar-idr-sdwan-port-safi-06, expired */
680
#define SAFNUM_RPD             75  /* draft-ietf-idr-rpd-10 */
681
#define SAFNUM_CT              76  /* draft-kaliraj-idr-bgp-classful-transport-planes-07 */
682
#define SAFNUM_FLOWSPEC        77  /* draft-ietf-idr-flowspec-nvo3-13 */
683
#define SAFNUM_MCAST_TREE      78  /* draft-ietf-bess-bgp-multicast-03 */
684
#define SAFNUM_BGP_DPS         79  /* https://www.arista.com/en/cg-veos-router/veos-router-dynamic-path-selection */
685
#define SAFNUM_BGP_LS_SPF      80  /* draft-ietf-lsvr-bgp-spf-15 */
686
#define SAFNUM_BGP_CAR         83  /* draft-ietf-idr-bgp-car-05 */
687
#define SAFNUM_BGP_VPN_CAR     84  /* draft-ietf-idr-bgp-car-05 */
688
22.6k
#define SAFNUM_BGP_MUP         85  /* draft-mpmz-bess-mup-safi-03 */
689
23.4k
#define SAFNUM_LAB_VPNUNICAST 128  /* RFC4364, RFC8277 */
690
4.74k
#define SAFNUM_LAB_VPNMULCAST 129  /* RFC6513, RFC6514 */
691
5.82k
#define SAFNUM_LAB_VPNUNIMULC 130  /* Obsolete and reserved, see RFC4760 */
692
2.67k
#define SAFNUM_ROUTE_TARGET   132  /* RFC 4684 Constrained Route Distribution for BGP/MPLS IP VPN */
693
10.9k
#define SAFNUM_FSPEC_RULE     133  /* RFC 8955 BGP flow spec SAFI */
694
58.2k
#define SAFNUM_FSPEC_VPN_RULE 134  /* RFC 8955 BGP flow spec SAFI VPN */
695
#define SAFNUM_L3VPN          140  /* Withdrawn, draft-ietf-l3vpn-bgpvpn-auto-09 */
696
697
/* BGP Additional Paths Capability */
698
#define BGP_ADDPATH_RECEIVE  0x01
699
#define BGP_ADDPATH_SEND     0x02
700
701
/* mcast-vpn route types RFC 6514 */
702
1.99k
#define MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD 1
703
547
#define MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD 2
704
1.08k
#define MCAST_VPN_RTYPE_SPMSI_AD          3
705
434
#define MCAST_VPN_RTYPE_LEAF_AD           4
706
701
#define MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD  5
707
327
#define MCAST_VPN_RTYPE_SHARED_TREE_JOIN  6
708
1.29k
#define MCAST_VPN_RTYPE_SOURCE_TREE_JOIN  7
709
710
/* RFC 5512 Tunnel Types */
711
6.06k
#define TUNNEL_TYPE_L2TP_OVER_IP      1
712
7.58k
#define TUNNEL_TYPE_GRE               2
713
#define TUNNEL_TYPE_TTE               3
714
#define TUNNEL_TYPE_IPSEC_IN_TM       4
715
#define TUNNEL_TYPE_IP_IN_IP_IPSEC    5
716
#define TUNNEL_TYPE_MPLS_IN_IP_IPSEC  6
717
#define TUNNEL_TYPE_IP_IN_IP          7
718
2.44k
#define TUNNEL_TYPE_VXLAN             8
719
1.95k
#define TUNNEL_TYPE_NVGRE             9
720
#define TUNNEL_TYPE_MPLS             10
721
3.07k
#define TUNNEL_TYPE_MPLS_IN_GRE      11
722
2.03k
#define TUNNEL_TYPE_VXLAN_GPE        12
723
#define TUNNEL_TYPE_MPLS_IN_UDP      13
724
#define TUNNEL_TYPE_IPV6_TUNNEL      14
725
#define TUNNEL_TYPE_SR_TE_POLICY     15
726
#define TUNNEL_TYPE_BARE             16
727
#define TUNNEL_TYPE_SR_TUNNEL        17
728
#define TUNNEL_TYPE_CLOUD_SECURITY   18
729
#define TUNNEL_TYPE_GENEVE_ENCAP     19
730
#define TUNNEL_TYPE_ANY_ENCAP        20
731
#define TUNNEL_TYPE_GTP_TUNNEL_TYPE  21
732
#define TUNNEL_TYPE_DPS_TUNNEL_ENCAP 22
733
#define TUNNEL_TYPE_ORIGINATING_PE   23
734
#define TUNNEL_TYPE_DPS_POLICY       24
735
#define TUNNEL_TYPE_SDWAN_HYBRID     25
736
#define TUNNEL_TYPE_X_OVER_UDP       26
737
#define TUNNEL_TYPE_DES_TUNNEL_ENCAP 27
738
739
740
/*RFC 6514 PMSI Tunnel Types */
741
72
#define PMSI_TUNNEL_NOPRESENT           0
742
70
#define PMSI_TUNNEL_RSVPTE_P2MP         1
743
664
#define PMSI_TUNNEL_MLDP_P2MP           2
744
195
#define PMSI_TUNNEL_PIMSSM              3
745
36
#define PMSI_TUNNEL_PIMSM               4
746
69
#define PMSI_TUNNEL_BIDIR_PIM           5
747
171
#define PMSI_TUNNEL_INGRESS             6
748
1.12k
#define PMSI_TUNNEL_MLDP_MP2MP          7
749
#define PMSI_TUNNEL_TRANPORT            8
750
#define PMSI_TUNNEL_ASS_REPLIC          9
751
#define PMSI_TUNNEL_BIER                11
752
#define PMSI_TUNNEL_SR_MPLS_P2MP        12
753
754
/* RFC 6388, RFC 6826, RFC 6512, RFC 7246, RFC 7442, RFC 8338 */
755
#define PMSI_MLDP_FEC_TYPE_RSVD                     0
756
1.12k
#define PMSI_MLDP_FEC_TYPE_GEN_LSP                  1
757
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SRC         3
758
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SRC         4
759
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_BIDIR       5
760
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_BIDIR       6
761
#define PMSI_MLDP_FEC_TYPE_RECURSE_OPAQUE_VALUE     7
762
#define PMSI_MLDP_FEC_TYPE_VPN_RECURSE_OPAQUE_VALUE 8
763
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_BIDIR      9
764
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_BIDIR      10
765
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SHARED_TREE 11
766
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SHARED_TREE 12
767
#define PMSI_MLDP_FEC_TYPE_L2VPN_MCAST              13
768
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_SRC        250
769
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_SRC        251
770
601
#define PMSI_MLDP_FEC_TYPE_EXT_TYPE                 255
771
772
#define PMSI_MLDP_FEC_ETYPE_RSVD                    0
773
774
/* RFC 7311 AIGP types */
775
284
#define AIGP_TLV_TYPE           1
776
777
/* RFC 9012 (RFC 5512/5640) Sub-TLV Types */
778
3.49k
#define TUNNEL_SUBTLV_ENCAPSULATION     1
779
757
#define TUNNEL_SUBTLV_PROTO_TYPE        2
780
#define TUNNEL_SUBTLV_IPSEC_TA          3
781
905
#define TUNNEL_SUBTLV_COLOR             4
782
1.28k
#define TUNNEL_SUBTLV_LOAD_BALANCE      5
783
#define TUNNEL_SUBTLV_REMOTE_ENDPOINT   6
784
#define TUNNEL_SUBTLV_IPV4_DS_FIELD     7
785
#define TUNNEL_SUBTLV_UDP_DST_PORT      8
786
#define TUNNEL_SUBTLV_EMBEDDED_LABEL    9
787
#define TUNNEL_SUBTLV_MPLS_LABEL        10
788
#define TUNNEL_SUBTLV_PREFIX_SID        11
789
212
#define TUNNEL_SUBTLV_PREFERENCE        12
790
1.22k
#define TUNNEL_SUBTLV_BINDING_SID       13
791
234
#define TUNNEL_SUBTLV_ENLP              14
792
502
#define TUNNEL_SUBTLV_PRIORITY          15
793
794
#define TUNNEL_SUBTLV_SPI_SI_REP        16
795
796
273
#define TUNNEL_SUBTLV_SRV6_BINDING_SID  20
797
798
#define TUNNEL_SUBTLV_IPSEC_SA_ID       64
799
#define TUNNEL_SUBTLV_EXT_PORT_PROP     65
800
#define TUNNEL_SUBTLV_UNDERLAY_ISP_PROP 66
801
#define TUNNEL_SUBTLV_IPSEC_SA_NONCE    67
802
#define TUNNEL_SUBTLV_IPSEC_PUBLIC_KEY  68
803
#define TUNNEL_SUBTLV_IPSEC_SA_PROPOSAL 69
804
#define TUNNEL_SUBTLV_SIMPL_IPSEC_SA    70
805
806
#define TUNNEL_SUBTLV_NRP               123
807
#define TUNNEL_SUBTLV_RPF               124
808
#define TUNNEL_SUBTLV_TREE_LABEL_STACK  125
809
810
1.33k
#define TUNNEL_SUBTLV_SEGMENT_LIST      128
811
415
#define TUNNEL_SUBTLV_POLICY_CP_NAME    129
812
223
#define TUNNEL_SUBTLV_POLICY_NAME       130
813
814
#define TUNNEL_SUBTLV_WAN_ID            192
815
#define TUNNEL_SUBTLV_BYTES             193
816
#define TUNNEL_SUBTLV_IPSEC_DIM         194
817
#define TUNNEL_SUBTLV_IPSEC_KEY_EXCH    195
818
#define TUNNEL_SUBTLV_IPSEC_SA_PROPS    196
819
#define TUNNEL_SUBTLV_SRV_SEGMENT_LIST  197
820
#define TUNNEL_SUBTLV_SRV_VTEP          198
821
#define TUNNEL_SUBTLV_DES_ADJACENCY     199
822
823
824
/* BGP Tunnel SubTLV VXLAN Flags bitmask */
825
14
#define TUNNEL_SUBTLV_VXLAN_VALID_VNID          0x80
826
14
#define TUNNEL_SUBTLV_VXLAN_VALID_MAC           0x40
827
14
#define TUNNEL_SUBTLV_VXLAN_RESERVED            0x3F
828
829
/* BGP Tunnel SubTLV VXLAN GPE Flags bitmask */
830
14
#define TUNNEL_SUBTLV_VXLAN_GPE_VERSION         0xC0
831
14
#define TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID      0x20
832
14
#define TUNNEL_SUBTLV_VXLAN_GPE_RESERVED        0x1F
833
834
/* BGP Tunnel SubTLV NVGRE Flags bitmask */
835
14
#define TUNNEL_SUBTLV_NVGRE_VALID_VNID          0x80
836
14
#define TUNNEL_SUBTLV_NVGRE_VALID_MAC           0x40
837
14
#define TUNNEL_SUBTLV_NVGRE_RESERVED            0x3F
838
839
/* BGP Tunnel SubTLV Binding SID Flags bitmask */
840
14
#define TUNNEL_SUBTLV_BINDING_SPECIFIED         0x80
841
14
#define TUNNEL_SUBTLV_BINDING_INVALID           0x40
842
14
#define TUNNEL_SUBTLV_BINDING_RESERVED          0x3F
843
844
/* BGP Tunnel SubTLV SRv6 Binding SID Flags bitmask - RFC 9830 Section 2.4.3 */
845
14
#define TUNNEL_SUBTLV_SRV6_BINDING_SPECIFIED    0x80
846
14
#define TUNNEL_SUBTLV_SRV6_BINDING_INVALID      0x40
847
14
#define TUNNEL_SUBTLV_SRV6_BINDING_B_FLAG       0x20
848
14
#define TUNNEL_SUBTLV_SRV6_BINDING_RESERVED     0x1F
849
850
/* BGP Segment List SubTLV Types - RFC 9830, RFC 9831 */
851
644
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A         1
852
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B_OLD     2  /* Deprecated - see Type 13 below */
853
378
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C         3
854
333
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D         4
855
427
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E         5
856
309
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F         6
857
277
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G         7
858
297
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H         8
859
223
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT    9
860
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I_OLD    10 /* Deprecated - see Type 14 below */
861
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J_OLD    11 /* Deprecated - see Type 15 below */
862
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K_OLD    12 /* Deprecated - see Type 16 below */
863
294
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B        13
864
401
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I        14
865
229
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J        15
866
211
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K        16
867
868
/* BGP Tunnel SubTLV Segment List SubTLV Flags bitmask - RFC 9830 Section 2.4.4.2.3 & RFC 9831 Section 2.10 */
869
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION      0x80  /* V-Flag (bit 0) - RFC 9830 */
870
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM         0x40  /* A-Flag (bit 1) - RFC 9831 */
871
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_S_FLAG            0x20  /* S-Flag (bit 2) - RFC 9831 */
872
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_B_FLAG            0x10  /* B-Flag (bit 3) - RFC 9830 */
873
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED          0x0F  /* Reserved bits (bits 4,5,6,7) */
874
875
/* Link-State NLRI types */
876
453
#define LINK_STATE_NODE_NLRI                    1
877
2.79k
#define LINK_STATE_LINK_NLRI                    2
878
1.26k
#define LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI    3
879
7.77k
#define LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI    4
880
#define LINK_STATE_SR_POLICY_CANDIDATE_PATH     5
881
2.83k
#define LINK_STATE_SRV6_SID_NLRI                6
882
#define LINK_STATE_STUB_LINK_NLRI               7
883
884
885
/* Link-State NLRI Protocol-ID values */
886
1.99k
#define BGP_LS_NLRI_PROTO_ID_UNKNOWN       0
887
4.02k
#define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 1
888
1.55k
#define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2 2
889
5.85k
#define BGP_LS_NLRI_PROTO_ID_OSPF_V2       3
890
#define BGP_LS_NLRI_PROTO_ID_DIRECT        4
891
#define BGP_LS_NLRI_PROTO_ID_STATIC        5
892
4.60k
#define BGP_LS_NLRI_PROTO_ID_OSPF_V3       6
893
#define BGP_LS_NLRI_PROTO_ID_BGP           7
894
#define BGP_LS_NLRI_PROTO_ID_RSVP_TE       8
895
#define BGP_LS_NLRI_PROTO_ID_SEGMENT_ROUTING 9
896
897
/* Link-State routing universes */
898
#define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3     0
899
#define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1     1
900
901
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN    0
902
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA 1
903
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA 2
904
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1 3
905
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2 4
906
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1     5
907
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2     6
908
909
/* RFC7752 */
910
6.14k
#define BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS         256
911
2.23k
#define BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS        257
912
1.07k
#define BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS  258
913
457
#define BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS         259
914
506
#define BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS          260
915
590
#define BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS         261
916
466
#define BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS          262
917
4.37k
#define BGP_NLRI_TLV_MULTI_TOPOLOGY_ID              263
918
928
#define BGP_NLRI_TLV_OSPF_ROUTE_TYPE                264
919
994
#define BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION    265
920
906
#define BGP_NLRI_TLV_NODE_MSD                       266
921
599
#define BGP_NLRI_TLV_LINK_MSD                       267
922
923
352
#define BGP_NLRI_TLV_AUTONOMOUS_SYSTEM              512
924
332
#define BGP_NLRI_TLV_BGP_LS_IDENTIFIER              513
925
280
#define BGP_NLRI_TLV_AREA_ID                        514
926
196
#define BGP_NLRI_TLV_IGP_ROUTER_ID                  515
927
206
#define BGP_NLRI_TLV_BGP_ROUTER_ID                  516
928
194
#define BGP_NLRI_TLV_BGP_CONFEDERATION_MEMBER       517
929
162
#define BGP_NLRI_TLV_SRV6_SID_INFO                  518
930
931
42.8k
#define BGP_NLRI_TLV_NODE_FLAG_BITS                 1024
932
195
#define BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES         1025
933
194
#define BGP_NLRI_TLV_NODE_NAME                      1026
934
194
#define BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER          1027
935
476
#define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE   1028
936
406
#define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE   1029
937
435
#define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE  1030
938
496
#define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE  1031
939
940
75.5k
#define BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR     1088
941
394
#define BGP_NLRI_TLV_MAX_LINK_BANDWIDTH             1089
942
45.1k
#define BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH  1090
943
2.50k
#define BGP_NLRI_TLV_UNRESERVED_BANDWIDTH           1091
944
612
#define BGP_NLRI_TLV_TE_DEFAULT_METRIC              1092
945
493k
#define BGP_NLRI_TLV_LINK_PROTECTION_TYPE           1093
946
713
#define BGP_NLRI_TLV_MPLS_PROTOCOL_MASK             1094
947
981
#define BGP_NLRI_TLV_METRIC                         1095
948
34.2k
#define BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP         1096
949
204
#define BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE          1097
950
194
#define BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE            1098
951
952
803
#define BGP_NLRI_TLV_IGP_FLAGS                      1152
953
643
#define BGP_NLRI_TLV_ROUTE_TAG                      1153
954
688
#define BGP_NLRI_TLV_EXTENDED_TAG                   1154
955
533
#define BGP_NLRI_TLV_PREFIX_METRIC                  1155
956
599
#define BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS        1156
957
202
#define BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE        1157
958
507
#define BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP  1173
959
960
961
/* Link-State NLRI TLV lengths */
962
600
#define BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM              4
963
579
#define BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER              4
964
494
#define BGP_NLRI_TLV_LEN_AREA_ID                        4
965
2.44k
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID                 4
966
2.61k
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID                 16
967
758
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE   BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
968
812
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE   BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
969
676
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE  BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
970
992
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE  BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
971
1.33k
#define BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS  8
972
728
#define BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS         4
973
406
#define BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS          4
974
855
#define BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS         16
975
341
#define BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS          16
976
7.62k
#define BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID              2
977
144k
#define BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR     4
978
594
#define BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH             4
979
45.3k
#define BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH  4
980
2.79k
#define BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH           32
981
2.44k
#define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD          3
982
1.03k
#define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW          4
983
493k
#define BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE           2
984
1.02k
#define BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK             1
985
1.18k
#define BGP_NLRI_TLV_LEN_MAX_METRIC                     3
986
600
#define BGP_NLRI_TLV_LEN_IGP_FLAGS                      1
987
872
#define BGP_NLRI_TLV_LEN_PREFIX_METRIC                  4
988
48.2k
#define BGP_NLRI_TLV_LEN_NODE_FLAG_BITS                 1
989
990
/* rfc9085 */
991
/* draft-ietf-idr-bgpls-srv6-ext-14 */
992
5.28k
#define BGP_LS_SR_TLV_SR_CAPABILITY                 1034
993
822
#define BGP_LS_SR_TLV_SR_ALGORITHM                  1035
994
644
#define BGP_LS_SR_TLV_SR_LOCAL_BLOCK                1036
995
436
#define BGP_LS_SR_TLV_SRV6_CAPABILITY               1038
996
44.7k
#define BGP_LS_SR_TLV_FLEX_ALGO_DEF                 1039
997
1.31k
#define BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY    1040
998
1.19k
#define BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY    1041
999
928
#define BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY    1042
1000
388
#define BGP_LS_SR_TLV_FLEX_ALGO_DEF_FLAGS           1043
1001
389
#define BGP_LS_SR_TLV_FLEX_ALGO_PREFIX_METRIC       1044
1002
43.9k
#define BGP_LS_SR_TLV_FLEX_ALGO_EXC_SRLG            1045
1003
795
#define BGP_LS_SR_TLV_ADJ_SID                       1099
1004
196
#define BGP_LS_SR_TLV_LAN_ADJ_SID                   1100
1005
17.7k
#define BGP_LS_SR_TLV_PEER_NODE_SID                 1101
1006
9.74k
#define BGP_LS_SR_TLV_PEER_ADJ_SID                  1102
1007
9.29k
#define BGP_LS_SR_TLV_PEER_SET_SID                  1103
1008
635
#define BGP_LS_SR_TLV_SRV6_END_X_SID                1106
1009
1.69k
#define BGP_LS_SR_TLV_SRV6_LAN_END_X_SID            1107
1010
557
#define BGP_LS_SR_TLV_PREFIX_SID                    1158
1011
202
#define BGP_LS_SR_TLV_RANGE                         1159
1012
464
#define BGP_LS_SR_TLV_SRV6_LOCATOR                  1162
1013
1.11k
#define BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS             1170
1014
601
#define BGP_LS_SR_TLV_SOURCE_ROUTER_ID              1171
1015
394
#define BGP_LS_SR_TLV_SRV6_ENDPOINT_BEHAVIOR        1250
1016
392
#define BGP_LS_SR_TLV_SRV6_SID_STRUCT               1252
1017
1018
/* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
1019
195
#define BGP_LS_IGP_TE_METRIC_DELAY                  1114
1020
291
#define BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX          1115
1021
2.25k
#define BGP_LS_IGP_TE_METRIC_DELAY_VARIATION        1116
1022
194
#define BGP_LS_IGP_TE_METRIC_LOSS                   1117
1023
674
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL     1118
1024
202
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE    1119
1025
196
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED     1120
1026
1027
14
#define BGP_LS_IGP_TE_METRIC_FLAG_A                 0x80
1028
14
#define BGP_LS_IGP_TE_METRIC_FLAG_RESERVED          0x7F
1029
1030
/* draft-ietf-idr-bgp-ls-app-specific-attr-07 */
1031
1.78M
#define BGP_LS_APP_SPEC_LINK_ATTR                   1122
1032
1033
/* Prefix-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext, RFC 8665-8667:
1034
1035
                             0  1  2  3  4  5  6  7
1036
                            +--+--+--+--+--+--+--+--+
1037
   if Protocol-ID is IS-IS  |R |N |P |E |V |L |  |  |
1038
                            +--+--+--+--+--+--+--+--+
1039
1040
                             0  1  2  3  4  5  6  7
1041
                            +--+--+--+--+--+--+--+--+
1042
   if Protocol-ID is OSPF   |  |NP|M |E |V |L |  |  |
1043
                            +--+--+--+--+--+--+--+--+
1044
*/
1045
14
#define BGP_LS_SR_PREFIX_SID_FLAG_R  0x80
1046
14
#define BGP_LS_SR_PREFIX_SID_FLAG_N  0x40
1047
14
#define BGP_LS_SR_PREFIX_SID_FLAG_NP 0x40
1048
14
#define BGP_LS_SR_PREFIX_SID_FLAG_P  0x20
1049
14
#define BGP_LS_SR_PREFIX_SID_FLAG_M  0x20
1050
14
#define BGP_LS_SR_PREFIX_SID_FLAG_E  0x10
1051
14
#define BGP_LS_SR_PREFIX_SID_FLAG_V  0x08
1052
14
#define BGP_LS_SR_PREFIX_SID_FLAG_L  0x04
1053
1054
/* Adjacency-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext, RFC 8665-8667:
1055
1056
                             0  1  2  3  4  5  6  7
1057
                            +--+--+--+--+--+--+--+--+
1058
   if Protocol-ID is IS-IS  |F |B |V |L |S |P |  |  |
1059
                            +--+--+--+--+--+--+--+--+
1060
1061
                             0  1  2  3  4  5  6  7
1062
                            +--+--+--+--+--+--+--+--+
1063
   if Protocol-ID is OSPF   |B |V |L |G |P |  |  |  |
1064
                            +--+--+--+--+--+--+--+--+
1065
*/
1066
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_FI 0x80
1067
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_BO 0x80
1068
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_BI 0x40
1069
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_VO 0x40
1070
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_VI 0x20
1071
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_LO 0x20
1072
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_LI 0x10
1073
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_GO 0x10
1074
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_SI 0x08
1075
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_PO 0x08
1076
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_PI 0x04
1077
1078
/* BGP Peering SIDs TLV flags, rfc9086:
1079
1080
   0  1  2  3  4  5  6  7
1081
   +--+--+--+--+--+--+--+--+
1082
   |V |L |B |P |  |  |  |  | rfc9086
1083
   +--+--+--+--+--+--+--+--+
1084
*/
1085
14
#define BGP_LS_SR_PEER_SID_FLAG_V   0x80
1086
14
#define BGP_LS_SR_PEER_SID_FLAG_L   0x40
1087
14
#define BGP_LS_SR_PEER_SID_FLAG_B   0x20
1088
14
#define BGP_LS_SR_PEER_SID_FLAG_P   0x10
1089
1090
/* SR-Capabilities TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext-01:
1091
1092
                             0  1  2  3  4  5  6  7
1093
                            +--+--+--+--+--+--+--+--+
1094
   if Protocol-ID is IS-IS  |I |V |H |  |  |  |  |  |
1095
                            +--+--+--+--+--+--+--+--+
1096
*/
1097
14
#define BGP_LS_SR_CAPABILITY_FLAG_I 0x80
1098
14
#define BGP_LS_SR_CAPABILITY_FLAG_V 0x40
1099
14
#define BGP_LS_SR_CAPABILITY_FLAG_H 0x20
1100
1101
/* Flexible Algorithm Definition Flags Sub-TLV flags, rfc9350:
1102
1103
                             0  1  2  3  4  5  6  7
1104
                            +--+--+--+--+--+--+--+--+
1105
   if Protocol-ID is IS-IS  |M |  |  |  |  |  |  |  |
1106
                            +--+--+--+--+--+--+--+--+
1107
                             0  1  2  3  4  5  6  7
1108
                            +--+--+--+--+--+--+--+--+
1109
   if Protocol-ID is OSPF   |M |  |  |  |  |  |  |  |
1110
                            +--+--+--+--+--+--+--+--+
1111
*/
1112
14
#define BGP_LS_FLEX_ALGO_DEF_FLAGS_M    0x80000000
1113
1114
/* OSPF Flexible Algorithm Prefix Metric Sub-TLV flags, rfc9350:
1115
1116
                             0  1  2  3  4  5  6  7
1117
                            +--+--+--+--+--+--+--+--+
1118
   if Protocol-ID is OSPF   |E |  |  |  |  |  |  |  |
1119
                            +--+--+--+--+--+--+--+--+
1120
*/
1121
14
#define BGP_LS_FLEX_ALGO_PREFIX_METRIC_FLAGS_E      0x80
1122
1123
/* Prefix Attribute Flags TLV flags, rfc9085:
1124
1125
                             0  1  2  3  4  5  6  7
1126
                            +--+--+--+--+--+--+--+--+
1127
   if Protocol-ID is IS-IS  |X |R |N |E |  |  |  |  | rfc7794,rfc9088
1128
                            +--+--+--+--+--+--+--+--+
1129
1130
                             0  1  2  3  4  5  6  7
1131
                            +--+--+--+--+--+--+--+--+
1132
   if Protocol-ID is OSPF   |A |N |E |  |  |  |  |  | rfc7684,rfc9089
1133
                            +--+--+--+--+--+--+--+--+
1134
*/
1135
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI 0x80
1136
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI 0x40
1137
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI 0x20
1138
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI 0x10
1139
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO 0x80
1140
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO 0x40
1141
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO 0x20
1142
1143
/* Link Attribute Application Identifiers, https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml:
1144
1145
   0  1  2  3  4  5  6  7
1146
   +--+--+--+--+--+--+--+--+
1147
   |R |S |F |X |  |  |  |  | rfc8919,rfc8920
1148
   +--+--+--+--+--+--+--+--+
1149
*/
1150
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R  0x80000000
1151
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S  0x40000000
1152
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F  0x20000000
1153
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X  0x10000000
1154
1155
/* SRv6 Capabilities TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1156
1157
                            0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16
1158
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1159
   if Protocol-ID is IS-IS  |  |O | Reserved                                | rfc9352
1160
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1161
 */
1162
14
#define BGP_LS_SRV6_CAP_FLAG_O         0x4000
1163
#define BGP_LS_SRV6_CAP_FLAG_RESERVED  0x3fff
1164
1165
/* SRv6 End.X SID TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1166
1167
                            0  1  2  3  4  5  6  7
1168
                            +--+--+--+--+--+--+--+--+
1169
   if Protocol-ID is IS-IS  |B |S |P |  |  |  |  |  | rfc9352
1170
                            +--+--+--+--+--+--+--+--+
1171
*/
1172
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_B         0x80
1173
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_S         0x40
1174
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_P         0x20
1175
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_RESERVED  0x1f
1176
1177
/* SRv6 Locator TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1178
1179
                            0  1  2  3  4  5  6  7  8
1180
                            +--+--+--+--+--+--+--+--+
1181
   if Protocol-ID is IS-IS  |D | Reserved           | rfc9352
1182
                            +--+--+--+--+--+--+--+--+
1183
*/
1184
14
#define BGP_LS_SRV6_LOC_FLAG_D         0x80
1185
14
#define BGP_LS_SRV6_LOC_FLAG_RESERVED  0x7f
1186
1187
/* BGP Prefix-SID TLV type */
1188
410
#define BGP_PREFIX_SID_TLV_LABEL_INDEX     1 /* Label-Index [RFC8669]                           */
1189
#define BGP_PREFIX_SID_TLV_2               2 /* Deprecated [RFC8669]                            */
1190
824
#define BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB 3 /* Originator SRGB [RFC8669]                       */
1191
#define BGP_PREFIX_SID_TLV_4               4 /* Deprecated [draft-ietf-bess-srv6-services]      */
1192
444
#define BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE 5 /* SRv6 L3 Service [draft-ietf-bess-srv6-services] */
1193
303
#define BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE 6 /* SRv6 L2 Service [draft-ietf-bess-srv6-services] */
1194
1195
/* BGP_PREFIX_SID TLV lengths   */
1196
410
#define BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX 7
1197
1198
/* BGP SRv6 Service Sub-TLV */
1199
2.80k
#define SRV6_SERVICE_SRV6_SID_INFORMATION 1
1200
1201
/* BGP SRv6 Service Data Sub-Sub-TLV */
1202
2.90k
#define SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE 1
1203
1204
/* SRv6 Endpoint behavior */
1205
#define SRV6_ENDPOINT_BEHAVIOR_END                    0x0001 /* End [RFC8986]                                                                            */
1206
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP                0x0002 /* End with PSP [RFC8986]                                                                   */
1207
#define SRV6_ENDPOINT_BEHAVIOR_END_USP                0x0003 /* End with USP [RFC8986]                                                                   */
1208
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP            0x0004 /* End with PSP & USP [RFC8986]                                                             */
1209
#define SRV6_ENDPOINT_BEHAVIOR_END_X                  0x0005 /* End.X [RFC8986]                                                                          */
1210
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP              0x0006 /* End.X with PSP [RFC8986]                                                                 */
1211
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USP              0x0007 /* End.X with UPS [RFC8986]                                                                 */
1212
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP          0x0008 /* End.X with PSP & USP [RFC8986]                                                           */
1213
#define SRV6_ENDPOINT_BEHAVIOR_END_T                  0x0009 /* End.T [RFC8986]                                                                          */
1214
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP              0x000A /* End.T with PSP [RFC8986]                                                                 */
1215
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USP              0x000B /* End.T with USP [RFC8986]                                                                 */
1216
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP          0x000C /* End.T with PSP & USP [RFC8986]                                                           */
1217
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT          0x000D /* End.B6.Insert [draft-filsfils-spring-srv6-net-pgm-insertion-04]                          */
1218
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS          0x000E /* End.B6.Encaps [RFC8986]                                                                  */
1219
#define SRV6_ENDPOINT_BEHAVIOR_END_BM                 0x000F /* End.BM [RFC8986]                                                                         */
1220
#define SRV6_ENDPOINT_BEHAVIOR_END_DX6                0x0010 /* End.DX6 [RFC8986]                                                                        */
1221
#define SRV6_ENDPOINT_BEHAVIOR_END_DX4                0x0011 /* End.DX4 [RFC8986]                                                                        */
1222
#define SRV6_ENDPOINT_BEHAVIOR_END_DT6                0x0012 /* End.DT6 [RFC8986]                                                                        */
1223
#define SRV6_ENDPOINT_BEHAVIOR_END_DT4                0x0013 /* End.DT4 [RFC8986]                                                                        */
1224
#define SRV6_ENDPOINT_BEHAVIOR_END_DT46               0x0014 /* End.DT46 [RFC8986]                                                                       */
1225
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2                0x0015 /* End.DX2 [RFC8986]                                                                        */
1226
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2V               0x0016 /* End.DX2V [RFC8986]                                                                       */
1227
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2U               0x0017 /* End.DX2U [RFC8986]                                                                       */
1228
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2M               0x0018 /* End.DT2M [RFC8986]                                                                       */
1229
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT_RED      0x001A /* End.B6.Insert.Red [draft-filsfils-spring-srv6-net-pgm-insertion-04]                      */
1230
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED      0x001B /* End.B6.Encaps.Red [RFC8986]                                                              */
1231
#define SRV6_ENDPOINT_BEHAVIOR_END_USD                0x001C /* End with USD [RFC8986]                                                                   */
1232
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD            0x001D /* End with PSP & USD [RFC8986]                                                             */
1233
#define SRV6_ENDPOINT_BEHAVIOR_END_USP_USD            0x001E /* End with USP & USD [RFC8986]                                                             */
1234
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD        0x001F /* End with PSP, USP & USD [RFC8986]                                                        */
1235
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USD              0x0020 /* End.X with USD [RFC8986]                                                                 */
1236
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD          0x0021 /* End.X with PSP & USD [RFC8986]                                                           */
1237
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD          0x0022 /* End.X with USP & USD [RFC8986]                                                           */
1238
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD      0x0023 /* End.X with PSP, USP & USD [RFC8986]                                                      */
1239
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USD              0x0024 /* End.T with USD [RFC8986]                                                                 */
1240
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD          0x0025 /* End.T with PSP & USD [RFC8986]                                                           */
1241
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD          0x0026 /* End.T with USP & USD [RFC8986]                                                           */
1242
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD      0x0027 /* End.T with PSP, USP & USD [RFC8986]                                                      */
1243
#define SRV6_ENDPOINT_BEHAVIOR_END_MAP                0x0028 /* End.MAP                                                                                  */
1244
#define SRV6_ENDPOINT_BEHAVIOR_END_LIMIT              0x0029 /* End.Limit                                                                                */
1245
#define SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID          0x002A /* End with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1246
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID               0x002B /* End with NEXT-CSID [draft-ietf-spring-srv6-srh-compression]                              */
1247
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP           0x002C /* End with NEXT-CSID & PSP [draft-ietf-spring-srv6-srh-compression]                        */
1248
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP           0x002D /* End with NEXT-CSID & USP [draft-ietf-spring-srv6-srh-compression]                        */
1249
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP       0x002E /* End with NEXT-CSID, PSP & USP [draft-ietf-spring-srv6-srh-compression]                   */
1250
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD           0x002F /* End with NEXT-CSID & USD [draft-ietf-spring-srv6-srh-compression]                        */
1251
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD       0x0030 /* End with NEXT-CSID, PSP & USD [draft-ietf-spring-srv6-srh-compression]                   */
1252
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD       0x0031 /* End with NEXT-CSID, USP & USD [draft-ietf-spring-srv6-srh-compression]                   */
1253
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD   0x0032 /* End with NEXT-CSID, PSP, USP & USD [draft-ietf-spring-srv6-srh-compression]              */
1254
#define SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID        0x0033 /* End.X with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]            */
1255
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID             0x0034 /* End.X with NEXT-CSID [draft-ietf-spring-srv6-srh-compression]                            */
1256
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP         0x0035 /* End.X with NEXT-CSID & PSP [draft-ietf-spring-srv6-srh-compression]                      */
1257
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP         0x0036 /* End.X with NEXT-CSID & USP [draft-ietf-spring-srv6-srh-compression]                      */
1258
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP     0x0037 /* End.X with NEXT-CSID, PSP & USP [draft-ietf-spring-srv6-srh-compression]                 */
1259
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD         0x0038 /* End.X with NEXT-CSID & USD [draft-ietf-spring-srv6-srh-compression]                      */
1260
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD     0x0039 /* End.X with NEXT-CSID, PSP & USD [draft-ietf-spring-srv6-srh-compression]                 */
1261
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD     0x003A /* End.X with NEXT-CSID, USP & USD [draft-ietf-spring-srv6-srh-compression]                 */
1262
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP_USD 0x003B /* End.X with NEXT-CSID, PSP, USP & USD [draft-ietf-spring-srv6-srh-compression]            */
1263
#define SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID           0x003C /* End.DX6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1264
#define SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID           0x003D /* End.DX4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1265
#define SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID           0x003E /* End.DT6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1266
#define SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID           0x003F /* End.DT4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1267
#define SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID          0x0040 /* End.DT46 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1268
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID           0x0041 /* End.DX2 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1269
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID          0x0042 /* End.DX2V with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1270
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID          0x0043 /* End.DT2U with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1271
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID          0x0044 /* End.DT2M with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1272
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6D            0x0045 /* End.M.GTP6.D [RFC9433]                                                                   */
1273
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6DI           0x0046 /* End.M.GTP6.Di [RFC9433]                                                                  */
1274
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6E            0x0047 /* End.M.GTP6.E [RFC9433]                                                                   */
1275
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP4E            0x0048 /* End.M.GTP4.E [RFC9433]                                                                   */
1276
 #define SRV6_ENDPOINT_BEHAVIOR_END_M                  0x004A /* End.M (Mirror SID) [draft-ietf-rtgwg-srv6-egress-protection-02]                          */
1277
#define SRV6_ENDPOINT_BEHAVIOR_END_REPLICATE          0x004B /* End.Replicate [RFC9524]                                                                  */
1278
#define SRV6_ENDPOINT_BEHAVIOR_END_NSH                0x0054 /* End.NSH - NSH Segment [RFC9491]                                                          */
1279
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1                0x009E /* End.DX1 [RFC9801]                                                                        */
1280
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1_NEXT_CSID      0x009F /* End.DX1 with NEXT-CSID [RFC9801]                                                         */
1281
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1_REPL_CSID      0x00A0 /* End.DX1 with REPLACE-CSID [RFC9801]                                                      */
1282
#define SRV6_ENDPOINT_BEHAVIOR_OPAQUE                 0xFFFF /* Opaque [RFC8986]                                                                         */
1283
1284
static const value_string bgptypevals[] = {
1285
    { BGP_OPEN,                "OPEN Message" },
1286
    { BGP_UPDATE,              "UPDATE Message" },
1287
    { BGP_NOTIFICATION,        "NOTIFICATION Message" },
1288
    { BGP_KEEPALIVE,           "KEEPALIVE Message" },
1289
    { BGP_ROUTE_REFRESH,       "ROUTE-REFRESH Message" },
1290
    { BGP_CAPABILITY,          "CAPABILITY Message" },
1291
    { BGP_ROUTE_REFRESH_CISCO, "Cisco ROUTE-REFRESH Message" },
1292
    { 0, NULL }
1293
};
1294
1295
static const value_string evpnrtypevals[] = {
1296
    { EVPN_AD_ROUTE,                   "Ethernet AD Route" },
1297
    { EVPN_MAC_ROUTE,                  "MAC Advertisement Route" },
1298
    { EVPN_INC_MCAST_TREE,             "Inclusive Multicast Route" },
1299
    { EVPN_ETH_SEGMENT_ROUTE,          "Ethernet Segment Route" },
1300
    { EVPN_IP_PREFIX_ROUTE,            "IP Prefix route" },
1301
    { EVPN_MC_ETHER_TAG_ROUTE,         "Selective Multicast Ethernet Tag Route" },
1302
    { EVPN_IGMP_JOIN_ROUTE,            "IGMP Join Synch Route" },
1303
    { EVPN_IGMP_LEAVE_ROUTE,           "IGMP Leave Synch Route" },
1304
    { EVPN_PER_REG_I_PMSI_A_D_ROUTE,   "Per-Region I-PMSI A-D route" },
1305
    { EVPN_S_PMSI_A_D_ROUTE,           "S-PMSI A-D Route" },
1306
    { EVPN_LEAF_A_D_ROUTE,             "Leaf A-D route" },
1307
    { 0, NULL }
1308
};
1309
1310
static const value_string evpn_nlri_esi_type[] = {
1311
    { BGP_NLRI_EVPN_ESI_VALUE,      "ESI 9 bytes value" },
1312
    { BGP_NLRI_EVPN_ESI_LACP,       "ESI LACP 802.1AX defined" },
1313
    { BGP_NLRI_EVPN_ESI_MSTP,       "ESI MSTP defined" },
1314
    { BGP_NLRI_EVPN_ESI_MAC,        "ESI MAC address defined" },
1315
    { BGP_NLRI_EVPN_ESI_RID,        "ESI Router ID" },
1316
    { BGP_NLRI_EVPN_ESI_ASN,        "ESI Autonomous System" },
1317
    { BGP_NLRI_EVPN_ESI_RES,        "ESI reserved" },
1318
    { 0, NULL }
1319
};
1320
1321
86
#define BGP_MAJOR_ERROR_MSG_HDR       1
1322
2.84k
#define BGP_MAJOR_ERROR_OPEN_MSG      2
1323
72
#define BGP_MAJOR_ERROR_UPDATE_MSG    3
1324
69
#define BGP_MAJOR_ERROR_HT_EXPIRED    4
1325
71
#define BGP_MAJOR_ERROR_STATE_MACHINE 5
1326
1.55k
#define BGP_MAJOR_ERROR_CEASE         6
1327
115
#define BGP_MAJOR_ERROR_ROUTE_REFRESH 7
1328
#define BGP_MAJOR_ERROR_SH_T_EXPIRED  8
1329
1330
static const value_string bgpnotify_major[] = {
1331
    { BGP_MAJOR_ERROR_MSG_HDR,       "Message Header Error" },
1332
    { BGP_MAJOR_ERROR_OPEN_MSG,      "OPEN Message Error" },
1333
    { BGP_MAJOR_ERROR_UPDATE_MSG,    "UPDATE Message Error" },
1334
    { BGP_MAJOR_ERROR_HT_EXPIRED,    "Hold Timer Expired" },
1335
    { BGP_MAJOR_ERROR_STATE_MACHINE, "Finite State Machine Error" },
1336
    { BGP_MAJOR_ERROR_CEASE,         "Cease" },
1337
    { BGP_MAJOR_ERROR_ROUTE_REFRESH, "ROUTE-REFRESH Message Error" },    /* RFC 7313 - Enhanced Route Refresh Capability for BGP-4 */
1338
    { BGP_MAJOR_ERROR_SH_T_EXPIRED,  "Send Hold Timer Expired" },
1339
    { 0, NULL }
1340
};
1341
1342
static const value_string bgpnotify_minor_msg_hdr[] = {
1343
    { 1, "Connection Not Synchronized" },
1344
    { 2, "Bad Message Length" },
1345
    { 3, "Bad Message Type" },
1346
    { 0, NULL }
1347
};
1348
1349
static const value_string bgpnotify_minor_open_msg[] = {
1350
    { 1,  "Unsupported Version Number" },
1351
    { 2,  "Bad Peer AS" },
1352
    { 3,  "Bad BGP Identifier" },
1353
    { 4,  "Unsupported Optional Parameter" },
1354
    { 5,  "Authentication Failure [Deprecated]" },
1355
    { 6,  "Unacceptable Hold Time" },
1356
    { 7,  "Unsupported Capability" },
1357
    { 8,  "No supported AFI/SAFI (Cisco)" },
1358
    { 11, "Role Mismatch" },
1359
    { 0, NULL }
1360
};
1361
1362
static const value_string bgpnotify_minor_update_msg[] = {
1363
    { 1,  "Malformed Attribute List" },
1364
    { 2,  "Unrecognized Well-known Attribute" },
1365
    { 3,  "Missing Well-known Attribute" },
1366
    { 4,  "Attribute Flags Error" },
1367
    { 5,  "Attribute Length Error" },
1368
    { 6,  "Invalid ORIGIN Attribute" },
1369
    { 7,  "AS Routing Loop [Deprecated]" },
1370
    { 8,  "Invalid NEXT_HOP Attribute" },
1371
    { 9,  "Optional Attribute Error" },
1372
    { 10, "Invalid Network Field" },
1373
    { 11, "Malformed AS_PATH" },
1374
    { 0, NULL }
1375
};
1376
/* RFC6608 Subcodes for BGP Finite State Machine Error */
1377
static const value_string bgpnotify_minor_state_machine[] = {
1378
    { 1, "Receive Unexpected Message in OpenSent State" },
1379
    { 2, "Receive Unexpected Message in OpenConfirm State" },
1380
    { 3, "Receive Unexpected Message in Established State" },
1381
    { 0, NULL }
1382
};
1383
1384
#define BGP_CEASE_MINOR_MAX_REACHED       1
1385
466
#define BGP_CEASE_MINOR_ADMIN_SHUTDOWN    2
1386
#define BGP_CEASE_MINOR_PEER_DE_CONF      3
1387
144
#define BGP_CEASE_MINOR_ADMIN_RESET       4
1388
#define BGP_CEASE_MINOR_CONN_RESET        5
1389
#define BGP_CEASE_MINOR_OTHER_CONF_CHANGE 6
1390
#define BGP_CEASE_MINOR_CONN_COLLISION    7
1391
#define BGP_CEASE_MINOR_OUT_RESOURCES     8
1392
#define BGP_CEASE_MINOR_HARD_RESET        9
1393
#define BGP_CEASE_MINOR_BFD_DOWN          10
1394
1395
/* RFC4486 Subcodes for BGP Cease Notification Message */
1396
static const value_string bgpnotify_minor_cease[] = {
1397
    { BGP_CEASE_MINOR_MAX_REACHED,       "Maximum Number of Prefixes Reached"},
1398
    { BGP_CEASE_MINOR_ADMIN_SHUTDOWN,    "Administratively Shutdown"},
1399
    { BGP_CEASE_MINOR_PEER_DE_CONF,      "Peer De-configured"},
1400
    { BGP_CEASE_MINOR_ADMIN_RESET,       "Administratively Reset"},
1401
    { BGP_CEASE_MINOR_CONN_RESET,        "Connection Rejected"},
1402
    { BGP_CEASE_MINOR_OTHER_CONF_CHANGE, "Other Configuration Change"},
1403
    { BGP_CEASE_MINOR_CONN_COLLISION,    "Connection Collision Resolution"},
1404
    { BGP_CEASE_MINOR_OUT_RESOURCES,     "Out of Resources"},
1405
    { BGP_CEASE_MINOR_HARD_RESET,        "Hard Reset"},
1406
    { BGP_CEASE_MINOR_BFD_DOWN,          "BFD Down"},
1407
    { 0,                                 NULL }
1408
};
1409
1410
/* RFC7313 - Enhanced Route Refresh Capability for BGP-4 */
1411
static const value_string bgpnotify_minor_rr_msg[] = {
1412
    { 1, "Invalid Message Length" },
1413
    { 0, NULL }
1414
};
1415
1416
static const value_string bgpattr_origin[] = {
1417
    { 0, "IGP" },
1418
    { 1, "EGP" },
1419
    { 2, "INCOMPLETE" },
1420
    { 0, NULL }
1421
};
1422
1423
static const value_string bgp_open_opt_vals[] = {
1424
    { BGP_OPTION_AUTHENTICATION, "Authentication" },
1425
    { BGP_OPTION_CAPABILITY, "Capability" },
1426
    { BGP_OPTION_EXTENDED_LEN, "Extended Length"},
1427
    { 0, NULL }
1428
};
1429
1430
static const value_string as_segment_type[] = {
1431
    { 1, "AS_SET" },
1432
    { 2, "AS_SEQUENCE" },
1433
/* RFC1965 has the wrong values, corrected in  */
1434
/* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
1435
    { 4, "AS_CONFED_SET" },
1436
    { 3, "AS_CONFED_SEQUENCE" },
1437
    { 0, NULL }
1438
};
1439
1440
static const value_string bgpattr_type[] = {
1441
    { BGPTYPE_ORIGIN,              "ORIGIN" },
1442
    { BGPTYPE_AS_PATH,             "AS_PATH" },
1443
    { BGPTYPE_NEXT_HOP,            "NEXT_HOP" },
1444
    { BGPTYPE_MULTI_EXIT_DISC,     "MULTI_EXIT_DISC" },
1445
    { BGPTYPE_LOCAL_PREF,          "LOCAL_PREF" },
1446
    { BGPTYPE_ATOMIC_AGGREGATE,    "ATOMIC_AGGREGATE" },
1447
    { BGPTYPE_AGGREGATOR,          "AGGREGATOR" },
1448
    { BGPTYPE_COMMUNITIES,         "COMMUNITIES" },
1449
    { BGPTYPE_ORIGINATOR_ID,       "ORIGINATOR_ID" },
1450
    { BGPTYPE_CLUSTER_LIST,        "CLUSTER_LIST" },
1451
    { BGPTYPE_DPA,                 "DPA" },
1452
    { BGPTYPE_ADVERTISER,          "ADVERTISER" },
1453
    { BGPTYPE_RCID_PATH,           "RCID_PATH / CLUSTER_ID" },
1454
    { BGPTYPE_MP_REACH_NLRI,       "MP_REACH_NLRI" },
1455
    { BGPTYPE_MP_UNREACH_NLRI,     "MP_UNREACH_NLRI" },
1456
    { BGPTYPE_EXTENDED_COMMUNITY,  "EXTENDED_COMMUNITIES" },
1457
    { BGPTYPE_AS4_PATH,            "AS4_PATH" },
1458
    { BGPTYPE_AS4_AGGREGATOR,      "AS4_AGGREGATOR" },
1459
    { BGPTYPE_SAFI_SPECIFIC_ATTR,  "SAFI_SPECIFIC_ATTRIBUTE" },
1460
    { BGPTYPE_CONNECTOR_ATTRIBUTE, "Connector Attribute" },
1461
    { BGPTYPE_AS_PATHLIMIT,        "AS_PATHLIMIT "},
1462
    { BGPTYPE_PMSI_TUNNEL_ATTR,    "PMSI_TUNNEL_ATTRIBUTE" },
1463
    { BGPTYPE_TUNNEL_ENCAPS_ATTR,  "TUNNEL_ENCAPSULATION_ATTRIBUTE" },
1464
    { BGPTYPE_TRAFFIC_ENGINEERING, "Traffic Engineering" },
1465
    { BGPTYPE_IPV6_ADDR_SPEC_EC,   "IPv6 Address Specific Extended Community" },
1466
    { BGPTYPE_AIGP,                "AIGP" },
1467
    { BGPTYPE_PE_DISTING_LABLES,   "PE Distinguisher Labels" },
1468
    { BGPTYPE_BGP_ENTROPY_LABEL,   "BGP Entropy Label Capability Attribute" },
1469
    { BGPTYPE_LINK_STATE_ATTR,     "BGP-LS Attribute" },
1470
    { BGPTYPE_30,                  "Deprecated" },
1471
    { BGPTYPE_31,                  "Deprecated" },
1472
    { BGPTYPE_LARGE_COMMUNITY,     "LARGE_COMMUNITY" },
1473
    { BGPTYPE_BGPSEC_PATH,         "BGPsec_PATH" },
1474
    { BGPTYPE_OTC,                 "OTC" },
1475
    { BGPTYPE_D_PATH,              "D_PATH" },
1476
    { BGPTYPE_SFP_ATTRIBUTE,       "SFP Attribute" },
1477
    { BGPTYPE_BFD_DISCRIMINATOR,   "BFD Discriminator" },
1478
    { BGPTYPE_NEXT_HOP_DEP_CAP,    "BGP Next Hop Dependent Capabilities" },
1479
    { BGPTYPE_BGP_PREFIX_SID,      "BGP Prefix-SID" },
1480
    { BGPTYPE_LINK_STATE_OLD_ATTR, "LINK_STATE (unofficial code point)" },
1481
    { BGPTYPE_ATTR_SET,            "ATTR_SET" },
1482
    { BGPTYPE_129,                 "Deprecated" },
1483
    { BGPTYPE_241,                 "Deprecated" },
1484
    { BGPTYPE_242,                 "Deprecated" },
1485
    { BGPTYPE_243,                 "Deprecated" },
1486
    { 0, NULL }
1487
};
1488
1489
static const value_string pmsi_tunnel_type[] = {
1490
    { PMSI_TUNNEL_NOPRESENT,      "Type is not present" },
1491
    { PMSI_TUNNEL_RSVPTE_P2MP,    "RSVP-TE P2MP LSP" },
1492
    { PMSI_TUNNEL_MLDP_P2MP,      "mLDP P2MP LSP" },
1493
    { PMSI_TUNNEL_PIMSSM,         "PIM SSM Tree" },
1494
    { PMSI_TUNNEL_PIMSM,          "PIM SM Tree" },
1495
    { PMSI_TUNNEL_BIDIR_PIM,      "BIDIR-PIM Tree" },
1496
    { PMSI_TUNNEL_INGRESS,        "Ingress Replication" },
1497
    { PMSI_TUNNEL_MLDP_MP2MP,     "mLDP MP2MP LSP" },
1498
    { PMSI_TUNNEL_TRANPORT,       "Transport Tunnel" },
1499
    { PMSI_TUNNEL_ASS_REPLIC,     "Assisted Replication Tunnel" },
1500
    { PMSI_TUNNEL_BIER,           "BIER" },
1501
    { PMSI_TUNNEL_SR_MPLS_P2MP,   "SR-MPLS P2MP Tree" },
1502
    { 0, NULL }
1503
};
1504
1505
static const value_string aigp_tlv_type[] = {
1506
    { AIGP_TLV_TYPE,            "Type AIGP TLV" },
1507
    { 0, NULL }
1508
};
1509
1510
static const value_string pmsi_mldp_fec_opaque_value_type[] = {
1511
    { PMSI_MLDP_FEC_TYPE_RSVD,                      "Reserved" },
1512
    { PMSI_MLDP_FEC_TYPE_GEN_LSP,                   "Generic LSP Identifier" },
1513
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SRC,          "Transit IPv4 Source" },
1514
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SRC,          "Transit IPv6 Source" },
1515
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_BIDIR,        "Transit IPv4 Bidir" },
1516
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_BIDIR,        "Transit IPv6 Bidir" },
1517
    { PMSI_MLDP_FEC_TYPE_RECURSE_OPAQUE_VALUE,      "Recursive Opaque Value" },
1518
    { PMSI_MLDP_FEC_TYPE_VPN_RECURSE_OPAQUE_VALUE,  "VPN-Recursive Opaque Value" },
1519
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_BIDIR,       "Transit VPNv4 Bidir" },
1520
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_BIDIR,       "Transit VPNv6 Bidir" },
1521
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SHARED_TREE,  "Transit IPv4 Shared Tree" },
1522
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SHARED_TREE,  "Transit IPv6 Shared Tree" },
1523
    { PMSI_MLDP_FEC_TYPE_L2VPN_MCAST,               "L2VPN-MCAST application" },
1524
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_SRC,         "Transit VPNv4 Source" },
1525
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_SRC,         "Transit VPNv6 Source" },
1526
    { PMSI_MLDP_FEC_TYPE_EXT_TYPE,                  "Extended Type field in the following two bytes" },
1527
    { 0, NULL}
1528
};
1529
1530
static const value_string pmsi_mldp_fec_opa_extented_type[] = {
1531
    { PMSI_MLDP_FEC_ETYPE_RSVD,         "Reserved" },
1532
    { 0, NULL}
1533
};
1534
1535
static const value_string bgp_attr_tunnel_type[] = {
1536
    { TUNNEL_TYPE_L2TP_OVER_IP, "L2TPv2 over IP" },
1537
    { TUNNEL_TYPE_GRE,          "GRE" },
1538
    { TUNNEL_TYPE_TTE,          "Transmit tunnel endpoint" },
1539
    { TUNNEL_TYPE_IPSEC_IN_TM,  "IPsec in Tunnel-mode" },
1540
    { TUNNEL_TYPE_IP_IN_IP_IPSEC, "IP in IP tunnel with IPsec Transport Mode" },
1541
    { TUNNEL_TYPE_MPLS_IN_IP_IPSEC, "MPLS-in-IP tunnel with IPsec Transport Mode" },
1542
    { TUNNEL_TYPE_IP_IN_IP,     "IP in IP" },
1543
    { TUNNEL_TYPE_VXLAN,        "VXLAN Encapsulation" },
1544
    { TUNNEL_TYPE_NVGRE,        "NVGRE Encapsulation" },
1545
    { TUNNEL_TYPE_MPLS,         "MPLS Encapsulation" },
1546
    { TUNNEL_TYPE_MPLS_IN_GRE,  "MPLS in GRE Encapsulation" },
1547
    { TUNNEL_TYPE_VXLAN_GPE,    "VXLAN GPE Encapsulation" },
1548
    { TUNNEL_TYPE_MPLS_IN_UDP,  "MPLS in UDP Encapsulation" },
1549
    { TUNNEL_TYPE_IPV6_TUNNEL,  "IPv6 Tunnel" },
1550
    { TUNNEL_TYPE_SR_TE_POLICY, "SR TE Policy Type" },
1551
    { TUNNEL_TYPE_BARE,         "Bare" },
1552
    { TUNNEL_TYPE_SR_TUNNEL,    "SR Tunnel" },
1553
    { TUNNEL_TYPE_CLOUD_SECURITY, "Cloud Security" },
1554
    { TUNNEL_TYPE_GENEVE_ENCAP, "Geneve Encapsulation" },
1555
    { TUNNEL_TYPE_ANY_ENCAP,    "Any Encapsulation" },
1556
    { TUNNEL_TYPE_GTP_TUNNEL_TYPE, "GTP Tunnel Type" },
1557
    { TUNNEL_TYPE_DPS_TUNNEL_ENCAP, "Dynamic Path Selection Tunnel Encapsulation" },
1558
    { TUNNEL_TYPE_ORIGINATING_PE, "Originating PE" },
1559
    { TUNNEL_TYPE_DPS_POLICY,   "Dynamic Path Selection Policy" },
1560
    { TUNNEL_TYPE_SDWAN_HYBRID, "SDWAN Hybrid" },
1561
    { TUNNEL_TYPE_X_OVER_UDP,   "X-over-UDP" },
1562
    { TUNNEL_TYPE_DES_TUNNEL_ENCAP, "Distributed Etherlink Switch Tunnel Encapsulation" },
1563
    { 0, NULL }
1564
};
1565
1566
static const value_string subtlv_type[] = {
1567
    { TUNNEL_SUBTLV_ENCAPSULATION,  "Encapsulation" },
1568
    { TUNNEL_SUBTLV_PROTO_TYPE,     "Protocol Type" },
1569
    { TUNNEL_SUBTLV_IPSEC_TA,       "IPsec Tunnel Authenticator" },
1570
    { TUNNEL_SUBTLV_COLOR,          "Color" },
1571
    { TUNNEL_SUBTLV_LOAD_BALANCE,   "Load-Balancing Block" },
1572
    { TUNNEL_SUBTLV_REMOTE_ENDPOINT,"Tunnel Egress Endpoint" },
1573
    { TUNNEL_SUBTLV_IPV4_DS_FIELD,  "IPv4 DS Field" },
1574
    { TUNNEL_SUBTLV_UDP_DST_PORT,   "UDP Destination Port" },
1575
    { TUNNEL_SUBTLV_EMBEDDED_LABEL, "Embedded Label Handling" },
1576
    { TUNNEL_SUBTLV_MPLS_LABEL,     "MPLS Label Stack" },
1577
    { TUNNEL_SUBTLV_PREFIX_SID,     "Prefix SID" },
1578
    { TUNNEL_SUBTLV_PREFERENCE,     "Preference" },
1579
    { TUNNEL_SUBTLV_BINDING_SID,    "Binding SID" },
1580
    { TUNNEL_SUBTLV_ENLP,           "ENLP" },
1581
    { TUNNEL_SUBTLV_PRIORITY,       "Priority" },
1582
    { TUNNEL_SUBTLV_SPI_SI_REP,     "SPI/SI Representation" },
1583
    { TUNNEL_SUBTLV_SRV6_BINDING_SID, "SRv6 Binding SID" },
1584
    { TUNNEL_SUBTLV_IPSEC_SA_ID,    "IPSEC-SA-ID" },
1585
    { TUNNEL_SUBTLV_EXT_PORT_PROP,  "Extended Port Property" },
1586
    { TUNNEL_SUBTLV_UNDERLAY_ISP_PROP, "Underlay ISP Properties" },
1587
    { TUNNEL_SUBTLV_IPSEC_SA_NONCE, "IPsec SA Nonce" },
1588
    { TUNNEL_SUBTLV_IPSEC_PUBLIC_KEY, "IPsec Public Key" },
1589
    { TUNNEL_SUBTLV_IPSEC_SA_PROPOSAL, "IPsec SA Proposal" },
1590
    { TUNNEL_SUBTLV_SIMPL_IPSEC_SA, "Simplified IPsec SA" },
1591
    { TUNNEL_SUBTLV_NRP,            "NRP" },
1592
    { TUNNEL_SUBTLV_RPF,            "RPF" },
1593
    { TUNNEL_SUBTLV_TREE_LABEL_STACK, "Tree Label Stack" },
1594
    { TUNNEL_SUBTLV_SEGMENT_LIST,   "Segment List" },
1595
    { TUNNEL_SUBTLV_POLICY_CP_NAME, "Policy CP Name" },
1596
    { TUNNEL_SUBTLV_POLICY_NAME,    "Policy Name" },
1597
    { TUNNEL_SUBTLV_WAN_ID,         "The WAN ID" },
1598
    { TUNNEL_SUBTLV_BYTES,          "The Bytes" },
1599
    { TUNNEL_SUBTLV_IPSEC_DIM,      "IPSEC DIM" },
1600
    { TUNNEL_SUBTLV_IPSEC_KEY_EXCH, "IPSEC Key Exchange" },
1601
    { TUNNEL_SUBTLV_IPSEC_SA_PROPS, "IPSEC SA Proposals" },
1602
    { TUNNEL_SUBTLV_SRV_SEGMENT_LIST, "Service Segment List" },
1603
    { TUNNEL_SUBTLV_SRV_VTEP,       "Service Vtep" },
1604
    { TUNNEL_SUBTLV_DES_ADJACENCY,  "Distributed Etherlink Switch (DES) Adjacency" },
1605
    { 0, NULL }
1606
};
1607
1608
static const value_string bgp_enlp_type[] = {
1609
    { 0 , "Reserved" },
1610
    { 1 , "Push IPv4, do not push IPv6" },
1611
    { 2 , "Push IPv6, do not push IPv4" },
1612
    { 3 , "Push IPv4, push IPv6" },
1613
    { 4 , "Do not push" },
1614
    { 0, NULL }
1615
};
1616
1617
static const value_string bgp_sr_policy_list_type[] = {
1618
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A,      "Type A MPLS SID sub-TLV" },
1619
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B_OLD,  "Type B SRv6 SID sub-TLV (deprecated)" },
1620
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C,      "Type C IPv4 Node and SID sub-TLV" },
1621
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D,      "Type D IPv6 Node and SID for SR-MPLS sub-TLV" },
1622
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E,      "Type E IPv4 Node, index and SID sub-TLV" },
1623
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F,      "Type F IPv4 Local/Remote addresses and SID sub-TLV" },
1624
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G,      "Type G IPv6 Node, index for remote and local pair and SID for SR-MPLS sub-TLV" },
1625
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H,      "Type H IPv6 Local/Remote addresses and SID sub-TLV" },
1626
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT, "Weight sub-TLV" },
1627
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I_OLD,  "Type I IPv6 Node and SID for SRv6 sub-TLV (deprecated)" },
1628
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J_OLD,  "Type J IPv6 Node, index for remote and local pair and SID for SRv6 sub-TLV (deprecated)" },
1629
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K_OLD,  "Type K IPv6 Local/Remote addresses and SID for SRv6 sub-TLV (deprecated)" },
1630
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B,      "Type B SRv6 SID sub-TLV" },
1631
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I,      "Type I IPv6 Node and SID for SRv6 sub-TLV" },
1632
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J,      "Type J IPv6 Node, index for remote and local pair and SID for SRv6 sub-TLV" },
1633
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K,      "Type K IPv6 Local/Remote addresses and SID for SRv6 sub-TLV" },
1634
    { 0, NULL }
1635
};
1636
1637
/* Short display names for segment list sub-TLV types, used in parent item summary */
1638
static const value_string bgp_sr_policy_list_type_short[] = {
1639
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A,      "MPLS SID" },
1640
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B_OLD,  "SRv6 SID (deprecated)" },
1641
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C,      "IPv4+SID" },
1642
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D,      "IPv6+SID" },
1643
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E,      "IPv4+Index+SID" },
1644
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F,      "IPv4 Adj+SID" },
1645
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G,      "IPv6+Index+SID" },
1646
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H,      "IPv6 Adj+SID" },
1647
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT, "Weight" },
1648
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I_OLD,  "IPv6+SRv6 SID (deprecated)" },
1649
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J_OLD,  "SRv6+Index (deprecated)" },
1650
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K_OLD,  "SRv6 Adj (deprecated)" },
1651
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B,      "SRv6 SID" },
1652
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I,      "IPv6+SRv6 SID" },
1653
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J,      "SRv6+Index" },
1654
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K,      "SRv6 Adj" },
1655
    { 0, NULL }
1656
};
1657
1658
static const true_false_string tfs_bgpext_com_type_auth = {
1659
    "Allocated on Standard Action, Early Allocation or Experimental Basis",
1660
    "Allocated on First Come First Serve Basis"
1661
};
1662
1663
static const value_string bgpext_com_type_high[] = {
1664
    { BGP_EXT_COM_TYPE_HIGH_TR_AS2,        "Transitive 2-Octet AS-Specific" },
1665
    { BGP_EXT_COM_TYPE_HIGH_TR_IP4,        "Transitive IPv4-Address-Specific" },
1666
    { BGP_EXT_COM_TYPE_HIGH_TR_AS4,        "Transitive 4-Octet AS-Specific" },
1667
    { BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE,     "Transitive Opaque" },
1668
    { BGP_EXT_COM_TYPE_HIGH_TR_QOS,        "Transitive QoS Marking" },
1669
    { BGP_EXT_COM_TYPE_HIGH_TR_COS,        "Transitive CoS Capability" },
1670
    { BGP_EXT_COM_TYPE_HIGH_TR_EVPN,       "Transitive EVPN" },
1671
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I,     "FlowSpec Transitive" },
1672
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW,       "Transitive Flow spec redirect/mirror to IP next-hop" },
1673
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R,     "Transitive FlowSpec Redirect to indirection-id" },
1674
    { BGP_EXT_COM_TYPE_HIGH_TR_TP_CLASS,   "Transitive Transport Class" },
1675
    { BGP_EXT_COM_TYPE_HIGH_TR_SFC,        "Transitive SFC" },
1676
    { BGP_EXT_COM_TYPE_HIGH_TR_MUP,        "Transitive MUP" },
1677
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT,        "Generic Transitive Extended Community"},
1678
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT_2,      "Generic Transitive Extended Community Part 2"},
1679
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT_3,      "Generic Transitive Extended Community Part 3 "},
1680
    { BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP,  "Transitive Experimental EIGRP" },
1681
    { BGP_EXT_COM_TYPE_HIGH_NTR_AS2,       "Non-Transitive 2-Octet AS-Specific" },
1682
    { BGP_EXT_COM_TYPE_HIGH_NTR_IP4,       "Non-Transitive IPv4-Address-Specific" },
1683
    { BGP_EXT_COM_TYPE_HIGH_NTR_AS4,       "Non-Transitive 4-Octet AS-Specific" },
1684
    { BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE,    "Non-Transitive Opaque" },
1685
    { BGP_EXT_COM_TYPE_HIGH_NTR_QOS,       "Non-Transitive QoS Marking" },
1686
    { BGP_EXT_COM_TYPE_HIGH_NTR_FLOWSPEC,  "FlowSpec Non-Transitive Extended Communities" },
1687
    { BGP_EXT_COM_TYPE_HIGH_NTR_TRANSPORT, "Non-Transitive Transport Class" },
1688
    { 0, NULL}
1689
};
1690
1691
static const value_string bgpext_com_stype_tr_exp_2[] = {
1692
    { BGP_EXT_COM_STYPE_EXP_2_FLOW_RED,      "Flow spec redirect IPv4 format"},
1693
    { 0, NULL}
1694
};
1695
1696
static const value_string bgpext_com_stype_tr_exp_3[] = {
1697
    { BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP,     "Security Group AS4"},
1698
    { BGP_EXT_COM_STYPE_EXP_3_FLOW_RED,      "Flow spec redirect AS-4byte format"},
1699
    { BGP_EXT_COM_STYPE_EXP_3_TAG4,          "Tag4"},
1700
    { BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS,      "Origin Sub-Cluster4"},
1701
    { 0, NULL}
1702
};
1703
1704
static const value_string bgpext_com_stype_tr_evpn[] = {
1705
    { BGP_EXT_COM_STYPE_EVPN_MMAC,        "MAC Mobility" },
1706
    { BGP_EXT_COM_STYPE_EVPN_LABEL,       "ESI Label" },
1707
    { BGP_EXT_COM_STYPE_EVPN_IMP,         "ES-Import Route Target" },
1708
    { BGP_EXT_COM_STYPE_EVPN_ROUTERMAC,   "EVPN Router's MAC" },
1709
    { BGP_EXT_COM_STYPE_EVPN_L2ATTR,      "EVPN Layer 2 Attributes" },
1710
    { BGP_EXT_COM_STYPE_EVPN_ETREE,       "E-Tree" },
1711
    { BGP_EXT_COM_STYPE_EVPN_DF,          "DF Election" },
1712
    { BGP_EXT_COM_STYPE_EVPN_ISID,        "I-SID" },
1713
    { BGP_EXT_COM_STYPE_EVPN_ND,          "ARP/ND" },
1714
    { BGP_EXT_COM_STYPE_EVPN_MCFLAGS,     "Multicast Flags Extended Community" },
1715
    { BGP_EXT_COM_STYPE_EVPN_EVIRT0,      "EVI-RT Type 0 Extended Community" },
1716
    { BGP_EXT_COM_STYPE_EVPN_EVIRT1,      "EVI-RT Type 1 Extended Community" },
1717
    { BGP_EXT_COM_STYPE_EVPN_EVIRT2,      "EVI-RT Type 2 Extended Community" },
1718
    { BGP_EXT_COM_STYPE_EVPN_EVIRT3,      "EVI-RT Type 3 Extended Community" },
1719
    { BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT,  "EVPN Attachment Circuit" },
1720
    { BGP_EXT_COM_STYPE_EVPN_SVC_CARV_TS, "Service Carving Timestamp" },
1721
    { BGP_EXT_COM_STYPE_EVPN_LINK_BW,     "EVPN Link Bandwidth Extended Community" },
1722
    { BGP_EXT_COM_STYPE_EVPN_RT_EC,       "RT-derived-EC" },
1723
    { 0, NULL}
1724
};
1725
1726
static const value_string bgpext_com_stype_tr_as2[] = {
1727
    { BGP_EXT_COM_STYPE_AS2_RT,       "Route Target" },
1728
    { BGP_EXT_COM_STYPE_AS2_RO,       "Route Origin" },
1729
    { BGP_EXT_COM_STYPE_AS2_LBW,      "Link Bandwidth" },
1730
    { BGP_EXT_COM_STYPE_AS2_OSPF_DID, "OSPF Domain Identifier" },
1731
    { BGP_EXT_COM_STYPE_AS2_RT_AGG_P, "Route Aggregation Parameter" },
1732
    { BGP_EXT_COM_STYPE_AS2_DCOLL,    "BGP Data Collection" },
1733
    { BGP_EXT_COM_STYPE_AS2_SRC_AS,   "Source AS" },
1734
    { BGP_EXT_COM_STYPE_AS2_L2VPN,    "L2VPN Identifier" },
1735
    { BGP_EXT_COM_STYPE_AS2_CVPND,    "Cisco VPN-Distinguisher" },
1736
    { BGP_EXT_COM_STYPE_AS2_RT_REC,   "Route Target Record" },
1737
    { BGP_EXT_COM_STYPE_AS2_RT_EC,    "RT-derived-EC" },
1738
    { BGP_EXT_COM_STYPE_AS2_VNI,      "Virtual-Network Identifier" },
1739
    { 0, NULL}
1740
};
1741
1742
static const value_string bgpext_com_stype_ntr_as2[] = {
1743
    { BGP_EXT_COM_STYPE_AS2_LBW, "Link Bandwidth" },
1744
    { BGP_EXT_COM_STYPE_AS2_VNI, "Virtual-Network Identifier" },
1745
    { 0, NULL}
1746
};
1747
1748
static const value_string bgpext_com_stype_tr_as4[] = {
1749
    { BGP_EXT_COM_STYPE_AS4_RT,       "Route Target" },
1750
    { BGP_EXT_COM_STYPE_AS4_RO,       "Route Origin" },
1751
    { BGP_EXT_COM_STYPE_AS4_GEN,      "Generic" },
1752
    { BGP_EXT_COM_STYPE_AS4_OSPF_DID, "OSPF Domain Identifier" },
1753
    { BGP_EXT_COM_STYPE_AS4_BGP_DC,   "BGP Data Collection"},
1754
    { BGP_EXT_COM_STYPE_AS4_S_AS,     "Source AS" },
1755
    { BGP_EXT_COM_STYPE_AS4_CIS_V,    "Cisco VPN Identifier" },
1756
    { BGP_EXT_COM_STYPE_AS4_RT_REC,   "Route-Target Record"},
1757
    { BGP_EXT_COM_STYPE_AS4_RT_EC,    "RT-derived-EC" },
1758
    { 0, NULL}
1759
};
1760
1761
static const value_string bgpext_com_stype_ntr_as4[] = {
1762
    { BGP_EXT_COM_STYPE_AS4_GEN, "Generic" },
1763
    { 0, NULL}
1764
};
1765
1766
static const value_string bgpext_com_stype_tr_IP4[] = {
1767
    { BGP_EXT_COM_STYPE_IP4_RT,       "Route Target" },
1768
    { BGP_EXT_COM_STYPE_IP4_RO,       "Route Origin" },
1769
    { BGP_EXT_COM_STYPE_IP4_IFIT_TAIL,"IPv4-Address-Specific IFIT Tail Community" },
1770
    { BGP_EXT_COM_STYPE_IP4_OSPF_DID, "OSPF Domain Identifier" },
1771
    { BGP_EXT_COM_STYPE_IP4_OSPF_RID, "OSPF Router ID" },
1772
    { BGP_EXT_COM_STYPE_IP4_NODE_TGT, "Node Target Extended Community" },
1773
    { BGP_EXT_COM_STYPE_IP4_L2VPN,    "L2VPN Identifier" },
1774
    { BGP_EXT_COM_STYPE_IP4_VRF_I,    "VRF Route Import" },
1775
    { BGP_EXT_COM_STYPE_IP4_FLOW_RDR, "Flow-spec Redirect to IPv4" },
1776
    { BGP_EXT_COM_STYPE_IP4_CIS_D,    "Cisco VPN-Distinguisher" },
1777
    { BGP_EXT_COM_STYPE_IP4_SEG_NH,   "Inter-area P2MP Segmented Next-Hop" },
1778
    { BGP_EXT_COM_STYPE_IP4_RT_REC,   "Route-Target Record" },
1779
    { BGP_EXT_COM_STYPE_IP4_VRF_RNH,  "VRF-Recursive-Next-Hop-Extended-Community" },
1780
    { BGP_EXT_COM_STYPE_IP4_RT_EC,    "RT-derived-EC" },
1781
    { BGP_EXT_COM_STYPE_IP4_MVPN_RP,  "MVPN SA RP-address Extended Community" },
1782
    { 0, NULL}
1783
};
1784
1785
static const value_string bgpext_com_stype_ntr_IP4[] = {
1786
    { BGP_EXT_COM_STYPE_IP4_NODE_TGT, "Node Target Extended Community" },
1787
    { 0, NULL}
1788
};
1789
1790
static const value_string bgpext_com_stype_tr_opaque[] = {
1791
    { BGP_EXT_COM_STYPE_OPA_COST,      "Cost" },
1792
    { BGP_EXT_COM_STYPE_OPA_CP_OSPF,   "CP-ORF" },
1793
    { BGP_EXT_COM_STYPE_OPA_EXTN_SRC,  "Extranet Source Extended Community" },
1794
    { BGP_EXT_COM_STYPE_OPA_EXTN_SEP,  "Extranet Separation Extended Community" },
1795
    { BGP_EXT_COM_STYPE_OPA_OSPF_RT,   "OSPF Route Type" },
1796
    { BGP_EXT_COM_STYPE_OPA_PMSI_ATTR, "Additional PMSI Tunnel Attribute Flags" },
1797
    { BGP_EXT_COM_STYPE_OPA_CTX_LBL,   "Context-Specific Label Space ID Extended Community" },
1798
    { BGP_EXT_COM_STYPE_OPA_COLOR,     "Color" },
1799
    { BGP_EXT_COM_STYPE_OPA_ENCAP,     "Encapsulation" },
1800
    { BGP_EXT_COM_STYPE_OPA_DGTW,      "Default Gateway" },
1801
    { BGP_EXT_COM_STYPE_OPA_PPMP_LBL,  "Point-to-Point-to-Multipoint (PPMP) Label" },
1802
    { BGP_EXT_COM_STYPE_OPA_GRP_TAG,   "BGP Group Policy Class Tag Extended Community" },
1803
    { BGP_EXT_COM_STYPE_OPA_HSH_SRT,   "Consistent Hash Sort Order" },
1804
    { BGP_EXT_COM_STYPE_OPA_GRP_PID,   "Group Policy ID Extended Community" },
1805
    { BGP_EXT_COM_STYPE_OPA_LCM,       "Local Color Mapping (LCM)" },
1806
    { BGP_EXT_COM_STYPE_OPA_LOADBAL,   "LoadBalance" },
1807
    { 0, NULL}
1808
};
1809
1810
static const value_string bgpext_com_cost_poi_type[] = {
1811
    { BGP_EXT_COM_COST_POI_ORIGIN,  "\"Lowest Origin code\" step" },
1812
    { BGP_EXT_COM_COST_POI_ASPATH,  "\"Shortest AS_PATH\" step" },
1813
    { BGP_EXT_COM_COST_POI_MED,     "\"Lowest MED\" step" },
1814
    { BGP_EXT_COM_COST_POI_LP,      "\"Highest Local Preference\" step" },
1815
    { BGP_EXT_COM_COST_POI_AIGP,    "\"Lowest Accumulated IGP Cost\" step" },
1816
    { BGP_EXT_COM_COST_POI_ABS,     "Before BGP Best Path algorithm" },
1817
    { BGP_EXT_COM_COST_POI_IGP,     "\"Smallest IGP Metric\" step" },
1818
    { BGP_EXT_COM_COST_POI_EI,      "\"Prefer eBGP to iBGP\" step" },
1819
    { BGP_EXT_COM_COST_POI_RID,     "\"Smallest BGP RID\" step" },
1820
    { 0,NULL}
1821
};
1822
1823
static const value_string bgpext_com_tunnel_type[] = {
1824
    { BGP_EXT_COM_TUNNEL_RESERVED,      "Reserved" },
1825
    { BGP_EXT_COM_TUNNEL_L2TPV3,        "L2TPv3 over IP" },
1826
    { BGP_EXT_COM_TUNNEL_GRE,           "GRE" },
1827
    { BGP_EXT_COM_TUNNEL_ENDP,          "Transmit tunnel endpoint" },
1828
    { BGP_EXT_COM_TUNNEL_IPSEC,         "IPsec in Tunnel-mode" },
1829
    { BGP_EXT_COM_TUNNEL_IPIPSEC,       "IP in IP tunnel with IPsec Transport Mode" },
1830
    { BGP_EXT_COM_TUNNEL_MPLSIP,        "MPLS-in-IP tunnel with IPsec Transport Mode" },
1831
    { BGP_EXT_COM_TUNNEL_IPIP,          "IP in IP" },
1832
    { BGP_EXT_COM_TUNNEL_VXLAN,         "VXLAN Encapsulation" },
1833
    { BGP_EXT_COM_TUNNEL_NVGRE,         "NVGRE Encapsulation" },
1834
    { BGP_EXT_COM_TUNNEL_MPLS,          "MPLS Encapsulation" },
1835
    { BGP_EXT_COM_TUNNEL_MPLSGRE,       "MPLS in GRE Encapsulation" },
1836
    { BGP_EXT_COM_TUNNEL_VXLANGPE,      "VxLAN GPE Encapsulation" },
1837
    { BGP_EXT_COM_TUNNEL_MPLSUDP,       "MPLS in UDP Encapsulation" },
1838
    { BGP_EXT_COM_TUNNEL_IPV6_TUNNEL,   "IPv6 Tunnel" },
1839
    { BGP_EXT_COM_TUNNEL_SE_TE_POLICY,  "SR TE Policy Type" },
1840
    { BGP_EXT_COM_TUNNEL_BARE,          "Bare" },
1841
    { BGP_EXT_COM_TUNNEL_SR_TUNNEL,     "SR Tunnel" },
1842
    { BGP_EXT_COM_TUNNEL_CLOUD_SEC,     "Cloud Security" },
1843
    { BGP_EXT_COM_TUNNEL_GENEVE_ENCAP,  "Geneve Encapsulation" },
1844
    { BGP_EXT_COM_TUNNEL_ANY_ENCAP,     "Any Encapsulation" },
1845
    { BGP_EXT_COM_TUNNEL_GTP_TUNNEL,    "GTP Tunnel Type" },
1846
    { BGP_EXT_COM_TUNNEL_DPS_TUNNEL,    "Dynamic Path Selection (DPS) Tunnel Encapsulation" },
1847
    { BGP_EXT_COM_TUNNEL_OPE,           "Originating PE (OPE)" },
1848
    { BGP_EXT_COM_TUNNEL_DYN_DPS_POL,   "Dynamic Path Selection (DPS) Policy" },
1849
    { BGP_EXT_COM_TUNNEL_SDWAN_HYB,     "SDWAN-Hybrid" },
1850
    { BGP_EXT_COM_TUNNEL_X_OVER_UDP,    "X-over-UDP" },
1851
    { BGP_EXT_COM_TUNNEL_DES_ENCAP,     "Distributed Etherlink Switch (DES) Tunnel Encapsulation" },
1852
    { 0, NULL}
1853
};
1854
1855
static const value_string bgpext_com_stype_ntr_opaque[] = {
1856
    { BGP_EXT_COM_STYPE_OPA_OR_VAL_ST,  "BGP Origin Validation state" },
1857
    { BGP_EXT_COM_STYPE_OPA_COST,       "Cost Community" },
1858
    { BGP_EXT_COM_STYPE_OPA_RT,         "Route Target" },
1859
    { BGP_EXT_COM_STYPE_OPA_RT_EC,      "RT-derived-EC" },
1860
    { 0, NULL}
1861
};
1862
1863
static const value_string bgpext_com_stype_tr_exp[] = {
1864
    { BGP_EXT_COM_STYPE_EXP_OSPF_RT,    "OSPF Route Type" },
1865
    { BGP_EXT_COM_STYPE_EXP_OSPF_RID,   "OSPF Router ID" },
1866
    { BGP_EXT_COM_STYPE_EXP_SEC_GROUP,  "Security Group" },
1867
    { BGP_EXT_COM_STYPE_EXP_OSPF_DID,   "OSPF Domain Identifier" },
1868
    { BGP_EXT_COM_STYPE_EXP_F_TR,       "Flow spec traffic-rate" },
1869
    { BGP_EXT_COM_STYPE_EXP_F_TA,       "Flow spec traffic-action" },
1870
    { BGP_EXT_COM_STYPE_EXP_F_RED,      "Flow spec redirect AS 2 bytes" },
1871
    { BGP_EXT_COM_STYPE_EXP_F_RMARK,    "Flow spec traffic-remarking" },
1872
    { BGP_EXT_COM_STYPE_EXP_L2,         "Layer2 Info" },
1873
    { BGP_EXT_COM_STYPE_EXP_ETREE,      "E-Tree Info" },
1874
    { BGP_EXT_COM_STYPE_EXP_FLOW_RATE,  "Flow spec traffic-rate-packets" },
1875
    { BGP_EXT_COM_STYPE_EXP_FLOW_SFC,   "Flow Specification for SFC Classifiers" },
1876
    { BGP_EXT_COM_STYPE_EXP_TAG,        "Tag" },
1877
    { BGP_EXT_COM_STYPE_EXP_SUB_CLUS,   "Origin Sub-Cluster" },
1878
    { 0, NULL}
1879
};
1880
1881
static const value_string bgpext_com_stype_tr_eigrp[] = {
1882
    { BGP_EXT_COM_STYPE_EXP_EIGRP_FT,   "EIGRP Route Flags, Route Tag" },
1883
    { BGP_EXT_COM_STYPE_EXP_EIGRP_AD,   "EIGRP AS Number, Delay" },
1884
    { BGP_EXT_COM_STYPE_EXP_EIGRP_RHB,  "EIGRP Reliability, Hop Count, Bandwidth" },
1885
    { BGP_EXT_COM_STYPE_EXP_EIGRP_LM,   "EIGRP Load, MTU" },
1886
    { BGP_EXT_COM_STYPE_EXP_EIGRP_EAR,  "EIGRP External AS Number, Router ID" },
1887
    { BGP_EXT_COM_STYPE_EXP_EIGRP_EPM,  "EIGRP External Protocol, Metric" },
1888
    { BGP_EXT_COM_STYPE_EXP_EIGRP_RID,  "EIGRP Originating Router ID" },
1889
    { 0, NULL}
1890
};
1891
1892
static const value_string bgpext_com_stype_tr_mup[] = {
1893
    { BGP_EXT_COM_STYPE_MUP_DIRECT_SEG, "MUP Direct-Type Segment Identifier"},
1894
    { 0, NULL}
1895
};
1896
1897
static const value_string flow_spec_op_len_val[] = {
1898
    { 0, "1 byte: 1 <<"  },
1899
    { 1, "2 bytes: 1 <<" },
1900
    { 2, "4 bytes: 1 <<" },
1901
    { 3, "8 bytes: 1 <<" },
1902
    { 0, NULL  }
1903
};
1904
1905
static const value_string qos_tech_type[] = {
1906
    { QOS_TECH_TYPE_DSCP,         "DiffServ enabled IP (DSCP encoding)" },
1907
    { QOS_TECH_TYPE_802_1q,       "Ethernet using 802.1q priority tag" },
1908
    { QOS_TECH_TYPE_E_LSP,        "MPLS using E-LSP" },
1909
    { QOS_TECH_TYPE_VC,           "Virtual Channel (VC) encoding" },
1910
    { QOS_TECH_TYPE_GMPLS_TIME,   "GMPLS - time slot encoding" },
1911
    { QOS_TECH_TYPE_GMPLS_LAMBDA, "GMPLS - lambda encoding" },
1912
    { QOS_TECH_TYPE_GMPLS_FIBRE,  "GMPLS - fibre encoding" },
1913
    { 0, NULL }
1914
};
1915
1916
static const value_string bgp_ssa_type[] = {
1917
    { BGP_SSA_L2TPv3 ,          "L2TPv3 Tunnel" },
1918
    { BGP_SSA_mGRE ,            "mGRE Tunnel" },
1919
    { BGP_SSA_IPSec ,           "IPSec Tunnel" },
1920
    { BGP_SSA_MPLS ,            "MPLS Tunnel" },
1921
    { BGP_SSA_L2TPv3_IN_IPSec , "L2TPv3 in IPSec Tunnel" },
1922
    { BGP_SSA_mGRE_IN_IPSec ,   "mGRE in IPSec Tunnel" },
1923
    { 0, NULL }
1924
};
1925
1926
/*
1927
 * BGP Layer 2 Encapsulation Types
1928
 *
1929
 * RFC 6624
1930
 *
1931
 * http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-l2-encapsulation-types-registry
1932
 */
1933
static const value_string bgp_l2vpn_encaps[] = {
1934
    { 0,  "Reserved"},
1935
    { 1,  "Frame Relay"},
1936
    { 2,  "ATM AAL5 SDU VCC transport"},
1937
    { 3,  "ATM transparent cell transport"},
1938
    { 4,  "Ethernet (VLAN) Tagged mode"},
1939
    { 5,  "Ethernet raw mode"},
1940
    { 6,  "Cisco-HDLC"},
1941
    { 7,  "PPP"},
1942
    { 8,  "SONET/SDH CES"},
1943
    { 9,  "ATM n-to-one VCC cell transport"},
1944
    { 10, "ATM n-to-one VPC cell transport"},
1945
    { 11, "IP layer 2 transport"},
1946
    { 15, "Frame relay port mode"},
1947
    { 17, "Structure agnostic E1 over packet"},
1948
    { 18, "Structure agnostic T1 over packet"},
1949
    { 19, "VPLS"},
1950
    { 20, "Structure agnostic T3 over packet"},
1951
    { 21, "Nx64kbit/s Basic Service using Structure-aware"},
1952
    { 25, "Frame Relay DLCI"},
1953
    { 40, "Structure agnostic E3 over packet"},
1954
    { 41, "Octet-aligned playload for structure-agnostic DS1 circuits"},
1955
    { 42, "E1 Nx64kbit/s with CAS using Structure-aware"},
1956
    { 43, "DS1 (ESF) Nx64kbit/s with CAS using Structure-aware"},
1957
    { 44, "DS1 (SF) Nx64kbit/s with CAS using Structure-aware"},
1958
    { 64, "IP-interworking"},
1959
    { 0, NULL }
1960
};
1961
1962
static const value_string bgpext_com_ospf_rtype[] = {
1963
  { BGP_OSPF_RTYPE_RTR, "Router" },
1964
  { BGP_OSPF_RTYPE_NET, "Network" },
1965
  { BGP_OSPF_RTYPE_SUM, "Summary" },
1966
  { BGP_OSPF_RTYPE_EXT, "External" },
1967
  { BGP_OSPF_RTYPE_NSSA,"NSSA External" },
1968
  { BGP_OSPF_RTYPE_SHAM,"MPLS-VPN Sham" },
1969
  { 0, NULL }
1970
};
1971
1972
/* Subsequent address family identifier, RFC4760 */
1973
static const value_string bgpattr_nlri_safi[] = {
1974
    { 0,                        "Reserved" },
1975
    { SAFNUM_UNICAST,           "Unicast" },
1976
    { SAFNUM_MULCAST,           "Multicast" },
1977
    { SAFNUM_UNIMULC,           "Unicast+Multicast (Deprecated)" },
1978
    { SAFNUM_MPLS_LABEL,        "Labeled Unicast" },
1979
    { SAFNUM_MCAST_VPN,         "MCAST-VPN" },
1980
    { SAFNUM_MULTISEG_PW,       "Multi-Segment Pseudowires" },
1981
    { SAFNUM_ENCAPSULATION,     "Encapsulation (Deprecated)" },
1982
    { SAFNUM_MCAST_VPLS,        "MCAST-VPLS" },
1983
    { SAFNUM_TUNNEL,            "Tunnel (Deprecated)" },
1984
    { SAFNUM_VPLS,              "VPLS" },
1985
    { SAFNUM_MDT,               "Cisco MDT" },
1986
    { SAFNUM_4OVER6,            "4over6" },
1987
    { SAFNUM_6OVER4,            "6over4" },
1988
    { SAFNUM_L1VPN,             "Layer-1 VPN" },
1989
    { SAFNUM_EVPN,              "EVPN" },
1990
    { SAFNUM_BGP_LS,            "BGP-LS" },
1991
    { SAFNUM_BGP_LS_VPN,        "BGP-LS-VPN" },
1992
    { SAFNUM_SR_POLICY,         "SR Policy" },
1993
    { SAFNUM_SD_WAN,            "SD-WAN" },
1994
    { SAFNUM_RPD,               "Routing Policy Distribution" },
1995
    { SAFNUM_CT,                "Classful Transport Planes" },
1996
    { SAFNUM_FLOWSPEC,          "Tunneled Traffic Flowspec" },
1997
    { SAFNUM_MCAST_TREE,        "MCAST-TREE" },
1998
    { SAFNUM_BGP_DPS,           "Dynamic Path Selection" },
1999
    { SAFNUM_BGP_LS_SPF,        "BGP-LS-SPF" },
2000
    { SAFNUM_BGP_CAR,           "BGP-CAR" },
2001
    { SAFNUM_BGP_VPN_CAR,       "BGP-VPN-CAR" },
2002
    { SAFNUM_BGP_MUP,           "BGP-MUP" },
2003
    { SAFNUM_LAB_VPNUNICAST,    "Labeled VPN Unicast" },
2004
    { SAFNUM_LAB_VPNMULCAST,    "Labeled VPN Multicast" },
2005
    { SAFNUM_LAB_VPNUNIMULC,    "Labeled VPN Unicast+Multicast (Deprecated)" },
2006
    { SAFNUM_ROUTE_TARGET,      "Route Target Filter" },
2007
    { SAFNUM_FSPEC_RULE,        "Flow Spec Filter" },
2008
    { SAFNUM_FSPEC_VPN_RULE,    "Flow Spec Filter VPN" },
2009
    { SAFNUM_L3VPN,             "Layer-3 VPN (Deprecated)" },
2010
    { 0, NULL }
2011
};
2012
2013
/* ORF Type, RFC5291 */
2014
static const value_string orf_type_vals[] = {
2015
    /* first 3 entries: questionable origin */
2016
    { BGP_ORF_COMM,           "(unregistered) Communities ORF-Type" },
2017
    { BGP_ORF_EXTCOMM,        "(unregistered) Extended Communities ORF-Type" },
2018
    { BGP_ORF_ASPATH,         "(unregistered) AS-path ORF-Type" },
2019
    /* IANA registered */
2020
    { BGP_ORF_PREFIX,         "Address Prefix ORF" },
2021
    { BGP_ORF_CP_ORF,         "CP-ORF" },
2022
    { BGP_ORF_VPN_PREFIX,     "VPN Prefix ORF" },
2023
    /* vendor-specific */
2024
    { BGP_ORF_PREFIX_CISCO,   "Cisco PrefixList ORF-Type" },
2025
    { BGP_ORF_COMM_CISCO,     "Cisco CommunityList ORF-Type" },
2026
    { BGP_ORF_EXTCOMM_CISCO,  "Cisco Extended CommunityList ORF-Type" },
2027
    { BGP_ORF_ASPATH_CISCO,   "Cisco AsPathList ORF-Type" },
2028
    { 0,        NULL }
2029
};
2030
2031
/* ORF Send/Receive, RFC5291 */
2032
static const value_string orf_send_recv_vals[] = {
2033
    { 1,        "Receive" },
2034
    { 2,        "Send" },
2035
    { 3,        "Both" },
2036
    { 0,        NULL }
2037
};
2038
2039
/* ORF Send/Receive, RFC5291 */
2040
static const value_string orf_when_vals[] = {
2041
    { 1,        "Immediate" },
2042
    { 2,        "Defer" },
2043
    { 0,        NULL }
2044
};
2045
2046
static const value_string orf_entry_action_vals[] = {
2047
    { BGP_ORF_ADD,          "Add" },
2048
    { BGP_ORF_REMOVE,       "Remove" },
2049
    { BGP_ORF_REMOVEALL,    "RemoveAll" },
2050
    { 0,        NULL }
2051
};
2052
2053
static const value_string orf_entry_match_vals[] = {
2054
    { BGP_ORF_PERMIT,   "Permit" },
2055
    { BGP_ORF_DENY,     "Deny" },
2056
    { 0,        NULL }
2057
};
2058
2059
/* BGPsec Send/Receive, RFC8205 */
2060
static const value_string bgpsec_send_receive_vals[] = {
2061
    { 0,        "Receive" },
2062
    { 1,        "Send" },
2063
    { 0,        NULL }
2064
};
2065
2066
/* BGP Role, RFC9234 */
2067
static const value_string bgprole_vals[] = {
2068
    { 0,        "Provider" },
2069
    { 1,        "RS" },
2070
    { 2,        "RS-Client" },
2071
    { 3,        "Customer" },
2072
    { 4,        "Peer" },
2073
    { 0,        NULL }
2074
};
2075
2076
static const value_string capability_vals[] = {
2077
    { BGP_CAPABILITY_RESERVED,                      "Reserved capability" },
2078
    { BGP_CAPABILITY_MULTIPROTOCOL,                 "Multiprotocol extensions capability" },
2079
    { BGP_CAPABILITY_ROUTE_REFRESH,                 "Route refresh capability" },
2080
    { BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING,   "Cooperative route filtering capability" },
2081
    { BGP_CAPABILITY_MULTIPLE_ROUTE_DEST,           "Multiple routes to a destination capability" },
2082
    { BGP_CAPABILITY_EXTENDED_NEXT_HOP,             "Extended Next Hop Encoding" },
2083
    { BGP_CAPABILITY_EXTENDED_MESSAGE,              "BGP-Extended Message" },
2084
    { BGP_CAPABILITY_BGPSEC,                        "BGPsec capability" },
2085
    { BGP_CAPABILITY_MULTIPLE_LABELS,               "Multiple Labels capability" },
2086
    { BGP_CAPABILITY_BGP_ROLE,                      "BGP Role" },
2087
    { BGP_CAPABILITY_GRACEFUL_RESTART,              "Graceful Restart capability" },
2088
    { BGP_CAPABILITY_4_OCTET_AS_NUMBER,             "Support for 4-octet AS number capability" },
2089
    { BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO,      "Deprecated Dynamic Capability (Cisco)" },
2090
    { BGP_CAPABILITY_DYNAMIC_CAPABILITY,            "Support for Dynamic capability" },
2091
    { BGP_CAPABILITY_MULTISESSION,                  "Multisession BGP Capability" },
2092
    { BGP_CAPABILITY_ADDITIONAL_PATHS,              "Support for Additional Paths" },
2093
    { BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH,        "Enhanced route refresh capability" },
2094
    { BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART,   "Long-Lived Graceful Restart (LLGR) Capability" },
2095
    { BGP_CAPABILITY_CP_ORF,                        "CP-ORF Capability" },
2096
    { BGP_CAPABILITY_FQDN,                          "FQDN Capability" },
2097
    { BGP_CAPABILITY_BFD_STRICT,                    "BFD Strict-Mode capability" },
2098
    { BGP_CAPABILITY_SOFT_VERSION,                  "Software Version Capability" },
2099
    { BGP_CAPABILITY_PATHS_LIMIT,                   "PATHS-LIMIT Capability" },
2100
    { BGP_CAPABILITY_ROUTE_REFRESH_CISCO,           "Route Refresh Capability (Cisco)" },
2101
    { BGP_CAPABILITY_RPD_CISCO,                     "Routing Policy Distribution (Cisco)" },
2102
    { BGP_CAPABILITY_ORF_CISCO,                     "Outbound Route Filtering (Cisco)" },
2103
    { BGP_CAPABILITY_MULTISESSION_CISCO,            "Multisession (Cisco)" },
2104
    { BGP_CAPABILITY_FQDN_CISCO,                    "FQDN (Cisco)" },
2105
    { BGP_CAPABILITY_OPERATIONAL_MSG_CISCO,         "OPERATIONAL message (Cisco)" },
2106
    { BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP,           "Link-Local Next Hop Capability" },
2107
    { 0, NULL }
2108
};
2109
2110
static const value_string community_vals[] = {
2111
    { BGP_COMM_GRACEFUL_SHUTDOWN,   "GRACEFUL_SHUTDOWN" },
2112
    { BGP_COMM_ACCEPT_OWN,          "ACCEPT_OWN" },
2113
    { BGP_COMM_RT_FLTR_XLTD_V4,     "ROUTE_FILTER_TRANSLATED_v4" },
2114
    { BGP_COMM_RT_FLTR_V4,          "ROUTE_FILTER_v4" },
2115
    { BGP_COMM_RT_FLTR_XLTD_V6,     "ROUTE_FILTER_TRANSLATED_v6" },
2116
    { BGP_COMM_RT_FLTR_V6,          "ROUTE_FILTER_v6" },
2117
    { BGP_COMM_LLGR_STALE,          "LLGR_STALE" },
2118
    { BGP_COMM_NO_LLGR,             "NO_LLGR" },
2119
    { BGP_COMM_ACCEPT_OWN_HOP,      "accept-own-nexthop" },
2120
    { BGP_COMM_STANDBY_PE,          "Standby PE" },
2121
    { BGP_COMM_BLACKHOLE,           "BLACKHOLE" },
2122
    { BGP_COMM_NO_EXPORT,           "NO_EXPORT" },
2123
    { BGP_COMM_NO_ADVERTISE,        "NO_ADVERTISE" },
2124
    { BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
2125
    { BGP_COMM_NOPEER,              "NOPEER" },
2126
    { 0,                            NULL }
2127
};
2128
2129
/* Capability Message action code */
2130
static const value_string bgpcap_action[] = {
2131
    { 0, "advertising a capability" },
2132
    { 1, "removing a capability" },
2133
    { 0, NULL }
2134
};
2135
2136
static const value_string mcast_vpn_route_type[] = {
2137
    { MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD, "Intra-AS I-PMSI A-D route" },
2138
    { MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD, "Inter-AS I-PMSI A-D route" },
2139
    { MCAST_VPN_RTYPE_SPMSI_AD         , "S-PMSI A-D route" },
2140
    { MCAST_VPN_RTYPE_LEAF_AD          , "Leaf A-D route" },
2141
    { MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD , "Source Active A-D route" },
2142
    { MCAST_VPN_RTYPE_SHARED_TREE_JOIN , "Shared Tree Join route" },
2143
    { MCAST_VPN_RTYPE_SOURCE_TREE_JOIN , "Source Tree Join route" },
2144
    { 0, NULL }
2145
};
2146
2147
/* NLRI type value_string as defined in idr-ls */
2148
static const value_string bgp_ls_nlri_type_vals[] = {
2149
    { LINK_STATE_NODE_NLRI,                 "Node NLRI" },
2150
    { LINK_STATE_LINK_NLRI,                 "Link NLRI" },
2151
    { LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI, "IPv4 Topology Prefix NLRI" },
2152
    { LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI, "IPv6 Topology Prefix NLRI" },
2153
    { LINK_STATE_SR_POLICY_CANDIDATE_PATH,  "ST Policy Candidate Path NLRI" },
2154
    { LINK_STATE_SRV6_SID_NLRI,             "SRv6 SID NLRI" },
2155
    { LINK_STATE_STUB_LINK_NLRI,            "Stub Link NLRI" },
2156
    { 0, NULL },
2157
};
2158
2159
/* Link-State NLRI Protocol-ID value strings */
2160
static const value_string link_state_nlri_protocol_id_values[] = {
2161
    { BGP_LS_NLRI_PROTO_ID_UNKNOWN,         "Unknown" },
2162
    { BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1,   "IS-IS Level 1"},
2163
    { BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2,   "IS-IS Level 2"},
2164
    { BGP_LS_NLRI_PROTO_ID_OSPF_V2,         "OSPFv2"},
2165
    { BGP_LS_NLRI_PROTO_ID_DIRECT,          "Direct"},
2166
    { BGP_LS_NLRI_PROTO_ID_STATIC,          "Static"},
2167
    { BGP_LS_NLRI_PROTO_ID_OSPF_V3,         "OSPFv3"},
2168
    { BGP_LS_NLRI_PROTO_ID_BGP,             "BGP"},
2169
    { BGP_LS_NLRI_PROTO_ID_RSVP_TE,         "RSVP-TE" },
2170
    { BGP_LS_NLRI_PROTO_ID_SEGMENT_ROUTING, "Segment Routing" },
2171
    { 0, NULL},
2172
};
2173
2174
/* Link-State routing universes */
2175
static const val64_string link_state_nlri_routing_universe_values[] = {
2176
    { BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3, "L3 packet topology" },
2177
    { BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1, "L1 optical topology"},
2178
    { 0, NULL}
2179
};
2180
2181
/* Link state prefix NLRI OSPF Route Type */
2182
static const value_string link_state_prefix_descriptors_ospf_route_type[] = {
2183
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN,     "Unknown" },
2184
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA,  "Intra-Area"},
2185
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA,  "Inter Area"},
2186
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1,  "External 1"},
2187
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2,  "External 2"},
2188
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1,      "NSSA 1"},
2189
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2,      "NSSA 2"},
2190
    { 0 , NULL}
2191
};
2192
2193
/* Link state Flex Algo Metric Type: draft-ietf-lsr-flex-algo-17 */
2194
static const value_string flex_algo_metric_types[] = {
2195
    { 0, "IGP Metric"},
2196
    { 1, "Min Unidirectional Link Delay"},
2197
    { 2, "TE Metric"},
2198
    { 0, NULL }
2199
};
2200
2201
/* Link state IGP Algorithm Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
2202
static const value_string igp_algo_types[] = {
2203
    { 0,   "Shortest Path First (SPF)" },
2204
    { 1,   "Strict Shortest Path First (Strict SPF)" },
2205
    { 0,   NULL }
2206
};
2207
2208
/* Link state IGP MSD Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
2209
static const value_string igp_msd_types[] = {
2210
    { 0,   "Reserved" },
2211
    { 1,   "Base MPLS Imposition MSD" },
2212
    { 2,   "ERLD-MSD" },
2213
    { 41,  "SRH Max SL" },
2214
    { 42,  "SRH Max End Pop" },
2215
    { 44,  "SRH Max H.Encaps" },
2216
    { 45,  "SRH Max End D" },
2217
    { 0,   NULL }
2218
};
2219
2220
/* NLRI type value_string as define in BGP flow spec RFC */
2221
2222
static const value_string flowspec_nlri_opvaluepair_type[] = {
2223
    { BGPNLRI_FSPEC_DST_PFIX, "Destination prefix filter" },
2224
    { BGPNLRI_FSPEC_SRC_PFIX, "Source prefix filter" },
2225
    { BGPNLRI_FSPEC_IP_PROTO, "Protocol / Next Header filter" },
2226
    { BGPNLRI_FSPEC_PORT,     "Port filter" },
2227
    { BGPNLRI_FSPEC_DST_PORT, "Destination port filter" },
2228
    { BGPNLRI_FSPEC_SRC_PORT, "Source port filter" },
2229
    { BGPNLRI_FSPEC_ICMP_TP,  "ICMP type filter" },
2230
    { BGPNLRI_FSPEC_ICMP_CD,  "ICMP code filter" },
2231
    { BGPNLRI_FSPEC_TCP_FLAGS,"TCP flags filter" },
2232
    { BGPNLRI_FSPEC_PCK_LEN,  "Packet Length filter" },
2233
    { BGPNLRI_FSPEC_DSCP,     "DSCP marking filter" },
2234
    { BGPNLRI_FSPEC_FRAGMENT, "IP fragment filter" },
2235
    { 0, NULL },
2236
};
2237
2238
/* Subtype Route Refresh, draft-ietf-idr-bgp-enhanced-route-refresh-02 */
2239
static const value_string route_refresh_subtype_vals[] = {
2240
    { 0, "Normal route refresh request [RFC2918] with/without ORF [RFC5291]" },
2241
    { 1, "Demarcation of the beginning of a route refresh" },
2242
    { 2, "Demarcation of the ending of a route refresh" },
2243
    { 0,  NULL }
2244
};
2245
2246
static const value_string bgp_prefix_sid_type[] = {
2247
    { BGP_PREFIX_SID_TLV_LABEL_INDEX,     "Label-Index" },
2248
    { BGP_PREFIX_SID_TLV_2,               "Deprecated" },
2249
    { BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB, "Originator SRGB" },
2250
    { BGP_PREFIX_SID_TLV_4,               "Deprecated" },
2251
    { BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE, "SRv6 L3 Service" },
2252
    { BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE, "SRv6 L2 Service" },
2253
    { 0, NULL }
2254
};
2255
2256
static const value_string srv6_service_sub_tlv_type[] = {
2257
    { SRV6_SERVICE_SRV6_SID_INFORMATION,   "SRv6 SID Information" },
2258
    { 0,  NULL }
2259
};
2260
2261
static const value_string srv6_service_data_sub_sub_tlv_type[] = {
2262
    { SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE,   "SRv6 SID Structure" },
2263
    { 0,  NULL }
2264
};
2265
2266
/* SRv6 Endpoint behavior value_string [RFC 8986]. */
2267
static const value_string srv6_endpoint_behavior[] = {
2268
    { SRV6_ENDPOINT_BEHAVIOR_END,                    "End" },
2269
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP,                "End with PSP" },
2270
    { SRV6_ENDPOINT_BEHAVIOR_END_USP,                "End with USP" },
2271
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP,            "End with PSP & USP" },
2272
    { SRV6_ENDPOINT_BEHAVIOR_END_X,                  "End.X" },
2273
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP,              "End.X with PSP" },
2274
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USP,              "End.X with USP" },
2275
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP,          "End.X with PSP & USP" },
2276
    { SRV6_ENDPOINT_BEHAVIOR_END_T,                  "End.T" },
2277
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP,              "End.T with PSP" },
2278
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USP,              "End.T with USP" },
2279
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP,          "End.T with PSP & USP" },
2280
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT,          "End.B6.Insert" },
2281
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS,          "End.B6.Encaps" },
2282
    { SRV6_ENDPOINT_BEHAVIOR_END_BM,                 "End.BM" },
2283
    { SRV6_ENDPOINT_BEHAVIOR_END_DX6,                "End.DX6" },
2284
    { SRV6_ENDPOINT_BEHAVIOR_END_DX4,                "End.DX4" },
2285
    { SRV6_ENDPOINT_BEHAVIOR_END_DT6,                "End.DT6" },
2286
    { SRV6_ENDPOINT_BEHAVIOR_END_DT4,                "End.DT4" },
2287
    { SRV6_ENDPOINT_BEHAVIOR_END_DT46,               "End.DT46" },
2288
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2,                "End.DX2" },
2289
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2V,               "End.DX2V" },
2290
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2U,               "End.DT2U" },
2291
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2M,               "End.DT2M" },
2292
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT_RED,      "End.B6.Insert.Red" },
2293
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED,      "End.B6.Encaps.Red" },
2294
    { SRV6_ENDPOINT_BEHAVIOR_END_USD,                "End with USD" },
2295
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD,            "End with PSP & USD" },
2296
    { SRV6_ENDPOINT_BEHAVIOR_END_USP_USD,            "End with USP & USD" },
2297
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD,        "End with PSP, USP & USD" },
2298
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USD,              "End.X with USD" },
2299
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD,          "End.X with PSP & USD" },
2300
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD,          "End.X with USP & USD" },
2301
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD,      "End.X with PSP, USP & USD" },
2302
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USD,              "End.T with USD" },
2303
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD,          "End.T with PSP & USD" },
2304
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD,          "End.T with USP & USD" },
2305
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD,      "End.T with PSP, USP & USD" },
2306
    { SRV6_ENDPOINT_BEHAVIOR_END_MAP,                "End.MAP" },
2307
    { SRV6_ENDPOINT_BEHAVIOR_END_LIMIT,              "End.Limit" },
2308
    { SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID,          "End with NEXT-ONLY-CSID" },
2309
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID,               "End with NEXT-CSID" },
2310
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP,           "End with NEXT-CSID & PSP" },
2311
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP,           "End with NEXT-CSID & USP" },
2312
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP,       "End with NEXT-CSID, PSP & USP" },
2313
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD,           "End with NEXT-CSID & USD" },
2314
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD,       "End with NEXT-CSID, PSP & USD" },
2315
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD,       "End with NEXT-CSID, USP & USD" },
2316
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD,   "End with NEXT-CSID, PSP, USP & USD" },
2317
    { SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID,        "End.X with NEXT-ONLY-CSID" },
2318
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID,             "End.X with NEXT-CSID" },
2319
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP,         "End.X with NEXT-CSID & PSP" },
2320
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP,         "End.X with NEXT-CSID & USP" },
2321
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP,     "End.X with NEXT-CSID, PSP & USP" },
2322
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD,         "End.X with NEXT-CSID & USD" },
2323
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD,     "End.X with NEXT-CSID, PSP & USD" },
2324
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD,     "End.X with NEXT-CSID, USP & USD" },
2325
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP_USD, "End.X with NEXT-CSID, PSP, USP & USD" },
2326
    { SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID,           "End.DX6 with NEXT-CSID" },
2327
    { SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID,           "End.DX4 with NEXT-CSID" },
2328
    { SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID,           "End.DT6 with NEXT-CSID" },
2329
    { SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID,           "End.DT4 with NEXT-CSID" },
2330
    { SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID,          "End.DT46 with NEXT-CSID" },
2331
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID,           "End.DX2 with NEXT-CSID" },
2332
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID,          "End.DX2V with NEXT-CSID" },
2333
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID,          "End.DT2U with NEXT-CSID" },
2334
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID,          "End.DT2M with NEXT-CSID" },
2335
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6D,            "End.M.GTP6.D" },
2336
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6DI,           "End.M.GTP6.Di" },
2337
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6E,            "End.M.GTP6.E" },
2338
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP4E,            "End.M.GTP4.E" },
2339
    { SRV6_ENDPOINT_BEHAVIOR_END_M,                  "End.M" },
2340
    { SRV6_ENDPOINT_BEHAVIOR_END_REPLICATE,          "End.Replicate" },
2341
    { SRV6_ENDPOINT_BEHAVIOR_END_NSH,                "End.NSH - NSH Segment" },
2342
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1,                "End.DX1" },
2343
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1_NEXT_CSID,      "End.DX1 with NEXT-CSID" },
2344
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1_REPL_CSID,      "End.DX1 with REPLACE-CSID" },
2345
    { SRV6_ENDPOINT_BEHAVIOR_OPAQUE,                 "Opaque" },
2346
    { 0,  NULL }
2347
};
2348
2349
1.76k
#define BGP_MUP_AT_3GPP_5G 1
2350
725
#define BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY 1
2351
530
#define BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY 2
2352
1.86k
#define BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED 3
2353
1.34k
#define BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED 4
2354
2355
static const value_string bgp_mup_architecture_types[] = {
2356
    { BGP_MUP_AT_3GPP_5G,         "3gpp-5g" },
2357
    { 0, NULL }
2358
};
2359
2360
static const value_string bgp_mup_route_types[] = {
2361
    { BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY, "Interwork Segment Discovery route" },
2362
    { BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY,    "Direct Segment Discovery route" },
2363
    { BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED,  "Type 1 Session Transformed (ST) route" },
2364
    { BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED,  "Type 2 Session Transformed (ST) route" },
2365
    { 0, NULL }
2366
};
2367
2368
static const value_string bgp_ext_com_local_admin_types[] = {
2369
    { 0, "VID (802.1Q VLAN ID)" },
2370
    { 1, "VXLAN" },
2371
    { 2, "NVGRE" },
2372
    { 3, "I-SID" },
2373
    { 4, "EVI" },
2374
    { 5, "dual-VID (QinQ VLAN ID)" },
2375
    { 0, NULL }
2376
};
2377
2378
static const true_false_string tfs_non_transitive_transitive = { "Non-transitive", "Transitive" };
2379
static const true_false_string tfs_esi_label_flag = { "Single-Active redundancy", "All-Active redundancy" };
2380
static const true_false_string tfs_ospf_rt_mt = { "Type-2", "Type-1" };
2381
static const true_false_string tfs_eigrp_rtype = { "Internal" , "External" };
2382
static const true_false_string tfs_cost_replace = { "Replaces the original attribute value", "Evaluated after the original attribute value" };
2383
static const true_false_string tfs_exclude_include = { "Exclude", "Include" };
2384
static const true_false_string tfs_manually_auto_derived = { "manually derived", "auto-derived"};
2385
2386
/* Maximal size of an IP address string */
2387
#define MAX_SIZE_OF_IP_ADDR_STRING      16
2388
2389
static const uint8_t rd_zero[BGP_ROUTE_DISTINGUISHER_SIZE] = {0};
2390
2391
static int proto_bgp;
2392
2393
/* BGP header field initialisation */
2394
2395
/* global BGP header field */
2396
2397
static int hf_bgp_marker;
2398
static int hf_bgp_length;
2399
static int hf_bgp_prefix_length;
2400
static int hf_bgp_rd;
2401
static int hf_bgp_continuation;
2402
static int hf_bgp_originating_as;
2403
static int hf_bgp_community_prefix;
2404
static int hf_bgp_endpoint_address;
2405
static int hf_bgp_endpoint_address_ipv6;
2406
static int hf_bgp_label_stack;
2407
static int hf_bgp_large_communities;
2408
static int hf_bgp_large_communities_ga;
2409
static int hf_bgp_large_communities_ldp1;
2410
static int hf_bgp_large_communities_ldp2;
2411
static int hf_bgp_vplsad_length;
2412
static int hf_bgp_vplsad_rd;
2413
static int hf_bgp_bgpad_pe_addr;
2414
static int hf_bgp_vplsbgp_ce_id;
2415
static int hf_bgp_vplsbgp_labelblock_offset;
2416
static int hf_bgp_vplsbgp_labelblock_size;
2417
static int hf_bgp_vplsbgp_labelblock_base;
2418
static int hf_bgp_wildcard_route_target;
2419
static int hf_bgp_type;
2420
2421
/* BGP open message header field */
2422
2423
static int hf_bgp_open_version;
2424
static int hf_bgp_open_myas;
2425
static int hf_bgp_open_holdtime;
2426
static int hf_bgp_open_identifier;
2427
static int hf_bgp_open_opt_len;
2428
static int hf_bgp_open_opt_extension;
2429
static int hf_bgp_open_opt_extension_mark;
2430
static int hf_bgp_open_opt_extension_len;
2431
static int hf_bgp_open_opt_params;
2432
static int hf_bgp_open_opt_param;
2433
static int hf_bgp_open_opt_param_type;
2434
static int hf_bgp_open_opt_param_len;
2435
static int hf_bgp_open_opt_param_auth;
2436
static int hf_bgp_open_opt_param_unknown;
2437
2438
/* BGP notify header field */
2439
2440
static int hf_bgp_notify_major_error;
2441
static int hf_bgp_notify_minor_msg_hdr;
2442
static int hf_bgp_notify_minor_open_msg;
2443
static int hf_bgp_notify_minor_update_msg;
2444
static int hf_bgp_notify_minor_ht_expired;
2445
static int hf_bgp_notify_minor_state_machine;
2446
static int hf_bgp_notify_minor_cease;
2447
static int hf_bgp_notify_minor_rr_msg;
2448
static int hf_bgp_notify_minor_unknown;
2449
static int hf_bgp_notify_data;
2450
static int hf_bgp_notify_error_open_bad_peer_as;
2451
static int hf_bgp_notify_communication_length;
2452
static int hf_bgp_notify_communication;
2453
2454
/* BGP route refresh header field */
2455
2456
static int hf_bgp_route_refresh_afi;
2457
static int hf_bgp_route_refresh_subtype;
2458
static int hf_bgp_route_refresh_safi;
2459
static int hf_bgp_route_refresh_orf;
2460
static int hf_bgp_route_refresh_orf_flag;
2461
static int hf_bgp_route_refresh_orf_type;
2462
static int hf_bgp_route_refresh_orf_length;
2463
static int hf_bgp_route_refresh_orf_entry_prefixlist;
2464
static int hf_bgp_route_refresh_orf_entry_action;
2465
static int hf_bgp_route_refresh_orf_entry_match;
2466
static int hf_bgp_route_refresh_orf_entry_sequence;
2467
static int hf_bgp_route_refresh_orf_entry_prefixmask_lower;
2468
static int hf_bgp_route_refresh_orf_entry_prefixmask_upper;
2469
static int hf_bgp_route_refresh_orf_entry_ip;
2470
2471
/* BGP capabilities header field */
2472
2473
static int hf_bgp_cap;
2474
static int hf_bgp_cap_type;
2475
static int hf_bgp_cap_length;
2476
static int hf_bgp_cap_action;
2477
static int hf_bgp_cap_unknown;
2478
static int hf_bgp_cap_reserved;
2479
static int hf_bgp_cap_mp_afi;
2480
static int hf_bgp_cap_mp_safi;
2481
static int hf_bgp_cap_enh_afi;
2482
static int hf_bgp_cap_enh_safi;
2483
static int hf_bgp_cap_enh_nhafi;
2484
static int hf_bgp_cap_role;
2485
static int hf_bgp_cap_gr_timers;
2486
static int hf_bgp_cap_gr_timers_restart_flag;
2487
static int hf_bgp_cap_gr_timers_notification_flag;
2488
static int hf_bgp_cap_gr_timers_restart_time;
2489
static int hf_bgp_cap_gr_afi;
2490
static int hf_bgp_cap_gr_safi;
2491
static int hf_bgp_cap_gr_flag;
2492
static int hf_bgp_cap_gr_flag_pfs;
2493
static int hf_bgp_cap_4as;
2494
static int hf_bgp_cap_dc;
2495
static int hf_bgp_cap_ap_afi;
2496
static int hf_bgp_cap_ap_safi;
2497
static int hf_bgp_cap_ap_sendreceive;
2498
static int hf_bgp_cap_orf_afi;
2499
static int hf_bgp_cap_orf_safi;
2500
static int hf_bgp_cap_orf_number;
2501
static int hf_bgp_cap_orf_type;
2502
static int hf_bgp_cap_orf_sendreceive;
2503
static int hf_bgp_cap_fqdn_hostname_len;
2504
static int hf_bgp_cap_fqdn_hostname;
2505
static int hf_bgp_cap_fqdn_domain_name_len;
2506
static int hf_bgp_cap_fqdn_domain_name;
2507
static int hf_bgp_cap_multisession_flags;
2508
static int hf_bgp_cap_bgpsec_flags;
2509
static int hf_bgp_cap_bgpsec_version;
2510
static int hf_bgp_cap_bgpsec_sendreceive;
2511
static int hf_bgp_cap_bgpsec_reserved;
2512
static int hf_bgp_cap_bgpsec_afi;
2513
static int hf_bgp_cap_soft_version;
2514
static int hf_bgp_cap_soft_version_len;
2515
2516
/* BGP update global header field */
2517
static int hf_bgp_update_withdrawn_routes_length;
2518
static int hf_bgp_update_withdrawn_routes;
2519
2520
2521
/* BGP update path attribute header field */
2522
static int hf_bgp_update_total_path_attribute_length;
2523
static int hf_bgp_update_path_attributes;
2524
static int hf_bgp_update_path_attributes_unknown;
2525
static int hf_bgp_update_path_attribute_communities;
2526
static int hf_bgp_update_path_attribute_community_well_known;
2527
static int hf_bgp_update_path_attribute_community;
2528
static int hf_bgp_update_path_attribute_community_as;
2529
static int hf_bgp_update_path_attribute_community_value;
2530
static int hf_bgp_update_path_attribute;
2531
static int hf_bgp_update_path_attribute_flags;
2532
static int hf_bgp_update_path_attribute_flags_optional;
2533
static int hf_bgp_update_path_attribute_flags_transitive;
2534
static int hf_bgp_update_path_attribute_flags_partial;
2535
static int hf_bgp_update_path_attribute_flags_extended_length;
2536
static int hf_bgp_update_path_attribute_flags_unused;
2537
static int hf_bgp_update_path_attribute_type_code;
2538
static int hf_bgp_update_path_attribute_length;
2539
static int hf_bgp_update_path_attribute_next_hop;
2540
static int hf_bgp_update_path_attribute_as_path_segment;
2541
static int hf_bgp_update_path_attribute_as_path_segment_type;
2542
static int hf_bgp_update_path_attribute_as_path_segment_length;
2543
static int hf_bgp_update_path_attribute_as_path_segment_as2;
2544
static int hf_bgp_update_path_attribute_as_path_segment_as4;
2545
static int hf_bgp_update_path_attribute_origin;
2546
static int hf_bgp_update_path_attribute_cluster_list;
2547
static int hf_bgp_update_path_attribute_cluster_id;
2548
static int hf_bgp_update_path_attribute_originator_id;
2549
static int hf_bgp_update_path_attribute_local_pref;
2550
static int hf_bgp_update_path_attribute_attrset_origin_as;
2551
static int hf_bgp_update_path_attribute_multi_exit_disc;
2552
static int hf_bgp_update_path_attribute_aggregator_as;
2553
static int hf_bgp_update_path_attribute_aggregator_origin;
2554
static int hf_bgp_update_path_attribute_link_state;
2555
static int hf_bgp_update_path_attribute_mp_reach_nlri_address_family;
2556
static int hf_bgp_update_path_attribute_mp_reach_nlri_safi;
2557
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop;
2558
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd;
2559
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4;
2560
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6;
2561
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local;
2562
static int hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa;
2563
static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length;
2564
static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa;
2565
static int hf_bgp_update_path_attribute_mp_reach_nlri;
2566
static int hf_bgp_update_path_attribute_mp_unreach_nlri_address_family;
2567
static int hf_bgp_update_path_attribute_mp_unreach_nlri_safi;
2568
static int hf_bgp_update_path_attribute_mp_unreach_nlri;
2569
static int hf_bgp_update_path_attribute_aigp;
2570
static int hf_bgp_update_path_attribute_bgpsec_sb_len;
2571
static int hf_bgp_update_path_attribute_bgpsec_algo_id;
2572
static int hf_bgp_update_path_attribute_bgpsec_sps_pcount;
2573
static int hf_bgp_update_path_attribute_bgpsec_sps_flags;
2574
static int hf_bgp_update_path_attribute_bgpsec_sps_as;
2575
static int hf_bgp_update_path_attribute_bgpsec_sp_len;
2576
static int hf_bgp_update_path_attribute_bgpsec_ski;
2577
static int hf_bgp_update_path_attribute_bgpsec_sig_len;
2578
static int hf_bgp_update_path_attribute_bgpsec_sig;
2579
static int hf_bgp_update_path_attribute_otc;
2580
static int hf_bgp_update_path_attribute_d_path;
2581
static int hf_bgp_d_path_ga;
2582
static int hf_bgp_d_path_la;
2583
static int hf_bgp_d_path_length;
2584
static int hf_bgp_d_path_isf_safi;
2585
static int hf_bgp_evpn_nlri;
2586
static int hf_bgp_evpn_nlri_rt;
2587
static int hf_bgp_evpn_nlri_len;
2588
static int hf_bgp_evpn_nlri_rd;
2589
static int hf_bgp_evpn_nlri_esi;
2590
static int hf_bgp_evpn_nlri_esi_type;
2591
static int hf_bgp_evpn_nlri_esi_lacp_mac;
2592
static int hf_bgp_evpn_nlri_esi_portk;
2593
static int hf_bgp_evpn_nlri_esi_remain;
2594
static int hf_bgp_evpn_nlri_esi_value;
2595
static int hf_bgp_evpn_nlri_esi_value_type0;
2596
static int hf_bgp_evpn_nlri_esi_rb_mac;
2597
static int hf_bgp_evpn_nlri_esi_rbprio;
2598
static int hf_bgp_evpn_nlri_esi_sys_mac;
2599
static int hf_bgp_evpn_nlri_esi_mac_discr;
2600
static int hf_bgp_evpn_nlri_esi_router_id;
2601
static int hf_bgp_evpn_nlri_esi_router_discr;
2602
static int hf_bgp_evpn_nlri_esi_asn;
2603
static int hf_bgp_evpn_nlri_esi_asn_discr;
2604
static int hf_bgp_evpn_nlri_esi_reserved;
2605
static int hf_bgp_evpn_nlri_etag;
2606
static int hf_bgp_evpn_nlri_mpls_ls1;
2607
static int hf_bgp_evpn_nlri_mpls_ls2;
2608
static int hf_bgp_evpn_nlri_vni;
2609
static int hf_bgp_evpn_nlri_maclen;
2610
static int hf_bgp_evpn_nlri_mac_addr;
2611
static int hf_bgp_evpn_nlri_iplen;
2612
static int hf_bgp_evpn_nlri_prefix_len;
2613
static int hf_bgp_evpn_nlri_ip_addr;
2614
static int hf_bgp_evpn_nlri_ipv6_addr;
2615
static int hf_bgp_evpn_nlri_ipv4_gtw;
2616
static int hf_bgp_evpn_nlri_ipv6_gtw;
2617
static int hf_bgp_evpn_nlri_igmp_mc_or_length;
2618
static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4;
2619
static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6;
2620
static int hf_bgp_evpn_nlri_igmp_mc_reserved;
2621
static int hf_bgp_evpn_nlri_igmp_mc_max_resp_time;
2622
static int hf_bgp_evpn_nlri_igmp_mc_flags;
2623
static int hf_bgp_evpn_nlri_igmp_mc_flags_v1;
2624
static int hf_bgp_evpn_nlri_igmp_mc_flags_v2;
2625
static int hf_bgp_evpn_nlri_igmp_mc_flags_v3;
2626
static int hf_bgp_evpn_nlri_igmp_mc_flags_ie;
2627
static int hf_bgp_evpn_nlri_igmp_mc_flags_reserved;
2628
2629
static int * const evpn_nlri_igmp_mc_flags[] = {
2630
       &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
2631
       &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
2632
       &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
2633
       &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
2634
       &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
2635
       NULL
2636
       };
2637
2638
/* BGP update tunnel encaps attribute RFC 5512 */
2639
2640
static int hf_bgp_update_encaps_tunnel_tlv_len;
2641
static int hf_bgp_update_encaps_tunnel_tlv_type;
2642
static int hf_bgp_update_encaps_tunnel_subtlv_len;
2643
static int hf_bgp_update_encaps_tunnel_subtlv_type;
2644
static int hf_bgp_update_encaps_tunnel_subtlv_session_id;
2645
static int hf_bgp_update_encaps_tunnel_subtlv_cookie;
2646
static int hf_bgp_update_encaps_tunnel_subtlv_gre_key;
2647
static int hf_bgp_update_encaps_tunnel_subtlv_color_value;
2648
static int hf_bgp_update_encaps_tunnel_subtlv_lb_block_length;
2649
static int hf_bgp_update_encaps_tunnel_subtlv_value;
2650
2651
/* draft-ietf-idr-tunnel-encaps */
2652
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags;
2653
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid;
2654
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac;
2655
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved;
2656
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid;
2657
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac;
2658
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved;
2659
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags;
2660
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version;
2661
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid;
2662
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved;
2663
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid;
2664
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved;
2665
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags;
2666
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid;
2667
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac;
2668
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved;
2669
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid;
2670
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac;
2671
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved;
2672
2673
/* draft-ietf-idr-segment-routing-te-policy */
2674
static int hf_bgp_update_encaps_tunnel_subtlv_pref_flags;
2675
static int hf_bgp_update_encaps_tunnel_subtlv_pref_reserved;
2676
static int hf_bgp_update_encaps_tunnel_subtlv_pref_preference;
2677
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags;
2678
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified;
2679
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid;
2680
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved;
2681
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved;
2682
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid;
2683
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags;
2684
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_specified;
2685
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_invalid;
2686
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_b_flag;
2687
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_reserved;
2688
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_reserved;
2689
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_sid;
2690
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_flags;
2691
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved;
2692
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp;
2693
static int hf_bgp_update_encaps_tunnel_subtlv_priority_priority;
2694
static int hf_bgp_update_encaps_tunnel_subtlv_priority_reserved;
2695
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved;
2696
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv;
2697
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type;
2698
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length;
2699
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data;
2700
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags;
2701
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification;
2702
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm;
2703
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_s_flag;
2704
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_b_flag;
2705
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved;
2706
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved;
2707
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label;
2708
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class;
2709
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack;
2710
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl;
2711
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm;
2712
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id;
2713
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id;
2714
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address;
2715
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv4_address;
2716
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv4_address;
2717
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address;
2718
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address;
2719
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address;
2720
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_sid;
2721
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior;
2722
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_code;
2723
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_reserved;
2724
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_lb_length;
2725
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_ln_length;
2726
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_func_length;
2727
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_arg_length;
2728
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight;
2729
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight_flags;
2730
static int hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_reserved;
2731
static int hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_name;
2732
static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved;
2733
static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_name;
2734
2735
/* RFC 6514 PMSI Tunnel Attribute */
2736
static int hf_bgp_pmsi_tunnel_flags;
2737
static int hf_bgp_pmsi_tunnel_type;
2738
static int hf_bgp_pmsi_tunnel_id;
2739
static int hf_bgp_pmsi_tunnel_not_present;
2740
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_id; /* RFC4875 section 19 */
2741
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id;
2742
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4;
2743
static int hf_bgp_pmsi_tunnel_mldp_fec_el_type; /* RFC 6388 section 2.3 */
2744
static int hf_bgp_pmsi_tunnel_mldp_fec_el_afi;
2745
static int hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len;
2746
static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4;
2747
static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6;
2748
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len;
2749
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type;
2750
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len;
2751
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn;
2752
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str;
2753
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type;
2754
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len;
2755
static int hf_bgp_pmsi_tunnel_pimsm_sender;
2756
static int hf_bgp_pmsi_tunnel_pimsm_pmc_group;
2757
static int hf_bgp_pmsi_tunnel_pimssm_root_node;
2758
static int hf_bgp_pmsi_tunnel_pimssm_pmc_group;
2759
static int hf_bgp_pmsi_tunnel_pimbidir_sender;
2760
static int hf_bgp_pmsi_tunnel_pimbidir_pmc_group;
2761
static int hf_bgp_pmsi_tunnel_ingress_rep_addr;
2762
static int hf_bgp_pmsi_tunnel_ingress_rep_addr6;
2763
2764
/* RFC 7311 attribute */
2765
static int hf_bgp_aigp_type;
2766
static int hf_bgp_aigp_tlv_length;
2767
static int hf_bgp_aigp_accu_igp_metric;
2768
2769
2770
/* MPLS labels decoding */
2771
static int hf_bgp_update_mpls_label;
2772
static int hf_bgp_update_mpls_label_value;
2773
static int hf_bgp_update_mpls_label_value_20bits;
2774
static int hf_bgp_update_mpls_traffic_class;
2775
static int hf_bgp_update_mpls_bottom_stack;
2776
2777
/* BGP update path attribute SSA SAFI Specific attribute (deprecated should we keep it ?) */
2778
2779
static int hf_bgp_ssa_t;
2780
static int hf_bgp_ssa_type;
2781
static int hf_bgp_ssa_len;
2782
static int hf_bgp_ssa_value;
2783
static int hf_bgp_ssa_l2tpv3_pref;
2784
static int hf_bgp_ssa_l2tpv3_s;
2785
static int hf_bgp_ssa_l2tpv3_unused;
2786
static int hf_bgp_ssa_l2tpv3_cookie_len;
2787
static int hf_bgp_ssa_l2tpv3_session_id;
2788
static int hf_bgp_ssa_l2tpv3_cookie;
2789
2790
/* BGP NLRI head field */
2791
static int hf_bgp_update_nlri;
2792
2793
static int hf_bgp_mp_reach_nlri_ipv4_prefix;
2794
static int hf_bgp_mp_unreach_nlri_ipv4_prefix;
2795
static int hf_bgp_mp_reach_nlri_ipv6_prefix;
2796
static int hf_bgp_mp_unreach_nlri_ipv6_prefix;
2797
static int hf_bgp_mp_nlri_tnl_id;
2798
static int hf_bgp_withdrawn_prefix;
2799
static int hf_bgp_nlri_prefix;
2800
static int hf_bgp_nlri_path_id;
2801
2802
/* BGP mcast IP VPN nlri header field */
2803
2804
static int hf_bgp_mcast_vpn_nlri_t;
2805
static int hf_bgp_mcast_vpn_nlri_route_type;
2806
static int hf_bgp_mcast_vpn_nlri_length;
2807
static int hf_bgp_mcast_vpn_nlri_rd;
2808
static int hf_bgp_mcast_vpn_nlri_origin_router_ipv4;
2809
static int hf_bgp_mcast_vpn_nlri_origin_router_ipv6;
2810
static int hf_bgp_mcast_vpn_nlri_source_as;
2811
static int hf_bgp_mcast_vpn_nlri_source_length;
2812
static int hf_bgp_mcast_vpn_nlri_group_length;
2813
static int hf_bgp_mcast_vpn_nlri_source_addr_ipv4;
2814
static int hf_bgp_mcast_vpn_nlri_source_addr_ipv6;
2815
static int hf_bgp_mcast_vpn_nlri_group_addr_ipv4;
2816
static int hf_bgp_mcast_vpn_nlri_group_addr_ipv6;
2817
static int hf_bgp_mcast_vpn_nlri_route_key;
2818
2819
/* BGP SR policy nlri field */
2820
static int hf_bgp_sr_policy_nlri_length;
2821
static int hf_bgp_sr_policy_nlri_distinguisher;
2822
static int hf_bgp_sr_policy_nlri_policy_color;
2823
static int hf_bgp_sr_policy_nlri_endpoint_v4;
2824
static int hf_bgp_sr_policy_nlri_endpoint_v6;
2825
2826
/* BGP-LS */
2827
2828
static int hf_bgp_ls_type;
2829
static int hf_bgp_ls_length;
2830
2831
static int hf_bgp_ls_nlri;
2832
static int hf_bgp_ls_safi128_nlri;
2833
static int hf_bgp_ls_safi128_nlri_route_distinguisher;
2834
static int hf_bgp_ls_safi128_nlri_route_distinguisher_type;
2835
static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2;
2836
static int hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4;
2837
static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4;
2838
static int hf_bgp_ls_safi128_nlri_route_dist_asnum_2;
2839
static int hf_bgp_ls_safi128_nlri_route_dist_asnum_4;
2840
static int hf_bgp_ls_nlri_type;
2841
static int hf_bgp_ls_nlri_length;
2842
static int hf_bgp_ls_nlri_link_nlri_type;
2843
static int hf_bgp_ls_nlri_link_descriptors_tlv;
2844
static int hf_bgp_ls_nlri_prefix_descriptors_tlv;
2845
static int hf_bgp_ls_nlri_srv6_sid_descriptors_tlv;
2846
static int hf_bgp_ls_nlri_link_local_identifier;
2847
static int hf_bgp_ls_nlri_link_remote_identifier;
2848
static int hf_bgp_ls_nlri_ipv4_interface_address;
2849
static int hf_bgp_ls_nlri_ipv4_neighbor_address;
2850
static int hf_bgp_ls_nlri_ipv6_interface_address;
2851
static int hf_bgp_ls_nlri_ipv6_neighbor_address;
2852
static int hf_bgp_ls_nlri_multi_topology_id;
2853
static int hf_bgp_ls_nlri_ospf_route_type;
2854
static int hf_bgp_ls_nlri_ip_reachability_prefix_ip;
2855
static int hf_bgp_ls_nlri_ip_reachability_prefix_ip6;
2856
static int hf_bgp_ls_nlri_node_nlri_type;
2857
static int hf_bgp_ls_nlri_node_protocol_id;
2858
static int hf_bgp_ls_nlri_node_identifier;
2859
static int hf_bgp_ls_ipv4_topology_prefix_nlri_type;
2860
static int hf_bgp_ls_ipv6_topology_prefix_nlri_type;
2861
static int hf_bgp_ls_nlri_srv6_sid_nlri_type;
2862
2863
/* BGP-LS + SR */
2864
static int hf_bgp_ls_sr_tlv_capabilities;
2865
static int hf_bgp_ls_sr_tlv_capabilities_range_size;
2866
static int hf_bgp_ls_sr_tlv_capabilities_flags;
2867
static int hf_bgp_ls_sr_tlv_capabilities_flags_i;
2868
static int hf_bgp_ls_sr_tlv_capabilities_flags_v;
2869
static int hf_bgp_ls_sr_tlv_capabilities_flags_h;
2870
static int hf_bgp_ls_sr_tlv_capabilities_flags_reserved;
2871
static int hf_bgp_ls_sr_tlv_capabilities_sid_label;
2872
static int hf_bgp_ls_sr_tlv_capabilities_sid_index;
2873
static int hf_bgp_ls_sr_tlv_algorithm;
2874
static int hf_bgp_ls_sr_tlv_algorithm_value;
2875
static int hf_bgp_ls_sr_tlv_local_block;                      /* 1036 */
2876
static int hf_bgp_ls_sr_tlv_local_block_flags;
2877
static int hf_bgp_ls_sr_tlv_local_block_range_size;
2878
static int hf_bgp_ls_sr_tlv_local_block_sid_label;
2879
static int hf_bgp_ls_sr_tlv_local_block_sid_index;
2880
static int hf_bgp_ls_sr_tlv_srv6_cap;                         /* 1037 */
2881
static int hf_bgp_ls_sr_tlv_srv6_cap_flags;
2882
static int hf_bgp_ls_sr_tlv_srv6_cap_flags_o;
2883
static int hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved;
2884
static int hf_bgp_ls_sr_tlv_srv6_cap_reserved;
2885
static int hf_bgp_ls_sr_tlv_flex_algo_def;                    /* 1039 */
2886
static int hf_bgp_ls_sr_tlv_flex_algo_algorithm;
2887
static int hf_bgp_ls_sr_tlv_flex_algo_metric_type;
2888
static int hf_bgp_ls_sr_tlv_flex_algo_calc_type;
2889
static int hf_bgp_ls_sr_tlv_flex_algo_priority;
2890
static int hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity;       /* 1040 */
2891
static int hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity;       /* 1041 */
2892
static int hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity;       /* 1042 */
2893
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags;              /* 1043 */
2894
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags;
2895
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m;
2896
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric;          /* 1044 */
2897
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags;
2898
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e;
2899
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved;
2900
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric;
2901
static int hf_bgp_ls_sr_tlv_flex_algo_exc_srlg;               /* 1045 */
2902
static int hf_bgp_ls_sr_tlv_prefix_sid;
2903
static int hf_bgp_ls_sr_tlv_prefix_sid_flags;
2904
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_r;
2905
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_n;
2906
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_np;
2907
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_p;
2908
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_m;
2909
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_e;
2910
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_v;
2911
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_l;
2912
static int hf_bgp_ls_sr_tlv_prefix_sid_algo;
2913
static int hf_bgp_ls_sr_tlv_prefix_sid_label;
2914
static int hf_bgp_ls_sr_tlv_prefix_sid_index;
2915
static int hf_bgp_ls_sr_tlv_adjacency_sid;
2916
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags;
2917
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi;
2918
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi;
2919
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo;
2920
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi;
2921
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo;
2922
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_li;
2923
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo;
2924
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_si;
2925
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_go;
2926
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi;
2927
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_po;
2928
static int hf_bgp_ls_sr_tlv_adjacency_sid_weight;
2929
static int hf_bgp_ls_sr_tlv_adjacency_sid_label;
2930
static int hf_bgp_ls_sr_tlv_adjacency_sid_index;
2931
static int hf_bgp_ls_sr_tlv_peer_node_sid;                    /* 1101 */
2932
static int hf_bgp_ls_sr_tlv_peer_adj_sid;                     /* 1102 */
2933
static int hf_bgp_ls_sr_tlv_peer_set_sid;                     /* 1103 */
2934
static int hf_bgp_ls_sr_tlv_peer_sid_flags;
2935
static int hf_bgp_ls_sr_tlv_peer_sid_flags_v;
2936
static int hf_bgp_ls_sr_tlv_peer_sid_flags_l;
2937
static int hf_bgp_ls_sr_tlv_peer_sid_flags_b;
2938
static int hf_bgp_ls_sr_tlv_peer_sid_flags_p;
2939
static int hf_bgp_ls_sr_tlv_peer_sid_weight;
2940
static int hf_bgp_ls_sr_tlv_peer_sid_label;
2941
static int hf_bgp_ls_sr_tlv_peer_sid_index;
2942
static int hf_bgp_ls_sr_tlv_srv6_endx_sid;                   /* 1106 */
2943
static int hf_bgp_ls_sr_tlv_srv6_lan_endx_sid;               /* 1107 */
2944
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior;
2945
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags;
2946
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b;
2947
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s;
2948
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p;
2949
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved;
2950
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_algo;
2951
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_weight;
2952
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved;
2953
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis;
2954
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf;
2955
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_sid;
2956
static int hf_bgp_ls_sr_tlv_srv6_locator;                     /* 1162 */
2957
static int hf_bgp_ls_sr_tlv_srv6_locator_flags;
2958
static int hf_bgp_ls_sr_tlv_srv6_locator_flags_d;
2959
static int hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved;
2960
static int hf_bgp_ls_sr_tlv_srv6_locator_algo;
2961
static int hf_bgp_ls_sr_tlv_srv6_locator_reserved;
2962
static int hf_bgp_ls_sr_tlv_srv6_locator_metric;
2963
static int hf_bgp_ls_sr_tlv_prefix_attr_flags;                /* 1170 */
2964
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags;
2965
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown;
2966
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao;
2967
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no;
2968
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo;
2969
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi;
2970
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri;
2971
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni;
2972
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei;
2973
static int hf_bgp_ls_sr_tlv_source_router_id;                 /* 1171 */
2974
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior;           /* 1250 */
2975
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior;
2976
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags;
2977
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo;
2978
static int hf_bgp_ls_sr_tlv_srv6_sid_struct;                  /* 1252 */
2979
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len;
2980
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len;
2981
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len;
2982
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len;
2983
2984
static int * const srv6_endx_sid_flags[] = {
2985
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b,
2986
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s,
2987
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p,
2988
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved,
2989
    NULL
2990
};
2991
2992
/* RFC7752 TLVs */
2993
static int hf_bgp_ls_tlv_local_node_descriptors;              /* 256 */
2994
static int hf_bgp_ls_tlv_remote_node_descriptors;             /* 257 */
2995
static int hf_bgp_ls_tlv_link_local_remote_identifiers;       /* 258 */
2996
static int hf_bgp_ls_tlv_ipv4_interface_address;              /* 259 */
2997
static int hf_bgp_ls_tlv_ipv4_neighbor_address;               /* 260 */
2998
static int hf_bgp_ls_tlv_ipv6_interface_address;              /* 261 */
2999
static int hf_bgp_ls_tlv_ipv6_neighbor_address;               /* 262 */
3000
static int hf_bgp_ls_tlv_multi_topology_id;                   /* 263 */
3001
static int hf_bgp_ls_tlv_ospf_route_type;                     /* 264 */
3002
static int hf_bgp_ls_tlv_ip_reachability_information;         /* 265 */
3003
static int hf_bgp_ls_tlv_node_msd;                            /* 266 */
3004
static int hf_bgp_ls_tlv_link_msd;                            /* 267 */
3005
static int hf_bgp_ls_tlv_igp_msd_type;
3006
static int hf_bgp_ls_tlv_igp_msd_value;
3007
3008
static int hf_bgp_ls_tlv_autonomous_system;                   /* 512 */
3009
static int hf_bgp_ls_tlv_autonomous_system_id;
3010
static int hf_bgp_ls_tlv_bgp_ls_identifier;                   /* 513 */
3011
static int hf_bgp_ls_tlv_bgp_ls_identifier_id;
3012
static int hf_bgp_ls_tlv_area_id;                             /* 514 */
3013
static int hf_bgp_ls_tlv_area_id_id;
3014
static int hf_bgp_ls_tlv_igp_router;                          /* 515 */
3015
static int hf_bgp_ls_tlv_igp_router_id;
3016
static int hf_bgp_ls_tlv_bgp_router_id;                       /* 516 */
3017
static int hf_bgp_ls_tlv_bgp_router_id_id;
3018
static int hf_bgp_ls_tlv_bgp_confederation_member;            /* 517 */
3019
static int hf_bgp_ls_tlv_bgp_confederation_member_as;
3020
static int hf_bgp_ls_tlv_srv6_sid_info;                       /* 518 */
3021
static int hf_bgp_ls_tlv_srv6_sid_info_sid;
3022
3023
static int hf_bgp_ls_tlv_node_flags_bits;                     /* 1024 */
3024
static int hf_bgp_ls_tlv_opaque_node_properties;              /* 1025 */
3025
static int hf_bgp_ls_tlv_opaque_node_properties_value;
3026
static int hf_bgp_ls_tlv_node_name;                           /* 1026 */
3027
static int hf_bgp_ls_tlv_node_name_value;
3028
static int hf_bgp_ls_tlv_is_is_area_identifier;               /* 1027 */
3029
static int hf_bgp_ls_tlv_is_is_area_identifier_value;
3030
static int hf_bgp_ls_tlv_ipv4_router_id_of_local_node;        /* 1028 */
3031
static int hf_bgp_ls_tlv_ipv4_router_id_value;
3032
static int hf_bgp_ls_tlv_ipv6_router_id_value;
3033
static int hf_bgp_ls_tlv_ipv6_router_id_of_local_node;        /* 1029 */
3034
static int hf_bgp_ls_tlv_ipv4_router_id_of_remote_node;       /* 1030 */
3035
static int hf_bgp_ls_tlv_ipv6_router_id_of_remote_node;       /* 1031 */
3036
3037
static int hf_bgp_ls_tlv_administrative_group_color;          /* 1088 */
3038
static int hf_bgp_ls_tlv_administrative_group_color_value;
3039
static int hf_bgp_ls_tlv_administrative_group;
3040
static int hf_bgp_ls_tlv_max_link_bandwidth;                  /* 1089 */
3041
static int hf_bgp_ls_tlv_max_reservable_link_bandwidth;       /* 1090 */
3042
static int hf_bgp_ls_tlv_unreserved_bandwidth;                /* 1091 */
3043
static int hf_bgp_ls_bandwidth_value;
3044
static int hf_bgp_ls_tlv_te_default_metric;                   /* 1092 */
3045
static int hf_bgp_ls_tlv_te_default_metric_value_old;
3046
static int hf_bgp_ls_tlv_te_default_metric_value;
3047
static int hf_bgp_ls_tlv_link_protection_type;                /* 1093 */
3048
static int hf_bgp_ls_tlv_link_protection_type_value;
3049
static int hf_bgp_ls_tlv_mpls_protocol_mask;                  /* 1094 */
3050
static int hf_bgp_ls_tlv_metric;                              /* 1095 */
3051
static int hf_bgp_ls_tlv_metric_value1;
3052
static int hf_bgp_ls_tlv_metric_value2;
3053
static int hf_bgp_ls_tlv_metric_value3;
3054
static int hf_bgp_ls_tlv_shared_risk_link_group;              /* 1096 */
3055
static int hf_bgp_ls_tlv_shared_risk_link_group_value;
3056
static int hf_bgp_ls_tlv_opaque_link_attribute;               /* 1097 */
3057
static int hf_bgp_ls_tlv_opaque_link_attribute_value;
3058
static int hf_bgp_ls_tlv_link_name_attribute;                 /* 1098 */
3059
static int hf_bgp_ls_tlv_link_name_attribute_value;
3060
static int hf_bgp_ls_tlv_app_spec_link_attrs;                 /* 1122 */
3061
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len;
3062
static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len;
3063
static int hf_bgp_ls_tlv_app_spec_link_attrs_reserved;
3064
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm;
3065
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r;
3066
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s;
3067
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f;
3068
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x;
3069
static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm;
3070
3071
static int hf_bgp_ls_tlv_igp_flags;                           /* 1152 */
3072
static int hf_bgp_ls_tlv_route_tag;                           /* 1153 */
3073
static int hf_bgp_ls_tlv_route_tag_value;
3074
static int hf_bgp_ls_tlv_route_extended_tag;                  /* 1154 */
3075
static int hf_bgp_ls_tlv_route_extended_tag_value;
3076
static int hf_bgp_ls_tlv_prefix_metric;                       /* 1155 */
3077
static int hf_bgp_ls_tlv_prefix_metric_value;
3078
static int hf_bgp_ls_ospf_forwarding_address;                 /* 1156 */
3079
static int hf_bgp_ls_ospf_forwarding_address_ipv4_address;
3080
static int hf_bgp_ls_ospf_forwarding_address_ipv6_address;
3081
static int hf_bgp_ls_opaque_prefix_attribute;                 /* 1157 */
3082
static int hf_bgp_ls_opaque_prefix_attribute_value;
3083
static int hf_bgp_ls_extended_administrative_group;           /* 1173 */
3084
static int hf_bgp_ls_extended_administrative_group_value;
3085
3086
3087
/* Link Protection Types */
3088
static int hf_bgp_ls_link_protection_type_extra_traffic;
3089
static int hf_bgp_ls_link_protection_type_unprotected;
3090
static int hf_bgp_ls_link_protection_type_shared;
3091
static int hf_bgp_ls_link_protection_type_dedicated_1to1;
3092
static int hf_bgp_ls_link_protection_type_dedicated_1plus1;
3093
static int hf_bgp_ls_link_protection_type_enhanced;
3094
/* MPLS Protocol Mask flags */
3095
static int hf_bgp_ls_mpls_protocol_mask_flag_l;
3096
static int hf_bgp_ls_mpls_protocol_mask_flag_r;
3097
/* BGP-LS IGP Flags */
3098
static int hf_bgp_ls_igp_flags_flag_d;
3099
/* Node Flag Bits TLV's flags */
3100
static int hf_bgp_ls_node_flag_bits_overload;
3101
static int hf_bgp_ls_node_flag_bits_attached;
3102
static int hf_bgp_ls_node_flag_bits_external;
3103
static int hf_bgp_ls_node_flag_bits_abr;
3104
3105
/* RFC8669 BGP Prefix-SID header field */
3106
static int hf_bgp_prefix_sid_unknown;
3107
static int hf_bgp_prefix_sid_label_index;
3108
static int hf_bgp_prefix_sid_label_index_value;
3109
static int hf_bgp_prefix_sid_label_index_flags;
3110
static int hf_bgp_prefix_sid_originator_srgb;
3111
static int hf_bgp_prefix_sid_originator_srgb_blocks;
3112
static int hf_bgp_prefix_sid_originator_srgb_block;
3113
static int hf_bgp_prefix_sid_originator_srgb_flags;
3114
static int hf_bgp_prefix_sid_originator_srgb_base;
3115
static int hf_bgp_prefix_sid_originator_srgb_range;
3116
static int hf_bgp_prefix_sid_type;
3117
static int hf_bgp_prefix_sid_length;
3118
static int hf_bgp_prefix_sid_value;
3119
static int hf_bgp_prefix_sid_reserved;
3120
3121
/* draft-ietf-bess-srv6-services-05 header field */
3122
static int hf_bgp_prefix_sid_srv6_l3vpn;
3123
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs;
3124
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv;
3125
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type;
3126
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length;
3127
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value;
3128
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved;
3129
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_value;
3130
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_flags;
3131
static int hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior;
3132
static int hf_bgp_prefix_sid_srv6_l3vpn_reserved;
3133
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs;
3134
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv;
3135
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type;
3136
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length;
3137
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value;
3138
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len;
3139
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len;
3140
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len;
3141
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len;
3142
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len;
3143
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset;
3144
static int hf_bgp_prefix_sid_srv6_l2vpn;
3145
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs;
3146
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv;
3147
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type;
3148
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length;
3149
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value;
3150
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved;
3151
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_value;
3152
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_flags;
3153
static int hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior;
3154
static int hf_bgp_prefix_sid_srv6_l2vpn_reserved;
3155
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs;
3156
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv;
3157
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type;
3158
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length;
3159
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value;
3160
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len;
3161
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len;
3162
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len;
3163
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len;
3164
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len;
3165
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset;
3166
3167
/* BGP flow spec nlri header field */
3168
3169
static int hf_bgp_flowspec_nlri_t;
3170
static int hf_bgp_flowspec_nlri_route_distinguisher;
3171
static int hf_bgp_flowspec_nlri_route_distinguisher_type;
3172
static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_2;
3173
static int hf_bgp_flowspec_nlri_route_dist_admin_ipv4;
3174
static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_4;
3175
static int hf_bgp_flowspec_nlri_route_dist_asnum_2;
3176
static int hf_bgp_flowspec_nlri_route_dist_asnum_4;
3177
static int hf_bgp_flowspec_nlri_filter;
3178
static int hf_bgp_flowspec_nlri_filter_type;
3179
static int hf_bgp_flowspec_nlri_length;
3180
static int hf_bgp_flowspec_nlri_dst_pref_ipv4;
3181
static int hf_bgp_flowspec_nlri_src_pref_ipv4;
3182
static int hf_bgp_flowspec_nlri_op_flags;
3183
static int hf_bgp_flowspec_nlri_op_eol;
3184
static int hf_bgp_flowspec_nlri_op_and;
3185
static int hf_bgp_flowspec_nlri_op_val_len;
3186
static int hf_bgp_flowspec_nlri_op_un_bit4;
3187
static int hf_bgp_flowspec_nlri_op_un_bit5;
3188
static int hf_bgp_flowspec_nlri_op_lt;
3189
static int hf_bgp_flowspec_nlri_op_gt;
3190
static int hf_bgp_flowspec_nlri_op_eq;
3191
static int hf_bgp_flowspec_nlri_dec_val_8;
3192
static int hf_bgp_flowspec_nlri_dec_val_16;
3193
static int hf_bgp_flowspec_nlri_dec_val_32;
3194
static int hf_bgp_flowspec_nlri_dec_val_64;
3195
static int hf_bgp_flowspec_nlri_op_flg_not;
3196
static int hf_bgp_flowspec_nlri_op_flg_match;
3197
static int hf_bgp_flowspec_nlri_tcp_flags;
3198
static int hf_bgp_flowspec_nlri_tcp_flags_cwr;
3199
static int hf_bgp_flowspec_nlri_tcp_flags_ecn;
3200
static int hf_bgp_flowspec_nlri_tcp_flags_urg;
3201
static int hf_bgp_flowspec_nlri_tcp_flags_ack;
3202
static int hf_bgp_flowspec_nlri_tcp_flags_push;
3203
static int hf_bgp_flowspec_nlri_tcp_flags_reset;
3204
static int hf_bgp_flowspec_nlri_tcp_flags_syn;
3205
static int hf_bgp_flowspec_nlri_tcp_flags_fin;
3206
static int hf_bgp_flowspec_nlri_fflag;
3207
static int hf_bgp_flowspec_nlri_fflag_lf;
3208
static int hf_bgp_flowspec_nlri_fflag_ff;
3209
static int hf_bgp_flowspec_nlri_fflag_isf;
3210
static int hf_bgp_flowspec_nlri_fflag_df;
3211
static int hf_bgp_flowspec_nlri_dscp;
3212
static int hf_bgp_flowspec_nlri_src_ipv6_pref;
3213
static int hf_bgp_flowspec_nlri_dst_ipv6_pref;
3214
static int hf_bgp_flowspec_nlri_ipv6_pref_len;
3215
static int hf_bgp_flowspec_nlri_ipv6_pref_offset;
3216
3217
/* BGP update safi ndt nlri  draft-nalawade-idr-mdt-safi-03 */
3218
3219
static int hf_bgp_mdt_nlri_safi_rd;
3220
static int hf_bgp_mdt_nlri_safi_ipv4_addr;
3221
static int hf_bgp_mdt_nlri_safi_group_addr;
3222
3223
/* BGP update extended community header field */
3224
3225
static int hf_bgp_ext_communities;
3226
static int hf_bgp_ext_community;
3227
static int hf_bgp_ext_com_type_auth;
3228
static int hf_bgp_ext_com_type_tran;
3229
3230
static int hf_bgp_ext_com_type_high;
3231
static int hf_bgp_ext_com_stype_low_unknown;
3232
static int hf_bgp_ext_com_stype_tr_evpn;
3233
static int hf_bgp_ext_com_stype_tr_as2;
3234
static int hf_bgp_ext_com_stype_ntr_as2;
3235
static int hf_bgp_ext_com_stype_tr_as4;
3236
static int hf_bgp_ext_com_stype_ntr_as4;
3237
static int hf_bgp_ext_com_stype_tr_IP4;
3238
static int hf_bgp_ext_com_stype_ntr_IP4;
3239
static int hf_bgp_ext_com_stype_tr_opaque;
3240
static int hf_bgp_ext_com_stype_ntr_opaque;
3241
static int hf_bgp_ext_com_tunnel_type;
3242
static int hf_bgp_ext_com_stype_tr_mup;
3243
static int hf_bgp_ext_com_stype_tr_exp;
3244
static int hf_bgp_ext_com_stype_tr_exp_2;
3245
static int hf_bgp_ext_com_stype_tr_exp_3;
3246
3247
static int hf_bgp_ext_com_value_as2;
3248
static int hf_bgp_ext_com_value_as4;
3249
static int hf_bgp_ext_com_value_IP4;
3250
static int hf_bgp_ext_com_value_an2;
3251
static int hf_bgp_ext_com_value_an4;
3252
static int hf_bgp_ext_com_value_raw;
3253
static int hf_bgp_ext_com_value_link_bw;
3254
static int hf_bgp_ext_com_value_ospf_rt_area;
3255
static int hf_bgp_ext_com_value_ospf_rt_type;
3256
static int hf_bgp_ext_com_value_ospf_rt_options;
3257
static int hf_bgp_ext_com_value_ospf_rt_options_mt;
3258
static int hf_bgp_ext_com_value_ospf_rid;
3259
static int hf_bgp_ext_com_value_fs_remark;
3260
static int hf_bgp_ext_com_local_admin_flags;
3261
static int hf_bgp_ext_com_local_admin_auto_derived_flag;
3262
static int hf_bgp_ext_com_local_admin_type;
3263
static int hf_bgp_ext_com_local_admin_domain_id;
3264
static int hf_bgp_ext_com_local_admin_service_id;
3265
3266
/* BGP QoS propagation draft-knoll-idr-qos-attribute */
3267
3268
static int hf_bgp_ext_com_qos_flags;
3269
static int hf_bgp_ext_com_qos_flags_remarking;
3270
static int hf_bgp_ext_com_qos_flags_ignore_remarking;
3271
static int hf_bgp_ext_com_qos_flags_agg_marking;
3272
static int hf_bgp_ext_com_cos_flags;
3273
static int hf_bgp_ext_com_cos_flags_be;
3274
static int hf_bgp_ext_com_cos_flags_ef;
3275
static int hf_bgp_ext_com_cos_flags_af;
3276
static int hf_bgp_ext_com_cos_flags_le;
3277
static int hf_bgp_ext_com_qos_set_number;
3278
static int hf_bgp_ext_com_qos_tech_type;
3279
static int hf_bgp_ext_com_qos_marking_o;
3280
static int hf_bgp_ext_com_qos_marking_a;
3281
static int hf_bgp_ext_com_qos_default_to_zero;
3282
3283
/* BGP Flow spec extended community RFC 5575 */
3284
3285
static int hf_bgp_ext_com_flow_rate_float;
3286
static int hf_bgp_ext_com_flow_act_allset;
3287
static int hf_bgp_ext_com_flow_act_term_act;
3288
static int hf_bgp_ext_com_flow_act_samp_act;
3289
3290
/* BGP L2 extended community RFC 4761, RFC 6624 */
3291
/* draft-ietf-l2vpn-vpls-multihoming */
3292
3293
static int hf_bgp_ext_com_l2_encaps;
3294
static int hf_bgp_ext_com_l2_c_flags;
3295
static int hf_bgp_ext_com_l2_mtu;
3296
static int hf_bgp_ext_com_l2_flag_d;
3297
static int hf_bgp_ext_com_l2_flag_z1;
3298
static int hf_bgp_ext_com_l2_flag_f;
3299
static int hf_bgp_ext_com_l2_flag_z345;
3300
static int hf_bgp_ext_com_l2_flag_c;
3301
static int hf_bgp_ext_com_l2_flag_s;
3302
static int hf_bgp_ext_com_l2_esi_label_flag;
3303
static int hf_bgp_ext_com_evpn_mmac_flag;
3304
static int hf_bgp_ext_com_evpn_mmac_seq;
3305
static int hf_bgp_ext_com_evpn_esirt;
3306
static int hf_bgp_ext_com_evpn_routermac;
3307
static int hf_bgp_ext_com_evpn_mmac_flag_sticky;
3308
3309
/* BGP E-Tree Info extended community RFC 7796 */
3310
3311
static int hf_bgp_ext_com_etree_flags;
3312
static int hf_bgp_ext_com_etree_root_vlan;
3313
static int hf_bgp_ext_com_etree_leaf_vlan;
3314
static int hf_bgp_ext_com_etree_flag_reserved;
3315
static int hf_bgp_ext_com_etree_flag_p;
3316
static int hf_bgp_ext_com_etree_flag_v;
3317
3318
/* VPWS Support in EVPN  RFC 8214 */
3319
/* draft-yu-bess-evpn-l2-attributes-04 */
3320
3321
static int hf_bgp_ext_com_evpn_l2attr_flags;
3322
static int hf_bgp_ext_com_evpn_l2attr_flag_reserved;
3323
static int hf_bgp_ext_com_evpn_l2attr_flag_ci;
3324
static int hf_bgp_ext_com_evpn_l2attr_flag_f;
3325
static int hf_bgp_ext_com_evpn_l2attr_flag_c;
3326
static int hf_bgp_ext_com_evpn_l2attr_flag_p;
3327
static int hf_bgp_ext_com_evpn_l2attr_flag_b;
3328
static int hf_bgp_ext_com_evpn_l2attr_l2_mtu;
3329
static int hf_bgp_ext_com_evpn_l2attr_reserved;
3330
3331
/* E-Tree RFC8317 */
3332
3333
static int hf_bgp_ext_com_evpn_etree_flags;
3334
static int hf_bgp_ext_com_evpn_etree_flag_reserved;
3335
static int hf_bgp_ext_com_evpn_etree_flag_l;
3336
static int hf_bgp_ext_com_evpn_etree_reserved;
3337
3338
/* BGP Cost Community */
3339
3340
static int hf_bgp_ext_com_cost_poi;
3341
static int hf_bgp_ext_com_cost_cid;
3342
static int hf_bgp_ext_com_cost_cost;
3343
static int hf_bgp_ext_com_cost_cid_rep;
3344
3345
/* EIGRP route attributes extended communities */
3346
3347
static int hf_bgp_ext_com_stype_tr_exp_eigrp;
3348
static int hf_bgp_ext_com_eigrp_flags;
3349
static int hf_bgp_ext_com_eigrp_flags_rt;
3350
static int hf_bgp_ext_com_eigrp_rtag;
3351
static int hf_bgp_ext_com_eigrp_asn;
3352
static int hf_bgp_ext_com_eigrp_delay;
3353
static int hf_bgp_ext_com_eigrp_rly;
3354
static int hf_bgp_ext_com_eigrp_hops;
3355
static int hf_bgp_ext_com_eigrp_bw;
3356
static int hf_bgp_ext_com_eigrp_load;
3357
static int hf_bgp_ext_com_eigrp_mtu;
3358
static int hf_bgp_ext_com_eigrp_rid;
3359
static int hf_bgp_ext_com_eigrp_e_asn;
3360
static int hf_bgp_ext_com_eigrp_e_rid;
3361
static int hf_bgp_ext_com_eigrp_e_pid;
3362
static int hf_bgp_ext_com_eigrp_e_m;
3363
3364
/* MUP extended community */
3365
3366
static int hf_bgp_ext_com_mup_segment_id2;
3367
static int hf_bgp_ext_com_mup_segment_id4;
3368
3369
/* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
3370
static int hf_bgp_ls_igp_te_metric_flags;
3371
static int hf_bgp_ls_igp_te_metric_flags_a;
3372
static int hf_bgp_ls_igp_te_metric_flags_reserved;
3373
static int hf_bgp_ls_igp_te_metric_delay;
3374
static int hf_bgp_ls_igp_te_metric_delay_value;
3375
static int hf_bgp_ls_igp_te_metric_delay_min_max;
3376
static int hf_bgp_ls_igp_te_metric_delay_min;
3377
static int hf_bgp_ls_igp_te_metric_delay_max;
3378
static int hf_bgp_ls_igp_te_metric_delay_variation;
3379
static int hf_bgp_ls_igp_te_metric_delay_variation_value;
3380
static int hf_bgp_ls_igp_te_metric_link_loss;
3381
static int hf_bgp_ls_igp_te_metric_link_loss_value;
3382
static int hf_bgp_ls_igp_te_metric_bandwidth_residual;
3383
static int hf_bgp_ls_igp_te_metric_bandwidth_residual_value;
3384
static int hf_bgp_ls_igp_te_metric_bandwidth_available;
3385
static int hf_bgp_ls_igp_te_metric_bandwidth_available_value;
3386
static int hf_bgp_ls_igp_te_metric_bandwidth_utilized;
3387
static int hf_bgp_ls_igp_te_metric_bandwidth_utilized_value;
3388
static int hf_bgp_ls_igp_te_metric_reserved;
3389
3390
/* draft-mpmz-bess-mup-safi-03 */
3391
static int hf_bgp_mup_nlri;
3392
static int hf_bgp_mup_nlri_at;
3393
static int hf_bgp_mup_nlri_rt;
3394
static int hf_bgp_mup_nlri_len;
3395
static int hf_bgp_mup_nlri_rd;
3396
static int hf_bgp_mup_nlri_prefixlen;
3397
static int hf_bgp_mup_nlri_ip_prefix;
3398
static int hf_bgp_mup_nlri_ipv6_prefix;
3399
static int hf_bgp_mup_nlri_ip_addr;
3400
static int hf_bgp_mup_nlri_ipv6_addr;
3401
static int hf_bgp_mup_nlri_3gpp_5g_type1_st_route;
3402
static int hf_bgp_mup_nlri_3gpp_5g_teid;
3403
static int hf_bgp_mup_nlri_3gpp_5g_qfi;
3404
static int hf_bgp_mup_nlri_3gpp_5g_ep_addr_len;
3405
static int hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr;
3406
static int hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr;
3407
static int hf_bgp_mup_nlri_3gpp_5g_source_addr_len;
3408
static int hf_bgp_mup_nlri_3gpp_5g_source_ip_addr;
3409
static int hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr;
3410
static int hf_bgp_mup_nlri_3gpp_5g_type2_st_route;
3411
static int hf_bgp_mup_nlri_ep_len;
3412
static int hf_bgp_mup_nlri_ep_ip_addr;
3413
static int hf_bgp_mup_nlri_ep_ipv6_addr;
3414
static int hf_bgp_mup_nlri_3gpp_5g_ep_teid;
3415
static int hf_bgp_mup_nlri_unknown_data;
3416
3417
static int * const ls_igp_te_metric_flags[] = {
3418
       &hf_bgp_ls_igp_te_metric_flags_a,
3419
       &hf_bgp_ls_igp_te_metric_flags_reserved,
3420
       NULL
3421
       };
3422
3423
static int ett_bgp;
3424
static int ett_bgp_prefix;
3425
static int ett_bgp_unfeas;
3426
static int ett_bgp_attrs;
3427
static int ett_bgp_attr;
3428
static int ett_bgp_attr_flags;
3429
static int ett_bgp_mp_nhna;
3430
static int ett_bgp_mp_reach_nlri;
3431
static int ett_bgp_mp_unreach_nlri;
3432
static int ett_bgp_mp_snpa;
3433
static int ett_bgp_nlri;
3434
static int ett_bgp_open;
3435
static int ett_bgp_update;
3436
static int ett_bgp_notification;
3437
static int ett_bgp_route_refresh; /* ROUTE-REFRESH message tree */
3438
static int ett_bgp_capability;
3439
static int ett_bgp_as_path_segment;
3440
static int ett_bgp_as_path_segment_asn;
3441
static int ett_bgp_communities;
3442
static int ett_bgp_community;
3443
static int ett_bgp_cluster_list;  /* cluster list tree          */
3444
static int ett_bgp_options;       /* optional parameters tree   */
3445
static int ett_bgp_option;        /* an optional parameter tree */
3446
static int ett_bgp_options_ext;
3447
static int ett_bgp_cap;           /* an cap parameter tree */
3448
static int ett_bgp_extended_communities; /* extended communities list tree */
3449
static int ett_bgp_extended_community; /* extended community tree for each community of BGP update */
3450
static int ett_bgp_ext_com_type;  /* Extended Community Type High tree (IANA, Transitive bits) */
3451
static int ett_bgp_extended_com_fspec_redir; /* extended communities BGP flow act redirect */
3452
static int ett_bgp_ext_com_flags; /* extended communities flags tree */
3453
static int ett_bgp_ext_com_l2_flags; /* extended communities tree for l2 services flags */
3454
static int ett_bgp_ext_com_etree_flags;
3455
static int ett_bgp_ext_com_evpn_mmac_flags;
3456
static int ett_bgp_ext_com_evpn_l2attr_flags;
3457
static int ett_bgp_ext_com_evpn_etree_flags;
3458
static int ett_bgp_ext_com_cost_cid; /* Cost community CommunityID tree (replace/evaluate after bit) */
3459
static int ett_bgp_ext_com_ospf_rt_opt; /* Tree for Options bitfield of OSPF Route Type extended community */
3460
static int ett_bgp_ext_com_eigrp_flags; /* Tree for EIGRP route flags */
3461
static int ett_bgp_ssa;           /* safi specific attribute */
3462
static int ett_bgp_ssa_subtree;   /* safi specific attribute Subtrees */
3463
static int ett_bgp_orf;           /* orf (outbound route filter) tree */
3464
static int ett_bgp_orf_entry;     /* orf entry tree */
3465
static int ett_bgp_mcast_vpn_nlri;
3466
static int ett_bgp_flow_spec_nlri;
3467
static int ett_bgp_flow_spec_nlri_filter; /* tree decoding multiple op and value pairs */
3468
static int ett_bgp_flow_spec_nlri_op_flags; /* tree decoding each op and val pair within the op and value set */
3469
static int ett_bgp_flow_spec_nlri_tcp;
3470
static int ett_bgp_flow_spec_nlri_ff;
3471
static int ett_bgp_tunnel_tlv;
3472
static int ett_bgp_tunnel_tlv_subtree;
3473
static int ett_bgp_tunnel_subtlv;
3474
static int ett_bgp_tunnel_subtlv_subtree;
3475
static int ett_bgp_link_state;
3476
static int ett_bgp_evpn_nlri;
3477
static int ett_bgp_evpn_nlri_esi;
3478
static int ett_bgp_evpn_nlri_mc;
3479
static int ett_bgp_mpls_labels;
3480
static int ett_bgp_pmsi_tunnel_id;
3481
static int ett_bgp_aigp_attr;
3482
static int ett_bgp_large_communities;
3483
static int ett_bgp_dpath;
3484
static int ett_bgp_prefix_sid_originator_srgb;
3485
static int ett_bgp_prefix_sid_originator_srgb_block;
3486
static int ett_bgp_prefix_sid_originator_srgb_blocks;
3487
static int ett_bgp_prefix_sid_label_index;
3488
static int ett_bgp_prefix_sid_ipv6;
3489
static int ett_bgp_bgpsec_secure_path;
3490
static int ett_bgp_bgpsec_secure_path_segment;
3491
static int ett_bgp_bgpsec_signature_block;
3492
static int ett_bgp_bgpsec_signature_segment;
3493
static int ett_bgp_vxlan;
3494
static int ett_bgp_binding_sid;
3495
static int ett_bgp_segment_list;
3496
static int ett_bgp_prefix_sid_unknown;
3497
static int ett_bgp_prefix_sid_srv6_l3vpn;
3498
static int ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs;
3499
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_information;
3500
static int ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs;
3501
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_structure;
3502
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown;
3503
static int ett_bgp_prefix_sid_srv6_l3vpn_unknown;
3504
static int ett_bgp_prefix_sid_srv6_l2vpn;
3505
static int ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs;
3506
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_information;
3507
static int ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs;
3508
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_structure;
3509
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown;
3510
static int ett_bgp_prefix_sid_srv6_l2vpn_unknown;
3511
static int ett_bgp_mup_nlri;
3512
static int ett_bgp_mup_nlri_3gpp_5g_type1_st_route;
3513
static int ett_bgp_mup_nlri_3gpp_5g_type2_st_route;
3514
3515
static expert_field ei_bgp_marker_invalid;
3516
static expert_field ei_bgp_cap_len_bad;
3517
static expert_field ei_bgp_cap_gr_helper_mode_only;
3518
static expert_field ei_bgp_notify_minor_unknown;
3519
static expert_field ei_bgp_route_refresh_orf_type_unknown;
3520
static expert_field ei_bgp_route_refresh_orf_type_unsupported;
3521
static expert_field ei_bgp_route_refresh_orf_type_unregistered;
3522
static expert_field ei_bgp_route_refresh_orf_action_invalid;
3523
static expert_field ei_bgp_length_invalid;
3524
static expert_field ei_bgp_prefix_length_invalid;
3525
static expert_field ei_bgp_afi_type_not_supported;
3526
static expert_field ei_bgp_unknown_afi;
3527
static expert_field ei_bgp_unknown_safi;
3528
static expert_field ei_bgp_unknown_label_vpn;
3529
static expert_field ei_bgp_ls_error;
3530
static expert_field ei_bgp_ls_warn;
3531
static expert_field ei_bgp_ext_com_len_bad;
3532
static expert_field ei_bgp_attr_pmsi_opaque_type;
3533
static expert_field ei_bgp_attr_pmsi_tunnel_type;
3534
static expert_field ei_bgp_prefix_length_err;
3535
static expert_field ei_bgp_attr_aigp_type;
3536
static expert_field ei_bgp_attr_as_path_as_len_err;
3537
static expert_field ei_bgp_next_hop_ipv6_scope;
3538
static expert_field ei_bgp_next_hop_rd_nonzero;
3539
3540
static expert_field ei_bgp_evpn_nlri_rt_type_err;
3541
static expert_field ei_bgp_evpn_nlri_rt_len_err;
3542
static expert_field ei_bgp_evpn_nlri_esi_type_err;
3543
static expert_field ei_bgp_evpn_nlri_rt4_no_ip;
3544
3545
static expert_field ei_bgp_mup_unknown_at;
3546
static expert_field ei_bgp_mup_unknown_rt;
3547
static expert_field ei_bgp_mup_nlri_addr_len_err;
3548
3549
/* desegmentation */
3550
static bool bgp_desegment = true;
3551
static bool bgp_ext_msg = true;
3552
3553
static int bgp_asn_len;
3554
3555
/* FF: BGP-LS is just a collector of IGP link state information. Some
3556
   fields are encoded "as-is" from the IGP, hence in order to dissect
3557
   them properly we must be aware of their origin, e.g. IS-IS or OSPF.
3558
   So, *before* dissecting LINK_STATE attributes we must get the
3559
   'Protocol-ID' field that is present in the MP_[UN]REACH_NLRI
3560
   attribute. The tricky thing is that there is no strict order
3561
   for path attributes on the wire, hence we have to keep track
3562
   of 1) the 'Protocol-ID' from the MP_[UN]REACH_NLRI and 2)
3563
   the offset/len of the LINK_STATE attribute. We store them in
3564
   per-packet proto_data and once we got both we are ready for the
3565
   LINK_STATE attribute dissection.
3566
*/
3567
typedef struct _link_state_data {
3568
    /* Link/Node NLRI Protocol-ID (e.g. OSPF or IS-IS) */
3569
    uint8_t protocol_id;
3570
    /* LINK_STATE attribute coordinates */
3571
    int ostart;  /* offset at which the LINK_STATE path attribute starts */
3572
    int oend;    /* offset at which the LINK_STATE path attribute ends */
3573
    uint16_t tlen; /* length of the LINK_STATE path attribute */
3574
    /* presence flag */
3575
    bool link_state_attr_present;
3576
    /* tree where add LINK_STATE items */
3577
    proto_tree *subtree2;
3578
} link_state_data;
3579
3580
34.7k
#define LINK_STATE_DATA_KEY 0
3581
3582
static void
3583
13.1k
save_link_state_protocol_id(packet_info *pinfo, uint8_t protocol_id) {
3584
13.1k
    link_state_data *data =
3585
13.1k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3586
13.1k
    if (!data) {
3587
1.05k
        data = wmem_new0(pinfo->pool, link_state_data);
3588
1.05k
        data->ostart = -1;
3589
1.05k
        data->oend = -1;
3590
1.05k
        data->tlen = 0;
3591
1.05k
        data->link_state_attr_present = false;
3592
1.05k
        data->subtree2 = NULL;
3593
1.05k
    }
3594
13.1k
    data->protocol_id = protocol_id;
3595
13.1k
    p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3596
13.1k
    return;
3597
13.1k
}
3598
3599
static void
3600
2.96k
save_link_state_attr_position(packet_info *pinfo, int ostart, int oend, uint16_t tlen, proto_tree *subtree2) {
3601
2.96k
    link_state_data *data =
3602
2.96k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3603
2.96k
    if (!data) {
3604
1.99k
        data = wmem_new0(pinfo->pool, link_state_data);
3605
1.99k
        data->protocol_id = BGP_LS_NLRI_PROTO_ID_UNKNOWN;
3606
1.99k
    }
3607
2.96k
    data->ostart = ostart;
3608
2.96k
    data->oend = oend;
3609
2.96k
    data->tlen = tlen;
3610
2.96k
    data->link_state_attr_present = true;
3611
2.96k
    data->subtree2 = subtree2;
3612
2.96k
    p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3613
2.96k
    return;
3614
2.96k
}
3615
3616
static link_state_data*
3617
2.52k
load_link_state_data(packet_info *pinfo) {
3618
2.52k
    link_state_data *data =
3619
2.52k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3620
2.52k
    return data;
3621
2.52k
}
3622
3623
typedef struct _path_attr_data {
3624
    bool encaps_community_present;
3625
    uint16_t encaps_tunnel_type;
3626
} path_attr_data;
3627
3628
11.1k
#define PATH_ATTR_DATA_KEY 1
3629
3630
static void
3631
341
save_path_attr_encaps_tunnel_type(packet_info *pinfo, uint32_t encaps_tunnel_type) {
3632
341
    path_attr_data *data =
3633
341
        (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3634
341
    if (!data) {
3635
220
        data = wmem_new0(wmem_file_scope(), path_attr_data);
3636
220
    }
3637
341
    data->encaps_community_present = true;
3638
341
    data->encaps_tunnel_type = encaps_tunnel_type;
3639
341
    p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY, data);
3640
341
    return;
3641
341
}
3642
3643
static path_attr_data*
3644
10.4k
load_path_attr_data(packet_info *pinfo) {
3645
10.4k
    path_attr_data *data =
3646
10.4k
        (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3647
10.4k
    return data;
3648
10.4k
}
3649
3650
typedef struct _afi_safi_data {
3651
    uint16_t afi;
3652
    uint8_t safi;  /* offset at which the LINK_STATE path attribute starts */
3653
} afi_safi_data;
3654
3655
48.4k
#define AFI_SAFI_DATA_KEY 2
3656
3657
static void
3658
23.9k
save_afi_safi_data(packet_info *pinfo, uint16_t afi, uint8_t safi) {
3659
23.9k
    afi_safi_data *data =
3660
23.9k
        (afi_safi_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY);
3661
23.9k
    if (!data) {
3662
5.08k
        data = wmem_new0(wmem_file_scope(), afi_safi_data);
3663
5.08k
    }
3664
23.9k
    data->afi  = afi;
3665
23.9k
    data->safi = safi;
3666
23.9k
    p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY, data);
3667
23.9k
    return;
3668
23.9k
}
3669
3670
static afi_safi_data*
3671
563
load_afi_safi_data(packet_info *pinfo) {
3672
563
    afi_safi_data *data =
3673
563
        (afi_safi_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY);
3674
563
    return data;
3675
563
}
3676
3677
/*
3678
 * Detect IPv4/IPv6 prefixes  conform to BGP Additional Path but NOT conform to standard BGP
3679
 *
3680
 * A real BGP speaker would rely on the BGP Additional Path in the BGP Open messages.
3681
 * But it is not suitable for a packet analyse because the BGP sessions are not supposed to
3682
 * restart very often, and Open messages from both sides of the session would be needed
3683
 * to determine the result of the capability negotiation.
3684
 * Code inspired from the decode_prefix4 function
3685
 */
3686
static int
3687
67.8k
detect_add_path_prefix46(tvbuff_t *tvb, unsigned offset, int end, int max_bit_length) {
3688
67.8k
    uint32_t addr_len;
3689
67.8k
    uint8_t prefix_len;
3690
67.8k
    int o;
3691
    /* Must be compatible with BGP Additional Path  */
3692
106k
    for (o = offset + 4; o < end; o += 4) {
3693
39.9k
        prefix_len = tvb_get_uint8(tvb, o);
3694
39.9k
        if( prefix_len > max_bit_length) {
3695
471
            return 0; /* invalid prefix length - not BGP add-path */
3696
471
        }
3697
39.5k
        addr_len = (prefix_len + 7) / 8;
3698
39.5k
        o += 1 + addr_len;
3699
39.5k
        if( o > end ) {
3700
516
            return 0; /* invalid offset - not BGP add-path */
3701
516
        }
3702
39.0k
        if (prefix_len % 8) {
3703
            /* detect bits set after the end of the prefix */
3704
1.74k
            if( tvb_get_uint8(tvb, o - 1 )  & (0xFF >> (prefix_len % 8)) ) {
3705
381
                return 0; /* invalid prefix content - not BGP add-path */
3706
381
            }
3707
1.74k
        }
3708
39.0k
    }
3709
    /* Must NOT be compatible with standard BGP */
3710
77.6k
    for (o = offset; o < end; ) {
3711
13.4k
        prefix_len = tvb_get_uint8(tvb, o);
3712
13.4k
        if( prefix_len == 0 && end - o > 1 ) {
3713
700
            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 */
3714
700
        }
3715
12.7k
        if( prefix_len > max_bit_length) {
3716
264
            return 1; /* invalid prefix length - may be BGP add-path */
3717
264
        }
3718
12.4k
        addr_len = (prefix_len + 7) / 8;
3719
12.4k
        o += 1 + addr_len;
3720
12.4k
        if( o > end ) {
3721
1.08k
            return 1; /* invalid offset - may be BGP add-path */
3722
1.08k
        }
3723
11.3k
        if (prefix_len % 8) {
3724
            /* detect bits set after the end of the prefix */
3725
1.51k
            if( tvb_get_uint8(tvb, o - 1 ) & (0xFF >> (prefix_len % 8)) ) {
3726
193
                return 1; /* invalid prefix content - may be BGP add-path (or a bug) */
3727
193
            }
3728
1.51k
        }
3729
11.3k
    }
3730
64.2k
    return 0; /* valid - do not assume Additional Path */
3731
66.4k
}
3732
static int
3733
35.4k
detect_add_path_prefix4(tvbuff_t *tvb, unsigned offset, int end) {
3734
35.4k
    return detect_add_path_prefix46(tvb, offset, end, 32);
3735
35.4k
}
3736
static int
3737
26.3k
detect_add_path_prefix6(tvbuff_t *tvb, unsigned offset, int end) {
3738
26.3k
    return detect_add_path_prefix46(tvb, offset, end, 128);
3739
26.3k
}
3740
/*
3741
 * Decode an IPv4 prefix with Path Identifier
3742
 * Code inspired from the decode_prefix4 function
3743
 */
3744
static int
3745
decode_path_prefix4(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, unsigned offset,
3746
                    const char *tag)
3747
1.22k
{
3748
1.22k
    proto_tree *prefix_tree;
3749
1.22k
    ws_in4_addr ip_addr; /* IP address                         */
3750
1.22k
    uint8_t plen;         /* prefix length                      */
3751
1.22k
    int    length;       /* number of octets needed for prefix */
3752
1.22k
    uint32_t path_identifier;
3753
1.22k
    address addr;
3754
3755
    /* snarf path identifier length and prefix */
3756
1.22k
    path_identifier = tvb_get_ntohl(tvb, offset);
3757
1.22k
    plen = tvb_get_uint8(tvb, offset + 4);
3758
1.22k
    length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 4 + 1, &ip_addr, plen);
3759
1.22k
    if (length < 0) {
3760
101
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4 , 1, "%s length %u invalid (> 32)",
3761
101
            tag, plen);
3762
101
        return -1;
3763
101
    }
3764
    /* put prefix into protocol tree */
3765
1.12k
    set_address(&addr, AT_IPv4, 4, &ip_addr);
3766
1.12k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,  4 + 1 + length,
3767
1.12k
                            ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3768
1.12k
                            address_to_str(pinfo->pool, &addr), plen, path_identifier);
3769
1.12k
    proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3770
1.12k
    proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
3771
1.12k
    proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, ip_addr);
3772
1.12k
    return 4 + 1 + length;
3773
1.22k
}
3774
3775
/*
3776
 * Decode an IPv4 prefix.
3777
 */
3778
static int
3779
decode_prefix4(proto_tree *tree, packet_info *pinfo, proto_item *parent_item, int hf_addr, tvbuff_t *tvb, unsigned offset,
3780
               const char *tag)
3781
38.4k
{
3782
38.4k
    proto_tree *prefix_tree;
3783
38.4k
    ws_in4_addr ip_addr; /* IP address                         */
3784
38.4k
    uint8_t plen;         /* prefix length                      */
3785
38.4k
    int    length;       /* number of octets needed for prefix */
3786
38.4k
    address addr;
3787
3788
    /* snarf length and prefix */
3789
38.4k
    plen = tvb_get_uint8(tvb, offset);
3790
38.4k
    length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 1, &ip_addr, plen);
3791
38.4k
    if (length < 0) {
3792
2.04k
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid (> 32)",
3793
2.04k
            tag, plen);
3794
2.04k
        return -1;
3795
2.04k
    }
3796
3797
    /* put prefix into protocol tree */
3798
36.3k
    set_address(&addr, AT_IPv4, 4, &ip_addr);
3799
36.3k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3800
36.3k
            1 + length, ett_bgp_prefix, NULL,
3801
36.3k
            "%s/%u", address_to_str(pinfo->pool, &addr), plen);
3802
3803
36.3k
    proto_item_append_text(parent_item, " (%s/%u)",
3804
36.3k
                             address_to_str(pinfo->pool, &addr), plen);
3805
3806
36.3k
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3807
36.3k
        tag, plen);
3808
36.3k
    proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 1, length, ip_addr);
3809
36.3k
    return 1 + length;
3810
38.4k
}
3811
3812
/*
3813
 * Decode an IPv6 prefix with path ID.
3814
 */
3815
static int
3816
decode_path_prefix6(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, unsigned offset,
3817
               const char *tag)
3818
541
{
3819
541
    proto_tree          *prefix_tree;
3820
541
    uint32_t path_identifier;
3821
541
    ws_in6_addr   addr;     /* IPv6 address                       */
3822
541
    address             addr_str;
3823
541
    int                 plen;     /* prefix length                      */
3824
541
    int                 length;   /* number of octets needed for prefix */
3825
3826
    /* snarf length and prefix */
3827
541
    path_identifier = tvb_get_ntohl(tvb, offset);
3828
541
    plen = tvb_get_uint8(tvb, offset + 4);
3829
541
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 4 + 1, &addr, plen);
3830
541
    if (length < 0) {
3831
66
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4, 1, "%s length %u invalid",
3832
66
            tag, plen);
3833
66
        return -1;
3834
66
    }
3835
3836
    /* put prefix into protocol tree */
3837
475
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3838
475
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,  4 + 1 + length,
3839
475
                            ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3840
475
                            address_to_str(pinfo->pool, &addr_str), plen, path_identifier);
3841
3842
475
    proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3843
475
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, plen, "%s prefix length: %u",
3844
475
        tag, plen);
3845
475
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, &addr);
3846
3847
475
    return 4 + 1 + length;
3848
541
}
3849
3850
/*
3851
 * Decode an IPv6 prefix.
3852
 */
3853
static int
3854
decode_prefix6(proto_tree *tree, packet_info *pinfo, int hf_addr, tvbuff_t *tvb, unsigned offset,
3855
               uint16_t tlen, const char *tag)
3856
26.0k
{
3857
26.0k
    proto_tree          *prefix_tree;
3858
26.0k
    ws_in6_addr   addr;     /* IPv6 address                       */
3859
26.0k
    address             addr_str;
3860
26.0k
    int                 plen;     /* prefix length                      */
3861
26.0k
    int                 length;   /* number of octets needed for prefix */
3862
3863
    /* snarf length and prefix */
3864
26.0k
    plen = tvb_get_uint8(tvb, offset);
3865
26.0k
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 1, &addr, plen);
3866
26.0k
    if (length < 0) {
3867
450
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid",
3868
450
            tag, plen);
3869
450
        return -1;
3870
450
    }
3871
3872
    /* put prefix into protocol tree */
3873
25.5k
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3874
25.5k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3875
25.5k
            tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3876
25.5k
            address_to_str(pinfo->pool, &addr_str), plen);
3877
25.5k
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3878
25.5k
        tag, plen);
3879
25.5k
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 1, length, &addr);
3880
25.5k
    return 1 + length;
3881
26.0k
}
3882
3883
static int
3884
decode_fspec_match_prefix6(proto_tree *tree, proto_item *parent_item, int hf_addr,
3885
                           tvbuff_t *tvb, unsigned offset, uint16_t tlen, packet_info *pinfo)
3886
1.06k
{
3887
1.06k
    proto_tree        *prefix_tree;
3888
1.06k
    ws_in6_addr addr;     /* IPv6 address                       */
3889
1.06k
    address           addr_str;
3890
1.06k
    int               plen;     /* prefix length                      */
3891
1.06k
    int               length;   /* number of octets needed for prefix */
3892
1.06k
    int               poffset_place = 1;
3893
1.06k
    int               plength_place = 0;
3894
3895
    /* snarf length and prefix */
3896
1.06k
    plen = tvb_get_uint8(tvb, offset);
3897
1.06k
    if (plen == 0) /* I should be facing a draft 04 version where the prefix offset is switched with length */
3898
229
    {
3899
229
      plen =  tvb_get_uint8(tvb, offset+1);
3900
229
      poffset_place = 0;
3901
229
      plength_place = 1;
3902
229
    }
3903
1.06k
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 2, &addr, plen);
3904
1.06k
    if (length < 0) {
3905
266
        expert_add_info_format(pinfo, parent_item, &ei_bgp_prefix_length_err, "Length is invalid %u", plen);
3906
266
        return -1;
3907
266
    }
3908
3909
    /* put prefix into protocol tree */
3910
797
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3911
797
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3912
797
            tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3913
797
            address_to_str(pinfo->pool, &addr_str), plen);
3914
797
    proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_len, tvb, offset + plength_place, 1, ENC_BIG_ENDIAN);
3915
797
    proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_offset, tvb, offset + poffset_place, 1, ENC_BIG_ENDIAN);
3916
797
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 2, length, &addr);
3917
797
    if (parent_item != NULL)
3918
711
      proto_item_append_text(parent_item, " (%s/%u)",
3919
711
                             address_to_str(pinfo->pool, &addr_str), plen);
3920
797
    return 2 + length;
3921
1.06k
}
3922
3923
const char*
3924
decode_bgp_rd(wmem_allocator_t *pool, tvbuff_t *tvb, unsigned offset)
3925
28.0k
{
3926
28.0k
    uint16_t rd_type;
3927
28.0k
    wmem_strbuf_t *strbuf;
3928
3929
28.0k
    rd_type = tvb_get_ntohs(tvb,offset);
3930
28.0k
    strbuf = wmem_strbuf_create(pool);
3931
3932
28.0k
    switch (rd_type) {
3933
1.48k
        case FORMAT_AS2_LOC:
3934
1.48k
            wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohs(tvb, offset + 2),
3935
1.48k
                                      tvb_get_ntohl(tvb, offset + 4));
3936
1.48k
            break;
3937
550
        case FORMAT_IP_LOC:
3938
550
            wmem_strbuf_append_printf(strbuf, "%s:%u", tvb_ip_to_str(pool, tvb, offset + 2),
3939
550
                                      tvb_get_ntohs(tvb, offset + 6));
3940
550
            break ;
3941
573
        case FORMAT_AS4_LOC:
3942
573
            wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohl(tvb, offset + 2),
3943
573
                                      tvb_get_ntohs(tvb, offset + 6));
3944
573
            break ;
3945
25.4k
        default:
3946
25.4k
            wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) RD type",rd_type);
3947
25.4k
            break;
3948
28.0k
    } /* switch (rd_type) */
3949
3950
28.0k
    return wmem_strbuf_get_str(strbuf);
3951
28.0k
}
3952
3953
static int
3954
decode_mcast_vpn_nlri_addresses(proto_tree *tree, tvbuff_t *tvb,
3955
                                unsigned offset)
3956
6.40k
{
3957
6.40k
    uint8_t addr_len;
3958
3959
    /* Multicast Source Address */
3960
6.40k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_length, tvb, offset,
3961
6.40k
                        1, ENC_BIG_ENDIAN);
3962
6.40k
    addr_len = tvb_get_uint8(tvb, offset);
3963
6.40k
    if (addr_len != 0 && addr_len != 32 && addr_len != 128)
3964
1.04k
        return -1;
3965
5.35k
    offset++;
3966
5.35k
    switch (addr_len) {
3967
976
        case 32:
3968
976
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv4, tvb,
3969
976
                                offset, 4, ENC_BIG_ENDIAN);
3970
976
            offset += 4;
3971
976
            break;
3972
1.02k
        case 128:
3973
1.02k
             proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv6, tvb,
3974
1.02k
                                 offset, 16, ENC_NA);
3975
1.02k
             offset += 16;
3976
1.02k
             break;
3977
5.35k
    }
3978
3979
    /* Multicast Group Address */
3980
5.33k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_length, tvb, offset,
3981
5.33k
                        1, ENC_BIG_ENDIAN);
3982
5.33k
    addr_len = tvb_get_uint8(tvb, offset);
3983
5.33k
    if (addr_len != 0 && addr_len != 32 && addr_len != 128)
3984
455
        return -1;
3985
4.88k
    offset++;
3986
4.88k
    switch(addr_len) {
3987
239
        case 32:
3988
239
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv4, tvb,
3989
239
                                offset, 4, ENC_BIG_ENDIAN);
3990
239
            offset += 4;
3991
239
            break;
3992
556
        case 128:
3993
556
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv6, tvb,
3994
556
                                offset, 16, ENC_NA);
3995
556
            offset += 16;
3996
556
            break;
3997
4.88k
    }
3998
3999
4.87k
    return offset;
4000
4.88k
}
4001
4002
/*
4003
 * function to decode operator in BGP flow spec NLRI when it address decimal values (TCP ports, UDP ports, ports, ...)
4004
 */
4005
4006
static void
4007
decode_bgp_flow_spec_dec_operator(proto_tree *tree, tvbuff_t *tvb, unsigned offset)
4008
134k
{
4009
134k
    static int * const flags[] = {
4010
134k
        &hf_bgp_flowspec_nlri_op_eol,
4011
134k
        &hf_bgp_flowspec_nlri_op_and,
4012
134k
        &hf_bgp_flowspec_nlri_op_val_len,
4013
134k
        &hf_bgp_flowspec_nlri_op_un_bit4,
4014
134k
        &hf_bgp_flowspec_nlri_op_lt,
4015
134k
        &hf_bgp_flowspec_nlri_op_gt,
4016
134k
        &hf_bgp_flowspec_nlri_op_eq,
4017
134k
        NULL
4018
134k
    };
4019
4020
134k
    proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
4021
134k
}
4022
4023
/*
4024
 * Decode an operator and decimal values of BGP flow spec NLRI
4025
 */
4026
static int
4027
decode_bgp_nlri_op_dec_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4028
4.90k
{
4029
4.90k
    uint8_t nlri_operator;
4030
4.90k
    unsigned cursor_op_val=0;
4031
4.90k
    uint8_t value_len=0;
4032
4.90k
    unsigned value=0;
4033
4.90k
    uint8_t shift_amount=0;
4034
4.90k
    unsigned first_loop=0;
4035
4036
4.90k
    proto_item_append_text(parent_item," (");
4037
4038
134k
    do {
4039
134k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4040
134k
        shift_amount = nlri_operator&0x30;
4041
134k
        shift_amount = shift_amount >> 4;
4042
134k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4043
        /* call to a operator decode function */
4044
134k
        decode_bgp_flow_spec_dec_operator(parent_tree, tvb, offset+cursor_op_val);
4045
134k
        if (first_loop == 0)
4046
4.90k
        {
4047
            /* If first operator we remove a white space and or (||) is not relevant */
4048
            /* BGP flow spec NLRI operator bitmask */
4049
4.90k
            proto_item_append_text(parent_item,"%s%s%s%s",
4050
4.90k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4051
4.90k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4052
4.90k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4053
4.90k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4054
4.90k
            first_loop = 1;
4055
4.90k
        }
4056
129k
        else
4057
129k
        {
4058
129k
            proto_item_append_text(parent_item," %s%s%s%s",
4059
129k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4060
129k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4061
129k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4062
129k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4063
129k
        }
4064
134k
        cursor_op_val++;  /* we manage this operator we move to the value */
4065
134k
        switch (value_len) {
4066
127k
            case 1:
4067
127k
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_8, tvb, offset+cursor_op_val, 1,ENC_BIG_ENDIAN);
4068
127k
                value = tvb_get_uint8(tvb,offset+cursor_op_val);
4069
127k
                break;
4070
2.45k
            case 2:
4071
2.45k
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_16, tvb, offset+cursor_op_val, 2,ENC_BIG_ENDIAN);
4072
2.45k
                value = tvb_get_ntohs(tvb,offset+cursor_op_val);
4073
2.45k
                break;
4074
0
            case 3:
4075
0
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_32, tvb, offset+cursor_op_val, 4, ENC_BIG_ENDIAN);
4076
0
                value = tvb_get_ntohl(tvb,offset+cursor_op_val);
4077
0
                break;
4078
694
            case 4:
4079
694
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_64, tvb, offset+cursor_op_val, 8, ENC_BIG_ENDIAN);
4080
694
                break;
4081
3.04k
            default:
4082
3.04k
                return -1;
4083
134k
        }
4084
130k
        cursor_op_val = cursor_op_val + value_len;
4085
130k
        proto_item_append_text(parent_item,"%u", value);
4086
130k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4087
1.85k
    proto_item_append_text(parent_item,")");
4088
1.85k
    return (cursor_op_val);
4089
4.90k
}
4090
4091
4092
/*
4093
 * function to decode operator in BGP flow spec NLRI when it address a bitmask values (TCP flags, fragmentation flags,...)
4094
 */
4095
4096
static void
4097
decode_bgp_flow_spec_bitmask_operator(proto_tree *tree, tvbuff_t *tvb, unsigned offset)
4098
352k
{
4099
352k
    static int * const flags[] = {
4100
352k
        &hf_bgp_flowspec_nlri_op_eol,
4101
352k
        &hf_bgp_flowspec_nlri_op_and,
4102
352k
        &hf_bgp_flowspec_nlri_op_val_len,
4103
352k
        &hf_bgp_flowspec_nlri_op_un_bit4,
4104
352k
        &hf_bgp_flowspec_nlri_op_un_bit5,
4105
352k
        &hf_bgp_flowspec_nlri_op_flg_not,
4106
352k
        &hf_bgp_flowspec_nlri_op_flg_match,
4107
352k
        NULL
4108
352k
    };
4109
4110
352k
    proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
4111
352k
}
4112
4113
/*
4114
 * Decode an operator and tcp flags bitmask of BGP flow spec NLRI
4115
 */
4116
static int
4117
decode_bgp_nlri_op_tcpf_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4118
1.96k
{
4119
1.96k
    uint8_t nlri_operator;
4120
1.96k
    uint8_t tcp_flags;
4121
1.96k
    unsigned cursor_op_val=0;
4122
1.96k
    uint8_t value_len=0;
4123
1.96k
    uint8_t shift_amount=0;
4124
1.96k
    unsigned first_loop=0;
4125
4126
1.96k
    static int * const nlri_tcp_flags[] = {
4127
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_cwr,
4128
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_ecn,
4129
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_urg,
4130
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_ack,
4131
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_push,
4132
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_reset,
4133
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_syn,
4134
1.96k
        &hf_bgp_flowspec_nlri_tcp_flags_fin,
4135
1.96k
        NULL
4136
1.96k
    };
4137
4138
1.96k
    proto_item_append_text(parent_item," (");
4139
4140
294k
    do {
4141
294k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4142
294k
        shift_amount = nlri_operator&0x30;
4143
294k
        shift_amount = shift_amount >> 4;
4144
294k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4145
294k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val); /* call to a operator decode function */
4146
294k
        if (first_loop == 0)
4147
1.96k
        {
4148
            /* If first operator we remove a white space and or (||) is not relevant */
4149
1.96k
            proto_item_append_text(parent_item,"%s%s%s%s",
4150
1.96k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4151
1.96k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4152
1.96k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4153
1.96k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4154
1.96k
            first_loop = 1;
4155
1.96k
        }
4156
292k
        else
4157
292k
        {
4158
292k
            proto_item_append_text(parent_item," %s%s%s%s",
4159
292k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4160
292k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4161
292k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4162
292k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4163
292k
        }
4164
294k
        cursor_op_val++;  /* we manage this operator we move to the value */
4165
294k
        if (value_len == 2) {
4166
2.80k
            cursor_op_val++; /* tcp flags are coded over 2 bytes only the second one is significant, we move to second byte */
4167
2.80k
        }
4168
4169
294k
        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);
4170
294k
        tcp_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4171
4172
294k
        proto_item_append_text(parent_item," %s%s%s%s%s%s",
4173
294k
             ((tcp_flags & BGPNLRI_FSPEC_TH_URG) == 0) ? "" : "U",
4174
294k
             ((tcp_flags & BGPNLRI_FSPEC_TH_ACK) == 0) ? "" : "A",
4175
294k
             ((tcp_flags & BGPNLRI_FSPEC_TH_PUSH) == 0) ? "" : "P",
4176
294k
             ((tcp_flags & BGPNLRI_FSPEC_TH_RST) == 0) ? "" : "R",
4177
294k
             ((tcp_flags & BGPNLRI_FSPEC_TH_SYN) == 0) ? "" : "S",
4178
294k
             ((tcp_flags & BGPNLRI_FSPEC_TH_FIN) == 0) ? "" : "F");
4179
294k
        cursor_op_val = cursor_op_val + value_len;
4180
294k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4181
1.96k
    proto_item_append_text(parent_item,")");
4182
1.96k
    return (cursor_op_val);
4183
1.96k
}
4184
4185
4186
/*
4187
 * Decode an operator and fragmentation bitmask of BGP flow spec NLRI
4188
 */
4189
static int
4190
decode_bgp_nlri_op_fflag_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4191
1.24k
{
4192
1.24k
    uint8_t nlri_operator;
4193
1.24k
    uint8_t fragment_flags;
4194
1.24k
    unsigned cursor_op_val=0;
4195
1.24k
    uint8_t value_len=0;
4196
1.24k
    uint8_t shift_amount=0;
4197
1.24k
    unsigned first_loop=0;
4198
4199
1.24k
    static int * const nlri_flags[] = {
4200
1.24k
        &hf_bgp_flowspec_nlri_fflag_lf,
4201
1.24k
        &hf_bgp_flowspec_nlri_fflag_ff,
4202
1.24k
        &hf_bgp_flowspec_nlri_fflag_isf,
4203
1.24k
        &hf_bgp_flowspec_nlri_fflag_df,
4204
1.24k
        NULL
4205
1.24k
    };
4206
4207
1.24k
    proto_item_append_text(parent_item," (");
4208
4209
44.6k
    do {
4210
44.6k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4211
44.6k
        shift_amount = nlri_operator&0x30;
4212
44.6k
        shift_amount = shift_amount >> 4;
4213
44.6k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4214
        /* call a function to decode operator addressing bitmask */
4215
44.6k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
4216
44.6k
        if (first_loop == 0)
4217
1.24k
        {
4218
            /* If first operator we remove a white space and or (||) is not relevant */
4219
1.24k
            proto_item_append_text(parent_item,"%s%s%s%s",
4220
1.24k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4221
1.24k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4222
1.24k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4223
1.24k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4224
1.24k
            first_loop = 1;
4225
1.24k
        }
4226
43.3k
        else
4227
43.3k
        {
4228
43.3k
            proto_item_append_text(parent_item," %s%s%s%s",
4229
43.3k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4230
43.3k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4231
43.3k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4232
43.3k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4233
43.3k
        }
4234
44.6k
        cursor_op_val++;  /* we manage this operator we move to the value */
4235
44.6k
        if (value_len != 1) {
4236
774
            return -1; /* frag flags have to be coded in 1 byte */
4237
774
        }
4238
43.8k
        fragment_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4239
4240
43.8k
        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);
4241
4242
43.8k
        proto_item_append_text(parent_item," %s%s%s%s",
4243
43.8k
             ((fragment_flags & BGPNLRI_FSPEC_FG_DF) == 0) ? "" : "DF",
4244
43.8k
             ((fragment_flags & BGPNLRI_FSPEC_FG_ISF) == 0) ? "" : "IsF",
4245
43.8k
             ((fragment_flags & BGPNLRI_FSPEC_FG_FF) == 0) ? "" : "FF",
4246
43.8k
             ((fragment_flags & BGPNLRI_FSPEC_FG_LF) == 0) ? "" : "LF");
4247
43.8k
        cursor_op_val = cursor_op_val + value_len;
4248
43.8k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4249
472
    proto_item_append_text(parent_item,")");
4250
472
    return (cursor_op_val);
4251
1.24k
}
4252
4253
/*
4254
 * Decode an operator and DSCP value of BGP flow spec NLRI
4255
 */
4256
static int
4257
decode_bgp_nlri_op_dscp_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4258
1.23k
{
4259
1.23k
    uint8_t nlri_operator;
4260
1.23k
    uint8_t dscp_flags;
4261
1.23k
    unsigned cursor_op_val=0;
4262
1.23k
    uint8_t value_len=0;
4263
1.23k
    uint8_t shift_amount=0;
4264
1.23k
    unsigned first_loop=0;
4265
4266
1.23k
    proto_item_append_text(parent_item," (");
4267
4268
13.5k
    do {
4269
13.5k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4270
13.5k
        shift_amount = nlri_operator&0x30;
4271
13.5k
        shift_amount = shift_amount >> 4;
4272
13.5k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4273
        /* call a function to decode operator addressing bitmask */
4274
13.5k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
4275
13.5k
        if (first_loop == 0)
4276
1.23k
        {
4277
            /* If first operator we remove a white space and or (||) is not relevant */
4278
1.23k
            proto_item_append_text(parent_item,"%s%s%s%s",
4279
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4280
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4281
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4282
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4283
1.23k
            first_loop = 1;
4284
1.23k
        }
4285
12.3k
        else
4286
12.3k
        {
4287
12.3k
            proto_item_append_text(parent_item," %s%s%s%s",
4288
12.3k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4289
12.3k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4290
12.3k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4291
12.3k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4292
12.3k
        }
4293
13.5k
        cursor_op_val++;  /* we manage this operator we move to the value */
4294
13.5k
        if (value_len != 1) {
4295
552
            return -1; /* frag flags have to be coded in 1 byte */
4296
552
        }
4297
12.9k
        dscp_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4298
12.9k
        proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dscp, tvb, offset+cursor_op_val, 1, ENC_BIG_ENDIAN);
4299
12.9k
        proto_item_append_text(parent_item,"%s",val_to_str_ext_const(dscp_flags,&dscp_vals_ext, "Unknown DSCP"));
4300
12.9k
        cursor_op_val = cursor_op_val + value_len;
4301
12.9k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4302
679
    proto_item_append_text(parent_item,")");
4303
679
    return (cursor_op_val);
4304
1.23k
}
4305
4306
4307
4308
/*
4309
 * Decode an FLOWSPEC nlri as define in RFC 5575
4310
 */
4311
static int
4312
decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, uint16_t afi, uint8_t safi, packet_info *pinfo)
4313
28.2k
{
4314
28.2k
    unsigned  tot_flow_len;       /* total length of the flow spec NLRI */
4315
28.2k
    unsigned  offset_len;         /* offset of the flow spec NLRI itself could be 1 or 2 bytes */
4316
28.2k
    unsigned  cursor_fspec;       /* cursor to move into flow spec nlri */
4317
28.2k
    int       filter_len = -1;
4318
28.2k
    uint16_t  len_16;
4319
28.2k
    uint32_t  rd_type;
4320
28.2k
    proto_item *item;
4321
28.2k
    proto_item *filter_item;
4322
28.2k
    proto_item *disting_item;
4323
28.2k
    proto_tree *nlri_tree;
4324
28.2k
    proto_tree *disting_tree;
4325
28.2k
    proto_tree *filter_tree;
4326
4327
4328
28.2k
    if (afi != AFNUM_IP && afi != AFNUM_IP6)
4329
0
    {
4330
0
        expert_add_info(pinfo, NULL, &ei_bgp_afi_type_not_supported);
4331
0
        return -1;
4332
0
    }
4333
4334
28.2k
    tot_flow_len = tvb_get_uint8(tvb, offset);
4335
    /* if nlri length is greater than 240 bytes, it is encoded over 2 bytes */
4336
    /* with most significant nibble all in one. 240 is encoded 0xf0f0, 241 0xf0f1 */
4337
    /* max possible value value is 4095 Oxffff */
4338
4339
28.2k
    if (tot_flow_len >= 240)
4340
266
    {
4341
266
        len_16 = tvb_get_ntohs(tvb, offset);
4342
266
        tot_flow_len = len_16 & 0x0FFF; /* remove most significant nibble */
4343
266
        offset_len = 2;
4344
27.9k
    } else {
4345
27.9k
        offset_len = 1;
4346
27.9k
    }
4347
4348
28.2k
    item = proto_tree_add_item(tree, hf_bgp_flowspec_nlri_t, tvb, offset,
4349
28.2k
                               tot_flow_len+offset_len, ENC_NA);
4350
28.2k
    proto_item_set_text(item, "FLOW_SPEC_NLRI (%u byte%s)",
4351
28.2k
                        tot_flow_len+offset_len, plurality(tot_flow_len+offset_len, "", "s"));
4352
4353
28.2k
    nlri_tree = proto_item_add_subtree(item, ett_bgp_flow_spec_nlri);
4354
4355
28.2k
    proto_tree_add_uint(nlri_tree, hf_bgp_flowspec_nlri_length, tvb, offset,
4356
28.2k
                        offset_len, tot_flow_len);
4357
4358
28.2k
    offset = offset + offset_len;
4359
28.2k
    cursor_fspec = 0;
4360
4361
    /* when SAFI is VPN Flow Spec, then write route distinguisher */
4362
28.2k
    if (safi == SAFNUM_FSPEC_VPN_RULE)
4363
18.0k
    {
4364
18.0k
        disting_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_route_distinguisher,
4365
18.0k
                                           tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4366
18.0k
        disting_tree = proto_item_add_subtree(disting_item, ett_bgp_flow_spec_nlri);
4367
18.0k
        proto_tree_add_item_ret_uint(disting_tree, hf_bgp_flowspec_nlri_route_distinguisher_type,
4368
18.0k
                                     tvb, offset, 2, ENC_BIG_ENDIAN, &rd_type);
4369
        /* Route Distinguisher Type */
4370
18.0k
        switch (rd_type) {
4371
1.75k
        case FORMAT_AS2_LOC:
4372
1.75k
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
4373
1.75k
                                tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4374
1.75k
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_4,
4375
1.75k
                                tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4376
1.75k
            break;
4377
4378
3.34k
        case FORMAT_IP_LOC:
4379
3.34k
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
4380
3.34k
                                tvb, offset + 2, 4, ENC_BIG_ENDIAN);
4381
3.34k
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
4382
3.34k
                                tvb, offset + 6, 2, ENC_BIG_ENDIAN);
4383
3.34k
            break;
4384
4385
367
        case FORMAT_AS4_LOC:
4386
367
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
4387
367
                                tvb, offset + 2, 4, ENC_BIG_ENDIAN);
4388
367
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
4389
367
                                tvb, offset + 6, 2, ENC_BIG_ENDIAN);
4390
367
            break;
4391
4392
12.5k
        default:
4393
12.5k
            expert_add_info_format(pinfo, disting_tree, &ei_bgp_length_invalid,
4394
12.5k
                                   "Unknown Route Distinguisher type (%u)", rd_type);
4395
18.0k
        }
4396
17.9k
        cursor_fspec += BGP_ROUTE_DISTINGUISHER_SIZE;
4397
17.9k
    }
4398
4399
34.7k
    while (cursor_fspec < tot_flow_len)
4400
14.3k
    {
4401
14.3k
        filter_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_filter, tvb, offset+cursor_fspec, 1, ENC_NA);
4402
14.3k
        filter_tree = proto_item_add_subtree(filter_item, ett_bgp_flow_spec_nlri_filter);
4403
14.3k
        proto_tree_add_item(filter_tree, hf_bgp_flowspec_nlri_filter_type, tvb, offset+cursor_fspec, 1, ENC_BIG_ENDIAN);
4404
14.3k
        proto_item_append_text(filter_item, ": %s", val_to_str(pinfo->pool, tvb_get_uint8(tvb,offset+cursor_fspec), flowspec_nlri_opvaluepair_type, "Unknown filter %d"));
4405
14.3k
        switch (tvb_get_uint8(tvb,offset+cursor_fspec)) {
4406
2.51k
        case BGPNLRI_FSPEC_DST_PFIX:
4407
2.51k
            cursor_fspec++;
4408
2.51k
            if (afi == AFNUM_IP)
4409
1.80k
                filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_dst_pref_ipv4,
4410
1.80k
                                            tvb, offset+cursor_fspec, "Destination IP filter");
4411
718
            else /* AFNUM_IP6 */
4412
718
                filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_dst_ipv6_pref,
4413
718
                                                        tvb, offset+cursor_fspec, 0, pinfo);
4414
2.51k
            if (filter_len == -1)
4415
1.21k
                cursor_fspec= tot_flow_len;
4416
2.51k
            break;
4417
736
        case BGPNLRI_FSPEC_SRC_PFIX:
4418
736
            cursor_fspec++;
4419
736
            if (afi == AFNUM_IP)
4420
391
                filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_src_pref_ipv4,
4421
391
                                            tvb, offset+cursor_fspec, "Source IP filter");
4422
345
            else /* AFNUM_IP6 */
4423
345
                filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_src_ipv6_pref,
4424
345
                                                        tvb, offset+cursor_fspec, 0, pinfo);
4425
736
            if (filter_len == -1)
4426
311
              cursor_fspec= tot_flow_len;
4427
736
            break;
4428
261
        case BGPNLRI_FSPEC_IP_PROTO:
4429
261
            cursor_fspec++;
4430
261
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4431
261
            break;
4432
423
        case BGPNLRI_FSPEC_PORT:
4433
423
            cursor_fspec++;
4434
423
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4435
423
            break;
4436
284
        case BGPNLRI_FSPEC_DST_PORT:
4437
284
            cursor_fspec++;
4438
284
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4439
284
            break;
4440
3.00k
        case BGPNLRI_FSPEC_SRC_PORT:
4441
3.00k
            cursor_fspec++;
4442
3.00k
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4443
3.00k
            break;
4444
452
        case BGPNLRI_FSPEC_ICMP_TP:
4445
452
            cursor_fspec++;
4446
452
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4447
452
            break;
4448
215
        case BGPNLRI_FSPEC_ICMP_CD:
4449
215
            cursor_fspec++;
4450
215
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4451
215
            break;
4452
1.96k
        case BGPNLRI_FSPEC_TCP_FLAGS:
4453
1.96k
            cursor_fspec++;
4454
1.96k
            filter_len = decode_bgp_nlri_op_tcpf_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4455
1.96k
            break;
4456
267
        case BGPNLRI_FSPEC_PCK_LEN:
4457
267
            cursor_fspec++;
4458
267
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4459
267
            break;
4460
1.23k
        case BGPNLRI_FSPEC_DSCP:
4461
1.23k
            cursor_fspec++;
4462
1.23k
            filter_len = decode_bgp_nlri_op_dscp_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4463
1.23k
            break;
4464
1.24k
        case BGPNLRI_FSPEC_FRAGMENT:
4465
1.24k
            cursor_fspec++;
4466
1.24k
            filter_len = decode_bgp_nlri_op_fflag_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4467
1.24k
            break;
4468
1.77k
        default:
4469
1.77k
            return -1;
4470
14.3k
      }
4471
12.4k
      if (filter_len>0)
4472
6.57k
          cursor_fspec += filter_len;
4473
5.88k
      else
4474
5.88k
          break;
4475
6.57k
      proto_item_set_len(filter_item,filter_len+1);
4476
6.57k
    }
4477
26.2k
    return tot_flow_len+offset_len-1;
4478
28.1k
}
4479
4480
/*
4481
 * Decode an MCAST-VPN nlri as defined in draft-ietf-l3vpn-2547bis-mcast-bgp-08.txt .
4482
 */
4483
static int
4484
decode_mcast_vpn_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, uint16_t afi, packet_info *pinfo)
4485
10.4k
{
4486
10.4k
    uint8_t route_type, length, ip_length;
4487
10.4k
    proto_item *item;
4488
10.4k
    proto_tree *nlri_tree;
4489
10.4k
    uint32_t route_key_length;
4490
10.4k
    int ret;
4491
4492
10.4k
    ip_length = (afi == AFNUM_IP) ? 4 : 16;
4493
4494
10.4k
    route_type = tvb_get_uint8(tvb, offset);
4495
10.4k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_route_type, tvb,
4496
10.4k
                               offset, 1, ENC_BIG_ENDIAN);
4497
10.4k
    offset++;
4498
4499
10.4k
    length = tvb_get_uint8(tvb, offset);
4500
10.4k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_length, tvb, offset,
4501
10.4k
                               1, ENC_BIG_ENDIAN);
4502
10.4k
    offset++;
4503
4504
10.4k
    if (length > tvb_reported_length_remaining(tvb, offset))
4505
99
        return -1;
4506
4507
    // XXX - Should call tvb_new_subset_length(tvb, offset, length) here
4508
4509
10.3k
    item = proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_t, tvb, offset,
4510
10.3k
                               length, ENC_NA);
4511
10.3k
    proto_item_set_text(item, "%s (%u byte%s)",
4512
10.3k
                        val_to_str_const(route_type, mcast_vpn_route_type, "Unknown"),
4513
10.3k
                        length, plurality(length, "", "s"));
4514
4515
10.3k
    nlri_tree = proto_item_add_subtree(item, ett_bgp_mcast_vpn_nlri);
4516
4517
10.3k
    switch (route_type) {
4518
1.99k
        case MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD:
4519
1.99k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4520
1.99k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4521
1.99k
                                       ENC_NA);
4522
1.99k
            proto_item_set_text(item, "Route Distinguisher: %s",
4523
1.99k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4524
1.99k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4525
4526
1.99k
            if (afi == AFNUM_IP)
4527
1.40k
                proto_tree_add_item(nlri_tree,
4528
1.40k
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4529
1.40k
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4530
587
            else
4531
587
                proto_tree_add_item(nlri_tree,
4532
587
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4533
587
                                           tvb, offset, ip_length, ENC_NA);
4534
1.99k
            break;
4535
4536
547
        case MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD:
4537
547
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4538
547
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4539
547
                                       ENC_NA);
4540
547
            proto_item_set_text(item, "Route Distinguisher: %s",
4541
547
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4542
547
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4543
4544
547
            proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
4545
547
                                offset, 4, ENC_BIG_ENDIAN);
4546
547
            break;
4547
4548
1.08k
        case MCAST_VPN_RTYPE_SPMSI_AD:
4549
1.08k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4550
1.08k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4551
1.08k
                                       ENC_NA);
4552
1.08k
            proto_item_set_text(item, "Route Distinguisher: %s",
4553
1.08k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4554
1.08k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4555
4556
1.08k
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4557
1.08k
            if (ret < 0)
4558
179
                return -1;
4559
4560
907
            offset = ret;
4561
4562
907
            if (afi == AFNUM_IP)
4563
569
                proto_tree_add_item(nlri_tree,
4564
569
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4565
569
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4566
338
            else
4567
338
                proto_tree_add_item(nlri_tree,
4568
338
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4569
338
                                           tvb, offset, ip_length, ENC_NA);
4570
907
            break;
4571
4572
434
        case MCAST_VPN_RTYPE_LEAF_AD:
4573
434
            if (ckd_sub(&route_key_length, length, ip_length)) {
4574
36
                THROW(ReportedBoundsError);
4575
36
            }
4576
434
            item = proto_tree_add_item(nlri_tree,
4577
434
                                       hf_bgp_mcast_vpn_nlri_route_key, tvb,
4578
434
                                       offset, route_key_length, ENC_NA);
4579
434
            proto_item_set_text(item, "Route Key (%u byte%s)", route_key_length,
4580
434
                                plurality(route_key_length, "", "s"));
4581
434
            offset += route_key_length;
4582
4583
434
            if (afi == AFNUM_IP)
4584
202
                proto_tree_add_item(nlri_tree,
4585
202
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4586
202
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4587
232
            else
4588
232
                proto_tree_add_item(nlri_tree,
4589
232
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4590
232
                                           tvb, offset, ip_length, ENC_NA);
4591
434
            break;
4592
4593
701
        case MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD:
4594
701
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4595
701
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4596
701
                                       ENC_NA);
4597
701
            proto_item_set_text(item, "Route Distinguisher: %s",
4598
701
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4599
701
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4600
4601
701
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4602
701
            if (ret < 0)
4603
302
                return -1;
4604
399
            break;
4605
4606
399
        case MCAST_VPN_RTYPE_SHARED_TREE_JOIN:
4607
1.29k
        case MCAST_VPN_RTYPE_SOURCE_TREE_JOIN:
4608
1.29k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4609
1.29k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4610
1.29k
                                       ENC_NA);
4611
1.29k
            proto_item_set_text(item, "Route Distinguisher: %s",
4612
1.29k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4613
1.29k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4614
4615
1.29k
            proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
4616
1.29k
                                offset, 4, ENC_BIG_ENDIAN);
4617
1.29k
            offset += 4;
4618
4619
1.29k
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4620
1.29k
            if (ret < 0)
4621
225
                return -1;
4622
1.07k
            break;
4623
10.3k
    }
4624
4625
    /* route type field (1 byte) + length field (1 byte) + length */
4626
9.43k
    return 2 + length;
4627
10.3k
}
4628
4629
/*
4630
 * Decode an SR Policy SAFI as defined in draft-ietf-idr-segment-routing-te-policy-08
4631
 */
4632
static int
4633
decode_sr_policy_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, uint16_t afi)
4634
265
{
4635
265
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_length, tvb, offset, 1, ENC_BIG_ENDIAN);
4636
265
   offset += 1;
4637
265
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_distinguisher, tvb, offset, 4, ENC_BIG_ENDIAN);
4638
265
   offset += 4;
4639
265
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_policy_color, tvb, offset, 4, ENC_BIG_ENDIAN);
4640
265
   offset += 4;
4641
265
   if (afi == AFNUM_IP) {
4642
125
       proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
4643
125
       return 13;
4644
140
   } else {
4645
140
       proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v6, tvb, offset, 16, ENC_NA);
4646
140
       return 25;
4647
140
   }
4648
265
}
4649
4650
/*
4651
 * Decodes an MDT-SAFI message.
4652
 */
4653
static unsigned
4654
decode_mdt_safi(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, unsigned offset)
4655
653
{
4656
653
    const unsigned ip_length = 4;
4657
653
    const unsigned mdt_safi_nlri_length_bits = 128;
4658
653
    unsigned length; /* length in bits */
4659
653
    int   orig_offset = offset;
4660
653
    proto_item *item;
4661
4662
653
    length = tvb_get_uint8(tvb, offset);
4663
653
    if (length != mdt_safi_nlri_length_bits)
4664
290
        return -1;
4665
363
    offset++;
4666
4667
363
    item = proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_rd, tvb,
4668
363
                               offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4669
363
    proto_item_set_text(item, "Route Distinguisher: %s",
4670
363
                        decode_bgp_rd(pinfo->pool, tvb, offset));
4671
363
    offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4672
4673
363
    proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_ipv4_addr, tvb,
4674
363
                        offset, ip_length, ENC_BIG_ENDIAN);
4675
363
    offset += ip_length;
4676
4677
363
    proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_group_addr, tvb,
4678
363
                        offset, ip_length, ENC_BIG_ENDIAN);
4679
363
    offset += ip_length;
4680
4681
363
    return offset - orig_offset;
4682
653
}
4683
4684
/*
4685
 * Decode an MPLS label stack
4686
 * XXX - We should change *buf to **buf, use wmem_alloc() and drop the buflen
4687
 * argument.
4688
 */
4689
static unsigned
4690
decode_MPLS_stack(tvbuff_t *tvb, unsigned offset, wmem_strbuf_t *stack_strbuf)
4691
6.21k
{
4692
6.21k
    uint32_t    label_entry;    /* an MPLS label entry (label + COS field + stack bit   */
4693
6.21k
    unsigned    indx;          /* index for the label stack */
4694
4695
6.21k
    indx = offset ;
4696
6.21k
    label_entry = 0x000000 ;
4697
4698
6.21k
    wmem_strbuf_truncate(stack_strbuf, 0);
4699
4700
42.3k
    while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4701
4702
36.9k
        label_entry = tvb_get_ntoh24(tvb, indx) ;
4703
4704
        /* withdrawn routes may contain 0 or 0x800000 in the first label */
4705
36.9k
        if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4706
800
            wmem_strbuf_append(stack_strbuf, "0 (withdrawn)");
4707
800
            return 1;
4708
800
        }
4709
4710
36.1k
        wmem_strbuf_append_printf(stack_strbuf, "%u%s", label_entry >> 4,
4711
36.1k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4712
4713
36.1k
        indx += 3 ;
4714
36.1k
    }
4715
4716
5.41k
    return (indx - offset) / 3;
4717
6.21k
}
4718
4719
static unsigned
4720
decode_MPLS_stack_tree(tvbuff_t *tvb, unsigned offset, proto_tree *parent_tree)
4721
1.73k
{
4722
1.73k
    uint32_t    label_entry=0;    /* an MPLS label entry (label + COS field + stack bit)   */
4723
1.73k
    unsigned    indx;          /* index for the label stack */
4724
1.73k
    proto_tree  *labels_tree=NULL;
4725
1.73k
    proto_item  *labels_item=NULL;
4726
1.73k
    proto_item  *label_item=NULL;
4727
1.73k
    indx = offset ;
4728
1.73k
    label_entry = 0x000000 ;
4729
4730
1.73k
    labels_item = proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label, tvb, offset, 3, ENC_NA);
4731
1.73k
    proto_item_append_text(labels_item, ": ");
4732
1.73k
    labels_tree = proto_item_add_subtree(labels_item, ett_bgp_mpls_labels);
4733
2.07k
    while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4734
4735
1.69k
        label_entry = tvb_get_ntoh24(tvb, indx);
4736
1.69k
        label_item = proto_tree_add_item(labels_tree, hf_bgp_update_mpls_label_value, tvb, indx, 3, ENC_BIG_ENDIAN);
4737
        /* withdrawn routes may contain 0 or 0x800000 in the first label */
4738
1.69k
        if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4739
273
            proto_item_append_text(labels_item, " (withdrawn)");
4740
273
            proto_item_append_text(label_item, " (withdrawn)");
4741
273
            return 1;
4742
273
        }
4743
4744
1.42k
        proto_item_append_text(labels_item, "%u%s", label_entry >> 4,
4745
1.42k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4746
1.42k
        proto_item_append_text(label_item, "%u%s", label_entry >> 4,
4747
1.42k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4748
1.42k
        indx += 3 ;
4749
4750
1.42k
        if ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4751
            /* real MPLS multi-label stack in BGP? - maybe later; for now, it must be a bogus packet */
4752
1.07k
            proto_item_append_text(labels_item, " (BOGUS: Bottom of Stack NOT set!)");
4753
1.07k
            break;
4754
1.07k
        }
4755
1.42k
    }
4756
1.46k
    proto_item_set_len(labels_item, (indx - offset));
4757
1.46k
    return (indx - offset) / 3;
4758
1.73k
}
4759
4760
/*
4761
 * Decode a multiprotocol next hop address that expected to be IPv4.
4762
 * Returns 0 on failure (invalid length).
4763
 */
4764
static int
4765
decode_mp_next_hop_ipv4(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo _U_, wmem_strbuf_t *strbuf, int nhlen)
4766
2.65k
{
4767
2.65k
    switch (nhlen) {
4768
465
        case (FT_IPv4_LEN):
4769
465
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4770
465
            wmem_strbuf_append(strbuf, tvb_ip_to_str(pinfo->pool, tvb, offset));
4771
465
            break;
4772
2.18k
        default:
4773
2.18k
            return 0;
4774
2.65k
    }
4775
465
    return nhlen;
4776
2.65k
}
4777
4778
/*
4779
 * Decode a multiprotocol next hop address expected to be VPN-IPv4.
4780
 * Note that the Route Distinguisher is always 0. Returns 0 on failure
4781
 * (invalid length).
4782
 */
4783
static int
4784
decode_mp_next_hop_vpn_ipv4(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4785
1.90k
{
4786
1.90k
    proto_item    *ti;
4787
1.90k
    const char    *rd_string;
4788
4789
1.90k
    switch (nhlen) {
4790
191
        case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv4_LEN):
4791
191
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4792
191
            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);
4793
191
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4794
122
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4795
122
            }
4796
191
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4797
191
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4798
191
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4799
191
            wmem_strbuf_append_printf(strbuf, " IPv4=%s", tvb_ip_to_str(pinfo->pool, tvb, offset));
4800
191
            break;
4801
1.71k
        default:
4802
1.71k
            return 0;
4803
1.90k
    }
4804
191
    return nhlen;
4805
1.90k
}
4806
4807
/*
4808
 * Decode a multiprotocol next hop address that is expected to be IPv6,
4809
 * optionally including a second, link-local, address, differentiating by
4810
 * length. Returns 0 on failure (invalid length).
4811
 */
4812
static int
4813
decode_mp_next_hop_ipv6(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4814
4.25k
{
4815
4.25k
    proto_item    *ti;
4816
4.25k
    ws_in6_addr    ipv6_addr;
4817
4.25k
    char           ipv6_buffer[WS_INET6_ADDRSTRLEN];
4818
4819
4.25k
    switch (nhlen) {
4820
211
        case (FT_IPv6_LEN):
4821
211
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4822
211
            wmem_strbuf_append(strbuf, tvb_ip6_to_str(pinfo->pool, tvb, offset));
4823
211
            break;
4824
216
        case (2*FT_IPv6_LEN):
4825
            /* global address followed by link-local */
4826
216
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4827
216
            wmem_strbuf_append_printf(strbuf, "IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4828
216
            offset += FT_IPv6_LEN;
4829
216
            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);
4830
216
            tvb_get_ipv6(tvb, offset, &ipv6_addr);
4831
216
            if (!in6_addr_is_linklocal(&ipv6_addr)) {
4832
146
                expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4833
146
            }
4834
216
            ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4835
216
            wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4836
216
            break;
4837
3.82k
        default:
4838
3.82k
            return 0;
4839
4.25k
    }
4840
427
    return nhlen;
4841
4.25k
}
4842
4843
/*
4844
 * Decode a multiprotocol next hop address that is expected to be VPN-IPv6,
4845
 * optionally including a second, link-local, address. Note that the Route
4846
 * Distinguisher is always 0. Returns 0 on failure (invalid length).
4847
 */
4848
static int
4849
decode_mp_next_hop_vpn_ipv6(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4850
2.20k
{
4851
2.20k
    proto_item    *ti;
4852
2.20k
    const char    *rd_string;
4853
2.20k
    ws_in6_addr    ipv6_addr;
4854
2.20k
    char           ipv6_buffer[WS_INET6_ADDRSTRLEN];
4855
4856
2.20k
    switch (nhlen) {
4857
132
        case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN):
4858
132
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4859
132
            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);
4860
132
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4861
66
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4862
66
            }
4863
132
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4864
132
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4865
132
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4866
132
            wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4867
132
            break;
4868
347
        case (2*(BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN)):
4869
347
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4870
347
            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);
4871
347
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4872
264
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4873
264
            }
4874
347
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4875
347
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4876
347
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4877
347
            wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4878
347
            offset += FT_IPv6_LEN;
4879
347
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4880
347
            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);
4881
347
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4882
276
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4883
276
            }
4884
347
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4885
347
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4886
347
            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);
4887
347
            tvb_get_ipv6(tvb, offset, &ipv6_addr);
4888
347
            if (!in6_addr_is_linklocal(&ipv6_addr)) {
4889
311
                expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4890
311
            }
4891
347
            ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4892
347
            wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4893
347
            break;
4894
1.72k
        default:
4895
1.72k
            return 0;
4896
2.20k
    }
4897
479
    return nhlen;
4898
2.20k
}
4899
4900
/*
4901
 * Decode a multiprotocol next hop address
4902
 */
4903
static int
4904
decode_mp_next_hop(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint16_t afi, uint8_t safi, int nhlen)
4905
10.9k
{
4906
10.9k
    proto_item    *ti;
4907
10.9k
    proto_tree    *next_hop_t;
4908
10.9k
    int            length, offset = 0;
4909
10.9k
    wmem_strbuf_t *strbuf;
4910
4911
10.9k
    strbuf = wmem_strbuf_create(pinfo->pool);
4912
4913
    /* BGP Multiprotocol Next Hop Principles
4914
     *
4915
     * BGP Multiprotocol support is specified over a large variety of
4916
     * RFCs for different <AFI, SAFI> pairs, which leaves some theoretical
4917
     * pairings undefined (e.g., the Abstract of RFC 4760 contemplates
4918
     * supporting the IPX address family) as well as leading to some
4919
     * omissions, contradictions, and inconsistencies. However, some general
4920
     * principles that apply across (nearly) all extant pairs exist.
4921
     *
4922
     * 1. Global IPv6 addresses can be followed by a link-local IPv6 address
4923
     *
4924
     * RFC 2545 specifies in section 3, "Constructing the Next Hop field,"
4925
     * that when the next hop address type is IPv6, the address given should
4926
     * be in global (or site-local) unicast address scope, and it shall be
4927
     * followed by the link-local address if and only if the BGP speaker shares
4928
     * a common subnet with the address and the peer the route is being
4929
     * advertised to.
4930
     *
4931
     * The wording implies that this holds for any <AFI, SAFI> pair where
4932
     * a IPv6 address is used, and RFCs 5549, 7752, and 8950 demonstrate that
4933
     * this explicitly holds for the most common ones, including for VPN-IPv6
4934
     * addresses (where the route distinguisher field also appears, see
4935
     * RFC 4659). Sometimes the possibility is elided where it is known to
4936
     * exist e.g. RFC 7606 7.11 MP_REACH_NLRI "For example, if RFC5549 is in
4937
     * use, then the next hop would have to have a length of 4 or 16." Thus
4938
     * it is possible that its omission in other RFCs covering new <AFI, SAFI>
4939
     * pairs is an oversight.
4940
     *
4941
     * 2. [VPN-]IPv4 NLRI can have [VPN-]IPv6 Next Hop addresses
4942
     *
4943
     * RFCs 5549 and 8950 declare that the next hop address may not necessarily
4944
     * belong to the address family specified by the AFI, updating RFC 2858,
4945
     * specifically addressing the case of IPv6 islands across a IPv4 core
4946
     * and vice versa.
4947
     *
4948
     * IPv4 addresses can easily be mapped into IPv6 addresses, and that
4949
     * is the solution for one case, but in the other the Next Hop must be an
4950
     * IPv6 (or VPN-IPv6) address even though the NLRI is IPv4.
4951
     *
4952
     * The wording of RFC 8950 strongly implies that the intent is to allow
4953
     * IPv6 Net Hop addresses for any case of IPv4 or VPN-IPv4 NLRI, providing
4954
     * a BGP Capability to declare that the BGP speakers supports a different
4955
     * Next Hop AFI for <AFI, SAFI> pairs defined without this capability,
4956
     * and noting those (like <1, 132>, SAFNUM_ROUTE_TARGET, RFC 4684) that
4957
     * consider the possibility from the start.
4958
     *
4959
     * 3. Next Hop Route Distinguisher (RD) is 0 or omitted
4960
     *
4961
     * RDs do not have a meaning in the Next Hop network address. However, when
4962
     * RFC 2547 introduced the VPN-IPv4 address family, at that point the Next
4963
     * Hop address family had to be the same as the NLRI address family, so the
4964
     * RD was set to all 0. Later defined <AFI, SAFI> pairs with RDs in their
4965
     * NLRI have either used this custom of a 0 RD, or else omitted it and
4966
     * only had the IP address in the Next Hop.
4967
     */
4968
4969
10.9k
    ti = proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop, tvb, offset, nhlen + 1, ENC_NA);
4970
10.9k
    next_hop_t = proto_item_add_subtree(ti, ett_bgp_mp_nhna);
4971
10.9k
    offset += 1;
4972
4973
10.9k
    switch (afi) {
4974
4.58k
        case AFNUM_IP:
4975
4.58k
            switch (safi) {
4976
151
                case SAFNUM_UNICAST:       /* RFC 8950 */
4977
451
                case SAFNUM_MULCAST:       /* RFC 8950 */
4978
530
                case SAFNUM_UNIMULC:       /* Deprecated, but as above */
4979
738
                case SAFNUM_MPLS_LABEL:    /* RFC 8277 */
4980
1.11k
                case SAFNUM_MCAST_VPN:     /* RFC 6514 */
4981
1.19k
                case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used"
4982
                                            * according to
4983
                                            * draft-ietf-idr-tunnel-encaps-22
4984
                                            */
4985
1.33k
                case SAFNUM_ROUTE_TARGET:  /* RFC 4684 */
4986
1.68k
                case SAFNUM_BGP_MUP:       /* draft-mpmz-bess-mup-safi-00 */
4987
1.75k
                case SAFNUM_SR_POLICY:     /* RFC 9830 */
4988
                    /* IPv4 or IPv6, differentiated by field length, according
4989
                     * to the RFCs cited above. RFC 8950 explicitly addresses
4990
                     * the possible link-local IPv6 address. RFC 6514 depending
4991
                     * on the situation either the Next Hop MUST be the same
4992
                     * as in the IP Address field lower in the network stack,
4993
                     * or simply SHOULD be "a routeable address" of the ASBR/
4994
                     * local PE. */
4995
1.75k
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4996
1.49k
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4997
1.49k
                    }
4998
1.75k
                    break;
4999
261
                case SAFNUM_TUNNEL:
5000
                    /* Internet Draft draft-nalawade-kapoor-tunnel-safi-05
5001
                     * long expired, but "[NLRI] network address... SHOULD be
5002
                     * the same as the [Next Hop] network address."
5003
                     */
5004
261
                    length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5005
261
                    break;
5006
393
                case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
5007
527
                case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
5008
794
                case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
5009
                    /* RFC 8950 indicates that the next hop can be VPN-IPv4 or
5010
                     * VPN-IPv6 (with RD all 0), and in the latter case the
5011
                     * link-local IPv6 address can be included. Note that RFC
5012
                     * 5549 incorrectly did not include the RD in the Next Hop
5013
                     * for VPN-IPv6 (see Erratum ID 5253), but according to
5014
                     * RFC 8950 2. "Changes Compared to RFC 5549":
5015
                     * "As all known and deployed implementations are
5016
                     * interoperable today and use the new proposed encoding,
5017
                     * the change does not break existing interoperability,"
5018
                     * and thus we need not test for a missing RD.
5019
                     */
5020
794
                    if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5021
637
                        length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5022
637
                    }
5023
794
                    break;
5024
627
                case SAFNUM_FSPEC_RULE:
5025
1.22k
                case SAFNUM_FSPEC_VPN_RULE:
5026
1.22k
                    length = 0;
5027
                    /* When advertising Flow Specifications, the Length of the
5028
                     * Next-Hop Address MUST be set 0. The Network Address of
5029
                     * the Next-Hop field MUST be ignored.
5030
                     */
5031
1.22k
                    if (nhlen != 0) {
5032
1.04k
                        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid,
5033
1.04k
                                               "The length (%d) of Next Hop (FlowSpec) is not zero", nhlen);
5034
1.04k
                        break;
5035
1.04k
                    }
5036
185
                    length++;
5037
185
                    break;
5038
544
                default:
5039
544
                    length = 0;
5040
544
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5041
544
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5042
544
                    break;
5043
4.58k
            } /* switch (safi) */
5044
4.58k
            break;
5045
4.58k
        case AFNUM_IP6:
5046
3.60k
            switch (safi) {
5047
208
                case SAFNUM_UNICAST:       /* RFC 8950 */
5048
317
                case SAFNUM_MULCAST:       /* RFC 8950 */
5049
426
                case SAFNUM_UNIMULC:       /* Deprecated, but as above */
5050
810
                case SAFNUM_MPLS_LABEL:    /* RFC 8277 */
5051
1.14k
                case SAFNUM_MCAST_VPN:     /* RFC 6514 */
5052
1.35k
                case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used" */
5053
1.61k
                case SAFNUM_TUNNEL:        /* Expired Internet Draft */
5054
2.25k
                case SAFNUM_BGP_MUP:       /* draft-mpmz-bess-mup-safi-00 */
5055
                    /* IPv6 address, possibly followed by link-local address */
5056
2.25k
                    length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5057
2.25k
                    break;
5058
35
                case SAFNUM_SR_POLICY:     /* RFC 9830 */
5059
                    /* IPv4 address or IPv6 address (optionally with link-local) */
5060
35
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5061
34
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5062
34
                    }
5063
35
                    break;
5064
251
                case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
5065
367
                case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
5066
492
                case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
5067
                    /* VPN-IPv6 address, possibly followed by link-local addr */
5068
492
                    length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5069
492
                    break;
5070
167
                case SAFNUM_FSPEC_RULE:
5071
568
                case SAFNUM_FSPEC_VPN_RULE:
5072
568
                    length = 0;
5073
                    /* When advertising Flow Specifications, the Length of the
5074
                     * Next-Hop Address MUST be set 0. The Network Address of
5075
                     * the Next-Hop field MUST be ignored.
5076
                     */
5077
568
                    if (nhlen != 0) {
5078
220
                        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid,
5079
220
                                               "The length (%d) of Next Hop (FlowSpec) is not zero", nhlen);
5080
220
                        break;
5081
220
                    }
5082
348
                    length++;
5083
348
                    break;
5084
259
                default:
5085
259
                    length = 0;
5086
259
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5087
259
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5088
259
                    break;
5089
3.60k
            } /* switch (safi) */
5090
3.60k
            break;
5091
3.60k
        case AFNUM_AFI_FOR_L2VPN_INFORMATION:
5092
769
        case AFNUM_AFI_FOR_L2VPN_INFORMATION_OLD:
5093
769
            switch (safi) {
5094
                /* XXX: Do these first three really appear with L2VPN AFI? */
5095
75
                case SAFNUM_LAB_VPNUNICAST:
5096
166
                case SAFNUM_LAB_VPNMULCAST:
5097
236
                case SAFNUM_LAB_VPNUNIMULC:
5098
337
                case SAFNUM_VPLS: /* RFC 4761 (VPLS) and RFC 6074 (BGP-AD) */
5099
459
                case SAFNUM_EVPN: /* RFC 7432 */
5100
                    /* The RFCs above specify that the next-hop is simply the
5101
                     * address of the PE (loopback address in some cases for
5102
                     * BGP-AD), either IPv4 or IPv6, differentiated by length.
5103
                     * A RD is included in the NLRI in these cases, but not in
5104
                     * the Next Hop address unlike in AFI 1 or 2.
5105
                     */
5106
459
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5107
391
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5108
391
                    }
5109
459
                    break;
5110
310
                default:
5111
310
                    length = 0;
5112
310
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5113
310
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5114
310
                    break;
5115
769
            } /* switch (safi) */
5116
769
            break;
5117
1.45k
        case AFNUM_BGP_LS:
5118
            /* RFC 7752 section 3.4 "BGP Next-Hop Information" explains that
5119
             * the next-hop address length field specifies the next-hop address
5120
             * family. "If the next-hop length is 4, then the next hop is an
5121
             * IPv4 address; if the next-hop length is 16, then it is a global
5122
             * IPv6 address; and if the next-hop length is 32, then there is
5123
             * one global IPv6 address followed by a link-local IPv6 address"
5124
             */
5125
1.45k
            switch (safi) {
5126
143
                case SAFNUM_BGP_LS:
5127
143
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5128
77
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5129
77
                    }
5130
143
                    break;
5131
1.10k
                case SAFNUM_BGP_LS_VPN:
5132
                    /* RFC 7752 3.4: "For VPN SAFI, as per custom, an 8-byte
5133
                     * Route Distinguisher set to all zero is prepended to the
5134
                     * next hop."
5135
                     */
5136
1.10k
                    if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5137
1.07k
                        length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5138
1.07k
                    }
5139
1.10k
                    break;
5140
206
                default:
5141
206
                    length = 0;
5142
206
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5143
206
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5144
206
                    break;
5145
1.45k
            } /* switch (safi) */
5146
1.45k
            break;
5147
1.45k
        default:
5148
429
            length = 0;
5149
429
            expert_add_info(pinfo, ti, &ei_bgp_unknown_afi);
5150
429
            break;
5151
10.9k
    } /* switch (af) */
5152
5153
10.8k
    if (length) {
5154
2.09k
        proto_item_append_text(ti, ": %s", wmem_strbuf_get_str(strbuf));
5155
8.75k
    } else {
5156
8.75k
        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid, "Unknown Next Hop length (%u byte%s)", nhlen, plurality(nhlen, "", "s"));
5157
8.75k
        if (nhlen > 0) {
5158
5.28k
            proto_item_append_text(ti, ": %s", tvb_bytes_to_str(pinfo->pool, tvb, offset, nhlen));
5159
5.28k
        }
5160
8.75k
    }
5161
5162
10.8k
    return length;
5163
10.9k
}
5164
5165
static int decode_bgp_link_node_descriptor(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, int length)
5166
1.07k
{
5167
1.07k
    uint16_t sub_length;
5168
1.07k
    uint16_t type;
5169
1.07k
    uint16_t diss_length;
5170
5171
1.07k
    proto_item* tlv_item;
5172
1.07k
    proto_tree* tlv_tree;
5173
5174
1.07k
    diss_length = 0;
5175
5176
3.51k
    while (length > 0 ) {
5177
2.63k
    if (length < 4) {
5178
123
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5179
123
            "Unknown data in Link-State Link NLRI!");
5180
123
        diss_length += length;
5181
123
        break;
5182
123
    }
5183
2.51k
    type = tvb_get_ntohs(tvb, offset);
5184
2.51k
    sub_length = tvb_get_ntohs(tvb, offset + 2);
5185
5186
2.51k
    switch (type) {
5187
352
        case BGP_NLRI_TLV_AUTONOMOUS_SYSTEM:
5188
352
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_autonomous_system, tvb, offset, sub_length+4, ENC_NA);
5189
352
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5190
352
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5191
352
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5192
352
              if (sub_length != BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM) {
5193
248
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5194
248
                                         "Autonomous system TLV length should be %u bytes! (%u)",
5195
248
                                         BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM, sub_length);
5196
248
                  break;
5197
248
              }
5198
104
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_autonomous_system_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5199
104
          break;
5200
332
          case BGP_NLRI_TLV_BGP_LS_IDENTIFIER:
5201
332
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_ls_identifier, tvb, offset, sub_length+4, ENC_NA);
5202
332
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5203
332
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5204
332
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5205
332
              if (sub_length != BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER) {
5206
247
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5207
247
                                         "BGP-LS TLV length should be %u bytes! (%u)",
5208
247
                                         BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER, sub_length);
5209
247
                  break;
5210
247
              }
5211
85
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_ls_identifier_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5212
85
          break;
5213
280
          case BGP_NLRI_TLV_AREA_ID:
5214
280
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_area_id, tvb, offset, sub_length+4, ENC_NA);
5215
280
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5216
280
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5217
280
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5218
280
              if (sub_length != BGP_NLRI_TLV_LEN_AREA_ID) {
5219
214
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5220
214
                                         "Area ID TLV length should be %u bytes! (%u)",
5221
214
                                         BGP_NLRI_TLV_LEN_AREA_ID, sub_length);
5222
214
                  break;
5223
214
              }
5224
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_area_id_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5225
66
          break;
5226
196
          case BGP_NLRI_TLV_IGP_ROUTER_ID:
5227
196
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_router, tvb, offset, sub_length+4, ENC_NA);
5228
196
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5229
196
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5230
196
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5231
196
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_router_id, tvb, offset + 4, sub_length, ENC_NA);
5232
196
          break;
5233
206
          case BGP_NLRI_TLV_BGP_ROUTER_ID:
5234
206
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_router_id, tvb, offset, sub_length+4, ENC_NA);
5235
206
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5236
206
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5237
206
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5238
206
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_router_id_id, tvb, offset + 4, sub_length, ENC_BIG_ENDIAN);
5239
206
          break;
5240
194
          case BGP_NLRI_TLV_BGP_CONFEDERATION_MEMBER:
5241
194
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_confederation_member, tvb, offset, sub_length+4, ENC_NA);
5242
194
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5243
194
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5244
194
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5245
194
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_confederation_member_as, tvb, offset + 4, sub_length, ENC_BIG_ENDIAN);
5246
194
          break;
5247
910
          default:
5248
910
              expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn, "Undefined node Descriptor Sub-TLV type (%u)!", type);
5249
2.51k
    }
5250
5251
2.43k
    length -= 4 + sub_length;
5252
2.43k
    offset += 4 + sub_length;
5253
2.43k
    diss_length += 4 + sub_length;
5254
2.43k
    }
5255
1.00k
    return diss_length;
5256
1.07k
}
5257
5258
5259
/*
5260
 * Decode BGP Link State Local and Remote NODE Descriptors
5261
 */
5262
static int decode_bgp_link_node_nlri_tlvs(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, uint16_t expected_sub_tlv)
5263
7.23k
{
5264
7.23k
    uint16_t length;
5265
7.23k
    uint16_t type;
5266
7.23k
    proto_tree* tlv_tree;
5267
7.23k
    proto_item* tlv_item;
5268
5269
7.23k
    type = tvb_get_ntohs(tvb, offset);
5270
7.23k
    length = tvb_get_ntohs(tvb, offset + 2);
5271
5272
7.23k
    if (expected_sub_tlv != type) {
5273
6.62k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error, "Expected/actual tlv mismatch, expected: %u, actual: %u", expected_sub_tlv, type);
5274
6.62k
    }
5275
5276
7.23k
    switch(type){
5277
5278
        /*local and remote node descriptors */
5279
614
        case BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS:
5280
614
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_local_node_descriptors, tvb, offset, length+4, ENC_NA);
5281
614
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5282
614
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5283
614
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5284
614
            decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
5285
614
        break;
5286
5287
465
        case BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS:
5288
465
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_remote_node_descriptors, tvb, offset, length+4, ENC_NA);
5289
465
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5290
465
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5291
465
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5292
465
            decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
5293
465
        break;
5294
7.23k
        }
5295
5296
7.11k
    return length +4 ;
5297
7.23k
}
5298
5299
/*
5300
 * Dissect Link and Node NLRI common fields (Protocol-ID, Identifier, Local Node Desc.)
5301
 */
5302
static int decode_bgp_link_node_nlri_common_fields(tvbuff_t *tvb,
5303
15.1k
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length) {
5304
15.1k
    int dissected_length;
5305
15.1k
    int tmp_length;
5306
5307
    /* dissect Link NLRI header */
5308
15.1k
    if (length < 12) {
5309
1.95k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5310
1.95k
                "Link State NLRI length is lower than 12 bytes! (%d)", length);
5311
1.95k
        return length;
5312
1.95k
    }
5313
5314
13.1k
    proto_tree_add_item(tree, hf_bgp_ls_nlri_node_protocol_id, tvb, offset, 1, ENC_BIG_ENDIAN);
5315
13.1k
    save_link_state_protocol_id(pinfo, tvb_get_uint8(tvb, offset));
5316
13.1k
    proto_tree_add_item(tree, hf_bgp_ls_nlri_node_identifier, tvb, offset + 1, 8, ENC_BIG_ENDIAN);
5317
5318
13.1k
    dissected_length = 9;
5319
13.1k
    offset += dissected_length;
5320
13.1k
    length -= dissected_length;
5321
5322
    /* dissect Local Node Descriptors TLV */
5323
13.1k
    if (length < 4) {
5324
7.62k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5325
7.62k
                "Unknown data in Link-State Link NLRI! length = %d bytes", length);
5326
7.62k
        return dissected_length;
5327
7.62k
    }
5328
5329
5.52k
    tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, tree, offset, pinfo,
5330
5.52k
                                                BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS);
5331
5.52k
    if (tmp_length < 0) {
5332
0
       return -1;
5333
0
    }
5334
5.52k
    dissected_length += tmp_length;
5335
5336
5.52k
    return dissected_length;
5337
5.52k
}
5338
5339
5340
/*
5341
 * Decode Link Descriptors
5342
 */
5343
static int decode_bgp_link_nlri_link_descriptors(tvbuff_t *tvb,
5344
948
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length) {
5345
5346
948
    uint16_t sub_length;
5347
948
    uint16_t type;
5348
948
    uint16_t diss_length;
5349
948
    uint16_t tmp16;
5350
5351
948
    proto_item* tlv_item;
5352
948
    proto_tree* tlv_tree;
5353
948
    proto_item* tlv_sub_item;
5354
948
    proto_tree* tlv_sub_tree;
5355
5356
948
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_link_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5357
948
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5358
5359
948
    diss_length = 0;
5360
2.47k
    while (length > 0) {
5361
2.38k
        if (length < 4) {
5362
73
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5363
73
                    "Unknown data in Link-State Link NLRI!");
5364
73
            diss_length += length;
5365
73
            break;
5366
73
        }
5367
5368
2.31k
        type = tvb_get_ntohs(tvb, offset);
5369
2.31k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5370
2.31k
        switch (type) {
5371
271
            case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5372
271
                if(sub_length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS){
5373
67
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5374
67
                                           "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
5375
67
                                           sub_length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
5376
67
                    return -1;
5377
67
                }
5378
204
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5379
204
                                                   hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
5380
204
                                                   sub_length + 4, ENC_NA);
5381
204
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5382
204
            break;
5383
5384
263
            case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
5385
263
                if(sub_length != BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS){
5386
69
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5387
69
                                           "Unexpected IPv4 Interface Address TLV's length (%u), it must be %u bytes!",
5388
69
                                           sub_length, BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS);
5389
69
                    return -1;
5390
69
                }
5391
194
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5392
194
                                                   hf_bgp_ls_tlv_ipv4_interface_address, tvb, offset,
5393
194
                                                   sub_length + 4, ENC_NA);
5394
194
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5395
194
            break;
5396
5397
304
            case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
5398
304
                if(sub_length != BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS){
5399
102
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5400
102
                                           "Unexpected IPv4 Neighbor Address TLV's length (%u), it must be %u bytes!",
5401
102
                                           sub_length, BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS);
5402
102
                    return -1;
5403
102
                }
5404
202
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5405
202
                                                   hf_bgp_ls_tlv_ipv4_neighbor_address, tvb, offset,
5406
202
                                                   sub_length + 4, ENC_NA);
5407
202
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5408
202
            break;
5409
5410
329
            case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
5411
329
                if(sub_length != BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS){
5412
68
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5413
68
                                           "Unexpected IPv6 Interface Address TLV's length (%u), it must be %u bytes!",
5414
68
                                           sub_length, BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS);
5415
68
                    return -1;
5416
68
                }
5417
261
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5418
261
                                                   hf_bgp_ls_tlv_ipv6_interface_address, tvb, offset,
5419
261
                                                   sub_length + 4, ENC_NA);
5420
261
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5421
261
            break;
5422
5423
269
            case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
5424
269
                if(sub_length != BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS){
5425
72
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5426
72
                                           "Unexpected IPv6 Neighbor Address TLV's length (%u), it must be %u bytes!",
5427
72
                                           sub_length, BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS);
5428
72
                    return -1;
5429
72
                }
5430
197
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5431
197
                                                   hf_bgp_ls_tlv_ipv6_neighbor_address, tvb, offset,
5432
197
                                                   sub_length + 4, ENC_NA);
5433
197
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5434
197
            break;
5435
5436
565
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5437
565
                if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5438
83
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5439
83
                                           "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5440
83
                                           sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5441
83
                    return -1;
5442
83
                }
5443
482
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5444
482
                        hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5445
482
                        ENC_NA);
5446
482
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5447
482
            break;
5448
5449
297
            default:
5450
297
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5451
297
                        "Unknown Link Descriptor TLV Code (%u)!", type);
5452
297
                return -1;
5453
2.31k
        }
5454
5455
1.54k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5456
1.54k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5457
5458
1.54k
        switch (type) {
5459
204
            case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5460
204
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5461
204
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5462
204
            break;
5463
5464
194
            case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
5465
194
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_interface_address, tvb, offset + 4,
5466
194
                                    BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
5467
194
            break;
5468
5469
202
            case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
5470
202
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_neighbor_address, tvb, offset + 4,
5471
202
                                    BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
5472
202
            break;
5473
5474
261
            case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
5475
261
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_interface_address, tvb, offset + 4,
5476
261
                                    BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
5477
261
            break;
5478
5479
197
            case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
5480
197
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_neighbor_address, tvb, offset + 4,
5481
197
                                    BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
5482
197
            break;
5483
5484
482
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5485
482
                tmp16 = tvb_get_ntohs(tvb, offset + 4);
5486
482
                tmp16 >>= 12;
5487
482
                if(tmp16){
5488
201
                    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);
5489
201
                }
5490
482
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
5491
482
                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5492
482
            break;
5493
1.54k
        }
5494
5495
1.52k
        length -= 4 + sub_length;
5496
1.52k
        offset += 4 + sub_length;
5497
1.52k
        diss_length += 4 + sub_length;
5498
1.52k
    }
5499
163
    return diss_length;
5500
948
}
5501
5502
/*
5503
 * Decode Prefix Descriptors
5504
 */
5505
static int decode_bgp_link_nlri_prefix_descriptors(tvbuff_t *tvb,
5506
1.07k
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length, int proto) {
5507
5508
1.07k
    uint16_t sub_length;
5509
1.07k
    uint16_t type;
5510
1.07k
    uint16_t diss_length;
5511
1.07k
    uint16_t tmp16;
5512
5513
1.07k
    proto_item* tlv_item;
5514
1.07k
    proto_tree* tlv_tree;
5515
1.07k
    proto_item* tlv_sub_item;
5516
1.07k
    proto_tree* tlv_sub_tree;
5517
5518
1.07k
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_prefix_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5519
1.07k
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5520
5521
1.07k
    diss_length = 0;
5522
2.61k
    while (length > 0) {
5523
2.35k
        if (length < 4) {
5524
77
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5525
77
                    "Unknown data in Link-State Link NLRI!");
5526
77
            diss_length += length;
5527
77
            break;
5528
77
        }
5529
5530
2.27k
        type = tvb_get_ntohs(tvb, offset);
5531
2.27k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5532
2.27k
        switch (type) {
5533
754
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5534
754
                if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5535
71
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5536
71
                                           "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5537
71
                                           sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5538
71
                    return -1;
5539
71
                }
5540
683
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5541
683
                        hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5542
683
                        ENC_NA);
5543
683
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5544
683
            break;
5545
5546
464
            case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
5547
464
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5548
464
                        hf_bgp_ls_tlv_ospf_route_type, tvb, offset, sub_length + 4,
5549
464
                        ENC_NA);
5550
464
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5551
464
            break;
5552
497
            case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
5553
497
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5554
497
                        hf_bgp_ls_tlv_ip_reachability_information, tvb, offset, sub_length + 4,
5555
497
                        ENC_NA);
5556
497
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5557
497
            break;
5558
5559
521
            default:
5560
521
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5561
521
                        "Unknown Prefix Descriptor TLV Code (%u)!", type);
5562
521
                return -1;
5563
2.27k
        }
5564
5565
1.64k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5566
1.64k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5567
5568
1.64k
        switch (type) {
5569
683
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5570
683
                tmp16 = tvb_get_ntohs(tvb, offset + 4);
5571
683
                tmp16 >>= 12;
5572
683
                if(tmp16){
5573
377
                    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);
5574
377
                }
5575
683
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
5576
683
                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5577
683
            break;
5578
5579
464
            case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
5580
5581
464
                if (sub_length != 1) {
5582
237
                    expert_add_info_format(pinfo, tlv_sub_tree, &ei_bgp_ls_error, "OSPF Route Type length must be \"1\"");
5583
237
                    break;
5584
237
                }
5585
227
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ospf_route_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5586
227
            break;
5587
5588
497
            case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
5589
497
                if (( proto == IP_PROTO_IPV4 ) && (decode_prefix4(tlv_sub_tree, pinfo, tlv_sub_item, hf_bgp_ls_nlri_ip_reachability_prefix_ip,
5590
265
                               tvb, offset + 4, "Reachability") == -1))
5591
66
                    return diss_length;
5592
431
                if (( proto == IP_PROTO_IPV6 ) && (decode_prefix6(tlv_sub_tree, pinfo, hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
5593
232
                               tvb, offset + 4, 0, "Reachability") == -1))
5594
34
                    return diss_length;
5595
397
            break;
5596
1.64k
        }
5597
5598
1.54k
        length -= 4 + sub_length;
5599
1.54k
        offset += 4 + sub_length;
5600
1.54k
        diss_length += 4 + sub_length;
5601
1.54k
    }
5602
338
    return diss_length;
5603
1.07k
}
5604
5605
/*
5606
 * Decode SRv6 SID Descriptors
5607
 */
5608
static int decode_bgp_link_nlri_srv6_sid_descriptors(tvbuff_t *tvb,
5609
813
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length) {
5610
5611
813
    uint16_t sub_length;
5612
813
    uint16_t type;
5613
813
    uint16_t diss_length;
5614
813
    uint16_t tmp16;
5615
5616
813
    proto_item* tlv_item;
5617
813
    proto_tree* tlv_tree;
5618
813
    proto_item* tlv_sub_item;
5619
813
    proto_tree* tlv_sub_tree;
5620
5621
813
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_srv6_sid_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5622
813
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5623
5624
813
    diss_length = 0;
5625
1.50k
    while (length > 0) {
5626
1.16k
        if (length < 4) {
5627
74
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5628
74
                    "Unknown data in Link-State SRv6 SID NLRI!");
5629
74
            diss_length += length;
5630
74
            break;
5631
74
        }
5632
5633
1.09k
        type = tvb_get_ntohs(tvb, offset);
5634
1.09k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5635
1.09k
        switch (type) {
5636
736
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5637
736
            if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5638
79
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5639
79
                                       "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5640
79
                                       sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5641
79
                return -1;
5642
79
            }
5643
657
            tlv_sub_item = proto_tree_add_item(tlv_tree,
5644
657
                                               hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5645
657
                                               ENC_NA);
5646
657
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5647
657
            break;
5648
5649
119
        case BGP_NLRI_TLV_SRV6_SID_INFO:
5650
119
            if (sub_length != 16) {
5651
76
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5652
76
                                       "Unexpected SRv6 SID Information TLV's length (%u), it must be 16 bytes!",
5653
76
                                       sub_length);
5654
76
                return -1;
5655
76
            }
5656
43
            tlv_sub_item = proto_tree_add_item(tlv_tree,
5657
43
                                               hf_bgp_ls_tlv_srv6_sid_info, tvb, offset, sub_length + 4,
5658
43
                                               ENC_NA);
5659
43
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5660
43
            break;
5661
5662
207
        default:
5663
207
            expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5664
207
                                   "Unknown SRv6 SID Descriptor TLV Code (%u)!", type);
5665
207
            return -1;
5666
1.09k
        }
5667
5668
700
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5669
700
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5670
5671
700
        switch (type) {
5672
657
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5673
657
            tmp16 = tvb_get_ntohs(tvb, offset + 4);
5674
657
            tmp16 >>= 12;
5675
657
            if (tmp16) {
5676
420
                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);
5677
420
            }
5678
657
            proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id,
5679
657
                                tvb, offset + 4, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5680
657
            break;
5681
5682
43
        case BGP_NLRI_TLV_SRV6_SID_INFO:
5683
43
            proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_tlv_srv6_sid_info_sid,
5684
43
                                tvb, offset + 4, 16, ENC_NA);
5685
43
            break;
5686
700
        }
5687
5688
694
        length -= 4 + sub_length;
5689
694
        offset += 4 + sub_length;
5690
694
        diss_length += 4 + sub_length;
5691
694
    }
5692
413
    return diss_length;
5693
813
}
5694
5695
/*
5696
 * Decode Flex Algo sub-TLVs in BGP-LS attributes
5697
 */
5698
static int
5699
decode_link_state_attribute_flex_algo_subtlv(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint8_t _U_ protocol_id)
5700
46.1k
{
5701
46.1k
    uint16_t type;
5702
46.1k
    uint16_t length;
5703
46.1k
    uint16_t tmp16;
5704
46.1k
    int i;
5705
46.1k
    proto_item* tlv_item;
5706
46.1k
    proto_tree* tlv_tree;
5707
46.1k
    proto_item* ti;
5708
5709
46.1k
    type = tvb_get_ntohs(tvb, offset);
5710
46.1k
    length = tvb_get_ntohs(tvb, offset + 2);
5711
5712
46.1k
    switch (type) {
5713
382
    case BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY:
5714
649
    case BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY:
5715
928
    case BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY:
5716
928
        tlv_item = proto_tree_add_item(tree,
5717
928
                                       (type == BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY) ?
5718
382
                                       hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity :
5719
928
                                       ((type == BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY) ?
5720
267
                                        hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity :
5721
546
                                        hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity),
5722
928
                                       tvb, offset, length + 4, ENC_NA);
5723
928
        tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5724
928
        proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5725
928
        ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5726
928
        if (length % 4 != 0) {
5727
293
            expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u mod 4 != 0)",
5728
293
                                   "Extended Administrative Group", length);
5729
293
            break;
5730
293
        }
5731
635
        tmp16 = length;
5732
1.05k
        while (tmp16) {
5733
421
            proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
5734
421
            tmp16 -= 4;
5735
421
        }
5736
635
        break;
5737
5738
388
    case BGP_LS_SR_TLV_FLEX_ALGO_DEF_FLAGS:
5739
388
        {
5740
388
            static int * const flex_algo_def_flags[] = {
5741
388
                &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m,
5742
388
                NULL
5743
388
            };
5744
388
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def_flags, tvb, offset, length + 4, ENC_NA);
5745
388
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5746
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5747
388
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5748
388
            if (length != 4) {
5749
194
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u != 4)",
5750
194
                                       "Flexible Algorithm Definition Flags", length);
5751
194
                break;
5752
194
            }
5753
194
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags, ett_bgp_link_state, flex_algo_def_flags, ENC_NA);
5754
194
        }
5755
0
        break;
5756
5757
43.9k
    case BGP_LS_SR_TLV_FLEX_ALGO_EXC_SRLG:
5758
43.9k
        tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_exc_srlg, tvb, offset, length + 4, ENC_NA);
5759
43.9k
        tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5760
43.9k
        proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5761
43.9k
        ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5762
43.9k
        if (length % 4 != 0) {
5763
43.4k
            expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u mod 4 != 0)",
5764
43.4k
                                   "Flexible Algorithm Exclude SRLG", length);
5765
43.4k
            break;
5766
43.4k
        }
5767
851
        for (i = 0; i < length; i += 4) {
5768
425
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + i, 4, ENC_BIG_ENDIAN);
5769
425
        }
5770
426
        break;
5771
5772
857
    default:
5773
857
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
5774
857
                               "Unknown BGP-LS Flex-Algo sub-TLV Code (%u)!", type);
5775
857
        break;
5776
46.1k
    }
5777
5778
46.0k
    return length + 4;
5779
46.1k
}
5780
5781
/*
5782
 * Decode a multiprotocol prefix
5783
 */
5784
static int
5785
// NOLINTNEXTLINE(misc-no-recursion)
5786
decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint8_t protocol_id)
5787
3.31M
{
5788
3.31M
    uint16_t type;
5789
3.31M
    uint16_t length;
5790
3.31M
    uint8_t tmp8;
5791
3.31M
    uint16_t tmp16;
5792
3.31M
    uint32_t tmp32;
5793
3.31M
    float   tmp_float;
5794
3.31M
    uint32_t mask;
5795
3.31M
    unsigned local_offset, local_length;
5796
3.31M
    int n;
5797
3.31M
    uint8_t sabm_len, udabm_len;
5798
3.31M
    int     advance;
5799
5800
3.31M
    proto_item* tlv_item;
5801
3.31M
    proto_tree* tlv_tree;
5802
3.31M
    proto_item* tlv_sub_item;
5803
3.31M
    proto_tree* tlv_sub_tree;
5804
3.31M
    proto_item* ti;
5805
5806
3.31M
    type = tvb_get_ntohs(tvb, offset);
5807
3.31M
    length = tvb_get_ntohs(tvb, offset + 2);
5808
5809
3.31M
    increment_dissection_depth(pinfo);
5810
3.31M
    switch (type) {
5811
5812
        /* NODE ATTRIBUTE TLVs */
5813
497
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5814
497
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_multi_topology_id, tvb, offset, length + 4, ENC_NA);
5815
497
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5816
5817
1.25k
            for (n = 0; n < (length / BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID); n++) {
5818
754
                tmp16 = tvb_get_ntohs(tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID));
5819
754
                tmp16 >>= 12;
5820
754
                if(tmp16){
5821
309
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved bits of Multi Topology ID must be set to zero! (%u)", tmp16);
5822
309
                }
5823
754
                proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID),
5824
754
                                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5825
754
            }
5826
497
            break;
5827
5828
42.8k
        case BGP_NLRI_TLV_NODE_FLAG_BITS:
5829
42.8k
            {
5830
42.8k
            static int * const flags[] = {
5831
42.8k
                &hf_bgp_ls_node_flag_bits_overload,
5832
42.8k
                &hf_bgp_ls_node_flag_bits_attached,
5833
42.8k
                &hf_bgp_ls_node_flag_bits_external,
5834
42.8k
                &hf_bgp_ls_node_flag_bits_abr,
5835
42.8k
                NULL
5836
42.8k
            };
5837
5838
42.8k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_flags_bits, tvb, offset, length+4, ENC_NA);
5839
42.8k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5840
42.8k
            if(length != BGP_NLRI_TLV_LEN_NODE_FLAG_BITS){
5841
5.36k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Node Flags Bits TLV's length (%u), it must be %u bytes!",
5842
5.36k
                                       length, BGP_NLRI_TLV_LEN_NODE_FLAG_BITS);
5843
5.36k
                break;
5844
5.36k
            }
5845
37.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5846
37.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5847
37.5k
            proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
5848
37.5k
            tmp8 = tvb_get_uint8(tvb, offset+4) & 0x0f;
5849
37.5k
            if(tmp8){
5850
18.0k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flag bits are not set to zero (%u).", tmp8);
5851
18.0k
            }
5852
37.5k
            }
5853
0
            break;
5854
5855
195
        case BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES:
5856
195
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_node_properties, tvb, offset, length+4, ENC_NA);
5857
195
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5858
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5859
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5860
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_node_properties_value, tvb, offset + 4, length, ENC_NA);
5861
195
            break;
5862
5863
194
        case BGP_NLRI_TLV_NODE_NAME:
5864
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_name, tvb, offset, length+4, ENC_NA);
5865
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5866
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5867
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5868
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_node_name_value, tvb, offset + 4, length, ENC_ASCII);
5869
194
            break;
5870
5871
194
        case BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER:
5872
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_is_is_area_identifier, tvb, offset, length+4, ENC_NA);
5873
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5874
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5875
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5876
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_is_is_area_identifier_value, tvb, offset + 4, length, ENC_NA);
5877
194
            break;
5878
5879
5.28k
        case BGP_LS_SR_TLV_SR_CAPABILITY:
5880
5.28k
            {
5881
                /*
5882
                  0  1  2  3  4  5  6  7
5883
                  +--+--+--+--+--+--+--+--+
5884
                  |I |V |H |  |  |  |  |  |
5885
                  +--+--+--+--+--+--+--+--+
5886
                */
5887
5.28k
                static int * const sr_capabilities_flags[] = {
5888
5.28k
                    &hf_bgp_ls_sr_tlv_capabilities_flags_i,
5889
5.28k
                    &hf_bgp_ls_sr_tlv_capabilities_flags_v,
5890
5.28k
                    &hf_bgp_ls_sr_tlv_capabilities_flags_h,
5891
5.28k
                    &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
5892
5.28k
                    NULL
5893
5.28k
                };
5894
5.28k
                unsigned offset2;
5895
5.28k
                int remaining_data;
5896
5.28k
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_capabilities, tvb, offset, length + 4, ENC_NA);
5897
5.28k
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5898
5.28k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5899
5.28k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5900
5.28k
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_capabilities_flags,
5901
5.28k
                                       ett_bgp_link_state, sr_capabilities_flags, ENC_BIG_ENDIAN);
5902
                /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
5903
5.28k
                offset2 = offset + 4 + 2;
5904
5.28k
                remaining_data = length - 2;
5905
5.83k
                while (remaining_data > 0) {
5906
550
                    uint16_t sid_len = 0;
5907
                    /* parse and consume the range field */
5908
550
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
5909
550
                    offset2 += 3;
5910
                    /* parse and consume type/len fields */
5911
550
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
5912
550
                    offset2 += 2;
5913
550
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
5914
550
                    sid_len = tvb_get_ntohs(tvb, offset2);
5915
550
                    offset2 += 2;
5916
550
                    if (sid_len == 3) {
5917
                        /* parse and consume the SID/Label field */
5918
241
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
5919
241
                        offset2 += 3;
5920
241
                        remaining_data -= 10;
5921
309
                    } else {
5922
                        /* parse and consume the SID/Index field */
5923
309
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
5924
309
                        offset2 += 4;
5925
309
                        remaining_data -= 11;
5926
309
                    }
5927
550
                }
5928
5.28k
            }
5929
5.28k
            break;
5930
5931
644
        case BGP_LS_SR_TLV_SR_LOCAL_BLOCK:
5932
644
            {
5933
644
                unsigned offset2;
5934
644
                int remaining_data;
5935
644
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_local_block, tvb, offset, length + 4, ENC_NA);
5936
644
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5937
644
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5938
644
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5939
644
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_flags, tvb, offset + 4, 1, ENC_NA);
5940
                /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
5941
644
                offset2 = offset + 4 + 2;
5942
644
                remaining_data = length - 2;
5943
1.44k
                while (remaining_data > 0) {
5944
797
                    uint16_t sid_len = 0;
5945
                    /* parse and consume the range field */
5946
797
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
5947
797
                    offset2 += 3;
5948
                    /* parse and consume type/len fields */
5949
797
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
5950
797
                    offset2 += 2;
5951
797
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
5952
797
                    sid_len = tvb_get_ntohs(tvb, offset2);
5953
797
                    offset2 += 2;
5954
797
                    if (sid_len == 3) {
5955
                        /* parse and consume the SID/Label field */
5956
388
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
5957
388
                        offset2 += 3;
5958
388
                        remaining_data -= 10;
5959
409
                    } else {
5960
                        /* parse and consume the SID/Index field */
5961
409
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
5962
409
                        offset2 += 4;
5963
409
                        remaining_data -= 11;
5964
409
                    }
5965
797
                }
5966
644
            }
5967
644
            break;
5968
5969
822
        case BGP_LS_SR_TLV_SR_ALGORITHM:
5970
822
            {
5971
822
                unsigned offset2;
5972
822
                int remaining_data;
5973
822
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_algorithm, tvb, offset, length+4, ENC_NA);
5974
822
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5975
822
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5976
822
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5977
                /* past type-length fields, we got one or more 'Algorithm N' value */
5978
822
                offset2 = offset + 4;
5979
822
                remaining_data = length;
5980
1.29k
                while (remaining_data > 0) {
5981
473
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_algorithm_value, tvb, offset2, 1, ENC_NA);
5982
473
                    offset2 += 1;
5983
473
                    remaining_data -= 1;
5984
473
                }
5985
822
            }
5986
822
            break;
5987
5988
436
        case BGP_LS_SR_TLV_SRV6_CAPABILITY:
5989
436
            {
5990
436
                static int * const srv6_cap_flags[] = {
5991
436
                    &hf_bgp_ls_sr_tlv_srv6_cap_flags_o,
5992
436
                    &hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved,
5993
436
                    NULL
5994
436
                };
5995
436
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_cap, tvb, offset, length + 4, ENC_NA);
5996
436
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5997
436
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5998
436
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5999
436
                if (length != 4) {
6000
242
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6001
242
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6002
242
                                           length, "SRv6 Capabilities", 4);
6003
242
                    break;
6004
242
                }
6005
194
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_srv6_cap_flags,
6006
194
                                       ett_bgp_link_state, srv6_cap_flags, ENC_BIG_ENDIAN);
6007
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_cap_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6008
194
            }
6009
0
            break;
6010
6011
44.7k
        case BGP_LS_SR_TLV_FLEX_ALGO_DEF:
6012
44.7k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def, tvb, offset, length+4, ENC_NA);
6013
44.7k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6014
44.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6015
44.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6016
44.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
6017
44.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_metric_type, tvb, offset + 5, 1, ENC_NA);
6018
44.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_calc_type, tvb, offset + 6, 1, ENC_NA);
6019
44.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_priority, tvb, offset + 7, 1, ENC_NA);
6020
44.7k
            local_offset = offset + 8;
6021
90.8k
            while (local_offset < offset + length) {
6022
46.1k
                advance = decode_link_state_attribute_flex_algo_subtlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6023
46.1k
                if (advance < 0) {
6024
0
                    break;
6025
0
                }
6026
46.1k
                local_offset += advance;
6027
46.1k
            }
6028
44.7k
            break;
6029
6030
        /* NODE & LINK ATTRIBUTE TLVs */
6031
307
        case BGP_NLRI_TLV_NODE_MSD:
6032
599
        case BGP_NLRI_TLV_LINK_MSD:
6033
599
            tlv_item = proto_tree_add_item(tree,
6034
599
                                           (type == BGP_NLRI_TLV_NODE_MSD ?
6035
307
                                            hf_bgp_ls_tlv_node_msd : hf_bgp_ls_tlv_link_msd),
6036
599
                                            tvb, offset, length + 4, ENC_NA);
6037
599
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
6038
599
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6039
599
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6040
599
            local_offset = offset + 4;
6041
599
            local_length = length;
6042
1.15k
            while (local_length >= 2) {
6043
556
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_type, tvb, local_offset, 1, ENC_NA);
6044
556
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_value, tvb, local_offset+1, 1, ENC_NA);
6045
556
                local_length -= 2;
6046
556
                local_offset += 2;
6047
556
            }
6048
599
            break;
6049
6050
476
        case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE:
6051
476
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
6052
476
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6053
476
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6054
476
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6055
476
            if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE){
6056
282
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
6057
282
                                    length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE);
6058
282
                break;
6059
282
            }
6060
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6061
194
            break;
6062
406
        case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE:
6063
406
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
6064
406
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6065
406
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6066
406
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6067
406
            if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE){
6068
212
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
6069
212
                                    length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE);
6070
212
                break;
6071
212
            }
6072
194
            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);
6073
194
            break;
6074
6075
        /* Link Attribute TLVs */
6076
595
        case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
6077
595
            if (length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS) {
6078
397
                expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
6079
397
                                       "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
6080
397
                                       length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
6081
397
                break;
6082
397
            }
6083
198
            tlv_item = proto_tree_add_item(tree,
6084
198
                                           hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
6085
198
                                           length + 4, ENC_NA);
6086
198
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
6087
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6088
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6089
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6090
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6091
198
            break;
6092
6093
435
        case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE:
6094
435
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
6095
435
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6096
435
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6097
435
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6098
435
            if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE){
6099
241
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
6100
241
                                    length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE);
6101
241
                break;
6102
241
            }
6103
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6104
194
            break;
6105
6106
496
        case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE:
6107
496
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
6108
496
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6109
496
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6110
496
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6111
496
            if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE){
6112
302
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
6113
302
                                    length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE);
6114
302
                break;
6115
302
            }
6116
194
            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);
6117
194
            break;
6118
6119
75.5k
        case BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR:
6120
75.5k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_administrative_group_color, tvb, offset, length+4, ENC_NA);
6121
75.5k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6122
75.5k
            if(length != BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR){
6123
68.8k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Administrative group (color) TLV's length (%u), it must be %u bytes!",
6124
68.8k
                                       length, BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR);
6125
68.8k
                break;
6126
68.8k
            }
6127
6.67k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6128
6.67k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6129
6.67k
            tmp32 = tvb_get_ntohl(tvb, offset + 4);
6130
6.67k
            tlv_sub_item = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_administrative_group_color_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6131
6.67k
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_prefix);
6132
6.67k
            mask = 1;
6133
220k
            for(n = 0; n<32; n++){
6134
213k
                if( tmp32 & mask ) proto_tree_add_uint(tlv_sub_tree, hf_bgp_ls_tlv_administrative_group, tvb, offset + 4, 4, n);
6135
213k
                mask <<= 1;
6136
213k
            }
6137
6.67k
            break;
6138
6139
394
        case BGP_NLRI_TLV_MAX_LINK_BANDWIDTH:
6140
394
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_link_bandwidth, tvb, offset, length+4, ENC_NA);
6141
394
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6142
394
            if(length != BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH){
6143
200
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Maximum link bandwidth TLV's length (%u), it must be %u bytes!",
6144
200
                                       length, BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH);
6145
200
                break;
6146
200
            }
6147
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6148
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6149
194
            tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
6150
194
            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);
6151
194
            break;
6152
6153
45.1k
        case BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH:
6154
45.1k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_reservable_link_bandwidth, tvb, offset, length+4, ENC_NA);
6155
45.1k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6156
45.1k
            if(length != BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH){
6157
203
                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!",
6158
203
                                       length, BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH);
6159
203
                break;
6160
203
            }
6161
44.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6162
44.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6163
44.9k
            tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
6164
44.9k
            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);
6165
44.9k
            break;
6166
6167
2.50k
        case BGP_NLRI_TLV_UNRESERVED_BANDWIDTH:
6168
2.50k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_unreserved_bandwidth, tvb, offset, length+4, ENC_NA);
6169
2.50k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6170
2.50k
            if(length != BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH){
6171
286
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Unreserved bandwidth TLV's length (%u), it must be %u bytes!",
6172
286
                                       length, BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH);
6173
286
                break;
6174
286
            }
6175
2.21k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6176
2.21k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6177
19.9k
            for(n = 0; n<8; n++){
6178
17.7k
                tmp_float = tvb_get_ntohieee_float(tvb, offset + 4 + (4 * n))*8/1000000;
6179
17.7k
                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);
6180
17.7k
                proto_item_prepend_text(tlv_sub_item, "Priority %u, ", n);
6181
17.7k
            }
6182
2.21k
            break;
6183
6184
612
        case BGP_NLRI_TLV_TE_DEFAULT_METRIC:
6185
612
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_te_default_metric, tvb, offset, length+4, ENC_NA);
6186
612
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6187
            /* FF: The 'TE Default Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 04
6188
               was 3 bytes as per RFC5305/3.7, since version 05 is 4 bytes. Here we try to parse both formats
6189
               without complain because there are real implementations out there based on the 3 bytes size. At
6190
               the same time we clearly highlight that 3 is "old" and 4 is correct via expert info. */
6191
612
            if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
6192
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
6193
194
                                       "Old TE Default Metric TLV's length (%u), it should be %u bytes!",
6194
194
                                       length,
6195
194
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
6196
                /* just a warning do not give up dissection */
6197
194
            }
6198
612
            if (length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD && length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
6199
224
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
6200
224
                                       "Unexpected TE Default Metric TLV's length (%u), it must be %u or %u bytes!",
6201
224
                                       length,
6202
224
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD,
6203
224
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
6204
                /* major error give up dissection */
6205
224
                break;
6206
224
            }
6207
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6208
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6209
388
            if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
6210
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value_old, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
6211
194
            } else if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
6212
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6213
194
            }
6214
388
            break;
6215
6216
493k
        case BGP_NLRI_TLV_LINK_PROTECTION_TYPE:
6217
493k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_protection_type, tvb, offset, length+4, ENC_NA);
6218
493k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6219
493k
            if(length != BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE){
6220
253
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Link Protection Type TLV's length (%u), it must be %u bytes!",
6221
253
                                       length, BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE);
6222
253
                break;
6223
253
            }
6224
492k
            else {
6225
492k
                static int * const nlri_flags[] = {
6226
492k
                    &hf_bgp_ls_link_protection_type_extra_traffic,
6227
492k
                    &hf_bgp_ls_link_protection_type_unprotected,
6228
492k
                    &hf_bgp_ls_link_protection_type_shared,
6229
492k
                    &hf_bgp_ls_link_protection_type_dedicated_1to1,
6230
492k
                    &hf_bgp_ls_link_protection_type_dedicated_1plus1,
6231
492k
                    &hf_bgp_ls_link_protection_type_enhanced,
6232
492k
                    NULL
6233
492k
                };
6234
6235
492k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6236
492k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6237
492k
                tmp8 = tvb_get_uint8(tvb, offset + 4);
6238
6239
492k
                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);
6240
492k
                tmp8 >>= 6;
6241
492k
                if(tmp8){
6242
284k
                    expert_add_info_format(pinfo, tlv_sub_item, &ei_bgp_ls_error, "Reserved Protection Capabilities bits are not set to zero (%u).", tmp8);
6243
284k
                }
6244
492k
                tmp8 = tvb_get_uint8(tvb, offset + 4 + 1);
6245
492k
                if(tmp8){
6246
492k
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved field is not set to zero. (%u)", tmp8);
6247
492k
                }
6248
492k
            }
6249
492k
            break;
6250
492k
        case BGP_NLRI_TLV_MPLS_PROTOCOL_MASK:
6251
713
            {
6252
713
            static int * const flags[] = {
6253
713
                &hf_bgp_ls_mpls_protocol_mask_flag_l,
6254
713
                &hf_bgp_ls_mpls_protocol_mask_flag_r,
6255
713
                NULL
6256
713
            };
6257
6258
713
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_mpls_protocol_mask, tvb, offset, length+4, ENC_NA);
6259
713
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6260
713
            if(length != BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK){
6261
313
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected MPLS Protocol Mask TLV's length (%u), it must be %u bytes!",
6262
313
                                       length, BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK);
6263
313
                break;
6264
313
            }
6265
400
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6266
400
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6267
400
            proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
6268
400
            tmp8 = tvb_get_uint8(tvb, offset + 4) & 0x3f;
6269
400
            if(tmp8){
6270
197
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error, tvb, offset + 4, 1,
6271
197
                                             "Reserved flags are not set to zero (%u).", tmp8);
6272
197
            }
6273
400
            }
6274
0
            break;
6275
981
        case BGP_NLRI_TLV_METRIC:
6276
            /* FF: The IGP 'Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 02
6277
               was fixed at 3 bytes, since version 03 is variable 1/2/3 bytes. We cannot complain if
6278
               length is not fixed at 3. */
6279
981
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_metric, tvb, offset, length + 4, ENC_NA);
6280
981
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6281
981
            if (length > BGP_NLRI_TLV_LEN_MAX_METRIC) {
6282
203
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
6283
203
                                       "Unexpected Metric TLV's length (%u), it must be less than %u bytes!",
6284
203
                                       length, BGP_NLRI_TLV_LEN_MAX_METRIC);
6285
203
                break;
6286
203
            }
6287
778
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6288
778
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6289
778
            if (length == 1) {
6290
196
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value1, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6291
582
            } else if (length == 2) {
6292
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value2, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6293
388
            } else if (length == 3) {
6294
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value3, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
6295
194
            }
6296
778
            break;
6297
34.2k
        case BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP:
6298
34.2k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_shared_risk_link_group, tvb, offset, length+4, ENC_NA);
6299
34.2k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6300
34.2k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6301
34.2k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6302
34.2k
            tmp16 = length;
6303
34.2k
            n = 0;
6304
34.6k
            while(tmp16 > 0){
6305
34.2k
                if(tmp16 < 4) {
6306
33.8k
                    proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error,
6307
33.8k
                                                 tvb, offset + 4 + (n * 4), tmp16,
6308
33.8k
                                                 "Shared Risk Link Group Value must be 4 bytes long (%u).", tmp16);
6309
33.8k
                    break;
6310
33.8k
                }
6311
414
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
6312
414
                tmp16 -= 4;
6313
414
                n++;
6314
414
            }
6315
34.2k
            break;
6316
6317
204
        case BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE:
6318
204
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_link_attribute, tvb, offset, length+4, ENC_NA);
6319
204
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6320
204
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6321
204
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6322
204
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_link_attribute_value, tvb,  offset + 4, length, ENC_NA);
6323
204
            break;
6324
6325
194
        case BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE:
6326
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_name_attribute, tvb, offset, length+4, ENC_NA);
6327
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6328
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6329
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6330
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_link_name_attribute_value, tvb, offset + 4, length, ENC_ASCII);
6331
194
            break;
6332
6333
795
        case BGP_LS_SR_TLV_ADJ_SID:
6334
795
            {
6335
                /*
6336
                   0  1  2  3  4  5  6  7
6337
                  +--+--+--+--+--+--+--+--+
6338
                  |F |B |V |L |S |P |  |  |
6339
                  +--+--+--+--+--+--+--+--+
6340
                */
6341
795
                static int * const adj_sid_isis_flags[] = {
6342
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
6343
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
6344
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
6345
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
6346
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
6347
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi,
6348
795
                    NULL
6349
795
                };
6350
                /*
6351
                   0  1  2  3  4  5  6  7
6352
                  +--+--+--+--+--+--+--+--+
6353
                  |B |V |L |G |P |  |  |  |
6354
                  +--+--+--+--+--+--+--+--+
6355
                */
6356
795
                static int * const adj_sid_ospf_flags[] = {
6357
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
6358
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
6359
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
6360
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_go,
6361
795
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_po,
6362
795
                    NULL
6363
795
                };
6364
6365
795
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_adjacency_sid, tvb, offset, length + 4, ENC_NA);
6366
795
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6367
795
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6368
795
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6369
795
                if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6370
388
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
6371
388
                                           ett_bgp_link_state, adj_sid_ospf_flags, ENC_BIG_ENDIAN);
6372
407
                } else {
6373
                    /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6374
407
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
6375
407
                                           ett_bgp_link_state, adj_sid_isis_flags, ENC_BIG_ENDIAN);
6376
407
                }
6377
795
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6378
795
                if (length == 7) {
6379
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6380
601
                } else {
6381
601
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6382
601
                }
6383
795
            }
6384
795
            break;
6385
6386
196
        case BGP_LS_SR_TLV_LAN_ADJ_SID:
6387
196
            break;
6388
6389
8.43k
        case BGP_LS_SR_TLV_PEER_NODE_SID:
6390
8.89k
        case BGP_LS_SR_TLV_PEER_ADJ_SID:
6391
9.29k
        case BGP_LS_SR_TLV_PEER_SET_SID:
6392
9.29k
            {
6393
                /*
6394
                   0  1  2  3  4  5  6  7
6395
                  +--+--+--+--+--+--+--+--+
6396
                  |V |L |B |P |  |  |  |  | rfc9086
6397
                  +--+--+--+--+--+--+--+--+
6398
                */
6399
9.29k
                static int * const peer_sid_flags[] = {
6400
9.29k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
6401
9.29k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
6402
9.29k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
6403
9.29k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
6404
9.29k
                    NULL
6405
9.29k
                };
6406
6407
9.29k
                tlv_item = proto_tree_add_item(tree,
6408
9.29k
                                               (type == BGP_LS_SR_TLV_PEER_NODE_SID ?
6409
8.43k
                                                hf_bgp_ls_sr_tlv_peer_node_sid :
6410
9.29k
                                                (type == BGP_LS_SR_TLV_PEER_ADJ_SID ?
6411
458
                                                 hf_bgp_ls_sr_tlv_peer_adj_sid :
6412
854
                                                 hf_bgp_ls_sr_tlv_peer_set_sid)),
6413
9.29k
                                               tvb, offset, length + 4, ENC_NA);
6414
9.29k
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6415
9.29k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6416
9.29k
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6417
9.29k
                if (length != 7 && length != 8) {
6418
8.89k
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6419
8.89k
                                           "Unexpected TLV Length (%u) in BGP-LS Peer SID TLV, it must be either 7 or 8 bytes!",
6420
8.89k
                                           length);
6421
8.89k
                    break;
6422
8.89k
                }
6423
396
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_peer_sid_flags,
6424
396
                                       ett_bgp_link_state, peer_sid_flags, ENC_BIG_ENDIAN);
6425
396
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6426
396
                if (length == 7) {
6427
197
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6428
199
                } else {
6429
199
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6430
199
                }
6431
396
            }
6432
0
            break;
6433
6434
635
        case BGP_LS_SR_TLV_SRV6_END_X_SID:
6435
635
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_endx_sid,
6436
635
                                           tvb, offset, length + 4, ENC_NA);
6437
635
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6438
635
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6439
635
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6440
635
            if (length < 20) {
6441
199
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6442
199
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6443
199
                                       length, "SRv6 End.X SID", 20);
6444
199
                break;
6445
199
            }
6446
436
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6447
436
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 6,
6448
436
                                   hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
6449
436
                                   ett_bgp_link_state, srv6_endx_sid_flags, ENC_BIG_ENDIAN);
6450
436
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_algo, tvb, offset + 7, 1, ENC_NA);
6451
436
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_weight, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6452
436
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved, tvb, offset + 9, 1, ENC_BIG_ENDIAN);
6453
436
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_sid, tvb, offset + 10, 16, ENC_NA);
6454
436
            local_offset = offset + 26;
6455
995
            while (local_offset < offset + length) {
6456
559
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6457
559
                if (advance < 0) {
6458
0
                    break;
6459
0
                }
6460
559
                local_offset += advance;
6461
559
            }
6462
436
            break;
6463
6464
1.69k
        case BGP_LS_SR_TLV_SRV6_LAN_END_X_SID:
6465
1.69k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_lan_endx_sid,
6466
1.69k
                                           tvb, offset, length+4, ENC_NA);
6467
1.69k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6468
1.69k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6469
1.69k
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6470
1.69k
            if ((((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) && length < 26) ||
6471
1.30k
                ((protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
6472
1.05k
                  protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) && length < 28)) {
6473
647
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6474
647
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6475
647
                                       length, "SRv6 LAN End.X SID",
6476
647
                                       ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) ? 26 : 28);
6477
647
                break;
6478
647
            }
6479
1.04k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6480
1.04k
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 6,
6481
1.04k
                                   hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
6482
1.04k
                                   ett_bgp_link_state, srv6_endx_sid_flags, ENC_BIG_ENDIAN);
6483
1.04k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_algo, tvb, offset + 7, 1, ENC_NA);
6484
1.04k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_weight, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6485
1.04k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved, tvb, offset + 9, 1, ENC_BIG_ENDIAN);
6486
1.04k
            local_offset = offset + 10;
6487
1.04k
            if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6488
393
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf, tvb, local_offset, 4, ENC_BIG_ENDIAN);
6489
393
                local_offset += 4;
6490
655
            } else {
6491
                /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6492
655
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis, tvb, local_offset, 6, ENC_NA);
6493
655
                local_offset += 6;
6494
655
            }
6495
1.04k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_sid, tvb, local_offset, 16, ENC_NA);
6496
1.04k
            local_offset += 16;
6497
2.12k
            while (local_offset < offset + length) {
6498
1.07k
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6499
1.07k
                if (advance < 0) {
6500
0
                    break;
6501
0
                }
6502
1.07k
                local_offset += advance;
6503
1.07k
            }
6504
1.04k
            break;
6505
6506
1.78M
        case BGP_LS_APP_SPEC_LINK_ATTR:
6507
1.78M
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_app_spec_link_attrs, tvb, offset, length + 4, ENC_NA);
6508
1.78M
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6509
1.78M
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6510
1.78M
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6511
1.78M
            ti = proto_tree_add_item_ret_uint8(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len, tvb, offset + 4, 1, ENC_NA, &sabm_len);
6512
1.78M
            if (sabm_len != 0 && sabm_len != 4 && sabm_len != 8) {
6513
73.5k
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6514
73.5k
                                       "Unexpected SABM Length (%u) in BGP-LS Application-Specific Link Attributes TLV, it must be 0/4/8 bytes!",
6515
73.5k
                                       sabm_len);
6516
73.5k
                break;
6517
73.5k
            }
6518
1.71M
            ti = proto_tree_add_item_ret_uint8(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len, tvb, offset + 5, 1, ENC_NA, &udabm_len);
6519
1.71M
            if (udabm_len != 0 && udabm_len != 4 && udabm_len != 8) {
6520
18.1k
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6521
18.1k
                                       "Unexpected UDABM Length (%u) in BGP-LS Application Specific Link Attributes TLV, it must be 0/4/8 bytes!",
6522
18.1k
                                       sabm_len);
6523
18.1k
                break;
6524
18.1k
            }
6525
1.69M
            tmp16 = tvb_get_uint16(tvb, offset + 6, ENC_BIG_ENDIAN);
6526
1.69M
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6527
1.69M
            if (tmp16 != 0) {
6528
1.42M
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_warn,
6529
1.42M
                                       "Reserved field must be 0 in BGP-LS Application-Specific Link Attributes TLV");
6530
1.42M
            }
6531
1.69M
            if (sabm_len > 0) {
6532
19.6k
                static int * const app_spec_link_attrs_sabm[] = {
6533
19.6k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
6534
19.6k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
6535
19.6k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
6536
19.6k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
6537
19.6k
                    NULL
6538
19.6k
                };
6539
19.6k
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 8, hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
6540
19.6k
                                       ett_bgp_link_state, app_spec_link_attrs_sabm, ENC_BIG_ENDIAN);
6541
19.6k
            }
6542
1.69M
            if (udabm_len > 0) {
6543
21.8k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
6544
21.8k
                                    tvb, offset + 8 + sabm_len, udabm_len, ENC_NA);
6545
21.8k
            }
6546
            /* Decode Link Attribute sub-TLVs */
6547
1.69M
            local_offset = offset + 8 + sabm_len + udabm_len;
6548
5.00M
            while (local_offset < offset + length) {
6549
3.30M
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6550
3.30M
                if (advance < 0) {
6551
0
                    break;
6552
0
                }
6553
3.30M
                local_offset += advance;
6554
3.30M
            }
6555
1.69M
            break;
6556
6557
        /* Prefix Attribute TLVs */
6558
600
        case BGP_NLRI_TLV_IGP_FLAGS:
6559
600
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_flags, tvb, offset, length+4, ENC_NA);
6560
600
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6561
600
            if(length != BGP_NLRI_TLV_LEN_IGP_FLAGS){
6562
203
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IGP Flags TLV's length (%u), it must be %u bytes!",
6563
203
                                       length, BGP_NLRI_TLV_IGP_FLAGS);
6564
203
                break;
6565
203
            }
6566
397
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6567
397
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6568
397
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_flags_flag_d, tvb, offset + 4, 1, ENC_NA);
6569
397
            tmp8 = tvb_get_uint8(tvb, offset + 4) & 0x7F;
6570
397
            if(tmp8){
6571
202
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flags are not set to zero (%u).", tmp8);
6572
202
            }
6573
397
            break;
6574
6575
643
        case BGP_NLRI_TLV_ROUTE_TAG:
6576
643
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_tag, tvb, offset, length+4, ENC_NA);
6577
643
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6578
643
            if(length % 4 != 0) {
6579
196
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Tag TLV's length (%u mod 4 != 0) ",
6580
196
                                       length);
6581
196
                break;
6582
196
            }
6583
447
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6584
447
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6585
447
            tmp16 = length;
6586
447
            n = 0;
6587
894
            while(tmp16){
6588
447
                if(tmp16 < 4) {
6589
0
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Tag must be 4 bytes long (%u).", tmp16);
6590
0
                    break;
6591
0
                }
6592
447
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_tag_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
6593
447
                tmp16 -= 4;
6594
447
                n++;
6595
447
            }
6596
447
            break;
6597
6598
688
        case BGP_NLRI_TLV_EXTENDED_TAG:
6599
688
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_extended_tag, tvb, offset, length+4, ENC_NA);
6600
688
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6601
688
            if(length % 8 != 0) {
6602
196
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Extended Tag TLV's length (%u mod 8 != 0) ",
6603
196
                                       length);
6604
196
                break;
6605
196
            }
6606
492
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6607
492
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6608
492
            tmp16 = length;
6609
492
            n = 0;
6610
986
            while(tmp16){
6611
494
                if(tmp16 < 8) {
6612
0
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Extended Tag must be 8 bytes long (%u).", tmp16);
6613
0
                    break;
6614
0
                }
6615
494
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_extended_tag_value, tvb, offset + 4 + (n * 8), 8, ENC_BIG_ENDIAN);
6616
494
                tmp16 -= 8;
6617
494
                n++;
6618
494
            }
6619
492
            break;
6620
6621
533
        case BGP_NLRI_TLV_PREFIX_METRIC:
6622
533
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_prefix_metric, tvb, offset, length+4, ENC_NA);
6623
533
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6624
533
            if(length != BGP_NLRI_TLV_LEN_PREFIX_METRIC){
6625
339
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Prefix Metric TLV's length (%u), it must be %u bytes!",
6626
339
                                       length, BGP_NLRI_TLV_LEN_PREFIX_METRIC);
6627
339
                break;
6628
339
            }
6629
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6630
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6631
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_prefix_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6632
194
            break;
6633
6634
599
        case BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS:
6635
599
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_ospf_forwarding_address, tvb, offset, length+4, ENC_NA);
6636
599
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6637
599
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6638
599
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6639
599
            if (length == 4) {
6640
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv4_address, tvb, offset + 4, length, ENC_BIG_ENDIAN);
6641
194
            }
6642
405
            else if (length == 16) {
6643
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv6_address, tvb, offset + 4, length,  ENC_NA);
6644
194
            }
6645
211
            else {
6646
211
                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);
6647
211
                break;
6648
211
            }
6649
388
            break;
6650
6651
388
        case BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE:
6652
202
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_opaque_prefix_attribute, tvb, offset, length+4, ENC_NA);
6653
202
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6654
202
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6655
202
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6656
202
            proto_tree_add_item(tlv_tree, hf_bgp_ls_opaque_prefix_attribute_value, tvb, offset + 4, length, ENC_NA);
6657
202
            break;
6658
6659
507
        case BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP:
6660
507
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_extended_administrative_group, tvb, offset, length+4, ENC_NA);
6661
507
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6662
507
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6663
507
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6664
507
            if(length % 4 != 0) {
6665
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Extended Administrative Group TLV's length (%u mod 4 != 0)",
6666
194
                                       length);
6667
194
                break;
6668
194
            }
6669
313
            tmp16 = length;
6670
770
            while(tmp16){
6671
457
                proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
6672
457
                tmp16 -= 4;
6673
457
            }
6674
313
            break;
6675
6676
557
        case BGP_LS_SR_TLV_PREFIX_SID:
6677
557
            {
6678
                /*
6679
                   0  1  2  3  4  5  6  7
6680
                  +--+--+--+--+--+--+--+--+
6681
                  |R |N |P |E |V |L |  |  |
6682
                  +--+--+--+--+--+--+--+--+
6683
                */
6684
557
                static int * const prefix_sid_isis_flags[] = {
6685
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
6686
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
6687
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
6688
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
6689
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
6690
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
6691
557
                    NULL
6692
557
                };
6693
                /*
6694
                   0  1  2  3  4  5  6  7
6695
                  +--+--+--+--+--+--+--+--+
6696
                  |  |NP|M |E |V |L |  |  |
6697
                  +--+--+--+--+--+--+--+--+
6698
                */
6699
557
                static int * const prefix_sid_ospf_flags[] = {
6700
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
6701
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
6702
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
6703
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
6704
557
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
6705
557
                    NULL
6706
557
                };
6707
6708
557
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_sid, tvb, offset, length + 4, ENC_NA);
6709
557
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6710
557
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6711
557
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6712
557
                if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6713
260
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
6714
260
                                           ett_bgp_link_state, prefix_sid_ospf_flags, ENC_BIG_ENDIAN);
6715
297
                } else {
6716
                    /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6717
297
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
6718
297
                                           ett_bgp_link_state, prefix_sid_isis_flags, ENC_BIG_ENDIAN);
6719
297
                }
6720
557
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6721
557
                if (length == 7) {
6722
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6723
363
                } else {
6724
363
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6725
363
                }
6726
557
            }
6727
557
            break;
6728
6729
202
        case BGP_LS_SR_TLV_RANGE:
6730
202
            break;
6731
6732
464
        case BGP_LS_SR_TLV_SRV6_LOCATOR:
6733
464
            {
6734
464
                static int * const srv6_locator_flags[] = {
6735
464
                    &hf_bgp_ls_sr_tlv_srv6_locator_flags_d,
6736
464
                    &hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved,
6737
464
                    NULL
6738
464
                };
6739
464
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_locator, tvb, offset, length+4, ENC_NA);
6740
464
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6741
464
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6742
464
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6743
464
                if (length < 8) {
6744
260
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6745
260
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6746
260
                                           length, "SRv6 Locator", 8);
6747
260
                    break;
6748
260
                }
6749
204
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_srv6_locator_flags,
6750
204
                                       ett_bgp_link_state, srv6_locator_flags, ENC_NA);
6751
204
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6752
204
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6753
204
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_metric, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6754
204
            }
6755
0
            break;
6756
6757
1.11k
        case BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS:
6758
1.11k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_attr_flags, tvb, offset, length+4, ENC_NA);
6759
1.11k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6760
1.11k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6761
1.11k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6762
1.11k
            if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6763
                /* rfc7684, rfc9089 */
6764
404
                static int * const prefix_attr_ospf_flags[] = {
6765
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
6766
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
6767
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
6768
404
                    NULL
6769
404
                };
6770
404
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
6771
404
                                       ett_bgp_link_state, prefix_attr_ospf_flags, ENC_BIG_ENDIAN);
6772
706
            } else if (protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
6773
496
                       protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) {
6774
                /* rfc7794, rfc9088 */
6775
404
                static int * const prefix_attr_isis_flags[] = {
6776
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
6777
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
6778
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
6779
404
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
6780
404
                    NULL
6781
404
                };
6782
404
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
6783
404
                                       ett_bgp_link_state, prefix_attr_isis_flags, ENC_BIG_ENDIAN);
6784
404
            } else {
6785
302
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
6786
302
                                    tvb, offset + 4, tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN), ENC_NA);
6787
302
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
6788
302
                                       "Unknown Protocol-ID (%u) for Prefix Attribute Flags TLV",
6789
302
                                       protocol_id);
6790
302
            }
6791
1.11k
            break;
6792
6793
601
        case BGP_LS_SR_TLV_SOURCE_ROUTER_ID:
6794
601
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_source_router_id, tvb, offset, length+4, ENC_NA);
6795
601
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6796
601
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6797
601
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6798
601
            if (length == BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID) {
6799
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID, ENC_BIG_ENDIAN);
6800
407
            } else if (length == BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID) {
6801
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv6_router_id_value, tvb, offset + 4, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID, ENC_NA);
6802
213
            } else {
6803
213
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6804
213
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be either %u or %u bytes!",
6805
213
                                       length, "Source Router-ID",
6806
213
                                       BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID,
6807
213
                                       BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID);
6808
213
            }
6809
601
            break;
6810
6811
389
        case BGP_LS_SR_TLV_FLEX_ALGO_PREFIX_METRIC:
6812
389
            {
6813
                /* rfc9351, rfc9350 */
6814
389
                static int * const fapm_flags[] = {
6815
389
                    &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e,
6816
389
                    NULL
6817
389
                };
6818
389
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric, tvb, offset, length + 4, ENC_NA);
6819
389
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6820
389
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6821
389
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6822
389
                if (length != 8) {
6823
195
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6824
195
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be 8 bytes!",
6825
195
                                           length, "Flexible Algorithm Prefix Metric");
6826
195
                    break;
6827
195
                }
6828
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
6829
194
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 5, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags,
6830
194
                                       ett_bgp_link_state, fapm_flags, ENC_NA);
6831
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6832
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6833
194
                break;
6834
389
            }
6835
6836
        /* SID Attribute TLVs */
6837
394
        case BGP_LS_SR_TLV_SRV6_ENDPOINT_BEHAVIOR:
6838
394
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior, tvb, offset, length+4, ENC_NA);
6839
394
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6840
394
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6841
394
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6842
394
            if (length != 4) {
6843
200
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6844
200
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6845
200
                                       length, "SRv6 Endpoint Behavior", 4);
6846
200
                break;
6847
200
            }
6848
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6849
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
6850
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo, tvb, offset + 7, 1, ENC_BIG_ENDIAN);
6851
194
            break;
6852
6853
392
        case BGP_LS_SR_TLV_SRV6_SID_STRUCT:
6854
392
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_sid_struct, tvb, offset, length + 4, ENC_NA);
6855
392
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6856
392
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6857
392
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6858
392
            if (length != 4) {
6859
198
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6860
198
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6861
198
                                       length, "SRv6 SID Structure", 4);
6862
198
                break;
6863
198
            }
6864
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len, tvb, offset + 4, 1, ENC_NA);
6865
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len, tvb, offset + 5, 1, ENC_NA);
6866
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len, tvb, offset + 6, 1, ENC_NA);
6867
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len, tvb, offset + 7, 1, ENC_NA);
6868
194
            break;
6869
6870
195
        case BGP_LS_IGP_TE_METRIC_DELAY:
6871
195
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay, tvb, offset, length+4, ENC_NA);
6872
195
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6873
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6874
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6875
195
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6876
195
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6877
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6878
195
            break;
6879
291
        case BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX:
6880
291
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_min_max, tvb, offset, length+4, ENC_NA);
6881
291
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6882
291
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6883
291
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6884
291
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6885
291
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6886
291
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_min, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6887
291
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6888
291
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_max, tvb, offset + 9, 3, ENC_BIG_ENDIAN);
6889
291
            break;
6890
2.25k
        case BGP_LS_IGP_TE_METRIC_DELAY_VARIATION:
6891
2.25k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_variation, tvb, offset, length+4, ENC_NA);
6892
2.25k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6893
2.25k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6894
2.25k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6895
2.25k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6896
2.25k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_variation_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6897
2.25k
            break;
6898
194
        case BGP_LS_IGP_TE_METRIC_LOSS:
6899
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_link_loss, tvb, offset, length+4, ENC_NA);
6900
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6901
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6902
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6903
194
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6904
194
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6905
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_link_loss_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6906
194
            break;
6907
674
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL:
6908
674
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_residual, tvb, offset, length+4, ENC_NA);
6909
674
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6910
674
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6911
674
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6912
674
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_residual_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6913
674
            break;
6914
202
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE:
6915
202
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_available, tvb, offset, length+4, ENC_NA);
6916
202
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6917
202
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6918
202
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6919
202
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_available_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6920
202
            break;
6921
196
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED:
6922
196
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized, tvb, offset, length+4, ENC_NA);
6923
196
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6924
196
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6925
196
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6926
196
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6927
196
            break;
6928
6929
746k
        default:
6930
746k
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
6931
746k
                "Unknown BGP-LS Attribute TLV Code (%u)!", type);
6932
746k
            break;
6933
3.31M
    }
6934
3.31M
    decrement_dissection_depth(pinfo);
6935
3.31M
    return length + 4;
6936
3.31M
}
6937
6938
10.6k
static int decode_evpn_nlri_esi(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo) {
6939
10.6k
    uint8_t esi_type = 0;
6940
10.6k
    proto_tree *esi_tree;
6941
10.6k
    proto_item *ti;
6942
6943
10.6k
    ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri_esi, tvb, offset, 10, ENC_NA);
6944
10.6k
    esi_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri_esi);
6945
10.6k
    proto_tree_add_item_ret_uint8(esi_tree, hf_bgp_evpn_nlri_esi_type, tvb, offset, 1, ENC_BIG_ENDIAN, &esi_type);
6946
10.6k
    proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value, tvb, offset+1, 9, ENC_NA);
6947
10.6k
    switch (esi_type) {
6948
1.87k
        case BGP_NLRI_EVPN_ESI_VALUE :
6949
1.87k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value_type0, tvb,
6950
1.87k
                                offset+1, 9, ENC_NA);
6951
1.87k
            break;
6952
483
        case BGP_NLRI_EVPN_ESI_LACP :
6953
483
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_lacp_mac, tvb,
6954
483
                                offset+1, 6, ENC_NA);
6955
483
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_portk, tvb,
6956
483
                                offset+7, 2, ENC_BIG_ENDIAN);
6957
483
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6958
483
                                offset+9, 1, ENC_NA);
6959
483
            break;
6960
429
        case BGP_NLRI_EVPN_ESI_MSTP :
6961
429
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rb_mac, tvb,
6962
429
                                offset+1, 6, ENC_NA);
6963
429
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rbprio, tvb,
6964
429
                                offset+7, 2, ENC_BIG_ENDIAN);
6965
429
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6966
429
                                offset+9, 1, ENC_NA);
6967
429
            break;
6968
486
        case BGP_NLRI_EVPN_ESI_MAC :
6969
486
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_sys_mac, tvb,
6970
486
                                offset+1, 6, ENC_NA);
6971
486
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_mac_discr, tvb,
6972
486
                                offset+7, 2, ENC_NA);
6973
486
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6974
486
                                offset+9, 1, ENC_NA);
6975
486
            break;
6976
4.84k
        case BGP_NLRI_EVPN_ESI_RID :
6977
4.84k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_id, tvb,
6978
4.84k
                                offset+1, 4, ENC_BIG_ENDIAN);
6979
4.84k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_discr, tvb,
6980
4.84k
                                offset+5, 4, ENC_NA);
6981
4.84k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6982
4.84k
                                offset+9, 1, ENC_NA);
6983
4.84k
            break;
6984
232
        case BGP_NLRI_EVPN_ESI_ASN :
6985
232
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn, tvb,
6986
232
                                offset+1, 4, ENC_BIG_ENDIAN);
6987
232
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn_discr, tvb,
6988
232
                                offset+5, 4, ENC_NA);
6989
232
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6990
232
                                offset+9, 1, ENC_NA);
6991
232
            break;
6992
508
        case BGP_NLRI_EVPN_ESI_RES :
6993
508
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_reserved, tvb,
6994
508
                                offset+1, 9, ENC_NA);
6995
508
            break;
6996
1.75k
        default :
6997
1.75k
            expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_esi_type_err,
6998
1.75k
                                   "Invalid EVPN ESI (%u)!", esi_type);
6999
1.75k
            return (-1);
7000
10.6k
    }
7001
8.85k
    return 0;
7002
10.6k
}
7003
7004
/*
7005
 * Decode EVPN NLRI, RFC 7432 section 7.7
7006
 */
7007
21.5k
static int decode_evpn_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo) {
7008
21.5k
    int reader_offset = offset;
7009
21.5k
    int start_offset = offset+2;
7010
21.5k
    proto_tree *prefix_tree;
7011
21.5k
    proto_item *ti;
7012
21.5k
    uint8_t route_type;
7013
21.5k
    uint8_t nlri_len;
7014
21.5k
    uint8_t ip_len;
7015
21.5k
    uint32_t total_length = 0;
7016
21.5k
    uint32_t or_length;
7017
21.5k
    path_attr_data *data = NULL;
7018
21.5k
    proto_item *item;
7019
21.5k
    int ret;
7020
7021
21.5k
    route_type = tvb_get_uint8(tvb, offset);
7022
7023
21.5k
    nlri_len = tvb_get_uint8(tvb, offset + 1);
7024
7025
21.5k
    ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri, tvb, reader_offset,
7026
21.5k
                               nlri_len+2, ENC_NA);
7027
7028
21.5k
    prefix_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri);
7029
7030
21.5k
    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rt, tvb, reader_offset,
7031
21.5k
                        1, ENC_BIG_ENDIAN);
7032
21.5k
    proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, tvb_get_uint8(tvb, offset), evpnrtypevals, "Unknown capability %d"));
7033
    /* moving to next field */
7034
21.5k
    reader_offset++;
7035
7036
21.5k
    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_len, tvb, reader_offset,
7037
21.5k
                        1, ENC_BIG_ENDIAN);
7038
21.5k
    reader_offset++;
7039
7040
21.5k
    switch (route_type) {
7041
1.83k
    case EVPN_AD_ROUTE:
7042
    /*
7043
                +---------------------------------------+
7044
                |      RD   (8 octets)                  |
7045
                +---------------------------------------+
7046
                |Ethernet Segment Identifier (10 octets)|
7047
                +---------------------------------------+
7048
                |  Ethernet Tag ID (4 octets)           |
7049
                +---------------------------------------+
7050
                |  MPLS Label (3 octets)                |
7051
                +---------------------------------------+
7052
   */
7053
7054
1.83k
        if (nlri_len < 25) {
7055
289
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7056
289
                                   "Invalid length (%u) of EVPN NLRI Route Type 1 (Ethernet Auto-discovery Route)", nlri_len);
7057
289
            return -1;
7058
289
        }
7059
1.54k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7060
1.54k
                                   8, ENC_NA);
7061
1.54k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7062
1.54k
        reader_offset += 8;
7063
7064
1.54k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7065
1.54k
        reader_offset += 10;
7066
1.54k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7067
1.54k
                                   4, ENC_BIG_ENDIAN);
7068
1.54k
        reader_offset += 4;
7069
1.54k
        data = load_path_attr_data(pinfo);
7070
1.54k
        if (data && data->encaps_community_present &&
7071
628
                (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7072
413
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7073
413
            reader_offset += 3;
7074
1.13k
        } else {
7075
1.13k
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7076
1.13k
            reader_offset += 3;
7077
1.13k
        }
7078
1.54k
        total_length = reader_offset - offset;
7079
1.54k
        break;
7080
7081
4.73k
    case EVPN_MAC_ROUTE:
7082
/*
7083
        +---------------------------------------+
7084
        |      RD   (8 octets)                  |
7085
        +---------------------------------------+
7086
        |Ethernet Segment Identifier (10 octets)|
7087
        +---------------------------------------+
7088
        |  Ethernet Tag ID (4 octets)           |
7089
        +---------------------------------------+
7090
        |  MAC Address Length (1 octet)         |
7091
        +---------------------------------------+
7092
        |  MAC Address (6 octets)               |
7093
        +---------------------------------------+
7094
        |  IP Address Length (1 octet)          |
7095
        +---------------------------------------+
7096
        |  IP Address (0 or 4 or 16 octets)     |
7097
        +---------------------------------------+
7098
        |  MPLS Label1 (3 octets)               |
7099
        +---------------------------------------+
7100
        |  MPLS Label2 (0 or 3 octets)          |
7101
        +---------------------------------------+
7102
7103
*/
7104
7105
4.73k
        if (nlri_len < 33) {
7106
438
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7107
438
                                   "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7108
438
            return -1;
7109
438
        }
7110
4.29k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7111
4.29k
                                   8, ENC_NA);
7112
4.29k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7113
4.29k
        reader_offset += 8;
7114
7115
4.29k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7116
4.29k
        reader_offset += 10;
7117
7118
4.29k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7119
4.29k
                            4, ENC_BIG_ENDIAN);
7120
4.29k
        reader_offset += 4;
7121
7122
4.29k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_maclen, tvb, reader_offset,
7123
4.29k
                            1, ENC_BIG_ENDIAN);
7124
4.29k
        reader_offset += 1;
7125
7126
4.29k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mac_addr, tvb, reader_offset,
7127
4.29k
                            6, ENC_NA);
7128
4.29k
        reader_offset += 6;
7129
7130
4.29k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7131
4.29k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7132
4.29k
                            1, ENC_BIG_ENDIAN);
7133
4.29k
        reader_offset++;
7134
7135
4.29k
        if (ip_len == 4) {
7136
            /*IPv4 address*/
7137
140
            if (nlri_len < 37) {
7138
69
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7139
69
                                       "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7140
69
                return -1;
7141
69
            }
7142
71
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7143
71
                                4, ENC_BIG_ENDIAN);
7144
71
            reader_offset += 4;
7145
4.15k
        } else if (ip_len == 16) {
7146
            /*IPv6 address*/
7147
144
            if (nlri_len < 49) {
7148
74
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7149
74
                                       "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7150
74
                return -1;
7151
74
            }
7152
70
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7153
70
                                16, ENC_NA);
7154
70
            reader_offset += 16;
7155
4.01k
        } else if (ip_len == 0) {
7156
            /*IP not included*/
7157
3.64k
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset-1, 1);
7158
3.64k
        } else {
7159
361
            return -1;
7160
361
        }
7161
3.79k
        data = load_path_attr_data(pinfo);
7162
3.79k
        if (data && data->encaps_community_present &&
7163
1.45k
                (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7164
1.24k
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7165
1.24k
            reader_offset += 3;
7166
1.24k
            if (reader_offset - start_offset < nlri_len) {
7167
217
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7168
217
                reader_offset += 3;
7169
217
            }
7170
2.54k
        } else {
7171
2.54k
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7172
2.54k
            reader_offset += 3;
7173
            /* we check if we reached the end of the nlri reading fields one by one */
7174
            /* if not, the second optional label is in the payload */
7175
2.54k
            if (reader_offset - start_offset < nlri_len) {
7176
378
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls2, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7177
378
                reader_offset += 3;
7178
378
            }
7179
2.54k
        }
7180
3.79k
        total_length = reader_offset - offset;
7181
3.79k
        break;
7182
7183
1.66k
    case EVPN_INC_MCAST_TREE:
7184
/*
7185
        +---------------------------------------+
7186
        |      RD   (8 octets)                  |
7187
        +---------------------------------------+
7188
        |  Ethernet Tag ID (4 octets)           |
7189
        +---------------------------------------+
7190
        |  IP Address Length (1 octet)          |
7191
        +---------------------------------------+
7192
        |   Originating Router's IP Addr        |
7193
        |          (4 or 16 octets)             |
7194
        +---------------------------------------+
7195
*/
7196
7197
1.66k
        if (nlri_len < 13) {
7198
495
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7199
495
                                   "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7200
495
            return -1;
7201
495
        }
7202
1.16k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7203
1.16k
                                   8, ENC_NA);
7204
1.16k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7205
1.16k
        reader_offset += 8;
7206
7207
1.16k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7208
1.16k
                            4, ENC_BIG_ENDIAN);
7209
        /* move to next field */
7210
1.16k
        reader_offset += 4;
7211
1.16k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7212
1.16k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7213
1.16k
                            1, ENC_BIG_ENDIAN);
7214
1.16k
        reader_offset += 1;
7215
7216
1.16k
        if (ip_len == 4) {
7217
            /*IPv4 address*/
7218
410
            if (nlri_len < 17) {
7219
201
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7220
201
                                       "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7221
201
                return -1;
7222
201
            }
7223
209
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7224
209
                                4, ENC_BIG_ENDIAN);
7225
209
            reader_offset += 4;
7226
755
        } else if (ip_len == 16) {
7227
            /*IPv6 address*/
7228
293
            if (nlri_len < 29) {
7229
67
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7230
67
                                       "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7231
67
                return -1;
7232
67
            }
7233
226
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7234
226
                                16, ENC_NA);
7235
226
            reader_offset += 16;
7236
462
        } else if (ip_len == 0) {
7237
            /*IP not included*/
7238
330
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
7239
330
        } else {
7240
132
            return -1;
7241
132
        }
7242
765
        total_length = reader_offset - offset;
7243
765
        break;
7244
7245
1.35k
    case EVPN_ETH_SEGMENT_ROUTE:
7246
/*
7247
        +---------------------------------------+
7248
        |      RD   (8 octets)                  |
7249
        +---------------------------------------+
7250
        |Ethernet Segment Identifier (10 octets)|
7251
        +---------------------------------------+
7252
        |  IP Address Length (1 octet)          |
7253
        +---------------------------------------+
7254
        |   Originating Router's IP Addr        |
7255
        |          (4 or 16 octets)             |
7256
        +---------------------------------------+
7257
*/
7258
7259
1.35k
        if (nlri_len < 19) {
7260
350
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7261
350
                                   "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7262
350
            return -1;
7263
350
        }
7264
1.00k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7265
1.00k
                                   8, ENC_NA);
7266
1.00k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7267
1.00k
        reader_offset += 8;
7268
7269
1.00k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7270
        /* move to next field */
7271
1.00k
        reader_offset += 10;
7272
7273
1.00k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7274
1.00k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7275
1.00k
                            1, ENC_BIG_ENDIAN);
7276
1.00k
        reader_offset++;
7277
7278
1.00k
        if (ip_len == 4) {
7279
            /*IPv4 address*/
7280
264
            if (nlri_len < 23) {
7281
66
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7282
66
                                       "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7283
66
                return -1;
7284
66
            }
7285
198
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7286
198
                                4, ENC_BIG_ENDIAN);
7287
198
            reader_offset += 4;
7288
736
        } else if (ip_len == 16) {
7289
            /*IPv6 address*/
7290
137
            if (nlri_len < 35) {
7291
71
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7292
71
                                       "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7293
71
                return -1;
7294
71
            }
7295
66
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7296
66
                                16, ENC_NA);
7297
66
            reader_offset += 16;
7298
599
        } else if (ip_len == 0) {
7299
            /*IP not included*/
7300
440
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
7301
440
        } else {
7302
159
            return -1;
7303
159
        }
7304
704
        total_length = reader_offset - offset;
7305
704
        break;
7306
3.46k
    case EVPN_IP_PREFIX_ROUTE:
7307
7308
/*
7309
    +---------------------------------------+
7310
    |      RD   (8 octets)                  |
7311
    +---------------------------------------+
7312
    |Ethernet Segment Identifier (10 octets)|
7313
    +---------------------------------------+
7314
    |  Ethernet Tag ID (4 octets)           |
7315
    +---------------------------------------+
7316
    |  IP Prefix Length (1 octet)           |
7317
    +---------------------------------------+
7318
    |  IP Prefix (4 or 16 octets)           |
7319
    +---------------------------------------+
7320
    |  GW IP Address (4 or 16 octets)       |
7321
    +---------------------------------------+
7322
    |  MPLS Label (3 octets)                |
7323
    +---------------------------------------+
7324
*/
7325
7326
3.46k
        if (nlri_len < 26) {
7327
274
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7328
274
                                   "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7329
274
            return -1;
7330
274
        }
7331
3.18k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7332
3.18k
                                   8, ENC_NA);
7333
3.18k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7334
3.18k
        reader_offset += 8;
7335
7336
3.18k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7337
3.18k
        reader_offset += 10;
7338
7339
3.18k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7340
3.18k
                            4, ENC_BIG_ENDIAN);
7341
3.18k
        reader_offset += 4;
7342
7343
3.18k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_prefix_len, tvb, reader_offset,
7344
3.18k
                            1, ENC_BIG_ENDIAN);
7345
3.18k
        reader_offset++;
7346
7347
3.18k
        switch (nlri_len) {
7348
1.65k
            case 34 :
7349
                /* IPv4 address */
7350
1.65k
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7351
1.65k
                                    4, ENC_BIG_ENDIAN);
7352
1.65k
                reader_offset += 4;
7353
7354
1.65k
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv4_gtw, tvb, reader_offset,
7355
1.65k
                                    4, ENC_BIG_ENDIAN);
7356
1.65k
                reader_offset += 4;
7357
7358
1.65k
                data = load_path_attr_data(pinfo);
7359
1.65k
                if (data && data->encaps_community_present &&
7360
613
                        (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7361
398
                    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7362
1.25k
                } else {
7363
1.25k
                    decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
7364
1.25k
                }
7365
1.65k
                total_length = 36;
7366
1.65k
                break;
7367
879
            case 58 :
7368
                /* IPv6 address */
7369
879
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7370
879
                                    16, ENC_NA);
7371
879
                reader_offset += 16;
7372
7373
879
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_gtw, tvb, reader_offset,
7374
879
                                    16, ENC_NA);
7375
879
                reader_offset += 16;
7376
7377
879
                data = load_path_attr_data(pinfo);
7378
879
                if (data && data->encaps_community_present &&
7379
610
                        (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7380
397
                    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7381
482
                } else {
7382
482
                    decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
7383
482
                }
7384
879
                total_length = 60;
7385
879
                break;
7386
644
            default :
7387
644
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7388
644
                                       "Invalid length (%u) of EVPN NLRI Route Type 5 (IP Prefix Route)", nlri_len);
7389
644
                return -1;
7390
3.18k
        }
7391
2.45k
        break;
7392
7393
2.45k
    case EVPN_MC_ETHER_TAG_ROUTE:
7394
870
    case EVPN_IGMP_JOIN_ROUTE:
7395
1.29k
    case EVPN_IGMP_LEAVE_ROUTE:
7396
3.77k
    case EVPN_S_PMSI_A_D_ROUTE:
7397
/*
7398
          +---------------------------------------+
7399
          |  RD (8 octets)                        |
7400
          +---------------------------------------+
7401
          |  Ethernet Tag ID (4 octets)           |
7402
          +---------------------------------------+
7403
          |  Multicast Source Length (1 octet)    |
7404
          +---------------------------------------+
7405
          |  Multicast Source Address (variable)  |
7406
          +---------------------------------------+
7407
          |  Multicast Group Length (1 octet)     |
7408
          +---------------------------------------+
7409
          |  Multicast Group Address (Variable)   |
7410
          +---------------------------------------+
7411
          |  Originator Router Length (1 octet)   |
7412
          +---------------------------------------+
7413
          |  Originator Router Address (variable) |
7414
          +---------------------------------------+
7415
          |  Flags (1 octets) (optional)          |
7416
          +---------------------------------------+
7417
7418
          +--------------------------------------------------+
7419
          |  RD (8 octets)                                   |
7420
          +--------------------------------------------------+
7421
          |  Ethernet Segment Identifier (10 octets)         |
7422
          +--------------------------------------------------+
7423
          |  Ethernet Tag ID  (4 octets)                     |
7424
          +--------------------------------------------------+
7425
          |  Multicast Source Length (1 octet)               |
7426
          +--------------------------------------------------+
7427
          |  Multicast Source Address (variable)             |
7428
          +--------------------------------------------------+
7429
          |  Multicast Group Length (1 octet)                |
7430
          +--------------------------------------------------+
7431
          |  Multicast Group Address (Variable)              |
7432
          +--------------------------------------------------+
7433
          |  Originator Router Length (1 octet)              |
7434
          +--------------------------------------------------+
7435
          |  Originator Router Address (variable)            |
7436
          +--------------------------------------------------+
7437
          |  Flags (1 octet)                                 |
7438
          +--------------------------------------------------+
7439
7440
          +--------------------------------------------------+
7441
          |  RD (8 octets)                                   |
7442
          +--------------------------------------------------+
7443
          |  Ethernet Segment Identifier (10 octets)         |
7444
          +--------------------------------------------------+
7445
          |  Ethernet Tag ID  (4 octets)                     |
7446
          +--------------------------------------------------+
7447
          |  Multicast Source Length (1 octet)               |
7448
          +--------------------------------------------------+
7449
          |  Multicast Source Address (variable)             |
7450
          +--------------------------------------------------+
7451
          |  Multicast Group Length (1 octet)                |
7452
          +--------------------------------------------------+
7453
          |  Multicast Group Address (Variable)              |
7454
          +--------------------------------------------------+
7455
          |  Originator Router Length (1 octet)              |
7456
          +--------------------------------------------------+
7457
          |  Originator Router Address (variable)            |
7458
          +--------------------------------------------------+
7459
          |  Reserved (4 octets)                             |
7460
          +--------------------------------------------------+
7461
          |  Maximum Response Time (1 octet)                 |
7462
          +--------------------------------------------------+
7463
          |  Flags (1 octet)                                 |
7464
          +--------------------------------------------------+
7465
*/
7466
7467
3.77k
        if (nlri_len < 15) {
7468
407
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7469
407
                                   "Invalid length (%u) of EVPN NLRI Route Type %u", nlri_len, route_type);
7470
407
            return -1;
7471
407
        }
7472
3.36k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7473
3.36k
                                   8, ENC_NA);
7474
3.36k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7475
3.36k
        reader_offset += 8;
7476
7477
3.36k
        if (route_type == EVPN_IGMP_JOIN_ROUTE || route_type == EVPN_IGMP_LEAVE_ROUTE) {
7478
606
            decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7479
606
            reader_offset += 10;
7480
606
        }
7481
7482
3.36k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7483
3.36k
                            4, ENC_BIG_ENDIAN);
7484
3.36k
        reader_offset += 4;
7485
7486
3.36k
        ret = decode_mcast_vpn_nlri_addresses(prefix_tree, tvb, reader_offset);
7487
3.36k
        if (ret < 0)
7488
797
            return -1;
7489
7490
2.56k
        reader_offset = ret;
7491
2.56k
        proto_tree_add_item_ret_uint(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_length, tvb,
7492
2.56k
                                     reader_offset, 1, ENC_BIG_ENDIAN, &or_length);
7493
2.56k
        reader_offset += 1;
7494
2.56k
        switch(or_length) {
7495
361
            case 32:
7496
361
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4, tvb,
7497
361
                                    reader_offset, 4, ENC_BIG_ENDIAN);
7498
361
                reader_offset += 4;
7499
361
                break;
7500
809
            case 128:
7501
809
                 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6, tvb,
7502
809
                                     reader_offset, 16, ENC_NA);
7503
809
                 reader_offset += 16;
7504
809
                 break;
7505
2.56k
        }
7506
7507
2.51k
        if (route_type == EVPN_IGMP_LEAVE_ROUTE) {
7508
75
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_reserved, tvb,
7509
75
                                reader_offset, 4, ENC_NA);
7510
75
            reader_offset += 4;
7511
7512
            /* Maximum Response Time, per RFC2236 (IGMPv2)
7513
             * XXX - What if this is the max response time from RFC3376 (IGMPv3)?
7514
             */
7515
75
            uint8_t tsecs = tvb_get_uint8(tvb, offset);
7516
75
            proto_tree_add_uint_format_value(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_max_resp_time, tvb,
7517
75
                                             reader_offset, 1, tsecs, "%.1f sec (0x%02x)", tsecs*0.1, tsecs);
7518
7519
75
            reader_offset += 1;
7520
75
        }
7521
7522
2.51k
        if (reader_offset - start_offset < nlri_len) {
7523
1.34k
            proto_tree_add_bitmask(prefix_tree, tvb, reader_offset, hf_bgp_evpn_nlri_igmp_mc_flags,
7524
1.34k
                                   ett_bgp_evpn_nlri_mc, evpn_nlri_igmp_mc_flags, ENC_BIG_ENDIAN);
7525
1.34k
            reader_offset += 1;
7526
1.34k
        }
7527
2.51k
        total_length = reader_offset - offset;
7528
2.51k
        break;
7529
7530
4.73k
    default:
7531
4.73k
        expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_rt_type_err,
7532
4.73k
                               "Invalid EVPN Route Type (%u)", route_type);
7533
4.73k
        return -1;
7534
21.5k
    }
7535
7536
11.6k
    return total_length;
7537
21.5k
}
7538
7539
2.58k
static int decode_bgp_mup_nlri_variable_prefix(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint16_t afi) {
7540
7541
2.58k
    int reader_offset = offset;
7542
2.58k
    uint32_t total_length = 0;
7543
7544
2.58k
    int         byte_length;
7545
2.58k
    ws_in4_addr ipv4_prefix;
7546
2.58k
    address     ipv4_prefix_addr;
7547
2.58k
    ws_in6_addr ipv6_prefix;
7548
2.58k
    address     ipv6_prefix_addr;
7549
2.58k
    char        *prefix_str;
7550
2.58k
    uint8_t     prefix_length;
7551
7552
2.58k
    prefix_length = tvb_get_uint8(tvb, reader_offset);
7553
2.58k
    proto_tree_add_item(tree, hf_bgp_mup_nlri_prefixlen, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7554
2.58k
    reader_offset++;
7555
7556
2.58k
    switch (afi) {
7557
819
    case AFNUM_IP:
7558
819
        byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &ipv4_prefix, prefix_length);
7559
819
        if (byte_length == -1) {
7560
378
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, reader_offset,
7561
378
                                         "IPv4 prefix has an invalid length: %d bits", prefix_length);
7562
378
            return -1;
7563
378
        }
7564
441
        set_address(&ipv4_prefix_addr, AT_IPv4, 4, &ipv4_prefix);
7565
441
        prefix_str = address_to_str(pinfo->pool, &ipv4_prefix_addr);
7566
441
        proto_tree_add_ipv4_format_value(tree, hf_bgp_mup_nlri_ip_prefix, tvb, reader_offset, byte_length,
7567
441
                                         ipv4_prefix, "%s/%d", prefix_str, prefix_length);
7568
441
        reader_offset += byte_length;
7569
441
        break;
7570
7571
1.76k
    case AFNUM_IP6:
7572
1.76k
        byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, reader_offset, &ipv6_prefix, prefix_length);
7573
1.76k
        if (byte_length == -1) {
7574
860
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, reader_offset,
7575
860
                                         "IPv6 prefix has an invalid length: %d bits", prefix_length);
7576
860
            return -1;
7577
860
        }
7578
902
        set_address(&ipv6_prefix_addr, AT_IPv6, 16, ipv6_prefix.bytes);
7579
902
        prefix_str = address_to_str(pinfo->pool, &ipv6_prefix_addr);
7580
902
        proto_tree_add_ipv6_format_value(tree, hf_bgp_mup_nlri_ipv6_prefix, tvb, reader_offset, byte_length,
7581
902
                                         &ipv6_prefix, "%s/%d", prefix_str, prefix_length);
7582
902
        reader_offset += byte_length;
7583
902
        break;
7584
2.58k
    }
7585
1.34k
    total_length = reader_offset - offset;
7586
1.34k
    return total_length;
7587
2.58k
}
7588
7589
7590
static int decode_bgp_mup_nlri_type1_st_route(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7591
1.86k
                                              uint16_t afi, uint8_t architecture_type) {
7592
    /*
7593
        +-----------------------------------+
7594
        |           RD  (8 octets)          |
7595
        +-----------------------------------+
7596
        |      Prefix Length (1 octet)      |
7597
        +-----------------------------------+
7598
        |         Prefix (variable)         |
7599
        +-----------------------------------+
7600
        | Architecture specific (variable)  |
7601
        +-----------------------------------+
7602
    */
7603
1.86k
    int reader_offset = offset;
7604
1.86k
    uint32_t total_length = 0;
7605
7606
1.86k
    proto_item  *item;
7607
1.86k
    uint8_t     endpoint_address_length;
7608
1.86k
    uint8_t     source_address_length;
7609
1.86k
    proto_item  *arch_spec_item;
7610
1.86k
    proto_tree  *arch_spec_tree;
7611
1.86k
    int         arch_spec_byte;
7612
7613
1.86k
    item = proto_tree_add_item(tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7614
1.86k
    proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7615
1.86k
    reader_offset += 8;
7616
7617
1.86k
    reader_offset += decode_bgp_mup_nlri_variable_prefix(tree, tvb, reader_offset, pinfo, afi);
7618
7619
1.86k
    switch (architecture_type) {
7620
1.46k
    case BGP_MUP_AT_3GPP_5G:
7621
        /*
7622
            +-----------------------------------1
7623
            |          TEID (4 octets)          |
7624
            +-----------------------------------+
7625
            |          QFI (1 octet)            |
7626
            +-----------------------------------+
7627
            | Endpoint Address Length (1 octet) |
7628
            +-----------------------------------+
7629
            |    Endpoint Address (variable)    |
7630
            +-----------------------------------+
7631
            |  Source Address Length (1 octet)  |
7632
            +-----------------------------------+
7633
            |     Source Address (variable)     |
7634
            +-----------------------------------+
7635
        */
7636
1.46k
        endpoint_address_length = tvb_get_uint8(tvb, reader_offset+5); // should be multiple of 8
7637
1.46k
        source_address_length = tvb_get_uint8(tvb, reader_offset + 6 + endpoint_address_length/8); // should be zero or multiple of 8
7638
1.46k
        arch_spec_byte = 7 + endpoint_address_length/8 + source_address_length/8;
7639
7640
1.46k
        arch_spec_item = proto_tree_add_item(tree, hf_bgp_mup_nlri_3gpp_5g_type1_st_route, tvb, reader_offset, arch_spec_byte, ENC_NA);
7641
1.46k
        arch_spec_tree = proto_item_add_subtree(arch_spec_item, ett_bgp_mup_nlri_3gpp_5g_type1_st_route);
7642
7643
1.46k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_teid, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7644
1.46k
        reader_offset += 4;
7645
7646
1.46k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_qfi, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7647
1.46k
        reader_offset++;
7648
7649
1.46k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_addr_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7650
1.46k
        reader_offset++;
7651
7652
1.46k
        if (endpoint_address_length==32) {
7653
404
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7654
404
            reader_offset += 4;
7655
1.06k
        } else if (endpoint_address_length==128) {
7656
891
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7657
891
            reader_offset += 16;
7658
891
        } else {
7659
170
            expert_add_info_format(pinfo, arch_spec_tree, &ei_bgp_mup_nlri_addr_len_err,
7660
170
                                   "Invalid length (%u) of Endpoint Address Length", endpoint_address_length);
7661
170
            return -1;
7662
170
        }
7663
1.29k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_addr_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7664
1.29k
        reader_offset++;
7665
1.29k
        if (source_address_length==0) {
7666
            /* Source Address Length of 0 means the Source Address is not carried within the NLRI. */
7667
766
        } else if (source_address_length==32) {
7668
291
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7669
291
            reader_offset += 4;
7670
475
        } else if (source_address_length==128) {
7671
292
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7672
292
            reader_offset += 16;
7673
292
        } else {
7674
183
            expert_add_info_format(pinfo, arch_spec_tree, &ei_bgp_mup_nlri_addr_len_err,
7675
183
                                   "Invalid length (%u) of Source Address Length", source_address_length);
7676
183
            return -1;
7677
183
        }
7678
1.11k
        break;
7679
1.11k
    default:
7680
        /* return error because the length is unknown */
7681
400
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_mup_unknown_at, tvb, reader_offset,
7682
400
                                     "Architecture specific type 1 ST route for unknown architecture type: %d", architecture_type);
7683
400
        return -1;
7684
1.86k
    }
7685
7686
1.10k
    total_length = reader_offset - offset;
7687
1.10k
    return total_length;
7688
1.86k
}
7689
7690
static int decode_bgp_mup_nlri_type2_st_route(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7691
1.34k
                                              uint16_t afi, uint8_t architecture_type) {
7692
    /*
7693
        +-----------------------------------+
7694
        |           RD  (8 octets)          |
7695
        +-----------------------------------+
7696
        |      Endpoint Length (1 octet)    |
7697
        +-----------------------------------+
7698
        |      Endpoint Address (variable)  |
7699
        +-----------------------------------+
7700
        | Architecture specific Endpoint    |
7701
        |         Identifier (variable)     |
7702
        +-----------------------------------+
7703
    */
7704
1.34k
    int reader_offset = offset;
7705
1.34k
    uint32_t total_length = 0;
7706
7707
1.34k
    proto_item  *rd_pi;
7708
1.34k
    int         byte_length = 0;
7709
1.34k
    ws_in4_addr ipv4_prefix;
7710
1.34k
    address     ipv4_prefix_addr;
7711
1.34k
    ws_in6_addr ipv6_prefix;
7712
1.34k
    address     ipv6_prefix_addr;
7713
1.34k
    char        *prefix_str;
7714
1.34k
    uint8_t     prefix_length = 0;
7715
1.34k
    uint8_t     endpoint_length = 0;
7716
7717
1.34k
    uint8_t     arch_spec_endpoint_length = 0;
7718
1.34k
    proto_item  *arch_spec_item;
7719
1.34k
    proto_tree  *arch_spec_tree;
7720
1.34k
    uint32_t    arch_spec_3gpp_5g_teid;
7721
7722
1.34k
    rd_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7723
1.34k
    proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7724
1.34k
    reader_offset += 8;
7725
7726
1.34k
    endpoint_length = tvb_get_uint8(tvb, reader_offset);
7727
1.34k
    proto_tree_add_item(tree, hf_bgp_mup_nlri_ep_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7728
1.34k
    reader_offset++;
7729
7730
1.34k
    switch (afi) {
7731
865
    case AFNUM_IP:
7732
865
        prefix_length = endpoint_length>32 ? 32 : endpoint_length;
7733
865
        byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &ipv4_prefix, prefix_length);
7734
865
        set_address(&ipv4_prefix_addr, AT_IPv4, 4, &ipv4_prefix);
7735
865
        prefix_str = address_to_str(pinfo->pool, &ipv4_prefix_addr);
7736
7737
865
        proto_tree_add_ipv4_format_value(tree, hf_bgp_mup_nlri_ep_ip_addr, tvb, reader_offset, byte_length,
7738
865
                                         ipv4_prefix, "%s/%d", prefix_str, prefix_length);
7739
865
        reader_offset += byte_length;
7740
7741
865
        if (endpoint_length>32) {
7742
454
            arch_spec_endpoint_length = endpoint_length - 32;
7743
454
        }
7744
865
        break;
7745
481
    case AFNUM_IP6:
7746
481
        prefix_length = endpoint_length>128 ? 128 : endpoint_length;
7747
481
        byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, reader_offset, &ipv6_prefix, prefix_length);
7748
481
        set_address(&ipv6_prefix_addr, AT_IPv6, 16, ipv6_prefix.bytes);
7749
481
        prefix_str = address_to_str(pinfo->pool, &ipv6_prefix_addr);
7750
7751
481
        proto_tree_add_ipv6_format_value(tree, hf_bgp_mup_nlri_ep_ipv6_addr, tvb, reader_offset, byte_length,
7752
481
                        &ipv6_prefix, "%s/%d", prefix_str, prefix_length);
7753
481
        reader_offset += byte_length;
7754
7755
481
        if (endpoint_length>128) {
7756
216
            arch_spec_endpoint_length = endpoint_length - 128;
7757
216
        }
7758
481
        break;
7759
1.34k
    }
7760
1.33k
    if (arch_spec_endpoint_length>0) {
7761
670
        switch (architecture_type) {
7762
299
        case BGP_MUP_AT_3GPP_5G:
7763
            /*
7764
            +-----------------------------------+
7765
            |          TEID (0-4 octets)        |
7766
            +-----------------------------------+
7767
            */
7768
299
            byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &arch_spec_3gpp_5g_teid, arch_spec_endpoint_length);
7769
7770
299
            arch_spec_item = proto_tree_add_item(tree, hf_bgp_mup_nlri_3gpp_5g_type2_st_route, tvb, reader_offset, byte_length, ENC_NA);
7771
299
            arch_spec_tree = proto_item_add_subtree(arch_spec_item, ett_bgp_mup_nlri_3gpp_5g_type2_st_route);
7772
299
            proto_tree_add_uint_format_value(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_teid, tvb, reader_offset, byte_length, arch_spec_3gpp_5g_teid,
7773
299
                                            "0x%08x/%d", g_ntohl(arch_spec_3gpp_5g_teid), arch_spec_endpoint_length);
7774
299
            reader_offset += byte_length;
7775
299
            break;
7776
371
        default:
7777
            /* for unknown architecture types, just decode as binary */
7778
371
            byte_length = (arch_spec_endpoint_length-1)/8 + 1;
7779
371
            proto_tree_add_item(tree, hf_bgp_mup_nlri_unknown_data, tvb, reader_offset, byte_length, ENC_NA);
7780
371
            reader_offset += byte_length;
7781
7782
371
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_mup_unknown_at, tvb, reader_offset,
7783
371
                                         "Architecture specific type 2 ST route for unknown architecture type: %d", architecture_type);
7784
371
            break;
7785
670
        }
7786
670
    }
7787
7788
1.31k
    total_length = reader_offset - offset;
7789
1.31k
    return total_length;
7790
1.33k
}
7791
7792
/* draft-mpmz-bess-mup-safi-00 */
7793
18.6k
static int decode_bgp_mup_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint16_t afi) {
7794
7795
18.6k
    int reader_offset = offset;
7796
7797
18.6k
    proto_tree *prefix_tree;
7798
18.6k
    proto_item *nlri_pi;
7799
18.6k
    proto_item *rd_pi;
7800
18.6k
    uint8_t architecture_type;
7801
18.6k
    uint16_t route_type;
7802
18.6k
    uint8_t nlri_len;
7803
7804
18.6k
    int decoded_length = 0;
7805
7806
18.6k
    architecture_type = tvb_get_uint8(tvb, offset);
7807
18.6k
    route_type = tvb_get_uint16(tvb, offset + 1, ENC_BIG_ENDIAN);
7808
18.6k
    nlri_len = tvb_get_uint8(tvb, offset + 3);
7809
7810
18.6k
    nlri_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri, tvb, reader_offset, nlri_len+4, ENC_NA);
7811
7812
18.6k
    prefix_tree = proto_item_add_subtree(nlri_pi, ett_bgp_mup_nlri);
7813
7814
18.6k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_at, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7815
18.6k
    proto_item_append_text(nlri_pi, ": %s", val_to_str(pinfo->pool, architecture_type, bgp_mup_architecture_types,
7816
18.6k
                           "Unknown architecture type %d"));
7817
18.6k
    reader_offset++;
7818
7819
18.6k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rt, tvb, reader_offset, 2, ENC_BIG_ENDIAN);
7820
18.6k
    proto_item_append_text(nlri_pi, ": %s", val_to_str(pinfo->pool, route_type, bgp_mup_route_types,
7821
18.6k
                           "Unknown route type %d"));
7822
18.6k
    reader_offset += 2;
7823
7824
18.6k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7825
18.6k
    reader_offset++;
7826
7827
18.6k
    switch (route_type) {
7828
725
    case BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY:
7829
        /*
7830
         +-----------------------------------+
7831
         |           RD  (8 octets)          |
7832
         +-----------------------------------+
7833
         |       Prefix Length (1 octet)     |
7834
         +-----------------------------------+
7835
         |        Prefix (variable)          |
7836
         +-----------------------------------+
7837
        */
7838
725
        rd_pi = proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7839
725
        proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7840
725
        reader_offset += 8;
7841
7842
725
        decoded_length = decode_bgp_mup_nlri_variable_prefix(prefix_tree, tvb, reader_offset, pinfo, afi);
7843
725
        if (decoded_length < 0) {
7844
245
            return -1;
7845
245
        }
7846
480
        break;
7847
7848
530
    case BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY:
7849
        /*
7850
         +-----------------------------------+
7851
         |           RD  (8 octets)          |
7852
         +-----------------------------------+
7853
         |        Address (4 or 16 octets)   |
7854
         +-----------------------------------+
7855
        */
7856
530
        rd_pi = proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7857
530
        proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7858
530
        reader_offset += 8;
7859
530
        switch (afi) {
7860
215
        case AFNUM_IP:
7861
215
            proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7862
215
            break;
7863
315
        case AFNUM_IP6:
7864
315
            proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7865
315
            break;
7866
530
        }
7867
521
        break;
7868
7869
1.86k
    case BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED:
7870
1.86k
        decoded_length = decode_bgp_mup_nlri_type1_st_route(prefix_tree, tvb, reader_offset, pinfo, afi, architecture_type);
7871
1.86k
        if (decoded_length < 0) {
7872
750
            return -1;
7873
750
        }
7874
1.11k
        break;
7875
7876
1.34k
    case BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED:
7877
1.34k
        decoded_length = decode_bgp_mup_nlri_type2_st_route(prefix_tree, tvb, reader_offset, pinfo, afi, architecture_type);
7878
1.34k
        if (decoded_length < 0) {
7879
0
            return -1;
7880
0
        }
7881
1.34k
        break;
7882
7883
14.1k
    default:
7884
        /* for unknown route types, just decode as binary */
7885
14.1k
        proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_unknown_data, tvb, reader_offset, nlri_len, ENC_NA);
7886
14.1k
        reader_offset += nlri_len;
7887
14.1k
        proto_tree_add_expert_format_remaining(prefix_tree, pinfo, &ei_bgp_mup_unknown_rt, tvb, reader_offset,
7888
14.1k
                                     "Unknown route type: %d", route_type);
7889
14.1k
        break;
7890
18.6k
    }
7891
7892
17.5k
    return nlri_len+4;
7893
18.6k
}
7894
7895
7896
/*
7897
 * Decode a multiprotocol prefix
7898
 */
7899
static int
7900
decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
7901
                 uint16_t afi, uint8_t safi, int tlen, tvbuff_t *tvb, unsigned offset,
7902
                 const char *tag, packet_info *pinfo)
7903
174k
{
7904
174k
    int                 start_offset = offset;
7905
174k
    proto_item          *ti;
7906
174k
    proto_tree          *prefix_tree;
7907
174k
    proto_item          *nlri_ti;
7908
174k
    proto_tree          *nlri_tree;
7909
174k
    proto_item          *disting_item;
7910
174k
    proto_tree          *disting_tree;
7911
7912
174k
    int                 total_length=0;     /* length of the entire item */
7913
174k
    int                 length;             /* length of the prefix address, in bytes */
7914
174k
    int                 tmp_length;
7915
174k
    unsigned            plen;               /* length of the prefix address, in bits */
7916
174k
    unsigned            labnum;             /* number of labels             */
7917
174k
    uint16_t            tnl_id;             /* Tunnel Identifier */
7918
174k
    ws_in4_addr         ip4addr;            /* IPv4 address                 */
7919
174k
    address addr;
7920
174k
    ws_in6_addr         ip6addr;            /* IPv6 address                 */
7921
174k
    uint16_t            nlri_type;          /* NLRI Type                    */
7922
174k
    uint16_t            tmp16;
7923
174k
    uint32_t            path_identifier=0;
7924
174k
    int                 end=0;              /* Message End                  */
7925
7926
174k
    wmem_strbuf_t      *stack_strbuf;       /* label stack                  */
7927
174k
    wmem_strbuf_t      *comm_strbuf;
7928
7929
174k
    switch (afi) {
7930
7931
77.5k
    case AFNUM_IP:
7932
77.5k
        switch (safi) {
7933
7934
3.33k
            case SAFNUM_UNICAST:
7935
33.8k
            case SAFNUM_MULCAST:
7936
34.6k
            case SAFNUM_UNIMULC:
7937
                /* parse each prefix */
7938
7939
34.6k
                end = offset + tlen;
7940
7941
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
7942
34.6k
                if( detect_add_path_prefix4(tvb, offset, end) ) {
7943
                    /* IPv4 prefixes with Path Id */
7944
320
                    total_length = decode_path_prefix4(tree, pinfo, hf_path_id, hf_addr4, tvb, offset, tag);
7945
34.3k
                } else {
7946
34.3k
                    total_length = decode_prefix4(tree, pinfo, NULL,hf_addr4, tvb, offset, tag);
7947
34.3k
                }
7948
34.6k
                if (total_length < 0)
7949
532
                    return -1;
7950
34.1k
                break;
7951
7952
34.1k
            case SAFNUM_MPLS_LABEL:
7953
933
                end = offset + tlen;
7954
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
7955
933
                if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
7956
                    /* snarf path identifier */
7957
130
                    path_identifier = tvb_get_ntohl(tvb, offset);
7958
130
                    offset += 4;
7959
130
                    total_length += 4;
7960
130
                }
7961
                /* snarf length */
7962
933
                plen =  tvb_get_uint8(tvb, offset);
7963
933
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
7964
933
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
7965
7966
933
                offset += (1 + labnum * 3);
7967
933
                if (plen < (labnum * 3*8)) {
7968
202
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
7969
202
                                        "%s Labeled IPv4 prefix length %u invalid",
7970
202
                                        tag, plen);
7971
202
                    return -1;
7972
202
                }
7973
731
                plen -= (labnum * 3*8);
7974
731
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
7975
731
                if (length < 0) {
7976
174
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
7977
174
                                        "%s Labeled IPv4 prefix length %u invalid",
7978
174
                                        tag, plen + (labnum * 3*8));
7979
174
                    return -1;
7980
174
                }
7981
7982
557
                set_address(&addr, AT_IPv4, 4, &ip4addr);
7983
557
                if (total_length > 0) {
7984
102
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
7985
102
                                         (offset + length) - start_offset,
7986
102
                                         ett_bgp_prefix, NULL,
7987
102
                                         "Label Stack=%s IPv4=%s/%u PathID %u",
7988
102
                                         wmem_strbuf_get_str(stack_strbuf),
7989
102
                                         address_to_str(pinfo->pool, &addr), plen, path_identifier);
7990
102
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
7991
102
                    start_offset += 4;
7992
455
                } else {
7993
455
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
7994
455
                                        (offset + length) - start_offset,
7995
455
                                        ett_bgp_prefix, NULL,
7996
455
                                        "Label Stack=%s IPv4=%s/%u",
7997
455
                                        wmem_strbuf_get_str(stack_strbuf),
7998
455
                                        address_to_str(pinfo->pool, &addr), plen);
7999
455
                }
8000
557
                proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
8001
557
                                        "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
8002
557
                proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
8003
557
                                        "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
8004
557
                total_length += (1 + labnum*3) + length;
8005
557
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
8006
557
                break;
8007
4.88k
            case SAFNUM_MCAST_VPN:
8008
4.88k
                total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
8009
4.88k
                if (total_length < 0)
8010
437
                    return -1;
8011
4.44k
                break;
8012
4.44k
            case SAFNUM_MDT:
8013
653
                total_length = decode_mdt_safi(pinfo, tree, tvb, offset);
8014
653
                if (total_length < 0)
8015
290
                    return -1;
8016
363
                break;
8017
1.33k
            case SAFNUM_ROUTE_TARGET:
8018
1.33k
                plen = tvb_get_uint8(tvb, offset);
8019
8020
1.33k
                if (plen == 0) {
8021
365
                    proto_tree_add_string(tree, hf_bgp_wildcard_route_target, tvb, offset, 1, tag);
8022
365
                    total_length = 1;
8023
365
                    break;
8024
365
                }
8025
8026
974
                if ((plen < 32) || (plen > 96)) {
8027
178
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8028
178
                                        "%s Route target length %u invalid",
8029
178
                                        tag, plen);
8030
178
                    return -1;
8031
178
                }
8032
8033
796
                length = (plen + 7)/8;
8034
796
                comm_strbuf = wmem_strbuf_create(pinfo->pool);
8035
8036
796
                switch (tvb_get_ntohs(tvb, offset + 1 + 4)) {
8037
194
                case BGP_EXT_COM_RT_AS2:
8038
194
                    wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
8039
194
                                              tvb_get_ntohs(tvb, offset + 1 + 6),
8040
194
                                              tvb_get_ntohl(tvb, offset + 1 + 8));
8041
194
                    break;
8042
98
                case BGP_EXT_COM_RT_IP4:
8043
98
                    wmem_strbuf_append_printf(comm_strbuf, "%s:%u",
8044
98
                                              tvb_ip_to_str(pinfo->pool, tvb, offset + 1 + 6),
8045
98
                                              tvb_get_ntohs(tvb, offset + 1 + 10));
8046
98
                    break;
8047
196
                case BGP_EXT_COM_RT_AS4:
8048
196
                    wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
8049
196
                                              tvb_get_ntohl(tvb, 6),
8050
196
                                              tvb_get_ntohs(tvb, offset + 1 + 10));
8051
196
                    break;
8052
284
                default:
8053
284
                    wmem_strbuf_append_printf(comm_strbuf, "Invalid RT type");
8054
284
                    break;
8055
796
                }
8056
753
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset + 1, length,
8057
753
                                    ett_bgp_prefix, NULL, "%s %u:%s/%u",
8058
753
                                    tag, tvb_get_ntohl(tvb, offset + 1 + 0),
8059
753
                                    wmem_strbuf_get_str(comm_strbuf),
8060
753
                                    plen);
8061
753
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN);
8062
753
                proto_tree_add_item(prefix_tree, hf_bgp_originating_as, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
8063
753
                proto_tree_add_string(prefix_tree, hf_bgp_community_prefix, tvb, offset + 1 + 4, length - 4, wmem_strbuf_get_str(comm_strbuf));
8064
753
                total_length = 1 + length;
8065
753
                break;
8066
479
            case SAFNUM_ENCAPSULATION:
8067
479
                plen =  tvb_get_uint8(tvb, offset);
8068
479
                if (plen != 32){
8069
283
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8070
283
                                        "%s IPv4 address length %u invalid",
8071
283
                                        tag, plen);
8072
283
                    return -1;
8073
283
                }
8074
196
                offset += 1;
8075
8076
196
                proto_tree_add_item(tree, hf_bgp_endpoint_address, tvb, offset, 4, ENC_BIG_ENDIAN);
8077
8078
196
                total_length = 5; /* length(1 octet) + address(4 octets) */
8079
196
                break;
8080
559
            case SAFNUM_TUNNEL:
8081
559
                plen =  tvb_get_uint8(tvb, offset);
8082
559
                if (plen <= 16){
8083
255
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8084
255
                                        "%s Tunnel IPv4 prefix length %u invalid",
8085
255
                                        tag, plen);
8086
255
                    return -1;
8087
255
                }
8088
304
                tnl_id = tvb_get_ntohs(tvb, offset + 1);
8089
304
                offset += 3; /* Length + Tunnel Id */
8090
304
                plen -= 16; /* 2-octet Identifier */
8091
304
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
8092
304
                if (length < 0) {
8093
71
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8094
71
                                        "%s Tunnel IPv4 prefix length %u invalid",
8095
71
                                        tag, plen + 16);
8096
71
                    return -1;
8097
71
                }
8098
233
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8099
233
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8100
233
                                         (offset + length) - start_offset,
8101
233
                                         ett_bgp_prefix, NULL,
8102
233
                                         "Tunnel Identifier=0x%x IPv4=%s/%u",
8103
233
                                         tnl_id, address_to_str(pinfo->pool, &addr), plen);
8104
8105
233
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
8106
8107
233
                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
8108
233
                                    start_offset + 1, 2, ENC_BIG_ENDIAN);
8109
233
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
8110
233
                total_length = 1 + 2 + length; /* length field + Tunnel Id + IPv4 len */
8111
233
                break;
8112
133
            case SAFNUM_SR_POLICY:
8113
133
                total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
8114
133
                if (total_length < 0)
8115
0
                    return -1;
8116
133
                break;
8117
523
            case SAFNUM_LAB_VPNUNICAST:
8118
1.61k
            case SAFNUM_LAB_VPNMULCAST:
8119
1.96k
            case SAFNUM_LAB_VPNUNIMULC:
8120
1.96k
                end = offset + tlen;
8121
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
8122
1.96k
                if (detect_add_path_prefix46(tvb, offset, end, 255)) {
8123
                    /* snarf path identifier */
8124
326
                    offset += 4;
8125
326
                    total_length += 4;
8126
326
                }
8127
1.96k
                plen =  tvb_get_uint8(tvb, offset);
8128
1.96k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8129
1.96k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8130
8131
1.96k
                offset += (1 + labnum * 3);
8132
1.96k
                if (plen < (labnum * 3*8 + 8*8)) {
8133
1.05k
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8134
1.05k
                                        "%s Labeled VPN IPv4 prefix length %u invalid",
8135
1.05k
                                        tag, plen);
8136
1.05k
                    return -1;
8137
1.05k
                }
8138
902
                plen -= (labnum * 3*8 + 8*8);
8139
8140
902
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 8, &ip4addr, plen);
8141
902
                if (length < 0) {
8142
143
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8143
143
                                             "%s Labeled VPN IPv4 prefix length %u invalid",
8144
143
                                             tag, plen + (labnum * 3*8) + 8*8);
8145
143
                     return -1;
8146
143
                }
8147
759
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8148
759
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8149
759
                                                 (offset + 8 + length) - start_offset,
8150
759
                                                 ett_bgp_prefix, NULL, "BGP Prefix");
8151
8152
759
                if (total_length > 0) {
8153
189
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8154
189
                    start_offset += 4;
8155
189
                }
8156
759
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
8157
759
                proto_tree_add_string(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf));
8158
759
                proto_tree_add_string(prefix_tree, hf_bgp_rd, tvb, start_offset + 1 + 3 * labnum, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
8159
8160
759
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset + 8, length, ip4addr);
8161
8162
759
                total_length += (1 + labnum * 3 + 8) + length;
8163
759
                break;
8164
8165
6.68k
           case SAFNUM_FSPEC_RULE:
8166
23.2k
           case SAFNUM_FSPEC_VPN_RULE:
8167
23.2k
             total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
8168
23.2k
             if(total_length < 0)
8169
1.15k
               return -1;
8170
22.1k
             total_length++;
8171
22.1k
           break;
8172
8.11k
            case SAFNUM_BGP_MUP:
8173
8.11k
                total_length = decode_bgp_mup_nlri(tree, tvb, offset, pinfo, afi);
8174
8.11k
                break;
8175
580
           default:
8176
580
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8177
580
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8178
580
                return -1;
8179
77.5k
        } /* switch (safi) */
8180
71.6k
        break;
8181
8182
71.6k
    case AFNUM_IP6:
8183
52.4k
        switch (safi) {
8184
8185
19.3k
            case SAFNUM_UNICAST:
8186
23.2k
            case SAFNUM_MULCAST:
8187
26.3k
            case SAFNUM_UNIMULC:
8188
                /* parse each prefix */
8189
8190
26.3k
                end = offset + tlen;
8191
8192
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8193
26.3k
                if( detect_add_path_prefix6(tvb, offset, end) ) {
8194
                    /* IPv6 prefixes with Path Id */
8195
541
                    total_length = decode_path_prefix6(tree, pinfo, hf_path_id, hf_addr6, tvb, offset, tag);
8196
25.7k
                } else {
8197
25.7k
                    total_length = decode_prefix6(tree, pinfo, hf_addr6, tvb, offset, 0, tag);
8198
25.7k
                }
8199
26.3k
                if (total_length < 0)
8200
482
                    return -1;
8201
25.8k
                break;
8202
8203
25.8k
            case SAFNUM_MPLS_LABEL:
8204
1.15k
                end = offset + tlen;
8205
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8206
1.15k
                if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
8207
                    /* snarf path identifier */
8208
327
                    path_identifier = tvb_get_ntohl(tvb, offset);
8209
327
                    offset += 4;
8210
327
                    total_length += 4;
8211
327
                }
8212
                /* snarf length */
8213
1.15k
                plen =  tvb_get_uint8(tvb, offset);
8214
1.15k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8215
1.15k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8216
8217
1.15k
                offset += (1 + labnum * 3);
8218
1.15k
                if (plen < (labnum * 3*8)) {
8219
609
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8220
609
                                        "%s Labeled IPv6 prefix length %u invalid", tag, plen);
8221
609
                    return -1;
8222
609
                }
8223
541
                plen -= (labnum * 3*8);
8224
8225
541
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
8226
541
                if (length < 0) {
8227
91
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8228
91
                                        "%s Labeled IPv6 prefix length %u invalid",
8229
91
                                        tag, plen  + (labnum * 3*8));
8230
91
                    return -1;
8231
91
                }
8232
8233
450
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8234
450
                if (total_length > 0) {
8235
69
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8236
69
                                    (offset + length) - start_offset,
8237
69
                                    ett_bgp_prefix, NULL,
8238
69
                                    "Label Stack=%s, IPv6=%s/%u PathId %u",
8239
69
                                    wmem_strbuf_get_str(stack_strbuf),
8240
69
                                    address_to_str(pinfo->pool, &addr), plen, path_identifier);
8241
69
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8242
69
                    start_offset += 4;
8243
381
                } else {
8244
381
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8245
381
                                    (offset + length) - start_offset,
8246
381
                                    ett_bgp_prefix, NULL,
8247
381
                                    "Label Stack=%s, IPv6=%s/%u",
8248
381
                                    wmem_strbuf_get_str(stack_strbuf),
8249
381
                                    address_to_str(pinfo->pool, &addr), plen);
8250
381
                }
8251
450
                proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
8252
450
                                        "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
8253
450
                proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
8254
450
                                        "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
8255
450
                total_length += (1 + labnum*3) + length;
8256
450
                proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
8257
450
                break;
8258
5.53k
            case SAFNUM_MCAST_VPN:
8259
5.53k
                total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
8260
5.53k
                if (total_length < 0)
8261
368
                    return -1;
8262
5.16k
                break;
8263
5.16k
            case SAFNUM_ENCAPSULATION:
8264
793
                plen =  tvb_get_uint8(tvb, offset);
8265
793
                if (plen != 128){
8266
429
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8267
429
                                        "%s IPv6 address length %u invalid",
8268
429
                                        tag, plen);
8269
429
                    return -1;
8270
429
                }
8271
364
                offset += 1;
8272
8273
364
                proto_tree_add_item(tree, hf_bgp_endpoint_address_ipv6, tvb, offset, 16, ENC_NA);
8274
8275
364
                total_length = 17; /* length(1 octet) + address(16 octets) */
8276
364
                break;
8277
690
            case SAFNUM_TUNNEL:
8278
690
                plen =  tvb_get_uint8(tvb, offset);
8279
690
                if (plen <= 16){
8280
268
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8281
268
                                        "%s Tunnel IPv6 prefix length %u invalid",
8282
268
                                        tag, plen);
8283
268
                    return -1;
8284
268
                }
8285
422
                tnl_id = tvb_get_ntohs(tvb, offset + 1);
8286
422
                offset += 3; /* Length + Tunnel Id */
8287
422
                plen -= 16; /* 2-octet Identifier */
8288
422
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
8289
422
                if (length < 0) {
8290
196
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8291
196
                                        "%s Tunnel IPv6 prefix length %u invalid",
8292
196
                                        tag, plen + 16);
8293
196
                    return -1;
8294
196
                }
8295
226
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8296
226
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8297
226
                                    (offset + length) - start_offset,
8298
226
                                    ett_bgp_prefix, NULL,
8299
226
                                    "Tunnel Identifier=0x%x IPv6=%s/%u",
8300
226
                                    tnl_id, address_to_str(pinfo->pool, &addr), plen);
8301
226
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
8302
8303
226
                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
8304
226
                                    start_offset + 1, 2, ENC_BIG_ENDIAN);
8305
226
                proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
8306
8307
226
                total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */
8308
226
                break;
8309
8310
132
            case SAFNUM_SR_POLICY:
8311
132
                total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
8312
132
                if (total_length < 0)
8313
0
                    return -1;
8314
132
                break;
8315
8316
10.5k
            case SAFNUM_BGP_MUP:
8317
10.5k
                total_length = decode_bgp_mup_nlri(tree, tvb, offset, pinfo, afi);
8318
10.5k
                break;
8319
512
            case SAFNUM_LAB_VPNUNICAST:
8320
1.86k
            case SAFNUM_LAB_VPNMULCAST:
8321
2.05k
            case SAFNUM_LAB_VPNUNIMULC:
8322
2.05k
                end = offset + tlen;
8323
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8324
2.05k
                if (detect_add_path_prefix46(tvb, offset, end, 255)) {
8325
                    /* snarf path identifier */
8326
309
                    offset += 4;
8327
309
                    total_length += 4;
8328
309
                }
8329
2.05k
                plen =  tvb_get_uint8(tvb, offset);
8330
2.05k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8331
2.05k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8332
8333
2.05k
                offset += (1 + labnum * 3);
8334
2.05k
                if (plen < (labnum * 3*8 + 8*8)) {
8335
1.01k
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8336
1.01k
                                        "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
8337
1.01k
                    return -1;
8338
1.01k
                }
8339
1.04k
                plen -= (labnum * 3*8 + 8*8);
8340
8341
1.04k
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 8, &ip6addr, plen);
8342
1.04k
                if (length < 0) {
8343
108
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8344
108
                                                 "%s Labeled VPN IPv6 prefix length %u invalid",
8345
108
                                                 tag, plen + (labnum * 3*8) + 8*8);
8346
108
                    return -1;
8347
108
                }
8348
8349
936
                if (total_length > 0) {
8350
219
                    proto_tree_add_item(tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8351
219
                    start_offset += 4;
8352
219
                }
8353
936
                proto_tree_add_item(tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
8354
936
                proto_tree_add_string(tree, hf_bgp_label_stack, tvb, start_offset + 1, labnum * 3, wmem_strbuf_get_str(stack_strbuf));
8355
936
                proto_tree_add_string(tree, hf_bgp_rd, tvb, offset, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
8356
8357
8358
936
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8359
936
                proto_tree_add_ipv6_format_value(tree, hf_addr6, tvb, offset + 8, length,
8360
936
                                                 &ip6addr, "%s/%u", address_to_str(pinfo->pool, &addr), plen);
8361
8362
936
                total_length += (1 + labnum * 3 + 8) + length;
8363
8364
936
                break;
8365
3.48k
            case SAFNUM_FSPEC_RULE:
8366
4.94k
            case SAFNUM_FSPEC_VPN_RULE:
8367
4.94k
                total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
8368
4.94k
                if(total_length < 0)
8369
619
                    return -1;
8370
4.33k
                total_length++;
8371
4.33k
                break;
8372
269
            default:
8373
269
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8374
269
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8375
269
                return -1;
8376
52.4k
        } /* switch (safi) */
8377
47.3k
        break;
8378
8379
47.3k
    case AFNUM_AFI_FOR_L2VPN_INFORMATION:
8380
22.5k
    case AFNUM_AFI_FOR_L2VPN_INFORMATION_OLD:
8381
22.5k
        switch (safi) {
8382
8383
55
            case SAFNUM_LAB_VPNUNICAST:
8384
200
            case SAFNUM_LAB_VPNMULCAST:
8385
282
            case SAFNUM_LAB_VPNUNIMULC:
8386
499
            case SAFNUM_VPLS:
8387
499
                plen =  tvb_get_ntohs(tvb,offset);
8388
499
                proto_tree_add_item(tree, hf_bgp_vplsad_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8389
8390
499
                proto_tree_add_string(tree, hf_bgp_vplsad_rd, tvb, offset+2, 8, decode_bgp_rd(pinfo->pool, tvb, offset+2));
8391
                /* RFC6074 Section 7 BGP-AD and VPLS-BGP Interoperability
8392
                   Both BGP-AD and VPLS-BGP [RFC4761] use the same AFI/SAFI.  In order
8393
                   for both BGP-AD and VPLS-BGP to co-exist, the NLRI length must be
8394
                   used as a demultiplexer.
8395
8396
                   The BGP-AD NLRI has an NLRI length of 12 bytes, containing only an
8397
                   8-byte RD and a 4-byte VSI-ID. VPLS-BGP [RFC4761] uses a 17-byte
8398
                   NLRI length.  Therefore, implementations of BGP-AD must ignore NLRI
8399
                   that are greater than 12 bytes.
8400
                */
8401
499
                if(plen == 12) /* BGP-AD */
8402
253
                {
8403
253
                    proto_tree_add_item(tree, hf_bgp_bgpad_pe_addr, tvb, offset+10, 4, ENC_BIG_ENDIAN);
8404
253
                }else{ /* VPLS-BGP */
8405
8406
246
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_ce_id, tvb, offset+10, 2, ENC_BIG_ENDIAN);
8407
8408
246
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_offset, tvb, offset+12, 2, ENC_BIG_ENDIAN);
8409
246
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_size, tvb, offset+14, 2, ENC_BIG_ENDIAN);
8410
246
                    stack_strbuf = wmem_strbuf_create(pinfo->pool);
8411
246
                    decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
8412
246
                    proto_tree_add_string(tree, hf_bgp_vplsbgp_labelblock_base, tvb, offset+16, plen-14, wmem_strbuf_get_str(stack_strbuf));
8413
8414
246
                }
8415
                /* FIXME there are subTLVs left to decode ... for now lets omit them */
8416
499
                total_length = plen+2;
8417
499
                break;
8418
8419
21.6k
            case SAFNUM_EVPN:
8420
                /* Check for Add Path */
8421
21.6k
                if (tvb_get_uint8(tvb, offset + 4 ) <= EVPN_S_PMSI_A_D_ROUTE && tvb_get_uint8(tvb, offset ) == 0) {
8422
6.52k
                    proto_tree_add_item(tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8423
6.52k
                    offset += 4;
8424
6.52k
                    total_length = decode_evpn_nlri(tree, tvb, offset, pinfo) + 4;
8425
15.1k
                } else {
8426
15.1k
                     total_length = decode_evpn_nlri(tree, tvb, offset, pinfo);
8427
15.1k
                }
8428
21.6k
                break;
8429
8430
352
            default:
8431
352
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8432
352
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8433
352
                return -1;
8434
22.5k
        } /* switch (safi) */
8435
21.5k
        break;
8436
21.5k
    case AFNUM_BGP_LS:
8437
20.7k
        nlri_type = tvb_get_ntohs(tvb, offset);
8438
20.7k
        total_length = tvb_get_ntohs(tvb, offset + 2);
8439
20.7k
        length = total_length;
8440
20.7k
        total_length += 4;
8441
8442
20.7k
        if (safi == SAFNUM_BGP_LS || safi == SAFNUM_BGP_LS_VPN) {
8443
19.3k
            ti = proto_tree_add_item(tree, hf_bgp_ls_nlri, tvb, offset, total_length , ENC_NA);
8444
19.3k
        } else if (safi == SAFNUM_LAB_VPNUNICAST) {
8445
898
            ti = proto_tree_add_item(tree, hf_bgp_ls_safi128_nlri, tvb, offset, total_length , ENC_NA);
8446
898
        } else
8447
533
            return -1;
8448
8449
20.2k
        prefix_tree = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
8450
20.2k
        proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_type, tvb, offset, 2, ENC_BIG_ENDIAN);
8451
20.2k
        proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
8452
20.2k
        offset += 4;
8453
8454
        /* when SAFI 128, then write route distinguisher */
8455
20.2k
        if (safi == SAFNUM_LAB_VPNUNICAST) {
8456
898
            if (length < BGP_ROUTE_DISTINGUISHER_SIZE) {
8457
458
                if (length == 0) {
8458
254
                    expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
8459
254
                                           "Unexpected end of SAFI 128 NLRI, Route Distinguisher field is required!");
8460
254
                }
8461
458
                if (length > 0) {
8462
204
                    expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
8463
204
                                           "Unexpected Route Distinguisher length (%u)!",
8464
204
                                           length);
8465
204
                }
8466
458
                break;
8467
458
            }
8468
440
            disting_item = proto_tree_add_item(prefix_tree, hf_bgp_ls_safi128_nlri_route_distinguisher,
8469
440
                                               tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
8470
440
            disting_tree = proto_item_add_subtree(disting_item, ett_bgp_mp_reach_nlri);
8471
440
            tmp16 = tvb_get_ntohs(tvb, offset);
8472
440
            proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_distinguisher_type,
8473
440
                                tvb, offset, 2, ENC_BIG_ENDIAN);
8474
            /* Route Distinguisher Type */
8475
440
            switch (tmp16) {
8476
89
            case 0:
8477
89
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
8478
89
                                    tvb, offset + 2, 2, ENC_BIG_ENDIAN);
8479
89
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
8480
89
                                    tvb, offset + 4, 4, ENC_BIG_ENDIAN);
8481
89
                break;
8482
8483
68
            case 1:
8484
68
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
8485
68
                                    tvb, offset + 2, 4, ENC_BIG_ENDIAN);
8486
68
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
8487
68
                                    tvb, offset + 6, 2, ENC_BIG_ENDIAN);
8488
68
                break;
8489
8490
66
            case 2:
8491
66
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
8492
66
                                    tvb, offset + 2, 4, ENC_BIG_ENDIAN);
8493
66
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
8494
66
                                    tvb, offset + 6, 2, ENC_BIG_ENDIAN);
8495
66
                break;
8496
8497
203
            default:
8498
203
                expert_add_info_format(pinfo, disting_tree, &ei_bgp_ls_error,
8499
203
                                       "Unknown Route Distinguisher type (%u)", tmp16);
8500
440
            }
8501
411
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
8502
411
            length -= BGP_ROUTE_DISTINGUISHER_SIZE;
8503
411
        }
8504
8505
19.7k
        switch (nlri_type) {
8506
2.79k
        case LINK_STATE_LINK_NLRI:
8507
8508
2.79k
            nlri_ti = proto_tree_add_item(prefix_tree,
8509
2.79k
                    hf_bgp_ls_nlri_link_nlri_type, tvb, offset, length,
8510
2.79k
                    ENC_NA);
8511
2.79k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8512
2.79k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8513
2.79k
                    offset, pinfo, length);
8514
2.79k
            if (tmp_length < 1)
8515
229
                return -1;
8516
8517
2.56k
            offset += tmp_length;
8518
2.56k
            length -= tmp_length;
8519
8520
            /* dissect Remote Node descriptors TLV */
8521
2.56k
            if (length > 0 && length < 4) {
8522
268
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8523
268
                        "Unknown data in Link-State Link NLRI!");
8524
268
                break;
8525
268
            }
8526
2.29k
            if (length < 1)
8527
534
                break;
8528
8529
1.76k
           tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, nlri_tree, offset,
8530
1.76k
                                                       pinfo, BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS);
8531
1.76k
           if (tmp_length < 1)
8532
0
               return -1;
8533
8534
1.76k
           offset += tmp_length;
8535
1.76k
           length -= tmp_length;
8536
8537
           /* dissect Link Descriptor NLRI */
8538
1.76k
           if (length > 0 && length < 4) {
8539
248
               expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8540
248
                       "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
8541
248
               break;
8542
248
           }
8543
1.51k
           if (length < 1)
8544
485
               break;
8545
8546
1.03k
           tmp_length = decode_bgp_link_nlri_link_descriptors(tvb, nlri_tree,
8547
1.03k
                   offset, pinfo, length);
8548
1.03k
           if (tmp_length < 1)
8549
758
               return -1;
8550
8551
274
           break;
8552
8553
453
       case LINK_STATE_NODE_NLRI:
8554
453
            nlri_ti = proto_tree_add_item(prefix_tree,
8555
453
                    hf_bgp_ls_nlri_node_nlri_type, tvb, offset, length,
8556
453
                    ENC_NA);
8557
453
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8558
453
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8559
453
                    offset, pinfo, length);
8560
453
            if (tmp_length < 1)
8561
225
                return -1;
8562
8563
228
            break;
8564
8565
1.26k
        case LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI:
8566
1.26k
            nlri_ti = proto_tree_add_item(prefix_tree,
8567
1.26k
                    hf_bgp_ls_ipv4_topology_prefix_nlri_type, tvb, offset, length,
8568
1.26k
                    ENC_NA);
8569
1.26k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8570
1.26k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8571
1.26k
                                                                 offset, pinfo, length);
8572
1.26k
            if (tmp_length < 1)
8573
127
                return -1;
8574
8575
1.13k
            offset += tmp_length;
8576
1.13k
            length -= tmp_length;
8577
8578
            /* dissect Prefix Descriptors NLRI */
8579
1.13k
            if (length > 0 && length < 4) {
8580
308
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8581
308
                        "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
8582
308
                break;
8583
308
            }
8584
827
            if (length < 1)
8585
291
                break;
8586
8587
536
            tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
8588
536
                    offset, pinfo, length, IP_PROTO_IPV4);
8589
536
            if (tmp_length < 1)
8590
374
                return -1;
8591
8592
162
            break;
8593
8594
7.77k
        case LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI:
8595
7.77k
            nlri_ti = proto_tree_add_item(prefix_tree,
8596
7.77k
                    hf_bgp_ls_ipv6_topology_prefix_nlri_type, tvb, offset, length,
8597
7.77k
                    ENC_NA);
8598
7.77k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8599
7.77k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8600
7.77k
                    offset, pinfo, length);
8601
7.77k
            if (tmp_length < 1)
8602
219
                return -1;
8603
8604
7.55k
            offset += tmp_length;
8605
7.55k
            length -= tmp_length;
8606
8607
            /* dissect Prefix Descriptors NLRI */
8608
7.55k
            if (length > 0 && length < 4) {
8609
6.82k
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8610
6.82k
                        "Unknown data in Link-State Link NLRI!");
8611
6.82k
                break;
8612
6.82k
            }
8613
728
            if (length < 1)
8614
169
                break;
8615
8616
559
            tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
8617
559
                    offset, pinfo, length, IP_PROTO_IPV6);
8618
559
            if (tmp_length < 1)
8619
320
                return -1;
8620
8621
239
            break;
8622
8623
2.83k
        case LINK_STATE_SRV6_SID_NLRI:
8624
2.83k
            nlri_ti = proto_tree_add_item(prefix_tree,
8625
2.83k
                    hf_bgp_ls_nlri_srv6_sid_nlri_type, tvb, offset, length,
8626
2.83k
                    ENC_NA);
8627
2.83k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8628
2.83k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8629
2.83k
                    offset, pinfo, length);
8630
2.83k
            if (tmp_length < 1)
8631
258
                return -1;
8632
8633
2.57k
            offset += tmp_length;
8634
2.57k
            length -= tmp_length;
8635
8636
            /* dissect SRv6 SID Descriptors NLRI */
8637
2.57k
            if (length > 0 && length < 4) {
8638
388
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8639
388
                        "Unknown data in Link-State SRv6 SID NLRI!");
8640
388
                break;
8641
388
            }
8642
2.18k
            if (length < 1)
8643
1.35k
                break;
8644
8645
829
            tmp_length = decode_bgp_link_nlri_srv6_sid_descriptors(tvb, nlri_tree,
8646
829
                    offset, pinfo, length);
8647
829
            if (tmp_length < 1)
8648
362
                return -1;
8649
8650
467
            break;
8651
8652
4.62k
        default:
8653
4.62k
            proto_tree_add_expert_format(tree, pinfo,  &ei_bgp_ls_error, tvb, start_offset, 0,
8654
4.62k
                                         "Unknown Link-State NLRI type (%u)", afi);
8655
8656
19.7k
        }
8657
16.5k
        break;
8658
8659
16.5k
        default:
8660
1.18k
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_afi, tvb, start_offset, 0,
8661
1.18k
                                         "Unknown AFI (%u) value", afi);
8662
1.18k
            return -1;
8663
174k
    } /* switch (afi) */
8664
157k
    return total_length;
8665
174k
}
8666
8667
/*
8668
 * Dissect a BGP capability.
8669
 */
8670
int
8671
dissect_bgp_capability_item(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, unsigned offset, bool action)
8672
8.76k
{
8673
8.76k
    proto_tree *cap_tree;
8674
8.76k
    proto_item *ti;
8675
8.76k
    proto_item *ti_len;
8676
8.76k
    uint8_t ctype;
8677
8.76k
    uint8_t clen;
8678
8679
8.76k
    ti = proto_tree_add_item(tree, hf_bgp_cap, tvb, offset, -1, ENC_NA);
8680
8.76k
    cap_tree = proto_item_add_subtree(ti, ett_bgp_cap);
8681
8682
8.76k
    proto_tree_add_item(cap_tree, hf_bgp_cap_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8683
8.76k
    ctype = tvb_get_uint8(tvb, offset);
8684
8.76k
    proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, ctype, capability_vals, "Unknown capability %d"));
8685
8.76k
    offset += 1;
8686
8687
8.76k
    ti_len = proto_tree_add_item(cap_tree, hf_bgp_cap_length, tvb, offset, 1, ENC_BIG_ENDIAN);
8688
8.76k
    clen = tvb_get_uint8(tvb, offset);
8689
8.76k
    proto_item_set_len(ti, clen+2);
8690
8.76k
    offset += 1;
8691
8692
8.76k
    if(action){
8693
1.22k
        proto_tree_add_item(cap_tree, hf_bgp_cap_action, tvb, offset, 1, ENC_BIG_ENDIAN);
8694
1.22k
        proto_item_set_len(ti, clen+3);
8695
1.22k
        offset += 1;
8696
1.22k
    }
8697
8698
    /* check the capability type */
8699
8.76k
    switch (ctype) {
8700
875
        case BGP_CAPABILITY_RESERVED:
8701
875
            if (clen != 0) {
8702
247
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8703
247
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8704
247
            }
8705
875
            offset += clen;
8706
875
            break;
8707
464
        case BGP_CAPABILITY_MULTIPROTOCOL:
8708
464
            if (clen != 4) {
8709
268
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
8710
268
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8711
268
                offset += clen;
8712
268
            }
8713
196
            else {
8714
                /* AFI */
8715
196
                proto_tree_add_item(cap_tree, hf_bgp_cap_mp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8716
196
                offset += 2;
8717
8718
                /* Reserved */
8719
196
                proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
8720
196
                offset += 1;
8721
8722
                /* SAFI */
8723
196
                proto_tree_add_item(cap_tree, hf_bgp_cap_mp_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8724
196
                offset += 1;
8725
196
            }
8726
464
            break;
8727
488
        case BGP_CAPABILITY_EXTENDED_NEXT_HOP: {
8728
488
            unsigned eclen = offset + clen;
8729
778
                while (offset <= eclen - 6) {
8730
                    /* AFI */
8731
290
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8732
290
                    offset += 2;
8733
8734
                    /* SAFI */
8735
290
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_safi, tvb, offset, 2, ENC_BIG_ENDIAN);
8736
290
                    offset += 2;
8737
8738
                    /* AFI */
8739
290
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_nhafi, tvb, offset, 2, ENC_BIG_ENDIAN);
8740
290
                    offset += 2;
8741
290
                }
8742
488
                if (offset != eclen) {
8743
266
                    expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of 6", clen);
8744
266
                    proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, eclen - offset, ENC_NA);
8745
266
                    offset = eclen;
8746
266
                }
8747
488
            }
8748
488
            break;
8749
283
        case BGP_CAPABILITY_BGP_ROLE:
8750
283
            if (clen != 1) {
8751
217
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 1", clen);
8752
217
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8753
217
                offset += clen;
8754
217
            }
8755
66
            else {
8756
66
                proto_tree_add_item(cap_tree, hf_bgp_cap_role, tvb, offset, 1, ENC_BIG_ENDIAN);
8757
66
                offset += 1;
8758
66
            }
8759
283
            break;
8760
707
        case BGP_CAPABILITY_GRACEFUL_RESTART:
8761
707
            if ((clen < 6) && (clen != 2)) {
8762
414
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
8763
414
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8764
414
                offset += clen;
8765
414
            }
8766
293
            else {
8767
293
                unsigned eclen = offset + clen;
8768
8769
293
                static int * const timer_flags[] = {
8770
293
                    &hf_bgp_cap_gr_timers_restart_flag,
8771
293
                    &hf_bgp_cap_gr_timers_notification_flag,
8772
293
                    &hf_bgp_cap_gr_timers_restart_time,
8773
293
                    NULL
8774
293
                };
8775
8776
293
                if (clen == 2){
8777
130
                    expert_add_info(pinfo, ti_len, &ei_bgp_cap_gr_helper_mode_only);
8778
130
                }
8779
8780
                /* Timers */
8781
293
                proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_timers, ett_bgp_cap, timer_flags, ENC_BIG_ENDIAN);
8782
293
                offset += 2;
8783
8784
                /*
8785
                 * what follows is alist of AFI/SAFI/flag triplets
8786
                 * read it until the TLV ends
8787
                 */
8788
676
                while (offset < eclen) {
8789
383
                    static int * const flags[] = {
8790
383
                        &hf_bgp_cap_gr_flag_pfs,
8791
383
                        NULL
8792
383
                    };
8793
8794
                    /* AFI */
8795
383
                    proto_tree_add_item(cap_tree, hf_bgp_cap_gr_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8796
383
                    offset += 2;
8797
8798
                    /* SAFI */
8799
383
                    proto_tree_add_item(cap_tree, hf_bgp_cap_gr_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8800
383
                    offset += 1;
8801
8802
                    /* Flags */
8803
383
                    proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_flag, ett_bgp_cap, flags, ENC_BIG_ENDIAN);
8804
383
                    offset += 1;
8805
383
                }
8806
293
            }
8807
707
            break;
8808
407
        case BGP_CAPABILITY_4_OCTET_AS_NUMBER:
8809
407
            if (clen != 4) {
8810
212
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
8811
212
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8812
212
                offset += clen;
8813
212
            }
8814
195
            else {
8815
195
                proto_tree_add_item(cap_tree, hf_bgp_cap_4as, tvb, offset, 4, ENC_BIG_ENDIAN);
8816
195
                offset += 4;
8817
195
            }
8818
407
            break;
8819
343
        case BGP_CAPABILITY_DYNAMIC_CAPABILITY:
8820
343
            if (clen > 0) {
8821
92
                unsigned eclen = offset + clen;
8822
8823
398
                while (offset < eclen) {
8824
306
                    proto_tree_add_item(cap_tree, hf_bgp_cap_dc, tvb, offset, 1, ENC_BIG_ENDIAN);
8825
306
                    offset += 1;
8826
306
                }
8827
92
            }
8828
343
            break;
8829
452
        case BGP_CAPABILITY_ADDITIONAL_PATHS:
8830
452
            if (clen % 4 != 0) {
8831
196
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of  4", clen);
8832
196
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8833
196
                offset += clen;
8834
196
            }
8835
256
            else { /* AFI SAFI Send-receive*/
8836
256
                unsigned eclen = offset + clen;
8837
8838
500
                while (offset < eclen){
8839
                    /* AFI */
8840
244
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8841
244
                    offset += 2;
8842
8843
                    /* SAFI */
8844
244
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8845
244
                    offset += 1;
8846
8847
                    /* Send-Receive */
8848
244
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
8849
244
                    offset += 1;
8850
244
                }
8851
256
            }
8852
452
            break;
8853
8854
210
        case BGP_CAPABILITY_FQDN:{
8855
210
            uint8_t hostname_len, domain_name_len;
8856
8857
210
            proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_fqdn_hostname_len, tvb, offset, 1, ENC_NA, &hostname_len);
8858
210
            offset += 1;
8859
8860
210
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_hostname, tvb, offset, hostname_len, ENC_ASCII);
8861
210
            offset += hostname_len;
8862
8863
210
            proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_fqdn_domain_name_len, tvb, offset, 1, ENC_NA, &domain_name_len);
8864
210
            offset += 1;
8865
8866
210
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_domain_name, tvb, offset, domain_name_len, ENC_ASCII);
8867
210
            offset += domain_name_len;
8868
8869
210
            }
8870
210
            break;
8871
8872
203
        case BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP:
8873
399
        case BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH:
8874
603
        case BGP_CAPABILITY_ROUTE_REFRESH_CISCO:
8875
1.26k
        case BGP_CAPABILITY_ROUTE_REFRESH:
8876
1.46k
        case BGP_CAPABILITY_CP_ORF:
8877
1.46k
            if (clen != 0) {
8878
363
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8879
363
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8880
363
            }
8881
1.46k
            offset += clen;
8882
1.46k
            break;
8883
232
        case BGP_CAPABILITY_ORF_CISCO:
8884
717
        case BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING:
8885
717
            if (clen < 6) {
8886
434
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
8887
434
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8888
434
                offset += clen;
8889
434
            }
8890
283
            else {
8891
283
                uint8_t orfnum;       /* number of ORFs */
8892
283
                int i;
8893
                /* AFI */
8894
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8895
283
                offset += 2;
8896
8897
                /* Reserved */
8898
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
8899
283
                offset += 1;
8900
8901
                /* SAFI */
8902
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8903
283
                offset += 1;
8904
8905
                /* Number of ORFs */
8906
283
                orfnum = tvb_get_uint8(tvb, offset);
8907
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_number, tvb, offset, 1, ENC_BIG_ENDIAN);
8908
283
                offset += 1;
8909
567
                for (i=0; i<orfnum; i++) {
8910
                    /* ORF Type */
8911
284
                    proto_tree_add_item(cap_tree, hf_bgp_cap_orf_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8912
284
                    offset += 1;
8913
8914
                    /* Send/Receive */
8915
284
                    proto_tree_add_item(cap_tree, hf_bgp_cap_orf_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
8916
284
                    offset += 1;
8917
284
                }
8918
283
            }
8919
8920
717
            break;
8921
427
        case BGP_CAPABILITY_MULTISESSION_CISCO:
8922
427
            if (clen < 1) {
8923
228
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 1", clen);
8924
228
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8925
228
                offset += clen;
8926
228
            }
8927
199
            else {
8928
199
                proto_tree_add_item(cap_tree, hf_bgp_cap_multisession_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
8929
199
                offset += 1;
8930
199
            }
8931
8932
427
            break;
8933
468
        case BGP_CAPABILITY_BGPSEC:
8934
468
            if (clen != 3) {
8935
264
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 3", clen);
8936
264
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8937
264
                offset += clen;
8938
264
            }
8939
204
            else {
8940
204
                static int * const bgpsec_flags[] = {
8941
204
                    &hf_bgp_cap_bgpsec_version,
8942
204
                    &hf_bgp_cap_bgpsec_sendreceive,
8943
204
                    &hf_bgp_cap_bgpsec_reserved,
8944
204
                    NULL
8945
204
                };
8946
8947
                /* BGPsec Flags */
8948
204
                proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_bgpsec_flags, ett_bgp_cap, bgpsec_flags, ENC_BIG_ENDIAN);
8949
204
                offset += 1;
8950
8951
                /* BGPsec AFI */
8952
204
                proto_tree_add_item(cap_tree, hf_bgp_cap_bgpsec_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8953
204
                offset += 2;
8954
204
            }
8955
8956
468
            break;
8957
8958
400
        case BGP_CAPABILITY_BFD_STRICT:
8959
400
            if (clen != 0) {
8960
202
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8961
202
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8962
202
            }
8963
400
            offset += clen;
8964
400
            break;
8965
267
        case BGP_CAPABILITY_SOFT_VERSION:{
8966
267
            uint8_t soft_version_len;
8967
8968
267
            proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_soft_version_len, tvb, offset, 1, ENC_NA, &soft_version_len);
8969
267
            offset += 1;
8970
8971
267
            proto_tree_add_item(cap_tree, hf_bgp_cap_soft_version, tvb, offset, soft_version_len, ENC_ASCII);
8972
267
            offset += soft_version_len;
8973
267
            }
8974
267
            break;
8975
            /* unknown capability */
8976
532
        default:
8977
532
            if (clen != 0) {
8978
240
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8979
240
            }
8980
532
            offset += clen;
8981
532
            break;
8982
8.76k
    } /* switch (ctype) */
8983
8.20k
    return offset;
8984
8.76k
}
8985
8986
/*
8987
 * Dissect a BGP OPEN message.
8988
 */
8989
8990
static void
8991
dissect_bgp_open(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
8992
460
{
8993
460
    uint16_t        optlen;    /* Option Length */
8994
460
    int             ptype;     /* parameter type        */
8995
460
    int             plen;      /* parameter length      */
8996
460
    int             cend;      /* capabilities end      */
8997
460
    int             oend;      /* options end           */
8998
460
    int             offset;    /* tvb offset counter    */
8999
460
    uint32_t        as_num;    /* AS Number             */
9000
460
    proto_item      *ti;       /* tree item             */
9001
460
    proto_tree      *opt_tree;  /* subtree for options   */
9002
460
    proto_tree      *par_tree;  /* subtree for par options   */
9003
460
    proto_tree      *opt_extension_tree;  /* subtree for par options   */
9004
9005
460
    offset = BGP_MARKER_SIZE + 2 + 1;
9006
9007
460
    proto_tree_add_item(tree, hf_bgp_open_version, tvb, offset, 1, ENC_BIG_ENDIAN);
9008
460
    offset += 1;
9009
9010
460
    ti = proto_tree_add_item_ret_uint(tree, hf_bgp_open_myas, tvb, offset, 2, ENC_BIG_ENDIAN, &as_num);
9011
460
    if (as_num == BGP_AS_TRANS) {
9012
10
        proto_item_append_text(ti, " (AS_TRANS)");
9013
10
    }
9014
460
    offset += 2;
9015
9016
460
    proto_tree_add_item(tree, hf_bgp_open_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN);
9017
460
    offset += 2;
9018
9019
460
    proto_tree_add_item(tree, hf_bgp_open_identifier, tvb, offset, 4, ENC_BIG_ENDIAN);
9020
460
    offset += 4;
9021
9022
460
    proto_tree_add_item(tree, hf_bgp_open_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN);
9023
460
    optlen = tvb_get_uint8(tvb, offset);
9024
460
    offset += 1;
9025
9026
    /* optional parameters */
9027
460
    if (optlen > 0) {
9028
217
        ptype = tvb_get_uint8(tvb, offset);
9029
217
        if (ptype == BGP_OPTION_EXTENDED_LEN) {  /* Extended Length covered by RFC9072 */
9030
109
            optlen = tvb_get_uint16(tvb, offset+1, ENC_BIG_ENDIAN);
9031
9032
109
            ti =  proto_tree_add_item(tree, hf_bgp_open_opt_extension, tvb, offset, 3, ENC_NA);
9033
109
            opt_extension_tree = proto_item_add_subtree(ti, ett_bgp_options_ext);
9034
109
            proto_tree_add_item(opt_extension_tree, hf_bgp_open_opt_extension_mark, tvb, offset, 1, ENC_NA);
9035
109
            proto_tree_add_item(opt_extension_tree, hf_bgp_open_opt_extension_len, tvb, offset +1, 2, ENC_BIG_ENDIAN);
9036
9037
109
            oend = offset + 3 + optlen;
9038
109
            offset += 3;
9039
109
        } else {
9040
108
            oend = offset + optlen;
9041
108
        }
9042
9043
        /* add a subtree */
9044
217
        ti = proto_tree_add_item(tree, hf_bgp_open_opt_params, tvb, offset, optlen, ENC_NA);
9045
217
        opt_tree = proto_item_add_subtree(ti, ett_bgp_options);
9046
9047
        /* step through all of the optional parameters */
9048
1.21k
        while (offset < oend) {
9049
9050
            /* add a subtree */
9051
1.07k
            ti = proto_tree_add_item(opt_tree, hf_bgp_open_opt_param, tvb, offset, -1, ENC_NA);
9052
1.07k
            par_tree = proto_item_add_subtree(ti, ett_bgp_options);
9053
9054
            /* display and grab the type ... */
9055
1.07k
            proto_tree_add_item(par_tree, hf_bgp_open_opt_param_type, tvb, offset, 1, ENC_BIG_ENDIAN);
9056
1.07k
            ptype = tvb_get_uint8(tvb, offset);
9057
1.07k
            proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, ptype, bgp_open_opt_vals, "Unknown Parameter %d"));
9058
1.07k
            offset += 1;
9059
9060
            /* ... and length */
9061
1.07k
            proto_tree_add_item(par_tree, hf_bgp_open_opt_param_len, tvb, offset, 1, ENC_BIG_ENDIAN);
9062
1.07k
            plen = tvb_get_uint8(tvb, offset);
9063
1.07k
            proto_item_set_len(ti, plen+2);
9064
1.07k
            offset += 1;
9065
9066
            /* check the type */
9067
1.07k
            switch (ptype) {
9068
231
                case BGP_OPTION_AUTHENTICATION:
9069
231
                    proto_tree_add_item(par_tree, hf_bgp_open_opt_param_auth, tvb, offset, plen, ENC_NA);
9070
231
                    offset += plen;
9071
231
                    break;
9072
531
                case BGP_OPTION_CAPABILITY:
9073
                    /* grab the capability code */
9074
531
                    cend = offset + plen;
9075
9076
                    /* step through all of the capabilities */
9077
1.07k
                    while (offset < cend) {
9078
541
                        offset = dissect_bgp_capability_item(tvb, par_tree, pinfo, offset, false);
9079
541
                    }
9080
531
                    break;
9081
253
                default:
9082
253
                    proto_tree_add_item(opt_tree, hf_bgp_open_opt_param_unknown, tvb, offset, plen, ENC_NA);
9083
253
                    break;
9084
1.07k
            } /* switch (ptype) */
9085
1.07k
        }
9086
217
    }
9087
460
}
9088
9089
/*
9090
 * Heuristic for auto-detection of ASN length 2 or 4 bytes
9091
 */
9092
9093
static uint8_t
9094
heuristic_as2_or_4_from_as_path(tvbuff_t *tvb, unsigned as_path_offset, unsigned end_attr_offset, uint8_t bgpa_type, unsigned *number_as_segment)
9095
2.77k
{
9096
2.77k
    int counter_as_segment=0;
9097
2.77k
    unsigned offset_check=0;
9098
2.77k
    uint8_t assumed_as_len=0;
9099
2.77k
    int asn_is_null=0;
9100
2.77k
    unsigned j=0;
9101
2.77k
    unsigned k=0;
9102
2.77k
    unsigned k_save=0;
9103
2.77k
    uint8_t next_type=0;
9104
2.77k
    uint8_t length=0;
9105
    /* Heuristic is done in two phases
9106
     * First we try to identify the as length (2 or 4 bytes)
9107
     * then we do check that our assumption is ok
9108
     * recalculating the offset and checking we end up with the right result
9109
    * k is used to navigate into the AS_PATH */
9110
2.77k
    k = as_path_offset;
9111
    /* case of AS_PATH type being explicitly 4 bytes ASN */
9112
2.77k
    if (bgpa_type == BGPTYPE_AS4_PATH) {
9113
        /* We calculate numbers of segments and return the as length */
9114
537
        assumed_as_len = 4;
9115
2.80k
        while (k < end_attr_offset)
9116
2.26k
        {
9117
            /* we skip segment type and point to length */
9118
2.26k
            k++;
9119
2.26k
            length = tvb_get_uint8(tvb, k);
9120
            /* length read let's move to first ASN */
9121
2.26k
            k++;
9122
            /* we move to the next segment */
9123
2.26k
            k = k + (length*assumed_as_len);
9124
2.26k
            counter_as_segment++;
9125
2.26k
        }
9126
537
        *number_as_segment = counter_as_segment;
9127
537
        return 4;
9128
537
    }
9129
    /* case of user specified ASN length */
9130
2.23k
    if (bgp_asn_len != 0) {
9131
        /* We calculate numbers of segments and return the as length */
9132
0
        assumed_as_len = bgp_asn_len;
9133
0
        while (k < end_attr_offset)
9134
0
        {
9135
            /* we skip segment type and point to length */
9136
0
            k++;
9137
0
            length = tvb_get_uint8(tvb, k);
9138
            /* length read let's move to first ASN */
9139
0
            k++;
9140
            /* we move to the next segment */
9141
0
            k = k + (length*assumed_as_len);
9142
            /* if I am not facing the last segment k need to point to next length */
9143
0
            counter_as_segment++;
9144
0
        }
9145
0
        *number_as_segment = counter_as_segment;
9146
0
        return bgp_asn_len;
9147
0
    }
9148
    /* case of a empty path attribute */
9149
2.23k
    if (as_path_offset == end_attr_offset)
9150
577
    {
9151
577
        *number_as_segment = 0;
9152
577
        return bgp_asn_len;
9153
577
    }
9154
    /* case of we run the heuristic to find the as length */
9155
1.65k
    k_save = k;
9156
    /* we do run the heuristic on first segment and look at next segment if it exists */
9157
1.65k
    k++;
9158
1.65k
    length = tvb_get_uint8(tvb, k++);
9159
    /* let's do some checking with an as length 2 bytes */
9160
1.65k
    offset_check = k + 2*length;
9161
1.65k
    next_type = tvb_get_uint8(tvb, offset_check);
9162
    /* we do have one segment made of 2 bytes ASN we do reach the end of the attribute taking
9163
     * 2 bytes ASN for our calculation */
9164
1.65k
    if (offset_check == end_attr_offset)
9165
243
        assumed_as_len = 2;
9166
    /* else we do check if we see a valid AS segment type after (length * AS 2 bytes) */
9167
1.41k
    else if (next_type == AS_SET ||
9168
1.08k
            next_type == AS_SEQUENCE ||
9169
758
            next_type == AS_CONFED_SEQUENCE ||
9170
1.03k
            next_type == AS_CONFED_SET) {
9171
        /* 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 */
9172
3.40k
            for (j=0; j < length && !asn_is_null; j++) {
9173
2.37k
                if(tvb_get_ntohs(tvb, k+(2*j)) == 0) {
9174
86
                    asn_is_null = 1;
9175
86
                }
9176
2.37k
            }
9177
1.03k
            if (asn_is_null == 0)
9178
950
                assumed_as_len = 2;
9179
86
            else
9180
86
                assumed_as_len = 4;
9181
1.03k
        }
9182
380
    else
9183
    /* we didn't find a valid AS segment type in the next coming segment assuming 2 bytes ASN */
9184
380
        assumed_as_len = 4;
9185
    /* now that we have our assumed as length let's check we can calculate the attribute length properly */
9186
1.65k
    k = k_save;
9187
4.00k
    while (k < end_attr_offset)
9188
2.34k
    {
9189
        /* we skip the AS type */
9190
2.34k
        k++;
9191
        /* we get the length of the AS segment */
9192
2.34k
        length = tvb_get_uint8(tvb, k);
9193
        /* let's point to the first byte of the AS segment */
9194
2.34k
        k++;
9195
        /* we move to the next segment */
9196
2.34k
        k = k + (length*assumed_as_len);
9197
2.34k
        counter_as_segment++;
9198
2.34k
    }
9199
1.65k
    if (k == end_attr_offset) {
9200
    /* success */
9201
316
        *number_as_segment = counter_as_segment;
9202
316
        return assumed_as_len;
9203
316
    } else
9204
    /* we are in trouble */
9205
1.34k
    return -1;
9206
1.65k
}
9207
9208
/*
9209
 * Dissect BGP update extended communities
9210
 */
9211
9212
static int
9213
dissect_bgp_update_ext_com(proto_tree *parent_tree, tvbuff_t *tvb, uint16_t tlen, unsigned tvb_off, packet_info *pinfo)
9214
1.24k
{
9215
1.24k
    int             offset=0;
9216
1.24k
    int             end=0;
9217
1.24k
    uint8_t         com_type_high_byte;
9218
1.24k
    uint8_t         com_stype_low_byte;
9219
1.24k
    proto_tree      *communities_tree;
9220
1.24k
    proto_tree      *community_tree;
9221
1.24k
    proto_tree      *community_type_tree;
9222
1.24k
    proto_item      *communities_item=NULL;
9223
1.24k
    proto_item      *community_item=NULL;
9224
1.24k
    proto_item      *community_type_item=NULL;
9225
1.24k
    uint32_t        encaps_tunnel_type;
9226
1.24k
    afi_safi_data   *data = NULL;
9227
9228
1.24k
    offset = tvb_off ;
9229
1.24k
    end = tvb_off + tlen ;
9230
1.24k
    communities_item = proto_tree_add_item(parent_tree, hf_bgp_ext_communities, tvb, offset, tlen, ENC_NA);
9231
1.24k
    communities_tree = proto_item_add_subtree(communities_item, ett_bgp_extended_communities);
9232
1.24k
    proto_item_append_text(communities_item, ": (%u communit%s)", tlen/8, plurality(tlen/8, "y", "ies"));
9233
6.12k
    while (offset < end) {
9234
5.47k
        com_type_high_byte = tvb_get_uint8(tvb,offset); /* high community type octet */
9235
5.47k
        com_stype_low_byte = tvb_get_uint8(tvb,offset+1); /* sub type low community type octet */
9236
5.47k
        community_item = proto_tree_add_item(communities_tree, hf_bgp_ext_community, tvb, offset, 8, ENC_NA);
9237
5.47k
        community_tree = proto_item_add_subtree(community_item,ett_bgp_extended_community);
9238
9239
        /* Add the Type octet as a decoded item to the community_tree right away,
9240
         * and also dissect its two top bits in a subtree.
9241
         */
9242
9243
5.47k
        community_type_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_type_high, tvb, offset, 1, ENC_BIG_ENDIAN);
9244
5.47k
        community_type_tree = proto_item_add_subtree(community_type_item, ett_bgp_ext_com_type);
9245
5.47k
        proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_auth, tvb, offset, 1, ENC_BIG_ENDIAN);
9246
5.47k
        proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_tran, tvb, offset, 1, ENC_BIG_ENDIAN);
9247
9248
        /* In the switch(), handlers of individual types and subtypes should
9249
         * add and dissect the remaining 7 octets. Dissectors should use the
9250
         * proto_item_set_text() on the community_item to set the community
9251
         * name in the displayed label as specifically as possible, and
9252
         * proto_item_append_text() to add reasonable details.
9253
         *
9254
         * The intended text label of the community_item for each extended
9255
         * community attribute is:
9256
         *
9257
         * Community Name: Values [General Community Type Name]
9258
         *
9259
         * For example:
9260
         * Route Target: 1:1 [Transitive 2-Octet AS-Specific]
9261
         * Unknown subtype 0x01: 0x8081 0x0000 0x2800 [Non-Transitive Opaque]
9262
         * Unknown type 0x88 subtype 0x00: 0x0000 0x0000 0x0000 [Unknown community]
9263
         *
9264
         * The [] part with general community name is added at the end
9265
         * of the switch().
9266
         *
9267
         * The first option (Route Target) shows a fully recognized and
9268
         * dissected extended community. Note that the line immediately calls
9269
         * the community by its most specific known type (Route Target), while
9270
         * the general type is shown in the brackets. The second option shows a
9271
         * community whose Type is recognized (Non-Transitive Opaque) but whose
9272
         * Subtype is not known. The third option shows an unrecognized
9273
         * extended community.
9274
         *
9275
         * Printing out the community raw value as 3 short ints is intentional:
9276
         * With an unknown community, we cannot assume any particular internal
9277
         * value format, and dumping the value in short ints provides for easy
9278
         * readability.
9279
         */
9280
9281
5.47k
        switch (com_type_high_byte) {
9282
568
            case BGP_EXT_COM_TYPE_HIGH_TR_AS2: /* Transitive Two-Octet AS-Specific Extended Community */
9283
9284
568
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9285
568
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9286
568
                data = load_afi_safi_data(pinfo);
9287
9288
568
                if(data && data->afi == AFNUM_AFI_FOR_L2VPN_INFORMATION && data->safi == SAFNUM_EVPN) {
9289
133
                        static int * const local_admin_flags[] = {
9290
133
                            &hf_bgp_ext_com_local_admin_auto_derived_flag,
9291
133
                            &hf_bgp_ext_com_local_admin_type,
9292
133
                            &hf_bgp_ext_com_local_admin_domain_id,
9293
133
                            NULL
9294
133
                        };
9295
133
                        proto_tree_add_bitmask(community_tree, tvb, offset+4, hf_bgp_ext_com_local_admin_flags,
9296
133
                                ett_bgp_vxlan, local_admin_flags, ENC_BIG_ENDIAN);
9297
133
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_local_admin_service_id, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9298
435
                } else {
9299
435
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9300
435
                }
9301
9302
568
                proto_item_set_text(community_item, "%s: %u:%u",
9303
568
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_as2, "Unknown subtype 0x%02x"),
9304
568
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9305
568
                break;
9306
9307
170
            case BGP_EXT_COM_TYPE_HIGH_NTR_AS2: /* Non-Transitive Two-Octet AS-Specific Extended Community */
9308
170
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9309
170
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9310
9311
170
                proto_item_set_text(community_item, "%s:",
9312
170
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_as2, "Unknown subtype 0x%02x"));
9313
9314
170
                switch (com_stype_low_byte) {
9315
66
                    case BGP_EXT_COM_STYPE_AS2_LBW:
9316
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_link_bw, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9317
9318
66
                        proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
9319
66
                                tvb_get_ntohs(tvb,offset+2),
9320
66
                                tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
9321
66
                        break;
9322
9323
104
                    default:
9324
104
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9325
9326
104
                        proto_item_append_text(community_item, " %u:%u",
9327
104
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
9328
104
                    break;
9329
170
                }
9330
156
                break;
9331
9332
248
            case BGP_EXT_COM_TYPE_HIGH_TR_IP4: /* Transitive IPv4-Address-specific Extended Community */
9333
248
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9334
9335
248
                proto_item_set_text(community_item, "%s: %s:%u",
9336
248
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_IP4, "Unknown subtype 0x%02x"),
9337
248
                        tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9338
9339
248
                switch(com_stype_low_byte) {
9340
69
                    case BGP_EXT_COM_STYPE_IP4_OSPF_RID:
9341
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9342
69
                        break;
9343
9344
130
                    default:
9345
130
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9346
130
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9347
130
                        break;
9348
248
                }
9349
199
                break;
9350
9351
199
            case BGP_EXT_COM_TYPE_HIGH_NTR_IP4: /* Non-Transitive IPv4-Address-specific Extended Community */
9352
68
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9353
68
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9354
68
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9355
9356
68
                proto_item_set_text(community_item, "%s: %s:%u",
9357
68
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_IP4, "Unknown subtype 0x%02x"),
9358
68
                        tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9359
68
                break;
9360
9361
91
            case BGP_EXT_COM_TYPE_HIGH_TR_AS4: /* Transitive Four-Octet AS-Specific Extended Community */
9362
91
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9363
91
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9364
91
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9365
9366
91
                proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
9367
91
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_as4, "Unknown subtype 0x%02x"),
9368
91
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
9369
91
                        tvb_get_ntohs(tvb,offset+6));
9370
91
                break;
9371
9372
73
            case BGP_EXT_COM_TYPE_HIGH_NTR_AS4: /* Non-Transitive Four-Octet AS-Specific Extended Community */
9373
73
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9374
73
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9375
73
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9376
9377
73
                proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
9378
73
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_as4, "Unknown subtype 0x%02x"),
9379
73
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
9380
73
                        tvb_get_ntohs(tvb,offset+6));
9381
73
                break;
9382
9383
578
            case BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE: /* Transitive Opaque Extended Community */
9384
578
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9385
9386
578
                proto_item_set_text(community_item, "%s:",
9387
578
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_opaque, "Unknown subtype 0x%02x"));
9388
9389
578
                switch(com_stype_low_byte) {
9390
92
                    case BGP_EXT_COM_STYPE_OPA_COST:
9391
92
                        {
9392
92
                        proto_item *cost_com_item;
9393
92
                        proto_tree *cost_com_cid_tree;
9394
9395
92
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9396
92
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9397
92
                        cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
9398
92
                        proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9399
92
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
9400
92
                            offset+4, 4, ENC_BIG_ENDIAN);
9401
92
                        proto_item_append_text(cost_com_item, " (%s)",
9402
92
                            tfs_get_string(tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
9403
9404
92
                        proto_item_append_text(community_item, " %u, POI: %s (%s)",
9405
92
                                tvb_get_ntohl(tvb, offset+4),
9406
92
                                val_to_str(pinfo->pool, tvb_get_uint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
9407
92
                                (tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
9408
92
                        }
9409
92
                        break;
9410
9411
69
                    case BGP_EXT_COM_STYPE_OPA_OSPF_RT:
9412
69
                        {
9413
69
                        proto_item *ospf_rt_opt_item;
9414
69
                        proto_tree *ospf_rt_opt_tree;
9415
9416
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9417
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9418
69
                        ospf_rt_opt_item = proto_tree_add_item(community_tree,
9419
69
                                hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9420
69
                        ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
9421
69
                        proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
9422
69
                                tvb, offset+7, 1, ENC_BIG_ENDIAN);
9423
69
                        proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
9424
69
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
9425
9426
69
                        proto_item_append_text(community_item, " Area: %s, Type: %s",
9427
69
                                tvb_ip_to_str(pinfo->pool, tvb,offset+2),
9428
69
                                val_to_str_const(tvb_get_uint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
9429
69
                        }
9430
69
                        break;
9431
9432
341
                    case BGP_EXT_COM_STYPE_OPA_ENCAP:
9433
                        /* Community octets 2 through 5 are reserved and carry no useful value according to RFC 5512. */
9434
341
                        proto_tree_add_item_ret_uint(community_tree, hf_bgp_ext_com_tunnel_type, tvb, offset+6, 2, ENC_BIG_ENDIAN, &encaps_tunnel_type);
9435
341
                        save_path_attr_encaps_tunnel_type(pinfo, encaps_tunnel_type);
9436
9437
341
                        proto_item_append_text(community_item, " %s",
9438
341
                                val_to_str_const(tvb_get_ntohs(tvb,offset+6), bgpext_com_tunnel_type, "Unknown"));
9439
341
                        break;
9440
9441
0
                    case BGP_EXT_COM_STYPE_OPA_COLOR:
9442
0
                    case BGP_EXT_COM_STYPE_OPA_DGTW:
9443
76
                    default:
9444
                        /* The particular Opaque subtype is unknown or the
9445
                         * dissector is not written yet. We will dump the
9446
                         * entire community value in 2-byte short words.
9447
                         */
9448
76
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9449
76
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9450
76
                                tvb_get_ntohs(tvb,offset+2),
9451
76
                                tvb_get_ntohs(tvb,offset+4),
9452
76
                                tvb_get_ntohs(tvb,offset+6));
9453
9454
76
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9455
76
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9456
76
                        break;
9457
578
                }
9458
556
                break;
9459
9460
556
            case BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE: /* Non-Transitive Opaque Extended Community */
9461
170
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9462
9463
170
                proto_item_set_text(community_item, "%s:",
9464
170
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_opaque, "Unknown subtype 0x%02x"));
9465
9466
170
                switch(com_stype_low_byte) {
9467
96
                    case BGP_EXT_COM_STYPE_OPA_COST:
9468
96
                        {
9469
96
                        proto_item *cost_com_item;
9470
96
                        proto_tree *cost_com_cid_tree;
9471
9472
96
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9473
96
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9474
96
                        cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
9475
96
                        proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9476
96
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
9477
96
                            offset+4, 4, ENC_BIG_ENDIAN);
9478
96
                        proto_item_append_text(cost_com_item, " (%s)",
9479
96
                            tfs_get_string(tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
9480
9481
96
                        proto_item_append_text(community_item, " %u, POI: %s (%s)",
9482
96
                                tvb_get_ntohl(tvb, offset+4),
9483
96
                                val_to_str(pinfo->pool, tvb_get_uint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
9484
96
                                (tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
9485
96
                        }
9486
96
                        break;
9487
9488
74
                    default:
9489
                            /* The particular Opaque subtype is unknown or the
9490
                             * dissector is not written yet. We will dump the
9491
                             * entire community value in 2-byte short words.
9492
                             */
9493
74
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9494
74
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9495
74
                                tvb_get_ntohs(tvb,offset+2),
9496
74
                                tvb_get_ntohs(tvb,offset+4),
9497
74
                                tvb_get_ntohs(tvb,offset+6));
9498
9499
74
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9500
74
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9501
74
                        break;
9502
170
                }
9503
155
                break;
9504
9505
155
            case BGP_EXT_COM_TYPE_HIGH_TR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
9506
144
            case BGP_EXT_COM_TYPE_HIGH_NTR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
9507
144
                {
9508
144
                static int * const qos_flags[] = {
9509
144
                    &hf_bgp_ext_com_qos_flags_remarking,
9510
144
                    &hf_bgp_ext_com_qos_flags_ignore_remarking,
9511
144
                    &hf_bgp_ext_com_qos_flags_agg_marking,
9512
144
                    NULL
9513
144
                };
9514
9515
144
                proto_item_set_text(community_item, "QoS Marking");
9516
9517
144
                proto_tree_add_bitmask(community_tree, tvb, offset, hf_bgp_ext_com_qos_flags,
9518
144
                        ett_bgp_ext_com_flags, qos_flags, ENC_BIG_ENDIAN);
9519
9520
144
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_set_number, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9521
144
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_tech_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9522
144
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_o, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9523
144
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_a, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9524
144
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_default_to_zero, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9525
144
                }
9526
144
                break;
9527
9528
94
            case BGP_EXT_COM_TYPE_HIGH_TR_COS: /* CoS Capability [Thomas_Martin_Knoll] */
9529
94
                {
9530
94
                int i;
9531
9532
94
                proto_item_set_text(community_item, "CoS Capability");
9533
9534
715
                for (i=1; i < 8; i++) {
9535
621
                    static int * const cos_flags[] = {
9536
621
                        &hf_bgp_ext_com_cos_flags_be,
9537
621
                        &hf_bgp_ext_com_cos_flags_ef,
9538
621
                        &hf_bgp_ext_com_cos_flags_af,
9539
621
                        &hf_bgp_ext_com_cos_flags_le,
9540
621
                        NULL
9541
621
                    };
9542
9543
621
                    proto_tree_add_bitmask(community_tree, tvb, offset+i, hf_bgp_ext_com_cos_flags,
9544
621
                            ett_bgp_ext_com_flags, cos_flags, ENC_BIG_ENDIAN);
9545
621
                }
9546
94
                }
9547
94
                break;
9548
9549
609
            case BGP_EXT_COM_TYPE_HIGH_TR_EVPN: /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
9550
609
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_evpn, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9551
9552
609
                proto_item_set_text(community_item, "%s:",
9553
609
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_evpn, "Unknown subtype 0x%02x"));
9554
9555
609
                switch (com_stype_low_byte) {
9556
76
                    case BGP_EXT_COM_STYPE_EVPN_MMAC:
9557
76
                        {
9558
76
                        proto_tree *evpn_mmac_flag_tree;
9559
76
                        proto_item *evpn_mmac_flag_item;
9560
9561
76
                        evpn_mmac_flag_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9562
76
                        evpn_mmac_flag_tree = proto_item_add_subtree(evpn_mmac_flag_item, ett_bgp_ext_com_evpn_mmac_flags);
9563
76
                        proto_tree_add_item (evpn_mmac_flag_tree, hf_bgp_ext_com_evpn_mmac_flag_sticky, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9564
                        /* Octet at offset 3 is reserved per RFC 7432 Section 7.7 */
9565
76
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_seq, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9566
9567
76
                        proto_item_append_text(community_item, " %s MAC",
9568
76
                          (tvb_get_uint8(tvb,offset+2) & BGP_EXT_COM_EVPN_MMAC_STICKY) ? "Sticky" : "Movable");
9569
76
                        }
9570
76
                        break;
9571
9572
71
                    case BGP_EXT_COM_STYPE_EVPN_LABEL:
9573
71
                        {
9574
71
                        proto_item *ti;
9575
9576
71
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_esi_label_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9577
                        /* Octets at offsets 3 and 4 are reserved perf RFC 7432 Section 7.5 */
9578
71
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9579
71
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9580
71
                        proto_item_set_generated(ti);
9581
71
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9582
71
                        proto_item_set_generated(ti);
9583
71
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9584
71
                        proto_item_set_generated(ti);
9585
9586
71
                        proto_item_append_text(community_item, " %s, Label: %u",
9587
71
                                tfs_get_string(tvb_get_uint8(tvb, offset+2) & BGP_EXT_COM_ESI_LABEL_FLAGS, &tfs_esi_label_flag),
9588
71
                                tvb_get_ntoh24(tvb,offset+5) >> 4);
9589
71
                        }
9590
71
                        break;
9591
9592
90
                    case BGP_EXT_COM_STYPE_EVPN_IMP:
9593
90
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_esirt, tvb, offset+2, 6, ENC_NA);
9594
9595
90
                        proto_item_append_text(community_item, " RT: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
9596
90
                        break;
9597
9598
68
                    case BGP_EXT_COM_STYPE_EVPN_ROUTERMAC:
9599
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_routermac, tvb, offset+2, 6, ENC_NA);
9600
9601
68
                        proto_item_append_text(community_item, " Router's MAC: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
9602
68
                        break;
9603
9604
68
                    case BGP_EXT_COM_STYPE_EVPN_L2ATTR:
9605
68
                        {
9606
68
                        static int * const l2attr_flags[] = {
9607
68
                            &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
9608
68
                            &hf_bgp_ext_com_evpn_l2attr_flag_ci,
9609
68
                            &hf_bgp_ext_com_evpn_l2attr_flag_f,
9610
68
                            &hf_bgp_ext_com_evpn_l2attr_flag_c,
9611
68
                            &hf_bgp_ext_com_evpn_l2attr_flag_p,
9612
68
                            &hf_bgp_ext_com_evpn_l2attr_flag_b,
9613
68
                            NULL
9614
68
                        };
9615
9616
68
                        proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_l2attr_flags,
9617
68
                            ett_bgp_ext_com_evpn_l2attr_flags, l2attr_flags, ENC_BIG_ENDIAN);
9618
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9619
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_reserved, tvb, offset+6, 2, ENC_NA);
9620
9621
68
                        proto_item_append_text(community_item, " flags: 0x%04x, L2 MTU: %u", tvb_get_ntohs(tvb, offset+2), tvb_get_ntohs(tvb, offset+4));
9622
68
                        }
9623
68
                        break;
9624
9625
67
                    case BGP_EXT_COM_STYPE_EVPN_ETREE:
9626
67
                        {
9627
67
                        static int * const etree_flags[] = {
9628
67
                            &hf_bgp_ext_com_evpn_etree_flag_reserved,
9629
67
                            &hf_bgp_ext_com_evpn_etree_flag_l,
9630
67
                            NULL
9631
67
                        };
9632
9633
67
                        proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_etree_flags,
9634
67
                            ett_bgp_ext_com_evpn_etree_flags, etree_flags, ENC_BIG_ENDIAN);
9635
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_etree_reserved, tvb, offset+3, 2, ENC_NA);
9636
9637
67
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9638
67
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9639
67
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9640
67
                        }
9641
67
                        break;
9642
9643
169
                    default:
9644
                        /* The particular EVPN subtype is unknown or the
9645
                         * dissector is not written yet. We will dump the
9646
                         * entire community value in 2-byte short words.
9647
                         */
9648
169
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9649
169
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9650
169
                                tvb_get_ntohs(tvb,offset+2),
9651
169
                                tvb_get_ntohs(tvb,offset+4),
9652
169
                                tvb_get_ntohs(tvb,offset+6));
9653
9654
169
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9655
169
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9656
169
                        break;
9657
609
                }
9658
567
                break;
9659
9660
567
            case BGP_EXT_COM_TYPE_HIGH_TR_MUP:
9661
140
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_mup, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9662
9663
140
                proto_item_set_text(community_item, "%s:",
9664
140
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_mup, "Unknown subtype 0x%02x"));
9665
140
                switch (com_stype_low_byte) {
9666
66
                    case BGP_EXT_COM_STYPE_MUP_DIRECT_SEG:
9667
                        /* format of this community is open, then display it in 2-byte:4-byte decimal format like route target */
9668
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_mup_segment_id2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9669
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_mup_segment_id4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9670
66
                        proto_item_append_text(community_item, " %u:%u", tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9671
66
                        break;
9672
74
                    default:
9673
74
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9674
74
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9675
74
                                tvb_get_ntohs(tvb,offset+2),
9676
74
                                tvb_get_ntohs(tvb,offset+4),
9677
74
                                tvb_get_ntohs(tvb,offset+6));
9678
9679
74
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9680
74
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9681
74
                        break;
9682
140
                }
9683
121
                break;
9684
682
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT: /* Generic Transitive Extended Community */
9685
682
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9686
9687
682
                proto_item_set_text(community_item, "%s:",
9688
682
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"));
9689
9690
682
                switch (com_stype_low_byte) {
9691
66
                    case BGP_EXT_COM_STYPE_EXP_OSPF_RT:
9692
66
                        {
9693
66
                        proto_item *ospf_rt_opt_item;
9694
66
                        proto_tree *ospf_rt_opt_tree;
9695
9696
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9697
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9698
66
                        ospf_rt_opt_item = proto_tree_add_item(community_tree,
9699
66
                                hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9700
66
                        ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
9701
66
                        proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
9702
66
                                tvb, offset+7, 1, ENC_BIG_ENDIAN);
9703
66
                        proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
9704
66
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
9705
9706
66
                        proto_item_append_text(community_item, " Area: %s, Type: %s",
9707
66
                                tvb_ip_to_str(pinfo->pool, tvb,offset+2),
9708
66
                                val_to_str_const(tvb_get_uint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
9709
66
                        }
9710
66
                        break;
9711
9712
68
                    case BGP_EXT_COM_STYPE_EXP_OSPF_RID:
9713
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9714
9715
68
                        proto_item_append_text(community_item, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+2));
9716
68
                        break;
9717
9718
67
                    case BGP_EXT_COM_STYPE_EXP_OSPF_DID:
9719
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9720
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9721
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9722
9723
67
                        proto_item_set_text(community_item, "%s: %u:%u",
9724
67
                                val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"),
9725
67
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9726
67
                        break;
9727
9728
67
                    case BGP_EXT_COM_STYPE_EXP_F_TR:  /* Flow spec traffic-rate [RFC5575] */
9729
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2,
9730
67
                                tvb, offset+2, 2, ENC_BIG_ENDIAN);
9731
                        /* remaining 4 bytes gives traffic rate in IEEE floating point */
9732
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_rate_float, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9733
9734
67
                        proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
9735
67
                                tvb_get_ntohs(tvb,offset+2),
9736
67
                                tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
9737
67
                        break;
9738
9739
74
                    case BGP_EXT_COM_STYPE_EXP_F_TA:  /* Flow spec traffic-action [RFC5575] */
9740
74
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_allset, tvb, offset+2, 5, ENC_NA);
9741
74
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_samp_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9742
74
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_term_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9743
9744
74
                        proto_item_append_text(community_item, " Sample: %s, Terminal: %s",
9745
74
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_S, &tfs_yes_no),
9746
74
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_T, &tfs_yes_no));
9747
74
                        break;
9748
9749
66
                    case BGP_EXT_COM_STYPE_EXP_F_RED: /* Flow spec redirect [RFC5575] */
9750
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9751
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9752
9753
66
                        proto_item_append_text(community_item, " RT %u:%u",
9754
66
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
9755
66
                        break;
9756
9757
69
                    case BGP_EXT_COM_STYPE_EXP_F_RMARK: /* Flow spec traffic-remarking [RFC5575] */
9758
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_fs_remark, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9759
9760
69
                        proto_item_append_text(community_item, " %s",
9761
69
                                val_to_str_ext_const(tvb_get_uint8(tvb,offset+7), &dscp_vals_ext, "Unknown DSCP"));
9762
69
                        break;
9763
9764
67
                    case BGP_EXT_COM_STYPE_EXP_L2:
9765
67
                        {
9766
67
                        static int * const com_l2_flags[] = {
9767
67
                            &hf_bgp_ext_com_l2_flag_d,
9768
67
                            &hf_bgp_ext_com_l2_flag_z1,
9769
67
                            &hf_bgp_ext_com_l2_flag_f,
9770
67
                            &hf_bgp_ext_com_l2_flag_z345,
9771
67
                            &hf_bgp_ext_com_l2_flag_c,
9772
67
                            &hf_bgp_ext_com_l2_flag_s,
9773
67
                            NULL
9774
67
                        };
9775
9776
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_encaps,tvb,offset+2, 1, ENC_BIG_ENDIAN);
9777
9778
67
                        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);
9779
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9780
67
                        }
9781
67
                        break;
9782
9783
67
                    case BGP_EXT_COM_STYPE_EXP_ETREE:
9784
67
                        {
9785
67
                        static int * const com_etree_flags[] = {
9786
67
                            &hf_bgp_ext_com_etree_flag_reserved,
9787
67
                            &hf_bgp_ext_com_etree_flag_p,
9788
67
                            &hf_bgp_ext_com_etree_flag_v,
9789
67
                            NULL
9790
67
                        };
9791
9792
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_root_vlan,tvb,offset+2, 2, ENC_BIG_ENDIAN);
9793
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_leaf_vlan,tvb,offset+4, 2, ENC_BIG_ENDIAN);
9794
67
                        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);
9795
67
                        }
9796
67
                        break;
9797
9798
71
                    default:
9799
                        /* The particular Experimental subtype is unknown or
9800
                         * the dissector is not written yet. We will dump the
9801
                         * entire community value in 2-byte short words.
9802
                         */
9803
71
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9804
71
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9805
71
                                tvb_get_ntohs(tvb,offset+2),
9806
71
                                tvb_get_ntohs(tvb,offset+4),
9807
71
                                tvb_get_ntohs(tvb,offset+6));
9808
9809
71
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9810
71
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9811
71
                        break;
9812
682
                }
9813
610
                break;
9814
9815
610
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT_2:
9816
201
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9817
9818
201
                proto_item_set_text(community_item, "%s:",
9819
201
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp_2, "Unknown subtype 0x%02x"));
9820
9821
201
                switch (com_stype_low_byte) {
9822
66
                    case BGP_EXT_COM_STYPE_EXP_2_FLOW_RED:
9823
66
                        {
9824
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9825
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9826
66
                        }
9827
66
                        break;
9828
9829
135
                    default:
9830
                        /* The particular Experimental subtype is unknown or
9831
                         * the dissector is not written yet. We will dump the
9832
                         * entire community value in 2-byte short words.
9833
                         */
9834
135
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9835
135
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9836
135
                                tvb_get_ntohs(tvb,offset+2),
9837
135
                                tvb_get_ntohs(tvb,offset+4),
9838
135
                                tvb_get_ntohs(tvb,offset+6));
9839
9840
135
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9841
135
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9842
135
                        break;
9843
201
                }
9844
182
                break;
9845
9846
182
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT_3:
9847
181
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_3, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9848
9849
181
                proto_item_set_text(community_item, "%s:",
9850
181
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp_3, "Unknown subtype 0x%02x"));
9851
9852
181
                switch (com_stype_low_byte) {
9853
67
                    case BGP_EXT_COM_STYPE_EXP_3_FLOW_RED:
9854
67
                        {
9855
67
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9856
67
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9857
67
                        }
9858
67
                        break;
9859
9860
114
                    default:
9861
                        /* The particular Experimental subtype is unknown or
9862
                         * the dissector is not written yet. We will dump the
9863
                         * entire community value in 2-byte short words.
9864
                         */
9865
114
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9866
114
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9867
114
                                tvb_get_ntohs(tvb,offset+2),
9868
114
                                tvb_get_ntohs(tvb,offset+4),
9869
114
                                tvb_get_ntohs(tvb,offset+6));
9870
9871
114
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9872
114
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9873
114
                        break;
9874
181
                }
9875
162
                break;
9876
9877
885
            case BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP:
9878
885
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_eigrp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9879
9880
885
                proto_item_set_text(community_item, "%s:",
9881
885
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_eigrp, "Unknown subtype 0x%02x"));
9882
9883
885
                switch(com_stype_low_byte) {
9884
255
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_FT:
9885
255
                        {
9886
255
                        proto_item *eigrp_flags_item;
9887
255
                        proto_tree *eigrp_flags_tree;
9888
9889
255
                        eigrp_flags_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_flags, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9890
255
                        eigrp_flags_tree = proto_item_add_subtree(eigrp_flags_item, ett_bgp_ext_com_eigrp_flags);
9891
9892
255
                        proto_tree_add_item(eigrp_flags_tree, hf_bgp_ext_com_eigrp_flags_rt, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9893
255
                        proto_item_append_text(eigrp_flags_tree, " (%s)",
9894
255
                                tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
9895
255
                        proto_item_append_text(community_tree, " %s route",
9896
255
                                tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
9897
9898
255
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rtag, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9899
255
                        proto_item_append_text(community_tree, ", Tag: %u", tvb_get_ntohl(tvb, offset+4));
9900
255
                        }
9901
255
                        break;
9902
9903
87
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_AD:
9904
87
                        {
9905
87
                        uint32_t raw_value;
9906
9907
87
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9908
9909
87
                        raw_value = tvb_get_ntohl(tvb, offset+4);
9910
87
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_delay,
9911
87
                                tvb, offset+4, 4, raw_value, "%u (%u usec)", raw_value, raw_value * 10 / 256);
9912
9913
87
                        proto_item_append_text(community_item, " ASN: %u, D: %u",
9914
87
                                tvb_get_ntohs(tvb, offset+2), raw_value);
9915
87
                        }
9916
87
                        break;
9917
9918
176
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_RHB:
9919
176
                        {
9920
176
                        uint32_t raw_value;
9921
9922
176
                        raw_value = tvb_get_uint8(tvb, offset+2);
9923
176
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_rly,
9924
176
                                tvb, offset+2, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
9925
176
                        proto_item_append_text(community_item, " R: %u", raw_value);
9926
9927
176
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_hops, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9928
176
                        proto_item_append_text(community_tree, ", H: %u", tvb_get_uint8(tvb, offset+3));
9929
9930
176
                        raw_value = tvb_get_ntohl(tvb, offset+4);
9931
176
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_bw,
9932
176
                                tvb, offset+4, 4, raw_value, "%u (%u Kbps)", raw_value, raw_value ? (2560000000U / raw_value) : 0);
9933
176
                        proto_item_append_text(community_tree, ", B: %u", raw_value);
9934
176
                        }
9935
176
                        break;
9936
9937
67
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_LM:
9938
67
                        {
9939
67
                        uint32_t raw_value;
9940
9941
67
                        raw_value = tvb_get_uint8(tvb, offset+3);
9942
67
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_load,
9943
67
                                tvb, offset+3, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
9944
67
                        proto_item_append_text(community_tree, " L: %u", raw_value);
9945
9946
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_mtu, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9947
67
                        proto_item_append_text(community_tree, ", M: %u", tvb_get_ntohl(tvb, offset+4));
9948
67
                        }
9949
67
                        break;
9950
9951
67
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_EAR:
9952
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9953
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9954
9955
67
                        proto_item_append_text(community_tree, " ASN: %u, RID: %s",
9956
67
                                tvb_get_ntohs(tvb, offset+2), tvb_ip_to_str(pinfo->pool, tvb, offset+4));
9957
67
                        break;
9958
9959
87
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_EPM:
9960
87
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_pid, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9961
87
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_m, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9962
9963
87
                        proto_item_append_text(community_tree, " %s, Metric: %u",
9964
87
                          val_to_str(pinfo->pool, tvb_get_ntohs(tvb, offset+2), eigrp_proto2string, "Unknown protocol %u"),
9965
87
                          tvb_get_ntohl(tvb, offset+4));
9966
87
                        break;
9967
9968
66
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_RID:
9969
66
                       proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9970
66
                       proto_item_append_text(community_tree, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+4));
9971
66
                     break;
9972
885
                }
9973
820
                break;
9974
9975
820
            case BGP_EXT_COM_TYPE_HIGH_TR_FLOW: /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
9976
437
            default:
9977
437
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_low_unknown, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9978
9979
437
                proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9980
437
                        tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9981
437
                        tvb_get_ntohs(tvb,offset+2),
9982
437
                        tvb_get_ntohs(tvb,offset+4),
9983
437
                        tvb_get_ntohs(tvb,offset+6));
9984
9985
437
                proto_item_set_text(community_item, "Unknown type 0x%02x subtype 0x%02x: 0x%04x 0x%04x 0x%04x",
9986
437
                        com_type_high_byte, com_stype_low_byte,
9987
437
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9988
437
                break;
9989
5.47k
        }
9990
4.88k
        proto_item_append_text (community_item, " [%s]", val_to_str_const(com_type_high_byte, bgpext_com_type_high, "Unknown community"));
9991
4.88k
        offset = offset + 8;
9992
4.88k
    }
9993
645
    return 0;
9994
1.24k
}
9995
9996
static int
9997
dissect_bgp_update_pmsi_attr(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, uint16_t tlen, unsigned tvb_off)
9998
2.63k
{
9999
2.63k
    int             offset=0;
10000
2.63k
    uint8_t         tunnel_type=0;
10001
2.63k
    uint8_t         opaque_value_type=0;
10002
2.63k
    uint8_t         rn_addr_length=0;
10003
2.63k
    uint16_t        tunnel_id_len=0;
10004
2.63k
    uint16_t        opaque_value_length=0;
10005
2.63k
    proto_item      *tunnel_id_item=NULL;
10006
2.63k
    proto_item      *opaque_value_type_item=NULL;
10007
2.63k
    proto_item      *pmsi_tunnel_type_item=NULL;
10008
2.63k
    proto_tree      *tunnel_id_tree=NULL;
10009
2.63k
    path_attr_data  *data = NULL;
10010
10011
2.63k
    offset = tvb_off ;
10012
2.63k
    tunnel_id_len = tlen - 5;
10013
10014
2.63k
    proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_flags, tvb, offset,
10015
2.63k
                        1, ENC_BIG_ENDIAN);
10016
10017
2.63k
    pmsi_tunnel_type_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_type, tvb, offset+1,
10018
2.63k
                                                1, ENC_BIG_ENDIAN);
10019
10020
2.63k
    data = load_path_attr_data(pinfo);
10021
2.63k
    if (data && data->encaps_community_present &&
10022
469
            (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
10023
260
        proto_tree_add_item(parent_tree, hf_bgp_evpn_nlri_vni, tvb, offset+2, 3, ENC_BIG_ENDIAN);
10024
2.37k
    } else {
10025
2.37k
        proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+2, 3, ENC_BIG_ENDIAN);
10026
2.37k
    }
10027
10028
2.63k
    tunnel_id_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_id, tvb, offset+5,
10029
2.63k
                        tunnel_id_len, ENC_NA);
10030
2.63k
    tunnel_id_tree = proto_item_add_subtree(tunnel_id_item, ett_bgp_pmsi_tunnel_id);
10031
10032
2.63k
    tunnel_type = tvb_get_uint8(tvb, offset+1);
10033
2.63k
    switch(tunnel_type) {
10034
72
        case PMSI_TUNNEL_NOPRESENT:
10035
72
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_not_present, tvb, offset+1, 1, ENC_NA);
10036
72
            break;
10037
70
        case PMSI_TUNNEL_RSVPTE_P2MP:
10038
70
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_id, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10039
70
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id, tvb, offset+11, 2, ENC_BIG_ENDIAN);
10040
70
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4, tvb, offset+13, 4, ENC_BIG_ENDIAN);
10041
70
            proto_item_append_text(tunnel_id_item, ": Id %u, Ext Id %s",
10042
70
                                tvb_get_ntohs(tvb, offset+11), tvb_ip_to_str(pinfo->pool, tvb, offset+13));
10043
70
            break;
10044
664
        case PMSI_TUNNEL_MLDP_P2MP:
10045
1.12k
        case PMSI_TUNNEL_MLDP_MP2MP:
10046
1.12k
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_type, tvb, offset+5, 1, ENC_BIG_ENDIAN);
10047
1.12k
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_afi, tvb, offset+6, 2, ENC_BIG_ENDIAN);
10048
1.12k
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len, tvb, offset+8, 1, ENC_BIG_ENDIAN);
10049
1.12k
            rn_addr_length = tvb_get_uint8(tvb, offset+8);
10050
1.12k
            if(rn_addr_length == 4)
10051
561
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10052
564
            else
10053
564
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6, tvb, offset+9, 16, ENC_NA);
10054
10055
1.12k
            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);
10056
1.12k
            opaque_value_type_item = proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
10057
1.12k
                                                         tvb, offset+11+rn_addr_length, 1, ENC_BIG_ENDIAN);
10058
1.12k
            opaque_value_type = tvb_get_uint8(tvb, offset+11+rn_addr_length);
10059
1.12k
            if(opaque_value_type == PMSI_MLDP_FEC_TYPE_GEN_LSP) {
10060
524
                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);
10061
524
                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);
10062
524
                proto_item_append_text(tunnel_id_item, ": Type: %s root node: %s Id: %u",
10063
524
                                       val_to_str_const(tvb_get_uint8(tvb, offset+5), fec_types_vals, "Unknown"),
10064
524
                                       tvb_ip_to_str(pinfo->pool, tvb, offset+9),
10065
524
                                       tvb_get_ntohl(tvb, offset+14+rn_addr_length));
10066
601
            } else if (opaque_value_type == PMSI_MLDP_FEC_TYPE_EXT_TYPE) {
10067
67
                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);
10068
67
                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);
10069
67
                opaque_value_length = tvb_get_ntohs(tvb, offset+14+rn_addr_length);
10070
67
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str, tvb, offset+16+rn_addr_length,
10071
67
                                    opaque_value_length, ENC_ASCII);
10072
67
            }
10073
534
            else {
10074
                /* This covers situation when opaque id is 0 (reserved) or any other value */
10075
534
                expert_add_info_format(pinfo, opaque_value_type_item, &ei_bgp_attr_pmsi_opaque_type,
10076
534
                                            "Opaque Value type %u wrong, must be modulo 1 or 255", opaque_value_type);
10077
534
            }
10078
1.12k
            break;
10079
195
        case PMSI_TUNNEL_PIMSSM:
10080
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_root_node, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10081
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10082
195
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10083
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10084
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10085
195
            break;
10086
36
        case PMSI_TUNNEL_PIMSM:
10087
36
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10088
36
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10089
36
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10090
36
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10091
36
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10092
36
            break;
10093
69
        case PMSI_TUNNEL_BIDIR_PIM:
10094
69
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10095
69
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10096
69
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10097
69
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10098
69
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10099
69
            break;
10100
171
        case PMSI_TUNNEL_INGRESS:
10101
171
            if(tunnel_id_len == 4){
10102
67
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10103
67
                proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
10104
67
                                       tvb_ip_to_str(pinfo->pool, tvb, offset+5));
10105
104
            } else {
10106
104
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr6, tvb, offset+5, 16, ENC_NA);
10107
104
                proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
10108
104
                                       tvb_ip6_to_str(pinfo->pool, tvb, offset+5));
10109
104
            }
10110
171
            break;
10111
831
        default:
10112
831
            expert_add_info_format(pinfo, pmsi_tunnel_type_item, &ei_bgp_attr_pmsi_tunnel_type,
10113
831
                                            "Tunnel type %u wrong", tunnel_type);
10114
831
            break;
10115
2.63k
    }
10116
10117
10118
2.43k
    return 0;
10119
2.63k
}
10120
10121
static unsigned
10122
dissect_bgp_sr_mpls_sid(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
10123
756
{
10124
756
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
10125
756
            tvb, offset, 3, ENC_BIG_ENDIAN);
10126
756
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
10127
756
            tvb, offset, 3, ENC_BIG_ENDIAN);
10128
756
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
10129
756
            tvb, offset, 3, ENC_BIG_ENDIAN);
10130
756
    offset += 3;
10131
756
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
10132
756
            tvb, offset, 1, ENC_BIG_ENDIAN);
10133
756
    return 4;
10134
756
}
10135
10136
/* Helper to dissect SRv6 Endpoint Behavior and SID Structure (8 octets) */
10137
static unsigned
10138
dissect_bgp_srv6_endpoint_behavior_only(tvbuff_t *tvb, proto_tree *tree, unsigned offset, int ett)
10139
362
{
10140
362
    proto_tree *subtree;
10141
362
    proto_item *ti;
10142
10143
362
    ti = proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior,
10144
362
            tvb, offset, 8, ENC_NA);
10145
362
    subtree = proto_item_add_subtree(ti, ett);
10146
10147
362
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_code,
10148
362
            tvb, offset, 2, ENC_BIG_ENDIAN);
10149
362
    offset += 2;
10150
10151
362
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_reserved,
10152
362
            tvb, offset, 2, ENC_BIG_ENDIAN);
10153
362
    offset += 2;
10154
10155
362
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_lb_length,
10156
362
            tvb, offset, 1, ENC_BIG_ENDIAN);
10157
362
    offset += 1;
10158
10159
362
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_ln_length,
10160
362
            tvb, offset, 1, ENC_BIG_ENDIAN);
10161
362
    offset += 1;
10162
10163
362
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_func_length,
10164
362
            tvb, offset, 1, ENC_BIG_ENDIAN);
10165
362
    offset += 1;
10166
10167
362
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_arg_length,
10168
362
            tvb, offset, 1, ENC_BIG_ENDIAN);
10169
10170
362
    return 8;
10171
362
}
10172
10173
static unsigned
10174
dissect_bgp_srv6_sid_endpoint_behavior(tvbuff_t *tvb, proto_tree *tree, unsigned offset,
10175
                                        gboolean has_endpoint_behavior)
10176
754
{
10177
754
    unsigned bytes_consumed = 16;
10178
10179
754
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_sid,
10180
754
            tvb, offset, 16, ENC_NA);
10181
754
    offset += 16;
10182
10183
754
    if (has_endpoint_behavior) {
10184
293
        bytes_consumed += dissect_bgp_srv6_endpoint_behavior_only(tvb, tree, offset, ett_bgp_segment_list);
10185
293
    }
10186
10187
754
    return bytes_consumed;
10188
754
}
10189
10190
/*
10191
 * Dissect BGP path attributes
10192
 *
10193
 */
10194
void
10195
// NOLINTNEXTLINE(misc-no-recursion)
10196
dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, uint16_t path_attr_len, unsigned tvb_off, packet_info *pinfo)
10197
11.1k
{
10198
11.1k
    uint8_t       bgpa_flags;                 /* path attributes          */
10199
11.1k
    uint8_t       bgpa_type;
10200
11.1k
    unsigned      o;                          /* packet offset            */
10201
11.1k
    unsigned      q=0;                        /* tmp                      */
10202
11.1k
    unsigned      end=0;                      /* message end              */
10203
11.1k
    int           advance;                    /* tmp                      */
10204
11.1k
    proto_item    *ti;                        /* tree item                */
10205
11.1k
    proto_item    *ti_communities;            /* tree communities         */
10206
11.1k
    proto_item    *ti_community;              /* tree for each community  */
10207
11.1k
    proto_item    *ti_as;                     /* tree for each as         */
10208
11.1k
    proto_item    *attr_len_item;
10209
11.1k
    proto_item    *aigp_type_item;
10210
11.1k
    proto_tree    *subtree2;                  /* path attribute subtree   */
10211
11.1k
    proto_tree    *subtree3;                  /* subtree for attributes   */
10212
11.1k
    proto_tree    *subtree4;                  /* subtree for attributes   */
10213
11.1k
    proto_tree    *subtree5;                  /* subtree for attributes   */
10214
11.1k
    proto_tree    *subtree6;                  /* subtree for attributes   */
10215
11.1k
    proto_tree    *subtree7;                  /* subtree for attributes   */
10216
11.1k
    proto_tree    *subtree8;                  /* subtree for attributes   */
10217
11.1k
    proto_tree    *attr_set_subtree;          /* subtree for attr_set     */
10218
11.1k
    proto_tree    *as_path_segment_tree;      /* subtree for AS_PATH segments */
10219
11.1k
    unsigned      number_as_segment=0;        /* Number As segment        */
10220
11.1k
    proto_tree    *communities_tree;          /* subtree for COMMUNITIES  */
10221
11.1k
    proto_tree    *community_tree;            /* subtree for a community  */
10222
11.1k
    proto_tree    *cluster_list_tree;         /* subtree for CLUSTER_LIST */
10223
11.1k
    unsigned      i=0, j, k;                  /* tmp                      */
10224
11.1k
    uint8_t       type=0;                     /* AS_PATH segment type     */
10225
11.1k
    uint8_t       length=0;                   /* AS_PATH segment length   */
10226
11.1k
    uint32_t      aggregator_as;
10227
11.1k
    uint16_t      ssa_type;                   /* SSA T + Type */
10228
11.1k
    uint16_t      ssa_len;                    /* SSA TLV Length */
10229
11.1k
    uint8_t       ssa_v3_len;                 /* SSA L2TPv3 Cookie Length */
10230
11.1k
    uint16_t      encaps_tunnel_type;         /* Encapsulation Tunnel Type */
10231
11.1k
    uint16_t      encaps_tunnel_len;          /* Encapsulation TLV Length */
10232
11.1k
    uint8_t       encaps_tunnel_subtype;      /* Encapsulation Tunnel Sub-TLV Type */
10233
11.1k
    uint16_t      encaps_tunnel_sublen;       /* Encapsulation TLV Sub-TLV Length */
10234
11.1k
    uint16_t      encaps_tunnel_sub_totallen; /* Encapsulation TLV Sub-TLV Length + Type + Length field */
10235
11.1k
    uint8_t       aigp_type;                  /* AIGP TLV type from AIGP attribute */
10236
11.1k
    uint8_t       prefix_sid_subtype;         /* BGP Prefix-SID TLV Type */
10237
11.1k
    uint16_t      prefix_sid_sublen;          /* BGP Prefix-SID TLV Length */
10238
11.1k
    unsigned      prefix_sid_sub_tlv_offset;  /* BGP Prefix-SID SRGB Length */
10239
11.1k
    int           check_srgb;                 /* BGP Prefix-SID SRGB counter */
10240
11.1k
    uint16_t      secpathlen;                 /* BGPsec Secure Path length */
10241
11.1k
    uint16_t      sigblocklen;                /* BGPsec Signature Block length */
10242
11.1k
    uint8_t       secpathcount;               /* Number of Secure Path Segments */
10243
11.1k
    uint16_t      sig_len;                    /* Length of BGPsec Signature */
10244
11.1k
    uint32_t      segment_subtlv_type;        /* Segment List SubTLV Type */
10245
11.1k
    uint32_t      segment_subtlv_length;      /* Segment List SubTLV Length */
10246
11.1k
    uint8_t       srv6_service_subtlv_type;         /* SRv6 Service Sub-TLV type */
10247
11.1k
    uint16_t      srv6_service_subtlv_len;          /* SRv6 Service Sub-TLV length */
10248
11.1k
    uint8_t       srv6_service_data_subsubtlv_type; /* SRv6 Service Data Sub-Sub-TLV type */
10249
11.1k
    uint16_t      srv6_service_data_subsubtlv_len;  /* SRv6 Service Data Sub-Sub-TLV length */
10250
10251
11.1k
    o = tvb_off;
10252
10253
11.1k
    increment_dissection_depth(pinfo);
10254
64.3k
    while (i < path_attr_len) {
10255
61.8k
        proto_item *ti_pa, *ti_flags;
10256
61.8k
        unsigned    off;
10257
61.8k
        unsigned    alen, aoff, tlen, aoff_save;
10258
61.8k
        uint8_t snpa;
10259
61.8k
        uint8_t nexthop_len;
10260
61.8k
        uint8_t asn_len = 0;
10261
61.8k
        uint32_t af, saf, as_num;
10262
10263
61.8k
        static int * const path_flags[] = {
10264
61.8k
            &hf_bgp_update_path_attribute_flags_optional,
10265
61.8k
            &hf_bgp_update_path_attribute_flags_transitive,
10266
61.8k
            &hf_bgp_update_path_attribute_flags_partial,
10267
61.8k
            &hf_bgp_update_path_attribute_flags_extended_length,
10268
61.8k
            &hf_bgp_update_path_attribute_flags_unused,
10269
61.8k
            NULL
10270
61.8k
        };
10271
10272
61.8k
        bgpa_flags = tvb_get_uint8(tvb, o + i);
10273
61.8k
        bgpa_type = tvb_get_uint8(tvb, o + i+1);
10274
10275
        /* check for the Extended Length bit */
10276
61.8k
        if (bgpa_flags & BGP_ATTR_FLAG_EXTENDED_LENGTH) {
10277
1.32k
            alen = tvb_get_ntohs(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
10278
1.32k
            aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+2;
10279
60.5k
        } else {
10280
60.5k
            alen = tvb_get_uint8(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
10281
60.5k
            aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+1;
10282
60.5k
        }
10283
61.8k
        tlen = alen;
10284
10285
61.8k
        ti_pa = proto_tree_add_item(subtree, hf_bgp_update_path_attribute, tvb, o + i, tlen + aoff, ENC_NA);
10286
61.8k
        proto_item_append_text(ti_pa, " - %s", val_to_str(pinfo->pool, bgpa_type, bgpattr_type, "Unknown (%u)"));
10287
10288
61.8k
        subtree2 = proto_item_add_subtree(ti_pa, ett_bgp_attr);
10289
10290
61.8k
        ti_flags = proto_tree_add_bitmask(subtree2, tvb, o + i, hf_bgp_update_path_attribute_flags, ett_bgp_attr_flags, path_flags, ENC_NA);
10291
10292
61.8k
        if ((bgpa_flags & BGP_ATTR_FLAG_OPTIONAL) == 0)
10293
55.0k
            proto_item_append_text(ti_flags, "%s", ", Well-known");
10294
61.8k
        if ((bgpa_flags & BGP_ATTR_FLAG_TRANSITIVE) == 0)
10295
56.0k
            proto_item_append_text(ti_flags, "%s", ", Non-transitive");
10296
61.8k
        if ((bgpa_flags & BGP_ATTR_FLAG_PARTIAL) == 0)
10297
50.6k
            proto_item_append_text(ti_flags, "%s", ", Complete");
10298
10299
61.8k
        proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_type_code, tvb, o + i + 1, 1, ENC_BIG_ENDIAN);
10300
10301
61.8k
        attr_len_item = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_length, tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE,
10302
61.8k
                                            aoff - BGP_SIZE_OF_PATH_ATTRIBUTE, ENC_BIG_ENDIAN);
10303
61.8k
        if (aoff + tlen > path_attr_len - i) {
10304
604
            proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10305
604
                                         "Path attribute length is invalid: %u byte%s", tlen,
10306
604
                                         plurality(tlen, "", "s"));
10307
604
            return;
10308
604
        }
10309
10310
        /* Path Attribute Type */
10311
61.2k
        switch (bgpa_type) {
10312
1.75k
            case BGPTYPE_ORIGIN:
10313
1.75k
                if (tlen != 1) {
10314
1.41k
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10315
1.41k
                                                 "Origin (invalid): %u byte%s", tlen,
10316
1.41k
                                                 plurality(tlen, "", "s"));
10317
1.41k
                } else {
10318
332
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_origin, tvb,
10319
332
                                        o + i + aoff, 1, ENC_BIG_ENDIAN);
10320
332
                    proto_item_append_text(ti_pa, ": %s", val_to_str_const(tvb_get_uint8(tvb, o + i + aoff), bgpattr_origin, "Unknown"));
10321
332
                }
10322
1.75k
                break;
10323
2.23k
            case BGPTYPE_AS_PATH:
10324
2.77k
            case BGPTYPE_AS4_PATH:
10325
                /* Apply heuristic to guess if we are facing 2 or 4 bytes ASN
10326
                   (o + i + aoff) =
10327
                   (o + current attribute + aoff bytes to first tuple)
10328
                   heuristic also tell us how many AS segments we have */
10329
2.77k
                asn_len = heuristic_as2_or_4_from_as_path(tvb, o+i+aoff, o+i+aoff+tlen,
10330
2.77k
                                                          bgpa_type, &number_as_segment);
10331
2.77k
                if (asn_len == 255)
10332
1.24k
                    {
10333
1.24k
                        expert_add_info_format(pinfo, ti_pa, &ei_bgp_attr_as_path_as_len_err,
10334
1.24k
                                               "ASN length uncalculated by heuristic : %u", asn_len);
10335
1.24k
                        break;
10336
1.24k
                    }
10337
1.53k
                proto_item_append_text(ti_pa,": ");
10338
1.53k
                if(tlen == 0) {
10339
686
                    proto_item_append_text(ti_pa,"empty");
10340
686
                }
10341
1.53k
                q = o + i + aoff;
10342
4.13k
                for (k=0; k < number_as_segment; k++)
10343
2.73k
                {
10344
2.73k
                    type = tvb_get_uint8(tvb, q);
10345
2.73k
                    length = tvb_get_uint8(tvb, q+1);
10346
2.73k
                    ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_as_path_segment, tvb,
10347
2.73k
                                             q, length * asn_len + 2, ENC_NA);
10348
2.73k
                    proto_item_append_text(ti,": ");
10349
2.73k
                    as_path_segment_tree = proto_item_add_subtree(ti, ett_bgp_as_path_segment);
10350
2.73k
                    proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_type, tvb,
10351
2.73k
                                        q, 1, ENC_BIG_ENDIAN);
10352
2.73k
                    proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_length, tvb,
10353
2.73k
                                        q+1, 1, ENC_BIG_ENDIAN);
10354
2.73k
                    switch(type)
10355
2.73k
                    {
10356
576
                        case AS_SET:
10357
576
                            proto_item_append_text(ti_pa, "{");
10358
576
                            proto_item_append_text(ti, "{");
10359
576
                            break;
10360
633
                        case AS_CONFED_SET:
10361
633
                            proto_item_append_text(ti_pa, "[");
10362
633
                            proto_item_append_text(ti, "[");
10363
633
                            break;
10364
303
                        case AS_CONFED_SEQUENCE:
10365
303
                            proto_item_append_text(ti_pa, "(");
10366
303
                            proto_item_append_text(ti, "(");
10367
303
                            break;
10368
2.73k
                    }
10369
10370
2.73k
                    q = q + 2;
10371
5.84k
                    for (j = 0; j < length; j++)
10372
3.10k
                    {
10373
3.10k
                        if(asn_len == 2) {
10374
1.05k
                            ti_as = proto_tree_add_item_ret_uint(as_path_segment_tree,
10375
1.05k
                                                hf_bgp_update_path_attribute_as_path_segment_as2,
10376
1.05k
                                                tvb, q, 2, ENC_BIG_ENDIAN, &as_num);
10377
1.05k
                            if (as_num == BGP_AS_TRANS) {
10378
226
                                proto_item_append_text(ti_as, " (AS_TRANS)");
10379
226
                            }
10380
1.05k
                            proto_item_append_text(ti_pa, "%u",
10381
1.05k
                                                   tvb_get_ntohs(tvb, q));
10382
1.05k
                            proto_item_append_text(ti, "%u",
10383
1.05k
                                                   tvb_get_ntohs(tvb, q));
10384
1.05k
                        }
10385
2.05k
                        else if (asn_len == 4) {
10386
2.05k
                            proto_tree_add_item(as_path_segment_tree,
10387
2.05k
                                                hf_bgp_update_path_attribute_as_path_segment_as4,
10388
2.05k
                                                tvb, q, 4, ENC_BIG_ENDIAN);
10389
2.05k
                            proto_item_append_text(ti_pa, "%u",
10390
2.05k
                                                   tvb_get_ntohl(tvb, q));
10391
2.05k
                            proto_item_append_text(ti, "%u",
10392
2.05k
                                                   tvb_get_ntohl(tvb, q));
10393
2.05k
                        }
10394
3.10k
                        if (j != (unsigned)(length-1))
10395
2.36k
                        {
10396
2.36k
                            proto_item_append_text(ti_pa, "%s",
10397
2.36k
                                                   (type == AS_SET || type == AS_CONFED_SET) ?
10398
1.39k
                                                   ", " : " ");
10399
2.36k
                            proto_item_append_text(ti, "%s",
10400
2.36k
                                                   (type == AS_SET || type == AS_CONFED_SET) ?
10401
1.39k
                                                   ", " : " ");
10402
2.36k
                        }
10403
3.10k
                        q += asn_len;
10404
3.10k
                    }
10405
2.73k
                    switch(type)
10406
2.73k
                    {
10407
542
                        case AS_SET:
10408
542
                            proto_item_append_text(ti_pa, "} ");
10409
542
                            proto_item_append_text(ti, "}");
10410
542
                            break;
10411
617
                        case AS_CONFED_SET:
10412
617
                            proto_item_append_text(ti_pa, "] ");
10413
617
                            proto_item_append_text(ti, "]");
10414
617
                            break;
10415
277
                        case AS_CONFED_SEQUENCE:
10416
277
                            proto_item_append_text(ti_pa, ") ");
10417
277
                            proto_item_append_text(ti, ")");
10418
277
                            break;
10419
1.17k
                        default:
10420
1.17k
                            proto_item_append_text(ti_pa, " ");
10421
1.17k
                            break;
10422
2.73k
                    }
10423
2.73k
                }
10424
10425
1.40k
                break;
10426
1.40k
            case BGPTYPE_NEXT_HOP:
10427
625
                if (tlen != 4) {
10428
547
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10429
547
                                                 "Next hop (invalid): %u byte%s", tlen,
10430
547
                                                 plurality(tlen, "", "s"));
10431
547
                } else {
10432
78
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_next_hop, tvb,
10433
78
                                        o + i + aoff, 4, ENC_BIG_ENDIAN);
10434
78
                    proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
10435
78
                }
10436
625
                break;
10437
1.50k
            case BGPTYPE_MULTI_EXIT_DISC:
10438
1.50k
                if (tlen != 4) {
10439
1.29k
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10440
1.29k
                                                 "Multiple exit discriminator (invalid): %u byte%s",
10441
1.29k
                                                 tlen, plurality(tlen, "", "s"));
10442
1.29k
                } else {
10443
209
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_multi_exit_disc, tvb,
10444
209
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10445
209
                    proto_item_append_text(ti_pa,": %u", tvb_get_ntohl(tvb, o + i + aoff));
10446
209
                }
10447
1.50k
                break;
10448
510
            case BGPTYPE_LOCAL_PREF:
10449
510
                if (tlen != 4) {
10450
313
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10451
313
                                                 "Local preference (invalid): %u byte%s", tlen,
10452
313
                                                 plurality(tlen, "", "s"));
10453
313
                } else {
10454
197
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_local_pref, tvb,
10455
197
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10456
197
                    proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
10457
197
                }
10458
510
                break;
10459
871
            case BGPTYPE_ATOMIC_AGGREGATE:
10460
871
                if (tlen != 0) {
10461
630
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10462
630
                                                 "Atomic aggregate (invalid): %u byte%s", tlen,
10463
630
                                                 plurality(tlen, "", "s"));
10464
630
                }
10465
871
                break;
10466
529
            case BGPTYPE_AGGREGATOR:
10467
529
                if (tlen != 6 && tlen != 8) {
10468
394
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10469
394
                                                 "Aggregator (invalid): %u byte%s", tlen,
10470
394
                                                 plurality(tlen, "", "s"));
10471
394
                    break;
10472
394
                }
10473
                /* FALL THROUGH */
10474
627
            case BGPTYPE_AS4_AGGREGATOR:
10475
627
                if (bgpa_type == BGPTYPE_AS4_AGGREGATOR && tlen != 8)
10476
426
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10477
426
                                                 "Aggregator (invalid): %u byte%s", tlen,
10478
426
                                                 plurality(tlen, "", "s"));
10479
201
                else {
10480
201
                    asn_len = tlen - 4;
10481
201
                    aggregator_as = (asn_len == 2) ?
10482
67
                        tvb_get_ntohs(tvb, o + i + aoff) :
10483
201
                        tvb_get_ntohl(tvb, o + i + aoff);
10484
201
                    proto_tree_add_uint(subtree2, hf_bgp_update_path_attribute_aggregator_as, tvb,
10485
201
                                        o + i + aoff, asn_len, aggregator_as);
10486
201
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aggregator_origin, tvb,
10487
201
                                        o + i + aoff + asn_len, 4, ENC_BIG_ENDIAN);
10488
10489
201
                    proto_item_append_text(ti_pa, ": AS: %u origin: %s", aggregator_as,
10490
201
                                           tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff + asn_len));
10491
201
                }
10492
627
                break;
10493
579
            case BGPTYPE_COMMUNITIES:
10494
579
                if (tlen % 4 != 0) {
10495
236
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10496
236
                                                 "Communities (invalid): %u byte%s", tlen,
10497
236
                                                 plurality(tlen, "", "s"));
10498
236
                    break;
10499
236
                }
10500
10501
343
                proto_item_append_text(ti_pa, ": ");
10502
10503
343
                ti_communities = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_communities,
10504
343
                                                     tvb, o + i + aoff, tlen, ENC_NA);
10505
10506
343
                communities_tree = proto_item_add_subtree(ti_communities,
10507
343
                                                          ett_bgp_communities);
10508
343
                proto_item_append_text(ti_communities, ": ");
10509
                /* (o + i + aoff) =
10510
                   (o + current attribute + aoff bytes to first tuple) */
10511
343
                q = o + i + aoff;
10512
343
                end = q + tlen;
10513
10514
                /* snarf each community */
10515
1.44k
                while (q < end) {
10516
                    /* check for reserved values */
10517
1.09k
                    uint32_t community = tvb_get_ntohl(tvb, q);
10518
1.09k
                    if ((community & 0xFFFF0000) == FOURHEX0 ||
10519
766
                        (community & 0xFFFF0000) == FOURHEXF) {
10520
470
                        proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community_well_known,
10521
470
                                            tvb, q, 4, ENC_BIG_ENDIAN);
10522
470
                        proto_item_append_text(ti_pa, "%s ", val_to_str_const(community, community_vals, "Reserved"));
10523
470
                        proto_item_append_text(ti_communities, "%s ", val_to_str_const(community, community_vals, "Reserved"));
10524
470
                    }
10525
628
                    else {
10526
628
                        ti_community = proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community, tvb,
10527
628
                                                           q, 4, ENC_NA);
10528
628
                        community_tree = proto_item_add_subtree(ti_community,
10529
628
                                                                ett_bgp_community);
10530
628
                        proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_as,
10531
628
                                            tvb, q, 2, ENC_BIG_ENDIAN);
10532
628
                        proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_value,
10533
628
                                            tvb, q+2, 2, ENC_BIG_ENDIAN);
10534
628
                        proto_item_append_text(ti_pa, "%u:%u ",tvb_get_ntohs(tvb, q),
10535
628
                                               tvb_get_ntohs(tvb, q+2));
10536
628
                        proto_item_append_text(ti_communities, "%u:%u ",tvb_get_ntohs(tvb, q),
10537
628
                                               tvb_get_ntohs(tvb, q+2));
10538
628
                        proto_item_append_text(ti_community, ": %u:%u ",tvb_get_ntohs(tvb, q),
10539
628
                                               tvb_get_ntohs(tvb, q+2));
10540
628
                    }
10541
10542
1.09k
                    q += 4;
10543
1.09k
                }
10544
10545
10546
343
                break;
10547
482
            case BGPTYPE_ORIGINATOR_ID:
10548
482
                if (tlen != 4) {
10549
285
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10550
285
                                                 "Originator identifier (invalid): %u byte%s", tlen,
10551
285
                                                 plurality(tlen, "", "s"));
10552
285
                } else {
10553
197
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_originator_id, tvb,
10554
197
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10555
197
                    proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
10556
197
                }
10557
482
                break;
10558
10.9k
            case BGPTYPE_MP_REACH_NLRI:
10559
                /* RFC 2283 says that a MP_[UN]REACH_NLRI path attribute can
10560
                 * have more than one <AFI, SAFI, Next Hop, ..., NLRI> tuple.
10561
                 * However, that doesn't work because the NLRI is also a
10562
                 * variable number of <length, prefix> fields without a field
10563
                 * for the overall length of the NLRI. Thus one would have to
10564
                 * guess whether a particular byte were the length of the next
10565
                 * prefix or a new AFI. So no one ever implemented that, and
10566
                 * RFC 2858, obsoleting 2283, says you can't do that.
10567
                 */
10568
10.9k
                proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_address_family, tvb,
10569
10.9k
                                    o + i + aoff, 2, ENC_BIG_ENDIAN, &af);
10570
10.9k
                proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_safi, tvb,
10571
10.9k
                                    o + i + aoff + 2, 1, ENC_BIG_ENDIAN, &saf);
10572
10.9k
                nexthop_len = tvb_get_uint8(tvb, o + i + aoff + 3);
10573
10.9k
                save_afi_safi_data(pinfo, (uint16_t)af, (uint8_t)saf);
10574
10575
10.9k
                decode_mp_next_hop(tvb_new_subset_length(tvb, o + i + aoff + 3, nexthop_len + 1), subtree2, pinfo, af, saf, nexthop_len);
10576
10577
10.9k
                aoff_save = aoff;
10578
10.9k
                tlen -= nexthop_len + 4;
10579
10.9k
                aoff += nexthop_len + 4;
10580
10581
10.9k
                off = 0;
10582
10.9k
                ti = proto_tree_add_item_ret_uint8(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa, tvb,
10583
10.9k
                                                   o + i + aoff, 1, ENC_BIG_ENDIAN, &snpa);
10584
10.9k
                off++;
10585
10.9k
                if (snpa) {
10586
4.83k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_snpa);
10587
25.0k
                    for (/*nothing*/; snpa > 0; snpa--) {
10588
20.2k
                        uint8_t snpa_length = tvb_get_uint8(tvb, o + i + aoff + off);
10589
20.2k
                        proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length, tvb,
10590
20.2k
                                            o + i + aoff + off, 1, ENC_BIG_ENDIAN);
10591
20.2k
                        off++;
10592
20.2k
                        proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa, tvb,
10593
20.2k
                                            o + i + aoff + off, snpa_length, ENC_NA);
10594
20.2k
                        off += snpa_length;
10595
20.2k
                    }
10596
4.83k
                }
10597
10.9k
                tlen -= off;
10598
10.9k
                aoff += off;
10599
10600
10.9k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri, tvb, o + i + aoff, tlen, ENC_NA);
10601
10.9k
                subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
10602
10603
10.9k
                if (tlen)  {
10604
9.72k
                    if (af != AFNUM_IP && af != AFNUM_IP6 && af != AFNUM_AFI_FOR_L2VPN_INFORMATION && af != AFNUM_BGP_LS) {
10605
274
                        proto_tree_add_expert(subtree3, pinfo, &ei_bgp_unknown_afi, tvb, o + i + aoff, tlen);
10606
9.45k
                    } else {
10607
128k
                        while (tlen > 0) {
10608
127k
                            advance = decode_prefix_MP(subtree3,
10609
127k
                                                       hf_bgp_nlri_path_id,
10610
127k
                                                       hf_bgp_mp_reach_nlri_ipv4_prefix,
10611
127k
                                                       hf_bgp_mp_reach_nlri_ipv6_prefix,
10612
127k
                                                       af, saf, tlen,
10613
127k
                                                       tvb, o + i + aoff, "MP Reach NLRI", pinfo);
10614
127k
                            if (advance < 0)
10615
9.11k
                                break;
10616
118k
                            tlen -= advance;
10617
118k
                            aoff += advance;
10618
118k
                        }
10619
9.45k
                    }
10620
9.72k
                }
10621
10.9k
                aoff = aoff_save;
10622
10.9k
                break;
10623
12.6k
            case BGPTYPE_MP_UNREACH_NLRI:
10624
12.6k
                af = tvb_get_ntohs(tvb, o + i + aoff);
10625
12.6k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_address_family, tvb,
10626
12.6k
                                    o + i + aoff, 2, ENC_BIG_ENDIAN);
10627
12.6k
                saf = tvb_get_uint8(tvb, o + i + aoff + 2) ;
10628
12.6k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_safi, tvb,
10629
12.6k
                                    o + i + aoff+2, 1, ENC_BIG_ENDIAN);
10630
12.6k
                save_afi_safi_data(pinfo, (uint16_t)af, (uint8_t)saf);
10631
10632
12.6k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri, tvb, o + i + aoff + 3, tlen - 3, ENC_NA);
10633
12.6k
                subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_unreach_nlri);
10634
10635
12.6k
                aoff_save = aoff;
10636
12.6k
                tlen -= 3;
10637
12.6k
                aoff += 3;
10638
12.6k
                if (tlen > 0) {
10639
10640
48.9k
                    while (tlen > 0) {
10641
46.6k
                        advance = decode_prefix_MP(subtree3,
10642
46.6k
                                                   hf_bgp_nlri_path_id,
10643
46.6k
                                                   hf_bgp_mp_unreach_nlri_ipv4_prefix,
10644
46.6k
                                                   hf_bgp_mp_unreach_nlri_ipv6_prefix,
10645
46.6k
                                                   af, saf, tlen,
10646
46.6k
                                                   tvb, o + i + aoff, "MP Unreach NLRI", pinfo);
10647
46.6k
                        if (advance < 0)
10648
10.0k
                            break;
10649
36.5k
                        tlen -= advance;
10650
36.5k
                        aoff += advance;
10651
36.5k
                    }
10652
12.3k
                }
10653
12.6k
                aoff = aoff_save;
10654
12.6k
                break;
10655
351
            case BGPTYPE_CLUSTER_LIST:
10656
351
                if (tlen % 4 != 0) {
10657
209
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10658
209
                                                 "Cluster list (invalid): %u byte%s", tlen,
10659
209
                                                 plurality(tlen, "", "s"));
10660
209
                    break;
10661
209
                }
10662
10663
142
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_cluster_list,
10664
142
                                         tvb, o + i + aoff, tlen, ENC_NA);
10665
142
                cluster_list_tree = proto_item_add_subtree(ti,
10666
142
                                                               ett_bgp_cluster_list);
10667
10668
                /* (o + i + aoff) =
10669
                   (o + current attribute + aoff bytes to first tuple) */
10670
142
                q = o + i + aoff;
10671
142
                end = q + tlen;
10672
142
                proto_item_append_text(ti, ":");
10673
142
                proto_item_append_text(ti_pa, ":");
10674
                /* snarf each cluster identifier */
10675
523
                while (q < end) {
10676
381
                    proto_tree_add_item(cluster_list_tree, hf_bgp_update_path_attribute_cluster_id,
10677
381
                                        tvb, q, 4, ENC_BIG_ENDIAN);
10678
381
                    proto_item_append_text(ti, " %s", tvb_ip_to_str(pinfo->pool, tvb, q));
10679
381
                    proto_item_append_text(ti_pa, " %s", tvb_ip_to_str(pinfo->pool, tvb, q));
10680
381
                    q += 4;
10681
381
                }
10682
10683
142
                break;
10684
1.47k
            case BGPTYPE_EXTENDED_COMMUNITY:
10685
1.47k
                if (tlen %8 != 0) {
10686
233
                    expert_add_info_format(pinfo, attr_len_item, &ei_bgp_ext_com_len_bad,
10687
233
                                           "Community length %u wrong, must be modulo 8", tlen);
10688
1.24k
                } else {
10689
1.24k
                    dissect_bgp_update_ext_com(subtree2, tvb, tlen, o+i+aoff, pinfo);
10690
1.24k
                }
10691
1.47k
                break;
10692
1.19k
            case BGPTYPE_SAFI_SPECIFIC_ATTR:
10693
1.19k
                q = o + i + aoff;
10694
1.19k
                end = o + i + aoff + tlen ;
10695
10696
2.25k
                while(q < end) {
10697
1.55k
                    ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
10698
1.55k
                    ssa_len = tvb_get_ntohs(tvb, q + 2);
10699
10700
1.55k
                    subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, MIN((unsigned)ssa_len + 4, end - q),
10701
1.55k
                                                             ett_bgp_ssa, NULL, "%s Information",
10702
1.55k
                                                             val_to_str_const(ssa_type, bgp_ssa_type, "Unknown SSA"));
10703
10704
1.55k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_t, tvb,
10705
1.55k
                                        q, 1, ENC_BIG_ENDIAN);
10706
1.55k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb, q, 2, ENC_BIG_ENDIAN);
10707
10708
1.55k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
10709
10710
1.55k
                    if ((ssa_len == 0) || (q + ssa_len > end)) {
10711
429
                        proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 2,
10712
429
                                                     end - q - 2, "Invalid Length of %u", ssa_len);
10713
429
                        break;
10714
429
                    }
10715
10716
1.12k
                    switch (ssa_type) {
10717
467
                        case BGP_SSA_L2TPv3:
10718
467
                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_pref, tvb,
10719
467
                                                q + 4, 2, ENC_BIG_ENDIAN);
10720
10721
467
                            subtree4 = proto_tree_add_subtree(subtree3, tvb, q + 6, 1, ett_bgp_ssa_subtree, NULL, "Flags");
10722
467
                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_s, tvb,
10723
467
                                                q + 6, 1, ENC_BIG_ENDIAN);
10724
467
                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_unused, tvb,
10725
467
                                                q + 6, 1, ENC_BIG_ENDIAN);
10726
10727
467
                            ssa_v3_len = tvb_get_uint8(tvb, q + 7);
10728
467
                            if (ssa_v3_len + 8 == ssa_len){
10729
133
                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie_len, tvb,
10730
133
                                                    q + 7, 1, ENC_BIG_ENDIAN);
10731
334
                            } else {
10732
334
                                proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 7, 1,
10733
334
                                                             "Invalid Cookie Length of %u", ssa_v3_len);
10734
334
                                q += ssa_len + 4; /* 4 from type and length */
10735
334
                                break;
10736
334
                            }
10737
133
                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_session_id, tvb,
10738
133
                                                q + 8, 4, ENC_BIG_ENDIAN);
10739
133
                            if (ssa_v3_len)
10740
67
                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie, tvb,
10741
67
                                                    q + 12, ssa_v3_len, ENC_NA);
10742
133
                            q += ssa_len + 4; /* 4 from type and length */
10743
133
                            break;
10744
8
                        case BGP_SSA_mGRE:
10745
145
                        case BGP_SSA_IPSec:
10746
147
                        case BGP_SSA_MPLS:
10747
213
                        default:
10748
213
                            proto_tree_add_item(subtree3, hf_bgp_ssa_value, tvb,
10749
213
                                                q + 4, ssa_len, ENC_NA);
10750
213
                            q += ssa_len + 4; /* 4 from type and length */
10751
213
                            break;
10752
201
                        case BGP_SSA_L2TPv3_IN_IPSec:
10753
399
                        case BGP_SSA_mGRE_IN_IPSec:
10754
                            /* These contain BGP_SSA_IPSec and BGP_SSA_L2TPv3/BGP_SSA_mGRE */
10755
399
                            q += 4; /* 4 from type and length */
10756
399
                            break;
10757
1.12k
                    } /* switch (bgpa.bgpa_type) */
10758
1.12k
                }
10759
1.13k
                break;
10760
1.82k
            case BGPTYPE_TUNNEL_ENCAPS_ATTR:
10761
1.82k
                q = o + i + aoff;
10762
1.82k
                end = o + i + aoff + tlen;
10763
10764
1.82k
                subtree3 = proto_tree_add_subtree(subtree2, tvb, q, tlen, ett_bgp_tunnel_tlv, NULL, "TLV Encodings");
10765
10766
3.11k
                while (q < end) {
10767
1.83k
                    encaps_tunnel_type = tvb_get_ntohs(tvb, q);
10768
1.83k
                    encaps_tunnel_len = tvb_get_ntohs(tvb, q + 2);
10769
10770
1.83k
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, encaps_tunnel_len + 4,
10771
1.83k
                                         ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
10772
1.83k
                                         val_to_str_const(encaps_tunnel_type, bgp_attr_tunnel_type, "Unknown"), encaps_tunnel_len + 4);
10773
10774
1.83k
                    proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_type, tvb, q, 2, ENC_BIG_ENDIAN);
10775
1.83k
                    proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
10776
10777
1.83k
                    subtree5 = proto_tree_add_subtree(subtree4, tvb, q + 4, encaps_tunnel_len, ett_bgp_tunnel_subtlv, NULL, "Sub-TLV Encodings");
10778
10779
1.83k
                    q += 4;
10780
1.83k
                    j = q + encaps_tunnel_len;
10781
18.8k
                    while ( q < j ) {
10782
17.5k
                        encaps_tunnel_subtype = tvb_get_uint8(tvb, q);
10783
17.5k
                        if (encaps_tunnel_subtype < 128) {
10784
15.3k
                            encaps_tunnel_sublen = tvb_get_uint8(tvb, q + 1);
10785
15.3k
                            encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 2;
10786
15.3k
                        } else {
10787
2.23k
                            encaps_tunnel_sublen = tvb_get_ntohs(tvb, q + 1);
10788
2.23k
                            encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 3;
10789
2.23k
                        }
10790
17.5k
                        subtree6 = proto_tree_add_subtree_format(subtree5, tvb, q, encaps_tunnel_sub_totallen,
10791
17.5k
                                             ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
10792
17.5k
                                             val_to_str_const(encaps_tunnel_subtype, subtlv_type, "Unknown"), encaps_tunnel_sub_totallen);
10793
17.5k
                        proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
10794
17.5k
                        q += 1;
10795
17.5k
                        if (encaps_tunnel_subtype < 128) {
10796
15.3k
                            proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 1, ENC_BIG_ENDIAN);
10797
15.3k
                            q += 1;
10798
15.3k
                        } else {
10799
2.26k
                            proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 2, ENC_BIG_ENDIAN);
10800
2.26k
                            q += 2;
10801
2.26k
                        }
10802
10803
17.5k
                        switch (encaps_tunnel_subtype) {
10804
3.49k
                            case TUNNEL_SUBTLV_ENCAPSULATION:
10805
3.49k
                                {
10806
3.49k
                                static int * const vxlan_flags[] = {
10807
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
10808
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
10809
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
10810
3.49k
                                    NULL
10811
3.49k
                                    };
10812
3.49k
                                static int * const vxlan_gpe_flags[] = {
10813
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
10814
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
10815
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
10816
3.49k
                                    NULL
10817
3.49k
                                    };
10818
3.49k
                                static int * const nvgre_flags[] = {
10819
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
10820
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
10821
3.49k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
10822
3.49k
                                    NULL
10823
3.49k
                                    };
10824
3.49k
                                if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP) {
10825
230
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_session_id, tvb, q, 4, ENC_BIG_ENDIAN);
10826
230
                                    q += 4;
10827
230
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_cookie, tvb, q, encaps_tunnel_sublen - 4, ENC_NA);
10828
230
                                    q += (encaps_tunnel_sublen - 4);
10829
3.26k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_GRE || encaps_tunnel_type == TUNNEL_TYPE_MPLS_IN_GRE) {
10830
827
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 4, ENC_BIG_ENDIAN);
10831
827
                                    q += 4;
10832
2.44k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN) {
10833
411
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
10834
411
                                            ett_bgp_vxlan, vxlan_flags, ENC_BIG_ENDIAN);
10835
411
                                    q += 1;
10836
411
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
10837
411
                                    q += 3;
10838
411
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac, tvb, q, 6, ENC_NA);
10839
411
                                    q += 6;
10840
411
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
10841
411
                                    q += 2;
10842
2.03k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN_GPE) {
10843
76
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
10844
76
                                            ett_bgp_vxlan, vxlan_gpe_flags, ENC_BIG_ENDIAN);
10845
76
                                    q += 1;
10846
76
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
10847
76
                                    q += 2;
10848
76
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
10849
76
                                    q += 3;
10850
76
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10851
76
                                    q += 1;
10852
1.95k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_NVGRE) {
10853
201
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
10854
201
                                            ett_bgp_vxlan, nvgre_flags, ENC_BIG_ENDIAN);
10855
201
                                    q += 1;
10856
201
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
10857
201
                                    q += 3;
10858
201
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac, tvb, q, 6, ENC_NA);
10859
201
                                    q += 6;
10860
201
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
10861
201
                                    q += 2;
10862
201
                                }
10863
3.49k
                                }
10864
3.49k
                                break;
10865
757
                            case TUNNEL_SUBTLV_PROTO_TYPE:
10866
757
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 2, ENC_BIG_ENDIAN);
10867
757
                                q += 2;
10868
757
                                break;
10869
905
                            case TUNNEL_SUBTLV_COLOR:
10870
905
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_color_value, tvb, q, 4, ENC_BIG_ENDIAN);
10871
905
                                q += 4;
10872
905
                                break;
10873
1.28k
                            case TUNNEL_SUBTLV_LOAD_BALANCE:
10874
1.28k
                                if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP || encaps_tunnel_type == TUNNEL_TYPE_GRE) {
10875
439
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_lb_block_length, tvb, q, 4, ENC_BIG_ENDIAN);
10876
439
                                    q += 4;
10877
439
                                }
10878
1.28k
                                break;
10879
212
                            case TUNNEL_SUBTLV_PREFERENCE:
10880
212
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_flags, tvb, q, 1, ENC_BIG_ENDIAN);
10881
212
                                q += 1;
10882
212
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10883
212
                                q += 1;
10884
212
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_preference, tvb, q, 4, ENC_NA);
10885
212
                                q += 4;
10886
212
                                break;
10887
1.22k
                            case TUNNEL_SUBTLV_BINDING_SID:
10888
1.22k
                                {
10889
1.22k
                                static int * const flags[] = {
10890
1.22k
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
10891
1.22k
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
10892
1.22k
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
10893
1.22k
                                    NULL
10894
1.22k
                                    };
10895
10896
1.22k
                                proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
10897
1.22k
                                        ett_bgp_binding_sid, flags, ENC_BIG_ENDIAN);
10898
1.22k
                                q += 1;
10899
1.22k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
10900
1.22k
                                        tvb, q, 1, ENC_BIG_ENDIAN);
10901
1.22k
                                q += 1;
10902
10903
1.22k
                                if (encaps_tunnel_sublen == 6) {
10904
208
                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree6, q);
10905
1.01k
                                } else if (encaps_tunnel_sublen > 2) {
10906
526
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid, tvb, q,
10907
526
                                            encaps_tunnel_sublen - 2, ENC_NA);
10908
526
                                    q += (encaps_tunnel_sublen - 2);
10909
526
                                }
10910
1.22k
                                }
10911
1.22k
                                break;
10912
273
                            case TUNNEL_SUBTLV_SRV6_BINDING_SID:
10913
273
                                {
10914
273
                                static int * const srv6_binding_flags[] = {
10915
273
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_specified,
10916
273
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_invalid,
10917
273
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_b_flag,
10918
273
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_reserved,
10919
273
                                    NULL
10920
273
                                    };
10921
10922
273
                                proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags,
10923
273
                                        ett_bgp_binding_sid, srv6_binding_flags, ENC_BIG_ENDIAN);
10924
273
                                q += 1;
10925
273
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_reserved,
10926
273
                                        tvb, q, 1, ENC_BIG_ENDIAN);
10927
273
                                q += 1;
10928
10929
                                /* SRv6 Binding SID (16 octets) */
10930
273
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_sid,
10931
273
                                        tvb, q, 16, ENC_NA);
10932
273
                                q += 16;
10933
10934
                                /* Optional SRv6 Endpoint Behavior (8 octets) - use helper function */
10935
273
                                if (encaps_tunnel_sublen == 26) {
10936
69
                                    q += dissect_bgp_srv6_endpoint_behavior_only(tvb, subtree6, q, ett_bgp_binding_sid);
10937
69
                                }
10938
273
                                }
10939
273
                                break;
10940
234
                            case TUNNEL_SUBTLV_ENLP:
10941
234
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_flags, tvb, q, 1, ENC_BIG_ENDIAN);
10942
234
                                q += 1;
10943
234
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10944
234
                                q += 1;
10945
234
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp, tvb, q, 1, ENC_BIG_ENDIAN);
10946
234
                                q += 1;
10947
234
                                break;
10948
502
                            case TUNNEL_SUBTLV_PRIORITY:
10949
502
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_priority, tvb, q, 1, ENC_BIG_ENDIAN);
10950
502
                                q += 1;
10951
502
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10952
502
                                q += 1;
10953
502
                                break;
10954
1.33k
                            case TUNNEL_SUBTLV_SEGMENT_LIST:
10955
1.33k
                                {
10956
1.33k
                                static int * const flags[] = {
10957
1.33k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
10958
1.33k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
10959
1.33k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_s_flag,
10960
1.33k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_b_flag,
10961
1.33k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
10962
1.33k
                                    NULL
10963
1.33k
                                    };
10964
10965
1.33k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10966
1.33k
                                q += 1;
10967
1.33k
                                encaps_tunnel_sublen -= 1;
10968
1.33k
                                subtree7 = proto_tree_add_subtree(subtree6, tvb, q, encaps_tunnel_sublen,
10969
1.33k
                                        ett_bgp_segment_list, &ti, "sub-TLVs:");
10970
1.33k
                                bool first_subtlv = true;
10971
12.9k
                                while (encaps_tunnel_sublen > 2) {
10972
11.6k
                                    segment_subtlv_type = tvb_get_uint8(tvb, q);
10973
11.6k
                                    segment_subtlv_length = tvb_get_uint8(tvb, q + 1);
10974
11.6k
                                    subtree8 = proto_tree_add_subtree_format(subtree7, tvb, q, segment_subtlv_length + 2,
10975
11.6k
                                            ett_bgp_segment_list, NULL, "SubTLV: %s", val_to_str_const(segment_subtlv_type,
10976
11.6k
                                            bgp_sr_policy_list_type, "Unknown"));
10977
10978
                                    /* Append sub-TLV summary to parent item - use short name for readability */
10979
11.6k
                                    const char *short_name = val_to_str_const(segment_subtlv_type,
10980
11.6k
                                            bgp_sr_policy_list_type_short, "Unknown");
10981
10982
11.6k
                                    if (!first_subtlv) {
10983
10.5k
                                        proto_item_append_text(ti, ",");
10984
10.5k
                                    }
10985
11.6k
                                    proto_item_append_text(ti, " %s (%u byte%s)",
10986
11.6k
                                        short_name,
10987
11.6k
                                        segment_subtlv_length + 2,
10988
11.6k
                                        (segment_subtlv_length + 2 == 1) ? "" : "s");
10989
11.6k
                                    first_subtlv = false;
10990
11.6k
                                    proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
10991
11.6k
                                    q += 1;
10992
11.6k
                                    proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length, tvb, q, 1, ENC_BIG_ENDIAN);
10993
11.6k
                                    q += 1;
10994
11.6k
                                    if (segment_subtlv_length > 0) {
10995
6.12k
                                        switch(segment_subtlv_type) {
10996
                                            /* TODO: Dissect further subTLVs data as defined in draft-ietf-idr-segment-routing-te-policy-08 section 2.4.3.2 */
10997
644
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A:
10998
644
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
10999
644
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11000
644
                                                q += 1;
11001
644
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11002
644
                                                        tvb, q, 1, ENC_NA);
11003
644
                                                q += 1;
11004
644
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
11005
644
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
11006
644
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
11007
644
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
11008
644
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
11009
644
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
11010
644
                                                q += 3;
11011
644
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
11012
644
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11013
644
                                                q += 1;
11014
644
                                                break;
11015
294
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B:
11016
                                                /* RFC 9830 Section 2.4.4.2.2 - Type B Segment
11017
                                                 * Length MUST be 26 when SRv6 Endpoint Behavior and SID
11018
                                                 * Structure is present; else it MUST be 18.
11019
                                                 * RFC 9830 Section 2.4.4.2.3 - B-Flag indicates presence
11020
                                                 * of SRv6 Endpoint Behavior and SID Structure.
11021
                                                 */
11022
294
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11023
294
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11024
294
                                                q += 1;
11025
294
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11026
294
                                                        tvb, q, 1, ENC_NA);
11027
294
                                                q += 1;
11028
11029
294
                                                q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11030
294
                                                        segment_subtlv_length == 26);
11031
294
                                                break;
11032
378
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C:
11033
                                                /* RFC 9831 Section 2.1 - Type C Segment
11034
                                                 * IPv4 Node Address, SR Algorithm, and optional SR-MPLS SID
11035
                                                 * Length MUST be 10 when SR-MPLS SID is present; else it MUST be 6.
11036
                                                 */
11037
378
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11038
378
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11039
378
                                                q += 1;
11040
11041
                                                /* SR Algorithm (1 octet) */
11042
378
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11043
378
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11044
378
                                                q += 1;
11045
11046
                                                /* IPv4 Node Address (4 octets) */
11047
378
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address,
11048
378
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11049
378
                                                q += 4;
11050
11051
378
                                                if (segment_subtlv_length == 10) {
11052
67
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11053
67
                                                }
11054
378
                                                break;
11055
333
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D:
11056
                                                /* RFC 9831 Section 2.2 - Type D Segment
11057
                                                 * IPv6 Node Address, SR Algorithm, and optional SR-MPLS SID
11058
                                                 * Length MUST be 22 when SR-MPLS SID is present; else it MUST be 18.
11059
                                                 */
11060
333
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11061
333
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11062
333
                                                q += 1;
11063
11064
                                                /* SR Algorithm (1 octet) */
11065
333
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11066
333
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11067
333
                                                q += 1;
11068
11069
                                                /* IPv6 Node Address (16 octets) */
11070
333
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address,
11071
333
                                                        tvb, q, 16, ENC_NA);
11072
333
                                                q += 16;
11073
11074
333
                                                if (segment_subtlv_length == 22) {
11075
69
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11076
69
                                                }
11077
333
                                                break;
11078
427
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E:
11079
                                                /* RFC 9831 Section 2.3 - Type E Segment
11080
                                                 * IPv4 Node Address, Local Interface ID, and optional SR-MPLS SID
11081
                                                 * Length MUST be 14 when SR-MPLS SID is present; else it MUST be 10.
11082
                                                 */
11083
427
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11084
427
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11085
427
                                                q += 1;
11086
11087
                                                /* Reserved (1 octet) */
11088
427
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11089
427
                                                        tvb, q, 1, ENC_NA);
11090
427
                                                q += 1;
11091
11092
                                                /* Local Interface ID (4 octets) */
11093
427
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
11094
427
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11095
427
                                                q += 4;
11096
11097
                                                /* IPv4 Node Address (4 octets) */
11098
427
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address,
11099
427
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11100
427
                                                q += 4;
11101
11102
427
                                                if (segment_subtlv_length == 14) {
11103
203
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11104
203
                                                }
11105
427
                                                break;
11106
309
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F:
11107
                                                /* RFC 9831 Section 2.4 - Type F Segment
11108
                                                 * IPv4 adjacency (local/remote addresses) and optional SR-MPLS SID
11109
                                                 * Length MUST be 14 when SR-MPLS SID is present; else it MUST be 10.
11110
                                                 */
11111
309
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11112
309
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11113
309
                                                q += 1;
11114
11115
                                                /* Reserved (1 octet) */
11116
309
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11117
309
                                                        tvb, q, 1, ENC_NA);
11118
309
                                                q += 1;
11119
11120
                                                /* Local IPv4 Address (4 octets) */
11121
309
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv4_address,
11122
309
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11123
309
                                                q += 4;
11124
11125
                                                /* Remote IPv4 Address (4 octets) */
11126
309
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv4_address,
11127
309
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11128
309
                                                q += 4;
11129
11130
309
                                                if (segment_subtlv_length == 14) {
11131
73
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11132
73
                                                }
11133
309
                                                break;
11134
277
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G:
11135
                                                /* RFC 9831 Section 2.5 - Type G Segment
11136
                                                 * IPv6 link-local adjacency with local/remote node addresses and interface IDs
11137
                                                 * Length MUST be 46 when SR-MPLS SID is present; else it MUST be 42.
11138
                                                 */
11139
277
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11140
277
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11141
277
                                                q += 1;
11142
11143
                                                /* Reserved (1 octet) */
11144
277
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11145
277
                                                        tvb, q, 1, ENC_NA);
11146
277
                                                q += 1;
11147
11148
                                                /* Local Interface ID (4 octets) */
11149
277
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
11150
277
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11151
277
                                                q += 4;
11152
11153
                                                /* IPv6 Local Node Address (16 octets) */
11154
277
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11155
277
                                                        tvb, q, 16, ENC_NA);
11156
277
                                                q += 16;
11157
11158
                                                /* Remote Interface ID (4 octets) */
11159
277
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id,
11160
277
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11161
277
                                                q += 4;
11162
11163
                                                /* IPv6 Remote Node Address (16 octets) */
11164
277
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11165
277
                                                        tvb, q, 16, ENC_NA);
11166
277
                                                q += 16;
11167
11168
277
                                                if (segment_subtlv_length == 46) {
11169
66
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11170
66
                                                }
11171
277
                                                break;
11172
297
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H:
11173
                                                /* RFC 9831 Section 2.6 - Type H Segment
11174
                                                 * IPv6 adjacency (local/remote addresses) and optional SR-MPLS SID
11175
                                                 * Length MUST be 38 when SR-MPLS SID is present; else it MUST be 34.
11176
                                                 */
11177
297
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11178
297
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11179
297
                                                q += 1;
11180
11181
                                                /* Reserved (1 octet) */
11182
297
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11183
297
                                                        tvb, q, 1, ENC_NA);
11184
297
                                                q += 1;
11185
11186
                                                /* Local IPv6 Address (16 octets) */
11187
297
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11188
297
                                                        tvb, q, 16, ENC_NA);
11189
297
                                                q += 16;
11190
11191
                                                /* Remote IPv6 Address (16 octets) */
11192
297
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11193
297
                                                        tvb, q, 16, ENC_NA);
11194
297
                                                q += 16;
11195
11196
297
                                                if (segment_subtlv_length == 38) {
11197
70
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11198
70
                                                }
11199
297
                                                break;
11200
229
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J:
11201
                                                /* RFC 9831 Section 2.8 - Type J Segment
11202
                                                 * IPv6 link-local adjacency with local/remote node addresses, interface IDs,
11203
                                                 * SR Algorithm, and optional SRv6 SID with optional Endpoint Behavior
11204
                                                 * Length MUST be 66 when both SRv6 SID and Endpoint Behavior are present,
11205
                                                 * 58 when only SRv6 SID is present, or 42 when SRv6 SID is not present.
11206
                                                 */
11207
229
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11208
229
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11209
229
                                                q += 1;
11210
11211
                                                /* SR Algorithm (1 octet) */
11212
229
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11213
229
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11214
229
                                                q += 1;
11215
11216
                                                /* Local Interface ID (4 octets) */
11217
229
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
11218
229
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11219
229
                                                q += 4;
11220
11221
                                                /* IPv6 Local Node Address (16 octets) */
11222
229
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11223
229
                                                        tvb, q, 16, ENC_NA);
11224
229
                                                q += 16;
11225
11226
                                                /* Remote Interface ID (4 octets) */
11227
229
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id,
11228
229
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11229
229
                                                q += 4;
11230
11231
                                                /* IPv6 Remote Node Address (16 octets) */
11232
229
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11233
229
                                                        tvb, q, 16, ENC_NA);
11234
229
                                                q += 16;
11235
11236
229
                                                if (segment_subtlv_length >= 58) {
11237
160
                                                    q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11238
160
                                                            segment_subtlv_length == 66);
11239
160
                                                }
11240
229
                                                break;
11241
401
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I:
11242
                                                /* RFC 9831 Section 2.7 - Type I Segment
11243
                                                 * IPv6 Node Address, SR Algorithm, and optional SRv6 SID with optional Endpoint Behavior
11244
                                                 * Length MUST be 42 when both SRv6 SID and Endpoint Behavior are present,
11245
                                                 * 34 when only SRv6 SID is present, or 18 when SRv6 SID is not present.
11246
                                                 */
11247
401
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11248
401
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11249
401
                                                q += 1;
11250
11251
                                                /* SR Algorithm (1 octet) */
11252
401
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11253
401
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11254
401
                                                q += 1;
11255
11256
                                                /* IPv6 Node Address (16 octets) */
11257
401
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address,
11258
401
                                                        tvb, q, 16, ENC_NA);
11259
401
                                                q += 16;
11260
11261
401
                                                if (segment_subtlv_length >= 34) {
11262
161
                                                    q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11263
161
                                                            segment_subtlv_length == 42);
11264
161
                                                }
11265
401
                                                break;
11266
211
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K:
11267
                                                /* RFC 9831 Section 2.9 - Type K Segment
11268
                                                 * IPv6 adjacency (local/remote addresses), SR Algorithm, and optional SRv6 SID with optional Endpoint Behavior
11269
                                                 * Length MUST be 58 when both SRv6 SID and Endpoint Behavior are present,
11270
                                                 * 50 when only SRv6 SID is present, or 34 when SRv6 SID is not present.
11271
                                                 */
11272
211
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11273
211
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11274
211
                                                q += 1;
11275
11276
                                                /* SR Algorithm (1 octet) */
11277
211
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11278
211
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11279
211
                                                q += 1;
11280
11281
                                                /* Local IPv6 Address (16 octets) */
11282
211
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11283
211
                                                        tvb, q, 16, ENC_NA);
11284
211
                                                q += 16;
11285
11286
                                                /* Remote IPv6 Address (16 octets) */
11287
211
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11288
211
                                                        tvb, q, 16, ENC_NA);
11289
211
                                                q += 16;
11290
11291
211
                                                if (segment_subtlv_length >= 50) {
11292
139
                                                    q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11293
139
                                                            segment_subtlv_length == 58);
11294
139
                                                }
11295
211
                                                break;
11296
223
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT:
11297
                                                /* RFC 9256 Section 2.4.4.1 - Weight sub-TLV
11298
                                                 * Flags (1 octet) + Reserved (1 octet) + Weight (4 octets)
11299
                                                 */
11300
223
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight_flags,
11301
223
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11302
223
                                                q += 1;
11303
223
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11304
223
                                                        tvb, q, 1, ENC_NA);
11305
223
                                                q += 1;
11306
223
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight,
11307
223
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11308
223
                                                q += 4;
11309
223
                                                break;
11310
2.10k
                                            default:
11311
2.10k
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
11312
2.10k
                                                        tvb, q, segment_subtlv_length, ENC_NA);
11313
2.10k
                                                q += segment_subtlv_length;
11314
2.10k
                                                break;
11315
6.12k
                                        }
11316
6.12k
                                    }
11317
11.5k
                                    encaps_tunnel_sublen -= (segment_subtlv_length + 2);
11318
11.5k
                                }
11319
1.33k
                                }
11320
1.26k
                                break;
11321
1.26k
                            case TUNNEL_SUBTLV_POLICY_CP_NAME:
11322
415
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11323
415
                                q += 1;
11324
415
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_name, tvb, q,
11325
415
                                        encaps_tunnel_sublen - 1, ENC_ASCII);
11326
415
                                q += (encaps_tunnel_sublen - 1);
11327
415
                                break;
11328
223
                            case TUNNEL_SUBTLV_POLICY_NAME:
11329
223
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11330
223
                                q += 1;
11331
223
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_name, tvb, q,
11332
223
                                        encaps_tunnel_sublen - 1, ENC_ASCII);
11333
223
                                q += (encaps_tunnel_sublen - 1);
11334
223
                                break;
11335
6.47k
                            default:
11336
6.47k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_value, tvb, q, encaps_tunnel_sublen, ENC_NA);
11337
6.47k
                                q += encaps_tunnel_sublen;
11338
6.47k
                                break;
11339
17.5k
                        } /* switch (encaps_tunnel_subtype) */
11340
17.5k
                    }
11341
1.83k
                }
11342
1.28k
                break;
11343
1.28k
            case BGPTYPE_AIGP:
11344
381
                q = o + i + aoff;
11345
381
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aigp, tvb, q, tlen, ENC_NA);
11346
381
                subtree3 = proto_item_add_subtree(ti, ett_bgp_aigp_attr);
11347
381
                aigp_type_item = proto_tree_add_item_ret_uint8(subtree3, hf_bgp_aigp_type, tvb, q, 1, ENC_BIG_ENDIAN, &aigp_type);
11348
381
                switch (aigp_type) {
11349
284
                    case AIGP_TLV_TYPE :
11350
284
                        proto_tree_add_item(subtree3, hf_bgp_aigp_tlv_length, tvb, q+1, 2, ENC_BIG_ENDIAN);
11351
284
                        proto_tree_add_item(subtree3, hf_bgp_aigp_accu_igp_metric, tvb, q+3, 8, ENC_BIG_ENDIAN);
11352
284
                        proto_item_append_text(ti, ": %" PRIu64, tvb_get_ntoh64(tvb, q+3));
11353
284
                        proto_item_append_text(ti_pa, ": %" PRIu64, tvb_get_ntoh64(tvb, q+3));
11354
284
                        break;
11355
97
                    default :
11356
97
                        expert_add_info_format(pinfo, aigp_type_item, &ei_bgp_attr_aigp_type,
11357
97
                                               "AIGP type %u unknown", aigp_type);
11358
381
                }
11359
373
                break;
11360
2.37k
            case BGPTYPE_LINK_STATE_ATTR:
11361
2.96k
            case BGPTYPE_LINK_STATE_OLD_ATTR:
11362
2.96k
                q = o + i + aoff;
11363
2.96k
                end = o + i + aoff + tlen;
11364
                /* FF: BGPTYPE_LINK_STATE_ATTR body dissection is moved after the while.
11365
                   Here we just save the TLV coordinates and the subtree. */
11366
2.96k
                save_link_state_attr_position(pinfo, q, end, tlen, subtree2);
11367
2.96k
                break;
11368
11369
494
            case BGPTYPE_LARGE_COMMUNITY:
11370
494
                if(tlen == 0 || tlen % 12){
11371
455
                    break;
11372
455
                }
11373
39
                q = o + i + aoff;
11374
39
                end = q + tlen;
11375
39
                wmem_strbuf_t *comm_strbuf;
11376
39
                comm_strbuf = wmem_strbuf_create(pinfo->pool);
11377
157
                while (q < end) {
11378
118
                    uint32_t ga, ldp1, ldp2;
11379
118
                    ga = tvb_get_ntohl(tvb, q);
11380
118
                    ldp1 = tvb_get_ntohl(tvb, q+4);
11381
118
                    ldp2 = tvb_get_ntohl(tvb, q+8);
11382
118
                    ti = proto_tree_add_string_format(subtree2, hf_bgp_large_communities, tvb, q, 12, NULL, "Large communities: %u:%u:%u", ga, ldp1, ldp2);
11383
118
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_large_communities);
11384
118
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ga, tvb,
11385
118
                                            q, 4, ENC_BIG_ENDIAN);
11386
118
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp1, tvb,
11387
118
                                            q + 4, 4, ENC_BIG_ENDIAN);
11388
118
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp2, tvb,
11389
118
                                            q + 8, 4, ENC_BIG_ENDIAN);
11390
118
                    wmem_strbuf_append_printf(comm_strbuf, " %u:%u:%u", ga, ldp1, ldp2);
11391
118
                    q += 12;
11392
118
                }
11393
11394
39
                proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(comm_strbuf));
11395
11396
39
                break;
11397
777
            case BGPTYPE_BGPSEC_PATH:
11398
777
                q = o + i + aoff;
11399
777
                end = q + tlen;
11400
777
                secpathlen = tvb_get_ntohs(tvb, q); /* Secure Path Length */
11401
11402
777
                if (((secpathlen - 2) % SEC_PATH_SEG_SIZE) != 0) { /* SEC_PATH_SEG_SIZE = 6 */
11403
647
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11404
647
                        "Invalid BGPsec Secure Path length: %u bytes", secpathlen);
11405
647
                }
11406
11407
777
                subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, secpathlen,
11408
777
                                                         ett_bgp_bgpsec_secure_path,
11409
777
                                                         NULL,
11410
777
                                                         "Secure Path (%d byte%s)",
11411
777
                                                         secpathlen,
11412
777
                                                         plurality(secpathlen, "", "s"));
11413
11414
                /* Secure Path Length */
11415
777
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sp_len, tvb, q, 2, ENC_BIG_ENDIAN);
11416
777
                q += 2;
11417
11418
777
                secpathcount = (secpathlen - 2) / SEC_PATH_SEG_SIZE; /* Amount of Secure Path Segments */
11419
777
                j = 0;
11420
13.3k
                while (j < secpathcount) {
11421
12.5k
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, SEC_PATH_SEG_SIZE,
11422
12.5k
                                                             ett_bgp_bgpsec_secure_path_segment,
11423
12.5k
                                                             NULL,
11424
12.5k
                                                             "Secure Path Segment (%d byte%s)",
11425
12.5k
                                                             SEC_PATH_SEG_SIZE,
11426
12.5k
                                                             plurality(SEC_PATH_SEG_SIZE, "", "s"));
11427
11428
                    /* pCount field */
11429
12.5k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_pcount, tvb,
11430
12.5k
                                        q, 1, ENC_BIG_ENDIAN);
11431
12.5k
                    q += 1;
11432
11433
                    /* Flags field */
11434
12.5k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_flags, tvb,
11435
12.5k
                                        q, 1, ENC_BIG_ENDIAN);
11436
12.5k
                    q += 1;
11437
11438
                    /* ASN field */
11439
12.5k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_as, tvb,
11440
12.5k
                                        q, 4, ENC_BIG_ENDIAN);
11441
12.5k
                    q += 4;
11442
12.5k
                    j++;
11443
12.5k
                }
11444
11445
777
                sigblocklen = tvb_get_ntohs(tvb, q); /* Signature Block Length */
11446
11447
777
                subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, sigblocklen,
11448
777
                                                         ett_bgp_bgpsec_signature_block,
11449
777
                                                         NULL,
11450
777
                                                         "Signature Block (%d byte%s)",
11451
777
                                                         sigblocklen,
11452
777
                                                         plurality(sigblocklen, "", "s"));
11453
11454
                /* Signature Block Length */
11455
777
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sb_len, tvb, q, 2, ENC_BIG_ENDIAN);
11456
777
                q += 2;
11457
11458
                /* Algorithm Suite ID */
11459
777
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_algo_id, tvb, q, 1, ENC_BIG_ENDIAN);
11460
777
                q += 1;
11461
11462
889
                while (q < end) {
11463
112
                    sig_len = tvb_get_ntohs(tvb, q+20); /* Signature Length of current Segment */
11464
11465
112
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, 22+sig_len,
11466
112
                                                             ett_bgp_bgpsec_signature_segment,
11467
112
                                                             NULL,
11468
112
                                                             "Signature Segment (%d byte%s)",
11469
112
                                                             22+sig_len,
11470
112
                                                             plurality(22+sig_len, "", "s"));
11471
11472
                    /* Subject Key Identifier */
11473
112
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_ski, tvb,
11474
112
                                        q, 20, ENC_NA);
11475
112
                    q += 20;
11476
11477
                    /* Signature Length */
11478
112
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig_len, tvb,
11479
112
                                        q, 2, ENC_BIG_ENDIAN);
11480
112
                    q += 2;
11481
11482
                    /* Signature */
11483
112
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig, tvb,
11484
112
                                        q, sig_len, ENC_NA);
11485
112
                    q += sig_len;
11486
112
                }
11487
11488
777
                break;
11489
2.12k
            case BGPTYPE_BGP_PREFIX_SID:
11490
2.12k
                q = o + i + aoff;
11491
2.12k
                end = q + tlen;
11492
2.12k
                proto_item    *tlv_item, *stlv_item, *sstlv_item;
11493
2.12k
                proto_tree    *tlv_tree, *stlv_tree, *sstlv_tree;
11494
2.12k
                proto_item    *srgb_tlv_item;
11495
2.12k
                proto_tree    *srgb_tlv_tree;
11496
2.12k
                proto_item    *srv6_stlv_item;
11497
2.12k
                proto_tree    *srv6_stlv_tree;
11498
2.12k
                proto_item    *srv6_data_sstlv_item;
11499
2.12k
                proto_tree    *srv6_data_sstlv_tree;
11500
2.12k
                int sub_pnt, sub_end;
11501
2.12k
                int sub_sub_pnt, sub_sub_end;
11502
4.16k
                while (q < end) {
11503
2.29k
                    prefix_sid_subtype = tvb_get_uint8(tvb, q);
11504
2.29k
                    prefix_sid_sublen = tvb_get_ntohs(tvb, q + 1);
11505
2.29k
                    switch (prefix_sid_subtype) {
11506
410
                        case BGP_PREFIX_SID_TLV_LABEL_INDEX:
11507
410
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_label_index, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11508
410
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_label_index);
11509
410
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11510
410
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11511
410
                            if (prefix_sid_sublen != BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX){
11512
215
                                proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11513
215
                                    "Invalid BGP Prefix-SID Label Index length: %u bytes", prefix_sid_sublen);
11514
215
                                q += 3 + prefix_sid_sublen;
11515
215
                                break;
11516
215
                            }
11517
195
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11518
195
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_flags, tvb, q + 4, 2, ENC_BIG_ENDIAN);
11519
195
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_value, tvb, q + 6, 4, ENC_BIG_ENDIAN);
11520
195
                            proto_item_append_text(tlv_tree, ": %u ", tvb_get_ntohl(tvb, q + 6));
11521
195
                            q += 10;
11522
195
                            break;
11523
824
                        case BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB:
11524
824
                            check_srgb = prefix_sid_sublen - 2;
11525
824
                            prefix_sid_sub_tlv_offset = 0;
11526
824
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_originator_srgb, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11527
824
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb);
11528
824
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11529
824
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11530
824
                            if(check_srgb % 3 || check_srgb % 2){
11531
411
                                proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11532
411
                                    "Invalid BGP Prefix-SID SRGB Originator length: %u bytes", prefix_sid_sublen);
11533
411
                                q += 3 + prefix_sid_sublen;
11534
411
                                break;
11535
411
                            }
11536
413
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_flags, tvb, q + 3, 2, ENC_BIG_ENDIAN);
11537
413
                            q += 2;
11538
413
                            tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_blocks, tvb, q , prefix_sid_sublen - 2, ENC_NA);
11539
413
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb_blocks);
11540
1.44k
                            while (prefix_sid_sublen > prefix_sid_sub_tlv_offset + 2) {
11541
1.03k
                                srgb_tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_block, tvb, q , prefix_sid_sublen - 2, ENC_NA);
11542
1.03k
                                srgb_tlv_tree = proto_item_add_subtree(srgb_tlv_item, ett_bgp_prefix_sid_originator_srgb_block);
11543
1.03k
                                prefix_sid_sub_tlv_offset += 3;
11544
1.03k
                                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);
11545
1.03k
                                prefix_sid_sub_tlv_offset += 3;
11546
1.03k
                                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);
11547
1.03k
                                proto_item_append_text(srgb_tlv_tree, "(%u:%u)", tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset - 3),
11548
1.03k
                                    tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset));
11549
1.03k
                            }
11550
413
                            q += 3 + prefix_sid_sublen;
11551
413
                            break;
11552
444
                        case BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE:
11553
444
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l3vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11554
444
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l3vpn);
11555
444
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11556
444
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11557
444
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11558
11559
444
                            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);
11560
444
                            srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs);
11561
11562
444
                            sub_pnt = q + 4;
11563
444
                            sub_end = q + 3 + prefix_sid_sublen;
11564
1.75k
                            while (sub_pnt < sub_end) {
11565
1.36k
                                srv6_service_subtlv_type = tvb_get_uint8(tvb, sub_pnt);
11566
1.36k
                                srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
11567
11568
1.36k
                                switch (srv6_service_subtlv_type) {
11569
782
                                    case SRV6_SERVICE_SRV6_SID_INFORMATION:
11570
782
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11571
782
                                                                        hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11572
782
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11573
782
                                        proto_item_append_text(stlv_item, " - %s",
11574
782
                                                               val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11575
782
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_information);
11576
11577
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11578
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11579
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
11580
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
11581
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
11582
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_BIG_ENDIAN);
11583
782
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
11584
11585
782
                                        srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
11586
782
                                                                                   hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
11587
782
                                                                                   tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
11588
782
                                        srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs);
11589
11590
782
                                        sub_sub_pnt = sub_pnt + 24;
11591
782
                                        sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
11592
1.83k
                                        while (sub_sub_pnt < sub_sub_end) {
11593
1.07k
                                            srv6_service_data_subsubtlv_type = tvb_get_uint8(tvb, sub_sub_pnt);
11594
1.07k
                                            srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
11595
11596
1.07k
                                            switch (srv6_service_data_subsubtlv_type) {
11597
566
                                                case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
11598
566
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11599
566
                                                                                     hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11600
566
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11601
566
                                                    proto_item_append_text(sstlv_item, " - %s",
11602
566
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11603
566
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_structure);
11604
11605
566
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11606
566
                                                    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);
11607
566
                                                    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);
11608
566
                                                    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);
11609
566
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
11610
566
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
11611
566
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
11612
566
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
11613
566
                                                    break;
11614
492
                                                default:
11615
492
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11616
492
                                                                                     hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11617
492
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11618
492
                                                    proto_item_append_text(sstlv_item, " - %s",
11619
492
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11620
492
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown);
11621
11622
492
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11623
492
                                                    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);
11624
492
                                                    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);
11625
492
                                                    break;
11626
1.07k
                                            }
11627
1.05k
                                            sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
11628
1.05k
                                        }
11629
760
                                        break;
11630
760
                                    default:
11631
559
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11632
559
                                                                        hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11633
559
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11634
559
                                        proto_item_append_text(stlv_item, " - %s", val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11635
559
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_unknown);
11636
11637
559
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11638
559
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11639
559
                                        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);
11640
559
                                        break;
11641
1.36k
                                }
11642
1.30k
                                sub_pnt += 3 + srv6_service_subtlv_len;
11643
1.30k
                            }
11644
387
                            q += (3 + prefix_sid_sublen);
11645
387
                            break;
11646
303
                        case BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE:
11647
303
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l2vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11648
303
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l2vpn);
11649
303
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11650
303
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11651
303
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11652
11653
303
                            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);
11654
303
                            srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs);
11655
11656
303
                            sub_pnt = q + 4;
11657
303
                            sub_end = q + 3 + prefix_sid_sublen;
11658
2.78k
                            while (sub_pnt < sub_end) {
11659
2.53k
                                srv6_service_subtlv_type = tvb_get_uint8(tvb, sub_pnt);
11660
2.53k
                                srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
11661
11662
2.53k
                                switch (srv6_service_subtlv_type) {
11663
2.01k
                                    case SRV6_SERVICE_SRV6_SID_INFORMATION:
11664
2.01k
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11665
2.01k
                                                                        hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11666
2.01k
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11667
2.01k
                                        proto_item_append_text(stlv_item, " - %s",
11668
2.01k
                                                               val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11669
2.01k
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_information);
11670
11671
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11672
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11673
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
11674
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
11675
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
11676
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_BIG_ENDIAN);
11677
2.01k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
11678
11679
2.01k
                                        srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
11680
2.01k
                                                                                   hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
11681
2.01k
                                                                                   tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
11682
2.01k
                                        srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs);
11683
11684
2.01k
                                        sub_sub_pnt = sub_pnt + 24;
11685
2.01k
                                        sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
11686
4.66k
                                        while (sub_sub_pnt < sub_sub_end) {
11687
2.67k
                                            srv6_service_data_subsubtlv_type = tvb_get_uint8(tvb, sub_sub_pnt);
11688
2.67k
                                            srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
11689
11690
2.67k
                                            switch (srv6_service_data_subsubtlv_type) {
11691
2.33k
                                                case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
11692
2.33k
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11693
2.33k
                                                                                     hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11694
2.33k
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11695
2.33k
                                                    proto_item_append_text(sstlv_item, " - %s",
11696
2.33k
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11697
2.33k
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_structure);
11698
11699
2.33k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11700
2.33k
                                                    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);
11701
2.33k
                                                    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);
11702
2.33k
                                                    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);
11703
2.33k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
11704
2.33k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
11705
2.33k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
11706
2.33k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
11707
2.33k
                                                    break;
11708
321
                                                default:
11709
321
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11710
321
                                                                                     hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11711
321
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11712
321
                                                    proto_item_append_text(sstlv_item, " - %s",
11713
321
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11714
321
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown);
11715
11716
321
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11717
321
                                                    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);
11718
321
                                                    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);
11719
321
                                                    break;
11720
2.67k
                                            }
11721
2.65k
                                            sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
11722
2.65k
                                        }
11723
1.99k
                                        break;
11724
1.99k
                                    default:
11725
495
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11726
495
                                                                        hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11727
495
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11728
495
                                        proto_item_append_text(stlv_item, " - %s", val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11729
495
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_unknown);
11730
11731
495
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11732
495
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11733
495
                                        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);
11734
495
                                        break;
11735
2.53k
                                }
11736
2.48k
                                sub_pnt += 3 + srv6_service_subtlv_len;
11737
2.48k
                            }
11738
255
                            q += (3 + prefix_sid_sublen);
11739
255
                            break;
11740
275
                        default:
11741
275
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_unknown, tvb, q, prefix_sid_sublen + 3, ENC_NA);
11742
275
                            proto_item_append_text(tlv_item, " (%s)", val_to_str(pinfo->pool, prefix_sid_subtype, bgp_prefix_sid_type, "%u"));
11743
275
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_unknown);
11744
275
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11745
275
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11746
275
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_value, tvb, q + 3, prefix_sid_sublen - 3, ENC_NA);
11747
275
                            q += (3 + prefix_sid_sublen);
11748
275
                            break;
11749
2.29k
                    }
11750
2.29k
                }
11751
1.87k
                break;
11752
2.63k
            case BGPTYPE_PMSI_TUNNEL_ATTR:
11753
2.63k
                dissect_bgp_update_pmsi_attr(pinfo, subtree2, tvb, tlen, o+i+aoff);
11754
2.63k
                break;
11755
11756
1.06k
            case BGPTYPE_ATTR_SET:
11757
1.06k
                if (alen >= 4) {
11758
780
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_attrset_origin_as, tvb,
11759
780
                                        o + i + aoff, 4, ENC_BIG_ENDIAN);
11760
780
                    if (alen > 4) {
11761
571
                        ti =  proto_tree_add_item(subtree2, hf_bgp_update_path_attributes, tvb, o+i+aoff+4, alen-4, ENC_NA);
11762
571
                        attr_set_subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
11763
571
                        dissect_bgp_path_attr(attr_set_subtree, tvb, alen-4, o+i+aoff+4, pinfo);
11764
571
                    }
11765
780
                } else {
11766
288
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11767
288
                                                 "Attribute set (invalid): %u byte%s",
11768
288
                                                 alen, plurality(alen, "", "s"));
11769
288
                }
11770
1.06k
                break;
11771
312
            case BGPTYPE_OTC:
11772
312
                if (tlen != 4) {
11773
118
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
11774
118
                                                 "Only to Customer (invalid): %u byte%s", tlen,
11775
118
                                                 plurality(tlen, "", "s"));
11776
194
                } else {
11777
194
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_otc, tvb,
11778
194
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
11779
194
                    proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
11780
194
                }
11781
312
                break;
11782
489
            case BGPTYPE_D_PATH:
11783
489
                if(tlen < 8){
11784
222
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
11785
222
                                                 "D-PATH attribute has invalid length (invalid): %u byte%s", tlen,
11786
222
                                                 plurality(tlen, "", "s"));
11787
222
                    break;
11788
222
                }
11789
267
                q = o + i + aoff;
11790
267
                end = q + tlen;
11791
267
                wmem_strbuf_t *dpath_strbuf;
11792
267
                dpath_strbuf = wmem_strbuf_create(pinfo->pool);
11793
267
                uint8_t dpath_len;
11794
267
                dpath_len = tvb_get_uint8(tvb, q);
11795
267
                proto_tree_add_item(subtree2, hf_bgp_d_path_length, tvb,
11796
267
                                        q, 1, ENC_BIG_ENDIAN);
11797
267
                q += 1;
11798
1.31k
                while (dpath_len > 0 && q < end) {
11799
1.04k
                    uint32_t ad;
11800
1.04k
                    uint16_t ld;
11801
1.04k
                    ad = tvb_get_ntohl(tvb, q);
11802
1.04k
                    ld = tvb_get_ntohs(tvb, q+4);
11803
1.04k
                    ti = proto_tree_add_string_format(subtree2, hf_bgp_update_path_attribute_d_path, tvb, q, 6, NULL, "Domain ID: %u:%u", ad, ld);
11804
1.04k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_dpath);
11805
1.04k
                    proto_tree_add_item(subtree3, hf_bgp_d_path_ga, tvb,
11806
1.04k
                                        q, 4, ENC_BIG_ENDIAN);
11807
1.04k
                    proto_tree_add_item(subtree3, hf_bgp_d_path_la, tvb,
11808
1.04k
                                        q + 4, 2, ENC_BIG_ENDIAN);
11809
1.04k
                    wmem_strbuf_append_printf(dpath_strbuf, " %u:%u", ad, ld);
11810
1.04k
                    q += 6;
11811
1.04k
                    dpath_len -= 1;
11812
1.04k
                }
11813
267
                if (dpath_len != 0 || q >= end) {
11814
148
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
11815
148
                                                 "D-PATH list (invalid): %u byte%s", tlen,
11816
148
                                                 plurality(tlen, "", "s"));
11817
148
                    break;
11818
148
                }
11819
119
                proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(dpath_strbuf));
11820
11821
119
                proto_tree_add_item(subtree2, hf_bgp_d_path_isf_safi, tvb,
11822
119
                                    q, 1, ENC_BIG_ENDIAN);
11823
119
                break;
11824
9.57k
            default:
11825
9.57k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attributes_unknown, tvb, o + i + aoff, tlen, ENC_NA);
11826
9.57k
                break;
11827
61.2k
        } /* switch (bgpa.bgpa_type) */ /* end of second switch */
11828
11829
53.1k
        i += alen + aoff;
11830
53.1k
    }
11831
2.52k
    decrement_dissection_depth(pinfo);
11832
2.52k
    {
11833
        /* FF: postponed BGPTYPE_LINK_STATE_ATTR dissection */
11834
2.52k
        link_state_data *data = load_link_state_data(pinfo);
11835
2.52k
        if (data && data->link_state_attr_present) {
11836
2.25k
            ti = proto_tree_add_item(data->subtree2, hf_bgp_update_path_attribute_link_state, tvb, data->ostart, data->tlen, ENC_NA);
11837
2.25k
            subtree3 = proto_item_add_subtree(ti, ett_bgp_link_state);
11838
9.33k
            while (data->ostart < data->oend) {
11839
7.08k
                advance = decode_link_state_attribute_tlv(subtree3, tvb, data->ostart, pinfo, data->protocol_id);
11840
7.08k
                if (advance < 0) {
11841
0
                    break;
11842
0
                }
11843
7.08k
                data->ostart += advance;
11844
7.08k
            }
11845
2.25k
        }
11846
2.52k
    }
11847
2.52k
}
11848
/*
11849
 * Dissect a BGP UPDATE message.
11850
 */
11851
static void
11852
dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11853
11.1k
{
11854
11.1k
    uint16_t        hlen;                       /* message length           */
11855
11.1k
    int             o;                          /* packet offset            */
11856
11.1k
    int             end=0;                      /* message end              */
11857
11.1k
    uint16_t        len;                        /* tmp                      */
11858
11.1k
    proto_item      *ti;                        /* tree item                */
11859
11.1k
    proto_tree      *subtree;                   /* subtree for attributes   */
11860
11.1k
    int             i;                          /* tmp                      */
11861
11862
11.1k
    hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
11863
11.1k
    o = BGP_HEADER_SIZE;
11864
11865
11866
    /* check for withdrawals */
11867
11.1k
    len = tvb_get_ntohs(tvb, o);
11868
11.1k
    proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes_length, tvb, o, 2, ENC_BIG_ENDIAN);
11869
11.1k
    o += 2;
11870
11871
    /* parse unfeasible prefixes */
11872
11.1k
    if (len > 0) {
11873
497
        ti = proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes, tvb, o, len, ENC_NA);
11874
497
        subtree = proto_item_add_subtree(ti, ett_bgp_unfeas);
11875
11876
        /* parse each prefix */
11877
497
        end = o + len;
11878
11879
        /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
11880
497
        if( detect_add_path_prefix4(tvb, o, end) ) {
11881
            /* IPv4 prefixes with Path Id */
11882
746
            while (o < end) {
11883
603
                i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_withdrawn_prefix, tvb, o,
11884
603
                    "Withdrawn route");
11885
603
                if (i < 0)
11886
69
                    return;
11887
534
                o += i;
11888
534
            }
11889
285
        } else {
11890
813
            while (o < end) {
11891
566
                i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_withdrawn_prefix, tvb, o,
11892
566
                    "Withdrawn route");
11893
566
                if (i < 0)
11894
38
                    return;
11895
528
                o += i;
11896
528
            }
11897
285
        }
11898
497
    }
11899
11900
    /* check for advertisements */
11901
11.0k
    len = tvb_get_ntohs(tvb, o);
11902
11.0k
    proto_tree_add_item(tree, hf_bgp_update_total_path_attribute_length, tvb, o, 2, ENC_BIG_ENDIAN);
11903
11904
    /* path attributes */
11905
11.0k
    if (len > 0) {
11906
10.6k
        ti =  proto_tree_add_item(tree, hf_bgp_update_path_attributes, tvb, o+2, len, ENC_NA);
11907
10.6k
        subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
11908
11909
10.6k
        dissect_bgp_path_attr(subtree, tvb, len, o+2, pinfo);
11910
11911
10.6k
        o += 2 + len;
11912
11913
        /* NLRI */
11914
10.6k
        len = hlen - o;
11915
11916
        /* parse prefixes */
11917
10.6k
        if (len > 0) {
11918
1.29k
            ti = proto_tree_add_item(tree, hf_bgp_update_nlri, tvb, o, len, ENC_NA);
11919
1.29k
            subtree = proto_item_add_subtree(ti, ett_bgp_nlri);
11920
1.29k
            end = o + len;
11921
            /*
11922
             * Heuristic to detect if IPv4 prefix are using Path Identifiers
11923
             * we need at least 5 bytes for Add-path prefixes
11924
             */
11925
1.29k
            if( len > 4 && detect_add_path_prefix4(tvb, o, end) ) {
11926
                /* IPv4 prefixes with Path Id */
11927
382
                while (o < end) {
11928
304
                    i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_nlri_prefix, tvb, o,
11929
304
                                            "NLRI");
11930
304
                    if (i < 0)
11931
0
                       return;
11932
304
                    o += i;
11933
304
                }
11934
1.22k
            } else {
11935
                /* Standard prefixes */
11936
2.01k
                while (o < end) {
11937
911
                    i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_nlri_prefix, tvb, o, "NLRI");
11938
911
                    if (i < 0)
11939
118
                        return;
11940
793
                    o += i;
11941
793
                }
11942
1.22k
            }
11943
1.29k
        }
11944
10.6k
    }
11945
11.0k
}
11946
11947
/*
11948
 * Dissect a BGP CAPABILITY message.
11949
 */
11950
static void
11951
dissect_bgp_capability(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11952
533
{
11953
533
    unsigned offset = 0;
11954
533
    unsigned mend;
11955
11956
533
    mend = offset + tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
11957
533
    offset += BGP_HEADER_SIZE;
11958
    /* step through all of the capabilities */
11959
1.83k
    while (offset < mend) {
11960
1.30k
        offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, true);
11961
1.30k
    }
11962
533
}
11963
11964
/*
11965
 * Dissect a BGP NOTIFICATION message.
11966
 */
11967
static void
11968
dissect_bgp_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11969
1.29k
{
11970
1.29k
    int                     hlen;   /* message length           */
11971
1.29k
    int                     offset;
11972
1.29k
    unsigned                major_error;
11973
1.29k
    proto_item              *ti;
11974
1.29k
    uint8_t                 clen;
11975
1.29k
    uint8_t                 minor_cease;
11976
11977
11978
1.29k
    hlen =  tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
11979
1.29k
    offset = BGP_MARKER_SIZE + 2 + 1;
11980
11981
11982
    /* print error code */
11983
1.29k
    proto_tree_add_item_ret_uint(tree, hf_bgp_notify_major_error, tvb, offset, 1, ENC_BIG_ENDIAN, &major_error);
11984
1.29k
    offset += 1;
11985
11986
1.29k
    switch(major_error){
11987
86
        case BGP_MAJOR_ERROR_MSG_HDR:
11988
86
            proto_tree_add_item(tree, hf_bgp_notify_minor_msg_hdr, tvb, offset, 1, ENC_BIG_ENDIAN);
11989
86
        break;
11990
524
        case BGP_MAJOR_ERROR_OPEN_MSG:
11991
524
            proto_tree_add_item(tree, hf_bgp_notify_minor_open_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
11992
524
        break;
11993
72
        case BGP_MAJOR_ERROR_UPDATE_MSG:
11994
72
            proto_tree_add_item(tree,hf_bgp_notify_minor_update_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
11995
72
        break;
11996
69
        case BGP_MAJOR_ERROR_HT_EXPIRED:
11997
69
            proto_tree_add_item(tree, hf_bgp_notify_minor_ht_expired, tvb, offset,  1, ENC_BIG_ENDIAN);
11998
69
        break;
11999
71
        case BGP_MAJOR_ERROR_STATE_MACHINE:
12000
71
            proto_tree_add_item(tree, hf_bgp_notify_minor_state_machine, tvb, offset, 1, ENC_BIG_ENDIAN);
12001
71
        break;
12002
240
        case BGP_MAJOR_ERROR_CEASE:
12003
240
            proto_tree_add_item(tree, hf_bgp_notify_minor_cease, tvb, offset, 1, ENC_BIG_ENDIAN);
12004
240
        break;
12005
115
        case BGP_MAJOR_ERROR_ROUTE_REFRESH:
12006
115
            proto_tree_add_item(tree, hf_bgp_notify_minor_rr_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
12007
115
        break;
12008
111
        default:
12009
111
            ti = proto_tree_add_item(tree, hf_bgp_notify_minor_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
12010
111
            expert_add_info_format(pinfo, ti, &ei_bgp_notify_minor_unknown, "Unknown notification error (%d)",major_error);
12011
111
        break;
12012
1.29k
    }
12013
1.10k
    offset += 1;
12014
12015
    /* only print if there is optional data */
12016
1.10k
    if (hlen > BGP_MIN_NOTIFICATION_MSG_SIZE) {
12017
916
        minor_cease = tvb_get_uint8(tvb, offset - 1);
12018
916
        clen = tvb_get_uint8(tvb, offset);
12019
        /* Might be a idr-shutdown communication, first byte is length */
12020
916
        if (hlen - BGP_MIN_NOTIFICATION_MSG_SIZE - 1 == clen && major_error == BGP_MAJOR_ERROR_CEASE &&
12021
233
                (minor_cease == BGP_CEASE_MINOR_ADMIN_SHUTDOWN || minor_cease == BGP_CEASE_MINOR_ADMIN_RESET) ) {
12022
155
            proto_tree_add_item(tree, hf_bgp_notify_communication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
12023
155
            offset += 1;
12024
155
            proto_tree_add_item(tree, hf_bgp_notify_communication, tvb, offset, clen, ENC_UTF_8);
12025
        /* otherwise just dump the hex data */
12026
761
        } else if ( major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 7 ) {
12027
7.28k
            while (offset < hlen) {
12028
6.91k
                offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, false);
12029
6.91k
            }
12030
397
        } else if (major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 2 ) { /* Display Bad Peer AS Number */
12031
71
            proto_tree_add_item(tree, hf_bgp_notify_error_open_bad_peer_as, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_BIG_ENDIAN);
12032
326
        } else {
12033
326
            proto_tree_add_item(tree, hf_bgp_notify_data, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_NA);
12034
326
        }
12035
916
    }
12036
1.10k
}
12037
12038
/*
12039
 * Dissect a BGP ROUTE-REFRESH message.
12040
 */
12041
static void
12042
dissect_bgp_route_refresh(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
12043
565
{
12044
565
    int             p;         /* tvb offset counter    */
12045
565
    int             pend;       /* end of list of entries for one orf type */
12046
565
    uint16_t        hlen;       /* tvb RR msg length */
12047
565
    proto_item      *ti;        /* tree item             */
12048
565
    proto_item      *ti1;       /* tree item             */
12049
565
    proto_tree      *subtree;   /* tree for orf   */
12050
565
    proto_tree      *subtree1;  /* tree for orf entry */
12051
565
    uint8_t         orftype;    /* ORF Type */
12052
565
    uint16_t        orflen;     /* ORF len */
12053
565
    uint8_t         entryflag;  /* ORF Entry flag: action(add,del,delall) match(permit,deny) */
12054
565
    int             entrylen;   /* ORF Entry length */
12055
565
    int             advance;    /* tmp                      */
12056
565
    uint32_t        afi;
12057
565
    uint32_t        safi;
12058
12059
12060
/*
12061
example 1
12062
 00 1c 05       hlen=28
12063
 00 01 00 01    afi,safi= ipv4-unicast
12064
 02 80 00 01    defer, prefix-orf, len=1
12065
    80            removeall
12066
example 2
12067
 00 25 05       hlen=37
12068
 00 01 00 01    afi,saif= ipv4-unicast
12069
 01 80 00 0a    immediate, prefix-orf, len=10
12070
    00            add
12071
    00 00 00 05   seqno = 5
12072
    12            ge = 18
12073
    18            le = 24
12074
    10 07 02      prefix = 7.2.0.0/16
12075
*/
12076
565
    if (!tree)
12077
0
        return;
12078
12079
565
    hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
12080
565
    p = BGP_HEADER_SIZE;
12081
12082
    /* AFI */
12083
565
    proto_tree_add_item_ret_uint(tree, hf_bgp_route_refresh_afi, tvb, p, 2, ENC_BIG_ENDIAN, &afi);
12084
565
    p += 2;
12085
12086
    /*  Subtype in draft-ietf-idr-bgp-enhanced-route-refresh-02 (for Enhanced Route Refresh Capability) before Reserved*/
12087
565
    proto_tree_add_item(tree, hf_bgp_route_refresh_subtype, tvb, p, 1, ENC_BIG_ENDIAN);
12088
565
    p++;
12089
12090
    /* SAFI */
12091
565
    proto_tree_add_item_ret_uint(tree, hf_bgp_route_refresh_safi, tvb, p, 1, ENC_BIG_ENDIAN, &safi);
12092
565
    p++;
12093
565
    save_afi_safi_data(pinfo, (uint16_t)afi, (uint8_t)safi);
12094
12095
565
    if ( hlen == BGP_HEADER_SIZE + 4 )
12096
112
        return;
12097
2.46k
    while (p < hlen) {
12098
        /* ORF type */
12099
12100
2.18k
        ti = proto_tree_add_item(tree, hf_bgp_route_refresh_orf, tvb, p, 4, ENC_NA);
12101
2.18k
        subtree = proto_item_add_subtree(ti, ett_bgp_orf);
12102
12103
2.18k
        proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_flag, tvb, p, 1, ENC_BIG_ENDIAN);
12104
2.18k
        p += 1;
12105
12106
2.18k
        ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_type, tvb, p, 1, ENC_BIG_ENDIAN);
12107
2.18k
        orftype = tvb_get_uint8(tvb, p);
12108
2.18k
        p += 1;
12109
12110
2.18k
        proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_length, tvb, p, 2, ENC_BIG_ENDIAN);
12111
2.18k
        orflen = tvb_get_ntohs(tvb, p);
12112
2.18k
        proto_item_set_len(ti, orflen + 4);
12113
2.18k
        p += 2;
12114
12115
2.18k
        pend = p + orflen;
12116
12117
2.18k
        switch (orftype) {
12118
197
        case BGP_ORF_COMM:
12119
264
        case BGP_ORF_EXTCOMM:
12120
332
        case BGP_ORF_ASPATH:
12121
332
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unregistered, "Deprecated non-IANA ORF Entry type %u", orftype);
12122
332
            break;
12123
12124
74
        case BGP_ORF_PREFIX:
12125
651
        case BGP_ORF_PREFIX_CISCO:
12126
1.71k
            while (p < pend) {
12127
1.12k
                ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_entry_prefixlist, tvb, p, 1, ENC_NA);
12128
1.12k
                subtree1 = proto_item_add_subtree(ti1, ett_bgp_orf_entry);
12129
1.12k
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_action, tvb, p, 1, ENC_BIG_ENDIAN);
12130
1.12k
                entryflag = tvb_get_uint8(tvb, p);
12131
1.12k
                if (((entryflag & BGP_ORF_ACTION) >> 6) == BGP_ORF_REMOVEALL) {
12132
502
                    p++;
12133
502
                    continue;
12134
502
                }
12135
624
                if (((entryflag & BGP_ORF_ACTION) >> 6) > BGP_ORF_REMOVEALL) {
12136
418
                    expert_add_info(pinfo, ti1, &ei_bgp_route_refresh_orf_action_invalid);
12137
418
                    p++;
12138
418
                    continue;
12139
418
                }
12140
206
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_match, tvb, p, 1, ENC_BIG_ENDIAN);
12141
206
                p++;
12142
12143
206
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_sequence, tvb, p, 4, ENC_BIG_ENDIAN);
12144
206
                p +=4;
12145
12146
206
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_lower, tvb, p, 1, ENC_BIG_ENDIAN);
12147
206
                p++;
12148
12149
206
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_upper, tvb, p, 1, ENC_BIG_ENDIAN);
12150
206
                p++;
12151
12152
206
                advance = decode_prefix4(subtree1, pinfo, NULL, hf_bgp_route_refresh_orf_entry_ip, tvb, p, "ORF");
12153
206
                if (advance < 0)
12154
67
                        break;
12155
139
                entrylen = 7 + 1 + advance;
12156
12157
139
                proto_item_set_len(ti1, entrylen);
12158
139
                p += advance;
12159
139
            }
12160
651
            break;
12161
12162
195
        case BGP_ORF_CP_ORF:
12163
261
        case BGP_ORF_VPN_PREFIX:
12164
476
        case BGP_ORF_COMM_CISCO:
12165
671
        case BGP_ORF_EXTCOMM_CISCO:
12166
865
        case BGP_ORF_ASPATH_CISCO:
12167
865
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unsupported, "ORF entry type %u not supported for decoding", orftype);
12168
865
            break;
12169
12170
223
        default:
12171
223
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unknown, "ORFEntry-Unknown (type %u)", orftype);
12172
2.18k
        }
12173
12174
2.00k
        p = pend;
12175
2.00k
    }
12176
453
}
12177
12178
static bool
12179
bgp_length_is_valid (uint8_t bgp_type, uint32_t bgp_len)
12180
14.3k
{
12181
14.3k
    switch (bgp_type) {
12182
469
    case BGP_OPEN:
12183
1.00k
    case BGP_CAPABILITY:
12184
1.00k
        if (bgp_len < BGP_HEADER_SIZE || bgp_len > BGP_MAX_PACKET_SIZE)
12185
12
            return false;
12186
993
        break;
12187
993
    case BGP_KEEPALIVE:
12188
316
        if (bgp_len != BGP_HEADER_SIZE)
12189
85
            return false;
12190
231
        break;
12191
11.1k
    case BGP_UPDATE:
12192
12.4k
    case BGP_NOTIFICATION:
12193
12.7k
    case BGP_ROUTE_REFRESH_CISCO:
12194
12.9k
    case BGP_ROUTE_REFRESH:
12195
13.0k
    default:
12196
13.0k
        if (bgp_len < BGP_HEADER_SIZE)
12197
0
            return false;
12198
13.0k
        if (bgp_ext_msg) {
12199
13.0k
            if (bgp_len > BGP_MAX_PACKET_SIZE_EXTENDED)
12200
0
                return false;
12201
13.0k
        } else {
12202
0
            if (bgp_len > BGP_MAX_PACKET_SIZE)
12203
0
                return false;
12204
0
        }
12205
13.0k
        break;
12206
14.3k
    }
12207
12208
    /* length is valid */
12209
14.2k
    return true;
12210
14.3k
}
12211
12212
static int
12213
dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
12214
                void *data _U_)
12215
14.4k
{
12216
14.4k
    uint32_t      bgp_len;          /* Message length             */
12217
14.4k
    uint8_t       bgp_type;         /* Message type               */
12218
14.4k
    const char    *typ;             /* Message type (string)      */
12219
14.4k
    proto_item    *ti = NULL;
12220
14.4k
    proto_item    *ti_marker = NULL;/* marker item                */
12221
14.4k
    proto_item    *ti_len = NULL;   /* length item                */
12222
14.4k
    proto_tree    *bgp_tree = NULL; /* BGP packet tree            */
12223
14.4k
    static const uint8_t valid_marker[BGP_MARKER_SIZE] = {
12224
14.4k
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
12225
14.4k
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
12226
14.4k
    };
12227
12228
14.4k
    bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
12229
14.4k
    bgp_type = tvb_get_uint8(tvb, BGP_MARKER_SIZE + 2);
12230
14.4k
    typ = val_to_str(pinfo->pool, bgp_type, bgptypevals, "Unknown message type (0x%02x)");
12231
12232
14.4k
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP");
12233
14.4k
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, typ);
12234
12235
14.4k
    if (tree) {
12236
14.3k
        ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, ENC_NA);
12237
14.3k
        proto_item_append_text(ti, " - %s", typ);
12238
12239
        /* add a different tree for each message type */
12240
14.3k
        switch (bgp_type) {
12241
469
            case BGP_OPEN:
12242
469
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_open);
12243
469
                break;
12244
11.1k
            case BGP_UPDATE:
12245
11.1k
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_update);
12246
11.1k
                break;
12247
1.29k
            case BGP_NOTIFICATION:
12248
1.29k
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_notification);
12249
1.29k
                break;
12250
316
            case BGP_KEEPALIVE:
12251
316
                bgp_tree = proto_item_add_subtree(ti, ett_bgp);
12252
316
                break;
12253
352
            case BGP_ROUTE_REFRESH_CISCO:
12254
565
            case BGP_ROUTE_REFRESH:
12255
565
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh);
12256
565
                break;
12257
536
            case BGP_CAPABILITY:
12258
536
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_capability);
12259
536
                break;
12260
58
            default:
12261
58
                bgp_tree = proto_item_add_subtree(ti, ett_bgp);
12262
58
                break;
12263
14.3k
        }
12264
12265
14.3k
        ti_marker = proto_tree_add_item(bgp_tree, hf_bgp_marker, tvb, 0,
12266
14.3k
          BGP_MARKER_SIZE, ENC_NA);
12267
14.3k
        if (tvb_memeql(tvb, 0, valid_marker, BGP_MARKER_SIZE) != 0) {
12268
2.75k
             expert_add_info(pinfo, ti_marker, &ei_bgp_marker_invalid);
12269
2.75k
        }
12270
12271
14.3k
        ti_len = proto_tree_add_item(bgp_tree, hf_bgp_length, tvb, 16, 2, ENC_BIG_ENDIAN);
12272
14.3k
    }
12273
12274
14.4k
    if (! bgp_length_is_valid (bgp_type, bgp_len)) {
12275
97
        expert_add_info_format(pinfo, ti_len, &ei_bgp_length_invalid, "Length is invalid %u", bgp_len);
12276
97
        return tvb_captured_length(tvb);
12277
97
    }
12278
12279
14.3k
    if (tree) {
12280
14.2k
        proto_item_set_len(ti, bgp_len);
12281
14.2k
    }
12282
12283
14.3k
    proto_tree_add_item(bgp_tree, hf_bgp_type, tvb, 16 + 2, 1, ENC_BIG_ENDIAN);
12284
12285
14.3k
    switch (bgp_type) {
12286
460
    case BGP_OPEN:
12287
460
        dissect_bgp_open(tvb, bgp_tree, pinfo);
12288
460
        break;
12289
11.1k
    case BGP_UPDATE:
12290
11.1k
        dissect_bgp_update(tvb, bgp_tree, pinfo);
12291
11.1k
        break;
12292
1.29k
    case BGP_NOTIFICATION:
12293
1.29k
        dissect_bgp_notification(tvb, bgp_tree, pinfo);
12294
1.29k
        break;
12295
231
    case BGP_KEEPALIVE:
12296
        /* no data in KEEPALIVE messages */
12297
231
        break;
12298
352
    case BGP_ROUTE_REFRESH_CISCO:
12299
565
    case BGP_ROUTE_REFRESH:
12300
565
        dissect_bgp_route_refresh(tvb, bgp_tree, pinfo);
12301
565
        break;
12302
533
    case BGP_CAPABILITY:
12303
533
        dissect_bgp_capability(tvb, bgp_tree, pinfo);
12304
533
        break;
12305
58
    default:
12306
58
        break;
12307
14.3k
    }
12308
2.21k
    return bgp_len;
12309
14.3k
}
12310
12311
static unsigned
12312
get_bgp_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
12313
14.5k
{
12314
14.5k
    return tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
12315
14.5k
}
12316
12317
/*
12318
 * Dissect a BGP packet.
12319
 */
12320
static int
12321
dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
12322
11.4k
{
12323
11.4k
    volatile unsigned  offset = 0;      /* offset into the tvbuff           */
12324
11.4k
    static unsigned char marker[] = {   /* BGP message marker               */
12325
11.4k
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
12326
11.4k
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
12327
11.4k
    };
12328
11.4k
    proto_item    *ti;           /* tree item                        */
12329
11.4k
    proto_tree    *bgp_tree;     /* BGP packet tree                  */
12330
11.4k
    tvbuff_t *volatile this_tvb; /* for tcp_dissect_pdus()           */
12331
12332
    /*
12333
     * Scan through the TCP payload looking for a BGP marker.
12334
     */
12335
13.7k
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
12336
        /*
12337
         * Start with a quick search for 0xFFFF, then do the heavier
12338
         * tvb_memeql() once we find it.
12339
         */
12340
13.7k
        if (!tvb_find_uint16_remaining(tvb, (unsigned)offset, 0xFFFF, (unsigned*)&offset)){
12341
            /* Didn't find even the start of a marker */
12342
168
            return 0;
12343
168
        }
12344
13.5k
        else if (0 == tvb_memeql(tvb, offset, marker, BGP_MARKER_SIZE)) {
12345
            /* Found the marker - stop scanning and start processing BGP packets. */
12346
11.3k
            break;
12347
11.3k
        }
12348
2.23k
        else {
12349
            /* Keep scanning through the tvbuff to try to find a marker. */
12350
2.23k
            offset++;
12351
2.23k
        }
12352
13.7k
    }
12353
12354
11.3k
    col_clear(pinfo->cinfo, COL_INFO);
12355
12356
    /*
12357
     * If we skipped any bytes, mark it as a BGP continuation.
12358
     */
12359
11.3k
    if (offset > 0) {
12360
428
        ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, offset, ENC_NA);
12361
428
        bgp_tree = proto_item_add_subtree(ti, ett_bgp);
12362
428
        proto_item_append_text(bgp_tree, " - Continuation");
12363
428
        proto_tree_add_item(bgp_tree, hf_bgp_continuation, tvb, 0, offset, ENC_NA);
12364
12365
        /* Don't include the continuation in PDU reassembly */
12366
428
        this_tvb = tvb_new_subset_remaining(tvb, offset);
12367
428
    }
12368
10.8k
    else {
12369
10.8k
        this_tvb = tvb;
12370
10.8k
    }
12371
12372
    /*
12373
     * Now process the BGP packets in the TCP payload.
12374
     */
12375
11.3k
    tcp_dissect_pdus(this_tvb, pinfo, tree, bgp_desegment, BGP_HEADER_SIZE,
12376
11.3k
                     get_bgp_len, dissect_bgp_pdu, NULL);
12377
11.3k
    return tvb_captured_length(tvb);
12378
11.4k
}
12379
12380
/*
12381
 * Register ourselves.
12382
 */
12383
void
12384
proto_register_bgp(void)
12385
14
{
12386
12387
14
    static hf_register_info hf[] = {
12388
      /* BGP Header */
12389
14
      { &hf_bgp_marker,
12390
14
        { "Marker", "bgp.marker", FT_BYTES, BASE_NONE,
12391
14
          NULL, 0x0, "Must be set to all ones (16 Bytes)", HFILL }},
12392
14
      { &hf_bgp_length,
12393
14
        { "Length", "bgp.length", FT_UINT16, BASE_DEC,
12394
14
          NULL, 0x0, "The total length of the message, including the header in octets", HFILL }},
12395
14
      { &hf_bgp_prefix_length,
12396
14
        { "Prefix Length", "bgp.prefix_length", FT_UINT8, BASE_DEC,
12397
14
          NULL, 0x0, NULL, HFILL }},
12398
14
      { &hf_bgp_rd,
12399
14
        { "Route Distinguisher", "bgp.rd", FT_STRING, BASE_NONE,
12400
14
          NULL, 0x0, NULL, HFILL }},
12401
14
      { &hf_bgp_continuation,
12402
14
        { "Continuation", "bgp.continuation", FT_NONE, BASE_NONE,
12403
14
          NULL, 0x0, NULL, HFILL }},
12404
14
      { &hf_bgp_originating_as,
12405
14
        { "Originating AS", "bgp.originating_as", FT_UINT32, BASE_DEC,
12406
14
          NULL, 0x0, NULL, HFILL }},
12407
14
      { &hf_bgp_community_prefix,
12408
14
        { "Community Prefix", "bgp.community_prefix", FT_STRING, BASE_NONE,
12409
14
          NULL, 0x0, NULL, HFILL }},
12410
14
      { &hf_bgp_endpoint_address,
12411
14
        { "Endpoint Address", "bgp.endpoint_address", FT_IPv4, BASE_NONE,
12412
14
          NULL, 0x0, NULL, HFILL }},
12413
14
      { &hf_bgp_endpoint_address_ipv6,
12414
14
        { "Endpoint Address", "bgp.endpoint_address_ipv6", FT_IPv6, BASE_NONE,
12415
14
          NULL, 0x0, NULL, HFILL }},
12416
14
      { &hf_bgp_label_stack,
12417
14
        { "Label Stack", "bgp.label_stack", FT_STRING, BASE_NONE,
12418
14
          NULL, 0x0, NULL, HFILL }},
12419
14
      { &hf_bgp_vplsad_length,
12420
14
        { "Length", "bgp.vplsad.length", FT_UINT16, BASE_DEC,
12421
14
          NULL, 0x0, NULL, HFILL }},
12422
14
      { &hf_bgp_vplsad_rd,
12423
14
        { "RD", "bgp.vplsad.rd", FT_STRING, BASE_NONE,
12424
14
          NULL, 0x0, NULL, HFILL }},
12425
14
      { &hf_bgp_bgpad_pe_addr,
12426
14
        { "PE Addr", "bgp.ad.pe_addr", FT_IPv4, BASE_NONE,
12427
14
          NULL, 0x0, NULL, HFILL }},
12428
14
      { &hf_bgp_vplsbgp_ce_id,
12429
14
        { "CE-ID", "bgp.vplsbgp.ce_id", FT_UINT16, BASE_DEC,
12430
14
          NULL, 0x0, NULL, HFILL }},
12431
14
      { &hf_bgp_vplsbgp_labelblock_offset,
12432
14
        { "Label Block Offset", "bgp.vplsbgp.labelblock.offset", FT_UINT16, BASE_DEC,
12433
14
          NULL, 0x0, NULL, HFILL }},
12434
14
      { &hf_bgp_vplsbgp_labelblock_size,
12435
14
        { "Label Block Size", "bgp.vplsbgp.labelblock.size", FT_UINT16, BASE_DEC,
12436
14
          NULL, 0x0, NULL, HFILL }},
12437
14
      { &hf_bgp_vplsbgp_labelblock_base,
12438
14
        { "Label Block Base", "bgp.vplsbgp.labelblock.base", FT_STRING, BASE_NONE,
12439
14
          NULL, 0x0, NULL, HFILL }},
12440
14
      { &hf_bgp_wildcard_route_target,
12441
14
        { "Wildcard route target", "bgp.wildcard_route_target", FT_STRING, BASE_NONE,
12442
14
          NULL, 0x0, NULL, HFILL }},
12443
14
      { &hf_bgp_type,
12444
14
        { "Type", "bgp.type", FT_UINT8, BASE_DEC,
12445
14
          VALS(bgptypevals), 0x0, "BGP message type", HFILL }},
12446
      /* Open Message */
12447
14
      { &hf_bgp_open_version,
12448
14
        { "Version", "bgp.open.version", FT_UINT8, BASE_DEC,
12449
14
          NULL, 0x0, "The protocol version number", HFILL }},
12450
14
      { &hf_bgp_open_myas,
12451
14
        { "My AS", "bgp.open.myas", FT_UINT16, BASE_DEC,
12452
14
          NULL, 0x0, "The Autonomous System number of the sender", HFILL }},
12453
14
      { &hf_bgp_open_holdtime,
12454
14
        { "Hold Time", "bgp.open.holdtime", FT_UINT16, BASE_DEC,
12455
14
          NULL, 0x0, "The number of seconds the sender proposes for Hold Time", HFILL }},
12456
14
      { &hf_bgp_open_identifier,
12457
14
        { "BGP Identifier", "bgp.open.identifier", FT_IPv4, BASE_NONE,
12458
14
          NULL, 0x0, "The BGP Identifier of the sender", HFILL }},
12459
14
      { &hf_bgp_open_opt_len,
12460
14
        { "Optional Parameters Length", "bgp.open.opt.len", FT_UINT8, BASE_DEC,
12461
14
          NULL, 0x0, "The total length of the Optional Parameters field in octets", HFILL }},
12462
14
      { &hf_bgp_open_opt_extension,
12463
14
        { "Optional Parameter Extension", "bgp.open.opt.extension", FT_NONE, BASE_NONE,
12464
14
          NULL, 0x0, "Optional Parameters Extension detected", HFILL }},
12465
14
      { &hf_bgp_open_opt_extension_mark,
12466
14
        { "Extension Mark", "bgp.open.opt.extension.mark", FT_UINT8, BASE_DEC,
12467
14
          NULL, 0x0, "Optional Parameters Extension detected", HFILL }},
12468
14
      { &hf_bgp_open_opt_extension_len,
12469
14
        { "Extended Length", "bgp.open.opt.extension_len", FT_UINT16, BASE_DEC,
12470
14
          NULL, 0x0, "The total extended length of the Optional Parameters field in octets", HFILL }},
12471
14
      { &hf_bgp_open_opt_params,
12472
14
        { "Optional Parameters", "bgp.open.opt", FT_NONE, BASE_NONE,
12473
14
          NULL, 0x0, "List of optional parameters", HFILL }},
12474
14
      { &hf_bgp_open_opt_param,
12475
14
        { "Optional Parameter", "bgp.open.opt.param", FT_NONE, BASE_NONE,
12476
14
          NULL, 0x0, NULL, HFILL }},
12477
14
      { &hf_bgp_open_opt_param_type,
12478
14
        { "Parameter Type", "bgp.open.opt.param.type", FT_UINT8, BASE_DEC,
12479
14
          VALS(bgp_open_opt_vals), 0x0, "Unambiguously identifies individual parameters", HFILL }},
12480
14
      { &hf_bgp_open_opt_param_len,
12481
14
        { "Parameter Length", "bgp.open.opt.param.len", FT_UINT8, BASE_DEC,
12482
14
          NULL, 0x0, "Length of the Parameter Value", HFILL }},
12483
14
      { &hf_bgp_open_opt_param_auth,
12484
14
        { "Authentication Data", "bgp.open.opt.param.auth", FT_BYTES, BASE_NONE,
12485
14
          NULL, 0x0, "Deprecated", HFILL }},
12486
14
      { &hf_bgp_open_opt_param_unknown,
12487
14
        { "Unknown", "bgp.open.opt.param.unknown", FT_BYTES, BASE_NONE,
12488
14
          NULL, 0x0, "Unknown Parameter", HFILL }},
12489
        /* Notification error */
12490
14
      { &hf_bgp_notify_major_error,
12491
14
        { "Major error Code", "bgp.notify.major_error", FT_UINT8, BASE_DEC,
12492
14
          VALS(bgpnotify_major), 0x0, NULL, HFILL }},
12493
14
      { &hf_bgp_notify_minor_msg_hdr,
12494
14
        { "Minor error Code (Message Header)", "bgp.notify.minor_error", FT_UINT8, BASE_DEC,
12495
14
          VALS(bgpnotify_minor_msg_hdr), 0x0, NULL, HFILL }},
12496
14
      { &hf_bgp_notify_minor_open_msg,
12497
14
        { "Minor error Code (Open Message)", "bgp.notify.minor_error_open", FT_UINT8, BASE_DEC,
12498
14
          VALS(bgpnotify_minor_open_msg), 0x0, NULL, HFILL }},
12499
14
      { &hf_bgp_notify_minor_update_msg,
12500
14
        { "Minor error Code (Update Message)", "bgp.notify.minor_error_update", FT_UINT8, BASE_DEC,
12501
14
          VALS(bgpnotify_minor_update_msg), 0x0, NULL, HFILL }},
12502
14
      { &hf_bgp_notify_minor_ht_expired,
12503
14
        { "Minor error Code (Hold Timer Expired)", "bgp.notify.minor_error_expired", FT_UINT8, BASE_DEC,
12504
14
          NULL, 0x0, NULL, HFILL }},
12505
14
      { &hf_bgp_notify_minor_state_machine,
12506
14
        { "Minor error Code (State Machine)", "bgp.notify.minor_error_state", FT_UINT8, BASE_DEC,
12507
14
          VALS(bgpnotify_minor_state_machine), 0x0, NULL, HFILL }},
12508
14
      { &hf_bgp_notify_minor_cease,
12509
14
        { "Minor error Code (Cease)", "bgp.notify.minor_error_cease", FT_UINT8, BASE_DEC,
12510
14
          VALS(bgpnotify_minor_cease), 0x0, NULL, HFILL }},
12511
14
      { &hf_bgp_notify_minor_rr_msg,
12512
14
        { "Minor error Code (Route-Refresh message)", "bgp.notify.minor_error_route_refresh", FT_UINT8, BASE_DEC,
12513
14
          VALS(bgpnotify_minor_rr_msg), 0x0, NULL, HFILL }},
12514
14
      { &hf_bgp_notify_minor_unknown,
12515
14
        { "Minor error Code (Unknown)", "bgp.notify.minor_error_unknown", FT_UINT8, BASE_DEC,
12516
14
          NULL, 0x0, NULL, HFILL }},
12517
14
      { &hf_bgp_notify_data,
12518
14
        { "Data", "bgp.notify.minor_data", FT_BYTES, BASE_NONE,
12519
14
           NULL, 0x0, NULL, HFILL }},
12520
14
      { &hf_bgp_notify_error_open_bad_peer_as,
12521
14
        { "Bad Peer AS", "bgp.notify.error_open.bad_peer_as", FT_UINT32, BASE_DEC,
12522
14
           NULL, 0x0, NULL, HFILL }},
12523
14
      { &hf_bgp_notify_communication_length,
12524
14
        { "BGP Shutdown Communication Length", "bgp.notify.communication_length", FT_UINT8, BASE_DEC,
12525
14
          NULL, 0x0, NULL, HFILL }},
12526
14
      { &hf_bgp_notify_communication,
12527
14
        { "Shutdown Communication", "bgp.notify.communication", FT_STRING, BASE_NONE,
12528
14
          NULL, 0x0, NULL, HFILL }},
12529
12530
        /* Route Refresh */
12531
14
      { &hf_bgp_route_refresh_afi,
12532
14
        { "Address family identifier (AFI)", "bgp.route_refresh.afi", FT_UINT16, BASE_DEC,
12533
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12534
14
      { &hf_bgp_route_refresh_subtype,
12535
14
        { "Subtype", "bgp.route_refresh.subtype", FT_UINT8, BASE_DEC,
12536
14
          VALS(route_refresh_subtype_vals), 0x0, NULL, HFILL }},
12537
14
      { &hf_bgp_route_refresh_safi,
12538
14
        { "Subsequent address family identifier (SAFI)", "bgp.route_refresh.safi", FT_UINT8, BASE_DEC,
12539
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12540
14
      { &hf_bgp_route_refresh_orf,
12541
14
        { "ORF information", "bgp.route_refresh.orf", FT_NONE, BASE_NONE,
12542
14
          NULL, 0x0, NULL, HFILL }},
12543
14
      { &hf_bgp_route_refresh_orf_flag,
12544
14
        { "ORF flag", "bgp.route_refresh.orf.flag", FT_UINT8, BASE_DEC,
12545
14
          VALS(orf_when_vals), 0x0, NULL, HFILL }},
12546
14
      { &hf_bgp_route_refresh_orf_type,
12547
14
        { "ORF type", "bgp.route_refresh.orf.type", FT_UINT8, BASE_DEC,
12548
14
          VALS(orf_type_vals), 0x0, NULL, HFILL }},
12549
14
      { &hf_bgp_route_refresh_orf_length,
12550
14
        { "ORF length", "bgp.route_refresh.orf.length", FT_UINT16, BASE_DEC,
12551
14
          NULL, 0x0, NULL, HFILL }},
12552
14
      { &hf_bgp_route_refresh_orf_entry_prefixlist,
12553
14
        { "ORFEntry PrefixList", "bgp.route_refresh.orf.entry", FT_NONE, BASE_NONE,
12554
14
          NULL, 0x0, NULL, HFILL }},
12555
14
      { &hf_bgp_route_refresh_orf_entry_action,
12556
14
        { "ORFEntry Action", "bgp.route_refresh.orf.entry.action", FT_UINT8, BASE_DEC,
12557
14
          VALS(orf_entry_action_vals), BGP_ORF_ACTION, NULL, HFILL }},
12558
14
      { &hf_bgp_route_refresh_orf_entry_match,
12559
14
        { "ORFEntry Match", "bgp.route_refresh.orf.entry.match", FT_UINT8, BASE_DEC,
12560
14
          VALS(orf_entry_match_vals), BGP_ORF_MATCH, NULL, HFILL }},
12561
14
      { &hf_bgp_route_refresh_orf_entry_sequence,
12562
14
        { "ORFEntry Sequence", "bgp.route_refresh.orf.entry.sequence", FT_UINT32, BASE_DEC,
12563
14
          NULL, 0x0, NULL, HFILL }},
12564
14
      { &hf_bgp_route_refresh_orf_entry_prefixmask_lower,
12565
14
        { "ORFEntry PrefixMask length lower bound", "bgp.route_refresh.orf.entry.prefixmask_lower", FT_UINT8, BASE_DEC,
12566
14
          NULL, 0x0, NULL, HFILL }},
12567
14
      { &hf_bgp_route_refresh_orf_entry_prefixmask_upper,
12568
14
        { "ORFEntry PrefixMask length upper bound", "bgp.route_refresh.orf.entry.prefixmask_upper", FT_UINT8, BASE_DEC,
12569
14
          NULL, 0x0, NULL, HFILL }},
12570
14
      { &hf_bgp_route_refresh_orf_entry_ip,
12571
14
        { "ORFEntry IP address", "bgp.route_refresh.orf.entry.ip", FT_IPv4, BASE_NONE,
12572
14
          NULL, 0x0, NULL, HFILL }},
12573
12574
        /* Capability */
12575
14
      { &hf_bgp_cap,
12576
14
        { "Capability", "bgp.cap", FT_NONE, BASE_NONE,
12577
14
          NULL, 0x0, NULL, HFILL }},
12578
14
      { &hf_bgp_cap_type,
12579
14
        { "Type", "bgp.cap.type", FT_UINT8, BASE_DEC,
12580
14
          VALS(capability_vals), 0x0, NULL, HFILL }},
12581
14
      { &hf_bgp_cap_length,
12582
14
        { "Length", "bgp.cap.length", FT_UINT8, BASE_DEC,
12583
14
          NULL, 0x0, NULL, HFILL }},
12584
14
      { &hf_bgp_cap_action,
12585
14
        { "Action", "bgp.cap.action", FT_UINT8, BASE_DEC,
12586
14
          VALS(bgpcap_action), 0x0, NULL, HFILL }},
12587
14
      { &hf_bgp_cap_unknown,
12588
14
        { "Unknown", "bgp.cap.unknown", FT_BYTES, BASE_NONE,
12589
14
          NULL, 0x0, NULL, HFILL }},
12590
14
      { &hf_bgp_cap_reserved,
12591
14
        { "Reserved", "bgp.cap.reserved", FT_BYTES, BASE_NONE,
12592
14
          NULL, 0x0, "Must be Zero", HFILL }},
12593
14
      { &hf_bgp_cap_mp_afi,
12594
14
        { "AFI", "bgp.cap.mp.afi", FT_UINT16, BASE_DEC,
12595
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12596
14
      { &hf_bgp_cap_mp_safi,
12597
14
        { "SAFI", "bgp.cap.mp.safi", FT_UINT8, BASE_DEC,
12598
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12599
14
      { &hf_bgp_cap_enh_afi,
12600
14
        { "AFI", "bgp.cap.enh.afi", FT_UINT16, BASE_DEC,
12601
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12602
14
      { &hf_bgp_cap_enh_safi,
12603
14
        { "SAFI", "bgp.cap.enh.safi", FT_UINT16, BASE_DEC,
12604
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12605
14
      { &hf_bgp_cap_enh_nhafi,
12606
14
        { "Next hop AFI", "bgp.cap.enh.nhafi", FT_UINT16, BASE_DEC,
12607
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12608
14
      { &hf_bgp_cap_role,
12609
14
        { "BGP Role", "bgp.cap.role", FT_UINT8, BASE_DEC,
12610
14
          VALS(bgprole_vals), 0x0, NULL, HFILL }},
12611
14
      { &hf_bgp_cap_gr_timers,
12612
14
        { "Restart Timers", "bgp.cap.gr.timers", FT_UINT16, BASE_HEX,
12613
14
          NULL, 0x0, NULL, HFILL }},
12614
14
      { &hf_bgp_cap_gr_timers_restart_flag,
12615
14
        { "Restart state", "bgp.cap.gr.timers.restart_flag", FT_BOOLEAN, 16,
12616
14
          TFS(&tfs_yes_no), 0x8000, NULL, HFILL }},
12617
14
      { &hf_bgp_cap_gr_timers_notification_flag,
12618
14
        { "Graceful notification", "bgp.cap.gr.timers.notification_flag", FT_BOOLEAN, 16,
12619
14
          TFS(&tfs_yes_no), 0x4000, NULL, HFILL }},
12620
14
      { &hf_bgp_cap_gr_timers_restart_time,
12621
14
        { "Time", "bgp.cap.gr.timers.restart_time", FT_UINT16, BASE_DEC,
12622
14
          NULL, 0x0FFF, "in us", HFILL }},
12623
14
      { &hf_bgp_cap_gr_afi,
12624
14
        { "AFI", "bgp.cap.gr.afi", FT_UINT16, BASE_DEC,
12625
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12626
14
      { &hf_bgp_cap_gr_safi,
12627
14
        { "SAFI", "bgp.cap.gr.safi", FT_UINT8, BASE_DEC,
12628
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12629
14
      { &hf_bgp_cap_gr_flag,
12630
14
        { "Flag", "bgp.cap.gr.flag", FT_UINT8, BASE_HEX,
12631
14
          NULL, 0x0, NULL, HFILL }},
12632
14
      { &hf_bgp_cap_gr_flag_pfs,
12633
14
        { "Preserve forwarding state", "bgp.cap.gr.flag.pfs", FT_BOOLEAN, 8,
12634
14
          TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
12635
14
      { &hf_bgp_cap_4as,
12636
14
        { "AS Number", "bgp.cap.4as", FT_UINT32, BASE_DEC,
12637
14
          NULL, 0x0, NULL, HFILL }},
12638
14
      { &hf_bgp_cap_dc,
12639
14
        { "Capability Dynamic", "bgp.cap.dc", FT_UINT8, BASE_DEC,
12640
14
          VALS(capability_vals), 0x0, NULL, HFILL }},
12641
14
      { &hf_bgp_cap_ap_afi,
12642
14
        { "AFI", "bgp.cap.ap.afi", FT_UINT16, BASE_DEC,
12643
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12644
14
      { &hf_bgp_cap_ap_safi,
12645
14
        { "SAFI", "bgp.cap.ap.safi", FT_UINT8, BASE_DEC,
12646
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12647
14
      { &hf_bgp_cap_ap_sendreceive,
12648
14
        { "Send/Receive", "bgp.cap.ap.sendreceive", FT_UINT8, BASE_DEC,
12649
14
          VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
12650
14
      { &hf_bgp_cap_orf_afi,
12651
14
        { "AFI", "bgp.cap.orf.afi", FT_UINT16, BASE_DEC,
12652
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12653
14
      { &hf_bgp_cap_orf_safi,
12654
14
        { "SAFI", "bgp.cap.orf.safi", FT_UINT8, BASE_DEC,
12655
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12656
14
      { &hf_bgp_cap_orf_number,
12657
14
        { "Number", "bgp.cap.orf.number", FT_UINT8, BASE_DEC,
12658
14
          NULL, 0x0, NULL, HFILL }},
12659
14
      { &hf_bgp_cap_orf_type,
12660
14
        { "Type", "bgp.cap.orf.type", FT_UINT8, BASE_DEC,
12661
14
          VALS(orf_type_vals), 0x0, NULL, HFILL }},
12662
14
      { &hf_bgp_cap_orf_sendreceive,
12663
14
        { "Send Receive", "bgp.cap.orf.sendreceive", FT_UINT8, BASE_DEC,
12664
14
          VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
12665
14
      { &hf_bgp_cap_fqdn_hostname_len,
12666
14
        { "Hostname Length", "bgp.cap.orf.fqdn.hostname.len", FT_UINT8, BASE_DEC,
12667
14
          NULL, 0x0, NULL, HFILL }},
12668
14
      { &hf_bgp_cap_fqdn_hostname,
12669
14
        { "Hostname", "bgp.cap.orf.fqdn.hostname", FT_STRING, BASE_NONE,
12670
14
          NULL, 0x0, NULL, HFILL }},
12671
14
      { &hf_bgp_cap_fqdn_domain_name_len,
12672
14
        { "Domain Name Length", "bgp.cap.orf.fqdn.domain_name.len", FT_UINT8, BASE_DEC,
12673
14
          NULL, 0x0, NULL, HFILL }},
12674
14
      { &hf_bgp_cap_fqdn_domain_name,
12675
14
        { "Domain Name", "bgp.cap.orf.fqdn.domain_name", FT_STRING, BASE_NONE,
12676
14
          NULL, 0x0, NULL, HFILL }},
12677
14
      { &hf_bgp_cap_multisession_flags,
12678
14
        { "Flag", "bgp.cap.multisession.flags", FT_UINT8, BASE_HEX,
12679
14
          NULL, 0x0, NULL, HFILL }},
12680
14
      { &hf_bgp_cap_bgpsec_flags,
12681
14
        { "Flag", "bgp.cap.bgpsec.flags", FT_UINT8, BASE_HEX,
12682
14
          NULL, 0x0, NULL, HFILL }},
12683
14
      { &hf_bgp_cap_bgpsec_version,
12684
14
        { "Version", "bgp.cap.bgpsec.version", FT_UINT8, BASE_DEC,
12685
14
          NULL, 0xF0, NULL, HFILL }},
12686
14
      { &hf_bgp_cap_bgpsec_sendreceive,
12687
14
        { "Send/Receive", "bgp.cap.bgpsec.sendreceive", FT_UINT8, BASE_DEC,
12688
14
          VALS(bgpsec_send_receive_vals), 0x8, NULL, HFILL }},
12689
14
      { &hf_bgp_cap_bgpsec_reserved,
12690
14
        { "Reserved", "bgp.cap.bgpsec.reserved", FT_UINT8, BASE_HEX,
12691
14
          NULL, 0x7, "Must be Zero", HFILL }},
12692
14
      { &hf_bgp_cap_bgpsec_afi,
12693
14
        { "AFI", "bgp.cap.bgpsec.afi", FT_UINT16, BASE_DEC,
12694
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12695
14
      { &hf_bgp_cap_soft_version_len,
12696
14
        { "Software Version Length", "bgp.cap.software_version.len", FT_UINT8, BASE_DEC,
12697
14
          NULL, 0x0, NULL, HFILL }},
12698
14
      { &hf_bgp_cap_soft_version,
12699
14
        { "Software Version", "bgp.cap.software_version", FT_STRING, BASE_NONE,
12700
14
          NULL, 0x0, NULL, HFILL }},
12701
      /* BGP update */
12702
12703
14
      { &hf_bgp_update_withdrawn_routes_length,
12704
14
        { "Withdrawn Routes Length", "bgp.update.withdrawn_routes.length", FT_UINT16, BASE_DEC,
12705
14
          NULL, 0x0, NULL, HFILL}},
12706
14
      { &hf_bgp_update_withdrawn_routes,
12707
14
        { "Withdrawn Routes", "bgp.update.withdrawn_routes", FT_NONE, BASE_NONE,
12708
14
          NULL, 0x0, NULL, HFILL}},
12709
12710
14
      { &hf_bgp_update_path_attribute_aggregator_as,
12711
14
        { "Aggregator AS", "bgp.update.path_attribute.aggregator_as", FT_UINT32, BASE_DEC,
12712
14
          NULL, 0x0, NULL, HFILL}},
12713
      /* BGP update path attributes */
12714
14
      { &hf_bgp_update_path_attributes,
12715
14
        { "Path attributes", "bgp.update.path_attributes", FT_NONE, BASE_NONE,
12716
14
          NULL, 0x0, NULL, HFILL}},
12717
14
      { &hf_bgp_update_path_attributes_unknown,
12718
14
        { "Unknown Path attributes", "bgp.update.path_attributes.unknown", FT_NONE, BASE_NONE,
12719
14
          NULL, 0x0, NULL, HFILL}},
12720
14
      { &hf_bgp_update_total_path_attribute_length,
12721
14
        { "Total Path Attribute Length", "bgp.update.path_attributes.length", FT_UINT16, BASE_DEC,
12722
14
          NULL, 0x0, NULL, HFILL}},
12723
14
      { &hf_bgp_update_path_attribute_aggregator_origin,
12724
14
        { "Aggregator origin", "bgp.update.path_attribute.aggregator_origin", FT_IPv4, BASE_NONE,
12725
14
          NULL, 0x0, NULL, HFILL}},
12726
14
      { &hf_bgp_update_path_attribute_as_path_segment,
12727
14
        { "AS Path segment", "bgp.update.path_attribute.as_path_segment", FT_NONE, BASE_NONE,
12728
14
          NULL, 0x0, NULL, HFILL}},
12729
14
      { &hf_bgp_update_path_attribute_as_path_segment_type,
12730
14
        { "Segment type", "bgp.update.path_attribute.as_path_segment.type", FT_UINT8, BASE_DEC,
12731
14
          VALS(as_segment_type), 0x0, NULL, HFILL}},
12732
14
      { &hf_bgp_update_path_attribute_as_path_segment_length,
12733
14
        { "Segment length (number of ASN)", "bgp.update.path_attribute.as_path_segment.length", FT_UINT8, BASE_DEC,
12734
14
          NULL, 0x0, NULL, HFILL}},
12735
14
      { &hf_bgp_update_path_attribute_as_path_segment_as2,
12736
14
        { "AS2", "bgp.update.path_attribute.as_path_segment.as2", FT_UINT16, BASE_DEC,
12737
14
          NULL, 0x0, NULL, HFILL}},
12738
14
      { &hf_bgp_update_path_attribute_as_path_segment_as4,
12739
14
        { "AS4", "bgp.update.path_attribute.as_path_segment.as4", FT_UINT32, BASE_DEC,
12740
14
          NULL, 0x0, NULL, HFILL}},
12741
14
      { &hf_bgp_update_path_attribute_communities,
12742
14
        { "Communities", "bgp.update.path_attribute.communities", FT_NONE, BASE_NONE,
12743
14
          NULL, 0x0, NULL, HFILL}},
12744
14
      { &hf_bgp_update_path_attribute_community,
12745
14
        { "Community", "bgp.update.path_attribute.community", FT_NONE, BASE_NONE,
12746
14
          NULL, 0x0, NULL, HFILL}},
12747
14
      { &hf_bgp_update_path_attribute_community_well_known,
12748
14
        { "Community Well-known", "bgp.update.path_attribute.community_wellknown", FT_UINT32, BASE_HEX,
12749
14
          VALS(community_vals), 0x0, "Reserved", HFILL}},
12750
14
      { &hf_bgp_update_path_attribute_community_as,
12751
14
        { "Community AS", "bgp.update.path_attribute.community_as", FT_UINT16, BASE_DEC,
12752
14
          NULL, 0x0, NULL, HFILL}},
12753
14
      { &hf_bgp_update_path_attribute_community_value,
12754
14
        { "Community value", "bgp.update.path_attribute.community_value", FT_UINT16, BASE_DEC,
12755
14
          NULL, 0x0, NULL, HFILL}},
12756
14
      { &hf_bgp_update_path_attribute_local_pref,
12757
14
        { "Local preference", "bgp.update.path_attribute.local_pref", FT_UINT32, BASE_DEC,
12758
14
          NULL, 0x0, NULL, HFILL}},
12759
14
      { &hf_bgp_update_path_attribute_attrset_origin_as,
12760
14
        { "Origin AS", "bgp.update.path_attribute.attr_set.origin_as", FT_UINT32, BASE_DEC,
12761
14
          NULL, 0x0, NULL, HFILL}},
12762
14
      { &hf_bgp_update_path_attribute_multi_exit_disc,
12763
14
        { "Multiple exit discriminator", "bgp.update.path_attribute.multi_exit_disc", FT_UINT32, BASE_DEC,
12764
14
          NULL, 0x0, NULL, HFILL}},
12765
14
      { &hf_bgp_update_path_attribute_next_hop,
12766
14
        { "Next hop", "bgp.update.path_attribute.next_hop", FT_IPv4, BASE_NONE,
12767
14
          NULL, 0x0, NULL, HFILL}},
12768
14
      { &hf_bgp_update_path_attribute_origin,
12769
14
        { "Origin", "bgp.update.path_attribute.origin", FT_UINT8, BASE_DEC,
12770
14
          VALS(bgpattr_origin), 0x0, NULL, HFILL}},
12771
14
      { &hf_bgp_update_path_attribute,
12772
14
        { "Path Attribute", "bgp.update.path_attribute", FT_NONE, BASE_NONE,
12773
14
          NULL, 0x0, NULL, HFILL}},
12774
14
      { &hf_bgp_update_path_attribute_flags,
12775
14
        { "Flags", "bgp.update.path_attribute.flags", FT_UINT8, BASE_HEX,
12776
14
          NULL, 0x0, NULL, HFILL}},
12777
14
      { &hf_bgp_update_path_attribute_flags_optional,
12778
14
        { "Optional", "bgp.update.path_attribute.flags.optional", FT_BOOLEAN, 8,
12779
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_OPTIONAL, NULL, HFILL}},
12780
14
      { &hf_bgp_update_path_attribute_flags_transitive,
12781
14
        { "Transitive", "bgp.update.path_attribute.flags.transitive", FT_BOOLEAN, 8,
12782
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_TRANSITIVE, NULL, HFILL}},
12783
14
      { &hf_bgp_update_path_attribute_flags_partial,
12784
14
        { "Partial", "bgp.update.path_attribute.flags.partial", FT_BOOLEAN, 8,
12785
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_PARTIAL, NULL, HFILL}},
12786
14
      { &hf_bgp_update_path_attribute_flags_extended_length,
12787
14
        { "Extended-Length", "bgp.update.path_attribute.flags.extended_length", FT_BOOLEAN, 8,
12788
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_EXTENDED_LENGTH, NULL, HFILL}},
12789
14
      { &hf_bgp_update_path_attribute_flags_unused,
12790
14
        { "Unused", "bgp.update.path_attribute.flags.unused", FT_UINT8, BASE_HEX,
12791
14
          NULL, BGP_ATTR_FLAG_UNUSED, NULL, HFILL}},
12792
14
      { &hf_bgp_update_path_attribute_type_code,
12793
14
        { "Type Code", "bgp.update.path_attribute.type_code", FT_UINT8, BASE_DEC,
12794
14
          VALS(bgpattr_type), 0x0, NULL, HFILL}},
12795
14
      { &hf_bgp_update_path_attribute_length,
12796
14
        { "Length", "bgp.update.path_attribute.length", FT_UINT16, BASE_DEC,
12797
14
          NULL, 0x0, NULL, HFILL}},
12798
14
      { &hf_bgp_update_path_attribute_link_state,
12799
14
        { "Link State", "bgp.update.path_attribute.link_state", FT_NONE, BASE_NONE,
12800
14
          NULL, 0x0, NULL, HFILL}},
12801
12802
      /* BGPsec Path Attributes, RFC8205*/
12803
14
      { &hf_bgp_update_path_attribute_bgpsec_sp_len,
12804
14
        { "Length", "bgp.update.path_attribute.bgpsec.sp.length", FT_UINT16, BASE_DEC,
12805
14
          NULL, 0x0, NULL, HFILL}},
12806
14
      { &hf_bgp_update_path_attribute_bgpsec_sps_pcount,
12807
14
        { "pCount", "bgp.update.path_attribute.bgpsec.sps.pcount", FT_UINT8, BASE_DEC,
12808
14
          NULL, 0x0, NULL, HFILL}},
12809
14
      { &hf_bgp_update_path_attribute_bgpsec_sps_flags,
12810
14
        { "Flags", "bgp.update.path_attribute.bgpsec.sps.flags", FT_UINT8, BASE_DEC,
12811
14
          NULL, 0x0, NULL, HFILL}},
12812
14
      { &hf_bgp_update_path_attribute_bgpsec_sps_as,
12813
14
        { "AS Number", "bgp.update.path_attribute.bgpsec.sps.as", FT_UINT32, BASE_DEC,
12814
14
          NULL, 0x0, NULL, HFILL}},
12815
14
      { &hf_bgp_update_path_attribute_bgpsec_sb_len,
12816
14
        { "Length", "bgp.update.path_attribute.bgpsec.sb.length", FT_UINT16, BASE_DEC,
12817
14
          NULL, 0x0, NULL, HFILL}},
12818
14
      { &hf_bgp_update_path_attribute_bgpsec_algo_id,
12819
14
        { "Algo ID", "bgp.update.path_attribute.bgpsec.sb.algo_id", FT_UINT8, BASE_DEC,
12820
14
          NULL, 0x0, NULL, HFILL}},
12821
14
      { &hf_bgp_update_path_attribute_bgpsec_ski,
12822
14
        { "SKI", "bgp.update.path_attribute.bgpsec.ss.ski", FT_BYTES, SEP_SPACE,
12823
14
          NULL, 0x0, NULL, HFILL}},
12824
14
      { &hf_bgp_update_path_attribute_bgpsec_sig_len,
12825
14
        { "Length", "bgp.update.path_attribute.bgpsec.ss.length", FT_UINT16, BASE_DEC,
12826
14
          NULL, 0x0, NULL, HFILL}},
12827
14
      { &hf_bgp_update_path_attribute_bgpsec_sig,
12828
14
        { "Signature", "bgp.update.path_attribute.bgpsec.ss.sig", FT_BYTES, SEP_SPACE,
12829
14
          NULL, 0x0, NULL, HFILL}},
12830
12831
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_address_family,
12832
14
        { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_reach_nlri.afi", FT_UINT16, BASE_DEC,
12833
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12834
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_safi,
12835
14
        { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_reach_nlri.safi", FT_UINT8, BASE_DEC,
12836
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12837
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop,
12838
14
        { "Next hop", "bgp.update.path_attribute.mp_reach_nlri.next_hop", FT_BYTES, BASE_NO_DISPLAY_VALUE,
12839
14
          NULL, 0x0, NULL, HFILL }},
12840
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd,
12841
14
        { "Route Distinguisher", "bgp.update.path_attribute.mp_reach_nlri.next_hop.rd", FT_STRING, BASE_NONE,
12842
14
          NULL, 0x0, "RD is always zero in the Next Hop", HFILL }},
12843
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4,
12844
14
        { "IPv4 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv4", FT_IPv4, BASE_NONE,
12845
14
          NULL, 0x0, NULL, HFILL}},
12846
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6,
12847
14
        { "IPv6 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6", FT_IPv6, BASE_NONE,
12848
14
          NULL, 0x0, NULL, HFILL}},
12849
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local,
12850
14
        { "Link-local Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6.link_local", FT_IPv6, BASE_NONE,
12851
14
          NULL, 0x0, NULL, HFILL}},
12852
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa,
12853
14
        { "Number of Subnetwork points of attachment (SNPA)", "bgp.update.path_attribute.mp_reach_nlri.nbr_snpa", FT_UINT8, BASE_DEC,
12854
14
          NULL, 0x0, NULL, HFILL }},
12855
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length,
12856
14
        { "SNPA Length", "bgp.update.path_attribute.mp_reach_nlri.snpa_length", FT_UINT8, BASE_DEC,
12857
14
          NULL, 0x0, NULL, HFILL }},
12858
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa,
12859
14
        { "SNPA", "bgp.update.path_attribute.mp_reach_nlri.snpa", FT_BYTES, BASE_NONE,
12860
14
          NULL, 0x0, NULL, HFILL }},
12861
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri,
12862
14
        { "Network Layer Reachability Information (NLRI)", "bgp.update.path_attribute.mp_reach_nlri", FT_NONE, BASE_NONE,
12863
14
          NULL, 0x0, NULL, HFILL}},
12864
12865
14
      { &hf_bgp_update_path_attribute_mp_unreach_nlri_address_family,
12866
14
        { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_unreach_nlri.afi", FT_UINT16, BASE_DEC,
12867
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12868
14
      { &hf_bgp_update_path_attribute_mp_unreach_nlri_safi,
12869
14
        { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_unreach_nlri.safi", FT_UINT8, BASE_DEC,
12870
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12871
14
      { &hf_bgp_update_path_attribute_mp_unreach_nlri,
12872
14
        { "Withdrawn Routes", "bgp.update.path_attribute.mp_unreach_nlri", FT_NONE, BASE_NONE,
12873
14
          NULL, 0x0, NULL, HFILL}},
12874
12875
14
      { &hf_bgp_pmsi_tunnel_flags,
12876
14
        { "Flags", "bgp.update.path_attribute.pmsi.tunnel.flags", FT_UINT8, BASE_DEC,
12877
14
          NULL, 0x0, NULL, HFILL}},
12878
14
      { &hf_bgp_pmsi_tunnel_type,
12879
14
        { "Tunnel Type", "bgp.update.path_attribute.pmsi.tunnel.type", FT_UINT8, BASE_DEC,
12880
14
          VALS(pmsi_tunnel_type), 0x0, NULL, HFILL}},
12881
14
      { &hf_bgp_pmsi_tunnel_id,
12882
14
        { "Tunnel ID", "bgp.update.path_attribute.pmsi.tunnel.id", FT_NONE, BASE_NONE,
12883
14
          NULL, 0x0, NULL, HFILL}},
12884
14
      { &hf_bgp_pmsi_tunnel_not_present,
12885
14
        { "Tunnel ID not present", "bgp.update.path_attribute.pmsi.tunnel_id.not_present", FT_NONE, BASE_NONE,
12886
14
          NULL, 0x0, NULL, HFILL}},
12887
14
      { &hf_bgp_update_mpls_label,
12888
14
        { "MPLS Label Stack", "bgp.update.path_attribute.mpls_label", FT_NONE,
12889
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12890
14
      { &hf_bgp_update_mpls_label_value_20bits,
12891
14
        { "MPLS Label", "bgp.update.path_attribute.mpls_label_value_20bits", FT_UINT24,
12892
14
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
12893
14
      { &hf_bgp_update_mpls_label_value,
12894
14
        { "MPLS Label", "bgp.update.path_attribute.mpls_label_value", FT_UINT24,
12895
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12896
14
      { &hf_bgp_update_mpls_traffic_class,
12897
14
        { "Traffic Class", "bgp.update.path_attribute.mpls_traffic_class", FT_UINT24,
12898
14
          BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
12899
14
      { &hf_bgp_update_mpls_bottom_stack,
12900
14
        { "Bottom-of-Stack", "bgp.update.path_attribute.mpls_bottom_stack", FT_BOOLEAN,
12901
14
          24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
12902
14
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_id, /* RFC4875 section 19 */
12903
14
        { "RSVP P2MP id", "bgp.update.path_attribute.pmsi.rsvp.id", FT_IPv4, BASE_NONE,
12904
14
          NULL, 0x0, NULL, HFILL}},
12905
14
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id,
12906
14
        { "RSVP P2MP tunnel id", "bgp.update.path_attribute.pmsi.rsvp.tunnel_id", FT_UINT16, BASE_DEC,
12907
14
          NULL, 0x0, NULL, HFILL}},
12908
14
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4,
12909
14
        { "RSVP P2MP extended tunnel id", "bgp.update.path_attribute.pmsi.rsvp.ext_tunnel_idv4", FT_IPv4, BASE_NONE,
12910
14
         NULL, 0x0, NULL, HFILL}},
12911
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_type,
12912
14
        { "mLDP P2MP FEC element type", "bgp.update.path_attribute.pmsi.mldp.fec.type", FT_UINT8, BASE_DEC,
12913
14
         VALS(fec_types_vals), 0x0, NULL, HFILL}},
12914
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_afi,
12915
14
        {"mLDP P2MP FEC element address family", "bgp.update.path_attribute.pmsi.mldp.fec.address_family", FT_UINT16, BASE_DEC,
12916
14
         VALS(afn_vals), 0x0, NULL, HFILL}},
12917
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len,
12918
14
        {"mLDP P2MP FEC element address length", "bgp.update.path_attribute.pmsi.mldp.fec.address_length", FT_UINT8, BASE_DEC,
12919
14
         NULL, 0x0, NULL, HFILL}},
12920
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4,
12921
14
        {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev4", FT_IPv4, BASE_NONE,
12922
14
         NULL, 0x0, NULL, HFILL}},
12923
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6,
12924
14
        {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev6", FT_IPv6, BASE_NONE,
12925
14
         NULL, 0x0, NULL, HFILL}},
12926
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len,
12927
14
        {"mLDP P2MP FEC element opaque length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_length", FT_UINT16, BASE_DEC,
12928
14
         NULL, 0x0, NULL, HFILL}},
12929
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
12930
14
        {"mLDP P2MP FEC element opaque value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_type", FT_UINT8, BASE_DEC,
12931
14
         VALS(pmsi_mldp_fec_opaque_value_type), 0x0, NULL, HFILL}},
12932
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len,
12933
14
        {"mLDP P2MP FEC element opaque value length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_length", FT_UINT16, BASE_DEC,
12934
14
         NULL, 0x0, NULL, HFILL}},
12935
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn,
12936
14
        {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_rn", FT_UINT32, BASE_DEC,
12937
14
         NULL, 0x0, NULL, HFILL}},
12938
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str,
12939
14
        {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_str", FT_STRING, BASE_NONE,
12940
14
         NULL, 0x0, NULL, HFILL}},
12941
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type,
12942
14
        {"mLDP P2MP FEC element opaque extended value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_value_type", FT_UINT16, BASE_DEC,
12943
14
         VALS(pmsi_mldp_fec_opa_extented_type), 0x0, NULL, HFILL}},
12944
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len,
12945
14
        {"mLDP P2MP FEC element opaque extended length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_length", FT_UINT16, BASE_DEC,
12946
14
         NULL, 0x0, NULL, HFILL}},
12947
14
      { &hf_bgp_pmsi_tunnel_pimsm_sender,
12948
14
        {"PIM-SM Tree tunnel sender address", "bgp.update.path_attribute.pmsi.pimsm.sender_address", FT_IPv4, BASE_NONE,
12949
14
         NULL, 0x0, NULL, HFILL}},
12950
14
      { &hf_bgp_pmsi_tunnel_pimsm_pmc_group,
12951
14
        {"PIM-SM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimsm.pmulticast_group", FT_IPv4, BASE_NONE,
12952
14
         NULL, 0x0, NULL, HFILL}},
12953
14
      { &hf_bgp_pmsi_tunnel_pimssm_root_node,
12954
14
        {"PIM-SSM Tree tunnel Root Node", "bgp.update.path_attribute.pmsi.pimssm.root_node", FT_IPv4, BASE_NONE,
12955
14
         NULL, 0x0, NULL, HFILL}},
12956
14
      { &hf_bgp_pmsi_tunnel_pimssm_pmc_group,
12957
14
        {"PIM-SSM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimssm.pmulticast_group", FT_IPv4, BASE_NONE,
12958
14
         NULL, 0x0, NULL, HFILL}},
12959
14
      { &hf_bgp_pmsi_tunnel_pimbidir_sender,
12960
14
        {"BIDIR-PIM Tree Tunnel sender address", "bgp.update.path_attribute.pmsi.bidir_pim_tree.sender", FT_IPv4, BASE_NONE,
12961
14
         NULL, 0x0, NULL, HFILL}},
12962
14
      { &hf_bgp_pmsi_tunnel_pimbidir_pmc_group,
12963
14
        {"BIDIR-PIM Tree Tunnel P-multicast group", "bgp.update.path_attribute.pmsi.bidir_pim_tree.pmulticast_group", FT_IPv4, BASE_NONE,
12964
14
         NULL, 0x0, NULL, HFILL}},
12965
14
      { &hf_bgp_pmsi_tunnel_ingress_rep_addr,
12966
14
        {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip", FT_IPv4, BASE_NONE,
12967
14
        NULL, 0x0, NULL, HFILL}},
12968
14
      { &hf_bgp_pmsi_tunnel_ingress_rep_addr6,
12969
14
        {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip6", FT_IPv6, BASE_NONE,
12970
14
        NULL, 0x0, NULL, HFILL}},
12971
12972
        /* BGP Only to Customer (OTC) Attribute, RFC9234 */
12973
14
      { &hf_bgp_update_path_attribute_otc,
12974
14
        { "Only to Customer", "bgp.update.path_attribute.otc", FT_UINT32, BASE_DEC,
12975
14
          NULL, 0x0, NULL, HFILL}},
12976
12977
        /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
12978
14
      { &hf_bgp_update_path_attribute_d_path,
12979
14
        { "Domain Path Attribute", "bgp.update.path_attribute.dpath", FT_STRING, BASE_NONE,
12980
14
          NULL, 0x0, NULL, HFILL}},
12981
14
      { &hf_bgp_d_path_length,
12982
14
        {"Domain Path Attribute length", "bgp.update.attribute.dpath.length", FT_UINT16, BASE_DEC,
12983
14
        NULL, 0x0, NULL, HFILL}},
12984
14
      { &hf_bgp_d_path_ga,
12985
14
        { "Global Administrator", "bgp.update.attribute.dpath.ga", FT_UINT32, BASE_DEC,
12986
14
          NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
12987
14
      { &hf_bgp_d_path_la,
12988
14
        { "Local Administrator", "bgp.update.attribute.dpath.la", FT_UINT16, BASE_DEC,
12989
14
          NULL, 0x0, "A two-octet operator-defined value", HFILL }},
12990
14
      { &hf_bgp_d_path_isf_safi,
12991
14
        { "Inter-Subnet Forwarding SAFI type", "bgp.update.attribute.dpath.isf.safi", FT_UINT8, BASE_DEC,
12992
14
          NULL, 0x0, NULL, HFILL }},
12993
12994
        /* RFC7311 */
12995
14
      { &hf_bgp_update_path_attribute_aigp,
12996
14
        { "AIGP Attribute", "bgp.update.path_attribute.aigp", FT_NONE, BASE_NONE,
12997
14
          NULL, 0x0, NULL, HFILL}},
12998
14
      { &hf_bgp_aigp_type,
12999
14
        {"AIGP attribute type", "bgp.update.attribute.aigp.type", FT_UINT8, BASE_DEC,
13000
14
        VALS(aigp_tlv_type), 0x0, NULL, HFILL }},
13001
14
      { &hf_bgp_aigp_tlv_length,
13002
14
        {"AIGP TLV length", "bgp.update.attribute.aigp.length", FT_UINT16, BASE_DEC,
13003
14
        NULL, 0x0, NULL, HFILL}},
13004
14
      { &hf_bgp_aigp_accu_igp_metric,
13005
14
        {"AIGP Accumulated IGP Metric", "bgp.update.attribute.aigp.accu_igp_metric", FT_UINT64, BASE_DEC,
13006
14
        NULL, 0x0, NULL, HFILL}},
13007
13008
        /* RFC8092 */
13009
14
      { &hf_bgp_large_communities,
13010
14
        { "Large Communities", "bgp.large_communities", FT_STRING, BASE_NONE,
13011
14
          NULL, 0x0, NULL, HFILL }},
13012
14
      { &hf_bgp_large_communities_ga,
13013
14
        { "Global Administrator", "bgp.large_communities.ga", FT_UINT32, BASE_DEC,
13014
14
          NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
13015
14
      { &hf_bgp_large_communities_ldp1,
13016
14
        { "Local Data Part 1", "bgp.large_communities.ldp1", FT_UINT32, BASE_DEC,
13017
14
          NULL, 0x0, "A four-octet operator-defined value", HFILL }},
13018
14
      { &hf_bgp_large_communities_ldp2,
13019
14
        { "Local Data Part 2", "bgp.large_communities.ldp2", FT_UINT32, BASE_DEC,
13020
14
          NULL, 0x0, "A four-octet operator-defined value", HFILL }},
13021
13022
        /* RFC4456 */
13023
14
       { &hf_bgp_update_path_attribute_originator_id,
13024
14
        { "Originator identifier", "bgp.update.path_attribute.originator_id", FT_IPv4, BASE_NONE,
13025
14
          NULL, 0x0, NULL, HFILL}},
13026
14
      { &hf_bgp_update_path_attribute_cluster_list,
13027
14
        { "Cluster List", "bgp.path_attribute.cluster_list", FT_NONE, BASE_NONE,
13028
14
          NULL, 0x0, NULL, HFILL}},
13029
14
      { &hf_bgp_update_path_attribute_cluster_id,
13030
14
        { "Cluster ID", "bgp.path_attribute.cluster_id", FT_IPv4, BASE_NONE,
13031
14
          NULL, 0x0, NULL, HFILL}},
13032
13033
        /* RFC8669 */
13034
14
      { &hf_bgp_prefix_sid_unknown,
13035
14
        { "Unknown TLV", "bgp.prefix_sid.unknown", FT_NONE, BASE_NONE,
13036
14
          NULL, 0x0, NULL, HFILL }},
13037
14
      { &hf_bgp_prefix_sid_label_index,
13038
14
        { "Label-Index", "bgp.prefix_sid.label_index", FT_NONE, BASE_NONE,
13039
14
          NULL, 0x0, NULL, HFILL }},
13040
14
      { &hf_bgp_prefix_sid_label_index_value,
13041
14
        { "Label-Index Value", "bgp.prefix_sid.label_index.value", FT_UINT32, BASE_DEC,
13042
14
          NULL, 0x0, "4-octet label index value", HFILL }},
13043
14
      { &hf_bgp_prefix_sid_label_index_flags,
13044
14
        { "Label-Index Flags", "bgp.prefix_sid.label_index.flags", FT_UINT16, BASE_HEX,
13045
14
          NULL, 0x0, "2-octet flags, None is defined", HFILL }},
13046
14
      { &hf_bgp_prefix_sid_originator_srgb_flags,
13047
14
        { "Originator SRGB Flags", "bgp.prefix_sid.originator_srgb.flags", FT_UINT16, BASE_HEX,
13048
14
          NULL, 0x0, "2-octet flags, None is defined", HFILL }},
13049
14
      { &hf_bgp_prefix_sid_originator_srgb,
13050
14
        { "Originator SRGB", "bgp.prefix_sid.originator_srgb", FT_NONE, BASE_NONE,
13051
14
          NULL, 0x0, NULL, HFILL }},
13052
14
      { &hf_bgp_prefix_sid_originator_srgb_blocks,
13053
14
        { "SRGB Blocks", "bgp.prefix_sid.originator_srgb_blocks", FT_NONE, BASE_NONE,
13054
14
          NULL, 0x0, NULL, HFILL }},
13055
14
      { &hf_bgp_prefix_sid_originator_srgb_block,
13056
14
        { "SRGB Block", "bgp.prefix_sid.originator_srgb_block", FT_NONE, BASE_NONE,
13057
14
          NULL, 0x0, NULL, HFILL }},
13058
14
      { &hf_bgp_prefix_sid_originator_srgb_base,
13059
14
        { "SRGB Base", "bgp.prefix_sid.originator_srgb_base", FT_UINT24, BASE_DEC,
13060
14
          NULL, 0x0, "A three-octet value", HFILL }},
13061
14
      { &hf_bgp_prefix_sid_originator_srgb_range,
13062
14
        { "SRGB Range", "bgp.prefix_sid.originator_srgb_range", FT_UINT24, BASE_DEC,
13063
14
          NULL, 0x0, "A three-octet value", HFILL }},
13064
14
      { &hf_bgp_prefix_sid_type,
13065
14
        { "Type", "bgp.prefix_sid.type", FT_UINT8, BASE_DEC,
13066
14
          VALS(bgp_prefix_sid_type), 0x0, "BGP Prefix-SID message type", HFILL }},
13067
14
      { &hf_bgp_prefix_sid_length,
13068
14
        { "Length", "bgp.prefix_sid.length", FT_UINT16, BASE_DEC,
13069
14
          NULL, 0x0, "BGP Prefix-SID message payload", HFILL }},
13070
14
      { &hf_bgp_prefix_sid_value,
13071
14
        { "Value", "bgp.prefix_sid.value", FT_BYTES, BASE_NONE,
13072
14
          NULL, 0x0, "BGP Prefix-SID message value", HFILL }},
13073
14
      { &hf_bgp_prefix_sid_reserved,
13074
14
        { "Reserved", "bgp.prefix_sid.reserved", FT_BYTES,
13075
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13076
13077
        /* draft-ietf-bess-srv6-services-05 */
13078
14
      { &hf_bgp_prefix_sid_srv6_l3vpn,
13079
14
        { "SRv6 L3 Service", "bgp.prefix_sid.srv6_l3vpn", FT_NONE, BASE_NONE,
13080
14
          NULL, 0x0, NULL, HFILL }},
13081
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
13082
14
        { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_tlvs", FT_NONE, BASE_NONE,
13083
14
          NULL, 0x0, NULL, HFILL }},
13084
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
13085
14
        { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_tlv", FT_NONE, BASE_NONE,
13086
14
          NULL, 0x0, NULL, HFILL }},
13087
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type,
13088
14
        { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
13089
14
          VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
13090
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length,
13091
14
        { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
13092
14
          NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
13093
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value,
13094
14
        { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
13095
14
          NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
13096
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved,
13097
14
        { "Reserved", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.reserved", FT_BYTES,
13098
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13099
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_value,
13100
14
        { "SRv6 SID Value", "bgp.prefix_sid.srv6_l3vpn.sid_value", FT_IPv6, BASE_NONE,
13101
14
          NULL, 0x0, NULL, HFILL }},
13102
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_flags,
13103
14
        { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l3vpn.sid_flags", FT_UINT8, BASE_HEX,
13104
14
          NULL, 0x0, NULL, HFILL }},
13105
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior,
13106
14
        { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l3vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
13107
14
          VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
13108
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_reserved,
13109
14
        { "Reserved", "bgp.prefix_sid.srv6_l3vpn.reserved", FT_BYTES,
13110
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13111
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
13112
14
        { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
13113
14
          NULL, 0x0, NULL, HFILL }},
13114
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
13115
14
        { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
13116
14
          NULL, 0x0, NULL, HFILL }},
13117
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type,
13118
14
        { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
13119
14
          VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
13120
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length,
13121
14
        { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
13122
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
13123
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value,
13124
14
        { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
13125
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
13126
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len,
13127
14
        { "Locator Block Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
13128
14
          NULL, 0x0, NULL, HFILL }},
13129
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len,
13130
14
        { "Locator Node Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
13131
14
          NULL, 0x0, NULL, HFILL }},
13132
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len,
13133
14
        { "Function Length", "bgp.prefix_sid.srv6_l3vpn.sid.func_len", FT_UINT8, BASE_DEC,
13134
14
          NULL, 0x0, NULL, HFILL }},
13135
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len,
13136
14
        { "Argument Length", "bgp.prefix_sid.srv6_l3vpn.sid.arg_len", FT_UINT8, BASE_DEC,
13137
14
          NULL, 0x0, NULL, HFILL }},
13138
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len,
13139
14
        { "Transposition Length", "bgp.prefix_sid.srv6_l3vpn.sid.trans_len", FT_UINT8, BASE_DEC,
13140
14
          NULL, 0x0, NULL, HFILL }},
13141
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset,
13142
14
        { "Transposition Offset", "bgp.prefix_sid.srv6_l3vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
13143
14
          NULL, 0x0, NULL, HFILL }},
13144
14
      { &hf_bgp_prefix_sid_srv6_l2vpn,
13145
14
        { "SRv6 L2 Service", "bgp.prefix_sid.srv6_l2vpn", FT_NONE, BASE_NONE,
13146
14
          NULL, 0x0, NULL, HFILL }},
13147
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
13148
14
        { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_tlvs", FT_NONE, BASE_NONE,
13149
14
          NULL, 0x0, NULL, HFILL }},
13150
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
13151
14
        { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_tlv", FT_NONE, BASE_NONE,
13152
14
          NULL, 0x0, NULL, HFILL }},
13153
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type,
13154
14
        { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
13155
14
          VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
13156
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length,
13157
14
        { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
13158
14
          NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
13159
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value,
13160
14
        { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
13161
14
          NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
13162
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved,
13163
14
        { "Reserved", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.reserved", FT_BYTES,
13164
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13165
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_value,
13166
14
        { "SRv6 SID Value", "bgp.prefix_sid.srv6_l2vpn.sid_value", FT_IPv6, BASE_NONE,
13167
14
          NULL, 0x0, NULL, HFILL }},
13168
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_flags,
13169
14
        { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l2vpn.sid_flags", FT_UINT8, BASE_HEX,
13170
14
          NULL, 0x0, NULL, HFILL }},
13171
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior,
13172
14
        { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l2vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
13173
14
          VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
13174
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_reserved,
13175
14
        { "Reserved", "bgp.prefix_sid.srv6_l2vpn.reserved", FT_BYTES,
13176
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13177
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
13178
14
        { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
13179
14
          NULL, 0x0, NULL, HFILL }},
13180
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
13181
14
        { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
13182
14
          NULL, 0x0, NULL, HFILL }},
13183
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type,
13184
14
        { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
13185
14
          VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
13186
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length,
13187
14
        { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
13188
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
13189
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value,
13190
14
        { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
13191
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
13192
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len,
13193
14
        { "Locator Block Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
13194
14
          NULL, 0x0, NULL, HFILL }},
13195
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len,
13196
14
        { "Locator Node Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
13197
14
          NULL, 0x0, NULL, HFILL }},
13198
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len,
13199
14
        { "Function Length", "bgp.prefix_sid.srv6_l2vpn.sid.func_len", FT_UINT8, BASE_DEC,
13200
14
          NULL, 0x0, NULL, HFILL }},
13201
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len,
13202
14
        { "Argument Length", "bgp.prefix_sid.srv6_l2vpn.sid.arg_len", FT_UINT8, BASE_DEC,
13203
14
          NULL, 0x0, NULL, HFILL }},
13204
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len,
13205
14
        { "Transposition Length", "bgp.prefix_sid.srv6_l2vpn.sid.trans_len", FT_UINT8, BASE_DEC,
13206
14
          NULL, 0x0, NULL, HFILL }},
13207
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset,
13208
14
        { "Transposition Offset", "bgp.prefix_sid.srv6_l2vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
13209
14
          NULL, 0x0, NULL, HFILL }},
13210
13211
        /* RFC5512 : BGP Encapsulation SAFI and the BGP Tunnel Encapsulation Attribute  */
13212
14
      { &hf_bgp_update_encaps_tunnel_tlv_len,
13213
14
        { "length", "bgp.update.encaps_tunnel_tlv_len", FT_UINT16,
13214
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13215
14
      { &hf_bgp_update_encaps_tunnel_tlv_type,
13216
14
        { "Type code", "bgp.update.encaps_tunnel_tlv_type", FT_UINT16, BASE_DEC,
13217
14
          VALS(bgp_attr_tunnel_type), 0x0, NULL, HFILL}},
13218
14
      { &hf_bgp_update_encaps_tunnel_subtlv_len,
13219
14
        { "length", "bgp.update.encaps_tunnel_tlv_sublen", FT_UINT16,
13220
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13221
14
      { &hf_bgp_update_encaps_tunnel_subtlv_type,
13222
14
        { "Type code", "bgp.update.encaps_tunnel_subtlv_type", FT_UINT8, BASE_DEC,
13223
14
          VALS(subtlv_type), 0x0, NULL, HFILL}},
13224
14
      { &hf_bgp_update_encaps_tunnel_subtlv_session_id,
13225
14
        { "Session ID", "bgp.update.encaps_tunnel_tlv_subtlv_session_id", FT_UINT32,
13226
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13227
14
      { &hf_bgp_update_encaps_tunnel_subtlv_cookie,
13228
14
        { "Cookie", "bgp.update.encaps_tunnel_tlv_subtlv_cookie", FT_BYTES,
13229
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13230
14
      { &hf_bgp_update_encaps_tunnel_subtlv_gre_key,
13231
14
        { "GRE Key", "bgp.update.encaps_tunnel_tlv_subtlv_gre_key", FT_UINT32,
13232
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13233
14
      { &hf_bgp_update_encaps_tunnel_subtlv_color_value,
13234
14
        { "Color Value", "bgp.update.encaps_tunnel_tlv_subtlv_color_value", FT_UINT32,
13235
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13236
14
      { &hf_bgp_update_encaps_tunnel_subtlv_lb_block_length,
13237
14
        { "Load-balancing block length", "bgp.update.encaps_tunnel_tlv_subtlv_lb_block_length", FT_UINT32,
13238
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13239
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
13240
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags", FT_UINT8,
13241
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13242
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
13243
14
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_vnid", FT_BOOLEAN,
13244
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_VNID, NULL, HFILL }},
13245
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
13246
14
        { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_mac", FT_BOOLEAN,
13247
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_MAC, NULL, HFILL }},
13248
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
13249
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.reserved", FT_UINT8,
13250
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_RESERVED, NULL, HFILL }},
13251
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid,
13252
14
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.vnid", FT_UINT24,
13253
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13254
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac,
13255
14
        { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.mac", FT_ETHER,
13256
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13257
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved,
13258
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.reserved", FT_UINT16,
13259
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13260
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
13261
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags", FT_UINT8,
13262
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13263
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
13264
14
        { "Version", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.version", FT_UINT8,
13265
14
          BASE_DEC, NULL, TUNNEL_SUBTLV_VXLAN_GPE_VERSION, NULL, HFILL }},
13266
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
13267
14
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.valid_vnid", FT_BOOLEAN,
13268
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID, NULL, HFILL }},
13269
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
13270
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.reserved", FT_UINT8,
13271
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_GPE_RESERVED, NULL, HFILL }},
13272
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid,
13273
14
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.vnid", FT_UINT24,
13274
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13275
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved,
13276
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.reserved", FT_UINT16,
13277
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13278
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
13279
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags", FT_UINT8,
13280
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13281
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
13282
14
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_vnid", FT_BOOLEAN,
13283
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_VNID, NULL, HFILL }},
13284
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
13285
14
        { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_mac", FT_BOOLEAN,
13286
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_MAC, NULL, HFILL }},
13287
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
13288
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.reserved", FT_UINT8,
13289
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_NVGRE_RESERVED, NULL, HFILL }},
13290
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid,
13291
14
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.vnid", FT_UINT24,
13292
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13293
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac,
13294
14
        { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.mac", FT_ETHER,
13295
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13296
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved,
13297
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.reserved", FT_UINT16,
13298
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13299
14
      { &hf_bgp_update_encaps_tunnel_subtlv_value,
13300
14
        { "Value", "bgp.update.encaps_tunnel_tlv_subtlv.value", FT_BYTES,
13301
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13302
14
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_flags,
13303
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.pref.flags", FT_UINT8,
13304
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13305
14
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_reserved,
13306
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.pref.reserved", FT_UINT8,
13307
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13308
14
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_preference,
13309
14
        { "Preference", "bgp.update.encaps_tunnel_tlv_subtlv.pref.preference", FT_BYTES,
13310
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13311
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
13312
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags", FT_UINT8,
13313
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13314
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
13315
14
        { "Specified-BSID-only", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.specified", FT_BOOLEAN,
13316
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_SPECIFIED, NULL, HFILL }},
13317
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
13318
14
        { "Drop Upon Invalid", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.invalid", FT_BOOLEAN,
13319
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_INVALID, NULL, HFILL }},
13320
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
13321
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.reserved", FT_UINT8,
13322
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_BINDING_RESERVED, NULL, HFILL }},
13323
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
13324
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.reserved", FT_UINT8,
13325
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13326
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid,
13327
14
        { "Binding SID", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.sid", FT_BYTES,
13328
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13329
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags,
13330
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags", FT_UINT8,
13331
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13332
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_specified,
13333
14
        { "S-Flag: Specified-BSID-only", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.specified", FT_BOOLEAN,
13334
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SRV6_BINDING_SPECIFIED, NULL, HFILL }},
13335
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_invalid,
13336
14
        { "I-Flag: Drop Upon Invalid", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.invalid", FT_BOOLEAN,
13337
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SRV6_BINDING_INVALID, NULL, HFILL }},
13338
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_b_flag,
13339
14
        { "B-Flag: SRv6 Endpoint Behavior present", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.b_flag", FT_BOOLEAN,
13340
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SRV6_BINDING_B_FLAG, NULL, HFILL }},
13341
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_reserved,
13342
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.reserved", FT_UINT8,
13343
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_SRV6_BINDING_RESERVED, NULL, HFILL }},
13344
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_reserved,
13345
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.reserved", FT_UINT8,
13346
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13347
14
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_sid,
13348
14
        { "SRv6 Binding SID", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.sid", FT_IPv6,
13349
14
          BASE_NONE, NULL, 0x0, "16-octet IPv6 address", HFILL}},
13350
14
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_flags,
13351
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.flags", FT_UINT8,
13352
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13353
14
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved,
13354
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.reserved", FT_UINT8,
13355
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13356
14
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp,
13357
14
        { "ENLP", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.preference", FT_UINT8,
13358
14
          BASE_DEC, VALS(bgp_enlp_type), 0x0, NULL, HFILL}},
13359
14
      { &hf_bgp_update_encaps_tunnel_subtlv_priority_priority,
13360
14
        { "Priority", "bgp.update.encaps_tunnel_tlv_subtlv.priority.priority", FT_UINT8,
13361
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13362
14
      { &hf_bgp_update_encaps_tunnel_subtlv_priority_reserved,
13363
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.priority.reserved", FT_UINT8,
13364
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13365
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved,
13366
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.reserved", FT_UINT8,
13367
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13368
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv,
13369
14
        { "sub-TLVs", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv", FT_BYTES,
13370
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13371
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type,
13372
14
        { "Type", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.type", FT_UINT8,
13373
14
          BASE_DEC, VALS(bgp_sr_policy_list_type), 0x0, NULL, HFILL}},
13374
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length,
13375
14
        { "Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.length", FT_UINT8,
13376
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13377
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
13378
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags", FT_UINT8,
13379
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13380
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
13381
14
        { "V-Flag: SID verification", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.verification", FT_BOOLEAN,
13382
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION, "Used by SRPM for SID verification (RFC 9256)", HFILL }},
13383
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
13384
14
        { "A-Flag: SR Algorithm", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.algorithm", FT_BOOLEAN,
13385
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM, "SR Algorithm field present (RFC 9831)", HFILL }},
13386
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_s_flag,
13387
14
        { "S-Flag: SID present", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.s_flag", FT_BOOLEAN,
13388
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_S_FLAG, "Indicates presence of SR-MPLS or SRv6 SID (RFC 9831)", HFILL }},
13389
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_b_flag,
13390
14
        { "B-Flag: SRv6 Endpoint Behavior present", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.b_flag", FT_BOOLEAN,
13391
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_B_FLAG, "Indicates presence of SRv6 Endpoint Behavior and SID Structure (RFC 9830)", HFILL }},
13392
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
13393
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.reserved", FT_UINT8,
13394
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED, NULL, HFILL }},
13395
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
13396
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.reserved", FT_BYTES,
13397
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13398
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
13399
14
        { "MPLS Label", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.mpls_label", FT_UINT24,
13400
14
          BASE_DEC_HEX, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
13401
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
13402
14
        { "Traffic Class", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.traffic_class", FT_UINT24,
13403
14
          BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
13404
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
13405
14
        { "Bottom-of-Stack", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.bottom_stack", FT_BOOLEAN,
13406
14
          24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
13407
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
13408
14
        { "TTL", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ttl", FT_UINT8,
13409
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13410
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
13411
14
        { "SR Algorithm", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.sr_algorithm", FT_UINT8,
13412
14
          BASE_DEC, NULL, 0x0, "SR Algorithm as per RFC 8402 Section 3.1.1", HFILL}},
13413
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
13414
14
        { "Local Interface ID", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.local_interface_id", FT_UINT32,
13415
14
          BASE_DEC, NULL, 0x0, "Interface index of the local interface (RFC 9552 TLV 258)", HFILL}},
13416
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id,
13417
14
        { "Remote Interface ID", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.remote_interface_id", FT_UINT32,
13418
14
          BASE_DEC, NULL, 0x0, "Interface index of the remote interface (RFC 9552 TLV 258)", HFILL}},
13419
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address,
13420
14
        { "IPv4 Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ipv4_node_address", FT_IPv4,
13421
14
          BASE_NONE, NULL, 0x0, "4-octet IPv4 address representing a node", HFILL}},
13422
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv4_address,
13423
14
        { "Local IPv4 Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.local_ipv4_address", FT_IPv4,
13424
14
          BASE_NONE, NULL, 0x0, "Local link address (adjacency)", HFILL}},
13425
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv4_address,
13426
14
        { "Remote IPv4 Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.remote_ipv4_address", FT_IPv4,
13427
14
          BASE_NONE, NULL, 0x0, "Remote link address of neighbor (adjacency)", HFILL}},
13428
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address,
13429
14
        { "IPv6 Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ipv6_node_address", FT_IPv6,
13430
14
          BASE_NONE, NULL, 0x0, "16-octet IPv6 address representing a node", HFILL}},
13431
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
13432
14
        { "IPv6 Local Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.local_ipv6_address", FT_IPv6,
13433
14
          BASE_NONE, NULL, 0x0, "16-octet IPv6 local node address (link-local adjacency)", HFILL}},
13434
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
13435
14
        { "IPv6 Remote Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.remote_ipv6_address", FT_IPv6,
13436
14
          BASE_NONE, NULL, 0x0, "16-octet IPv6 remote node address (link-local adjacency)", HFILL}},
13437
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_sid,
13438
14
        { "SRv6 SID", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_sid", FT_IPv6,
13439
14
          BASE_NONE, NULL, 0x0, "16-octet IPv6 address", HFILL}},
13440
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior,
13441
14
        { "SRv6 Endpoint Behavior and SID Structure", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_endpoint_behavior", FT_NONE,
13442
14
          BASE_NONE, NULL, 0x0, "RFC 8986 SRv6 Endpoint Behavior and SID Structure", HFILL}},
13443
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_code,
13444
14
        { "Endpoint Behavior", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_endpoint_behavior.code", FT_UINT16,
13445
14
          BASE_DEC_HEX, VALS(srv6_endpoint_behavior), 0x0, "SRv6 Endpoint Behavior code point (0xFFFF = Opaque)", HFILL}},
13446
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_reserved,
13447
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_endpoint_behavior.reserved", FT_UINT16,
13448
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13449
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_lb_length,
13450
14
        { "Locator Block Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_lb_length", FT_UINT8,
13451
14
          BASE_DEC, NULL, 0x0, "SRv6 SID Locator Block length in bits", HFILL}},
13452
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_ln_length,
13453
14
        { "Locator Node Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_ln_length", FT_UINT8,
13454
14
          BASE_DEC, NULL, 0x0, "SRv6 SID Locator Node length in bits", HFILL}},
13455
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_func_length,
13456
14
        { "Function Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_func_length", FT_UINT8,
13457
14
          BASE_DEC, NULL, 0x0, "SRv6 SID Function length in bits", HFILL}},
13458
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_arg_length,
13459
14
        { "Argument Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_arg_length", FT_UINT8,
13460
14
          BASE_DEC, NULL, 0x0, "SRv6 SID Arguments length in bits", HFILL}},
13461
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight_flags,
13462
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.weight.flags", FT_UINT8,
13463
14
          BASE_HEX, NULL, 0x0, "Weight sub-TLV flags (reserved)", HFILL}},
13464
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight,
13465
14
        { "Weight", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.weight", FT_UINT32,
13466
14
          BASE_DEC, NULL, 0x0, "Weight value (0 is invalid)", HFILL}},
13467
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
13468
14
        { "Data", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.data", FT_BYTES,
13469
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13470
14
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_reserved,
13471
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.policy_cp_name.reserved", FT_UINT8,
13472
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13473
14
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_name,
13474
14
        { "Candidate path name", "bgp.update.encaps_tunnel_tlv_subtlv.policy_cp_name.name", FT_STRING,
13475
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13476
14
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved,
13477
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.reserved", FT_UINT8,
13478
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13479
14
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_name,
13480
14
        { "Policy name", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.name", FT_STRING,
13481
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13482
13483
      /* BGP update path attribute SSA SAFI (deprecated IETF draft) */
13484
14
      { &hf_bgp_ssa_t,
13485
14
        { "Transitive bit", "bgp.ssa_t", FT_BOOLEAN, 8,
13486
14
          NULL, 0x80, "SSA Transitive bit", HFILL}},
13487
14
      { &hf_bgp_ssa_type,
13488
14
        { "SSA Type", "bgp.ssa_type", FT_UINT16, BASE_DEC,
13489
14
          VALS(bgp_ssa_type), 0x7FFF, NULL, HFILL}},
13490
14
      { &hf_bgp_ssa_len,
13491
14
        { "Length", "bgp.ssa_len", FT_UINT16, BASE_DEC,
13492
14
          NULL, 0x0, "SSA Length", HFILL}},
13493
14
      { &hf_bgp_ssa_value,
13494
14
        { "Value", "bgp.ssa_value", FT_BYTES, BASE_NONE,
13495
14
          NULL, 0x0, "SSA Value", HFILL}},
13496
14
      { &hf_bgp_ssa_l2tpv3_pref,
13497
14
        { "Preference", "bgp.ssa_l2tpv3_pref", FT_UINT16, BASE_DEC,
13498
14
          NULL, 0x0, NULL, HFILL}},
13499
14
      { &hf_bgp_ssa_l2tpv3_s,
13500
14
        { "Sequencing bit", "bgp.ssa_l2tpv3_s", FT_BOOLEAN, 8,
13501
14
          NULL, 0x80, "Sequencing S-bit", HFILL}},
13502
14
      { &hf_bgp_ssa_l2tpv3_unused,
13503
14
        { "Unused", "bgp.ssa_l2tpv3_Unused", FT_BOOLEAN, 8,
13504
14
          NULL, 0x7F, "Unused Flags", HFILL}},
13505
14
      { &hf_bgp_ssa_l2tpv3_cookie_len,
13506
14
        { "Cookie Length", "bgp.ssa_l2tpv3_cookie_len", FT_UINT8, BASE_DEC,
13507
14
          NULL, 0x0, NULL, HFILL}},
13508
14
      { &hf_bgp_ssa_l2tpv3_session_id,
13509
14
        { "Session ID", "bgp.ssa_l2tpv3_session_id", FT_UINT32, BASE_DEC,
13510
14
          NULL, 0x0, NULL, HFILL}},
13511
14
      { &hf_bgp_ssa_l2tpv3_cookie,
13512
14
        { "Cookie", "bgp.ssa_l2tpv3_cookie", FT_BYTES, BASE_NONE,
13513
14
          NULL, 0x0, NULL, HFILL}},
13514
14
      { &hf_bgp_withdrawn_prefix,
13515
14
        { "Withdrawn prefix", "bgp.withdrawn_prefix", FT_IPv4, BASE_NONE,
13516
14
          NULL, 0x0, NULL, HFILL}},
13517
13518
      /* NLRI header description */
13519
14
      { &hf_bgp_update_nlri,
13520
14
        { "Network Layer Reachability Information (NLRI)", "bgp.update.nlri", FT_NONE, BASE_NONE,
13521
14
          NULL, 0x0, NULL, HFILL}},
13522
      /* Global NLRI description */
13523
14
      { &hf_bgp_mp_reach_nlri_ipv4_prefix,
13524
14
        { "MP Reach NLRI IPv4 prefix", "bgp.mp_reach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
13525
14
          NULL, 0x0, NULL, HFILL}},
13526
14
      { &hf_bgp_mp_unreach_nlri_ipv4_prefix,
13527
14
        { "MP Unreach NLRI IPv4 prefix", "bgp.mp_unreach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
13528
14
          NULL, 0x0, NULL, HFILL}},
13529
14
      { &hf_bgp_mp_reach_nlri_ipv6_prefix,
13530
14
        { "MP Reach NLRI IPv6 prefix", "bgp.mp_reach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
13531
14
          NULL, 0x0, NULL, HFILL}},
13532
14
      { &hf_bgp_mp_unreach_nlri_ipv6_prefix,
13533
14
        { "MP Unreach NLRI IPv6 prefix", "bgp.mp_unreach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
13534
14
          NULL, 0x0, NULL, HFILL}},
13535
14
      { &hf_bgp_mp_nlri_tnl_id,
13536
14
        { "MP Reach NLRI Tunnel Identifier", "bgp.mp_nlri_tnl_id", FT_UINT16, BASE_HEX,
13537
14
          NULL, 0x0, NULL, HFILL}},
13538
14
      { &hf_bgp_nlri_prefix,
13539
14
        { "NLRI prefix", "bgp.nlri_prefix", FT_IPv4, BASE_NONE,
13540
14
          NULL, 0x0, NULL, HFILL}},
13541
14
      { &hf_bgp_nlri_path_id,
13542
14
        { "NLRI path id", "bgp.nlri_path_id", FT_UINT32, BASE_DEC,
13543
14
          NULL, 0x0, NULL, HFILL}},
13544
13545
      /* mcast vpn nlri and capability */
13546
14
      { &hf_bgp_mcast_vpn_nlri_t,
13547
14
        { "MCAST-VPN nlri", "bgp.mcast_vpn_nlri", FT_BYTES, BASE_NONE,
13548
14
          NULL, 0x0, NULL, HFILL}},
13549
14
      { &hf_bgp_mcast_vpn_nlri_route_type,
13550
14
        { "Route Type", "bgp.mcast_vpn_nlri_route_type", FT_UINT8,
13551
14
          BASE_DEC, VALS(mcast_vpn_route_type), 0x0, NULL, HFILL}},
13552
14
      { &hf_bgp_mcast_vpn_nlri_length,
13553
14
        { "Length", "bgp.mcast_vpn_nlri_length", FT_UINT8,
13554
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13555
14
      { &hf_bgp_mcast_vpn_nlri_rd,
13556
14
        { "Route Distinguisher", "bgp.mcast_vpn_nlri_rd", FT_BYTES,
13557
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13558
14
      { &hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
13559
14
        { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv4", FT_IPv4,
13560
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13561
14
      { &hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
13562
14
        { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv6", FT_IPv6,
13563
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13564
14
      { &hf_bgp_mcast_vpn_nlri_source_as,
13565
14
        { "Source AS", "bgp.mcast_vpn_nlri_source_as", FT_UINT32,
13566
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13567
14
       { &hf_bgp_mcast_vpn_nlri_source_length,
13568
14
        { "Multicast Source Length", "bgp.mcast_vpn_nlri_source_length", FT_UINT8,
13569
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13570
14
       { &hf_bgp_mcast_vpn_nlri_group_length,
13571
14
        { "Multicast Group Length", "bgp.mcast_vpn_nlri_group_length", FT_UINT8,
13572
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13573
14
      { &hf_bgp_mcast_vpn_nlri_source_addr_ipv4,
13574
14
        { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv4", FT_IPv4,
13575
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13576
14
      { &hf_bgp_mcast_vpn_nlri_source_addr_ipv6,
13577
14
        { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv6", FT_IPv6,
13578
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13579
14
      { &hf_bgp_mcast_vpn_nlri_group_addr_ipv4,
13580
14
        { "Multicast Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv4", FT_IPv4,
13581
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13582
14
      { &hf_bgp_mcast_vpn_nlri_group_addr_ipv6,
13583
14
        { "Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv6", FT_IPv6,
13584
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13585
14
      { &hf_bgp_mcast_vpn_nlri_route_key,
13586
14
        { "Route Key", "bgp.mcast_vpn_nlri_route_key", FT_BYTES,
13587
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13588
      /* sr policy nlri*/
13589
14
      { &hf_bgp_sr_policy_nlri_length,
13590
14
        { "NLRI length", "bgp.sr_policy_nlri_length", FT_UINT8,
13591
14
          BASE_DEC, NULL, 0x0, "NLRI length in bits", HFILL}},
13592
14
      { &hf_bgp_sr_policy_nlri_distinguisher,
13593
14
        { "Distinguisher", "bgp.sr_policy_nlri_distinguisher", FT_UINT32,
13594
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13595
14
      { &hf_bgp_sr_policy_nlri_policy_color,
13596
14
        { "Policy color", "bgp.sr_policy_nlri_policy_color", FT_UINT32,
13597
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13598
14
      { &hf_bgp_sr_policy_nlri_endpoint_v4,
13599
14
        { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv4", FT_IPv4,
13600
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13601
14
      { &hf_bgp_sr_policy_nlri_endpoint_v6,
13602
14
        { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv6", FT_IPv6,
13603
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13604
        /* Bgp flow spec nlri and capability */
13605
14
      { &hf_bgp_flowspec_nlri_t,
13606
14
        { "FLOW-SPEC nlri", "bgp.flowspec_nlri", FT_BYTES, BASE_NONE,
13607
14
          NULL, 0x0, NULL, HFILL}},
13608
14
      { &hf_bgp_flowspec_nlri_route_distinguisher,
13609
14
        { "Route Distinguisher", "bgp.flowspec_route_distinguisher", FT_NONE,
13610
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13611
14
      { &hf_bgp_flowspec_nlri_route_distinguisher_type,
13612
14
        { "Route Distinguisher Type", "bgp.flowspec_route_distinguisher_type", FT_UINT16,
13613
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13614
14
      { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
13615
14
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_2", FT_UINT16,
13616
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13617
14
      { &hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
13618
14
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_ipv4", FT_IPv4,
13619
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13620
14
      { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
13621
14
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_4", FT_UINT32,
13622
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13623
14
      { &hf_bgp_flowspec_nlri_route_dist_asnum_2,
13624
14
        { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_2", FT_UINT16,
13625
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13626
14
      { &hf_bgp_flowspec_nlri_route_dist_asnum_4,
13627
14
        { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_4", FT_UINT32,
13628
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13629
14
      { &hf_bgp_flowspec_nlri_filter,
13630
14
        { "Filter", "bgp.flowspec_nlri.filter", FT_NONE, BASE_NONE,
13631
14
          NULL, 0x0, NULL, HFILL }},
13632
14
      { &hf_bgp_flowspec_nlri_filter_type,
13633
14
        { "Filter type", "bgp.flowspec_nlri.filter_type", FT_UINT8, BASE_DEC,
13634
14
          VALS(flowspec_nlri_opvaluepair_type), 0x0, NULL, HFILL }},
13635
14
      { &hf_bgp_flowspec_nlri_length,
13636
14
        { "NRLI length", "bgp.flowspec_nlri.length", FT_UINT16, BASE_DEC,
13637
14
          NULL, 0x0, NULL, HFILL }},
13638
14
      { &hf_bgp_flowspec_nlri_op_flags,
13639
14
        { "Operator flags", "bgp.flowspec_nlri.opflags", FT_UINT8, BASE_HEX,
13640
14
          NULL, 0x0, NULL, HFILL }},
13641
14
      { &hf_bgp_flowspec_nlri_dst_pref_ipv4,
13642
14
        { "Destination IP filter", "bgp.flowspec_nlri.dst_prefix_filter", FT_IPv4,
13643
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13644
14
      { &hf_bgp_flowspec_nlri_src_pref_ipv4,
13645
14
        { "Source IP filter", "bgp.flowspec_nlri.src_prefix_filter", FT_IPv4,
13646
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13647
14
      { &hf_bgp_flowspec_nlri_op_eol,
13648
14
        { "end-of-list", "bgp.flowspec_nlri.op.eol", FT_BOOLEAN, 8,
13649
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_END_OF_LST, NULL, HFILL }},
13650
14
      { &hf_bgp_flowspec_nlri_op_and,
13651
14
        { "and", "bgp.flowspec_nlri.op.and", FT_BOOLEAN, 8,
13652
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_AND_BIT, NULL, HFILL }},
13653
14
      { &hf_bgp_flowspec_nlri_op_val_len,
13654
14
        { "Value length", "bgp.flowspec_nlri.op.val_len", FT_UINT8, BASE_DEC,
13655
14
          VALS(flow_spec_op_len_val), BGPNLRI_FSPEC_VAL_LEN, NULL, HFILL }},
13656
14
      { &hf_bgp_flowspec_nlri_op_un_bit4,
13657
14
        { "Reserved", "bgp.flowspec_nlri.op.un_bit4", FT_BOOLEAN, 8,
13658
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT4, "Unused (must be zero)",HFILL}},
13659
14
      { &hf_bgp_flowspec_nlri_op_un_bit5,
13660
14
        { "Reserved", "bgp.flowspec_nlri.op.un_bit5", FT_BOOLEAN, 8,
13661
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT5, "Unused (must be zero)", HFILL}},
13662
14
      { &hf_bgp_flowspec_nlri_dec_val_8,
13663
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_8", FT_UINT8, BASE_DEC,
13664
14
          NULL, 0x0, NULL, HFILL }},
13665
14
      { &hf_bgp_flowspec_nlri_dec_val_16,
13666
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_16", FT_UINT16, BASE_DEC,
13667
14
          NULL, 0x0, NULL, HFILL }},
13668
14
      { &hf_bgp_flowspec_nlri_dec_val_32,
13669
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_32", FT_UINT32, BASE_DEC,
13670
14
          NULL, 0x0, NULL, HFILL }},
13671
14
      { &hf_bgp_flowspec_nlri_dec_val_64,
13672
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_64", FT_UINT64, BASE_DEC,
13673
14
          NULL, 0x0, NULL, HFILL }},
13674
14
      { &hf_bgp_flowspec_nlri_op_lt,
13675
14
        { "less than", "bgp.flowspec_nlri.op.lt", FT_BOOLEAN, 8,
13676
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_LESS_THAN, NULL, HFILL }},
13677
14
      { &hf_bgp_flowspec_nlri_op_gt,
13678
14
        { "greater than", "bgp.flowspec_nlri.op.gt", FT_BOOLEAN, 8,
13679
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_GREATER_THAN, NULL, HFILL }},
13680
14
      { &hf_bgp_flowspec_nlri_op_eq,
13681
14
        { "equal", "bgp.flowspec_nlri.op.equal", FT_BOOLEAN, 8,
13682
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_EQUAL, NULL, HFILL }},
13683
14
      { &hf_bgp_flowspec_nlri_op_flg_not,
13684
14
        { "logical negation", "bgp.flowspec_nlri.op.flg_not", FT_BOOLEAN, 8,
13685
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_NOTBIT, NULL, HFILL }},
13686
14
      { &hf_bgp_flowspec_nlri_op_flg_match,
13687
14
        { "Match bit", "bgp.flowspec_nlri.op.flg_match", FT_BOOLEAN, 8,
13688
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_MATCHBIT, NULL, HFILL }},
13689
14
      { &hf_bgp_flowspec_nlri_tcp_flags,
13690
14
        { "TCP flags", "bgp.flowspec_nlri.val_tcp.flags", FT_UINT8, BASE_HEX,
13691
14
          NULL, 0x0, NULL, HFILL }},
13692
14
      { &hf_bgp_flowspec_nlri_tcp_flags_cwr,
13693
14
        { "Congestion Window Reduced (CWR)", "bgp.flowspec_nlri.val_tcp.flags.cwr", FT_BOOLEAN, 8,
13694
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_CWR, NULL, HFILL }},
13695
14
      { &hf_bgp_flowspec_nlri_tcp_flags_ecn,
13696
14
        { "ECN-Echo", "bgp.flowspec_nlri.val_tcp.flags.ecn", FT_BOOLEAN, 8,
13697
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ECN, NULL, HFILL }},
13698
14
      { &hf_bgp_flowspec_nlri_tcp_flags_urg,
13699
14
        { "Urgent",  "bgp.flowspec_nlri.val_tcp.flags.urg", FT_BOOLEAN, 8,
13700
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_URG, NULL, HFILL }},
13701
14
      { &hf_bgp_flowspec_nlri_tcp_flags_ack,
13702
14
        { "Acknowledgment", "bgp.flowspec_nlri.val_tcp.flags.ack", FT_BOOLEAN, 8,
13703
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ACK, NULL, HFILL }},
13704
14
      { &hf_bgp_flowspec_nlri_tcp_flags_push,
13705
14
        { "Push", "bgp.flowspec_nlri.val_tcp.flags.push", FT_BOOLEAN, 8,
13706
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_PUSH, NULL, HFILL }},
13707
14
      { &hf_bgp_flowspec_nlri_tcp_flags_reset,
13708
14
        { "Reset", "bgp.flowspec_nlri.val_tcp.flags.reset", FT_BOOLEAN, 8,
13709
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_RST, NULL, HFILL }},
13710
14
      { &hf_bgp_flowspec_nlri_tcp_flags_syn,
13711
14
        { "Syn", "bgp.flowspec_nlri.val_tcp.flags.syn", FT_BOOLEAN, 8,
13712
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_SYN, NULL, HFILL }},
13713
14
      { &hf_bgp_flowspec_nlri_tcp_flags_fin,
13714
14
        { "Fin", "bgp.flowspec_nlri.val_tcp.flags.fin", FT_BOOLEAN, 8,
13715
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_FIN, NULL, HFILL }},
13716
14
      { &hf_bgp_flowspec_nlri_fflag,
13717
14
        { "Fragment Flag", "bgp.flowspec_nlri.val_frag", FT_UINT8, BASE_HEX,
13718
14
          NULL, 0x0, NULL, HFILL }},
13719
14
      { &hf_bgp_flowspec_nlri_fflag_lf,
13720
14
        { "Last fragment", "bgp.flowspec_nlri.val_frag_lf", FT_BOOLEAN, 8,
13721
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_LF, NULL, HFILL }},
13722
14
      { &hf_bgp_flowspec_nlri_fflag_ff,
13723
14
        { "First fragment", "bgp.flowspec_nlri.val_frag_ff", FT_BOOLEAN, 8,
13724
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_FF, NULL, HFILL }},
13725
14
      { &hf_bgp_flowspec_nlri_fflag_isf,
13726
14
        { "Is a fragment", "bgp.flowspec_nlri.val_frag_isf", FT_BOOLEAN, 8,
13727
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_ISF, NULL, HFILL }},
13728
14
      { &hf_bgp_flowspec_nlri_fflag_df,
13729
14
        { "Don't fragment", "bgp.flowspec_nlri.val_frag_df", FT_BOOLEAN, 8,
13730
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_DF, NULL, HFILL }},
13731
14
      { &hf_bgp_flowspec_nlri_dscp,
13732
14
        { "Differentiated Services Codepoint", "bgp.flowspec_nlri.val_dsfield", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
13733
14
          &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
13734
14
      { &hf_bgp_flowspec_nlri_src_ipv6_pref,
13735
14
        { "Source IPv6 prefix", "bgp.flowspec_nlri.src_ipv6_pref", FT_IPv6, BASE_NONE,
13736
14
          NULL, 0x0, NULL, HFILL}},
13737
14
      { &hf_bgp_flowspec_nlri_dst_ipv6_pref,
13738
14
        { "Destination IPv6 prefix", "bgp.flowspec_nlri.dst_ipv6_pref", FT_IPv6, BASE_NONE,
13739
14
          NULL, 0x0, NULL, HFILL}},
13740
14
      { &hf_bgp_flowspec_nlri_ipv6_pref_len,
13741
14
        { "IPv6 prefix length", "bgp.flowspec_nlri.ipv6_pref_length", FT_UINT8, BASE_DEC,
13742
14
          NULL, 0x0, NULL, HFILL}},
13743
14
      { &hf_bgp_flowspec_nlri_ipv6_pref_offset,
13744
14
        { "IPv6 prefix offset", "bgp.flowspec_nlri.ipv6_pref_offset", FT_UINT8, BASE_DEC,
13745
14
          NULL, 0x0, NULL, HFILL}},
13746
        /* end of bgp flow spec */
13747
        /* BGP update safi ndt nlri  draft-nalawade-idr-mdt-safi-03 */
13748
14
      { &hf_bgp_mdt_nlri_safi_rd,
13749
14
        { "Route Distinguisher", "bgp.mdt_safi_rd", FT_BYTES,
13750
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13751
14
      { &hf_bgp_mdt_nlri_safi_ipv4_addr,
13752
14
        { "IPv4 Address", "bgp.mdt_safi_ipv4_addr", FT_IPv4,
13753
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13754
14
      { &hf_bgp_mdt_nlri_safi_group_addr,
13755
14
        { "Group Address", "bgp.mdt_safi_group_addr", FT_IPv4,
13756
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13757
        /* BGP update extended community header field */
13758
14
      { &hf_bgp_ext_communities,
13759
14
        { "Carried extended communities", "bgp.ext_communities", FT_NONE, BASE_NONE,
13760
14
          NULL, 0x0, NULL, HFILL }},
13761
14
      { &hf_bgp_ext_community,
13762
14
        { "Community", "bgp.ext_community", FT_NONE, BASE_NONE,
13763
14
          NULL, 0x0, "Extended Community attribute", HFILL }},
13764
14
      { &hf_bgp_ext_com_type_high,
13765
14
        { "Type", "bgp.ext_com.type", FT_UINT8, BASE_HEX,
13766
14
          VALS(bgpext_com_type_high), 0x0, "Extended Community type", HFILL }},
13767
14
      { &hf_bgp_ext_com_type_auth,
13768
14
        { "IANA Authority", "bgp.ext_com.type.auth", FT_BOOLEAN, 8,
13769
14
          TFS(&tfs_bgpext_com_type_auth), BGP_EXT_COM_TYPE_AUTH, "IANA Type Allocation Policy", HFILL }},
13770
14
      {&hf_bgp_ext_com_type_tran,
13771
14
        { "Transitive across ASes", "bgp.ext_com.type.tran", FT_BOOLEAN, 8,
13772
14
          TFS(&tfs_non_transitive_transitive), BGP_EXT_COM_TYPE_TRAN, "Transitivity of the attribute across autonomous systems", HFILL }},
13773
14
      { &hf_bgp_ext_com_stype_low_unknown,
13774
14
        { "Subtype", "bgp.ext_com.stype_unknown", FT_UINT8, BASE_HEX,
13775
14
          NULL, 0x0, "Extended Community subtype", HFILL }},
13776
14
      { &hf_bgp_ext_com_stype_tr_evpn,
13777
14
        { "Subtype (EVPN)", "bgp.ext_com.stype_tr_evpn", FT_UINT8, BASE_HEX,
13778
14
          VALS(bgpext_com_stype_tr_evpn), 0x0, "EVPN Extended Community subtype", HFILL}},
13779
14
      { &hf_bgp_ext_com_stype_tr_as2,
13780
14
        { "Subtype (AS2)", "bgp.ext_com.stype_tr_as2", FT_UINT8, BASE_HEX,
13781
14
          VALS(bgpext_com_stype_tr_as2), 0x0, "2-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
13782
14
      { &hf_bgp_ext_com_stype_ntr_as2,
13783
14
        { "Subtype (Non-transitive AS2)", "bgp.ext_com.stype_ntr_as2", FT_UINT8, BASE_HEX,
13784
14
          VALS(bgpext_com_stype_ntr_as2), 0x0, "2-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
13785
14
      { &hf_bgp_ext_com_stype_tr_as4,
13786
14
        { "Subtype (AS4)", "bgp.ext_com.stype_tr_as4", FT_UINT8, BASE_HEX,
13787
14
          VALS(bgpext_com_stype_tr_as4), 0x0, "4-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
13788
14
      { &hf_bgp_ext_com_stype_ntr_as4,
13789
14
        { "Subtype (Non-transitive AS4)", "bgp.ext_com.stype_ntr_as4", FT_UINT8, BASE_HEX,
13790
14
          VALS(bgpext_com_stype_ntr_as4), 0x0, "4-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
13791
14
      { &hf_bgp_ext_com_stype_tr_IP4,
13792
14
        { "Subtype (IPv4)", "bgp.ext_com.stype_tr_IP4", FT_UINT8, BASE_HEX,
13793
14
          VALS(bgpext_com_stype_tr_IP4), 0x0, "IPv4-Address-Specific Transitive Extended Community subtype", HFILL}},
13794
14
      { &hf_bgp_ext_com_stype_ntr_IP4,
13795
14
        { "Subtype (Non-transitive IPv4)", "bgp.ext_com.stype_ntr_IP4", FT_UINT8, BASE_HEX,
13796
14
          VALS(bgpext_com_stype_ntr_IP4), 0x0, "IPv4-Address-Specific Non-transitive Extended Community subtype", HFILL}},
13797
14
      { &hf_bgp_ext_com_stype_tr_opaque,
13798
14
        { "Subtype (Opaque)", "bgp.ext_com.stype_tr_opaque", FT_UINT8, BASE_HEX,
13799
14
          VALS(bgpext_com_stype_tr_opaque), 0x0, "Opaque Transitive Extended Community subtype", HFILL}},
13800
14
      { &hf_bgp_ext_com_stype_ntr_opaque,
13801
14
        { "Subtype (Non-transitive Opaque)", "bgp.ext_com.stype_ntr_opaque", FT_UINT8, BASE_HEX,
13802
14
          VALS(bgpext_com_stype_ntr_opaque), 0x0, "Opaque Non-transitive Extended Community subtype", HFILL}},
13803
14
      { &hf_bgp_ext_com_tunnel_type,
13804
14
        { "Tunnel type", "bgp.ext_com.tunnel_type", FT_UINT16, BASE_DEC,
13805
14
          VALS(bgpext_com_tunnel_type), 0x0, "Tunnel encapsulation type", HFILL}},
13806
14
      { &hf_bgp_ext_com_stype_tr_mup,
13807
14
        { "Subtype (MUP)", "bgp.ext_com.stype_tr_mup", FT_UINT8, BASE_HEX,
13808
14
          VALS(bgpext_com_stype_tr_mup), 0x0, "MUP Extended Community subtype", HFILL}},
13809
14
      { &hf_bgp_ext_com_stype_tr_exp,
13810
14
        { "Subtype (Experimental)", "bgp.ext_com.stype_tr_exp", FT_UINT8, BASE_HEX,
13811
14
          VALS(bgpext_com_stype_tr_exp), 0x0, "Experimental Transitive Extended Community subtype", HFILL}},
13812
14
      { &hf_bgp_ext_com_stype_tr_exp_2,
13813
14
        { "Subtype (Experimental Part 2)", "bgp.ext_com.stype_tr_exp_2", FT_UINT8, BASE_HEX,
13814
14
          VALS(bgpext_com_stype_tr_exp_2), 0x0, "Generic Transitive Experimental Use Extended Community Part 2 Sub-Types", HFILL}},
13815
14
      { &hf_bgp_ext_com_stype_tr_exp_3,
13816
14
        { "Subtype (Experimental Part 3)", "bgp.ext_com.stype_tr_exp_3", FT_UINT8, BASE_HEX,
13817
14
          VALS(bgpext_com_stype_tr_exp_3), 0x0, "Generic Transitive Experimental Use Extended Community Part 3 Sub-Types", HFILL}},
13818
14
      { &hf_bgp_ext_com_value_as2,
13819
14
        { "2-Octet AS", "bgp.ext_com.value_as2", FT_UINT16, BASE_DEC,
13820
14
          NULL, 0x0, "Global Administrator Field value (2B Autonomous System Number)", HFILL }},
13821
14
      { &hf_bgp_ext_com_value_as4,
13822
14
        { "4-Octet AS", "bgp.ext_com.value_as4", FT_UINT32, BASE_DEC,
13823
14
          NULL, 0x0, "Global Administrator Field value (4B Autonomous System Number)", HFILL }},
13824
14
      { &hf_bgp_ext_com_value_IP4,
13825
14
        { "IPv4 address", "bgp.ext_com.value_IP4", FT_IPv4, BASE_NONE,
13826
14
          NULL, 0x0, "Global Administrator Field value (IPv4 Address)", HFILL }},
13827
14
      { &hf_bgp_ext_com_value_an2,
13828
14
        { "2-Octet AN", "bgp.ext_com.value_an2", FT_UINT16, BASE_DEC,
13829
14
          NULL, 0x0, "Local Administrator Field value (2B Assigned Number)", HFILL }},
13830
14
      { &hf_bgp_ext_com_value_an4,
13831
14
        { "4-Octet AN", "bgp.ext_com.value_an4", FT_UINT32, BASE_DEC,
13832
14
          NULL, 0x0, "Local Administrator Field value (4B Assigned Number)", HFILL }},
13833
14
      { &hf_bgp_ext_com_value_link_bw,
13834
14
        { "Link bandwidth", "bgp.ext_com.value_link_bw", FT_FLOAT, BASE_NONE,
13835
14
          NULL, 0x0, NULL, HFILL}},
13836
14
      { &hf_bgp_ext_com_value_ospf_rt_area,
13837
14
        { "Area ID", "bgp.ext_com.value_ospf_rtype.area", FT_IPv4, BASE_NONE,
13838
14
          NULL, 0x0, "Original OSPF Area ID this route comes from", HFILL }},
13839
14
      { &hf_bgp_ext_com_value_ospf_rt_type,
13840
14
        { "Route type", "bgp.ext_com.value_ospf_rtype.type", FT_UINT8, BASE_DEC,
13841
14
          VALS(bgpext_com_ospf_rtype), 0x0, "Original OSPF LSA Type that carried this route", HFILL}},
13842
14
      { &hf_bgp_ext_com_value_ospf_rt_options,
13843
14
        { "Options", "bgp.ext_com.value_ospf_rtype.options", FT_UINT8, BASE_HEX,
13844
14
          NULL, 0x0, "OSPF Route Type Options bitfield", HFILL }},
13845
14
      { &hf_bgp_ext_com_value_ospf_rt_options_mt,
13846
14
        { "Metric type", "bgp.ext_com.value_ospf_rtype.options.mt", FT_BOOLEAN, 8,
13847
14
          TFS(&tfs_ospf_rt_mt), BGP_OSPF_RTYPE_METRIC_TYPE, "OSPF metric type (Type-1 or Type-2) of the original route", HFILL }},
13848
14
      { &hf_bgp_ext_com_value_ospf_rid,
13849
14
        { "Router ID", "bgp.ext_com.value_ospf_rid", FT_IPv4, BASE_NONE,
13850
14
          NULL, 0x0, "OSPF Router ID of the redistributing PE router", HFILL }},
13851
14
      { &hf_bgp_ext_com_value_fs_remark,
13852
14
        { "Remarking value", "bgp.ext_com.value_fs_dscp", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
13853
14
          &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
13854
14
      { &hf_bgp_ext_com_local_admin_flags,
13855
14
        { "Local Administrator", "bgp.ext_com.local_admin", FT_UINT8, BASE_HEX,
13856
14
          NULL, 0x0, NULL, HFILL }},
13857
14
      { &hf_bgp_ext_com_local_admin_auto_derived_flag,
13858
14
        { "A-Bit", "bgp.ext_com.local_admin.auto_derived", FT_BOOLEAN, 8,
13859
14
          TFS(&tfs_manually_auto_derived), 0x80, NULL, HFILL }},
13860
14
      { &hf_bgp_ext_com_local_admin_type,
13861
14
        { "Type", "bgp.ext_com.local_admin.type", FT_UINT8, BASE_DEC,
13862
14
          VALS(bgp_ext_com_local_admin_types), 0x70, NULL, HFILL }},
13863
14
      { &hf_bgp_ext_com_local_admin_domain_id,
13864
14
        { "Domain Id", "bgp.ext_com.local_admin.domain_id", FT_UINT8, BASE_DEC,
13865
14
          NULL, 0x0F, NULL, HFILL }},
13866
14
      { &hf_bgp_ext_com_local_admin_service_id,
13867
14
        { "Service Id", "bgp.ext_com.local_admin.service_id", FT_UINT24, BASE_DEC,
13868
14
          NULL, 0x00, NULL, HFILL }},
13869
14
      { &hf_bgp_ext_com_value_raw,
13870
14
        { "Raw Value", "bgp.ext_com.value_raw", FT_UINT48, BASE_HEX,
13871
14
          NULL, 0x0, "Raw value of the lowmost 6 octets of the Extended Community attribute", HFILL }},
13872
            /* BGP update extended community flow spec RFC 5575 */
13873
14
      { &hf_bgp_ext_com_flow_act_samp_act,
13874
14
        { "Sample", "bgp.ext_com_flow.sample", FT_BOOLEAN, 8,
13875
14
          TFS(&tfs_set_notset), BGP_EXT_COM_FSPEC_ACT_S, NULL, HFILL }},
13876
14
      { &hf_bgp_ext_com_flow_act_term_act,
13877
14
        { "Terminal action", "bgp.ext_com_flow.traff_act", FT_BOOLEAN, 8,
13878
14
          TFS(&tfs_set_notset),BGP_EXT_COM_FSPEC_ACT_T,NULL, HFILL}},
13879
14
      { &hf_bgp_ext_com_flow_rate_float,
13880
14
        { "Rate shaper", "bgp.ext_com_flow.rate_limit", FT_FLOAT, BASE_NONE,
13881
14
          NULL, 0x0, NULL, HFILL}},
13882
14
      { &hf_bgp_ext_com_flow_act_allset,
13883
14
        { "5 Bytes", "bgp.flowspec_ext_com.emptybytes", FT_BYTES, BASE_NONE,
13884
14
          NULL, 0x0, "Must be set to all 0", HFILL }},
13885
            /* BGP QoS propagation draft-knoll-idr-qos-attribute */
13886
14
      { &hf_bgp_ext_com_qos_flags,
13887
14
        { "Flags", "bgp.ext_com_qos.flags", FT_UINT8, BASE_HEX,
13888
14
          NULL, 0, NULL, HFILL}},
13889
14
      { &hf_bgp_ext_com_qos_flags_remarking,
13890
14
        { "Remarking", "bgp.ext_com_qos.flags.remarking", FT_BOOLEAN, 8,
13891
14
          TFS(&tfs_yes_no), 0x10, NULL, HFILL}},
13892
14
      { &hf_bgp_ext_com_qos_flags_ignore_remarking,
13893
14
        { "Ignore remarking", "bgp.ext_com_qos.flags.ignore_remarking", FT_BOOLEAN, 8,
13894
14
          TFS(&tfs_yes_no), 0x08, NULL, HFILL}},
13895
14
      { &hf_bgp_ext_com_qos_flags_agg_marking,
13896
14
        { "Aggregation of markings", "bgp.ext_com_qos.flags.agg_marking", FT_BOOLEAN, 8,
13897
14
          TFS(&tfs_yes_no), 0x04, NULL, HFILL}},
13898
14
      { &hf_bgp_ext_com_cos_flags,
13899
14
        { "Flags byte", "bgp.ext_com_cos.flags", FT_UINT8, BASE_HEX,
13900
14
          NULL, 0, NULL, HFILL}},
13901
14
      { &hf_bgp_ext_com_cos_flags_be,
13902
14
        { "BE class", "bgp.ext_com_cos.flags.be", FT_BOOLEAN, 8,
13903
14
          TFS(&tfs_supported_not_supported), 0x80, NULL, HFILL}},
13904
14
      { &hf_bgp_ext_com_cos_flags_ef,
13905
14
        { "EF class", "bgp.ext_com_cos.flags.ef", FT_BOOLEAN, 8,
13906
14
          TFS(&tfs_supported_not_supported), 0x40, NULL, HFILL}},
13907
14
      { &hf_bgp_ext_com_cos_flags_af,
13908
14
        { "AF class", "bgp.ext_com_cos.flags.af", FT_BOOLEAN, 8,
13909
14
          TFS(&tfs_supported_not_supported), 0x20, NULL, HFILL}},
13910
14
      { &hf_bgp_ext_com_cos_flags_le,
13911
14
        { "LE class", "bgp.ext_com_cos.flags.le", FT_BOOLEAN, 8,
13912
14
          TFS(&tfs_supported_not_supported), 0x10, NULL, HFILL}},
13913
14
      { &hf_bgp_ext_com_qos_set_number,
13914
14
        { "QoS Set Number", "bgp.ext_com_qos.set_number", FT_UINT8, BASE_HEX,
13915
14
          NULL, 0, NULL, HFILL}},
13916
14
      { &hf_bgp_ext_com_qos_tech_type,
13917
14
        { "Technology Type", "bgp.ext_com_qos.tech_type", FT_UINT8, BASE_HEX,
13918
14
          VALS(qos_tech_type), 0, NULL, HFILL}},
13919
14
      { &hf_bgp_ext_com_qos_marking_o,
13920
14
        { "QoS Marking O", "bgp.ext_com_qos.marking_o", FT_UINT16, BASE_HEX,
13921
14
          NULL, 0, NULL, HFILL}},
13922
14
      { &hf_bgp_ext_com_qos_marking_a,
13923
14
        { "QoS Marking A", "bgp.ext_com_qos.marking_a", FT_UINT8, BASE_HEX_DEC,
13924
14
          NULL, 0, NULL, HFILL}},
13925
14
      { &hf_bgp_ext_com_qos_default_to_zero,
13926
14
        { "Defaults to zero", "bgp.ext_com_qos.default_to_zero", FT_UINT8, BASE_HEX,
13927
14
          NULL, 0, NULL, HFILL}},
13928
      /* BGP L2 extended community RFC 4761, RFC 6624 */
13929
            /* draft-ietf-l2vpn-vpls-multihoming */
13930
14
      { &hf_bgp_ext_com_l2_encaps,
13931
14
        { "Encaps Type", "bgp.ext_com_l2.encaps_type", FT_UINT8, BASE_DEC,
13932
14
          VALS(bgp_l2vpn_encaps), 0, NULL, HFILL}},
13933
14
      { &hf_bgp_ext_com_l2_c_flags,
13934
14
        { "Control Flags", "bgp.ext_com_l2.c_flags", FT_UINT8, BASE_HEX,
13935
14
          NULL, 0x0, NULL, HFILL }},
13936
14
      { &hf_bgp_ext_com_l2_flag_d,
13937
14
        { "Down flag", "bgp.ext_com_l2.flag_d",FT_BOOLEAN, 8,
13938
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_D, NULL, HFILL }},
13939
14
      { &hf_bgp_ext_com_l2_flag_z1,
13940
14
        { "Unassigned", "bgp.ext_com_l2.flag_z1",FT_UINT8, BASE_DEC,
13941
14
          NULL, BGP_EXT_COM_L2_FLAG_Z1, "Must be Zero", HFILL }},
13942
14
      { &hf_bgp_ext_com_l2_flag_f,
13943
14
        { "Flush flag", "bgp.ext_com_l2.flag_f",FT_BOOLEAN, 8,
13944
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_F, NULL, HFILL }},
13945
14
      { &hf_bgp_ext_com_l2_flag_z345,
13946
14
        { "Unassigned", "bgp.ext_com_l2.flag_z345",FT_UINT8, BASE_DEC,
13947
14
          NULL, BGP_EXT_COM_L2_FLAG_Z345, "Must be Zero", HFILL }},
13948
14
      { &hf_bgp_ext_com_l2_flag_c,
13949
14
        { "C flag", "bgp.ext_com_l2.flag_c",FT_BOOLEAN, 8,
13950
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_C, NULL, HFILL }},
13951
14
      { &hf_bgp_ext_com_l2_flag_s,
13952
14
        { "S flag", "bgp.ext_com_l2.flag_s",FT_BOOLEAN, 8,
13953
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_S, NULL, HFILL }},
13954
14
      { &hf_bgp_ext_com_l2_mtu,
13955
14
        { "Layer-2 MTU", "bgp.ext_com_l2.l2_mtu", FT_UINT16, BASE_DEC,
13956
14
          NULL, 0x0, NULL, HFILL}},
13957
14
      { &hf_bgp_ext_com_l2_esi_label_flag,
13958
14
        { "Single active bit", "bgp.ext_com_l2.esi_label_flag",FT_BOOLEAN, 8,
13959
14
          TFS(&tfs_esi_label_flag), BGP_EXT_COM_ESI_LABEL_FLAGS, NULL, HFILL }},
13960
14
      { &hf_bgp_ext_com_etree_root_vlan,
13961
14
        { "Root VLAN", "bgp.ext_com_etree.root_vlan", FT_UINT16, BASE_DEC,
13962
14
          NULL, 0x0FFF, NULL, HFILL }},
13963
14
      { &hf_bgp_ext_com_etree_leaf_vlan,
13964
14
        { "Leaf VLAN", "bgp.ext_com_etree.leaf_vlan", FT_UINT16, BASE_DEC,
13965
14
          NULL, 0x0FFF, NULL, HFILL }},
13966
14
      { &hf_bgp_ext_com_etree_flags,
13967
14
        { "Flags", "bgp.ext_com_etree.flags", FT_UINT16, BASE_HEX,
13968
14
          NULL, 0x0, NULL, HFILL }},
13969
14
      { &hf_bgp_ext_com_etree_flag_reserved,
13970
14
        { "Reserved", "bgp.ext_com_etree.flag_reserved",FT_UINT16, BASE_HEX,
13971
14
          NULL, BGP_EXT_COM_ETREE_FLAG_RESERVED, NULL, HFILL }},
13972
14
      { &hf_bgp_ext_com_etree_flag_p,
13973
14
        { "P", "bgp.ext_com_etree.flag_p",FT_BOOLEAN, 16,
13974
14
          TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_P, "PE is attached with leaf nodes only", HFILL }},
13975
14
      { &hf_bgp_ext_com_etree_flag_v,
13976
14
        { "V", "bgp.ext_com_etree.flag_v",FT_BOOLEAN, 16,
13977
14
          TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_V, "VLAN mapping", HFILL }},
13978
14
      { &hf_bgp_ext_com_evpn_mmac_flag,
13979
14
        { "Flags", "bgp.ext_com_evpn.mmac.flags", FT_UINT8, BASE_HEX,
13980
14
          NULL, 0x0, "MAC Mobility flags", HFILL }},
13981
14
      { &hf_bgp_ext_com_evpn_mmac_flag_sticky,
13982
14
        { "Sticky/Static MAC", "bgp.ext_com_evpn.mmac.flags.sticky", FT_BOOLEAN, 8,
13983
14
          TFS(&tfs_yes_no), BGP_EXT_COM_EVPN_MMAC_STICKY, "Indicates whether the MAC address is fixed or movable", HFILL }},
13984
14
      { &hf_bgp_ext_com_evpn_mmac_seq,
13985
14
        { "Sequence number", "bgp.ext_com_evpn.mmac.seq", FT_UINT32, BASE_DEC,
13986
14
          NULL, 0x0, "MAC Mobility Update Sequence number", HFILL }},
13987
14
      { &hf_bgp_ext_com_evpn_esirt,
13988
14
        { "ES-Import Route Target", "bgp.ext_com_evpn.esi.rt", FT_ETHER, BASE_NONE,
13989
14
          NULL, 0x0, "Route Target as a MAC Address", HFILL }},
13990
14
      { &hf_bgp_ext_com_evpn_routermac,
13991
14
        { "Router's MAC", "bgp.ext_com_evpn.esi.router_mac", FT_ETHER, BASE_NONE,
13992
14
          NULL, 0x0, "Router's MAC Address", HFILL }},
13993
14
      { &hf_bgp_ext_com_evpn_l2attr_flags,
13994
14
        { "Flags", "bgp.ext_com_evpn.l2attr.flags", FT_UINT16, BASE_HEX,
13995
14
          NULL, 0x0, "EVPN L2 attribute flags", HFILL }},
13996
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
13997
14
        { "Reserved", "bgp.ext_com_evpn.l2attr.flag_reserved", FT_UINT16, BASE_HEX,
13998
14
          NULL, BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED, NULL, HFILL }},
13999
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_ci,
14000
14
        { "CI flag", "bgp.ext_com_evpn.l2attr.flag_ci", FT_BOOLEAN, 16,
14001
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI, "Control Word Indicator Extended Community can be advertised", HFILL }},
14002
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_f,
14003
14
        { "F flag", "bgp.ext_com_evpn.l2attr.flag_f", FT_BOOLEAN, 16,
14004
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_F, "PE is capable to send and receive flow label", HFILL }},
14005
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_c,
14006
14
        { "C flag", "bgp.ext_com_evpn.l2attr.flag_c", FT_BOOLEAN, 16,
14007
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_C, "Control word must be present when sending EVPN packets to this PE", HFILL }},
14008
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_p,
14009
14
        { "P flag", "bgp.ext_com_evpn.l2attr.flag_p", FT_BOOLEAN, 16,
14010
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_P, "Primary PE", HFILL }},
14011
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_b,
14012
14
        { "B flag", "bgp.ext_com_evpn.l2attr.flag_b", FT_BOOLEAN, 16,
14013
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_B, "Backup PE", HFILL }},
14014
14
      { &hf_bgp_ext_com_evpn_l2attr_l2_mtu,
14015
14
        { "L2 MTU", "bgp.ext_com_evpn.l2attr.l2_mtu", FT_UINT16, BASE_DEC,
14016
14
          NULL, 0x0, NULL, HFILL }},
14017
14
      { &hf_bgp_ext_com_evpn_l2attr_reserved,
14018
14
        { "Reserved", "bgp.ext_com_evpn.l2attr.reserved", FT_BYTES, BASE_NONE,
14019
14
          NULL, 0x0, NULL, HFILL }},
14020
14
      { &hf_bgp_ext_com_evpn_etree_flags,
14021
14
        { "Flags", "bgp.ext_com_evpn.etree.flags", FT_UINT8, BASE_HEX,
14022
14
          NULL, 0x0, "EVPN E-Tree attribute flags", HFILL }},
14023
14
      { &hf_bgp_ext_com_evpn_etree_flag_reserved,
14024
14
        { "Reserved", "bgp.ext_com_evpn.etree.flag_reserved", FT_UINT8, BASE_HEX,
14025
14
          NULL, BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED, NULL, HFILL }},
14026
14
      { &hf_bgp_ext_com_evpn_etree_flag_l,
14027
14
        { "L flag", "bgp.ext_com_evpn.etree.flag_l", FT_BOOLEAN, 8,
14028
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_ETREE_FLAG_L, "Leaf-Indication", HFILL }},
14029
14
      { &hf_bgp_ext_com_evpn_etree_reserved,
14030
14
        { "Reserved", "bgp.ext_com_evpn.etree.reserved", FT_BYTES, BASE_NONE,
14031
14
          NULL, 0x0, NULL, HFILL }},
14032
      /* BGP Cost Community */
14033
14
      { &hf_bgp_ext_com_cost_poi,
14034
14
        { "Point of insertion", "bgp.ext_com_cost.poi", FT_UINT8, BASE_DEC,
14035
14
          VALS(bgpext_com_cost_poi_type), 0x0, "Placement of the Cost value in the BGP Best Path algorithm", HFILL }},
14036
14
      { &hf_bgp_ext_com_cost_cid,
14037
14
        { "Community ID", "bgp.ext_com_cost.cid", FT_UINT8, BASE_DEC,
14038
14
          NULL, 0x0, "Community instance ID to distinguish between multiple Cost communities", HFILL }},
14039
14
      { &hf_bgp_ext_com_cost_cost,
14040
14
        { "Cost", "bgp.ext_com_cost.cost", FT_UINT32, BASE_DEC,
14041
14
          NULL, 0x0, "Cost value", HFILL }},
14042
14
      { &hf_bgp_ext_com_cost_cid_rep,
14043
14
        { "Cost use", "bgp.ext_com_cost.cid.use", FT_BOOLEAN, 8,
14044
14
          TFS(&tfs_cost_replace), BGP_EXT_COM_COST_CID_REP, "Indicates whether the Cost value will replace the original attribute value", HFILL }},
14045
      /* EIGRP Route Metrics Extended Communities */
14046
14
      { &hf_bgp_ext_com_stype_tr_exp_eigrp,
14047
14
        { "Route Attributes", "bgp.ext_com_eigrp", FT_UINT8, BASE_DEC,
14048
14
          VALS(bgpext_com_stype_tr_eigrp), 0x0, "Original EIGRP route attributes", HFILL }},
14049
14
      { &hf_bgp_ext_com_eigrp_flags,
14050
14
        { "Route flags", "bgp.ext_com_eigrp.flags", FT_UINT16, BASE_HEX,
14051
14
          NULL, 0x0, "EIGRP Route flags bitfield", HFILL }},
14052
14
      { &hf_bgp_ext_com_eigrp_flags_rt,
14053
14
        { "Route type", "bgp.ext_com_eigrp.flags.rt", FT_BOOLEAN, 16,
14054
14
          TFS(&tfs_eigrp_rtype), BGP_EXT_COM_EXP_EIGRP_FLAG_RT, "Original EIGRP route type (internal/external)", HFILL }},
14055
14
      { &hf_bgp_ext_com_eigrp_rtag,
14056
14
        { "Route tag", "bgp.ext_com_eigrp.rtag", FT_UINT32, BASE_DEC,
14057
14
          NULL, 0x0, "Original EIGRP route tag", HFILL }},
14058
14
      { &hf_bgp_ext_com_eigrp_asn,
14059
14
        { "AS Number", "bgp.ext_com_eigrp.asn", FT_UINT16, BASE_DEC,
14060
14
          NULL, 0x0, "Original EIGRP Autonomous System Number this route comes from", HFILL }},
14061
14
      { &hf_bgp_ext_com_eigrp_delay,
14062
14
        { "Delay", "bgp.ext_com_eigrp.dly", FT_UINT32, BASE_DEC,
14063
14
          NULL, 0x0, "Original EIGRP route delay metric", HFILL }},
14064
14
      { &hf_bgp_ext_com_eigrp_rly,
14065
14
        { "Reliability", "bgp.ext_com_eigrp.rly", FT_UINT8, BASE_DEC,
14066
14
          NULL, 0x0, "Original EIGRP route reliability metric", HFILL }},
14067
14
      { &hf_bgp_ext_com_eigrp_hops,
14068
14
        { "Hop count", "bgp.ext_com_eigrp.hops", FT_UINT8, BASE_DEC,
14069
14
          NULL, 0x0, "Original EIGRP route hop count", HFILL }},
14070
14
      { &hf_bgp_ext_com_eigrp_bw,
14071
14
        { "Bandwidth", "bgp.ext_com_eigrp.bw", FT_UINT32, BASE_DEC,
14072
14
          NULL, 0x0, "Original EIGRP route bandwidth metric", HFILL }},
14073
14
      { &hf_bgp_ext_com_eigrp_load,
14074
14
        { "Load", "bgp.ext_com_eigrp.load", FT_UINT8, BASE_DEC,
14075
14
          NULL, 0x0, "Original EIGRP route load metric", HFILL }},
14076
14
      { &hf_bgp_ext_com_eigrp_mtu,
14077
14
        { "MTU", "bgp.ext_com_eigrp.mtu", FT_UINT32, BASE_DEC,
14078
14
          NULL, 0x0, "Original EIGRP route path MTU", HFILL }},
14079
14
      { &hf_bgp_ext_com_eigrp_rid,
14080
14
        { "Router ID", "bgp.ext_com_eigrp.rid", FT_IPv4, BASE_NONE,
14081
14
          NULL, 0x0, "EIGRP Router ID of the router that originated the route", HFILL }},
14082
14
      { &hf_bgp_ext_com_eigrp_e_asn,
14083
14
        { "External AS Number", "bgp.ext_com_eigrp.e_asn", FT_UINT16, BASE_DEC,
14084
14
          NULL, 0x0, "Original AS Number of the route before its redistribution into EIGRP", HFILL }},
14085
14
      { &hf_bgp_ext_com_eigrp_e_rid,
14086
14
        { "External Router ID", "bgp.ext_com_eigrp.e_rid", FT_IPv4, BASE_NONE,
14087
14
          NULL, 0x0, "EIGRP Router ID of the router that redistributed this route into EIGRP", HFILL }},
14088
14
      { &hf_bgp_ext_com_eigrp_e_pid,
14089
14
        { "External protocol", "bgp.ext_com_eigrp.e_pid", FT_UINT16, BASE_DEC,
14090
14
          VALS(eigrp_proto2string), 0x0, "Original routing protocol from which this route was redistributed into EIGRP", HFILL }},
14091
14
      { &hf_bgp_ext_com_eigrp_e_m,
14092
14
        { "External metric", "bgp.ext_com_eigrp.e_metric", FT_UINT32, BASE_DEC,
14093
14
          NULL, 0x0, "Original metric of the route before its redistribution into EIGRP", HFILL }},
14094
14
      { &hf_bgp_ext_com_mup_segment_id2,
14095
14
        { "Segment Identifier 2-byte", "bgp.ext_com_mup.segment_id2", FT_UINT16, BASE_DEC,
14096
14
          NULL, 0x0, "Configurable segment identifier value 2-byte", HFILL }},
14097
14
      { &hf_bgp_ext_com_mup_segment_id4,
14098
14
        { "Segment Identifier 4-byte", "bgp.ext_com_mup.segment_id4", FT_UINT32, BASE_DEC,
14099
14
          NULL, 0x0, "Configurable segment identifier value 4-byte", HFILL }},
14100
14101
      /* idr-ls-03 */
14102
14
      { &hf_bgp_ls_type,
14103
14
        { "Type", "bgp.ls.type", FT_UINT16, BASE_DEC,
14104
14
          NULL, 0x0, "BGP-LS message type", HFILL }},
14105
14
      { &hf_bgp_ls_length,
14106
14
        { "Length", "bgp.ls.length", FT_UINT16, BASE_DEC,
14107
14
          NULL, 0x0, "The total length of the message payload in octets", HFILL }},
14108
14
      { &hf_bgp_ls_nlri,
14109
14
        { "BGP-LS NLRI", "bgp.ls.nlri", FT_NONE,
14110
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14111
14
      { &hf_bgp_ls_safi128_nlri,
14112
14
        { "Link State SAFI 128 NLRI", "bgp.ls.nlri_safi128", FT_NONE,
14113
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14114
14
      { &hf_bgp_ls_safi128_nlri_route_distinguisher,
14115
14
        { "Route Distinguisher", "bgp.ls.nlri_safi128_route_distinguisher", FT_NONE,
14116
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14117
14
      { &hf_bgp_ls_safi128_nlri_route_distinguisher_type,
14118
14
        { "Route Distinguisher Type", "bgp.ls.nlri_safi128_route_distinguisher_type", FT_UINT16,
14119
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14120
14
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
14121
14
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_2", FT_UINT16,
14122
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14123
14
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
14124
14
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_ipv4", FT_IPv4,
14125
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14126
14
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
14127
14
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_4", FT_UINT32,
14128
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14129
14
      { &hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
14130
14
        { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_2", FT_UINT16,
14131
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14132
14
      { &hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
14133
14
        { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_4", FT_UINT32,
14134
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14135
14
      { &hf_bgp_ls_nlri_type,
14136
14
        { "NLRI Type", "bgp.ls.nlri_type", FT_UINT16,
14137
14
          BASE_DEC, VALS(bgp_ls_nlri_type_vals), 0x0, NULL, HFILL}},
14138
14
      { &hf_bgp_ls_nlri_length,
14139
14
        { "NLRI Length", "bgp.ls.nlri_length", FT_UINT16,
14140
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14141
14
      { &hf_bgp_ls_nlri_link_nlri_type,
14142
14
        { "Link-State NLRI Link NLRI", "bgp.ls.nlri_link", FT_NONE,
14143
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14144
14
      { &hf_bgp_ls_nlri_link_descriptors_tlv,
14145
14
        { "Link Descriptors TLV", "bgp.ls.nlri_link_descriptors_tlv", FT_NONE,
14146
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14147
14
      { &hf_bgp_ls_nlri_prefix_descriptors_tlv,
14148
14
        { "Prefix Descriptors TLV", "bgp.ls.nlri_prefix_descriptors_tlv", FT_NONE,
14149
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14150
14
      { &hf_bgp_ls_nlri_srv6_sid_descriptors_tlv,
14151
14
        { "SRv6 SID Descriptors TLV", "bgp.ls.nlri_srv6_sid_descriptors_tlv", FT_NONE,
14152
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14153
14
      { &hf_bgp_ls_nlri_link_local_identifier,
14154
14
        { "Link Local Identifier", "bgp.ls.nlri_link_local_identifier", FT_UINT32,
14155
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14156
14
      { &hf_bgp_ls_nlri_link_remote_identifier,
14157
14
        { "Link Remote Identifier", "bgp.ls.nlri_link_remote_identifier", FT_UINT32,
14158
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14159
14
      { &hf_bgp_ls_nlri_ipv4_interface_address,
14160
14
        { "IPv4 Interface Address", "bgp.ls.nlri_ipv4_interface_address", FT_IPv4,
14161
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14162
14
      { &hf_bgp_ls_nlri_ipv4_neighbor_address,
14163
14
        { "IPv4 Neighbor Address", "bgp.ls.nlri_ipv4_neighbor_address", FT_IPv4,
14164
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14165
14
      { &hf_bgp_ls_nlri_ipv6_interface_address,
14166
14
        { "IPv6 Interface Address", "bgp.ls.nlri_ipv6_interface_address", FT_IPv6,
14167
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14168
14
      { &hf_bgp_ls_nlri_ipv6_neighbor_address,
14169
14
        { "IPv6 Neighbor Address", "bgp.ls.nlri_ipv6_neighbor_address", FT_IPv6,
14170
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14171
14
      { &hf_bgp_ls_nlri_multi_topology_id,
14172
14
        { "Multi Topology ID", "bgp.ls.nlri_multi_topology_id", FT_UINT16,
14173
14
          BASE_DEC_HEX, NULL, 0x0fff, NULL, HFILL}},
14174
14
      { &hf_bgp_ls_nlri_ospf_route_type,
14175
14
        { "OSPF Route Type", "bgp.ls.nlri_ospf_route_type", FT_UINT8,
14176
14
          BASE_DEC, VALS(link_state_prefix_descriptors_ospf_route_type), 0x0, NULL, HFILL}},
14177
14
      { &hf_bgp_ls_nlri_ip_reachability_prefix_ip,
14178
14
       { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip", FT_IPv4,
14179
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14180
14
      { &hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
14181
14
       { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip6", FT_IPv6,
14182
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14183
14
      { &hf_bgp_ls_nlri_node_nlri_type,
14184
14
        { "Link-State NLRI Node NLRI", "bgp.ls.nlri_node", FT_NONE,
14185
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14186
14
      { &hf_bgp_ls_nlri_node_protocol_id,
14187
14
        { "Protocol ID", "bgp.ls.nlri_node.protocol_id", FT_UINT8,
14188
14
          BASE_DEC, VALS(link_state_nlri_protocol_id_values), 0x0, NULL, HFILL }},
14189
14
      { &hf_bgp_ls_nlri_node_identifier,
14190
14
        { "Identifier", "bgp.ls.nlri_node.identifier", FT_UINT64,
14191
14
          BASE_DEC | BASE_VAL64_STRING, VALS64(link_state_nlri_routing_universe_values), 0x0, NULL, HFILL }},
14192
14
      { &hf_bgp_ls_ipv4_topology_prefix_nlri_type,
14193
14
        { "Link-State NLRI IPv4 Topology Prefix", "bgp.ls.ipv4_topology_prefix", FT_NONE,
14194
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14195
14
      { &hf_bgp_ls_ipv6_topology_prefix_nlri_type,
14196
14
        { "Link-State NLRI IPv6 Topology Prefix", "bgp.ls.ipv6_topology_prefix", FT_NONE,
14197
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14198
14
      { &hf_bgp_ls_nlri_srv6_sid_nlri_type,
14199
14
        { "Link-State NLRI SRv6 SID NLRI", "bgp.ls.nlri_srv6_sid", FT_NONE,
14200
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14201
       /* NLRI TLVs */
14202
14
      { &hf_bgp_ls_tlv_local_node_descriptors,
14203
14
        { "Local Node Descriptors TLV", "bgp.ls.tlv.local_node_descriptors", FT_NONE,
14204
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14205
14
      { &hf_bgp_ls_tlv_remote_node_descriptors,
14206
14
        { "Remote Node Descriptors TLV", "bgp.ls.tlv.remote_node_descriptors", FT_NONE,
14207
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14208
14
      { &hf_bgp_ls_tlv_autonomous_system,
14209
14
        { "Autonomous System TLV", "bgp.ls.tlv.autonomous_system", FT_NONE,
14210
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14211
14
      { &hf_bgp_ls_tlv_autonomous_system_id,
14212
14
        { "AS ID", "bgp.ls.tlv.autonomous_system.id", FT_UINT32,
14213
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
14214
14
      { &hf_bgp_ls_tlv_bgp_ls_identifier,
14215
14
        { "BGP-LS Identifier TLV", "bgp.ls.tlv.bgp_ls_identifier", FT_NONE,
14216
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14217
14
      { &hf_bgp_ls_tlv_bgp_ls_identifier_id,
14218
14
        { "BGP-LS ID", "bgp.ls.tlv.bgp_ls_identifier_id", FT_UINT32,
14219
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
14220
14
      { &hf_bgp_ls_tlv_area_id,
14221
14
        { "Area ID TLV", "bgp.ls.tlv.area_id", FT_NONE,
14222
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14223
14
      { &hf_bgp_ls_tlv_area_id_id,
14224
14
        { "Area ID", "bgp.ls.tlv.area_id.id", FT_UINT32,
14225
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
14226
14
      { &hf_bgp_ls_tlv_ipv4_router_id_of_local_node,
14227
14
        { "IPv4 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv4_router_id_of_local_node", FT_NONE,
14228
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14229
14
      { &hf_bgp_ls_tlv_ipv4_router_id_value,
14230
14
        { "IPv4 Router-ID", "bgp.ls.tlv.ipv4_router_id_value", FT_IPv4,
14231
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14232
14
      { &hf_bgp_ls_tlv_ipv6_router_id_of_local_node,
14233
14
        { "IPv6 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv6_router_id_of_local_node", FT_NONE,
14234
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14235
14
      { &hf_bgp_ls_tlv_ipv6_router_id_value,
14236
14
        { "IPv6 Router-ID", "bgp.ls.tlv.ipv6_router_id_value", FT_IPv6,
14237
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14238
14
      { &hf_bgp_ls_tlv_ipv4_router_id_of_remote_node,
14239
14
        { "IPv4 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv4_router_id_of_remote_node", FT_NONE,
14240
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14241
14
      { &hf_bgp_ls_tlv_ipv6_router_id_of_remote_node,
14242
14
        { "IPv6 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv6_router_id_of_remote_node", FT_NONE,
14243
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14244
14
      { &hf_bgp_ls_tlv_link_local_remote_identifiers,
14245
14
        { "Link Local/Remote Identifiers TLV", "bgp.ls.tlv.link_local_remote_identifiers", FT_NONE,
14246
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14247
14
      { &hf_bgp_ls_tlv_ipv4_interface_address,
14248
14
        {  "IPv4 interface address TLV", "bgp.ls.tlv.ipv4_interface_address", FT_NONE,
14249
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14250
14
      { &hf_bgp_ls_tlv_ipv4_neighbor_address,
14251
14
        { "IPv4 neighbor address TLV", "bgp.ls.tlv.ipv4_neighbor_address", FT_NONE,
14252
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14253
14
      { &hf_bgp_ls_tlv_ipv6_interface_address,
14254
14
        { "IPv6 interface address TLV", "bgp.ls.tlv.ipv6_interface_address", FT_NONE,
14255
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14256
14
      { &hf_bgp_ls_tlv_ipv6_neighbor_address,
14257
14
        { "IPv6 neighbor address TLV", "bgp.ls.tlv.ipv6_neighbor_address", FT_NONE,
14258
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14259
14
      { &hf_bgp_ls_tlv_node_msd,
14260
14
        { "Node MSD TLV", "bgp.ls.tlv.node_msd", FT_NONE,
14261
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14262
14
      { &hf_bgp_ls_tlv_link_msd,
14263
14
        { "Link MSD TLV", "bgp.ls.tlv.link_msd", FT_NONE,
14264
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14265
14
      { &hf_bgp_ls_tlv_igp_msd_type,
14266
14
        { "MSD Type", "bgp.ls.tlv.igp_msd_type", FT_UINT8,
14267
14
          BASE_DEC, VALS(igp_msd_types), 0x0, NULL, HFILL }},
14268
14
      { &hf_bgp_ls_tlv_igp_msd_value,
14269
14
        { "MSD Value", "bgp.ls.tlv.igp_msd_value", FT_UINT8,
14270
14
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
14271
14
      { &hf_bgp_ls_tlv_multi_topology_id,
14272
14
        { "Multi Topology ID TLV", "bgp.ls.tlv.multi_topology_id", FT_NONE,
14273
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14274
14
      { &hf_bgp_ls_tlv_ospf_route_type,
14275
14
        { "OSPF Route Type TLV", "bgp.ls.tlv.ospf_route_type", FT_NONE,
14276
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14277
14
      { &hf_bgp_ls_tlv_ip_reachability_information,
14278
14
        { "IP Reachability Information TLV", "bgp.ls.tlv.ip_reachability_information", FT_NONE,
14279
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14280
14
      { &hf_bgp_ls_tlv_administrative_group_color,
14281
14
        { "Administrative group (color) TLV", "bgp.ls.tlv.administrative_group_color", FT_NONE,
14282
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14283
14
      { &hf_bgp_ls_tlv_administrative_group_color_value,
14284
14
        { "Group Mask", "bgp.ls.tlv.administrative_group_color_value", FT_UINT32,
14285
14
         BASE_DEC, NULL, 0xffff, NULL, HFILL}},
14286
14
      { &hf_bgp_ls_tlv_administrative_group,
14287
14
        { "Group", "bgp.ls.tlv.administrative_group", FT_UINT32,
14288
14
         BASE_DEC, NULL, 0xffff, NULL, HFILL}},
14289
14
      { &hf_bgp_ls_tlv_max_link_bandwidth,
14290
14
        { "Maximum link bandwidth TLV", "bgp.ls.tlv.maximum_link_bandwidth", FT_NONE,
14291
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14292
14
      { &hf_bgp_ls_tlv_max_reservable_link_bandwidth,
14293
14
        { "Maximum reservable link bandwidth TLV", "bgp.ls.tlv.maximum_reservable_link_bandwidth", FT_NONE,
14294
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14295
14
      { &hf_bgp_ls_tlv_unreserved_bandwidth,
14296
14
        { "Unreserved bandwidth TLV", "bgp.ls.tlv.unreserved_bandwidth", FT_NONE,
14297
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14298
14
      { &hf_bgp_ls_bandwidth_value,
14299
14
        {"Bandwidth", "bgp.ls.bandwidth_value", FT_FLOAT,
14300
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14301
14
      { &hf_bgp_ls_tlv_te_default_metric,
14302
14
        { "TE Default Metric TLV", "bgp.ls.tlv.te_default_metric", FT_NONE,
14303
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14304
14
      { &hf_bgp_ls_tlv_te_default_metric_value_old,
14305
14
        { "TE Default Metric (old format)", "bgp.ls.tlv.te_default_metric_value.old", FT_UINT24,
14306
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
14307
14
      { &hf_bgp_ls_tlv_te_default_metric_value,
14308
14
        { "TE Default Metric", "bgp.ls.tlv.te_default_metric_value", FT_UINT32,
14309
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
14310
14
      { &hf_bgp_ls_tlv_link_protection_type,
14311
14
        { "Link Protection Type TLV", "bgp.ls.tlv.link_protection_type", FT_NONE,
14312
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14313
14
      { &hf_bgp_ls_tlv_link_protection_type_value,
14314
14
        { "Protection Capabilities", "bgp.ls.tlv.link_protection_type_value", FT_UINT8,
14315
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14316
14
      { &hf_bgp_ls_tlv_mpls_protocol_mask,
14317
14
        { "MPLS Protocol Mask TLV", "bgp.ls.tlv.mpls_protocol_mask", FT_NONE,
14318
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14319
14
      { &hf_bgp_ls_tlv_metric,
14320
14
        { "Metric TLV", "bgp.ls.tlv.metric", FT_NONE,
14321
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14322
14
      { &hf_bgp_ls_tlv_metric_value1,
14323
14
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT8,
14324
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14325
14
      { &hf_bgp_ls_tlv_metric_value2,
14326
14
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT16,
14327
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14328
14
      { &hf_bgp_ls_tlv_metric_value3,
14329
14
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT24,
14330
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14331
14
      { &hf_bgp_ls_tlv_shared_risk_link_group,
14332
14
        { "Shared Risk Link Group TLV", "bgp.ls.tlv.shared_risk_link_group", FT_NONE,
14333
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14334
14
      { &hf_bgp_ls_tlv_shared_risk_link_group_value,
14335
14
        { "Shared Risk Link Group Value", "bgp.ls.tlv.shared_risk_link_group_value", FT_UINT32,
14336
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14337
14
      { &hf_bgp_ls_tlv_opaque_link_attribute,
14338
14
        { "Opaque Link Attribute TLV", "bgp.ls.tlv.opaque_link_attribute", FT_NONE,
14339
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14340
14
      { &hf_bgp_ls_tlv_opaque_link_attribute_value,
14341
14
        { "Opaque link attributes", "bgp.ls.tlv.opaque_link_attribute_value", FT_NONE,
14342
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14343
14
      { &hf_bgp_ls_tlv_link_name_attribute,
14344
14
        { "Opaque Link Attribute TLV", "bgp.ls.tlv.link_name_attribute", FT_NONE,
14345
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14346
14
      { &hf_bgp_ls_tlv_link_name_attribute_value,
14347
14
        {"Link Name", "bgp.ls.tlv.link_name_attribute_value", FT_STRING,
14348
14
          BASE_NONE, NULL, 0, NULL, HFILL }},
14349
14
      { &hf_bgp_ls_tlv_igp_flags,
14350
14
        { "IGP Flags TLV", "bgp.ls.tlv.igp_flags", FT_NONE,
14351
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14352
14
      { &hf_bgp_ls_tlv_route_tag,
14353
14
        { "Route Tag TLV", "bgp.ls.tlv.route_tag", FT_NONE,
14354
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14355
14
      { &hf_bgp_ls_tlv_route_tag_value,
14356
14
        { "Route Tag Value", "bgp.ls.tlv.route_tag_value", FT_UINT32,
14357
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14358
14
      { &hf_bgp_ls_tlv_route_extended_tag,
14359
14
        { "Extended Route Tag TLV", "bgp.ls.tlv.route_extended_tag", FT_NONE,
14360
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14361
14
      { &hf_bgp_ls_tlv_route_extended_tag_value,
14362
14
        {"Extended Route Tag", "bgp.ls.tlv.extended_route_tag_value", FT_UINT64,
14363
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14364
14
      { &hf_bgp_ls_tlv_prefix_metric,
14365
14
        { "Prefix Metric TLV", "bgp.ls.tlv.prefix_metric", FT_NONE,
14366
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14367
14
      { &hf_bgp_ls_tlv_prefix_metric_value,
14368
14
        { "Prefix Metric", "bgp.ls.tlv.prefix_metric_value", FT_UINT32,
14369
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14370
14
      { &hf_bgp_ls_ospf_forwarding_address,
14371
14
        { "OSPF Forwarding Address TLV", "bgp.ls.tlv.ospf_forwarding_address", FT_NONE,
14372
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14373
14
      { &hf_bgp_ls_ospf_forwarding_address_ipv4_address,
14374
14
        { "OSPF forwarding IPv4 address", "bgp.ls.tlv.ospf_forwarding_address_ipv4", FT_IPv4,
14375
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14376
14
      { &hf_bgp_ls_ospf_forwarding_address_ipv6_address,
14377
14
        { "OSPF forwarding IPv6 address", "bgp.ls.tlv.ospf_forwarding_address_ipv6", FT_IPv6,
14378
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14379
14
      { &hf_bgp_ls_opaque_prefix_attribute,
14380
14
        { "Opaque Prefix Attribute TLV", "bgp.ls.tlv.opaque_prefix_attribute", FT_NONE,
14381
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14382
14
      { &hf_bgp_ls_opaque_prefix_attribute_value,
14383
14
        { "Opaque prefix attributes", "bgp.ls.tlv.opaque_prefix_attribute_value", FT_NONE,
14384
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14385
14
      { &hf_bgp_ls_extended_administrative_group,
14386
14
        { "Extended Administrative Group TLV", "bgp.ls.tlv.extended_administrative_group", FT_NONE,
14387
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14388
14
      { &hf_bgp_ls_extended_administrative_group_value,
14389
14
        { "Extended Administrative Group", "bgp.ls.tlv.extended_administrative_group_value", FT_BYTES,
14390
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14391
14
      { &hf_bgp_ls_tlv_igp_router,
14392
14
        { "IGP Router-ID", "bgp.ls.tlv.igp_router", FT_NONE,
14393
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14394
14
      { &hf_bgp_ls_tlv_igp_router_id,
14395
14
        { "IGP ID", "bgp.ls.tlv.igp_router_id", FT_BYTES,
14396
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14397
14
      { &hf_bgp_ls_tlv_bgp_router_id,
14398
14
        { "BGP Router-ID TLV", "bgp.ls.tlv.bgp_router_id", FT_NONE,
14399
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14400
14
      { &hf_bgp_ls_tlv_bgp_router_id_id,
14401
14
        { "BGP Router-ID", "bgp.ls.tlv.bgp_router_id.id", FT_IPv4,
14402
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14403
14
      { &hf_bgp_ls_tlv_bgp_confederation_member,
14404
14
        { "BGP Confederation Member TLV", "bgp.ls.tlv.confederation_member", FT_NONE,
14405
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14406
14
      { &hf_bgp_ls_tlv_bgp_confederation_member_as,
14407
14
        { "BGP Confederation Member AS", "bgp.ls.tlv.confederation_member.as", FT_UINT32,
14408
14
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
14409
14
      { &hf_bgp_ls_tlv_srv6_sid_info,
14410
14
        { "SRv6 SID Information TLV", "bgp.ls.tlv.srv6_sid_info", FT_NONE,
14411
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14412
14
      { &hf_bgp_ls_tlv_srv6_sid_info_sid,
14413
14
        { "SID", "bgp.ls.tlv.srv6_sid_info.sid", FT_IPv6,
14414
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14415
14
      { &hf_bgp_ls_tlv_node_flags_bits,
14416
14
        { "Node Flags Bits TLV", "bgp.ls.tlv.node_flags_bits", FT_NONE,
14417
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14418
14
      { &hf_bgp_ls_tlv_opaque_node_properties,
14419
14
        { "Opaque Node Properties TLV", "bgp.ls.tlv.opaque_node_properties", FT_NONE,
14420
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14421
14
      { &hf_bgp_ls_tlv_opaque_node_properties_value,
14422
14
        { "Opaque Node Properties", "bgp.ls.tlv.opaque_node_properties_value", FT_NONE,
14423
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14424
14
      { &hf_bgp_ls_tlv_node_name,
14425
14
        { "Node Name TLV", "bgp.ls.tlv.node_name", FT_NONE,
14426
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14427
14
      { &hf_bgp_ls_tlv_node_name_value,
14428
14
        {"Node name", "bgp.ls.tlv.node_name_value", FT_STRING,
14429
14
         BASE_NONE, NULL, 0, NULL, HFILL }},
14430
14
      { &hf_bgp_ls_tlv_is_is_area_identifier,
14431
14
        { "IS-IS Area Identifier TLV", "bgp.ls.tlv.is_is_area_identifier", FT_NONE,
14432
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14433
14
      { &hf_bgp_ls_tlv_is_is_area_identifier_value,
14434
14
        { "IS-IS Area Identifier", "bgp.ls.tlv.is_is_area_identifier_value", FT_BYTES,
14435
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14436
      /* Link Protection Types */
14437
14
      { &hf_bgp_ls_link_protection_type_enhanced,
14438
14
        { "Enhanced", "bgp.ls.link_protection_type.enhanced", FT_BOOLEAN, 8,
14439
14
          TFS(&tfs_capable_not_capable), 0x20, NULL, HFILL }},
14440
14
      { &hf_bgp_ls_link_protection_type_dedicated_1plus1,
14441
14
        { "Dedicated 1+1", "bgp.ls.link_protection_type.dedicated_1plus1", FT_BOOLEAN, 8,
14442
14
          TFS(&tfs_capable_not_capable), 0x10, NULL, HFILL }},
14443
14
      { &hf_bgp_ls_link_protection_type_dedicated_1to1,
14444
14
        { "Dedicated 1:1", "bgp.ls.link_protection_type.dedicated_1colon1", FT_BOOLEAN, 8,
14445
14
          TFS(&tfs_capable_not_capable), 0x08, NULL, HFILL }},
14446
14
      { &hf_bgp_ls_link_protection_type_shared,
14447
14
        { "Shared", "bgp.ls.link_protection_type.shared", FT_BOOLEAN, 8,
14448
14
          TFS(&tfs_capable_not_capable), 0x04, NULL, HFILL }},
14449
14
      { &hf_bgp_ls_link_protection_type_unprotected,
14450
14
        { "Unprotected", "bgp.ls.link_protection_type.unprotected", FT_BOOLEAN, 8,
14451
14
          TFS(&tfs_capable_not_capable), 0x02, NULL, HFILL }},
14452
14
      { &hf_bgp_ls_link_protection_type_extra_traffic,
14453
14
        { "Extra Traffic", "bgp.ls.link_protection_type.extra_traffic", FT_BOOLEAN, 8,
14454
14
          TFS(&tfs_capable_not_capable), 0x01, NULL, HFILL }},
14455
      /* MPLS Protocol Mask flags */
14456
14
      { &hf_bgp_ls_mpls_protocol_mask_flag_l,
14457
14
        { "Label Distribution Protocol (LDP)", "bgp.ls.protocol_mask_tlv.mpls_protocol.l", FT_BOOLEAN, 8,
14458
14
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
14459
14
      { &hf_bgp_ls_mpls_protocol_mask_flag_r,
14460
14
        { "Extension to RSVP for LSP Tunnels (RSVP-TE)", "bgp.ls.protocol_mask_tlv.mpls_protocol.r", FT_BOOLEAN, 8,
14461
14
          TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
14462
      /* IGP Flags TLV */
14463
14
      { &hf_bgp_ls_igp_flags_flag_d,
14464
14
        { "IS-IS Up/Down Bit", "bgp.ls.protocol_mask_tlv.igp_flags_flag_d.d", FT_BOOLEAN, 8,
14465
14
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
14466
      /* Node Flag Bits TLV flags */
14467
14
      { &hf_bgp_ls_node_flag_bits_overload,
14468
14
        { "Overload Bit", "bgp.ls.node_flag_bits.overload", FT_BOOLEAN, 8,
14469
14
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
14470
14
      { &hf_bgp_ls_node_flag_bits_attached,
14471
14
        { "Attached Bit", "bgp.ls.node_flag_bits.attached", FT_BOOLEAN, 8,
14472
14
          TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
14473
14
      { &hf_bgp_ls_node_flag_bits_external,
14474
14
        { "External Bit", "bgp.ls.node_flag_bits.external", FT_BOOLEAN, 8,
14475
14
          TFS(&tfs_set_notset), 0x20, NULL, HFILL}},
14476
14
      { &hf_bgp_ls_node_flag_bits_abr,
14477
14
        { "ABR Bit", "bgp.ls.node_flag_bits.abr", FT_BOOLEAN, 8,
14478
14
          TFS(&tfs_set_notset), 0x10, NULL, HFILL}},
14479
14
      { &hf_bgp_evpn_nlri,
14480
14
        { "EVPN NLRI", "bgp.evpn.nlri", FT_NONE,
14481
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14482
14
      { &hf_bgp_evpn_nlri_rt,
14483
14
        { "Route Type", "bgp.evpn.nlri.rt", FT_UINT8, BASE_DEC,
14484
14
          VALS(evpnrtypevals), 0x0, NULL, HFILL }},
14485
14
      { &hf_bgp_evpn_nlri_len,
14486
14
        { "Length", "bgp.evpn.nlri.len", FT_UINT8,
14487
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14488
14
      { &hf_bgp_evpn_nlri_rd,
14489
14
        { "Route Distinguisher", "bgp.evpn.nlri.rd", FT_BYTES,
14490
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14491
14
      { &hf_bgp_evpn_nlri_esi,
14492
14
        { "ESI", "bgp.evpn.nlri.esi", FT_BYTES,
14493
14
          SEP_COLON, NULL, 0x0, NULL, HFILL }},
14494
14
      { &hf_bgp_evpn_nlri_esi_type,
14495
14
        { "ESI Type", "bgp.evpn.nlri.esi.type", FT_UINT8,
14496
14
          BASE_DEC, VALS(evpn_nlri_esi_type), 0x0, "EVPN ESI type", HFILL }},
14497
14
      { &hf_bgp_evpn_nlri_esi_lacp_mac,
14498
14
        { "CE LACP system MAC", "bgp.evpn.nlri.esi.lacp_mac", FT_ETHER,
14499
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14500
14
      { &hf_bgp_evpn_nlri_esi_portk,
14501
14
        { "LACP port key", "bgp.evpn.nlri.esi.lacp_portkey", FT_UINT16,
14502
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
14503
14
      { &hf_bgp_evpn_nlri_esi_remain,
14504
14
        { "Remaining bytes", "bgp.evpn.nlri.esi.remaining", FT_BYTES,
14505
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14506
14
      { &hf_bgp_evpn_nlri_esi_reserved,
14507
14
        { "Reserved value all 0xff", "bgp.evpn.nlri.esi.reserved", FT_BYTES,
14508
14
         BASE_NONE, NULL, 0x0, NULL, HFILL }},
14509
14
      { &hf_bgp_evpn_nlri_esi_value,
14510
14
        { "ESI Value", "bgp.evpn.nlri.esi.value", FT_BYTES,
14511
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14512
14
      { &hf_bgp_evpn_nlri_esi_value_type0,
14513
14
        { "ESI 9 bytes value", "bgp.evpn.nlri.esi.type0", FT_BYTES,
14514
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14515
14
      { &hf_bgp_evpn_nlri_esi_rb_mac,
14516
14
        { "ESI root bridge MAC", "bgp.evpn.nlri.esi.root_bridge", FT_ETHER,
14517
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14518
14
      { &hf_bgp_evpn_nlri_esi_rbprio,
14519
14
        { "ESI root bridge priority", "bgp.evpn.nlri.esi.rb_prio", FT_UINT16,
14520
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
14521
14
      { &hf_bgp_evpn_nlri_esi_sys_mac,
14522
14
        { "ESI system MAC", "bgp.evpn.nlri.esi.system_mac", FT_ETHER,
14523
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14524
14
      { &hf_bgp_evpn_nlri_esi_mac_discr,
14525
14
        { "ESI system mac discriminator", "bgp.evpn.nlri.esi.system_mac_discr", FT_BYTES,
14526
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14527
14
      { &hf_bgp_evpn_nlri_esi_router_id,
14528
14
        { "ESI router ID", "bgp.evpn.nlri.esi.router_id", FT_IPv4,
14529
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14530
14
      { &hf_bgp_evpn_nlri_esi_router_discr,
14531
14
        { "ESI router discriminator", "bgp.evpn.nlri.esi.router_discr", FT_BYTES,
14532
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14533
14
      { &hf_bgp_evpn_nlri_esi_asn,
14534
14
        { "ESI ASN", "bgp.evpn.nlri.esi.asn", FT_UINT32,
14535
14
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
14536
14
      { &hf_bgp_evpn_nlri_esi_asn_discr,
14537
14
        { "ESI ASN discriminator", "bgp.evpn.nlri.esi.asn_discr", FT_BYTES,
14538
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14539
14
      { &hf_bgp_evpn_nlri_etag,
14540
14
       { "Ethernet Tag ID", "bgp.evpn.nlri.etag", FT_UINT32,
14541
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14542
14
      { &hf_bgp_evpn_nlri_mpls_ls1,
14543
14
        { "MPLS Label 1", "bgp.evpn.nlri.mpls_ls1", FT_UINT24,
14544
14
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
14545
14
      { &hf_bgp_evpn_nlri_mpls_ls2,
14546
14
        { "MPLS Label 2", "bgp.evpn.nlri.mpls_ls2", FT_UINT24,
14547
14
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
14548
14
      { &hf_bgp_evpn_nlri_vni,
14549
14
        { "VNI", "bgp.evpn.nlri.vni", FT_UINT24,
14550
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14551
14
      { &hf_bgp_evpn_nlri_maclen,
14552
14
       { "MAC Address Length", "bgp.evpn.nlri.maclen", FT_UINT8,
14553
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14554
14
      { &hf_bgp_evpn_nlri_mac_addr,
14555
14
        { "MAC Address", "bgp.evpn.nlri.mac_addr", FT_ETHER,
14556
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14557
14
      { &hf_bgp_evpn_nlri_iplen,
14558
14
        { "IP Address Length", "bgp.evpn.nlri.iplen", FT_UINT8,
14559
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14560
14
      { &hf_bgp_evpn_nlri_prefix_len,
14561
14
        { "IP prefix length", "bgp.evpn.nlri.prefix_len", FT_UINT8,
14562
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14563
14
      { &hf_bgp_evpn_nlri_ip_addr,
14564
14
        { "IPv4 address", "bgp.evpn.nlri.ip.addr", FT_IPv4,
14565
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14566
14
      { &hf_bgp_evpn_nlri_ipv6_addr,
14567
14
        { "IPv6 address", "bgp.evpn.nlri.ipv6.addr", FT_IPv6,
14568
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14569
14
      { &hf_bgp_evpn_nlri_ipv4_gtw,
14570
14
        { "IPv4 Gateway address", "bgp.evpn.nlri.ipv4.gtw_addr", FT_IPv4,
14571
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14572
14
      { &hf_bgp_evpn_nlri_ipv6_gtw,
14573
14
        { "IPv6 Gateway address", "bgp.evpn.nlri.ipv6.gtw_addr", FT_IPv6,
14574
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14575
     /* segment routing extensions to link state */
14576
     /* Node Attributes TLVs */
14577
14
      { &hf_bgp_ls_sr_tlv_capabilities,
14578
14
        { "SR Capabilities", "bgp.ls.sr.tlv.capabilities", FT_NONE,
14579
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14580
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags,
14581
14
        { "Flags", "bgp.ls.sr.tlv.capabilities.flags", FT_UINT8,
14582
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14583
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_i,
14584
14
        { "MPLS IPv4 flag (I)", "bgp.ls.sr.tlv.capabilities.flags.i", FT_BOOLEAN,
14585
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_I, NULL, HFILL}},
14586
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_v,
14587
14
        { "MPLS IPv6 flag (V)", "bgp.ls.sr.tlv.capabilities.flags.v", FT_BOOLEAN,
14588
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_V, NULL, HFILL}},
14589
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_h,
14590
14
        { "SR-IPv6 flag (H)", "bgp.ls.sr.tlv.capabilities.flags.h", FT_BOOLEAN,
14591
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_H, NULL, HFILL}},
14592
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
14593
14
        { "Reserved", "bgp.ls.sr.tlv.capabilities.flags.reserved", FT_UINT8,
14594
14
          BASE_HEX, NULL, 0x1F, NULL, HFILL}},
14595
14
      { &hf_bgp_ls_sr_tlv_capabilities_range_size,
14596
14
        { "Range Size", "bgp.ls.sr.tlv.capabilities.range_size", FT_UINT24,
14597
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14598
14
      { &hf_bgp_ls_sr_tlv_capabilities_sid_label,
14599
14
        { "From Label", "bgp.ls.sr.tlv.capabilities.sid.label", FT_UINT24,
14600
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14601
14
      { &hf_bgp_ls_sr_tlv_capabilities_sid_index,
14602
14
        { "From Index", "bgp.ls.sr.tlv.capabilities.sid.index", FT_UINT32,
14603
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14604
14
      { &hf_bgp_ls_sr_tlv_algorithm,
14605
14
        { "SR Algorithm TLV", "bgp.ls.sr.tlv.algorithm", FT_NONE,
14606
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14607
14
      { &hf_bgp_ls_sr_tlv_algorithm_value,
14608
14
        { "SR Algorithm", "bgp.ls.sr.tlv.algorithm.value", FT_UINT8,
14609
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14610
14
      { &hf_bgp_ls_sr_tlv_local_block,
14611
14
        { "SR Local Block", "bgp.ls.sr.tlv.local_block", FT_NONE,
14612
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14613
14
      { &hf_bgp_ls_sr_tlv_srv6_cap,
14614
14
        { "SRv6 Capabilities TLV", "bgp.ls.sr.tlv.srv6_capabilities", FT_NONE,
14615
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14616
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags,
14617
14
        { "Flags", "bgp.ls.sr.tlv.srv6_capabilities.flags", FT_UINT16,
14618
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14619
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags_o,
14620
14
        { "OAM flag (O)", "bgp.ls.sr.tlv.srv6_capabilities.flags.o", FT_BOOLEAN,
14621
14
          16, TFS(&tfs_set_notset), BGP_LS_SRV6_CAP_FLAG_O, NULL, HFILL}},
14622
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved,
14623
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_capabilities.flags.reserved", FT_UINT16,
14624
14
          BASE_HEX, NULL, 0x3fff, NULL, HFILL}},
14625
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_reserved,
14626
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_capabilities.reserved", FT_UINT16,
14627
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14628
14
      { &hf_bgp_ls_sr_tlv_local_block_flags,
14629
14
        { "Flags", "bgp.ls.sr.tlv.local_block.flags", FT_UINT8,
14630
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14631
14
      { &hf_bgp_ls_sr_tlv_local_block_range_size,
14632
14
        { "Range Size", "bgp.ls.sr.tlv.local_block.range_size", FT_UINT24,
14633
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14634
14
      { &hf_bgp_ls_sr_tlv_local_block_sid_label,
14635
14
        { "From Label", "bgp.ls.sr.tlv.local_block.sid.label", FT_UINT24,
14636
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14637
14
      { &hf_bgp_ls_sr_tlv_local_block_sid_index,
14638
14
        { "From Index", "bgp.ls.sr.tlv.local_block.sid.index", FT_UINT32,
14639
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14640
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def,
14641
14
        { "Flexible Algorithm Definition TLV", "bgp.ls.sr.tlv.flex_algo", FT_NONE,
14642
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14643
14
      { &hf_bgp_ls_sr_tlv_flex_algo_algorithm,
14644
14
        { "Flex-Algorithm", "bgp.ls.sr.tlv.flex_algo.flex_algorithm", FT_UINT8,
14645
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14646
14
      { &hf_bgp_ls_sr_tlv_flex_algo_metric_type,
14647
14
        { "Metric-Type", "bgp.ls.sr.tlv.flex_algo.metric_type", FT_UINT8,
14648
14
          BASE_DEC, VALS(flex_algo_metric_types), 0x0, NULL, HFILL}},
14649
14
      { &hf_bgp_ls_sr_tlv_flex_algo_calc_type,
14650
14
        { "Calculation-Type", "bgp.ls.sr.tlv.flex_algo.calculation_type", FT_UINT8,
14651
14
          BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14652
14
      { &hf_bgp_ls_sr_tlv_flex_algo_priority,
14653
14
        { "Priority", "bgp.ls.sr.tlv.flex_algo.priority", FT_UINT8,
14654
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14655
14
      { &hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity,
14656
14
        { "Flexible Algorithm Exclude-Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.exclude_any_affinity", FT_NONE,
14657
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14658
14
      { &hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity,
14659
14
        { "Flexible Algorithm Include-Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_any_affinity", FT_NONE,
14660
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14661
14
      { &hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity,
14662
14
        { "Flexible Algorithm Include-All Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_all_affinity", FT_NONE,
14663
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14664
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags,
14665
14
        { "Flexible Algorithm Definition Flags TLV", "bgp.ls.sr.tlv.flex_algo.definition_flags", FT_NONE,
14666
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14667
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags,
14668
14
        { "Flags", "bgp.ls.sr.tlv.flex_algo.definition_flags.flags", FT_UINT32,
14669
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14670
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m,
14671
14
        { "M-flag (M)", "bgp.ls.sr.tlv.flex_algo.definition_flags.flags.m", FT_BOOLEAN,
14672
14
          32, TFS(&tfs_set_notset), BGP_LS_FLEX_ALGO_DEF_FLAGS_M, NULL, HFILL}},
14673
14
      { &hf_bgp_ls_sr_tlv_flex_algo_exc_srlg,
14674
14
        { "Flexible Algorithm Exclude SRLG TLV", "bgp.ls.sr.tlv.flex_algo.exclude_srlg", FT_NONE,
14675
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14676
     /* Prefix Attribute TLVs */
14677
14
      { &hf_bgp_ls_sr_tlv_prefix_sid,
14678
14
        { "Prefix SID TLV", "bgp.ls.sr.tlv.prefix.sid", FT_NONE,
14679
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14680
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags,
14681
14
        { "Flags", "bgp.ls.sr.tlv.prefix.sid.flags", FT_UINT8,
14682
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14683
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
14684
14
        { "Re-advertisement (R)", "bgp.ls.sr.tlv.prefix.sid.flags.r", FT_BOOLEAN,
14685
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_R, NULL, HFILL}},
14686
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
14687
14
        { "Node-SID (N)", "bgp.ls.sr.tlv.prefix.sid.flags.n", FT_BOOLEAN,
14688
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_N, NULL, HFILL}},
14689
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
14690
14
        { "No-PHP (NP)", "bgp.ls.sr.tlv.prefix.sid.flags.np", FT_BOOLEAN,
14691
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_NP, NULL, HFILL}},
14692
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
14693
14
        { "No-PHP (P)", "bgp.ls.sr.tlv.prefix.sid.flags.p", FT_BOOLEAN,
14694
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_P, NULL, HFILL}},
14695
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
14696
14
        { "Mapping Server Flag (M)", "bgp.ls.sr.tlv.prefix.sid.flags.m", FT_BOOLEAN,
14697
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_M, NULL, HFILL}},
14698
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
14699
14
        { "Explicit-Null (E)", "bgp.ls.sr.tlv.prefix.sid.flags.e", FT_BOOLEAN,
14700
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_E, NULL, HFILL}},
14701
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
14702
14
        { "Value (V)", "bgp.ls.sr.tlv.prefix.sid.flags.v", FT_BOOLEAN,
14703
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_V, NULL, HFILL}},
14704
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
14705
14
        { "Local (L)", "bgp.ls.sr.tlv.prefix.sid.flags.l", FT_BOOLEAN,
14706
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_L, NULL, HFILL}},
14707
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_algo,
14708
14
        { "Algorithm", "bgp.ls.sr.tlv.prefix.sid.algo", FT_UINT8,
14709
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14710
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_label,
14711
14
        { "SID/Label", "bgp.ls.sr.tlv.prefix.sid.label", FT_UINT24,
14712
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14713
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_index,
14714
14
        { "SID/Index", "bgp.ls.sr.tlv.prefix.sid.index", FT_UINT32,
14715
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14716
14
      { &hf_bgp_ls_sr_tlv_srv6_locator,
14717
14
        { "SRv6 Locator TLV", "bgp.ls.sr.tlv.srv6_locator", FT_NONE,
14718
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14719
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags,
14720
14
        { "Flags", "bgp.ls.sr.tlv.srv6_locator.flags", FT_UINT8,
14721
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14722
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags_d,
14723
14
        { "Down flag (D)", "bgp.ls.sr.tlv.srv6_locator.flags.d", FT_BOOLEAN,
14724
14
          8, TFS(&tfs_set_notset), BGP_LS_SRV6_LOC_FLAG_D, NULL, HFILL}},
14725
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved,
14726
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_locator.flags.reserved", FT_UINT8,
14727
14
          BASE_HEX, NULL, BGP_LS_SRV6_LOC_FLAG_RESERVED, NULL, HFILL}},
14728
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_algo,
14729
14
        { "Algorithm", "bgp.ls.sr.tlv.srv6_locator.algorithm",
14730
14
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14731
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_reserved,
14732
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_locator.reserved", FT_UINT16,
14733
14
          BASE_HEX, NULL, 0, NULL, HFILL}},
14734
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_metric,
14735
14
        { "Metric", "bgp.ls.sr.tlv.srv6_locator.metric", FT_UINT32,
14736
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14737
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags,
14738
14
        { "Prefix Attribute Flags TLV", "bgp.ls.sr.tlv.prefix.attribute_flags", FT_NONE,
14739
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14740
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
14741
14
        { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags", FT_UINT8,
14742
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14743
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
14744
14
        { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.unknown", FT_BYTES,
14745
14
          SEP_SPACE, NULL, 0x0,NULL, HFILL }},
14746
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
14747
14
        { "Attach (A)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.a", FT_BOOLEAN,
14748
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO, NULL, HFILL}},
14749
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
14750
14
        { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
14751
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO, NULL, HFILL}},
14752
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
14753
14
        { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
14754
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO, NULL, HFILL}},
14755
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
14756
14
        { "External Prefix (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.x", FT_BOOLEAN,
14757
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI, NULL, HFILL}},
14758
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
14759
14
        { "Re-advertisement (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.r", FT_BOOLEAN,
14760
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI, NULL, HFILL}},
14761
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
14762
14
        { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
14763
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI, NULL, HFILL}},
14764
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
14765
14
        { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
14766
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI, NULL, HFILL}},
14767
14
      { &hf_bgp_ls_sr_tlv_source_router_id,
14768
14
        { "Source Router-ID TLV", "bgp.ls.sr.tlv.source_router_id", FT_NONE,
14769
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14770
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric,
14771
14
        { "Flexible Algorithm Prefix Metric TLV", "bgp.ls.sr.tlv.flex_algo.prefix_metric", FT_NONE,
14772
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14773
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags,
14774
14
        { "Flags", "bgp.ls.sr.tlv.flex_algo.prefix_metric.flags", FT_UINT8,
14775
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14776
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e,
14777
14
        { "E bit (E)", "bgp.ls.sr.tlv.flex_algo.prefix_metric.flags.e", FT_BOOLEAN,
14778
14
          8, TFS(&tfs_set_notset), BGP_LS_FLEX_ALGO_PREFIX_METRIC_FLAGS_E, NULL, HFILL}},
14779
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved,
14780
14
        { "Reserved", "bgp.ls.sr.tlv.flex_algo.prefix_metric.reserved", FT_UINT16,
14781
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14782
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric,
14783
14
        { "Metric", "bgp.ls.sr.tlv.flex_algo.prefix_metric.metric", FT_UINT32,
14784
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14785
     /* SID Attribute TLVs */
14786
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior,
14787
14
        { "SRv6 Endpoint Behavior TLV", "bgp.ls.sr.tlv.srv6_endpoint_behavior", FT_NONE,
14788
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14789
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior,
14790
14
        { "Endpoint Behavior", "bgp.ls.sr.tlv.srv6_endpoint_behavior.endpoint_behavior", FT_UINT16,
14791
14
          BASE_HEX, VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL}},
14792
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags,
14793
14
        { "Flags", "bgp.ls.sr.tlv.srv6_endpoint_behavior.flags", FT_UINT8,
14794
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14795
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo,
14796
14
        { "Algorithm", "bgp.ls.sr.tlv.srv6_endpoint_behavior.algorithm",
14797
14
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14798
     /* Adjacency Attribute TLVs */
14799
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid,
14800
14
        { "Adjacency SID TLV", "bgp.ls.sr.tlv.adjacency.sid", FT_NONE,
14801
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14802
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags,
14803
14
        { "Flags", "bgp.ls.sr.tlv.adjacency.sid.flags", FT_UINT8,
14804
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14805
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
14806
14
        { "Address-Family flag (F)", "bgp.ls.sr.tlv.adjacency.sid.flags.f", FT_BOOLEAN,
14807
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_FI, NULL, HFILL}},
14808
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
14809
14
        { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
14810
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BO, NULL, HFILL}},
14811
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
14812
14
        { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
14813
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BI, NULL, HFILL}},
14814
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
14815
14
        { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
14816
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VO, NULL, HFILL}},
14817
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
14818
14
        { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
14819
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VI, NULL, HFILL}},
14820
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
14821
14
        { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
14822
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LO, NULL, HFILL}},
14823
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
14824
14
        { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
14825
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LI, NULL, HFILL}},
14826
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_go,
14827
14
        { "Group Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.g", FT_BOOLEAN,
14828
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_GO, NULL, HFILL}},
14829
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
14830
14
        { "Set Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.s", FT_BOOLEAN,
14831
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_SI, NULL, HFILL}},
14832
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_po,
14833
14
        { "Persistent Flag (P)", "bgp.ls.sr.tlv.adjacency.sid.flags.p", FT_BOOLEAN,
14834
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_PO, NULL, HFILL}},
14835
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi,
14836
14
        { "Persistent Flag (P)", "bgp.ls.sr.tlv.adjacency.sid.flags.p", FT_BOOLEAN,
14837
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_PI, NULL, HFILL}},
14838
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_weight,
14839
14
        { "Weight", "bgp.ls.sr.tlv.adjacency.sid.weight", FT_UINT8,
14840
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14841
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_label,
14842
14
        { "SID/Label", "bgp.ls.sr.tlv.adjacency.sid.label", FT_UINT24,
14843
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14844
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_index,
14845
14
        { "SID/Index", "bgp.ls.sr.tlv.adjacency.sid.index", FT_UINT32,
14846
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14847
14
      { &hf_bgp_ls_sr_tlv_peer_node_sid,
14848
14
        { "PeerNode SID TLV", "bgp.ls.sr.tlv.peer_node.sid", FT_NONE,
14849
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14850
14
      { &hf_bgp_ls_sr_tlv_peer_adj_sid,
14851
14
        { "PeerAdj SID TLV", "bgp.ls.sr.tlv.peer_adj.sid", FT_NONE,
14852
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14853
14
      { &hf_bgp_ls_sr_tlv_peer_set_sid,
14854
14
        { "PeerSet SID TLV", "bgp.ls.sr.tlv.peer_set.sid", FT_NONE,
14855
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14856
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags,
14857
14
        { "Flags", "bgp.ls.sr.tlv.peer.sid.flags", FT_UINT8,
14858
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14859
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
14860
14
        { "Value flag (V)", "bgp.ls.sr.tlv.peer.sid.flags.v", FT_BOOLEAN,
14861
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_V, NULL, HFILL}},
14862
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
14863
14
        { "Local flag (L)", "bgp.ls.sr.tlv.peer.sid.flags.l", FT_BOOLEAN,
14864
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_L, NULL, HFILL}},
14865
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
14866
14
        { "Backup flag (B)", "bgp.ls.sr.tlv.peer.sid.flags.b", FT_BOOLEAN,
14867
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_B, NULL, HFILL}},
14868
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
14869
14
        { "Persistent flag (P)", "bgp.ls.sr.tlv.peer.sid.flags.p", FT_BOOLEAN,
14870
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_P, NULL, HFILL}},
14871
14
      { &hf_bgp_ls_sr_tlv_peer_sid_weight,
14872
14
        { "Weight", "bgp.ls.sr.tlv.peer.sid.weight", FT_UINT8,
14873
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14874
14
      { &hf_bgp_ls_sr_tlv_peer_sid_label,
14875
14
        { "SID/Label", "bgp.ls.sr.tlv.peer.sid.label", FT_UINT24,
14876
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14877
14
      { &hf_bgp_ls_sr_tlv_peer_sid_index,
14878
14
        { "SID/Index", "bgp.ls.sr.tlv.peer.sid.index", FT_UINT32,
14879
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14880
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid,
14881
14
        { "SRv6 End.X SID TLV", "bgp.ls.sr.tlv.srv6_endx_sid", FT_NONE,
14882
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14883
14
      { &hf_bgp_ls_sr_tlv_srv6_lan_endx_sid,
14884
14
        { "SRv6 LAN End.X SID TLV", "bgp.ls.sr.tlv.srv6_lan_endx_sid", FT_NONE,
14885
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14886
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior,
14887
14
        { "Endpoint Behavior", "bgp.ls.sr.tlv.srv6_endx_sid.endpoint_behavior",
14888
14
          FT_UINT16, BASE_DEC, VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
14889
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
14890
14
        { "Flags", "bgp.ls.sr.tlv.srv6_endx_sid.flags", FT_UINT8,
14891
14
          BASE_HEX, NULL, 0x0, NULL, HFILL }},
14892
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b,
14893
14
        { "Backup flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.b",
14894
14
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_B, NULL, HFILL }},
14895
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s,
14896
14
        { "Set flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.s",
14897
14
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_S, NULL, HFILL }},
14898
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p,
14899
14
        { "Persistent flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.p",
14900
14
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_P, NULL, HFILL }},
14901
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved,
14902
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_endx_sid.flags.reserved",
14903
14
          FT_UINT8, BASE_HEX, NULL, BGP_LS_SRV6_ENDX_SID_FLAG_RESERVED, NULL, HFILL }},
14904
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_algo,
14905
14
        { "Algorithm", "bgp.ls.sr.tlv.srv6_endx_sid.algorithm",
14906
14
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL }},
14907
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_weight,
14908
14
        { "Weight", "bgp.ls.sr.tlv.srv6_endx_sid.weight",
14909
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14910
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved,
14911
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_endx_sid.reserved",
14912
14
          FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
14913
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf,
14914
14
        { "Neighbor-ID", "bgp.ls.tlv.srv6_endx_sid.neighbor_id_ospf", FT_IPv4,
14915
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14916
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis,
14917
14
        { "Neighbor-ID", "bgp.ls.tlv.srv6_endx_sid.neighbor_id_isis", FT_SYSTEM_ID,
14918
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14919
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_sid,
14920
14
        { "SID", "bgp.ls.sr.tlv.srv6_endx_sid.sid",
14921
14
          FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
14922
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct,
14923
14
        { "SRv6 SID Structure TLV", "bgp.ls.sr.tlv.srv6_sid_structure", FT_NONE,
14924
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14925
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len,
14926
14
        { "Locator Block Length", "bgp.ls.sr.tlv.srv6_sid_structure.locator_block_len",
14927
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14928
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len,
14929
14
        { "Locator Node Length", "bgp.ls.sr.tlv.srv6_sid_structure.locator_node_len",
14930
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14931
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len,
14932
14
        { "Function Length", "bgp.ls.sr.tlv.srv6_sid_structure.fun_len",
14933
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14934
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len,
14935
14
        { "Arguments Length", "bgp.ls.sr.tlv.srv6_sid_structure.arg_len",
14936
14
          FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL }},
14937
14
      { &hf_bgp_ls_igp_te_metric_flags,
14938
14
        { "TE Metric Flags", "bgp.ls.igp_te_metric.flags", FT_UINT8,
14939
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14940
14
      { &hf_bgp_ls_igp_te_metric_flags_a,
14941
14
        { "Anomalous (A) bit", "bgp.ls.igp_te_metric.flags.a", FT_BOOLEAN,
14942
14
          8, TFS(&tfs_set_notset), BGP_LS_IGP_TE_METRIC_FLAG_A, NULL, HFILL}},
14943
14
      { &hf_bgp_ls_igp_te_metric_flags_reserved,
14944
14
        { "Reserved", "bgp.ls.igp_te_metric.flags.reserved", FT_UINT8,
14945
14
          BASE_HEX, NULL, BGP_LS_IGP_TE_METRIC_FLAG_RESERVED, NULL, HFILL}},
14946
14
      { &hf_bgp_ls_igp_te_metric_delay,
14947
14
        { "Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay", FT_NONE,
14948
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14949
14
      { &hf_bgp_ls_igp_te_metric_delay_value,
14950
14
        { "Delay", "bgp.ls.igp_te_metric.delay_value", FT_UINT24,
14951
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14952
14
      { &hf_bgp_ls_igp_te_metric_delay_min_max,
14953
14
        { "Min/Max Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay_min_max", FT_NONE,
14954
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14955
14
      { &hf_bgp_ls_igp_te_metric_delay_min,
14956
14
        { "Min Delay", "bgp.ls.igp_te_metric.delay_min", FT_UINT24,
14957
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14958
14
      { &hf_bgp_ls_igp_te_metric_delay_max,
14959
14
        { "Max Delay", "bgp.ls.igp_te_metric.delay_max", FT_UINT24,
14960
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14961
14
      { &hf_bgp_ls_igp_te_metric_delay_variation,
14962
14
        { "Unidirectional Delay Variation TLV", "bgp.ls.igp_te_metric.delay_variation", FT_NONE,
14963
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14964
14
      { &hf_bgp_ls_igp_te_metric_delay_variation_value,
14965
14
        { "Delay Variation", "bgp.ls.igp_te_metric.delay_variation_value", FT_UINT24,
14966
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14967
14
      { &hf_bgp_ls_igp_te_metric_link_loss,
14968
14
        { "Unidirectional Link Loss TLV", "bgp.ls.igp_te_metric.link_loss", FT_NONE,
14969
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14970
14
      { &hf_bgp_ls_igp_te_metric_link_loss_value,
14971
14
        { "Link Loss", "bgp.ls.igp_te_metric.link_loss_value", FT_UINT24,
14972
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14973
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_residual,
14974
14
        { "Unidirectional Residual Bandwidth TLV", "bgp.ls.igp_te_metric.residual_bandwidth", FT_NONE,
14975
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14976
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_residual_value,
14977
14
        { "Residual Bandwidth", "bgp.ls.igp_te_metric.residual_bandwidth_value", FT_UINT32,
14978
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14979
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_available,
14980
14
        { "Unidirectional Available Bandwidth TLV", "bgp.ls.igp_te_metric.available_bandwidth", FT_NONE,
14981
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14982
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_available_value,
14983
14
        { "Residual Bandwidth", "bgp.ls.igp_te_metric.available_bandwidth_value", FT_UINT32,
14984
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14985
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_utilized,
14986
14
        { "Unidirectional Utilized Bandwidth TLV", "bgp.ls.igp_te_metric.utilized_bandwidth", FT_NONE,
14987
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14988
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_utilized_value,
14989
14
        { "Utilized Bandwidth", "bgp.ls.igp_te_metric.utilized_bandwidth_value", FT_UINT32,
14990
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14991
14
      { &hf_bgp_ls_igp_te_metric_reserved,
14992
14
        { "Reserved", "bgp.ls.igp_te_metric.reserved", FT_UINT8,
14993
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14994
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs,
14995
14
        { "Application-Specific Link Attributes TLV", "bgp.ls.tlv.application_specific_link_attributes", FT_NONE,
14996
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14997
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len,
14998
14
        { "SABM Length", "bgp.ls.tlv.application_specific_link_attributes.sabm_length", FT_UINT8,
14999
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15000
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len,
15001
14
        { "UDABM Length", "bgp.ls.tlv.application_specific_link_attributes.udabm_length", FT_UINT8,
15002
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15003
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_reserved,
15004
14
        { "Reserved", "bgp.ls.tlv.application_specific_link_attributes.reserved", FT_UINT16,
15005
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15006
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
15007
14
        { "Standard Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.sabm", FT_UINT32,
15008
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15009
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
15010
14
        { "RSVP-TE (R)", "bgp.ls.tlv.application_specific_link_attributes.sabm.r", FT_BOOLEAN,
15011
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R, NULL, HFILL}},
15012
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
15013
14
        { "Segment Routing Policy (S)", "bgp.ls.tlv.application_specific_link_attributes.sabm.s", FT_BOOLEAN,
15014
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S, NULL, HFILL}},
15015
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
15016
14
        { "Loop Free Alternate (F)", "bgp.ls.tlv.application_specific_link_attributes.sabm.f", FT_BOOLEAN,
15017
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F, NULL, HFILL}},
15018
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
15019
14
        { "Flexible Algorithm (X)", "bgp.ls.tlv.application_specific_link_attributes.sabm.x", FT_BOOLEAN,
15020
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X, NULL, HFILL}},
15021
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
15022
14
        { "User-Defined Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.udabm", FT_BYTES,
15023
14
          SEP_SPACE, NULL, 0x0,NULL, HFILL }},
15024
15025
14
      { &hf_bgp_evpn_nlri_igmp_mc_or_length,
15026
14
       { "Originator Router Length", "bgp.evpn.nlri.or_length", FT_UINT8,
15027
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15028
14
      { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4,
15029
14
       { "Originator Router Address IPv4", "bgp.evpn.nlri.or_addr_ipv4", FT_IPv4,
15030
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15031
14
      { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6,
15032
14
       { "Originator Router Address IPv6", "bgp.evpn.nlri.or_addr_ipv6", FT_IPv6,
15033
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15034
14
      { &hf_bgp_evpn_nlri_igmp_mc_reserved,
15035
14
       { "Reserved", "bgp.evpn.nlri.igmp_mc_reserved", FT_BYTES,
15036
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15037
14
      { &hf_bgp_evpn_nlri_igmp_mc_max_resp_time,
15038
14
       { "Max. response time", "bgp.evpn.nlri.igmp_mc_max_resp_time", FT_UINT8,
15039
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15040
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags,
15041
14
       { "Flags", "bgp.evpn.nlri.igmp_mc_flags", FT_UINT8,
15042
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15043
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
15044
14
        { "IGMP Version 1", "bgp.evpn.nlri.igmp_mc_flags.v1", FT_BOOLEAN,
15045
14
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V1, NULL, HFILL}},
15046
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
15047
14
        { "IGMP Version 2", "bgp.evpn.nlri.igmp_mc_flags.v2", FT_BOOLEAN,
15048
14
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V2, NULL, HFILL}},
15049
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
15050
14
        { "IGMP Version 3", "bgp.evpn.nlri.igmp_mc_flags.v3", FT_BOOLEAN,
15051
14
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V3, NULL, HFILL}},
15052
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
15053
14
        { "Group Type (IE Flag)", "bgp.evpn.nlri.igmp_mc_flags.ie", FT_BOOLEAN,
15054
14
          8, TFS(&tfs_exclude_include), EVPN_IGMP_MC_FLAG_IE, "Group Type (Include/Exclude Flag)", HFILL}},
15055
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
15056
14
        { "Reserved", "bgp.evpn.nlri.igmp_mc_flags.reserved", FT_UINT8,
15057
14
          BASE_HEX, NULL, EVPN_IGMP_MC_FLAG_RESERVED, NULL, HFILL}},
15058
15059
        /* draft-mpmz-bess-mup-safi-00 */
15060
14
      { &hf_bgp_mup_nlri,
15061
14
        { "BGP-MUP NLRI", "bgp.mup.nlri", FT_NONE,
15062
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15063
14
      { &hf_bgp_mup_nlri_at,
15064
14
        { "Architecture Type", "bgp.mup.nlri.at", FT_UINT8, BASE_DEC,
15065
14
          VALS(bgp_mup_architecture_types), 0x0, NULL, HFILL }},
15066
14
      { &hf_bgp_mup_nlri_rt,
15067
14
        { "Route Type", "bgp.mup.nlri.rt", FT_UINT16, BASE_DEC,
15068
14
          VALS(bgp_mup_route_types), 0x0, NULL, HFILL }},
15069
14
      { &hf_bgp_mup_nlri_len,
15070
14
        { "Length", "bgp.mup.nlri.len", FT_UINT8,
15071
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15072
14
      { &hf_bgp_mup_nlri_rd,
15073
14
        { "Route Distinguisher", "bgp.mup.nlri.rd", FT_BYTES,
15074
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15075
14
      { &hf_bgp_mup_nlri_prefixlen,
15076
14
        { "Prefix Length", "bgp.mup.nlri.prefixlen", FT_UINT8,
15077
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15078
14
      { &hf_bgp_mup_nlri_ip_prefix,
15079
14
        { "IPv4 Prefix", "bgp.mup.nlri.ip_prefix", FT_IPv4,
15080
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15081
14
      { &hf_bgp_mup_nlri_ipv6_prefix,
15082
14
        { "IPv6 Prefix", "bgp.mup.nlri.ipv6_prefix", FT_IPv6,
15083
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15084
14
      { &hf_bgp_mup_nlri_ip_addr,
15085
14
        { "IPv4 Address", "bgp.mup.nlri.ip_addr", FT_IPv4,
15086
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15087
14
      { &hf_bgp_mup_nlri_ipv6_addr,
15088
14
        { "IPv6 Address", "bgp.mup.nlri.ipv6_addr", FT_IPv6,
15089
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15090
14
      { &hf_bgp_mup_nlri_3gpp_5g_teid,
15091
14
        { "TEID", "bgp.mup.nlri.3gpp_5g.teid", FT_UINT32,
15092
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15093
14
      { &hf_bgp_mup_nlri_3gpp_5g_qfi,
15094
14
        { "QFI", "bgp.mup.nlri.3gpp_5g.qfi", FT_UINT8,
15095
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15096
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_addr_len,
15097
14
        { "Endpoint Length", "bgp.mup.nlri.3gpp_5g.ep.len", FT_UINT8,
15098
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15099
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr,
15100
14
        { "Endpoint Address", "bgp.mup.nlri.3gpp_5g.ep.ip_addr", FT_IPv4,
15101
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15102
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr,
15103
14
        { "Endpoint Address", "bgp.mup.nlri.3gpp_5g.ep.ipv6_addr", FT_IPv6,
15104
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15105
14
      { &hf_bgp_mup_nlri_3gpp_5g_source_addr_len,
15106
14
        { "Source Address Length", "bgp.mup.nlri.3gpp_5g.source.len", FT_UINT8,
15107
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15108
14
      { &hf_bgp_mup_nlri_3gpp_5g_source_ip_addr,
15109
14
        { "Source Address", "bgp.mup.nlri.3gpp_5g.source.ip_addr", FT_IPv4,
15110
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15111
14
      { &hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr,
15112
14
        { "Source Address", "bgp.mup.nlri.3gpp_5g.source.ipv6_addr", FT_IPv6,
15113
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15114
14
      { &hf_bgp_mup_nlri_ep_len,
15115
14
        { "Endpoint Length", "bgp.mup.nlri.ep.len", FT_UINT8,
15116
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15117
14
      { &hf_bgp_mup_nlri_ep_ip_addr,
15118
14
        { "Endpoint Address", "bgp.mup.nlri.ep.ip_addr", FT_IPv4,
15119
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15120
14
      { &hf_bgp_mup_nlri_ep_ipv6_addr,
15121
14
        { "Endpoint Address", "bgp.mup.nlri.ep.ipv6_addr", FT_IPv6,
15122
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15123
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_teid,
15124
14
        { "Endpoint TEID", "bgp.mup.nlri.3gpp_5g.ep.teid", FT_UINT32,
15125
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15126
14
      { &hf_bgp_mup_nlri_3gpp_5g_type1_st_route,
15127
14
        { "3gpp-5g specific Type 1 ST route", "bgp.mup.nlri.3gpp_5g.type1_st_route", FT_NONE,
15128
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15129
14
      { &hf_bgp_mup_nlri_3gpp_5g_type2_st_route,
15130
14
        { "3gpp-5g specific Type 2 ST route", "bgp.mup.nlri.3gpp_5g.type2_st_route", FT_NONE,
15131
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15132
14
      { &hf_bgp_mup_nlri_unknown_data,
15133
14
        { "Unknown Data", "bgp.mup.nlri.unknown_data", FT_BYTES,
15134
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15135
14
};
15136
15137
14
    static int *ett[] = {
15138
14
      &ett_bgp,
15139
14
      &ett_bgp_prefix,
15140
14
      &ett_bgp_unfeas,
15141
14
      &ett_bgp_attrs,
15142
14
      &ett_bgp_attr,
15143
14
      &ett_bgp_attr_flags,
15144
14
      &ett_bgp_mp_nhna,
15145
14
      &ett_bgp_mp_reach_nlri,
15146
14
      &ett_bgp_mp_unreach_nlri,
15147
14
      &ett_bgp_mp_snpa,
15148
14
      &ett_bgp_nlri,
15149
14
      &ett_bgp_open,
15150
14
      &ett_bgp_update,
15151
14
      &ett_bgp_notification,
15152
14
      &ett_bgp_route_refresh,
15153
14
      &ett_bgp_capability,
15154
14
      &ett_bgp_as_path_segment,
15155
14
      &ett_bgp_as_path_segment_asn,
15156
14
      &ett_bgp_communities,
15157
14
      &ett_bgp_community,
15158
14
      &ett_bgp_cluster_list,
15159
14
      &ett_bgp_options,
15160
14
      &ett_bgp_option,
15161
14
      &ett_bgp_options_ext,
15162
14
      &ett_bgp_cap,
15163
14
      &ett_bgp_extended_communities,
15164
14
      &ett_bgp_extended_community,
15165
14
      &ett_bgp_ext_com_type,
15166
14
      &ett_bgp_extended_com_fspec_redir,
15167
14
      &ett_bgp_ext_com_flags,
15168
14
      &ett_bgp_ext_com_l2_flags,
15169
14
      &ett_bgp_ext_com_etree_flags,
15170
14
      &ett_bgp_ext_com_evpn_mmac_flags,
15171
14
      &ett_bgp_ext_com_evpn_l2attr_flags,
15172
14
      &ett_bgp_ext_com_evpn_etree_flags,
15173
14
      &ett_bgp_ext_com_cost_cid,
15174
14
      &ett_bgp_ext_com_ospf_rt_opt,
15175
14
      &ett_bgp_ext_com_eigrp_flags,
15176
14
      &ett_bgp_ssa,
15177
14
      &ett_bgp_ssa_subtree,
15178
14
      &ett_bgp_orf,
15179
14
      &ett_bgp_orf_entry,
15180
14
      &ett_bgp_mcast_vpn_nlri,
15181
14
      &ett_bgp_flow_spec_nlri,
15182
14
      &ett_bgp_flow_spec_nlri_filter,
15183
14
      &ett_bgp_flow_spec_nlri_op_flags,
15184
14
      &ett_bgp_flow_spec_nlri_tcp,
15185
14
      &ett_bgp_flow_spec_nlri_ff,
15186
14
      &ett_bgp_tunnel_tlv,
15187
14
      &ett_bgp_tunnel_tlv_subtree,
15188
14
      &ett_bgp_tunnel_subtlv,
15189
14
      &ett_bgp_tunnel_subtlv_subtree,
15190
14
      &ett_bgp_link_state,
15191
14
      &ett_bgp_evpn_nlri,
15192
14
      &ett_bgp_evpn_nlri_esi,
15193
14
      &ett_bgp_evpn_nlri_mc,
15194
14
      &ett_bgp_mpls_labels,
15195
14
      &ett_bgp_pmsi_tunnel_id,
15196
14
      &ett_bgp_aigp_attr,
15197
14
      &ett_bgp_large_communities,
15198
14
      &ett_bgp_dpath,
15199
14
      &ett_bgp_prefix_sid_label_index,
15200
14
      &ett_bgp_prefix_sid_ipv6,
15201
14
      &ett_bgp_prefix_sid_originator_srgb,
15202
14
      &ett_bgp_prefix_sid_originator_srgb_block,
15203
14
      &ett_bgp_prefix_sid_originator_srgb_blocks,
15204
14
      &ett_bgp_bgpsec_secure_path,
15205
14
      &ett_bgp_bgpsec_secure_path_segment,
15206
14
      &ett_bgp_bgpsec_signature_block,
15207
14
      &ett_bgp_bgpsec_signature_segment,
15208
14
      &ett_bgp_vxlan,
15209
14
      &ett_bgp_binding_sid,
15210
14
      &ett_bgp_segment_list,
15211
14
      &ett_bgp_prefix_sid_unknown,
15212
14
      &ett_bgp_prefix_sid_srv6_l3vpn,
15213
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
15214
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_information,
15215
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
15216
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_structure,
15217
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown,
15218
14
      &ett_bgp_prefix_sid_srv6_l3vpn_unknown,
15219
14
      &ett_bgp_prefix_sid_srv6_l2vpn,
15220
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
15221
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_information,
15222
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
15223
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_structure,
15224
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown,
15225
14
      &ett_bgp_prefix_sid_srv6_l2vpn_unknown,
15226
14
      &ett_bgp_mup_nlri,
15227
14
      &ett_bgp_mup_nlri_3gpp_5g_type1_st_route,
15228
14
      &ett_bgp_mup_nlri_3gpp_5g_type2_st_route,
15229
14
    };
15230
14
    static ei_register_info ei[] = {
15231
14
        { &ei_bgp_marker_invalid, { "bgp.marker_invalid", PI_MALFORMED, PI_ERROR, "Marker is not all ones", EXPFILL }},
15232
14
        { &ei_bgp_cap_len_bad, { "bgp.cap.length.bad", PI_MALFORMED, PI_ERROR, "Capability length is wrong", EXPFILL }},
15233
14
        { &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 }},
15234
14
        { &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }},
15235
14
        { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_UNDECODED, PI_WARN, "unknown ORF type", EXPFILL }},
15236
14
        { &ei_bgp_route_refresh_orf_type_unsupported, { "bgp.route_refresh.orf.type.unsupported", PI_UNDECODED, PI_WARN, "ORF type: decoding not supported", EXPFILL }},
15237
14
        { &ei_bgp_route_refresh_orf_type_unregistered, { "bgp.route_refresh.orf.type.unregistered", PI_MALFORMED, PI_ERROR, "ORF type: unregistered/non-IANA value", EXPFILL }},
15238
14
        { &ei_bgp_route_refresh_orf_action_invalid, { "bgp.route_refresh.orf.action.invalid", PI_MALFORMED, PI_ERROR, "Invalid ORF action", EXPFILL }},
15239
14
        { &ei_bgp_length_invalid, { "bgp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
15240
14
        { &ei_bgp_prefix_length_invalid, { "bgp.prefix_length.invalid", PI_MALFORMED, PI_ERROR, "Prefix length is invalid", EXPFILL }},
15241
14
        { &ei_bgp_afi_type_not_supported, { "bgp.afi_type_not_supported", PI_PROTOCOL, PI_ERROR, "AFI Type not supported", EXPFILL }},
15242
14
        { &ei_bgp_unknown_afi, { "bgp.unknown_afi", PI_PROTOCOL, PI_ERROR, "Unknown Address Family", EXPFILL }},
15243
14
        { &ei_bgp_unknown_safi, { "bgp.unknown_safi", PI_PROTOCOL, PI_ERROR, "Unknown SAFI", EXPFILL }},
15244
14
        { &ei_bgp_unknown_label_vpn, { "bgp.unknown_label", PI_PROTOCOL, PI_ERROR, "Unknown Label VPN", EXPFILL }},
15245
14
        { &ei_bgp_ls_error, { "bgp.ls.error", PI_PROTOCOL, PI_ERROR, "Link State error", EXPFILL }},
15246
14
        { &ei_bgp_ls_warn, { "bgp.ls.warn", PI_PROTOCOL, PI_WARN, "Link State warning", EXPFILL }},
15247
14
        { &ei_bgp_ext_com_len_bad, { "bgp.ext_com.length.bad", PI_PROTOCOL, PI_ERROR, "Extended community length is wrong", EXPFILL }},
15248
14
        { &ei_bgp_evpn_nlri_rt_type_err, { "bgp.evpn.type", PI_MALFORMED, PI_ERROR, "EVPN Route Type is invalid", EXPFILL }},
15249
14
        { &ei_bgp_evpn_nlri_rt_len_err, { "bgp.evpn.len", PI_MALFORMED, PI_ERROR, "EVPN Length is invalid", EXPFILL }},
15250
14
        { &ei_bgp_evpn_nlri_esi_type_err, { "bgp.evpn.esi_type", PI_MALFORMED, PI_ERROR, "EVPN ESI Type is invalid", EXPFILL }},
15251
14
        { &ei_bgp_evpn_nlri_rt4_no_ip, { "bgp.evpn.no_ip", PI_PROTOCOL, PI_NOTE, "IP Address: NOT INCLUDED", EXPFILL }},
15252
14
        { &ei_bgp_attr_pmsi_tunnel_type, { "bgp.attr.pmsi.tunnel_type", PI_PROTOCOL, PI_ERROR, "Unknown Tunnel type", EXPFILL }},
15253
14
        { &ei_bgp_attr_pmsi_opaque_type, { "bgp.attr.pmsi.opaque_type", PI_PROTOCOL, PI_ERROR, "Invalid pmsi opaque type", EXPFILL }},
15254
14
        { &ei_bgp_attr_aigp_type, { "bgp.attr.aigp.type", PI_MALFORMED, PI_NOTE, "Unknown AIGP attribute type", EXPFILL}},
15255
14
        { &ei_bgp_prefix_length_err, { "bgp.prefix.length", PI_MALFORMED, PI_ERROR, "Invalid IPv6 prefix length", EXPFILL}},
15256
14
        { &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}},
15257
14
        { &ei_bgp_next_hop_ipv6_scope, { "bgp.next_hop.ipv6.scope", PI_PROTOCOL, PI_WARN, "Invalid IPv6 address scope", EXPFILL}},
15258
14
        { &ei_bgp_next_hop_rd_nonzero, { "bgp.next_hop.rd.nonzero", PI_PROTOCOL, PI_WARN, "Route Distinguisher in Next Hop Network Address nonzero", EXPFILL}},
15259
14
        { &ei_bgp_mup_unknown_at, { "bgp.mup.unknown_at", PI_PROTOCOL, PI_ERROR, "Unknown architecture type", EXPFILL }},
15260
14
        { &ei_bgp_mup_unknown_rt, { "bgp.mup.unknown_rt", PI_PROTOCOL, PI_ERROR, "Unknown route type", EXPFILL }},
15261
14
        { &ei_bgp_mup_nlri_addr_len_err, { "bgp.mup.nlri.addr_len_err", PI_PROTOCOL, PI_ERROR, "Address length invalid", EXPFILL }},
15262
14
    };
15263
15264
14
    module_t *bgp_module;
15265
14
    expert_module_t* expert_bgp;
15266
15267
14
    static const enum_val_t asn_len[] = {
15268
14
        {"auto-detect", "Auto-detect", 0},
15269
14
        {"2", "2 octet", 2},
15270
14
        {"4", "4 octet", 4},
15271
14
        {NULL, NULL, -1}
15272
14
    };
15273
15274
14
    proto_bgp = proto_register_protocol("Border Gateway Protocol", "BGP", "bgp");
15275
14
    proto_register_field_array(proto_bgp, hf, array_length(hf));
15276
14
    proto_register_subtree_array(ett, array_length(ett));
15277
14
    expert_bgp = expert_register_protocol(proto_bgp);
15278
14
    expert_register_field_array(expert_bgp, ei, array_length(ei));
15279
15280
14
    bgp_module = prefs_register_protocol(proto_bgp, NULL);
15281
14
    prefs_register_bool_preference(bgp_module, "desegment",
15282
14
      "Reassemble BGP messages spanning multiple TCP segments",
15283
14
      "Whether the BGP dissector should reassemble messages spanning multiple TCP segments."
15284
14
      " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
15285
14
      &bgp_desegment);
15286
14
    prefs_register_bool_preference(bgp_module, "ext_msg",
15287
14
      "Allow BGP Extended Messages",
15288
14
      "Whether the BGP dissector should allow packets with a length exceeding 4096 octets.",
15289
14
      &bgp_ext_msg);
15290
14
    prefs_register_enum_preference(bgp_module, "asn_len",
15291
14
      "Length of the AS number",
15292
14
      "BGP dissector detect the length of the AS number in AS_PATH attributes automatically or manually (NOTE: Automatic detection is not 100% accurate)",
15293
14
      &bgp_asn_len, asn_len, false);
15294
15295
14
    bgp_handle = register_dissector("bgp", dissect_bgp, proto_bgp);
15296
14
    register_dissector("bgp.pdu", dissect_bgp_pdu, proto_bgp);
15297
14
}
15298
15299
void
15300
proto_reg_handoff_bgp(void)
15301
14
{
15302
14
    dissector_add_uint_with_preference("tcp.port", BGP_TCP_PORT, bgp_handle);
15303
14
}
15304
/*
15305
* Editor modelines - https://www.wireshark.org/tools/modelines.html
15306
*
15307
* Local variables:
15308
* c-basic-offset: 4
15309
* tab-width: 8
15310
* indent-tabs-mode: nil
15311
* End:
15312
*
15313
* ex: set shiftwidth=4 tabstop=8 expandtab:
15314
* :indentSize=4:tabSize=8:noTabs=true:
15315
*/