Coverage Report

Created: 2026-09-28 06:52

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.02k
#define BGP_MAX_PACKET_SIZE            4096
97
14.1k
#define BGP_MAX_PACKET_SIZE_EXTENDED  65535
98
108k
#define BGP_MARKER_SIZE                  16    /* size of BGP marker */
99
42.2k
#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.48k
#define BGP_MIN_NOTIFICATION_MSG_SIZE    21
103
#define BGP_MIN_KEEPALVE_MSG_SIZE       BGP_HEADER_SIZE
104
16
#define BGP_TCP_PORT                    179
105
86.7k
#define BGP_ROUTE_DISTINGUISHER_SIZE      8
106
107
/* BGP message types */
108
1.92k
#define BGP_OPEN          1
109
35.9k
#define BGP_UPDATE        2
110
16.2k
#define BGP_NOTIFICATION  3
111
831
#define BGP_KEEPALIVE     4
112
15.5k
#define BGP_ROUTE_REFRESH 5
113
1.77k
#define BGP_CAPABILITY    6
114
14.5k
#define BGP_ROUTE_REFRESH_CISCO 0x80
115
116
275k
#define BGP_SIZE_OF_PATH_ATTRIBUTE       2
117
118
119
/* attribute flags, from RFC1771 */
120
68.8k
#define BGP_ATTR_FLAG_OPTIONAL        0x80
121
68.8k
#define BGP_ATTR_FLAG_TRANSITIVE      0x40
122
68.8k
#define BGP_ATTR_FLAG_PARTIAL         0x20
123
68.8k
#define BGP_ATTR_FLAG_EXTENDED_LENGTH 0x10
124
16
#define BGP_ATTR_FLAG_UNUSED          0x0F
125
126
127
/* SSA flags */
128
#define BGP_SSA_TRANSITIVE    0x8000
129
1.60k
#define BGP_SSA_TYPE          0x7FFF
130
131
/* SSA Types */
132
480
#define BGP_SSA_L2TPv3          1
133
10
#define BGP_SSA_mGRE            2
134
139
#define BGP_SSA_IPSec           3
135
143
#define BGP_SSA_MPLS            4
136
200
#define BGP_SSA_L2TPv3_IN_IPSec 5
137
397
#define BGP_SSA_mGRE_IN_IPSec   6
138
139
/* BGP MPLS information */
140
89.3k
#define BGP_MPLS_BOTTOM_L_STACK 0x000001
141
32
#define BGP_MPLS_TRAFFIC_CLASS  0x00000E
142
64
#define BGP_MPLS_LABEL          0xFFFFF0
143
144
/* AS_PATH segment types */
145
15.3k
#define AS_SET             1   /* RFC1771 */
146
2.35k
#define AS_SEQUENCE        2   /* RFC1771 */
147
6.83k
#define AS_CONFED_SET      4   /* RFC1965 has the wrong values, corrected in  */
148
2.90k
#define AS_CONFED_SEQUENCE 3   /* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
149
150
/* BGPsec_PATH attributes */
151
5.09k
#define SEC_PATH_SEG_SIZE 6
152
153
/* OPEN message Optional Parameter types  */
154
254
#define BGP_OPTION_AUTHENTICATION    1   /* RFC1771 */
155
536
#define BGP_OPTION_CAPABILITY        2   /* RFC2842 */
156
288
#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
962
#define BGP_CAPABILITY_RESERVED                      0  /* RFC5492 */
161
425
#define BGP_CAPABILITY_MULTIPROTOCOL                 1  /* RFC2858 */
162
1.24k
#define BGP_CAPABILITY_ROUTE_REFRESH                 2  /* RFC2918 */
163
692
#define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING   3  /* RFC5291 */
164
#define BGP_CAPABILITY_MULTIPLE_ROUTE_DEST           4  /* RFC8277 Deprecated */
165
609
#define BGP_CAPABILITY_EXTENDED_NEXT_HOP             5  /* RFC5549 */
166
#define BGP_CAPABILITY_EXTENDED_MESSAGE              6  /* draft-ietf-idr-bgp-extended-messages */
167
470
#define BGP_CAPABILITY_BGPSEC                        7  /* RFC8205 */
168
#define BGP_CAPABILITY_MULTIPLE_LABELS               8  /* RFC8277 */
169
403
#define BGP_CAPABILITY_BGP_ROLE                      9  /* RFC9234 */
170
692
#define BGP_CAPABILITY_GRACEFUL_RESTART             64  /* RFC4724 */
171
424
#define BGP_CAPABILITY_4_OCTET_AS_NUMBER            65  /* RFC6793 */
172
#define BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO     66  /* Cisco Dynamic capability*/
173
410
#define BGP_CAPABILITY_DYNAMIC_CAPABILITY           67  /* draft-ietf-idr-dynamic-cap */
174
#define BGP_CAPABILITY_MULTISESSION                 68  /* draft-ietf-idr-bgp-multisession */
175
622
#define BGP_CAPABILITY_ADDITIONAL_PATHS             69  /* [RFC7911] */
176
392
#define BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH       70  /* [RFC7313] */
177
#define BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART  71  /* draft-uttaro-idr-bgp-persistence */
178
1.44k
#define BGP_CAPABILITY_CP_ORF                       72  /* [RFC7543] */
179
194
#define BGP_CAPABILITY_FQDN                         73  /* draft-walton-bgp-hostname-capability */
180
422
#define BGP_CAPABILITY_BFD_STRICT                   74  /* draft-ietf-idr-bgp-bfd-strict-mode */
181
196
#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
196
#define BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP          77  /* draft-white-linklocal-capability */
184
626
#define BGP_CAPABILITY_ROUTE_REFRESH_CISCO         128  /* Cisco, RFC8810 */
185
#define BGP_CAPABILITY_RPD_CISCO                   129  /* Cisco, RFC8810 */
186
208
#define BGP_CAPABILITY_ORF_CISCO                   130  /* Cisco, RFC8810 */
187
593
#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
196
#define BGP_ORF_COMM            0x02 /* unknown */
195
390
#define BGP_ORF_EXTCOMM         0x03 /* unknown */
196
587
#define BGP_ORF_ASPATH          0x04 /* draft-ietf-idr-aspath-orf (expired) */
197
209
#define BGP_ORF_PREFIX          0x40 /* RFC5292 */
198
195
#define BGP_ORF_CP_ORF          0x41 /* RFC7543 */
199
396
#define BGP_ORF_VPN_PREFIX      0x42 /* draft-ietf-idr-vpn-prefix-orf-06 */
200
889
#define BGP_ORF_PREFIX_CISCO    0x80 /* Cisco, same as 0x40 */
201
591
#define BGP_ORF_COMM_CISCO      0x81 /* Cisco */
202
785
#define BGP_ORF_EXTCOMM_CISCO   0x82 /* Cisco */
203
980
#define BGP_ORF_ASPATH_CISCO    0x83 /* Cisco */
204
205
/* RFC5291 */
206
2.08k
#define BGP_ORF_ACTION      0xc0
207
#define BGP_ORF_ADD         0x00
208
#define BGP_ORF_REMOVE      0x01
209
2.06k
#define BGP_ORF_REMOVEALL   0x02
210
211
16
#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.02k
#define FOURHEX0                     0x00000000
233
701
#define FOURHEXF                     0xFFFF0000
234
235
/* IANA assigned AS */
236
1.71k
#define BGP_AS_TRANS        23456
237
238
/* attribute types */
239
1.54k
#define BGPTYPE_ORIGIN               1 /* RFC4271           */
240
2.14k
#define BGPTYPE_AS_PATH              2 /* RFC4271           */
241
735
#define BGPTYPE_NEXT_HOP             3 /* RFC4271           */
242
1.30k
#define BGPTYPE_MULTI_EXIT_DISC      4 /* RFC4271           */
243
490
#define BGPTYPE_LOCAL_PREF           5 /* RFC4271           */
244
1.00k
#define BGPTYPE_ATOMIC_AGGREGATE     6 /* RFC4271           */
245
579
#define BGPTYPE_AGGREGATOR           7 /* RFC4271           */
246
826
#define BGPTYPE_COMMUNITIES          8 /* RFC1997           */
247
442
#define BGPTYPE_ORIGINATOR_ID        9 /* RFC4456           */
248
644
#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
15.3k
#define BGPTYPE_MP_REACH_NLRI       14 /* RFC4760           */
253
14.2k
#define BGPTYPE_MP_UNREACH_NLRI     15 /* RFC4760           */
254
1.44k
#define BGPTYPE_EXTENDED_COMMUNITY  16 /* RFC4360           */
255
5.89k
#define BGPTYPE_AS4_PATH            17 /* RFC 6793          */
256
2.48k
#define BGPTYPE_AS4_AGGREGATOR      18 /* RFC 6793          */
257
1.21k
#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
3.30k
#define BGPTYPE_PMSI_TUNNEL_ATTR    22 /* RFC6514 */
261
1.93k
#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
494
#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.58k
#define BGPTYPE_LINK_STATE_ATTR     29 /* RFC7752 */
268
#define BGPTYPE_30                  30 /* Deprecated [RFC8093] */
269
#define BGPTYPE_31                  31 /* Deprecated [RFC8093] */
270
602
#define BGPTYPE_LARGE_COMMUNITY     32 /* RFC8092 */
271
818
#define BGPTYPE_BGPSEC_PATH         33 /* BGPsec_PATH [RFC8205] */
272
459
#define BGPTYPE_OTC                 35 /* BGP Only to Customer [RFC9234] */
273
515
#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
404
#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
1.97k
#define BGPTYPE_BGP_PREFIX_SID      40 /* BGP Prefix-SID [RFC8669] */
278
2.89k
#define BGPTYPE_LINK_STATE_OLD_ATTR 99 /* squatted value used by at least 2
279
                                          implementations before IANA assignment */
280
1.19k
#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.72k
#define EVPN_AD_ROUTE                   1
288
4.31k
#define EVPN_MAC_ROUTE                  2
289
2.14k
#define EVPN_INC_MCAST_TREE             3
290
1.54k
#define EVPN_ETH_SEGMENT_ROUTE          4
291
3.48k
#define EVPN_IP_PREFIX_ROUTE            5  /* draft-rabadan-l2vpn-evpn-prefix-advertisement */
292
708
#define EVPN_MC_ETHER_TAG_ROUTE         6  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
293
7.37k
#define EVPN_IGMP_JOIN_ROUTE            7  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
294
6.63k
#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
46.3k
#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
16
#define EVPN_IGMP_MC_FLAG_V1                0x01
300
16
#define EVPN_IGMP_MC_FLAG_V2                0x02
301
16
#define EVPN_IGMP_MC_FLAG_V3                0x04
302
16
#define EVPN_IGMP_MC_FLAG_IE                0x08
303
16
#define EVPN_IGMP_MC_FLAG_RESERVED          0xF0
304
305
/* NLRI type as define in BGP flow spec RFC */
306
1.22k
#define BGPNLRI_FSPEC_DST_PFIX      1 /* RFC 5575         */
307
1.02k
#define BGPNLRI_FSPEC_SRC_PFIX      2 /* RFC 5575         */
308
303
#define BGPNLRI_FSPEC_IP_PROTO      3 /* RFC 5575         */
309
324
#define BGPNLRI_FSPEC_PORT          4 /* RFC 5575         */
310
263
#define BGPNLRI_FSPEC_DST_PORT      5 /* RFC 5575         */
311
3.61k
#define BGPNLRI_FSPEC_SRC_PORT      6 /* RFC 5575         */
312
370
#define BGPNLRI_FSPEC_ICMP_TP       7 /* RFC 5575         */
313
240
#define BGPNLRI_FSPEC_ICMP_CD       8 /* RFC 5575         */
314
1.73k
#define BGPNLRI_FSPEC_TCP_FLAGS     9 /* RFC 5575         */
315
273
#define BGPNLRI_FSPEC_PCK_LEN      10 /* RFC 5575         */
316
1.17k
#define BGPNLRI_FSPEC_DSCP         11 /* RFC 5575         */
317
932
#define BGPNLRI_FSPEC_FRAGMENT     12 /* RFC 5575         */
318
319
/* BGP flow spec NLRI operator bitmask */
320
389k
#define BGPNLRI_FSPEC_END_OF_LST         0x80
321
395k
#define BGPNLRI_FSPEC_AND_BIT            0x40
322
16
#define BGPNLRI_FSPEC_VAL_LEN            0x30
323
16
#define BGPNLRI_FSPEC_UNUSED_BIT4        0x08
324
16
#define BGPNLRI_FSPEC_UNUSED_BIT5        0x04
325
395k
#define BGPNLRI_FSPEC_LESS_THAN          0x04
326
395k
#define BGPNLRI_FSPEC_GREATER_THAN       0x02
327
395k
#define BGPNLRI_FSPEC_EQUAL              0x01
328
16
#define BGPNLRI_FSPEC_TCPF_NOTBIT        0x02
329
16
#define BGPNLRI_FSPEC_TCPF_MATCHBIT      0x01
330
32
#define BGPNLRI_FSPEC_DSCP_BITMASK       0x3F
331
332
/* BGP flow spec specific filter value: TCP flags, Packet fragment ... */
333
254k
#define BGPNLRI_FSPEC_TH_FIN  0x01
334
254k
#define BGPNLRI_FSPEC_TH_SYN  0x02
335
254k
#define BGPNLRI_FSPEC_TH_RST  0x04
336
254k
#define BGPNLRI_FSPEC_TH_PUSH 0x08
337
254k
#define BGPNLRI_FSPEC_TH_ACK  0x10
338
254k
#define BGPNLRI_FSPEC_TH_URG  0x20
339
16
#define BGPNLRI_FSPEC_TH_ECN  0x40
340
16
#define BGPNLRI_FSPEC_TH_CWR  0x80
341
342
7.70k
#define BGPNLRI_FSPEC_FG_DF   0x01
343
7.70k
#define BGPNLRI_FSPEC_FG_ISF  0x02
344
7.70k
#define BGPNLRI_FSPEC_FG_FF   0x04
345
7.70k
#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
16
#define BGP_EXT_COM_TYPE_AUTH               0x80    /* FCFS or Standard/Early/Experimental allocated */
355
16
#define BGP_EXT_COM_TYPE_TRAN               0x40    /* Non-transitive or Transitive */
356
357
465
#define BGP_EXT_COM_TYPE_HIGH_TR_AS2        0x00    /* Transitive Two-Octet AS-Specific Extended Community */
358
232
#define BGP_EXT_COM_TYPE_HIGH_TR_IP4        0x01    /* Transitive IPv4-Address-specific Extended Community */
359
92
#define BGP_EXT_COM_TYPE_HIGH_TR_AS4        0x02    /* Transitive Four-Octet AS-Specific Extended Community */
360
522
#define BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE     0x03    /* Transitive Opaque Extended Community */
361
77
#define BGP_EXT_COM_TYPE_HIGH_TR_QOS        0x04    /* QoS Marking [Thomas_Martin_Knoll] */
362
107
#define BGP_EXT_COM_TYPE_HIGH_TR_COS        0x05    /* CoS Capability [Thomas_Martin_Knoll] */
363
504
#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
1
#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
468
#define BGP_EXT_COM_TYPE_HIGH_TR_MUP        0x0c    /* Transitive MUP Extended Community */
370
692
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT        0x80    /* Generic Transitive Extended Community [RFC7153][RFC9184] */
371
140
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT_2      0x81    /* Generic Transitive Extended Community Part 2 [RFC8955][RFC9184] */
372
150
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT_3      0x82    /* Generic Transitive Extended Community Part 3 [RFC8955][RFC9184] */
373
940
#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
146
#define BGP_EXT_COM_TYPE_HIGH_NTR_AS2       0x40    /* Non-Transitive Two-Octet AS-Specific Extended Community [RFC7153] */
381
66
#define BGP_EXT_COM_TYPE_HIGH_NTR_IP4       0x41    /* Non-Transitive IPv4-Address-specific Extended Community [RFC7153] */
382
66
#define BGP_EXT_COM_TYPE_HIGH_NTR_AS4       0x42    /* Non-Transitive Four-Octet AS-Specific Extended Community [RFC7153] */
383
147
#define BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE    0x43    /* Non-Transitive Opaque Extended Community [RFC7153] */
384
143
#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
68
#define BGP_EXT_COM_STYPE_EVPN_MMAC         0x00    /* MAC Mobility [draft-ietf-l2vpn-pbb-evpn] */
390
69
#define BGP_EXT_COM_STYPE_EVPN_LABEL        0x01    /* ESI MPLS Label [draft-ietf-l2vpn-evpn] */
391
75
#define BGP_EXT_COM_STYPE_EVPN_IMP          0x02    /* ES Import [draft-sajassi-l2vpn-evpn-segment-route] */
392
91
#define BGP_EXT_COM_STYPE_EVPN_ROUTERMAC    0x03    /* draft-sajassi-l2vpn-evpn-inter-subnet-forwarding */
393
67
#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
84
#define BGP_EXT_COM_EVPN_MMAC_STICKY        0x01    /* Bitmask: Set for sticky/static MAC address */
413
414
/* RFC 8214 Flags EVPN L2 Attributes */
415
16
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_B         0x0001  /* Backup PE */
416
16
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_P         0x0002  /* Primary PE */
417
16
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_C         0x0004  /* Control word required */
418
/* draft-yu-bess-evpn-l2-attributes-04 */
419
16
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_F         0x0008  /* Send and receive flow label */
420
16
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI        0x0010  /* CWI extended community can be included */
421
16
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED  0xFFE0  /* Reserved */
422
423
/* RFC 8317 Flags EVPN E-Tree Attributes */
424
16
#define BGP_EXT_COM_EVPN_ETREE_FLAG_L         0x01  /* Leaf-Indication */
425
16
#define BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED  0xFE  /* Reserved */
426
427
/* EPVN route AD NLRI ESI type */
428
1.92k
#define BGP_NLRI_EVPN_ESI_VALUE             0x00    /* ESI type 0, 9 bytes integer */
429
401
#define BGP_NLRI_EVPN_ESI_LACP              0x01    /* ESI type 1, LACP 802.1AX */
430
447
#define BGP_NLRI_EVPN_ESI_MSTP              0x02    /* ESI type 2, MSTP defined ESI */
431
553
#define BGP_NLRI_EVPN_ESI_MAC               0x03    /* ESI type 3, MAC allocated value */
432
4.35k
#define BGP_NLRI_EVPN_ESI_RID               0x04    /* ESI type 4, Router ID as ESI */
433
323
#define BGP_NLRI_EVPN_ESI_ASN               0x05    /* ESI type 5, ASN as ESI */
434
444
#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
67
#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
66
#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
67
#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
2
#define BGP_EXT_COM_STYPE_OPA_COLOR     0x0b    /* Color Extended Community [RFC5512] */
501
304
#define BGP_EXT_COM_STYPE_OPA_ENCAP     0x0c    /* Encapsulation Extended Community [RFC5512] */
502
3
#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
308
#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
6.46k
#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.05k
#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
146
#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_AS2    0x00 /* Direct Segment, 2-Octet AS Specific */
564
66
#define BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_IP4    0x01 /* Direct Segment, IPv4 Address Specific */
565
66
#define BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_AS4    0x02 /* Direct Segment, 4-Octet AS Specific */
566
132
#define BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_AS2 0x03 /* Interwork Segment, 2-Octet AS Specific */
567
132
#define BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_IP4 0x04 /* Interwork Segment, IPv4 Address Specific */
568
132
#define BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_AS4 0x05 /* Interwork Segment, 4-Octet AS Specific */
569
570
/* BGP Generic Transitive Experimental Use Extended Community Sub-Types */
571
572
78
#define BGP_EXT_COM_STYPE_EXP_OSPF_RT   0x00    /* OSPF Route Type, deprecated [RFC4577] */
573
66
#define BGP_EXT_COM_STYPE_EXP_OSPF_RID  0x01    /* OSPF Router ID, deprecated [RFC4577] */
574
#define BGP_EXT_COM_STYPE_EXP_SEC_GROUP 0x04    /* Security Group [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#security-group] */
575
68
#define BGP_EXT_COM_STYPE_EXP_OSPF_DID  0x05    /* OSPF Domain ID, deprecated [RFC4577] */
576
66
#define BGP_EXT_COM_STYPE_EXP_F_TR      0x06    /* Flow spec traffic-rate [RFC5575] */
577
68
#define BGP_EXT_COM_STYPE_EXP_F_TA      0x07    /* Flow spec traffic-action [RFC5575] */
578
66
#define BGP_EXT_COM_STYPE_EXP_F_RED     0x08    /* Flow spec redirect [RFC5575] */
579
76
#define BGP_EXT_COM_STYPE_EXP_F_RMARK   0x09    /* Flow spec traffic-remarking [RFC5575] */
580
67
#define BGP_EXT_COM_STYPE_EXP_L2        0x0a    /* Layer2 Info Extended Community [RFC4761] */
581
69
#define BGP_EXT_COM_STYPE_EXP_ETREE     0x0b    /* E-Tree Info [RFC7796] */
582
#define BGP_EXT_COM_STYPE_EXP_FLOW_RATE 0x0c    /* Flow spec traffic-rate-packets [RFC8955] */
583
#define BGP_EXT_COM_STYPE_EXP_FLOW_SFC  0x0d    /* Flow Specification for SFC Classifiers [RFC9015] */
584
#define BGP_EXT_COM_STYPE_EXP_TAG       0x84    /* Tag [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#tag] */
585
#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] */
586
587
/* BGP Generic Transitive Experimental Use Extended Community Part 2 */
588
589
66
#define BGP_EXT_COM_STYPE_EXP_2_FLOW_RED 0x08
590
591
/* BGP Generic Transitive Experimental Use Extended Community Part 3 */
592
593
#define BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP 0x04
594
66
#define BGP_EXT_COM_STYPE_EXP_3_FLOW_RED  0x08
595
#define BGP_EXT_COM_STYPE_EXP_3_TAG4      0x84
596
#define BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS  0x85
597
598
/* BGP Transitive Experimental EIGRP route attribute Sub-Types */
599
600
306
#define BGP_EXT_COM_STYPE_EXP_EIGRP_FT  0x00    /* Route Flags, Route Tag */
601
71
#define BGP_EXT_COM_STYPE_EXP_EIGRP_AD  0x01    /* ASN, Delay */
602
172
#define BGP_EXT_COM_STYPE_EXP_EIGRP_RHB 0x02    /* Reliability, Hop Count, Bandwidth */
603
66
#define BGP_EXT_COM_STYPE_EXP_EIGRP_LM  0x03    /* Load, MTU */
604
68
#define BGP_EXT_COM_STYPE_EXP_EIGRP_EAR 0x04    /* External ASN, RID of the redistributing router */
605
102
#define BGP_EXT_COM_STYPE_EXP_EIGRP_EPM 0x05    /* External Protocol ID, metric */
606
66
#define BGP_EXT_COM_STYPE_EXP_EIGRP_RID 0x06    /* Originating EIGRP Router ID of the route */
607
608
628
#define BGP_EXT_COM_EXP_EIGRP_FLAG_RT   0x8000  /* Route flag - Internal/External */
609
610
611
/* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
612
613
                                        /* RFC 4360 */
614
194
#define BGP_EXT_COM_RT_AS2        0x0002  /* Route Target,Format AS(2bytes):AN(4bytes) */
615
194
#define BGP_EXT_COM_RT_IP4        0x0102  /* Route Target,Format IP address:AN(2bytes) */
616
204
#define BGP_EXT_COM_RT_AS4        0x0202  /* Route Target,Format AS(4bytes):AN(2bytes) */
617
618
/* extended community option flow flec action bit S and T */
619
84
#define BGP_EXT_COM_FSPEC_ACT_S 0x02
620
84
#define BGP_EXT_COM_FSPEC_ACT_T 0x01
621
622
/* extended community l2vpn flags */
623
624
16
#define BGP_EXT_COM_L2_FLAG_D     0x80
625
16
#define BGP_EXT_COM_L2_FLAG_Z1    0x40
626
16
#define BGP_EXT_COM_L2_FLAG_F     0x20
627
16
#define BGP_EXT_COM_L2_FLAG_Z345  0x1c
628
16
#define BGP_EXT_COM_L2_FLAG_C     0x02
629
16
#define BGP_EXT_COM_L2_FLAG_S     0x01
630
631
/* extended community E-Tree Info flags */
632
633
16
#define BGP_EXT_COM_ETREE_FLAG_RESERVED   0xFFFC
634
16
#define BGP_EXT_COM_ETREE_FLAG_P          0x0002
635
16
#define BGP_EXT_COM_ETREE_FLAG_V          0x0001
636
637
/* Extended community QoS Marking technology type */
638
#define QOS_TECH_TYPE_DSCP         0x00  /* DiffServ enabled IP (DSCP encoding) */
639
#define QOS_TECH_TYPE_802_1q       0x01  /* Ethernet using 802.1q priority tag */
640
#define QOS_TECH_TYPE_E_LSP        0x02  /* MPLS using E-LSP */
641
#define QOS_TECH_TYPE_VC           0x03  /* Virtual Channel (VC) encoding using separate channels for */
642
                                         /* QoS forwarding / one channel per class (e.g. ATM VCs, FR  */
643
                                         /* VCs, MPLS L-LSPs) */
644
#define QOS_TECH_TYPE_GMPLS_TIME   0x04   /* GMPLS - time slot encoding */
645
#define QOS_TECH_TYPE_GMPLS_LAMBDA 0x05  /* GMPLS - lambda encoding */
646
#define QOS_TECH_TYPE_GMPLS_FIBRE  0x06  /* GMPLS - fibre encoding */
647
648
/* OSPF codes for  BGP_EXT_COM_OSPF_RTYPE draft-rosen-vpns-ospf-bgp-mpls  */
649
#define BGP_OSPF_RTYPE_RTR      1 /* OSPF Router LSA */
650
#define BGP_OSPF_RTYPE_NET      2 /* OSPF Network LSA */
651
#define BGP_OSPF_RTYPE_SUM      3 /* OSPF Summary LSA */
652
#define BGP_OSPF_RTYPE_EXT      5 /* OSPF External LSA, note that ASBR doesn't apply to MPLS-VPN */
653
#define BGP_OSPF_RTYPE_NSSA     7 /* OSPF NSSA External*/
654
#define BGP_OSPF_RTYPE_SHAM     129 /* OSPF-MPLS-VPN Sham link */
655
161
#define BGP_OSPF_RTYPE_METRIC_TYPE 0x1 /* Type-1 (clear) or Type-2 (set) external metric */
656
657
/* Extended community & Route distinguisher formats */
658
3.48k
#define FORMAT_AS2_LOC      0x00    /* Format AS(2bytes):AN(4bytes) */
659
1.43k
#define FORMAT_IP_LOC       0x01    /* Format IP address:AN(2bytes) */
660
1.22k
#define FORMAT_AS4_LOC      0x02    /* Format AS(4bytes):AN(2bytes) */
661
662
/* RFC 4760 subsequent address family numbers (last updated 2024-03-19)
663
 * https://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml
664
 */
665
25.9k
#define SAFNUM_UNICAST          1  /* RFC4760 */
666
81.9k
#define SAFNUM_MULCAST          2  /* RFC4760 */
667
113k
#define SAFNUM_UNIMULC          3  /* Deprecated, see RFC4760 */
668
5.52k
#define SAFNUM_MPLS_LABEL       4  /* RFC8277 */
669
13.4k
#define SAFNUM_MCAST_VPN        5  /* RFC6514 */
670
#define SAFNUM_MULTISEG_PW      6  /* RFC7267 */
671
4.97k
#define SAFNUM_ENCAPSULATION    7  /* RFC5512, obsolete and never deployed, see draft-ietf-idr-tunnel-encaps-22 */
672
#define SAFNUM_MCAST_VPLS       8  /* RFC7117 */
673
#define SAFNUM_BGP_SFC          9  /* RFC9015 */
674
3.57k
#define SAFNUM_TUNNEL          64  /* draft-nalawade-kapoor-tunnel-safi-05.txt (Expired) */
675
938
#define SAFNUM_VPLS            65  /* RFC4761, RFC6074 */
676
658
#define SAFNUM_MDT             66  /* RFC6037 */
677
#define SAFNUM_4OVER6          67  /* RFC5747 */
678
#define SAFNUM_6OVER4          68  /* Never specified? Cf. RFC5747 */
679
#define SAFNUM_L1VPN           69  /* RFC5195 */
680
21.9k
#define SAFNUM_EVPN            70  /* RFC7432 */
681
44.2k
#define SAFNUM_BGP_LS          71  /* RFC7752 */
682
11.2k
#define SAFNUM_BGP_LS_VPN      72  /* RFC7752 */
683
2.99k
#define SAFNUM_SR_POLICY       73  /* draft-ietf-idr-segment-routing-te-policy-11 */
684
#define SAFNUM_SD_WAN          74  /* draft-dunbar-idr-sdwan-port-safi-06, expired */
685
#define SAFNUM_RPD             75  /* draft-ietf-idr-rpd-10 */
686
#define SAFNUM_CT              76  /* draft-kaliraj-idr-bgp-classful-transport-planes-07 */
687
#define SAFNUM_FLOWSPEC        77  /* draft-ietf-idr-flowspec-nvo3-13 */
688
#define SAFNUM_MCAST_TREE      78  /* draft-ietf-bess-bgp-multicast-03 */
689
#define SAFNUM_BGP_DPS         79  /* https://www.arista.com/en/cg-veos-router/veos-router-dynamic-path-selection */
690
#define SAFNUM_BGP_LS_SPF      80  /* draft-ietf-lsvr-bgp-spf-15 */
691
#define SAFNUM_BGP_CAR         83  /* draft-ietf-idr-bgp-car-05 */
692
#define SAFNUM_BGP_VPN_CAR     84  /* draft-ietf-idr-bgp-car-05 */
693
181k
#define SAFNUM_BGP_MUP         85  /* draft-ietf-bess-mup-safi-01 */
694
25.9k
#define SAFNUM_LAB_VPNUNICAST 128  /* RFC4364, RFC8277 */
695
5.56k
#define SAFNUM_LAB_VPNMULCAST 129  /* RFC6513, RFC6514 */
696
7.11k
#define SAFNUM_LAB_VPNUNIMULC 130  /* Obsolete and reserved, see RFC4760 */
697
4.00k
#define SAFNUM_ROUTE_TARGET   132  /* RFC 4684 Constrained Route Distribution for BGP/MPLS IP VPN */
698
11.4k
#define SAFNUM_FSPEC_RULE     133  /* RFC 8955 BGP flow spec SAFI */
699
89.0k
#define SAFNUM_FSPEC_VPN_RULE 134  /* RFC 8955 BGP flow spec SAFI VPN */
700
#define SAFNUM_L3VPN          140  /* Withdrawn, draft-ietf-l3vpn-bgpvpn-auto-09 */
701
702
/* BGP Additional Paths Capability */
703
#define BGP_ADDPATH_RECEIVE  0x01
704
#define BGP_ADDPATH_SEND     0x02
705
706
/* mcast-vpn route types RFC 6514 */
707
1.31k
#define MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD 1
708
1.14k
#define MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD 2
709
1.20k
#define MCAST_VPN_RTYPE_SPMSI_AD          3
710
426
#define MCAST_VPN_RTYPE_LEAF_AD           4
711
827
#define MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD  5
712
548
#define MCAST_VPN_RTYPE_SHARED_TREE_JOIN  6
713
1.47k
#define MCAST_VPN_RTYPE_SOURCE_TREE_JOIN  7
714
715
/* RFC 5512 Tunnel Types */
716
6.32k
#define TUNNEL_TYPE_L2TP_OVER_IP      1
717
6.48k
#define TUNNEL_TYPE_GRE               2
718
#define TUNNEL_TYPE_TTE               3
719
#define TUNNEL_TYPE_IPSEC_IN_TM       4
720
#define TUNNEL_TYPE_IP_IN_IP_IPSEC    5
721
#define TUNNEL_TYPE_MPLS_IN_IP_IPSEC  6
722
#define TUNNEL_TYPE_IP_IN_IP          7
723
1.86k
#define TUNNEL_TYPE_VXLAN             8
724
1.38k
#define TUNNEL_TYPE_NVGRE             9
725
#define TUNNEL_TYPE_MPLS             10
726
2.24k
#define TUNNEL_TYPE_MPLS_IN_GRE      11
727
1.59k
#define TUNNEL_TYPE_VXLAN_GPE        12
728
#define TUNNEL_TYPE_MPLS_IN_UDP      13
729
#define TUNNEL_TYPE_IPV6_TUNNEL      14
730
#define TUNNEL_TYPE_SR_TE_POLICY     15
731
#define TUNNEL_TYPE_BARE             16
732
#define TUNNEL_TYPE_SR_TUNNEL        17
733
#define TUNNEL_TYPE_CLOUD_SECURITY   18
734
#define TUNNEL_TYPE_GENEVE_ENCAP     19
735
#define TUNNEL_TYPE_ANY_ENCAP        20
736
#define TUNNEL_TYPE_GTP_TUNNEL_TYPE  21
737
#define TUNNEL_TYPE_DPS_TUNNEL_ENCAP 22
738
#define TUNNEL_TYPE_ORIGINATING_PE   23
739
#define TUNNEL_TYPE_DPS_POLICY       24
740
#define TUNNEL_TYPE_SDWAN_HYBRID     25
741
#define TUNNEL_TYPE_X_OVER_UDP       26
742
#define TUNNEL_TYPE_DES_TUNNEL_ENCAP 27
743
744
745
/*RFC 6514 PMSI Tunnel Types */
746
69
#define PMSI_TUNNEL_NOPRESENT           0
747
196
#define PMSI_TUNNEL_RSVPTE_P2MP         1
748
529
#define PMSI_TUNNEL_MLDP_P2MP           2
749
195
#define PMSI_TUNNEL_PIMSSM              3
750
195
#define PMSI_TUNNEL_PIMSM               4
751
195
#define PMSI_TUNNEL_BIDIR_PIM           5
752
218
#define PMSI_TUNNEL_INGRESS             6
753
920
#define PMSI_TUNNEL_MLDP_MP2MP          7
754
#define PMSI_TUNNEL_TRANPORT            8
755
#define PMSI_TUNNEL_ASS_REPLIC          9
756
#define PMSI_TUNNEL_BIER                11
757
#define PMSI_TUNNEL_SR_MPLS_P2MP        12
758
759
/* RFC 6388, RFC 6826, RFC 6512, RFC 7246, RFC 7442, RFC 8338 */
760
#define PMSI_MLDP_FEC_TYPE_RSVD                     0
761
920
#define PMSI_MLDP_FEC_TYPE_GEN_LSP                  1
762
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SRC         3
763
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SRC         4
764
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_BIDIR       5
765
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_BIDIR       6
766
#define PMSI_MLDP_FEC_TYPE_RECURSE_OPAQUE_VALUE     7
767
#define PMSI_MLDP_FEC_TYPE_VPN_RECURSE_OPAQUE_VALUE 8
768
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_BIDIR      9
769
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_BIDIR      10
770
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SHARED_TREE 11
771
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SHARED_TREE 12
772
#define PMSI_MLDP_FEC_TYPE_L2VPN_MCAST              13
773
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_SRC        250
774
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_SRC        251
775
510
#define PMSI_MLDP_FEC_TYPE_EXT_TYPE                 255
776
777
#define PMSI_MLDP_FEC_ETYPE_RSVD                    0
778
779
/* RFC 7311 AIGP types */
780
291
#define AIGP_TLV_TYPE           1
781
782
/* RFC 9012 (RFC 5512/5640) Sub-TLV Types */
783
2.64k
#define TUNNEL_SUBTLV_ENCAPSULATION     1
784
698
#define TUNNEL_SUBTLV_PROTO_TYPE        2
785
#define TUNNEL_SUBTLV_IPSEC_TA          3
786
1.20k
#define TUNNEL_SUBTLV_COLOR             4
787
1.84k
#define TUNNEL_SUBTLV_LOAD_BALANCE      5
788
#define TUNNEL_SUBTLV_REMOTE_ENDPOINT   6
789
#define TUNNEL_SUBTLV_IPV4_DS_FIELD     7
790
#define TUNNEL_SUBTLV_UDP_DST_PORT      8
791
#define TUNNEL_SUBTLV_EMBEDDED_LABEL    9
792
#define TUNNEL_SUBTLV_MPLS_LABEL        10
793
#define TUNNEL_SUBTLV_PREFIX_SID        11
794
210
#define TUNNEL_SUBTLV_PREFERENCE        12
795
1.01k
#define TUNNEL_SUBTLV_BINDING_SID       13
796
209
#define TUNNEL_SUBTLV_ENLP              14
797
470
#define TUNNEL_SUBTLV_PRIORITY          15
798
799
#define TUNNEL_SUBTLV_SPI_SI_REP        16
800
801
281
#define TUNNEL_SUBTLV_SRV6_BINDING_SID  20
802
803
#define TUNNEL_SUBTLV_IPSEC_SA_ID       64
804
#define TUNNEL_SUBTLV_EXT_PORT_PROP     65
805
#define TUNNEL_SUBTLV_UNDERLAY_ISP_PROP 66
806
#define TUNNEL_SUBTLV_IPSEC_SA_NONCE    67
807
#define TUNNEL_SUBTLV_IPSEC_PUBLIC_KEY  68
808
#define TUNNEL_SUBTLV_IPSEC_SA_PROPOSAL 69
809
#define TUNNEL_SUBTLV_SIMPL_IPSEC_SA    70
810
811
#define TUNNEL_SUBTLV_NRP               123
812
#define TUNNEL_SUBTLV_RPF               124
813
#define TUNNEL_SUBTLV_TREE_LABEL_STACK  125
814
815
1.58k
#define TUNNEL_SUBTLV_SEGMENT_LIST      128
816
201
#define TUNNEL_SUBTLV_POLICY_CP_NAME    129
817
337
#define TUNNEL_SUBTLV_POLICY_NAME       130
818
819
#define TUNNEL_SUBTLV_WAN_ID            192
820
#define TUNNEL_SUBTLV_BYTES             193
821
#define TUNNEL_SUBTLV_IPSEC_DIM         194
822
#define TUNNEL_SUBTLV_IPSEC_KEY_EXCH    195
823
#define TUNNEL_SUBTLV_IPSEC_SA_PROPS    196
824
#define TUNNEL_SUBTLV_SRV_SEGMENT_LIST  197
825
#define TUNNEL_SUBTLV_SRV_VTEP          198
826
#define TUNNEL_SUBTLV_DES_ADJACENCY     199
827
828
829
/* BGP Tunnel SubTLV VXLAN Flags bitmask */
830
16
#define TUNNEL_SUBTLV_VXLAN_VALID_VNID          0x80
831
16
#define TUNNEL_SUBTLV_VXLAN_VALID_MAC           0x40
832
16
#define TUNNEL_SUBTLV_VXLAN_RESERVED            0x3F
833
834
/* BGP Tunnel SubTLV VXLAN GPE Flags bitmask */
835
16
#define TUNNEL_SUBTLV_VXLAN_GPE_VERSION         0xC0
836
16
#define TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID      0x20
837
16
#define TUNNEL_SUBTLV_VXLAN_GPE_RESERVED        0x1F
838
839
/* BGP Tunnel SubTLV NVGRE Flags bitmask */
840
16
#define TUNNEL_SUBTLV_NVGRE_VALID_VNID          0x80
841
16
#define TUNNEL_SUBTLV_NVGRE_VALID_MAC           0x40
842
16
#define TUNNEL_SUBTLV_NVGRE_RESERVED            0x3F
843
844
/* BGP Tunnel SubTLV Binding SID Flags bitmask */
845
16
#define TUNNEL_SUBTLV_BINDING_SPECIFIED         0x80
846
16
#define TUNNEL_SUBTLV_BINDING_INVALID           0x40
847
16
#define TUNNEL_SUBTLV_BINDING_RESERVED          0x3F
848
849
/* BGP Tunnel SubTLV SRv6 Binding SID Flags bitmask - RFC 9830 Section 2.4.3 */
850
16
#define TUNNEL_SUBTLV_SRV6_BINDING_SPECIFIED    0x80
851
16
#define TUNNEL_SUBTLV_SRV6_BINDING_INVALID      0x40
852
16
#define TUNNEL_SUBTLV_SRV6_BINDING_B_FLAG       0x20
853
16
#define TUNNEL_SUBTLV_SRV6_BINDING_RESERVED     0x1F
854
855
/* BGP Segment List SubTLV Types - RFC 9830, RFC 9831 */
856
614
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A         1
857
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B_OLD     2  /* Deprecated - see Type 13 below */
858
314
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C         3
859
324
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D         4
860
434
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E         5
861
314
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F         6
862
270
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G         7
863
292
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H         8
864
239
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT    9
865
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I_OLD    10 /* Deprecated - see Type 14 below */
866
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J_OLD    11 /* Deprecated - see Type 15 below */
867
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K_OLD    12 /* Deprecated - see Type 16 below */
868
296
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B        13
869
360
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I        14
870
336
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J        15
871
362
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K        16
872
873
/* BGP Tunnel SubTLV Segment List SubTLV Flags bitmask - RFC 9830 Section 2.4.4.2.3 & RFC 9831 Section 2.10 */
874
16
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION      0x80  /* V-Flag (bit 0) - RFC 9830 */
875
16
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM         0x40  /* A-Flag (bit 1) - RFC 9831 */
876
16
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_S_FLAG            0x20  /* S-Flag (bit 2) - RFC 9831 */
877
16
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_B_FLAG            0x10  /* B-Flag (bit 3) - RFC 9830 */
878
16
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED          0x0F  /* Reserved bits (bits 4,5,6,7) */
879
880
/* Link-State NLRI types */
881
466
#define LINK_STATE_NODE_NLRI                    1
882
3.70k
#define LINK_STATE_LINK_NLRI                    2
883
1.48k
#define LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI    3
884
4.44k
#define LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI    4
885
#define LINK_STATE_SR_POLICY_CANDIDATE_PATH     5
886
3.89k
#define LINK_STATE_SRV6_SID_NLRI                6
887
#define LINK_STATE_STUB_LINK_NLRI               7
888
889
890
/* Link-State NLRI Protocol-ID values */
891
2.00k
#define BGP_LS_NLRI_PROTO_ID_UNKNOWN       0
892
4.34k
#define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 1
893
1.58k
#define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2 2
894
6.50k
#define BGP_LS_NLRI_PROTO_ID_OSPF_V2       3
895
#define BGP_LS_NLRI_PROTO_ID_DIRECT        4
896
#define BGP_LS_NLRI_PROTO_ID_STATIC        5
897
5.07k
#define BGP_LS_NLRI_PROTO_ID_OSPF_V3       6
898
#define BGP_LS_NLRI_PROTO_ID_BGP           7
899
#define BGP_LS_NLRI_PROTO_ID_RSVP_TE       8
900
#define BGP_LS_NLRI_PROTO_ID_SEGMENT_ROUTING 9
901
902
/* Link-State routing universes */
903
#define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3     0
904
#define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1     1
905
906
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN    0
907
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA 1
908
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA 2
909
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1 3
910
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2 4
911
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1     5
912
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2     6
913
914
/* RFC7752 */
915
8.80k
#define BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS         256
916
2.96k
#define BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS        257
917
1.18k
#define BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS  258
918
470
#define BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS         259
919
474
#define BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS          260
920
846
#define BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS         261
921
220
#define BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS          262
922
5.54k
#define BGP_NLRI_TLV_MULTI_TOPOLOGY_ID              263
923
978
#define BGP_NLRI_TLV_OSPF_ROUTE_TYPE                264
924
1.05k
#define BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION    265
925
956
#define BGP_NLRI_TLV_NODE_MSD                       266
926
627
#define BGP_NLRI_TLV_LINK_MSD                       267
927
928
496
#define BGP_NLRI_TLV_AUTONOMOUS_SYSTEM              512
929
361
#define BGP_NLRI_TLV_BGP_LS_IDENTIFIER              513
930
281
#define BGP_NLRI_TLV_AREA_ID                        514
931
200
#define BGP_NLRI_TLV_IGP_ROUTER_ID                  515
932
214
#define BGP_NLRI_TLV_BGP_ROUTER_ID                  516
933
217
#define BGP_NLRI_TLV_BGP_CONFEDERATION_MEMBER       517
934
198
#define BGP_NLRI_TLV_SRV6_SID_INFO                  518
935
936
91.5k
#define BGP_NLRI_TLV_NODE_FLAG_BITS                 1024
937
224
#define BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES         1025
938
198
#define BGP_NLRI_TLV_NODE_NAME                      1026
939
194
#define BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER          1027
940
566
#define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE   1028
941
422
#define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE   1029
942
449
#define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE  1030
943
519
#define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE  1031
944
945
1.10k
#define BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR     1088
946
467
#define BGP_NLRI_TLV_MAX_LINK_BANDWIDTH             1089
947
3.26k
#define BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH  1090
948
39.8k
#define BGP_NLRI_TLV_UNRESERVED_BANDWIDTH           1091
949
599
#define BGP_NLRI_TLV_TE_DEFAULT_METRIC              1092
950
405k
#define BGP_NLRI_TLV_LINK_PROTECTION_TYPE           1093
951
660
#define BGP_NLRI_TLV_MPLS_PROTOCOL_MASK             1094
952
2.00k
#define BGP_NLRI_TLV_METRIC                         1095
953
36.7k
#define BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP         1096
954
354
#define BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE          1097
955
194
#define BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE            1098
956
957
786
#define BGP_NLRI_TLV_IGP_FLAGS                      1152
958
688
#define BGP_NLRI_TLV_ROUTE_TAG                      1153
959
691
#define BGP_NLRI_TLV_EXTENDED_TAG                   1154
960
437
#define BGP_NLRI_TLV_PREFIX_METRIC                  1155
961
604
#define BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS        1156
962
234
#define BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE        1157
963
610
#define BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP  1173
964
965
966
/* Link-State NLRI TLV lengths */
967
772
#define BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM              4
968
611
#define BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER              4
969
496
#define BGP_NLRI_TLV_LEN_AREA_ID                        4
970
2.63k
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID                 4
971
2.68k
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID                 16
972
938
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE   BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
973
844
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE   BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
974
704
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE  BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
975
1.03k
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE  BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
976
1.59k
#define BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS  8
977
738
#define BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS         4
978
342
#define BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS          4
979
980
#define BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS         16
980
242
#define BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS          16
981
9.24k
#define BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID              2
982
1.34k
#define BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR     4
983
679
#define BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH             4
984
3.49k
#define BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH  4
985
40.1k
#define BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH           32
986
2.39k
#define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD          3
987
1.00k
#define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW          4
988
410k
#define BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE           2
989
910
#define BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK             1
990
2.20k
#define BGP_NLRI_TLV_LEN_MAX_METRIC                     3
991
587
#define BGP_NLRI_TLV_LEN_IGP_FLAGS                      1
992
680
#define BGP_NLRI_TLV_LEN_PREFIX_METRIC                  4
993
111k
#define BGP_NLRI_TLV_LEN_NODE_FLAG_BITS                 1
994
995
/* rfc9085 */
996
/* draft-ietf-idr-bgpls-srv6-ext-14 */
997
619
#define BGP_LS_SR_TLV_SR_CAPABILITY                 1034
998
413
#define BGP_LS_SR_TLV_SR_ALGORITHM                  1035
999
664
#define BGP_LS_SR_TLV_SR_LOCAL_BLOCK                1036
1000
801
#define BGP_LS_SR_TLV_SRV6_CAPABILITY               1038
1001
29.9k
#define BGP_LS_SR_TLV_FLEX_ALGO_DEF                 1039
1002
1.68k
#define BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY    1040
1003
1.92k
#define BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY    1041
1004
1.28k
#define BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY    1042
1005
392
#define BGP_LS_SR_TLV_FLEX_ALGO_DEF_FLAGS           1043
1006
405
#define BGP_LS_SR_TLV_FLEX_ALGO_PREFIX_METRIC       1044
1007
29.2k
#define BGP_LS_SR_TLV_FLEX_ALGO_EXC_SRLG            1045
1008
792
#define BGP_LS_SR_TLV_ADJ_SID                       1099
1009
195
#define BGP_LS_SR_TLV_LAN_ADJ_SID                   1100
1010
1.36k
#define BGP_LS_SR_TLV_PEER_NODE_SID                 1101
1011
1.47k
#define BGP_LS_SR_TLV_PEER_ADJ_SID                  1102
1012
1.06k
#define BGP_LS_SR_TLV_PEER_SET_SID                  1103
1013
620
#define BGP_LS_SR_TLV_SRV6_END_X_SID                1106
1014
1.85k
#define BGP_LS_SR_TLV_SRV6_LAN_END_X_SID            1107
1015
860
#define BGP_LS_SR_TLV_PREFIX_SID                    1158
1016
198
#define BGP_LS_SR_TLV_RANGE                         1159
1017
402
#define BGP_LS_SR_TLV_SRV6_LOCATOR                  1162
1018
1.13k
#define BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS             1170
1019
593
#define BGP_LS_SR_TLV_SOURCE_ROUTER_ID              1171
1020
422
#define BGP_LS_SR_TLV_SRV6_ENDPOINT_BEHAVIOR        1250
1021
399
#define BGP_LS_SR_TLV_SRV6_SID_STRUCT               1252
1022
1023
/* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
1024
195
#define BGP_LS_IGP_TE_METRIC_DELAY                  1114
1025
16.5k
#define BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX          1115
1026
194
#define BGP_LS_IGP_TE_METRIC_DELAY_VARIATION        1116
1027
206
#define BGP_LS_IGP_TE_METRIC_LOSS                   1117
1028
194
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL     1118
1029
194
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE    1119
1030
194
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED     1120
1031
1032
16
#define BGP_LS_IGP_TE_METRIC_FLAG_A                 0x80
1033
16
#define BGP_LS_IGP_TE_METRIC_FLAG_RESERVED          0x7F
1034
1035
/* draft-ietf-idr-bgp-ls-app-specific-attr-07 */
1036
1.48M
#define BGP_LS_APP_SPEC_LINK_ATTR                   1122
1037
1038
/* Prefix-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext, RFC 8665-8667:
1039
1040
                             0  1  2  3  4  5  6  7
1041
                            +--+--+--+--+--+--+--+--+
1042
   if Protocol-ID is IS-IS  |R |N |P |E |V |L |  |  |
1043
                            +--+--+--+--+--+--+--+--+
1044
1045
                             0  1  2  3  4  5  6  7
1046
                            +--+--+--+--+--+--+--+--+
1047
   if Protocol-ID is OSPF   |  |NP|M |E |V |L |  |  |
1048
                            +--+--+--+--+--+--+--+--+
1049
*/
1050
16
#define BGP_LS_SR_PREFIX_SID_FLAG_R  0x80
1051
16
#define BGP_LS_SR_PREFIX_SID_FLAG_N  0x40
1052
16
#define BGP_LS_SR_PREFIX_SID_FLAG_NP 0x40
1053
16
#define BGP_LS_SR_PREFIX_SID_FLAG_P  0x20
1054
16
#define BGP_LS_SR_PREFIX_SID_FLAG_M  0x20
1055
16
#define BGP_LS_SR_PREFIX_SID_FLAG_E  0x10
1056
16
#define BGP_LS_SR_PREFIX_SID_FLAG_V  0x08
1057
16
#define BGP_LS_SR_PREFIX_SID_FLAG_L  0x04
1058
1059
/* Adjacency-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext, RFC 8665-8667:
1060
1061
                             0  1  2  3  4  5  6  7
1062
                            +--+--+--+--+--+--+--+--+
1063
   if Protocol-ID is IS-IS  |F |B |V |L |S |P |  |  |
1064
                            +--+--+--+--+--+--+--+--+
1065
1066
                             0  1  2  3  4  5  6  7
1067
                            +--+--+--+--+--+--+--+--+
1068
   if Protocol-ID is OSPF   |B |V |L |G |P |  |  |  |
1069
                            +--+--+--+--+--+--+--+--+
1070
*/
1071
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_FI 0x80
1072
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_BO 0x80
1073
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_BI 0x40
1074
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_VO 0x40
1075
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_VI 0x20
1076
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_LO 0x20
1077
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_LI 0x10
1078
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_GO 0x10
1079
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_SI 0x08
1080
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_PO 0x08
1081
16
#define BGP_LS_SR_ADJACENCY_SID_FLAG_PI 0x04
1082
1083
/* BGP Peering SIDs TLV flags, rfc9086:
1084
1085
   0  1  2  3  4  5  6  7
1086
   +--+--+--+--+--+--+--+--+
1087
   |V |L |B |P |  |  |  |  | rfc9086
1088
   +--+--+--+--+--+--+--+--+
1089
*/
1090
16
#define BGP_LS_SR_PEER_SID_FLAG_V   0x80
1091
16
#define BGP_LS_SR_PEER_SID_FLAG_L   0x40
1092
16
#define BGP_LS_SR_PEER_SID_FLAG_B   0x20
1093
16
#define BGP_LS_SR_PEER_SID_FLAG_P   0x10
1094
1095
/* SR-Capabilities TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext-01:
1096
1097
                             0  1  2  3  4  5  6  7
1098
                            +--+--+--+--+--+--+--+--+
1099
   if Protocol-ID is IS-IS  |I |V |H |  |  |  |  |  |
1100
                            +--+--+--+--+--+--+--+--+
1101
*/
1102
16
#define BGP_LS_SR_CAPABILITY_FLAG_I 0x80
1103
16
#define BGP_LS_SR_CAPABILITY_FLAG_V 0x40
1104
16
#define BGP_LS_SR_CAPABILITY_FLAG_H 0x20
1105
1106
/* Flexible Algorithm Definition Flags Sub-TLV flags, rfc9350:
1107
1108
                             0  1  2  3  4  5  6  7
1109
                            +--+--+--+--+--+--+--+--+
1110
   if Protocol-ID is IS-IS  |M |  |  |  |  |  |  |  |
1111
                            +--+--+--+--+--+--+--+--+
1112
                             0  1  2  3  4  5  6  7
1113
                            +--+--+--+--+--+--+--+--+
1114
   if Protocol-ID is OSPF   |M |  |  |  |  |  |  |  |
1115
                            +--+--+--+--+--+--+--+--+
1116
*/
1117
16
#define BGP_LS_FLEX_ALGO_DEF_FLAGS_M    0x80000000
1118
1119
/* OSPF Flexible Algorithm Prefix Metric Sub-TLV flags, rfc9350:
1120
1121
                             0  1  2  3  4  5  6  7
1122
                            +--+--+--+--+--+--+--+--+
1123
   if Protocol-ID is OSPF   |E |  |  |  |  |  |  |  |
1124
                            +--+--+--+--+--+--+--+--+
1125
*/
1126
16
#define BGP_LS_FLEX_ALGO_PREFIX_METRIC_FLAGS_E      0x80
1127
1128
/* Prefix Attribute Flags TLV flags, rfc9085:
1129
1130
                             0  1  2  3  4  5  6  7
1131
                            +--+--+--+--+--+--+--+--+
1132
   if Protocol-ID is IS-IS  |X |R |N |E |  |  |  |  | rfc7794,rfc9088
1133
                            +--+--+--+--+--+--+--+--+
1134
1135
                             0  1  2  3  4  5  6  7
1136
                            +--+--+--+--+--+--+--+--+
1137
   if Protocol-ID is OSPF   |A |N |E |  |  |  |  |  | rfc7684,rfc9089
1138
                            +--+--+--+--+--+--+--+--+
1139
*/
1140
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI 0x80
1141
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI 0x40
1142
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI 0x20
1143
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI 0x10
1144
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO 0x80
1145
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO 0x40
1146
16
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO 0x20
1147
1148
/* Link Attribute Application Identifiers, https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml:
1149
1150
   0  1  2  3  4  5  6  7
1151
   +--+--+--+--+--+--+--+--+
1152
   |R |S |F |X |  |  |  |  | rfc8919,rfc8920
1153
   +--+--+--+--+--+--+--+--+
1154
*/
1155
16
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R  0x80000000
1156
16
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S  0x40000000
1157
16
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F  0x20000000
1158
16
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X  0x10000000
1159
1160
/* SRv6 Capabilities TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1161
1162
                            0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16
1163
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1164
   if Protocol-ID is IS-IS  |  |O | Reserved                                | rfc9352
1165
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1166
 */
1167
16
#define BGP_LS_SRV6_CAP_FLAG_O         0x4000
1168
#define BGP_LS_SRV6_CAP_FLAG_RESERVED  0x3fff
1169
1170
/* SRv6 End.X SID TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1171
1172
                            0  1  2  3  4  5  6  7
1173
                            +--+--+--+--+--+--+--+--+
1174
   if Protocol-ID is IS-IS  |B |S |P |  |  |  |  |  | rfc9352
1175
                            +--+--+--+--+--+--+--+--+
1176
*/
1177
16
#define BGP_LS_SRV6_ENDX_SID_FLAG_B         0x80
1178
16
#define BGP_LS_SRV6_ENDX_SID_FLAG_S         0x40
1179
16
#define BGP_LS_SRV6_ENDX_SID_FLAG_P         0x20
1180
16
#define BGP_LS_SRV6_ENDX_SID_FLAG_RESERVED  0x1f
1181
1182
/* SRv6 Locator TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1183
1184
                            0  1  2  3  4  5  6  7  8
1185
                            +--+--+--+--+--+--+--+--+
1186
   if Protocol-ID is IS-IS  |D | Reserved           | rfc9352
1187
                            +--+--+--+--+--+--+--+--+
1188
*/
1189
16
#define BGP_LS_SRV6_LOC_FLAG_D         0x80
1190
16
#define BGP_LS_SRV6_LOC_FLAG_RESERVED  0x7f
1191
1192
/* BGP Prefix-SID TLV type */
1193
406
#define BGP_PREFIX_SID_TLV_LABEL_INDEX     1 /* Label-Index [RFC8669]                           */
1194
#define BGP_PREFIX_SID_TLV_2               2 /* Deprecated [RFC8669]                            */
1195
837
#define BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB 3 /* Originator SRGB [RFC8669]                       */
1196
#define BGP_PREFIX_SID_TLV_4               4 /* Deprecated [draft-ietf-bess-srv6-services]      */
1197
587
#define BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE 5 /* SRv6 L3 Service [draft-ietf-bess-srv6-services] */
1198
470
#define BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE 6 /* SRv6 L2 Service [draft-ietf-bess-srv6-services] */
1199
1200
/* BGP_PREFIX_SID TLV lengths   */
1201
406
#define BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX 7
1202
1203
/* BGP SRv6 Service Sub-TLV */
1204
2.19k
#define SRV6_SERVICE_SRV6_SID_INFORMATION 1
1205
1206
/* BGP SRv6 Service Data Sub-Sub-TLV */
1207
2.31k
#define SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE 1
1208
1209
/* SRv6 Endpoint behavior */
1210
#define SRV6_ENDPOINT_BEHAVIOR_END                    0x0001 /* End [RFC8986]                                                                            */
1211
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP                0x0002 /* End with PSP [RFC8986]                                                                   */
1212
#define SRV6_ENDPOINT_BEHAVIOR_END_USP                0x0003 /* End with USP [RFC8986]                                                                   */
1213
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP            0x0004 /* End with PSP & USP [RFC8986]                                                             */
1214
#define SRV6_ENDPOINT_BEHAVIOR_END_X                  0x0005 /* End.X [RFC8986]                                                                          */
1215
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP              0x0006 /* End.X with PSP [RFC8986]                                                                 */
1216
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USP              0x0007 /* End.X with UPS [RFC8986]                                                                 */
1217
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP          0x0008 /* End.X with PSP & USP [RFC8986]                                                           */
1218
#define SRV6_ENDPOINT_BEHAVIOR_END_T                  0x0009 /* End.T [RFC8986]                                                                          */
1219
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP              0x000A /* End.T with PSP [RFC8986]                                                                 */
1220
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USP              0x000B /* End.T with USP [RFC8986]                                                                 */
1221
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP          0x000C /* End.T with PSP & USP [RFC8986]                                                           */
1222
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT          0x000D /* End.B6.Insert [draft-filsfils-spring-srv6-net-pgm-insertion-04]                          */
1223
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS          0x000E /* End.B6.Encaps [RFC8986]                                                                  */
1224
#define SRV6_ENDPOINT_BEHAVIOR_END_BM                 0x000F /* End.BM [RFC8986]                                                                         */
1225
#define SRV6_ENDPOINT_BEHAVIOR_END_DX6                0x0010 /* End.DX6 [RFC8986]                                                                        */
1226
#define SRV6_ENDPOINT_BEHAVIOR_END_DX4                0x0011 /* End.DX4 [RFC8986]                                                                        */
1227
#define SRV6_ENDPOINT_BEHAVIOR_END_DT6                0x0012 /* End.DT6 [RFC8986]                                                                        */
1228
#define SRV6_ENDPOINT_BEHAVIOR_END_DT4                0x0013 /* End.DT4 [RFC8986]                                                                        */
1229
#define SRV6_ENDPOINT_BEHAVIOR_END_DT46               0x0014 /* End.DT46 [RFC8986]                                                                       */
1230
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2                0x0015 /* End.DX2 [RFC8986]                                                                        */
1231
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2V               0x0016 /* End.DX2V [RFC8986]                                                                       */
1232
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2U               0x0017 /* End.DX2U [RFC8986]                                                                       */
1233
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2M               0x0018 /* End.DT2M [RFC8986]                                                                       */
1234
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT_RED      0x001A /* End.B6.Insert.Red [draft-filsfils-spring-srv6-net-pgm-insertion-04]                      */
1235
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED      0x001B /* End.B6.Encaps.Red [RFC8986]                                                              */
1236
#define SRV6_ENDPOINT_BEHAVIOR_END_USD                0x001C /* End with USD [RFC8986]                                                                   */
1237
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD            0x001D /* End with PSP & USD [RFC8986]                                                             */
1238
#define SRV6_ENDPOINT_BEHAVIOR_END_USP_USD            0x001E /* End with USP & USD [RFC8986]                                                             */
1239
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD        0x001F /* End with PSP, USP & USD [RFC8986]                                                        */
1240
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USD              0x0020 /* End.X with USD [RFC8986]                                                                 */
1241
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD          0x0021 /* End.X with PSP & USD [RFC8986]                                                           */
1242
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD          0x0022 /* End.X with USP & USD [RFC8986]                                                           */
1243
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD      0x0023 /* End.X with PSP, USP & USD [RFC8986]                                                      */
1244
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USD              0x0024 /* End.T with USD [RFC8986]                                                                 */
1245
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD          0x0025 /* End.T with PSP & USD [RFC8986]                                                           */
1246
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD          0x0026 /* End.T with USP & USD [RFC8986]                                                           */
1247
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD      0x0027 /* End.T with PSP, USP & USD [RFC8986]                                                      */
1248
#define SRV6_ENDPOINT_BEHAVIOR_END_MAP                0x0028 /* End.MAP                                                                                  */
1249
#define SRV6_ENDPOINT_BEHAVIOR_END_LIMIT              0x0029 /* End.Limit                                                                                */
1250
#define SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID          0x002A /* End with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1251
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID               0x002B /* End with NEXT-CSID [draft-ietf-spring-srv6-srh-compression]                              */
1252
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP           0x002C /* End with NEXT-CSID & PSP [draft-ietf-spring-srv6-srh-compression]                        */
1253
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP           0x002D /* End with NEXT-CSID & USP [draft-ietf-spring-srv6-srh-compression]                        */
1254
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP       0x002E /* End with NEXT-CSID, PSP & USP [draft-ietf-spring-srv6-srh-compression]                   */
1255
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD           0x002F /* End with NEXT-CSID & USD [draft-ietf-spring-srv6-srh-compression]                        */
1256
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD       0x0030 /* End with NEXT-CSID, PSP & USD [draft-ietf-spring-srv6-srh-compression]                   */
1257
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD       0x0031 /* End with NEXT-CSID, USP & USD [draft-ietf-spring-srv6-srh-compression]                   */
1258
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD   0x0032 /* End with NEXT-CSID, PSP, USP & USD [draft-ietf-spring-srv6-srh-compression]              */
1259
#define SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID        0x0033 /* End.X with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]            */
1260
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID             0x0034 /* End.X with NEXT-CSID [draft-ietf-spring-srv6-srh-compression]                            */
1261
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP         0x0035 /* End.X with NEXT-CSID & PSP [draft-ietf-spring-srv6-srh-compression]                      */
1262
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP         0x0036 /* End.X with NEXT-CSID & USP [draft-ietf-spring-srv6-srh-compression]                      */
1263
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP     0x0037 /* End.X with NEXT-CSID, PSP & USP [draft-ietf-spring-srv6-srh-compression]                 */
1264
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD         0x0038 /* End.X with NEXT-CSID & USD [draft-ietf-spring-srv6-srh-compression]                      */
1265
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD     0x0039 /* End.X with NEXT-CSID, PSP & USD [draft-ietf-spring-srv6-srh-compression]                 */
1266
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD     0x003A /* End.X with NEXT-CSID, USP & USD [draft-ietf-spring-srv6-srh-compression]                 */
1267
#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]            */
1268
#define SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID           0x003C /* End.DX6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1269
#define SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID           0x003D /* End.DX4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1270
#define SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID           0x003E /* End.DT6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1271
#define SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID           0x003F /* End.DT4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1272
#define SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID          0x0040 /* End.DT46 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1273
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID           0x0041 /* End.DX2 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1274
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID          0x0042 /* End.DX2V with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1275
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID          0x0043 /* End.DT2U with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1276
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID          0x0044 /* End.DT2M with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1277
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6D            0x0045 /* End.M.GTP6.D [RFC9433]                                                                   */
1278
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6DI           0x0046 /* End.M.GTP6.Di [RFC9433]                                                                  */
1279
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6E            0x0047 /* End.M.GTP6.E [RFC9433]                                                                   */
1280
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP4E            0x0048 /* End.M.GTP4.E [RFC9433]                                                                   */
1281
 #define SRV6_ENDPOINT_BEHAVIOR_END_M                  0x004A /* End.M (Mirror SID) [draft-ietf-rtgwg-srv6-egress-protection-02]                          */
1282
#define SRV6_ENDPOINT_BEHAVIOR_END_REPLICATE          0x004B /* End.Replicate [RFC9524]                                                                  */
1283
#define SRV6_ENDPOINT_BEHAVIOR_END_NSH                0x0054 /* End.NSH - NSH Segment [RFC9491]                                                          */
1284
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1                0x009E /* End.DX1 [RFC9801]                                                                        */
1285
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1_NEXT_CSID      0x009F /* End.DX1 with NEXT-CSID [RFC9801]                                                         */
1286
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1_REPL_CSID      0x00A0 /* End.DX1 with REPLACE-CSID [RFC9801]                                                      */
1287
#define SRV6_ENDPOINT_BEHAVIOR_OPAQUE                 0xFFFF /* Opaque [RFC8986]                                                                         */
1288
1289
static const value_string bgptypevals[] = {
1290
    { BGP_OPEN,                "OPEN Message" },
1291
    { BGP_UPDATE,              "UPDATE Message" },
1292
    { BGP_NOTIFICATION,        "NOTIFICATION Message" },
1293
    { BGP_KEEPALIVE,           "KEEPALIVE Message" },
1294
    { BGP_ROUTE_REFRESH,       "ROUTE-REFRESH Message" },
1295
    { BGP_CAPABILITY,          "CAPABILITY Message" },
1296
    { BGP_ROUTE_REFRESH_CISCO, "Cisco ROUTE-REFRESH Message" },
1297
    { 0, NULL }
1298
};
1299
1300
static const value_string evpnrtypevals[] = {
1301
    { EVPN_AD_ROUTE,                   "Ethernet AD Route" },
1302
    { EVPN_MAC_ROUTE,                  "MAC Advertisement Route" },
1303
    { EVPN_INC_MCAST_TREE,             "Inclusive Multicast Route" },
1304
    { EVPN_ETH_SEGMENT_ROUTE,          "Ethernet Segment Route" },
1305
    { EVPN_IP_PREFIX_ROUTE,            "IP Prefix route" },
1306
    { EVPN_MC_ETHER_TAG_ROUTE,         "Selective Multicast Ethernet Tag Route" },
1307
    { EVPN_IGMP_JOIN_ROUTE,            "IGMP Join Synch Route" },
1308
    { EVPN_IGMP_LEAVE_ROUTE,           "IGMP Leave Synch Route" },
1309
    { EVPN_PER_REG_I_PMSI_A_D_ROUTE,   "Per-Region I-PMSI A-D route" },
1310
    { EVPN_S_PMSI_A_D_ROUTE,           "S-PMSI A-D Route" },
1311
    { EVPN_LEAF_A_D_ROUTE,             "Leaf A-D route" },
1312
    { 0, NULL }
1313
};
1314
1315
static const value_string evpn_nlri_esi_type[] = {
1316
    { BGP_NLRI_EVPN_ESI_VALUE,      "ESI 9 bytes value" },
1317
    { BGP_NLRI_EVPN_ESI_LACP,       "ESI LACP 802.1AX defined" },
1318
    { BGP_NLRI_EVPN_ESI_MSTP,       "ESI MSTP defined" },
1319
    { BGP_NLRI_EVPN_ESI_MAC,        "ESI MAC address defined" },
1320
    { BGP_NLRI_EVPN_ESI_RID,        "ESI Router ID" },
1321
    { BGP_NLRI_EVPN_ESI_ASN,        "ESI Autonomous System" },
1322
    { BGP_NLRI_EVPN_ESI_RES,        "ESI reserved" },
1323
    { 0, NULL }
1324
};
1325
1326
68
#define BGP_MAJOR_ERROR_MSG_HDR       1
1327
3.07k
#define BGP_MAJOR_ERROR_OPEN_MSG      2
1328
87
#define BGP_MAJOR_ERROR_UPDATE_MSG    3
1329
99
#define BGP_MAJOR_ERROR_HT_EXPIRED    4
1330
70
#define BGP_MAJOR_ERROR_STATE_MACHINE 5
1331
1.67k
#define BGP_MAJOR_ERROR_CEASE         6
1332
124
#define BGP_MAJOR_ERROR_ROUTE_REFRESH 7
1333
#define BGP_MAJOR_ERROR_SH_T_EXPIRED  8
1334
1335
static const value_string bgpnotify_major[] = {
1336
    { BGP_MAJOR_ERROR_MSG_HDR,       "Message Header Error" },
1337
    { BGP_MAJOR_ERROR_OPEN_MSG,      "OPEN Message Error" },
1338
    { BGP_MAJOR_ERROR_UPDATE_MSG,    "UPDATE Message Error" },
1339
    { BGP_MAJOR_ERROR_HT_EXPIRED,    "Hold Timer Expired" },
1340
    { BGP_MAJOR_ERROR_STATE_MACHINE, "Finite State Machine Error" },
1341
    { BGP_MAJOR_ERROR_CEASE,         "Cease" },
1342
    { BGP_MAJOR_ERROR_ROUTE_REFRESH, "ROUTE-REFRESH Message Error" },    /* RFC 7313 - Enhanced Route Refresh Capability for BGP-4 */
1343
    { BGP_MAJOR_ERROR_SH_T_EXPIRED,  "Send Hold Timer Expired" },
1344
    { 0, NULL }
1345
};
1346
1347
static const value_string bgpnotify_minor_msg_hdr[] = {
1348
    { 1, "Connection Not Synchronized" },
1349
    { 2, "Bad Message Length" },
1350
    { 3, "Bad Message Type" },
1351
    { 0, NULL }
1352
};
1353
1354
static const value_string bgpnotify_minor_open_msg[] = {
1355
    { 1,  "Unsupported Version Number" },
1356
    { 2,  "Bad Peer AS" },
1357
    { 3,  "Bad BGP Identifier" },
1358
    { 4,  "Unsupported Optional Parameter" },
1359
    { 5,  "Authentication Failure [Deprecated]" },
1360
    { 6,  "Unacceptable Hold Time" },
1361
    { 7,  "Unsupported Capability" },
1362
    { 8,  "No supported AFI/SAFI (Cisco)" },
1363
    { 11, "Role Mismatch" },
1364
    { 0, NULL }
1365
};
1366
1367
static const value_string bgpnotify_minor_update_msg[] = {
1368
    { 1,  "Malformed Attribute List" },
1369
    { 2,  "Unrecognized Well-known Attribute" },
1370
    { 3,  "Missing Well-known Attribute" },
1371
    { 4,  "Attribute Flags Error" },
1372
    { 5,  "Attribute Length Error" },
1373
    { 6,  "Invalid ORIGIN Attribute" },
1374
    { 7,  "AS Routing Loop [Deprecated]" },
1375
    { 8,  "Invalid NEXT_HOP Attribute" },
1376
    { 9,  "Optional Attribute Error" },
1377
    { 10, "Invalid Network Field" },
1378
    { 11, "Malformed AS_PATH" },
1379
    { 0, NULL }
1380
};
1381
/* RFC6608 Subcodes for BGP Finite State Machine Error */
1382
static const value_string bgpnotify_minor_state_machine[] = {
1383
    { 1, "Receive Unexpected Message in OpenSent State" },
1384
    { 2, "Receive Unexpected Message in OpenConfirm State" },
1385
    { 3, "Receive Unexpected Message in Established State" },
1386
    { 0, NULL }
1387
};
1388
1389
#define BGP_CEASE_MINOR_MAX_REACHED       1
1390
518
#define BGP_CEASE_MINOR_ADMIN_SHUTDOWN    2
1391
#define BGP_CEASE_MINOR_PEER_DE_CONF      3
1392
171
#define BGP_CEASE_MINOR_ADMIN_RESET       4
1393
#define BGP_CEASE_MINOR_CONN_RESET        5
1394
#define BGP_CEASE_MINOR_OTHER_CONF_CHANGE 6
1395
#define BGP_CEASE_MINOR_CONN_COLLISION    7
1396
#define BGP_CEASE_MINOR_OUT_RESOURCES     8
1397
#define BGP_CEASE_MINOR_HARD_RESET        9
1398
#define BGP_CEASE_MINOR_BFD_DOWN          10
1399
1400
/* RFC4486 Subcodes for BGP Cease Notification Message */
1401
static const value_string bgpnotify_minor_cease[] = {
1402
    { BGP_CEASE_MINOR_MAX_REACHED,       "Maximum Number of Prefixes Reached"},
1403
    { BGP_CEASE_MINOR_ADMIN_SHUTDOWN,    "Administratively Shutdown"},
1404
    { BGP_CEASE_MINOR_PEER_DE_CONF,      "Peer De-configured"},
1405
    { BGP_CEASE_MINOR_ADMIN_RESET,       "Administratively Reset"},
1406
    { BGP_CEASE_MINOR_CONN_RESET,        "Connection Rejected"},
1407
    { BGP_CEASE_MINOR_OTHER_CONF_CHANGE, "Other Configuration Change"},
1408
    { BGP_CEASE_MINOR_CONN_COLLISION,    "Connection Collision Resolution"},
1409
    { BGP_CEASE_MINOR_OUT_RESOURCES,     "Out of Resources"},
1410
    { BGP_CEASE_MINOR_HARD_RESET,        "Hard Reset"},
1411
    { BGP_CEASE_MINOR_BFD_DOWN,          "BFD Down"},
1412
    { 0,                                 NULL }
1413
};
1414
1415
/* RFC7313 - Enhanced Route Refresh Capability for BGP-4 */
1416
static const value_string bgpnotify_minor_rr_msg[] = {
1417
    { 1, "Invalid Message Length" },
1418
    { 0, NULL }
1419
};
1420
1421
static const value_string bgpattr_origin[] = {
1422
    { 0, "IGP" },
1423
    { 1, "EGP" },
1424
    { 2, "INCOMPLETE" },
1425
    { 0, NULL }
1426
};
1427
1428
static const value_string bgp_open_opt_vals[] = {
1429
    { BGP_OPTION_AUTHENTICATION, "Authentication" },
1430
    { BGP_OPTION_CAPABILITY, "Capability" },
1431
    { BGP_OPTION_EXTENDED_LEN, "Extended Length"},
1432
    { 0, NULL }
1433
};
1434
1435
static const value_string as_segment_type[] = {
1436
    { 1, "AS_SET" },
1437
    { 2, "AS_SEQUENCE" },
1438
/* RFC1965 has the wrong values, corrected in  */
1439
/* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
1440
    { 4, "AS_CONFED_SET" },
1441
    { 3, "AS_CONFED_SEQUENCE" },
1442
    { 0, NULL }
1443
};
1444
1445
static const value_string bgpattr_type[] = {
1446
    { BGPTYPE_ORIGIN,              "ORIGIN" },
1447
    { BGPTYPE_AS_PATH,             "AS_PATH" },
1448
    { BGPTYPE_NEXT_HOP,            "NEXT_HOP" },
1449
    { BGPTYPE_MULTI_EXIT_DISC,     "MULTI_EXIT_DISC" },
1450
    { BGPTYPE_LOCAL_PREF,          "LOCAL_PREF" },
1451
    { BGPTYPE_ATOMIC_AGGREGATE,    "ATOMIC_AGGREGATE" },
1452
    { BGPTYPE_AGGREGATOR,          "AGGREGATOR" },
1453
    { BGPTYPE_COMMUNITIES,         "COMMUNITIES" },
1454
    { BGPTYPE_ORIGINATOR_ID,       "ORIGINATOR_ID" },
1455
    { BGPTYPE_CLUSTER_LIST,        "CLUSTER_LIST" },
1456
    { BGPTYPE_DPA,                 "DPA" },
1457
    { BGPTYPE_ADVERTISER,          "ADVERTISER" },
1458
    { BGPTYPE_RCID_PATH,           "RCID_PATH / CLUSTER_ID" },
1459
    { BGPTYPE_MP_REACH_NLRI,       "MP_REACH_NLRI" },
1460
    { BGPTYPE_MP_UNREACH_NLRI,     "MP_UNREACH_NLRI" },
1461
    { BGPTYPE_EXTENDED_COMMUNITY,  "EXTENDED_COMMUNITIES" },
1462
    { BGPTYPE_AS4_PATH,            "AS4_PATH" },
1463
    { BGPTYPE_AS4_AGGREGATOR,      "AS4_AGGREGATOR" },
1464
    { BGPTYPE_SAFI_SPECIFIC_ATTR,  "SAFI_SPECIFIC_ATTRIBUTE" },
1465
    { BGPTYPE_CONNECTOR_ATTRIBUTE, "Connector Attribute" },
1466
    { BGPTYPE_AS_PATHLIMIT,        "AS_PATHLIMIT "},
1467
    { BGPTYPE_PMSI_TUNNEL_ATTR,    "PMSI_TUNNEL_ATTRIBUTE" },
1468
    { BGPTYPE_TUNNEL_ENCAPS_ATTR,  "TUNNEL_ENCAPSULATION_ATTRIBUTE" },
1469
    { BGPTYPE_TRAFFIC_ENGINEERING, "Traffic Engineering" },
1470
    { BGPTYPE_IPV6_ADDR_SPEC_EC,   "IPv6 Address Specific Extended Community" },
1471
    { BGPTYPE_AIGP,                "AIGP" },
1472
    { BGPTYPE_PE_DISTING_LABLES,   "PE Distinguisher Labels" },
1473
    { BGPTYPE_BGP_ENTROPY_LABEL,   "BGP Entropy Label Capability Attribute" },
1474
    { BGPTYPE_LINK_STATE_ATTR,     "BGP-LS Attribute" },
1475
    { BGPTYPE_30,                  "Deprecated" },
1476
    { BGPTYPE_31,                  "Deprecated" },
1477
    { BGPTYPE_LARGE_COMMUNITY,     "LARGE_COMMUNITY" },
1478
    { BGPTYPE_BGPSEC_PATH,         "BGPsec_PATH" },
1479
    { BGPTYPE_OTC,                 "OTC" },
1480
    { BGPTYPE_D_PATH,              "D_PATH" },
1481
    { BGPTYPE_SFP_ATTRIBUTE,       "SFP Attribute" },
1482
    { BGPTYPE_BFD_DISCRIMINATOR,   "BFD Discriminator" },
1483
    { BGPTYPE_NEXT_HOP_DEP_CAP,    "BGP Next Hop Dependent Capabilities" },
1484
    { BGPTYPE_BGP_PREFIX_SID,      "BGP Prefix-SID" },
1485
    { BGPTYPE_LINK_STATE_OLD_ATTR, "LINK_STATE (unofficial code point)" },
1486
    { BGPTYPE_ATTR_SET,            "ATTR_SET" },
1487
    { BGPTYPE_129,                 "Deprecated" },
1488
    { BGPTYPE_241,                 "Deprecated" },
1489
    { BGPTYPE_242,                 "Deprecated" },
1490
    { BGPTYPE_243,                 "Deprecated" },
1491
    { 0, NULL }
1492
};
1493
1494
static const value_string pmsi_tunnel_type[] = {
1495
    { PMSI_TUNNEL_NOPRESENT,      "Type is not present" },
1496
    { PMSI_TUNNEL_RSVPTE_P2MP,    "RSVP-TE P2MP LSP" },
1497
    { PMSI_TUNNEL_MLDP_P2MP,      "mLDP P2MP LSP" },
1498
    { PMSI_TUNNEL_PIMSSM,         "PIM SSM Tree" },
1499
    { PMSI_TUNNEL_PIMSM,          "PIM SM Tree" },
1500
    { PMSI_TUNNEL_BIDIR_PIM,      "BIDIR-PIM Tree" },
1501
    { PMSI_TUNNEL_INGRESS,        "Ingress Replication" },
1502
    { PMSI_TUNNEL_MLDP_MP2MP,     "mLDP MP2MP LSP" },
1503
    { PMSI_TUNNEL_TRANPORT,       "Transport Tunnel" },
1504
    { PMSI_TUNNEL_ASS_REPLIC,     "Assisted Replication Tunnel" },
1505
    { PMSI_TUNNEL_BIER,           "BIER" },
1506
    { PMSI_TUNNEL_SR_MPLS_P2MP,   "SR-MPLS P2MP Tree" },
1507
    { 0, NULL }
1508
};
1509
1510
static const value_string aigp_tlv_type[] = {
1511
    { AIGP_TLV_TYPE,            "Type AIGP TLV" },
1512
    { 0, NULL }
1513
};
1514
1515
/* BFD Discriminator (RFC 9026) */
1516
#define BGP_BFD_MODE_RESERVED_0         0
1517
#define BGP_BFD_MODE_P2MP               1
1518
#define BGP_BFD_MODE_UNICAST            2
1519
#define BGP_BFD_MODE_RESERVED_255       255
1520
1521
static const value_string bgp_bfd_mode_vals[] = {
1522
    { BGP_BFD_MODE_RESERVED_0,    "Reserved" },
1523
    { BGP_BFD_MODE_P2MP,          "P2MP BFD Session" },
1524
    { BGP_BFD_MODE_UNICAST,       "Unicast BFD Session" },
1525
    { BGP_BFD_MODE_RESERVED_255,  "Reserved" },
1526
    { 0, NULL }
1527
};
1528
1529
#define BGP_BFD_DISCRIMINATOR_TLV_RESERVED_0    0
1530
661
#define BGP_BFD_DISCRIMINATOR_TLV_SOURCE_IP     1
1531
#define BGP_BFD_DISCRIMINATOR_TLV_RESERVED_255  255
1532
1533
static const value_string bgp_bfd_discriminator_tlv_type_vals[] = {
1534
    { BGP_BFD_DISCRIMINATOR_TLV_RESERVED_0,   "Reserved" },
1535
    { BGP_BFD_DISCRIMINATOR_TLV_SOURCE_IP,    "Source IP Address" },
1536
    { BGP_BFD_DISCRIMINATOR_TLV_RESERVED_255, "Reserved" },
1537
    { 0, NULL }
1538
};
1539
1540
static const value_string pmsi_mldp_fec_opaque_value_type[] = {
1541
    { PMSI_MLDP_FEC_TYPE_RSVD,                      "Reserved" },
1542
    { PMSI_MLDP_FEC_TYPE_GEN_LSP,                   "Generic LSP Identifier" },
1543
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SRC,          "Transit IPv4 Source" },
1544
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SRC,          "Transit IPv6 Source" },
1545
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_BIDIR,        "Transit IPv4 Bidir" },
1546
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_BIDIR,        "Transit IPv6 Bidir" },
1547
    { PMSI_MLDP_FEC_TYPE_RECURSE_OPAQUE_VALUE,      "Recursive Opaque Value" },
1548
    { PMSI_MLDP_FEC_TYPE_VPN_RECURSE_OPAQUE_VALUE,  "VPN-Recursive Opaque Value" },
1549
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_BIDIR,       "Transit VPNv4 Bidir" },
1550
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_BIDIR,       "Transit VPNv6 Bidir" },
1551
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SHARED_TREE,  "Transit IPv4 Shared Tree" },
1552
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SHARED_TREE,  "Transit IPv6 Shared Tree" },
1553
    { PMSI_MLDP_FEC_TYPE_L2VPN_MCAST,               "L2VPN-MCAST application" },
1554
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_SRC,         "Transit VPNv4 Source" },
1555
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_SRC,         "Transit VPNv6 Source" },
1556
    { PMSI_MLDP_FEC_TYPE_EXT_TYPE,                  "Extended Type field in the following two bytes" },
1557
    { 0, NULL}
1558
};
1559
1560
static const value_string pmsi_mldp_fec_opa_extented_type[] = {
1561
    { PMSI_MLDP_FEC_ETYPE_RSVD,         "Reserved" },
1562
    { 0, NULL}
1563
};
1564
1565
static const value_string bgp_attr_tunnel_type[] = {
1566
    { TUNNEL_TYPE_L2TP_OVER_IP, "L2TPv2 over IP" },
1567
    { TUNNEL_TYPE_GRE,          "GRE" },
1568
    { TUNNEL_TYPE_TTE,          "Transmit tunnel endpoint" },
1569
    { TUNNEL_TYPE_IPSEC_IN_TM,  "IPsec in Tunnel-mode" },
1570
    { TUNNEL_TYPE_IP_IN_IP_IPSEC, "IP in IP tunnel with IPsec Transport Mode" },
1571
    { TUNNEL_TYPE_MPLS_IN_IP_IPSEC, "MPLS-in-IP tunnel with IPsec Transport Mode" },
1572
    { TUNNEL_TYPE_IP_IN_IP,     "IP in IP" },
1573
    { TUNNEL_TYPE_VXLAN,        "VXLAN Encapsulation" },
1574
    { TUNNEL_TYPE_NVGRE,        "NVGRE Encapsulation" },
1575
    { TUNNEL_TYPE_MPLS,         "MPLS Encapsulation" },
1576
    { TUNNEL_TYPE_MPLS_IN_GRE,  "MPLS in GRE Encapsulation" },
1577
    { TUNNEL_TYPE_VXLAN_GPE,    "VXLAN GPE Encapsulation" },
1578
    { TUNNEL_TYPE_MPLS_IN_UDP,  "MPLS in UDP Encapsulation" },
1579
    { TUNNEL_TYPE_IPV6_TUNNEL,  "IPv6 Tunnel" },
1580
    { TUNNEL_TYPE_SR_TE_POLICY, "SR TE Policy Type" },
1581
    { TUNNEL_TYPE_BARE,         "Bare" },
1582
    { TUNNEL_TYPE_SR_TUNNEL,    "SR Tunnel" },
1583
    { TUNNEL_TYPE_CLOUD_SECURITY, "Cloud Security" },
1584
    { TUNNEL_TYPE_GENEVE_ENCAP, "Geneve Encapsulation" },
1585
    { TUNNEL_TYPE_ANY_ENCAP,    "Any Encapsulation" },
1586
    { TUNNEL_TYPE_GTP_TUNNEL_TYPE, "GTP Tunnel Type" },
1587
    { TUNNEL_TYPE_DPS_TUNNEL_ENCAP, "Dynamic Path Selection Tunnel Encapsulation" },
1588
    { TUNNEL_TYPE_ORIGINATING_PE, "Originating PE" },
1589
    { TUNNEL_TYPE_DPS_POLICY,   "Dynamic Path Selection Policy" },
1590
    { TUNNEL_TYPE_SDWAN_HYBRID, "SDWAN Hybrid" },
1591
    { TUNNEL_TYPE_X_OVER_UDP,   "X-over-UDP" },
1592
    { TUNNEL_TYPE_DES_TUNNEL_ENCAP, "Distributed Etherlink Switch Tunnel Encapsulation" },
1593
    { 0, NULL }
1594
};
1595
1596
static const value_string subtlv_type[] = {
1597
    { TUNNEL_SUBTLV_ENCAPSULATION,  "Encapsulation" },
1598
    { TUNNEL_SUBTLV_PROTO_TYPE,     "Protocol Type" },
1599
    { TUNNEL_SUBTLV_IPSEC_TA,       "IPsec Tunnel Authenticator" },
1600
    { TUNNEL_SUBTLV_COLOR,          "Color" },
1601
    { TUNNEL_SUBTLV_LOAD_BALANCE,   "Load-Balancing Block" },
1602
    { TUNNEL_SUBTLV_REMOTE_ENDPOINT,"Tunnel Egress Endpoint" },
1603
    { TUNNEL_SUBTLV_IPV4_DS_FIELD,  "IPv4 DS Field" },
1604
    { TUNNEL_SUBTLV_UDP_DST_PORT,   "UDP Destination Port" },
1605
    { TUNNEL_SUBTLV_EMBEDDED_LABEL, "Embedded Label Handling" },
1606
    { TUNNEL_SUBTLV_MPLS_LABEL,     "MPLS Label Stack" },
1607
    { TUNNEL_SUBTLV_PREFIX_SID,     "Prefix SID" },
1608
    { TUNNEL_SUBTLV_PREFERENCE,     "Preference" },
1609
    { TUNNEL_SUBTLV_BINDING_SID,    "Binding SID" },
1610
    { TUNNEL_SUBTLV_ENLP,           "ENLP" },
1611
    { TUNNEL_SUBTLV_PRIORITY,       "Priority" },
1612
    { TUNNEL_SUBTLV_SPI_SI_REP,     "SPI/SI Representation" },
1613
    { TUNNEL_SUBTLV_SRV6_BINDING_SID, "SRv6 Binding SID" },
1614
    { TUNNEL_SUBTLV_IPSEC_SA_ID,    "IPSEC-SA-ID" },
1615
    { TUNNEL_SUBTLV_EXT_PORT_PROP,  "Extended Port Property" },
1616
    { TUNNEL_SUBTLV_UNDERLAY_ISP_PROP, "Underlay ISP Properties" },
1617
    { TUNNEL_SUBTLV_IPSEC_SA_NONCE, "IPsec SA Nonce" },
1618
    { TUNNEL_SUBTLV_IPSEC_PUBLIC_KEY, "IPsec Public Key" },
1619
    { TUNNEL_SUBTLV_IPSEC_SA_PROPOSAL, "IPsec SA Proposal" },
1620
    { TUNNEL_SUBTLV_SIMPL_IPSEC_SA, "Simplified IPsec SA" },
1621
    { TUNNEL_SUBTLV_NRP,            "NRP" },
1622
    { TUNNEL_SUBTLV_RPF,            "RPF" },
1623
    { TUNNEL_SUBTLV_TREE_LABEL_STACK, "Tree Label Stack" },
1624
    { TUNNEL_SUBTLV_SEGMENT_LIST,   "Segment List" },
1625
    { TUNNEL_SUBTLV_POLICY_CP_NAME, "Policy CP Name" },
1626
    { TUNNEL_SUBTLV_POLICY_NAME,    "Policy Name" },
1627
    { TUNNEL_SUBTLV_WAN_ID,         "The WAN ID" },
1628
    { TUNNEL_SUBTLV_BYTES,          "The Bytes" },
1629
    { TUNNEL_SUBTLV_IPSEC_DIM,      "IPSEC DIM" },
1630
    { TUNNEL_SUBTLV_IPSEC_KEY_EXCH, "IPSEC Key Exchange" },
1631
    { TUNNEL_SUBTLV_IPSEC_SA_PROPS, "IPSEC SA Proposals" },
1632
    { TUNNEL_SUBTLV_SRV_SEGMENT_LIST, "Service Segment List" },
1633
    { TUNNEL_SUBTLV_SRV_VTEP,       "Service Vtep" },
1634
    { TUNNEL_SUBTLV_DES_ADJACENCY,  "Distributed Etherlink Switch (DES) Adjacency" },
1635
    { 0, NULL }
1636
};
1637
1638
static const value_string bgp_enlp_type[] = {
1639
    { 0 , "Reserved" },
1640
    { 1 , "Push IPv4, do not push IPv6" },
1641
    { 2 , "Push IPv6, do not push IPv4" },
1642
    { 3 , "Push IPv4, push IPv6" },
1643
    { 4 , "Do not push" },
1644
    { 0, NULL }
1645
};
1646
1647
static const value_string bgp_sr_policy_list_type[] = {
1648
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A,      "Type A MPLS SID sub-TLV" },
1649
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B_OLD,  "Type B SRv6 SID sub-TLV (deprecated)" },
1650
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C,      "Type C IPv4 Node and SID sub-TLV" },
1651
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D,      "Type D IPv6 Node and SID for SR-MPLS sub-TLV" },
1652
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E,      "Type E IPv4 Node, index and SID sub-TLV" },
1653
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F,      "Type F IPv4 Local/Remote addresses and SID sub-TLV" },
1654
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G,      "Type G IPv6 Node, index for remote and local pair and SID for SR-MPLS sub-TLV" },
1655
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H,      "Type H IPv6 Local/Remote addresses and SID sub-TLV" },
1656
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT, "Weight sub-TLV" },
1657
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I_OLD,  "Type I IPv6 Node and SID for SRv6 sub-TLV (deprecated)" },
1658
    { 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)" },
1659
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K_OLD,  "Type K IPv6 Local/Remote addresses and SID for SRv6 sub-TLV (deprecated)" },
1660
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B,      "Type B SRv6 SID sub-TLV" },
1661
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I,      "Type I IPv6 Node and SID for SRv6 sub-TLV" },
1662
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J,      "Type J IPv6 Node, index for remote and local pair and SID for SRv6 sub-TLV" },
1663
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K,      "Type K IPv6 Local/Remote addresses and SID for SRv6 sub-TLV" },
1664
    { 0, NULL }
1665
};
1666
1667
/* Short display names for segment list sub-TLV types, used in parent item summary */
1668
static const value_string bgp_sr_policy_list_type_short[] = {
1669
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A,      "MPLS SID" },
1670
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B_OLD,  "SRv6 SID (deprecated)" },
1671
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C,      "IPv4+SID" },
1672
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D,      "IPv6+SID" },
1673
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E,      "IPv4+Index+SID" },
1674
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F,      "IPv4 Adj+SID" },
1675
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G,      "IPv6+Index+SID" },
1676
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H,      "IPv6 Adj+SID" },
1677
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT, "Weight" },
1678
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I_OLD,  "IPv6+SRv6 SID (deprecated)" },
1679
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J_OLD,  "SRv6+Index (deprecated)" },
1680
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K_OLD,  "SRv6 Adj (deprecated)" },
1681
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B,      "SRv6 SID" },
1682
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I,      "IPv6+SRv6 SID" },
1683
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J,      "SRv6+Index" },
1684
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K,      "SRv6 Adj" },
1685
    { 0, NULL }
1686
};
1687
1688
static const true_false_string tfs_bgpext_com_type_auth = {
1689
    "Allocated on Standard Action, Early Allocation or Experimental Basis",
1690
    "Allocated on First Come First Serve Basis"
1691
};
1692
1693
static const value_string bgpext_com_type_high[] = {
1694
    { BGP_EXT_COM_TYPE_HIGH_TR_AS2,        "Transitive 2-Octet AS-Specific" },
1695
    { BGP_EXT_COM_TYPE_HIGH_TR_IP4,        "Transitive IPv4-Address-Specific" },
1696
    { BGP_EXT_COM_TYPE_HIGH_TR_AS4,        "Transitive 4-Octet AS-Specific" },
1697
    { BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE,     "Transitive Opaque" },
1698
    { BGP_EXT_COM_TYPE_HIGH_TR_QOS,        "Transitive QoS Marking" },
1699
    { BGP_EXT_COM_TYPE_HIGH_TR_COS,        "Transitive CoS Capability" },
1700
    { BGP_EXT_COM_TYPE_HIGH_TR_EVPN,       "Transitive EVPN" },
1701
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I,     "FlowSpec Transitive" },
1702
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW,       "Transitive Flow spec redirect/mirror to IP next-hop" },
1703
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R,     "Transitive FlowSpec Redirect to indirection-id" },
1704
    { BGP_EXT_COM_TYPE_HIGH_TR_TP_CLASS,   "Transitive Transport Class" },
1705
    { BGP_EXT_COM_TYPE_HIGH_TR_SFC,        "Transitive SFC" },
1706
    { BGP_EXT_COM_TYPE_HIGH_TR_MUP,        "Transitive MUP" },
1707
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT,        "Generic Transitive Extended Community"},
1708
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT_2,      "Generic Transitive Extended Community Part 2"},
1709
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT_3,      "Generic Transitive Extended Community Part 3 "},
1710
    { BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP,  "Transitive Experimental EIGRP" },
1711
    { BGP_EXT_COM_TYPE_HIGH_NTR_AS2,       "Non-Transitive 2-Octet AS-Specific" },
1712
    { BGP_EXT_COM_TYPE_HIGH_NTR_IP4,       "Non-Transitive IPv4-Address-Specific" },
1713
    { BGP_EXT_COM_TYPE_HIGH_NTR_AS4,       "Non-Transitive 4-Octet AS-Specific" },
1714
    { BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE,    "Non-Transitive Opaque" },
1715
    { BGP_EXT_COM_TYPE_HIGH_NTR_QOS,       "Non-Transitive QoS Marking" },
1716
    { BGP_EXT_COM_TYPE_HIGH_NTR_FLOWSPEC,  "FlowSpec Non-Transitive Extended Communities" },
1717
    { BGP_EXT_COM_TYPE_HIGH_NTR_TRANSPORT, "Non-Transitive Transport Class" },
1718
    { 0, NULL}
1719
};
1720
1721
static const value_string bgpext_com_stype_tr_exp_2[] = {
1722
    { BGP_EXT_COM_STYPE_EXP_2_FLOW_RED,      "Flow spec redirect IPv4 format"},
1723
    { 0, NULL}
1724
};
1725
1726
static const value_string bgpext_com_stype_tr_exp_3[] = {
1727
    { BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP,     "Security Group AS4"},
1728
    { BGP_EXT_COM_STYPE_EXP_3_FLOW_RED,      "Flow spec redirect AS-4byte format"},
1729
    { BGP_EXT_COM_STYPE_EXP_3_TAG4,          "Tag4"},
1730
    { BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS,      "Origin Sub-Cluster4"},
1731
    { 0, NULL}
1732
};
1733
1734
static const value_string bgpext_com_stype_tr_evpn[] = {
1735
    { BGP_EXT_COM_STYPE_EVPN_MMAC,        "MAC Mobility" },
1736
    { BGP_EXT_COM_STYPE_EVPN_LABEL,       "ESI Label" },
1737
    { BGP_EXT_COM_STYPE_EVPN_IMP,         "ES-Import Route Target" },
1738
    { BGP_EXT_COM_STYPE_EVPN_ROUTERMAC,   "EVPN Router's MAC" },
1739
    { BGP_EXT_COM_STYPE_EVPN_L2ATTR,      "EVPN Layer 2 Attributes" },
1740
    { BGP_EXT_COM_STYPE_EVPN_ETREE,       "E-Tree" },
1741
    { BGP_EXT_COM_STYPE_EVPN_DF,          "DF Election" },
1742
    { BGP_EXT_COM_STYPE_EVPN_ISID,        "I-SID" },
1743
    { BGP_EXT_COM_STYPE_EVPN_ND,          "ARP/ND" },
1744
    { BGP_EXT_COM_STYPE_EVPN_MCFLAGS,     "Multicast Flags Extended Community" },
1745
    { BGP_EXT_COM_STYPE_EVPN_EVIRT0,      "EVI-RT Type 0 Extended Community" },
1746
    { BGP_EXT_COM_STYPE_EVPN_EVIRT1,      "EVI-RT Type 1 Extended Community" },
1747
    { BGP_EXT_COM_STYPE_EVPN_EVIRT2,      "EVI-RT Type 2 Extended Community" },
1748
    { BGP_EXT_COM_STYPE_EVPN_EVIRT3,      "EVI-RT Type 3 Extended Community" },
1749
    { BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT,  "EVPN Attachment Circuit" },
1750
    { BGP_EXT_COM_STYPE_EVPN_SVC_CARV_TS, "Service Carving Timestamp" },
1751
    { BGP_EXT_COM_STYPE_EVPN_LINK_BW,     "EVPN Link Bandwidth Extended Community" },
1752
    { BGP_EXT_COM_STYPE_EVPN_RT_EC,       "RT-derived-EC" },
1753
    { 0, NULL}
1754
};
1755
1756
static const value_string bgpext_com_stype_tr_as2[] = {
1757
    { BGP_EXT_COM_STYPE_AS2_RT,       "Route Target" },
1758
    { BGP_EXT_COM_STYPE_AS2_RO,       "Route Origin" },
1759
    { BGP_EXT_COM_STYPE_AS2_LBW,      "Link Bandwidth" },
1760
    { BGP_EXT_COM_STYPE_AS2_OSPF_DID, "OSPF Domain Identifier" },
1761
    { BGP_EXT_COM_STYPE_AS2_RT_AGG_P, "Route Aggregation Parameter" },
1762
    { BGP_EXT_COM_STYPE_AS2_DCOLL,    "BGP Data Collection" },
1763
    { BGP_EXT_COM_STYPE_AS2_SRC_AS,   "Source AS" },
1764
    { BGP_EXT_COM_STYPE_AS2_L2VPN,    "L2VPN Identifier" },
1765
    { BGP_EXT_COM_STYPE_AS2_CVPND,    "Cisco VPN-Distinguisher" },
1766
    { BGP_EXT_COM_STYPE_AS2_RT_REC,   "Route Target Record" },
1767
    { BGP_EXT_COM_STYPE_AS2_RT_EC,    "RT-derived-EC" },
1768
    { BGP_EXT_COM_STYPE_AS2_VNI,      "Virtual-Network Identifier" },
1769
    { 0, NULL}
1770
};
1771
1772
static const value_string bgpext_com_stype_ntr_as2[] = {
1773
    { BGP_EXT_COM_STYPE_AS2_LBW, "Link Bandwidth" },
1774
    { BGP_EXT_COM_STYPE_AS2_VNI, "Virtual-Network Identifier" },
1775
    { 0, NULL}
1776
};
1777
1778
static const value_string bgpext_com_stype_tr_as4[] = {
1779
    { BGP_EXT_COM_STYPE_AS4_RT,       "Route Target" },
1780
    { BGP_EXT_COM_STYPE_AS4_RO,       "Route Origin" },
1781
    { BGP_EXT_COM_STYPE_AS4_GEN,      "Generic" },
1782
    { BGP_EXT_COM_STYPE_AS4_OSPF_DID, "OSPF Domain Identifier" },
1783
    { BGP_EXT_COM_STYPE_AS4_BGP_DC,   "BGP Data Collection"},
1784
    { BGP_EXT_COM_STYPE_AS4_S_AS,     "Source AS" },
1785
    { BGP_EXT_COM_STYPE_AS4_CIS_V,    "Cisco VPN Identifier" },
1786
    { BGP_EXT_COM_STYPE_AS4_RT_REC,   "Route-Target Record"},
1787
    { BGP_EXT_COM_STYPE_AS4_RT_EC,    "RT-derived-EC" },
1788
    { 0, NULL}
1789
};
1790
1791
static const value_string bgpext_com_stype_ntr_as4[] = {
1792
    { BGP_EXT_COM_STYPE_AS4_GEN, "Generic" },
1793
    { 0, NULL}
1794
};
1795
1796
static const value_string bgpext_com_stype_tr_IP4[] = {
1797
    { BGP_EXT_COM_STYPE_IP4_RT,       "Route Target" },
1798
    { BGP_EXT_COM_STYPE_IP4_RO,       "Route Origin" },
1799
    { BGP_EXT_COM_STYPE_IP4_IFIT_TAIL,"IPv4-Address-Specific IFIT Tail Community" },
1800
    { BGP_EXT_COM_STYPE_IP4_OSPF_DID, "OSPF Domain Identifier" },
1801
    { BGP_EXT_COM_STYPE_IP4_OSPF_RID, "OSPF Router ID" },
1802
    { BGP_EXT_COM_STYPE_IP4_NODE_TGT, "Node Target Extended Community" },
1803
    { BGP_EXT_COM_STYPE_IP4_L2VPN,    "L2VPN Identifier" },
1804
    { BGP_EXT_COM_STYPE_IP4_VRF_I,    "VRF Route Import" },
1805
    { BGP_EXT_COM_STYPE_IP4_FLOW_RDR, "Flow-spec Redirect to IPv4" },
1806
    { BGP_EXT_COM_STYPE_IP4_CIS_D,    "Cisco VPN-Distinguisher" },
1807
    { BGP_EXT_COM_STYPE_IP4_SEG_NH,   "Inter-area P2MP Segmented Next-Hop" },
1808
    { BGP_EXT_COM_STYPE_IP4_RT_REC,   "Route-Target Record" },
1809
    { BGP_EXT_COM_STYPE_IP4_VRF_RNH,  "VRF-Recursive-Next-Hop-Extended-Community" },
1810
    { BGP_EXT_COM_STYPE_IP4_RT_EC,    "RT-derived-EC" },
1811
    { BGP_EXT_COM_STYPE_IP4_MVPN_RP,  "MVPN SA RP-address Extended Community" },
1812
    { 0, NULL}
1813
};
1814
1815
static const value_string bgpext_com_stype_ntr_IP4[] = {
1816
    { BGP_EXT_COM_STYPE_IP4_NODE_TGT, "Node Target Extended Community" },
1817
    { 0, NULL}
1818
};
1819
1820
static const value_string bgpext_com_stype_tr_opaque[] = {
1821
    { BGP_EXT_COM_STYPE_OPA_COST,      "Cost" },
1822
    { BGP_EXT_COM_STYPE_OPA_CP_OSPF,   "CP-ORF" },
1823
    { BGP_EXT_COM_STYPE_OPA_EXTN_SRC,  "Extranet Source Extended Community" },
1824
    { BGP_EXT_COM_STYPE_OPA_EXTN_SEP,  "Extranet Separation Extended Community" },
1825
    { BGP_EXT_COM_STYPE_OPA_OSPF_RT,   "OSPF Route Type" },
1826
    { BGP_EXT_COM_STYPE_OPA_PMSI_ATTR, "Additional PMSI Tunnel Attribute Flags" },
1827
    { BGP_EXT_COM_STYPE_OPA_CTX_LBL,   "Context-Specific Label Space ID Extended Community" },
1828
    { BGP_EXT_COM_STYPE_OPA_COLOR,     "Color" },
1829
    { BGP_EXT_COM_STYPE_OPA_ENCAP,     "Encapsulation" },
1830
    { BGP_EXT_COM_STYPE_OPA_DGTW,      "Default Gateway" },
1831
    { BGP_EXT_COM_STYPE_OPA_PPMP_LBL,  "Point-to-Point-to-Multipoint (PPMP) Label" },
1832
    { BGP_EXT_COM_STYPE_OPA_GRP_TAG,   "BGP Group Policy Class Tag Extended Community" },
1833
    { BGP_EXT_COM_STYPE_OPA_HSH_SRT,   "Consistent Hash Sort Order" },
1834
    { BGP_EXT_COM_STYPE_OPA_GRP_PID,   "Group Policy ID Extended Community" },
1835
    { BGP_EXT_COM_STYPE_OPA_LCM,       "Local Color Mapping (LCM)" },
1836
    { BGP_EXT_COM_STYPE_OPA_LOADBAL,   "LoadBalance" },
1837
    { 0, NULL}
1838
};
1839
1840
static const value_string bgpext_com_cost_poi_type[] = {
1841
    { BGP_EXT_COM_COST_POI_ORIGIN,  "\"Lowest Origin code\" step" },
1842
    { BGP_EXT_COM_COST_POI_ASPATH,  "\"Shortest AS_PATH\" step" },
1843
    { BGP_EXT_COM_COST_POI_MED,     "\"Lowest MED\" step" },
1844
    { BGP_EXT_COM_COST_POI_LP,      "\"Highest Local Preference\" step" },
1845
    { BGP_EXT_COM_COST_POI_AIGP,    "\"Lowest Accumulated IGP Cost\" step" },
1846
    { BGP_EXT_COM_COST_POI_ABS,     "Before BGP Best Path algorithm" },
1847
    { BGP_EXT_COM_COST_POI_IGP,     "\"Smallest IGP Metric\" step" },
1848
    { BGP_EXT_COM_COST_POI_EI,      "\"Prefer eBGP to iBGP\" step" },
1849
    { BGP_EXT_COM_COST_POI_RID,     "\"Smallest BGP RID\" step" },
1850
    { 0,NULL}
1851
};
1852
1853
static const value_string bgpext_com_tunnel_type[] = {
1854
    { BGP_EXT_COM_TUNNEL_RESERVED,      "Reserved" },
1855
    { BGP_EXT_COM_TUNNEL_L2TPV3,        "L2TPv3 over IP" },
1856
    { BGP_EXT_COM_TUNNEL_GRE,           "GRE" },
1857
    { BGP_EXT_COM_TUNNEL_ENDP,          "Transmit tunnel endpoint" },
1858
    { BGP_EXT_COM_TUNNEL_IPSEC,         "IPsec in Tunnel-mode" },
1859
    { BGP_EXT_COM_TUNNEL_IPIPSEC,       "IP in IP tunnel with IPsec Transport Mode" },
1860
    { BGP_EXT_COM_TUNNEL_MPLSIP,        "MPLS-in-IP tunnel with IPsec Transport Mode" },
1861
    { BGP_EXT_COM_TUNNEL_IPIP,          "IP in IP" },
1862
    { BGP_EXT_COM_TUNNEL_VXLAN,         "VXLAN Encapsulation" },
1863
    { BGP_EXT_COM_TUNNEL_NVGRE,         "NVGRE Encapsulation" },
1864
    { BGP_EXT_COM_TUNNEL_MPLS,          "MPLS Encapsulation" },
1865
    { BGP_EXT_COM_TUNNEL_MPLSGRE,       "MPLS in GRE Encapsulation" },
1866
    { BGP_EXT_COM_TUNNEL_VXLANGPE,      "VxLAN GPE Encapsulation" },
1867
    { BGP_EXT_COM_TUNNEL_MPLSUDP,       "MPLS in UDP Encapsulation" },
1868
    { BGP_EXT_COM_TUNNEL_IPV6_TUNNEL,   "IPv6 Tunnel" },
1869
    { BGP_EXT_COM_TUNNEL_SE_TE_POLICY,  "SR TE Policy Type" },
1870
    { BGP_EXT_COM_TUNNEL_BARE,          "Bare" },
1871
    { BGP_EXT_COM_TUNNEL_SR_TUNNEL,     "SR Tunnel" },
1872
    { BGP_EXT_COM_TUNNEL_CLOUD_SEC,     "Cloud Security" },
1873
    { BGP_EXT_COM_TUNNEL_GENEVE_ENCAP,  "Geneve Encapsulation" },
1874
    { BGP_EXT_COM_TUNNEL_ANY_ENCAP,     "Any Encapsulation" },
1875
    { BGP_EXT_COM_TUNNEL_GTP_TUNNEL,    "GTP Tunnel Type" },
1876
    { BGP_EXT_COM_TUNNEL_DPS_TUNNEL,    "Dynamic Path Selection (DPS) Tunnel Encapsulation" },
1877
    { BGP_EXT_COM_TUNNEL_OPE,           "Originating PE (OPE)" },
1878
    { BGP_EXT_COM_TUNNEL_DYN_DPS_POL,   "Dynamic Path Selection (DPS) Policy" },
1879
    { BGP_EXT_COM_TUNNEL_SDWAN_HYB,     "SDWAN-Hybrid" },
1880
    { BGP_EXT_COM_TUNNEL_X_OVER_UDP,    "X-over-UDP" },
1881
    { BGP_EXT_COM_TUNNEL_DES_ENCAP,     "Distributed Etherlink Switch (DES) Tunnel Encapsulation" },
1882
    { 0, NULL}
1883
};
1884
1885
static const value_string bgpext_com_stype_ntr_opaque[] = {
1886
    { BGP_EXT_COM_STYPE_OPA_OR_VAL_ST,  "BGP Origin Validation state" },
1887
    { BGP_EXT_COM_STYPE_OPA_COST,       "Cost Community" },
1888
    { BGP_EXT_COM_STYPE_OPA_RT,         "Route Target" },
1889
    { BGP_EXT_COM_STYPE_OPA_RT_EC,      "RT-derived-EC" },
1890
    { 0, NULL}
1891
};
1892
1893
static const value_string bgpext_com_stype_tr_exp[] = {
1894
    { BGP_EXT_COM_STYPE_EXP_OSPF_RT,    "OSPF Route Type" },
1895
    { BGP_EXT_COM_STYPE_EXP_OSPF_RID,   "OSPF Router ID" },
1896
    { BGP_EXT_COM_STYPE_EXP_SEC_GROUP,  "Security Group" },
1897
    { BGP_EXT_COM_STYPE_EXP_OSPF_DID,   "OSPF Domain Identifier" },
1898
    { BGP_EXT_COM_STYPE_EXP_F_TR,       "Flow spec traffic-rate" },
1899
    { BGP_EXT_COM_STYPE_EXP_F_TA,       "Flow spec traffic-action" },
1900
    { BGP_EXT_COM_STYPE_EXP_F_RED,      "Flow spec redirect AS 2 bytes" },
1901
    { BGP_EXT_COM_STYPE_EXP_F_RMARK,    "Flow spec traffic-remarking" },
1902
    { BGP_EXT_COM_STYPE_EXP_L2,         "Layer2 Info" },
1903
    { BGP_EXT_COM_STYPE_EXP_ETREE,      "E-Tree Info" },
1904
    { BGP_EXT_COM_STYPE_EXP_FLOW_RATE,  "Flow spec traffic-rate-packets" },
1905
    { BGP_EXT_COM_STYPE_EXP_FLOW_SFC,   "Flow Specification for SFC Classifiers" },
1906
    { BGP_EXT_COM_STYPE_EXP_TAG,        "Tag" },
1907
    { BGP_EXT_COM_STYPE_EXP_SUB_CLUS,   "Origin Sub-Cluster" },
1908
    { 0, NULL}
1909
};
1910
1911
static const value_string bgpext_com_stype_tr_eigrp[] = {
1912
    { BGP_EXT_COM_STYPE_EXP_EIGRP_FT,   "EIGRP Route Flags, Route Tag" },
1913
    { BGP_EXT_COM_STYPE_EXP_EIGRP_AD,   "EIGRP AS Number, Delay" },
1914
    { BGP_EXT_COM_STYPE_EXP_EIGRP_RHB,  "EIGRP Reliability, Hop Count, Bandwidth" },
1915
    { BGP_EXT_COM_STYPE_EXP_EIGRP_LM,   "EIGRP Load, MTU" },
1916
    { BGP_EXT_COM_STYPE_EXP_EIGRP_EAR,  "EIGRP External AS Number, Router ID" },
1917
    { BGP_EXT_COM_STYPE_EXP_EIGRP_EPM,  "EIGRP External Protocol, Metric" },
1918
    { BGP_EXT_COM_STYPE_EXP_EIGRP_RID,  "EIGRP Originating Router ID" },
1919
    { 0, NULL}
1920
};
1921
1922
static const value_string bgpext_com_stype_tr_mup[] = {
1923
    { BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_AS2,    "MUP Direct Segment (2-Octet AS Specific)"},
1924
    { BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_IP4,    "MUP Direct Segment (IPv4 Address Specific)"},
1925
    { BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_AS4,    "MUP Direct Segment (4-Octet AS Specific)"},
1926
    { BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_AS2, "MUP Interwork Segment (2-Octet AS Specific)"},
1927
    { BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_IP4, "MUP Interwork Segment (IPv4 Address Specific)"},
1928
    { BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_AS4, "MUP Interwork Segment (4-Octet AS Specific)"},
1929
    { 0, NULL}
1930
};
1931
1932
static const value_string flow_spec_op_len_val[] = {
1933
    { 0, "1 byte: 1 <<"  },
1934
    { 1, "2 bytes: 1 <<" },
1935
    { 2, "4 bytes: 1 <<" },
1936
    { 3, "8 bytes: 1 <<" },
1937
    { 0, NULL  }
1938
};
1939
1940
static const value_string qos_tech_type[] = {
1941
    { QOS_TECH_TYPE_DSCP,         "DiffServ enabled IP (DSCP encoding)" },
1942
    { QOS_TECH_TYPE_802_1q,       "Ethernet using 802.1q priority tag" },
1943
    { QOS_TECH_TYPE_E_LSP,        "MPLS using E-LSP" },
1944
    { QOS_TECH_TYPE_VC,           "Virtual Channel (VC) encoding" },
1945
    { QOS_TECH_TYPE_GMPLS_TIME,   "GMPLS - time slot encoding" },
1946
    { QOS_TECH_TYPE_GMPLS_LAMBDA, "GMPLS - lambda encoding" },
1947
    { QOS_TECH_TYPE_GMPLS_FIBRE,  "GMPLS - fibre encoding" },
1948
    { 0, NULL }
1949
};
1950
1951
static const value_string bgp_ssa_type[] = {
1952
    { BGP_SSA_L2TPv3 ,          "L2TPv3 Tunnel" },
1953
    { BGP_SSA_mGRE ,            "mGRE Tunnel" },
1954
    { BGP_SSA_IPSec ,           "IPSec Tunnel" },
1955
    { BGP_SSA_MPLS ,            "MPLS Tunnel" },
1956
    { BGP_SSA_L2TPv3_IN_IPSec , "L2TPv3 in IPSec Tunnel" },
1957
    { BGP_SSA_mGRE_IN_IPSec ,   "mGRE in IPSec Tunnel" },
1958
    { 0, NULL }
1959
};
1960
1961
/*
1962
 * BGP Layer 2 Encapsulation Types
1963
 *
1964
 * RFC 6624
1965
 *
1966
 * http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-l2-encapsulation-types-registry
1967
 */
1968
static const value_string bgp_l2vpn_encaps[] = {
1969
    { 0,  "Reserved"},
1970
    { 1,  "Frame Relay"},
1971
    { 2,  "ATM AAL5 SDU VCC transport"},
1972
    { 3,  "ATM transparent cell transport"},
1973
    { 4,  "Ethernet (VLAN) Tagged mode"},
1974
    { 5,  "Ethernet raw mode"},
1975
    { 6,  "Cisco-HDLC"},
1976
    { 7,  "PPP"},
1977
    { 8,  "SONET/SDH CES"},
1978
    { 9,  "ATM n-to-one VCC cell transport"},
1979
    { 10, "ATM n-to-one VPC cell transport"},
1980
    { 11, "IP layer 2 transport"},
1981
    { 15, "Frame relay port mode"},
1982
    { 17, "Structure agnostic E1 over packet"},
1983
    { 18, "Structure agnostic T1 over packet"},
1984
    { 19, "VPLS"},
1985
    { 20, "Structure agnostic T3 over packet"},
1986
    { 21, "Nx64kbit/s Basic Service using Structure-aware"},
1987
    { 25, "Frame Relay DLCI"},
1988
    { 40, "Structure agnostic E3 over packet"},
1989
    { 41, "Octet-aligned playload for structure-agnostic DS1 circuits"},
1990
    { 42, "E1 Nx64kbit/s with CAS using Structure-aware"},
1991
    { 43, "DS1 (ESF) Nx64kbit/s with CAS using Structure-aware"},
1992
    { 44, "DS1 (SF) Nx64kbit/s with CAS using Structure-aware"},
1993
    { 64, "IP-interworking"},
1994
    { 0, NULL }
1995
};
1996
1997
static const value_string bgpext_com_ospf_rtype[] = {
1998
  { BGP_OSPF_RTYPE_RTR, "Router" },
1999
  { BGP_OSPF_RTYPE_NET, "Network" },
2000
  { BGP_OSPF_RTYPE_SUM, "Summary" },
2001
  { BGP_OSPF_RTYPE_EXT, "External" },
2002
  { BGP_OSPF_RTYPE_NSSA,"NSSA External" },
2003
  { BGP_OSPF_RTYPE_SHAM,"MPLS-VPN Sham" },
2004
  { 0, NULL }
2005
};
2006
2007
/* Subsequent address family identifier, RFC4760 */
2008
static const value_string bgpattr_nlri_safi[] = {
2009
    { 0,                        "Reserved" },
2010
    { SAFNUM_UNICAST,           "Unicast" },
2011
    { SAFNUM_MULCAST,           "Multicast" },
2012
    { SAFNUM_UNIMULC,           "Unicast+Multicast (Deprecated)" },
2013
    { SAFNUM_MPLS_LABEL,        "Labeled Unicast" },
2014
    { SAFNUM_MCAST_VPN,         "MCAST-VPN" },
2015
    { SAFNUM_MULTISEG_PW,       "Multi-Segment Pseudowires" },
2016
    { SAFNUM_ENCAPSULATION,     "Encapsulation (Deprecated)" },
2017
    { SAFNUM_MCAST_VPLS,        "MCAST-VPLS" },
2018
    { SAFNUM_TUNNEL,            "Tunnel (Deprecated)" },
2019
    { SAFNUM_VPLS,              "VPLS" },
2020
    { SAFNUM_MDT,               "Cisco MDT" },
2021
    { SAFNUM_4OVER6,            "4over6" },
2022
    { SAFNUM_6OVER4,            "6over4" },
2023
    { SAFNUM_L1VPN,             "Layer-1 VPN" },
2024
    { SAFNUM_EVPN,              "EVPN" },
2025
    { SAFNUM_BGP_LS,            "BGP-LS" },
2026
    { SAFNUM_BGP_LS_VPN,        "BGP-LS-VPN" },
2027
    { SAFNUM_SR_POLICY,         "SR Policy" },
2028
    { SAFNUM_SD_WAN,            "SD-WAN" },
2029
    { SAFNUM_RPD,               "Routing Policy Distribution" },
2030
    { SAFNUM_CT,                "Classful Transport Planes" },
2031
    { SAFNUM_FLOWSPEC,          "Tunneled Traffic Flowspec" },
2032
    { SAFNUM_MCAST_TREE,        "MCAST-TREE" },
2033
    { SAFNUM_BGP_DPS,           "Dynamic Path Selection" },
2034
    { SAFNUM_BGP_LS_SPF,        "BGP-LS-SPF" },
2035
    { SAFNUM_BGP_CAR,           "BGP-CAR" },
2036
    { SAFNUM_BGP_VPN_CAR,       "BGP-VPN-CAR" },
2037
    { SAFNUM_BGP_MUP,           "BGP-MUP" },
2038
    { SAFNUM_LAB_VPNUNICAST,    "Labeled VPN Unicast" },
2039
    { SAFNUM_LAB_VPNMULCAST,    "Labeled VPN Multicast" },
2040
    { SAFNUM_LAB_VPNUNIMULC,    "Labeled VPN Unicast+Multicast (Deprecated)" },
2041
    { SAFNUM_ROUTE_TARGET,      "Route Target Filter" },
2042
    { SAFNUM_FSPEC_RULE,        "Flow Spec Filter" },
2043
    { SAFNUM_FSPEC_VPN_RULE,    "Flow Spec Filter VPN" },
2044
    { SAFNUM_L3VPN,             "Layer-3 VPN (Deprecated)" },
2045
    { 0, NULL }
2046
};
2047
2048
/* ORF Type, RFC5291 */
2049
static const value_string orf_type_vals[] = {
2050
    /* first 3 entries: questionable origin */
2051
    { BGP_ORF_COMM,           "(unregistered) Communities ORF-Type" },
2052
    { BGP_ORF_EXTCOMM,        "(unregistered) Extended Communities ORF-Type" },
2053
    { BGP_ORF_ASPATH,         "(unregistered) AS-path ORF-Type" },
2054
    /* IANA registered */
2055
    { BGP_ORF_PREFIX,         "Address Prefix ORF" },
2056
    { BGP_ORF_CP_ORF,         "CP-ORF" },
2057
    { BGP_ORF_VPN_PREFIX,     "VPN Prefix ORF" },
2058
    /* vendor-specific */
2059
    { BGP_ORF_PREFIX_CISCO,   "Cisco PrefixList ORF-Type" },
2060
    { BGP_ORF_COMM_CISCO,     "Cisco CommunityList ORF-Type" },
2061
    { BGP_ORF_EXTCOMM_CISCO,  "Cisco Extended CommunityList ORF-Type" },
2062
    { BGP_ORF_ASPATH_CISCO,   "Cisco AsPathList ORF-Type" },
2063
    { 0,        NULL }
2064
};
2065
2066
/* ORF Send/Receive, RFC5291 */
2067
static const value_string orf_send_recv_vals[] = {
2068
    { 1,        "Receive" },
2069
    { 2,        "Send" },
2070
    { 3,        "Both" },
2071
    { 0,        NULL }
2072
};
2073
2074
/* ORF Send/Receive, RFC5291 */
2075
static const value_string orf_when_vals[] = {
2076
    { 1,        "Immediate" },
2077
    { 2,        "Defer" },
2078
    { 0,        NULL }
2079
};
2080
2081
static const value_string orf_entry_action_vals[] = {
2082
    { BGP_ORF_ADD,          "Add" },
2083
    { BGP_ORF_REMOVE,       "Remove" },
2084
    { BGP_ORF_REMOVEALL,    "RemoveAll" },
2085
    { 0,        NULL }
2086
};
2087
2088
static const value_string orf_entry_match_vals[] = {
2089
    { BGP_ORF_PERMIT,   "Permit" },
2090
    { BGP_ORF_DENY,     "Deny" },
2091
    { 0,        NULL }
2092
};
2093
2094
/* BGPsec Send/Receive, RFC8205 */
2095
static const value_string bgpsec_send_receive_vals[] = {
2096
    { 0,        "Receive" },
2097
    { 1,        "Send" },
2098
    { 0,        NULL }
2099
};
2100
2101
/* BGP Role, RFC9234 */
2102
static const value_string bgprole_vals[] = {
2103
    { 0,        "Provider" },
2104
    { 1,        "RS" },
2105
    { 2,        "RS-Client" },
2106
    { 3,        "Customer" },
2107
    { 4,        "Peer" },
2108
    { 0,        NULL }
2109
};
2110
2111
static const value_string capability_vals[] = {
2112
    { BGP_CAPABILITY_RESERVED,                      "Reserved capability" },
2113
    { BGP_CAPABILITY_MULTIPROTOCOL,                 "Multiprotocol extensions capability" },
2114
    { BGP_CAPABILITY_ROUTE_REFRESH,                 "Route refresh capability" },
2115
    { BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING,   "Cooperative route filtering capability" },
2116
    { BGP_CAPABILITY_MULTIPLE_ROUTE_DEST,           "Multiple routes to a destination capability" },
2117
    { BGP_CAPABILITY_EXTENDED_NEXT_HOP,             "Extended Next Hop Encoding" },
2118
    { BGP_CAPABILITY_EXTENDED_MESSAGE,              "BGP-Extended Message" },
2119
    { BGP_CAPABILITY_BGPSEC,                        "BGPsec capability" },
2120
    { BGP_CAPABILITY_MULTIPLE_LABELS,               "Multiple Labels capability" },
2121
    { BGP_CAPABILITY_BGP_ROLE,                      "BGP Role" },
2122
    { BGP_CAPABILITY_GRACEFUL_RESTART,              "Graceful Restart capability" },
2123
    { BGP_CAPABILITY_4_OCTET_AS_NUMBER,             "Support for 4-octet AS number capability" },
2124
    { BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO,      "Deprecated Dynamic Capability (Cisco)" },
2125
    { BGP_CAPABILITY_DYNAMIC_CAPABILITY,            "Support for Dynamic capability" },
2126
    { BGP_CAPABILITY_MULTISESSION,                  "Multisession BGP Capability" },
2127
    { BGP_CAPABILITY_ADDITIONAL_PATHS,              "Support for Additional Paths" },
2128
    { BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH,        "Enhanced route refresh capability" },
2129
    { BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART,   "Long-Lived Graceful Restart (LLGR) Capability" },
2130
    { BGP_CAPABILITY_CP_ORF,                        "CP-ORF Capability" },
2131
    { BGP_CAPABILITY_FQDN,                          "FQDN Capability" },
2132
    { BGP_CAPABILITY_BFD_STRICT,                    "BFD Strict-Mode capability" },
2133
    { BGP_CAPABILITY_SOFT_VERSION,                  "Software Version Capability" },
2134
    { BGP_CAPABILITY_PATHS_LIMIT,                   "PATHS-LIMIT Capability" },
2135
    { BGP_CAPABILITY_ROUTE_REFRESH_CISCO,           "Route Refresh Capability (Cisco)" },
2136
    { BGP_CAPABILITY_RPD_CISCO,                     "Routing Policy Distribution (Cisco)" },
2137
    { BGP_CAPABILITY_ORF_CISCO,                     "Outbound Route Filtering (Cisco)" },
2138
    { BGP_CAPABILITY_MULTISESSION_CISCO,            "Multisession (Cisco)" },
2139
    { BGP_CAPABILITY_FQDN_CISCO,                    "FQDN (Cisco)" },
2140
    { BGP_CAPABILITY_OPERATIONAL_MSG_CISCO,         "OPERATIONAL message (Cisco)" },
2141
    { BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP,           "Link-Local Next Hop Capability" },
2142
    { 0, NULL }
2143
};
2144
2145
static const value_string community_vals[] = {
2146
    { BGP_COMM_GRACEFUL_SHUTDOWN,   "GRACEFUL_SHUTDOWN" },
2147
    { BGP_COMM_ACCEPT_OWN,          "ACCEPT_OWN" },
2148
    { BGP_COMM_RT_FLTR_XLTD_V4,     "ROUTE_FILTER_TRANSLATED_v4" },
2149
    { BGP_COMM_RT_FLTR_V4,          "ROUTE_FILTER_v4" },
2150
    { BGP_COMM_RT_FLTR_XLTD_V6,     "ROUTE_FILTER_TRANSLATED_v6" },
2151
    { BGP_COMM_RT_FLTR_V6,          "ROUTE_FILTER_v6" },
2152
    { BGP_COMM_LLGR_STALE,          "LLGR_STALE" },
2153
    { BGP_COMM_NO_LLGR,             "NO_LLGR" },
2154
    { BGP_COMM_ACCEPT_OWN_HOP,      "accept-own-nexthop" },
2155
    { BGP_COMM_STANDBY_PE,          "Standby PE" },
2156
    { BGP_COMM_BLACKHOLE,           "BLACKHOLE" },
2157
    { BGP_COMM_NO_EXPORT,           "NO_EXPORT" },
2158
    { BGP_COMM_NO_ADVERTISE,        "NO_ADVERTISE" },
2159
    { BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
2160
    { BGP_COMM_NOPEER,              "NOPEER" },
2161
    { 0,                            NULL }
2162
};
2163
2164
/* Capability Message action code */
2165
static const value_string bgpcap_action[] = {
2166
    { 0, "advertising a capability" },
2167
    { 1, "removing a capability" },
2168
    { 0, NULL }
2169
};
2170
2171
static const value_string mcast_vpn_route_type[] = {
2172
    { MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD, "Intra-AS I-PMSI A-D route" },
2173
    { MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD, "Inter-AS I-PMSI A-D route" },
2174
    { MCAST_VPN_RTYPE_SPMSI_AD         , "S-PMSI A-D route" },
2175
    { MCAST_VPN_RTYPE_LEAF_AD          , "Leaf A-D route" },
2176
    { MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD , "Source Active A-D route" },
2177
    { MCAST_VPN_RTYPE_SHARED_TREE_JOIN , "Shared Tree Join route" },
2178
    { MCAST_VPN_RTYPE_SOURCE_TREE_JOIN , "Source Tree Join route" },
2179
    { 0, NULL }
2180
};
2181
2182
/* NLRI type value_string as defined in idr-ls */
2183
static const value_string bgp_ls_nlri_type_vals[] = {
2184
    { LINK_STATE_NODE_NLRI,                 "Node NLRI" },
2185
    { LINK_STATE_LINK_NLRI,                 "Link NLRI" },
2186
    { LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI, "IPv4 Topology Prefix NLRI" },
2187
    { LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI, "IPv6 Topology Prefix NLRI" },
2188
    { LINK_STATE_SR_POLICY_CANDIDATE_PATH,  "ST Policy Candidate Path NLRI" },
2189
    { LINK_STATE_SRV6_SID_NLRI,             "SRv6 SID NLRI" },
2190
    { LINK_STATE_STUB_LINK_NLRI,            "Stub Link NLRI" },
2191
    { 0, NULL },
2192
};
2193
2194
/* Link-State NLRI Protocol-ID value strings */
2195
static const value_string link_state_nlri_protocol_id_values[] = {
2196
    { BGP_LS_NLRI_PROTO_ID_UNKNOWN,         "Unknown" },
2197
    { BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1,   "IS-IS Level 1"},
2198
    { BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2,   "IS-IS Level 2"},
2199
    { BGP_LS_NLRI_PROTO_ID_OSPF_V2,         "OSPFv2"},
2200
    { BGP_LS_NLRI_PROTO_ID_DIRECT,          "Direct"},
2201
    { BGP_LS_NLRI_PROTO_ID_STATIC,          "Static"},
2202
    { BGP_LS_NLRI_PROTO_ID_OSPF_V3,         "OSPFv3"},
2203
    { BGP_LS_NLRI_PROTO_ID_BGP,             "BGP"},
2204
    { BGP_LS_NLRI_PROTO_ID_RSVP_TE,         "RSVP-TE" },
2205
    { BGP_LS_NLRI_PROTO_ID_SEGMENT_ROUTING, "Segment Routing" },
2206
    { 0, NULL},
2207
};
2208
2209
/* Link-State routing universes */
2210
static const val64_string link_state_nlri_routing_universe_values[] = {
2211
    { BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3, "L3 packet topology" },
2212
    { BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1, "L1 optical topology"},
2213
    { 0, NULL}
2214
};
2215
2216
/* Link state prefix NLRI OSPF Route Type */
2217
static const value_string link_state_prefix_descriptors_ospf_route_type[] = {
2218
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN,     "Unknown" },
2219
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA,  "Intra-Area"},
2220
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA,  "Inter Area"},
2221
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1,  "External 1"},
2222
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2,  "External 2"},
2223
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1,      "NSSA 1"},
2224
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2,      "NSSA 2"},
2225
    { 0 , NULL}
2226
};
2227
2228
/* Link state Flex Algo Metric Type: draft-ietf-lsr-flex-algo-17 */
2229
static const value_string flex_algo_metric_types[] = {
2230
    { 0, "IGP Metric"},
2231
    { 1, "Min Unidirectional Link Delay"},
2232
    { 2, "TE Metric"},
2233
    { 0, NULL }
2234
};
2235
2236
/* Link state IGP Algorithm Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
2237
static const value_string igp_algo_types[] = {
2238
    { 0,   "Shortest Path First (SPF)" },
2239
    { 1,   "Strict Shortest Path First (Strict SPF)" },
2240
    { 0,   NULL }
2241
};
2242
2243
/* Link state IGP MSD Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
2244
static const value_string igp_msd_types[] = {
2245
    { 0,   "Reserved" },
2246
    { 1,   "Base MPLS Imposition MSD" },
2247
    { 2,   "ERLD-MSD" },
2248
    { 41,  "SRH Max SL" },
2249
    { 42,  "SRH Max End Pop" },
2250
    { 44,  "SRH Max H.Encaps" },
2251
    { 45,  "SRH Max End D" },
2252
    { 0,   NULL }
2253
};
2254
2255
/* NLRI type value_string as define in BGP flow spec RFC */
2256
2257
static const value_string flowspec_nlri_opvaluepair_type[] = {
2258
    { BGPNLRI_FSPEC_DST_PFIX, "Destination prefix filter" },
2259
    { BGPNLRI_FSPEC_SRC_PFIX, "Source prefix filter" },
2260
    { BGPNLRI_FSPEC_IP_PROTO, "Protocol / Next Header filter" },
2261
    { BGPNLRI_FSPEC_PORT,     "Port filter" },
2262
    { BGPNLRI_FSPEC_DST_PORT, "Destination port filter" },
2263
    { BGPNLRI_FSPEC_SRC_PORT, "Source port filter" },
2264
    { BGPNLRI_FSPEC_ICMP_TP,  "ICMP type filter" },
2265
    { BGPNLRI_FSPEC_ICMP_CD,  "ICMP code filter" },
2266
    { BGPNLRI_FSPEC_TCP_FLAGS,"TCP flags filter" },
2267
    { BGPNLRI_FSPEC_PCK_LEN,  "Packet Length filter" },
2268
    { BGPNLRI_FSPEC_DSCP,     "DSCP marking filter" },
2269
    { BGPNLRI_FSPEC_FRAGMENT, "IP fragment filter" },
2270
    { 0, NULL },
2271
};
2272
2273
/* Subtype Route Refresh, draft-ietf-idr-bgp-enhanced-route-refresh-02 */
2274
static const value_string route_refresh_subtype_vals[] = {
2275
    { 0, "Normal route refresh request [RFC2918] with/without ORF [RFC5291]" },
2276
    { 1, "Demarcation of the beginning of a route refresh" },
2277
    { 2, "Demarcation of the ending of a route refresh" },
2278
    { 0,  NULL }
2279
};
2280
2281
static const value_string bgp_prefix_sid_type[] = {
2282
    { BGP_PREFIX_SID_TLV_LABEL_INDEX,     "Label-Index" },
2283
    { BGP_PREFIX_SID_TLV_2,               "Deprecated" },
2284
    { BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB, "Originator SRGB" },
2285
    { BGP_PREFIX_SID_TLV_4,               "Deprecated" },
2286
    { BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE, "SRv6 L3 Service" },
2287
    { BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE, "SRv6 L2 Service" },
2288
    { 0, NULL }
2289
};
2290
2291
static const value_string srv6_service_sub_tlv_type[] = {
2292
    { SRV6_SERVICE_SRV6_SID_INFORMATION,   "SRv6 SID Information" },
2293
    { 0,  NULL }
2294
};
2295
2296
static const value_string srv6_service_data_sub_sub_tlv_type[] = {
2297
    { SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE,   "SRv6 SID Structure" },
2298
    { 0,  NULL }
2299
};
2300
2301
/* SRv6 Endpoint behavior value_string [RFC 8986]. */
2302
static const value_string srv6_endpoint_behavior[] = {
2303
    { SRV6_ENDPOINT_BEHAVIOR_END,                    "End" },
2304
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP,                "End with PSP" },
2305
    { SRV6_ENDPOINT_BEHAVIOR_END_USP,                "End with USP" },
2306
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP,            "End with PSP & USP" },
2307
    { SRV6_ENDPOINT_BEHAVIOR_END_X,                  "End.X" },
2308
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP,              "End.X with PSP" },
2309
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USP,              "End.X with USP" },
2310
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP,          "End.X with PSP & USP" },
2311
    { SRV6_ENDPOINT_BEHAVIOR_END_T,                  "End.T" },
2312
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP,              "End.T with PSP" },
2313
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USP,              "End.T with USP" },
2314
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP,          "End.T with PSP & USP" },
2315
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT,          "End.B6.Insert" },
2316
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS,          "End.B6.Encaps" },
2317
    { SRV6_ENDPOINT_BEHAVIOR_END_BM,                 "End.BM" },
2318
    { SRV6_ENDPOINT_BEHAVIOR_END_DX6,                "End.DX6" },
2319
    { SRV6_ENDPOINT_BEHAVIOR_END_DX4,                "End.DX4" },
2320
    { SRV6_ENDPOINT_BEHAVIOR_END_DT6,                "End.DT6" },
2321
    { SRV6_ENDPOINT_BEHAVIOR_END_DT4,                "End.DT4" },
2322
    { SRV6_ENDPOINT_BEHAVIOR_END_DT46,               "End.DT46" },
2323
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2,                "End.DX2" },
2324
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2V,               "End.DX2V" },
2325
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2U,               "End.DT2U" },
2326
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2M,               "End.DT2M" },
2327
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT_RED,      "End.B6.Insert.Red" },
2328
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED,      "End.B6.Encaps.Red" },
2329
    { SRV6_ENDPOINT_BEHAVIOR_END_USD,                "End with USD" },
2330
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD,            "End with PSP & USD" },
2331
    { SRV6_ENDPOINT_BEHAVIOR_END_USP_USD,            "End with USP & USD" },
2332
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD,        "End with PSP, USP & USD" },
2333
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USD,              "End.X with USD" },
2334
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD,          "End.X with PSP & USD" },
2335
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD,          "End.X with USP & USD" },
2336
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD,      "End.X with PSP, USP & USD" },
2337
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USD,              "End.T with USD" },
2338
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD,          "End.T with PSP & USD" },
2339
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD,          "End.T with USP & USD" },
2340
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD,      "End.T with PSP, USP & USD" },
2341
    { SRV6_ENDPOINT_BEHAVIOR_END_MAP,                "End.MAP" },
2342
    { SRV6_ENDPOINT_BEHAVIOR_END_LIMIT,              "End.Limit" },
2343
    { SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID,          "End with NEXT-ONLY-CSID" },
2344
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID,               "End with NEXT-CSID" },
2345
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP,           "End with NEXT-CSID & PSP" },
2346
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP,           "End with NEXT-CSID & USP" },
2347
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP,       "End with NEXT-CSID, PSP & USP" },
2348
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD,           "End with NEXT-CSID & USD" },
2349
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD,       "End with NEXT-CSID, PSP & USD" },
2350
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD,       "End with NEXT-CSID, USP & USD" },
2351
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD,   "End with NEXT-CSID, PSP, USP & USD" },
2352
    { SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID,        "End.X with NEXT-ONLY-CSID" },
2353
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID,             "End.X with NEXT-CSID" },
2354
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP,         "End.X with NEXT-CSID & PSP" },
2355
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP,         "End.X with NEXT-CSID & USP" },
2356
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP,     "End.X with NEXT-CSID, PSP & USP" },
2357
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD,         "End.X with NEXT-CSID & USD" },
2358
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD,     "End.X with NEXT-CSID, PSP & USD" },
2359
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD,     "End.X with NEXT-CSID, USP & USD" },
2360
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP_USD, "End.X with NEXT-CSID, PSP, USP & USD" },
2361
    { SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID,           "End.DX6 with NEXT-CSID" },
2362
    { SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID,           "End.DX4 with NEXT-CSID" },
2363
    { SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID,           "End.DT6 with NEXT-CSID" },
2364
    { SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID,           "End.DT4 with NEXT-CSID" },
2365
    { SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID,          "End.DT46 with NEXT-CSID" },
2366
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID,           "End.DX2 with NEXT-CSID" },
2367
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID,          "End.DX2V with NEXT-CSID" },
2368
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID,          "End.DT2U with NEXT-CSID" },
2369
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID,          "End.DT2M with NEXT-CSID" },
2370
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6D,            "End.M.GTP6.D" },
2371
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6DI,           "End.M.GTP6.Di" },
2372
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6E,            "End.M.GTP6.E" },
2373
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP4E,            "End.M.GTP4.E" },
2374
    { SRV6_ENDPOINT_BEHAVIOR_END_M,                  "End.M" },
2375
    { SRV6_ENDPOINT_BEHAVIOR_END_REPLICATE,          "End.Replicate" },
2376
    { SRV6_ENDPOINT_BEHAVIOR_END_NSH,                "End.NSH - NSH Segment" },
2377
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1,                "End.DX1" },
2378
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1_NEXT_CSID,      "End.DX1 with NEXT-CSID" },
2379
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1_REPL_CSID,      "End.DX1 with REPLACE-CSID" },
2380
    { SRV6_ENDPOINT_BEHAVIOR_OPAQUE,                 "Opaque" },
2381
    { 0,  NULL }
2382
};
2383
2384
170k
#define BGP_MUP_AT_3GPP_5G 1
2385
1.21k
#define BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY 1
2386
750
#define BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY 2
2387
2.62k
#define BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED 3
2388
3.05k
#define BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED 4
2389
2390
752
#define BGP_MUP_ST_TLV_3GPP_5G_SESSION_PARAMS 1
2391
752
#define BGP_MUP_ST_TLV_INTERWORK_ENDPOINT 2
2392
597
#define BGP_MUP_ST_TLV_SOURCE_ADDRESS 3
2393
2394
static const value_string bgp_mup_architecture_types[] = {
2395
    { BGP_MUP_AT_3GPP_5G,         "3gpp-5g" },
2396
    { 0, NULL }
2397
};
2398
2399
static const value_string bgp_mup_route_types[] = {
2400
    { BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY, "Interwork Segment Discovery route" },
2401
    { BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY,    "Direct Segment Discovery route" },
2402
    { BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED,  "Type 1 Session Transformed (ST) route" },
2403
    { BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED,  "Type 2 Session Transformed (ST) route" },
2404
    { 0, NULL }
2405
};
2406
2407
static const value_string bgp_mup_st_route_tlv_types[] = {
2408
    { BGP_MUP_ST_TLV_3GPP_5G_SESSION_PARAMS, "3gpp-5g Session Parameters" },
2409
    { BGP_MUP_ST_TLV_INTERWORK_ENDPOINT,     "Interwork Endpoint" },
2410
    { BGP_MUP_ST_TLV_SOURCE_ADDRESS,         "Source Address" },
2411
    { 0, NULL }
2412
};
2413
2414
static const value_string bgp_ext_com_local_admin_types[] = {
2415
    { 0, "VID (802.1Q VLAN ID)" },
2416
    { 1, "VXLAN" },
2417
    { 2, "NVGRE" },
2418
    { 3, "I-SID" },
2419
    { 4, "EVI" },
2420
    { 5, "dual-VID (QinQ VLAN ID)" },
2421
    { 0, NULL }
2422
};
2423
2424
static const true_false_string tfs_non_transitive_transitive = { "Non-transitive", "Transitive" };
2425
static const true_false_string tfs_esi_label_flag = { "Single-Active redundancy", "All-Active redundancy" };
2426
static const true_false_string tfs_ospf_rt_mt = { "Type-2", "Type-1" };
2427
static const true_false_string tfs_eigrp_rtype = { "Internal" , "External" };
2428
static const true_false_string tfs_cost_replace = { "Replaces the original attribute value", "Evaluated after the original attribute value" };
2429
static const true_false_string tfs_exclude_include = { "Exclude", "Include" };
2430
static const true_false_string tfs_manually_auto_derived = { "manually derived", "auto-derived"};
2431
2432
/* Maximal size of an IP address string */
2433
#define MAX_SIZE_OF_IP_ADDR_STRING      16
2434
2435
static const uint8_t rd_zero[BGP_ROUTE_DISTINGUISHER_SIZE] = {0};
2436
2437
static int proto_bgp;
2438
2439
/* BGP header field initialisation */
2440
2441
/* global BGP header field */
2442
2443
static int hf_bgp_marker;
2444
static int hf_bgp_length;
2445
static int hf_bgp_prefix_length;
2446
static int hf_bgp_rd;
2447
static int hf_bgp_continuation;
2448
static int hf_bgp_originating_as;
2449
static int hf_bgp_community_prefix;
2450
static int hf_bgp_endpoint_address;
2451
static int hf_bgp_endpoint_address_ipv6;
2452
static int hf_bgp_label_stack;
2453
static int hf_bgp_large_communities;
2454
static int hf_bgp_large_communities_ga;
2455
static int hf_bgp_large_communities_ldp1;
2456
static int hf_bgp_large_communities_ldp2;
2457
static int hf_bgp_vplsad_length;
2458
static int hf_bgp_vplsad_rd;
2459
static int hf_bgp_bgpad_pe_addr;
2460
static int hf_bgp_vplsbgp_ce_id;
2461
static int hf_bgp_vplsbgp_labelblock_offset;
2462
static int hf_bgp_vplsbgp_labelblock_size;
2463
static int hf_bgp_vplsbgp_labelblock_base;
2464
static int hf_bgp_wildcard_route_target;
2465
static int hf_bgp_type;
2466
2467
/* BGP open message header field */
2468
2469
static int hf_bgp_open_version;
2470
static int hf_bgp_open_myas;
2471
static int hf_bgp_open_holdtime;
2472
static int hf_bgp_open_identifier;
2473
static int hf_bgp_open_opt_len;
2474
static int hf_bgp_open_opt_extension;
2475
static int hf_bgp_open_opt_extension_mark;
2476
static int hf_bgp_open_opt_extension_len;
2477
static int hf_bgp_open_opt_params;
2478
static int hf_bgp_open_opt_param;
2479
static int hf_bgp_open_opt_param_type;
2480
static int hf_bgp_open_opt_param_len;
2481
static int hf_bgp_open_opt_param_auth;
2482
static int hf_bgp_open_opt_param_unknown;
2483
2484
/* BGP notify header field */
2485
2486
static int hf_bgp_notify_major_error;
2487
static int hf_bgp_notify_minor_msg_hdr;
2488
static int hf_bgp_notify_minor_open_msg;
2489
static int hf_bgp_notify_minor_update_msg;
2490
static int hf_bgp_notify_minor_ht_expired;
2491
static int hf_bgp_notify_minor_state_machine;
2492
static int hf_bgp_notify_minor_cease;
2493
static int hf_bgp_notify_minor_rr_msg;
2494
static int hf_bgp_notify_minor_unknown;
2495
static int hf_bgp_notify_data;
2496
static int hf_bgp_notify_error_open_bad_peer_as;
2497
static int hf_bgp_notify_communication_length;
2498
static int hf_bgp_notify_communication;
2499
2500
/* BGP route refresh header field */
2501
2502
static int hf_bgp_route_refresh_afi;
2503
static int hf_bgp_route_refresh_subtype;
2504
static int hf_bgp_route_refresh_safi;
2505
static int hf_bgp_route_refresh_orf;
2506
static int hf_bgp_route_refresh_orf_flag;
2507
static int hf_bgp_route_refresh_orf_type;
2508
static int hf_bgp_route_refresh_orf_length;
2509
static int hf_bgp_route_refresh_orf_entry_prefixlist;
2510
static int hf_bgp_route_refresh_orf_entry_action;
2511
static int hf_bgp_route_refresh_orf_entry_match;
2512
static int hf_bgp_route_refresh_orf_entry_sequence;
2513
static int hf_bgp_route_refresh_orf_entry_prefixmask_lower;
2514
static int hf_bgp_route_refresh_orf_entry_prefixmask_upper;
2515
static int hf_bgp_route_refresh_orf_entry_ip;
2516
2517
/* BGP capabilities header field */
2518
2519
static int hf_bgp_cap;
2520
static int hf_bgp_cap_type;
2521
static int hf_bgp_cap_length;
2522
static int hf_bgp_cap_action;
2523
static int hf_bgp_cap_unknown;
2524
static int hf_bgp_cap_reserved;
2525
static int hf_bgp_cap_mp_afi;
2526
static int hf_bgp_cap_mp_safi;
2527
static int hf_bgp_cap_enh_afi;
2528
static int hf_bgp_cap_enh_safi;
2529
static int hf_bgp_cap_enh_nhafi;
2530
static int hf_bgp_cap_role;
2531
static int hf_bgp_cap_gr_timers;
2532
static int hf_bgp_cap_gr_timers_restart_flag;
2533
static int hf_bgp_cap_gr_timers_notification_flag;
2534
static int hf_bgp_cap_gr_timers_restart_time;
2535
static int hf_bgp_cap_gr_afi;
2536
static int hf_bgp_cap_gr_safi;
2537
static int hf_bgp_cap_gr_flag;
2538
static int hf_bgp_cap_gr_flag_pfs;
2539
static int hf_bgp_cap_4as;
2540
static int hf_bgp_cap_dc;
2541
static int hf_bgp_cap_ap_afi;
2542
static int hf_bgp_cap_ap_safi;
2543
static int hf_bgp_cap_ap_sendreceive;
2544
static int hf_bgp_cap_orf_afi;
2545
static int hf_bgp_cap_orf_safi;
2546
static int hf_bgp_cap_orf_number;
2547
static int hf_bgp_cap_orf_type;
2548
static int hf_bgp_cap_orf_sendreceive;
2549
static int hf_bgp_cap_fqdn_hostname_len;
2550
static int hf_bgp_cap_fqdn_hostname;
2551
static int hf_bgp_cap_fqdn_domain_name_len;
2552
static int hf_bgp_cap_fqdn_domain_name;
2553
static int hf_bgp_cap_multisession_flags;
2554
static int hf_bgp_cap_bgpsec_flags;
2555
static int hf_bgp_cap_bgpsec_version;
2556
static int hf_bgp_cap_bgpsec_sendreceive;
2557
static int hf_bgp_cap_bgpsec_reserved;
2558
static int hf_bgp_cap_bgpsec_afi;
2559
static int hf_bgp_cap_soft_version;
2560
static int hf_bgp_cap_soft_version_len;
2561
2562
/* BGP update global header field */
2563
static int hf_bgp_update_withdrawn_routes_length;
2564
static int hf_bgp_update_withdrawn_routes;
2565
2566
2567
/* BGP update path attribute header field */
2568
static int hf_bgp_update_total_path_attribute_length;
2569
static int hf_bgp_update_path_attributes;
2570
static int hf_bgp_update_path_attributes_unknown;
2571
static int hf_bgp_update_path_attribute_communities;
2572
static int hf_bgp_update_path_attribute_community_well_known;
2573
static int hf_bgp_update_path_attribute_community;
2574
static int hf_bgp_update_path_attribute_community_as;
2575
static int hf_bgp_update_path_attribute_community_value;
2576
static int hf_bgp_update_path_attribute;
2577
static int hf_bgp_update_path_attribute_flags;
2578
static int hf_bgp_update_path_attribute_flags_optional;
2579
static int hf_bgp_update_path_attribute_flags_transitive;
2580
static int hf_bgp_update_path_attribute_flags_partial;
2581
static int hf_bgp_update_path_attribute_flags_extended_length;
2582
static int hf_bgp_update_path_attribute_flags_unused;
2583
static int hf_bgp_update_path_attribute_type_code;
2584
static int hf_bgp_update_path_attribute_length;
2585
static int hf_bgp_update_path_attribute_next_hop;
2586
static int hf_bgp_update_path_attribute_as_path_segment;
2587
static int hf_bgp_update_path_attribute_as_path_segment_type;
2588
static int hf_bgp_update_path_attribute_as_path_segment_length;
2589
static int hf_bgp_update_path_attribute_as_path_segment_as2;
2590
static int hf_bgp_update_path_attribute_as_path_segment_as4;
2591
static int hf_bgp_update_path_attribute_origin;
2592
static int hf_bgp_update_path_attribute_cluster_list;
2593
static int hf_bgp_update_path_attribute_cluster_id;
2594
static int hf_bgp_update_path_attribute_originator_id;
2595
static int hf_bgp_update_path_attribute_local_pref;
2596
static int hf_bgp_update_path_attribute_attrset_origin_as;
2597
static int hf_bgp_update_path_attribute_multi_exit_disc;
2598
static int hf_bgp_update_path_attribute_aggregator_as;
2599
static int hf_bgp_update_path_attribute_aggregator_origin;
2600
static int hf_bgp_update_path_attribute_link_state;
2601
static int hf_bgp_update_path_attribute_mp_reach_nlri_address_family;
2602
static int hf_bgp_update_path_attribute_mp_reach_nlri_safi;
2603
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop;
2604
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd;
2605
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4;
2606
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6;
2607
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local;
2608
static int hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa;
2609
static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length;
2610
static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa;
2611
static int hf_bgp_update_path_attribute_mp_reach_nlri;
2612
static int hf_bgp_update_path_attribute_mp_unreach_nlri_address_family;
2613
static int hf_bgp_update_path_attribute_mp_unreach_nlri_safi;
2614
static int hf_bgp_update_path_attribute_mp_unreach_nlri;
2615
static int hf_bgp_update_path_attribute_aigp;
2616
static int hf_bgp_update_path_attribute_bgpsec_sb_len;
2617
static int hf_bgp_update_path_attribute_bgpsec_algo_id;
2618
static int hf_bgp_update_path_attribute_bgpsec_sps_pcount;
2619
static int hf_bgp_update_path_attribute_bgpsec_sps_flags;
2620
static int hf_bgp_update_path_attribute_bgpsec_sps_as;
2621
static int hf_bgp_update_path_attribute_bgpsec_sp_len;
2622
static int hf_bgp_update_path_attribute_bgpsec_ski;
2623
static int hf_bgp_update_path_attribute_bgpsec_sig_len;
2624
static int hf_bgp_update_path_attribute_bgpsec_sig;
2625
static int hf_bgp_update_path_attribute_otc;
2626
static int hf_bgp_update_path_attribute_d_path;
2627
static int hf_bgp_d_path_ga;
2628
static int hf_bgp_d_path_la;
2629
static int hf_bgp_d_path_length;
2630
static int hf_bgp_d_path_isf_safi;
2631
static int hf_bgp_update_path_attribute_bfd_mode;
2632
static int hf_bgp_update_path_attribute_bfd_discriminator;
2633
static int hf_bgp_bfd_discriminator_tlv;
2634
static int hf_bgp_bfd_discriminator_tlv_type;
2635
static int hf_bgp_bfd_discriminator_tlv_length;
2636
static int hf_bgp_bfd_discriminator_tlv_source_ipv4;
2637
static int hf_bgp_bfd_discriminator_tlv_source_ipv6;
2638
static int hf_bgp_bfd_discriminator_tlv_value;
2639
static int hf_bgp_evpn_nlri;
2640
static int hf_bgp_evpn_nlri_rt;
2641
static int hf_bgp_evpn_nlri_len;
2642
static int hf_bgp_evpn_nlri_rd;
2643
static int hf_bgp_evpn_nlri_esi;
2644
static int hf_bgp_evpn_nlri_esi_type;
2645
static int hf_bgp_evpn_nlri_esi_lacp_mac;
2646
static int hf_bgp_evpn_nlri_esi_portk;
2647
static int hf_bgp_evpn_nlri_esi_remain;
2648
static int hf_bgp_evpn_nlri_esi_value;
2649
static int hf_bgp_evpn_nlri_esi_value_type0;
2650
static int hf_bgp_evpn_nlri_esi_rb_mac;
2651
static int hf_bgp_evpn_nlri_esi_rbprio;
2652
static int hf_bgp_evpn_nlri_esi_sys_mac;
2653
static int hf_bgp_evpn_nlri_esi_mac_discr;
2654
static int hf_bgp_evpn_nlri_esi_router_id;
2655
static int hf_bgp_evpn_nlri_esi_router_discr;
2656
static int hf_bgp_evpn_nlri_esi_asn;
2657
static int hf_bgp_evpn_nlri_esi_asn_discr;
2658
static int hf_bgp_evpn_nlri_esi_reserved;
2659
static int hf_bgp_evpn_nlri_etag;
2660
static int hf_bgp_evpn_nlri_mpls_ls1;
2661
static int hf_bgp_evpn_nlri_mpls_ls2;
2662
static int hf_bgp_evpn_nlri_vni;
2663
static int hf_bgp_evpn_nlri_maclen;
2664
static int hf_bgp_evpn_nlri_mac_addr;
2665
static int hf_bgp_evpn_nlri_iplen;
2666
static int hf_bgp_evpn_nlri_prefix_len;
2667
static int hf_bgp_evpn_nlri_ip_addr;
2668
static int hf_bgp_evpn_nlri_ipv6_addr;
2669
static int hf_bgp_evpn_nlri_ipv4_gtw;
2670
static int hf_bgp_evpn_nlri_ipv6_gtw;
2671
static int hf_bgp_evpn_nlri_igmp_mc_or_length;
2672
static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4;
2673
static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6;
2674
static int hf_bgp_evpn_nlri_igmp_mc_reserved;
2675
static int hf_bgp_evpn_nlri_igmp_mc_max_resp_time;
2676
static int hf_bgp_evpn_nlri_igmp_mc_flags;
2677
static int hf_bgp_evpn_nlri_igmp_mc_flags_v1;
2678
static int hf_bgp_evpn_nlri_igmp_mc_flags_v2;
2679
static int hf_bgp_evpn_nlri_igmp_mc_flags_v3;
2680
static int hf_bgp_evpn_nlri_igmp_mc_flags_ie;
2681
static int hf_bgp_evpn_nlri_igmp_mc_flags_reserved;
2682
2683
static int * const evpn_nlri_igmp_mc_flags[] = {
2684
       &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
2685
       &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
2686
       &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
2687
       &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
2688
       &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
2689
       NULL
2690
       };
2691
2692
/* BGP update tunnel encaps attribute RFC 5512 */
2693
2694
static int hf_bgp_update_encaps_tunnel_tlv_len;
2695
static int hf_bgp_update_encaps_tunnel_tlv_type;
2696
static int hf_bgp_update_encaps_tunnel_subtlv_len;
2697
static int hf_bgp_update_encaps_tunnel_subtlv_type;
2698
static int hf_bgp_update_encaps_tunnel_subtlv_session_id;
2699
static int hf_bgp_update_encaps_tunnel_subtlv_cookie;
2700
static int hf_bgp_update_encaps_tunnel_subtlv_gre_key;
2701
static int hf_bgp_update_encaps_tunnel_subtlv_color_value;
2702
static int hf_bgp_update_encaps_tunnel_subtlv_lb_block_length;
2703
static int hf_bgp_update_encaps_tunnel_subtlv_value;
2704
2705
/* draft-ietf-idr-tunnel-encaps */
2706
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags;
2707
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid;
2708
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac;
2709
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved;
2710
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid;
2711
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac;
2712
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved;
2713
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags;
2714
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version;
2715
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid;
2716
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved;
2717
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid;
2718
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved;
2719
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags;
2720
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid;
2721
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac;
2722
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved;
2723
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid;
2724
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac;
2725
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved;
2726
2727
/* draft-ietf-idr-segment-routing-te-policy */
2728
static int hf_bgp_update_encaps_tunnel_subtlv_pref_flags;
2729
static int hf_bgp_update_encaps_tunnel_subtlv_pref_reserved;
2730
static int hf_bgp_update_encaps_tunnel_subtlv_pref_preference;
2731
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags;
2732
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified;
2733
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid;
2734
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved;
2735
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved;
2736
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid;
2737
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags;
2738
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_specified;
2739
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_invalid;
2740
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_b_flag;
2741
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_reserved;
2742
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_reserved;
2743
static int hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_sid;
2744
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_flags;
2745
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved;
2746
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp;
2747
static int hf_bgp_update_encaps_tunnel_subtlv_priority_priority;
2748
static int hf_bgp_update_encaps_tunnel_subtlv_priority_reserved;
2749
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved;
2750
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv;
2751
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type;
2752
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length;
2753
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data;
2754
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags;
2755
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification;
2756
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm;
2757
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_s_flag;
2758
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_b_flag;
2759
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved;
2760
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved;
2761
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label;
2762
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class;
2763
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack;
2764
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl;
2765
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm;
2766
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id;
2767
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id;
2768
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address;
2769
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv4_address;
2770
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv4_address;
2771
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address;
2772
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address;
2773
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address;
2774
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_sid;
2775
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior;
2776
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_code;
2777
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_reserved;
2778
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_lb_length;
2779
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_ln_length;
2780
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_func_length;
2781
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_arg_length;
2782
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight;
2783
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight_flags;
2784
static int hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_reserved;
2785
static int hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_name;
2786
static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved;
2787
static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_name;
2788
2789
/* RFC 6514 PMSI Tunnel Attribute */
2790
static int hf_bgp_pmsi_tunnel_flags;
2791
static int hf_bgp_pmsi_tunnel_type;
2792
static int hf_bgp_pmsi_tunnel_id;
2793
static int hf_bgp_pmsi_tunnel_not_present;
2794
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_id; /* RFC4875 section 19 */
2795
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id;
2796
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4;
2797
static int hf_bgp_pmsi_tunnel_mldp_fec_el_type; /* RFC 6388 section 2.3 */
2798
static int hf_bgp_pmsi_tunnel_mldp_fec_el_afi;
2799
static int hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len;
2800
static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4;
2801
static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6;
2802
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len;
2803
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type;
2804
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len;
2805
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn;
2806
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str;
2807
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type;
2808
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len;
2809
static int hf_bgp_pmsi_tunnel_pimsm_sender;
2810
static int hf_bgp_pmsi_tunnel_pimsm_pmc_group;
2811
static int hf_bgp_pmsi_tunnel_pimssm_root_node;
2812
static int hf_bgp_pmsi_tunnel_pimssm_pmc_group;
2813
static int hf_bgp_pmsi_tunnel_pimbidir_sender;
2814
static int hf_bgp_pmsi_tunnel_pimbidir_pmc_group;
2815
static int hf_bgp_pmsi_tunnel_ingress_rep_addr;
2816
static int hf_bgp_pmsi_tunnel_ingress_rep_addr6;
2817
2818
/* RFC 7311 attribute */
2819
static int hf_bgp_aigp_type;
2820
static int hf_bgp_aigp_tlv_length;
2821
static int hf_bgp_aigp_accu_igp_metric;
2822
2823
2824
/* MPLS labels decoding */
2825
static int hf_bgp_update_mpls_label;
2826
static int hf_bgp_update_mpls_label_value;
2827
static int hf_bgp_update_mpls_label_value_20bits;
2828
static int hf_bgp_update_mpls_traffic_class;
2829
static int hf_bgp_update_mpls_bottom_stack;
2830
2831
/* BGP update path attribute SSA SAFI Specific attribute (deprecated should we keep it ?) */
2832
2833
static int hf_bgp_ssa_t;
2834
static int hf_bgp_ssa_type;
2835
static int hf_bgp_ssa_len;
2836
static int hf_bgp_ssa_value;
2837
static int hf_bgp_ssa_l2tpv3_pref;
2838
static int hf_bgp_ssa_l2tpv3_s;
2839
static int hf_bgp_ssa_l2tpv3_unused;
2840
static int hf_bgp_ssa_l2tpv3_cookie_len;
2841
static int hf_bgp_ssa_l2tpv3_session_id;
2842
static int hf_bgp_ssa_l2tpv3_cookie;
2843
2844
/* BGP NLRI head field */
2845
static int hf_bgp_update_nlri;
2846
2847
static int hf_bgp_mp_reach_nlri_ipv4_prefix;
2848
static int hf_bgp_mp_unreach_nlri_ipv4_prefix;
2849
static int hf_bgp_mp_reach_nlri_ipv6_prefix;
2850
static int hf_bgp_mp_unreach_nlri_ipv6_prefix;
2851
static int hf_bgp_mp_nlri_tnl_id;
2852
static int hf_bgp_withdrawn_prefix;
2853
static int hf_bgp_nlri_prefix;
2854
static int hf_bgp_nlri_path_id;
2855
2856
/* BGP mcast IP VPN nlri header field */
2857
2858
static int hf_bgp_mcast_vpn_nlri_t;
2859
static int hf_bgp_mcast_vpn_nlri_route_type;
2860
static int hf_bgp_mcast_vpn_nlri_length;
2861
static int hf_bgp_mcast_vpn_nlri_rd;
2862
static int hf_bgp_mcast_vpn_nlri_origin_router_ipv4;
2863
static int hf_bgp_mcast_vpn_nlri_origin_router_ipv6;
2864
static int hf_bgp_mcast_vpn_nlri_source_as;
2865
static int hf_bgp_mcast_vpn_nlri_source_length;
2866
static int hf_bgp_mcast_vpn_nlri_group_length;
2867
static int hf_bgp_mcast_vpn_nlri_source_addr_ipv4;
2868
static int hf_bgp_mcast_vpn_nlri_source_addr_ipv6;
2869
static int hf_bgp_mcast_vpn_nlri_group_addr_ipv4;
2870
static int hf_bgp_mcast_vpn_nlri_group_addr_ipv6;
2871
static int hf_bgp_mcast_vpn_nlri_route_key;
2872
2873
/* BGP SR policy nlri field */
2874
static int hf_bgp_sr_policy_nlri_length;
2875
static int hf_bgp_sr_policy_nlri_distinguisher;
2876
static int hf_bgp_sr_policy_nlri_policy_color;
2877
static int hf_bgp_sr_policy_nlri_endpoint_v4;
2878
static int hf_bgp_sr_policy_nlri_endpoint_v6;
2879
2880
/* BGP-LS */
2881
2882
static int hf_bgp_ls_type;
2883
static int hf_bgp_ls_length;
2884
2885
static int hf_bgp_ls_nlri;
2886
static int hf_bgp_ls_safi128_nlri;
2887
static int hf_bgp_ls_safi128_nlri_route_distinguisher;
2888
static int hf_bgp_ls_safi128_nlri_route_distinguisher_type;
2889
static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2;
2890
static int hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4;
2891
static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4;
2892
static int hf_bgp_ls_safi128_nlri_route_dist_asnum_2;
2893
static int hf_bgp_ls_safi128_nlri_route_dist_asnum_4;
2894
static int hf_bgp_ls_nlri_type;
2895
static int hf_bgp_ls_nlri_length;
2896
static int hf_bgp_ls_nlri_link_nlri_type;
2897
static int hf_bgp_ls_nlri_link_descriptors_tlv;
2898
static int hf_bgp_ls_nlri_prefix_descriptors_tlv;
2899
static int hf_bgp_ls_nlri_srv6_sid_descriptors_tlv;
2900
static int hf_bgp_ls_nlri_link_local_identifier;
2901
static int hf_bgp_ls_nlri_link_remote_identifier;
2902
static int hf_bgp_ls_nlri_ipv4_interface_address;
2903
static int hf_bgp_ls_nlri_ipv4_neighbor_address;
2904
static int hf_bgp_ls_nlri_ipv6_interface_address;
2905
static int hf_bgp_ls_nlri_ipv6_neighbor_address;
2906
static int hf_bgp_ls_nlri_multi_topology_id;
2907
static int hf_bgp_ls_nlri_ospf_route_type;
2908
static int hf_bgp_ls_nlri_ip_reachability_prefix_ip;
2909
static int hf_bgp_ls_nlri_ip_reachability_prefix_ip6;
2910
static int hf_bgp_ls_nlri_node_nlri_type;
2911
static int hf_bgp_ls_nlri_node_protocol_id;
2912
static int hf_bgp_ls_nlri_node_identifier;
2913
static int hf_bgp_ls_ipv4_topology_prefix_nlri_type;
2914
static int hf_bgp_ls_ipv6_topology_prefix_nlri_type;
2915
static int hf_bgp_ls_nlri_srv6_sid_nlri_type;
2916
2917
/* BGP-LS + SR */
2918
static int hf_bgp_ls_sr_tlv_capabilities;
2919
static int hf_bgp_ls_sr_tlv_capabilities_range_size;
2920
static int hf_bgp_ls_sr_tlv_capabilities_flags;
2921
static int hf_bgp_ls_sr_tlv_capabilities_flags_i;
2922
static int hf_bgp_ls_sr_tlv_capabilities_flags_v;
2923
static int hf_bgp_ls_sr_tlv_capabilities_flags_h;
2924
static int hf_bgp_ls_sr_tlv_capabilities_flags_reserved;
2925
static int hf_bgp_ls_sr_tlv_capabilities_sid_label;
2926
static int hf_bgp_ls_sr_tlv_capabilities_sid_index;
2927
static int hf_bgp_ls_sr_tlv_algorithm;
2928
static int hf_bgp_ls_sr_tlv_algorithm_value;
2929
static int hf_bgp_ls_sr_tlv_local_block;                      /* 1036 */
2930
static int hf_bgp_ls_sr_tlv_local_block_flags;
2931
static int hf_bgp_ls_sr_tlv_local_block_range_size;
2932
static int hf_bgp_ls_sr_tlv_local_block_sid_label;
2933
static int hf_bgp_ls_sr_tlv_local_block_sid_index;
2934
static int hf_bgp_ls_sr_tlv_srv6_cap;                         /* 1037 */
2935
static int hf_bgp_ls_sr_tlv_srv6_cap_flags;
2936
static int hf_bgp_ls_sr_tlv_srv6_cap_flags_o;
2937
static int hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved;
2938
static int hf_bgp_ls_sr_tlv_srv6_cap_reserved;
2939
static int hf_bgp_ls_sr_tlv_flex_algo_def;                    /* 1039 */
2940
static int hf_bgp_ls_sr_tlv_flex_algo_algorithm;
2941
static int hf_bgp_ls_sr_tlv_flex_algo_metric_type;
2942
static int hf_bgp_ls_sr_tlv_flex_algo_calc_type;
2943
static int hf_bgp_ls_sr_tlv_flex_algo_priority;
2944
static int hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity;       /* 1040 */
2945
static int hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity;       /* 1041 */
2946
static int hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity;       /* 1042 */
2947
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags;              /* 1043 */
2948
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags;
2949
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m;
2950
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric;          /* 1044 */
2951
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags;
2952
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e;
2953
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved;
2954
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric;
2955
static int hf_bgp_ls_sr_tlv_flex_algo_exc_srlg;               /* 1045 */
2956
static int hf_bgp_ls_sr_tlv_prefix_sid;
2957
static int hf_bgp_ls_sr_tlv_prefix_sid_flags;
2958
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_r;
2959
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_n;
2960
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_np;
2961
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_p;
2962
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_m;
2963
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_e;
2964
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_v;
2965
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_l;
2966
static int hf_bgp_ls_sr_tlv_prefix_sid_algo;
2967
static int hf_bgp_ls_sr_tlv_prefix_sid_label;
2968
static int hf_bgp_ls_sr_tlv_prefix_sid_index;
2969
static int hf_bgp_ls_sr_tlv_adjacency_sid;
2970
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags;
2971
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi;
2972
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi;
2973
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo;
2974
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi;
2975
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo;
2976
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_li;
2977
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo;
2978
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_si;
2979
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_go;
2980
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi;
2981
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_po;
2982
static int hf_bgp_ls_sr_tlv_adjacency_sid_weight;
2983
static int hf_bgp_ls_sr_tlv_adjacency_sid_label;
2984
static int hf_bgp_ls_sr_tlv_adjacency_sid_index;
2985
static int hf_bgp_ls_sr_tlv_peer_node_sid;                    /* 1101 */
2986
static int hf_bgp_ls_sr_tlv_peer_adj_sid;                     /* 1102 */
2987
static int hf_bgp_ls_sr_tlv_peer_set_sid;                     /* 1103 */
2988
static int hf_bgp_ls_sr_tlv_peer_sid_flags;
2989
static int hf_bgp_ls_sr_tlv_peer_sid_flags_v;
2990
static int hf_bgp_ls_sr_tlv_peer_sid_flags_l;
2991
static int hf_bgp_ls_sr_tlv_peer_sid_flags_b;
2992
static int hf_bgp_ls_sr_tlv_peer_sid_flags_p;
2993
static int hf_bgp_ls_sr_tlv_peer_sid_weight;
2994
static int hf_bgp_ls_sr_tlv_peer_sid_label;
2995
static int hf_bgp_ls_sr_tlv_peer_sid_index;
2996
static int hf_bgp_ls_sr_tlv_srv6_endx_sid;                   /* 1106 */
2997
static int hf_bgp_ls_sr_tlv_srv6_lan_endx_sid;               /* 1107 */
2998
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior;
2999
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags;
3000
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b;
3001
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s;
3002
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p;
3003
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved;
3004
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_algo;
3005
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_weight;
3006
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved;
3007
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis;
3008
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf;
3009
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_sid;
3010
static int hf_bgp_ls_sr_tlv_srv6_locator;                     /* 1162 */
3011
static int hf_bgp_ls_sr_tlv_srv6_locator_flags;
3012
static int hf_bgp_ls_sr_tlv_srv6_locator_flags_d;
3013
static int hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved;
3014
static int hf_bgp_ls_sr_tlv_srv6_locator_algo;
3015
static int hf_bgp_ls_sr_tlv_srv6_locator_reserved;
3016
static int hf_bgp_ls_sr_tlv_srv6_locator_metric;
3017
static int hf_bgp_ls_sr_tlv_prefix_attr_flags;                /* 1170 */
3018
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags;
3019
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown;
3020
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao;
3021
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no;
3022
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo;
3023
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi;
3024
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri;
3025
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni;
3026
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei;
3027
static int hf_bgp_ls_sr_tlv_source_router_id;                 /* 1171 */
3028
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior;           /* 1250 */
3029
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior;
3030
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags;
3031
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo;
3032
static int hf_bgp_ls_sr_tlv_srv6_sid_struct;                  /* 1252 */
3033
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len;
3034
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len;
3035
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len;
3036
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len;
3037
3038
static int * const srv6_endx_sid_flags[] = {
3039
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b,
3040
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s,
3041
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p,
3042
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved,
3043
    NULL
3044
};
3045
3046
/* RFC7752 TLVs */
3047
static int hf_bgp_ls_tlv_local_node_descriptors;              /* 256 */
3048
static int hf_bgp_ls_tlv_remote_node_descriptors;             /* 257 */
3049
static int hf_bgp_ls_tlv_link_local_remote_identifiers;       /* 258 */
3050
static int hf_bgp_ls_tlv_ipv4_interface_address;              /* 259 */
3051
static int hf_bgp_ls_tlv_ipv4_neighbor_address;               /* 260 */
3052
static int hf_bgp_ls_tlv_ipv6_interface_address;              /* 261 */
3053
static int hf_bgp_ls_tlv_ipv6_neighbor_address;               /* 262 */
3054
static int hf_bgp_ls_tlv_multi_topology_id;                   /* 263 */
3055
static int hf_bgp_ls_tlv_ospf_route_type;                     /* 264 */
3056
static int hf_bgp_ls_tlv_ip_reachability_information;         /* 265 */
3057
static int hf_bgp_ls_tlv_node_msd;                            /* 266 */
3058
static int hf_bgp_ls_tlv_link_msd;                            /* 267 */
3059
static int hf_bgp_ls_tlv_igp_msd_type;
3060
static int hf_bgp_ls_tlv_igp_msd_value;
3061
3062
static int hf_bgp_ls_tlv_autonomous_system;                   /* 512 */
3063
static int hf_bgp_ls_tlv_autonomous_system_id;
3064
static int hf_bgp_ls_tlv_bgp_ls_identifier;                   /* 513 */
3065
static int hf_bgp_ls_tlv_bgp_ls_identifier_id;
3066
static int hf_bgp_ls_tlv_area_id;                             /* 514 */
3067
static int hf_bgp_ls_tlv_area_id_id;
3068
static int hf_bgp_ls_tlv_igp_router;                          /* 515 */
3069
static int hf_bgp_ls_tlv_igp_router_id;
3070
static int hf_bgp_ls_tlv_bgp_router_id;                       /* 516 */
3071
static int hf_bgp_ls_tlv_bgp_router_id_id;
3072
static int hf_bgp_ls_tlv_bgp_confederation_member;            /* 517 */
3073
static int hf_bgp_ls_tlv_bgp_confederation_member_as;
3074
static int hf_bgp_ls_tlv_srv6_sid_info;                       /* 518 */
3075
static int hf_bgp_ls_tlv_srv6_sid_info_sid;
3076
3077
static int hf_bgp_ls_tlv_node_flags_bits;                     /* 1024 */
3078
static int hf_bgp_ls_tlv_opaque_node_properties;              /* 1025 */
3079
static int hf_bgp_ls_tlv_opaque_node_properties_value;
3080
static int hf_bgp_ls_tlv_node_name;                           /* 1026 */
3081
static int hf_bgp_ls_tlv_node_name_value;
3082
static int hf_bgp_ls_tlv_is_is_area_identifier;               /* 1027 */
3083
static int hf_bgp_ls_tlv_is_is_area_identifier_value;
3084
static int hf_bgp_ls_tlv_ipv4_router_id_of_local_node;        /* 1028 */
3085
static int hf_bgp_ls_tlv_ipv4_router_id_value;
3086
static int hf_bgp_ls_tlv_ipv6_router_id_value;
3087
static int hf_bgp_ls_tlv_ipv6_router_id_of_local_node;        /* 1029 */
3088
static int hf_bgp_ls_tlv_ipv4_router_id_of_remote_node;       /* 1030 */
3089
static int hf_bgp_ls_tlv_ipv6_router_id_of_remote_node;       /* 1031 */
3090
3091
static int hf_bgp_ls_tlv_administrative_group_color;          /* 1088 */
3092
static int hf_bgp_ls_tlv_administrative_group_color_value;
3093
static int hf_bgp_ls_tlv_administrative_group;
3094
static int hf_bgp_ls_tlv_max_link_bandwidth;                  /* 1089 */
3095
static int hf_bgp_ls_tlv_max_reservable_link_bandwidth;       /* 1090 */
3096
static int hf_bgp_ls_tlv_unreserved_bandwidth;                /* 1091 */
3097
static int hf_bgp_ls_bandwidth_value;
3098
static int hf_bgp_ls_tlv_te_default_metric;                   /* 1092 */
3099
static int hf_bgp_ls_tlv_te_default_metric_value_old;
3100
static int hf_bgp_ls_tlv_te_default_metric_value;
3101
static int hf_bgp_ls_tlv_link_protection_type;                /* 1093 */
3102
static int hf_bgp_ls_tlv_link_protection_type_value;
3103
static int hf_bgp_ls_tlv_mpls_protocol_mask;                  /* 1094 */
3104
static int hf_bgp_ls_tlv_metric;                              /* 1095 */
3105
static int hf_bgp_ls_tlv_metric_value1;
3106
static int hf_bgp_ls_tlv_metric_value2;
3107
static int hf_bgp_ls_tlv_metric_value3;
3108
static int hf_bgp_ls_tlv_shared_risk_link_group;              /* 1096 */
3109
static int hf_bgp_ls_tlv_shared_risk_link_group_value;
3110
static int hf_bgp_ls_tlv_opaque_link_attribute;               /* 1097 */
3111
static int hf_bgp_ls_tlv_opaque_link_attribute_value;
3112
static int hf_bgp_ls_tlv_link_name_attribute;                 /* 1098 */
3113
static int hf_bgp_ls_tlv_link_name_attribute_value;
3114
static int hf_bgp_ls_tlv_app_spec_link_attrs;                 /* 1122 */
3115
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len;
3116
static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len;
3117
static int hf_bgp_ls_tlv_app_spec_link_attrs_reserved;
3118
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm;
3119
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r;
3120
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s;
3121
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f;
3122
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x;
3123
static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm;
3124
3125
static int hf_bgp_ls_tlv_igp_flags;                           /* 1152 */
3126
static int hf_bgp_ls_tlv_route_tag;                           /* 1153 */
3127
static int hf_bgp_ls_tlv_route_tag_value;
3128
static int hf_bgp_ls_tlv_route_extended_tag;                  /* 1154 */
3129
static int hf_bgp_ls_tlv_route_extended_tag_value;
3130
static int hf_bgp_ls_tlv_prefix_metric;                       /* 1155 */
3131
static int hf_bgp_ls_tlv_prefix_metric_value;
3132
static int hf_bgp_ls_ospf_forwarding_address;                 /* 1156 */
3133
static int hf_bgp_ls_ospf_forwarding_address_ipv4_address;
3134
static int hf_bgp_ls_ospf_forwarding_address_ipv6_address;
3135
static int hf_bgp_ls_opaque_prefix_attribute;                 /* 1157 */
3136
static int hf_bgp_ls_opaque_prefix_attribute_value;
3137
static int hf_bgp_ls_extended_administrative_group;           /* 1173 */
3138
static int hf_bgp_ls_extended_administrative_group_value;
3139
3140
3141
/* Link Protection Types */
3142
static int hf_bgp_ls_link_protection_type_extra_traffic;
3143
static int hf_bgp_ls_link_protection_type_unprotected;
3144
static int hf_bgp_ls_link_protection_type_shared;
3145
static int hf_bgp_ls_link_protection_type_dedicated_1to1;
3146
static int hf_bgp_ls_link_protection_type_dedicated_1plus1;
3147
static int hf_bgp_ls_link_protection_type_enhanced;
3148
/* MPLS Protocol Mask flags */
3149
static int hf_bgp_ls_mpls_protocol_mask_flag_l;
3150
static int hf_bgp_ls_mpls_protocol_mask_flag_r;
3151
/* BGP-LS IGP Flags */
3152
static int hf_bgp_ls_igp_flags_flag_d;
3153
/* Node Flag Bits TLV's flags */
3154
static int hf_bgp_ls_node_flag_bits_overload;
3155
static int hf_bgp_ls_node_flag_bits_attached;
3156
static int hf_bgp_ls_node_flag_bits_external;
3157
static int hf_bgp_ls_node_flag_bits_abr;
3158
3159
/* RFC8669 BGP Prefix-SID header field */
3160
static int hf_bgp_prefix_sid_unknown;
3161
static int hf_bgp_prefix_sid_label_index;
3162
static int hf_bgp_prefix_sid_label_index_value;
3163
static int hf_bgp_prefix_sid_label_index_flags;
3164
static int hf_bgp_prefix_sid_originator_srgb;
3165
static int hf_bgp_prefix_sid_originator_srgb_blocks;
3166
static int hf_bgp_prefix_sid_originator_srgb_block;
3167
static int hf_bgp_prefix_sid_originator_srgb_flags;
3168
static int hf_bgp_prefix_sid_originator_srgb_base;
3169
static int hf_bgp_prefix_sid_originator_srgb_range;
3170
static int hf_bgp_prefix_sid_type;
3171
static int hf_bgp_prefix_sid_length;
3172
static int hf_bgp_prefix_sid_value;
3173
static int hf_bgp_prefix_sid_reserved;
3174
3175
/* draft-ietf-bess-srv6-services-05 header field */
3176
static int hf_bgp_prefix_sid_srv6_l3vpn;
3177
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs;
3178
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv;
3179
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type;
3180
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length;
3181
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value;
3182
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved;
3183
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_value;
3184
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_flags;
3185
static int hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior;
3186
static int hf_bgp_prefix_sid_srv6_l3vpn_reserved;
3187
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs;
3188
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv;
3189
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type;
3190
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length;
3191
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value;
3192
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len;
3193
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len;
3194
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len;
3195
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len;
3196
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len;
3197
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset;
3198
static int hf_bgp_prefix_sid_srv6_l2vpn;
3199
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs;
3200
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv;
3201
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type;
3202
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length;
3203
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value;
3204
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved;
3205
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_value;
3206
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_flags;
3207
static int hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior;
3208
static int hf_bgp_prefix_sid_srv6_l2vpn_reserved;
3209
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs;
3210
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv;
3211
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type;
3212
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length;
3213
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value;
3214
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len;
3215
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len;
3216
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len;
3217
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len;
3218
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len;
3219
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset;
3220
3221
/* BGP flow spec nlri header field */
3222
3223
static int hf_bgp_flowspec_nlri_t;
3224
static int hf_bgp_flowspec_nlri_route_distinguisher;
3225
static int hf_bgp_flowspec_nlri_route_distinguisher_type;
3226
static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_2;
3227
static int hf_bgp_flowspec_nlri_route_dist_admin_ipv4;
3228
static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_4;
3229
static int hf_bgp_flowspec_nlri_route_dist_asnum_2;
3230
static int hf_bgp_flowspec_nlri_route_dist_asnum_4;
3231
static int hf_bgp_flowspec_nlri_filter;
3232
static int hf_bgp_flowspec_nlri_filter_type;
3233
static int hf_bgp_flowspec_nlri_length;
3234
static int hf_bgp_flowspec_nlri_dst_pref_ipv4;
3235
static int hf_bgp_flowspec_nlri_src_pref_ipv4;
3236
static int hf_bgp_flowspec_nlri_op_flags;
3237
static int hf_bgp_flowspec_nlri_op_eol;
3238
static int hf_bgp_flowspec_nlri_op_and;
3239
static int hf_bgp_flowspec_nlri_op_val_len;
3240
static int hf_bgp_flowspec_nlri_op_un_bit4;
3241
static int hf_bgp_flowspec_nlri_op_un_bit5;
3242
static int hf_bgp_flowspec_nlri_op_lt;
3243
static int hf_bgp_flowspec_nlri_op_gt;
3244
static int hf_bgp_flowspec_nlri_op_eq;
3245
static int hf_bgp_flowspec_nlri_dec_val_8;
3246
static int hf_bgp_flowspec_nlri_dec_val_16;
3247
static int hf_bgp_flowspec_nlri_dec_val_32;
3248
static int hf_bgp_flowspec_nlri_dec_val_64;
3249
static int hf_bgp_flowspec_nlri_op_flg_not;
3250
static int hf_bgp_flowspec_nlri_op_flg_match;
3251
static int hf_bgp_flowspec_nlri_tcp_flags;
3252
static int hf_bgp_flowspec_nlri_tcp_flags_cwr;
3253
static int hf_bgp_flowspec_nlri_tcp_flags_ecn;
3254
static int hf_bgp_flowspec_nlri_tcp_flags_urg;
3255
static int hf_bgp_flowspec_nlri_tcp_flags_ack;
3256
static int hf_bgp_flowspec_nlri_tcp_flags_push;
3257
static int hf_bgp_flowspec_nlri_tcp_flags_reset;
3258
static int hf_bgp_flowspec_nlri_tcp_flags_syn;
3259
static int hf_bgp_flowspec_nlri_tcp_flags_fin;
3260
static int hf_bgp_flowspec_nlri_fflag;
3261
static int hf_bgp_flowspec_nlri_fflag_lf;
3262
static int hf_bgp_flowspec_nlri_fflag_ff;
3263
static int hf_bgp_flowspec_nlri_fflag_isf;
3264
static int hf_bgp_flowspec_nlri_fflag_df;
3265
static int hf_bgp_flowspec_nlri_dscp;
3266
static int hf_bgp_flowspec_nlri_src_ipv6_pref;
3267
static int hf_bgp_flowspec_nlri_dst_ipv6_pref;
3268
static int hf_bgp_flowspec_nlri_ipv6_pref_len;
3269
static int hf_bgp_flowspec_nlri_ipv6_pref_offset;
3270
3271
/* BGP update safi ndt nlri  draft-nalawade-idr-mdt-safi-03 */
3272
3273
static int hf_bgp_mdt_nlri_safi_rd;
3274
static int hf_bgp_mdt_nlri_safi_ipv4_addr;
3275
static int hf_bgp_mdt_nlri_safi_group_addr;
3276
3277
/* BGP update extended community header field */
3278
3279
static int hf_bgp_ext_communities;
3280
static int hf_bgp_ext_community;
3281
static int hf_bgp_ext_com_type_auth;
3282
static int hf_bgp_ext_com_type_tran;
3283
3284
static int hf_bgp_ext_com_type_high;
3285
static int hf_bgp_ext_com_stype_low_unknown;
3286
static int hf_bgp_ext_com_stype_tr_evpn;
3287
static int hf_bgp_ext_com_stype_tr_as2;
3288
static int hf_bgp_ext_com_stype_ntr_as2;
3289
static int hf_bgp_ext_com_stype_tr_as4;
3290
static int hf_bgp_ext_com_stype_ntr_as4;
3291
static int hf_bgp_ext_com_stype_tr_IP4;
3292
static int hf_bgp_ext_com_stype_ntr_IP4;
3293
static int hf_bgp_ext_com_stype_tr_opaque;
3294
static int hf_bgp_ext_com_stype_ntr_opaque;
3295
static int hf_bgp_ext_com_tunnel_type;
3296
static int hf_bgp_ext_com_stype_tr_mup;
3297
static int hf_bgp_ext_com_stype_tr_exp;
3298
static int hf_bgp_ext_com_stype_tr_exp_2;
3299
static int hf_bgp_ext_com_stype_tr_exp_3;
3300
3301
static int hf_bgp_ext_com_value_as2;
3302
static int hf_bgp_ext_com_value_as4;
3303
static int hf_bgp_ext_com_value_IP4;
3304
static int hf_bgp_ext_com_value_an2;
3305
static int hf_bgp_ext_com_value_an4;
3306
static int hf_bgp_ext_com_value_raw;
3307
static int hf_bgp_ext_com_value_link_bw;
3308
static int hf_bgp_ext_com_value_ospf_rt_area;
3309
static int hf_bgp_ext_com_value_ospf_rt_type;
3310
static int hf_bgp_ext_com_value_ospf_rt_options;
3311
static int hf_bgp_ext_com_value_ospf_rt_options_mt;
3312
static int hf_bgp_ext_com_value_ospf_rid;
3313
static int hf_bgp_ext_com_value_fs_remark;
3314
static int hf_bgp_ext_com_local_admin_flags;
3315
static int hf_bgp_ext_com_local_admin_auto_derived_flag;
3316
static int hf_bgp_ext_com_local_admin_type;
3317
static int hf_bgp_ext_com_local_admin_domain_id;
3318
static int hf_bgp_ext_com_local_admin_service_id;
3319
3320
/* BGP QoS propagation draft-knoll-idr-qos-attribute */
3321
3322
static int hf_bgp_ext_com_qos_flags;
3323
static int hf_bgp_ext_com_qos_flags_remarking;
3324
static int hf_bgp_ext_com_qos_flags_ignore_remarking;
3325
static int hf_bgp_ext_com_qos_flags_agg_marking;
3326
static int hf_bgp_ext_com_cos_flags;
3327
static int hf_bgp_ext_com_cos_flags_be;
3328
static int hf_bgp_ext_com_cos_flags_ef;
3329
static int hf_bgp_ext_com_cos_flags_af;
3330
static int hf_bgp_ext_com_cos_flags_le;
3331
static int hf_bgp_ext_com_qos_set_number;
3332
static int hf_bgp_ext_com_qos_tech_type;
3333
static int hf_bgp_ext_com_qos_marking_o;
3334
static int hf_bgp_ext_com_qos_marking_a;
3335
static int hf_bgp_ext_com_qos_default_to_zero;
3336
3337
/* BGP Flow spec extended community RFC 5575 */
3338
3339
static int hf_bgp_ext_com_flow_rate_float;
3340
static int hf_bgp_ext_com_flow_act_allset;
3341
static int hf_bgp_ext_com_flow_act_term_act;
3342
static int hf_bgp_ext_com_flow_act_samp_act;
3343
3344
/* BGP L2 extended community RFC 4761, RFC 6624 */
3345
/* draft-ietf-l2vpn-vpls-multihoming */
3346
3347
static int hf_bgp_ext_com_l2_encaps;
3348
static int hf_bgp_ext_com_l2_c_flags;
3349
static int hf_bgp_ext_com_l2_mtu;
3350
static int hf_bgp_ext_com_l2_flag_d;
3351
static int hf_bgp_ext_com_l2_flag_z1;
3352
static int hf_bgp_ext_com_l2_flag_f;
3353
static int hf_bgp_ext_com_l2_flag_z345;
3354
static int hf_bgp_ext_com_l2_flag_c;
3355
static int hf_bgp_ext_com_l2_flag_s;
3356
static int hf_bgp_ext_com_l2_esi_label_flag;
3357
static int hf_bgp_ext_com_evpn_mmac_flag;
3358
static int hf_bgp_ext_com_evpn_mmac_seq;
3359
static int hf_bgp_ext_com_evpn_esirt;
3360
static int hf_bgp_ext_com_evpn_routermac;
3361
static int hf_bgp_ext_com_evpn_mmac_flag_sticky;
3362
3363
/* BGP E-Tree Info extended community RFC 7796 */
3364
3365
static int hf_bgp_ext_com_etree_flags;
3366
static int hf_bgp_ext_com_etree_root_vlan;
3367
static int hf_bgp_ext_com_etree_leaf_vlan;
3368
static int hf_bgp_ext_com_etree_flag_reserved;
3369
static int hf_bgp_ext_com_etree_flag_p;
3370
static int hf_bgp_ext_com_etree_flag_v;
3371
3372
/* VPWS Support in EVPN  RFC 8214 */
3373
/* draft-yu-bess-evpn-l2-attributes-04 */
3374
3375
static int hf_bgp_ext_com_evpn_l2attr_flags;
3376
static int hf_bgp_ext_com_evpn_l2attr_flag_reserved;
3377
static int hf_bgp_ext_com_evpn_l2attr_flag_ci;
3378
static int hf_bgp_ext_com_evpn_l2attr_flag_f;
3379
static int hf_bgp_ext_com_evpn_l2attr_flag_c;
3380
static int hf_bgp_ext_com_evpn_l2attr_flag_p;
3381
static int hf_bgp_ext_com_evpn_l2attr_flag_b;
3382
static int hf_bgp_ext_com_evpn_l2attr_l2_mtu;
3383
static int hf_bgp_ext_com_evpn_l2attr_reserved;
3384
3385
/* E-Tree RFC8317 */
3386
3387
static int hf_bgp_ext_com_evpn_etree_flags;
3388
static int hf_bgp_ext_com_evpn_etree_flag_reserved;
3389
static int hf_bgp_ext_com_evpn_etree_flag_l;
3390
static int hf_bgp_ext_com_evpn_etree_reserved;
3391
3392
/* BGP Cost Community */
3393
3394
static int hf_bgp_ext_com_cost_poi;
3395
static int hf_bgp_ext_com_cost_cid;
3396
static int hf_bgp_ext_com_cost_cost;
3397
static int hf_bgp_ext_com_cost_cid_rep;
3398
3399
/* EIGRP route attributes extended communities */
3400
3401
static int hf_bgp_ext_com_stype_tr_exp_eigrp;
3402
static int hf_bgp_ext_com_eigrp_flags;
3403
static int hf_bgp_ext_com_eigrp_flags_rt;
3404
static int hf_bgp_ext_com_eigrp_rtag;
3405
static int hf_bgp_ext_com_eigrp_asn;
3406
static int hf_bgp_ext_com_eigrp_delay;
3407
static int hf_bgp_ext_com_eigrp_rly;
3408
static int hf_bgp_ext_com_eigrp_hops;
3409
static int hf_bgp_ext_com_eigrp_bw;
3410
static int hf_bgp_ext_com_eigrp_load;
3411
static int hf_bgp_ext_com_eigrp_mtu;
3412
static int hf_bgp_ext_com_eigrp_rid;
3413
static int hf_bgp_ext_com_eigrp_e_asn;
3414
static int hf_bgp_ext_com_eigrp_e_rid;
3415
static int hf_bgp_ext_com_eigrp_e_pid;
3416
static int hf_bgp_ext_com_eigrp_e_m;
3417
3418
/* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
3419
static int hf_bgp_ls_igp_te_metric_flags;
3420
static int hf_bgp_ls_igp_te_metric_flags_a;
3421
static int hf_bgp_ls_igp_te_metric_flags_reserved;
3422
static int hf_bgp_ls_igp_te_metric_delay;
3423
static int hf_bgp_ls_igp_te_metric_delay_value;
3424
static int hf_bgp_ls_igp_te_metric_delay_min_max;
3425
static int hf_bgp_ls_igp_te_metric_delay_min;
3426
static int hf_bgp_ls_igp_te_metric_delay_max;
3427
static int hf_bgp_ls_igp_te_metric_delay_variation;
3428
static int hf_bgp_ls_igp_te_metric_delay_variation_value;
3429
static int hf_bgp_ls_igp_te_metric_link_loss;
3430
static int hf_bgp_ls_igp_te_metric_link_loss_value;
3431
static int hf_bgp_ls_igp_te_metric_bandwidth_residual;
3432
static int hf_bgp_ls_igp_te_metric_bandwidth_residual_value;
3433
static int hf_bgp_ls_igp_te_metric_bandwidth_available;
3434
static int hf_bgp_ls_igp_te_metric_bandwidth_available_value;
3435
static int hf_bgp_ls_igp_te_metric_bandwidth_utilized;
3436
static int hf_bgp_ls_igp_te_metric_bandwidth_utilized_value;
3437
static int hf_bgp_ls_igp_te_metric_reserved;
3438
3439
/* draft-ietf-bess-mup-safi-01 */
3440
static int hf_bgp_mup_nlri;
3441
static int hf_bgp_mup_nlri_at;
3442
static int hf_bgp_mup_nlri_rt;
3443
static int hf_bgp_mup_nlri_len;
3444
static int hf_bgp_mup_nlri_rd;
3445
static int hf_bgp_mup_nlri_prefixlen;
3446
static int hf_bgp_mup_nlri_ip_prefix;
3447
static int hf_bgp_mup_nlri_ipv6_prefix;
3448
static int hf_bgp_mup_nlri_ip_addr;
3449
static int hf_bgp_mup_nlri_ipv6_addr;
3450
static int hf_bgp_mup_nlri_3gpp_5g_type1_st_route;
3451
static int hf_bgp_mup_nlri_3gpp_5g_teid;
3452
static int hf_bgp_mup_nlri_3gpp_5g_qfi;
3453
static int hf_bgp_mup_nlri_3gpp_5g_ep_addr_len;
3454
static int hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr;
3455
static int hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr;
3456
static int hf_bgp_mup_nlri_3gpp_5g_source_addr_len;
3457
static int hf_bgp_mup_nlri_3gpp_5g_source_ip_addr;
3458
static int hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr;
3459
static int hf_bgp_mup_nlri_3gpp_5g_type2_st_route;
3460
static int hf_bgp_mup_nlri_ep_len;
3461
static int hf_bgp_mup_nlri_ep_ip_addr;
3462
static int hf_bgp_mup_nlri_ep_ipv6_addr;
3463
static int hf_bgp_mup_nlri_3gpp_5g_ep_teid;
3464
static int hf_bgp_mup_nlri_st_route_tlv;
3465
static int hf_bgp_mup_nlri_st_route_tlv_type;
3466
static int hf_bgp_mup_nlri_st_route_tlv_len;
3467
static int hf_bgp_mup_nlri_st_route_tlv_value;
3468
static int hf_bgp_mup_nlri_st_route_tlv_interwork_ep_ip_addr;
3469
static int hf_bgp_mup_nlri_st_route_tlv_interwork_ep_ipv6_addr;
3470
static int hf_bgp_mup_nlri_unknown_data;
3471
3472
static int * const ls_igp_te_metric_flags[] = {
3473
       &hf_bgp_ls_igp_te_metric_flags_a,
3474
       &hf_bgp_ls_igp_te_metric_flags_reserved,
3475
       NULL
3476
       };
3477
3478
static int ett_bgp;
3479
static int ett_bgp_prefix;
3480
static int ett_bgp_unfeas;
3481
static int ett_bgp_attrs;
3482
static int ett_bgp_attr;
3483
static int ett_bgp_attr_flags;
3484
static int ett_bgp_mp_nhna;
3485
static int ett_bgp_mp_reach_nlri;
3486
static int ett_bgp_mp_unreach_nlri;
3487
static int ett_bgp_mp_snpa;
3488
static int ett_bgp_nlri;
3489
static int ett_bgp_open;
3490
static int ett_bgp_update;
3491
static int ett_bgp_notification;
3492
static int ett_bgp_route_refresh; /* ROUTE-REFRESH message tree */
3493
static int ett_bgp_capability;
3494
static int ett_bgp_as_path_segment;
3495
static int ett_bgp_as_path_segment_asn;
3496
static int ett_bgp_communities;
3497
static int ett_bgp_community;
3498
static int ett_bgp_cluster_list;  /* cluster list tree          */
3499
static int ett_bgp_options;       /* optional parameters tree   */
3500
static int ett_bgp_option;        /* an optional parameter tree */
3501
static int ett_bgp_options_ext;
3502
static int ett_bgp_cap;           /* an cap parameter tree */
3503
static int ett_bgp_extended_communities; /* extended communities list tree */
3504
static int ett_bgp_extended_community; /* extended community tree for each community of BGP update */
3505
static int ett_bgp_ext_com_type;  /* Extended Community Type High tree (IANA, Transitive bits) */
3506
static int ett_bgp_extended_com_fspec_redir; /* extended communities BGP flow act redirect */
3507
static int ett_bgp_ext_com_flags; /* extended communities flags tree */
3508
static int ett_bgp_ext_com_l2_flags; /* extended communities tree for l2 services flags */
3509
static int ett_bgp_ext_com_etree_flags;
3510
static int ett_bgp_ext_com_evpn_mmac_flags;
3511
static int ett_bgp_ext_com_evpn_l2attr_flags;
3512
static int ett_bgp_ext_com_evpn_etree_flags;
3513
static int ett_bgp_ext_com_cost_cid; /* Cost community CommunityID tree (replace/evaluate after bit) */
3514
static int ett_bgp_ext_com_ospf_rt_opt; /* Tree for Options bitfield of OSPF Route Type extended community */
3515
static int ett_bgp_ext_com_eigrp_flags; /* Tree for EIGRP route flags */
3516
static int ett_bgp_ssa;           /* safi specific attribute */
3517
static int ett_bgp_ssa_subtree;   /* safi specific attribute Subtrees */
3518
static int ett_bgp_orf;           /* orf (outbound route filter) tree */
3519
static int ett_bgp_orf_entry;     /* orf entry tree */
3520
static int ett_bgp_mcast_vpn_nlri;
3521
static int ett_bgp_flow_spec_nlri;
3522
static int ett_bgp_flow_spec_nlri_filter; /* tree decoding multiple op and value pairs */
3523
static int ett_bgp_flow_spec_nlri_op_flags; /* tree decoding each op and val pair within the op and value set */
3524
static int ett_bgp_flow_spec_nlri_tcp;
3525
static int ett_bgp_flow_spec_nlri_ff;
3526
static int ett_bgp_tunnel_tlv;
3527
static int ett_bgp_tunnel_tlv_subtree;
3528
static int ett_bgp_tunnel_subtlv;
3529
static int ett_bgp_tunnel_subtlv_subtree;
3530
static int ett_bgp_link_state;
3531
static int ett_bgp_evpn_nlri;
3532
static int ett_bgp_evpn_nlri_esi;
3533
static int ett_bgp_evpn_nlri_mc;
3534
static int ett_bgp_mpls_labels;
3535
static int ett_bgp_pmsi_tunnel_id;
3536
static int ett_bgp_aigp_attr;
3537
static int ett_bgp_large_communities;
3538
static int ett_bgp_dpath;
3539
static int ett_bgp_bfd_discriminator_tlv;
3540
static int ett_bgp_prefix_sid_originator_srgb;
3541
static int ett_bgp_prefix_sid_originator_srgb_block;
3542
static int ett_bgp_prefix_sid_originator_srgb_blocks;
3543
static int ett_bgp_prefix_sid_label_index;
3544
static int ett_bgp_prefix_sid_ipv6;
3545
static int ett_bgp_bgpsec_secure_path;
3546
static int ett_bgp_bgpsec_secure_path_segment;
3547
static int ett_bgp_bgpsec_signature_block;
3548
static int ett_bgp_bgpsec_signature_segment;
3549
static int ett_bgp_vxlan;
3550
static int ett_bgp_binding_sid;
3551
static int ett_bgp_segment_list;
3552
static int ett_bgp_prefix_sid_unknown;
3553
static int ett_bgp_prefix_sid_srv6_l3vpn;
3554
static int ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs;
3555
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_information;
3556
static int ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs;
3557
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_structure;
3558
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown;
3559
static int ett_bgp_prefix_sid_srv6_l3vpn_unknown;
3560
static int ett_bgp_prefix_sid_srv6_l2vpn;
3561
static int ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs;
3562
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_information;
3563
static int ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs;
3564
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_structure;
3565
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown;
3566
static int ett_bgp_prefix_sid_srv6_l2vpn_unknown;
3567
static int ett_bgp_mup_nlri;
3568
static int ett_bgp_mup_nlri_3gpp_5g_type1_st_route;
3569
static int ett_bgp_mup_nlri_3gpp_5g_type2_st_route;
3570
static int ett_bgp_mup_nlri_st_route_tlv;
3571
3572
static expert_field ei_bgp_marker_invalid;
3573
static expert_field ei_bgp_cap_len_bad;
3574
static expert_field ei_bgp_cap_gr_helper_mode_only;
3575
static expert_field ei_bgp_notify_minor_unknown;
3576
static expert_field ei_bgp_route_refresh_orf_type_unknown;
3577
static expert_field ei_bgp_route_refresh_orf_type_unsupported;
3578
static expert_field ei_bgp_route_refresh_orf_type_unregistered;
3579
static expert_field ei_bgp_route_refresh_orf_action_invalid;
3580
static expert_field ei_bgp_length_invalid;
3581
static expert_field ei_bgp_prefix_length_invalid;
3582
static expert_field ei_bgp_afi_type_not_supported;
3583
static expert_field ei_bgp_unknown_afi;
3584
static expert_field ei_bgp_unknown_safi;
3585
static expert_field ei_bgp_unknown_label_vpn;
3586
static expert_field ei_bgp_ls_error;
3587
static expert_field ei_bgp_ls_warn;
3588
static expert_field ei_bgp_ext_com_len_bad;
3589
static expert_field ei_bgp_attr_pmsi_opaque_type;
3590
static expert_field ei_bgp_attr_pmsi_tunnel_type;
3591
static expert_field ei_bgp_prefix_length_err;
3592
static expert_field ei_bgp_attr_aigp_type;
3593
static expert_field ei_bgp_attr_as_path_as_len_err;
3594
static expert_field ei_bgp_next_hop_ipv6_scope;
3595
static expert_field ei_bgp_next_hop_rd_nonzero;
3596
3597
static expert_field ei_bgp_evpn_nlri_rt_type_err;
3598
static expert_field ei_bgp_evpn_nlri_rt_len_err;
3599
static expert_field ei_bgp_evpn_nlri_esi_type_err;
3600
static expert_field ei_bgp_evpn_nlri_rt4_no_ip;
3601
3602
static expert_field ei_bgp_mup_unknown_at;
3603
static expert_field ei_bgp_mup_unknown_rt;
3604
static expert_field ei_bgp_mup_nlri_addr_len_err;
3605
static expert_field ei_bgp_mup_nlri_tlv_len_err;
3606
3607
/* desegmentation */
3608
static bool bgp_desegment = true;
3609
static bool bgp_ext_msg = true;
3610
3611
static int bgp_asn_len;
3612
3613
/* FF: BGP-LS is just a collector of IGP link state information. Some
3614
   fields are encoded "as-is" from the IGP, hence in order to dissect
3615
   them properly we must be aware of their origin, e.g. IS-IS or OSPF.
3616
   So, *before* dissecting LINK_STATE attributes we must get the
3617
   'Protocol-ID' field that is present in the MP_[UN]REACH_NLRI
3618
   attribute. The tricky thing is that there is no strict order
3619
   for path attributes on the wire, hence we have to keep track
3620
   of 1) the 'Protocol-ID' from the MP_[UN]REACH_NLRI and 2)
3621
   the offset/len of the LINK_STATE attribute. We store them in
3622
   per-packet proto_data and once we got both we are ready for the
3623
   LINK_STATE attribute dissection.
3624
*/
3625
typedef struct _link_state_data {
3626
    /* Link/Node NLRI Protocol-ID (e.g. OSPF or IS-IS) */
3627
    uint8_t protocol_id;
3628
    /* LINK_STATE attribute coordinates */
3629
    int ostart;  /* offset at which the LINK_STATE path attribute starts */
3630
    int oend;    /* offset at which the LINK_STATE path attribute ends */
3631
    uint16_t tlen; /* length of the LINK_STATE path attribute */
3632
    /* presence flag */
3633
    bool link_state_attr_present;
3634
    /* tree where add LINK_STATE items */
3635
    proto_tree *subtree2;
3636
} link_state_data;
3637
3638
31.5k
#define LINK_STATE_DATA_KEY 0
3639
3640
static void
3641
11.5k
save_link_state_protocol_id(packet_info *pinfo, uint8_t protocol_id) {
3642
11.5k
    link_state_data *data =
3643
11.5k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3644
11.5k
    if (!data) {
3645
1.10k
        data = wmem_new0(pinfo->pool, link_state_data);
3646
1.10k
        data->ostart = -1;
3647
1.10k
        data->oend = -1;
3648
1.10k
        data->tlen = 0;
3649
1.10k
        data->link_state_attr_present = false;
3650
1.10k
        data->subtree2 = NULL;
3651
1.10k
    }
3652
11.5k
    data->protocol_id = protocol_id;
3653
11.5k
    p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3654
11.5k
    return;
3655
11.5k
}
3656
3657
static void
3658
2.89k
save_link_state_attr_position(packet_info *pinfo, int ostart, int oend, uint16_t tlen, proto_tree *subtree2) {
3659
2.89k
    link_state_data *data =
3660
2.89k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3661
2.89k
    if (!data) {
3662
2.00k
        data = wmem_new0(pinfo->pool, link_state_data);
3663
2.00k
        data->protocol_id = BGP_LS_NLRI_PROTO_ID_UNKNOWN;
3664
2.00k
    }
3665
2.89k
    data->ostart = ostart;
3666
2.89k
    data->oend = oend;
3667
2.89k
    data->tlen = tlen;
3668
2.89k
    data->link_state_attr_present = true;
3669
2.89k
    data->subtree2 = subtree2;
3670
2.89k
    p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3671
2.89k
    return;
3672
2.89k
}
3673
3674
static link_state_data*
3675
2.71k
load_link_state_data(packet_info *pinfo) {
3676
2.71k
    link_state_data *data =
3677
2.71k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3678
2.71k
    return data;
3679
2.71k
}
3680
3681
typedef struct _path_attr_data {
3682
    bool encaps_community_present;
3683
    uint16_t encaps_tunnel_type;
3684
} path_attr_data;
3685
3686
11.3k
#define PATH_ATTR_DATA_KEY 1
3687
3688
static void
3689
304
save_path_attr_encaps_tunnel_type(packet_info *pinfo, uint32_t encaps_tunnel_type) {
3690
304
    path_attr_data *data =
3691
304
        (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3692
304
    if (!data) {
3693
210
        data = wmem_new0(wmem_file_scope(), path_attr_data);
3694
210
    }
3695
304
    data->encaps_community_present = true;
3696
304
    data->encaps_tunnel_type = encaps_tunnel_type;
3697
304
    p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY, data);
3698
304
    return;
3699
304
}
3700
3701
static path_attr_data*
3702
10.7k
load_path_attr_data(packet_info *pinfo) {
3703
10.7k
    path_attr_data *data =
3704
10.7k
        (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3705
10.7k
    return data;
3706
10.7k
}
3707
3708
typedef struct _afi_safi_data {
3709
    uint16_t afi;
3710
    uint8_t safi;  /* offset at which the LINK_STATE path attribute starts */
3711
} afi_safi_data;
3712
3713
60.2k
#define AFI_SAFI_DATA_KEY 2
3714
3715
static void
3716
29.8k
save_afi_safi_data(packet_info *pinfo, uint16_t afi, uint8_t safi) {
3717
29.8k
    afi_safi_data *data =
3718
29.8k
        (afi_safi_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY);
3719
29.8k
    if (!data) {
3720
5.49k
        data = wmem_new0(wmem_file_scope(), afi_safi_data);
3721
5.49k
    }
3722
29.8k
    data->afi  = afi;
3723
29.8k
    data->safi = safi;
3724
29.8k
    p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY, data);
3725
29.8k
    return;
3726
29.8k
}
3727
3728
static afi_safi_data*
3729
464
load_afi_safi_data(packet_info *pinfo) {
3730
464
    afi_safi_data *data =
3731
464
        (afi_safi_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY);
3732
464
    return data;
3733
464
}
3734
3735
/*
3736
 * Detect IPv4/IPv6 prefixes  conform to BGP Additional Path but NOT conform to standard BGP
3737
 *
3738
 * A real BGP speaker would rely on the BGP Additional Path in the BGP Open messages.
3739
 * But it is not suitable for a packet analyse because the BGP sessions are not supposed to
3740
 * restart very often, and Open messages from both sides of the session would be needed
3741
 * to determine the result of the capability negotiation.
3742
 * Code inspired from the decode_prefix4 function
3743
 */
3744
static int
3745
120k
detect_add_path_prefix46(tvbuff_t *tvb, unsigned offset, int end, int max_bit_length) {
3746
120k
    uint32_t addr_len;
3747
120k
    uint8_t prefix_len;
3748
120k
    int o;
3749
    /* Must be compatible with BGP Additional Path  */
3750
157k
    for (o = offset + 4; o < end; o += 4) {
3751
38.0k
        prefix_len = tvb_get_uint8(tvb, o);
3752
38.0k
        if( prefix_len > max_bit_length) {
3753
459
            return 0; /* invalid prefix length - not BGP add-path */
3754
459
        }
3755
37.5k
        addr_len = (prefix_len + 7) / 8;
3756
37.5k
        o += 1 + addr_len;
3757
37.5k
        if( o > end ) {
3758
413
            return 0; /* invalid offset - not BGP add-path */
3759
413
        }
3760
37.1k
        if (prefix_len % 8) {
3761
            /* detect bits set after the end of the prefix */
3762
2.64k
            if( tvb_get_uint8(tvb, o - 1 )  & (0xFF >> (prefix_len % 8)) ) {
3763
469
                return 0; /* invalid prefix content - not BGP add-path */
3764
469
            }
3765
2.64k
        }
3766
37.1k
    }
3767
    /* Must NOT be compatible with standard BGP */
3768
142k
    for (o = offset; o < end; ) {
3769
25.3k
        prefix_len = tvb_get_uint8(tvb, o);
3770
25.3k
        if( prefix_len == 0 && end - o > 1 ) {
3771
589
            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 */
3772
589
        }
3773
24.7k
        if( prefix_len > max_bit_length) {
3774
275
            return 1; /* invalid prefix length - may be BGP add-path */
3775
275
        }
3776
24.5k
        addr_len = (prefix_len + 7) / 8;
3777
24.5k
        o += 1 + addr_len;
3778
24.5k
        if( o > end ) {
3779
1.76k
            return 1; /* invalid offset - may be BGP add-path */
3780
1.76k
        }
3781
22.7k
        if (prefix_len % 8) {
3782
            /* detect bits set after the end of the prefix */
3783
2.86k
            if( tvb_get_uint8(tvb, o - 1 ) & (0xFF >> (prefix_len % 8)) ) {
3784
218
                return 1; /* invalid prefix content - may be BGP add-path (or a bug) */
3785
218
            }
3786
2.86k
        }
3787
22.7k
    }
3788
116k
    return 0; /* valid - do not assume Additional Path */
3789
119k
}
3790
static int
3791
54.2k
detect_add_path_prefix4(tvbuff_t *tvb, unsigned offset, int end) {
3792
54.2k
    return detect_add_path_prefix46(tvb, offset, end, 32);
3793
54.2k
}
3794
static int
3795
58.6k
detect_add_path_prefix6(tvbuff_t *tvb, unsigned offset, int end) {
3796
58.6k
    return detect_add_path_prefix46(tvb, offset, end, 128);
3797
58.6k
}
3798
3799
/*
3800
 * Walk a list of BGP-MUP NLRI, each one optionally preceded by a Path
3801
 * Identifier, and tell whether the list is consistent with that assumption:
3802
 * every NLRI header is plausible and the last one ends exactly at the end of
3803
 * the NLRI field.
3804
 *
3805
 * Route types are only rejected when unassigned, not when merely unknown to
3806
 * this dissector: draft-ietf-bess-mup-safi has receivers ignore route types
3807
 * they do not implement, so rejecting them here would turn the detection off
3808
 * for every NLRI of an update carrying a single one of them.
3809
 */
3810
static bool
3811
347k
check_bgp_mup_nlri_list(tvbuff_t *tvb, unsigned offset, int end, bool add_path) {
3812
347k
    uint8_t  architecture_type;
3813
347k
    uint16_t route_type;
3814
347k
    int o;
3815
3816
426k
    for (o = offset; o < end; ) {
3817
84.1k
        if (add_path) {
3818
23.8k
            o += 4;
3819
23.8k
        }
3820
84.1k
        if (o + 4 > end) {
3821
926
            return false;
3822
926
        }
3823
83.2k
        if (!tvb_bytes_exist(tvb, o, 4)) {
3824
            /* Truncated capture: nothing seen so far contradicts the walk */
3825
491
            return true;
3826
491
        }
3827
82.7k
        architecture_type = tvb_get_uint8(tvb, o);
3828
82.7k
        route_type = tvb_get_ntohs(tvb, o + 1);
3829
82.7k
        if (architecture_type != BGP_MUP_AT_3GPP_5G || route_type == 0) {
3830
2.90k
            return false;
3831
2.90k
        }
3832
79.8k
        o += 4 + tvb_get_uint8(tvb, o + 3);
3833
79.8k
    }
3834
342k
    return o == end;
3835
347k
}
3836
3837
/*
3838
 * Detect if BGP-MUP NLRI are using Path Identifiers
3839
 *
3840
 * The MUP NLRI has no prefix length to key off, so detect_add_path_prefix46()
3841
 * does not apply. The NLRI is self delimiting instead, which allows the list to
3842
 * be walked both ways: only assume Additional Path when the walk holds with a
3843
 * Path Identifier and not without one.
3844
 */
3845
static int
3846
173k
detect_add_path_bgp_mup(tvbuff_t *tvb, unsigned offset, int end) {
3847
173k
    return !check_bgp_mup_nlri_list(tvb, offset, end, false) &&
3848
173k
        check_bgp_mup_nlri_list(tvb, offset, end, true);
3849
173k
}
3850
3851
/*
3852
 * Decode an IPv4 prefix with Path Identifier
3853
 * Code inspired from the decode_prefix4 function
3854
 */
3855
static int
3856
decode_path_prefix4(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, unsigned offset,
3857
                    const char *tag)
3858
1.19k
{
3859
1.19k
    proto_tree *prefix_tree;
3860
1.19k
    ws_in4_addr ip_addr; /* IP address                         */
3861
1.19k
    uint8_t plen;         /* prefix length                      */
3862
1.19k
    int    length;       /* number of octets needed for prefix */
3863
1.19k
    uint32_t path_identifier;
3864
1.19k
    address addr;
3865
3866
    /* snarf path identifier length and prefix */
3867
1.19k
    path_identifier = tvb_get_ntohl(tvb, offset);
3868
1.19k
    plen = tvb_get_uint8(tvb, offset + 4);
3869
1.19k
    length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 4 + 1, &ip_addr, plen);
3870
1.19k
    if (length < 0) {
3871
132
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4 , 1, "%s length %u invalid (> 32)",
3872
132
            tag, plen);
3873
132
        return -1;
3874
132
    }
3875
    /* put prefix into protocol tree */
3876
1.06k
    set_address(&addr, AT_IPv4, 4, &ip_addr);
3877
1.06k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,  4 + 1 + length,
3878
1.06k
                            ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3879
1.06k
                            address_to_str(pinfo->pool, &addr), plen, path_identifier);
3880
1.06k
    proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3881
1.06k
    proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
3882
1.06k
    proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, ip_addr);
3883
1.06k
    return 4 + 1 + length;
3884
1.19k
}
3885
3886
/*
3887
 * Decode an IPv4 prefix.
3888
 */
3889
static int
3890
decode_prefix4(proto_tree *tree, packet_info *pinfo, proto_item *parent_item, int hf_addr, tvbuff_t *tvb, unsigned offset,
3891
               const char *tag)
3892
56.0k
{
3893
56.0k
    proto_tree *prefix_tree;
3894
56.0k
    ws_in4_addr ip_addr; /* IP address                         */
3895
56.0k
    uint8_t plen;         /* prefix length                      */
3896
56.0k
    int    length;       /* number of octets needed for prefix */
3897
56.0k
    address addr;
3898
3899
    /* snarf length and prefix */
3900
56.0k
    plen = tvb_get_uint8(tvb, offset);
3901
56.0k
    length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 1, &ip_addr, plen);
3902
56.0k
    if (length < 0) {
3903
1.53k
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid (> 32)",
3904
1.53k
            tag, plen);
3905
1.53k
        return -1;
3906
1.53k
    }
3907
3908
    /* put prefix into protocol tree */
3909
54.5k
    set_address(&addr, AT_IPv4, 4, &ip_addr);
3910
54.5k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3911
54.5k
            1 + length, ett_bgp_prefix, NULL,
3912
54.5k
            "%s/%u", address_to_str(pinfo->pool, &addr), plen);
3913
3914
54.5k
    proto_item_append_text(parent_item, " (%s/%u)",
3915
54.5k
                             address_to_str(pinfo->pool, &addr), plen);
3916
3917
54.5k
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3918
54.5k
        tag, plen);
3919
54.5k
    proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 1, length, ip_addr);
3920
54.5k
    return 1 + length;
3921
56.0k
}
3922
3923
/*
3924
 * Decode an IPv6 prefix with path ID.
3925
 */
3926
static int
3927
decode_path_prefix6(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, unsigned offset,
3928
               const char *tag)
3929
485
{
3930
485
    proto_tree          *prefix_tree;
3931
485
    uint32_t path_identifier;
3932
485
    ws_in6_addr   addr;     /* IPv6 address                       */
3933
485
    address             addr_str;
3934
485
    int                 plen;     /* prefix length                      */
3935
485
    int                 length;   /* number of octets needed for prefix */
3936
3937
    /* snarf length and prefix */
3938
485
    path_identifier = tvb_get_ntohl(tvb, offset);
3939
485
    plen = tvb_get_uint8(tvb, offset + 4);
3940
485
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 4 + 1, &addr, plen);
3941
485
    if (length < 0) {
3942
66
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4, 1, "%s length %u invalid",
3943
66
            tag, plen);
3944
66
        return -1;
3945
66
    }
3946
3947
    /* put prefix into protocol tree */
3948
419
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3949
419
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,  4 + 1 + length,
3950
419
                            ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3951
419
                            address_to_str(pinfo->pool, &addr_str), plen, path_identifier);
3952
3953
419
    proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3954
419
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, plen, "%s prefix length: %u",
3955
419
        tag, plen);
3956
419
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, &addr);
3957
3958
419
    return 4 + 1 + length;
3959
485
}
3960
3961
/*
3962
 * Decode an IPv6 prefix.
3963
 */
3964
static int
3965
decode_prefix6(proto_tree *tree, packet_info *pinfo, int hf_addr, tvbuff_t *tvb, unsigned offset,
3966
               uint16_t tlen, const char *tag)
3967
58.4k
{
3968
58.4k
    proto_tree          *prefix_tree;
3969
58.4k
    ws_in6_addr   addr;     /* IPv6 address                       */
3970
58.4k
    address             addr_str;
3971
58.4k
    int                 plen;     /* prefix length                      */
3972
58.4k
    int                 length;   /* number of octets needed for prefix */
3973
3974
    /* snarf length and prefix */
3975
58.4k
    plen = tvb_get_uint8(tvb, offset);
3976
58.4k
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 1, &addr, plen);
3977
58.4k
    if (length < 0) {
3978
657
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid",
3979
657
            tag, plen);
3980
657
        return -1;
3981
657
    }
3982
3983
    /* put prefix into protocol tree */
3984
57.7k
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3985
57.7k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3986
57.7k
            tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3987
57.7k
            address_to_str(pinfo->pool, &addr_str), plen);
3988
57.7k
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3989
57.7k
        tag, plen);
3990
57.7k
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 1, length, &addr);
3991
57.7k
    return 1 + length;
3992
58.4k
}
3993
3994
static int
3995
decode_fspec_match_prefix6(proto_tree *tree, proto_item *parent_item, int hf_addr,
3996
                           tvbuff_t *tvb, unsigned offset, uint16_t tlen, packet_info *pinfo)
3997
1.20k
{
3998
1.20k
    proto_tree        *prefix_tree;
3999
1.20k
    ws_in6_addr addr;     /* IPv6 address                       */
4000
1.20k
    address           addr_str;
4001
1.20k
    int               plen;     /* prefix length                      */
4002
1.20k
    int               length;   /* number of octets needed for prefix */
4003
1.20k
    int               poffset_place = 1;
4004
1.20k
    int               plength_place = 0;
4005
4006
    /* snarf length and prefix */
4007
1.20k
    plen = tvb_get_uint8(tvb, offset);
4008
1.20k
    if (plen == 0) /* I should be facing a draft 04 version where the prefix offset is switched with length */
4009
213
    {
4010
213
      plen =  tvb_get_uint8(tvb, offset+1);
4011
213
      poffset_place = 0;
4012
213
      plength_place = 1;
4013
213
    }
4014
1.20k
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 2, &addr, plen);
4015
1.20k
    if (length < 0) {
4016
390
        expert_add_info_format(pinfo, parent_item, &ei_bgp_prefix_length_err, "Length is invalid %u", plen);
4017
390
        return -1;
4018
390
    }
4019
4020
    /* put prefix into protocol tree */
4021
810
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
4022
810
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
4023
810
            tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
4024
810
            address_to_str(pinfo->pool, &addr_str), plen);
4025
810
    proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_len, tvb, offset + plength_place, 1, ENC_BIG_ENDIAN);
4026
810
    proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_offset, tvb, offset + poffset_place, 1, ENC_BIG_ENDIAN);
4027
810
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 2, length, &addr);
4028
810
    if (parent_item != NULL)
4029
730
      proto_item_append_text(parent_item, " (%s/%u)",
4030
730
                             address_to_str(pinfo->pool, &addr_str), plen);
4031
810
    return 2 + length;
4032
1.20k
}
4033
4034
const char*
4035
decode_bgp_rd(wmem_allocator_t *pool, tvbuff_t *tvb, unsigned offset)
4036
32.0k
{
4037
32.0k
    uint16_t rd_type;
4038
32.0k
    wmem_strbuf_t *strbuf;
4039
4040
32.0k
    rd_type = tvb_get_ntohs(tvb,offset);
4041
32.0k
    strbuf = wmem_strbuf_create(pool);
4042
4043
32.0k
    switch (rd_type) {
4044
2.29k
        case FORMAT_AS2_LOC:
4045
2.29k
            wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohs(tvb, offset + 2),
4046
2.29k
                                      tvb_get_ntohl(tvb, offset + 4));
4047
2.29k
            break;
4048
631
        case FORMAT_IP_LOC:
4049
631
            wmem_strbuf_append_printf(strbuf, "%s:%u", tvb_ip_to_str(pool, tvb, offset + 2),
4050
631
                                      tvb_get_ntohs(tvb, offset + 6));
4051
631
            break ;
4052
855
        case FORMAT_AS4_LOC:
4053
855
            wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohl(tvb, offset + 2),
4054
855
                                      tvb_get_ntohs(tvb, offset + 6));
4055
855
            break ;
4056
28.2k
        default:
4057
28.2k
            wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) RD type",rd_type);
4058
28.2k
            break;
4059
32.0k
    } /* switch (rd_type) */
4060
4061
32.0k
    return wmem_strbuf_get_str(strbuf);
4062
32.0k
}
4063
4064
static int
4065
decode_mcast_vpn_nlri_addresses(proto_tree *tree, tvbuff_t *tvb,
4066
                                unsigned offset)
4067
6.58k
{
4068
6.58k
    uint8_t addr_len;
4069
4070
    /* Multicast Source Address */
4071
6.58k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_length, tvb, offset,
4072
6.58k
                        1, ENC_BIG_ENDIAN);
4073
6.58k
    addr_len = tvb_get_uint8(tvb, offset);
4074
6.58k
    if (addr_len != 0 && addr_len != 32 && addr_len != 128)
4075
1.27k
        return -1;
4076
5.30k
    offset++;
4077
5.30k
    switch (addr_len) {
4078
680
        case 32:
4079
680
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv4, tvb,
4080
680
                                offset, 4, ENC_BIG_ENDIAN);
4081
680
            offset += 4;
4082
680
            break;
4083
1.07k
        case 128:
4084
1.07k
             proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv6, tvb,
4085
1.07k
                                 offset, 16, ENC_NA);
4086
1.07k
             offset += 16;
4087
1.07k
             break;
4088
5.30k
    }
4089
4090
    /* Multicast Group Address */
4091
5.29k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_length, tvb, offset,
4092
5.29k
                        1, ENC_BIG_ENDIAN);
4093
5.29k
    addr_len = tvb_get_uint8(tvb, offset);
4094
5.29k
    if (addr_len != 0 && addr_len != 32 && addr_len != 128)
4095
555
        return -1;
4096
4.74k
    offset++;
4097
4.74k
    switch(addr_len) {
4098
312
        case 32:
4099
312
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv4, tvb,
4100
312
                                offset, 4, ENC_BIG_ENDIAN);
4101
312
            offset += 4;
4102
312
            break;
4103
311
        case 128:
4104
311
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv6, tvb,
4105
311
                                offset, 16, ENC_NA);
4106
311
            offset += 16;
4107
311
            break;
4108
4.74k
    }
4109
4110
4.72k
    return offset;
4111
4.74k
}
4112
4113
/*
4114
 * function to decode operator in BGP flow spec NLRI when it address decimal values (TCP ports, UDP ports, ports, ...)
4115
 */
4116
4117
static void
4118
decode_bgp_flow_spec_dec_operator(proto_tree *tree, tvbuff_t *tvb, unsigned offset)
4119
122k
{
4120
122k
    static int * const flags[] = {
4121
122k
        &hf_bgp_flowspec_nlri_op_eol,
4122
122k
        &hf_bgp_flowspec_nlri_op_and,
4123
122k
        &hf_bgp_flowspec_nlri_op_val_len,
4124
122k
        &hf_bgp_flowspec_nlri_op_un_bit4,
4125
122k
        &hf_bgp_flowspec_nlri_op_lt,
4126
122k
        &hf_bgp_flowspec_nlri_op_gt,
4127
122k
        &hf_bgp_flowspec_nlri_op_eq,
4128
122k
        NULL
4129
122k
    };
4130
4131
122k
    proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
4132
122k
}
4133
4134
/*
4135
 * Decode an operator and decimal values of BGP flow spec NLRI
4136
 */
4137
static int
4138
decode_bgp_nlri_op_dec_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4139
5.39k
{
4140
5.39k
    uint8_t nlri_operator;
4141
5.39k
    unsigned cursor_op_val=0;
4142
5.39k
    uint8_t value_len=0;
4143
5.39k
    unsigned value=0;
4144
5.39k
    uint8_t shift_amount=0;
4145
5.39k
    unsigned first_loop=0;
4146
4147
5.39k
    proto_item_append_text(parent_item," (");
4148
4149
122k
    do {
4150
122k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4151
122k
        shift_amount = nlri_operator&0x30;
4152
122k
        shift_amount = shift_amount >> 4;
4153
122k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4154
        /* call to a operator decode function */
4155
122k
        decode_bgp_flow_spec_dec_operator(parent_tree, tvb, offset+cursor_op_val);
4156
122k
        if (first_loop == 0)
4157
5.38k
        {
4158
            /* If first operator we remove a white space and or (||) is not relevant */
4159
            /* BGP flow spec NLRI operator bitmask */
4160
5.38k
            proto_item_append_text(parent_item,"%s%s%s%s",
4161
5.38k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4162
5.38k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4163
5.38k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4164
5.38k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4165
5.38k
            first_loop = 1;
4166
5.38k
        }
4167
116k
        else
4168
116k
        {
4169
116k
            proto_item_append_text(parent_item," %s%s%s%s",
4170
116k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4171
116k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4172
116k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4173
116k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4174
116k
        }
4175
122k
        cursor_op_val++;  /* we manage this operator we move to the value */
4176
122k
        switch (value_len) {
4177
116k
            case 1:
4178
116k
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_8, tvb, offset+cursor_op_val, 1,ENC_BIG_ENDIAN);
4179
116k
                value = tvb_get_uint8(tvb,offset+cursor_op_val);
4180
116k
                break;
4181
1.12k
            case 2:
4182
1.12k
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_16, tvb, offset+cursor_op_val, 2,ENC_BIG_ENDIAN);
4183
1.12k
                value = tvb_get_ntohs(tvb,offset+cursor_op_val);
4184
1.12k
                break;
4185
0
            case 3:
4186
0
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_32, tvb, offset+cursor_op_val, 4, ENC_BIG_ENDIAN);
4187
0
                value = tvb_get_ntohl(tvb,offset+cursor_op_val);
4188
0
                break;
4189
780
            case 4:
4190
780
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_64, tvb, offset+cursor_op_val, 8, ENC_BIG_ENDIAN);
4191
780
                break;
4192
4.17k
            default:
4193
4.17k
                return -1;
4194
122k
        }
4195
118k
        cursor_op_val = cursor_op_val + value_len;
4196
118k
        proto_item_append_text(parent_item,"%u", value);
4197
118k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4198
1.19k
    proto_item_append_text(parent_item,")");
4199
1.19k
    return (cursor_op_val);
4200
5.39k
}
4201
4202
4203
/*
4204
 * function to decode operator in BGP flow spec NLRI when it address a bitmask values (TCP flags, fragmentation flags,...)
4205
 */
4206
4207
static void
4208
decode_bgp_flow_spec_bitmask_operator(proto_tree *tree, tvbuff_t *tvb, unsigned offset)
4209
272k
{
4210
272k
    static int * const flags[] = {
4211
272k
        &hf_bgp_flowspec_nlri_op_eol,
4212
272k
        &hf_bgp_flowspec_nlri_op_and,
4213
272k
        &hf_bgp_flowspec_nlri_op_val_len,
4214
272k
        &hf_bgp_flowspec_nlri_op_un_bit4,
4215
272k
        &hf_bgp_flowspec_nlri_op_un_bit5,
4216
272k
        &hf_bgp_flowspec_nlri_op_flg_not,
4217
272k
        &hf_bgp_flowspec_nlri_op_flg_match,
4218
272k
        NULL
4219
272k
    };
4220
4221
272k
    proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
4222
272k
}
4223
4224
/*
4225
 * Decode an operator and tcp flags bitmask of BGP flow spec NLRI
4226
 */
4227
static int
4228
decode_bgp_nlri_op_tcpf_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4229
1.73k
{
4230
1.73k
    uint8_t nlri_operator;
4231
1.73k
    uint8_t tcp_flags;
4232
1.73k
    unsigned cursor_op_val=0;
4233
1.73k
    uint8_t value_len=0;
4234
1.73k
    uint8_t shift_amount=0;
4235
1.73k
    unsigned first_loop=0;
4236
4237
1.73k
    static int * const nlri_tcp_flags[] = {
4238
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_cwr,
4239
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_ecn,
4240
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_urg,
4241
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_ack,
4242
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_push,
4243
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_reset,
4244
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_syn,
4245
1.73k
        &hf_bgp_flowspec_nlri_tcp_flags_fin,
4246
1.73k
        NULL
4247
1.73k
    };
4248
4249
1.73k
    proto_item_append_text(parent_item," (");
4250
4251
254k
    do {
4252
254k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4253
254k
        shift_amount = nlri_operator&0x30;
4254
254k
        shift_amount = shift_amount >> 4;
4255
254k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4256
254k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val); /* call to a operator decode function */
4257
254k
        if (first_loop == 0)
4258
1.73k
        {
4259
            /* If first operator we remove a white space and or (||) is not relevant */
4260
1.73k
            proto_item_append_text(parent_item,"%s%s%s%s",
4261
1.73k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4262
1.73k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4263
1.73k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4264
1.73k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4265
1.73k
            first_loop = 1;
4266
1.73k
        }
4267
252k
        else
4268
252k
        {
4269
252k
            proto_item_append_text(parent_item," %s%s%s%s",
4270
252k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4271
252k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4272
252k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4273
252k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4274
252k
        }
4275
254k
        cursor_op_val++;  /* we manage this operator we move to the value */
4276
254k
        if (value_len == 2) {
4277
1.76k
            cursor_op_val++; /* tcp flags are coded over 2 bytes only the second one is significant, we move to second byte */
4278
1.76k
        }
4279
4280
254k
        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);
4281
254k
        tcp_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4282
4283
254k
        proto_item_append_text(parent_item," %s%s%s%s%s%s",
4284
254k
             ((tcp_flags & BGPNLRI_FSPEC_TH_URG) == 0) ? "" : "U",
4285
254k
             ((tcp_flags & BGPNLRI_FSPEC_TH_ACK) == 0) ? "" : "A",
4286
254k
             ((tcp_flags & BGPNLRI_FSPEC_TH_PUSH) == 0) ? "" : "P",
4287
254k
             ((tcp_flags & BGPNLRI_FSPEC_TH_RST) == 0) ? "" : "R",
4288
254k
             ((tcp_flags & BGPNLRI_FSPEC_TH_SYN) == 0) ? "" : "S",
4289
254k
             ((tcp_flags & BGPNLRI_FSPEC_TH_FIN) == 0) ? "" : "F");
4290
254k
        cursor_op_val = cursor_op_val + value_len;
4291
254k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4292
1.73k
    proto_item_append_text(parent_item,")");
4293
1.73k
    return (cursor_op_val);
4294
1.73k
}
4295
4296
4297
/*
4298
 * Decode an operator and fragmentation bitmask of BGP flow spec NLRI
4299
 */
4300
static int
4301
decode_bgp_nlri_op_fflag_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4302
932
{
4303
932
    uint8_t nlri_operator;
4304
932
    uint8_t fragment_flags;
4305
932
    unsigned cursor_op_val=0;
4306
932
    uint8_t value_len=0;
4307
932
    uint8_t shift_amount=0;
4308
932
    unsigned first_loop=0;
4309
4310
932
    static int * const nlri_flags[] = {
4311
932
        &hf_bgp_flowspec_nlri_fflag_lf,
4312
932
        &hf_bgp_flowspec_nlri_fflag_ff,
4313
932
        &hf_bgp_flowspec_nlri_fflag_isf,
4314
932
        &hf_bgp_flowspec_nlri_fflag_df,
4315
932
        NULL
4316
932
    };
4317
4318
932
    proto_item_append_text(parent_item," (");
4319
4320
8.19k
    do {
4321
8.19k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4322
8.19k
        shift_amount = nlri_operator&0x30;
4323
8.19k
        shift_amount = shift_amount >> 4;
4324
8.19k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4325
        /* call a function to decode operator addressing bitmask */
4326
8.19k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
4327
8.19k
        if (first_loop == 0)
4328
932
        {
4329
            /* If first operator we remove a white space and or (||) is not relevant */
4330
932
            proto_item_append_text(parent_item,"%s%s%s%s",
4331
932
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4332
932
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4333
932
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4334
932
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4335
932
            first_loop = 1;
4336
932
        }
4337
7.26k
        else
4338
7.26k
        {
4339
7.26k
            proto_item_append_text(parent_item," %s%s%s%s",
4340
7.26k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4341
7.26k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4342
7.26k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4343
7.26k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4344
7.26k
        }
4345
8.19k
        cursor_op_val++;  /* we manage this operator we move to the value */
4346
8.19k
        if (value_len != 1) {
4347
501
            return -1; /* frag flags have to be coded in 1 byte */
4348
501
        }
4349
7.69k
        fragment_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4350
4351
7.69k
        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);
4352
4353
7.69k
        proto_item_append_text(parent_item," %s%s%s%s",
4354
7.69k
             ((fragment_flags & BGPNLRI_FSPEC_FG_DF) == 0) ? "" : "DF",
4355
7.69k
             ((fragment_flags & BGPNLRI_FSPEC_FG_ISF) == 0) ? "" : "IsF",
4356
7.69k
             ((fragment_flags & BGPNLRI_FSPEC_FG_FF) == 0) ? "" : "FF",
4357
7.69k
             ((fragment_flags & BGPNLRI_FSPEC_FG_LF) == 0) ? "" : "LF");
4358
7.69k
        cursor_op_val = cursor_op_val + value_len;
4359
7.69k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4360
431
    proto_item_append_text(parent_item,")");
4361
431
    return (cursor_op_val);
4362
932
}
4363
4364
/*
4365
 * Decode an operator and DSCP value of BGP flow spec NLRI
4366
 */
4367
static int
4368
decode_bgp_nlri_op_dscp_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, unsigned offset)
4369
1.17k
{
4370
1.17k
    uint8_t nlri_operator;
4371
1.17k
    uint8_t dscp_flags;
4372
1.17k
    unsigned cursor_op_val=0;
4373
1.17k
    uint8_t value_len=0;
4374
1.17k
    uint8_t shift_amount=0;
4375
1.17k
    unsigned first_loop=0;
4376
4377
1.17k
    proto_item_append_text(parent_item," (");
4378
4379
10.1k
    do {
4380
10.1k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4381
10.1k
        shift_amount = nlri_operator&0x30;
4382
10.1k
        shift_amount = shift_amount >> 4;
4383
10.1k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4384
        /* call a function to decode operator addressing bitmask */
4385
10.1k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
4386
10.1k
        if (first_loop == 0)
4387
1.17k
        {
4388
            /* If first operator we remove a white space and or (||) is not relevant */
4389
1.17k
            proto_item_append_text(parent_item,"%s%s%s%s",
4390
1.17k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4391
1.17k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4392
1.17k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4393
1.17k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4394
1.17k
            first_loop = 1;
4395
1.17k
        }
4396
8.97k
        else
4397
8.97k
        {
4398
8.97k
            proto_item_append_text(parent_item," %s%s%s%s",
4399
8.97k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4400
8.97k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4401
8.97k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4402
8.97k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4403
8.97k
        }
4404
10.1k
        cursor_op_val++;  /* we manage this operator we move to the value */
4405
10.1k
        if (value_len != 1) {
4406
548
            return -1; /* frag flags have to be coded in 1 byte */
4407
548
        }
4408
9.59k
        dscp_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4409
9.59k
        proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dscp, tvb, offset+cursor_op_val, 1, ENC_BIG_ENDIAN);
4410
9.59k
        proto_item_append_text(parent_item,"%s",val_to_str_ext_const(dscp_flags,&dscp_vals_ext, "Unknown DSCP"));
4411
9.59k
        cursor_op_val = cursor_op_val + value_len;
4412
9.59k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4413
622
    proto_item_append_text(parent_item,")");
4414
622
    return (cursor_op_val);
4415
1.17k
}
4416
4417
4418
4419
/*
4420
 * Decode an FLOWSPEC nlri as define in RFC 5575
4421
 */
4422
static int
4423
decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, uint16_t afi, uint8_t safi, packet_info *pinfo)
4424
43.6k
{
4425
43.6k
    unsigned  tot_flow_len;       /* total length of the flow spec NLRI */
4426
43.6k
    unsigned  offset_len;         /* offset of the flow spec NLRI itself could be 1 or 2 bytes */
4427
43.6k
    unsigned  cursor_fspec;       /* cursor to move into flow spec nlri */
4428
43.6k
    int       filter_len = -1;
4429
43.6k
    uint16_t  len_16;
4430
43.6k
    uint32_t  rd_type;
4431
43.6k
    proto_item *item;
4432
43.6k
    proto_item *filter_item;
4433
43.6k
    proto_item *disting_item;
4434
43.6k
    proto_tree *nlri_tree;
4435
43.6k
    proto_tree *disting_tree;
4436
43.6k
    proto_tree *filter_tree;
4437
4438
4439
43.6k
    if (afi != AFNUM_IP && afi != AFNUM_IP6)
4440
0
    {
4441
0
        expert_add_info(pinfo, NULL, &ei_bgp_afi_type_not_supported);
4442
0
        return -1;
4443
0
    }
4444
4445
43.6k
    tot_flow_len = tvb_get_uint8(tvb, offset);
4446
    /* if nlri length is greater than 240 bytes, it is encoded over 2 bytes */
4447
    /* with most significant nibble all in one. 240 is encoded 0xf0f0, 241 0xf0f1 */
4448
    /* max possible value value is 4095 Oxffff */
4449
4450
43.6k
    if (tot_flow_len >= 240)
4451
279
    {
4452
279
        len_16 = tvb_get_ntohs(tvb, offset);
4453
279
        tot_flow_len = len_16 & 0x0FFF; /* remove most significant nibble */
4454
279
        offset_len = 2;
4455
43.3k
    } else {
4456
43.3k
        offset_len = 1;
4457
43.3k
    }
4458
4459
43.6k
    item = proto_tree_add_item(tree, hf_bgp_flowspec_nlri_t, tvb, offset,
4460
43.6k
                               tot_flow_len+offset_len, ENC_NA);
4461
43.6k
    proto_item_set_text(item, "FLOW_SPEC_NLRI (%u byte%s)",
4462
43.6k
                        tot_flow_len+offset_len, plurality(tot_flow_len+offset_len, "", "s"));
4463
4464
43.6k
    nlri_tree = proto_item_add_subtree(item, ett_bgp_flow_spec_nlri);
4465
4466
43.6k
    proto_tree_add_uint(nlri_tree, hf_bgp_flowspec_nlri_length, tvb, offset,
4467
43.6k
                        offset_len, tot_flow_len);
4468
4469
43.6k
    offset = offset + offset_len;
4470
43.6k
    cursor_fspec = 0;
4471
4472
    /* when SAFI is VPN Flow Spec, then write route distinguisher */
4473
43.6k
    if (safi == SAFNUM_FSPEC_VPN_RULE)
4474
33.0k
    {
4475
33.0k
        disting_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_route_distinguisher,
4476
33.0k
                                           tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4477
33.0k
        disting_tree = proto_item_add_subtree(disting_item, ett_bgp_flow_spec_nlri);
4478
33.0k
        proto_tree_add_item_ret_uint(disting_tree, hf_bgp_flowspec_nlri_route_distinguisher_type,
4479
33.0k
                                     tvb, offset, 2, ENC_BIG_ENDIAN, &rd_type);
4480
        /* Route Distinguisher Type */
4481
33.0k
        switch (rd_type) {
4482
1.19k
        case FORMAT_AS2_LOC:
4483
1.19k
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
4484
1.19k
                                tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4485
1.19k
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_4,
4486
1.19k
                                tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4487
1.19k
            break;
4488
4489
804
        case FORMAT_IP_LOC:
4490
804
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
4491
804
                                tvb, offset + 2, 4, ENC_BIG_ENDIAN);
4492
804
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
4493
804
                                tvb, offset + 6, 2, ENC_BIG_ENDIAN);
4494
804
            break;
4495
4496
368
        case FORMAT_AS4_LOC:
4497
368
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
4498
368
                                tvb, offset + 2, 4, ENC_BIG_ENDIAN);
4499
368
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
4500
368
                                tvb, offset + 6, 2, ENC_BIG_ENDIAN);
4501
368
            break;
4502
4503
30.7k
        default:
4504
30.7k
            expert_add_info_format(pinfo, disting_tree, &ei_bgp_length_invalid,
4505
30.7k
                                   "Unknown Route Distinguisher type (%u)", rd_type);
4506
33.0k
        }
4507
33.0k
        cursor_fspec += BGP_ROUTE_DISTINGUISHER_SIZE;
4508
33.0k
    }
4509
4510
49.0k
    while (cursor_fspec < tot_flow_len)
4511
13.1k
    {
4512
13.1k
        filter_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_filter, tvb, offset+cursor_fspec, 1, ENC_NA);
4513
13.1k
        filter_tree = proto_item_add_subtree(filter_item, ett_bgp_flow_spec_nlri_filter);
4514
13.1k
        proto_tree_add_item(filter_tree, hf_bgp_flowspec_nlri_filter_type, tvb, offset+cursor_fspec, 1, ENC_BIG_ENDIAN);
4515
13.1k
        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"));
4516
13.1k
        switch (tvb_get_uint8(tvb,offset+cursor_fspec)) {
4517
1.22k
        case BGPNLRI_FSPEC_DST_PFIX:
4518
1.22k
            cursor_fspec++;
4519
1.22k
            if (afi == AFNUM_IP)
4520
675
                filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_dst_pref_ipv4,
4521
675
                                            tvb, offset+cursor_fspec, "Destination IP filter");
4522
551
            else /* AFNUM_IP6 */
4523
551
                filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_dst_ipv6_pref,
4524
551
                                                        tvb, offset+cursor_fspec, 0, pinfo);
4525
1.22k
            if (filter_len == -1)
4526
278
                cursor_fspec= tot_flow_len;
4527
1.22k
            break;
4528
1.02k
        case BGPNLRI_FSPEC_SRC_PFIX:
4529
1.02k
            cursor_fspec++;
4530
1.02k
            if (afi == AFNUM_IP)
4531
378
                filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_src_pref_ipv4,
4532
378
                                            tvb, offset+cursor_fspec, "Source IP filter");
4533
649
            else /* AFNUM_IP6 */
4534
649
                filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_src_ipv6_pref,
4535
649
                                                        tvb, offset+cursor_fspec, 0, pinfo);
4536
1.02k
            if (filter_len == -1)
4537
430
              cursor_fspec= tot_flow_len;
4538
1.02k
            break;
4539
303
        case BGPNLRI_FSPEC_IP_PROTO:
4540
303
            cursor_fspec++;
4541
303
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4542
303
            break;
4543
324
        case BGPNLRI_FSPEC_PORT:
4544
324
            cursor_fspec++;
4545
324
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4546
324
            break;
4547
263
        case BGPNLRI_FSPEC_DST_PORT:
4548
263
            cursor_fspec++;
4549
263
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4550
263
            break;
4551
3.61k
        case BGPNLRI_FSPEC_SRC_PORT:
4552
3.61k
            cursor_fspec++;
4553
3.61k
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4554
3.61k
            break;
4555
370
        case BGPNLRI_FSPEC_ICMP_TP:
4556
370
            cursor_fspec++;
4557
370
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4558
370
            break;
4559
240
        case BGPNLRI_FSPEC_ICMP_CD:
4560
240
            cursor_fspec++;
4561
240
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4562
240
            break;
4563
1.73k
        case BGPNLRI_FSPEC_TCP_FLAGS:
4564
1.73k
            cursor_fspec++;
4565
1.73k
            filter_len = decode_bgp_nlri_op_tcpf_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4566
1.73k
            break;
4567
273
        case BGPNLRI_FSPEC_PCK_LEN:
4568
273
            cursor_fspec++;
4569
273
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4570
273
            break;
4571
1.17k
        case BGPNLRI_FSPEC_DSCP:
4572
1.17k
            cursor_fspec++;
4573
1.17k
            filter_len = decode_bgp_nlri_op_dscp_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4574
1.17k
            break;
4575
932
        case BGPNLRI_FSPEC_FRAGMENT:
4576
932
            cursor_fspec++;
4577
932
            filter_len = decode_bgp_nlri_op_fflag_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4578
932
            break;
4579
1.68k
        default:
4580
1.68k
            return -1;
4581
13.1k
      }
4582
11.3k
      if (filter_len>0)
4583
5.41k
          cursor_fspec += filter_len;
4584
5.93k
      else
4585
5.93k
          break;
4586
5.41k
      proto_item_set_len(filter_item,filter_len+1);
4587
5.41k
    }
4588
41.8k
    return tot_flow_len+offset_len-1;
4589
43.6k
}
4590
4591
/*
4592
 * Decode an MCAST-VPN nlri as defined in draft-ietf-l3vpn-2547bis-mcast-bgp-08.txt .
4593
 */
4594
static int
4595
decode_mcast_vpn_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, uint16_t afi, packet_info *pinfo)
4596
10.3k
{
4597
10.3k
    uint8_t route_type, length, ip_length;
4598
10.3k
    proto_item *item;
4599
10.3k
    proto_tree *nlri_tree;
4600
10.3k
    uint32_t route_key_length;
4601
10.3k
    int ret;
4602
4603
10.3k
    ip_length = (afi == AFNUM_IP) ? 4 : 16;
4604
4605
10.3k
    route_type = tvb_get_uint8(tvb, offset);
4606
10.3k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_route_type, tvb,
4607
10.3k
                               offset, 1, ENC_BIG_ENDIAN);
4608
10.3k
    offset++;
4609
4610
10.3k
    length = tvb_get_uint8(tvb, offset);
4611
10.3k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_length, tvb, offset,
4612
10.3k
                               1, ENC_BIG_ENDIAN);
4613
10.3k
    offset++;
4614
4615
10.3k
    if (length > tvb_reported_length_remaining(tvb, offset))
4616
171
        return -1;
4617
4618
    // XXX - Should call tvb_new_subset_length(tvb, offset, length) here
4619
4620
10.1k
    item = proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_t, tvb, offset,
4621
10.1k
                               length, ENC_NA);
4622
10.1k
    proto_item_set_text(item, "%s (%u byte%s)",
4623
10.1k
                        val_to_str_const(route_type, mcast_vpn_route_type, "Unknown"),
4624
10.1k
                        length, plurality(length, "", "s"));
4625
4626
10.1k
    nlri_tree = proto_item_add_subtree(item, ett_bgp_mcast_vpn_nlri);
4627
4628
10.1k
    switch (route_type) {
4629
1.31k
        case MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD:
4630
1.31k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4631
1.31k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4632
1.31k
                                       ENC_NA);
4633
1.31k
            proto_item_set_text(item, "Route Distinguisher: %s",
4634
1.31k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4635
1.31k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4636
4637
1.31k
            if (afi == AFNUM_IP)
4638
838
                proto_tree_add_item(nlri_tree,
4639
838
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4640
838
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4641
481
            else
4642
481
                proto_tree_add_item(nlri_tree,
4643
481
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4644
481
                                           tvb, offset, ip_length, ENC_NA);
4645
1.31k
            break;
4646
4647
1.14k
        case MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD:
4648
1.14k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4649
1.14k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4650
1.14k
                                       ENC_NA);
4651
1.14k
            proto_item_set_text(item, "Route Distinguisher: %s",
4652
1.14k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4653
1.14k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4654
4655
1.14k
            proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
4656
1.14k
                                offset, 4, ENC_BIG_ENDIAN);
4657
1.14k
            break;
4658
4659
1.20k
        case MCAST_VPN_RTYPE_SPMSI_AD:
4660
1.20k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4661
1.20k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4662
1.20k
                                       ENC_NA);
4663
1.20k
            proto_item_set_text(item, "Route Distinguisher: %s",
4664
1.20k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4665
1.20k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4666
4667
1.20k
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4668
1.20k
            if (ret < 0)
4669
196
                return -1;
4670
4671
1.01k
            offset = ret;
4672
4673
1.01k
            if (afi == AFNUM_IP)
4674
589
                proto_tree_add_item(nlri_tree,
4675
589
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4676
589
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4677
422
            else
4678
422
                proto_tree_add_item(nlri_tree,
4679
422
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4680
422
                                           tvb, offset, ip_length, ENC_NA);
4681
1.01k
            break;
4682
4683
426
        case MCAST_VPN_RTYPE_LEAF_AD:
4684
426
            if (ckd_sub(&route_key_length, length, ip_length)) {
4685
34
                THROW(ReportedBoundsError);
4686
34
            }
4687
426
            item = proto_tree_add_item(nlri_tree,
4688
426
                                       hf_bgp_mcast_vpn_nlri_route_key, tvb,
4689
426
                                       offset, route_key_length, ENC_NA);
4690
426
            proto_item_set_text(item, "Route Key (%u byte%s)", route_key_length,
4691
426
                                plurality(route_key_length, "", "s"));
4692
426
            offset += route_key_length;
4693
4694
426
            if (afi == AFNUM_IP)
4695
198
                proto_tree_add_item(nlri_tree,
4696
198
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4697
198
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4698
228
            else
4699
228
                proto_tree_add_item(nlri_tree,
4700
228
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4701
228
                                           tvb, offset, ip_length, ENC_NA);
4702
426
            break;
4703
4704
827
        case MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD:
4705
827
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4706
827
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4707
827
                                       ENC_NA);
4708
827
            proto_item_set_text(item, "Route Distinguisher: %s",
4709
827
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4710
827
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4711
4712
827
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4713
827
            if (ret < 0)
4714
383
                return -1;
4715
444
            break;
4716
4717
548
        case MCAST_VPN_RTYPE_SHARED_TREE_JOIN:
4718
1.47k
        case MCAST_VPN_RTYPE_SOURCE_TREE_JOIN:
4719
1.47k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4720
1.47k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4721
1.47k
                                       ENC_NA);
4722
1.47k
            proto_item_set_text(item, "Route Distinguisher: %s",
4723
1.47k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4724
1.47k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4725
4726
1.47k
            proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
4727
1.47k
                                offset, 4, ENC_BIG_ENDIAN);
4728
1.47k
            offset += 4;
4729
4730
1.47k
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4731
1.47k
            if (ret < 0)
4732
207
                return -1;
4733
1.26k
            break;
4734
10.1k
    }
4735
4736
    /* route type field (1 byte) + length field (1 byte) + length */
4737
9.23k
    return 2 + length;
4738
10.1k
}
4739
4740
/*
4741
 * Decode an SR Policy SAFI as defined in draft-ietf-idr-segment-routing-te-policy-08
4742
 */
4743
static int
4744
decode_sr_policy_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, uint16_t afi)
4745
266
{
4746
266
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_length, tvb, offset, 1, ENC_BIG_ENDIAN);
4747
266
   offset += 1;
4748
266
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_distinguisher, tvb, offset, 4, ENC_BIG_ENDIAN);
4749
266
   offset += 4;
4750
266
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_policy_color, tvb, offset, 4, ENC_BIG_ENDIAN);
4751
266
   offset += 4;
4752
266
   if (afi == AFNUM_IP) {
4753
125
       proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
4754
125
       return 13;
4755
141
   } else {
4756
141
       proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v6, tvb, offset, 16, ENC_NA);
4757
141
       return 25;
4758
141
   }
4759
266
}
4760
4761
/*
4762
 * Decodes an MDT-SAFI message.
4763
 */
4764
static unsigned
4765
decode_mdt_safi(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, unsigned offset)
4766
658
{
4767
658
    const unsigned ip_length = 4;
4768
658
    const unsigned mdt_safi_nlri_length_bits = 128;
4769
658
    unsigned length; /* length in bits */
4770
658
    int   orig_offset = offset;
4771
658
    proto_item *item;
4772
4773
658
    length = tvb_get_uint8(tvb, offset);
4774
658
    if (length != mdt_safi_nlri_length_bits)
4775
296
        return -1;
4776
362
    offset++;
4777
4778
362
    item = proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_rd, tvb,
4779
362
                               offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4780
362
    proto_item_set_text(item, "Route Distinguisher: %s",
4781
362
                        decode_bgp_rd(pinfo->pool, tvb, offset));
4782
362
    offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4783
4784
362
    proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_ipv4_addr, tvb,
4785
362
                        offset, ip_length, ENC_BIG_ENDIAN);
4786
362
    offset += ip_length;
4787
4788
362
    proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_group_addr, tvb,
4789
362
                        offset, ip_length, ENC_BIG_ENDIAN);
4790
362
    offset += ip_length;
4791
4792
362
    return offset - orig_offset;
4793
658
}
4794
4795
/*
4796
 * Decode an MPLS label stack
4797
 * XXX - We should change *buf to **buf, use wmem_alloc() and drop the buflen
4798
 * argument.
4799
 */
4800
static unsigned
4801
decode_MPLS_stack(tvbuff_t *tvb, unsigned offset, wmem_strbuf_t *stack_strbuf)
4802
8.07k
{
4803
8.07k
    uint32_t    label_entry;    /* an MPLS label entry (label + COS field + stack bit   */
4804
8.07k
    unsigned    indx;          /* index for the label stack */
4805
4806
8.07k
    indx = offset ;
4807
8.07k
    label_entry = 0x000000 ;
4808
4809
8.07k
    wmem_strbuf_truncate(stack_strbuf, 0);
4810
4811
45.4k
    while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4812
4813
38.3k
        label_entry = tvb_get_ntoh24(tvb, indx) ;
4814
4815
        /* withdrawn routes may contain 0 or 0x800000 in the first label */
4816
38.3k
        if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4817
1.06k
            wmem_strbuf_append(stack_strbuf, "0 (withdrawn)");
4818
1.06k
            return 1;
4819
1.06k
        }
4820
4821
37.3k
        wmem_strbuf_append_printf(stack_strbuf, "%u%s", label_entry >> 4,
4822
37.3k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4823
4824
37.3k
        indx += 3 ;
4825
37.3k
    }
4826
4827
7.01k
    return (indx - offset) / 3;
4828
8.07k
}
4829
4830
static unsigned
4831
decode_MPLS_stack_tree(tvbuff_t *tvb, unsigned offset, proto_tree *parent_tree)
4832
1.80k
{
4833
1.80k
    uint32_t    label_entry=0;    /* an MPLS label entry (label + COS field + stack bit)   */
4834
1.80k
    unsigned    indx;          /* index for the label stack */
4835
1.80k
    proto_tree  *labels_tree=NULL;
4836
1.80k
    proto_item  *labels_item=NULL;
4837
1.80k
    proto_item  *label_item=NULL;
4838
1.80k
    indx = offset ;
4839
1.80k
    label_entry = 0x000000 ;
4840
4841
1.80k
    labels_item = proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label, tvb, offset, 3, ENC_NA);
4842
1.80k
    proto_item_append_text(labels_item, ": ");
4843
1.80k
    labels_tree = proto_item_add_subtree(labels_item, ett_bgp_mpls_labels);
4844
2.21k
    while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4845
4846
1.76k
        label_entry = tvb_get_ntoh24(tvb, indx);
4847
1.76k
        label_item = proto_tree_add_item(labels_tree, hf_bgp_update_mpls_label_value, tvb, indx, 3, ENC_BIG_ENDIAN);
4848
        /* withdrawn routes may contain 0 or 0x800000 in the first label */
4849
1.76k
        if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4850
299
            proto_item_append_text(labels_item, " (withdrawn)");
4851
299
            proto_item_append_text(label_item, " (withdrawn)");
4852
299
            return 1;
4853
299
        }
4854
4855
1.46k
        proto_item_append_text(labels_item, "%u%s", label_entry >> 4,
4856
1.46k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4857
1.46k
        proto_item_append_text(label_item, "%u%s", label_entry >> 4,
4858
1.46k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4859
1.46k
        indx += 3 ;
4860
4861
1.46k
        if ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4862
            /* real MPLS multi-label stack in BGP? - maybe later; for now, it must be a bogus packet */
4863
1.05k
            proto_item_append_text(labels_item, " (BOGUS: Bottom of Stack NOT set!)");
4864
1.05k
            break;
4865
1.05k
        }
4866
1.46k
    }
4867
1.50k
    proto_item_set_len(labels_item, (indx - offset));
4868
1.50k
    return (indx - offset) / 3;
4869
1.80k
}
4870
4871
/*
4872
 * Decode a multiprotocol next hop address that expected to be IPv4.
4873
 * Returns 0 on failure (invalid length).
4874
 */
4875
static int
4876
decode_mp_next_hop_ipv4(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo _U_, wmem_strbuf_t *strbuf, int nhlen)
4877
3.64k
{
4878
3.64k
    switch (nhlen) {
4879
685
        case (FT_IPv4_LEN):
4880
685
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4881
685
            wmem_strbuf_append(strbuf, tvb_ip_to_str(pinfo->pool, tvb, offset));
4882
685
            break;
4883
2.96k
        default:
4884
2.96k
            return 0;
4885
3.64k
    }
4886
685
    return nhlen;
4887
3.64k
}
4888
4889
/*
4890
 * Decode a multiprotocol next hop address expected to be VPN-IPv4.
4891
 * Note that the Route Distinguisher is always 0. Returns 0 on failure
4892
 * (invalid length).
4893
 */
4894
static int
4895
decode_mp_next_hop_vpn_ipv4(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4896
1.75k
{
4897
1.75k
    proto_item    *ti;
4898
1.75k
    const char    *rd_string;
4899
4900
1.75k
    switch (nhlen) {
4901
271
        case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv4_LEN):
4902
271
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4903
271
            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);
4904
271
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4905
205
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4906
205
            }
4907
271
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4908
271
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4909
271
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4910
271
            wmem_strbuf_append_printf(strbuf, " IPv4=%s", tvb_ip_to_str(pinfo->pool, tvb, offset));
4911
271
            break;
4912
1.48k
        default:
4913
1.48k
            return 0;
4914
1.75k
    }
4915
271
    return nhlen;
4916
1.75k
}
4917
4918
/*
4919
 * Decode a multiprotocol next hop address that is expected to be IPv6,
4920
 * optionally including a second, link-local, address, differentiating by
4921
 * length. Returns 0 on failure (invalid length).
4922
 */
4923
static int
4924
decode_mp_next_hop_ipv6(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4925
7.69k
{
4926
7.69k
    proto_item    *ti;
4927
7.69k
    ws_in6_addr    ipv6_addr;
4928
7.69k
    char           ipv6_buffer[WS_INET6_ADDRSTRLEN];
4929
4930
7.69k
    switch (nhlen) {
4931
221
        case (FT_IPv6_LEN):
4932
221
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4933
221
            wmem_strbuf_append(strbuf, tvb_ip6_to_str(pinfo->pool, tvb, offset));
4934
221
            break;
4935
212
        case (2*FT_IPv6_LEN):
4936
            /* global address followed by link-local */
4937
212
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4938
212
            wmem_strbuf_append_printf(strbuf, "IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4939
212
            offset += FT_IPv6_LEN;
4940
212
            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);
4941
212
            tvb_get_ipv6(tvb, offset, &ipv6_addr);
4942
212
            if (!in6_addr_is_linklocal(&ipv6_addr)) {
4943
141
                expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4944
141
            }
4945
212
            ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4946
212
            wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4947
212
            break;
4948
7.26k
        default:
4949
7.26k
            return 0;
4950
7.69k
    }
4951
433
    return nhlen;
4952
7.69k
}
4953
4954
/*
4955
 * Decode a multiprotocol next hop address that is expected to be VPN-IPv6,
4956
 * optionally including a second, link-local, address. Note that the Route
4957
 * Distinguisher is always 0. Returns 0 on failure (invalid length).
4958
 */
4959
static int
4960
decode_mp_next_hop_vpn_ipv6(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4961
2.17k
{
4962
2.17k
    proto_item    *ti;
4963
2.17k
    const char    *rd_string;
4964
2.17k
    ws_in6_addr    ipv6_addr;
4965
2.17k
    char           ipv6_buffer[WS_INET6_ADDRSTRLEN];
4966
4967
2.17k
    switch (nhlen) {
4968
263
        case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN):
4969
263
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4970
263
            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);
4971
263
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4972
197
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4973
197
            }
4974
263
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4975
263
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4976
263
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4977
263
            wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4978
263
            break;
4979
390
        case (2*(BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN)):
4980
390
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4981
390
            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);
4982
390
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4983
307
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4984
307
            }
4985
390
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4986
390
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4987
390
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4988
390
            wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4989
390
            offset += FT_IPv6_LEN;
4990
390
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4991
390
            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);
4992
390
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4993
322
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4994
322
            }
4995
390
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4996
390
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4997
390
            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);
4998
390
            tvb_get_ipv6(tvb, offset, &ipv6_addr);
4999
390
            if (!in6_addr_is_linklocal(&ipv6_addr)) {
5000
320
                expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
5001
320
            }
5002
390
            ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
5003
390
            wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
5004
390
            break;
5005
1.52k
        default:
5006
1.52k
            return 0;
5007
2.17k
    }
5008
653
    return nhlen;
5009
2.17k
}
5010
5011
/*
5012
 * Decode a multiprotocol next hop address
5013
 */
5014
static int
5015
decode_mp_next_hop(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint16_t afi, uint8_t safi, int nhlen)
5016
15.2k
{
5017
15.2k
    proto_item    *ti;
5018
15.2k
    proto_tree    *next_hop_t;
5019
15.2k
    int            length, offset = 0;
5020
15.2k
    wmem_strbuf_t *strbuf;
5021
5022
15.2k
    strbuf = wmem_strbuf_create(pinfo->pool);
5023
5024
    /* BGP Multiprotocol Next Hop Principles
5025
     *
5026
     * BGP Multiprotocol support is specified over a large variety of
5027
     * RFCs for different <AFI, SAFI> pairs, which leaves some theoretical
5028
     * pairings undefined (e.g., the Abstract of RFC 4760 contemplates
5029
     * supporting the IPX address family) as well as leading to some
5030
     * omissions, contradictions, and inconsistencies. However, some general
5031
     * principles that apply across (nearly) all extant pairs exist.
5032
     *
5033
     * 1. Global IPv6 addresses can be followed by a link-local IPv6 address
5034
     *
5035
     * RFC 2545 specifies in section 3, "Constructing the Next Hop field,"
5036
     * that when the next hop address type is IPv6, the address given should
5037
     * be in global (or site-local) unicast address scope, and it shall be
5038
     * followed by the link-local address if and only if the BGP speaker shares
5039
     * a common subnet with the address and the peer the route is being
5040
     * advertised to.
5041
     *
5042
     * The wording implies that this holds for any <AFI, SAFI> pair where
5043
     * a IPv6 address is used, and RFCs 5549, 7752, and 8950 demonstrate that
5044
     * this explicitly holds for the most common ones, including for VPN-IPv6
5045
     * addresses (where the route distinguisher field also appears, see
5046
     * RFC 4659). Sometimes the possibility is elided where it is known to
5047
     * exist e.g. RFC 7606 7.11 MP_REACH_NLRI "For example, if RFC5549 is in
5048
     * use, then the next hop would have to have a length of 4 or 16." Thus
5049
     * it is possible that its omission in other RFCs covering new <AFI, SAFI>
5050
     * pairs is an oversight.
5051
     *
5052
     * 2. [VPN-]IPv4 NLRI can have [VPN-]IPv6 Next Hop addresses
5053
     *
5054
     * RFCs 5549 and 8950 declare that the next hop address may not necessarily
5055
     * belong to the address family specified by the AFI, updating RFC 2858,
5056
     * specifically addressing the case of IPv6 islands across a IPv4 core
5057
     * and vice versa.
5058
     *
5059
     * IPv4 addresses can easily be mapped into IPv6 addresses, and that
5060
     * is the solution for one case, but in the other the Next Hop must be an
5061
     * IPv6 (or VPN-IPv6) address even though the NLRI is IPv4.
5062
     *
5063
     * The wording of RFC 8950 strongly implies that the intent is to allow
5064
     * IPv6 Net Hop addresses for any case of IPv4 or VPN-IPv4 NLRI, providing
5065
     * a BGP Capability to declare that the BGP speakers supports a different
5066
     * Next Hop AFI for <AFI, SAFI> pairs defined without this capability,
5067
     * and noting those (like <1, 132>, SAFNUM_ROUTE_TARGET, RFC 4684) that
5068
     * consider the possibility from the start.
5069
     *
5070
     * 3. Next Hop Route Distinguisher (RD) is 0 or omitted
5071
     *
5072
     * RDs do not have a meaning in the Next Hop network address. However, when
5073
     * RFC 2547 introduced the VPN-IPv4 address family, at that point the Next
5074
     * Hop address family had to be the same as the NLRI address family, so the
5075
     * RD was set to all 0. Later defined <AFI, SAFI> pairs with RDs in their
5076
     * NLRI have either used this custom of a 0 RD, or else omitted it and
5077
     * only had the IP address in the Next Hop.
5078
     */
5079
5080
15.2k
    ti = proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop, tvb, offset, nhlen + 1, ENC_NA);
5081
15.2k
    next_hop_t = proto_item_add_subtree(ti, ett_bgp_mp_nhna);
5082
15.2k
    offset += 1;
5083
5084
15.2k
    switch (afi) {
5085
5.92k
        case AFNUM_IP:
5086
5.92k
            switch (safi) {
5087
267
                case SAFNUM_UNICAST:       /* RFC 8950 */
5088
568
                case SAFNUM_MULCAST:       /* RFC 8950 */
5089
826
                case SAFNUM_UNIMULC:       /* Deprecated, but as above */
5090
1.33k
                case SAFNUM_MPLS_LABEL:    /* RFC 8277 */
5091
1.63k
                case SAFNUM_MCAST_VPN:     /* RFC 6514 */
5092
1.93k
                case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used"
5093
                                            * according to
5094
                                            * draft-ietf-idr-tunnel-encaps-22
5095
                                            */
5096
2.21k
                case SAFNUM_ROUTE_TARGET:  /* RFC 4684 */
5097
2.53k
                case SAFNUM_BGP_MUP:       /* draft-ietf-bess-mup-safi-01 */
5098
2.59k
                case SAFNUM_SR_POLICY:     /* RFC 9830 */
5099
                    /* IPv4 or IPv6, differentiated by field length, according
5100
                     * to the RFCs cited above. RFC 8950 explicitly addresses
5101
                     * the possible link-local IPv6 address. RFC 6514 depending
5102
                     * on the situation either the Next Hop MUST be the same
5103
                     * as in the IP Address field lower in the network stack,
5104
                     * or simply SHOULD be "a routeable address" of the ASBR/
5105
                     * local PE. */
5106
2.59k
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5107
2.17k
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5108
2.17k
                    }
5109
2.59k
                    break;
5110
290
                case SAFNUM_TUNNEL:
5111
                    /* Internet Draft draft-nalawade-kapoor-tunnel-safi-05
5112
                     * long expired, but "[NLRI] network address... SHOULD be
5113
                     * the same as the [Next Hop] network address."
5114
                     */
5115
290
                    length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5116
290
                    break;
5117
494
                case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
5118
675
                case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
5119
939
                case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
5120
                    /* RFC 8950 indicates that the next hop can be VPN-IPv4 or
5121
                     * VPN-IPv6 (with RD all 0), and in the latter case the
5122
                     * link-local IPv6 address can be included. Note that RFC
5123
                     * 5549 incorrectly did not include the RD in the Next Hop
5124
                     * for VPN-IPv6 (see Erratum ID 5253), but according to
5125
                     * RFC 8950 2. "Changes Compared to RFC 5549":
5126
                     * "As all known and deployed implementations are
5127
                     * interoperable today and use the new proposed encoding,
5128
                     * the change does not break existing interoperability,"
5129
                     * and thus we need not test for a missing RD.
5130
                     */
5131
939
                    if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5132
741
                        length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5133
741
                    }
5134
939
                    break;
5135
640
                case SAFNUM_FSPEC_RULE:
5136
1.13k
                case SAFNUM_FSPEC_VPN_RULE:
5137
1.13k
                    length = 0;
5138
                    /* When advertising Flow Specifications, the Length of the
5139
                     * Next-Hop Address MUST be set 0. The Network Address of
5140
                     * the Next-Hop field MUST be ignored.
5141
                     */
5142
1.13k
                    if (nhlen != 0) {
5143
952
                        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid,
5144
952
                                               "The length (%d) of Next Hop (FlowSpec) is not zero", nhlen);
5145
952
                        break;
5146
952
                    }
5147
186
                    length++;
5148
186
                    break;
5149
957
                default:
5150
957
                    length = 0;
5151
957
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5152
957
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5153
957
                    break;
5154
5.92k
            } /* switch (safi) */
5155
5.92k
            break;
5156
6.79k
        case AFNUM_IP6:
5157
6.79k
            switch (safi) {
5158
213
                case SAFNUM_UNICAST:       /* RFC 8950 */
5159
443
                case SAFNUM_MULCAST:       /* RFC 8950 */
5160
596
                case SAFNUM_UNIMULC:       /* Deprecated, but as above */
5161
1.03k
                case SAFNUM_MPLS_LABEL:    /* RFC 8277 */
5162
1.44k
                case SAFNUM_MCAST_VPN:     /* RFC 6514 */
5163
1.65k
                case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used" */
5164
1.91k
                case SAFNUM_TUNNEL:        /* Expired Internet Draft */
5165
4.95k
                case SAFNUM_BGP_MUP:       /* draft-ietf-bess-mup-safi-01 */
5166
                    /* IPv6 address, possibly followed by link-local address */
5167
4.95k
                    length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5168
4.95k
                    break;
5169
135
                case SAFNUM_SR_POLICY:     /* RFC 9830 */
5170
                    /* IPv4 address or IPv6 address (optionally with link-local) */
5171
135
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5172
68
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5173
68
                    }
5174
135
                    break;
5175
268
                case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
5176
556
                case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
5177
697
                case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
5178
                    /* VPN-IPv6 address, possibly followed by link-local addr */
5179
697
                    length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5180
697
                    break;
5181
339
                case SAFNUM_FSPEC_RULE:
5182
612
                case SAFNUM_FSPEC_VPN_RULE:
5183
612
                    length = 0;
5184
                    /* When advertising Flow Specifications, the Length of the
5185
                     * Next-Hop Address MUST be set 0. The Network Address of
5186
                     * the Next-Hop field MUST be ignored.
5187
                     */
5188
612
                    if (nhlen != 0) {
5189
394
                        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid,
5190
394
                                               "The length (%d) of Next Hop (FlowSpec) is not zero", nhlen);
5191
394
                        break;
5192
394
                    }
5193
218
                    length++;
5194
218
                    break;
5195
396
                default:
5196
396
                    length = 0;
5197
396
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5198
396
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5199
396
                    break;
5200
6.79k
            } /* switch (safi) */
5201
6.79k
            break;
5202
6.79k
        case AFNUM_AFI_FOR_L2VPN_INFORMATION:
5203
852
        case AFNUM_AFI_FOR_L2VPN_INFORMATION_OLD:
5204
852
            switch (safi) {
5205
                /* XXX: Do these first three really appear with L2VPN AFI? */
5206
72
                case SAFNUM_LAB_VPNUNICAST:
5207
193
                case SAFNUM_LAB_VPNMULCAST:
5208
298
                case SAFNUM_LAB_VPNUNIMULC:
5209
372
                case SAFNUM_VPLS: /* RFC 4761 (VPLS) and RFC 6074 (BGP-AD) */
5210
482
                case SAFNUM_EVPN: /* RFC 7432 */
5211
                    /* The RFCs above specify that the next-hop is simply the
5212
                     * address of the PE (loopback address in some cases for
5213
                     * BGP-AD), either IPv4 or IPv6, differentiated by length.
5214
                     * A RD is included in the NLRI in these cases, but not in
5215
                     * the Next Hop address unlike in AFI 1 or 2.
5216
                     */
5217
482
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5218
414
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5219
414
                    }
5220
482
                    break;
5221
370
                default:
5222
370
                    length = 0;
5223
370
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5224
370
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5225
370
                    break;
5226
852
            } /* switch (safi) */
5227
852
            break;
5228
1.16k
        case AFNUM_BGP_LS:
5229
            /* RFC 7752 section 3.4 "BGP Next-Hop Information" explains that
5230
             * the next-hop address length field specifies the next-hop address
5231
             * family. "If the next-hop length is 4, then the next hop is an
5232
             * IPv4 address; if the next-hop length is 16, then it is a global
5233
             * IPv6 address; and if the next-hop length is 32, then there is
5234
             * one global IPv6 address followed by a link-local IPv6 address"
5235
             */
5236
1.16k
            switch (safi) {
5237
145
                case SAFNUM_BGP_LS:
5238
145
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5239
79
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5240
79
                    }
5241
145
                    break;
5242
812
                case SAFNUM_BGP_LS_VPN:
5243
                    /* RFC 7752 3.4: "For VPN SAFI, as per custom, an 8-byte
5244
                     * Route Distinguisher set to all zero is prepended to the
5245
                     * next hop."
5246
                     */
5247
812
                    if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5248
739
                        length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5249
739
                    }
5250
812
                    break;
5251
210
                default:
5252
210
                    length = 0;
5253
210
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5254
210
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5255
210
                    break;
5256
1.16k
            } /* switch (safi) */
5257
1.16k
            break;
5258
1.16k
        default:
5259
420
            length = 0;
5260
420
            expert_add_info(pinfo, ti, &ei_bgp_unknown_afi);
5261
420
            break;
5262
15.2k
    } /* switch (af) */
5263
5264
15.1k
    if (length) {
5265
2.44k
        proto_item_append_text(ti, ": %s", wmem_strbuf_get_str(strbuf));
5266
12.7k
    } else {
5267
12.7k
        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid, "Unknown Next Hop length (%u byte%s)", nhlen, plurality(nhlen, "", "s"));
5268
12.7k
        if (nhlen > 0) {
5269
7.01k
            proto_item_append_text(ti, ": %s", tvb_bytes_to_str(pinfo->pool, tvb, offset, nhlen));
5270
7.01k
        }
5271
12.7k
    }
5272
5273
15.1k
    return length;
5274
15.2k
}
5275
5276
static int decode_bgp_link_node_descriptor(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, int length)
5277
1.95k
{
5278
1.95k
    uint16_t sub_length;
5279
1.95k
    uint16_t type;
5280
1.95k
    uint16_t diss_length;
5281
5282
1.95k
    proto_item* tlv_item;
5283
1.95k
    proto_tree* tlv_tree;
5284
5285
1.95k
    diss_length = 0;
5286
5287
4.70k
    while (length > 0 ) {
5288
3.15k
    if (length < 4) {
5289
314
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5290
314
            "Unknown data in Link-State Link NLRI!");
5291
314
        diss_length += length;
5292
314
        break;
5293
314
    }
5294
2.83k
    type = tvb_get_ntohs(tvb, offset);
5295
2.83k
    sub_length = tvb_get_ntohs(tvb, offset + 2);
5296
5297
2.83k
    switch (type) {
5298
496
        case BGP_NLRI_TLV_AUTONOMOUS_SYSTEM:
5299
496
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_autonomous_system, tvb, offset, sub_length+4, ENC_NA);
5300
496
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5301
496
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5302
496
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5303
496
              if (sub_length != BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM) {
5304
276
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5305
276
                                         "Autonomous system TLV length should be %u bytes! (%u)",
5306
276
                                         BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM, sub_length);
5307
276
                  break;
5308
276
              }
5309
220
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_autonomous_system_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5310
220
          break;
5311
361
          case BGP_NLRI_TLV_BGP_LS_IDENTIFIER:
5312
361
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_ls_identifier, tvb, offset, sub_length+4, ENC_NA);
5313
361
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5314
361
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5315
361
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5316
361
              if (sub_length != BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER) {
5317
250
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5318
250
                                         "BGP-LS TLV length should be %u bytes! (%u)",
5319
250
                                         BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER, sub_length);
5320
250
                  break;
5321
250
              }
5322
111
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_ls_identifier_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5323
111
          break;
5324
281
          case BGP_NLRI_TLV_AREA_ID:
5325
281
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_area_id, tvb, offset, sub_length+4, ENC_NA);
5326
281
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5327
281
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5328
281
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5329
281
              if (sub_length != BGP_NLRI_TLV_LEN_AREA_ID) {
5330
215
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5331
215
                                         "Area ID TLV length should be %u bytes! (%u)",
5332
215
                                         BGP_NLRI_TLV_LEN_AREA_ID, sub_length);
5333
215
                  break;
5334
215
              }
5335
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_area_id_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5336
66
          break;
5337
200
          case BGP_NLRI_TLV_IGP_ROUTER_ID:
5338
200
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_router, tvb, offset, sub_length+4, ENC_NA);
5339
200
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5340
200
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5341
200
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5342
200
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_router_id, tvb, offset + 4, sub_length, ENC_NA);
5343
200
          break;
5344
214
          case BGP_NLRI_TLV_BGP_ROUTER_ID:
5345
214
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_router_id, tvb, offset, sub_length+4, ENC_NA);
5346
214
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5347
214
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5348
214
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5349
214
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_router_id_id, tvb, offset + 4, sub_length, ENC_BIG_ENDIAN);
5350
214
          break;
5351
217
          case BGP_NLRI_TLV_BGP_CONFEDERATION_MEMBER:
5352
217
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_confederation_member, tvb, offset, sub_length+4, ENC_NA);
5353
217
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5354
217
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5355
217
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5356
217
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_confederation_member_as, tvb, offset + 4, sub_length, ENC_BIG_ENDIAN);
5357
217
          break;
5358
1.01k
          default:
5359
1.01k
              expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn, "Undefined node Descriptor Sub-TLV type (%u)!", type);
5360
2.83k
    }
5361
5362
2.75k
    length -= 4 + sub_length;
5363
2.75k
    offset += 4 + sub_length;
5364
2.75k
    diss_length += 4 + sub_length;
5365
2.75k
    }
5366
1.86k
    return diss_length;
5367
1.95k
}
5368
5369
5370
/*
5371
 * Decode BGP Link State Local and Remote NODE Descriptors
5372
 */
5373
static int decode_bgp_link_node_nlri_tlvs(tvbuff_t *tvb, proto_tree *tree, unsigned offset, packet_info *pinfo, uint16_t expected_sub_tlv)
5374
9.73k
{
5375
9.73k
    uint16_t length;
5376
9.73k
    uint16_t type;
5377
9.73k
    proto_tree* tlv_tree;
5378
9.73k
    proto_item* tlv_item;
5379
5380
9.73k
    type = tvb_get_ntohs(tvb, offset);
5381
9.73k
    length = tvb_get_ntohs(tvb, offset + 2);
5382
5383
9.73k
    if (expected_sub_tlv != type) {
5384
8.38k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error, "Expected/actual tlv mismatch, expected: %u, actual: %u", expected_sub_tlv, type);
5385
8.38k
    }
5386
5387
9.73k
    switch(type){
5388
5389
        /*local and remote node descriptors */
5390
1.35k
        case BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS:
5391
1.35k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_local_node_descriptors, tvb, offset, length+4, ENC_NA);
5392
1.35k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5393
1.35k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5394
1.35k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5395
1.35k
            decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
5396
1.35k
        break;
5397
5398
598
        case BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS:
5399
598
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_remote_node_descriptors, tvb, offset, length+4, ENC_NA);
5400
598
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5401
598
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5402
598
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5403
598
            decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
5404
598
        break;
5405
9.73k
        }
5406
5407
9.59k
    return length +4 ;
5408
9.73k
}
5409
5410
/*
5411
 * Dissect Link and Node NLRI common fields (Protocol-ID, Identifier, Local Node Desc.)
5412
 */
5413
static int decode_bgp_link_node_nlri_common_fields(tvbuff_t *tvb,
5414
14.0k
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length) {
5415
14.0k
    int dissected_length;
5416
14.0k
    int tmp_length;
5417
5418
    /* dissect Link NLRI header */
5419
14.0k
    if (length < 12) {
5420
2.46k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5421
2.46k
                "Link State NLRI length is lower than 12 bytes! (%d)", length);
5422
2.46k
        return length;
5423
2.46k
    }
5424
5425
11.5k
    proto_tree_add_item(tree, hf_bgp_ls_nlri_node_protocol_id, tvb, offset, 1, ENC_BIG_ENDIAN);
5426
11.5k
    save_link_state_protocol_id(pinfo, tvb_get_uint8(tvb, offset));
5427
11.5k
    proto_tree_add_item(tree, hf_bgp_ls_nlri_node_identifier, tvb, offset + 1, 8, ENC_BIG_ENDIAN);
5428
5429
11.5k
    dissected_length = 9;
5430
11.5k
    offset += dissected_length;
5431
11.5k
    length -= dissected_length;
5432
5433
    /* dissect Local Node Descriptors TLV */
5434
11.5k
    if (length < 4) {
5435
4.08k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5436
4.08k
                "Unknown data in Link-State Link NLRI! length = %d bytes", length);
5437
4.08k
        return dissected_length;
5438
4.08k
    }
5439
5440
7.45k
    tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, tree, offset, pinfo,
5441
7.45k
                                                BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS);
5442
7.45k
    if (tmp_length < 0) {
5443
0
       return -1;
5444
0
    }
5445
7.45k
    dissected_length += tmp_length;
5446
5447
7.45k
    return dissected_length;
5448
7.45k
}
5449
5450
5451
/*
5452
 * Decode Link Descriptors
5453
 */
5454
static int decode_bgp_link_nlri_link_descriptors(tvbuff_t *tvb,
5455
1.37k
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length) {
5456
5457
1.37k
    uint16_t sub_length;
5458
1.37k
    uint16_t type;
5459
1.37k
    uint16_t diss_length;
5460
1.37k
    uint16_t tmp16;
5461
5462
1.37k
    proto_item* tlv_item;
5463
1.37k
    proto_tree* tlv_tree;
5464
1.37k
    proto_item* tlv_sub_item;
5465
1.37k
    proto_tree* tlv_sub_tree;
5466
5467
1.37k
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_link_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5468
1.37k
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5469
5470
1.37k
    diss_length = 0;
5471
3.05k
    while (length > 0) {
5472
2.82k
        if (length < 4) {
5473
361
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5474
361
                    "Unknown data in Link-State Link NLRI!");
5475
361
            diss_length += length;
5476
361
            break;
5477
361
        }
5478
5479
2.46k
        type = tvb_get_ntohs(tvb, offset);
5480
2.46k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5481
2.46k
        switch (type) {
5482
277
            case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5483
277
                if(sub_length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS){
5484
81
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5485
81
                                           "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
5486
81
                                           sub_length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
5487
81
                    return -1;
5488
81
                }
5489
196
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5490
196
                                                   hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
5491
196
                                                   sub_length + 4, ENC_NA);
5492
196
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5493
196
            break;
5494
5495
268
            case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
5496
268
                if(sub_length != BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS){
5497
66
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5498
66
                                           "Unexpected IPv4 Interface Address TLV's length (%u), it must be %u bytes!",
5499
66
                                           sub_length, BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS);
5500
66
                    return -1;
5501
66
                }
5502
202
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5503
202
                                                   hf_bgp_ls_tlv_ipv4_interface_address, tvb, offset,
5504
202
                                                   sub_length + 4, ENC_NA);
5505
202
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5506
202
            break;
5507
5508
272
            case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
5509
272
                if(sub_length != BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS){
5510
70
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5511
70
                                           "Unexpected IPv4 Neighbor Address TLV's length (%u), it must be %u bytes!",
5512
70
                                           sub_length, BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS);
5513
70
                    return -1;
5514
70
                }
5515
202
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5516
202
                                                   hf_bgp_ls_tlv_ipv4_neighbor_address, tvb, offset,
5517
202
                                                   sub_length + 4, ENC_NA);
5518
202
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5519
202
            break;
5520
5521
457
            case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
5522
457
                if(sub_length != BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS){
5523
68
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5524
68
                                           "Unexpected IPv6 Interface Address TLV's length (%u), it must be %u bytes!",
5525
68
                                           sub_length, BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS);
5526
68
                    return -1;
5527
68
                }
5528
389
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5529
389
                                                   hf_bgp_ls_tlv_ipv6_interface_address, tvb, offset,
5530
389
                                                   sub_length + 4, ENC_NA);
5531
389
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5532
389
            break;
5533
5534
154
            case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
5535
154
                if(sub_length != BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS){
5536
88
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5537
88
                                           "Unexpected IPv6 Neighbor Address TLV's length (%u), it must be %u bytes!",
5538
88
                                           sub_length, BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS);
5539
88
                    return -1;
5540
88
                }
5541
66
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5542
66
                                                   hf_bgp_ls_tlv_ipv6_neighbor_address, tvb, offset,
5543
66
                                                   sub_length + 4, ENC_NA);
5544
66
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5545
66
            break;
5546
5547
720
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5548
720
                if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5549
85
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5550
85
                                           "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5551
85
                                           sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5552
85
                    return -1;
5553
85
                }
5554
635
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5555
635
                        hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5556
635
                        ENC_NA);
5557
635
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5558
635
            break;
5559
5560
292
            default:
5561
292
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5562
292
                        "Unknown Link Descriptor TLV Code (%u)!", type);
5563
292
                return -1;
5564
2.46k
        }
5565
5566
1.69k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5567
1.69k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5568
5569
1.69k
        switch (type) {
5570
196
            case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5571
196
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5572
196
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5573
196
            break;
5574
5575
202
            case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
5576
202
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_interface_address, tvb, offset + 4,
5577
202
                                    BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
5578
202
            break;
5579
5580
202
            case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
5581
202
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_neighbor_address, tvb, offset + 4,
5582
202
                                    BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
5583
202
            break;
5584
5585
389
            case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
5586
389
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_interface_address, tvb, offset + 4,
5587
389
                                    BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
5588
389
            break;
5589
5590
66
            case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
5591
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_neighbor_address, tvb, offset + 4,
5592
66
                                    BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
5593
66
            break;
5594
5595
635
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5596
635
                tmp16 = tvb_get_ntohs(tvb, offset + 4);
5597
635
                tmp16 >>= 12;
5598
635
                if(tmp16){
5599
270
                    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);
5600
270
                }
5601
635
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
5602
635
                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5603
635
            break;
5604
1.69k
        }
5605
5606
1.67k
        length -= 4 + sub_length;
5607
1.67k
        offset += 4 + sub_length;
5608
1.67k
        diss_length += 4 + sub_length;
5609
1.67k
    }
5610
583
    return diss_length;
5611
1.37k
}
5612
5613
/*
5614
 * Decode Prefix Descriptors
5615
 */
5616
static int decode_bgp_link_nlri_prefix_descriptors(tvbuff_t *tvb,
5617
1.35k
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length, int proto) {
5618
5619
1.35k
    uint16_t sub_length;
5620
1.35k
    uint16_t type;
5621
1.35k
    uint16_t diss_length;
5622
1.35k
    uint16_t tmp16;
5623
5624
1.35k
    proto_item* tlv_item;
5625
1.35k
    proto_tree* tlv_tree;
5626
1.35k
    proto_item* tlv_sub_item;
5627
1.35k
    proto_tree* tlv_sub_tree;
5628
5629
1.35k
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_prefix_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5630
1.35k
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5631
5632
1.35k
    diss_length = 0;
5633
3.19k
    while (length > 0) {
5634
2.77k
        if (length < 4) {
5635
194
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5636
194
                    "Unknown data in Link-State Link NLRI!");
5637
194
            diss_length += length;
5638
194
            break;
5639
194
        }
5640
5641
2.58k
        type = tvb_get_ntohs(tvb, offset);
5642
2.58k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5643
2.58k
        switch (type) {
5644
1.02k
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5645
1.02k
                if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5646
74
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5647
74
                                           "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5648
74
                                           sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5649
74
                    return -1;
5650
74
                }
5651
951
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5652
951
                        hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5653
951
                        ENC_NA);
5654
951
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5655
951
            break;
5656
5657
489
            case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
5658
489
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5659
489
                        hf_bgp_ls_tlv_ospf_route_type, tvb, offset, sub_length + 4,
5660
489
                        ENC_NA);
5661
489
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5662
489
            break;
5663
528
            case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
5664
528
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5665
528
                        hf_bgp_ls_tlv_ip_reachability_information, tvb, offset, sub_length + 4,
5666
528
                        ENC_NA);
5667
528
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5668
528
            break;
5669
5670
507
            default:
5671
507
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5672
507
                        "Unknown Prefix Descriptor TLV Code (%u)!", type);
5673
507
                return -1;
5674
2.58k
        }
5675
5676
1.96k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5677
1.96k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5678
5679
1.96k
        switch (type) {
5680
951
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5681
951
                tmp16 = tvb_get_ntohs(tvb, offset + 4);
5682
951
                tmp16 >>= 12;
5683
951
                if(tmp16){
5684
584
                    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);
5685
584
                }
5686
951
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
5687
951
                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5688
951
            break;
5689
5690
489
            case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
5691
5692
489
                if (sub_length != 1) {
5693
250
                    expert_add_info_format(pinfo, tlv_sub_tree, &ei_bgp_ls_error, "OSPF Route Type length must be \"1\"");
5694
250
                    break;
5695
250
                }
5696
239
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ospf_route_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5697
239
            break;
5698
5699
528
            case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
5700
528
                if (( proto == IP_PROTO_IPV4 ) && (decode_prefix4(tlv_sub_tree, pinfo, tlv_sub_item, hf_bgp_ls_nlri_ip_reachability_prefix_ip,
5701
265
                               tvb, offset + 4, "Reachability") == -1))
5702
66
                    return diss_length;
5703
462
                if (( proto == IP_PROTO_IPV6 ) && (decode_prefix6(tlv_sub_tree, pinfo, hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
5704
263
                               tvb, offset + 4, 0, "Reachability") == -1))
5705
66
                    return diss_length;
5706
396
            break;
5707
1.96k
        }
5708
5709
1.83k
        length -= 4 + sub_length;
5710
1.83k
        offset += 4 + sub_length;
5711
1.83k
        diss_length += 4 + sub_length;
5712
1.83k
    }
5713
609
    return diss_length;
5714
1.35k
}
5715
5716
/*
5717
 * Decode SRv6 SID Descriptors
5718
 */
5719
static int decode_bgp_link_nlri_srv6_sid_descriptors(tvbuff_t *tvb,
5720
936
        proto_tree *tree, unsigned offset, packet_info *pinfo, int length) {
5721
5722
936
    uint16_t sub_length;
5723
936
    uint16_t type;
5724
936
    uint16_t diss_length;
5725
936
    uint16_t tmp16;
5726
5727
936
    proto_item* tlv_item;
5728
936
    proto_tree* tlv_tree;
5729
936
    proto_item* tlv_sub_item;
5730
936
    proto_tree* tlv_sub_tree;
5731
5732
936
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_srv6_sid_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5733
936
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5734
5735
936
    diss_length = 0;
5736
1.81k
    while (length > 0) {
5737
1.56k
        if (length < 4) {
5738
316
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5739
316
                    "Unknown data in Link-State SRv6 SID NLRI!");
5740
316
            diss_length += length;
5741
316
            break;
5742
316
        }
5743
5744
1.24k
        type = tvb_get_ntohs(tvb, offset);
5745
1.24k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5746
1.24k
        switch (type) {
5747
899
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5748
899
            if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5749
81
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5750
81
                                       "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5751
81
                                       sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5752
81
                return -1;
5753
81
            }
5754
818
            tlv_sub_item = proto_tree_add_item(tlv_tree,
5755
818
                                               hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5756
818
                                               ENC_NA);
5757
818
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5758
818
            break;
5759
5760
132
        case BGP_NLRI_TLV_SRV6_SID_INFO:
5761
132
            if (sub_length != 16) {
5762
66
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5763
66
                                       "Unexpected SRv6 SID Information TLV's length (%u), it must be 16 bytes!",
5764
66
                                       sub_length);
5765
66
                return -1;
5766
66
            }
5767
66
            tlv_sub_item = proto_tree_add_item(tlv_tree,
5768
66
                                               hf_bgp_ls_tlv_srv6_sid_info, tvb, offset, sub_length + 4,
5769
66
                                               ENC_NA);
5770
66
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5771
66
            break;
5772
5773
193
        default:
5774
193
            expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5775
193
                                   "Unknown SRv6 SID Descriptor TLV Code (%u)!", type);
5776
193
            return -1;
5777
1.24k
        }
5778
5779
884
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5780
884
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5781
5782
884
        switch (type) {
5783
818
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5784
818
            tmp16 = tvb_get_ntohs(tvb, offset + 4);
5785
818
            tmp16 >>= 12;
5786
818
            if (tmp16) {
5787
599
                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);
5788
599
            }
5789
818
            proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id,
5790
818
                                tvb, offset + 4, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5791
818
            break;
5792
5793
66
        case BGP_NLRI_TLV_SRV6_SID_INFO:
5794
66
            proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_tlv_srv6_sid_info_sid,
5795
66
                                tvb, offset + 4, 16, ENC_NA);
5796
66
            break;
5797
884
        }
5798
5799
877
        length -= 4 + sub_length;
5800
877
        offset += 4 + sub_length;
5801
877
        diss_length += 4 + sub_length;
5802
877
    }
5803
569
    return diss_length;
5804
936
}
5805
5806
/*
5807
 * Decode Flex Algo sub-TLVs in BGP-LS attributes
5808
 */
5809
static int
5810
decode_link_state_attribute_flex_algo_subtlv(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint8_t _U_ protocol_id)
5811
31.5k
{
5812
31.5k
    uint16_t type;
5813
31.5k
    uint16_t length;
5814
31.5k
    uint16_t tmp16;
5815
31.5k
    int i;
5816
31.5k
    proto_item* tlv_item;
5817
31.5k
    proto_tree* tlv_tree;
5818
31.5k
    proto_item* ti;
5819
5820
31.5k
    type = tvb_get_ntohs(tvb, offset);
5821
31.5k
    length = tvb_get_ntohs(tvb, offset + 2);
5822
5823
31.5k
    switch (type) {
5824
408
    case BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY:
5825
1.05k
    case BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY:
5826
1.28k
    case BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY:
5827
1.28k
        tlv_item = proto_tree_add_item(tree,
5828
1.28k
                                       (type == BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY) ?
5829
408
                                       hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity :
5830
1.28k
                                       ((type == BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY) ?
5831
647
                                        hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity :
5832
873
                                        hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity),
5833
1.28k
                                       tvb, offset, length + 4, ENC_NA);
5834
1.28k
        tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5835
1.28k
        proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5836
1.28k
        ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5837
1.28k
        if (length % 4 != 0) {
5838
426
            expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u mod 4 != 0)",
5839
426
                                   "Extended Administrative Group", length);
5840
426
            break;
5841
426
        }
5842
855
        tmp16 = length;
5843
1.28k
        while (tmp16) {
5844
427
            proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
5845
427
            tmp16 -= 4;
5846
427
        }
5847
855
        break;
5848
5849
392
    case BGP_LS_SR_TLV_FLEX_ALGO_DEF_FLAGS:
5850
392
        {
5851
392
            static int * const flex_algo_def_flags[] = {
5852
392
                &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m,
5853
392
                NULL
5854
392
            };
5855
392
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def_flags, tvb, offset, length + 4, ENC_NA);
5856
392
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5857
392
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5858
392
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5859
392
            if (length != 4) {
5860
198
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u != 4)",
5861
198
                                       "Flexible Algorithm Definition Flags", length);
5862
198
                break;
5863
198
            }
5864
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);
5865
194
        }
5866
0
        break;
5867
5868
29.2k
    case BGP_LS_SR_TLV_FLEX_ALGO_EXC_SRLG:
5869
29.2k
        tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_exc_srlg, tvb, offset, length + 4, ENC_NA);
5870
29.2k
        tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5871
29.2k
        proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5872
29.2k
        ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5873
29.2k
        if (length % 4 != 0) {
5874
28.8k
            expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u mod 4 != 0)",
5875
28.8k
                                   "Flexible Algorithm Exclude SRLG", length);
5876
28.8k
            break;
5877
28.8k
        }
5878
832
        for (i = 0; i < length; i += 4) {
5879
416
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + i, 4, ENC_BIG_ENDIAN);
5880
416
        }
5881
416
        break;
5882
5883
574
    default:
5884
574
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
5885
574
                               "Unknown BGP-LS Flex-Algo sub-TLV Code (%u)!", type);
5886
574
        break;
5887
31.5k
    }
5888
5889
31.5k
    return length + 4;
5890
31.5k
}
5891
5892
/*
5893
 * Decode a multiprotocol prefix
5894
 */
5895
static int
5896
// NOLINTNEXTLINE(misc-no-recursion)
5897
decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint8_t protocol_id)
5898
2.82M
{
5899
2.82M
    uint16_t type;
5900
2.82M
    uint16_t length;
5901
2.82M
    uint8_t tmp8;
5902
2.82M
    uint16_t tmp16;
5903
2.82M
    uint32_t tmp32;
5904
2.82M
    float   tmp_float;
5905
2.82M
    uint32_t mask;
5906
2.82M
    unsigned local_offset, local_length;
5907
2.82M
    int n;
5908
2.82M
    uint8_t sabm_len, udabm_len;
5909
2.82M
    int     advance;
5910
5911
2.82M
    proto_item* tlv_item;
5912
2.82M
    proto_tree* tlv_tree;
5913
2.82M
    proto_item* tlv_sub_item;
5914
2.82M
    proto_tree* tlv_sub_tree;
5915
2.82M
    proto_item* ti;
5916
5917
2.82M
    type = tvb_get_ntohs(tvb, offset);
5918
2.82M
    length = tvb_get_ntohs(tvb, offset + 2);
5919
5920
2.82M
    increment_dissection_depth(pinfo);
5921
2.82M
    switch (type) {
5922
5923
        /* NODE ATTRIBUTE TLVs */
5924
501
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5925
501
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_multi_topology_id, tvb, offset, length + 4, ENC_NA);
5926
501
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5927
5928
1.36k
            for (n = 0; n < (length / BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID); n++) {
5929
864
                tmp16 = tvb_get_ntohs(tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID));
5930
864
                tmp16 >>= 12;
5931
864
                if(tmp16){
5932
410
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved bits of Multi Topology ID must be set to zero! (%u)", tmp16);
5933
410
                }
5934
864
                proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID),
5935
864
                                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5936
864
            }
5937
501
            break;
5938
5939
91.5k
        case BGP_NLRI_TLV_NODE_FLAG_BITS:
5940
91.5k
            {
5941
91.5k
            static int * const flags[] = {
5942
91.5k
                &hf_bgp_ls_node_flag_bits_overload,
5943
91.5k
                &hf_bgp_ls_node_flag_bits_attached,
5944
91.5k
                &hf_bgp_ls_node_flag_bits_external,
5945
91.5k
                &hf_bgp_ls_node_flag_bits_abr,
5946
91.5k
                NULL
5947
91.5k
            };
5948
5949
91.5k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_flags_bits, tvb, offset, length+4, ENC_NA);
5950
91.5k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5951
91.5k
            if(length != BGP_NLRI_TLV_LEN_NODE_FLAG_BITS){
5952
19.7k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Node Flags Bits TLV's length (%u), it must be %u bytes!",
5953
19.7k
                                       length, BGP_NLRI_TLV_LEN_NODE_FLAG_BITS);
5954
19.7k
                break;
5955
19.7k
            }
5956
71.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5957
71.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5958
71.7k
            proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
5959
71.7k
            tmp8 = tvb_get_uint8(tvb, offset+4) & 0x0f;
5960
71.7k
            if(tmp8){
5961
71.5k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flag bits are not set to zero (%u).", tmp8);
5962
71.5k
            }
5963
71.7k
            }
5964
0
            break;
5965
5966
224
        case BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES:
5967
224
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_node_properties, tvb, offset, length+4, ENC_NA);
5968
224
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5969
224
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5970
224
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5971
224
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_node_properties_value, tvb, offset + 4, length, ENC_NA);
5972
224
            break;
5973
5974
198
        case BGP_NLRI_TLV_NODE_NAME:
5975
198
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_name, tvb, offset, length+4, ENC_NA);
5976
198
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5977
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5978
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5979
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_node_name_value, tvb, offset + 4, length, ENC_ASCII);
5980
198
            break;
5981
5982
194
        case BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER:
5983
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_is_is_area_identifier, tvb, offset, length+4, ENC_NA);
5984
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5985
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5986
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5987
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_is_is_area_identifier_value, tvb, offset + 4, length, ENC_NA);
5988
194
            break;
5989
5990
619
        case BGP_LS_SR_TLV_SR_CAPABILITY:
5991
619
            {
5992
                /*
5993
                  0  1  2  3  4  5  6  7
5994
                  +--+--+--+--+--+--+--+--+
5995
                  |I |V |H |  |  |  |  |  |
5996
                  +--+--+--+--+--+--+--+--+
5997
                */
5998
619
                static int * const sr_capabilities_flags[] = {
5999
619
                    &hf_bgp_ls_sr_tlv_capabilities_flags_i,
6000
619
                    &hf_bgp_ls_sr_tlv_capabilities_flags_v,
6001
619
                    &hf_bgp_ls_sr_tlv_capabilities_flags_h,
6002
619
                    &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
6003
619
                    NULL
6004
619
                };
6005
619
                unsigned offset2;
6006
619
                int remaining_data;
6007
619
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_capabilities, tvb, offset, length + 4, ENC_NA);
6008
619
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6009
619
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6010
619
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6011
619
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_capabilities_flags,
6012
619
                                       ett_bgp_link_state, sr_capabilities_flags, ENC_BIG_ENDIAN);
6013
                /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
6014
619
                offset2 = offset + 4 + 2;
6015
619
                remaining_data = length - 2;
6016
1.33k
                while (remaining_data > 0) {
6017
713
                    uint16_t sid_len = 0;
6018
                    /* parse and consume the range field */
6019
713
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
6020
713
                    offset2 += 3;
6021
                    /* parse and consume type/len fields */
6022
713
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
6023
713
                    offset2 += 2;
6024
713
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
6025
713
                    sid_len = tvb_get_ntohs(tvb, offset2);
6026
713
                    offset2 += 2;
6027
713
                    if (sid_len == 3) {
6028
                        /* parse and consume the SID/Label field */
6029
392
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
6030
392
                        offset2 += 3;
6031
392
                        remaining_data -= 10;
6032
392
                    } else {
6033
                        /* parse and consume the SID/Index field */
6034
321
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
6035
321
                        offset2 += 4;
6036
321
                        remaining_data -= 11;
6037
321
                    }
6038
713
                }
6039
619
            }
6040
619
            break;
6041
6042
664
        case BGP_LS_SR_TLV_SR_LOCAL_BLOCK:
6043
664
            {
6044
664
                unsigned offset2;
6045
664
                int remaining_data;
6046
664
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_local_block, tvb, offset, length + 4, ENC_NA);
6047
664
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6048
664
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6049
664
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6050
664
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_flags, tvb, offset + 4, 1, ENC_NA);
6051
                /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
6052
664
                offset2 = offset + 4 + 2;
6053
664
                remaining_data = length - 2;
6054
1.35k
                while (remaining_data > 0) {
6055
694
                    uint16_t sid_len = 0;
6056
                    /* parse and consume the range field */
6057
694
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
6058
694
                    offset2 += 3;
6059
                    /* parse and consume type/len fields */
6060
694
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
6061
694
                    offset2 += 2;
6062
694
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
6063
694
                    sid_len = tvb_get_ntohs(tvb, offset2);
6064
694
                    offset2 += 2;
6065
694
                    if (sid_len == 3) {
6066
                        /* parse and consume the SID/Label field */
6067
392
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
6068
392
                        offset2 += 3;
6069
392
                        remaining_data -= 10;
6070
392
                    } else {
6071
                        /* parse and consume the SID/Index field */
6072
302
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
6073
302
                        offset2 += 4;
6074
302
                        remaining_data -= 11;
6075
302
                    }
6076
694
                }
6077
664
            }
6078
664
            break;
6079
6080
413
        case BGP_LS_SR_TLV_SR_ALGORITHM:
6081
413
            {
6082
413
                unsigned offset2;
6083
413
                int remaining_data;
6084
413
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_algorithm, tvb, offset, length+4, ENC_NA);
6085
413
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6086
413
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6087
413
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6088
                /* past type-length fields, we got one or more 'Algorithm N' value */
6089
413
                offset2 = offset + 4;
6090
413
                remaining_data = length;
6091
862
                while (remaining_data > 0) {
6092
449
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_algorithm_value, tvb, offset2, 1, ENC_NA);
6093
449
                    offset2 += 1;
6094
449
                    remaining_data -= 1;
6095
449
                }
6096
413
            }
6097
413
            break;
6098
6099
801
        case BGP_LS_SR_TLV_SRV6_CAPABILITY:
6100
801
            {
6101
801
                static int * const srv6_cap_flags[] = {
6102
801
                    &hf_bgp_ls_sr_tlv_srv6_cap_flags_o,
6103
801
                    &hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved,
6104
801
                    NULL
6105
801
                };
6106
801
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_cap, tvb, offset, length + 4, ENC_NA);
6107
801
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6108
801
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6109
801
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6110
801
                if (length != 4) {
6111
607
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6112
607
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6113
607
                                           length, "SRv6 Capabilities", 4);
6114
607
                    break;
6115
607
                }
6116
194
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_srv6_cap_flags,
6117
194
                                       ett_bgp_link_state, srv6_cap_flags, ENC_BIG_ENDIAN);
6118
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_cap_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6119
194
            }
6120
0
            break;
6121
6122
29.9k
        case BGP_LS_SR_TLV_FLEX_ALGO_DEF:
6123
29.9k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def, tvb, offset, length+4, ENC_NA);
6124
29.9k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6125
29.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6126
29.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6127
29.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
6128
29.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_metric_type, tvb, offset + 5, 1, ENC_NA);
6129
29.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_calc_type, tvb, offset + 6, 1, ENC_NA);
6130
29.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_priority, tvb, offset + 7, 1, ENC_NA);
6131
29.9k
            local_offset = offset + 8;
6132
61.5k
            while (local_offset < offset + length) {
6133
31.5k
                advance = decode_link_state_attribute_flex_algo_subtlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6134
31.5k
                if (advance < 0) {
6135
0
                    break;
6136
0
                }
6137
31.5k
                local_offset += advance;
6138
31.5k
            }
6139
29.9k
            break;
6140
6141
        /* NODE & LINK ATTRIBUTE TLVs */
6142
329
        case BGP_NLRI_TLV_NODE_MSD:
6143
627
        case BGP_NLRI_TLV_LINK_MSD:
6144
627
            tlv_item = proto_tree_add_item(tree,
6145
627
                                           (type == BGP_NLRI_TLV_NODE_MSD ?
6146
329
                                            hf_bgp_ls_tlv_node_msd : hf_bgp_ls_tlv_link_msd),
6147
627
                                            tvb, offset, length + 4, ENC_NA);
6148
627
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
6149
627
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6150
627
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6151
627
            local_offset = offset + 4;
6152
627
            local_length = length;
6153
1.23k
            while (local_length >= 2) {
6154
612
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_type, tvb, local_offset, 1, ENC_NA);
6155
612
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_value, tvb, local_offset+1, 1, ENC_NA);
6156
612
                local_length -= 2;
6157
612
                local_offset += 2;
6158
612
            }
6159
627
            break;
6160
6161
566
        case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE:
6162
566
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
6163
566
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6164
566
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6165
566
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6166
566
            if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE){
6167
372
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
6168
372
                                    length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE);
6169
372
                break;
6170
372
            }
6171
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6172
194
            break;
6173
422
        case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE:
6174
422
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
6175
422
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6176
422
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6177
422
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6178
422
            if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE){
6179
228
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
6180
228
                                    length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE);
6181
228
                break;
6182
228
            }
6183
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);
6184
194
            break;
6185
6186
        /* Link Attribute TLVs */
6187
715
        case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
6188
715
            if (length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS) {
6189
521
                expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
6190
521
                                       "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
6191
521
                                       length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
6192
521
                break;
6193
521
            }
6194
194
            tlv_item = proto_tree_add_item(tree,
6195
194
                                           hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
6196
194
                                           length + 4, ENC_NA);
6197
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
6198
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6199
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6200
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6201
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6202
194
            break;
6203
6204
449
        case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE:
6205
449
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
6206
449
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6207
449
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6208
449
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6209
449
            if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE){
6210
255
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
6211
255
                                    length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE);
6212
255
                break;
6213
255
            }
6214
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6215
194
            break;
6216
6217
519
        case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE:
6218
519
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
6219
519
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6220
519
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6221
519
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6222
519
            if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE){
6223
325
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
6224
325
                                    length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE);
6225
325
                break;
6226
325
            }
6227
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);
6228
194
            break;
6229
6230
1.10k
        case BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR:
6231
1.10k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_administrative_group_color, tvb, offset, length+4, ENC_NA);
6232
1.10k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6233
1.10k
            if(length != BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR){
6234
243
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Administrative group (color) TLV's length (%u), it must be %u bytes!",
6235
243
                                       length, BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR);
6236
243
                break;
6237
243
            }
6238
861
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6239
861
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6240
861
            tmp32 = tvb_get_ntohl(tvb, offset + 4);
6241
861
            tlv_sub_item = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_administrative_group_color_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6242
861
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_prefix);
6243
861
            mask = 1;
6244
28.4k
            for(n = 0; n<32; n++){
6245
27.5k
                if( tmp32 & mask ) proto_tree_add_uint(tlv_sub_tree, hf_bgp_ls_tlv_administrative_group, tvb, offset + 4, 4, n);
6246
27.5k
                mask <<= 1;
6247
27.5k
            }
6248
861
            break;
6249
6250
467
        case BGP_NLRI_TLV_MAX_LINK_BANDWIDTH:
6251
467
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_link_bandwidth, tvb, offset, length+4, ENC_NA);
6252
467
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6253
467
            if(length != BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH){
6254
212
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Maximum link bandwidth TLV's length (%u), it must be %u bytes!",
6255
212
                                       length, BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH);
6256
212
                break;
6257
212
            }
6258
255
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6259
255
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6260
255
            tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
6261
255
            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);
6262
255
            break;
6263
6264
3.26k
        case BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH:
6265
3.26k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_reservable_link_bandwidth, tvb, offset, length+4, ENC_NA);
6266
3.26k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6267
3.26k
            if(length != BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH){
6268
230
                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!",
6269
230
                                       length, BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH);
6270
230
                break;
6271
230
            }
6272
3.03k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6273
3.03k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6274
3.03k
            tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
6275
3.03k
            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);
6276
3.03k
            break;
6277
6278
39.8k
        case BGP_NLRI_TLV_UNRESERVED_BANDWIDTH:
6279
39.8k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_unreserved_bandwidth, tvb, offset, length+4, ENC_NA);
6280
39.8k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6281
39.8k
            if(length != BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH){
6282
275
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Unreserved bandwidth TLV's length (%u), it must be %u bytes!",
6283
275
                                       length, BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH);
6284
275
                break;
6285
275
            }
6286
39.6k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6287
39.6k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6288
356k
            for(n = 0; n<8; n++){
6289
316k
                tmp_float = tvb_get_ntohieee_float(tvb, offset + 4 + (4 * n))*8/1000000;
6290
316k
                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);
6291
316k
                proto_item_prepend_text(tlv_sub_item, "Priority %u, ", n);
6292
316k
            }
6293
39.6k
            break;
6294
6295
599
        case BGP_NLRI_TLV_TE_DEFAULT_METRIC:
6296
599
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_te_default_metric, tvb, offset, length+4, ENC_NA);
6297
599
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6298
            /* FF: The 'TE Default Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 04
6299
               was 3 bytes as per RFC5305/3.7, since version 05 is 4 bytes. Here we try to parse both formats
6300
               without complain because there are real implementations out there based on the 3 bytes size. At
6301
               the same time we clearly highlight that 3 is "old" and 4 is correct via expert info. */
6302
599
            if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
6303
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
6304
194
                                       "Old TE Default Metric TLV's length (%u), it should be %u bytes!",
6305
194
                                       length,
6306
194
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
6307
                /* just a warning do not give up dissection */
6308
194
            }
6309
599
            if (length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD && length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
6310
211
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
6311
211
                                       "Unexpected TE Default Metric TLV's length (%u), it must be %u or %u bytes!",
6312
211
                                       length,
6313
211
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD,
6314
211
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
6315
                /* major error give up dissection */
6316
211
                break;
6317
211
            }
6318
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6319
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6320
388
            if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
6321
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value_old, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
6322
194
            } else if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
6323
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6324
194
            }
6325
388
            break;
6326
6327
405k
        case BGP_NLRI_TLV_LINK_PROTECTION_TYPE:
6328
405k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_protection_type, tvb, offset, length+4, ENC_NA);
6329
405k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6330
405k
            if(length != BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE){
6331
4.34k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Link Protection Type TLV's length (%u), it must be %u bytes!",
6332
4.34k
                                       length, BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE);
6333
4.34k
                break;
6334
4.34k
            }
6335
401k
            else {
6336
401k
                static int * const nlri_flags[] = {
6337
401k
                    &hf_bgp_ls_link_protection_type_extra_traffic,
6338
401k
                    &hf_bgp_ls_link_protection_type_unprotected,
6339
401k
                    &hf_bgp_ls_link_protection_type_shared,
6340
401k
                    &hf_bgp_ls_link_protection_type_dedicated_1to1,
6341
401k
                    &hf_bgp_ls_link_protection_type_dedicated_1plus1,
6342
401k
                    &hf_bgp_ls_link_protection_type_enhanced,
6343
401k
                    NULL
6344
401k
                };
6345
6346
401k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6347
401k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6348
401k
                tmp8 = tvb_get_uint8(tvb, offset + 4);
6349
6350
401k
                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);
6351
401k
                tmp8 >>= 6;
6352
401k
                if(tmp8){
6353
389k
                    expert_add_info_format(pinfo, tlv_sub_item, &ei_bgp_ls_error, "Reserved Protection Capabilities bits are not set to zero (%u).", tmp8);
6354
389k
                }
6355
401k
                tmp8 = tvb_get_uint8(tvb, offset + 4 + 1);
6356
401k
                if(tmp8){
6357
401k
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved field is not set to zero. (%u)", tmp8);
6358
401k
                }
6359
401k
            }
6360
401k
            break;
6361
401k
        case BGP_NLRI_TLV_MPLS_PROTOCOL_MASK:
6362
660
            {
6363
660
            static int * const flags[] = {
6364
660
                &hf_bgp_ls_mpls_protocol_mask_flag_l,
6365
660
                &hf_bgp_ls_mpls_protocol_mask_flag_r,
6366
660
                NULL
6367
660
            };
6368
6369
660
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_mpls_protocol_mask, tvb, offset, length+4, ENC_NA);
6370
660
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6371
660
            if(length != BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK){
6372
250
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected MPLS Protocol Mask TLV's length (%u), it must be %u bytes!",
6373
250
                                       length, BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK);
6374
250
                break;
6375
250
            }
6376
410
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6377
410
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6378
410
            proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
6379
410
            tmp8 = tvb_get_uint8(tvb, offset + 4) & 0x3f;
6380
410
            if(tmp8){
6381
206
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error, tvb, offset + 4, 1,
6382
206
                                             "Reserved flags are not set to zero (%u).", tmp8);
6383
206
            }
6384
410
            }
6385
0
            break;
6386
2.00k
        case BGP_NLRI_TLV_METRIC:
6387
            /* FF: The IGP 'Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 02
6388
               was fixed at 3 bytes, since version 03 is variable 1/2/3 bytes. We cannot complain if
6389
               length is not fixed at 3. */
6390
2.00k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_metric, tvb, offset, length + 4, ENC_NA);
6391
2.00k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6392
2.00k
            if (length > BGP_NLRI_TLV_LEN_MAX_METRIC) {
6393
203
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
6394
203
                                       "Unexpected Metric TLV's length (%u), it must be less than %u bytes!",
6395
203
                                       length, BGP_NLRI_TLV_LEN_MAX_METRIC);
6396
203
                break;
6397
203
            }
6398
1.80k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6399
1.80k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6400
1.80k
            if (length == 1) {
6401
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value1, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6402
1.60k
            } else if (length == 2) {
6403
1.21k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value2, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6404
1.21k
            } else if (length == 3) {
6405
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value3, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
6406
194
            }
6407
1.80k
            break;
6408
36.7k
        case BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP:
6409
36.7k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_shared_risk_link_group, tvb, offset, length+4, ENC_NA);
6410
36.7k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6411
36.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6412
36.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6413
36.7k
            tmp16 = length;
6414
36.7k
            n = 0;
6415
37.1k
            while(tmp16 > 0){
6416
36.7k
                if(tmp16 < 4) {
6417
36.3k
                    proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error,
6418
36.3k
                                                 tvb, offset + 4 + (n * 4), tmp16,
6419
36.3k
                                                 "Shared Risk Link Group Value must be 4 bytes long (%u).", tmp16);
6420
36.3k
                    break;
6421
36.3k
                }
6422
409
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
6423
409
                tmp16 -= 4;
6424
409
                n++;
6425
409
            }
6426
36.7k
            break;
6427
6428
354
        case BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE:
6429
354
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_link_attribute, tvb, offset, length+4, ENC_NA);
6430
354
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6431
354
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6432
354
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6433
354
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_link_attribute_value, tvb,  offset + 4, length, ENC_NA);
6434
354
            break;
6435
6436
194
        case BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE:
6437
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_name_attribute, tvb, offset, length+4, ENC_NA);
6438
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6439
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6440
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6441
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_link_name_attribute_value, tvb, offset + 4, length, ENC_ASCII);
6442
194
            break;
6443
6444
792
        case BGP_LS_SR_TLV_ADJ_SID:
6445
792
            {
6446
                /*
6447
                   0  1  2  3  4  5  6  7
6448
                  +--+--+--+--+--+--+--+--+
6449
                  |F |B |V |L |S |P |  |  |
6450
                  +--+--+--+--+--+--+--+--+
6451
                */
6452
792
                static int * const adj_sid_isis_flags[] = {
6453
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
6454
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
6455
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
6456
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
6457
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
6458
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi,
6459
792
                    NULL
6460
792
                };
6461
                /*
6462
                   0  1  2  3  4  5  6  7
6463
                  +--+--+--+--+--+--+--+--+
6464
                  |B |V |L |G |P |  |  |  |
6465
                  +--+--+--+--+--+--+--+--+
6466
                */
6467
792
                static int * const adj_sid_ospf_flags[] = {
6468
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
6469
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
6470
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
6471
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_go,
6472
792
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_po,
6473
792
                    NULL
6474
792
                };
6475
6476
792
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_adjacency_sid, tvb, offset, length + 4, ENC_NA);
6477
792
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6478
792
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6479
792
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6480
792
                if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6481
388
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
6482
388
                                           ett_bgp_link_state, adj_sid_ospf_flags, ENC_BIG_ENDIAN);
6483
404
                } else {
6484
                    /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6485
404
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
6486
404
                                           ett_bgp_link_state, adj_sid_isis_flags, ENC_BIG_ENDIAN);
6487
404
                }
6488
792
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6489
792
                if (length == 7) {
6490
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6491
598
                } else {
6492
598
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6493
598
                }
6494
792
            }
6495
792
            break;
6496
6497
195
        case BGP_LS_SR_TLV_LAN_ADJ_SID:
6498
195
            break;
6499
6500
295
        case BGP_LS_SR_TLV_PEER_NODE_SID:
6501
703
        case BGP_LS_SR_TLV_PEER_ADJ_SID:
6502
1.06k
        case BGP_LS_SR_TLV_PEER_SET_SID:
6503
1.06k
            {
6504
                /*
6505
                   0  1  2  3  4  5  6  7
6506
                  +--+--+--+--+--+--+--+--+
6507
                  |V |L |B |P |  |  |  |  | rfc9086
6508
                  +--+--+--+--+--+--+--+--+
6509
                */
6510
1.06k
                static int * const peer_sid_flags[] = {
6511
1.06k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
6512
1.06k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
6513
1.06k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
6514
1.06k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
6515
1.06k
                    NULL
6516
1.06k
                };
6517
6518
1.06k
                tlv_item = proto_tree_add_item(tree,
6519
1.06k
                                               (type == BGP_LS_SR_TLV_PEER_NODE_SID ?
6520
295
                                                hf_bgp_ls_sr_tlv_peer_node_sid :
6521
1.06k
                                                (type == BGP_LS_SR_TLV_PEER_ADJ_SID ?
6522
408
                                                 hf_bgp_ls_sr_tlv_peer_adj_sid :
6523
772
                                                 hf_bgp_ls_sr_tlv_peer_set_sid)),
6524
1.06k
                                               tvb, offset, length + 4, ENC_NA);
6525
1.06k
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6526
1.06k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6527
1.06k
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6528
1.06k
                if (length != 7 && length != 8) {
6529
659
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6530
659
                                           "Unexpected TLV Length (%u) in BGP-LS Peer SID TLV, it must be either 7 or 8 bytes!",
6531
659
                                           length);
6532
659
                    break;
6533
659
                }
6534
408
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_peer_sid_flags,
6535
408
                                       ett_bgp_link_state, peer_sid_flags, ENC_BIG_ENDIAN);
6536
408
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6537
408
                if (length == 7) {
6538
200
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6539
208
                } else {
6540
208
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6541
208
                }
6542
408
            }
6543
0
            break;
6544
6545
620
        case BGP_LS_SR_TLV_SRV6_END_X_SID:
6546
620
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_endx_sid,
6547
620
                                           tvb, offset, length + 4, ENC_NA);
6548
620
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6549
620
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6550
620
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6551
620
            if (length < 20) {
6552
199
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6553
199
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6554
199
                                       length, "SRv6 End.X SID", 20);
6555
199
                break;
6556
199
            }
6557
421
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6558
421
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 6,
6559
421
                                   hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
6560
421
                                   ett_bgp_link_state, srv6_endx_sid_flags, ENC_BIG_ENDIAN);
6561
421
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_algo, tvb, offset + 7, 1, ENC_NA);
6562
421
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_weight, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6563
421
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved, tvb, offset + 9, 1, ENC_BIG_ENDIAN);
6564
421
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_sid, tvb, offset + 10, 16, ENC_NA);
6565
421
            local_offset = offset + 26;
6566
838
            while (local_offset < offset + length) {
6567
417
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6568
417
                if (advance < 0) {
6569
0
                    break;
6570
0
                }
6571
417
                local_offset += advance;
6572
417
            }
6573
421
            break;
6574
6575
1.85k
        case BGP_LS_SR_TLV_SRV6_LAN_END_X_SID:
6576
1.85k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_lan_endx_sid,
6577
1.85k
                                           tvb, offset, length+4, ENC_NA);
6578
1.85k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6579
1.85k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6580
1.85k
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6581
1.85k
            if ((((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) && length < 26) ||
6582
1.46k
                ((protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
6583
1.07k
                  protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) && length < 28)) {
6584
775
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6585
775
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6586
775
                                       length, "SRv6 LAN End.X SID",
6587
775
                                       ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) ? 26 : 28);
6588
775
                break;
6589
775
            }
6590
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6591
1.08k
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 6,
6592
1.08k
                                   hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
6593
1.08k
                                   ett_bgp_link_state, srv6_endx_sid_flags, ENC_BIG_ENDIAN);
6594
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_algo, tvb, offset + 7, 1, ENC_NA);
6595
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_weight, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6596
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved, tvb, offset + 9, 1, ENC_BIG_ENDIAN);
6597
1.08k
            local_offset = offset + 10;
6598
1.08k
            if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6599
393
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf, tvb, local_offset, 4, ENC_BIG_ENDIAN);
6600
393
                local_offset += 4;
6601
691
            } else {
6602
                /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6603
691
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis, tvb, local_offset, 6, ENC_NA);
6604
691
                local_offset += 6;
6605
691
            }
6606
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_sid, tvb, local_offset, 16, ENC_NA);
6607
1.08k
            local_offset += 16;
6608
2.11k
            while (local_offset < offset + length) {
6609
1.03k
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6610
1.03k
                if (advance < 0) {
6611
0
                    break;
6612
0
                }
6613
1.03k
                local_offset += advance;
6614
1.03k
            }
6615
1.08k
            break;
6616
6617
1.48M
        case BGP_LS_APP_SPEC_LINK_ATTR:
6618
1.48M
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_app_spec_link_attrs, tvb, offset, length + 4, ENC_NA);
6619
1.48M
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6620
1.48M
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6621
1.48M
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6622
1.48M
            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);
6623
1.48M
            if (sabm_len != 0 && sabm_len != 4 && sabm_len != 8) {
6624
16.6k
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6625
16.6k
                                       "Unexpected SABM Length (%u) in BGP-LS Application-Specific Link Attributes TLV, it must be 0/4/8 bytes!",
6626
16.6k
                                       sabm_len);
6627
16.6k
                break;
6628
16.6k
            }
6629
1.46M
            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);
6630
1.46M
            if (udabm_len != 0 && udabm_len != 4 && udabm_len != 8) {
6631
11.3k
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6632
11.3k
                                       "Unexpected UDABM Length (%u) in BGP-LS Application Specific Link Attributes TLV, it must be 0/4/8 bytes!",
6633
11.3k
                                       sabm_len);
6634
11.3k
                break;
6635
11.3k
            }
6636
1.45M
            tmp16 = tvb_get_uint16(tvb, offset + 6, ENC_BIG_ENDIAN);
6637
1.45M
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6638
1.45M
            if (tmp16 != 0) {
6639
1.25M
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_warn,
6640
1.25M
                                       "Reserved field must be 0 in BGP-LS Application-Specific Link Attributes TLV");
6641
1.25M
            }
6642
1.45M
            if (sabm_len > 0) {
6643
72.9k
                static int * const app_spec_link_attrs_sabm[] = {
6644
72.9k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
6645
72.9k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
6646
72.9k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
6647
72.9k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
6648
72.9k
                    NULL
6649
72.9k
                };
6650
72.9k
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 8, hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
6651
72.9k
                                       ett_bgp_link_state, app_spec_link_attrs_sabm, ENC_BIG_ENDIAN);
6652
72.9k
            }
6653
1.45M
            if (udabm_len > 0) {
6654
767
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
6655
767
                                    tvb, offset + 8 + sabm_len, udabm_len, ENC_NA);
6656
767
            }
6657
            /* Decode Link Attribute sub-TLVs */
6658
1.45M
            local_offset = offset + 8 + sabm_len + udabm_len;
6659
4.27M
            while (local_offset < offset + length) {
6660
2.81M
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6661
2.81M
                if (advance < 0) {
6662
0
                    break;
6663
0
                }
6664
2.81M
                local_offset += advance;
6665
2.81M
            }
6666
1.45M
            break;
6667
6668
        /* Prefix Attribute TLVs */
6669
587
        case BGP_NLRI_TLV_IGP_FLAGS:
6670
587
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_flags, tvb, offset, length+4, ENC_NA);
6671
587
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6672
587
            if(length != BGP_NLRI_TLV_LEN_IGP_FLAGS){
6673
199
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IGP Flags TLV's length (%u), it must be %u bytes!",
6674
199
                                       length, BGP_NLRI_TLV_IGP_FLAGS);
6675
199
                break;
6676
199
            }
6677
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6678
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6679
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_flags_flag_d, tvb, offset + 4, 1, ENC_NA);
6680
388
            tmp8 = tvb_get_uint8(tvb, offset + 4) & 0x7F;
6681
388
            if(tmp8){
6682
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flags are not set to zero (%u).", tmp8);
6683
194
            }
6684
388
            break;
6685
6686
688
        case BGP_NLRI_TLV_ROUTE_TAG:
6687
688
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_tag, tvb, offset, length+4, ENC_NA);
6688
688
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6689
688
            if(length % 4 != 0) {
6690
239
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Tag TLV's length (%u mod 4 != 0) ",
6691
239
                                       length);
6692
239
                break;
6693
239
            }
6694
449
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6695
449
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6696
449
            tmp16 = length;
6697
449
            n = 0;
6698
901
            while(tmp16){
6699
452
                if(tmp16 < 4) {
6700
0
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Tag must be 4 bytes long (%u).", tmp16);
6701
0
                    break;
6702
0
                }
6703
452
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_tag_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
6704
452
                tmp16 -= 4;
6705
452
                n++;
6706
452
            }
6707
449
            break;
6708
6709
691
        case BGP_NLRI_TLV_EXTENDED_TAG:
6710
691
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_extended_tag, tvb, offset, length+4, ENC_NA);
6711
691
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6712
691
            if(length % 8 != 0) {
6713
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Extended Tag TLV's length (%u mod 8 != 0) ",
6714
194
                                       length);
6715
194
                break;
6716
194
            }
6717
497
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6718
497
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6719
497
            tmp16 = length;
6720
497
            n = 0;
6721
994
            while(tmp16){
6722
497
                if(tmp16 < 8) {
6723
0
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Extended Tag must be 8 bytes long (%u).", tmp16);
6724
0
                    break;
6725
0
                }
6726
497
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_extended_tag_value, tvb, offset + 4 + (n * 8), 8, ENC_BIG_ENDIAN);
6727
497
                tmp16 -= 8;
6728
497
                n++;
6729
497
            }
6730
497
            break;
6731
6732
437
        case BGP_NLRI_TLV_PREFIX_METRIC:
6733
437
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_prefix_metric, tvb, offset, length+4, ENC_NA);
6734
437
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6735
437
            if(length != BGP_NLRI_TLV_LEN_PREFIX_METRIC){
6736
243
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Prefix Metric TLV's length (%u), it must be %u bytes!",
6737
243
                                       length, BGP_NLRI_TLV_LEN_PREFIX_METRIC);
6738
243
                break;
6739
243
            }
6740
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6741
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6742
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_prefix_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6743
194
            break;
6744
6745
604
        case BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS:
6746
604
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_ospf_forwarding_address, tvb, offset, length+4, ENC_NA);
6747
604
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6748
604
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6749
604
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6750
604
            if (length == 4) {
6751
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv4_address, tvb, offset + 4, length, ENC_BIG_ENDIAN);
6752
194
            }
6753
410
            else if (length == 16) {
6754
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv6_address, tvb, offset + 4, length,  ENC_NA);
6755
194
            }
6756
216
            else {
6757
216
                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);
6758
216
                break;
6759
216
            }
6760
388
            break;
6761
6762
388
        case BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE:
6763
234
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_opaque_prefix_attribute, tvb, offset, length+4, ENC_NA);
6764
234
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6765
234
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6766
234
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6767
234
            proto_tree_add_item(tlv_tree, hf_bgp_ls_opaque_prefix_attribute_value, tvb, offset + 4, length, ENC_NA);
6768
234
            break;
6769
6770
610
        case BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP:
6771
610
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_extended_administrative_group, tvb, offset, length+4, ENC_NA);
6772
610
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6773
610
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6774
610
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6775
610
            if(length % 4 != 0) {
6776
195
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Extended Administrative Group TLV's length (%u mod 4 != 0)",
6777
195
                                       length);
6778
195
                break;
6779
195
            }
6780
415
            tmp16 = length;
6781
846
            while(tmp16){
6782
431
                proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
6783
431
                tmp16 -= 4;
6784
431
            }
6785
415
            break;
6786
6787
860
        case BGP_LS_SR_TLV_PREFIX_SID:
6788
860
            {
6789
                /*
6790
                   0  1  2  3  4  5  6  7
6791
                  +--+--+--+--+--+--+--+--+
6792
                  |R |N |P |E |V |L |  |  |
6793
                  +--+--+--+--+--+--+--+--+
6794
                */
6795
860
                static int * const prefix_sid_isis_flags[] = {
6796
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
6797
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
6798
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
6799
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
6800
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
6801
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
6802
860
                    NULL
6803
860
                };
6804
                /*
6805
                   0  1  2  3  4  5  6  7
6806
                  +--+--+--+--+--+--+--+--+
6807
                  |  |NP|M |E |V |L |  |  |
6808
                  +--+--+--+--+--+--+--+--+
6809
                */
6810
860
                static int * const prefix_sid_ospf_flags[] = {
6811
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
6812
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
6813
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
6814
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
6815
860
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
6816
860
                    NULL
6817
860
                };
6818
6819
860
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_sid, tvb, offset, length + 4, ENC_NA);
6820
860
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6821
860
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6822
860
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6823
860
                if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6824
389
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
6825
389
                                           ett_bgp_link_state, prefix_sid_ospf_flags, ENC_BIG_ENDIAN);
6826
471
                } else {
6827
                    /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6828
471
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
6829
471
                                           ett_bgp_link_state, prefix_sid_isis_flags, ENC_BIG_ENDIAN);
6830
471
                }
6831
860
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6832
860
                if (length == 7) {
6833
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6834
666
                } else {
6835
666
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6836
666
                }
6837
860
            }
6838
860
            break;
6839
6840
198
        case BGP_LS_SR_TLV_RANGE:
6841
198
            break;
6842
6843
402
        case BGP_LS_SR_TLV_SRV6_LOCATOR:
6844
402
            {
6845
402
                static int * const srv6_locator_flags[] = {
6846
402
                    &hf_bgp_ls_sr_tlv_srv6_locator_flags_d,
6847
402
                    &hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved,
6848
402
                    NULL
6849
402
                };
6850
402
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_locator, tvb, offset, length+4, ENC_NA);
6851
402
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6852
402
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6853
402
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6854
402
                if (length < 8) {
6855
196
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6856
196
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6857
196
                                           length, "SRv6 Locator", 8);
6858
196
                    break;
6859
196
                }
6860
206
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_srv6_locator_flags,
6861
206
                                       ett_bgp_link_state, srv6_locator_flags, ENC_NA);
6862
206
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6863
206
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6864
206
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_metric, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6865
206
            }
6866
0
            break;
6867
6868
1.13k
        case BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS:
6869
1.13k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_attr_flags, tvb, offset, length+4, ENC_NA);
6870
1.13k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6871
1.13k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6872
1.13k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6873
1.13k
            if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6874
                /* rfc7684, rfc9089 */
6875
428
                static int * const prefix_attr_ospf_flags[] = {
6876
428
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
6877
428
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
6878
428
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
6879
428
                    NULL
6880
428
                };
6881
428
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
6882
428
                                       ett_bgp_link_state, prefix_attr_ospf_flags, ENC_BIG_ENDIAN);
6883
704
            } else if (protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
6884
507
                       protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) {
6885
                /* rfc7794, rfc9088 */
6886
407
                static int * const prefix_attr_isis_flags[] = {
6887
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
6888
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
6889
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
6890
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
6891
407
                    NULL
6892
407
                };
6893
407
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
6894
407
                                       ett_bgp_link_state, prefix_attr_isis_flags, ENC_BIG_ENDIAN);
6895
407
            } else {
6896
297
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
6897
297
                                    tvb, offset + 4, tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN), ENC_NA);
6898
297
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
6899
297
                                       "Unknown Protocol-ID (%u) for Prefix Attribute Flags TLV",
6900
297
                                       protocol_id);
6901
297
            }
6902
1.13k
            break;
6903
6904
593
        case BGP_LS_SR_TLV_SOURCE_ROUTER_ID:
6905
593
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_source_router_id, tvb, offset, length+4, ENC_NA);
6906
593
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6907
593
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6908
593
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6909
593
            if (length == BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID) {
6910
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);
6911
399
            } else if (length == BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID) {
6912
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);
6913
205
            } else {
6914
205
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6915
205
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be either %u or %u bytes!",
6916
205
                                       length, "Source Router-ID",
6917
205
                                       BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID,
6918
205
                                       BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID);
6919
205
            }
6920
593
            break;
6921
6922
405
        case BGP_LS_SR_TLV_FLEX_ALGO_PREFIX_METRIC:
6923
405
            {
6924
                /* rfc9351, rfc9350 */
6925
405
                static int * const fapm_flags[] = {
6926
405
                    &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e,
6927
405
                    NULL
6928
405
                };
6929
405
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric, tvb, offset, length + 4, ENC_NA);
6930
405
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6931
405
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6932
405
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6933
405
                if (length != 8) {
6934
210
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6935
210
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be 8 bytes!",
6936
210
                                           length, "Flexible Algorithm Prefix Metric");
6937
210
                    break;
6938
210
                }
6939
195
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
6940
195
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 5, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags,
6941
195
                                       ett_bgp_link_state, fapm_flags, ENC_NA);
6942
195
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6943
195
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6944
195
                break;
6945
405
            }
6946
6947
        /* SID Attribute TLVs */
6948
422
        case BGP_LS_SR_TLV_SRV6_ENDPOINT_BEHAVIOR:
6949
422
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior, tvb, offset, length+4, ENC_NA);
6950
422
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6951
422
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6952
422
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6953
422
            if (length != 4) {
6954
228
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6955
228
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6956
228
                                       length, "SRv6 Endpoint Behavior", 4);
6957
228
                break;
6958
228
            }
6959
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6960
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
6961
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo, tvb, offset + 7, 1, ENC_BIG_ENDIAN);
6962
194
            break;
6963
6964
399
        case BGP_LS_SR_TLV_SRV6_SID_STRUCT:
6965
399
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_sid_struct, tvb, offset, length + 4, ENC_NA);
6966
399
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6967
399
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6968
399
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6969
399
            if (length != 4) {
6970
204
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6971
204
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6972
204
                                       length, "SRv6 SID Structure", 4);
6973
204
                break;
6974
204
            }
6975
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len, tvb, offset + 4, 1, ENC_NA);
6976
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len, tvb, offset + 5, 1, ENC_NA);
6977
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len, tvb, offset + 6, 1, ENC_NA);
6978
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len, tvb, offset + 7, 1, ENC_NA);
6979
195
            break;
6980
6981
195
        case BGP_LS_IGP_TE_METRIC_DELAY:
6982
195
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay, tvb, offset, length+4, ENC_NA);
6983
195
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6984
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6985
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6986
195
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6987
195
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6988
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6989
195
            break;
6990
16.5k
        case BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX:
6991
16.5k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_min_max, tvb, offset, length+4, ENC_NA);
6992
16.5k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6993
16.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6994
16.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6995
16.5k
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6996
16.5k
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6997
16.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_min, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6998
16.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6999
16.5k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_max, tvb, offset + 9, 3, ENC_BIG_ENDIAN);
7000
16.5k
            break;
7001
194
        case BGP_LS_IGP_TE_METRIC_DELAY_VARIATION:
7002
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_variation, tvb, offset, length+4, ENC_NA);
7003
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
7004
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
7005
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7006
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
7007
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_variation_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
7008
194
            break;
7009
206
        case BGP_LS_IGP_TE_METRIC_LOSS:
7010
206
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_link_loss, tvb, offset, length+4, ENC_NA);
7011
206
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
7012
206
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
7013
206
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7014
206
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
7015
206
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
7016
206
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_link_loss_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
7017
206
            break;
7018
194
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL:
7019
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_residual, tvb, offset, length+4, ENC_NA);
7020
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
7021
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
7022
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7023
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_residual_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
7024
194
            break;
7025
194
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE:
7026
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_available, tvb, offset, length+4, ENC_NA);
7027
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
7028
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
7029
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7030
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_available_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
7031
194
            break;
7032
194
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED:
7033
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized, tvb, offset, length+4, ENC_NA);
7034
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
7035
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
7036
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
7037
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
7038
194
            break;
7039
7040
692k
        default:
7041
692k
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
7042
692k
                "Unknown BGP-LS Attribute TLV Code (%u)!", type);
7043
692k
            break;
7044
2.82M
    }
7045
2.82M
    decrement_dissection_depth(pinfo);
7046
2.82M
    return length + 4;
7047
2.82M
}
7048
7049
10.4k
static int decode_evpn_nlri_esi(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo) {
7050
10.4k
    uint8_t esi_type = 0;
7051
10.4k
    proto_tree *esi_tree;
7052
10.4k
    proto_item *ti;
7053
7054
10.4k
    ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri_esi, tvb, offset, 10, ENC_NA);
7055
10.4k
    esi_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri_esi);
7056
10.4k
    proto_tree_add_item_ret_uint8(esi_tree, hf_bgp_evpn_nlri_esi_type, tvb, offset, 1, ENC_BIG_ENDIAN, &esi_type);
7057
10.4k
    proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value, tvb, offset+1, 9, ENC_NA);
7058
10.4k
    switch (esi_type) {
7059
1.92k
        case BGP_NLRI_EVPN_ESI_VALUE :
7060
1.92k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value_type0, tvb,
7061
1.92k
                                offset+1, 9, ENC_NA);
7062
1.92k
            break;
7063
401
        case BGP_NLRI_EVPN_ESI_LACP :
7064
401
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_lacp_mac, tvb,
7065
401
                                offset+1, 6, ENC_NA);
7066
401
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_portk, tvb,
7067
401
                                offset+7, 2, ENC_BIG_ENDIAN);
7068
401
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
7069
401
                                offset+9, 1, ENC_NA);
7070
401
            break;
7071
447
        case BGP_NLRI_EVPN_ESI_MSTP :
7072
447
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rb_mac, tvb,
7073
447
                                offset+1, 6, ENC_NA);
7074
447
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rbprio, tvb,
7075
447
                                offset+7, 2, ENC_BIG_ENDIAN);
7076
447
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
7077
447
                                offset+9, 1, ENC_NA);
7078
447
            break;
7079
553
        case BGP_NLRI_EVPN_ESI_MAC :
7080
553
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_sys_mac, tvb,
7081
553
                                offset+1, 6, ENC_NA);
7082
553
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_mac_discr, tvb,
7083
553
                                offset+7, 2, ENC_NA);
7084
553
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
7085
553
                                offset+9, 1, ENC_NA);
7086
553
            break;
7087
4.35k
        case BGP_NLRI_EVPN_ESI_RID :
7088
4.35k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_id, tvb,
7089
4.35k
                                offset+1, 4, ENC_BIG_ENDIAN);
7090
4.35k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_discr, tvb,
7091
4.35k
                                offset+5, 4, ENC_NA);
7092
4.35k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
7093
4.35k
                                offset+9, 1, ENC_NA);
7094
4.35k
            break;
7095
323
        case BGP_NLRI_EVPN_ESI_ASN :
7096
323
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn, tvb,
7097
323
                                offset+1, 4, ENC_BIG_ENDIAN);
7098
323
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn_discr, tvb,
7099
323
                                offset+5, 4, ENC_NA);
7100
323
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
7101
323
                                offset+9, 1, ENC_NA);
7102
323
            break;
7103
444
        case BGP_NLRI_EVPN_ESI_RES :
7104
444
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_reserved, tvb,
7105
444
                                offset+1, 9, ENC_NA);
7106
444
            break;
7107
2.02k
        default :
7108
2.02k
            expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_esi_type_err,
7109
2.02k
                                   "Invalid EVPN ESI (%u)!", esi_type);
7110
2.02k
            return (-1);
7111
10.4k
    }
7112
8.44k
    return 0;
7113
10.4k
}
7114
7115
/*
7116
 * Decode EVPN NLRI, RFC 7432 section 7.7
7117
 */
7118
21.1k
static int decode_evpn_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo) {
7119
21.1k
    int reader_offset = offset;
7120
21.1k
    int start_offset = offset+2;
7121
21.1k
    proto_tree *prefix_tree;
7122
21.1k
    proto_item *ti;
7123
21.1k
    uint8_t route_type;
7124
21.1k
    uint8_t nlri_len;
7125
21.1k
    uint8_t ip_len;
7126
21.1k
    uint32_t total_length = 0;
7127
21.1k
    uint32_t or_length;
7128
21.1k
    path_attr_data *data = NULL;
7129
21.1k
    proto_item *item;
7130
21.1k
    int ret;
7131
7132
21.1k
    route_type = tvb_get_uint8(tvb, offset);
7133
7134
21.1k
    nlri_len = tvb_get_uint8(tvb, offset + 1);
7135
7136
21.1k
    ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri, tvb, reader_offset,
7137
21.1k
                               nlri_len+2, ENC_NA);
7138
7139
21.1k
    prefix_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri);
7140
7141
21.1k
    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rt, tvb, reader_offset,
7142
21.1k
                        1, ENC_BIG_ENDIAN);
7143
21.1k
    proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, tvb_get_uint8(tvb, offset), evpnrtypevals, "Unknown capability %d"));
7144
    /* moving to next field */
7145
21.1k
    reader_offset++;
7146
7147
21.1k
    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_len, tvb, reader_offset,
7148
21.1k
                        1, ENC_BIG_ENDIAN);
7149
21.1k
    reader_offset++;
7150
7151
21.1k
    switch (route_type) {
7152
1.72k
    case EVPN_AD_ROUTE:
7153
    /*
7154
                +---------------------------------------+
7155
                |      RD   (8 octets)                  |
7156
                +---------------------------------------+
7157
                |Ethernet Segment Identifier (10 octets)|
7158
                +---------------------------------------+
7159
                |  Ethernet Tag ID (4 octets)           |
7160
                +---------------------------------------+
7161
                |  MPLS Label (3 octets)                |
7162
                +---------------------------------------+
7163
   */
7164
7165
1.72k
        if (nlri_len < 25) {
7166
303
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7167
303
                                   "Invalid length (%u) of EVPN NLRI Route Type 1 (Ethernet Auto-discovery Route)", nlri_len);
7168
303
            return -1;
7169
303
        }
7170
1.42k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7171
1.42k
                                   8, ENC_NA);
7172
1.42k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7173
1.42k
        reader_offset += 8;
7174
7175
1.42k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7176
1.42k
        reader_offset += 10;
7177
1.42k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7178
1.42k
                                   4, ENC_BIG_ENDIAN);
7179
1.42k
        reader_offset += 4;
7180
1.42k
        data = load_path_attr_data(pinfo);
7181
1.42k
        if (data && data->encaps_community_present &&
7182
609
                (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7183
403
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7184
403
            reader_offset += 3;
7185
1.02k
        } else {
7186
1.02k
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7187
1.02k
            reader_offset += 3;
7188
1.02k
        }
7189
1.42k
        total_length = reader_offset - offset;
7190
1.42k
        break;
7191
7192
4.31k
    case EVPN_MAC_ROUTE:
7193
/*
7194
        +---------------------------------------+
7195
        |      RD   (8 octets)                  |
7196
        +---------------------------------------+
7197
        |Ethernet Segment Identifier (10 octets)|
7198
        +---------------------------------------+
7199
        |  Ethernet Tag ID (4 octets)           |
7200
        +---------------------------------------+
7201
        |  MAC Address Length (1 octet)         |
7202
        +---------------------------------------+
7203
        |  MAC Address (6 octets)               |
7204
        +---------------------------------------+
7205
        |  IP Address Length (1 octet)          |
7206
        +---------------------------------------+
7207
        |  IP Address (0 or 4 or 16 octets)     |
7208
        +---------------------------------------+
7209
        |  MPLS Label1 (3 octets)               |
7210
        +---------------------------------------+
7211
        |  MPLS Label2 (0 or 3 octets)          |
7212
        +---------------------------------------+
7213
7214
*/
7215
7216
4.31k
        if (nlri_len < 33) {
7217
488
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7218
488
                                   "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7219
488
            return -1;
7220
488
        }
7221
3.82k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7222
3.82k
                                   8, ENC_NA);
7223
3.82k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7224
3.82k
        reader_offset += 8;
7225
7226
3.82k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7227
3.82k
        reader_offset += 10;
7228
7229
3.82k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7230
3.82k
                            4, ENC_BIG_ENDIAN);
7231
3.82k
        reader_offset += 4;
7232
7233
3.82k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_maclen, tvb, reader_offset,
7234
3.82k
                            1, ENC_BIG_ENDIAN);
7235
3.82k
        reader_offset += 1;
7236
7237
3.82k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mac_addr, tvb, reader_offset,
7238
3.82k
                            6, ENC_NA);
7239
3.82k
        reader_offset += 6;
7240
7241
3.82k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7242
3.82k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7243
3.82k
                            1, ENC_BIG_ENDIAN);
7244
3.82k
        reader_offset++;
7245
7246
3.82k
        if (ip_len == 4) {
7247
            /*IPv4 address*/
7248
266
            if (nlri_len < 37) {
7249
68
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7250
68
                                       "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7251
68
                return -1;
7252
68
            }
7253
198
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7254
198
                                4, ENC_BIG_ENDIAN);
7255
198
            reader_offset += 4;
7256
3.55k
        } else if (ip_len == 16) {
7257
            /*IPv6 address*/
7258
279
            if (nlri_len < 49) {
7259
80
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7260
80
                                       "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7261
80
                return -1;
7262
80
            }
7263
199
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7264
199
                                16, ENC_NA);
7265
199
            reader_offset += 16;
7266
3.27k
        } else if (ip_len == 0) {
7267
            /*IP not included*/
7268
3.00k
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset-1, 1);
7269
3.00k
        } else {
7270
279
            return -1;
7271
279
        }
7272
3.39k
        data = load_path_attr_data(pinfo);
7273
3.39k
        if (data && data->encaps_community_present &&
7274
813
                (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7275
605
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7276
605
            reader_offset += 3;
7277
605
            if (reader_offset - start_offset < nlri_len) {
7278
213
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7279
213
                reader_offset += 3;
7280
213
            }
7281
2.79k
        } else {
7282
2.79k
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7283
2.79k
            reader_offset += 3;
7284
            /* we check if we reached the end of the nlri reading fields one by one */
7285
            /* if not, the second optional label is in the payload */
7286
2.79k
            if (reader_offset - start_offset < nlri_len) {
7287
642
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls2, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7288
642
                reader_offset += 3;
7289
642
            }
7290
2.79k
        }
7291
3.39k
        total_length = reader_offset - offset;
7292
3.39k
        break;
7293
7294
2.14k
    case EVPN_INC_MCAST_TREE:
7295
/*
7296
        +---------------------------------------+
7297
        |      RD   (8 octets)                  |
7298
        +---------------------------------------+
7299
        |  Ethernet Tag ID (4 octets)           |
7300
        +---------------------------------------+
7301
        |  IP Address Length (1 octet)          |
7302
        +---------------------------------------+
7303
        |   Originating Router's IP Addr        |
7304
        |          (4 or 16 octets)             |
7305
        +---------------------------------------+
7306
*/
7307
7308
2.14k
        if (nlri_len < 13) {
7309
476
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7310
476
                                   "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7311
476
            return -1;
7312
476
        }
7313
1.66k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7314
1.66k
                                   8, ENC_NA);
7315
1.66k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7316
1.66k
        reader_offset += 8;
7317
7318
1.66k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7319
1.66k
                            4, ENC_BIG_ENDIAN);
7320
        /* move to next field */
7321
1.66k
        reader_offset += 4;
7322
1.66k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7323
1.66k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7324
1.66k
                            1, ENC_BIG_ENDIAN);
7325
1.66k
        reader_offset += 1;
7326
7327
1.66k
        if (ip_len == 4) {
7328
            /*IPv4 address*/
7329
415
            if (nlri_len < 17) {
7330
206
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7331
206
                                       "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7332
206
                return -1;
7333
206
            }
7334
209
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7335
209
                                4, ENC_BIG_ENDIAN);
7336
209
            reader_offset += 4;
7337
1.25k
        } else if (ip_len == 16) {
7338
            /*IPv6 address*/
7339
423
            if (nlri_len < 29) {
7340
204
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7341
204
                                       "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7342
204
                return -1;
7343
204
            }
7344
219
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7345
219
                                16, ENC_NA);
7346
219
            reader_offset += 16;
7347
827
        } else if (ip_len == 0) {
7348
            /*IP not included*/
7349
604
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
7350
604
        } else {
7351
223
            return -1;
7352
223
        }
7353
1.03k
        total_length = reader_offset - offset;
7354
1.03k
        break;
7355
7356
1.54k
    case EVPN_ETH_SEGMENT_ROUTE:
7357
/*
7358
        +---------------------------------------+
7359
        |      RD   (8 octets)                  |
7360
        +---------------------------------------+
7361
        |Ethernet Segment Identifier (10 octets)|
7362
        +---------------------------------------+
7363
        |  IP Address Length (1 octet)          |
7364
        +---------------------------------------+
7365
        |   Originating Router's IP Addr        |
7366
        |          (4 or 16 octets)             |
7367
        +---------------------------------------+
7368
*/
7369
7370
1.54k
        if (nlri_len < 19) {
7371
334
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7372
334
                                   "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7373
334
            return -1;
7374
334
        }
7375
1.20k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7376
1.20k
                                   8, ENC_NA);
7377
1.20k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7378
1.20k
        reader_offset += 8;
7379
7380
1.20k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7381
        /* move to next field */
7382
1.20k
        reader_offset += 10;
7383
7384
1.20k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7385
1.20k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7386
1.20k
                            1, ENC_BIG_ENDIAN);
7387
1.20k
        reader_offset++;
7388
7389
1.20k
        if (ip_len == 4) {
7390
            /*IPv4 address*/
7391
140
            if (nlri_len < 23) {
7392
67
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7393
67
                                       "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7394
67
                return -1;
7395
67
            }
7396
73
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7397
73
                                4, ENC_BIG_ENDIAN);
7398
73
            reader_offset += 4;
7399
1.06k
        } else if (ip_len == 16) {
7400
            /*IPv6 address*/
7401
267
            if (nlri_len < 35) {
7402
69
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7403
69
                                       "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7404
69
                return -1;
7405
69
            }
7406
198
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7407
198
                                16, ENC_NA);
7408
198
            reader_offset += 16;
7409
800
        } else if (ip_len == 0) {
7410
            /*IP not included*/
7411
490
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
7412
490
        } else {
7413
310
            return -1;
7414
310
        }
7415
761
        total_length = reader_offset - offset;
7416
761
        break;
7417
3.48k
    case EVPN_IP_PREFIX_ROUTE:
7418
7419
/*
7420
    +---------------------------------------+
7421
    |      RD   (8 octets)                  |
7422
    +---------------------------------------+
7423
    |Ethernet Segment Identifier (10 octets)|
7424
    +---------------------------------------+
7425
    |  Ethernet Tag ID (4 octets)           |
7426
    +---------------------------------------+
7427
    |  IP Prefix Length (1 octet)           |
7428
    +---------------------------------------+
7429
    |  IP Prefix (4 or 16 octets)           |
7430
    +---------------------------------------+
7431
    |  GW IP Address (4 or 16 octets)       |
7432
    +---------------------------------------+
7433
    |  MPLS Label (3 octets)                |
7434
    +---------------------------------------+
7435
*/
7436
7437
3.48k
        if (nlri_len < 26) {
7438
255
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7439
255
                                   "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7440
255
            return -1;
7441
255
        }
7442
3.22k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7443
3.22k
                                   8, ENC_NA);
7444
3.22k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7445
3.22k
        reader_offset += 8;
7446
7447
3.22k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7448
3.22k
        reader_offset += 10;
7449
7450
3.22k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7451
3.22k
                            4, ENC_BIG_ENDIAN);
7452
3.22k
        reader_offset += 4;
7453
7454
3.22k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_prefix_len, tvb, reader_offset,
7455
3.22k
                            1, ENC_BIG_ENDIAN);
7456
3.22k
        reader_offset++;
7457
7458
3.22k
        switch (nlri_len) {
7459
1.73k
            case 34 :
7460
                /* IPv4 address */
7461
1.73k
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7462
1.73k
                                    4, ENC_BIG_ENDIAN);
7463
1.73k
                reader_offset += 4;
7464
7465
1.73k
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv4_gtw, tvb, reader_offset,
7466
1.73k
                                    4, ENC_BIG_ENDIAN);
7467
1.73k
                reader_offset += 4;
7468
7469
1.73k
                data = load_path_attr_data(pinfo);
7470
1.73k
                if (data && data->encaps_community_present &&
7471
606
                        (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7472
397
                    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7473
1.33k
                } else {
7474
1.33k
                    decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
7475
1.33k
                }
7476
1.73k
                total_length = 36;
7477
1.73k
                break;
7478
859
            case 58 :
7479
                /* IPv6 address */
7480
859
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7481
859
                                    16, ENC_NA);
7482
859
                reader_offset += 16;
7483
7484
859
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_gtw, tvb, reader_offset,
7485
859
                                    16, ENC_NA);
7486
859
                reader_offset += 16;
7487
7488
859
                data = load_path_attr_data(pinfo);
7489
859
                if (data && data->encaps_community_present &&
7490
607
                        (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7491
393
                    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7492
466
                } else {
7493
466
                    decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
7494
466
                }
7495
859
                total_length = 60;
7496
859
                break;
7497
618
            default :
7498
618
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7499
618
                                       "Invalid length (%u) of EVPN NLRI Route Type 5 (IP Prefix Route)", nlri_len);
7500
618
                return -1;
7501
3.22k
        }
7502
2.52k
        break;
7503
7504
2.52k
    case EVPN_MC_ETHER_TAG_ROUTE:
7505
1.13k
    case EVPN_IGMP_JOIN_ROUTE:
7506
1.87k
    case EVPN_IGMP_LEAVE_ROUTE:
7507
3.84k
    case EVPN_S_PMSI_A_D_ROUTE:
7508
/*
7509
          +---------------------------------------+
7510
          |  RD (8 octets)                        |
7511
          +---------------------------------------+
7512
          |  Ethernet Tag ID (4 octets)           |
7513
          +---------------------------------------+
7514
          |  Multicast Source Length (1 octet)    |
7515
          +---------------------------------------+
7516
          |  Multicast Source Address (variable)  |
7517
          +---------------------------------------+
7518
          |  Multicast Group Length (1 octet)     |
7519
          +---------------------------------------+
7520
          |  Multicast Group Address (Variable)   |
7521
          +---------------------------------------+
7522
          |  Originator Router Length (1 octet)   |
7523
          +---------------------------------------+
7524
          |  Originator Router Address (variable) |
7525
          +---------------------------------------+
7526
          |  Flags (1 octets) (optional)          |
7527
          +---------------------------------------+
7528
7529
          +--------------------------------------------------+
7530
          |  RD (8 octets)                                   |
7531
          +--------------------------------------------------+
7532
          |  Ethernet Segment Identifier (10 octets)         |
7533
          +--------------------------------------------------+
7534
          |  Ethernet Tag ID  (4 octets)                     |
7535
          +--------------------------------------------------+
7536
          |  Multicast Source Length (1 octet)               |
7537
          +--------------------------------------------------+
7538
          |  Multicast Source Address (variable)             |
7539
          +--------------------------------------------------+
7540
          |  Multicast Group Length (1 octet)                |
7541
          +--------------------------------------------------+
7542
          |  Multicast Group Address (Variable)              |
7543
          +--------------------------------------------------+
7544
          |  Originator Router Length (1 octet)              |
7545
          +--------------------------------------------------+
7546
          |  Originator Router Address (variable)            |
7547
          +--------------------------------------------------+
7548
          |  Flags (1 octet)                                 |
7549
          +--------------------------------------------------+
7550
7551
          +--------------------------------------------------+
7552
          |  RD (8 octets)                                   |
7553
          +--------------------------------------------------+
7554
          |  Ethernet Segment Identifier (10 octets)         |
7555
          +--------------------------------------------------+
7556
          |  Ethernet Tag ID  (4 octets)                     |
7557
          +--------------------------------------------------+
7558
          |  Multicast Source Length (1 octet)               |
7559
          +--------------------------------------------------+
7560
          |  Multicast Source Address (variable)             |
7561
          +--------------------------------------------------+
7562
          |  Multicast Group Length (1 octet)                |
7563
          +--------------------------------------------------+
7564
          |  Multicast Group Address (Variable)              |
7565
          +--------------------------------------------------+
7566
          |  Originator Router Length (1 octet)              |
7567
          +--------------------------------------------------+
7568
          |  Originator Router Address (variable)            |
7569
          +--------------------------------------------------+
7570
          |  Reserved (4 octets)                             |
7571
          +--------------------------------------------------+
7572
          |  Maximum Response Time (1 octet)                 |
7573
          +--------------------------------------------------+
7574
          |  Flags (1 octet)                                 |
7575
          +--------------------------------------------------+
7576
*/
7577
7578
3.84k
        if (nlri_len < 15) {
7579
724
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7580
724
                                   "Invalid length (%u) of EVPN NLRI Route Type %u", nlri_len, route_type);
7581
724
            return -1;
7582
724
        }
7583
3.12k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7584
3.12k
                                   8, ENC_NA);
7585
3.12k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7586
3.12k
        reader_offset += 8;
7587
7588
3.12k
        if (route_type == EVPN_IGMP_JOIN_ROUTE || route_type == EVPN_IGMP_LEAVE_ROUTE) {
7589
814
            decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7590
814
            reader_offset += 10;
7591
814
        }
7592
7593
3.12k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7594
3.12k
                            4, ENC_BIG_ENDIAN);
7595
3.12k
        reader_offset += 4;
7596
7597
3.12k
        ret = decode_mcast_vpn_nlri_addresses(prefix_tree, tvb, reader_offset);
7598
3.12k
        if (ret < 0)
7599
1.04k
            return -1;
7600
7601
2.07k
        reader_offset = ret;
7602
2.07k
        proto_tree_add_item_ret_uint(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_length, tvb,
7603
2.07k
                                     reader_offset, 1, ENC_BIG_ENDIAN, &or_length);
7604
2.07k
        reader_offset += 1;
7605
2.07k
        switch(or_length) {
7606
474
            case 32:
7607
474
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4, tvb,
7608
474
                                    reader_offset, 4, ENC_BIG_ENDIAN);
7609
474
                reader_offset += 4;
7610
474
                break;
7611
579
            case 128:
7612
579
                 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6, tvb,
7613
579
                                     reader_offset, 16, ENC_NA);
7614
579
                 reader_offset += 16;
7615
579
                 break;
7616
2.07k
        }
7617
7618
2.03k
        if (route_type == EVPN_IGMP_LEAVE_ROUTE) {
7619
202
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_reserved, tvb,
7620
202
                                reader_offset, 4, ENC_NA);
7621
202
            reader_offset += 4;
7622
7623
            /* Maximum Response Time, per RFC2236 (IGMPv2)
7624
             * XXX - What if this is the max response time from RFC3376 (IGMPv3)?
7625
             */
7626
202
            uint8_t tsecs = tvb_get_uint8(tvb, offset);
7627
202
            proto_tree_add_uint_format_value(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_max_resp_time, tvb,
7628
202
                                             reader_offset, 1, tsecs, "%.1f sec (0x%02x)", tsecs*0.1, tsecs);
7629
7630
202
            reader_offset += 1;
7631
202
        }
7632
7633
2.03k
        if (reader_offset - start_offset < nlri_len) {
7634
1.24k
            proto_tree_add_bitmask(prefix_tree, tvb, reader_offset, hf_bgp_evpn_nlri_igmp_mc_flags,
7635
1.24k
                                   ett_bgp_evpn_nlri_mc, evpn_nlri_igmp_mc_flags, ENC_BIG_ENDIAN);
7636
1.24k
            reader_offset += 1;
7637
1.24k
        }
7638
2.03k
        total_length = reader_offset - offset;
7639
2.03k
        break;
7640
7641
4.09k
    default:
7642
4.09k
        expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_rt_type_err,
7643
4.09k
                               "Invalid EVPN Route Type (%u)", route_type);
7644
4.09k
        return -1;
7645
21.1k
    }
7646
7647
11.0k
    return total_length;
7648
21.1k
}
7649
7650
3.82k
static int decode_bgp_mup_nlri_variable_prefix(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint16_t afi) {
7651
7652
3.82k
    int reader_offset = offset;
7653
3.82k
    uint32_t total_length = 0;
7654
7655
3.82k
    int         byte_length;
7656
3.82k
    ws_in4_addr ipv4_prefix;
7657
3.82k
    address     ipv4_prefix_addr;
7658
3.82k
    ws_in6_addr ipv6_prefix;
7659
3.82k
    address     ipv6_prefix_addr;
7660
3.82k
    char        *prefix_str;
7661
3.82k
    uint8_t     prefix_length;
7662
7663
3.82k
    prefix_length = tvb_get_uint8(tvb, reader_offset);
7664
3.82k
    proto_tree_add_item(tree, hf_bgp_mup_nlri_prefixlen, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7665
3.82k
    reader_offset++;
7666
7667
3.82k
    switch (afi) {
7668
546
    case AFNUM_IP:
7669
546
        byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &ipv4_prefix, prefix_length);
7670
546
        if (byte_length == -1) {
7671
157
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, reader_offset,
7672
157
                                         "IPv4 prefix has an invalid length: %d bits", prefix_length);
7673
157
            return -1;
7674
157
        }
7675
389
        set_address(&ipv4_prefix_addr, AT_IPv4, 4, &ipv4_prefix);
7676
389
        prefix_str = address_to_str(pinfo->pool, &ipv4_prefix_addr);
7677
389
        proto_tree_add_ipv4_format_value(tree, hf_bgp_mup_nlri_ip_prefix, tvb, reader_offset, byte_length,
7678
389
                                         ipv4_prefix, "%s/%d", prefix_str, prefix_length);
7679
389
        reader_offset += byte_length;
7680
389
        break;
7681
7682
3.27k
    case AFNUM_IP6:
7683
3.27k
        byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, reader_offset, &ipv6_prefix, prefix_length);
7684
3.27k
        if (byte_length == -1) {
7685
636
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, reader_offset,
7686
636
                                         "IPv6 prefix has an invalid length: %d bits", prefix_length);
7687
636
            return -1;
7688
636
        }
7689
2.63k
        set_address(&ipv6_prefix_addr, AT_IPv6, 16, ipv6_prefix.bytes);
7690
2.63k
        prefix_str = address_to_str(pinfo->pool, &ipv6_prefix_addr);
7691
2.63k
        proto_tree_add_ipv6_format_value(tree, hf_bgp_mup_nlri_ipv6_prefix, tvb, reader_offset, byte_length,
7692
2.63k
                                         &ipv6_prefix, "%s/%d", prefix_str, prefix_length);
7693
2.63k
        reader_offset += byte_length;
7694
2.63k
        break;
7695
3.82k
    }
7696
3.02k
    total_length = reader_offset - offset;
7697
3.02k
    return total_length;
7698
3.82k
}
7699
7700
7701
static int decode_bgp_mup_nlri_st_route_tlvs(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7702
2.12k
                                             int remaining) {
7703
    /*
7704
        +-----------------------------------+
7705
        |          Type (1 octet)           |
7706
        +-----------------------------------+
7707
        |         Length (1 octet)          |
7708
        +-----------------------------------+
7709
        |         Value (variable)          |
7710
        +-----------------------------------+
7711
    */
7712
2.12k
    int reader_offset = offset;
7713
7714
2.12k
    proto_item *tlv_pi;
7715
2.12k
    proto_tree *tlv_tree;
7716
2.12k
    uint8_t    tlv_type;
7717
2.12k
    uint8_t    tlv_len;
7718
7719
5.38k
    while (remaining > 0) {
7720
4.82k
        if (remaining < 2) {
7721
197
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_mup_nlri_tlv_len_err, tvb, reader_offset, remaining,
7722
197
                                         "Malformed TLV: a valid TLV requires at least 2 octets");
7723
197
            return -1;
7724
197
        }
7725
4.63k
        tlv_type = tvb_get_uint8(tvb, reader_offset);
7726
4.63k
        tlv_len = tvb_get_uint8(tvb, reader_offset+1);
7727
4.63k
        if (2 + tlv_len > remaining) {
7728
222
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_mup_nlri_tlv_len_err, tvb, reader_offset, remaining,
7729
222
                                         "Malformed TLV: TLV length (%u) exceeds remaining NLRI length (%d)",
7730
222
                                         tlv_len, remaining);
7731
222
            return -1;
7732
222
        }
7733
4.40k
        tlv_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri_st_route_tlv, tvb, reader_offset, 2+tlv_len, ENC_NA);
7734
4.40k
        proto_item_append_text(tlv_pi, ": %s", val_to_str(pinfo->pool, tlv_type, bgp_mup_st_route_tlv_types,
7735
4.40k
                               "Unknown TLV type %d"));
7736
4.40k
        tlv_tree = proto_item_add_subtree(tlv_pi, ett_bgp_mup_nlri_st_route_tlv);
7737
7738
4.40k
        proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_st_route_tlv_type, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7739
4.40k
        proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_st_route_tlv_len, tvb, reader_offset+1, 1, ENC_BIG_ENDIAN);
7740
7741
4.40k
        switch (tlv_type) {
7742
752
        case BGP_MUP_ST_TLV_3GPP_5G_SESSION_PARAMS:
7743
752
            if (tlv_len != 5) {
7744
556
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_mup_nlri_tlv_len_err, tvb, reader_offset+1, 1,
7745
556
                                             "Invalid length (%u) of 3gpp-5g Session Parameters TLV", tlv_len);
7746
556
                return -1;
7747
556
            }
7748
196
            proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_3gpp_5g_teid, tvb, reader_offset+2, 4, ENC_BIG_ENDIAN);
7749
196
            proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_3gpp_5g_qfi, tvb, reader_offset+6, 1, ENC_BIG_ENDIAN);
7750
196
            break;
7751
752
        case BGP_MUP_ST_TLV_INTERWORK_ENDPOINT:
7752
752
            if (tlv_len == 4) {
7753
204
                proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_st_route_tlv_interwork_ep_ip_addr, tvb, reader_offset+2, 4, ENC_BIG_ENDIAN);
7754
548
            } else if (tlv_len == 16) {
7755
195
                proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_st_route_tlv_interwork_ep_ipv6_addr, tvb, reader_offset+2, 16, ENC_NA);
7756
353
            } else {
7757
353
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_mup_nlri_tlv_len_err, tvb, reader_offset+1, 1,
7758
353
                                             "Invalid length (%u) of Interwork Endpoint TLV", tlv_len);
7759
353
                return -1;
7760
353
            }
7761
399
            break;
7762
597
        case BGP_MUP_ST_TLV_SOURCE_ADDRESS:
7763
597
            if (tlv_len == 4) {
7764
202
                proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_3gpp_5g_source_ip_addr, tvb, reader_offset+2, 4, ENC_BIG_ENDIAN);
7765
395
            } else if (tlv_len == 16) {
7766
197
                proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr, tvb, reader_offset+2, 16, ENC_NA);
7767
198
            } else {
7768
198
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_mup_nlri_tlv_len_err, tvb, reader_offset+1, 1,
7769
198
                                             "Invalid length (%u) of Source Address TLV", tlv_len);
7770
198
                return -1;
7771
198
            }
7772
399
            break;
7773
2.29k
        default:
7774
            /* Unknown TLV types MUST be ignored */
7775
2.29k
            if (tlv_len > 0) {
7776
1.35k
                proto_tree_add_item(tlv_tree, hf_bgp_mup_nlri_st_route_tlv_value, tvb, reader_offset+2, tlv_len, ENC_NA);
7777
1.35k
            }
7778
2.29k
            break;
7779
4.40k
        }
7780
3.26k
        reader_offset += 2 + tlv_len;
7781
3.26k
        remaining -= 2 + tlv_len;
7782
3.26k
    }
7783
560
    return reader_offset - offset;
7784
2.12k
}
7785
7786
static int decode_bgp_mup_nlri_type1_st_route(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7787
2.62k
                                              uint16_t afi, uint8_t architecture_type, uint8_t nlri_len) {
7788
    /*
7789
        +-----------------------------------+
7790
        |           RD  (8 octets)          |
7791
        +-----------------------------------+
7792
        |      Prefix Length (1 octet)      |
7793
        +-----------------------------------+
7794
        |         Prefix (variable)         |
7795
        +-----------------------------------+
7796
        | Architecture specific (variable)  |
7797
        +-----------------------------------+
7798
    */
7799
2.62k
    int reader_offset = offset;
7800
2.62k
    uint32_t total_length = 0;
7801
7802
2.62k
    proto_item  *item;
7803
2.62k
    uint8_t     endpoint_address_length;
7804
2.62k
    uint8_t     source_address_length;
7805
2.62k
    proto_item  *arch_spec_item;
7806
2.62k
    proto_tree  *arch_spec_tree;
7807
2.62k
    int         arch_spec_byte;
7808
2.62k
    int         decoded_length;
7809
2.62k
    int         remaining;
7810
7811
2.62k
    item = proto_tree_add_item(tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7812
2.62k
    proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7813
2.62k
    reader_offset += 8;
7814
7815
2.62k
    decoded_length = decode_bgp_mup_nlri_variable_prefix(tree, tvb, reader_offset, pinfo, afi);
7816
2.62k
    if (decoded_length < 0) {
7817
400
        return -1;
7818
400
    }
7819
2.22k
    reader_offset += decoded_length;
7820
7821
2.22k
    switch (architecture_type) {
7822
1.84k
    case BGP_MUP_AT_3GPP_5G:
7823
        /*
7824
            +-----------------------------------+
7825
            |          TEID (4 octets)          |
7826
            +-----------------------------------+
7827
            |          QFI (1 octet)            |
7828
            +-----------------------------------+
7829
            | Endpoint Address Length (1 octet) |
7830
            +-----------------------------------+
7831
            |    Endpoint Address (variable)    |
7832
            +-----------------------------------+
7833
            |  Source Address Length (1 octet)  |
7834
            +-----------------------------------+
7835
            |     Source Address (variable)     |
7836
            +-----------------------------------+
7837
            |            TLVs (variable)        |
7838
            +-----------------------------------+
7839
        */
7840
1.84k
        endpoint_address_length = tvb_get_uint8(tvb, reader_offset+5); // should be multiple of 8
7841
1.84k
        source_address_length = tvb_get_uint8(tvb, reader_offset + 6 + endpoint_address_length/8); // should be zero or multiple of 8
7842
1.84k
        arch_spec_byte = 7 + endpoint_address_length/8 + source_address_length/8;
7843
7844
1.84k
        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);
7845
1.84k
        arch_spec_tree = proto_item_add_subtree(arch_spec_item, ett_bgp_mup_nlri_3gpp_5g_type1_st_route);
7846
7847
1.84k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_teid, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7848
1.84k
        reader_offset += 4;
7849
7850
1.84k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_qfi, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7851
1.84k
        reader_offset++;
7852
7853
1.84k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_addr_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7854
1.84k
        reader_offset++;
7855
7856
1.84k
        if (endpoint_address_length==32) {
7857
1.06k
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7858
1.06k
            reader_offset += 4;
7859
1.06k
        } else if (endpoint_address_length==128) {
7860
540
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7861
540
            reader_offset += 16;
7862
540
        } else {
7863
238
            expert_add_info_format(pinfo, arch_spec_tree, &ei_bgp_mup_nlri_addr_len_err,
7864
238
                                   "Invalid length (%u) of Endpoint Address Length", endpoint_address_length);
7865
238
            return -1;
7866
238
        }
7867
1.60k
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_addr_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7868
1.60k
        reader_offset++;
7869
1.60k
        if (source_address_length==0) {
7870
            /* Source Address Length of 0 means the Source Address is not carried within the NLRI. */
7871
805
        } else if (source_address_length==32) {
7872
354
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7873
354
            reader_offset += 4;
7874
446
        } else if (source_address_length==128) {
7875
199
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7876
199
            reader_offset += 16;
7877
247
        } else {
7878
247
            expert_add_info_format(pinfo, arch_spec_tree, &ei_bgp_mup_nlri_addr_len_err,
7879
247
                                   "Invalid length (%u) of Source Address Length", source_address_length);
7880
247
            return -1;
7881
247
        }
7882
1.35k
        remaining = nlri_len - (reader_offset - offset);
7883
1.35k
        if (remaining > 0) {
7884
507
            decoded_length = decode_bgp_mup_nlri_st_route_tlvs(tree, tvb, reader_offset, pinfo, remaining);
7885
507
            if (decoded_length < 0) {
7886
311
                return -1;
7887
311
            }
7888
196
            reader_offset += decoded_length;
7889
196
        }
7890
1.04k
        break;
7891
1.04k
    default:
7892
        /* return error because the length is unknown */
7893
379
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_mup_unknown_at, tvb, reader_offset,
7894
379
                                     "Architecture specific type 1 ST route for unknown architecture type: %d", architecture_type);
7895
379
        return -1;
7896
2.22k
    }
7897
7898
1.04k
    total_length = reader_offset - offset;
7899
1.04k
    return total_length;
7900
2.22k
}
7901
7902
static int decode_bgp_mup_nlri_type2_st_route(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo,
7903
3.05k
                                              uint16_t afi, uint8_t architecture_type, uint8_t nlri_len) {
7904
    /*
7905
        +-----------------------------------+
7906
        |           RD  (8 octets)          |
7907
        +-----------------------------------+
7908
        |      Endpoint Length (1 octet)    |
7909
        +-----------------------------------+
7910
        |      Endpoint Address (variable)  |
7911
        +-----------------------------------+
7912
        | Architecture specific Endpoint    |
7913
        |         Identifier (variable)     |
7914
        +-----------------------------------+
7915
    */
7916
3.05k
    int reader_offset = offset;
7917
3.05k
    uint32_t total_length = 0;
7918
7919
3.05k
    proto_item  *rd_pi;
7920
3.05k
    int         byte_length = 0;
7921
3.05k
    ws_in4_addr ipv4_prefix;
7922
3.05k
    address     ipv4_prefix_addr;
7923
3.05k
    ws_in6_addr ipv6_prefix;
7924
3.05k
    address     ipv6_prefix_addr;
7925
3.05k
    char        *prefix_str;
7926
3.05k
    uint8_t     prefix_length = 0;
7927
3.05k
    uint8_t     endpoint_length = 0;
7928
7929
3.05k
    uint8_t     arch_spec_endpoint_length = 0;
7930
3.05k
    proto_item  *arch_spec_item;
7931
3.05k
    proto_tree  *arch_spec_tree;
7932
3.05k
    uint32_t    arch_spec_3gpp_5g_teid;
7933
3.05k
    int         decoded_length;
7934
3.05k
    int         remaining;
7935
7936
3.05k
    rd_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7937
3.05k
    proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7938
3.05k
    reader_offset += 8;
7939
7940
3.05k
    endpoint_length = tvb_get_uint8(tvb, reader_offset);
7941
3.05k
    proto_tree_add_item(tree, hf_bgp_mup_nlri_ep_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7942
3.05k
    reader_offset++;
7943
7944
3.05k
    switch (afi) {
7945
583
    case AFNUM_IP:
7946
583
        prefix_length = endpoint_length>32 ? 32 : endpoint_length;
7947
583
        byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &ipv4_prefix, prefix_length);
7948
583
        set_address(&ipv4_prefix_addr, AT_IPv4, 4, &ipv4_prefix);
7949
583
        prefix_str = address_to_str(pinfo->pool, &ipv4_prefix_addr);
7950
7951
583
        proto_tree_add_ipv4_format_value(tree, hf_bgp_mup_nlri_ep_ip_addr, tvb, reader_offset, byte_length,
7952
583
                                         ipv4_prefix, "%s/%d", prefix_str, prefix_length);
7953
583
        reader_offset += byte_length;
7954
7955
583
        if (endpoint_length>32) {
7956
287
            arch_spec_endpoint_length = endpoint_length - 32;
7957
287
        }
7958
583
        break;
7959
2.46k
    case AFNUM_IP6:
7960
2.46k
        prefix_length = endpoint_length>128 ? 128 : endpoint_length;
7961
2.46k
        byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, reader_offset, &ipv6_prefix, prefix_length);
7962
2.46k
        set_address(&ipv6_prefix_addr, AT_IPv6, 16, ipv6_prefix.bytes);
7963
2.46k
        prefix_str = address_to_str(pinfo->pool, &ipv6_prefix_addr);
7964
7965
2.46k
        proto_tree_add_ipv6_format_value(tree, hf_bgp_mup_nlri_ep_ipv6_addr, tvb, reader_offset, byte_length,
7966
2.46k
                        &ipv6_prefix, "%s/%d", prefix_str, prefix_length);
7967
2.46k
        reader_offset += byte_length;
7968
7969
2.46k
        if (endpoint_length>128) {
7970
582
            arch_spec_endpoint_length = endpoint_length - 128;
7971
582
        }
7972
2.46k
        break;
7973
3.05k
    }
7974
3.03k
    if (arch_spec_endpoint_length>0) {
7975
869
        switch (architecture_type) {
7976
424
        case BGP_MUP_AT_3GPP_5G:
7977
            /*
7978
            +-----------------------------------+
7979
            |          TEID (0-4 octets)        |
7980
            +-----------------------------------+
7981
            |            TLVs (variable)        |
7982
            +-----------------------------------+
7983
            */
7984
424
            if (arch_spec_endpoint_length > 32) {
7985
210
                expert_add_info_format(pinfo, tree, &ei_bgp_mup_nlri_addr_len_err,
7986
210
                                       "Invalid Endpoint Length (%u)", endpoint_length);
7987
210
                return -1;
7988
210
            }
7989
214
            byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &arch_spec_3gpp_5g_teid, arch_spec_endpoint_length);
7990
7991
214
            arch_spec_item = proto_tree_add_item(tree, hf_bgp_mup_nlri_3gpp_5g_type2_st_route, tvb, reader_offset, byte_length, ENC_NA);
7992
214
            arch_spec_tree = proto_item_add_subtree(arch_spec_item, ett_bgp_mup_nlri_3gpp_5g_type2_st_route);
7993
214
            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,
7994
214
                                            "0x%08x/%d", g_ntohl(arch_spec_3gpp_5g_teid), arch_spec_endpoint_length);
7995
214
            reader_offset += byte_length;
7996
214
            break;
7997
445
        default:
7998
            /* for unknown architecture types, just decode as binary */
7999
445
            byte_length = (arch_spec_endpoint_length-1)/8 + 1;
8000
445
            proto_tree_add_item(tree, hf_bgp_mup_nlri_unknown_data, tvb, reader_offset, byte_length, ENC_NA);
8001
445
            reader_offset += byte_length;
8002
8003
445
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_bgp_mup_unknown_at, tvb, reader_offset,
8004
445
                                         "Architecture specific type 2 ST route for unknown architecture type: %d", architecture_type);
8005
445
            break;
8006
869
        }
8007
869
    }
8008
2.80k
    if (architecture_type == BGP_MUP_AT_3GPP_5G) {
8009
2.10k
        remaining = nlri_len - (reader_offset - offset);
8010
2.10k
        if (remaining > 0) {
8011
1.61k
            decoded_length = decode_bgp_mup_nlri_st_route_tlvs(tree, tvb, reader_offset, pinfo, remaining);
8012
1.61k
            if (decoded_length < 0) {
8013
1.20k
                return -1;
8014
1.20k
            }
8015
409
            reader_offset += decoded_length;
8016
409
        }
8017
2.10k
    }
8018
8019
1.59k
    total_length = reader_offset - offset;
8020
1.59k
    return total_length;
8021
2.80k
}
8022
8023
/* draft-ietf-bess-mup-safi-01 */
8024
173k
static int decode_bgp_mup_nlri(proto_tree *tree, tvbuff_t *tvb, unsigned offset, packet_info *pinfo, uint16_t afi) {
8025
8026
173k
    int reader_offset = offset;
8027
8028
173k
    proto_tree *prefix_tree;
8029
173k
    proto_item *nlri_pi;
8030
173k
    proto_item *rd_pi;
8031
173k
    uint8_t architecture_type;
8032
173k
    uint16_t route_type;
8033
173k
    uint8_t nlri_len;
8034
8035
173k
    int decoded_length = 0;
8036
8037
173k
    architecture_type = tvb_get_uint8(tvb, offset);
8038
173k
    route_type = tvb_get_uint16(tvb, offset + 1, ENC_BIG_ENDIAN);
8039
173k
    nlri_len = tvb_get_uint8(tvb, offset + 3);
8040
8041
173k
    nlri_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri, tvb, reader_offset, nlri_len+4, ENC_NA);
8042
8043
173k
    prefix_tree = proto_item_add_subtree(nlri_pi, ett_bgp_mup_nlri);
8044
8045
173k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_at, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
8046
173k
    proto_item_append_text(nlri_pi, ": %s", val_to_str(pinfo->pool, architecture_type, bgp_mup_architecture_types,
8047
173k
                           "Unknown architecture type %d"));
8048
173k
    reader_offset++;
8049
8050
173k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rt, tvb, reader_offset, 2, ENC_BIG_ENDIAN);
8051
173k
    proto_item_append_text(nlri_pi, ": %s", val_to_str(pinfo->pool, route_type, bgp_mup_route_types,
8052
173k
                           "Unknown route type %d"));
8053
173k
    reader_offset += 2;
8054
8055
173k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
8056
173k
    reader_offset++;
8057
8058
173k
    switch (route_type) {
8059
1.21k
    case BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY:
8060
        /*
8061
         +-----------------------------------+
8062
         |           RD  (8 octets)          |
8063
         +-----------------------------------+
8064
         |       Prefix Length (1 octet)     |
8065
         +-----------------------------------+
8066
         |        Prefix (variable)          |
8067
         +-----------------------------------+
8068
        */
8069
1.21k
        rd_pi = proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
8070
1.21k
        proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
8071
1.21k
        reader_offset += 8;
8072
8073
1.21k
        decoded_length = decode_bgp_mup_nlri_variable_prefix(prefix_tree, tvb, reader_offset, pinfo, afi);
8074
1.21k
        if (decoded_length < 0) {
8075
393
            return -1;
8076
393
        }
8077
818
        break;
8078
8079
818
    case BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY:
8080
        /*
8081
         +-----------------------------------+
8082
         |           RD  (8 octets)          |
8083
         +-----------------------------------+
8084
         |        Address (4 or 16 octets)   |
8085
         +-----------------------------------+
8086
        */
8087
750
        rd_pi = proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
8088
750
        proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
8089
750
        reader_offset += 8;
8090
750
        switch (afi) {
8091
234
        case AFNUM_IP:
8092
234
            proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
8093
234
            break;
8094
516
        case AFNUM_IP6:
8095
516
            proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
8096
516
            break;
8097
750
        }
8098
740
        break;
8099
8100
2.62k
    case BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED:
8101
2.62k
        decoded_length = decode_bgp_mup_nlri_type1_st_route(prefix_tree, tvb, reader_offset, pinfo, afi, architecture_type, nlri_len);
8102
2.62k
        if (decoded_length < 0) {
8103
1.57k
            return -1;
8104
1.57k
        }
8105
1.05k
        break;
8106
8107
3.05k
    case BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED:
8108
3.05k
        decoded_length = decode_bgp_mup_nlri_type2_st_route(prefix_tree, tvb, reader_offset, pinfo, afi, architecture_type, nlri_len);
8109
3.05k
        if (decoded_length < 0) {
8110
1.41k
            return -1;
8111
1.41k
        }
8112
1.63k
        break;
8113
8114
166k
    default:
8115
        /* for unknown route types, just decode as binary */
8116
166k
        proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_unknown_data, tvb, reader_offset, nlri_len, ENC_NA);
8117
166k
        reader_offset += nlri_len;
8118
166k
        proto_tree_add_expert_format_remaining(prefix_tree, pinfo, &ei_bgp_mup_unknown_rt, tvb, reader_offset,
8119
166k
                                     "Unknown route type: %d", route_type);
8120
166k
        break;
8121
173k
    }
8122
8123
170k
    return nlri_len+4;
8124
173k
}
8125
8126
8127
/*
8128
 * Decode a multiprotocol prefix
8129
 */
8130
static int
8131
decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
8132
                 uint16_t afi, uint8_t safi, int tlen, tvbuff_t *tvb, unsigned offset,
8133
                 const char *tag, packet_info *pinfo)
8134
400k
{
8135
400k
    int                 start_offset = offset;
8136
400k
    proto_item          *ti;
8137
400k
    proto_tree          *prefix_tree;
8138
400k
    proto_item          *nlri_ti;
8139
400k
    proto_tree          *nlri_tree;
8140
400k
    proto_item          *disting_item;
8141
400k
    proto_tree          *disting_tree;
8142
8143
400k
    int                 total_length=0;     /* length of the entire item */
8144
400k
    int                 length;             /* length of the prefix address, in bytes */
8145
400k
    int                 tmp_length;
8146
400k
    unsigned            plen;               /* length of the prefix address, in bits */
8147
400k
    unsigned            labnum;             /* number of labels             */
8148
400k
    uint16_t            tnl_id;             /* Tunnel Identifier */
8149
400k
    ws_in4_addr         ip4addr;            /* IPv4 address                 */
8150
400k
    address addr;
8151
400k
    ws_in6_addr         ip6addr;            /* IPv6 address                 */
8152
400k
    uint16_t            nlri_type;          /* NLRI Type                    */
8153
400k
    uint16_t            tmp16;
8154
400k
    uint32_t            path_identifier=0;
8155
400k
    int                 end=0;              /* Message End                  */
8156
8157
400k
    wmem_strbuf_t      *stack_strbuf;       /* label stack                  */
8158
400k
    wmem_strbuf_t      *comm_strbuf;
8159
8160
400k
    switch (afi) {
8161
8162
111k
    case AFNUM_IP:
8163
111k
        switch (safi) {
8164
8165
6.34k
            case SAFNUM_UNICAST:
8166
25.7k
            case SAFNUM_MULCAST:
8167
53.5k
            case SAFNUM_UNIMULC:
8168
                /* parse each prefix */
8169
8170
53.5k
                end = offset + tlen;
8171
8172
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
8173
53.5k
                if( detect_add_path_prefix4(tvb, offset, end) ) {
8174
                    /* IPv4 prefixes with Path Id */
8175
316
                    total_length = decode_path_prefix4(tree, pinfo, hf_path_id, hf_addr4, tvb, offset, tag);
8176
53.2k
                } else {
8177
53.2k
                    total_length = decode_prefix4(tree, pinfo, NULL,hf_addr4, tvb, offset, tag);
8178
53.2k
                }
8179
53.5k
                if (total_length < 0)
8180
869
                    return -1;
8181
52.6k
                break;
8182
8183
52.6k
            case SAFNUM_MPLS_LABEL:
8184
1.58k
                end = offset + tlen;
8185
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
8186
1.58k
                if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
8187
                    /* snarf path identifier */
8188
137
                    path_identifier = tvb_get_ntohl(tvb, offset);
8189
137
                    offset += 4;
8190
137
                    total_length += 4;
8191
137
                }
8192
                /* snarf length */
8193
1.58k
                plen =  tvb_get_uint8(tvb, offset);
8194
1.58k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8195
1.58k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8196
8197
1.58k
                offset += (1 + labnum * 3);
8198
1.58k
                if (plen < (labnum * 3*8)) {
8199
491
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8200
491
                                        "%s Labeled IPv4 prefix length %u invalid",
8201
491
                                        tag, plen);
8202
491
                    return -1;
8203
491
                }
8204
1.09k
                plen -= (labnum * 3*8);
8205
1.09k
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
8206
1.09k
                if (length < 0) {
8207
115
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8208
115
                                        "%s Labeled IPv4 prefix length %u invalid",
8209
115
                                        tag, plen + (labnum * 3*8));
8210
115
                    return -1;
8211
115
                }
8212
8213
982
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8214
982
                if (total_length > 0) {
8215
109
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8216
109
                                         (offset + length) - start_offset,
8217
109
                                         ett_bgp_prefix, NULL,
8218
109
                                         "Label Stack=%s IPv4=%s/%u PathID %u",
8219
109
                                         wmem_strbuf_get_str(stack_strbuf),
8220
109
                                         address_to_str(pinfo->pool, &addr), plen, path_identifier);
8221
109
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8222
109
                    start_offset += 4;
8223
873
                } else {
8224
873
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8225
873
                                        (offset + length) - start_offset,
8226
873
                                        ett_bgp_prefix, NULL,
8227
873
                                        "Label Stack=%s IPv4=%s/%u",
8228
873
                                        wmem_strbuf_get_str(stack_strbuf),
8229
873
                                        address_to_str(pinfo->pool, &addr), plen);
8230
873
                }
8231
982
                proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
8232
982
                                        "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
8233
982
                proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
8234
982
                                        "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
8235
982
                total_length += (1 + labnum*3) + length;
8236
982
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
8237
982
                break;
8238
4.52k
            case SAFNUM_MCAST_VPN:
8239
4.52k
                total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
8240
4.52k
                if (total_length < 0)
8241
375
                    return -1;
8242
4.15k
                break;
8243
4.15k
            case SAFNUM_MDT:
8244
658
                total_length = decode_mdt_safi(pinfo, tree, tvb, offset);
8245
658
                if (total_length < 0)
8246
296
                    return -1;
8247
362
                break;
8248
1.79k
            case SAFNUM_ROUTE_TARGET:
8249
1.79k
                plen = tvb_get_uint8(tvb, offset);
8250
8251
1.79k
                if (plen == 0) {
8252
541
                    proto_tree_add_string(tree, hf_bgp_wildcard_route_target, tvb, offset, 1, tag);
8253
541
                    total_length = 1;
8254
541
                    break;
8255
541
                }
8256
8257
1.24k
                if ((plen < 32) || (plen > 96)) {
8258
349
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8259
349
                                        "%s Route target length %u invalid",
8260
349
                                        tag, plen);
8261
349
                    return -1;
8262
349
                }
8263
8264
900
                length = (plen + 7)/8;
8265
900
                comm_strbuf = wmem_strbuf_create(pinfo->pool);
8266
8267
900
                switch (tvb_get_ntohs(tvb, offset + 1 + 4)) {
8268
194
                case BGP_EXT_COM_RT_AS2:
8269
194
                    wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
8270
194
                                              tvb_get_ntohs(tvb, offset + 1 + 6),
8271
194
                                              tvb_get_ntohl(tvb, offset + 1 + 8));
8272
194
                    break;
8273
194
                case BGP_EXT_COM_RT_IP4:
8274
194
                    wmem_strbuf_append_printf(comm_strbuf, "%s:%u",
8275
194
                                              tvb_ip_to_str(pinfo->pool, tvb, offset + 1 + 6),
8276
194
                                              tvb_get_ntohs(tvb, offset + 1 + 10));
8277
194
                    break;
8278
204
                case BGP_EXT_COM_RT_AS4:
8279
204
                    wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
8280
204
                                              tvb_get_ntohl(tvb, 6),
8281
204
                                              tvb_get_ntohs(tvb, offset + 1 + 10));
8282
204
                    break;
8283
281
                default:
8284
281
                    wmem_strbuf_append_printf(comm_strbuf, "Invalid RT type");
8285
281
                    break;
8286
900
                }
8287
855
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset + 1, length,
8288
855
                                    ett_bgp_prefix, NULL, "%s %u:%s/%u",
8289
855
                                    tag, tvb_get_ntohl(tvb, offset + 1 + 0),
8290
855
                                    wmem_strbuf_get_str(comm_strbuf),
8291
855
                                    plen);
8292
855
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN);
8293
855
                proto_tree_add_item(prefix_tree, hf_bgp_originating_as, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
8294
855
                proto_tree_add_string(prefix_tree, hf_bgp_community_prefix, tvb, offset + 1 + 4, length - 4, wmem_strbuf_get_str(comm_strbuf));
8295
855
                total_length = 1 + length;
8296
855
                break;
8297
621
            case SAFNUM_ENCAPSULATION:
8298
621
                plen =  tvb_get_uint8(tvb, offset);
8299
621
                if (plen != 32){
8300
426
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8301
426
                                        "%s IPv4 address length %u invalid",
8302
426
                                        tag, plen);
8303
426
                    return -1;
8304
426
                }
8305
195
                offset += 1;
8306
8307
195
                proto_tree_add_item(tree, hf_bgp_endpoint_address, tvb, offset, 4, ENC_BIG_ENDIAN);
8308
8309
195
                total_length = 5; /* length(1 octet) + address(4 octets) */
8310
195
                break;
8311
698
            case SAFNUM_TUNNEL:
8312
698
                plen =  tvb_get_uint8(tvb, offset);
8313
698
                if (plen <= 16){
8314
283
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8315
283
                                        "%s Tunnel IPv4 prefix length %u invalid",
8316
283
                                        tag, plen);
8317
283
                    return -1;
8318
283
                }
8319
415
                tnl_id = tvb_get_ntohs(tvb, offset + 1);
8320
415
                offset += 3; /* Length + Tunnel Id */
8321
415
                plen -= 16; /* 2-octet Identifier */
8322
415
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
8323
415
                if (length < 0) {
8324
195
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8325
195
                                        "%s Tunnel IPv4 prefix length %u invalid",
8326
195
                                        tag, plen + 16);
8327
195
                    return -1;
8328
195
                }
8329
220
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8330
220
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8331
220
                                         (offset + length) - start_offset,
8332
220
                                         ett_bgp_prefix, NULL,
8333
220
                                         "Tunnel Identifier=0x%x IPv4=%s/%u",
8334
220
                                         tnl_id, address_to_str(pinfo->pool, &addr), plen);
8335
8336
220
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
8337
8338
220
                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
8339
220
                                    start_offset + 1, 2, ENC_BIG_ENDIAN);
8340
220
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
8341
220
                total_length = 1 + 2 + length; /* length field + Tunnel Id + IPv4 len */
8342
220
                break;
8343
132
            case SAFNUM_SR_POLICY:
8344
132
                total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
8345
132
                if (total_length < 0)
8346
0
                    return -1;
8347
132
                break;
8348
1.07k
            case SAFNUM_LAB_VPNUNICAST:
8349
1.90k
            case SAFNUM_LAB_VPNMULCAST:
8350
2.25k
            case SAFNUM_LAB_VPNUNIMULC:
8351
2.25k
                end = offset + tlen;
8352
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
8353
2.25k
                if (detect_add_path_prefix46(tvb, offset, end, 255)) {
8354
                    /* snarf path identifier */
8355
428
                    offset += 4;
8356
428
                    total_length += 4;
8357
428
                }
8358
2.25k
                plen =  tvb_get_uint8(tvb, offset);
8359
2.25k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8360
2.25k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8361
8362
2.25k
                offset += (1 + labnum * 3);
8363
2.25k
                if (plen < (labnum * 3*8 + 8*8)) {
8364
1.33k
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8365
1.33k
                                        "%s Labeled VPN IPv4 prefix length %u invalid",
8366
1.33k
                                        tag, plen);
8367
1.33k
                    return -1;
8368
1.33k
                }
8369
923
                plen -= (labnum * 3*8 + 8*8);
8370
8371
923
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 8, &ip4addr, plen);
8372
923
                if (length < 0) {
8373
119
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8374
119
                                             "%s Labeled VPN IPv4 prefix length %u invalid",
8375
119
                                             tag, plen + (labnum * 3*8) + 8*8);
8376
119
                     return -1;
8377
119
                }
8378
804
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8379
804
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8380
804
                                                 (offset + 8 + length) - start_offset,
8381
804
                                                 ett_bgp_prefix, NULL, "BGP Prefix");
8382
8383
804
                if (total_length > 0) {
8384
164
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8385
164
                    start_offset += 4;
8386
164
                }
8387
804
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
8388
804
                proto_tree_add_string(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf));
8389
804
                proto_tree_add_string(prefix_tree, hf_bgp_rd, tvb, start_offset + 1 + 3 * labnum, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
8390
8391
804
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset + 8, length, ip4addr);
8392
8393
804
                total_length += (1 + labnum * 3 + 8) + length;
8394
804
                break;
8395
8396
7.39k
           case SAFNUM_FSPEC_RULE:
8397
39.2k
           case SAFNUM_FSPEC_VPN_RULE:
8398
39.2k
             total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
8399
39.2k
             if(total_length < 0)
8400
1.06k
               return -1;
8401
38.1k
             total_length++;
8402
38.1k
           break;
8403
5.68k
            case SAFNUM_BGP_MUP:
8404
5.68k
                end = offset + tlen;
8405
                /* Heuristic to detect if BGP-MUP NLRI are using Path Identifiers */
8406
5.68k
                if (detect_add_path_bgp_mup(tvb, offset, end)) {
8407
                    /* snarf path identifier */
8408
124
                    proto_tree_add_item(tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8409
124
                    offset += 4;
8410
124
                    total_length += 4;
8411
124
                }
8412
5.68k
                length = decode_bgp_mup_nlri(tree, tvb, offset, pinfo, afi);
8413
5.68k
                if (length < 0)
8414
380
                    return -1;
8415
5.30k
                total_length += length;
8416
5.30k
                break;
8417
954
           default:
8418
954
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8419
954
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8420
954
                return -1;
8421
111k
        } /* switch (safi) */
8422
103k
        break;
8423
8424
243k
    case AFNUM_IP6:
8425
243k
        switch (safi) {
8426
8427
19.0k
            case SAFNUM_UNICAST:
8428
55.2k
            case SAFNUM_MULCAST:
8429
58.6k
            case SAFNUM_UNIMULC:
8430
                /* parse each prefix */
8431
8432
58.6k
                end = offset + tlen;
8433
8434
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8435
58.6k
                if( detect_add_path_prefix6(tvb, offset, end) ) {
8436
                    /* IPv6 prefixes with Path Id */
8437
485
                    total_length = decode_path_prefix6(tree, pinfo, hf_path_id, hf_addr6, tvb, offset, tag);
8438
58.1k
                } else {
8439
58.1k
                    total_length = decode_prefix6(tree, pinfo, hf_addr6, tvb, offset, 0, tag);
8440
58.1k
                }
8441
58.6k
                if (total_length < 0)
8442
657
                    return -1;
8443
58.0k
                break;
8444
8445
58.0k
            case SAFNUM_MPLS_LABEL:
8446
1.57k
                end = offset + tlen;
8447
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8448
1.57k
                if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
8449
                    /* snarf path identifier */
8450
519
                    path_identifier = tvb_get_ntohl(tvb, offset);
8451
519
                    offset += 4;
8452
519
                    total_length += 4;
8453
519
                }
8454
                /* snarf length */
8455
1.57k
                plen =  tvb_get_uint8(tvb, offset);
8456
1.57k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8457
1.57k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8458
8459
1.57k
                offset += (1 + labnum * 3);
8460
1.57k
                if (plen < (labnum * 3*8)) {
8461
881
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8462
881
                                        "%s Labeled IPv6 prefix length %u invalid", tag, plen);
8463
881
                    return -1;
8464
881
                }
8465
689
                plen -= (labnum * 3*8);
8466
8467
689
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
8468
689
                if (length < 0) {
8469
109
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8470
109
                                        "%s Labeled IPv6 prefix length %u invalid",
8471
109
                                        tag, plen  + (labnum * 3*8));
8472
109
                    return -1;
8473
109
                }
8474
8475
580
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8476
580
                if (total_length > 0) {
8477
68
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8478
68
                                    (offset + length) - start_offset,
8479
68
                                    ett_bgp_prefix, NULL,
8480
68
                                    "Label Stack=%s, IPv6=%s/%u PathId %u",
8481
68
                                    wmem_strbuf_get_str(stack_strbuf),
8482
68
                                    address_to_str(pinfo->pool, &addr), plen, path_identifier);
8483
68
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8484
68
                    start_offset += 4;
8485
512
                } else {
8486
512
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8487
512
                                    (offset + length) - start_offset,
8488
512
                                    ett_bgp_prefix, NULL,
8489
512
                                    "Label Stack=%s, IPv6=%s/%u",
8490
512
                                    wmem_strbuf_get_str(stack_strbuf),
8491
512
                                    address_to_str(pinfo->pool, &addr), plen);
8492
512
                }
8493
580
                proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
8494
580
                                        "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
8495
580
                proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
8496
580
                                        "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
8497
580
                total_length += (1 + labnum*3) + length;
8498
580
                proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
8499
580
                break;
8500
5.82k
            case SAFNUM_MCAST_VPN:
8501
5.82k
                total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
8502
5.82k
                if (total_length < 0)
8503
582
                    return -1;
8504
5.24k
                break;
8505
5.24k
            case SAFNUM_ENCAPSULATION:
8506
769
                plen =  tvb_get_uint8(tvb, offset);
8507
769
                if (plen != 128){
8508
443
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8509
443
                                        "%s IPv6 address length %u invalid",
8510
443
                                        tag, plen);
8511
443
                    return -1;
8512
443
                }
8513
326
                offset += 1;
8514
8515
326
                proto_tree_add_item(tree, hf_bgp_endpoint_address_ipv6, tvb, offset, 16, ENC_NA);
8516
8517
326
                total_length = 17; /* length(1 octet) + address(16 octets) */
8518
326
                break;
8519
675
            case SAFNUM_TUNNEL:
8520
675
                plen =  tvb_get_uint8(tvb, offset);
8521
675
                if (plen <= 16){
8522
270
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8523
270
                                        "%s Tunnel IPv6 prefix length %u invalid",
8524
270
                                        tag, plen);
8525
270
                    return -1;
8526
270
                }
8527
405
                tnl_id = tvb_get_ntohs(tvb, offset + 1);
8528
405
                offset += 3; /* Length + Tunnel Id */
8529
405
                plen -= 16; /* 2-octet Identifier */
8530
405
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
8531
405
                if (length < 0) {
8532
196
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8533
196
                                        "%s Tunnel IPv6 prefix length %u invalid",
8534
196
                                        tag, plen + 16);
8535
196
                    return -1;
8536
196
                }
8537
209
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8538
209
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8539
209
                                    (offset + length) - start_offset,
8540
209
                                    ett_bgp_prefix, NULL,
8541
209
                                    "Tunnel Identifier=0x%x IPv6=%s/%u",
8542
209
                                    tnl_id, address_to_str(pinfo->pool, &addr), plen);
8543
209
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
8544
8545
209
                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
8546
209
                                    start_offset + 1, 2, ENC_BIG_ENDIAN);
8547
209
                proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
8548
8549
209
                total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */
8550
209
                break;
8551
8552
134
            case SAFNUM_SR_POLICY:
8553
134
                total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
8554
134
                if (total_length < 0)
8555
0
                    return -1;
8556
134
                break;
8557
8558
168k
            case SAFNUM_BGP_MUP:
8559
168k
                end = offset + tlen;
8560
                /* Heuristic to detect if BGP-MUP NLRI are using Path Identifiers */
8561
168k
                if (detect_add_path_bgp_mup(tvb, offset, end)) {
8562
                    /* snarf path identifier */
8563
88
                    proto_tree_add_item(tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8564
88
                    offset += 4;
8565
88
                    total_length += 4;
8566
88
                }
8567
168k
                length = decode_bgp_mup_nlri(tree, tvb, offset, pinfo, afi);
8568
168k
                if (length < 0)
8569
3.00k
                    return -1;
8570
165k
                total_length += length;
8571
165k
                break;
8572
577
            case SAFNUM_LAB_VPNUNICAST:
8573
1.99k
            case SAFNUM_LAB_VPNMULCAST:
8574
2.55k
            case SAFNUM_LAB_VPNUNIMULC:
8575
2.55k
                end = offset + tlen;
8576
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8577
2.55k
                if (detect_add_path_prefix46(tvb, offset, end, 255)) {
8578
                    /* snarf path identifier */
8579
679
                    offset += 4;
8580
679
                    total_length += 4;
8581
679
                }
8582
2.55k
                plen =  tvb_get_uint8(tvb, offset);
8583
2.55k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8584
2.55k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8585
8586
2.55k
                offset += (1 + labnum * 3);
8587
2.55k
                if (plen < (labnum * 3*8 + 8*8)) {
8588
1.33k
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8589
1.33k
                                        "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
8590
1.33k
                    return -1;
8591
1.33k
                }
8592
1.22k
                plen -= (labnum * 3*8 + 8*8);
8593
8594
1.22k
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 8, &ip6addr, plen);
8595
1.22k
                if (length < 0) {
8596
104
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8597
104
                                                 "%s Labeled VPN IPv6 prefix length %u invalid",
8598
104
                                                 tag, plen + (labnum * 3*8) + 8*8);
8599
104
                    return -1;
8600
104
                }
8601
8602
1.12k
                if (total_length > 0) {
8603
224
                    proto_tree_add_item(tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8604
224
                    start_offset += 4;
8605
224
                }
8606
1.12k
                proto_tree_add_item(tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
8607
1.12k
                proto_tree_add_string(tree, hf_bgp_label_stack, tvb, start_offset + 1, labnum * 3, wmem_strbuf_get_str(stack_strbuf));
8608
1.12k
                proto_tree_add_string(tree, hf_bgp_rd, tvb, offset, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
8609
8610
8611
1.12k
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8612
1.12k
                proto_tree_add_ipv6_format_value(tree, hf_addr6, tvb, offset + 8, length,
8613
1.12k
                                                 &ip6addr, "%s/%u", address_to_str(pinfo->pool, &addr), plen);
8614
8615
1.12k
                total_length += (1 + labnum * 3 + 8) + length;
8616
8617
1.12k
                break;
8618
3.12k
            case SAFNUM_FSPEC_RULE:
8619
4.39k
            case SAFNUM_FSPEC_VPN_RULE:
8620
4.39k
                total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
8621
4.39k
                if(total_length < 0)
8622
611
                    return -1;
8623
3.78k
                total_length++;
8624
3.78k
                break;
8625
393
            default:
8626
393
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8627
393
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8628
393
                return -1;
8629
243k
        } /* switch (safi) */
8630
233k
        break;
8631
8632
233k
    case AFNUM_AFI_FOR_L2VPN_INFORMATION:
8633
22.3k
    case AFNUM_AFI_FOR_L2VPN_INFORMATION_OLD:
8634
22.3k
        switch (safi) {
8635
8636
95
            case SAFNUM_LAB_VPNUNICAST:
8637
238
            case SAFNUM_LAB_VPNMULCAST:
8638
369
            case SAFNUM_LAB_VPNUNIMULC:
8639
566
            case SAFNUM_VPLS:
8640
566
                proto_tree_add_item_ret_uint(tree, hf_bgp_vplsad_length, tvb, offset, 2, ENC_BIG_ENDIAN, &plen);
8641
8642
566
                proto_tree_add_string(tree, hf_bgp_vplsad_rd, tvb, offset+2, 8, decode_bgp_rd(pinfo->pool, tvb, offset+2));
8643
                /* RFC6074 Section 7 BGP-AD and VPLS-BGP Interoperability
8644
                   Both BGP-AD and VPLS-BGP [RFC4761] use the same AFI/SAFI.  In order
8645
                   for both BGP-AD and VPLS-BGP to co-exist, the NLRI length must be
8646
                   used as a demultiplexer.
8647
8648
                   The BGP-AD NLRI has an NLRI length of 12 bytes, containing only an
8649
                   8-byte RD and a 4-byte VSI-ID. VPLS-BGP [RFC4761] uses a 17-byte
8650
                   NLRI length.  Therefore, implementations of BGP-AD must ignore NLRI
8651
                   that are greater than 12 bytes.
8652
                */
8653
566
                if(plen == 12) /* BGP-AD */
8654
302
                {
8655
302
                    proto_tree_add_item(tree, hf_bgp_bgpad_pe_addr, tvb, offset+10, 4, ENC_BIG_ENDIAN);
8656
302
                }else{ /* VPLS-BGP */
8657
8658
264
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_ce_id, tvb, offset+10, 2, ENC_BIG_ENDIAN);
8659
8660
264
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_offset, tvb, offset+12, 2, ENC_BIG_ENDIAN);
8661
264
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_size, tvb, offset+14, 2, ENC_BIG_ENDIAN);
8662
264
                    stack_strbuf = wmem_strbuf_create(pinfo->pool);
8663
264
                    decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
8664
264
                    proto_tree_add_string(tree, hf_bgp_vplsbgp_labelblock_base, tvb, offset+16, plen-14, wmem_strbuf_get_str(stack_strbuf));
8665
8666
264
                }
8667
                /* FIXME there are subTLVs left to decode ... for now lets omit them */
8668
566
                total_length = plen+2;
8669
566
                break;
8670
8671
21.2k
            case SAFNUM_EVPN:
8672
                /* Check for Add Path */
8673
21.2k
                if (tvb_get_uint8(tvb, offset + 4 ) <= EVPN_S_PMSI_A_D_ROUTE && tvb_get_uint8(tvb, offset ) == 0) {
8674
6.67k
                    proto_tree_add_item(tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8675
6.67k
                    offset += 4;
8676
6.67k
                    total_length = decode_evpn_nlri(tree, tvb, offset, pinfo) + 4;
8677
14.5k
                } else {
8678
14.5k
                     total_length = decode_evpn_nlri(tree, tvb, offset, pinfo);
8679
14.5k
                }
8680
21.2k
                break;
8681
8682
560
            default:
8683
560
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8684
560
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8685
560
                return -1;
8686
22.3k
        } /* switch (safi) */
8687
21.2k
        break;
8688
22.0k
    case AFNUM_BGP_LS:
8689
22.0k
        nlri_type = tvb_get_ntohs(tvb, offset);
8690
22.0k
        total_length = tvb_get_ntohs(tvb, offset + 2);
8691
22.0k
        length = total_length;
8692
22.0k
        total_length += 4;
8693
8694
22.0k
        if (safi == SAFNUM_BGP_LS || safi == SAFNUM_BGP_LS_VPN) {
8695
20.2k
            ti = proto_tree_add_item(tree, hf_bgp_ls_nlri, tvb, offset, total_length , ENC_NA);
8696
20.2k
        } else if (safi == SAFNUM_LAB_VPNUNICAST) {
8697
1.31k
            ti = proto_tree_add_item(tree, hf_bgp_ls_safi128_nlri, tvb, offset, total_length , ENC_NA);
8698
1.31k
        } else
8699
500
            return -1;
8700
8701
21.5k
        prefix_tree = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
8702
21.5k
        proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_type, tvb, offset, 2, ENC_BIG_ENDIAN);
8703
21.5k
        proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
8704
21.5k
        offset += 4;
8705
8706
        /* when SAFI 128, then write route distinguisher */
8707
21.5k
        if (safi == SAFNUM_LAB_VPNUNICAST) {
8708
1.31k
            if (length < BGP_ROUTE_DISTINGUISHER_SIZE) {
8709
725
                if (length == 0) {
8710
415
                    expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
8711
415
                                           "Unexpected end of SAFI 128 NLRI, Route Distinguisher field is required!");
8712
415
                }
8713
725
                if (length > 0) {
8714
310
                    expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
8715
310
                                           "Unexpected Route Distinguisher length (%u)!",
8716
310
                                           length);
8717
310
                }
8718
725
                break;
8719
725
            }
8720
594
            disting_item = proto_tree_add_item(prefix_tree, hf_bgp_ls_safi128_nlri_route_distinguisher,
8721
594
                                               tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
8722
594
            disting_tree = proto_item_add_subtree(disting_item, ett_bgp_mp_reach_nlri);
8723
594
            tmp16 = tvb_get_ntohs(tvb, offset);
8724
594
            proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_distinguisher_type,
8725
594
                                tvb, offset, 2, ENC_BIG_ENDIAN);
8726
            /* Route Distinguisher Type */
8727
594
            switch (tmp16) {
8728
108
            case 0:
8729
108
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
8730
108
                                    tvb, offset + 2, 2, ENC_BIG_ENDIAN);
8731
108
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
8732
108
                                    tvb, offset + 4, 4, ENC_BIG_ENDIAN);
8733
108
                break;
8734
8735
66
            case 1:
8736
66
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
8737
66
                                    tvb, offset + 2, 4, ENC_BIG_ENDIAN);
8738
66
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
8739
66
                                    tvb, offset + 6, 2, ENC_BIG_ENDIAN);
8740
66
                break;
8741
8742
71
            case 2:
8743
71
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
8744
71
                                    tvb, offset + 2, 4, ENC_BIG_ENDIAN);
8745
71
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
8746
71
                                    tvb, offset + 6, 2, ENC_BIG_ENDIAN);
8747
71
                break;
8748
8749
336
            default:
8750
336
                expert_add_info_format(pinfo, disting_tree, &ei_bgp_ls_error,
8751
336
                                       "Unknown Route Distinguisher type (%u)", tmp16);
8752
594
            }
8753
564
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
8754
564
            length -= BGP_ROUTE_DISTINGUISHER_SIZE;
8755
564
        }
8756
8757
20.8k
        switch (nlri_type) {
8758
3.70k
        case LINK_STATE_LINK_NLRI:
8759
8760
3.70k
            nlri_ti = proto_tree_add_item(prefix_tree,
8761
3.70k
                    hf_bgp_ls_nlri_link_nlri_type, tvb, offset, length,
8762
3.70k
                    ENC_NA);
8763
3.70k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8764
3.70k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8765
3.70k
                    offset, pinfo, length);
8766
3.70k
            if (tmp_length < 1)
8767
261
                return -1;
8768
8769
3.44k
            offset += tmp_length;
8770
3.44k
            length -= tmp_length;
8771
8772
            /* dissect Remote Node descriptors TLV */
8773
3.44k
            if (length > 0 && length < 4) {
8774
215
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8775
215
                        "Unknown data in Link-State Link NLRI!");
8776
215
                break;
8777
215
            }
8778
3.23k
            if (length < 1)
8779
861
                break;
8780
8781
2.37k
           tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, nlri_tree, offset,
8782
2.37k
                                                       pinfo, BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS);
8783
2.37k
           if (tmp_length < 1)
8784
0
               return -1;
8785
8786
2.37k
           offset += tmp_length;
8787
2.37k
           length -= tmp_length;
8788
8789
           /* dissect Link Descriptor NLRI */
8790
2.37k
           if (length > 0 && length < 4) {
8791
378
               expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8792
378
                       "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
8793
378
               break;
8794
378
           }
8795
1.99k
           if (length < 1)
8796
505
               break;
8797
8798
1.48k
           tmp_length = decode_bgp_link_nlri_link_descriptors(tvb, nlri_tree,
8799
1.48k
                   offset, pinfo, length);
8800
1.48k
           if (tmp_length < 1)
8801
750
               return -1;
8802
8803
738
           break;
8804
8805
738
       case LINK_STATE_NODE_NLRI:
8806
466
            nlri_ti = proto_tree_add_item(prefix_tree,
8807
466
                    hf_bgp_ls_nlri_node_nlri_type, tvb, offset, length,
8808
466
                    ENC_NA);
8809
466
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8810
466
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8811
466
                    offset, pinfo, length);
8812
466
            if (tmp_length < 1)
8813
251
                return -1;
8814
8815
215
            break;
8816
8817
1.48k
        case LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI:
8818
1.48k
            nlri_ti = proto_tree_add_item(prefix_tree,
8819
1.48k
                    hf_bgp_ls_ipv4_topology_prefix_nlri_type, tvb, offset, length,
8820
1.48k
                    ENC_NA);
8821
1.48k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8822
1.48k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8823
1.48k
                                                                 offset, pinfo, length);
8824
1.48k
            if (tmp_length < 1)
8825
179
                return -1;
8826
8827
1.30k
            offset += tmp_length;
8828
1.30k
            length -= tmp_length;
8829
8830
            /* dissect Prefix Descriptors NLRI */
8831
1.30k
            if (length > 0 && length < 4) {
8832
285
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8833
285
                        "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
8834
285
                break;
8835
285
            }
8836
1.02k
            if (length < 1)
8837
326
                break;
8838
8839
694
            tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
8840
694
                    offset, pinfo, length, IP_PROTO_IPV4);
8841
694
            if (tmp_length < 1)
8842
431
                return -1;
8843
8844
263
            break;
8845
8846
4.44k
        case LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI:
8847
4.44k
            nlri_ti = proto_tree_add_item(prefix_tree,
8848
4.44k
                    hf_bgp_ls_ipv6_topology_prefix_nlri_type, tvb, offset, length,
8849
4.44k
                    ENC_NA);
8850
4.44k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8851
4.44k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8852
4.44k
                    offset, pinfo, length);
8853
4.44k
            if (tmp_length < 1)
8854
194
                return -1;
8855
8856
4.25k
            offset += tmp_length;
8857
4.25k
            length -= tmp_length;
8858
8859
            /* dissect Prefix Descriptors NLRI */
8860
4.25k
            if (length > 0 && length < 4) {
8861
3.16k
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8862
3.16k
                        "Unknown data in Link-State Link NLRI!");
8863
3.16k
                break;
8864
3.16k
            }
8865
1.08k
            if (length < 1)
8866
403
                break;
8867
8868
684
            tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
8869
684
                    offset, pinfo, length, IP_PROTO_IPV6);
8870
684
            if (tmp_length < 1)
8871
284
                return -1;
8872
8873
400
            break;
8874
8875
3.89k
        case LINK_STATE_SRV6_SID_NLRI:
8876
3.89k
            nlri_ti = proto_tree_add_item(prefix_tree,
8877
3.89k
                    hf_bgp_ls_nlri_srv6_sid_nlri_type, tvb, offset, length,
8878
3.89k
                    ENC_NA);
8879
3.89k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8880
3.89k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8881
3.89k
                    offset, pinfo, length);
8882
3.89k
            if (tmp_length < 1)
8883
295
                return -1;
8884
8885
3.60k
            offset += tmp_length;
8886
3.60k
            length -= tmp_length;
8887
8888
            /* dissect SRv6 SID Descriptors NLRI */
8889
3.60k
            if (length > 0 && length < 4) {
8890
538
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8891
538
                        "Unknown data in Link-State SRv6 SID NLRI!");
8892
538
                break;
8893
538
            }
8894
3.06k
            if (length < 1)
8895
2.11k
                break;
8896
8897
951
            tmp_length = decode_bgp_link_nlri_srv6_sid_descriptors(tvb, nlri_tree,
8898
951
                    offset, pinfo, length);
8899
951
            if (tmp_length < 1)
8900
340
                return -1;
8901
8902
611
            break;
8903
8904
6.80k
        default:
8905
6.80k
            proto_tree_add_expert_format(tree, pinfo,  &ei_bgp_ls_error, tvb, start_offset, 0,
8906
6.80k
                                         "Unknown Link-State NLRI type (%u)", afi);
8907
8908
20.8k
        }
8909
17.4k
        break;
8910
8911
17.4k
        default:
8912
1.33k
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_afi, tvb, start_offset, 0,
8913
1.33k
                                         "Unknown AFI (%u) value", afi);
8914
1.33k
            return -1;
8915
400k
    } /* switch (afi) */
8916
377k
    return total_length;
8917
400k
}
8918
8919
/*
8920
 * Dissect a BGP capability.
8921
 */
8922
int
8923
dissect_bgp_capability_item(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, unsigned offset, bool action)
8924
9.38k
{
8925
9.38k
    proto_tree *cap_tree;
8926
9.38k
    proto_item *ti;
8927
9.38k
    proto_item *ti_len;
8928
9.38k
    uint8_t ctype;
8929
9.38k
    uint8_t clen;
8930
8931
9.38k
    ti = proto_tree_add_item(tree, hf_bgp_cap, tvb, offset, -1, ENC_NA);
8932
9.38k
    cap_tree = proto_item_add_subtree(ti, ett_bgp_cap);
8933
8934
9.38k
    proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_type, tvb, offset, 1, ENC_BIG_ENDIAN, &ctype);
8935
9.38k
    proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, ctype, capability_vals, "Unknown capability %d"));
8936
9.38k
    offset += 1;
8937
8938
9.38k
    ti_len = proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_length, tvb, offset, 1, ENC_BIG_ENDIAN, &clen);
8939
9.38k
    proto_item_set_len(ti, clen+2);
8940
9.38k
    offset += 1;
8941
8942
9.38k
    if(action){
8943
1.41k
        proto_tree_add_item(cap_tree, hf_bgp_cap_action, tvb, offset, 1, ENC_BIG_ENDIAN);
8944
1.41k
        proto_item_set_len(ti, clen+3);
8945
1.41k
        offset += 1;
8946
1.41k
    }
8947
8948
    /* check the capability type */
8949
9.38k
    switch (ctype) {
8950
962
        case BGP_CAPABILITY_RESERVED:
8951
962
            if (clen != 0) {
8952
311
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8953
311
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8954
311
            }
8955
962
            offset += clen;
8956
962
            break;
8957
425
        case BGP_CAPABILITY_MULTIPROTOCOL:
8958
425
            if (clen != 4) {
8959
230
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
8960
230
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8961
230
                offset += clen;
8962
230
            }
8963
195
            else {
8964
                /* AFI */
8965
195
                proto_tree_add_item(cap_tree, hf_bgp_cap_mp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8966
195
                offset += 2;
8967
8968
                /* Reserved */
8969
195
                proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
8970
195
                offset += 1;
8971
8972
                /* SAFI */
8973
195
                proto_tree_add_item(cap_tree, hf_bgp_cap_mp_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8974
195
                offset += 1;
8975
195
            }
8976
425
            break;
8977
609
        case BGP_CAPABILITY_EXTENDED_NEXT_HOP: {
8978
609
            unsigned eclen = offset + clen;
8979
934
                while (offset <= eclen - 6) {
8980
                    /* AFI */
8981
325
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8982
325
                    offset += 2;
8983
8984
                    /* SAFI */
8985
325
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_safi, tvb, offset, 2, ENC_BIG_ENDIAN);
8986
325
                    offset += 2;
8987
8988
                    /* AFI */
8989
325
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_nhafi, tvb, offset, 2, ENC_BIG_ENDIAN);
8990
325
                    offset += 2;
8991
325
                }
8992
609
                if (offset != eclen) {
8993
258
                    expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of 6", clen);
8994
258
                    proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, eclen - offset, ENC_NA);
8995
258
                    offset = eclen;
8996
258
                }
8997
609
            }
8998
609
            break;
8999
403
        case BGP_CAPABILITY_BGP_ROLE:
9000
403
            if (clen != 1) {
9001
209
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 1", clen);
9002
209
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9003
209
                offset += clen;
9004
209
            }
9005
194
            else {
9006
194
                proto_tree_add_item(cap_tree, hf_bgp_cap_role, tvb, offset, 1, ENC_BIG_ENDIAN);
9007
194
                offset += 1;
9008
194
            }
9009
403
            break;
9010
692
        case BGP_CAPABILITY_GRACEFUL_RESTART:
9011
692
            if ((clen < 6) && (clen != 2)) {
9012
270
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
9013
270
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9014
270
                offset += clen;
9015
270
            }
9016
422
            else {
9017
422
                unsigned eclen = offset + clen;
9018
9019
422
                static int * const timer_flags[] = {
9020
422
                    &hf_bgp_cap_gr_timers_restart_flag,
9021
422
                    &hf_bgp_cap_gr_timers_notification_flag,
9022
422
                    &hf_bgp_cap_gr_timers_restart_time,
9023
422
                    NULL
9024
422
                };
9025
9026
422
                if (clen == 2){
9027
262
                    expert_add_info(pinfo, ti_len, &ei_bgp_cap_gr_helper_mode_only);
9028
262
                }
9029
9030
                /* Timers */
9031
422
                proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_timers, ett_bgp_cap, timer_flags, ENC_BIG_ENDIAN);
9032
422
                offset += 2;
9033
9034
                /*
9035
                 * what follows is alist of AFI/SAFI/flag triplets
9036
                 * read it until the TLV ends
9037
                 */
9038
892
                while (offset < eclen) {
9039
470
                    static int * const flags[] = {
9040
470
                        &hf_bgp_cap_gr_flag_pfs,
9041
470
                        NULL
9042
470
                    };
9043
9044
                    /* AFI */
9045
470
                    proto_tree_add_item(cap_tree, hf_bgp_cap_gr_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
9046
470
                    offset += 2;
9047
9048
                    /* SAFI */
9049
470
                    proto_tree_add_item(cap_tree, hf_bgp_cap_gr_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
9050
470
                    offset += 1;
9051
9052
                    /* Flags */
9053
470
                    proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_flag, ett_bgp_cap, flags, ENC_BIG_ENDIAN);
9054
470
                    offset += 1;
9055
470
                }
9056
422
            }
9057
692
            break;
9058
424
        case BGP_CAPABILITY_4_OCTET_AS_NUMBER:
9059
424
            if (clen != 4) {
9060
230
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
9061
230
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9062
230
                offset += clen;
9063
230
            }
9064
194
            else {
9065
194
                proto_tree_add_item(cap_tree, hf_bgp_cap_4as, tvb, offset, 4, ENC_BIG_ENDIAN);
9066
194
                offset += 4;
9067
194
            }
9068
424
            break;
9069
410
        case BGP_CAPABILITY_DYNAMIC_CAPABILITY:
9070
410
            if (clen > 0) {
9071
215
                unsigned eclen = offset + clen;
9072
9073
630
                while (offset < eclen) {
9074
415
                    proto_tree_add_item(cap_tree, hf_bgp_cap_dc, tvb, offset, 1, ENC_BIG_ENDIAN);
9075
415
                    offset += 1;
9076
415
                }
9077
215
            }
9078
410
            break;
9079
622
        case BGP_CAPABILITY_ADDITIONAL_PATHS:
9080
622
            if (clen % 4 != 0) {
9081
195
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of  4", clen);
9082
195
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9083
195
                offset += clen;
9084
195
            }
9085
427
            else { /* AFI SAFI Send-receive*/
9086
427
                unsigned eclen = offset + clen;
9087
9088
838
                while (offset < eclen){
9089
                    /* AFI */
9090
411
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
9091
411
                    offset += 2;
9092
9093
                    /* SAFI */
9094
411
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
9095
411
                    offset += 1;
9096
9097
                    /* Send-Receive */
9098
411
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
9099
411
                    offset += 1;
9100
411
                }
9101
427
            }
9102
622
            break;
9103
9104
194
        case BGP_CAPABILITY_FQDN:{
9105
194
            uint8_t hostname_len, domain_name_len;
9106
9107
194
            proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_fqdn_hostname_len, tvb, offset, 1, ENC_NA, &hostname_len);
9108
194
            offset += 1;
9109
9110
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_hostname, tvb, offset, hostname_len, ENC_ASCII);
9111
194
            offset += hostname_len;
9112
9113
194
            proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_fqdn_domain_name_len, tvb, offset, 1, ENC_NA, &domain_name_len);
9114
194
            offset += 1;
9115
9116
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_domain_name, tvb, offset, domain_name_len, ENC_ASCII);
9117
194
            offset += domain_name_len;
9118
9119
194
            }
9120
194
            break;
9121
9122
196
        case BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP:
9123
392
        case BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH:
9124
626
        case BGP_CAPABILITY_ROUTE_REFRESH_CISCO:
9125
1.24k
        case BGP_CAPABILITY_ROUTE_REFRESH:
9126
1.44k
        case BGP_CAPABILITY_CP_ORF:
9127
1.44k
            if (clen != 0) {
9128
220
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
9129
220
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9130
220
            }
9131
1.44k
            offset += clen;
9132
1.44k
            break;
9133
208
        case BGP_CAPABILITY_ORF_CISCO:
9134
692
        case BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING:
9135
692
            if (clen < 6) {
9136
409
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
9137
409
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9138
409
                offset += clen;
9139
409
            }
9140
283
            else {
9141
283
                uint8_t orfnum;       /* number of ORFs */
9142
283
                int i;
9143
                /* AFI */
9144
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
9145
283
                offset += 2;
9146
9147
                /* Reserved */
9148
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
9149
283
                offset += 1;
9150
9151
                /* SAFI */
9152
283
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
9153
283
                offset += 1;
9154
9155
                /* Number of ORFs */
9156
283
                proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_orf_number, tvb, offset, 1, ENC_BIG_ENDIAN, &orfnum);
9157
283
                offset += 1;
9158
703
                for (i=0; i<orfnum; i++) {
9159
                    /* ORF Type */
9160
420
                    proto_tree_add_item(cap_tree, hf_bgp_cap_orf_type, tvb, offset, 1, ENC_BIG_ENDIAN);
9161
420
                    offset += 1;
9162
9163
                    /* Send/Receive */
9164
420
                    proto_tree_add_item(cap_tree, hf_bgp_cap_orf_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
9165
420
                    offset += 1;
9166
420
                }
9167
283
            }
9168
9169
692
            break;
9170
593
        case BGP_CAPABILITY_MULTISESSION_CISCO:
9171
593
            if (clen < 1) {
9172
372
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 1", clen);
9173
372
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9174
372
                offset += clen;
9175
372
            }
9176
221
            else {
9177
221
                proto_tree_add_item(cap_tree, hf_bgp_cap_multisession_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
9178
221
                offset += 1;
9179
221
            }
9180
9181
593
            break;
9182
470
        case BGP_CAPABILITY_BGPSEC:
9183
470
            if (clen != 3) {
9184
257
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 3", clen);
9185
257
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9186
257
                offset += clen;
9187
257
            }
9188
213
            else {
9189
213
                static int * const bgpsec_flags[] = {
9190
213
                    &hf_bgp_cap_bgpsec_version,
9191
213
                    &hf_bgp_cap_bgpsec_sendreceive,
9192
213
                    &hf_bgp_cap_bgpsec_reserved,
9193
213
                    NULL
9194
213
                };
9195
9196
                /* BGPsec Flags */
9197
213
                proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_bgpsec_flags, ett_bgp_cap, bgpsec_flags, ENC_BIG_ENDIAN);
9198
213
                offset += 1;
9199
9200
                /* BGPsec AFI */
9201
213
                proto_tree_add_item(cap_tree, hf_bgp_cap_bgpsec_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
9202
213
                offset += 2;
9203
213
            }
9204
9205
470
            break;
9206
9207
422
        case BGP_CAPABILITY_BFD_STRICT:
9208
422
            if (clen != 0) {
9209
197
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
9210
197
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9211
197
            }
9212
422
            offset += clen;
9213
422
            break;
9214
196
        case BGP_CAPABILITY_SOFT_VERSION:{
9215
196
            uint8_t soft_version_len;
9216
9217
196
            proto_tree_add_item_ret_uint8(cap_tree, hf_bgp_cap_soft_version_len, tvb, offset, 1, ENC_NA, &soft_version_len);
9218
196
            offset += 1;
9219
9220
196
            proto_tree_add_item(cap_tree, hf_bgp_cap_soft_version, tvb, offset, soft_version_len, ENC_ASCII);
9221
196
            offset += soft_version_len;
9222
196
            }
9223
196
            break;
9224
            /* unknown capability */
9225
573
        default:
9226
573
            if (clen != 0) {
9227
264
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
9228
264
            }
9229
573
            offset += clen;
9230
573
            break;
9231
9.38k
    } /* switch (ctype) */
9232
8.84k
    return offset;
9233
9.38k
}
9234
9235
/*
9236
 * Dissect a BGP OPEN message.
9237
 */
9238
9239
static void
9240
dissect_bgp_open(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
9241
636
{
9242
636
    uint16_t        optlen;    /* Option Length */
9243
636
    int             ptype;     /* parameter type        */
9244
636
    int             plen;      /* parameter length      */
9245
636
    int             cend;      /* capabilities end      */
9246
636
    int             oend;      /* options end           */
9247
636
    int             offset;    /* tvb offset counter    */
9248
636
    uint32_t        as_num;    /* AS Number             */
9249
636
    proto_item      *ti;       /* tree item             */
9250
636
    proto_tree      *opt_tree;  /* subtree for options   */
9251
636
    proto_tree      *par_tree;  /* subtree for par options   */
9252
636
    proto_tree      *opt_extension_tree;  /* subtree for par options   */
9253
9254
636
    offset = BGP_MARKER_SIZE + 2 + 1;
9255
9256
636
    proto_tree_add_item(tree, hf_bgp_open_version, tvb, offset, 1, ENC_BIG_ENDIAN);
9257
636
    offset += 1;
9258
9259
636
    ti = proto_tree_add_item_ret_uint(tree, hf_bgp_open_myas, tvb, offset, 2, ENC_BIG_ENDIAN, &as_num);
9260
636
    if (as_num == BGP_AS_TRANS) {
9261
34
        proto_item_append_text(ti, " (AS_TRANS)");
9262
34
    }
9263
636
    offset += 2;
9264
9265
636
    proto_tree_add_item(tree, hf_bgp_open_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN);
9266
636
    offset += 2;
9267
9268
636
    proto_tree_add_item(tree, hf_bgp_open_identifier, tvb, offset, 4, ENC_BIG_ENDIAN);
9269
636
    offset += 4;
9270
9271
636
    proto_tree_add_item_ret_uint16(tree, hf_bgp_open_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN, &optlen);
9272
636
    offset += 1;
9273
9274
    /* optional parameters */
9275
636
    if (optlen > 0) {
9276
288
        ptype = tvb_get_uint8(tvb, offset);
9277
288
        if (ptype == BGP_OPTION_EXTENDED_LEN) {  /* Extended Length covered by RFC9072 */
9278
81
            optlen = tvb_get_uint16(tvb, offset+1, ENC_BIG_ENDIAN);
9279
9280
81
            ti =  proto_tree_add_item(tree, hf_bgp_open_opt_extension, tvb, offset, 3, ENC_NA);
9281
81
            opt_extension_tree = proto_item_add_subtree(ti, ett_bgp_options_ext);
9282
81
            proto_tree_add_item(opt_extension_tree, hf_bgp_open_opt_extension_mark, tvb, offset, 1, ENC_NA);
9283
81
            proto_tree_add_item(opt_extension_tree, hf_bgp_open_opt_extension_len, tvb, offset +1, 2, ENC_BIG_ENDIAN);
9284
9285
81
            oend = offset + 3 + optlen;
9286
81
            offset += 3;
9287
207
        } else {
9288
207
            oend = offset + optlen;
9289
207
        }
9290
9291
        /* add a subtree */
9292
288
        ti = proto_tree_add_item(tree, hf_bgp_open_opt_params, tvb, offset, optlen, ENC_NA);
9293
288
        opt_tree = proto_item_add_subtree(ti, ett_bgp_options);
9294
9295
        /* step through all of the optional parameters */
9296
1.28k
        while (offset < oend) {
9297
9298
            /* add a subtree */
9299
1.14k
            ti = proto_tree_add_item(opt_tree, hf_bgp_open_opt_param, tvb, offset, -1, ENC_NA);
9300
1.14k
            par_tree = proto_item_add_subtree(ti, ett_bgp_options);
9301
9302
            /* display and grab the type ... */
9303
1.14k
            proto_tree_add_item(par_tree, hf_bgp_open_opt_param_type, tvb, offset, 1, ENC_BIG_ENDIAN);
9304
1.14k
            ptype = tvb_get_uint8(tvb, offset);
9305
1.14k
            proto_item_append_text(ti, ": %s", val_to_str(pinfo->pool, ptype, bgp_open_opt_vals, "Unknown Parameter %d"));
9306
1.14k
            offset += 1;
9307
9308
            /* ... and length */
9309
1.14k
            proto_tree_add_item(par_tree, hf_bgp_open_opt_param_len, tvb, offset, 1, ENC_BIG_ENDIAN);
9310
1.14k
            plen = tvb_get_uint8(tvb, offset);
9311
1.14k
            proto_item_set_len(ti, plen+2);
9312
1.14k
            offset += 1;
9313
9314
            /* check the type */
9315
1.14k
            switch (ptype) {
9316
254
                case BGP_OPTION_AUTHENTICATION:
9317
254
                    proto_tree_add_item(par_tree, hf_bgp_open_opt_param_auth, tvb, offset, plen, ENC_NA);
9318
254
                    offset += plen;
9319
254
                    break;
9320
536
                case BGP_OPTION_CAPABILITY:
9321
                    /* grab the capability code */
9322
536
                    cend = offset + plen;
9323
9324
                    /* step through all of the capabilities */
9325
1.14k
                    while (offset < cend) {
9326
604
                        offset = dissect_bgp_capability_item(tvb, par_tree, pinfo, offset, false);
9327
604
                    }
9328
536
                    break;
9329
253
                default:
9330
253
                    proto_tree_add_item(opt_tree, hf_bgp_open_opt_param_unknown, tvb, offset, plen, ENC_NA);
9331
253
                    break;
9332
1.14k
            } /* switch (ptype) */
9333
1.14k
        }
9334
288
    }
9335
636
}
9336
9337
/*
9338
 * Heuristic for auto-detection of ASN length 2 or 4 bytes
9339
 */
9340
9341
static uint8_t
9342
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)
9343
2.94k
{
9344
2.94k
    int counter_as_segment=0;
9345
2.94k
    unsigned offset_check=0;
9346
2.94k
    uint8_t assumed_as_len=0;
9347
2.94k
    int asn_is_null=0;
9348
2.94k
    unsigned j=0;
9349
2.94k
    unsigned k=0;
9350
2.94k
    unsigned k_save=0;
9351
2.94k
    uint8_t next_type=0;
9352
2.94k
    uint8_t length=0;
9353
    /* Heuristic is done in two phases
9354
     * First we try to identify the as length (2 or 4 bytes)
9355
     * then we do check that our assumption is ok
9356
     * recalculating the offset and checking we end up with the right result
9357
    * k is used to navigate into the AS_PATH */
9358
2.94k
    k = as_path_offset;
9359
    /* case of AS_PATH type being explicitly 4 bytes ASN */
9360
2.94k
    if (bgpa_type == BGPTYPE_AS4_PATH) {
9361
        /* We calculate numbers of segments and return the as length */
9362
799
        assumed_as_len = 4;
9363
3.29k
        while (k < end_attr_offset)
9364
2.49k
        {
9365
            /* we skip segment type and point to length */
9366
2.49k
            k++;
9367
2.49k
            length = tvb_get_uint8(tvb, k);
9368
            /* length read let's move to first ASN */
9369
2.49k
            k++;
9370
            /* we move to the next segment */
9371
2.49k
            k = k + (length*assumed_as_len);
9372
2.49k
            counter_as_segment++;
9373
2.49k
        }
9374
799
        *number_as_segment = counter_as_segment;
9375
799
        return 4;
9376
799
    }
9377
    /* case of user specified ASN length */
9378
2.14k
    if (bgp_asn_len != 0) {
9379
        /* We calculate numbers of segments and return the as length */
9380
0
        assumed_as_len = bgp_asn_len;
9381
0
        while (k < end_attr_offset)
9382
0
        {
9383
            /* we skip segment type and point to length */
9384
0
            k++;
9385
0
            length = tvb_get_uint8(tvb, k);
9386
            /* length read let's move to first ASN */
9387
0
            k++;
9388
            /* we move to the next segment */
9389
0
            k = k + (length*assumed_as_len);
9390
            /* if I am not facing the last segment k need to point to next length */
9391
0
            counter_as_segment++;
9392
0
        }
9393
0
        *number_as_segment = counter_as_segment;
9394
0
        return bgp_asn_len;
9395
0
    }
9396
    /* case of a empty path attribute */
9397
2.14k
    if (as_path_offset == end_attr_offset)
9398
564
    {
9399
564
        *number_as_segment = 0;
9400
564
        return bgp_asn_len;
9401
564
    }
9402
    /* case of we run the heuristic to find the as length */
9403
1.58k
    k_save = k;
9404
    /* we do run the heuristic on first segment and look at next segment if it exists */
9405
1.58k
    k++;
9406
1.58k
    length = tvb_get_uint8(tvb, k++);
9407
    /* let's do some checking with an as length 2 bytes */
9408
1.58k
    offset_check = k + 2*length;
9409
1.58k
    next_type = tvb_get_uint8(tvb, offset_check);
9410
    /* we do have one segment made of 2 bytes ASN we do reach the end of the attribute taking
9411
     * 2 bytes ASN for our calculation */
9412
1.58k
    if (offset_check == end_attr_offset)
9413
230
        assumed_as_len = 2;
9414
    /* else we do check if we see a valid AS segment type after (length * AS 2 bytes) */
9415
1.35k
    else if (next_type == AS_SET ||
9416
1.00k
            next_type == AS_SEQUENCE ||
9417
700
            next_type == AS_CONFED_SEQUENCE ||
9418
937
            next_type == AS_CONFED_SET) {
9419
        /* 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 */
9420
3.03k
            for (j=0; j < length && !asn_is_null; j++) {
9421
2.10k
                if(tvb_get_ntohs(tvb, k+(2*j)) == 0) {
9422
87
                    asn_is_null = 1;
9423
87
                }
9424
2.10k
            }
9425
937
            if (asn_is_null == 0)
9426
850
                assumed_as_len = 2;
9427
87
            else
9428
87
                assumed_as_len = 4;
9429
937
        }
9430
415
    else
9431
    /* we didn't find a valid AS segment type in the next coming segment assuming 2 bytes ASN */
9432
415
        assumed_as_len = 4;
9433
    /* now that we have our assumed as length let's check we can calculate the attribute length properly */
9434
1.58k
    k = k_save;
9435
4.20k
    while (k < end_attr_offset)
9436
2.62k
    {
9437
        /* we skip the AS type */
9438
2.62k
        k++;
9439
        /* we get the length of the AS segment */
9440
2.62k
        length = tvb_get_uint8(tvb, k);
9441
        /* let's point to the first byte of the AS segment */
9442
2.62k
        k++;
9443
        /* we move to the next segment */
9444
2.62k
        k = k + (length*assumed_as_len);
9445
2.62k
        counter_as_segment++;
9446
2.62k
    }
9447
1.58k
    if (k == end_attr_offset) {
9448
    /* success */
9449
321
        *number_as_segment = counter_as_segment;
9450
321
        return assumed_as_len;
9451
321
    } else
9452
    /* we are in trouble */
9453
1.26k
    return -1;
9454
1.58k
}
9455
9456
/*
9457
 * Dissect BGP update extended communities
9458
 */
9459
9460
static int
9461
dissect_bgp_update_ext_com(proto_tree *parent_tree, tvbuff_t *tvb, uint16_t tlen, unsigned tvb_off, packet_info *pinfo)
9462
1.22k
{
9463
1.22k
    int             offset=0;
9464
1.22k
    int             end=0;
9465
1.22k
    uint8_t         com_type_high_byte;
9466
1.22k
    uint8_t         com_stype_low_byte;
9467
1.22k
    proto_tree      *communities_tree;
9468
1.22k
    proto_tree      *community_tree;
9469
1.22k
    proto_tree      *community_type_tree;
9470
1.22k
    proto_item      *communities_item=NULL;
9471
1.22k
    proto_item      *community_item=NULL;
9472
1.22k
    proto_item      *community_type_item=NULL;
9473
1.22k
    uint32_t        encaps_tunnel_type;
9474
1.22k
    afi_safi_data   *data = NULL;
9475
9476
1.22k
    offset = tvb_off ;
9477
1.22k
    end = tvb_off + tlen ;
9478
1.22k
    communities_item = proto_tree_add_item(parent_tree, hf_bgp_ext_communities, tvb, offset, tlen, ENC_NA);
9479
1.22k
    communities_tree = proto_item_add_subtree(communities_item, ett_bgp_extended_communities);
9480
1.22k
    proto_item_append_text(communities_item, ": (%u communit%s)", tlen/8, plurality(tlen/8, "y", "ies"));
9481
5.83k
    while (offset < end) {
9482
5.28k
        com_type_high_byte = tvb_get_uint8(tvb,offset); /* high community type octet */
9483
5.28k
        com_stype_low_byte = tvb_get_uint8(tvb,offset+1); /* sub type low community type octet */
9484
5.28k
        community_item = proto_tree_add_item(communities_tree, hf_bgp_ext_community, tvb, offset, 8, ENC_NA);
9485
5.28k
        community_tree = proto_item_add_subtree(community_item,ett_bgp_extended_community);
9486
9487
        /* Add the Type octet as a decoded item to the community_tree right away,
9488
         * and also dissect its two top bits in a subtree.
9489
         */
9490
9491
5.28k
        community_type_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_type_high, tvb, offset, 1, ENC_BIG_ENDIAN);
9492
5.28k
        community_type_tree = proto_item_add_subtree(community_type_item, ett_bgp_ext_com_type);
9493
5.28k
        proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_auth, tvb, offset, 1, ENC_BIG_ENDIAN);
9494
5.28k
        proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_tran, tvb, offset, 1, ENC_BIG_ENDIAN);
9495
9496
        /* In the switch(), handlers of individual types and subtypes should
9497
         * add and dissect the remaining 7 octets. Dissectors should use the
9498
         * proto_item_set_text() on the community_item to set the community
9499
         * name in the displayed label as specifically as possible, and
9500
         * proto_item_append_text() to add reasonable details.
9501
         *
9502
         * The intended text label of the community_item for each extended
9503
         * community attribute is:
9504
         *
9505
         * Community Name: Values [General Community Type Name]
9506
         *
9507
         * For example:
9508
         * Route Target: 1:1 [Transitive 2-Octet AS-Specific]
9509
         * Unknown subtype 0x01: 0x8081 0x0000 0x2800 [Non-Transitive Opaque]
9510
         * Unknown type 0x88 subtype 0x00: 0x0000 0x0000 0x0000 [Unknown community]
9511
         *
9512
         * The [] part with general community name is added at the end
9513
         * of the switch().
9514
         *
9515
         * The first option (Route Target) shows a fully recognized and
9516
         * dissected extended community. Note that the line immediately calls
9517
         * the community by its most specific known type (Route Target), while
9518
         * the general type is shown in the brackets. The second option shows a
9519
         * community whose Type is recognized (Non-Transitive Opaque) but whose
9520
         * Subtype is not known. The third option shows an unrecognized
9521
         * extended community.
9522
         *
9523
         * Printing out the community raw value as 3 short ints is intentional:
9524
         * With an unknown community, we cannot assume any particular internal
9525
         * value format, and dumping the value in short ints provides for easy
9526
         * readability.
9527
         */
9528
9529
5.28k
        switch (com_type_high_byte) {
9530
465
            case BGP_EXT_COM_TYPE_HIGH_TR_AS2: /* Transitive Two-Octet AS-Specific Extended Community */
9531
9532
465
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9533
465
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9534
465
                data = load_afi_safi_data(pinfo);
9535
9536
465
                if(data && data->afi == AFNUM_AFI_FOR_L2VPN_INFORMATION && data->safi == SAFNUM_EVPN) {
9537
132
                        static int * const local_admin_flags[] = {
9538
132
                            &hf_bgp_ext_com_local_admin_auto_derived_flag,
9539
132
                            &hf_bgp_ext_com_local_admin_type,
9540
132
                            &hf_bgp_ext_com_local_admin_domain_id,
9541
132
                            NULL
9542
132
                        };
9543
132
                        proto_tree_add_bitmask(community_tree, tvb, offset+4, hf_bgp_ext_com_local_admin_flags,
9544
132
                                ett_bgp_vxlan, local_admin_flags, ENC_BIG_ENDIAN);
9545
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_local_admin_service_id, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9546
333
                } else {
9547
333
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9548
333
                }
9549
9550
465
                proto_item_set_text(community_item, "%s: %u:%u",
9551
465
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_as2, "Unknown subtype 0x%02x"),
9552
465
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9553
465
                break;
9554
9555
146
            case BGP_EXT_COM_TYPE_HIGH_NTR_AS2: /* Non-Transitive Two-Octet AS-Specific Extended Community */
9556
146
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9557
146
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9558
9559
146
                proto_item_set_text(community_item, "%s:",
9560
146
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_as2, "Unknown subtype 0x%02x"));
9561
9562
146
                switch (com_stype_low_byte) {
9563
67
                    case BGP_EXT_COM_STYPE_AS2_LBW:
9564
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_link_bw, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9565
9566
67
                        proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
9567
67
                                tvb_get_ntohs(tvb,offset+2),
9568
67
                                tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
9569
67
                        break;
9570
9571
79
                    default:
9572
79
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9573
9574
79
                        proto_item_append_text(community_item, " %u:%u",
9575
79
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
9576
79
                    break;
9577
146
                }
9578
124
                break;
9579
9580
232
            case BGP_EXT_COM_TYPE_HIGH_TR_IP4: /* Transitive IPv4-Address-specific Extended Community */
9581
232
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9582
9583
232
                proto_item_set_text(community_item, "%s: %s:%u",
9584
232
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_IP4, "Unknown subtype 0x%02x"),
9585
232
                        tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9586
9587
232
                switch(com_stype_low_byte) {
9588
66
                    case BGP_EXT_COM_STYPE_IP4_OSPF_RID:
9589
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9590
66
                        break;
9591
9592
91
                    default:
9593
91
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9594
91
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9595
91
                        break;
9596
232
                }
9597
157
                break;
9598
9599
157
            case BGP_EXT_COM_TYPE_HIGH_NTR_IP4: /* Non-Transitive IPv4-Address-specific Extended Community */
9600
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9601
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9602
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9603
9604
66
                proto_item_set_text(community_item, "%s: %s:%u",
9605
66
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_IP4, "Unknown subtype 0x%02x"),
9606
66
                        tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9607
66
                break;
9608
9609
92
            case BGP_EXT_COM_TYPE_HIGH_TR_AS4: /* Transitive Four-Octet AS-Specific Extended Community */
9610
92
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9611
92
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9612
92
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9613
9614
92
                proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
9615
92
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_as4, "Unknown subtype 0x%02x"),
9616
92
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
9617
92
                        tvb_get_ntohs(tvb,offset+6));
9618
92
                break;
9619
9620
66
            case BGP_EXT_COM_TYPE_HIGH_NTR_AS4: /* Non-Transitive Four-Octet AS-Specific Extended Community */
9621
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9622
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9623
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9624
9625
66
                proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
9626
66
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_as4, "Unknown subtype 0x%02x"),
9627
66
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
9628
66
                        tvb_get_ntohs(tvb,offset+6));
9629
66
                break;
9630
9631
522
            case BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE: /* Transitive Opaque Extended Community */
9632
522
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9633
9634
522
                proto_item_set_text(community_item, "%s:",
9635
522
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_opaque, "Unknown subtype 0x%02x"));
9636
9637
522
                switch(com_stype_low_byte) {
9638
71
                    case BGP_EXT_COM_STYPE_OPA_COST:
9639
71
                        {
9640
71
                        proto_item *cost_com_item;
9641
71
                        proto_tree *cost_com_cid_tree;
9642
9643
71
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9644
71
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9645
71
                        cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
9646
71
                        proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9647
71
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
9648
71
                            offset+4, 4, ENC_BIG_ENDIAN);
9649
71
                        proto_item_append_text(cost_com_item, " (%s)",
9650
71
                            tfs_get_string(tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
9651
9652
71
                        proto_item_append_text(community_item, " %u, POI: %s (%s)",
9653
71
                                tvb_get_ntohl(tvb, offset+4),
9654
71
                                val_to_str(pinfo->pool, tvb_get_uint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
9655
71
                                (tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
9656
71
                        }
9657
71
                        break;
9658
9659
67
                    case BGP_EXT_COM_STYPE_OPA_OSPF_RT:
9660
67
                        {
9661
67
                        proto_item *ospf_rt_opt_item;
9662
67
                        proto_tree *ospf_rt_opt_tree;
9663
9664
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9665
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9666
67
                        ospf_rt_opt_item = proto_tree_add_item(community_tree,
9667
67
                                hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9668
67
                        ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
9669
67
                        proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
9670
67
                                tvb, offset+7, 1, ENC_BIG_ENDIAN);
9671
67
                        proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
9672
67
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
9673
9674
67
                        proto_item_append_text(community_item, " Area: %s, Type: %s",
9675
67
                                tvb_ip_to_str(pinfo->pool, tvb,offset+2),
9676
67
                                val_to_str_const(tvb_get_uint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
9677
67
                        }
9678
67
                        break;
9679
9680
304
                    case BGP_EXT_COM_STYPE_OPA_ENCAP:
9681
                        /* Community octets 2 through 5 are reserved and carry no useful value according to RFC 5512. */
9682
304
                        proto_tree_add_item_ret_uint(community_tree, hf_bgp_ext_com_tunnel_type, tvb, offset+6, 2, ENC_BIG_ENDIAN, &encaps_tunnel_type);
9683
304
                        save_path_attr_encaps_tunnel_type(pinfo, encaps_tunnel_type);
9684
9685
304
                        proto_item_append_text(community_item, " %s",
9686
304
                                val_to_str_const(tvb_get_ntohs(tvb,offset+6), bgpext_com_tunnel_type, "Unknown"));
9687
304
                        break;
9688
9689
2
                    case BGP_EXT_COM_STYPE_OPA_COLOR:
9690
3
                    case BGP_EXT_COM_STYPE_OPA_DGTW:
9691
80
                    default:
9692
                        /* The particular Opaque subtype is unknown or the
9693
                         * dissector is not written yet. We will dump the
9694
                         * entire community value in 2-byte short words.
9695
                         */
9696
80
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9697
80
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9698
80
                                tvb_get_ntohs(tvb,offset+2),
9699
80
                                tvb_get_ntohs(tvb,offset+4),
9700
80
                                tvb_get_ntohs(tvb,offset+6));
9701
9702
80
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9703
80
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9704
80
                        break;
9705
522
                }
9706
501
                break;
9707
9708
501
            case BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE: /* Non-Transitive Opaque Extended Community */
9709
147
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9710
9711
147
                proto_item_set_text(community_item, "%s:",
9712
147
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_ntr_opaque, "Unknown subtype 0x%02x"));
9713
9714
147
                switch(com_stype_low_byte) {
9715
75
                    case BGP_EXT_COM_STYPE_OPA_COST:
9716
75
                        {
9717
75
                        proto_item *cost_com_item;
9718
75
                        proto_tree *cost_com_cid_tree;
9719
9720
75
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9721
75
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9722
75
                        cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
9723
75
                        proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9724
75
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
9725
75
                            offset+4, 4, ENC_BIG_ENDIAN);
9726
75
                        proto_item_append_text(cost_com_item, " (%s)",
9727
75
                            tfs_get_string(tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
9728
9729
75
                        proto_item_append_text(community_item, " %u, POI: %s (%s)",
9730
75
                                tvb_get_ntohl(tvb, offset+4),
9731
75
                                val_to_str(pinfo->pool, tvb_get_uint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
9732
75
                                (tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
9733
75
                        }
9734
75
                        break;
9735
9736
72
                    default:
9737
                            /* The particular Opaque subtype is unknown or the
9738
                             * dissector is not written yet. We will dump the
9739
                             * entire community value in 2-byte short words.
9740
                             */
9741
72
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9742
72
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9743
72
                                tvb_get_ntohs(tvb,offset+2),
9744
72
                                tvb_get_ntohs(tvb,offset+4),
9745
72
                                tvb_get_ntohs(tvb,offset+6));
9746
9747
72
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9748
72
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9749
72
                        break;
9750
147
                }
9751
128
                break;
9752
9753
128
            case BGP_EXT_COM_TYPE_HIGH_TR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
9754
143
            case BGP_EXT_COM_TYPE_HIGH_NTR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
9755
143
                {
9756
143
                static int * const qos_flags[] = {
9757
143
                    &hf_bgp_ext_com_qos_flags_remarking,
9758
143
                    &hf_bgp_ext_com_qos_flags_ignore_remarking,
9759
143
                    &hf_bgp_ext_com_qos_flags_agg_marking,
9760
143
                    NULL
9761
143
                };
9762
9763
143
                proto_item_set_text(community_item, "QoS Marking");
9764
9765
143
                proto_tree_add_bitmask(community_tree, tvb, offset, hf_bgp_ext_com_qos_flags,
9766
143
                        ett_bgp_ext_com_flags, qos_flags, ENC_BIG_ENDIAN);
9767
9768
143
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_set_number, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9769
143
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_tech_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9770
143
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_o, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9771
143
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_a, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9772
143
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_default_to_zero, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9773
143
                }
9774
143
                break;
9775
9776
107
            case BGP_EXT_COM_TYPE_HIGH_TR_COS: /* CoS Capability [Thomas_Martin_Knoll] */
9777
107
                {
9778
107
                int i;
9779
9780
107
                proto_item_set_text(community_item, "CoS Capability");
9781
9782
804
                for (i=1; i < 8; i++) {
9783
697
                    static int * const cos_flags[] = {
9784
697
                        &hf_bgp_ext_com_cos_flags_be,
9785
697
                        &hf_bgp_ext_com_cos_flags_ef,
9786
697
                        &hf_bgp_ext_com_cos_flags_af,
9787
697
                        &hf_bgp_ext_com_cos_flags_le,
9788
697
                        NULL
9789
697
                    };
9790
9791
697
                    proto_tree_add_bitmask(community_tree, tvb, offset+i, hf_bgp_ext_com_cos_flags,
9792
697
                            ett_bgp_ext_com_flags, cos_flags, ENC_BIG_ENDIAN);
9793
697
                }
9794
107
                }
9795
107
                break;
9796
9797
504
            case BGP_EXT_COM_TYPE_HIGH_TR_EVPN: /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
9798
504
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_evpn, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9799
9800
504
                proto_item_set_text(community_item, "%s:",
9801
504
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_evpn, "Unknown subtype 0x%02x"));
9802
9803
504
                switch (com_stype_low_byte) {
9804
68
                    case BGP_EXT_COM_STYPE_EVPN_MMAC:
9805
68
                        {
9806
68
                        proto_tree *evpn_mmac_flag_tree;
9807
68
                        proto_item *evpn_mmac_flag_item;
9808
9809
68
                        evpn_mmac_flag_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9810
68
                        evpn_mmac_flag_tree = proto_item_add_subtree(evpn_mmac_flag_item, ett_bgp_ext_com_evpn_mmac_flags);
9811
68
                        proto_tree_add_item (evpn_mmac_flag_tree, hf_bgp_ext_com_evpn_mmac_flag_sticky, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9812
                        /* Octet at offset 3 is reserved per RFC 7432 Section 7.7 */
9813
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_seq, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9814
9815
68
                        proto_item_append_text(community_item, " %s MAC",
9816
68
                          (tvb_get_uint8(tvb,offset+2) & BGP_EXT_COM_EVPN_MMAC_STICKY) ? "Sticky" : "Movable");
9817
68
                        }
9818
68
                        break;
9819
9820
69
                    case BGP_EXT_COM_STYPE_EVPN_LABEL:
9821
69
                        {
9822
69
                        proto_item *ti;
9823
9824
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_esi_label_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9825
                        /* Octets at offsets 3 and 4 are reserved perf RFC 7432 Section 7.5 */
9826
69
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9827
69
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9828
69
                        proto_item_set_generated(ti);
9829
69
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9830
69
                        proto_item_set_generated(ti);
9831
69
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9832
69
                        proto_item_set_generated(ti);
9833
9834
69
                        proto_item_append_text(community_item, " %s, Label: %u",
9835
69
                                tfs_get_string(tvb_get_uint8(tvb, offset+2) & BGP_EXT_COM_ESI_LABEL_FLAGS, &tfs_esi_label_flag),
9836
69
                                tvb_get_ntoh24(tvb,offset+5) >> 4);
9837
69
                        }
9838
69
                        break;
9839
9840
75
                    case BGP_EXT_COM_STYPE_EVPN_IMP:
9841
75
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_esirt, tvb, offset+2, 6, ENC_NA);
9842
9843
75
                        proto_item_append_text(community_item, " RT: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
9844
75
                        break;
9845
9846
91
                    case BGP_EXT_COM_STYPE_EVPN_ROUTERMAC:
9847
91
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_routermac, tvb, offset+2, 6, ENC_NA);
9848
9849
91
                        proto_item_append_text(community_item, " Router's MAC: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
9850
91
                        break;
9851
9852
67
                    case BGP_EXT_COM_STYPE_EVPN_L2ATTR:
9853
67
                        {
9854
67
                        static int * const l2attr_flags[] = {
9855
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
9856
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_ci,
9857
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_f,
9858
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_c,
9859
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_p,
9860
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_b,
9861
67
                            NULL
9862
67
                        };
9863
9864
67
                        proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_l2attr_flags,
9865
67
                            ett_bgp_ext_com_evpn_l2attr_flags, l2attr_flags, ENC_BIG_ENDIAN);
9866
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9867
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_reserved, tvb, offset+6, 2, ENC_NA);
9868
9869
67
                        proto_item_append_text(community_item, " flags: 0x%04x, L2 MTU: %u", tvb_get_ntohs(tvb, offset+2), tvb_get_ntohs(tvb, offset+4));
9870
67
                        }
9871
67
                        break;
9872
9873
67
                    case BGP_EXT_COM_STYPE_EVPN_ETREE:
9874
67
                        {
9875
67
                        static int * const etree_flags[] = {
9876
67
                            &hf_bgp_ext_com_evpn_etree_flag_reserved,
9877
67
                            &hf_bgp_ext_com_evpn_etree_flag_l,
9878
67
                            NULL
9879
67
                        };
9880
9881
67
                        proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_etree_flags,
9882
67
                            ett_bgp_ext_com_evpn_etree_flags, etree_flags, ENC_BIG_ENDIAN);
9883
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_etree_reserved, tvb, offset+3, 2, ENC_NA);
9884
9885
67
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9886
67
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9887
67
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9888
67
                        }
9889
67
                        break;
9890
9891
67
                    default:
9892
                        /* The particular EVPN subtype is unknown or the
9893
                         * dissector is not written yet. We will dump the
9894
                         * entire community value in 2-byte short words.
9895
                         */
9896
67
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9897
67
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9898
67
                                tvb_get_ntohs(tvb,offset+2),
9899
67
                                tvb_get_ntohs(tvb,offset+4),
9900
67
                                tvb_get_ntohs(tvb,offset+6));
9901
9902
67
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9903
67
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9904
67
                        break;
9905
504
                }
9906
460
                break;
9907
9908
468
            case BGP_EXT_COM_TYPE_HIGH_TR_MUP:
9909
468
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_mup, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9910
9911
468
                proto_item_set_text(community_item, "%s:",
9912
468
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_mup, "Unknown subtype 0x%02x"));
9913
468
                switch (com_stype_low_byte) {
9914
66
                    case BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_AS2:
9915
132
                    case BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_AS2:
9916
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9917
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9918
132
                        proto_item_append_text(community_item, " %u:%u", tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9919
132
                        break;
9920
66
                    case BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_IP4:
9921
132
                    case BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_IP4:
9922
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9923
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9924
132
                        proto_item_append_text(community_item, " %s:%u", tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9925
132
                        break;
9926
66
                    case BGP_EXT_COM_STYPE_MUP_DIRECT_SEG_AS4:
9927
132
                    case BGP_EXT_COM_STYPE_MUP_INTERWORK_SEG_AS4:
9928
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9929
132
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9930
132
                        proto_item_append_text(community_item, " %u:%u", tvb_get_ntohl(tvb,offset+2), tvb_get_ntohs(tvb,offset+6));
9931
132
                        break;
9932
72
                    default:
9933
72
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9934
72
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9935
72
                                tvb_get_ntohs(tvb,offset+2),
9936
72
                                tvb_get_ntohs(tvb,offset+4),
9937
72
                                tvb_get_ntohs(tvb,offset+6));
9938
9939
72
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9940
72
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9941
72
                        break;
9942
468
                }
9943
419
                break;
9944
692
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT: /* Generic Transitive Extended Community */
9945
692
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9946
9947
692
                proto_item_set_text(community_item, "%s:",
9948
692
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"));
9949
9950
692
                switch (com_stype_low_byte) {
9951
78
                    case BGP_EXT_COM_STYPE_EXP_OSPF_RT:
9952
78
                        {
9953
78
                        proto_item *ospf_rt_opt_item;
9954
78
                        proto_tree *ospf_rt_opt_tree;
9955
9956
78
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9957
78
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9958
78
                        ospf_rt_opt_item = proto_tree_add_item(community_tree,
9959
78
                                hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9960
78
                        ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
9961
78
                        proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
9962
78
                                tvb, offset+7, 1, ENC_BIG_ENDIAN);
9963
78
                        proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
9964
78
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
9965
9966
78
                        proto_item_append_text(community_item, " Area: %s, Type: %s",
9967
78
                                tvb_ip_to_str(pinfo->pool, tvb,offset+2),
9968
78
                                val_to_str_const(tvb_get_uint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
9969
78
                        }
9970
78
                        break;
9971
9972
66
                    case BGP_EXT_COM_STYPE_EXP_OSPF_RID:
9973
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9974
9975
66
                        proto_item_append_text(community_item, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+2));
9976
66
                        break;
9977
9978
68
                    case BGP_EXT_COM_STYPE_EXP_OSPF_DID:
9979
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9980
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9981
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9982
9983
68
                        proto_item_set_text(community_item, "%s: %u:%u",
9984
68
                                val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"),
9985
68
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9986
68
                        break;
9987
9988
66
                    case BGP_EXT_COM_STYPE_EXP_F_TR:  /* Flow spec traffic-rate [RFC5575] */
9989
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2,
9990
66
                                tvb, offset+2, 2, ENC_BIG_ENDIAN);
9991
                        /* remaining 4 bytes gives traffic rate in IEEE floating point */
9992
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_rate_float, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9993
9994
66
                        proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
9995
66
                                tvb_get_ntohs(tvb,offset+2),
9996
66
                                tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
9997
66
                        break;
9998
9999
68
                    case BGP_EXT_COM_STYPE_EXP_F_TA:  /* Flow spec traffic-action [RFC5575] */
10000
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_allset, tvb, offset+2, 5, ENC_NA);
10001
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_samp_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
10002
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_term_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
10003
10004
68
                        proto_item_append_text(community_item, " Sample: %s, Terminal: %s",
10005
68
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_S, &tfs_yes_no),
10006
68
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_T, &tfs_yes_no));
10007
68
                        break;
10008
10009
66
                    case BGP_EXT_COM_STYPE_EXP_F_RED: /* Flow spec redirect [RFC5575] */
10010
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
10011
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
10012
10013
66
                        proto_item_append_text(community_item, " RT %u:%u",
10014
66
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
10015
66
                        break;
10016
10017
76
                    case BGP_EXT_COM_STYPE_EXP_F_RMARK: /* Flow spec traffic-remarking [RFC5575] */
10018
76
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_fs_remark, tvb, offset+7, 1, ENC_BIG_ENDIAN);
10019
10020
76
                        proto_item_append_text(community_item, " %s",
10021
76
                                val_to_str_ext_const(tvb_get_uint8(tvb,offset+7), &dscp_vals_ext, "Unknown DSCP"));
10022
76
                        break;
10023
10024
67
                    case BGP_EXT_COM_STYPE_EXP_L2:
10025
67
                        {
10026
67
                        static int * const com_l2_flags[] = {
10027
67
                            &hf_bgp_ext_com_l2_flag_d,
10028
67
                            &hf_bgp_ext_com_l2_flag_z1,
10029
67
                            &hf_bgp_ext_com_l2_flag_f,
10030
67
                            &hf_bgp_ext_com_l2_flag_z345,
10031
67
                            &hf_bgp_ext_com_l2_flag_c,
10032
67
                            &hf_bgp_ext_com_l2_flag_s,
10033
67
                            NULL
10034
67
                        };
10035
10036
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_encaps,tvb,offset+2, 1, ENC_BIG_ENDIAN);
10037
10038
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);
10039
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
10040
67
                        }
10041
67
                        break;
10042
10043
69
                    case BGP_EXT_COM_STYPE_EXP_ETREE:
10044
69
                        {
10045
69
                        static int * const com_etree_flags[] = {
10046
69
                            &hf_bgp_ext_com_etree_flag_reserved,
10047
69
                            &hf_bgp_ext_com_etree_flag_p,
10048
69
                            &hf_bgp_ext_com_etree_flag_v,
10049
69
                            NULL
10050
69
                        };
10051
10052
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_root_vlan,tvb,offset+2, 2, ENC_BIG_ENDIAN);
10053
69
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_leaf_vlan,tvb,offset+4, 2, ENC_BIG_ENDIAN);
10054
69
                        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);
10055
69
                        }
10056
69
                        break;
10057
10058
68
                    default:
10059
                        /* The particular Experimental subtype is unknown or
10060
                         * the dissector is not written yet. We will dump the
10061
                         * entire community value in 2-byte short words.
10062
                         */
10063
68
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
10064
68
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
10065
68
                                tvb_get_ntohs(tvb,offset+2),
10066
68
                                tvb_get_ntohs(tvb,offset+4),
10067
68
                                tvb_get_ntohs(tvb,offset+6));
10068
10069
68
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
10070
68
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
10071
68
                        break;
10072
692
                }
10073
611
                break;
10074
10075
611
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT_2:
10076
140
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
10077
10078
140
                proto_item_set_text(community_item, "%s:",
10079
140
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp_2, "Unknown subtype 0x%02x"));
10080
10081
140
                switch (com_stype_low_byte) {
10082
66
                    case BGP_EXT_COM_STYPE_EXP_2_FLOW_RED:
10083
66
                        {
10084
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
10085
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
10086
66
                        }
10087
66
                        break;
10088
10089
74
                    default:
10090
                        /* The particular Experimental subtype is unknown or
10091
                         * the dissector is not written yet. We will dump the
10092
                         * entire community value in 2-byte short words.
10093
                         */
10094
74
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
10095
74
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
10096
74
                                tvb_get_ntohs(tvb,offset+2),
10097
74
                                tvb_get_ntohs(tvb,offset+4),
10098
74
                                tvb_get_ntohs(tvb,offset+6));
10099
10100
74
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
10101
74
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
10102
74
                        break;
10103
140
                }
10104
119
                break;
10105
10106
150
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT_3:
10107
150
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_3, tvb, offset+1, 1, ENC_BIG_ENDIAN);
10108
10109
150
                proto_item_set_text(community_item, "%s:",
10110
150
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_exp_3, "Unknown subtype 0x%02x"));
10111
10112
150
                switch (com_stype_low_byte) {
10113
66
                    case BGP_EXT_COM_STYPE_EXP_3_FLOW_RED:
10114
66
                        {
10115
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
10116
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
10117
66
                        }
10118
66
                        break;
10119
10120
84
                    default:
10121
                        /* The particular Experimental subtype is unknown or
10122
                         * the dissector is not written yet. We will dump the
10123
                         * entire community value in 2-byte short words.
10124
                         */
10125
84
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
10126
84
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
10127
84
                                tvb_get_ntohs(tvb,offset+2),
10128
84
                                tvb_get_ntohs(tvb,offset+4),
10129
84
                                tvb_get_ntohs(tvb,offset+6));
10130
10131
84
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
10132
84
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
10133
84
                        break;
10134
150
                }
10135
133
                break;
10136
10137
940
            case BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP:
10138
940
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_eigrp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
10139
10140
940
                proto_item_set_text(community_item, "%s:",
10141
940
                        val_to_str(pinfo->pool, com_stype_low_byte, bgpext_com_stype_tr_eigrp, "Unknown subtype 0x%02x"));
10142
10143
940
                switch(com_stype_low_byte) {
10144
306
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_FT:
10145
306
                        {
10146
306
                        proto_item *eigrp_flags_item;
10147
306
                        proto_tree *eigrp_flags_tree;
10148
10149
306
                        eigrp_flags_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_flags, tvb, offset+2, 2, ENC_BIG_ENDIAN);
10150
306
                        eigrp_flags_tree = proto_item_add_subtree(eigrp_flags_item, ett_bgp_ext_com_eigrp_flags);
10151
10152
306
                        proto_tree_add_item(eigrp_flags_tree, hf_bgp_ext_com_eigrp_flags_rt, tvb, offset+2, 2, ENC_BIG_ENDIAN);
10153
306
                        proto_item_append_text(eigrp_flags_tree, " (%s)",
10154
306
                                tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
10155
306
                        proto_item_append_text(community_tree, " %s route",
10156
306
                                tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
10157
10158
306
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rtag, tvb, offset+4, 4, ENC_BIG_ENDIAN);
10159
306
                        proto_item_append_text(community_tree, ", Tag: %u", tvb_get_ntohl(tvb, offset+4));
10160
306
                        }
10161
306
                        break;
10162
10163
71
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_AD:
10164
71
                        {
10165
71
                        uint32_t raw_value;
10166
10167
71
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
10168
10169
71
                        raw_value = tvb_get_ntohl(tvb, offset+4);
10170
71
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_delay,
10171
71
                                tvb, offset+4, 4, raw_value, "%u (%u usec)", raw_value, raw_value * 10 / 256);
10172
10173
71
                        proto_item_append_text(community_item, " ASN: %u, D: %u",
10174
71
                                tvb_get_ntohs(tvb, offset+2), raw_value);
10175
71
                        }
10176
71
                        break;
10177
10178
172
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_RHB:
10179
172
                        {
10180
172
                        uint32_t raw_value;
10181
10182
172
                        raw_value = tvb_get_uint8(tvb, offset+2);
10183
172
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_rly,
10184
172
                                tvb, offset+2, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
10185
172
                        proto_item_append_text(community_item, " R: %u", raw_value);
10186
10187
172
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_hops, tvb, offset+3, 1, ENC_BIG_ENDIAN);
10188
172
                        proto_item_append_text(community_tree, ", H: %u", tvb_get_uint8(tvb, offset+3));
10189
10190
172
                        raw_value = tvb_get_ntohl(tvb, offset+4);
10191
172
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_bw,
10192
172
                                tvb, offset+4, 4, raw_value, "%u (%u Kbps)", raw_value, raw_value ? (2560000000U / raw_value) : 0);
10193
172
                        proto_item_append_text(community_tree, ", B: %u", raw_value);
10194
172
                        }
10195
172
                        break;
10196
10197
66
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_LM:
10198
66
                        {
10199
66
                        uint32_t raw_value;
10200
10201
66
                        raw_value = tvb_get_uint8(tvb, offset+3);
10202
66
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_load,
10203
66
                                tvb, offset+3, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
10204
66
                        proto_item_append_text(community_tree, " L: %u", raw_value);
10205
10206
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_mtu, tvb, offset+4, 4, ENC_BIG_ENDIAN);
10207
66
                        proto_item_append_text(community_tree, ", M: %u", tvb_get_ntohl(tvb, offset+4));
10208
66
                        }
10209
66
                        break;
10210
10211
68
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_EAR:
10212
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
10213
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
10214
10215
68
                        proto_item_append_text(community_tree, " ASN: %u, RID: %s",
10216
68
                                tvb_get_ntohs(tvb, offset+2), tvb_ip_to_str(pinfo->pool, tvb, offset+4));
10217
68
                        break;
10218
10219
102
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_EPM:
10220
102
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_pid, tvb, offset+2, 2, ENC_BIG_ENDIAN);
10221
102
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_m, tvb, offset+4, 4, ENC_BIG_ENDIAN);
10222
10223
102
                        proto_item_append_text(community_tree, " %s, Metric: %u",
10224
102
                          val_to_str(pinfo->pool, tvb_get_ntohs(tvb, offset+2), eigrp_proto2string, "Unknown protocol %u"),
10225
102
                          tvb_get_ntohl(tvb, offset+4));
10226
102
                        break;
10227
10228
66
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_RID:
10229
66
                       proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
10230
66
                       proto_item_append_text(community_tree, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+4));
10231
66
                     break;
10232
940
                }
10233
868
                break;
10234
10235
868
            case BGP_EXT_COM_TYPE_HIGH_TR_FLOW: /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
10236
265
            default:
10237
265
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_low_unknown, tvb, offset+1, 1, ENC_BIG_ENDIAN);
10238
10239
265
                proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
10240
265
                        tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
10241
265
                        tvb_get_ntohs(tvb,offset+2),
10242
265
                        tvb_get_ntohs(tvb,offset+4),
10243
265
                        tvb_get_ntohs(tvb,offset+6));
10244
10245
265
                proto_item_set_text(community_item, "Unknown type 0x%02x subtype 0x%02x: 0x%04x 0x%04x 0x%04x",
10246
265
                        com_type_high_byte, com_stype_low_byte,
10247
265
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
10248
265
                break;
10249
5.28k
        }
10250
4.61k
        proto_item_append_text (community_item, " [%s]", val_to_str_const(com_type_high_byte, bgpext_com_type_high, "Unknown community"));
10251
4.61k
        offset = offset + 8;
10252
4.61k
    }
10253
553
    return 0;
10254
1.22k
}
10255
10256
static int
10257
dissect_bgp_update_pmsi_attr(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, uint16_t tlen, unsigned tvb_off)
10258
3.30k
{
10259
3.30k
    int             offset=0;
10260
3.30k
    uint8_t         tunnel_type=0;
10261
3.30k
    uint8_t         opaque_value_type=0;
10262
3.30k
    uint8_t         rn_addr_length=0;
10263
3.30k
    uint16_t        tunnel_id_len=0;
10264
3.30k
    uint16_t        opaque_value_length=0;
10265
3.30k
    proto_item      *tunnel_id_item=NULL;
10266
3.30k
    proto_item      *opaque_value_type_item=NULL;
10267
3.30k
    proto_item      *pmsi_tunnel_type_item=NULL;
10268
3.30k
    proto_tree      *tunnel_id_tree=NULL;
10269
3.30k
    path_attr_data  *data = NULL;
10270
10271
3.30k
    offset = tvb_off ;
10272
3.30k
    tunnel_id_len = tlen - 5;
10273
10274
3.30k
    proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_flags, tvb, offset,
10275
3.30k
                        1, ENC_BIG_ENDIAN);
10276
10277
3.30k
    pmsi_tunnel_type_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_type, tvb, offset+1,
10278
3.30k
                                                1, ENC_BIG_ENDIAN);
10279
10280
3.30k
    data = load_path_attr_data(pinfo);
10281
3.30k
    if (data && data->encaps_community_present &&
10282
595
            (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
10283
393
        proto_tree_add_item(parent_tree, hf_bgp_evpn_nlri_vni, tvb, offset+2, 3, ENC_BIG_ENDIAN);
10284
2.90k
    } else {
10285
2.90k
        proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+2, 3, ENC_BIG_ENDIAN);
10286
2.90k
    }
10287
10288
3.30k
    tunnel_id_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_id, tvb, offset+5,
10289
3.30k
                        tunnel_id_len, ENC_NA);
10290
3.30k
    tunnel_id_tree = proto_item_add_subtree(tunnel_id_item, ett_bgp_pmsi_tunnel_id);
10291
10292
3.30k
    tunnel_type = tvb_get_uint8(tvb, offset+1);
10293
3.30k
    switch(tunnel_type) {
10294
69
        case PMSI_TUNNEL_NOPRESENT:
10295
69
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_not_present, tvb, offset+1, 1, ENC_NA);
10296
69
            break;
10297
196
        case PMSI_TUNNEL_RSVPTE_P2MP:
10298
196
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_id, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10299
196
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id, tvb, offset+11, 2, ENC_BIG_ENDIAN);
10300
196
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4, tvb, offset+13, 4, ENC_BIG_ENDIAN);
10301
196
            proto_item_append_text(tunnel_id_item, ": Id %u, Ext Id %s",
10302
196
                                tvb_get_ntohs(tvb, offset+11), tvb_ip_to_str(pinfo->pool, tvb, offset+13));
10303
196
            break;
10304
529
        case PMSI_TUNNEL_MLDP_P2MP:
10305
920
        case PMSI_TUNNEL_MLDP_MP2MP:
10306
920
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_type, tvb, offset+5, 1, ENC_BIG_ENDIAN);
10307
920
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_afi, tvb, offset+6, 2, ENC_BIG_ENDIAN);
10308
920
            proto_tree_add_item_ret_uint8(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len, tvb, offset+8, 1, ENC_BIG_ENDIAN, &rn_addr_length);
10309
920
            if(rn_addr_length == 4)
10310
455
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10311
465
            else
10312
465
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6, tvb, offset+9, 16, ENC_NA);
10313
10314
920
            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);
10315
920
            opaque_value_type_item = proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
10316
920
                                                         tvb, offset+11+rn_addr_length, 1, ENC_BIG_ENDIAN);
10317
920
            opaque_value_type = tvb_get_uint8(tvb, offset+11+rn_addr_length);
10318
920
            if(opaque_value_type == PMSI_MLDP_FEC_TYPE_GEN_LSP) {
10319
410
                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);
10320
410
                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);
10321
410
                proto_item_append_text(tunnel_id_item, ": Type: %s root node: %s Id: %u",
10322
410
                                       val_to_str_const(tvb_get_uint8(tvb, offset+5), fec_types_vals, "Unknown"),
10323
410
                                       tvb_ip_to_str(pinfo->pool, tvb, offset+9),
10324
410
                                       tvb_get_ntohl(tvb, offset+14+rn_addr_length));
10325
510
            } else if (opaque_value_type == PMSI_MLDP_FEC_TYPE_EXT_TYPE) {
10326
68
                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);
10327
68
                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);
10328
68
                opaque_value_length = tvb_get_ntohs(tvb, offset+14+rn_addr_length);
10329
68
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str, tvb, offset+16+rn_addr_length,
10330
68
                                    opaque_value_length, ENC_ASCII);
10331
68
            }
10332
442
            else {
10333
                /* This covers situation when opaque id is 0 (reserved) or any other value */
10334
442
                expert_add_info_format(pinfo, opaque_value_type_item, &ei_bgp_attr_pmsi_opaque_type,
10335
442
                                            "Opaque Value type %u wrong, must be modulo 1 or 255", opaque_value_type);
10336
442
            }
10337
920
            break;
10338
195
        case PMSI_TUNNEL_PIMSSM:
10339
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_root_node, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10340
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10341
195
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10342
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10343
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10344
195
            break;
10345
195
        case PMSI_TUNNEL_PIMSM:
10346
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10347
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10348
195
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10349
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10350
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10351
195
            break;
10352
195
        case PMSI_TUNNEL_BIDIR_PIM:
10353
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10354
195
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10355
195
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10356
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10357
195
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10358
195
            break;
10359
218
        case PMSI_TUNNEL_INGRESS:
10360
218
            if(tunnel_id_len == 4){
10361
67
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10362
67
                proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
10363
67
                                       tvb_ip_to_str(pinfo->pool, tvb, offset+5));
10364
151
            } else {
10365
151
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr6, tvb, offset+5, 16, ENC_NA);
10366
151
                proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
10367
151
                                       tvb_ip6_to_str(pinfo->pool, tvb, offset+5));
10368
151
            }
10369
218
            break;
10370
1.24k
        default:
10371
1.24k
            expert_add_info_format(pinfo, pmsi_tunnel_type_item, &ei_bgp_attr_pmsi_tunnel_type,
10372
1.24k
                                            "Tunnel type %u wrong", tunnel_type);
10373
1.24k
            break;
10374
3.30k
    }
10375
10376
10377
3.11k
    return 0;
10378
3.30k
}
10379
10380
static unsigned
10381
dissect_bgp_sr_mpls_sid(tvbuff_t *tvb, proto_tree *tree, unsigned offset)
10382
741
{
10383
741
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
10384
741
            tvb, offset, 3, ENC_BIG_ENDIAN);
10385
741
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
10386
741
            tvb, offset, 3, ENC_BIG_ENDIAN);
10387
741
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
10388
741
            tvb, offset, 3, ENC_BIG_ENDIAN);
10389
741
    offset += 3;
10390
741
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
10391
741
            tvb, offset, 1, ENC_BIG_ENDIAN);
10392
741
    return 4;
10393
741
}
10394
10395
/* Helper to dissect SRv6 Endpoint Behavior and SID Structure (8 octets) */
10396
static unsigned
10397
dissect_bgp_srv6_endpoint_behavior_only(tvbuff_t *tvb, proto_tree *tree, unsigned offset, int ett)
10398
345
{
10399
345
    proto_tree *subtree;
10400
345
    proto_item *ti;
10401
10402
345
    ti = proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior,
10403
345
            tvb, offset, 8, ENC_NA);
10404
345
    subtree = proto_item_add_subtree(ti, ett);
10405
10406
345
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_code,
10407
345
            tvb, offset, 2, ENC_BIG_ENDIAN);
10408
345
    offset += 2;
10409
10410
345
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_reserved,
10411
345
            tvb, offset, 2, ENC_BIG_ENDIAN);
10412
345
    offset += 2;
10413
10414
345
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_lb_length,
10415
345
            tvb, offset, 1, ENC_BIG_ENDIAN);
10416
345
    offset += 1;
10417
10418
345
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_ln_length,
10419
345
            tvb, offset, 1, ENC_BIG_ENDIAN);
10420
345
    offset += 1;
10421
10422
345
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_func_length,
10423
345
            tvb, offset, 1, ENC_BIG_ENDIAN);
10424
345
    offset += 1;
10425
10426
345
    proto_tree_add_item(subtree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_arg_length,
10427
345
            tvb, offset, 1, ENC_BIG_ENDIAN);
10428
10429
345
    return 8;
10430
345
}
10431
10432
static unsigned
10433
dissect_bgp_srv6_sid_endpoint_behavior(tvbuff_t *tvb, proto_tree *tree, unsigned offset,
10434
                                        gboolean has_endpoint_behavior)
10435
729
{
10436
729
    unsigned bytes_consumed = 16;
10437
10438
729
    proto_tree_add_item(tree, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_sid,
10439
729
            tvb, offset, 16, ENC_NA);
10440
729
    offset += 16;
10441
10442
729
    if (has_endpoint_behavior) {
10443
268
        bytes_consumed += dissect_bgp_srv6_endpoint_behavior_only(tvb, tree, offset, ett_bgp_segment_list);
10444
268
    }
10445
10446
729
    return bytes_consumed;
10447
729
}
10448
10449
/*
10450
 * Dissect BGP path attributes
10451
 *
10452
 */
10453
void
10454
// NOLINTNEXTLINE(misc-no-recursion)
10455
dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, uint16_t path_attr_len, unsigned tvb_off, packet_info *pinfo)
10456
12.0k
{
10457
12.0k
    uint8_t       bgpa_flags;                 /* path attributes          */
10458
12.0k
    uint8_t       bgpa_type;
10459
12.0k
    unsigned      o;                          /* packet offset            */
10460
12.0k
    unsigned      q=0;                        /* tmp                      */
10461
12.0k
    unsigned      end=0;                      /* message end              */
10462
12.0k
    int           advance;                    /* tmp                      */
10463
12.0k
    proto_item    *ti;                        /* tree item                */
10464
12.0k
    proto_item    *ti_communities;            /* tree communities         */
10465
12.0k
    proto_item    *ti_community;              /* tree for each community  */
10466
12.0k
    proto_item    *ti_as;                     /* tree for each as         */
10467
12.0k
    proto_item    *attr_len_item;
10468
12.0k
    proto_item    *aigp_type_item;
10469
12.0k
    proto_tree    *subtree2;                  /* path attribute subtree   */
10470
12.0k
    proto_tree    *subtree3;                  /* subtree for attributes   */
10471
12.0k
    proto_tree    *subtree4;                  /* subtree for attributes   */
10472
12.0k
    proto_tree    *subtree5;                  /* subtree for attributes   */
10473
12.0k
    proto_tree    *subtree6;                  /* subtree for attributes   */
10474
12.0k
    proto_tree    *subtree7;                  /* subtree for attributes   */
10475
12.0k
    proto_tree    *subtree8;                  /* subtree for attributes   */
10476
12.0k
    proto_tree    *attr_set_subtree;          /* subtree for attr_set     */
10477
12.0k
    proto_tree    *as_path_segment_tree;      /* subtree for AS_PATH segments */
10478
12.0k
    unsigned      number_as_segment=0;        /* Number As segment        */
10479
12.0k
    proto_tree    *communities_tree;          /* subtree for COMMUNITIES  */
10480
12.0k
    proto_tree    *community_tree;            /* subtree for a community  */
10481
12.0k
    proto_tree    *cluster_list_tree;         /* subtree for CLUSTER_LIST */
10482
12.0k
    unsigned      i=0, j, k;                  /* tmp                      */
10483
12.0k
    uint8_t       type=0;                     /* AS_PATH segment type     */
10484
12.0k
    uint8_t       length=0;                   /* AS_PATH segment length   */
10485
12.0k
    uint32_t      aggregator_as;
10486
12.0k
    uint16_t      ssa_type;                   /* SSA T + Type */
10487
12.0k
    uint16_t      ssa_len;                    /* SSA TLV Length */
10488
12.0k
    uint8_t       ssa_v3_len;                 /* SSA L2TPv3 Cookie Length */
10489
12.0k
    uint16_t      encaps_tunnel_type;         /* Encapsulation Tunnel Type */
10490
12.0k
    uint16_t      encaps_tunnel_len;          /* Encapsulation TLV Length */
10491
12.0k
    uint8_t       encaps_tunnel_subtype;      /* Encapsulation Tunnel Sub-TLV Type */
10492
12.0k
    uint16_t      encaps_tunnel_sublen;       /* Encapsulation TLV Sub-TLV Length */
10493
12.0k
    uint16_t      encaps_tunnel_sub_totallen; /* Encapsulation TLV Sub-TLV Length + Type + Length field */
10494
12.0k
    uint8_t       aigp_type;                  /* AIGP TLV type from AIGP attribute */
10495
12.0k
    uint8_t       prefix_sid_subtype;         /* BGP Prefix-SID TLV Type */
10496
12.0k
    uint16_t      prefix_sid_sublen;          /* BGP Prefix-SID TLV Length */
10497
12.0k
    unsigned      prefix_sid_sub_tlv_offset;  /* BGP Prefix-SID SRGB Length */
10498
12.0k
    int           check_srgb;                 /* BGP Prefix-SID SRGB counter */
10499
12.0k
    uint16_t      secpathlen;                 /* BGPsec Secure Path length */
10500
12.0k
    uint16_t      sigblocklen;                /* BGPsec Signature Block length */
10501
12.0k
    uint8_t       secpathcount;               /* Number of Secure Path Segments */
10502
12.0k
    uint16_t      sig_len;                    /* Length of BGPsec Signature */
10503
12.0k
    uint32_t      segment_subtlv_type;        /* Segment List SubTLV Type */
10504
12.0k
    uint32_t      segment_subtlv_length;      /* Segment List SubTLV Length */
10505
12.0k
    uint8_t       srv6_service_subtlv_type;         /* SRv6 Service Sub-TLV type */
10506
12.0k
    uint16_t      srv6_service_subtlv_len;          /* SRv6 Service Sub-TLV length */
10507
12.0k
    uint8_t       srv6_service_data_subsubtlv_type; /* SRv6 Service Data Sub-Sub-TLV type */
10508
12.0k
    uint16_t      srv6_service_data_subsubtlv_len;  /* SRv6 Service Data Sub-Sub-TLV length */
10509
10510
12.0k
    o = tvb_off;
10511
10512
12.0k
    increment_dissection_depth(pinfo);
10513
71.5k
    while (i < path_attr_len) {
10514
68.7k
        proto_item *ti_pa, *ti_flags;
10515
68.7k
        unsigned    off;
10516
68.7k
        unsigned    alen, aoff, tlen, aoff_save;
10517
68.7k
        uint8_t snpa;
10518
68.7k
        uint8_t nexthop_len;
10519
68.7k
        uint8_t asn_len = 0;
10520
68.7k
        uint32_t af, saf, as_num;
10521
10522
68.7k
        static int * const path_flags[] = {
10523
68.7k
            &hf_bgp_update_path_attribute_flags_optional,
10524
68.7k
            &hf_bgp_update_path_attribute_flags_transitive,
10525
68.7k
            &hf_bgp_update_path_attribute_flags_partial,
10526
68.7k
            &hf_bgp_update_path_attribute_flags_extended_length,
10527
68.7k
            &hf_bgp_update_path_attribute_flags_unused,
10528
68.7k
            NULL
10529
68.7k
        };
10530
10531
68.7k
        bgpa_flags = tvb_get_uint8(tvb, o + i);
10532
68.7k
        bgpa_type = tvb_get_uint8(tvb, o + i+1);
10533
10534
        /* check for the Extended Length bit */
10535
68.7k
        if (bgpa_flags & BGP_ATTR_FLAG_EXTENDED_LENGTH) {
10536
1.33k
            alen = tvb_get_ntohs(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
10537
1.33k
            aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+2;
10538
67.4k
        } else {
10539
67.4k
            alen = tvb_get_uint8(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
10540
67.4k
            aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+1;
10541
67.4k
        }
10542
68.7k
        tlen = alen;
10543
10544
68.7k
        ti_pa = proto_tree_add_item(subtree, hf_bgp_update_path_attribute, tvb, o + i, tlen + aoff, ENC_NA);
10545
68.7k
        proto_item_append_text(ti_pa, " - %s", val_to_str(pinfo->pool, bgpa_type, bgpattr_type, "Unknown (%u)"));
10546
10547
68.7k
        subtree2 = proto_item_add_subtree(ti_pa, ett_bgp_attr);
10548
10549
68.7k
        ti_flags = proto_tree_add_bitmask(subtree2, tvb, o + i, hf_bgp_update_path_attribute_flags, ett_bgp_attr_flags, path_flags, ENC_NA);
10550
10551
68.7k
        if ((bgpa_flags & BGP_ATTR_FLAG_OPTIONAL) == 0)
10552
62.1k
            proto_item_append_text(ti_flags, "%s", ", Well-known");
10553
68.7k
        if ((bgpa_flags & BGP_ATTR_FLAG_TRANSITIVE) == 0)
10554
62.3k
            proto_item_append_text(ti_flags, "%s", ", Non-transitive");
10555
68.7k
        if ((bgpa_flags & BGP_ATTR_FLAG_PARTIAL) == 0)
10556
56.5k
            proto_item_append_text(ti_flags, "%s", ", Complete");
10557
10558
68.7k
        proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_type_code, tvb, o + i + 1, 1, ENC_BIG_ENDIAN);
10559
10560
68.7k
        attr_len_item = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_length, tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE,
10561
68.7k
                                            aoff - BGP_SIZE_OF_PATH_ATTRIBUTE, ENC_BIG_ENDIAN);
10562
68.7k
        if (aoff + tlen > path_attr_len - i) {
10563
622
            proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10564
622
                                         "Path attribute length is invalid: %u byte%s", tlen,
10565
622
                                         plurality(tlen, "", "s"));
10566
622
            return;
10567
622
        }
10568
10569
        /* Path Attribute Type */
10570
68.1k
        switch (bgpa_type) {
10571
1.54k
            case BGPTYPE_ORIGIN:
10572
1.54k
                if (tlen != 1) {
10573
1.20k
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10574
1.20k
                                                 "Origin (invalid): %u byte%s", tlen,
10575
1.20k
                                                 plurality(tlen, "", "s"));
10576
1.20k
                } else {
10577
344
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_origin, tvb,
10578
344
                                        o + i + aoff, 1, ENC_BIG_ENDIAN);
10579
344
                    proto_item_append_text(ti_pa, ": %s", val_to_str_const(tvb_get_uint8(tvb, o + i + aoff), bgpattr_origin, "Unknown"));
10580
344
                }
10581
1.54k
                break;
10582
2.14k
            case BGPTYPE_AS_PATH:
10583
2.94k
            case BGPTYPE_AS4_PATH:
10584
                /* Apply heuristic to guess if we are facing 2 or 4 bytes ASN
10585
                   (o + i + aoff) =
10586
                   (o + current attribute + aoff bytes to first tuple)
10587
                   heuristic also tell us how many AS segments we have */
10588
2.94k
                asn_len = heuristic_as2_or_4_from_as_path(tvb, o+i+aoff, o+i+aoff+tlen,
10589
2.94k
                                                          bgpa_type, &number_as_segment);
10590
2.94k
                if (asn_len == 255)
10591
1.15k
                    {
10592
1.15k
                        expert_add_info_format(pinfo, ti_pa, &ei_bgp_attr_as_path_as_len_err,
10593
1.15k
                                               "ASN length uncalculated by heuristic : %u", asn_len);
10594
1.15k
                        break;
10595
1.15k
                    }
10596
1.79k
                proto_item_append_text(ti_pa,": ");
10597
1.79k
                if(tlen == 0) {
10598
783
                    proto_item_append_text(ti_pa,"empty");
10599
783
                }
10600
1.79k
                q = o + i + aoff;
10601
4.89k
                for (k=0; k < number_as_segment; k++)
10602
3.23k
                {
10603
3.23k
                    type = tvb_get_uint8(tvb, q);
10604
3.23k
                    length = tvb_get_uint8(tvb, q+1);
10605
3.23k
                    ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_as_path_segment, tvb,
10606
3.23k
                                             q, length * asn_len + 2, ENC_NA);
10607
3.23k
                    proto_item_append_text(ti,": ");
10608
3.23k
                    as_path_segment_tree = proto_item_add_subtree(ti, ett_bgp_as_path_segment);
10609
3.23k
                    proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_type, tvb,
10610
3.23k
                                        q, 1, ENC_BIG_ENDIAN);
10611
3.23k
                    proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_length, tvb,
10612
3.23k
                                        q+1, 1, ENC_BIG_ENDIAN);
10613
3.23k
                    switch(type)
10614
3.23k
                    {
10615
573
                        case AS_SET:
10616
573
                            proto_item_append_text(ti_pa, "{");
10617
573
                            proto_item_append_text(ti, "{");
10618
573
                            break;
10619
526
                        case AS_CONFED_SET:
10620
526
                            proto_item_append_text(ti_pa, "[");
10621
526
                            proto_item_append_text(ti, "[");
10622
526
                            break;
10623
442
                        case AS_CONFED_SEQUENCE:
10624
442
                            proto_item_append_text(ti_pa, "(");
10625
442
                            proto_item_append_text(ti, "(");
10626
442
                            break;
10627
3.23k
                    }
10628
10629
3.23k
                    q = q + 2;
10630
7.18k
                    for (j = 0; j < length; j++)
10631
3.95k
                    {
10632
3.95k
                        if(asn_len == 2) {
10633
1.07k
                            ti_as = proto_tree_add_item_ret_uint(as_path_segment_tree,
10634
1.07k
                                                hf_bgp_update_path_attribute_as_path_segment_as2,
10635
1.07k
                                                tvb, q, 2, ENC_BIG_ENDIAN, &as_num);
10636
1.07k
                            if (as_num == BGP_AS_TRANS) {
10637
264
                                proto_item_append_text(ti_as, " (AS_TRANS)");
10638
264
                            }
10639
1.07k
                            proto_item_append_text(ti_pa, "%u",
10640
1.07k
                                                   tvb_get_ntohs(tvb, q));
10641
1.07k
                            proto_item_append_text(ti, "%u",
10642
1.07k
                                                   tvb_get_ntohs(tvb, q));
10643
1.07k
                        }
10644
2.87k
                        else if (asn_len == 4) {
10645
2.87k
                            proto_tree_add_item(as_path_segment_tree,
10646
2.87k
                                                hf_bgp_update_path_attribute_as_path_segment_as4,
10647
2.87k
                                                tvb, q, 4, ENC_BIG_ENDIAN);
10648
2.87k
                            proto_item_append_text(ti_pa, "%u",
10649
2.87k
                                                   tvb_get_ntohl(tvb, q));
10650
2.87k
                            proto_item_append_text(ti, "%u",
10651
2.87k
                                                   tvb_get_ntohl(tvb, q));
10652
2.87k
                        }
10653
3.95k
                        if (j != (unsigned)(length-1))
10654
2.88k
                        {
10655
2.88k
                            proto_item_append_text(ti_pa, "%s",
10656
2.88k
                                                   (type == AS_SET || type == AS_CONFED_SET) ?
10657
1.58k
                                                   ", " : " ");
10658
2.88k
                            proto_item_append_text(ti, "%s",
10659
2.88k
                                                   (type == AS_SET || type == AS_CONFED_SET) ?
10660
1.58k
                                                   ", " : " ");
10661
2.88k
                        }
10662
3.95k
                        q += asn_len;
10663
3.95k
                    }
10664
3.23k
                    switch(type)
10665
3.23k
                    {
10666
538
                        case AS_SET:
10667
538
                            proto_item_append_text(ti_pa, "} ");
10668
538
                            proto_item_append_text(ti, "}");
10669
538
                            break;
10670
510
                        case AS_CONFED_SET:
10671
510
                            proto_item_append_text(ti_pa, "] ");
10672
510
                            proto_item_append_text(ti, "]");
10673
510
                            break;
10674
415
                        case AS_CONFED_SEQUENCE:
10675
415
                            proto_item_append_text(ti_pa, ") ");
10676
415
                            proto_item_append_text(ti, ")");
10677
415
                            break;
10678
1.64k
                        default:
10679
1.64k
                            proto_item_append_text(ti_pa, " ");
10680
1.64k
                            break;
10681
3.23k
                    }
10682
3.23k
                }
10683
10684
1.66k
                break;
10685
1.66k
            case BGPTYPE_NEXT_HOP:
10686
735
                if (tlen != 4) {
10687
537
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10688
537
                                                 "Next hop (invalid): %u byte%s", tlen,
10689
537
                                                 plurality(tlen, "", "s"));
10690
537
                } else {
10691
198
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_next_hop, tvb,
10692
198
                                        o + i + aoff, 4, ENC_BIG_ENDIAN);
10693
198
                    proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
10694
198
                }
10695
735
                break;
10696
1.30k
            case BGPTYPE_MULTI_EXIT_DISC:
10697
1.30k
                if (tlen != 4) {
10698
1.07k
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10699
1.07k
                                                 "Multiple exit discriminator (invalid): %u byte%s",
10700
1.07k
                                                 tlen, plurality(tlen, "", "s"));
10701
1.07k
                } else {
10702
225
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_multi_exit_disc, tvb,
10703
225
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10704
225
                    proto_item_append_text(ti_pa,": %u", tvb_get_ntohl(tvb, o + i + aoff));
10705
225
                }
10706
1.30k
                break;
10707
490
            case BGPTYPE_LOCAL_PREF:
10708
490
                if (tlen != 4) {
10709
294
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10710
294
                                                 "Local preference (invalid): %u byte%s", tlen,
10711
294
                                                 plurality(tlen, "", "s"));
10712
294
                } else {
10713
196
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_local_pref, tvb,
10714
196
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10715
196
                    proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
10716
196
                }
10717
490
                break;
10718
1.00k
            case BGPTYPE_ATOMIC_AGGREGATE:
10719
1.00k
                if (tlen != 0) {
10720
735
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10721
735
                                                 "Atomic aggregate (invalid): %u byte%s", tlen,
10722
735
                                                 plurality(tlen, "", "s"));
10723
735
                }
10724
1.00k
                break;
10725
579
            case BGPTYPE_AGGREGATOR:
10726
579
                if (tlen != 6 && tlen != 8) {
10727
443
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10728
443
                                                 "Aggregator (invalid): %u byte%s", tlen,
10729
443
                                                 plurality(tlen, "", "s"));
10730
443
                    break;
10731
443
                }
10732
                /* FALL THROUGH */
10733
828
            case BGPTYPE_AS4_AGGREGATOR:
10734
828
                if (bgpa_type == BGPTYPE_AS4_AGGREGATOR && tlen != 8)
10735
625
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10736
625
                                                 "Aggregator (invalid): %u byte%s", tlen,
10737
625
                                                 plurality(tlen, "", "s"));
10738
203
                else {
10739
203
                    asn_len = tlen - 4;
10740
203
                    aggregator_as = (asn_len == 2) ?
10741
69
                        tvb_get_ntohs(tvb, o + i + aoff) :
10742
203
                        tvb_get_ntohl(tvb, o + i + aoff);
10743
203
                    proto_tree_add_uint(subtree2, hf_bgp_update_path_attribute_aggregator_as, tvb,
10744
203
                                        o + i + aoff, asn_len, aggregator_as);
10745
203
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aggregator_origin, tvb,
10746
203
                                        o + i + aoff + asn_len, 4, ENC_BIG_ENDIAN);
10747
10748
203
                    proto_item_append_text(ti_pa, ": AS: %u origin: %s", aggregator_as,
10749
203
                                           tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff + asn_len));
10750
203
                }
10751
828
                break;
10752
826
            case BGPTYPE_COMMUNITIES:
10753
826
                if (tlen % 4 != 0) {
10754
238
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10755
238
                                                 "Communities (invalid): %u byte%s", tlen,
10756
238
                                                 plurality(tlen, "", "s"));
10757
238
                    break;
10758
238
                }
10759
10760
588
                proto_item_append_text(ti_pa, ": ");
10761
10762
588
                ti_communities = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_communities,
10763
588
                                                     tvb, o + i + aoff, tlen, ENC_NA);
10764
10765
588
                communities_tree = proto_item_add_subtree(ti_communities,
10766
588
                                                          ett_bgp_communities);
10767
588
                proto_item_append_text(ti_communities, ": ");
10768
                /* (o + i + aoff) =
10769
                   (o + current attribute + aoff bytes to first tuple) */
10770
588
                q = o + i + aoff;
10771
588
                end = q + tlen;
10772
10773
                /* snarf each community */
10774
1.59k
                while (q < end) {
10775
                    /* check for reserved values */
10776
1.01k
                    uint32_t community = tvb_get_ntohl(tvb, q);
10777
1.01k
                    if ((community & 0xFFFF0000) == FOURHEX0 ||
10778
701
                        (community & 0xFFFF0000) == FOURHEXF) {
10779
419
                        proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community_well_known,
10780
419
                                            tvb, q, 4, ENC_BIG_ENDIAN);
10781
419
                        proto_item_append_text(ti_pa, "%s ", val_to_str_const(community, community_vals, "Reserved"));
10782
419
                        proto_item_append_text(ti_communities, "%s ", val_to_str_const(community, community_vals, "Reserved"));
10783
419
                    }
10784
591
                    else {
10785
591
                        ti_community = proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community, tvb,
10786
591
                                                           q, 4, ENC_NA);
10787
591
                        community_tree = proto_item_add_subtree(ti_community,
10788
591
                                                                ett_bgp_community);
10789
591
                        proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_as,
10790
591
                                            tvb, q, 2, ENC_BIG_ENDIAN);
10791
591
                        proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_value,
10792
591
                                            tvb, q+2, 2, ENC_BIG_ENDIAN);
10793
591
                        proto_item_append_text(ti_pa, "%u:%u ",tvb_get_ntohs(tvb, q),
10794
591
                                               tvb_get_ntohs(tvb, q+2));
10795
591
                        proto_item_append_text(ti_communities, "%u:%u ",tvb_get_ntohs(tvb, q),
10796
591
                                               tvb_get_ntohs(tvb, q+2));
10797
591
                        proto_item_append_text(ti_community, ": %u:%u ",tvb_get_ntohs(tvb, q),
10798
591
                                               tvb_get_ntohs(tvb, q+2));
10799
591
                    }
10800
10801
1.01k
                    q += 4;
10802
1.01k
                }
10803
10804
10805
588
                break;
10806
442
            case BGPTYPE_ORIGINATOR_ID:
10807
442
                if (tlen != 4) {
10808
243
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10809
243
                                                 "Originator identifier (invalid): %u byte%s", tlen,
10810
243
                                                 plurality(tlen, "", "s"));
10811
243
                } else {
10812
199
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_originator_id, tvb,
10813
199
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10814
199
                    proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
10815
199
                }
10816
442
                break;
10817
15.3k
            case BGPTYPE_MP_REACH_NLRI:
10818
                /* RFC 2283 says that a MP_[UN]REACH_NLRI path attribute can
10819
                 * have more than one <AFI, SAFI, Next Hop, ..., NLRI> tuple.
10820
                 * However, that doesn't work because the NLRI is also a
10821
                 * variable number of <length, prefix> fields without a field
10822
                 * for the overall length of the NLRI. Thus one would have to
10823
                 * guess whether a particular byte were the length of the next
10824
                 * prefix or a new AFI. So no one ever implemented that, and
10825
                 * RFC 2858, obsoleting 2283, says you can't do that.
10826
                 */
10827
15.3k
                proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_address_family, tvb,
10828
15.3k
                                    o + i + aoff, 2, ENC_BIG_ENDIAN, &af);
10829
15.3k
                proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_safi, tvb,
10830
15.3k
                                    o + i + aoff + 2, 1, ENC_BIG_ENDIAN, &saf);
10831
15.3k
                nexthop_len = tvb_get_uint8(tvb, o + i + aoff + 3);
10832
15.3k
                save_afi_safi_data(pinfo, (uint16_t)af, (uint8_t)saf);
10833
10834
15.3k
                decode_mp_next_hop(tvb_new_subset_length(tvb, o + i + aoff + 3, nexthop_len + 1), subtree2, pinfo, af, saf, nexthop_len);
10835
10836
15.3k
                aoff_save = aoff;
10837
15.3k
                tlen -= nexthop_len + 4;
10838
15.3k
                aoff += nexthop_len + 4;
10839
10840
15.3k
                off = 0;
10841
15.3k
                ti = proto_tree_add_item_ret_uint8(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa, tvb,
10842
15.3k
                                                   o + i + aoff, 1, ENC_BIG_ENDIAN, &snpa);
10843
15.3k
                off++;
10844
15.3k
                if (snpa) {
10845
6.20k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_snpa);
10846
30.3k
                    for (/*nothing*/; snpa > 0; snpa--) {
10847
24.1k
                        uint8_t snpa_length = tvb_get_uint8(tvb, o + i + aoff + off);
10848
24.1k
                        proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length, tvb,
10849
24.1k
                                            o + i + aoff + off, 1, ENC_BIG_ENDIAN);
10850
24.1k
                        off++;
10851
24.1k
                        proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa, tvb,
10852
24.1k
                                            o + i + aoff + off, snpa_length, ENC_NA);
10853
24.1k
                        off += snpa_length;
10854
24.1k
                    }
10855
6.20k
                }
10856
15.3k
                tlen -= off;
10857
15.3k
                aoff += off;
10858
10859
15.3k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri, tvb, o + i + aoff, tlen, ENC_NA);
10860
15.3k
                subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
10861
10862
15.3k
                if (tlen)  {
10863
13.7k
                    if (af != AFNUM_IP && af != AFNUM_IP6 && af != AFNUM_AFI_FOR_L2VPN_INFORMATION && af != AFNUM_BGP_LS) {
10864
230
                        proto_tree_add_expert(subtree3, pinfo, &ei_bgp_unknown_afi, tvb, o + i + aoff, tlen);
10865
13.5k
                    } else {
10866
349k
                        while (tlen > 0) {
10867
348k
                            advance = decode_prefix_MP(subtree3,
10868
348k
                                                       hf_bgp_nlri_path_id,
10869
348k
                                                       hf_bgp_mp_reach_nlri_ipv4_prefix,
10870
348k
                                                       hf_bgp_mp_reach_nlri_ipv6_prefix,
10871
348k
                                                       af, saf, tlen,
10872
348k
                                                       tvb, o + i + aoff, "MP Reach NLRI", pinfo);
10873
348k
                            if (advance < 0)
10874
13.2k
                                break;
10875
335k
                            tlen -= advance;
10876
335k
                            aoff += advance;
10877
335k
                        }
10878
13.5k
                    }
10879
13.7k
                }
10880
15.3k
                aoff = aoff_save;
10881
15.3k
                break;
10882
14.2k
            case BGPTYPE_MP_UNREACH_NLRI:
10883
14.2k
                af = tvb_get_ntohs(tvb, o + i + aoff);
10884
14.2k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_address_family, tvb,
10885
14.2k
                                    o + i + aoff, 2, ENC_BIG_ENDIAN);
10886
14.2k
                saf = tvb_get_uint8(tvb, o + i + aoff + 2) ;
10887
14.2k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_safi, tvb,
10888
14.2k
                                    o + i + aoff+2, 1, ENC_BIG_ENDIAN);
10889
14.2k
                save_afi_safi_data(pinfo, (uint16_t)af, (uint8_t)saf);
10890
10891
14.2k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri, tvb, o + i + aoff + 3, tlen - 3, ENC_NA);
10892
14.2k
                subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_unreach_nlri);
10893
10894
14.2k
                aoff_save = aoff;
10895
14.2k
                tlen -= 3;
10896
14.2k
                aoff += 3;
10897
14.2k
                if (tlen > 0) {
10898
10899
54.0k
                    while (tlen > 0) {
10900
51.5k
                        advance = decode_prefix_MP(subtree3,
10901
51.5k
                                                   hf_bgp_nlri_path_id,
10902
51.5k
                                                   hf_bgp_mp_unreach_nlri_ipv4_prefix,
10903
51.5k
                                                   hf_bgp_mp_unreach_nlri_ipv6_prefix,
10904
51.5k
                                                   af, saf, tlen,
10905
51.5k
                                                   tvb, o + i + aoff, "MP Unreach NLRI", pinfo);
10906
51.5k
                        if (advance < 0)
10907
11.5k
                            break;
10908
40.0k
                        tlen -= advance;
10909
40.0k
                        aoff += advance;
10910
40.0k
                    }
10911
13.9k
                }
10912
14.2k
                aoff = aoff_save;
10913
14.2k
                break;
10914
644
            case BGPTYPE_CLUSTER_LIST:
10915
644
                if (tlen % 4 != 0) {
10916
233
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10917
233
                                                 "Cluster list (invalid): %u byte%s", tlen,
10918
233
                                                 plurality(tlen, "", "s"));
10919
233
                    break;
10920
233
                }
10921
10922
411
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_cluster_list,
10923
411
                                         tvb, o + i + aoff, tlen, ENC_NA);
10924
411
                cluster_list_tree = proto_item_add_subtree(ti,
10925
411
                                                               ett_bgp_cluster_list);
10926
10927
                /* (o + i + aoff) =
10928
                   (o + current attribute + aoff bytes to first tuple) */
10929
411
                q = o + i + aoff;
10930
411
                end = q + tlen;
10931
411
                proto_item_append_text(ti, ":");
10932
411
                proto_item_append_text(ti_pa, ":");
10933
                /* snarf each cluster identifier */
10934
825
                while (q < end) {
10935
414
                    proto_tree_add_item(cluster_list_tree, hf_bgp_update_path_attribute_cluster_id,
10936
414
                                        tvb, q, 4, ENC_BIG_ENDIAN);
10937
414
                    proto_item_append_text(ti, " %s", tvb_ip_to_str(pinfo->pool, tvb, q));
10938
414
                    proto_item_append_text(ti_pa, " %s", tvb_ip_to_str(pinfo->pool, tvb, q));
10939
414
                    q += 4;
10940
414
                }
10941
10942
411
                break;
10943
1.44k
            case BGPTYPE_EXTENDED_COMMUNITY:
10944
1.44k
                if (tlen %8 != 0) {
10945
220
                    expert_add_info_format(pinfo, attr_len_item, &ei_bgp_ext_com_len_bad,
10946
220
                                           "Community length %u wrong, must be modulo 8", tlen);
10947
1.22k
                } else {
10948
1.22k
                    dissect_bgp_update_ext_com(subtree2, tvb, tlen, o+i+aoff, pinfo);
10949
1.22k
                }
10950
1.44k
                break;
10951
1.21k
            case BGPTYPE_SAFI_SPECIFIC_ATTR:
10952
1.21k
                q = o + i + aoff;
10953
1.21k
                end = o + i + aoff + tlen ;
10954
10955
2.28k
                while(q < end) {
10956
1.60k
                    ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
10957
1.60k
                    ssa_len = tvb_get_ntohs(tvb, q + 2);
10958
10959
1.60k
                    subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, MIN((unsigned)ssa_len + 4, end - q),
10960
1.60k
                                                             ett_bgp_ssa, NULL, "%s Information",
10961
1.60k
                                                             val_to_str_const(ssa_type, bgp_ssa_type, "Unknown SSA"));
10962
10963
1.60k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_t, tvb,
10964
1.60k
                                        q, 1, ENC_BIG_ENDIAN);
10965
1.60k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb, q, 2, ENC_BIG_ENDIAN);
10966
10967
1.60k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
10968
10969
1.60k
                    if ((ssa_len == 0) || (q + ssa_len > end)) {
10970
469
                        proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 2,
10971
469
                                                     end - q - 2, "Invalid Length of %u", ssa_len);
10972
469
                        break;
10973
469
                    }
10974
10975
1.13k
                    switch (ssa_type) {
10976
480
                        case BGP_SSA_L2TPv3:
10977
480
                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_pref, tvb,
10978
480
                                                q + 4, 2, ENC_BIG_ENDIAN);
10979
10980
480
                            subtree4 = proto_tree_add_subtree(subtree3, tvb, q + 6, 1, ett_bgp_ssa_subtree, NULL, "Flags");
10981
480
                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_s, tvb,
10982
480
                                                q + 6, 1, ENC_BIG_ENDIAN);
10983
480
                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_unused, tvb,
10984
480
                                                q + 6, 1, ENC_BIG_ENDIAN);
10985
10986
480
                            ssa_v3_len = tvb_get_uint8(tvb, q + 7);
10987
480
                            if (ssa_v3_len + 8 == ssa_len){
10988
134
                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie_len, tvb,
10989
134
                                                    q + 7, 1, ENC_BIG_ENDIAN);
10990
346
                            } else {
10991
346
                                proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 7, 1,
10992
346
                                                             "Invalid Cookie Length of %u", ssa_v3_len);
10993
346
                                q += ssa_len + 4; /* 4 from type and length */
10994
346
                                break;
10995
346
                            }
10996
134
                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_session_id, tvb,
10997
134
                                                q + 8, 4, ENC_BIG_ENDIAN);
10998
134
                            if (ssa_v3_len)
10999
68
                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie, tvb,
11000
68
                                                    q + 12, ssa_v3_len, ENC_NA);
11001
134
                            q += ssa_len + 4; /* 4 from type and length */
11002
134
                            break;
11003
10
                        case BGP_SSA_mGRE:
11004
139
                        case BGP_SSA_IPSec:
11005
143
                        case BGP_SSA_MPLS:
11006
217
                        default:
11007
217
                            proto_tree_add_item(subtree3, hf_bgp_ssa_value, tvb,
11008
217
                                                q + 4, ssa_len, ENC_NA);
11009
217
                            q += ssa_len + 4; /* 4 from type and length */
11010
217
                            break;
11011
200
                        case BGP_SSA_L2TPv3_IN_IPSec:
11012
397
                        case BGP_SSA_mGRE_IN_IPSec:
11013
                            /* These contain BGP_SSA_IPSec and BGP_SSA_L2TPv3/BGP_SSA_mGRE */
11014
397
                            q += 4; /* 4 from type and length */
11015
397
                            break;
11016
1.13k
                    } /* switch (bgpa.bgpa_type) */
11017
1.13k
                }
11018
1.15k
                break;
11019
1.93k
            case BGPTYPE_TUNNEL_ENCAPS_ATTR:
11020
1.93k
                q = o + i + aoff;
11021
1.93k
                end = o + i + aoff + tlen;
11022
11023
1.93k
                subtree3 = proto_tree_add_subtree(subtree2, tvb, q, tlen, ett_bgp_tunnel_tlv, NULL, "TLV Encodings");
11024
11025
3.35k
                while (q < end) {
11026
1.96k
                    encaps_tunnel_type = tvb_get_ntohs(tvb, q);
11027
1.96k
                    encaps_tunnel_len = tvb_get_ntohs(tvb, q + 2);
11028
11029
1.96k
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, encaps_tunnel_len + 4,
11030
1.96k
                                         ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
11031
1.96k
                                         val_to_str_const(encaps_tunnel_type, bgp_attr_tunnel_type, "Unknown"), encaps_tunnel_len + 4);
11032
11033
1.96k
                    proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_type, tvb, q, 2, ENC_BIG_ENDIAN);
11034
1.96k
                    proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
11035
11036
1.96k
                    subtree5 = proto_tree_add_subtree(subtree4, tvb, q + 4, encaps_tunnel_len, ett_bgp_tunnel_subtlv, NULL, "Sub-TLV Encodings");
11037
11038
1.96k
                    q += 4;
11039
1.96k
                    j = q + encaps_tunnel_len;
11040
18.1k
                    while ( q < j ) {
11041
16.6k
                        encaps_tunnel_subtype = tvb_get_uint8(tvb, q);
11042
16.6k
                        if (encaps_tunnel_subtype < 128) {
11043
14.2k
                            encaps_tunnel_sublen = tvb_get_uint8(tvb, q + 1);
11044
14.2k
                            encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 2;
11045
14.2k
                        } else {
11046
2.48k
                            encaps_tunnel_sublen = tvb_get_ntohs(tvb, q + 1);
11047
2.48k
                            encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 3;
11048
2.48k
                        }
11049
16.6k
                        subtree6 = proto_tree_add_subtree_format(subtree5, tvb, q, encaps_tunnel_sub_totallen,
11050
16.6k
                                             ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
11051
16.6k
                                             val_to_str_const(encaps_tunnel_subtype, subtlv_type, "Unknown"), encaps_tunnel_sub_totallen);
11052
16.6k
                        proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
11053
16.6k
                        q += 1;
11054
16.6k
                        if (encaps_tunnel_subtype < 128) {
11055
14.1k
                            proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 1, ENC_BIG_ENDIAN);
11056
14.1k
                            q += 1;
11057
14.1k
                        } else {
11058
2.50k
                            proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 2, ENC_BIG_ENDIAN);
11059
2.50k
                            q += 2;
11060
2.50k
                        }
11061
11062
16.6k
                        switch (encaps_tunnel_subtype) {
11063
2.64k
                            case TUNNEL_SUBTLV_ENCAPSULATION:
11064
2.64k
                                {
11065
2.64k
                                static int * const vxlan_flags[] = {
11066
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
11067
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
11068
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
11069
2.64k
                                    NULL
11070
2.64k
                                    };
11071
2.64k
                                static int * const vxlan_gpe_flags[] = {
11072
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
11073
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
11074
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
11075
2.64k
                                    NULL
11076
2.64k
                                    };
11077
2.64k
                                static int * const nvgre_flags[] = {
11078
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
11079
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
11080
2.64k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
11081
2.64k
                                    NULL
11082
2.64k
                                    };
11083
2.64k
                                if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP) {
11084
199
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_session_id, tvb, q, 4, ENC_BIG_ENDIAN);
11085
199
                                    q += 4;
11086
199
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_cookie, tvb, q, encaps_tunnel_sublen - 4, ENC_NA);
11087
199
                                    q += (encaps_tunnel_sublen - 4);
11088
2.44k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_GRE || encaps_tunnel_type == TUNNEL_TYPE_MPLS_IN_GRE) {
11089
583
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 4, ENC_BIG_ENDIAN);
11090
583
                                    q += 4;
11091
1.86k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN) {
11092
264
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
11093
264
                                            ett_bgp_vxlan, vxlan_flags, ENC_BIG_ENDIAN);
11094
264
                                    q += 1;
11095
264
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
11096
264
                                    q += 3;
11097
264
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac, tvb, q, 6, ENC_NA);
11098
264
                                    q += 6;
11099
264
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
11100
264
                                    q += 2;
11101
1.59k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN_GPE) {
11102
211
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
11103
211
                                            ett_bgp_vxlan, vxlan_gpe_flags, ENC_BIG_ENDIAN);
11104
211
                                    q += 1;
11105
211
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
11106
211
                                    q += 2;
11107
211
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
11108
211
                                    q += 3;
11109
211
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11110
211
                                    q += 1;
11111
1.38k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_NVGRE) {
11112
195
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
11113
195
                                            ett_bgp_vxlan, nvgre_flags, ENC_BIG_ENDIAN);
11114
195
                                    q += 1;
11115
195
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
11116
195
                                    q += 3;
11117
195
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac, tvb, q, 6, ENC_NA);
11118
195
                                    q += 6;
11119
195
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
11120
195
                                    q += 2;
11121
195
                                }
11122
2.64k
                                }
11123
2.64k
                                break;
11124
698
                            case TUNNEL_SUBTLV_PROTO_TYPE:
11125
698
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 2, ENC_BIG_ENDIAN);
11126
698
                                q += 2;
11127
698
                                break;
11128
1.20k
                            case TUNNEL_SUBTLV_COLOR:
11129
1.20k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_color_value, tvb, q, 4, ENC_BIG_ENDIAN);
11130
1.20k
                                q += 4;
11131
1.20k
                                break;
11132
1.84k
                            case TUNNEL_SUBTLV_LOAD_BALANCE:
11133
1.84k
                                if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP || encaps_tunnel_type == TUNNEL_TYPE_GRE) {
11134
445
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_lb_block_length, tvb, q, 4, ENC_BIG_ENDIAN);
11135
445
                                    q += 4;
11136
445
                                }
11137
1.84k
                                break;
11138
210
                            case TUNNEL_SUBTLV_PREFERENCE:
11139
210
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_flags, tvb, q, 1, ENC_BIG_ENDIAN);
11140
210
                                q += 1;
11141
210
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11142
210
                                q += 1;
11143
210
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_preference, tvb, q, 4, ENC_NA);
11144
210
                                q += 4;
11145
210
                                break;
11146
1.01k
                            case TUNNEL_SUBTLV_BINDING_SID:
11147
1.01k
                                {
11148
1.01k
                                static int * const flags[] = {
11149
1.01k
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
11150
1.01k
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
11151
1.01k
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
11152
1.01k
                                    NULL
11153
1.01k
                                    };
11154
11155
1.01k
                                proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
11156
1.01k
                                        ett_bgp_binding_sid, flags, ENC_BIG_ENDIAN);
11157
1.01k
                                q += 1;
11158
1.01k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
11159
1.01k
                                        tvb, q, 1, ENC_BIG_ENDIAN);
11160
1.01k
                                q += 1;
11161
11162
1.01k
                                if (encaps_tunnel_sublen == 6) {
11163
198
                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree6, q);
11164
814
                                } else if (encaps_tunnel_sublen > 2) {
11165
408
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid, tvb, q,
11166
408
                                            encaps_tunnel_sublen - 2, ENC_NA);
11167
408
                                    q += (encaps_tunnel_sublen - 2);
11168
408
                                }
11169
1.01k
                                }
11170
1.01k
                                break;
11171
281
                            case TUNNEL_SUBTLV_SRV6_BINDING_SID:
11172
281
                                {
11173
281
                                static int * const srv6_binding_flags[] = {
11174
281
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_specified,
11175
281
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_invalid,
11176
281
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_b_flag,
11177
281
                                    &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_reserved,
11178
281
                                    NULL
11179
281
                                    };
11180
11181
281
                                proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags,
11182
281
                                        ett_bgp_binding_sid, srv6_binding_flags, ENC_BIG_ENDIAN);
11183
281
                                q += 1;
11184
281
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_reserved,
11185
281
                                        tvb, q, 1, ENC_BIG_ENDIAN);
11186
281
                                q += 1;
11187
11188
                                /* SRv6 Binding SID (16 octets) */
11189
281
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_sid,
11190
281
                                        tvb, q, 16, ENC_NA);
11191
281
                                q += 16;
11192
11193
                                /* Optional SRv6 Endpoint Behavior (8 octets) - use helper function */
11194
281
                                if (encaps_tunnel_sublen == 26) {
11195
77
                                    q += dissect_bgp_srv6_endpoint_behavior_only(tvb, subtree6, q, ett_bgp_binding_sid);
11196
77
                                }
11197
281
                                }
11198
281
                                break;
11199
209
                            case TUNNEL_SUBTLV_ENLP:
11200
209
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_flags, tvb, q, 1, ENC_BIG_ENDIAN);
11201
209
                                q += 1;
11202
209
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11203
209
                                q += 1;
11204
209
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp, tvb, q, 1, ENC_BIG_ENDIAN);
11205
209
                                q += 1;
11206
209
                                break;
11207
470
                            case TUNNEL_SUBTLV_PRIORITY:
11208
470
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_priority, tvb, q, 1, ENC_BIG_ENDIAN);
11209
470
                                q += 1;
11210
470
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11211
470
                                q += 1;
11212
470
                                break;
11213
1.58k
                            case TUNNEL_SUBTLV_SEGMENT_LIST:
11214
1.58k
                                {
11215
1.58k
                                static int * const flags[] = {
11216
1.58k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
11217
1.58k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
11218
1.58k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_s_flag,
11219
1.58k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_b_flag,
11220
1.58k
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
11221
1.58k
                                    NULL
11222
1.58k
                                    };
11223
11224
1.58k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11225
1.58k
                                q += 1;
11226
1.58k
                                encaps_tunnel_sublen -= 1;
11227
1.58k
                                subtree7 = proto_tree_add_subtree(subtree6, tvb, q, encaps_tunnel_sublen,
11228
1.58k
                                        ett_bgp_segment_list, &ti, "sub-TLVs:");
11229
1.58k
                                bool first_subtlv = true;
11230
11.3k
                                while (encaps_tunnel_sublen > 2) {
11231
9.87k
                                    segment_subtlv_type = tvb_get_uint8(tvb, q);
11232
9.87k
                                    segment_subtlv_length = tvb_get_uint8(tvb, q + 1);
11233
9.87k
                                    subtree8 = proto_tree_add_subtree_format(subtree7, tvb, q, segment_subtlv_length + 2,
11234
9.87k
                                            ett_bgp_segment_list, NULL, "SubTLV: %s", val_to_str_const(segment_subtlv_type,
11235
9.87k
                                            bgp_sr_policy_list_type, "Unknown"));
11236
11237
                                    /* Append sub-TLV summary to parent item - use short name for readability */
11238
9.87k
                                    const char *short_name = val_to_str_const(segment_subtlv_type,
11239
9.87k
                                            bgp_sr_policy_list_type_short, "Unknown");
11240
11241
9.87k
                                    if (!first_subtlv) {
11242
8.50k
                                        proto_item_append_text(ti, ",");
11243
8.50k
                                    }
11244
9.87k
                                    proto_item_append_text(ti, " %s (%u byte%s)",
11245
9.87k
                                        short_name,
11246
9.87k
                                        segment_subtlv_length + 2,
11247
9.87k
                                        (segment_subtlv_length + 2 == 1) ? "" : "s");
11248
9.87k
                                    first_subtlv = false;
11249
9.87k
                                    proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
11250
9.87k
                                    q += 1;
11251
9.87k
                                    proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length, tvb, q, 1, ENC_BIG_ENDIAN);
11252
9.87k
                                    q += 1;
11253
9.87k
                                    if (segment_subtlv_length > 0) {
11254
5.85k
                                        switch(segment_subtlv_type) {
11255
                                            /* TODO: Dissect further subTLVs data as defined in draft-ietf-idr-segment-routing-te-policy-08 section 2.4.3.2 */
11256
614
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A:
11257
614
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11258
614
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11259
614
                                                q += 1;
11260
614
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11261
614
                                                        tvb, q, 1, ENC_NA);
11262
614
                                                q += 1;
11263
614
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
11264
614
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
11265
614
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
11266
614
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
11267
614
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
11268
614
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
11269
614
                                                q += 3;
11270
614
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
11271
614
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11272
614
                                                q += 1;
11273
614
                                                break;
11274
296
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B:
11275
                                                /* RFC 9830 Section 2.4.4.2.2 - Type B Segment
11276
                                                 * Length MUST be 26 when SRv6 Endpoint Behavior and SID
11277
                                                 * Structure is present; else it MUST be 18.
11278
                                                 * RFC 9830 Section 2.4.4.2.3 - B-Flag indicates presence
11279
                                                 * of SRv6 Endpoint Behavior and SID Structure.
11280
                                                 */
11281
296
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11282
296
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11283
296
                                                q += 1;
11284
296
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11285
296
                                                        tvb, q, 1, ENC_NA);
11286
296
                                                q += 1;
11287
11288
296
                                                q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11289
296
                                                        segment_subtlv_length == 26);
11290
296
                                                break;
11291
314
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C:
11292
                                                /* RFC 9831 Section 2.1 - Type C Segment
11293
                                                 * IPv4 Node Address, SR Algorithm, and optional SR-MPLS SID
11294
                                                 * Length MUST be 10 when SR-MPLS SID is present; else it MUST be 6.
11295
                                                 */
11296
314
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11297
314
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11298
314
                                                q += 1;
11299
11300
                                                /* SR Algorithm (1 octet) */
11301
314
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11302
314
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11303
314
                                                q += 1;
11304
11305
                                                /* IPv4 Node Address (4 octets) */
11306
314
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address,
11307
314
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11308
314
                                                q += 4;
11309
11310
314
                                                if (segment_subtlv_length == 10) {
11311
70
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11312
70
                                                }
11313
314
                                                break;
11314
324
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D:
11315
                                                /* RFC 9831 Section 2.2 - Type D Segment
11316
                                                 * IPv6 Node Address, SR Algorithm, and optional SR-MPLS SID
11317
                                                 * Length MUST be 22 when SR-MPLS SID is present; else it MUST be 18.
11318
                                                 */
11319
324
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11320
324
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11321
324
                                                q += 1;
11322
11323
                                                /* SR Algorithm (1 octet) */
11324
324
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11325
324
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11326
324
                                                q += 1;
11327
11328
                                                /* IPv6 Node Address (16 octets) */
11329
324
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address,
11330
324
                                                        tvb, q, 16, ENC_NA);
11331
324
                                                q += 16;
11332
11333
324
                                                if (segment_subtlv_length == 22) {
11334
69
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11335
69
                                                }
11336
324
                                                break;
11337
434
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E:
11338
                                                /* RFC 9831 Section 2.3 - Type E Segment
11339
                                                 * IPv4 Node Address, Local Interface ID, and optional SR-MPLS SID
11340
                                                 * Length MUST be 14 when SR-MPLS SID is present; else it MUST be 10.
11341
                                                 */
11342
434
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11343
434
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11344
434
                                                q += 1;
11345
11346
                                                /* Reserved (1 octet) */
11347
434
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11348
434
                                                        tvb, q, 1, ENC_NA);
11349
434
                                                q += 1;
11350
11351
                                                /* Local Interface ID (4 octets) */
11352
434
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
11353
434
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11354
434
                                                q += 4;
11355
11356
                                                /* IPv4 Node Address (4 octets) */
11357
434
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address,
11358
434
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11359
434
                                                q += 4;
11360
11361
434
                                                if (segment_subtlv_length == 14) {
11362
205
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11363
205
                                                }
11364
434
                                                break;
11365
314
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F:
11366
                                                /* RFC 9831 Section 2.4 - Type F Segment
11367
                                                 * IPv4 adjacency (local/remote addresses) and optional SR-MPLS SID
11368
                                                 * Length MUST be 14 when SR-MPLS SID is present; else it MUST be 10.
11369
                                                 */
11370
314
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11371
314
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11372
314
                                                q += 1;
11373
11374
                                                /* Reserved (1 octet) */
11375
314
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11376
314
                                                        tvb, q, 1, ENC_NA);
11377
314
                                                q += 1;
11378
11379
                                                /* Local IPv4 Address (4 octets) */
11380
314
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv4_address,
11381
314
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11382
314
                                                q += 4;
11383
11384
                                                /* Remote IPv4 Address (4 octets) */
11385
314
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv4_address,
11386
314
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11387
314
                                                q += 4;
11388
11389
314
                                                if (segment_subtlv_length == 14) {
11390
66
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11391
66
                                                }
11392
314
                                                break;
11393
270
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G:
11394
                                                /* RFC 9831 Section 2.5 - Type G Segment
11395
                                                 * IPv6 link-local adjacency with local/remote node addresses and interface IDs
11396
                                                 * Length MUST be 46 when SR-MPLS SID is present; else it MUST be 42.
11397
                                                 */
11398
270
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11399
270
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11400
270
                                                q += 1;
11401
11402
                                                /* Reserved (1 octet) */
11403
270
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11404
270
                                                        tvb, q, 1, ENC_NA);
11405
270
                                                q += 1;
11406
11407
                                                /* Local Interface ID (4 octets) */
11408
270
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
11409
270
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11410
270
                                                q += 4;
11411
11412
                                                /* IPv6 Local Node Address (16 octets) */
11413
270
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11414
270
                                                        tvb, q, 16, ENC_NA);
11415
270
                                                q += 16;
11416
11417
                                                /* Remote Interface ID (4 octets) */
11418
270
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id,
11419
270
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11420
270
                                                q += 4;
11421
11422
                                                /* IPv6 Remote Node Address (16 octets) */
11423
270
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11424
270
                                                        tvb, q, 16, ENC_NA);
11425
270
                                                q += 16;
11426
11427
270
                                                if (segment_subtlv_length == 46) {
11428
66
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11429
66
                                                }
11430
270
                                                break;
11431
292
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H:
11432
                                                /* RFC 9831 Section 2.6 - Type H Segment
11433
                                                 * IPv6 adjacency (local/remote addresses) and optional SR-MPLS SID
11434
                                                 * Length MUST be 38 when SR-MPLS SID is present; else it MUST be 34.
11435
                                                 */
11436
292
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11437
292
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11438
292
                                                q += 1;
11439
11440
                                                /* Reserved (1 octet) */
11441
292
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11442
292
                                                        tvb, q, 1, ENC_NA);
11443
292
                                                q += 1;
11444
11445
                                                /* Local IPv6 Address (16 octets) */
11446
292
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11447
292
                                                        tvb, q, 16, ENC_NA);
11448
292
                                                q += 16;
11449
11450
                                                /* Remote IPv6 Address (16 octets) */
11451
292
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11452
292
                                                        tvb, q, 16, ENC_NA);
11453
292
                                                q += 16;
11454
11455
292
                                                if (segment_subtlv_length == 38) {
11456
67
                                                    q += dissect_bgp_sr_mpls_sid(tvb, subtree8, q);
11457
67
                                                }
11458
292
                                                break;
11459
336
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J:
11460
                                                /* RFC 9831 Section 2.8 - Type J Segment
11461
                                                 * IPv6 link-local adjacency with local/remote node addresses, interface IDs,
11462
                                                 * SR Algorithm, and optional SRv6 SID with optional Endpoint Behavior
11463
                                                 * Length MUST be 66 when both SRv6 SID and Endpoint Behavior are present,
11464
                                                 * 58 when only SRv6 SID is present, or 42 when SRv6 SID is not present.
11465
                                                 */
11466
336
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11467
336
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11468
336
                                                q += 1;
11469
11470
                                                /* SR Algorithm (1 octet) */
11471
336
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11472
336
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11473
336
                                                q += 1;
11474
11475
                                                /* Local Interface ID (4 octets) */
11476
336
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
11477
336
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11478
336
                                                q += 4;
11479
11480
                                                /* IPv6 Local Node Address (16 octets) */
11481
336
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11482
336
                                                        tvb, q, 16, ENC_NA);
11483
336
                                                q += 16;
11484
11485
                                                /* Remote Interface ID (4 octets) */
11486
336
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id,
11487
336
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11488
336
                                                q += 4;
11489
11490
                                                /* IPv6 Remote Node Address (16 octets) */
11491
336
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11492
336
                                                        tvb, q, 16, ENC_NA);
11493
336
                                                q += 16;
11494
11495
336
                                                if (segment_subtlv_length >= 58) {
11496
134
                                                    q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11497
134
                                                            segment_subtlv_length == 66);
11498
134
                                                }
11499
336
                                                break;
11500
360
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I:
11501
                                                /* RFC 9831 Section 2.7 - Type I Segment
11502
                                                 * IPv6 Node Address, SR Algorithm, and optional SRv6 SID with optional Endpoint Behavior
11503
                                                 * Length MUST be 42 when both SRv6 SID and Endpoint Behavior are present,
11504
                                                 * 34 when only SRv6 SID is present, or 18 when SRv6 SID is not present.
11505
                                                 */
11506
360
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11507
360
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11508
360
                                                q += 1;
11509
11510
                                                /* SR Algorithm (1 octet) */
11511
360
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11512
360
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11513
360
                                                q += 1;
11514
11515
                                                /* IPv6 Node Address (16 octets) */
11516
360
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address,
11517
360
                                                        tvb, q, 16, ENC_NA);
11518
360
                                                q += 16;
11519
11520
360
                                                if (segment_subtlv_length >= 34) {
11521
157
                                                    q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11522
157
                                                            segment_subtlv_length == 42);
11523
157
                                                }
11524
360
                                                break;
11525
362
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K:
11526
                                                /* RFC 9831 Section 2.9 - Type K Segment
11527
                                                 * IPv6 adjacency (local/remote addresses), SR Algorithm, and optional SRv6 SID with optional Endpoint Behavior
11528
                                                 * Length MUST be 58 when both SRv6 SID and Endpoint Behavior are present,
11529
                                                 * 50 when only SRv6 SID is present, or 34 when SRv6 SID is not present.
11530
                                                 */
11531
362
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
11532
362
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
11533
362
                                                q += 1;
11534
11535
                                                /* SR Algorithm (1 octet) */
11536
362
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
11537
362
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11538
362
                                                q += 1;
11539
11540
                                                /* Local IPv6 Address (16 octets) */
11541
362
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
11542
362
                                                        tvb, q, 16, ENC_NA);
11543
362
                                                q += 16;
11544
11545
                                                /* Remote IPv6 Address (16 octets) */
11546
362
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
11547
362
                                                        tvb, q, 16, ENC_NA);
11548
362
                                                q += 16;
11549
11550
362
                                                if (segment_subtlv_length >= 50) {
11551
143
                                                    q += dissect_bgp_srv6_sid_endpoint_behavior(tvb, subtree8, q,
11552
143
                                                            segment_subtlv_length == 58);
11553
143
                                                }
11554
362
                                                break;
11555
239
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT:
11556
                                                /* RFC 9256 Section 2.4.4.1 - Weight sub-TLV
11557
                                                 * Flags (1 octet) + Reserved (1 octet) + Weight (4 octets)
11558
                                                 */
11559
239
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight_flags,
11560
239
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
11561
239
                                                q += 1;
11562
239
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
11563
239
                                                        tvb, q, 1, ENC_NA);
11564
239
                                                q += 1;
11565
239
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight,
11566
239
                                                        tvb, q, 4, ENC_BIG_ENDIAN);
11567
239
                                                q += 4;
11568
239
                                                break;
11569
1.70k
                                            default:
11570
1.70k
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
11571
1.70k
                                                        tvb, q, segment_subtlv_length, ENC_NA);
11572
1.70k
                                                q += segment_subtlv_length;
11573
1.70k
                                                break;
11574
5.85k
                                        }
11575
5.85k
                                    }
11576
9.79k
                                    encaps_tunnel_sublen -= (segment_subtlv_length + 2);
11577
9.79k
                                }
11578
1.58k
                                }
11579
1.50k
                                break;
11580
1.50k
                            case TUNNEL_SUBTLV_POLICY_CP_NAME:
11581
201
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11582
201
                                q += 1;
11583
201
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_name, tvb, q,
11584
201
                                        encaps_tunnel_sublen - 1, ENC_ASCII);
11585
201
                                q += (encaps_tunnel_sublen - 1);
11586
201
                                break;
11587
337
                            case TUNNEL_SUBTLV_POLICY_NAME:
11588
337
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
11589
337
                                q += 1;
11590
337
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_name, tvb, q,
11591
337
                                        encaps_tunnel_sublen - 1, ENC_ASCII);
11592
337
                                q += (encaps_tunnel_sublen - 1);
11593
337
                                break;
11594
5.72k
                            default:
11595
5.72k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_value, tvb, q, encaps_tunnel_sublen, ENC_NA);
11596
5.72k
                                q += encaps_tunnel_sublen;
11597
5.72k
                                break;
11598
16.6k
                        } /* switch (encaps_tunnel_subtype) */
11599
16.6k
                    }
11600
1.96k
                }
11601
1.39k
                break;
11602
1.39k
            case BGPTYPE_AIGP:
11603
494
                q = o + i + aoff;
11604
494
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aigp, tvb, q, tlen, ENC_NA);
11605
494
                subtree3 = proto_item_add_subtree(ti, ett_bgp_aigp_attr);
11606
494
                aigp_type_item = proto_tree_add_item_ret_uint8(subtree3, hf_bgp_aigp_type, tvb, q, 1, ENC_BIG_ENDIAN, &aigp_type);
11607
494
                switch (aigp_type) {
11608
291
                    case AIGP_TLV_TYPE :
11609
291
                        proto_tree_add_item(subtree3, hf_bgp_aigp_tlv_length, tvb, q+1, 2, ENC_BIG_ENDIAN);
11610
291
                        proto_tree_add_item(subtree3, hf_bgp_aigp_accu_igp_metric, tvb, q+3, 8, ENC_BIG_ENDIAN);
11611
291
                        proto_item_append_text(ti, ": %" PRIu64, tvb_get_ntoh64(tvb, q+3));
11612
291
                        proto_item_append_text(ti_pa, ": %" PRIu64, tvb_get_ntoh64(tvb, q+3));
11613
291
                        break;
11614
202
                    default :
11615
202
                        expert_add_info_format(pinfo, aigp_type_item, &ei_bgp_attr_aigp_type,
11616
202
                                               "AIGP type %u unknown", aigp_type);
11617
494
                }
11618
481
                break;
11619
2.58k
            case BGPTYPE_LINK_STATE_ATTR:
11620
2.89k
            case BGPTYPE_LINK_STATE_OLD_ATTR:
11621
2.89k
                q = o + i + aoff;
11622
2.89k
                end = o + i + aoff + tlen;
11623
                /* FF: BGPTYPE_LINK_STATE_ATTR body dissection is moved after the while.
11624
                   Here we just save the TLV coordinates and the subtree. */
11625
2.89k
                save_link_state_attr_position(pinfo, q, end, tlen, subtree2);
11626
2.89k
                break;
11627
11628
602
            case BGPTYPE_LARGE_COMMUNITY:
11629
602
                if(tlen == 0 || tlen % 12){
11630
521
                    break;
11631
521
                }
11632
81
                q = o + i + aoff;
11633
81
                end = q + tlen;
11634
81
                wmem_strbuf_t *comm_strbuf;
11635
81
                comm_strbuf = wmem_strbuf_create(pinfo->pool);
11636
239
                while (q < end) {
11637
158
                    uint32_t ga, ldp1, ldp2;
11638
158
                    ga = tvb_get_ntohl(tvb, q);
11639
158
                    ldp1 = tvb_get_ntohl(tvb, q+4);
11640
158
                    ldp2 = tvb_get_ntohl(tvb, q+8);
11641
158
                    ti = proto_tree_add_string_format(subtree2, hf_bgp_large_communities, tvb, q, 12, NULL, "Large communities: %u:%u:%u", ga, ldp1, ldp2);
11642
158
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_large_communities);
11643
158
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ga, tvb,
11644
158
                                            q, 4, ENC_BIG_ENDIAN);
11645
158
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp1, tvb,
11646
158
                                            q + 4, 4, ENC_BIG_ENDIAN);
11647
158
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp2, tvb,
11648
158
                                            q + 8, 4, ENC_BIG_ENDIAN);
11649
158
                    wmem_strbuf_append_printf(comm_strbuf, " %u:%u:%u", ga, ldp1, ldp2);
11650
158
                    q += 12;
11651
158
                }
11652
11653
81
                proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(comm_strbuf));
11654
11655
81
                break;
11656
818
            case BGPTYPE_BGPSEC_PATH:
11657
818
                q = o + i + aoff;
11658
818
                end = q + tlen;
11659
818
                secpathlen = tvb_get_ntohs(tvb, q); /* Secure Path Length */
11660
11661
818
                if (((secpathlen - 2) % SEC_PATH_SEG_SIZE) != 0) { /* SEC_PATH_SEG_SIZE = 6 */
11662
571
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11663
571
                        "Invalid BGPsec Secure Path length: %u bytes", secpathlen);
11664
571
                }
11665
11666
818
                subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, secpathlen,
11667
818
                                                         ett_bgp_bgpsec_secure_path,
11668
818
                                                         NULL,
11669
818
                                                         "Secure Path (%d byte%s)",
11670
818
                                                         secpathlen,
11671
818
                                                         plurality(secpathlen, "", "s"));
11672
11673
                /* Secure Path Length */
11674
818
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sp_len, tvb, q, 2, ENC_BIG_ENDIAN);
11675
818
                q += 2;
11676
11677
818
                secpathcount = (secpathlen - 2) / SEC_PATH_SEG_SIZE; /* Amount of Secure Path Segments */
11678
818
                j = 0;
11679
2.54k
                while (j < secpathcount) {
11680
1.73k
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, SEC_PATH_SEG_SIZE,
11681
1.73k
                                                             ett_bgp_bgpsec_secure_path_segment,
11682
1.73k
                                                             NULL,
11683
1.73k
                                                             "Secure Path Segment (%d byte%s)",
11684
1.73k
                                                             SEC_PATH_SEG_SIZE,
11685
1.73k
                                                             plurality(SEC_PATH_SEG_SIZE, "", "s"));
11686
11687
                    /* pCount field */
11688
1.73k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_pcount, tvb,
11689
1.73k
                                        q, 1, ENC_BIG_ENDIAN);
11690
1.73k
                    q += 1;
11691
11692
                    /* Flags field */
11693
1.73k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_flags, tvb,
11694
1.73k
                                        q, 1, ENC_BIG_ENDIAN);
11695
1.73k
                    q += 1;
11696
11697
                    /* ASN field */
11698
1.73k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_as, tvb,
11699
1.73k
                                        q, 4, ENC_BIG_ENDIAN);
11700
1.73k
                    q += 4;
11701
1.73k
                    j++;
11702
1.73k
                }
11703
11704
818
                sigblocklen = tvb_get_ntohs(tvb, q); /* Signature Block Length */
11705
11706
818
                subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, sigblocklen,
11707
818
                                                         ett_bgp_bgpsec_signature_block,
11708
818
                                                         NULL,
11709
818
                                                         "Signature Block (%d byte%s)",
11710
818
                                                         sigblocklen,
11711
818
                                                         plurality(sigblocklen, "", "s"));
11712
11713
                /* Signature Block Length */
11714
818
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sb_len, tvb, q, 2, ENC_BIG_ENDIAN);
11715
818
                q += 2;
11716
11717
                /* Algorithm Suite ID */
11718
818
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_algo_id, tvb, q, 1, ENC_BIG_ENDIAN);
11719
818
                q += 1;
11720
11721
959
                while (q < end) {
11722
141
                    sig_len = tvb_get_ntohs(tvb, q+20); /* Signature Length of current Segment */
11723
11724
141
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, 22+sig_len,
11725
141
                                                             ett_bgp_bgpsec_signature_segment,
11726
141
                                                             NULL,
11727
141
                                                             "Signature Segment (%d byte%s)",
11728
141
                                                             22+sig_len,
11729
141
                                                             plurality(22+sig_len, "", "s"));
11730
11731
                    /* Subject Key Identifier */
11732
141
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_ski, tvb,
11733
141
                                        q, 20, ENC_NA);
11734
141
                    q += 20;
11735
11736
                    /* Signature Length */
11737
141
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig_len, tvb,
11738
141
                                        q, 2, ENC_BIG_ENDIAN);
11739
141
                    q += 2;
11740
11741
                    /* Signature */
11742
141
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig, tvb,
11743
141
                                        q, sig_len, ENC_NA);
11744
141
                    q += sig_len;
11745
141
                }
11746
11747
818
                break;
11748
1.97k
            case BGPTYPE_BGP_PREFIX_SID:
11749
1.97k
                q = o + i + aoff;
11750
1.97k
                end = q + tlen;
11751
1.97k
                proto_item    *tlv_item, *stlv_item, *sstlv_item;
11752
1.97k
                proto_tree    *tlv_tree, *stlv_tree, *sstlv_tree;
11753
1.97k
                proto_item    *srgb_tlv_item;
11754
1.97k
                proto_tree    *srgb_tlv_tree;
11755
1.97k
                proto_item    *srv6_stlv_item;
11756
1.97k
                proto_tree    *srv6_stlv_tree;
11757
1.97k
                proto_item    *srv6_data_sstlv_item;
11758
1.97k
                proto_tree    *srv6_data_sstlv_tree;
11759
1.97k
                int sub_pnt, sub_end;
11760
1.97k
                int sub_sub_pnt, sub_sub_end;
11761
4.32k
                while (q < end) {
11762
2.61k
                    prefix_sid_subtype = tvb_get_uint8(tvb, q);
11763
2.61k
                    prefix_sid_sublen = tvb_get_ntohs(tvb, q + 1);
11764
2.61k
                    switch (prefix_sid_subtype) {
11765
406
                        case BGP_PREFIX_SID_TLV_LABEL_INDEX:
11766
406
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_label_index, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11767
406
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_label_index);
11768
406
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11769
406
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11770
406
                            if (prefix_sid_sublen != BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX){
11771
212
                                proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11772
212
                                    "Invalid BGP Prefix-SID Label Index length: %u bytes", prefix_sid_sublen);
11773
212
                                q += 3 + prefix_sid_sublen;
11774
212
                                break;
11775
212
                            }
11776
194
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11777
194
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_flags, tvb, q + 4, 2, ENC_BIG_ENDIAN);
11778
194
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_value, tvb, q + 6, 4, ENC_BIG_ENDIAN);
11779
194
                            proto_item_append_text(tlv_tree, ": %u ", tvb_get_ntohl(tvb, q + 6));
11780
194
                            q += 10;
11781
194
                            break;
11782
837
                        case BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB:
11783
837
                            check_srgb = prefix_sid_sublen - 2;
11784
837
                            prefix_sid_sub_tlv_offset = 0;
11785
837
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_originator_srgb, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11786
837
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb);
11787
837
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11788
837
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11789
837
                            if(check_srgb % 3 || check_srgb % 2){
11790
397
                                proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11791
397
                                    "Invalid BGP Prefix-SID SRGB Originator length: %u bytes", prefix_sid_sublen);
11792
397
                                q += 3 + prefix_sid_sublen;
11793
397
                                break;
11794
397
                            }
11795
440
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_flags, tvb, q + 3, 2, ENC_BIG_ENDIAN);
11796
440
                            q += 2;
11797
440
                            tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_blocks, tvb, q , prefix_sid_sublen - 2, ENC_NA);
11798
440
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb_blocks);
11799
1.39k
                            while (prefix_sid_sublen > prefix_sid_sub_tlv_offset + 2) {
11800
956
                                srgb_tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_block, tvb, q , prefix_sid_sublen - 2, ENC_NA);
11801
956
                                srgb_tlv_tree = proto_item_add_subtree(srgb_tlv_item, ett_bgp_prefix_sid_originator_srgb_block);
11802
956
                                prefix_sid_sub_tlv_offset += 3;
11803
956
                                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);
11804
956
                                prefix_sid_sub_tlv_offset += 3;
11805
956
                                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);
11806
956
                                proto_item_append_text(srgb_tlv_tree, "(%u:%u)", tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset - 3),
11807
956
                                    tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset));
11808
956
                            }
11809
440
                            q += 3 + prefix_sid_sublen;
11810
440
                            break;
11811
587
                        case BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE:
11812
587
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l3vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11813
587
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l3vpn);
11814
587
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11815
587
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11816
587
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11817
11818
587
                            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);
11819
587
                            srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs);
11820
11821
587
                            sub_pnt = q + 4;
11822
587
                            sub_end = q + 3 + prefix_sid_sublen;
11823
1.77k
                            while (sub_pnt < sub_end) {
11824
1.25k
                                srv6_service_subtlv_type = tvb_get_uint8(tvb, sub_pnt);
11825
1.25k
                                srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
11826
11827
1.25k
                                switch (srv6_service_subtlv_type) {
11828
742
                                    case SRV6_SERVICE_SRV6_SID_INFORMATION:
11829
742
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11830
742
                                                                        hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11831
742
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11832
742
                                        proto_item_append_text(stlv_item, " - %s",
11833
742
                                                               val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11834
742
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_information);
11835
11836
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11837
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11838
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
11839
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
11840
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
11841
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_BIG_ENDIAN);
11842
742
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
11843
11844
742
                                        srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
11845
742
                                                                                   hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
11846
742
                                                                                   tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
11847
742
                                        srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs);
11848
11849
742
                                        sub_sub_pnt = sub_pnt + 24;
11850
742
                                        sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
11851
1.57k
                                        while (sub_sub_pnt < sub_sub_end) {
11852
866
                                            srv6_service_data_subsubtlv_type = tvb_get_uint8(tvb, sub_sub_pnt);
11853
866
                                            srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
11854
11855
866
                                            switch (srv6_service_data_subsubtlv_type) {
11856
458
                                                case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
11857
458
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11858
458
                                                                                     hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11859
458
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11860
458
                                                    proto_item_append_text(sstlv_item, " - %s",
11861
458
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11862
458
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_structure);
11863
11864
458
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11865
458
                                                    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);
11866
458
                                                    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);
11867
458
                                                    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);
11868
458
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
11869
458
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
11870
458
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
11871
458
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
11872
458
                                                    break;
11873
391
                                                default:
11874
391
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11875
391
                                                                                     hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11876
391
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11877
391
                                                    proto_item_append_text(sstlv_item, " - %s",
11878
391
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11879
391
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown);
11880
11881
391
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11882
391
                                                    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);
11883
391
                                                    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);
11884
391
                                                    break;
11885
866
                                            }
11886
835
                                            sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
11887
835
                                        }
11888
711
                                        break;
11889
711
                                    default:
11890
490
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11891
490
                                                                        hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11892
490
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11893
490
                                        proto_item_append_text(stlv_item, " - %s", val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11894
490
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_unknown);
11895
11896
490
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11897
490
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11898
490
                                        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);
11899
490
                                        break;
11900
1.25k
                                }
11901
1.19k
                                sub_pnt += 3 + srv6_service_subtlv_len;
11902
1.19k
                            }
11903
519
                            q += (3 + prefix_sid_sublen);
11904
519
                            break;
11905
470
                        case BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE:
11906
470
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l2vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11907
470
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l2vpn);
11908
470
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11909
470
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11910
470
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11911
11912
470
                            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);
11913
470
                            srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs);
11914
11915
470
                            sub_pnt = q + 4;
11916
470
                            sub_end = q + 3 + prefix_sid_sublen;
11917
2.24k
                            while (sub_pnt < sub_end) {
11918
1.82k
                                srv6_service_subtlv_type = tvb_get_uint8(tvb, sub_pnt);
11919
1.82k
                                srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
11920
11921
1.82k
                                switch (srv6_service_subtlv_type) {
11922
1.45k
                                    case SRV6_SERVICE_SRV6_SID_INFORMATION:
11923
1.45k
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11924
1.45k
                                                                        hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11925
1.45k
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11926
1.45k
                                        proto_item_append_text(stlv_item, " - %s",
11927
1.45k
                                                               val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11928
1.45k
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_information);
11929
11930
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11931
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11932
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
11933
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
11934
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
11935
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_BIG_ENDIAN);
11936
1.45k
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
11937
11938
1.45k
                                        srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
11939
1.45k
                                                                                   hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
11940
1.45k
                                                                                   tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
11941
1.45k
                                        srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs);
11942
11943
1.45k
                                        sub_sub_pnt = sub_pnt + 24;
11944
1.45k
                                        sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
11945
3.57k
                                        while (sub_sub_pnt < sub_sub_end) {
11946
2.14k
                                            srv6_service_data_subsubtlv_type = tvb_get_uint8(tvb, sub_sub_pnt);
11947
2.14k
                                            srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
11948
11949
2.14k
                                            switch (srv6_service_data_subsubtlv_type) {
11950
1.85k
                                                case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
11951
1.85k
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11952
1.85k
                                                                                     hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11953
1.85k
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11954
1.85k
                                                    proto_item_append_text(sstlv_item, " - %s",
11955
1.85k
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11956
1.85k
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_structure);
11957
11958
1.85k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11959
1.85k
                                                    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);
11960
1.85k
                                                    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);
11961
1.85k
                                                    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);
11962
1.85k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
11963
1.85k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
11964
1.85k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
11965
1.85k
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
11966
1.85k
                                                    break;
11967
279
                                                default:
11968
279
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11969
279
                                                                                     hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11970
279
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11971
279
                                                    proto_item_append_text(sstlv_item, " - %s",
11972
279
                                                                           val_to_str(pinfo->pool, srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11973
279
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown);
11974
11975
279
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11976
279
                                                    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);
11977
279
                                                    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);
11978
279
                                                    break;
11979
2.14k
                                            }
11980
2.12k
                                            sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
11981
2.12k
                                        }
11982
1.43k
                                        break;
11983
1.43k
                                    default:
11984
344
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11985
344
                                                                        hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11986
344
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11987
344
                                        proto_item_append_text(stlv_item, " - %s", val_to_str(pinfo->pool, srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11988
344
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_unknown);
11989
11990
344
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11991
344
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11992
344
                                        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);
11993
344
                                        break;
11994
1.82k
                                }
11995
1.77k
                                sub_pnt += 3 + srv6_service_subtlv_len;
11996
1.77k
                            }
11997
416
                            q += (3 + prefix_sid_sublen);
11998
416
                            break;
11999
276
                        default:
12000
276
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_unknown, tvb, q, prefix_sid_sublen + 3, ENC_NA);
12001
276
                            proto_item_append_text(tlv_item, " (%s)", val_to_str(pinfo->pool, prefix_sid_subtype, bgp_prefix_sid_type, "%u"));
12002
276
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_unknown);
12003
276
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
12004
276
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
12005
276
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_value, tvb, q + 3, prefix_sid_sublen - 3, ENC_NA);
12006
276
                            q += (3 + prefix_sid_sublen);
12007
276
                            break;
12008
2.61k
                    }
12009
2.61k
                }
12010
1.70k
                break;
12011
3.30k
            case BGPTYPE_PMSI_TUNNEL_ATTR:
12012
3.30k
                dissect_bgp_update_pmsi_attr(pinfo, subtree2, tvb, tlen, o+i+aoff);
12013
3.30k
                break;
12014
12015
1.19k
            case BGPTYPE_ATTR_SET:
12016
1.19k
                if (alen >= 4) {
12017
931
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_attrset_origin_as, tvb,
12018
931
                                        o + i + aoff, 4, ENC_BIG_ENDIAN);
12019
931
                    if (alen > 4) {
12020
727
                        ti =  proto_tree_add_item(subtree2, hf_bgp_update_path_attributes, tvb, o+i+aoff+4, alen-4, ENC_NA);
12021
727
                        attr_set_subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
12022
727
                        dissect_bgp_path_attr(attr_set_subtree, tvb, alen-4, o+i+aoff+4, pinfo);
12023
727
                    }
12024
931
                } else {
12025
260
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
12026
260
                                                 "Attribute set (invalid): %u byte%s",
12027
260
                                                 alen, plurality(alen, "", "s"));
12028
260
                }
12029
1.19k
                break;
12030
459
            case BGPTYPE_OTC:
12031
459
                if (tlen != 4) {
12032
265
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
12033
265
                                                 "Only to Customer (invalid): %u byte%s", tlen,
12034
265
                                                 plurality(tlen, "", "s"));
12035
265
                } else {
12036
194
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_otc, tvb,
12037
194
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
12038
194
                    proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
12039
194
                }
12040
459
                break;
12041
515
            case BGPTYPE_D_PATH:
12042
515
                if(tlen < 8){
12043
242
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
12044
242
                                                 "D-PATH attribute has invalid length (invalid): %u byte%s", tlen,
12045
242
                                                 plurality(tlen, "", "s"));
12046
242
                    break;
12047
242
                }
12048
273
                q = o + i + aoff;
12049
273
                end = q + tlen;
12050
273
                wmem_strbuf_t *dpath_strbuf;
12051
273
                dpath_strbuf = wmem_strbuf_create(pinfo->pool);
12052
273
                uint8_t dpath_len;
12053
273
                dpath_len = tvb_get_uint8(tvb, q);
12054
273
                proto_tree_add_item(subtree2, hf_bgp_d_path_length, tvb,
12055
273
                                        q, 1, ENC_BIG_ENDIAN);
12056
273
                q += 1;
12057
1.39k
                while (dpath_len > 0 && q < end) {
12058
1.12k
                    uint32_t ad;
12059
1.12k
                    uint16_t ld;
12060
1.12k
                    ad = tvb_get_ntohl(tvb, q);
12061
1.12k
                    ld = tvb_get_ntohs(tvb, q+4);
12062
1.12k
                    ti = proto_tree_add_string_format(subtree2, hf_bgp_update_path_attribute_d_path, tvb, q, 6, NULL, "Domain ID: %u:%u", ad, ld);
12063
1.12k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_dpath);
12064
1.12k
                    proto_tree_add_item(subtree3, hf_bgp_d_path_ga, tvb,
12065
1.12k
                                        q, 4, ENC_BIG_ENDIAN);
12066
1.12k
                    proto_tree_add_item(subtree3, hf_bgp_d_path_la, tvb,
12067
1.12k
                                        q + 4, 2, ENC_BIG_ENDIAN);
12068
1.12k
                    wmem_strbuf_append_printf(dpath_strbuf, " %u:%u", ad, ld);
12069
1.12k
                    q += 6;
12070
1.12k
                    dpath_len -= 1;
12071
1.12k
                }
12072
273
                if (dpath_len != 0 || q >= end) {
12073
145
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
12074
145
                                                 "D-PATH list (invalid): %u byte%s", tlen,
12075
145
                                                 plurality(tlen, "", "s"));
12076
145
                    break;
12077
145
                }
12078
128
                proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(dpath_strbuf));
12079
12080
128
                proto_tree_add_item(subtree2, hf_bgp_d_path_isf_safi, tvb,
12081
128
                                    q, 1, ENC_BIG_ENDIAN);
12082
128
                break;
12083
404
            case BGPTYPE_BFD_DISCRIMINATOR: {
12084
404
                if (tlen < 5) {
12085
68
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
12086
68
                                                 "BFD Discriminator attribute has invalid length: %u byte%s (must be at least 5)",
12087
68
                                                 tlen, plurality(tlen, "", "s"));
12088
68
                    break;
12089
68
                }
12090
336
                q = o + i + aoff;
12091
336
                end = q + tlen;
12092
12093
336
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_bfd_mode, tvb, q, 1, ENC_BIG_ENDIAN);
12094
336
                uint8_t bfd_mode = tvb_get_uint8(tvb, q);
12095
336
                q += 1;
12096
12097
336
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_bfd_discriminator, tvb, q, 4, ENC_BIG_ENDIAN);
12098
336
                uint32_t bfd_disc = tvb_get_ntohl(tvb, q);
12099
336
                proto_item_append_text(ti_pa, ": Mode %u, Discriminator 0x%08x", bfd_mode, bfd_disc);
12100
336
                q += 4;
12101
12102
1.46k
                while (q < end) {
12103
1.32k
                    if (end - q < 2) {
12104
66
                        proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, q, end - q,
12105
66
                                                     "Truncated BFD Discriminator optional TLV header");
12106
66
                        break;
12107
66
                    }
12108
1.25k
                    uint8_t tlv_type = tvb_get_uint8(tvb, q);
12109
1.25k
                    uint8_t tlv_len  = tvb_get_uint8(tvb, q + 1);
12110
12111
1.25k
                    if (q + 2 + tlv_len > end) {
12112
43
                        proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, q, end - q,
12113
43
                                                     "BFD Discriminator optional TLV length %u exceeds attribute length", tlv_len);
12114
43
                        break;
12115
43
                    }
12116
12117
1.21k
                    ti = proto_tree_add_none_format(subtree2, hf_bgp_bfd_discriminator_tlv, tvb, q, 2 + tlv_len,
12118
1.21k
                                                    "TLV: %s (Length: %u)",
12119
1.21k
                                                    val_to_str_const(tlv_type, bgp_bfd_discriminator_tlv_type_vals, "Unknown"),
12120
1.21k
                                                    tlv_len);
12121
1.21k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_bfd_discriminator_tlv);
12122
1.21k
                    proto_tree_add_item(subtree3, hf_bgp_bfd_discriminator_tlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
12123
1.21k
                    q += 1;
12124
1.21k
                    proto_tree_add_item(subtree3, hf_bgp_bfd_discriminator_tlv_length, tvb, q, 1, ENC_BIG_ENDIAN);
12125
1.21k
                    q += 1;
12126
12127
1.21k
                    switch (tlv_type) {
12128
661
                    case BGP_BFD_DISCRIMINATOR_TLV_SOURCE_IP:
12129
661
                        if (tlv_len == 4) {
12130
195
                            proto_tree_add_item(subtree3, hf_bgp_bfd_discriminator_tlv_source_ipv4, tvb, q, 4, ENC_BIG_ENDIAN);
12131
195
                            proto_item_append_text(ti, ": %s", tvb_ip_to_str(pinfo->pool, tvb, q));
12132
466
                        } else if (tlv_len == 16) {
12133
66
                            proto_tree_add_item(subtree3, hf_bgp_bfd_discriminator_tlv_source_ipv6, tvb, q, 16, ENC_NA);
12134
66
                            proto_item_append_text(ti, ": %s", tvb_ip6_to_str(pinfo->pool, tvb, q));
12135
400
                        } else {
12136
400
                            proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q, tlv_len,
12137
400
                                                         "Invalid Source IP Address length: %u (expected 4 or 16)", tlv_len);
12138
400
                            if (tlv_len > 0) {
12139
198
                                proto_tree_add_item(subtree3, hf_bgp_bfd_discriminator_tlv_value, tvb, q, tlv_len, ENC_NA);
12140
198
                            }
12141
400
                        }
12142
661
                        break;
12143
505
                    default:
12144
505
                        if (tlv_len > 0) {
12145
219
                            proto_tree_add_item(subtree3, hf_bgp_bfd_discriminator_tlv_value, tvb, q, tlv_len, ENC_NA);
12146
219
                        }
12147
505
                        break;
12148
1.21k
                    }
12149
1.13k
                    q += tlv_len;
12150
1.13k
                }
12151
336
            } break;
12152
8.29k
            default:
12153
8.29k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attributes_unknown, tvb, o + i + aoff, tlen, ENC_NA);
12154
8.29k
                break;
12155
68.1k
        } /* switch (bgpa.bgpa_type) */ /* end of second switch */
12156
12157
59.5k
        i += alen + aoff;
12158
59.5k
    }
12159
2.71k
    decrement_dissection_depth(pinfo);
12160
2.71k
    {
12161
        /* FF: postponed BGPTYPE_LINK_STATE_ATTR dissection */
12162
2.71k
        link_state_data *data = load_link_state_data(pinfo);
12163
2.71k
        if (data && data->link_state_attr_present) {
12164
2.32k
            ti = proto_tree_add_item(data->subtree2, hf_bgp_update_path_attribute_link_state, tvb, data->ostart, data->tlen, ENC_NA);
12165
2.32k
            subtree3 = proto_item_add_subtree(ti, ett_bgp_link_state);
12166
9.82k
            while (data->ostart < data->oend) {
12167
7.50k
                advance = decode_link_state_attribute_tlv(subtree3, tvb, data->ostart, pinfo, data->protocol_id);
12168
7.50k
                if (advance < 0) {
12169
0
                    break;
12170
0
                }
12171
7.50k
                data->ostart += advance;
12172
7.50k
            }
12173
2.32k
        }
12174
2.71k
    }
12175
2.71k
}
12176
/*
12177
 * Dissect a BGP UPDATE message.
12178
 */
12179
static void
12180
dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
12181
11.9k
{
12182
11.9k
    uint16_t        hlen;                       /* message length           */
12183
11.9k
    int             o;                          /* packet offset            */
12184
11.9k
    int             end=0;                      /* message end              */
12185
11.9k
    uint16_t        len;                        /* tmp                      */
12186
11.9k
    proto_item      *ti;                        /* tree item                */
12187
11.9k
    proto_tree      *subtree;                   /* subtree for attributes   */
12188
11.9k
    int             i;                          /* tmp                      */
12189
12190
11.9k
    hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
12191
11.9k
    o = BGP_HEADER_SIZE;
12192
12193
12194
    /* check for withdrawals */
12195
11.9k
    proto_tree_add_item_ret_uint16(tree, hf_bgp_update_withdrawn_routes_length, tvb, o, 2, ENC_BIG_ENDIAN, &len);
12196
11.9k
    o += 2;
12197
12198
    /* parse unfeasible prefixes */
12199
11.9k
    if (len > 0) {
12200
575
        ti = proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes, tvb, o, len, ENC_NA);
12201
575
        subtree = proto_item_add_subtree(ti, ett_bgp_unfeas);
12202
12203
        /* parse each prefix */
12204
575
        end = o + len;
12205
12206
        /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
12207
575
        if( detect_add_path_prefix4(tvb, o, end) ) {
12208
            /* IPv4 prefixes with Path Id */
12209
718
            while (o < end) {
12210
586
                i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_withdrawn_prefix, tvb, o,
12211
586
                    "Withdrawn route");
12212
586
                if (i < 0)
12213
67
                    return;
12214
519
                o += i;
12215
519
            }
12216
376
        } else {
12217
1.01k
            while (o < end) {
12218
699
                i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_withdrawn_prefix, tvb, o,
12219
699
                    "Withdrawn route");
12220
699
                if (i < 0)
12221
59
                    return;
12222
640
                o += i;
12223
640
            }
12224
376
        }
12225
575
    }
12226
12227
    /* check for advertisements */
12228
11.8k
    proto_tree_add_item_ret_uint16(tree, hf_bgp_update_total_path_attribute_length, tvb, o, 2, ENC_BIG_ENDIAN, &len);
12229
12230
    /* path attributes */
12231
11.8k
    if (len > 0) {
12232
11.2k
        ti =  proto_tree_add_item(tree, hf_bgp_update_path_attributes, tvb, o+2, len, ENC_NA);
12233
11.2k
        subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
12234
12235
11.2k
        dissect_bgp_path_attr(subtree, tvb, len, o+2, pinfo);
12236
12237
11.2k
        o += 2 + len;
12238
12239
        /* NLRI */
12240
11.2k
        len = hlen - o;
12241
12242
        /* parse prefixes */
12243
11.2k
        if (len > 0) {
12244
1.32k
            ti = proto_tree_add_item(tree, hf_bgp_update_nlri, tvb, o, len, ENC_NA);
12245
1.32k
            subtree = proto_item_add_subtree(ti, ett_bgp_nlri);
12246
1.32k
            end = o + len;
12247
            /*
12248
             * Heuristic to detect if IPv4 prefix are using Path Identifiers
12249
             * we need at least 5 bytes for Add-path prefixes
12250
             */
12251
1.32k
            if( len > 4 && detect_add_path_prefix4(tvb, o, end) ) {
12252
                /* IPv4 prefixes with Path Id */
12253
371
                while (o < end) {
12254
292
                    i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_nlri_prefix, tvb, o,
12255
292
                                            "NLRI");
12256
292
                    if (i < 0)
12257
0
                       return;
12258
292
                    o += i;
12259
292
                }
12260
1.24k
            } else {
12261
                /* Standard prefixes */
12262
1.72k
                while (o < end) {
12263
569
                    i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_nlri_prefix, tvb, o, "NLRI");
12264
569
                    if (i < 0)
12265
91
                        return;
12266
478
                    o += i;
12267
478
                }
12268
1.24k
            }
12269
1.32k
        }
12270
11.2k
    }
12271
11.8k
}
12272
12273
/*
12274
 * Dissect a BGP CAPABILITY message.
12275
 */
12276
static void
12277
dissect_bgp_capability(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
12278
375
{
12279
375
    unsigned offset = 0;
12280
375
    unsigned mend;
12281
12282
375
    mend = offset + tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
12283
375
    offset += BGP_HEADER_SIZE;
12284
    /* step through all of the capabilities */
12285
1.86k
    while (offset < mend) {
12286
1.48k
        offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, true);
12287
1.48k
    }
12288
375
}
12289
12290
/*
12291
 * Dissect a BGP NOTIFICATION message.
12292
 */
12293
static void
12294
dissect_bgp_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
12295
1.42k
{
12296
1.42k
    int                     hlen;   /* message length           */
12297
1.42k
    int                     offset;
12298
1.42k
    unsigned                major_error;
12299
1.42k
    proto_item              *ti;
12300
1.42k
    uint8_t                 clen;
12301
1.42k
    uint8_t                 minor_cease;
12302
12303
12304
1.42k
    hlen =  tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
12305
1.42k
    offset = BGP_MARKER_SIZE + 2 + 1;
12306
12307
12308
    /* print error code */
12309
1.42k
    proto_tree_add_item_ret_uint(tree, hf_bgp_notify_major_error, tvb, offset, 1, ENC_BIG_ENDIAN, &major_error);
12310
1.42k
    offset += 1;
12311
12312
1.42k
    switch(major_error){
12313
68
        case BGP_MAJOR_ERROR_MSG_HDR:
12314
68
            proto_tree_add_item(tree, hf_bgp_notify_minor_msg_hdr, tvb, offset, 1, ENC_BIG_ENDIAN);
12315
68
        break;
12316
574
        case BGP_MAJOR_ERROR_OPEN_MSG:
12317
574
            proto_tree_add_item(tree, hf_bgp_notify_minor_open_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
12318
574
        break;
12319
87
        case BGP_MAJOR_ERROR_UPDATE_MSG:
12320
87
            proto_tree_add_item(tree,hf_bgp_notify_minor_update_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
12321
87
        break;
12322
99
        case BGP_MAJOR_ERROR_HT_EXPIRED:
12323
99
            proto_tree_add_item(tree, hf_bgp_notify_minor_ht_expired, tvb, offset,  1, ENC_BIG_ENDIAN);
12324
99
        break;
12325
70
        case BGP_MAJOR_ERROR_STATE_MACHINE:
12326
70
            proto_tree_add_item(tree, hf_bgp_notify_minor_state_machine, tvb, offset, 1, ENC_BIG_ENDIAN);
12327
70
        break;
12328
282
        case BGP_MAJOR_ERROR_CEASE:
12329
282
            proto_tree_add_item(tree, hf_bgp_notify_minor_cease, tvb, offset, 1, ENC_BIG_ENDIAN);
12330
282
        break;
12331
124
        case BGP_MAJOR_ERROR_ROUTE_REFRESH:
12332
124
            proto_tree_add_item(tree, hf_bgp_notify_minor_rr_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
12333
124
        break;
12334
106
        default:
12335
106
            ti = proto_tree_add_item(tree, hf_bgp_notify_minor_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
12336
106
            expert_add_info_format(pinfo, ti, &ei_bgp_notify_minor_unknown, "Unknown notification error (%d)",major_error);
12337
106
        break;
12338
1.42k
    }
12339
1.08k
    offset += 1;
12340
12341
    /* only print if there is optional data */
12342
1.08k
    if (hlen > BGP_MIN_NOTIFICATION_MSG_SIZE) {
12343
958
        minor_cease = tvb_get_uint8(tvb, offset - 1);
12344
958
        clen = tvb_get_uint8(tvb, offset);
12345
        /* Might be a idr-shutdown communication, first byte is length */
12346
958
        if (hlen - BGP_MIN_NOTIFICATION_MSG_SIZE - 1 == clen && major_error == BGP_MAJOR_ERROR_CEASE &&
12347
259
                (minor_cease == BGP_CEASE_MINOR_ADMIN_SHUTDOWN || minor_cease == BGP_CEASE_MINOR_ADMIN_RESET) ) {
12348
154
            proto_tree_add_item(tree, hf_bgp_notify_communication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
12349
154
            offset += 1;
12350
154
            proto_tree_add_item(tree, hf_bgp_notify_communication, tvb, offset, clen, ENC_UTF_8);
12351
        /* otherwise just dump the hex data */
12352
804
        } else if ( major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 7 ) {
12353
7.65k
            while (offset < hlen) {
12354
7.29k
                offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, false);
12355
7.29k
            }
12356
445
        } else if (major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 2 ) { /* Display Bad Peer AS Number */
12357
98
            proto_tree_add_item(tree, hf_bgp_notify_error_open_bad_peer_as, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_BIG_ENDIAN);
12358
347
        } else {
12359
347
            proto_tree_add_item(tree, hf_bgp_notify_data, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_NA);
12360
347
        }
12361
958
    }
12362
1.08k
}
12363
12364
/*
12365
 * Dissect a BGP ROUTE-REFRESH message.
12366
 */
12367
static void
12368
dissect_bgp_route_refresh(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
12369
721
{
12370
721
    int             p;         /* tvb offset counter    */
12371
721
    int             pend;       /* end of list of entries for one orf type */
12372
721
    uint16_t        hlen;       /* tvb RR msg length */
12373
721
    proto_item      *ti;        /* tree item             */
12374
721
    proto_item      *ti1;       /* tree item             */
12375
721
    proto_tree      *subtree;   /* tree for orf   */
12376
721
    proto_tree      *subtree1;  /* tree for orf entry */
12377
721
    uint8_t         orftype;    /* ORF Type */
12378
721
    uint16_t        orflen;     /* ORF len */
12379
721
    uint8_t         entryflag;  /* ORF Entry flag: action(add,del,delall) match(permit,deny) */
12380
721
    int             entrylen;   /* ORF Entry length */
12381
721
    int             advance;    /* tmp                      */
12382
721
    uint32_t        afi;
12383
721
    uint32_t        safi;
12384
12385
12386
/*
12387
example 1
12388
 00 1c 05       hlen=28
12389
 00 01 00 01    afi,safi= ipv4-unicast
12390
 02 80 00 01    defer, prefix-orf, len=1
12391
    80            removeall
12392
example 2
12393
 00 25 05       hlen=37
12394
 00 01 00 01    afi,saif= ipv4-unicast
12395
 01 80 00 0a    immediate, prefix-orf, len=10
12396
    00            add
12397
    00 00 00 05   seqno = 5
12398
    12            ge = 18
12399
    18            le = 24
12400
    10 07 02      prefix = 7.2.0.0/16
12401
*/
12402
721
    if (!tree)
12403
0
        return;
12404
12405
721
    hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
12406
721
    p = BGP_HEADER_SIZE;
12407
12408
    /* AFI */
12409
721
    proto_tree_add_item_ret_uint(tree, hf_bgp_route_refresh_afi, tvb, p, 2, ENC_BIG_ENDIAN, &afi);
12410
721
    p += 2;
12411
12412
    /*  Subtype in draft-ietf-idr-bgp-enhanced-route-refresh-02 (for Enhanced Route Refresh Capability) before Reserved*/
12413
721
    proto_tree_add_item(tree, hf_bgp_route_refresh_subtype, tvb, p, 1, ENC_BIG_ENDIAN);
12414
721
    p++;
12415
12416
    /* SAFI */
12417
721
    proto_tree_add_item_ret_uint(tree, hf_bgp_route_refresh_safi, tvb, p, 1, ENC_BIG_ENDIAN, &safi);
12418
721
    p++;
12419
721
    save_afi_safi_data(pinfo, (uint16_t)afi, (uint8_t)safi);
12420
12421
721
    if ( hlen == BGP_HEADER_SIZE + 4 )
12422
129
        return;
12423
3.32k
    while (p < hlen) {
12424
        /* ORF type */
12425
12426
2.89k
        ti = proto_tree_add_item(tree, hf_bgp_route_refresh_orf, tvb, p, 4, ENC_NA);
12427
2.89k
        subtree = proto_item_add_subtree(ti, ett_bgp_orf);
12428
12429
2.89k
        proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_flag, tvb, p, 1, ENC_BIG_ENDIAN);
12430
2.89k
        p += 1;
12431
12432
2.89k
        ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_type, tvb, p, 1, ENC_BIG_ENDIAN);
12433
2.89k
        orftype = tvb_get_uint8(tvb, p);
12434
2.89k
        p += 1;
12435
12436
2.89k
        proto_tree_add_item_ret_uint16(subtree, hf_bgp_route_refresh_orf_length, tvb, p, 2, ENC_BIG_ENDIAN, &orflen);
12437
2.89k
        proto_item_set_len(ti, orflen + 4);
12438
2.89k
        p += 2;
12439
12440
2.89k
        pend = p + orflen;
12441
12442
2.89k
        switch (orftype) {
12443
196
        case BGP_ORF_COMM:
12444
390
        case BGP_ORF_EXTCOMM:
12445
587
        case BGP_ORF_ASPATH:
12446
587
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unregistered, "Deprecated non-IANA ORF Entry type %u", orftype);
12447
587
            break;
12448
12449
209
        case BGP_ORF_PREFIX:
12450
889
        case BGP_ORF_PREFIX_CISCO:
12451
1.97k
            while (p < pend) {
12452
1.27k
                ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_entry_prefixlist, tvb, p, 1, ENC_NA);
12453
1.27k
                subtree1 = proto_item_add_subtree(ti1, ett_bgp_orf_entry);
12454
1.27k
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_action, tvb, p, 1, ENC_BIG_ENDIAN);
12455
1.27k
                entryflag = tvb_get_uint8(tvb, p);
12456
1.27k
                if (((entryflag & BGP_ORF_ACTION) >> 6) == BGP_ORF_REMOVEALL) {
12457
492
                    p++;
12458
492
                    continue;
12459
492
                }
12460
786
                if (((entryflag & BGP_ORF_ACTION) >> 6) > BGP_ORF_REMOVEALL) {
12461
472
                    expert_add_info(pinfo, ti1, &ei_bgp_route_refresh_orf_action_invalid);
12462
472
                    p++;
12463
472
                    continue;
12464
472
                }
12465
314
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_match, tvb, p, 1, ENC_BIG_ENDIAN);
12466
314
                p++;
12467
12468
314
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_sequence, tvb, p, 4, ENC_BIG_ENDIAN);
12469
314
                p +=4;
12470
12471
314
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_lower, tvb, p, 1, ENC_BIG_ENDIAN);
12472
314
                p++;
12473
12474
314
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_upper, tvb, p, 1, ENC_BIG_ENDIAN);
12475
314
                p++;
12476
12477
314
                advance = decode_prefix4(subtree1, pinfo, NULL, hf_bgp_route_refresh_orf_entry_ip, tvb, p, "ORF");
12478
314
                if (advance < 0)
12479
194
                        break;
12480
120
                entrylen = 7 + 1 + advance;
12481
12482
120
                proto_item_set_len(ti1, entrylen);
12483
120
                p += advance;
12484
120
            }
12485
889
            break;
12486
12487
195
        case BGP_ORF_CP_ORF:
12488
396
        case BGP_ORF_VPN_PREFIX:
12489
591
        case BGP_ORF_COMM_CISCO:
12490
785
        case BGP_ORF_EXTCOMM_CISCO:
12491
980
        case BGP_ORF_ASPATH_CISCO:
12492
980
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unsupported, "ORF entry type %u not supported for decoding", orftype);
12493
980
            break;
12494
12495
324
        default:
12496
324
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unknown, "ORFEntry-Unknown (type %u)", orftype);
12497
2.89k
        }
12498
12499
2.72k
        p = pend;
12500
2.72k
    }
12501
592
}
12502
12503
static bool
12504
bgp_length_is_valid (uint8_t bgp_type, uint32_t bgp_len)
12505
15.5k
{
12506
15.5k
    switch (bgp_type) {
12507
645
    case BGP_OPEN:
12508
1.02k
    case BGP_CAPABILITY:
12509
1.02k
        if (bgp_len < BGP_HEADER_SIZE || bgp_len > BGP_MAX_PACKET_SIZE)
12510
10
            return false;
12511
1.01k
        break;
12512
1.01k
    case BGP_KEEPALIVE:
12513
304
        if (bgp_len != BGP_HEADER_SIZE)
12514
81
            return false;
12515
223
        break;
12516
11.9k
    case BGP_UPDATE:
12517
13.4k
    case BGP_NOTIFICATION:
12518
13.8k
    case BGP_ROUTE_REFRESH_CISCO:
12519
14.1k
    case BGP_ROUTE_REFRESH:
12520
14.1k
    default:
12521
14.1k
        if (bgp_len < BGP_HEADER_SIZE)
12522
0
            return false;
12523
14.1k
        if (bgp_ext_msg) {
12524
14.1k
            if (bgp_len > BGP_MAX_PACKET_SIZE_EXTENDED)
12525
0
                return false;
12526
14.1k
        } else {
12527
0
            if (bgp_len > BGP_MAX_PACKET_SIZE)
12528
0
                return false;
12529
0
        }
12530
14.1k
        break;
12531
15.5k
    }
12532
12533
    /* length is valid */
12534
15.4k
    return true;
12535
15.5k
}
12536
12537
static int
12538
dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
12539
                void *data _U_)
12540
15.5k
{
12541
15.5k
    uint32_t      bgp_len;          /* Message length             */
12542
15.5k
    uint8_t       bgp_type;         /* Message type               */
12543
15.5k
    const char    *typ;             /* Message type (string)      */
12544
15.5k
    proto_item    *ti = NULL;
12545
15.5k
    proto_item    *ti_marker = NULL;/* marker item                */
12546
15.5k
    proto_item    *ti_len = NULL;   /* length item                */
12547
15.5k
    proto_tree    *bgp_tree = NULL; /* BGP packet tree            */
12548
15.5k
    static const uint8_t valid_marker[BGP_MARKER_SIZE] = {
12549
15.5k
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
12550
15.5k
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
12551
15.5k
    };
12552
12553
15.5k
    bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
12554
15.5k
    bgp_type = tvb_get_uint8(tvb, BGP_MARKER_SIZE + 2);
12555
15.5k
    typ = val_to_str(pinfo->pool, bgp_type, bgptypevals, "Unknown message type (0x%02x)");
12556
12557
15.5k
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP");
12558
15.5k
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, typ);
12559
12560
15.5k
    if (tree) {
12561
15.5k
        ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, ENC_NA);
12562
15.5k
        proto_item_append_text(ti, " - %s", typ);
12563
12564
        /* add a different tree for each message type */
12565
15.5k
        switch (bgp_type) {
12566
645
            case BGP_OPEN:
12567
645
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_open);
12568
645
                break;
12569
11.9k
            case BGP_UPDATE:
12570
11.9k
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_update);
12571
11.9k
                break;
12572
1.42k
            case BGP_NOTIFICATION:
12573
1.42k
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_notification);
12574
1.42k
                break;
12575
304
            case BGP_KEEPALIVE:
12576
304
                bgp_tree = proto_item_add_subtree(ti, ett_bgp);
12577
304
                break;
12578
396
            case BGP_ROUTE_REFRESH_CISCO:
12579
721
            case BGP_ROUTE_REFRESH:
12580
721
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh);
12581
721
                break;
12582
376
            case BGP_CAPABILITY:
12583
376
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_capability);
12584
376
                break;
12585
55
            default:
12586
55
                bgp_tree = proto_item_add_subtree(ti, ett_bgp);
12587
55
                break;
12588
15.5k
        }
12589
12590
15.5k
        ti_marker = proto_tree_add_item(bgp_tree, hf_bgp_marker, tvb, 0,
12591
15.5k
          BGP_MARKER_SIZE, ENC_NA);
12592
15.5k
        if (tvb_memeql(tvb, 0, valid_marker, BGP_MARKER_SIZE) != 0) {
12593
3.34k
             expert_add_info(pinfo, ti_marker, &ei_bgp_marker_invalid);
12594
3.34k
        }
12595
12596
15.5k
        ti_len = proto_tree_add_item(bgp_tree, hf_bgp_length, tvb, 16, 2, ENC_BIG_ENDIAN);
12597
15.5k
    }
12598
12599
15.5k
    if (! bgp_length_is_valid (bgp_type, bgp_len)) {
12600
91
        expert_add_info_format(pinfo, ti_len, &ei_bgp_length_invalid, "Length is invalid %u", bgp_len);
12601
91
        return tvb_captured_length(tvb);
12602
91
    }
12603
12604
15.4k
    if (tree) {
12605
15.4k
        proto_item_set_len(ti, bgp_len);
12606
15.4k
    }
12607
12608
15.4k
    proto_tree_add_item(bgp_tree, hf_bgp_type, tvb, 16 + 2, 1, ENC_BIG_ENDIAN);
12609
12610
15.4k
    switch (bgp_type) {
12611
636
    case BGP_OPEN:
12612
636
        dissect_bgp_open(tvb, bgp_tree, pinfo);
12613
636
        break;
12614
11.9k
    case BGP_UPDATE:
12615
11.9k
        dissect_bgp_update(tvb, bgp_tree, pinfo);
12616
11.9k
        break;
12617
1.42k
    case BGP_NOTIFICATION:
12618
1.42k
        dissect_bgp_notification(tvb, bgp_tree, pinfo);
12619
1.42k
        break;
12620
223
    case BGP_KEEPALIVE:
12621
        /* no data in KEEPALIVE messages */
12622
223
        break;
12623
396
    case BGP_ROUTE_REFRESH_CISCO:
12624
721
    case BGP_ROUTE_REFRESH:
12625
721
        dissect_bgp_route_refresh(tvb, bgp_tree, pinfo);
12626
721
        break;
12627
375
    case BGP_CAPABILITY:
12628
375
        dissect_bgp_capability(tvb, bgp_tree, pinfo);
12629
375
        break;
12630
55
    default:
12631
55
        break;
12632
15.4k
    }
12633
2.07k
    return bgp_len;
12634
15.4k
}
12635
12636
static unsigned
12637
get_bgp_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
12638
15.6k
{
12639
15.6k
    return tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
12640
15.6k
}
12641
12642
/*
12643
 * Dissect a BGP packet.
12644
 */
12645
static int
12646
dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
12647
12.1k
{
12648
12.1k
    volatile unsigned  offset = 0;      /* offset into the tvbuff           */
12649
12.1k
    static unsigned char marker[] = {   /* BGP message marker               */
12650
12.1k
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
12651
12.1k
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
12652
12.1k
    };
12653
12.1k
    proto_item    *ti;           /* tree item                        */
12654
12.1k
    proto_tree    *bgp_tree;     /* BGP packet tree                  */
12655
12.1k
    tvbuff_t *volatile this_tvb; /* for tcp_dissect_pdus()           */
12656
12657
    /*
12658
     * Scan through the TCP payload looking for a BGP marker.
12659
     */
12660
14.7k
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
12661
        /*
12662
         * Start with a quick search for 0xFFFF, then do the heavier
12663
         * tvb_memeql() once we find it.
12664
         */
12665
14.7k
        if (!tvb_find_uint16_remaining(tvb, (unsigned)offset, 0xFFFF, (unsigned*)&offset)){
12666
            /* Didn't find even the start of a marker */
12667
180
            return 0;
12668
180
        }
12669
14.5k
        else if (0 == tvb_memeql(tvb, offset, marker, BGP_MARKER_SIZE)) {
12670
            /* Found the marker - stop scanning and start processing BGP packets. */
12671
11.9k
            break;
12672
11.9k
        }
12673
2.60k
        else {
12674
            /* Keep scanning through the tvbuff to try to find a marker. */
12675
2.60k
            offset++;
12676
2.60k
        }
12677
14.7k
    }
12678
12679
11.9k
    col_clear(pinfo->cinfo, COL_INFO);
12680
12681
    /*
12682
     * If we skipped any bytes, mark it as a BGP continuation.
12683
     */
12684
11.9k
    if (offset > 0) {
12685
168
        ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, offset, ENC_NA);
12686
168
        bgp_tree = proto_item_add_subtree(ti, ett_bgp);
12687
168
        proto_item_append_text(bgp_tree, " - Continuation");
12688
168
        proto_tree_add_item(bgp_tree, hf_bgp_continuation, tvb, 0, offset, ENC_NA);
12689
12690
        /* Don't include the continuation in PDU reassembly */
12691
168
        this_tvb = tvb_new_subset_remaining(tvb, offset);
12692
168
    }
12693
11.7k
    else {
12694
11.7k
        this_tvb = tvb;
12695
11.7k
    }
12696
12697
    /*
12698
     * Now process the BGP packets in the TCP payload.
12699
     */
12700
11.9k
    tcp_dissect_pdus(this_tvb, pinfo, tree, bgp_desegment, BGP_HEADER_SIZE,
12701
11.9k
                     get_bgp_len, dissect_bgp_pdu, NULL);
12702
11.9k
    return tvb_captured_length(tvb);
12703
12.1k
}
12704
12705
/*
12706
 * Register ourselves.
12707
 */
12708
void
12709
proto_register_bgp(void)
12710
16
{
12711
12712
16
    static hf_register_info hf[] = {
12713
      /* BGP Header */
12714
16
      { &hf_bgp_marker,
12715
16
        { "Marker", "bgp.marker", FT_BYTES, BASE_NONE,
12716
16
          NULL, 0x0, "Must be set to all ones (16 Bytes)", HFILL }},
12717
16
      { &hf_bgp_length,
12718
16
        { "Length", "bgp.length", FT_UINT16, BASE_DEC,
12719
16
          NULL, 0x0, "The total length of the message, including the header in octets", HFILL }},
12720
16
      { &hf_bgp_prefix_length,
12721
16
        { "Prefix Length", "bgp.prefix_length", FT_UINT8, BASE_DEC,
12722
16
          NULL, 0x0, NULL, HFILL }},
12723
16
      { &hf_bgp_rd,
12724
16
        { "Route Distinguisher", "bgp.rd", FT_STRING, BASE_NONE,
12725
16
          NULL, 0x0, NULL, HFILL }},
12726
16
      { &hf_bgp_continuation,
12727
16
        { "Continuation", "bgp.continuation", FT_NONE, BASE_NONE,
12728
16
          NULL, 0x0, NULL, HFILL }},
12729
16
      { &hf_bgp_originating_as,
12730
16
        { "Originating AS", "bgp.originating_as", FT_UINT32, BASE_DEC,
12731
16
          NULL, 0x0, NULL, HFILL }},
12732
16
      { &hf_bgp_community_prefix,
12733
16
        { "Community Prefix", "bgp.community_prefix", FT_STRING, BASE_NONE,
12734
16
          NULL, 0x0, NULL, HFILL }},
12735
16
      { &hf_bgp_endpoint_address,
12736
16
        { "Endpoint Address", "bgp.endpoint_address", FT_IPv4, BASE_NONE,
12737
16
          NULL, 0x0, NULL, HFILL }},
12738
16
      { &hf_bgp_endpoint_address_ipv6,
12739
16
        { "Endpoint Address", "bgp.endpoint_address_ipv6", FT_IPv6, BASE_NONE,
12740
16
          NULL, 0x0, NULL, HFILL }},
12741
16
      { &hf_bgp_label_stack,
12742
16
        { "Label Stack", "bgp.label_stack", FT_STRING, BASE_NONE,
12743
16
          NULL, 0x0, NULL, HFILL }},
12744
16
      { &hf_bgp_vplsad_length,
12745
16
        { "Length", "bgp.vplsad.length", FT_UINT16, BASE_DEC,
12746
16
          NULL, 0x0, NULL, HFILL }},
12747
16
      { &hf_bgp_vplsad_rd,
12748
16
        { "RD", "bgp.vplsad.rd", FT_STRING, BASE_NONE,
12749
16
          NULL, 0x0, NULL, HFILL }},
12750
16
      { &hf_bgp_bgpad_pe_addr,
12751
16
        { "PE Addr", "bgp.ad.pe_addr", FT_IPv4, BASE_NONE,
12752
16
          NULL, 0x0, NULL, HFILL }},
12753
16
      { &hf_bgp_vplsbgp_ce_id,
12754
16
        { "CE-ID", "bgp.vplsbgp.ce_id", FT_UINT16, BASE_DEC,
12755
16
          NULL, 0x0, NULL, HFILL }},
12756
16
      { &hf_bgp_vplsbgp_labelblock_offset,
12757
16
        { "Label Block Offset", "bgp.vplsbgp.labelblock.offset", FT_UINT16, BASE_DEC,
12758
16
          NULL, 0x0, NULL, HFILL }},
12759
16
      { &hf_bgp_vplsbgp_labelblock_size,
12760
16
        { "Label Block Size", "bgp.vplsbgp.labelblock.size", FT_UINT16, BASE_DEC,
12761
16
          NULL, 0x0, NULL, HFILL }},
12762
16
      { &hf_bgp_vplsbgp_labelblock_base,
12763
16
        { "Label Block Base", "bgp.vplsbgp.labelblock.base", FT_STRING, BASE_NONE,
12764
16
          NULL, 0x0, NULL, HFILL }},
12765
16
      { &hf_bgp_wildcard_route_target,
12766
16
        { "Wildcard route target", "bgp.wildcard_route_target", FT_STRING, BASE_NONE,
12767
16
          NULL, 0x0, NULL, HFILL }},
12768
16
      { &hf_bgp_type,
12769
16
        { "Type", "bgp.type", FT_UINT8, BASE_DEC,
12770
16
          VALS(bgptypevals), 0x0, "BGP message type", HFILL }},
12771
      /* Open Message */
12772
16
      { &hf_bgp_open_version,
12773
16
        { "Version", "bgp.open.version", FT_UINT8, BASE_DEC,
12774
16
          NULL, 0x0, "The protocol version number", HFILL }},
12775
16
      { &hf_bgp_open_myas,
12776
16
        { "My AS", "bgp.open.myas", FT_UINT16, BASE_DEC,
12777
16
          NULL, 0x0, "The Autonomous System number of the sender", HFILL }},
12778
16
      { &hf_bgp_open_holdtime,
12779
16
        { "Hold Time", "bgp.open.holdtime", FT_UINT16, BASE_DEC,
12780
16
          NULL, 0x0, "The number of seconds the sender proposes for Hold Time", HFILL }},
12781
16
      { &hf_bgp_open_identifier,
12782
16
        { "BGP Identifier", "bgp.open.identifier", FT_IPv4, BASE_NONE,
12783
16
          NULL, 0x0, "The BGP Identifier of the sender", HFILL }},
12784
16
      { &hf_bgp_open_opt_len,
12785
16
        { "Optional Parameters Length", "bgp.open.opt.len", FT_UINT8, BASE_DEC,
12786
16
          NULL, 0x0, "The total length of the Optional Parameters field in octets", HFILL }},
12787
16
      { &hf_bgp_open_opt_extension,
12788
16
        { "Optional Parameter Extension", "bgp.open.opt.extension", FT_NONE, BASE_NONE,
12789
16
          NULL, 0x0, "Optional Parameters Extension detected", HFILL }},
12790
16
      { &hf_bgp_open_opt_extension_mark,
12791
16
        { "Extension Mark", "bgp.open.opt.extension.mark", FT_UINT8, BASE_DEC,
12792
16
          NULL, 0x0, "Optional Parameters Extension detected", HFILL }},
12793
16
      { &hf_bgp_open_opt_extension_len,
12794
16
        { "Extended Length", "bgp.open.opt.extension_len", FT_UINT16, BASE_DEC,
12795
16
          NULL, 0x0, "The total extended length of the Optional Parameters field in octets", HFILL }},
12796
16
      { &hf_bgp_open_opt_params,
12797
16
        { "Optional Parameters", "bgp.open.opt", FT_NONE, BASE_NONE,
12798
16
          NULL, 0x0, "List of optional parameters", HFILL }},
12799
16
      { &hf_bgp_open_opt_param,
12800
16
        { "Optional Parameter", "bgp.open.opt.param", FT_NONE, BASE_NONE,
12801
16
          NULL, 0x0, NULL, HFILL }},
12802
16
      { &hf_bgp_open_opt_param_type,
12803
16
        { "Parameter Type", "bgp.open.opt.param.type", FT_UINT8, BASE_DEC,
12804
16
          VALS(bgp_open_opt_vals), 0x0, "Unambiguously identifies individual parameters", HFILL }},
12805
16
      { &hf_bgp_open_opt_param_len,
12806
16
        { "Parameter Length", "bgp.open.opt.param.len", FT_UINT8, BASE_DEC,
12807
16
          NULL, 0x0, "Length of the Parameter Value", HFILL }},
12808
16
      { &hf_bgp_open_opt_param_auth,
12809
16
        { "Authentication Data", "bgp.open.opt.param.auth", FT_BYTES, BASE_NONE,
12810
16
          NULL, 0x0, "Deprecated", HFILL }},
12811
16
      { &hf_bgp_open_opt_param_unknown,
12812
16
        { "Unknown", "bgp.open.opt.param.unknown", FT_BYTES, BASE_NONE,
12813
16
          NULL, 0x0, "Unknown Parameter", HFILL }},
12814
        /* Notification error */
12815
16
      { &hf_bgp_notify_major_error,
12816
16
        { "Major error Code", "bgp.notify.major_error", FT_UINT8, BASE_DEC,
12817
16
          VALS(bgpnotify_major), 0x0, NULL, HFILL }},
12818
16
      { &hf_bgp_notify_minor_msg_hdr,
12819
16
        { "Minor error Code (Message Header)", "bgp.notify.minor_error", FT_UINT8, BASE_DEC,
12820
16
          VALS(bgpnotify_minor_msg_hdr), 0x0, NULL, HFILL }},
12821
16
      { &hf_bgp_notify_minor_open_msg,
12822
16
        { "Minor error Code (Open Message)", "bgp.notify.minor_error_open", FT_UINT8, BASE_DEC,
12823
16
          VALS(bgpnotify_minor_open_msg), 0x0, NULL, HFILL }},
12824
16
      { &hf_bgp_notify_minor_update_msg,
12825
16
        { "Minor error Code (Update Message)", "bgp.notify.minor_error_update", FT_UINT8, BASE_DEC,
12826
16
          VALS(bgpnotify_minor_update_msg), 0x0, NULL, HFILL }},
12827
16
      { &hf_bgp_notify_minor_ht_expired,
12828
16
        { "Minor error Code (Hold Timer Expired)", "bgp.notify.minor_error_expired", FT_UINT8, BASE_DEC,
12829
16
          NULL, 0x0, NULL, HFILL }},
12830
16
      { &hf_bgp_notify_minor_state_machine,
12831
16
        { "Minor error Code (State Machine)", "bgp.notify.minor_error_state", FT_UINT8, BASE_DEC,
12832
16
          VALS(bgpnotify_minor_state_machine), 0x0, NULL, HFILL }},
12833
16
      { &hf_bgp_notify_minor_cease,
12834
16
        { "Minor error Code (Cease)", "bgp.notify.minor_error_cease", FT_UINT8, BASE_DEC,
12835
16
          VALS(bgpnotify_minor_cease), 0x0, NULL, HFILL }},
12836
16
      { &hf_bgp_notify_minor_rr_msg,
12837
16
        { "Minor error Code (Route-Refresh message)", "bgp.notify.minor_error_route_refresh", FT_UINT8, BASE_DEC,
12838
16
          VALS(bgpnotify_minor_rr_msg), 0x0, NULL, HFILL }},
12839
16
      { &hf_bgp_notify_minor_unknown,
12840
16
        { "Minor error Code (Unknown)", "bgp.notify.minor_error_unknown", FT_UINT8, BASE_DEC,
12841
16
          NULL, 0x0, NULL, HFILL }},
12842
16
      { &hf_bgp_notify_data,
12843
16
        { "Data", "bgp.notify.minor_data", FT_BYTES, BASE_NONE,
12844
16
           NULL, 0x0, NULL, HFILL }},
12845
16
      { &hf_bgp_notify_error_open_bad_peer_as,
12846
16
        { "Bad Peer AS", "bgp.notify.error_open.bad_peer_as", FT_UINT32, BASE_DEC,
12847
16
           NULL, 0x0, NULL, HFILL }},
12848
16
      { &hf_bgp_notify_communication_length,
12849
16
        { "BGP Shutdown Communication Length", "bgp.notify.communication_length", FT_UINT8, BASE_DEC,
12850
16
          NULL, 0x0, NULL, HFILL }},
12851
16
      { &hf_bgp_notify_communication,
12852
16
        { "Shutdown Communication", "bgp.notify.communication", FT_STRING, BASE_NONE,
12853
16
          NULL, 0x0, NULL, HFILL }},
12854
12855
        /* Route Refresh */
12856
16
      { &hf_bgp_route_refresh_afi,
12857
16
        { "Address family identifier (AFI)", "bgp.route_refresh.afi", FT_UINT16, BASE_DEC,
12858
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12859
16
      { &hf_bgp_route_refresh_subtype,
12860
16
        { "Subtype", "bgp.route_refresh.subtype", FT_UINT8, BASE_DEC,
12861
16
          VALS(route_refresh_subtype_vals), 0x0, NULL, HFILL }},
12862
16
      { &hf_bgp_route_refresh_safi,
12863
16
        { "Subsequent address family identifier (SAFI)", "bgp.route_refresh.safi", FT_UINT8, BASE_DEC,
12864
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12865
16
      { &hf_bgp_route_refresh_orf,
12866
16
        { "ORF information", "bgp.route_refresh.orf", FT_NONE, BASE_NONE,
12867
16
          NULL, 0x0, NULL, HFILL }},
12868
16
      { &hf_bgp_route_refresh_orf_flag,
12869
16
        { "ORF flag", "bgp.route_refresh.orf.flag", FT_UINT8, BASE_DEC,
12870
16
          VALS(orf_when_vals), 0x0, NULL, HFILL }},
12871
16
      { &hf_bgp_route_refresh_orf_type,
12872
16
        { "ORF type", "bgp.route_refresh.orf.type", FT_UINT8, BASE_DEC,
12873
16
          VALS(orf_type_vals), 0x0, NULL, HFILL }},
12874
16
      { &hf_bgp_route_refresh_orf_length,
12875
16
        { "ORF length", "bgp.route_refresh.orf.length", FT_UINT16, BASE_DEC,
12876
16
          NULL, 0x0, NULL, HFILL }},
12877
16
      { &hf_bgp_route_refresh_orf_entry_prefixlist,
12878
16
        { "ORFEntry PrefixList", "bgp.route_refresh.orf.entry", FT_NONE, BASE_NONE,
12879
16
          NULL, 0x0, NULL, HFILL }},
12880
16
      { &hf_bgp_route_refresh_orf_entry_action,
12881
16
        { "ORFEntry Action", "bgp.route_refresh.orf.entry.action", FT_UINT8, BASE_DEC,
12882
16
          VALS(orf_entry_action_vals), BGP_ORF_ACTION, NULL, HFILL }},
12883
16
      { &hf_bgp_route_refresh_orf_entry_match,
12884
16
        { "ORFEntry Match", "bgp.route_refresh.orf.entry.match", FT_UINT8, BASE_DEC,
12885
16
          VALS(orf_entry_match_vals), BGP_ORF_MATCH, NULL, HFILL }},
12886
16
      { &hf_bgp_route_refresh_orf_entry_sequence,
12887
16
        { "ORFEntry Sequence", "bgp.route_refresh.orf.entry.sequence", FT_UINT32, BASE_DEC,
12888
16
          NULL, 0x0, NULL, HFILL }},
12889
16
      { &hf_bgp_route_refresh_orf_entry_prefixmask_lower,
12890
16
        { "ORFEntry PrefixMask length lower bound", "bgp.route_refresh.orf.entry.prefixmask_lower", FT_UINT8, BASE_DEC,
12891
16
          NULL, 0x0, NULL, HFILL }},
12892
16
      { &hf_bgp_route_refresh_orf_entry_prefixmask_upper,
12893
16
        { "ORFEntry PrefixMask length upper bound", "bgp.route_refresh.orf.entry.prefixmask_upper", FT_UINT8, BASE_DEC,
12894
16
          NULL, 0x0, NULL, HFILL }},
12895
16
      { &hf_bgp_route_refresh_orf_entry_ip,
12896
16
        { "ORFEntry IP address", "bgp.route_refresh.orf.entry.ip", FT_IPv4, BASE_NONE,
12897
16
          NULL, 0x0, NULL, HFILL }},
12898
12899
        /* Capability */
12900
16
      { &hf_bgp_cap,
12901
16
        { "Capability", "bgp.cap", FT_NONE, BASE_NONE,
12902
16
          NULL, 0x0, NULL, HFILL }},
12903
16
      { &hf_bgp_cap_type,
12904
16
        { "Type", "bgp.cap.type", FT_UINT8, BASE_DEC,
12905
16
          VALS(capability_vals), 0x0, NULL, HFILL }},
12906
16
      { &hf_bgp_cap_length,
12907
16
        { "Length", "bgp.cap.length", FT_UINT8, BASE_DEC,
12908
16
          NULL, 0x0, NULL, HFILL }},
12909
16
      { &hf_bgp_cap_action,
12910
16
        { "Action", "bgp.cap.action", FT_UINT8, BASE_DEC,
12911
16
          VALS(bgpcap_action), 0x0, NULL, HFILL }},
12912
16
      { &hf_bgp_cap_unknown,
12913
16
        { "Unknown", "bgp.cap.unknown", FT_BYTES, BASE_NONE,
12914
16
          NULL, 0x0, NULL, HFILL }},
12915
16
      { &hf_bgp_cap_reserved,
12916
16
        { "Reserved", "bgp.cap.reserved", FT_BYTES, BASE_NONE,
12917
16
          NULL, 0x0, "Must be Zero", HFILL }},
12918
16
      { &hf_bgp_cap_mp_afi,
12919
16
        { "AFI", "bgp.cap.mp.afi", FT_UINT16, BASE_DEC,
12920
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12921
16
      { &hf_bgp_cap_mp_safi,
12922
16
        { "SAFI", "bgp.cap.mp.safi", FT_UINT8, BASE_DEC,
12923
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12924
16
      { &hf_bgp_cap_enh_afi,
12925
16
        { "AFI", "bgp.cap.enh.afi", FT_UINT16, BASE_DEC,
12926
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12927
16
      { &hf_bgp_cap_enh_safi,
12928
16
        { "SAFI", "bgp.cap.enh.safi", FT_UINT16, BASE_DEC,
12929
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12930
16
      { &hf_bgp_cap_enh_nhafi,
12931
16
        { "Next hop AFI", "bgp.cap.enh.nhafi", FT_UINT16, BASE_DEC,
12932
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12933
16
      { &hf_bgp_cap_role,
12934
16
        { "BGP Role", "bgp.cap.role", FT_UINT8, BASE_DEC,
12935
16
          VALS(bgprole_vals), 0x0, NULL, HFILL }},
12936
16
      { &hf_bgp_cap_gr_timers,
12937
16
        { "Restart Timers", "bgp.cap.gr.timers", FT_UINT16, BASE_HEX,
12938
16
          NULL, 0x0, NULL, HFILL }},
12939
16
      { &hf_bgp_cap_gr_timers_restart_flag,
12940
16
        { "Restart state", "bgp.cap.gr.timers.restart_flag", FT_BOOLEAN, 16,
12941
16
          TFS(&tfs_yes_no), 0x8000, NULL, HFILL }},
12942
16
      { &hf_bgp_cap_gr_timers_notification_flag,
12943
16
        { "Graceful notification", "bgp.cap.gr.timers.notification_flag", FT_BOOLEAN, 16,
12944
16
          TFS(&tfs_yes_no), 0x4000, NULL, HFILL }},
12945
16
      { &hf_bgp_cap_gr_timers_restart_time,
12946
16
        { "Time", "bgp.cap.gr.timers.restart_time", FT_UINT16, BASE_DEC,
12947
16
          NULL, 0x0FFF, "in us", HFILL }},
12948
16
      { &hf_bgp_cap_gr_afi,
12949
16
        { "AFI", "bgp.cap.gr.afi", FT_UINT16, BASE_DEC,
12950
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12951
16
      { &hf_bgp_cap_gr_safi,
12952
16
        { "SAFI", "bgp.cap.gr.safi", FT_UINT8, BASE_DEC,
12953
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12954
16
      { &hf_bgp_cap_gr_flag,
12955
16
        { "Flag", "bgp.cap.gr.flag", FT_UINT8, BASE_HEX,
12956
16
          NULL, 0x0, NULL, HFILL }},
12957
16
      { &hf_bgp_cap_gr_flag_pfs,
12958
16
        { "Preserve forwarding state", "bgp.cap.gr.flag.pfs", FT_BOOLEAN, 8,
12959
16
          TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
12960
16
      { &hf_bgp_cap_4as,
12961
16
        { "AS Number", "bgp.cap.4as", FT_UINT32, BASE_DEC,
12962
16
          NULL, 0x0, NULL, HFILL }},
12963
16
      { &hf_bgp_cap_dc,
12964
16
        { "Capability Dynamic", "bgp.cap.dc", FT_UINT8, BASE_DEC,
12965
16
          VALS(capability_vals), 0x0, NULL, HFILL }},
12966
16
      { &hf_bgp_cap_ap_afi,
12967
16
        { "AFI", "bgp.cap.ap.afi", FT_UINT16, BASE_DEC,
12968
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12969
16
      { &hf_bgp_cap_ap_safi,
12970
16
        { "SAFI", "bgp.cap.ap.safi", FT_UINT8, BASE_DEC,
12971
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12972
16
      { &hf_bgp_cap_ap_sendreceive,
12973
16
        { "Send/Receive", "bgp.cap.ap.sendreceive", FT_UINT8, BASE_DEC,
12974
16
          VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
12975
16
      { &hf_bgp_cap_orf_afi,
12976
16
        { "AFI", "bgp.cap.orf.afi", FT_UINT16, BASE_DEC,
12977
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
12978
16
      { &hf_bgp_cap_orf_safi,
12979
16
        { "SAFI", "bgp.cap.orf.safi", FT_UINT8, BASE_DEC,
12980
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12981
16
      { &hf_bgp_cap_orf_number,
12982
16
        { "Number", "bgp.cap.orf.number", FT_UINT8, BASE_DEC,
12983
16
          NULL, 0x0, NULL, HFILL }},
12984
16
      { &hf_bgp_cap_orf_type,
12985
16
        { "Type", "bgp.cap.orf.type", FT_UINT8, BASE_DEC,
12986
16
          VALS(orf_type_vals), 0x0, NULL, HFILL }},
12987
16
      { &hf_bgp_cap_orf_sendreceive,
12988
16
        { "Send Receive", "bgp.cap.orf.sendreceive", FT_UINT8, BASE_DEC,
12989
16
          VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
12990
16
      { &hf_bgp_cap_fqdn_hostname_len,
12991
16
        { "Hostname Length", "bgp.cap.orf.fqdn.hostname.len", FT_UINT8, BASE_DEC,
12992
16
          NULL, 0x0, NULL, HFILL }},
12993
16
      { &hf_bgp_cap_fqdn_hostname,
12994
16
        { "Hostname", "bgp.cap.orf.fqdn.hostname", FT_STRING, BASE_NONE,
12995
16
          NULL, 0x0, NULL, HFILL }},
12996
16
      { &hf_bgp_cap_fqdn_domain_name_len,
12997
16
        { "Domain Name Length", "bgp.cap.orf.fqdn.domain_name.len", FT_UINT8, BASE_DEC,
12998
16
          NULL, 0x0, NULL, HFILL }},
12999
16
      { &hf_bgp_cap_fqdn_domain_name,
13000
16
        { "Domain Name", "bgp.cap.orf.fqdn.domain_name", FT_STRING, BASE_NONE,
13001
16
          NULL, 0x0, NULL, HFILL }},
13002
16
      { &hf_bgp_cap_multisession_flags,
13003
16
        { "Flag", "bgp.cap.multisession.flags", FT_UINT8, BASE_HEX,
13004
16
          NULL, 0x0, NULL, HFILL }},
13005
16
      { &hf_bgp_cap_bgpsec_flags,
13006
16
        { "Flag", "bgp.cap.bgpsec.flags", FT_UINT8, BASE_HEX,
13007
16
          NULL, 0x0, NULL, HFILL }},
13008
16
      { &hf_bgp_cap_bgpsec_version,
13009
16
        { "Version", "bgp.cap.bgpsec.version", FT_UINT8, BASE_DEC,
13010
16
          NULL, 0xF0, NULL, HFILL }},
13011
16
      { &hf_bgp_cap_bgpsec_sendreceive,
13012
16
        { "Send/Receive", "bgp.cap.bgpsec.sendreceive", FT_UINT8, BASE_DEC,
13013
16
          VALS(bgpsec_send_receive_vals), 0x8, NULL, HFILL }},
13014
16
      { &hf_bgp_cap_bgpsec_reserved,
13015
16
        { "Reserved", "bgp.cap.bgpsec.reserved", FT_UINT8, BASE_HEX,
13016
16
          NULL, 0x7, "Must be Zero", HFILL }},
13017
16
      { &hf_bgp_cap_bgpsec_afi,
13018
16
        { "AFI", "bgp.cap.bgpsec.afi", FT_UINT16, BASE_DEC,
13019
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
13020
16
      { &hf_bgp_cap_soft_version_len,
13021
16
        { "Software Version Length", "bgp.cap.software_version.len", FT_UINT8, BASE_DEC,
13022
16
          NULL, 0x0, NULL, HFILL }},
13023
16
      { &hf_bgp_cap_soft_version,
13024
16
        { "Software Version", "bgp.cap.software_version", FT_STRING, BASE_NONE,
13025
16
          NULL, 0x0, NULL, HFILL }},
13026
      /* BGP update */
13027
13028
16
      { &hf_bgp_update_withdrawn_routes_length,
13029
16
        { "Withdrawn Routes Length", "bgp.update.withdrawn_routes.length", FT_UINT16, BASE_DEC,
13030
16
          NULL, 0x0, NULL, HFILL}},
13031
16
      { &hf_bgp_update_withdrawn_routes,
13032
16
        { "Withdrawn Routes", "bgp.update.withdrawn_routes", FT_NONE, BASE_NONE,
13033
16
          NULL, 0x0, NULL, HFILL}},
13034
13035
16
      { &hf_bgp_update_path_attribute_aggregator_as,
13036
16
        { "Aggregator AS", "bgp.update.path_attribute.aggregator_as", FT_UINT32, BASE_DEC,
13037
16
          NULL, 0x0, NULL, HFILL}},
13038
      /* BGP update path attributes */
13039
16
      { &hf_bgp_update_path_attributes,
13040
16
        { "Path attributes", "bgp.update.path_attributes", FT_NONE, BASE_NONE,
13041
16
          NULL, 0x0, NULL, HFILL}},
13042
16
      { &hf_bgp_update_path_attributes_unknown,
13043
16
        { "Unknown Path attributes", "bgp.update.path_attributes.unknown", FT_NONE, BASE_NONE,
13044
16
          NULL, 0x0, NULL, HFILL}},
13045
16
      { &hf_bgp_update_total_path_attribute_length,
13046
16
        { "Total Path Attribute Length", "bgp.update.path_attributes.length", FT_UINT16, BASE_DEC,
13047
16
          NULL, 0x0, NULL, HFILL}},
13048
16
      { &hf_bgp_update_path_attribute_aggregator_origin,
13049
16
        { "Aggregator origin", "bgp.update.path_attribute.aggregator_origin", FT_IPv4, BASE_NONE,
13050
16
          NULL, 0x0, NULL, HFILL}},
13051
16
      { &hf_bgp_update_path_attribute_as_path_segment,
13052
16
        { "AS Path segment", "bgp.update.path_attribute.as_path_segment", FT_NONE, BASE_NONE,
13053
16
          NULL, 0x0, NULL, HFILL}},
13054
16
      { &hf_bgp_update_path_attribute_as_path_segment_type,
13055
16
        { "Segment type", "bgp.update.path_attribute.as_path_segment.type", FT_UINT8, BASE_DEC,
13056
16
          VALS(as_segment_type), 0x0, NULL, HFILL}},
13057
16
      { &hf_bgp_update_path_attribute_as_path_segment_length,
13058
16
        { "Segment length (number of ASN)", "bgp.update.path_attribute.as_path_segment.length", FT_UINT8, BASE_DEC,
13059
16
          NULL, 0x0, NULL, HFILL}},
13060
16
      { &hf_bgp_update_path_attribute_as_path_segment_as2,
13061
16
        { "AS2", "bgp.update.path_attribute.as_path_segment.as2", FT_UINT16, BASE_DEC,
13062
16
          NULL, 0x0, NULL, HFILL}},
13063
16
      { &hf_bgp_update_path_attribute_as_path_segment_as4,
13064
16
        { "AS4", "bgp.update.path_attribute.as_path_segment.as4", FT_UINT32, BASE_DEC,
13065
16
          NULL, 0x0, NULL, HFILL}},
13066
16
      { &hf_bgp_update_path_attribute_communities,
13067
16
        { "Communities", "bgp.update.path_attribute.communities", FT_NONE, BASE_NONE,
13068
16
          NULL, 0x0, NULL, HFILL}},
13069
16
      { &hf_bgp_update_path_attribute_community,
13070
16
        { "Community", "bgp.update.path_attribute.community", FT_NONE, BASE_NONE,
13071
16
          NULL, 0x0, NULL, HFILL}},
13072
16
      { &hf_bgp_update_path_attribute_community_well_known,
13073
16
        { "Community Well-known", "bgp.update.path_attribute.community_wellknown", FT_UINT32, BASE_HEX,
13074
16
          VALS(community_vals), 0x0, "Reserved", HFILL}},
13075
16
      { &hf_bgp_update_path_attribute_community_as,
13076
16
        { "Community AS", "bgp.update.path_attribute.community_as", FT_UINT16, BASE_DEC,
13077
16
          NULL, 0x0, NULL, HFILL}},
13078
16
      { &hf_bgp_update_path_attribute_community_value,
13079
16
        { "Community value", "bgp.update.path_attribute.community_value", FT_UINT16, BASE_DEC,
13080
16
          NULL, 0x0, NULL, HFILL}},
13081
16
      { &hf_bgp_update_path_attribute_local_pref,
13082
16
        { "Local preference", "bgp.update.path_attribute.local_pref", FT_UINT32, BASE_DEC,
13083
16
          NULL, 0x0, NULL, HFILL}},
13084
16
      { &hf_bgp_update_path_attribute_attrset_origin_as,
13085
16
        { "Origin AS", "bgp.update.path_attribute.attr_set.origin_as", FT_UINT32, BASE_DEC,
13086
16
          NULL, 0x0, NULL, HFILL}},
13087
16
      { &hf_bgp_update_path_attribute_multi_exit_disc,
13088
16
        { "Multiple exit discriminator", "bgp.update.path_attribute.multi_exit_disc", FT_UINT32, BASE_DEC,
13089
16
          NULL, 0x0, NULL, HFILL}},
13090
16
      { &hf_bgp_update_path_attribute_next_hop,
13091
16
        { "Next hop", "bgp.update.path_attribute.next_hop", FT_IPv4, BASE_NONE,
13092
16
          NULL, 0x0, NULL, HFILL}},
13093
16
      { &hf_bgp_update_path_attribute_origin,
13094
16
        { "Origin", "bgp.update.path_attribute.origin", FT_UINT8, BASE_DEC,
13095
16
          VALS(bgpattr_origin), 0x0, NULL, HFILL}},
13096
16
      { &hf_bgp_update_path_attribute,
13097
16
        { "Path Attribute", "bgp.update.path_attribute", FT_NONE, BASE_NONE,
13098
16
          NULL, 0x0, NULL, HFILL}},
13099
16
      { &hf_bgp_update_path_attribute_flags,
13100
16
        { "Flags", "bgp.update.path_attribute.flags", FT_UINT8, BASE_HEX,
13101
16
          NULL, 0x0, NULL, HFILL}},
13102
16
      { &hf_bgp_update_path_attribute_flags_optional,
13103
16
        { "Optional", "bgp.update.path_attribute.flags.optional", FT_BOOLEAN, 8,
13104
16
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_OPTIONAL, NULL, HFILL}},
13105
16
      { &hf_bgp_update_path_attribute_flags_transitive,
13106
16
        { "Transitive", "bgp.update.path_attribute.flags.transitive", FT_BOOLEAN, 8,
13107
16
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_TRANSITIVE, NULL, HFILL}},
13108
16
      { &hf_bgp_update_path_attribute_flags_partial,
13109
16
        { "Partial", "bgp.update.path_attribute.flags.partial", FT_BOOLEAN, 8,
13110
16
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_PARTIAL, NULL, HFILL}},
13111
16
      { &hf_bgp_update_path_attribute_flags_extended_length,
13112
16
        { "Extended-Length", "bgp.update.path_attribute.flags.extended_length", FT_BOOLEAN, 8,
13113
16
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_EXTENDED_LENGTH, NULL, HFILL}},
13114
16
      { &hf_bgp_update_path_attribute_flags_unused,
13115
16
        { "Unused", "bgp.update.path_attribute.flags.unused", FT_UINT8, BASE_HEX,
13116
16
          NULL, BGP_ATTR_FLAG_UNUSED, NULL, HFILL}},
13117
16
      { &hf_bgp_update_path_attribute_type_code,
13118
16
        { "Type Code", "bgp.update.path_attribute.type_code", FT_UINT8, BASE_DEC,
13119
16
          VALS(bgpattr_type), 0x0, NULL, HFILL}},
13120
16
      { &hf_bgp_update_path_attribute_length,
13121
16
        { "Length", "bgp.update.path_attribute.length", FT_UINT16, BASE_DEC,
13122
16
          NULL, 0x0, NULL, HFILL}},
13123
16
      { &hf_bgp_update_path_attribute_link_state,
13124
16
        { "Link State", "bgp.update.path_attribute.link_state", FT_NONE, BASE_NONE,
13125
16
          NULL, 0x0, NULL, HFILL}},
13126
13127
      /* BGPsec Path Attributes, RFC8205*/
13128
16
      { &hf_bgp_update_path_attribute_bgpsec_sp_len,
13129
16
        { "Length", "bgp.update.path_attribute.bgpsec.sp.length", FT_UINT16, BASE_DEC,
13130
16
          NULL, 0x0, NULL, HFILL}},
13131
16
      { &hf_bgp_update_path_attribute_bgpsec_sps_pcount,
13132
16
        { "pCount", "bgp.update.path_attribute.bgpsec.sps.pcount", FT_UINT8, BASE_DEC,
13133
16
          NULL, 0x0, NULL, HFILL}},
13134
16
      { &hf_bgp_update_path_attribute_bgpsec_sps_flags,
13135
16
        { "Flags", "bgp.update.path_attribute.bgpsec.sps.flags", FT_UINT8, BASE_DEC,
13136
16
          NULL, 0x0, NULL, HFILL}},
13137
16
      { &hf_bgp_update_path_attribute_bgpsec_sps_as,
13138
16
        { "AS Number", "bgp.update.path_attribute.bgpsec.sps.as", FT_UINT32, BASE_DEC,
13139
16
          NULL, 0x0, NULL, HFILL}},
13140
16
      { &hf_bgp_update_path_attribute_bgpsec_sb_len,
13141
16
        { "Length", "bgp.update.path_attribute.bgpsec.sb.length", FT_UINT16, BASE_DEC,
13142
16
          NULL, 0x0, NULL, HFILL}},
13143
16
      { &hf_bgp_update_path_attribute_bgpsec_algo_id,
13144
16
        { "Algo ID", "bgp.update.path_attribute.bgpsec.sb.algo_id", FT_UINT8, BASE_DEC,
13145
16
          NULL, 0x0, NULL, HFILL}},
13146
16
      { &hf_bgp_update_path_attribute_bgpsec_ski,
13147
16
        { "SKI", "bgp.update.path_attribute.bgpsec.ss.ski", FT_BYTES, SEP_SPACE,
13148
16
          NULL, 0x0, NULL, HFILL}},
13149
16
      { &hf_bgp_update_path_attribute_bgpsec_sig_len,
13150
16
        { "Length", "bgp.update.path_attribute.bgpsec.ss.length", FT_UINT16, BASE_DEC,
13151
16
          NULL, 0x0, NULL, HFILL}},
13152
16
      { &hf_bgp_update_path_attribute_bgpsec_sig,
13153
16
        { "Signature", "bgp.update.path_attribute.bgpsec.ss.sig", FT_BYTES, SEP_SPACE,
13154
16
          NULL, 0x0, NULL, HFILL}},
13155
13156
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_address_family,
13157
16
        { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_reach_nlri.afi", FT_UINT16, BASE_DEC,
13158
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
13159
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_safi,
13160
16
        { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_reach_nlri.safi", FT_UINT8, BASE_DEC,
13161
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
13162
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop,
13163
16
        { "Next hop", "bgp.update.path_attribute.mp_reach_nlri.next_hop", FT_BYTES, BASE_NO_DISPLAY_VALUE,
13164
16
          NULL, 0x0, NULL, HFILL }},
13165
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd,
13166
16
        { "Route Distinguisher", "bgp.update.path_attribute.mp_reach_nlri.next_hop.rd", FT_STRING, BASE_NONE,
13167
16
          NULL, 0x0, "RD is always zero in the Next Hop", HFILL }},
13168
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4,
13169
16
        { "IPv4 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv4", FT_IPv4, BASE_NONE,
13170
16
          NULL, 0x0, NULL, HFILL}},
13171
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6,
13172
16
        { "IPv6 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6", FT_IPv6, BASE_NONE,
13173
16
          NULL, 0x0, NULL, HFILL}},
13174
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local,
13175
16
        { "Link-local Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6.link_local", FT_IPv6, BASE_NONE,
13176
16
          NULL, 0x0, NULL, HFILL}},
13177
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa,
13178
16
        { "Number of Subnetwork points of attachment (SNPA)", "bgp.update.path_attribute.mp_reach_nlri.nbr_snpa", FT_UINT8, BASE_DEC,
13179
16
          NULL, 0x0, NULL, HFILL }},
13180
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length,
13181
16
        { "SNPA Length", "bgp.update.path_attribute.mp_reach_nlri.snpa_length", FT_UINT8, BASE_DEC,
13182
16
          NULL, 0x0, NULL, HFILL }},
13183
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa,
13184
16
        { "SNPA", "bgp.update.path_attribute.mp_reach_nlri.snpa", FT_BYTES, BASE_NONE,
13185
16
          NULL, 0x0, NULL, HFILL }},
13186
16
      { &hf_bgp_update_path_attribute_mp_reach_nlri,
13187
16
        { "Network Layer Reachability Information (NLRI)", "bgp.update.path_attribute.mp_reach_nlri", FT_NONE, BASE_NONE,
13188
16
          NULL, 0x0, NULL, HFILL}},
13189
13190
16
      { &hf_bgp_update_path_attribute_mp_unreach_nlri_address_family,
13191
16
        { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_unreach_nlri.afi", FT_UINT16, BASE_DEC,
13192
16
          VALS(afn_vals), 0x0, NULL, HFILL }},
13193
16
      { &hf_bgp_update_path_attribute_mp_unreach_nlri_safi,
13194
16
        { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_unreach_nlri.safi", FT_UINT8, BASE_DEC,
13195
16
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
13196
16
      { &hf_bgp_update_path_attribute_mp_unreach_nlri,
13197
16
        { "Withdrawn Routes", "bgp.update.path_attribute.mp_unreach_nlri", FT_NONE, BASE_NONE,
13198
16
          NULL, 0x0, NULL, HFILL}},
13199
13200
16
      { &hf_bgp_pmsi_tunnel_flags,
13201
16
        { "Flags", "bgp.update.path_attribute.pmsi.tunnel.flags", FT_UINT8, BASE_DEC,
13202
16
          NULL, 0x0, NULL, HFILL}},
13203
16
      { &hf_bgp_pmsi_tunnel_type,
13204
16
        { "Tunnel Type", "bgp.update.path_attribute.pmsi.tunnel.type", FT_UINT8, BASE_DEC,
13205
16
          VALS(pmsi_tunnel_type), 0x0, NULL, HFILL}},
13206
16
      { &hf_bgp_pmsi_tunnel_id,
13207
16
        { "Tunnel ID", "bgp.update.path_attribute.pmsi.tunnel.id", FT_NONE, BASE_NONE,
13208
16
          NULL, 0x0, NULL, HFILL}},
13209
16
      { &hf_bgp_pmsi_tunnel_not_present,
13210
16
        { "Tunnel ID not present", "bgp.update.path_attribute.pmsi.tunnel_id.not_present", FT_NONE, BASE_NONE,
13211
16
          NULL, 0x0, NULL, HFILL}},
13212
16
      { &hf_bgp_update_mpls_label,
13213
16
        { "MPLS Label Stack", "bgp.update.path_attribute.mpls_label", FT_NONE,
13214
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13215
16
      { &hf_bgp_update_mpls_label_value_20bits,
13216
16
        { "MPLS Label", "bgp.update.path_attribute.mpls_label_value_20bits", FT_UINT24,
13217
16
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
13218
16
      { &hf_bgp_update_mpls_label_value,
13219
16
        { "MPLS Label", "bgp.update.path_attribute.mpls_label_value", FT_UINT24,
13220
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13221
16
      { &hf_bgp_update_mpls_traffic_class,
13222
16
        { "Traffic Class", "bgp.update.path_attribute.mpls_traffic_class", FT_UINT24,
13223
16
          BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
13224
16
      { &hf_bgp_update_mpls_bottom_stack,
13225
16
        { "Bottom-of-Stack", "bgp.update.path_attribute.mpls_bottom_stack", FT_BOOLEAN,
13226
16
          24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
13227
16
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_id, /* RFC4875 section 19 */
13228
16
        { "RSVP P2MP id", "bgp.update.path_attribute.pmsi.rsvp.id", FT_IPv4, BASE_NONE,
13229
16
          NULL, 0x0, NULL, HFILL}},
13230
16
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id,
13231
16
        { "RSVP P2MP tunnel id", "bgp.update.path_attribute.pmsi.rsvp.tunnel_id", FT_UINT16, BASE_DEC,
13232
16
          NULL, 0x0, NULL, HFILL}},
13233
16
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4,
13234
16
        { "RSVP P2MP extended tunnel id", "bgp.update.path_attribute.pmsi.rsvp.ext_tunnel_idv4", FT_IPv4, BASE_NONE,
13235
16
         NULL, 0x0, NULL, HFILL}},
13236
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_type,
13237
16
        { "mLDP P2MP FEC element type", "bgp.update.path_attribute.pmsi.mldp.fec.type", FT_UINT8, BASE_DEC,
13238
16
         VALS(fec_types_vals), 0x0, NULL, HFILL}},
13239
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_afi,
13240
16
        {"mLDP P2MP FEC element address family", "bgp.update.path_attribute.pmsi.mldp.fec.address_family", FT_UINT16, BASE_DEC,
13241
16
         VALS(afn_vals), 0x0, NULL, HFILL}},
13242
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len,
13243
16
        {"mLDP P2MP FEC element address length", "bgp.update.path_attribute.pmsi.mldp.fec.address_length", FT_UINT8, BASE_DEC,
13244
16
         NULL, 0x0, NULL, HFILL}},
13245
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4,
13246
16
        {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev4", FT_IPv4, BASE_NONE,
13247
16
         NULL, 0x0, NULL, HFILL}},
13248
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6,
13249
16
        {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev6", FT_IPv6, BASE_NONE,
13250
16
         NULL, 0x0, NULL, HFILL}},
13251
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len,
13252
16
        {"mLDP P2MP FEC element opaque length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_length", FT_UINT16, BASE_DEC,
13253
16
         NULL, 0x0, NULL, HFILL}},
13254
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
13255
16
        {"mLDP P2MP FEC element opaque value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_type", FT_UINT8, BASE_DEC,
13256
16
         VALS(pmsi_mldp_fec_opaque_value_type), 0x0, NULL, HFILL}},
13257
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len,
13258
16
        {"mLDP P2MP FEC element opaque value length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_length", FT_UINT16, BASE_DEC,
13259
16
         NULL, 0x0, NULL, HFILL}},
13260
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn,
13261
16
        {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_rn", FT_UINT32, BASE_DEC,
13262
16
         NULL, 0x0, NULL, HFILL}},
13263
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str,
13264
16
        {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_str", FT_STRING, BASE_NONE,
13265
16
         NULL, 0x0, NULL, HFILL}},
13266
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type,
13267
16
        {"mLDP P2MP FEC element opaque extended value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_value_type", FT_UINT16, BASE_DEC,
13268
16
         VALS(pmsi_mldp_fec_opa_extented_type), 0x0, NULL, HFILL}},
13269
16
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len,
13270
16
        {"mLDP P2MP FEC element opaque extended length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_length", FT_UINT16, BASE_DEC,
13271
16
         NULL, 0x0, NULL, HFILL}},
13272
16
      { &hf_bgp_pmsi_tunnel_pimsm_sender,
13273
16
        {"PIM-SM Tree tunnel sender address", "bgp.update.path_attribute.pmsi.pimsm.sender_address", FT_IPv4, BASE_NONE,
13274
16
         NULL, 0x0, NULL, HFILL}},
13275
16
      { &hf_bgp_pmsi_tunnel_pimsm_pmc_group,
13276
16
        {"PIM-SM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimsm.pmulticast_group", FT_IPv4, BASE_NONE,
13277
16
         NULL, 0x0, NULL, HFILL}},
13278
16
      { &hf_bgp_pmsi_tunnel_pimssm_root_node,
13279
16
        {"PIM-SSM Tree tunnel Root Node", "bgp.update.path_attribute.pmsi.pimssm.root_node", FT_IPv4, BASE_NONE,
13280
16
         NULL, 0x0, NULL, HFILL}},
13281
16
      { &hf_bgp_pmsi_tunnel_pimssm_pmc_group,
13282
16
        {"PIM-SSM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimssm.pmulticast_group", FT_IPv4, BASE_NONE,
13283
16
         NULL, 0x0, NULL, HFILL}},
13284
16
      { &hf_bgp_pmsi_tunnel_pimbidir_sender,
13285
16
        {"BIDIR-PIM Tree Tunnel sender address", "bgp.update.path_attribute.pmsi.bidir_pim_tree.sender", FT_IPv4, BASE_NONE,
13286
16
         NULL, 0x0, NULL, HFILL}},
13287
16
      { &hf_bgp_pmsi_tunnel_pimbidir_pmc_group,
13288
16
        {"BIDIR-PIM Tree Tunnel P-multicast group", "bgp.update.path_attribute.pmsi.bidir_pim_tree.pmulticast_group", FT_IPv4, BASE_NONE,
13289
16
         NULL, 0x0, NULL, HFILL}},
13290
16
      { &hf_bgp_pmsi_tunnel_ingress_rep_addr,
13291
16
        {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip", FT_IPv4, BASE_NONE,
13292
16
        NULL, 0x0, NULL, HFILL}},
13293
16
      { &hf_bgp_pmsi_tunnel_ingress_rep_addr6,
13294
16
        {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip6", FT_IPv6, BASE_NONE,
13295
16
        NULL, 0x0, NULL, HFILL}},
13296
13297
        /* BGP Only to Customer (OTC) Attribute, RFC9234 */
13298
16
      { &hf_bgp_update_path_attribute_otc,
13299
16
        { "Only to Customer", "bgp.update.path_attribute.otc", FT_UINT32, BASE_DEC,
13300
16
          NULL, 0x0, NULL, HFILL}},
13301
13302
        /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
13303
16
      { &hf_bgp_update_path_attribute_d_path,
13304
16
        { "Domain Path Attribute", "bgp.update.path_attribute.dpath", FT_STRING, BASE_NONE,
13305
16
          NULL, 0x0, NULL, HFILL}},
13306
16
      { &hf_bgp_d_path_length,
13307
16
        {"Domain Path Attribute length", "bgp.update.attribute.dpath.length", FT_UINT16, BASE_DEC,
13308
16
        NULL, 0x0, NULL, HFILL}},
13309
16
      { &hf_bgp_d_path_ga,
13310
16
        { "Global Administrator", "bgp.update.attribute.dpath.ga", FT_UINT32, BASE_DEC,
13311
16
          NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
13312
16
      { &hf_bgp_d_path_la,
13313
16
        { "Local Administrator", "bgp.update.attribute.dpath.la", FT_UINT16, BASE_DEC,
13314
16
          NULL, 0x0, "A two-octet operator-defined value", HFILL }},
13315
16
      { &hf_bgp_d_path_isf_safi,
13316
16
        { "Inter-Subnet Forwarding SAFI type", "bgp.update.attribute.dpath.isf.safi", FT_UINT8, BASE_DEC,
13317
16
          NULL, 0x0, NULL, HFILL }},
13318
13319
        /* BFD Discriminator Attribute, RFC9026 */
13320
16
      { &hf_bgp_update_path_attribute_bfd_mode,
13321
16
        { "BFD Mode", "bgp.update.path_attribute.bfd_mode", FT_UINT8, BASE_DEC,
13322
16
          VALS(bgp_bfd_mode_vals), 0x0, NULL, HFILL}},
13323
16
      { &hf_bgp_update_path_attribute_bfd_discriminator,
13324
16
        { "BFD Discriminator", "bgp.update.path_attribute.bfd_discriminator", FT_UINT32, BASE_HEX_DEC,
13325
16
          NULL, 0x0, NULL, HFILL}},
13326
16
      { &hf_bgp_bfd_discriminator_tlv,
13327
16
        { "BFD Discriminator TLV", "bgp.bfd_discriminator.tlv", FT_NONE, BASE_NONE,
13328
16
          NULL, 0x0, NULL, HFILL}},
13329
16
      { &hf_bgp_bfd_discriminator_tlv_type,
13330
16
        { "Type", "bgp.bfd_discriminator.tlv.type", FT_UINT8, BASE_DEC,
13331
16
          VALS(bgp_bfd_discriminator_tlv_type_vals), 0x0, "TLV Type", HFILL}},
13332
16
      { &hf_bgp_bfd_discriminator_tlv_length,
13333
16
        { "Length", "bgp.bfd_discriminator.tlv.length", FT_UINT8, BASE_DEC,
13334
16
          NULL, 0x0, "TLV Length", HFILL}},
13335
16
      { &hf_bgp_bfd_discriminator_tlv_source_ipv4,
13336
16
        { "Source IPv4 Address", "bgp.bfd_discriminator.tlv.source_ipv4", FT_IPv4, BASE_NONE,
13337
16
          NULL, 0x0, NULL, HFILL}},
13338
16
      { &hf_bgp_bfd_discriminator_tlv_source_ipv6,
13339
16
        { "Source IPv6 Address", "bgp.bfd_discriminator.tlv.source_ipv6", FT_IPv6, BASE_NONE,
13340
16
          NULL, 0x0, NULL, HFILL}},
13341
16
      { &hf_bgp_bfd_discriminator_tlv_value,
13342
16
        { "Value", "bgp.bfd_discriminator.tlv.value", FT_BYTES, BASE_NONE,
13343
16
          NULL, 0x0, "TLV Value", HFILL}},
13344
13345
        /* RFC7311 */
13346
16
      { &hf_bgp_update_path_attribute_aigp,
13347
16
        { "AIGP Attribute", "bgp.update.path_attribute.aigp", FT_NONE, BASE_NONE,
13348
16
          NULL, 0x0, NULL, HFILL}},
13349
16
      { &hf_bgp_aigp_type,
13350
16
        {"AIGP attribute type", "bgp.update.attribute.aigp.type", FT_UINT8, BASE_DEC,
13351
16
        VALS(aigp_tlv_type), 0x0, NULL, HFILL }},
13352
16
      { &hf_bgp_aigp_tlv_length,
13353
16
        {"AIGP TLV length", "bgp.update.attribute.aigp.length", FT_UINT16, BASE_DEC,
13354
16
        NULL, 0x0, NULL, HFILL}},
13355
16
      { &hf_bgp_aigp_accu_igp_metric,
13356
16
        {"AIGP Accumulated IGP Metric", "bgp.update.attribute.aigp.accu_igp_metric", FT_UINT64, BASE_DEC,
13357
16
        NULL, 0x0, NULL, HFILL}},
13358
13359
        /* RFC8092 */
13360
16
      { &hf_bgp_large_communities,
13361
16
        { "Large Communities", "bgp.large_communities", FT_STRING, BASE_NONE,
13362
16
          NULL, 0x0, NULL, HFILL }},
13363
16
      { &hf_bgp_large_communities_ga,
13364
16
        { "Global Administrator", "bgp.large_communities.ga", FT_UINT32, BASE_DEC,
13365
16
          NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
13366
16
      { &hf_bgp_large_communities_ldp1,
13367
16
        { "Local Data Part 1", "bgp.large_communities.ldp1", FT_UINT32, BASE_DEC,
13368
16
          NULL, 0x0, "A four-octet operator-defined value", HFILL }},
13369
16
      { &hf_bgp_large_communities_ldp2,
13370
16
        { "Local Data Part 2", "bgp.large_communities.ldp2", FT_UINT32, BASE_DEC,
13371
16
          NULL, 0x0, "A four-octet operator-defined value", HFILL }},
13372
13373
        /* RFC4456 */
13374
16
       { &hf_bgp_update_path_attribute_originator_id,
13375
16
        { "Originator identifier", "bgp.update.path_attribute.originator_id", FT_IPv4, BASE_NONE,
13376
16
          NULL, 0x0, NULL, HFILL}},
13377
16
      { &hf_bgp_update_path_attribute_cluster_list,
13378
16
        { "Cluster List", "bgp.path_attribute.cluster_list", FT_NONE, BASE_NONE,
13379
16
          NULL, 0x0, NULL, HFILL}},
13380
16
      { &hf_bgp_update_path_attribute_cluster_id,
13381
16
        { "Cluster ID", "bgp.path_attribute.cluster_id", FT_IPv4, BASE_NONE,
13382
16
          NULL, 0x0, NULL, HFILL}},
13383
13384
        /* RFC8669 */
13385
16
      { &hf_bgp_prefix_sid_unknown,
13386
16
        { "Unknown TLV", "bgp.prefix_sid.unknown", FT_NONE, BASE_NONE,
13387
16
          NULL, 0x0, NULL, HFILL }},
13388
16
      { &hf_bgp_prefix_sid_label_index,
13389
16
        { "Label-Index", "bgp.prefix_sid.label_index", FT_NONE, BASE_NONE,
13390
16
          NULL, 0x0, NULL, HFILL }},
13391
16
      { &hf_bgp_prefix_sid_label_index_value,
13392
16
        { "Label-Index Value", "bgp.prefix_sid.label_index.value", FT_UINT32, BASE_DEC,
13393
16
          NULL, 0x0, "4-octet label index value", HFILL }},
13394
16
      { &hf_bgp_prefix_sid_label_index_flags,
13395
16
        { "Label-Index Flags", "bgp.prefix_sid.label_index.flags", FT_UINT16, BASE_HEX,
13396
16
          NULL, 0x0, "2-octet flags, None is defined", HFILL }},
13397
16
      { &hf_bgp_prefix_sid_originator_srgb_flags,
13398
16
        { "Originator SRGB Flags", "bgp.prefix_sid.originator_srgb.flags", FT_UINT16, BASE_HEX,
13399
16
          NULL, 0x0, "2-octet flags, None is defined", HFILL }},
13400
16
      { &hf_bgp_prefix_sid_originator_srgb,
13401
16
        { "Originator SRGB", "bgp.prefix_sid.originator_srgb", FT_NONE, BASE_NONE,
13402
16
          NULL, 0x0, NULL, HFILL }},
13403
16
      { &hf_bgp_prefix_sid_originator_srgb_blocks,
13404
16
        { "SRGB Blocks", "bgp.prefix_sid.originator_srgb_blocks", FT_NONE, BASE_NONE,
13405
16
          NULL, 0x0, NULL, HFILL }},
13406
16
      { &hf_bgp_prefix_sid_originator_srgb_block,
13407
16
        { "SRGB Block", "bgp.prefix_sid.originator_srgb_block", FT_NONE, BASE_NONE,
13408
16
          NULL, 0x0, NULL, HFILL }},
13409
16
      { &hf_bgp_prefix_sid_originator_srgb_base,
13410
16
        { "SRGB Base", "bgp.prefix_sid.originator_srgb_base", FT_UINT24, BASE_DEC,
13411
16
          NULL, 0x0, "A three-octet value", HFILL }},
13412
16
      { &hf_bgp_prefix_sid_originator_srgb_range,
13413
16
        { "SRGB Range", "bgp.prefix_sid.originator_srgb_range", FT_UINT24, BASE_DEC,
13414
16
          NULL, 0x0, "A three-octet value", HFILL }},
13415
16
      { &hf_bgp_prefix_sid_type,
13416
16
        { "Type", "bgp.prefix_sid.type", FT_UINT8, BASE_DEC,
13417
16
          VALS(bgp_prefix_sid_type), 0x0, "BGP Prefix-SID message type", HFILL }},
13418
16
      { &hf_bgp_prefix_sid_length,
13419
16
        { "Length", "bgp.prefix_sid.length", FT_UINT16, BASE_DEC,
13420
16
          NULL, 0x0, "BGP Prefix-SID message payload", HFILL }},
13421
16
      { &hf_bgp_prefix_sid_value,
13422
16
        { "Value", "bgp.prefix_sid.value", FT_BYTES, BASE_NONE,
13423
16
          NULL, 0x0, "BGP Prefix-SID message value", HFILL }},
13424
16
      { &hf_bgp_prefix_sid_reserved,
13425
16
        { "Reserved", "bgp.prefix_sid.reserved", FT_BYTES,
13426
16
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13427
13428
        /* draft-ietf-bess-srv6-services-05 */
13429
16
      { &hf_bgp_prefix_sid_srv6_l3vpn,
13430
16
        { "SRv6 L3 Service", "bgp.prefix_sid.srv6_l3vpn", FT_NONE, BASE_NONE,
13431
16
          NULL, 0x0, NULL, HFILL }},
13432
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
13433
16
        { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_tlvs", FT_NONE, BASE_NONE,
13434
16
          NULL, 0x0, NULL, HFILL }},
13435
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
13436
16
        { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_tlv", FT_NONE, BASE_NONE,
13437
16
          NULL, 0x0, NULL, HFILL }},
13438
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type,
13439
16
        { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
13440
16
          VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
13441
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length,
13442
16
        { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
13443
16
          NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
13444
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value,
13445
16
        { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
13446
16
          NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
13447
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved,
13448
16
        { "Reserved", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.reserved", FT_BYTES,
13449
16
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13450
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_value,
13451
16
        { "SRv6 SID Value", "bgp.prefix_sid.srv6_l3vpn.sid_value", FT_IPv6, BASE_NONE,
13452
16
          NULL, 0x0, NULL, HFILL }},
13453
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_flags,
13454
16
        { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l3vpn.sid_flags", FT_UINT8, BASE_HEX,
13455
16
          NULL, 0x0, NULL, HFILL }},
13456
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior,
13457
16
        { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l3vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
13458
16
          VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
13459
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_reserved,
13460
16
        { "Reserved", "bgp.prefix_sid.srv6_l3vpn.reserved", FT_BYTES,
13461
16
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13462
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
13463
16
        { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
13464
16
          NULL, 0x0, NULL, HFILL }},
13465
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
13466
16
        { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
13467
16
          NULL, 0x0, NULL, HFILL }},
13468
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type,
13469
16
        { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
13470
16
          VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
13471
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length,
13472
16
        { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
13473
16
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
13474
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value,
13475
16
        { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
13476
16
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
13477
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len,
13478
16
        { "Locator Block Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
13479
16
          NULL, 0x0, NULL, HFILL }},
13480
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len,
13481
16
        { "Locator Node Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
13482
16
          NULL, 0x0, NULL, HFILL }},
13483
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len,
13484
16
        { "Function Length", "bgp.prefix_sid.srv6_l3vpn.sid.func_len", FT_UINT8, BASE_DEC,
13485
16
          NULL, 0x0, NULL, HFILL }},
13486
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len,
13487
16
        { "Argument Length", "bgp.prefix_sid.srv6_l3vpn.sid.arg_len", FT_UINT8, BASE_DEC,
13488
16
          NULL, 0x0, NULL, HFILL }},
13489
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len,
13490
16
        { "Transposition Length", "bgp.prefix_sid.srv6_l3vpn.sid.trans_len", FT_UINT8, BASE_DEC,
13491
16
          NULL, 0x0, NULL, HFILL }},
13492
16
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset,
13493
16
        { "Transposition Offset", "bgp.prefix_sid.srv6_l3vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
13494
16
          NULL, 0x0, NULL, HFILL }},
13495
16
      { &hf_bgp_prefix_sid_srv6_l2vpn,
13496
16
        { "SRv6 L2 Service", "bgp.prefix_sid.srv6_l2vpn", FT_NONE, BASE_NONE,
13497
16
          NULL, 0x0, NULL, HFILL }},
13498
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
13499
16
        { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_tlvs", FT_NONE, BASE_NONE,
13500
16
          NULL, 0x0, NULL, HFILL }},
13501
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
13502
16
        { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_tlv", FT_NONE, BASE_NONE,
13503
16
          NULL, 0x0, NULL, HFILL }},
13504
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type,
13505
16
        { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
13506
16
          VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
13507
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length,
13508
16
        { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
13509
16
          NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
13510
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value,
13511
16
        { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
13512
16
          NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
13513
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved,
13514
16
        { "Reserved", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.reserved", FT_BYTES,
13515
16
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13516
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_value,
13517
16
        { "SRv6 SID Value", "bgp.prefix_sid.srv6_l2vpn.sid_value", FT_IPv6, BASE_NONE,
13518
16
          NULL, 0x0, NULL, HFILL }},
13519
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_flags,
13520
16
        { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l2vpn.sid_flags", FT_UINT8, BASE_HEX,
13521
16
          NULL, 0x0, NULL, HFILL }},
13522
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior,
13523
16
        { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l2vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
13524
16
          VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
13525
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_reserved,
13526
16
        { "Reserved", "bgp.prefix_sid.srv6_l2vpn.reserved", FT_BYTES,
13527
16
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
13528
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
13529
16
        { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
13530
16
          NULL, 0x0, NULL, HFILL }},
13531
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
13532
16
        { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
13533
16
          NULL, 0x0, NULL, HFILL }},
13534
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type,
13535
16
        { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
13536
16
          VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
13537
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length,
13538
16
        { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
13539
16
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
13540
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value,
13541
16
        { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
13542
16
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
13543
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len,
13544
16
        { "Locator Block Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
13545
16
          NULL, 0x0, NULL, HFILL }},
13546
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len,
13547
16
        { "Locator Node Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
13548
16
          NULL, 0x0, NULL, HFILL }},
13549
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len,
13550
16
        { "Function Length", "bgp.prefix_sid.srv6_l2vpn.sid.func_len", FT_UINT8, BASE_DEC,
13551
16
          NULL, 0x0, NULL, HFILL }},
13552
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len,
13553
16
        { "Argument Length", "bgp.prefix_sid.srv6_l2vpn.sid.arg_len", FT_UINT8, BASE_DEC,
13554
16
          NULL, 0x0, NULL, HFILL }},
13555
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len,
13556
16
        { "Transposition Length", "bgp.prefix_sid.srv6_l2vpn.sid.trans_len", FT_UINT8, BASE_DEC,
13557
16
          NULL, 0x0, NULL, HFILL }},
13558
16
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset,
13559
16
        { "Transposition Offset", "bgp.prefix_sid.srv6_l2vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
13560
16
          NULL, 0x0, NULL, HFILL }},
13561
13562
        /* RFC5512 : BGP Encapsulation SAFI and the BGP Tunnel Encapsulation Attribute  */
13563
16
      { &hf_bgp_update_encaps_tunnel_tlv_len,
13564
16
        { "length", "bgp.update.encaps_tunnel_tlv_len", FT_UINT16,
13565
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13566
16
      { &hf_bgp_update_encaps_tunnel_tlv_type,
13567
16
        { "Type code", "bgp.update.encaps_tunnel_tlv_type", FT_UINT16, BASE_DEC,
13568
16
          VALS(bgp_attr_tunnel_type), 0x0, NULL, HFILL}},
13569
16
      { &hf_bgp_update_encaps_tunnel_subtlv_len,
13570
16
        { "length", "bgp.update.encaps_tunnel_tlv_sublen", FT_UINT16,
13571
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13572
16
      { &hf_bgp_update_encaps_tunnel_subtlv_type,
13573
16
        { "Type code", "bgp.update.encaps_tunnel_subtlv_type", FT_UINT8, BASE_DEC,
13574
16
          VALS(subtlv_type), 0x0, NULL, HFILL}},
13575
16
      { &hf_bgp_update_encaps_tunnel_subtlv_session_id,
13576
16
        { "Session ID", "bgp.update.encaps_tunnel_tlv_subtlv_session_id", FT_UINT32,
13577
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13578
16
      { &hf_bgp_update_encaps_tunnel_subtlv_cookie,
13579
16
        { "Cookie", "bgp.update.encaps_tunnel_tlv_subtlv_cookie", FT_BYTES,
13580
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13581
16
      { &hf_bgp_update_encaps_tunnel_subtlv_gre_key,
13582
16
        { "GRE Key", "bgp.update.encaps_tunnel_tlv_subtlv_gre_key", FT_UINT32,
13583
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13584
16
      { &hf_bgp_update_encaps_tunnel_subtlv_color_value,
13585
16
        { "Color Value", "bgp.update.encaps_tunnel_tlv_subtlv_color_value", FT_UINT32,
13586
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13587
16
      { &hf_bgp_update_encaps_tunnel_subtlv_lb_block_length,
13588
16
        { "Load-balancing block length", "bgp.update.encaps_tunnel_tlv_subtlv_lb_block_length", FT_UINT32,
13589
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13590
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
13591
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags", FT_UINT8,
13592
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13593
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
13594
16
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_vnid", FT_BOOLEAN,
13595
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_VNID, NULL, HFILL }},
13596
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
13597
16
        { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_mac", FT_BOOLEAN,
13598
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_MAC, NULL, HFILL }},
13599
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
13600
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.reserved", FT_UINT8,
13601
16
          BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_RESERVED, NULL, HFILL }},
13602
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid,
13603
16
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.vnid", FT_UINT24,
13604
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13605
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac,
13606
16
        { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.mac", FT_ETHER,
13607
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13608
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved,
13609
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.reserved", FT_UINT16,
13610
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13611
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
13612
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags", FT_UINT8,
13613
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13614
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
13615
16
        { "Version", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.version", FT_UINT8,
13616
16
          BASE_DEC, NULL, TUNNEL_SUBTLV_VXLAN_GPE_VERSION, NULL, HFILL }},
13617
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
13618
16
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.valid_vnid", FT_BOOLEAN,
13619
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID, NULL, HFILL }},
13620
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
13621
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.reserved", FT_UINT8,
13622
16
          BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_GPE_RESERVED, NULL, HFILL }},
13623
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid,
13624
16
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.vnid", FT_UINT24,
13625
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13626
16
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved,
13627
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.reserved", FT_UINT16,
13628
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13629
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
13630
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags", FT_UINT8,
13631
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13632
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
13633
16
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_vnid", FT_BOOLEAN,
13634
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_VNID, NULL, HFILL }},
13635
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
13636
16
        { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_mac", FT_BOOLEAN,
13637
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_MAC, NULL, HFILL }},
13638
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
13639
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.reserved", FT_UINT8,
13640
16
          BASE_HEX, NULL, TUNNEL_SUBTLV_NVGRE_RESERVED, NULL, HFILL }},
13641
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid,
13642
16
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.vnid", FT_UINT24,
13643
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13644
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac,
13645
16
        { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.mac", FT_ETHER,
13646
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13647
16
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved,
13648
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.reserved", FT_UINT16,
13649
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13650
16
      { &hf_bgp_update_encaps_tunnel_subtlv_value,
13651
16
        { "Value", "bgp.update.encaps_tunnel_tlv_subtlv.value", FT_BYTES,
13652
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13653
16
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_flags,
13654
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.pref.flags", FT_UINT8,
13655
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13656
16
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_reserved,
13657
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.pref.reserved", FT_UINT8,
13658
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13659
16
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_preference,
13660
16
        { "Preference", "bgp.update.encaps_tunnel_tlv_subtlv.pref.preference", FT_BYTES,
13661
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13662
16
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
13663
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags", FT_UINT8,
13664
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13665
16
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
13666
16
        { "Specified-BSID-only", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.specified", FT_BOOLEAN,
13667
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_SPECIFIED, NULL, HFILL }},
13668
16
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
13669
16
        { "Drop Upon Invalid", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.invalid", FT_BOOLEAN,
13670
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_INVALID, NULL, HFILL }},
13671
16
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
13672
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.reserved", FT_UINT8,
13673
16
          BASE_HEX, NULL, TUNNEL_SUBTLV_BINDING_RESERVED, NULL, HFILL }},
13674
16
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
13675
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.reserved", FT_UINT8,
13676
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13677
16
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid,
13678
16
        { "Binding SID", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.sid", FT_BYTES,
13679
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13680
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags,
13681
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags", FT_UINT8,
13682
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13683
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_specified,
13684
16
        { "S-Flag: Specified-BSID-only", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.specified", FT_BOOLEAN,
13685
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SRV6_BINDING_SPECIFIED, NULL, HFILL }},
13686
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_invalid,
13687
16
        { "I-Flag: Drop Upon Invalid", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.invalid", FT_BOOLEAN,
13688
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SRV6_BINDING_INVALID, NULL, HFILL }},
13689
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_b_flag,
13690
16
        { "B-Flag: SRv6 Endpoint Behavior present", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.b_flag", FT_BOOLEAN,
13691
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SRV6_BINDING_B_FLAG, NULL, HFILL }},
13692
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_flags_reserved,
13693
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.flags.reserved", FT_UINT8,
13694
16
          BASE_HEX, NULL, TUNNEL_SUBTLV_SRV6_BINDING_RESERVED, NULL, HFILL }},
13695
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_reserved,
13696
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.reserved", FT_UINT8,
13697
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13698
16
      { &hf_bgp_update_encaps_tunnel_subtlv_srv6_binding_sid_sid,
13699
16
        { "SRv6 Binding SID", "bgp.update.encaps_tunnel_tlv_subtlv.srv6_binding_sid.sid", FT_IPv6,
13700
16
          BASE_NONE, NULL, 0x0, "16-octet IPv6 address", HFILL}},
13701
16
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_flags,
13702
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.flags", FT_UINT8,
13703
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13704
16
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved,
13705
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.reserved", FT_UINT8,
13706
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13707
16
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp,
13708
16
        { "ENLP", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.preference", FT_UINT8,
13709
16
          BASE_DEC, VALS(bgp_enlp_type), 0x0, NULL, HFILL}},
13710
16
      { &hf_bgp_update_encaps_tunnel_subtlv_priority_priority,
13711
16
        { "Priority", "bgp.update.encaps_tunnel_tlv_subtlv.priority.priority", FT_UINT8,
13712
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13713
16
      { &hf_bgp_update_encaps_tunnel_subtlv_priority_reserved,
13714
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.priority.reserved", FT_UINT8,
13715
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13716
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved,
13717
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.reserved", FT_UINT8,
13718
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13719
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv,
13720
16
        { "sub-TLVs", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv", FT_BYTES,
13721
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13722
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type,
13723
16
        { "Type", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.type", FT_UINT8,
13724
16
          BASE_DEC, VALS(bgp_sr_policy_list_type), 0x0, NULL, HFILL}},
13725
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length,
13726
16
        { "Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.length", FT_UINT8,
13727
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13728
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
13729
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags", FT_UINT8,
13730
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13731
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
13732
16
        { "V-Flag: SID verification", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.verification", FT_BOOLEAN,
13733
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION, "Used by SRPM for SID verification (RFC 9256)", HFILL }},
13734
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
13735
16
        { "A-Flag: SR Algorithm", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.algorithm", FT_BOOLEAN,
13736
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM, "SR Algorithm field present (RFC 9831)", HFILL }},
13737
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_s_flag,
13738
16
        { "S-Flag: SID present", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.s_flag", FT_BOOLEAN,
13739
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_S_FLAG, "Indicates presence of SR-MPLS or SRv6 SID (RFC 9831)", HFILL }},
13740
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_b_flag,
13741
16
        { "B-Flag: SRv6 Endpoint Behavior present", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.b_flag", FT_BOOLEAN,
13742
16
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_B_FLAG, "Indicates presence of SRv6 Endpoint Behavior and SID Structure (RFC 9830)", HFILL }},
13743
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
13744
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.reserved", FT_UINT8,
13745
16
          BASE_HEX, NULL, TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED, NULL, HFILL }},
13746
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
13747
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.reserved", FT_BYTES,
13748
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13749
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
13750
16
        { "MPLS Label", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.mpls_label", FT_UINT24,
13751
16
          BASE_DEC_HEX, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
13752
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
13753
16
        { "Traffic Class", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.traffic_class", FT_UINT24,
13754
16
          BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
13755
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
13756
16
        { "Bottom-of-Stack", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.bottom_stack", FT_BOOLEAN,
13757
16
          24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
13758
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
13759
16
        { "TTL", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ttl", FT_UINT8,
13760
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13761
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_sr_algorithm,
13762
16
        { "SR Algorithm", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.sr_algorithm", FT_UINT8,
13763
16
          BASE_DEC, NULL, 0x0, "SR Algorithm as per RFC 8402 Section 3.1.1", HFILL}},
13764
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_interface_id,
13765
16
        { "Local Interface ID", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.local_interface_id", FT_UINT32,
13766
16
          BASE_DEC, NULL, 0x0, "Interface index of the local interface (RFC 9552 TLV 258)", HFILL}},
13767
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_interface_id,
13768
16
        { "Remote Interface ID", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.remote_interface_id", FT_UINT32,
13769
16
          BASE_DEC, NULL, 0x0, "Interface index of the remote interface (RFC 9552 TLV 258)", HFILL}},
13770
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv4_node_address,
13771
16
        { "IPv4 Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ipv4_node_address", FT_IPv4,
13772
16
          BASE_NONE, NULL, 0x0, "4-octet IPv4 address representing a node", HFILL}},
13773
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv4_address,
13774
16
        { "Local IPv4 Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.local_ipv4_address", FT_IPv4,
13775
16
          BASE_NONE, NULL, 0x0, "Local link address (adjacency)", HFILL}},
13776
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv4_address,
13777
16
        { "Remote IPv4 Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.remote_ipv4_address", FT_IPv4,
13778
16
          BASE_NONE, NULL, 0x0, "Remote link address of neighbor (adjacency)", HFILL}},
13779
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ipv6_node_address,
13780
16
        { "IPv6 Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ipv6_node_address", FT_IPv6,
13781
16
          BASE_NONE, NULL, 0x0, "16-octet IPv6 address representing a node", HFILL}},
13782
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_local_ipv6_address,
13783
16
        { "IPv6 Local Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.local_ipv6_address", FT_IPv6,
13784
16
          BASE_NONE, NULL, 0x0, "16-octet IPv6 local node address (link-local adjacency)", HFILL}},
13785
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_remote_ipv6_address,
13786
16
        { "IPv6 Remote Node Address", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.remote_ipv6_address", FT_IPv6,
13787
16
          BASE_NONE, NULL, 0x0, "16-octet IPv6 remote node address (link-local adjacency)", HFILL}},
13788
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_sid,
13789
16
        { "SRv6 SID", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_sid", FT_IPv6,
13790
16
          BASE_NONE, NULL, 0x0, "16-octet IPv6 address", HFILL}},
13791
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior,
13792
16
        { "SRv6 Endpoint Behavior and SID Structure", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_endpoint_behavior", FT_NONE,
13793
16
          BASE_NONE, NULL, 0x0, "RFC 8986 SRv6 Endpoint Behavior and SID Structure", HFILL}},
13794
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_code,
13795
16
        { "Endpoint Behavior", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_endpoint_behavior.code", FT_UINT16,
13796
16
          BASE_DEC_HEX, VALS(srv6_endpoint_behavior), 0x0, "SRv6 Endpoint Behavior code point (0xFFFF = Opaque)", HFILL}},
13797
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_endpoint_behavior_reserved,
13798
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_endpoint_behavior.reserved", FT_UINT16,
13799
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13800
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_lb_length,
13801
16
        { "Locator Block Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_lb_length", FT_UINT8,
13802
16
          BASE_DEC, NULL, 0x0, "SRv6 SID Locator Block length in bits", HFILL}},
13803
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_ln_length,
13804
16
        { "Locator Node Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_ln_length", FT_UINT8,
13805
16
          BASE_DEC, NULL, 0x0, "SRv6 SID Locator Node length in bits", HFILL}},
13806
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_func_length,
13807
16
        { "Function Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_func_length", FT_UINT8,
13808
16
          BASE_DEC, NULL, 0x0, "SRv6 SID Function length in bits", HFILL}},
13809
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_srv6_arg_length,
13810
16
        { "Argument Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.srv6_arg_length", FT_UINT8,
13811
16
          BASE_DEC, NULL, 0x0, "SRv6 SID Arguments length in bits", HFILL}},
13812
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight_flags,
13813
16
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.weight.flags", FT_UINT8,
13814
16
          BASE_HEX, NULL, 0x0, "Weight sub-TLV flags (reserved)", HFILL}},
13815
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_weight,
13816
16
        { "Weight", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.weight", FT_UINT32,
13817
16
          BASE_DEC, NULL, 0x0, "Weight value (0 is invalid)", HFILL}},
13818
16
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
13819
16
        { "Data", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.data", FT_BYTES,
13820
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13821
16
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_reserved,
13822
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.policy_cp_name.reserved", FT_UINT8,
13823
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13824
16
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_cp_name_name,
13825
16
        { "Candidate path name", "bgp.update.encaps_tunnel_tlv_subtlv.policy_cp_name.name", FT_STRING,
13826
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13827
16
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved,
13828
16
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.reserved", FT_UINT8,
13829
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13830
16
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_name,
13831
16
        { "Policy name", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.name", FT_STRING,
13832
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13833
13834
      /* BGP update path attribute SSA SAFI (deprecated IETF draft) */
13835
16
      { &hf_bgp_ssa_t,
13836
16
        { "Transitive bit", "bgp.ssa_t", FT_BOOLEAN, 8,
13837
16
          NULL, 0x80, "SSA Transitive bit", HFILL}},
13838
16
      { &hf_bgp_ssa_type,
13839
16
        { "SSA Type", "bgp.ssa_type", FT_UINT16, BASE_DEC,
13840
16
          VALS(bgp_ssa_type), 0x7FFF, NULL, HFILL}},
13841
16
      { &hf_bgp_ssa_len,
13842
16
        { "Length", "bgp.ssa_len", FT_UINT16, BASE_DEC,
13843
16
          NULL, 0x0, "SSA Length", HFILL}},
13844
16
      { &hf_bgp_ssa_value,
13845
16
        { "Value", "bgp.ssa_value", FT_BYTES, BASE_NONE,
13846
16
          NULL, 0x0, "SSA Value", HFILL}},
13847
16
      { &hf_bgp_ssa_l2tpv3_pref,
13848
16
        { "Preference", "bgp.ssa_l2tpv3_pref", FT_UINT16, BASE_DEC,
13849
16
          NULL, 0x0, NULL, HFILL}},
13850
16
      { &hf_bgp_ssa_l2tpv3_s,
13851
16
        { "Sequencing bit", "bgp.ssa_l2tpv3_s", FT_BOOLEAN, 8,
13852
16
          NULL, 0x80, "Sequencing S-bit", HFILL}},
13853
16
      { &hf_bgp_ssa_l2tpv3_unused,
13854
16
        { "Unused", "bgp.ssa_l2tpv3_Unused", FT_BOOLEAN, 8,
13855
16
          NULL, 0x7F, "Unused Flags", HFILL}},
13856
16
      { &hf_bgp_ssa_l2tpv3_cookie_len,
13857
16
        { "Cookie Length", "bgp.ssa_l2tpv3_cookie_len", FT_UINT8, BASE_DEC,
13858
16
          NULL, 0x0, NULL, HFILL}},
13859
16
      { &hf_bgp_ssa_l2tpv3_session_id,
13860
16
        { "Session ID", "bgp.ssa_l2tpv3_session_id", FT_UINT32, BASE_DEC,
13861
16
          NULL, 0x0, NULL, HFILL}},
13862
16
      { &hf_bgp_ssa_l2tpv3_cookie,
13863
16
        { "Cookie", "bgp.ssa_l2tpv3_cookie", FT_BYTES, BASE_NONE,
13864
16
          NULL, 0x0, NULL, HFILL}},
13865
16
      { &hf_bgp_withdrawn_prefix,
13866
16
        { "Withdrawn prefix", "bgp.withdrawn_prefix", FT_IPv4, BASE_NONE,
13867
16
          NULL, 0x0, NULL, HFILL}},
13868
13869
      /* NLRI header description */
13870
16
      { &hf_bgp_update_nlri,
13871
16
        { "Network Layer Reachability Information (NLRI)", "bgp.update.nlri", FT_NONE, BASE_NONE,
13872
16
          NULL, 0x0, NULL, HFILL}},
13873
      /* Global NLRI description */
13874
16
      { &hf_bgp_mp_reach_nlri_ipv4_prefix,
13875
16
        { "MP Reach NLRI IPv4 prefix", "bgp.mp_reach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
13876
16
          NULL, 0x0, NULL, HFILL}},
13877
16
      { &hf_bgp_mp_unreach_nlri_ipv4_prefix,
13878
16
        { "MP Unreach NLRI IPv4 prefix", "bgp.mp_unreach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
13879
16
          NULL, 0x0, NULL, HFILL}},
13880
16
      { &hf_bgp_mp_reach_nlri_ipv6_prefix,
13881
16
        { "MP Reach NLRI IPv6 prefix", "bgp.mp_reach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
13882
16
          NULL, 0x0, NULL, HFILL}},
13883
16
      { &hf_bgp_mp_unreach_nlri_ipv6_prefix,
13884
16
        { "MP Unreach NLRI IPv6 prefix", "bgp.mp_unreach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
13885
16
          NULL, 0x0, NULL, HFILL}},
13886
16
      { &hf_bgp_mp_nlri_tnl_id,
13887
16
        { "MP Reach NLRI Tunnel Identifier", "bgp.mp_nlri_tnl_id", FT_UINT16, BASE_HEX,
13888
16
          NULL, 0x0, NULL, HFILL}},
13889
16
      { &hf_bgp_nlri_prefix,
13890
16
        { "NLRI prefix", "bgp.nlri_prefix", FT_IPv4, BASE_NONE,
13891
16
          NULL, 0x0, NULL, HFILL}},
13892
16
      { &hf_bgp_nlri_path_id,
13893
16
        { "NLRI path id", "bgp.nlri_path_id", FT_UINT32, BASE_DEC,
13894
16
          NULL, 0x0, NULL, HFILL}},
13895
13896
      /* mcast vpn nlri and capability */
13897
16
      { &hf_bgp_mcast_vpn_nlri_t,
13898
16
        { "MCAST-VPN nlri", "bgp.mcast_vpn_nlri", FT_BYTES, BASE_NONE,
13899
16
          NULL, 0x0, NULL, HFILL}},
13900
16
      { &hf_bgp_mcast_vpn_nlri_route_type,
13901
16
        { "Route Type", "bgp.mcast_vpn_nlri_route_type", FT_UINT8,
13902
16
          BASE_DEC, VALS(mcast_vpn_route_type), 0x0, NULL, HFILL}},
13903
16
      { &hf_bgp_mcast_vpn_nlri_length,
13904
16
        { "Length", "bgp.mcast_vpn_nlri_length", FT_UINT8,
13905
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13906
16
      { &hf_bgp_mcast_vpn_nlri_rd,
13907
16
        { "Route Distinguisher", "bgp.mcast_vpn_nlri_rd", FT_BYTES,
13908
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13909
16
      { &hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
13910
16
        { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv4", FT_IPv4,
13911
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13912
16
      { &hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
13913
16
        { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv6", FT_IPv6,
13914
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13915
16
      { &hf_bgp_mcast_vpn_nlri_source_as,
13916
16
        { "Source AS", "bgp.mcast_vpn_nlri_source_as", FT_UINT32,
13917
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13918
16
       { &hf_bgp_mcast_vpn_nlri_source_length,
13919
16
        { "Multicast Source Length", "bgp.mcast_vpn_nlri_source_length", FT_UINT8,
13920
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13921
16
       { &hf_bgp_mcast_vpn_nlri_group_length,
13922
16
        { "Multicast Group Length", "bgp.mcast_vpn_nlri_group_length", FT_UINT8,
13923
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13924
16
      { &hf_bgp_mcast_vpn_nlri_source_addr_ipv4,
13925
16
        { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv4", FT_IPv4,
13926
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13927
16
      { &hf_bgp_mcast_vpn_nlri_source_addr_ipv6,
13928
16
        { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv6", FT_IPv6,
13929
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13930
16
      { &hf_bgp_mcast_vpn_nlri_group_addr_ipv4,
13931
16
        { "Multicast Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv4", FT_IPv4,
13932
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13933
16
      { &hf_bgp_mcast_vpn_nlri_group_addr_ipv6,
13934
16
        { "Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv6", FT_IPv6,
13935
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13936
16
      { &hf_bgp_mcast_vpn_nlri_route_key,
13937
16
        { "Route Key", "bgp.mcast_vpn_nlri_route_key", FT_BYTES,
13938
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13939
      /* sr policy nlri*/
13940
16
      { &hf_bgp_sr_policy_nlri_length,
13941
16
        { "NLRI length", "bgp.sr_policy_nlri_length", FT_UINT8,
13942
16
          BASE_DEC, NULL, 0x0, "NLRI length in bits", HFILL}},
13943
16
      { &hf_bgp_sr_policy_nlri_distinguisher,
13944
16
        { "Distinguisher", "bgp.sr_policy_nlri_distinguisher", FT_UINT32,
13945
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13946
16
      { &hf_bgp_sr_policy_nlri_policy_color,
13947
16
        { "Policy color", "bgp.sr_policy_nlri_policy_color", FT_UINT32,
13948
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13949
16
      { &hf_bgp_sr_policy_nlri_endpoint_v4,
13950
16
        { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv4", FT_IPv4,
13951
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13952
16
      { &hf_bgp_sr_policy_nlri_endpoint_v6,
13953
16
        { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv6", FT_IPv6,
13954
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13955
        /* Bgp flow spec nlri and capability */
13956
16
      { &hf_bgp_flowspec_nlri_t,
13957
16
        { "FLOW-SPEC nlri", "bgp.flowspec_nlri", FT_BYTES, BASE_NONE,
13958
16
          NULL, 0x0, NULL, HFILL}},
13959
16
      { &hf_bgp_flowspec_nlri_route_distinguisher,
13960
16
        { "Route Distinguisher", "bgp.flowspec_route_distinguisher", FT_NONE,
13961
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13962
16
      { &hf_bgp_flowspec_nlri_route_distinguisher_type,
13963
16
        { "Route Distinguisher Type", "bgp.flowspec_route_distinguisher_type", FT_UINT16,
13964
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13965
16
      { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
13966
16
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_2", FT_UINT16,
13967
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13968
16
      { &hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
13969
16
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_ipv4", FT_IPv4,
13970
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13971
16
      { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
13972
16
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_4", FT_UINT32,
13973
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13974
16
      { &hf_bgp_flowspec_nlri_route_dist_asnum_2,
13975
16
        { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_2", FT_UINT16,
13976
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13977
16
      { &hf_bgp_flowspec_nlri_route_dist_asnum_4,
13978
16
        { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_4", FT_UINT32,
13979
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13980
16
      { &hf_bgp_flowspec_nlri_filter,
13981
16
        { "Filter", "bgp.flowspec_nlri.filter", FT_NONE, BASE_NONE,
13982
16
          NULL, 0x0, NULL, HFILL }},
13983
16
      { &hf_bgp_flowspec_nlri_filter_type,
13984
16
        { "Filter type", "bgp.flowspec_nlri.filter_type", FT_UINT8, BASE_DEC,
13985
16
          VALS(flowspec_nlri_opvaluepair_type), 0x0, NULL, HFILL }},
13986
16
      { &hf_bgp_flowspec_nlri_length,
13987
16
        { "NRLI length", "bgp.flowspec_nlri.length", FT_UINT16, BASE_DEC,
13988
16
          NULL, 0x0, NULL, HFILL }},
13989
16
      { &hf_bgp_flowspec_nlri_op_flags,
13990
16
        { "Operator flags", "bgp.flowspec_nlri.opflags", FT_UINT8, BASE_HEX,
13991
16
          NULL, 0x0, NULL, HFILL }},
13992
16
      { &hf_bgp_flowspec_nlri_dst_pref_ipv4,
13993
16
        { "Destination IP filter", "bgp.flowspec_nlri.dst_prefix_filter", FT_IPv4,
13994
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13995
16
      { &hf_bgp_flowspec_nlri_src_pref_ipv4,
13996
16
        { "Source IP filter", "bgp.flowspec_nlri.src_prefix_filter", FT_IPv4,
13997
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13998
16
      { &hf_bgp_flowspec_nlri_op_eol,
13999
16
        { "end-of-list", "bgp.flowspec_nlri.op.eol", FT_BOOLEAN, 8,
14000
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_END_OF_LST, NULL, HFILL }},
14001
16
      { &hf_bgp_flowspec_nlri_op_and,
14002
16
        { "and", "bgp.flowspec_nlri.op.and", FT_BOOLEAN, 8,
14003
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_AND_BIT, NULL, HFILL }},
14004
16
      { &hf_bgp_flowspec_nlri_op_val_len,
14005
16
        { "Value length", "bgp.flowspec_nlri.op.val_len", FT_UINT8, BASE_DEC,
14006
16
          VALS(flow_spec_op_len_val), BGPNLRI_FSPEC_VAL_LEN, NULL, HFILL }},
14007
16
      { &hf_bgp_flowspec_nlri_op_un_bit4,
14008
16
        { "Reserved", "bgp.flowspec_nlri.op.un_bit4", FT_BOOLEAN, 8,
14009
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT4, "Unused (must be zero)",HFILL}},
14010
16
      { &hf_bgp_flowspec_nlri_op_un_bit5,
14011
16
        { "Reserved", "bgp.flowspec_nlri.op.un_bit5", FT_BOOLEAN, 8,
14012
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT5, "Unused (must be zero)", HFILL}},
14013
16
      { &hf_bgp_flowspec_nlri_dec_val_8,
14014
16
        { "Decimal value", "bgp.flowspec_nlri.dec_val_8", FT_UINT8, BASE_DEC,
14015
16
          NULL, 0x0, NULL, HFILL }},
14016
16
      { &hf_bgp_flowspec_nlri_dec_val_16,
14017
16
        { "Decimal value", "bgp.flowspec_nlri.dec_val_16", FT_UINT16, BASE_DEC,
14018
16
          NULL, 0x0, NULL, HFILL }},
14019
16
      { &hf_bgp_flowspec_nlri_dec_val_32,
14020
16
        { "Decimal value", "bgp.flowspec_nlri.dec_val_32", FT_UINT32, BASE_DEC,
14021
16
          NULL, 0x0, NULL, HFILL }},
14022
16
      { &hf_bgp_flowspec_nlri_dec_val_64,
14023
16
        { "Decimal value", "bgp.flowspec_nlri.dec_val_64", FT_UINT64, BASE_DEC,
14024
16
          NULL, 0x0, NULL, HFILL }},
14025
16
      { &hf_bgp_flowspec_nlri_op_lt,
14026
16
        { "less than", "bgp.flowspec_nlri.op.lt", FT_BOOLEAN, 8,
14027
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_LESS_THAN, NULL, HFILL }},
14028
16
      { &hf_bgp_flowspec_nlri_op_gt,
14029
16
        { "greater than", "bgp.flowspec_nlri.op.gt", FT_BOOLEAN, 8,
14030
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_GREATER_THAN, NULL, HFILL }},
14031
16
      { &hf_bgp_flowspec_nlri_op_eq,
14032
16
        { "equal", "bgp.flowspec_nlri.op.equal", FT_BOOLEAN, 8,
14033
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_EQUAL, NULL, HFILL }},
14034
16
      { &hf_bgp_flowspec_nlri_op_flg_not,
14035
16
        { "logical negation", "bgp.flowspec_nlri.op.flg_not", FT_BOOLEAN, 8,
14036
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_NOTBIT, NULL, HFILL }},
14037
16
      { &hf_bgp_flowspec_nlri_op_flg_match,
14038
16
        { "Match bit", "bgp.flowspec_nlri.op.flg_match", FT_BOOLEAN, 8,
14039
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_MATCHBIT, NULL, HFILL }},
14040
16
      { &hf_bgp_flowspec_nlri_tcp_flags,
14041
16
        { "TCP flags", "bgp.flowspec_nlri.val_tcp.flags", FT_UINT8, BASE_HEX,
14042
16
          NULL, 0x0, NULL, HFILL }},
14043
16
      { &hf_bgp_flowspec_nlri_tcp_flags_cwr,
14044
16
        { "Congestion Window Reduced (CWR)", "bgp.flowspec_nlri.val_tcp.flags.cwr", FT_BOOLEAN, 8,
14045
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_CWR, NULL, HFILL }},
14046
16
      { &hf_bgp_flowspec_nlri_tcp_flags_ecn,
14047
16
        { "ECN-Echo", "bgp.flowspec_nlri.val_tcp.flags.ecn", FT_BOOLEAN, 8,
14048
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ECN, NULL, HFILL }},
14049
16
      { &hf_bgp_flowspec_nlri_tcp_flags_urg,
14050
16
        { "Urgent",  "bgp.flowspec_nlri.val_tcp.flags.urg", FT_BOOLEAN, 8,
14051
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_URG, NULL, HFILL }},
14052
16
      { &hf_bgp_flowspec_nlri_tcp_flags_ack,
14053
16
        { "Acknowledgment", "bgp.flowspec_nlri.val_tcp.flags.ack", FT_BOOLEAN, 8,
14054
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ACK, NULL, HFILL }},
14055
16
      { &hf_bgp_flowspec_nlri_tcp_flags_push,
14056
16
        { "Push", "bgp.flowspec_nlri.val_tcp.flags.push", FT_BOOLEAN, 8,
14057
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_PUSH, NULL, HFILL }},
14058
16
      { &hf_bgp_flowspec_nlri_tcp_flags_reset,
14059
16
        { "Reset", "bgp.flowspec_nlri.val_tcp.flags.reset", FT_BOOLEAN, 8,
14060
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_RST, NULL, HFILL }},
14061
16
      { &hf_bgp_flowspec_nlri_tcp_flags_syn,
14062
16
        { "Syn", "bgp.flowspec_nlri.val_tcp.flags.syn", FT_BOOLEAN, 8,
14063
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_SYN, NULL, HFILL }},
14064
16
      { &hf_bgp_flowspec_nlri_tcp_flags_fin,
14065
16
        { "Fin", "bgp.flowspec_nlri.val_tcp.flags.fin", FT_BOOLEAN, 8,
14066
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_FIN, NULL, HFILL }},
14067
16
      { &hf_bgp_flowspec_nlri_fflag,
14068
16
        { "Fragment Flag", "bgp.flowspec_nlri.val_frag", FT_UINT8, BASE_HEX,
14069
16
          NULL, 0x0, NULL, HFILL }},
14070
16
      { &hf_bgp_flowspec_nlri_fflag_lf,
14071
16
        { "Last fragment", "bgp.flowspec_nlri.val_frag_lf", FT_BOOLEAN, 8,
14072
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_LF, NULL, HFILL }},
14073
16
      { &hf_bgp_flowspec_nlri_fflag_ff,
14074
16
        { "First fragment", "bgp.flowspec_nlri.val_frag_ff", FT_BOOLEAN, 8,
14075
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_FF, NULL, HFILL }},
14076
16
      { &hf_bgp_flowspec_nlri_fflag_isf,
14077
16
        { "Is a fragment", "bgp.flowspec_nlri.val_frag_isf", FT_BOOLEAN, 8,
14078
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_ISF, NULL, HFILL }},
14079
16
      { &hf_bgp_flowspec_nlri_fflag_df,
14080
16
        { "Don't fragment", "bgp.flowspec_nlri.val_frag_df", FT_BOOLEAN, 8,
14081
16
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_DF, NULL, HFILL }},
14082
16
      { &hf_bgp_flowspec_nlri_dscp,
14083
16
        { "Differentiated Services Codepoint", "bgp.flowspec_nlri.val_dsfield", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
14084
16
          &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
14085
16
      { &hf_bgp_flowspec_nlri_src_ipv6_pref,
14086
16
        { "Source IPv6 prefix", "bgp.flowspec_nlri.src_ipv6_pref", FT_IPv6, BASE_NONE,
14087
16
          NULL, 0x0, NULL, HFILL}},
14088
16
      { &hf_bgp_flowspec_nlri_dst_ipv6_pref,
14089
16
        { "Destination IPv6 prefix", "bgp.flowspec_nlri.dst_ipv6_pref", FT_IPv6, BASE_NONE,
14090
16
          NULL, 0x0, NULL, HFILL}},
14091
16
      { &hf_bgp_flowspec_nlri_ipv6_pref_len,
14092
16
        { "IPv6 prefix length", "bgp.flowspec_nlri.ipv6_pref_length", FT_UINT8, BASE_DEC,
14093
16
          NULL, 0x0, NULL, HFILL}},
14094
16
      { &hf_bgp_flowspec_nlri_ipv6_pref_offset,
14095
16
        { "IPv6 prefix offset", "bgp.flowspec_nlri.ipv6_pref_offset", FT_UINT8, BASE_DEC,
14096
16
          NULL, 0x0, NULL, HFILL}},
14097
        /* end of bgp flow spec */
14098
        /* BGP update safi ndt nlri  draft-nalawade-idr-mdt-safi-03 */
14099
16
      { &hf_bgp_mdt_nlri_safi_rd,
14100
16
        { "Route Distinguisher", "bgp.mdt_safi_rd", FT_BYTES,
14101
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14102
16
      { &hf_bgp_mdt_nlri_safi_ipv4_addr,
14103
16
        { "IPv4 Address", "bgp.mdt_safi_ipv4_addr", FT_IPv4,
14104
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14105
16
      { &hf_bgp_mdt_nlri_safi_group_addr,
14106
16
        { "Group Address", "bgp.mdt_safi_group_addr", FT_IPv4,
14107
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14108
        /* BGP update extended community header field */
14109
16
      { &hf_bgp_ext_communities,
14110
16
        { "Carried extended communities", "bgp.ext_communities", FT_NONE, BASE_NONE,
14111
16
          NULL, 0x0, NULL, HFILL }},
14112
16
      { &hf_bgp_ext_community,
14113
16
        { "Community", "bgp.ext_community", FT_NONE, BASE_NONE,
14114
16
          NULL, 0x0, "Extended Community attribute", HFILL }},
14115
16
      { &hf_bgp_ext_com_type_high,
14116
16
        { "Type", "bgp.ext_com.type", FT_UINT8, BASE_HEX,
14117
16
          VALS(bgpext_com_type_high), 0x0, "Extended Community type", HFILL }},
14118
16
      { &hf_bgp_ext_com_type_auth,
14119
16
        { "IANA Authority", "bgp.ext_com.type.auth", FT_BOOLEAN, 8,
14120
16
          TFS(&tfs_bgpext_com_type_auth), BGP_EXT_COM_TYPE_AUTH, "IANA Type Allocation Policy", HFILL }},
14121
16
      {&hf_bgp_ext_com_type_tran,
14122
16
        { "Transitive across ASes", "bgp.ext_com.type.tran", FT_BOOLEAN, 8,
14123
16
          TFS(&tfs_non_transitive_transitive), BGP_EXT_COM_TYPE_TRAN, "Transitivity of the attribute across autonomous systems", HFILL }},
14124
16
      { &hf_bgp_ext_com_stype_low_unknown,
14125
16
        { "Subtype", "bgp.ext_com.stype_unknown", FT_UINT8, BASE_HEX,
14126
16
          NULL, 0x0, "Extended Community subtype", HFILL }},
14127
16
      { &hf_bgp_ext_com_stype_tr_evpn,
14128
16
        { "Subtype (EVPN)", "bgp.ext_com.stype_tr_evpn", FT_UINT8, BASE_HEX,
14129
16
          VALS(bgpext_com_stype_tr_evpn), 0x0, "EVPN Extended Community subtype", HFILL}},
14130
16
      { &hf_bgp_ext_com_stype_tr_as2,
14131
16
        { "Subtype (AS2)", "bgp.ext_com.stype_tr_as2", FT_UINT8, BASE_HEX,
14132
16
          VALS(bgpext_com_stype_tr_as2), 0x0, "2-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
14133
16
      { &hf_bgp_ext_com_stype_ntr_as2,
14134
16
        { "Subtype (Non-transitive AS2)", "bgp.ext_com.stype_ntr_as2", FT_UINT8, BASE_HEX,
14135
16
          VALS(bgpext_com_stype_ntr_as2), 0x0, "2-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
14136
16
      { &hf_bgp_ext_com_stype_tr_as4,
14137
16
        { "Subtype (AS4)", "bgp.ext_com.stype_tr_as4", FT_UINT8, BASE_HEX,
14138
16
          VALS(bgpext_com_stype_tr_as4), 0x0, "4-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
14139
16
      { &hf_bgp_ext_com_stype_ntr_as4,
14140
16
        { "Subtype (Non-transitive AS4)", "bgp.ext_com.stype_ntr_as4", FT_UINT8, BASE_HEX,
14141
16
          VALS(bgpext_com_stype_ntr_as4), 0x0, "4-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
14142
16
      { &hf_bgp_ext_com_stype_tr_IP4,
14143
16
        { "Subtype (IPv4)", "bgp.ext_com.stype_tr_IP4", FT_UINT8, BASE_HEX,
14144
16
          VALS(bgpext_com_stype_tr_IP4), 0x0, "IPv4-Address-Specific Transitive Extended Community subtype", HFILL}},
14145
16
      { &hf_bgp_ext_com_stype_ntr_IP4,
14146
16
        { "Subtype (Non-transitive IPv4)", "bgp.ext_com.stype_ntr_IP4", FT_UINT8, BASE_HEX,
14147
16
          VALS(bgpext_com_stype_ntr_IP4), 0x0, "IPv4-Address-Specific Non-transitive Extended Community subtype", HFILL}},
14148
16
      { &hf_bgp_ext_com_stype_tr_opaque,
14149
16
        { "Subtype (Opaque)", "bgp.ext_com.stype_tr_opaque", FT_UINT8, BASE_HEX,
14150
16
          VALS(bgpext_com_stype_tr_opaque), 0x0, "Opaque Transitive Extended Community subtype", HFILL}},
14151
16
      { &hf_bgp_ext_com_stype_ntr_opaque,
14152
16
        { "Subtype (Non-transitive Opaque)", "bgp.ext_com.stype_ntr_opaque", FT_UINT8, BASE_HEX,
14153
16
          VALS(bgpext_com_stype_ntr_opaque), 0x0, "Opaque Non-transitive Extended Community subtype", HFILL}},
14154
16
      { &hf_bgp_ext_com_tunnel_type,
14155
16
        { "Tunnel type", "bgp.ext_com.tunnel_type", FT_UINT16, BASE_DEC,
14156
16
          VALS(bgpext_com_tunnel_type), 0x0, "Tunnel encapsulation type", HFILL}},
14157
16
      { &hf_bgp_ext_com_stype_tr_mup,
14158
16
        { "Subtype (MUP)", "bgp.ext_com.stype_tr_mup", FT_UINT8, BASE_HEX,
14159
16
          VALS(bgpext_com_stype_tr_mup), 0x0, "MUP Extended Community subtype", HFILL}},
14160
16
      { &hf_bgp_ext_com_stype_tr_exp,
14161
16
        { "Subtype (Experimental)", "bgp.ext_com.stype_tr_exp", FT_UINT8, BASE_HEX,
14162
16
          VALS(bgpext_com_stype_tr_exp), 0x0, "Experimental Transitive Extended Community subtype", HFILL}},
14163
16
      { &hf_bgp_ext_com_stype_tr_exp_2,
14164
16
        { "Subtype (Experimental Part 2)", "bgp.ext_com.stype_tr_exp_2", FT_UINT8, BASE_HEX,
14165
16
          VALS(bgpext_com_stype_tr_exp_2), 0x0, "Generic Transitive Experimental Use Extended Community Part 2 Sub-Types", HFILL}},
14166
16
      { &hf_bgp_ext_com_stype_tr_exp_3,
14167
16
        { "Subtype (Experimental Part 3)", "bgp.ext_com.stype_tr_exp_3", FT_UINT8, BASE_HEX,
14168
16
          VALS(bgpext_com_stype_tr_exp_3), 0x0, "Generic Transitive Experimental Use Extended Community Part 3 Sub-Types", HFILL}},
14169
16
      { &hf_bgp_ext_com_value_as2,
14170
16
        { "2-Octet AS", "bgp.ext_com.value_as2", FT_UINT16, BASE_DEC,
14171
16
          NULL, 0x0, "Global Administrator Field value (2B Autonomous System Number)", HFILL }},
14172
16
      { &hf_bgp_ext_com_value_as4,
14173
16
        { "4-Octet AS", "bgp.ext_com.value_as4", FT_UINT32, BASE_DEC,
14174
16
          NULL, 0x0, "Global Administrator Field value (4B Autonomous System Number)", HFILL }},
14175
16
      { &hf_bgp_ext_com_value_IP4,
14176
16
        { "IPv4 address", "bgp.ext_com.value_IP4", FT_IPv4, BASE_NONE,
14177
16
          NULL, 0x0, "Global Administrator Field value (IPv4 Address)", HFILL }},
14178
16
      { &hf_bgp_ext_com_value_an2,
14179
16
        { "2-Octet AN", "bgp.ext_com.value_an2", FT_UINT16, BASE_DEC,
14180
16
          NULL, 0x0, "Local Administrator Field value (2B Assigned Number)", HFILL }},
14181
16
      { &hf_bgp_ext_com_value_an4,
14182
16
        { "4-Octet AN", "bgp.ext_com.value_an4", FT_UINT32, BASE_DEC,
14183
16
          NULL, 0x0, "Local Administrator Field value (4B Assigned Number)", HFILL }},
14184
16
      { &hf_bgp_ext_com_value_link_bw,
14185
16
        { "Link bandwidth", "bgp.ext_com.value_link_bw", FT_FLOAT, BASE_NONE,
14186
16
          NULL, 0x0, NULL, HFILL}},
14187
16
      { &hf_bgp_ext_com_value_ospf_rt_area,
14188
16
        { "Area ID", "bgp.ext_com.value_ospf_rtype.area", FT_IPv4, BASE_NONE,
14189
16
          NULL, 0x0, "Original OSPF Area ID this route comes from", HFILL }},
14190
16
      { &hf_bgp_ext_com_value_ospf_rt_type,
14191
16
        { "Route type", "bgp.ext_com.value_ospf_rtype.type", FT_UINT8, BASE_DEC,
14192
16
          VALS(bgpext_com_ospf_rtype), 0x0, "Original OSPF LSA Type that carried this route", HFILL}},
14193
16
      { &hf_bgp_ext_com_value_ospf_rt_options,
14194
16
        { "Options", "bgp.ext_com.value_ospf_rtype.options", FT_UINT8, BASE_HEX,
14195
16
          NULL, 0x0, "OSPF Route Type Options bitfield", HFILL }},
14196
16
      { &hf_bgp_ext_com_value_ospf_rt_options_mt,
14197
16
        { "Metric type", "bgp.ext_com.value_ospf_rtype.options.mt", FT_BOOLEAN, 8,
14198
16
          TFS(&tfs_ospf_rt_mt), BGP_OSPF_RTYPE_METRIC_TYPE, "OSPF metric type (Type-1 or Type-2) of the original route", HFILL }},
14199
16
      { &hf_bgp_ext_com_value_ospf_rid,
14200
16
        { "Router ID", "bgp.ext_com.value_ospf_rid", FT_IPv4, BASE_NONE,
14201
16
          NULL, 0x0, "OSPF Router ID of the redistributing PE router", HFILL }},
14202
16
      { &hf_bgp_ext_com_value_fs_remark,
14203
16
        { "Remarking value", "bgp.ext_com.value_fs_dscp", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
14204
16
          &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
14205
16
      { &hf_bgp_ext_com_local_admin_flags,
14206
16
        { "Local Administrator", "bgp.ext_com.local_admin", FT_UINT8, BASE_HEX,
14207
16
          NULL, 0x0, NULL, HFILL }},
14208
16
      { &hf_bgp_ext_com_local_admin_auto_derived_flag,
14209
16
        { "A-Bit", "bgp.ext_com.local_admin.auto_derived", FT_BOOLEAN, 8,
14210
16
          TFS(&tfs_manually_auto_derived), 0x80, NULL, HFILL }},
14211
16
      { &hf_bgp_ext_com_local_admin_type,
14212
16
        { "Type", "bgp.ext_com.local_admin.type", FT_UINT8, BASE_DEC,
14213
16
          VALS(bgp_ext_com_local_admin_types), 0x70, NULL, HFILL }},
14214
16
      { &hf_bgp_ext_com_local_admin_domain_id,
14215
16
        { "Domain Id", "bgp.ext_com.local_admin.domain_id", FT_UINT8, BASE_DEC,
14216
16
          NULL, 0x0F, NULL, HFILL }},
14217
16
      { &hf_bgp_ext_com_local_admin_service_id,
14218
16
        { "Service Id", "bgp.ext_com.local_admin.service_id", FT_UINT24, BASE_DEC,
14219
16
          NULL, 0x00, NULL, HFILL }},
14220
16
      { &hf_bgp_ext_com_value_raw,
14221
16
        { "Raw Value", "bgp.ext_com.value_raw", FT_UINT48, BASE_HEX,
14222
16
          NULL, 0x0, "Raw value of the lowmost 6 octets of the Extended Community attribute", HFILL }},
14223
            /* BGP update extended community flow spec RFC 5575 */
14224
16
      { &hf_bgp_ext_com_flow_act_samp_act,
14225
16
        { "Sample", "bgp.ext_com_flow.sample", FT_BOOLEAN, 8,
14226
16
          TFS(&tfs_set_notset), BGP_EXT_COM_FSPEC_ACT_S, NULL, HFILL }},
14227
16
      { &hf_bgp_ext_com_flow_act_term_act,
14228
16
        { "Terminal action", "bgp.ext_com_flow.traff_act", FT_BOOLEAN, 8,
14229
16
          TFS(&tfs_set_notset),BGP_EXT_COM_FSPEC_ACT_T,NULL, HFILL}},
14230
16
      { &hf_bgp_ext_com_flow_rate_float,
14231
16
        { "Rate shaper", "bgp.ext_com_flow.rate_limit", FT_FLOAT, BASE_NONE,
14232
16
          NULL, 0x0, NULL, HFILL}},
14233
16
      { &hf_bgp_ext_com_flow_act_allset,
14234
16
        { "5 Bytes", "bgp.flowspec_ext_com.emptybytes", FT_BYTES, BASE_NONE,
14235
16
          NULL, 0x0, "Must be set to all 0", HFILL }},
14236
            /* BGP QoS propagation draft-knoll-idr-qos-attribute */
14237
16
      { &hf_bgp_ext_com_qos_flags,
14238
16
        { "Flags", "bgp.ext_com_qos.flags", FT_UINT8, BASE_HEX,
14239
16
          NULL, 0, NULL, HFILL}},
14240
16
      { &hf_bgp_ext_com_qos_flags_remarking,
14241
16
        { "Remarking", "bgp.ext_com_qos.flags.remarking", FT_BOOLEAN, 8,
14242
16
          TFS(&tfs_yes_no), 0x10, NULL, HFILL}},
14243
16
      { &hf_bgp_ext_com_qos_flags_ignore_remarking,
14244
16
        { "Ignore remarking", "bgp.ext_com_qos.flags.ignore_remarking", FT_BOOLEAN, 8,
14245
16
          TFS(&tfs_yes_no), 0x08, NULL, HFILL}},
14246
16
      { &hf_bgp_ext_com_qos_flags_agg_marking,
14247
16
        { "Aggregation of markings", "bgp.ext_com_qos.flags.agg_marking", FT_BOOLEAN, 8,
14248
16
          TFS(&tfs_yes_no), 0x04, NULL, HFILL}},
14249
16
      { &hf_bgp_ext_com_cos_flags,
14250
16
        { "Flags byte", "bgp.ext_com_cos.flags", FT_UINT8, BASE_HEX,
14251
16
          NULL, 0, NULL, HFILL}},
14252
16
      { &hf_bgp_ext_com_cos_flags_be,
14253
16
        { "BE class", "bgp.ext_com_cos.flags.be", FT_BOOLEAN, 8,
14254
16
          TFS(&tfs_supported_not_supported), 0x80, NULL, HFILL}},
14255
16
      { &hf_bgp_ext_com_cos_flags_ef,
14256
16
        { "EF class", "bgp.ext_com_cos.flags.ef", FT_BOOLEAN, 8,
14257
16
          TFS(&tfs_supported_not_supported), 0x40, NULL, HFILL}},
14258
16
      { &hf_bgp_ext_com_cos_flags_af,
14259
16
        { "AF class", "bgp.ext_com_cos.flags.af", FT_BOOLEAN, 8,
14260
16
          TFS(&tfs_supported_not_supported), 0x20, NULL, HFILL}},
14261
16
      { &hf_bgp_ext_com_cos_flags_le,
14262
16
        { "LE class", "bgp.ext_com_cos.flags.le", FT_BOOLEAN, 8,
14263
16
          TFS(&tfs_supported_not_supported), 0x10, NULL, HFILL}},
14264
16
      { &hf_bgp_ext_com_qos_set_number,
14265
16
        { "QoS Set Number", "bgp.ext_com_qos.set_number", FT_UINT8, BASE_HEX,
14266
16
          NULL, 0, NULL, HFILL}},
14267
16
      { &hf_bgp_ext_com_qos_tech_type,
14268
16
        { "Technology Type", "bgp.ext_com_qos.tech_type", FT_UINT8, BASE_HEX,
14269
16
          VALS(qos_tech_type), 0, NULL, HFILL}},
14270
16
      { &hf_bgp_ext_com_qos_marking_o,
14271
16
        { "QoS Marking O", "bgp.ext_com_qos.marking_o", FT_UINT16, BASE_HEX,
14272
16
          NULL, 0, NULL, HFILL}},
14273
16
      { &hf_bgp_ext_com_qos_marking_a,
14274
16
        { "QoS Marking A", "bgp.ext_com_qos.marking_a", FT_UINT8, BASE_HEX_DEC,
14275
16
          NULL, 0, NULL, HFILL}},
14276
16
      { &hf_bgp_ext_com_qos_default_to_zero,
14277
16
        { "Defaults to zero", "bgp.ext_com_qos.default_to_zero", FT_UINT8, BASE_HEX,
14278
16
          NULL, 0, NULL, HFILL}},
14279
      /* BGP L2 extended community RFC 4761, RFC 6624 */
14280
            /* draft-ietf-l2vpn-vpls-multihoming */
14281
16
      { &hf_bgp_ext_com_l2_encaps,
14282
16
        { "Encaps Type", "bgp.ext_com_l2.encaps_type", FT_UINT8, BASE_DEC,
14283
16
          VALS(bgp_l2vpn_encaps), 0, NULL, HFILL}},
14284
16
      { &hf_bgp_ext_com_l2_c_flags,
14285
16
        { "Control Flags", "bgp.ext_com_l2.c_flags", FT_UINT8, BASE_HEX,
14286
16
          NULL, 0x0, NULL, HFILL }},
14287
16
      { &hf_bgp_ext_com_l2_flag_d,
14288
16
        { "Down flag", "bgp.ext_com_l2.flag_d",FT_BOOLEAN, 8,
14289
16
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_D, NULL, HFILL }},
14290
16
      { &hf_bgp_ext_com_l2_flag_z1,
14291
16
        { "Unassigned", "bgp.ext_com_l2.flag_z1",FT_UINT8, BASE_DEC,
14292
16
          NULL, BGP_EXT_COM_L2_FLAG_Z1, "Must be Zero", HFILL }},
14293
16
      { &hf_bgp_ext_com_l2_flag_f,
14294
16
        { "Flush flag", "bgp.ext_com_l2.flag_f",FT_BOOLEAN, 8,
14295
16
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_F, NULL, HFILL }},
14296
16
      { &hf_bgp_ext_com_l2_flag_z345,
14297
16
        { "Unassigned", "bgp.ext_com_l2.flag_z345",FT_UINT8, BASE_DEC,
14298
16
          NULL, BGP_EXT_COM_L2_FLAG_Z345, "Must be Zero", HFILL }},
14299
16
      { &hf_bgp_ext_com_l2_flag_c,
14300
16
        { "C flag", "bgp.ext_com_l2.flag_c",FT_BOOLEAN, 8,
14301
16
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_C, NULL, HFILL }},
14302
16
      { &hf_bgp_ext_com_l2_flag_s,
14303
16
        { "S flag", "bgp.ext_com_l2.flag_s",FT_BOOLEAN, 8,
14304
16
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_S, NULL, HFILL }},
14305
16
      { &hf_bgp_ext_com_l2_mtu,
14306
16
        { "Layer-2 MTU", "bgp.ext_com_l2.l2_mtu", FT_UINT16, BASE_DEC,
14307
16
          NULL, 0x0, NULL, HFILL}},
14308
16
      { &hf_bgp_ext_com_l2_esi_label_flag,
14309
16
        { "Single active bit", "bgp.ext_com_l2.esi_label_flag",FT_BOOLEAN, 8,
14310
16
          TFS(&tfs_esi_label_flag), BGP_EXT_COM_ESI_LABEL_FLAGS, NULL, HFILL }},
14311
16
      { &hf_bgp_ext_com_etree_root_vlan,
14312
16
        { "Root VLAN", "bgp.ext_com_etree.root_vlan", FT_UINT16, BASE_DEC,
14313
16
          NULL, 0x0FFF, NULL, HFILL }},
14314
16
      { &hf_bgp_ext_com_etree_leaf_vlan,
14315
16
        { "Leaf VLAN", "bgp.ext_com_etree.leaf_vlan", FT_UINT16, BASE_DEC,
14316
16
          NULL, 0x0FFF, NULL, HFILL }},
14317
16
      { &hf_bgp_ext_com_etree_flags,
14318
16
        { "Flags", "bgp.ext_com_etree.flags", FT_UINT16, BASE_HEX,
14319
16
          NULL, 0x0, NULL, HFILL }},
14320
16
      { &hf_bgp_ext_com_etree_flag_reserved,
14321
16
        { "Reserved", "bgp.ext_com_etree.flag_reserved",FT_UINT16, BASE_HEX,
14322
16
          NULL, BGP_EXT_COM_ETREE_FLAG_RESERVED, NULL, HFILL }},
14323
16
      { &hf_bgp_ext_com_etree_flag_p,
14324
16
        { "P", "bgp.ext_com_etree.flag_p",FT_BOOLEAN, 16,
14325
16
          TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_P, "PE is attached with leaf nodes only", HFILL }},
14326
16
      { &hf_bgp_ext_com_etree_flag_v,
14327
16
        { "V", "bgp.ext_com_etree.flag_v",FT_BOOLEAN, 16,
14328
16
          TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_V, "VLAN mapping", HFILL }},
14329
16
      { &hf_bgp_ext_com_evpn_mmac_flag,
14330
16
        { "Flags", "bgp.ext_com_evpn.mmac.flags", FT_UINT8, BASE_HEX,
14331
16
          NULL, 0x0, "MAC Mobility flags", HFILL }},
14332
16
      { &hf_bgp_ext_com_evpn_mmac_flag_sticky,
14333
16
        { "Sticky/Static MAC", "bgp.ext_com_evpn.mmac.flags.sticky", FT_BOOLEAN, 8,
14334
16
          TFS(&tfs_yes_no), BGP_EXT_COM_EVPN_MMAC_STICKY, "Indicates whether the MAC address is fixed or movable", HFILL }},
14335
16
      { &hf_bgp_ext_com_evpn_mmac_seq,
14336
16
        { "Sequence number", "bgp.ext_com_evpn.mmac.seq", FT_UINT32, BASE_DEC,
14337
16
          NULL, 0x0, "MAC Mobility Update Sequence number", HFILL }},
14338
16
      { &hf_bgp_ext_com_evpn_esirt,
14339
16
        { "ES-Import Route Target", "bgp.ext_com_evpn.esi.rt", FT_ETHER, BASE_NONE,
14340
16
          NULL, 0x0, "Route Target as a MAC Address", HFILL }},
14341
16
      { &hf_bgp_ext_com_evpn_routermac,
14342
16
        { "Router's MAC", "bgp.ext_com_evpn.esi.router_mac", FT_ETHER, BASE_NONE,
14343
16
          NULL, 0x0, "Router's MAC Address", HFILL }},
14344
16
      { &hf_bgp_ext_com_evpn_l2attr_flags,
14345
16
        { "Flags", "bgp.ext_com_evpn.l2attr.flags", FT_UINT16, BASE_HEX,
14346
16
          NULL, 0x0, "EVPN L2 attribute flags", HFILL }},
14347
16
      { &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
14348
16
        { "Reserved", "bgp.ext_com_evpn.l2attr.flag_reserved", FT_UINT16, BASE_HEX,
14349
16
          NULL, BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED, NULL, HFILL }},
14350
16
      { &hf_bgp_ext_com_evpn_l2attr_flag_ci,
14351
16
        { "CI flag", "bgp.ext_com_evpn.l2attr.flag_ci", FT_BOOLEAN, 16,
14352
16
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI, "Control Word Indicator Extended Community can be advertised", HFILL }},
14353
16
      { &hf_bgp_ext_com_evpn_l2attr_flag_f,
14354
16
        { "F flag", "bgp.ext_com_evpn.l2attr.flag_f", FT_BOOLEAN, 16,
14355
16
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_F, "PE is capable to send and receive flow label", HFILL }},
14356
16
      { &hf_bgp_ext_com_evpn_l2attr_flag_c,
14357
16
        { "C flag", "bgp.ext_com_evpn.l2attr.flag_c", FT_BOOLEAN, 16,
14358
16
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_C, "Control word must be present when sending EVPN packets to this PE", HFILL }},
14359
16
      { &hf_bgp_ext_com_evpn_l2attr_flag_p,
14360
16
        { "P flag", "bgp.ext_com_evpn.l2attr.flag_p", FT_BOOLEAN, 16,
14361
16
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_P, "Primary PE", HFILL }},
14362
16
      { &hf_bgp_ext_com_evpn_l2attr_flag_b,
14363
16
        { "B flag", "bgp.ext_com_evpn.l2attr.flag_b", FT_BOOLEAN, 16,
14364
16
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_B, "Backup PE", HFILL }},
14365
16
      { &hf_bgp_ext_com_evpn_l2attr_l2_mtu,
14366
16
        { "L2 MTU", "bgp.ext_com_evpn.l2attr.l2_mtu", FT_UINT16, BASE_DEC,
14367
16
          NULL, 0x0, NULL, HFILL }},
14368
16
      { &hf_bgp_ext_com_evpn_l2attr_reserved,
14369
16
        { "Reserved", "bgp.ext_com_evpn.l2attr.reserved", FT_BYTES, BASE_NONE,
14370
16
          NULL, 0x0, NULL, HFILL }},
14371
16
      { &hf_bgp_ext_com_evpn_etree_flags,
14372
16
        { "Flags", "bgp.ext_com_evpn.etree.flags", FT_UINT8, BASE_HEX,
14373
16
          NULL, 0x0, "EVPN E-Tree attribute flags", HFILL }},
14374
16
      { &hf_bgp_ext_com_evpn_etree_flag_reserved,
14375
16
        { "Reserved", "bgp.ext_com_evpn.etree.flag_reserved", FT_UINT8, BASE_HEX,
14376
16
          NULL, BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED, NULL, HFILL }},
14377
16
      { &hf_bgp_ext_com_evpn_etree_flag_l,
14378
16
        { "L flag", "bgp.ext_com_evpn.etree.flag_l", FT_BOOLEAN, 8,
14379
16
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_ETREE_FLAG_L, "Leaf-Indication", HFILL }},
14380
16
      { &hf_bgp_ext_com_evpn_etree_reserved,
14381
16
        { "Reserved", "bgp.ext_com_evpn.etree.reserved", FT_BYTES, BASE_NONE,
14382
16
          NULL, 0x0, NULL, HFILL }},
14383
      /* BGP Cost Community */
14384
16
      { &hf_bgp_ext_com_cost_poi,
14385
16
        { "Point of insertion", "bgp.ext_com_cost.poi", FT_UINT8, BASE_DEC,
14386
16
          VALS(bgpext_com_cost_poi_type), 0x0, "Placement of the Cost value in the BGP Best Path algorithm", HFILL }},
14387
16
      { &hf_bgp_ext_com_cost_cid,
14388
16
        { "Community ID", "bgp.ext_com_cost.cid", FT_UINT8, BASE_DEC,
14389
16
          NULL, 0x0, "Community instance ID to distinguish between multiple Cost communities", HFILL }},
14390
16
      { &hf_bgp_ext_com_cost_cost,
14391
16
        { "Cost", "bgp.ext_com_cost.cost", FT_UINT32, BASE_DEC,
14392
16
          NULL, 0x0, "Cost value", HFILL }},
14393
16
      { &hf_bgp_ext_com_cost_cid_rep,
14394
16
        { "Cost use", "bgp.ext_com_cost.cid.use", FT_BOOLEAN, 8,
14395
16
          TFS(&tfs_cost_replace), BGP_EXT_COM_COST_CID_REP, "Indicates whether the Cost value will replace the original attribute value", HFILL }},
14396
      /* EIGRP Route Metrics Extended Communities */
14397
16
      { &hf_bgp_ext_com_stype_tr_exp_eigrp,
14398
16
        { "Route Attributes", "bgp.ext_com_eigrp", FT_UINT8, BASE_DEC,
14399
16
          VALS(bgpext_com_stype_tr_eigrp), 0x0, "Original EIGRP route attributes", HFILL }},
14400
16
      { &hf_bgp_ext_com_eigrp_flags,
14401
16
        { "Route flags", "bgp.ext_com_eigrp.flags", FT_UINT16, BASE_HEX,
14402
16
          NULL, 0x0, "EIGRP Route flags bitfield", HFILL }},
14403
16
      { &hf_bgp_ext_com_eigrp_flags_rt,
14404
16
        { "Route type", "bgp.ext_com_eigrp.flags.rt", FT_BOOLEAN, 16,
14405
16
          TFS(&tfs_eigrp_rtype), BGP_EXT_COM_EXP_EIGRP_FLAG_RT, "Original EIGRP route type (internal/external)", HFILL }},
14406
16
      { &hf_bgp_ext_com_eigrp_rtag,
14407
16
        { "Route tag", "bgp.ext_com_eigrp.rtag", FT_UINT32, BASE_DEC,
14408
16
          NULL, 0x0, "Original EIGRP route tag", HFILL }},
14409
16
      { &hf_bgp_ext_com_eigrp_asn,
14410
16
        { "AS Number", "bgp.ext_com_eigrp.asn", FT_UINT16, BASE_DEC,
14411
16
          NULL, 0x0, "Original EIGRP Autonomous System Number this route comes from", HFILL }},
14412
16
      { &hf_bgp_ext_com_eigrp_delay,
14413
16
        { "Delay", "bgp.ext_com_eigrp.dly", FT_UINT32, BASE_DEC,
14414
16
          NULL, 0x0, "Original EIGRP route delay metric", HFILL }},
14415
16
      { &hf_bgp_ext_com_eigrp_rly,
14416
16
        { "Reliability", "bgp.ext_com_eigrp.rly", FT_UINT8, BASE_DEC,
14417
16
          NULL, 0x0, "Original EIGRP route reliability metric", HFILL }},
14418
16
      { &hf_bgp_ext_com_eigrp_hops,
14419
16
        { "Hop count", "bgp.ext_com_eigrp.hops", FT_UINT8, BASE_DEC,
14420
16
          NULL, 0x0, "Original EIGRP route hop count", HFILL }},
14421
16
      { &hf_bgp_ext_com_eigrp_bw,
14422
16
        { "Bandwidth", "bgp.ext_com_eigrp.bw", FT_UINT32, BASE_DEC,
14423
16
          NULL, 0x0, "Original EIGRP route bandwidth metric", HFILL }},
14424
16
      { &hf_bgp_ext_com_eigrp_load,
14425
16
        { "Load", "bgp.ext_com_eigrp.load", FT_UINT8, BASE_DEC,
14426
16
          NULL, 0x0, "Original EIGRP route load metric", HFILL }},
14427
16
      { &hf_bgp_ext_com_eigrp_mtu,
14428
16
        { "MTU", "bgp.ext_com_eigrp.mtu", FT_UINT32, BASE_DEC,
14429
16
          NULL, 0x0, "Original EIGRP route path MTU", HFILL }},
14430
16
      { &hf_bgp_ext_com_eigrp_rid,
14431
16
        { "Router ID", "bgp.ext_com_eigrp.rid", FT_IPv4, BASE_NONE,
14432
16
          NULL, 0x0, "EIGRP Router ID of the router that originated the route", HFILL }},
14433
16
      { &hf_bgp_ext_com_eigrp_e_asn,
14434
16
        { "External AS Number", "bgp.ext_com_eigrp.e_asn", FT_UINT16, BASE_DEC,
14435
16
          NULL, 0x0, "Original AS Number of the route before its redistribution into EIGRP", HFILL }},
14436
16
      { &hf_bgp_ext_com_eigrp_e_rid,
14437
16
        { "External Router ID", "bgp.ext_com_eigrp.e_rid", FT_IPv4, BASE_NONE,
14438
16
          NULL, 0x0, "EIGRP Router ID of the router that redistributed this route into EIGRP", HFILL }},
14439
16
      { &hf_bgp_ext_com_eigrp_e_pid,
14440
16
        { "External protocol", "bgp.ext_com_eigrp.e_pid", FT_UINT16, BASE_DEC,
14441
16
          VALS(eigrp_proto2string), 0x0, "Original routing protocol from which this route was redistributed into EIGRP", HFILL }},
14442
16
      { &hf_bgp_ext_com_eigrp_e_m,
14443
16
        { "External metric", "bgp.ext_com_eigrp.e_metric", FT_UINT32, BASE_DEC,
14444
16
          NULL, 0x0, "Original metric of the route before its redistribution into EIGRP", HFILL }},
14445
14446
      /* idr-ls-03 */
14447
16
      { &hf_bgp_ls_type,
14448
16
        { "Type", "bgp.ls.type", FT_UINT16, BASE_DEC,
14449
16
          NULL, 0x0, "BGP-LS message type", HFILL }},
14450
16
      { &hf_bgp_ls_length,
14451
16
        { "Length", "bgp.ls.length", FT_UINT16, BASE_DEC,
14452
16
          NULL, 0x0, "The total length of the message payload in octets", HFILL }},
14453
16
      { &hf_bgp_ls_nlri,
14454
16
        { "BGP-LS NLRI", "bgp.ls.nlri", FT_NONE,
14455
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14456
16
      { &hf_bgp_ls_safi128_nlri,
14457
16
        { "Link State SAFI 128 NLRI", "bgp.ls.nlri_safi128", FT_NONE,
14458
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14459
16
      { &hf_bgp_ls_safi128_nlri_route_distinguisher,
14460
16
        { "Route Distinguisher", "bgp.ls.nlri_safi128_route_distinguisher", FT_NONE,
14461
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14462
16
      { &hf_bgp_ls_safi128_nlri_route_distinguisher_type,
14463
16
        { "Route Distinguisher Type", "bgp.ls.nlri_safi128_route_distinguisher_type", FT_UINT16,
14464
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14465
16
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
14466
16
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_2", FT_UINT16,
14467
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14468
16
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
14469
16
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_ipv4", FT_IPv4,
14470
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14471
16
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
14472
16
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_4", FT_UINT32,
14473
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14474
16
      { &hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
14475
16
        { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_2", FT_UINT16,
14476
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14477
16
      { &hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
14478
16
        { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_4", FT_UINT32,
14479
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14480
16
      { &hf_bgp_ls_nlri_type,
14481
16
        { "NLRI Type", "bgp.ls.nlri_type", FT_UINT16,
14482
16
          BASE_DEC, VALS(bgp_ls_nlri_type_vals), 0x0, NULL, HFILL}},
14483
16
      { &hf_bgp_ls_nlri_length,
14484
16
        { "NLRI Length", "bgp.ls.nlri_length", FT_UINT16,
14485
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14486
16
      { &hf_bgp_ls_nlri_link_nlri_type,
14487
16
        { "Link-State NLRI Link NLRI", "bgp.ls.nlri_link", FT_NONE,
14488
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14489
16
      { &hf_bgp_ls_nlri_link_descriptors_tlv,
14490
16
        { "Link Descriptors TLV", "bgp.ls.nlri_link_descriptors_tlv", FT_NONE,
14491
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14492
16
      { &hf_bgp_ls_nlri_prefix_descriptors_tlv,
14493
16
        { "Prefix Descriptors TLV", "bgp.ls.nlri_prefix_descriptors_tlv", FT_NONE,
14494
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14495
16
      { &hf_bgp_ls_nlri_srv6_sid_descriptors_tlv,
14496
16
        { "SRv6 SID Descriptors TLV", "bgp.ls.nlri_srv6_sid_descriptors_tlv", FT_NONE,
14497
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14498
16
      { &hf_bgp_ls_nlri_link_local_identifier,
14499
16
        { "Link Local Identifier", "bgp.ls.nlri_link_local_identifier", FT_UINT32,
14500
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14501
16
      { &hf_bgp_ls_nlri_link_remote_identifier,
14502
16
        { "Link Remote Identifier", "bgp.ls.nlri_link_remote_identifier", FT_UINT32,
14503
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14504
16
      { &hf_bgp_ls_nlri_ipv4_interface_address,
14505
16
        { "IPv4 Interface Address", "bgp.ls.nlri_ipv4_interface_address", FT_IPv4,
14506
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14507
16
      { &hf_bgp_ls_nlri_ipv4_neighbor_address,
14508
16
        { "IPv4 Neighbor Address", "bgp.ls.nlri_ipv4_neighbor_address", FT_IPv4,
14509
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14510
16
      { &hf_bgp_ls_nlri_ipv6_interface_address,
14511
16
        { "IPv6 Interface Address", "bgp.ls.nlri_ipv6_interface_address", FT_IPv6,
14512
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14513
16
      { &hf_bgp_ls_nlri_ipv6_neighbor_address,
14514
16
        { "IPv6 Neighbor Address", "bgp.ls.nlri_ipv6_neighbor_address", FT_IPv6,
14515
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14516
16
      { &hf_bgp_ls_nlri_multi_topology_id,
14517
16
        { "Multi Topology ID", "bgp.ls.nlri_multi_topology_id", FT_UINT16,
14518
16
          BASE_DEC_HEX, NULL, 0x0fff, NULL, HFILL}},
14519
16
      { &hf_bgp_ls_nlri_ospf_route_type,
14520
16
        { "OSPF Route Type", "bgp.ls.nlri_ospf_route_type", FT_UINT8,
14521
16
          BASE_DEC, VALS(link_state_prefix_descriptors_ospf_route_type), 0x0, NULL, HFILL}},
14522
16
      { &hf_bgp_ls_nlri_ip_reachability_prefix_ip,
14523
16
       { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip", FT_IPv4,
14524
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14525
16
      { &hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
14526
16
       { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip6", FT_IPv6,
14527
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14528
16
      { &hf_bgp_ls_nlri_node_nlri_type,
14529
16
        { "Link-State NLRI Node NLRI", "bgp.ls.nlri_node", FT_NONE,
14530
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14531
16
      { &hf_bgp_ls_nlri_node_protocol_id,
14532
16
        { "Protocol ID", "bgp.ls.nlri_node.protocol_id", FT_UINT8,
14533
16
          BASE_DEC, VALS(link_state_nlri_protocol_id_values), 0x0, NULL, HFILL }},
14534
16
      { &hf_bgp_ls_nlri_node_identifier,
14535
16
        { "Identifier", "bgp.ls.nlri_node.identifier", FT_UINT64,
14536
16
          BASE_DEC | BASE_VAL64_STRING, VALS64(link_state_nlri_routing_universe_values), 0x0, NULL, HFILL }},
14537
16
      { &hf_bgp_ls_ipv4_topology_prefix_nlri_type,
14538
16
        { "Link-State NLRI IPv4 Topology Prefix", "bgp.ls.ipv4_topology_prefix", FT_NONE,
14539
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14540
16
      { &hf_bgp_ls_ipv6_topology_prefix_nlri_type,
14541
16
        { "Link-State NLRI IPv6 Topology Prefix", "bgp.ls.ipv6_topology_prefix", FT_NONE,
14542
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14543
16
      { &hf_bgp_ls_nlri_srv6_sid_nlri_type,
14544
16
        { "Link-State NLRI SRv6 SID NLRI", "bgp.ls.nlri_srv6_sid", FT_NONE,
14545
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14546
       /* NLRI TLVs */
14547
16
      { &hf_bgp_ls_tlv_local_node_descriptors,
14548
16
        { "Local Node Descriptors TLV", "bgp.ls.tlv.local_node_descriptors", FT_NONE,
14549
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14550
16
      { &hf_bgp_ls_tlv_remote_node_descriptors,
14551
16
        { "Remote Node Descriptors TLV", "bgp.ls.tlv.remote_node_descriptors", FT_NONE,
14552
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14553
16
      { &hf_bgp_ls_tlv_autonomous_system,
14554
16
        { "Autonomous System TLV", "bgp.ls.tlv.autonomous_system", FT_NONE,
14555
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14556
16
      { &hf_bgp_ls_tlv_autonomous_system_id,
14557
16
        { "AS ID", "bgp.ls.tlv.autonomous_system.id", FT_UINT32,
14558
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
14559
16
      { &hf_bgp_ls_tlv_bgp_ls_identifier,
14560
16
        { "BGP-LS Identifier TLV", "bgp.ls.tlv.bgp_ls_identifier", FT_NONE,
14561
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14562
16
      { &hf_bgp_ls_tlv_bgp_ls_identifier_id,
14563
16
        { "BGP-LS ID", "bgp.ls.tlv.bgp_ls_identifier_id", FT_UINT32,
14564
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
14565
16
      { &hf_bgp_ls_tlv_area_id,
14566
16
        { "Area ID TLV", "bgp.ls.tlv.area_id", FT_NONE,
14567
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14568
16
      { &hf_bgp_ls_tlv_area_id_id,
14569
16
        { "Area ID", "bgp.ls.tlv.area_id.id", FT_UINT32,
14570
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
14571
16
      { &hf_bgp_ls_tlv_ipv4_router_id_of_local_node,
14572
16
        { "IPv4 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv4_router_id_of_local_node", FT_NONE,
14573
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14574
16
      { &hf_bgp_ls_tlv_ipv4_router_id_value,
14575
16
        { "IPv4 Router-ID", "bgp.ls.tlv.ipv4_router_id_value", FT_IPv4,
14576
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14577
16
      { &hf_bgp_ls_tlv_ipv6_router_id_of_local_node,
14578
16
        { "IPv6 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv6_router_id_of_local_node", FT_NONE,
14579
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14580
16
      { &hf_bgp_ls_tlv_ipv6_router_id_value,
14581
16
        { "IPv6 Router-ID", "bgp.ls.tlv.ipv6_router_id_value", FT_IPv6,
14582
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14583
16
      { &hf_bgp_ls_tlv_ipv4_router_id_of_remote_node,
14584
16
        { "IPv4 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv4_router_id_of_remote_node", FT_NONE,
14585
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14586
16
      { &hf_bgp_ls_tlv_ipv6_router_id_of_remote_node,
14587
16
        { "IPv6 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv6_router_id_of_remote_node", FT_NONE,
14588
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14589
16
      { &hf_bgp_ls_tlv_link_local_remote_identifiers,
14590
16
        { "Link Local/Remote Identifiers TLV", "bgp.ls.tlv.link_local_remote_identifiers", FT_NONE,
14591
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14592
16
      { &hf_bgp_ls_tlv_ipv4_interface_address,
14593
16
        {  "IPv4 interface address TLV", "bgp.ls.tlv.ipv4_interface_address", FT_NONE,
14594
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14595
16
      { &hf_bgp_ls_tlv_ipv4_neighbor_address,
14596
16
        { "IPv4 neighbor address TLV", "bgp.ls.tlv.ipv4_neighbor_address", FT_NONE,
14597
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14598
16
      { &hf_bgp_ls_tlv_ipv6_interface_address,
14599
16
        { "IPv6 interface address TLV", "bgp.ls.tlv.ipv6_interface_address", FT_NONE,
14600
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14601
16
      { &hf_bgp_ls_tlv_ipv6_neighbor_address,
14602
16
        { "IPv6 neighbor address TLV", "bgp.ls.tlv.ipv6_neighbor_address", FT_NONE,
14603
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14604
16
      { &hf_bgp_ls_tlv_node_msd,
14605
16
        { "Node MSD TLV", "bgp.ls.tlv.node_msd", FT_NONE,
14606
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14607
16
      { &hf_bgp_ls_tlv_link_msd,
14608
16
        { "Link MSD TLV", "bgp.ls.tlv.link_msd", FT_NONE,
14609
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14610
16
      { &hf_bgp_ls_tlv_igp_msd_type,
14611
16
        { "MSD Type", "bgp.ls.tlv.igp_msd_type", FT_UINT8,
14612
16
          BASE_DEC, VALS(igp_msd_types), 0x0, NULL, HFILL }},
14613
16
      { &hf_bgp_ls_tlv_igp_msd_value,
14614
16
        { "MSD Value", "bgp.ls.tlv.igp_msd_value", FT_UINT8,
14615
16
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
14616
16
      { &hf_bgp_ls_tlv_multi_topology_id,
14617
16
        { "Multi Topology ID TLV", "bgp.ls.tlv.multi_topology_id", FT_NONE,
14618
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14619
16
      { &hf_bgp_ls_tlv_ospf_route_type,
14620
16
        { "OSPF Route Type TLV", "bgp.ls.tlv.ospf_route_type", FT_NONE,
14621
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14622
16
      { &hf_bgp_ls_tlv_ip_reachability_information,
14623
16
        { "IP Reachability Information TLV", "bgp.ls.tlv.ip_reachability_information", FT_NONE,
14624
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14625
16
      { &hf_bgp_ls_tlv_administrative_group_color,
14626
16
        { "Administrative group (color) TLV", "bgp.ls.tlv.administrative_group_color", FT_NONE,
14627
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14628
16
      { &hf_bgp_ls_tlv_administrative_group_color_value,
14629
16
        { "Group Mask", "bgp.ls.tlv.administrative_group_color_value", FT_UINT32,
14630
16
         BASE_DEC, NULL, 0xffff, NULL, HFILL}},
14631
16
      { &hf_bgp_ls_tlv_administrative_group,
14632
16
        { "Group", "bgp.ls.tlv.administrative_group", FT_UINT32,
14633
16
         BASE_DEC, NULL, 0xffff, NULL, HFILL}},
14634
16
      { &hf_bgp_ls_tlv_max_link_bandwidth,
14635
16
        { "Maximum link bandwidth TLV", "bgp.ls.tlv.maximum_link_bandwidth", FT_NONE,
14636
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14637
16
      { &hf_bgp_ls_tlv_max_reservable_link_bandwidth,
14638
16
        { "Maximum reservable link bandwidth TLV", "bgp.ls.tlv.maximum_reservable_link_bandwidth", FT_NONE,
14639
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14640
16
      { &hf_bgp_ls_tlv_unreserved_bandwidth,
14641
16
        { "Unreserved bandwidth TLV", "bgp.ls.tlv.unreserved_bandwidth", FT_NONE,
14642
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14643
16
      { &hf_bgp_ls_bandwidth_value,
14644
16
        {"Bandwidth", "bgp.ls.bandwidth_value", FT_FLOAT,
14645
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14646
16
      { &hf_bgp_ls_tlv_te_default_metric,
14647
16
        { "TE Default Metric TLV", "bgp.ls.tlv.te_default_metric", FT_NONE,
14648
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14649
16
      { &hf_bgp_ls_tlv_te_default_metric_value_old,
14650
16
        { "TE Default Metric (old format)", "bgp.ls.tlv.te_default_metric_value.old", FT_UINT24,
14651
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
14652
16
      { &hf_bgp_ls_tlv_te_default_metric_value,
14653
16
        { "TE Default Metric", "bgp.ls.tlv.te_default_metric_value", FT_UINT32,
14654
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
14655
16
      { &hf_bgp_ls_tlv_link_protection_type,
14656
16
        { "Link Protection Type TLV", "bgp.ls.tlv.link_protection_type", FT_NONE,
14657
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14658
16
      { &hf_bgp_ls_tlv_link_protection_type_value,
14659
16
        { "Protection Capabilities", "bgp.ls.tlv.link_protection_type_value", FT_UINT8,
14660
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14661
16
      { &hf_bgp_ls_tlv_mpls_protocol_mask,
14662
16
        { "MPLS Protocol Mask TLV", "bgp.ls.tlv.mpls_protocol_mask", FT_NONE,
14663
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14664
16
      { &hf_bgp_ls_tlv_metric,
14665
16
        { "Metric TLV", "bgp.ls.tlv.metric", FT_NONE,
14666
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14667
16
      { &hf_bgp_ls_tlv_metric_value1,
14668
16
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT8,
14669
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14670
16
      { &hf_bgp_ls_tlv_metric_value2,
14671
16
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT16,
14672
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14673
16
      { &hf_bgp_ls_tlv_metric_value3,
14674
16
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT24,
14675
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14676
16
      { &hf_bgp_ls_tlv_shared_risk_link_group,
14677
16
        { "Shared Risk Link Group TLV", "bgp.ls.tlv.shared_risk_link_group", FT_NONE,
14678
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14679
16
      { &hf_bgp_ls_tlv_shared_risk_link_group_value,
14680
16
        { "Shared Risk Link Group Value", "bgp.ls.tlv.shared_risk_link_group_value", FT_UINT32,
14681
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14682
16
      { &hf_bgp_ls_tlv_opaque_link_attribute,
14683
16
        { "Opaque Link Attribute TLV", "bgp.ls.tlv.opaque_link_attribute", FT_NONE,
14684
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14685
16
      { &hf_bgp_ls_tlv_opaque_link_attribute_value,
14686
16
        { "Opaque link attributes", "bgp.ls.tlv.opaque_link_attribute_value", FT_NONE,
14687
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14688
16
      { &hf_bgp_ls_tlv_link_name_attribute,
14689
16
        { "Opaque Link Attribute TLV", "bgp.ls.tlv.link_name_attribute", FT_NONE,
14690
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14691
16
      { &hf_bgp_ls_tlv_link_name_attribute_value,
14692
16
        {"Link Name", "bgp.ls.tlv.link_name_attribute_value", FT_STRING,
14693
16
          BASE_NONE, NULL, 0, NULL, HFILL }},
14694
16
      { &hf_bgp_ls_tlv_igp_flags,
14695
16
        { "IGP Flags TLV", "bgp.ls.tlv.igp_flags", FT_NONE,
14696
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14697
16
      { &hf_bgp_ls_tlv_route_tag,
14698
16
        { "Route Tag TLV", "bgp.ls.tlv.route_tag", FT_NONE,
14699
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14700
16
      { &hf_bgp_ls_tlv_route_tag_value,
14701
16
        { "Route Tag Value", "bgp.ls.tlv.route_tag_value", FT_UINT32,
14702
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14703
16
      { &hf_bgp_ls_tlv_route_extended_tag,
14704
16
        { "Extended Route Tag TLV", "bgp.ls.tlv.route_extended_tag", FT_NONE,
14705
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14706
16
      { &hf_bgp_ls_tlv_route_extended_tag_value,
14707
16
        {"Extended Route Tag", "bgp.ls.tlv.extended_route_tag_value", FT_UINT64,
14708
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14709
16
      { &hf_bgp_ls_tlv_prefix_metric,
14710
16
        { "Prefix Metric TLV", "bgp.ls.tlv.prefix_metric", FT_NONE,
14711
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14712
16
      { &hf_bgp_ls_tlv_prefix_metric_value,
14713
16
        { "Prefix Metric", "bgp.ls.tlv.prefix_metric_value", FT_UINT32,
14714
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14715
16
      { &hf_bgp_ls_ospf_forwarding_address,
14716
16
        { "OSPF Forwarding Address TLV", "bgp.ls.tlv.ospf_forwarding_address", FT_NONE,
14717
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14718
16
      { &hf_bgp_ls_ospf_forwarding_address_ipv4_address,
14719
16
        { "OSPF forwarding IPv4 address", "bgp.ls.tlv.ospf_forwarding_address_ipv4", FT_IPv4,
14720
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14721
16
      { &hf_bgp_ls_ospf_forwarding_address_ipv6_address,
14722
16
        { "OSPF forwarding IPv6 address", "bgp.ls.tlv.ospf_forwarding_address_ipv6", FT_IPv6,
14723
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14724
16
      { &hf_bgp_ls_opaque_prefix_attribute,
14725
16
        { "Opaque Prefix Attribute TLV", "bgp.ls.tlv.opaque_prefix_attribute", FT_NONE,
14726
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14727
16
      { &hf_bgp_ls_opaque_prefix_attribute_value,
14728
16
        { "Opaque prefix attributes", "bgp.ls.tlv.opaque_prefix_attribute_value", FT_NONE,
14729
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14730
16
      { &hf_bgp_ls_extended_administrative_group,
14731
16
        { "Extended Administrative Group TLV", "bgp.ls.tlv.extended_administrative_group", FT_NONE,
14732
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14733
16
      { &hf_bgp_ls_extended_administrative_group_value,
14734
16
        { "Extended Administrative Group", "bgp.ls.tlv.extended_administrative_group_value", FT_BYTES,
14735
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14736
16
      { &hf_bgp_ls_tlv_igp_router,
14737
16
        { "IGP Router-ID", "bgp.ls.tlv.igp_router", FT_NONE,
14738
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14739
16
      { &hf_bgp_ls_tlv_igp_router_id,
14740
16
        { "IGP ID", "bgp.ls.tlv.igp_router_id", FT_BYTES,
14741
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14742
16
      { &hf_bgp_ls_tlv_bgp_router_id,
14743
16
        { "BGP Router-ID TLV", "bgp.ls.tlv.bgp_router_id", FT_NONE,
14744
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14745
16
      { &hf_bgp_ls_tlv_bgp_router_id_id,
14746
16
        { "BGP Router-ID", "bgp.ls.tlv.bgp_router_id.id", FT_IPv4,
14747
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14748
16
      { &hf_bgp_ls_tlv_bgp_confederation_member,
14749
16
        { "BGP Confederation Member TLV", "bgp.ls.tlv.confederation_member", FT_NONE,
14750
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14751
16
      { &hf_bgp_ls_tlv_bgp_confederation_member_as,
14752
16
        { "BGP Confederation Member AS", "bgp.ls.tlv.confederation_member.as", FT_UINT32,
14753
16
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
14754
16
      { &hf_bgp_ls_tlv_srv6_sid_info,
14755
16
        { "SRv6 SID Information TLV", "bgp.ls.tlv.srv6_sid_info", FT_NONE,
14756
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14757
16
      { &hf_bgp_ls_tlv_srv6_sid_info_sid,
14758
16
        { "SID", "bgp.ls.tlv.srv6_sid_info.sid", FT_IPv6,
14759
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14760
16
      { &hf_bgp_ls_tlv_node_flags_bits,
14761
16
        { "Node Flags Bits TLV", "bgp.ls.tlv.node_flags_bits", FT_NONE,
14762
16
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14763
16
      { &hf_bgp_ls_tlv_opaque_node_properties,
14764
16
        { "Opaque Node Properties TLV", "bgp.ls.tlv.opaque_node_properties", FT_NONE,
14765
16
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14766
16
      { &hf_bgp_ls_tlv_opaque_node_properties_value,
14767
16
        { "Opaque Node Properties", "bgp.ls.tlv.opaque_node_properties_value", FT_NONE,
14768
16
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14769
16
      { &hf_bgp_ls_tlv_node_name,
14770
16
        { "Node Name TLV", "bgp.ls.tlv.node_name", FT_NONE,
14771
16
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14772
16
      { &hf_bgp_ls_tlv_node_name_value,
14773
16
        {"Node name", "bgp.ls.tlv.node_name_value", FT_STRING,
14774
16
         BASE_NONE, NULL, 0, NULL, HFILL }},
14775
16
      { &hf_bgp_ls_tlv_is_is_area_identifier,
14776
16
        { "IS-IS Area Identifier TLV", "bgp.ls.tlv.is_is_area_identifier", FT_NONE,
14777
16
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14778
16
      { &hf_bgp_ls_tlv_is_is_area_identifier_value,
14779
16
        { "IS-IS Area Identifier", "bgp.ls.tlv.is_is_area_identifier_value", FT_BYTES,
14780
16
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
14781
      /* Link Protection Types */
14782
16
      { &hf_bgp_ls_link_protection_type_enhanced,
14783
16
        { "Enhanced", "bgp.ls.link_protection_type.enhanced", FT_BOOLEAN, 8,
14784
16
          TFS(&tfs_capable_not_capable), 0x20, NULL, HFILL }},
14785
16
      { &hf_bgp_ls_link_protection_type_dedicated_1plus1,
14786
16
        { "Dedicated 1+1", "bgp.ls.link_protection_type.dedicated_1plus1", FT_BOOLEAN, 8,
14787
16
          TFS(&tfs_capable_not_capable), 0x10, NULL, HFILL }},
14788
16
      { &hf_bgp_ls_link_protection_type_dedicated_1to1,
14789
16
        { "Dedicated 1:1", "bgp.ls.link_protection_type.dedicated_1colon1", FT_BOOLEAN, 8,
14790
16
          TFS(&tfs_capable_not_capable), 0x08, NULL, HFILL }},
14791
16
      { &hf_bgp_ls_link_protection_type_shared,
14792
16
        { "Shared", "bgp.ls.link_protection_type.shared", FT_BOOLEAN, 8,
14793
16
          TFS(&tfs_capable_not_capable), 0x04, NULL, HFILL }},
14794
16
      { &hf_bgp_ls_link_protection_type_unprotected,
14795
16
        { "Unprotected", "bgp.ls.link_protection_type.unprotected", FT_BOOLEAN, 8,
14796
16
          TFS(&tfs_capable_not_capable), 0x02, NULL, HFILL }},
14797
16
      { &hf_bgp_ls_link_protection_type_extra_traffic,
14798
16
        { "Extra Traffic", "bgp.ls.link_protection_type.extra_traffic", FT_BOOLEAN, 8,
14799
16
          TFS(&tfs_capable_not_capable), 0x01, NULL, HFILL }},
14800
      /* MPLS Protocol Mask flags */
14801
16
      { &hf_bgp_ls_mpls_protocol_mask_flag_l,
14802
16
        { "Label Distribution Protocol (LDP)", "bgp.ls.protocol_mask_tlv.mpls_protocol.l", FT_BOOLEAN, 8,
14803
16
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
14804
16
      { &hf_bgp_ls_mpls_protocol_mask_flag_r,
14805
16
        { "Extension to RSVP for LSP Tunnels (RSVP-TE)", "bgp.ls.protocol_mask_tlv.mpls_protocol.r", FT_BOOLEAN, 8,
14806
16
          TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
14807
      /* IGP Flags TLV */
14808
16
      { &hf_bgp_ls_igp_flags_flag_d,
14809
16
        { "IS-IS Up/Down Bit", "bgp.ls.protocol_mask_tlv.igp_flags_flag_d.d", FT_BOOLEAN, 8,
14810
16
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
14811
      /* Node Flag Bits TLV flags */
14812
16
      { &hf_bgp_ls_node_flag_bits_overload,
14813
16
        { "Overload Bit", "bgp.ls.node_flag_bits.overload", FT_BOOLEAN, 8,
14814
16
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
14815
16
      { &hf_bgp_ls_node_flag_bits_attached,
14816
16
        { "Attached Bit", "bgp.ls.node_flag_bits.attached", FT_BOOLEAN, 8,
14817
16
          TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
14818
16
      { &hf_bgp_ls_node_flag_bits_external,
14819
16
        { "External Bit", "bgp.ls.node_flag_bits.external", FT_BOOLEAN, 8,
14820
16
          TFS(&tfs_set_notset), 0x20, NULL, HFILL}},
14821
16
      { &hf_bgp_ls_node_flag_bits_abr,
14822
16
        { "ABR Bit", "bgp.ls.node_flag_bits.abr", FT_BOOLEAN, 8,
14823
16
          TFS(&tfs_set_notset), 0x10, NULL, HFILL}},
14824
16
      { &hf_bgp_evpn_nlri,
14825
16
        { "EVPN NLRI", "bgp.evpn.nlri", FT_NONE,
14826
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14827
16
      { &hf_bgp_evpn_nlri_rt,
14828
16
        { "Route Type", "bgp.evpn.nlri.rt", FT_UINT8, BASE_DEC,
14829
16
          VALS(evpnrtypevals), 0x0, NULL, HFILL }},
14830
16
      { &hf_bgp_evpn_nlri_len,
14831
16
        { "Length", "bgp.evpn.nlri.len", FT_UINT8,
14832
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14833
16
      { &hf_bgp_evpn_nlri_rd,
14834
16
        { "Route Distinguisher", "bgp.evpn.nlri.rd", FT_BYTES,
14835
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14836
16
      { &hf_bgp_evpn_nlri_esi,
14837
16
        { "ESI", "bgp.evpn.nlri.esi", FT_BYTES,
14838
16
          SEP_COLON, NULL, 0x0, NULL, HFILL }},
14839
16
      { &hf_bgp_evpn_nlri_esi_type,
14840
16
        { "ESI Type", "bgp.evpn.nlri.esi.type", FT_UINT8,
14841
16
          BASE_DEC, VALS(evpn_nlri_esi_type), 0x0, "EVPN ESI type", HFILL }},
14842
16
      { &hf_bgp_evpn_nlri_esi_lacp_mac,
14843
16
        { "CE LACP system MAC", "bgp.evpn.nlri.esi.lacp_mac", FT_ETHER,
14844
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14845
16
      { &hf_bgp_evpn_nlri_esi_portk,
14846
16
        { "LACP port key", "bgp.evpn.nlri.esi.lacp_portkey", FT_UINT16,
14847
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
14848
16
      { &hf_bgp_evpn_nlri_esi_remain,
14849
16
        { "Remaining bytes", "bgp.evpn.nlri.esi.remaining", FT_BYTES,
14850
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14851
16
      { &hf_bgp_evpn_nlri_esi_reserved,
14852
16
        { "Reserved value all 0xff", "bgp.evpn.nlri.esi.reserved", FT_BYTES,
14853
16
         BASE_NONE, NULL, 0x0, NULL, HFILL }},
14854
16
      { &hf_bgp_evpn_nlri_esi_value,
14855
16
        { "ESI Value", "bgp.evpn.nlri.esi.value", FT_BYTES,
14856
16
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14857
16
      { &hf_bgp_evpn_nlri_esi_value_type0,
14858
16
        { "ESI 9 bytes value", "bgp.evpn.nlri.esi.type0", FT_BYTES,
14859
16
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14860
16
      { &hf_bgp_evpn_nlri_esi_rb_mac,
14861
16
        { "ESI root bridge MAC", "bgp.evpn.nlri.esi.root_bridge", FT_ETHER,
14862
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14863
16
      { &hf_bgp_evpn_nlri_esi_rbprio,
14864
16
        { "ESI root bridge priority", "bgp.evpn.nlri.esi.rb_prio", FT_UINT16,
14865
16
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
14866
16
      { &hf_bgp_evpn_nlri_esi_sys_mac,
14867
16
        { "ESI system MAC", "bgp.evpn.nlri.esi.system_mac", FT_ETHER,
14868
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14869
16
      { &hf_bgp_evpn_nlri_esi_mac_discr,
14870
16
        { "ESI system mac discriminator", "bgp.evpn.nlri.esi.system_mac_discr", FT_BYTES,
14871
16
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14872
16
      { &hf_bgp_evpn_nlri_esi_router_id,
14873
16
        { "ESI router ID", "bgp.evpn.nlri.esi.router_id", FT_IPv4,
14874
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14875
16
      { &hf_bgp_evpn_nlri_esi_router_discr,
14876
16
        { "ESI router discriminator", "bgp.evpn.nlri.esi.router_discr", FT_BYTES,
14877
16
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14878
16
      { &hf_bgp_evpn_nlri_esi_asn,
14879
16
        { "ESI ASN", "bgp.evpn.nlri.esi.asn", FT_UINT32,
14880
16
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
14881
16
      { &hf_bgp_evpn_nlri_esi_asn_discr,
14882
16
        { "ESI ASN discriminator", "bgp.evpn.nlri.esi.asn_discr", FT_BYTES,
14883
16
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
14884
16
      { &hf_bgp_evpn_nlri_etag,
14885
16
       { "Ethernet Tag ID", "bgp.evpn.nlri.etag", FT_UINT32,
14886
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14887
16
      { &hf_bgp_evpn_nlri_mpls_ls1,
14888
16
        { "MPLS Label 1", "bgp.evpn.nlri.mpls_ls1", FT_UINT24,
14889
16
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
14890
16
      { &hf_bgp_evpn_nlri_mpls_ls2,
14891
16
        { "MPLS Label 2", "bgp.evpn.nlri.mpls_ls2", FT_UINT24,
14892
16
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
14893
16
      { &hf_bgp_evpn_nlri_vni,
14894
16
        { "VNI", "bgp.evpn.nlri.vni", FT_UINT24,
14895
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14896
16
      { &hf_bgp_evpn_nlri_maclen,
14897
16
       { "MAC Address Length", "bgp.evpn.nlri.maclen", FT_UINT8,
14898
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14899
16
      { &hf_bgp_evpn_nlri_mac_addr,
14900
16
        { "MAC Address", "bgp.evpn.nlri.mac_addr", FT_ETHER,
14901
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14902
16
      { &hf_bgp_evpn_nlri_iplen,
14903
16
        { "IP Address Length", "bgp.evpn.nlri.iplen", FT_UINT8,
14904
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14905
16
      { &hf_bgp_evpn_nlri_prefix_len,
14906
16
        { "IP prefix length", "bgp.evpn.nlri.prefix_len", FT_UINT8,
14907
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14908
16
      { &hf_bgp_evpn_nlri_ip_addr,
14909
16
        { "IPv4 address", "bgp.evpn.nlri.ip.addr", FT_IPv4,
14910
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14911
16
      { &hf_bgp_evpn_nlri_ipv6_addr,
14912
16
        { "IPv6 address", "bgp.evpn.nlri.ipv6.addr", FT_IPv6,
14913
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14914
16
      { &hf_bgp_evpn_nlri_ipv4_gtw,
14915
16
        { "IPv4 Gateway address", "bgp.evpn.nlri.ipv4.gtw_addr", FT_IPv4,
14916
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14917
16
      { &hf_bgp_evpn_nlri_ipv6_gtw,
14918
16
        { "IPv6 Gateway address", "bgp.evpn.nlri.ipv6.gtw_addr", FT_IPv6,
14919
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14920
     /* segment routing extensions to link state */
14921
     /* Node Attributes TLVs */
14922
16
      { &hf_bgp_ls_sr_tlv_capabilities,
14923
16
        { "SR Capabilities", "bgp.ls.sr.tlv.capabilities", FT_NONE,
14924
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14925
16
      { &hf_bgp_ls_sr_tlv_capabilities_flags,
14926
16
        { "Flags", "bgp.ls.sr.tlv.capabilities.flags", FT_UINT8,
14927
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14928
16
      { &hf_bgp_ls_sr_tlv_capabilities_flags_i,
14929
16
        { "MPLS IPv4 flag (I)", "bgp.ls.sr.tlv.capabilities.flags.i", FT_BOOLEAN,
14930
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_I, NULL, HFILL}},
14931
16
      { &hf_bgp_ls_sr_tlv_capabilities_flags_v,
14932
16
        { "MPLS IPv6 flag (V)", "bgp.ls.sr.tlv.capabilities.flags.v", FT_BOOLEAN,
14933
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_V, NULL, HFILL}},
14934
16
      { &hf_bgp_ls_sr_tlv_capabilities_flags_h,
14935
16
        { "SR-IPv6 flag (H)", "bgp.ls.sr.tlv.capabilities.flags.h", FT_BOOLEAN,
14936
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_H, NULL, HFILL}},
14937
16
      { &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
14938
16
        { "Reserved", "bgp.ls.sr.tlv.capabilities.flags.reserved", FT_UINT8,
14939
16
          BASE_HEX, NULL, 0x1F, NULL, HFILL}},
14940
16
      { &hf_bgp_ls_sr_tlv_capabilities_range_size,
14941
16
        { "Range Size", "bgp.ls.sr.tlv.capabilities.range_size", FT_UINT24,
14942
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14943
16
      { &hf_bgp_ls_sr_tlv_capabilities_sid_label,
14944
16
        { "From Label", "bgp.ls.sr.tlv.capabilities.sid.label", FT_UINT24,
14945
16
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14946
16
      { &hf_bgp_ls_sr_tlv_capabilities_sid_index,
14947
16
        { "From Index", "bgp.ls.sr.tlv.capabilities.sid.index", FT_UINT32,
14948
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14949
16
      { &hf_bgp_ls_sr_tlv_algorithm,
14950
16
        { "SR Algorithm TLV", "bgp.ls.sr.tlv.algorithm", FT_NONE,
14951
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14952
16
      { &hf_bgp_ls_sr_tlv_algorithm_value,
14953
16
        { "SR Algorithm", "bgp.ls.sr.tlv.algorithm.value", FT_UINT8,
14954
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14955
16
      { &hf_bgp_ls_sr_tlv_local_block,
14956
16
        { "SR Local Block", "bgp.ls.sr.tlv.local_block", FT_NONE,
14957
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14958
16
      { &hf_bgp_ls_sr_tlv_srv6_cap,
14959
16
        { "SRv6 Capabilities TLV", "bgp.ls.sr.tlv.srv6_capabilities", FT_NONE,
14960
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14961
16
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags,
14962
16
        { "Flags", "bgp.ls.sr.tlv.srv6_capabilities.flags", FT_UINT16,
14963
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14964
16
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags_o,
14965
16
        { "OAM flag (O)", "bgp.ls.sr.tlv.srv6_capabilities.flags.o", FT_BOOLEAN,
14966
16
          16, TFS(&tfs_set_notset), BGP_LS_SRV6_CAP_FLAG_O, NULL, HFILL}},
14967
16
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved,
14968
16
        { "Reserved", "bgp.ls.sr.tlv.srv6_capabilities.flags.reserved", FT_UINT16,
14969
16
          BASE_HEX, NULL, 0x3fff, NULL, HFILL}},
14970
16
      { &hf_bgp_ls_sr_tlv_srv6_cap_reserved,
14971
16
        { "Reserved", "bgp.ls.sr.tlv.srv6_capabilities.reserved", FT_UINT16,
14972
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14973
16
      { &hf_bgp_ls_sr_tlv_local_block_flags,
14974
16
        { "Flags", "bgp.ls.sr.tlv.local_block.flags", FT_UINT8,
14975
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14976
16
      { &hf_bgp_ls_sr_tlv_local_block_range_size,
14977
16
        { "Range Size", "bgp.ls.sr.tlv.local_block.range_size", FT_UINT24,
14978
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14979
16
      { &hf_bgp_ls_sr_tlv_local_block_sid_label,
14980
16
        { "From Label", "bgp.ls.sr.tlv.local_block.sid.label", FT_UINT24,
14981
16
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14982
16
      { &hf_bgp_ls_sr_tlv_local_block_sid_index,
14983
16
        { "From Index", "bgp.ls.sr.tlv.local_block.sid.index", FT_UINT32,
14984
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14985
16
      { &hf_bgp_ls_sr_tlv_flex_algo_def,
14986
16
        { "Flexible Algorithm Definition TLV", "bgp.ls.sr.tlv.flex_algo", FT_NONE,
14987
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14988
16
      { &hf_bgp_ls_sr_tlv_flex_algo_algorithm,
14989
16
        { "Flex-Algorithm", "bgp.ls.sr.tlv.flex_algo.flex_algorithm", FT_UINT8,
14990
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14991
16
      { &hf_bgp_ls_sr_tlv_flex_algo_metric_type,
14992
16
        { "Metric-Type", "bgp.ls.sr.tlv.flex_algo.metric_type", FT_UINT8,
14993
16
          BASE_DEC, VALS(flex_algo_metric_types), 0x0, NULL, HFILL}},
14994
16
      { &hf_bgp_ls_sr_tlv_flex_algo_calc_type,
14995
16
        { "Calculation-Type", "bgp.ls.sr.tlv.flex_algo.calculation_type", FT_UINT8,
14996
16
          BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14997
16
      { &hf_bgp_ls_sr_tlv_flex_algo_priority,
14998
16
        { "Priority", "bgp.ls.sr.tlv.flex_algo.priority", FT_UINT8,
14999
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15000
16
      { &hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity,
15001
16
        { "Flexible Algorithm Exclude-Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.exclude_any_affinity", FT_NONE,
15002
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15003
16
      { &hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity,
15004
16
        { "Flexible Algorithm Include-Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_any_affinity", FT_NONE,
15005
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15006
16
      { &hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity,
15007
16
        { "Flexible Algorithm Include-All Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_all_affinity", FT_NONE,
15008
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15009
16
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags,
15010
16
        { "Flexible Algorithm Definition Flags TLV", "bgp.ls.sr.tlv.flex_algo.definition_flags", FT_NONE,
15011
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15012
16
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags,
15013
16
        { "Flags", "bgp.ls.sr.tlv.flex_algo.definition_flags.flags", FT_UINT32,
15014
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15015
16
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m,
15016
16
        { "M-flag (M)", "bgp.ls.sr.tlv.flex_algo.definition_flags.flags.m", FT_BOOLEAN,
15017
16
          32, TFS(&tfs_set_notset), BGP_LS_FLEX_ALGO_DEF_FLAGS_M, NULL, HFILL}},
15018
16
      { &hf_bgp_ls_sr_tlv_flex_algo_exc_srlg,
15019
16
        { "Flexible Algorithm Exclude SRLG TLV", "bgp.ls.sr.tlv.flex_algo.exclude_srlg", FT_NONE,
15020
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15021
     /* Prefix Attribute TLVs */
15022
16
      { &hf_bgp_ls_sr_tlv_prefix_sid,
15023
16
        { "Prefix SID TLV", "bgp.ls.sr.tlv.prefix.sid", FT_NONE,
15024
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15025
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags,
15026
16
        { "Flags", "bgp.ls.sr.tlv.prefix.sid.flags", FT_UINT8,
15027
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15028
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
15029
16
        { "Re-advertisement (R)", "bgp.ls.sr.tlv.prefix.sid.flags.r", FT_BOOLEAN,
15030
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_R, NULL, HFILL}},
15031
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
15032
16
        { "Node-SID (N)", "bgp.ls.sr.tlv.prefix.sid.flags.n", FT_BOOLEAN,
15033
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_N, NULL, HFILL}},
15034
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
15035
16
        { "No-PHP (NP)", "bgp.ls.sr.tlv.prefix.sid.flags.np", FT_BOOLEAN,
15036
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_NP, NULL, HFILL}},
15037
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
15038
16
        { "No-PHP (P)", "bgp.ls.sr.tlv.prefix.sid.flags.p", FT_BOOLEAN,
15039
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_P, NULL, HFILL}},
15040
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
15041
16
        { "Mapping Server Flag (M)", "bgp.ls.sr.tlv.prefix.sid.flags.m", FT_BOOLEAN,
15042
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_M, NULL, HFILL}},
15043
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
15044
16
        { "Explicit-Null (E)", "bgp.ls.sr.tlv.prefix.sid.flags.e", FT_BOOLEAN,
15045
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_E, NULL, HFILL}},
15046
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
15047
16
        { "Value (V)", "bgp.ls.sr.tlv.prefix.sid.flags.v", FT_BOOLEAN,
15048
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_V, NULL, HFILL}},
15049
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
15050
16
        { "Local (L)", "bgp.ls.sr.tlv.prefix.sid.flags.l", FT_BOOLEAN,
15051
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_L, NULL, HFILL}},
15052
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_algo,
15053
16
        { "Algorithm", "bgp.ls.sr.tlv.prefix.sid.algo", FT_UINT8,
15054
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15055
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_label,
15056
16
        { "SID/Label", "bgp.ls.sr.tlv.prefix.sid.label", FT_UINT24,
15057
16
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
15058
16
      { &hf_bgp_ls_sr_tlv_prefix_sid_index,
15059
16
        { "SID/Index", "bgp.ls.sr.tlv.prefix.sid.index", FT_UINT32,
15060
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15061
16
      { &hf_bgp_ls_sr_tlv_srv6_locator,
15062
16
        { "SRv6 Locator TLV", "bgp.ls.sr.tlv.srv6_locator", FT_NONE,
15063
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15064
16
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags,
15065
16
        { "Flags", "bgp.ls.sr.tlv.srv6_locator.flags", FT_UINT8,
15066
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15067
16
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags_d,
15068
16
        { "Down flag (D)", "bgp.ls.sr.tlv.srv6_locator.flags.d", FT_BOOLEAN,
15069
16
          8, TFS(&tfs_set_notset), BGP_LS_SRV6_LOC_FLAG_D, NULL, HFILL}},
15070
16
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved,
15071
16
        { "Reserved", "bgp.ls.sr.tlv.srv6_locator.flags.reserved", FT_UINT8,
15072
16
          BASE_HEX, NULL, BGP_LS_SRV6_LOC_FLAG_RESERVED, NULL, HFILL}},
15073
16
      { &hf_bgp_ls_sr_tlv_srv6_locator_algo,
15074
16
        { "Algorithm", "bgp.ls.sr.tlv.srv6_locator.algorithm",
15075
16
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
15076
16
      { &hf_bgp_ls_sr_tlv_srv6_locator_reserved,
15077
16
        { "Reserved", "bgp.ls.sr.tlv.srv6_locator.reserved", FT_UINT16,
15078
16
          BASE_HEX, NULL, 0, NULL, HFILL}},
15079
16
      { &hf_bgp_ls_sr_tlv_srv6_locator_metric,
15080
16
        { "Metric", "bgp.ls.sr.tlv.srv6_locator.metric", FT_UINT32,
15081
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
15082
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags,
15083
16
        { "Prefix Attribute Flags TLV", "bgp.ls.sr.tlv.prefix.attribute_flags", FT_NONE,
15084
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15085
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
15086
16
        { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags", FT_UINT8,
15087
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15088
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
15089
16
        { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.unknown", FT_BYTES,
15090
16
          SEP_SPACE, NULL, 0x0,NULL, HFILL }},
15091
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
15092
16
        { "Attach (A)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.a", FT_BOOLEAN,
15093
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO, NULL, HFILL}},
15094
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
15095
16
        { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
15096
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO, NULL, HFILL}},
15097
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
15098
16
        { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
15099
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO, NULL, HFILL}},
15100
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
15101
16
        { "External Prefix (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.x", FT_BOOLEAN,
15102
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI, NULL, HFILL}},
15103
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
15104
16
        { "Re-advertisement (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.r", FT_BOOLEAN,
15105
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI, NULL, HFILL}},
15106
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
15107
16
        { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
15108
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI, NULL, HFILL}},
15109
16
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
15110
16
        { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
15111
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI, NULL, HFILL}},
15112
16
      { &hf_bgp_ls_sr_tlv_source_router_id,
15113
16
        { "Source Router-ID TLV", "bgp.ls.sr.tlv.source_router_id", FT_NONE,
15114
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15115
16
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric,
15116
16
        { "Flexible Algorithm Prefix Metric TLV", "bgp.ls.sr.tlv.flex_algo.prefix_metric", FT_NONE,
15117
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15118
16
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags,
15119
16
        { "Flags", "bgp.ls.sr.tlv.flex_algo.prefix_metric.flags", FT_UINT8,
15120
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15121
16
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e,
15122
16
        { "E bit (E)", "bgp.ls.sr.tlv.flex_algo.prefix_metric.flags.e", FT_BOOLEAN,
15123
16
          8, TFS(&tfs_set_notset), BGP_LS_FLEX_ALGO_PREFIX_METRIC_FLAGS_E, NULL, HFILL}},
15124
16
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved,
15125
16
        { "Reserved", "bgp.ls.sr.tlv.flex_algo.prefix_metric.reserved", FT_UINT16,
15126
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15127
16
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric,
15128
16
        { "Metric", "bgp.ls.sr.tlv.flex_algo.prefix_metric.metric", FT_UINT32,
15129
16
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
15130
     /* SID Attribute TLVs */
15131
16
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior,
15132
16
        { "SRv6 Endpoint Behavior TLV", "bgp.ls.sr.tlv.srv6_endpoint_behavior", FT_NONE,
15133
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15134
16
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior,
15135
16
        { "Endpoint Behavior", "bgp.ls.sr.tlv.srv6_endpoint_behavior.endpoint_behavior", FT_UINT16,
15136
16
          BASE_HEX, VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL}},
15137
16
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags,
15138
16
        { "Flags", "bgp.ls.sr.tlv.srv6_endpoint_behavior.flags", FT_UINT8,
15139
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15140
16
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo,
15141
16
        { "Algorithm", "bgp.ls.sr.tlv.srv6_endpoint_behavior.algorithm",
15142
16
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
15143
     /* Adjacency Attribute TLVs */
15144
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid,
15145
16
        { "Adjacency SID TLV", "bgp.ls.sr.tlv.adjacency.sid", FT_NONE,
15146
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15147
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags,
15148
16
        { "Flags", "bgp.ls.sr.tlv.adjacency.sid.flags", FT_UINT8,
15149
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15150
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
15151
16
        { "Address-Family flag (F)", "bgp.ls.sr.tlv.adjacency.sid.flags.f", FT_BOOLEAN,
15152
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_FI, NULL, HFILL}},
15153
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
15154
16
        { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
15155
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BO, NULL, HFILL}},
15156
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
15157
16
        { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
15158
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BI, NULL, HFILL}},
15159
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
15160
16
        { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
15161
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VO, NULL, HFILL}},
15162
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
15163
16
        { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
15164
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VI, NULL, HFILL}},
15165
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
15166
16
        { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
15167
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LO, NULL, HFILL}},
15168
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
15169
16
        { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
15170
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LI, NULL, HFILL}},
15171
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_go,
15172
16
        { "Group Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.g", FT_BOOLEAN,
15173
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_GO, NULL, HFILL}},
15174
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
15175
16
        { "Set Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.s", FT_BOOLEAN,
15176
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_SI, NULL, HFILL}},
15177
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_po,
15178
16
        { "Persistent Flag (P)", "bgp.ls.sr.tlv.adjacency.sid.flags.p", FT_BOOLEAN,
15179
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_PO, NULL, HFILL}},
15180
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi,
15181
16
        { "Persistent Flag (P)", "bgp.ls.sr.tlv.adjacency.sid.flags.p", FT_BOOLEAN,
15182
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_PI, NULL, HFILL}},
15183
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_weight,
15184
16
        { "Weight", "bgp.ls.sr.tlv.adjacency.sid.weight", FT_UINT8,
15185
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15186
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_label,
15187
16
        { "SID/Label", "bgp.ls.sr.tlv.adjacency.sid.label", FT_UINT24,
15188
16
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
15189
16
      { &hf_bgp_ls_sr_tlv_adjacency_sid_index,
15190
16
        { "SID/Index", "bgp.ls.sr.tlv.adjacency.sid.index", FT_UINT32,
15191
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15192
16
      { &hf_bgp_ls_sr_tlv_peer_node_sid,
15193
16
        { "PeerNode SID TLV", "bgp.ls.sr.tlv.peer_node.sid", FT_NONE,
15194
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15195
16
      { &hf_bgp_ls_sr_tlv_peer_adj_sid,
15196
16
        { "PeerAdj SID TLV", "bgp.ls.sr.tlv.peer_adj.sid", FT_NONE,
15197
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15198
16
      { &hf_bgp_ls_sr_tlv_peer_set_sid,
15199
16
        { "PeerSet SID TLV", "bgp.ls.sr.tlv.peer_set.sid", FT_NONE,
15200
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15201
16
      { &hf_bgp_ls_sr_tlv_peer_sid_flags,
15202
16
        { "Flags", "bgp.ls.sr.tlv.peer.sid.flags", FT_UINT8,
15203
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15204
16
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
15205
16
        { "Value flag (V)", "bgp.ls.sr.tlv.peer.sid.flags.v", FT_BOOLEAN,
15206
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_V, NULL, HFILL}},
15207
16
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
15208
16
        { "Local flag (L)", "bgp.ls.sr.tlv.peer.sid.flags.l", FT_BOOLEAN,
15209
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_L, NULL, HFILL}},
15210
16
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
15211
16
        { "Backup flag (B)", "bgp.ls.sr.tlv.peer.sid.flags.b", FT_BOOLEAN,
15212
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_B, NULL, HFILL}},
15213
16
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
15214
16
        { "Persistent flag (P)", "bgp.ls.sr.tlv.peer.sid.flags.p", FT_BOOLEAN,
15215
16
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_P, NULL, HFILL}},
15216
16
      { &hf_bgp_ls_sr_tlv_peer_sid_weight,
15217
16
        { "Weight", "bgp.ls.sr.tlv.peer.sid.weight", FT_UINT8,
15218
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15219
16
      { &hf_bgp_ls_sr_tlv_peer_sid_label,
15220
16
        { "SID/Label", "bgp.ls.sr.tlv.peer.sid.label", FT_UINT24,
15221
16
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
15222
16
      { &hf_bgp_ls_sr_tlv_peer_sid_index,
15223
16
        { "SID/Index", "bgp.ls.sr.tlv.peer.sid.index", FT_UINT32,
15224
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15225
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid,
15226
16
        { "SRv6 End.X SID TLV", "bgp.ls.sr.tlv.srv6_endx_sid", FT_NONE,
15227
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
15228
16
      { &hf_bgp_ls_sr_tlv_srv6_lan_endx_sid,
15229
16
        { "SRv6 LAN End.X SID TLV", "bgp.ls.sr.tlv.srv6_lan_endx_sid", FT_NONE,
15230
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
15231
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior,
15232
16
        { "Endpoint Behavior", "bgp.ls.sr.tlv.srv6_endx_sid.endpoint_behavior",
15233
16
          FT_UINT16, BASE_DEC, VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
15234
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
15235
16
        { "Flags", "bgp.ls.sr.tlv.srv6_endx_sid.flags", FT_UINT8,
15236
16
          BASE_HEX, NULL, 0x0, NULL, HFILL }},
15237
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b,
15238
16
        { "Backup flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.b",
15239
16
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_B, NULL, HFILL }},
15240
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s,
15241
16
        { "Set flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.s",
15242
16
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_S, NULL, HFILL }},
15243
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p,
15244
16
        { "Persistent flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.p",
15245
16
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_P, NULL, HFILL }},
15246
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved,
15247
16
        { "Reserved", "bgp.ls.sr.tlv.srv6_endx_sid.flags.reserved",
15248
16
          FT_UINT8, BASE_HEX, NULL, BGP_LS_SRV6_ENDX_SID_FLAG_RESERVED, NULL, HFILL }},
15249
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_algo,
15250
16
        { "Algorithm", "bgp.ls.sr.tlv.srv6_endx_sid.algorithm",
15251
16
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL }},
15252
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_weight,
15253
16
        { "Weight", "bgp.ls.sr.tlv.srv6_endx_sid.weight",
15254
16
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
15255
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved,
15256
16
        { "Reserved", "bgp.ls.sr.tlv.srv6_endx_sid.reserved",
15257
16
          FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
15258
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf,
15259
16
        { "Neighbor-ID", "bgp.ls.tlv.srv6_endx_sid.neighbor_id_ospf", FT_IPv4,
15260
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
15261
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis,
15262
16
        { "Neighbor-ID", "bgp.ls.tlv.srv6_endx_sid.neighbor_id_isis", FT_SYSTEM_ID,
15263
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
15264
16
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_sid,
15265
16
        { "SID", "bgp.ls.sr.tlv.srv6_endx_sid.sid",
15266
16
          FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
15267
16
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct,
15268
16
        { "SRv6 SID Structure TLV", "bgp.ls.sr.tlv.srv6_sid_structure", FT_NONE,
15269
16
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
15270
16
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len,
15271
16
        { "Locator Block Length", "bgp.ls.sr.tlv.srv6_sid_structure.locator_block_len",
15272
16
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
15273
16
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len,
15274
16
        { "Locator Node Length", "bgp.ls.sr.tlv.srv6_sid_structure.locator_node_len",
15275
16
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
15276
16
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len,
15277
16
        { "Function Length", "bgp.ls.sr.tlv.srv6_sid_structure.fun_len",
15278
16
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
15279
16
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len,
15280
16
        { "Arguments Length", "bgp.ls.sr.tlv.srv6_sid_structure.arg_len",
15281
16
          FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL }},
15282
16
      { &hf_bgp_ls_igp_te_metric_flags,
15283
16
        { "TE Metric Flags", "bgp.ls.igp_te_metric.flags", FT_UINT8,
15284
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15285
16
      { &hf_bgp_ls_igp_te_metric_flags_a,
15286
16
        { "Anomalous (A) bit", "bgp.ls.igp_te_metric.flags.a", FT_BOOLEAN,
15287
16
          8, TFS(&tfs_set_notset), BGP_LS_IGP_TE_METRIC_FLAG_A, NULL, HFILL}},
15288
16
      { &hf_bgp_ls_igp_te_metric_flags_reserved,
15289
16
        { "Reserved", "bgp.ls.igp_te_metric.flags.reserved", FT_UINT8,
15290
16
          BASE_HEX, NULL, BGP_LS_IGP_TE_METRIC_FLAG_RESERVED, NULL, HFILL}},
15291
16
      { &hf_bgp_ls_igp_te_metric_delay,
15292
16
        { "Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay", FT_NONE,
15293
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15294
16
      { &hf_bgp_ls_igp_te_metric_delay_value,
15295
16
        { "Delay", "bgp.ls.igp_te_metric.delay_value", FT_UINT24,
15296
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15297
16
      { &hf_bgp_ls_igp_te_metric_delay_min_max,
15298
16
        { "Min/Max Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay_min_max", FT_NONE,
15299
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15300
16
      { &hf_bgp_ls_igp_te_metric_delay_min,
15301
16
        { "Min Delay", "bgp.ls.igp_te_metric.delay_min", FT_UINT24,
15302
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15303
16
      { &hf_bgp_ls_igp_te_metric_delay_max,
15304
16
        { "Max Delay", "bgp.ls.igp_te_metric.delay_max", FT_UINT24,
15305
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15306
16
      { &hf_bgp_ls_igp_te_metric_delay_variation,
15307
16
        { "Unidirectional Delay Variation TLV", "bgp.ls.igp_te_metric.delay_variation", FT_NONE,
15308
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15309
16
      { &hf_bgp_ls_igp_te_metric_delay_variation_value,
15310
16
        { "Delay Variation", "bgp.ls.igp_te_metric.delay_variation_value", FT_UINT24,
15311
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15312
16
      { &hf_bgp_ls_igp_te_metric_link_loss,
15313
16
        { "Unidirectional Link Loss TLV", "bgp.ls.igp_te_metric.link_loss", FT_NONE,
15314
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15315
16
      { &hf_bgp_ls_igp_te_metric_link_loss_value,
15316
16
        { "Link Loss", "bgp.ls.igp_te_metric.link_loss_value", FT_UINT24,
15317
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15318
16
      { &hf_bgp_ls_igp_te_metric_bandwidth_residual,
15319
16
        { "Unidirectional Residual Bandwidth TLV", "bgp.ls.igp_te_metric.residual_bandwidth", FT_NONE,
15320
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15321
16
      { &hf_bgp_ls_igp_te_metric_bandwidth_residual_value,
15322
16
        { "Residual Bandwidth", "bgp.ls.igp_te_metric.residual_bandwidth_value", FT_UINT32,
15323
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15324
16
      { &hf_bgp_ls_igp_te_metric_bandwidth_available,
15325
16
        { "Unidirectional Available Bandwidth TLV", "bgp.ls.igp_te_metric.available_bandwidth", FT_NONE,
15326
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15327
16
      { &hf_bgp_ls_igp_te_metric_bandwidth_available_value,
15328
16
        { "Residual Bandwidth", "bgp.ls.igp_te_metric.available_bandwidth_value", FT_UINT32,
15329
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15330
16
      { &hf_bgp_ls_igp_te_metric_bandwidth_utilized,
15331
16
        { "Unidirectional Utilized Bandwidth TLV", "bgp.ls.igp_te_metric.utilized_bandwidth", FT_NONE,
15332
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15333
16
      { &hf_bgp_ls_igp_te_metric_bandwidth_utilized_value,
15334
16
        { "Utilized Bandwidth", "bgp.ls.igp_te_metric.utilized_bandwidth_value", FT_UINT32,
15335
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15336
16
      { &hf_bgp_ls_igp_te_metric_reserved,
15337
16
        { "Reserved", "bgp.ls.igp_te_metric.reserved", FT_UINT8,
15338
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15339
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs,
15340
16
        { "Application-Specific Link Attributes TLV", "bgp.ls.tlv.application_specific_link_attributes", FT_NONE,
15341
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15342
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len,
15343
16
        { "SABM Length", "bgp.ls.tlv.application_specific_link_attributes.sabm_length", FT_UINT8,
15344
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15345
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len,
15346
16
        { "UDABM Length", "bgp.ls.tlv.application_specific_link_attributes.udabm_length", FT_UINT8,
15347
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15348
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_reserved,
15349
16
        { "Reserved", "bgp.ls.tlv.application_specific_link_attributes.reserved", FT_UINT16,
15350
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15351
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
15352
16
        { "Standard Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.sabm", FT_UINT32,
15353
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15354
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
15355
16
        { "RSVP-TE (R)", "bgp.ls.tlv.application_specific_link_attributes.sabm.r", FT_BOOLEAN,
15356
16
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R, NULL, HFILL}},
15357
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
15358
16
        { "Segment Routing Policy (S)", "bgp.ls.tlv.application_specific_link_attributes.sabm.s", FT_BOOLEAN,
15359
16
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S, NULL, HFILL}},
15360
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
15361
16
        { "Loop Free Alternate (F)", "bgp.ls.tlv.application_specific_link_attributes.sabm.f", FT_BOOLEAN,
15362
16
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F, NULL, HFILL}},
15363
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
15364
16
        { "Flexible Algorithm (X)", "bgp.ls.tlv.application_specific_link_attributes.sabm.x", FT_BOOLEAN,
15365
16
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X, NULL, HFILL}},
15366
16
      { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
15367
16
        { "User-Defined Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.udabm", FT_BYTES,
15368
16
          SEP_SPACE, NULL, 0x0,NULL, HFILL }},
15369
15370
16
      { &hf_bgp_evpn_nlri_igmp_mc_or_length,
15371
16
       { "Originator Router Length", "bgp.evpn.nlri.or_length", FT_UINT8,
15372
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15373
16
      { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4,
15374
16
       { "Originator Router Address IPv4", "bgp.evpn.nlri.or_addr_ipv4", FT_IPv4,
15375
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15376
16
      { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6,
15377
16
       { "Originator Router Address IPv6", "bgp.evpn.nlri.or_addr_ipv6", FT_IPv6,
15378
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15379
16
      { &hf_bgp_evpn_nlri_igmp_mc_reserved,
15380
16
       { "Reserved", "bgp.evpn.nlri.igmp_mc_reserved", FT_BYTES,
15381
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15382
16
      { &hf_bgp_evpn_nlri_igmp_mc_max_resp_time,
15383
16
       { "Max. response time", "bgp.evpn.nlri.igmp_mc_max_resp_time", FT_UINT8,
15384
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15385
16
      { &hf_bgp_evpn_nlri_igmp_mc_flags,
15386
16
       { "Flags", "bgp.evpn.nlri.igmp_mc_flags", FT_UINT8,
15387
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15388
16
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
15389
16
        { "IGMP Version 1", "bgp.evpn.nlri.igmp_mc_flags.v1", FT_BOOLEAN,
15390
16
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V1, NULL, HFILL}},
15391
16
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
15392
16
        { "IGMP Version 2", "bgp.evpn.nlri.igmp_mc_flags.v2", FT_BOOLEAN,
15393
16
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V2, NULL, HFILL}},
15394
16
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
15395
16
        { "IGMP Version 3", "bgp.evpn.nlri.igmp_mc_flags.v3", FT_BOOLEAN,
15396
16
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V3, NULL, HFILL}},
15397
16
      { &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
15398
16
        { "Group Type (IE Flag)", "bgp.evpn.nlri.igmp_mc_flags.ie", FT_BOOLEAN,
15399
16
          8, TFS(&tfs_exclude_include), EVPN_IGMP_MC_FLAG_IE, "Group Type (Include/Exclude Flag)", HFILL}},
15400
16
      { &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
15401
16
        { "Reserved", "bgp.evpn.nlri.igmp_mc_flags.reserved", FT_UINT8,
15402
16
          BASE_HEX, NULL, EVPN_IGMP_MC_FLAG_RESERVED, NULL, HFILL}},
15403
15404
        /* draft-ietf-bess-mup-safi-01 */
15405
16
      { &hf_bgp_mup_nlri,
15406
16
        { "BGP-MUP NLRI", "bgp.mup.nlri", FT_NONE,
15407
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15408
16
      { &hf_bgp_mup_nlri_at,
15409
16
        { "Architecture Type", "bgp.mup.nlri.at", FT_UINT8, BASE_DEC,
15410
16
          VALS(bgp_mup_architecture_types), 0x0, NULL, HFILL }},
15411
16
      { &hf_bgp_mup_nlri_rt,
15412
16
        { "Route Type", "bgp.mup.nlri.rt", FT_UINT16, BASE_DEC,
15413
16
          VALS(bgp_mup_route_types), 0x0, NULL, HFILL }},
15414
16
      { &hf_bgp_mup_nlri_len,
15415
16
        { "Length", "bgp.mup.nlri.len", FT_UINT8,
15416
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15417
16
      { &hf_bgp_mup_nlri_rd,
15418
16
        { "Route Distinguisher", "bgp.mup.nlri.rd", FT_BYTES,
15419
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15420
16
      { &hf_bgp_mup_nlri_prefixlen,
15421
16
        { "Prefix Length", "bgp.mup.nlri.prefixlen", FT_UINT8,
15422
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15423
16
      { &hf_bgp_mup_nlri_ip_prefix,
15424
16
        { "IPv4 Prefix", "bgp.mup.nlri.ip_prefix", FT_IPv4,
15425
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15426
16
      { &hf_bgp_mup_nlri_ipv6_prefix,
15427
16
        { "IPv6 Prefix", "bgp.mup.nlri.ipv6_prefix", FT_IPv6,
15428
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15429
16
      { &hf_bgp_mup_nlri_ip_addr,
15430
16
        { "IPv4 Address", "bgp.mup.nlri.ip_addr", FT_IPv4,
15431
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15432
16
      { &hf_bgp_mup_nlri_ipv6_addr,
15433
16
        { "IPv6 Address", "bgp.mup.nlri.ipv6_addr", FT_IPv6,
15434
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15435
16
      { &hf_bgp_mup_nlri_3gpp_5g_teid,
15436
16
        { "TEID", "bgp.mup.nlri.3gpp_5g.teid", FT_UINT32,
15437
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15438
16
      { &hf_bgp_mup_nlri_3gpp_5g_qfi,
15439
16
        { "QFI", "bgp.mup.nlri.3gpp_5g.qfi", FT_UINT8,
15440
16
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
15441
16
      { &hf_bgp_mup_nlri_3gpp_5g_ep_addr_len,
15442
16
        { "Endpoint Length", "bgp.mup.nlri.3gpp_5g.ep.len", FT_UINT8,
15443
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15444
16
      { &hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr,
15445
16
        { "Endpoint Address", "bgp.mup.nlri.3gpp_5g.ep.ip_addr", FT_IPv4,
15446
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15447
16
      { &hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr,
15448
16
        { "Endpoint Address", "bgp.mup.nlri.3gpp_5g.ep.ipv6_addr", FT_IPv6,
15449
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15450
16
      { &hf_bgp_mup_nlri_3gpp_5g_source_addr_len,
15451
16
        { "Source Address Length", "bgp.mup.nlri.3gpp_5g.source.len", FT_UINT8,
15452
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15453
16
      { &hf_bgp_mup_nlri_3gpp_5g_source_ip_addr,
15454
16
        { "Source Address", "bgp.mup.nlri.3gpp_5g.source.ip_addr", FT_IPv4,
15455
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15456
16
      { &hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr,
15457
16
        { "Source Address", "bgp.mup.nlri.3gpp_5g.source.ipv6_addr", FT_IPv6,
15458
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15459
16
      { &hf_bgp_mup_nlri_ep_len,
15460
16
        { "Endpoint Length", "bgp.mup.nlri.ep.len", FT_UINT8,
15461
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15462
16
      { &hf_bgp_mup_nlri_ep_ip_addr,
15463
16
        { "Endpoint Address", "bgp.mup.nlri.ep.ip_addr", FT_IPv4,
15464
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15465
16
      { &hf_bgp_mup_nlri_ep_ipv6_addr,
15466
16
        { "Endpoint Address", "bgp.mup.nlri.ep.ipv6_addr", FT_IPv6,
15467
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15468
16
      { &hf_bgp_mup_nlri_3gpp_5g_ep_teid,
15469
16
        { "Endpoint TEID", "bgp.mup.nlri.3gpp_5g.ep.teid", FT_UINT32,
15470
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15471
16
      { &hf_bgp_mup_nlri_st_route_tlv,
15472
16
        { "TLV", "bgp.mup.nlri.st_route.tlv", FT_NONE,
15473
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15474
16
      { &hf_bgp_mup_nlri_st_route_tlv_type,
15475
16
        { "Type", "bgp.mup.nlri.st_route.tlv.type", FT_UINT8, BASE_DEC,
15476
16
          VALS(bgp_mup_st_route_tlv_types), 0x0, NULL, HFILL }},
15477
16
      { &hf_bgp_mup_nlri_st_route_tlv_len,
15478
16
        { "Length", "bgp.mup.nlri.st_route.tlv.len", FT_UINT8,
15479
16
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
15480
16
      { &hf_bgp_mup_nlri_st_route_tlv_value,
15481
16
        { "Value", "bgp.mup.nlri.st_route.tlv.value", FT_BYTES,
15482
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15483
16
      { &hf_bgp_mup_nlri_st_route_tlv_interwork_ep_ip_addr,
15484
16
        { "Interwork Endpoint Address", "bgp.mup.nlri.st_route.tlv.interwork_ep.ip_addr", FT_IPv4,
15485
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15486
16
      { &hf_bgp_mup_nlri_st_route_tlv_interwork_ep_ipv6_addr,
15487
16
        { "Interwork Endpoint Address", "bgp.mup.nlri.st_route.tlv.interwork_ep.ipv6_addr", FT_IPv6,
15488
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15489
16
      { &hf_bgp_mup_nlri_3gpp_5g_type1_st_route,
15490
16
        { "3gpp-5g specific Type 1 ST route", "bgp.mup.nlri.3gpp_5g.type1_st_route", FT_NONE,
15491
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15492
16
      { &hf_bgp_mup_nlri_3gpp_5g_type2_st_route,
15493
16
        { "3gpp-5g specific Type 2 ST route", "bgp.mup.nlri.3gpp_5g.type2_st_route", FT_NONE,
15494
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15495
16
      { &hf_bgp_mup_nlri_unknown_data,
15496
16
        { "Unknown Data", "bgp.mup.nlri.unknown_data", FT_BYTES,
15497
16
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
15498
16
};
15499
15500
16
    static int *ett[] = {
15501
16
      &ett_bgp,
15502
16
      &ett_bgp_prefix,
15503
16
      &ett_bgp_unfeas,
15504
16
      &ett_bgp_attrs,
15505
16
      &ett_bgp_attr,
15506
16
      &ett_bgp_attr_flags,
15507
16
      &ett_bgp_mp_nhna,
15508
16
      &ett_bgp_mp_reach_nlri,
15509
16
      &ett_bgp_mp_unreach_nlri,
15510
16
      &ett_bgp_mp_snpa,
15511
16
      &ett_bgp_nlri,
15512
16
      &ett_bgp_open,
15513
16
      &ett_bgp_update,
15514
16
      &ett_bgp_notification,
15515
16
      &ett_bgp_route_refresh,
15516
16
      &ett_bgp_capability,
15517
16
      &ett_bgp_as_path_segment,
15518
16
      &ett_bgp_as_path_segment_asn,
15519
16
      &ett_bgp_communities,
15520
16
      &ett_bgp_community,
15521
16
      &ett_bgp_cluster_list,
15522
16
      &ett_bgp_options,
15523
16
      &ett_bgp_option,
15524
16
      &ett_bgp_options_ext,
15525
16
      &ett_bgp_cap,
15526
16
      &ett_bgp_extended_communities,
15527
16
      &ett_bgp_extended_community,
15528
16
      &ett_bgp_ext_com_type,
15529
16
      &ett_bgp_extended_com_fspec_redir,
15530
16
      &ett_bgp_ext_com_flags,
15531
16
      &ett_bgp_ext_com_l2_flags,
15532
16
      &ett_bgp_ext_com_etree_flags,
15533
16
      &ett_bgp_ext_com_evpn_mmac_flags,
15534
16
      &ett_bgp_ext_com_evpn_l2attr_flags,
15535
16
      &ett_bgp_ext_com_evpn_etree_flags,
15536
16
      &ett_bgp_ext_com_cost_cid,
15537
16
      &ett_bgp_ext_com_ospf_rt_opt,
15538
16
      &ett_bgp_ext_com_eigrp_flags,
15539
16
      &ett_bgp_ssa,
15540
16
      &ett_bgp_ssa_subtree,
15541
16
      &ett_bgp_orf,
15542
16
      &ett_bgp_orf_entry,
15543
16
      &ett_bgp_mcast_vpn_nlri,
15544
16
      &ett_bgp_flow_spec_nlri,
15545
16
      &ett_bgp_flow_spec_nlri_filter,
15546
16
      &ett_bgp_flow_spec_nlri_op_flags,
15547
16
      &ett_bgp_flow_spec_nlri_tcp,
15548
16
      &ett_bgp_flow_spec_nlri_ff,
15549
16
      &ett_bgp_tunnel_tlv,
15550
16
      &ett_bgp_tunnel_tlv_subtree,
15551
16
      &ett_bgp_tunnel_subtlv,
15552
16
      &ett_bgp_tunnel_subtlv_subtree,
15553
16
      &ett_bgp_link_state,
15554
16
      &ett_bgp_evpn_nlri,
15555
16
      &ett_bgp_evpn_nlri_esi,
15556
16
      &ett_bgp_evpn_nlri_mc,
15557
16
      &ett_bgp_mpls_labels,
15558
16
      &ett_bgp_pmsi_tunnel_id,
15559
16
      &ett_bgp_aigp_attr,
15560
16
      &ett_bgp_large_communities,
15561
16
      &ett_bgp_dpath,
15562
16
      &ett_bgp_bfd_discriminator_tlv,
15563
16
      &ett_bgp_prefix_sid_label_index,
15564
16
      &ett_bgp_prefix_sid_ipv6,
15565
16
      &ett_bgp_prefix_sid_originator_srgb,
15566
16
      &ett_bgp_prefix_sid_originator_srgb_block,
15567
16
      &ett_bgp_prefix_sid_originator_srgb_blocks,
15568
16
      &ett_bgp_bgpsec_secure_path,
15569
16
      &ett_bgp_bgpsec_secure_path_segment,
15570
16
      &ett_bgp_bgpsec_signature_block,
15571
16
      &ett_bgp_bgpsec_signature_segment,
15572
16
      &ett_bgp_vxlan,
15573
16
      &ett_bgp_binding_sid,
15574
16
      &ett_bgp_segment_list,
15575
16
      &ett_bgp_prefix_sid_unknown,
15576
16
      &ett_bgp_prefix_sid_srv6_l3vpn,
15577
16
      &ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
15578
16
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_information,
15579
16
      &ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
15580
16
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_structure,
15581
16
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown,
15582
16
      &ett_bgp_prefix_sid_srv6_l3vpn_unknown,
15583
16
      &ett_bgp_prefix_sid_srv6_l2vpn,
15584
16
      &ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
15585
16
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_information,
15586
16
      &ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
15587
16
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_structure,
15588
16
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown,
15589
16
      &ett_bgp_prefix_sid_srv6_l2vpn_unknown,
15590
16
      &ett_bgp_mup_nlri,
15591
16
      &ett_bgp_mup_nlri_3gpp_5g_type1_st_route,
15592
16
      &ett_bgp_mup_nlri_3gpp_5g_type2_st_route,
15593
16
      &ett_bgp_mup_nlri_st_route_tlv,
15594
16
    };
15595
16
    static ei_register_info ei[] = {
15596
16
        { &ei_bgp_marker_invalid, { "bgp.marker_invalid", PI_MALFORMED, PI_ERROR, "Marker is not all ones", EXPFILL }},
15597
16
        { &ei_bgp_cap_len_bad, { "bgp.cap.length.bad", PI_MALFORMED, PI_ERROR, "Capability length is wrong", EXPFILL }},
15598
16
        { &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 }},
15599
16
        { &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }},
15600
16
        { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_UNDECODED, PI_WARN, "unknown ORF type", EXPFILL }},
15601
16
        { &ei_bgp_route_refresh_orf_type_unsupported, { "bgp.route_refresh.orf.type.unsupported", PI_UNDECODED, PI_WARN, "ORF type: decoding not supported", EXPFILL }},
15602
16
        { &ei_bgp_route_refresh_orf_type_unregistered, { "bgp.route_refresh.orf.type.unregistered", PI_MALFORMED, PI_ERROR, "ORF type: unregistered/non-IANA value", EXPFILL }},
15603
16
        { &ei_bgp_route_refresh_orf_action_invalid, { "bgp.route_refresh.orf.action.invalid", PI_MALFORMED, PI_ERROR, "Invalid ORF action", EXPFILL }},
15604
16
        { &ei_bgp_length_invalid, { "bgp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
15605
16
        { &ei_bgp_prefix_length_invalid, { "bgp.prefix_length.invalid", PI_MALFORMED, PI_ERROR, "Prefix length is invalid", EXPFILL }},
15606
16
        { &ei_bgp_afi_type_not_supported, { "bgp.afi_type_not_supported", PI_PROTOCOL, PI_ERROR, "AFI Type not supported", EXPFILL }},
15607
16
        { &ei_bgp_unknown_afi, { "bgp.unknown_afi", PI_PROTOCOL, PI_ERROR, "Unknown Address Family", EXPFILL }},
15608
16
        { &ei_bgp_unknown_safi, { "bgp.unknown_safi", PI_PROTOCOL, PI_ERROR, "Unknown SAFI", EXPFILL }},
15609
16
        { &ei_bgp_unknown_label_vpn, { "bgp.unknown_label", PI_PROTOCOL, PI_ERROR, "Unknown Label VPN", EXPFILL }},
15610
16
        { &ei_bgp_ls_error, { "bgp.ls.error", PI_PROTOCOL, PI_ERROR, "Link State error", EXPFILL }},
15611
16
        { &ei_bgp_ls_warn, { "bgp.ls.warn", PI_PROTOCOL, PI_WARN, "Link State warning", EXPFILL }},
15612
16
        { &ei_bgp_ext_com_len_bad, { "bgp.ext_com.length.bad", PI_PROTOCOL, PI_ERROR, "Extended community length is wrong", EXPFILL }},
15613
16
        { &ei_bgp_evpn_nlri_rt_type_err, { "bgp.evpn.type", PI_MALFORMED, PI_ERROR, "EVPN Route Type is invalid", EXPFILL }},
15614
16
        { &ei_bgp_evpn_nlri_rt_len_err, { "bgp.evpn.len", PI_MALFORMED, PI_ERROR, "EVPN Length is invalid", EXPFILL }},
15615
16
        { &ei_bgp_evpn_nlri_esi_type_err, { "bgp.evpn.esi_type", PI_MALFORMED, PI_ERROR, "EVPN ESI Type is invalid", EXPFILL }},
15616
16
        { &ei_bgp_evpn_nlri_rt4_no_ip, { "bgp.evpn.no_ip", PI_PROTOCOL, PI_NOTE, "IP Address: NOT INCLUDED", EXPFILL }},
15617
16
        { &ei_bgp_attr_pmsi_tunnel_type, { "bgp.attr.pmsi.tunnel_type", PI_PROTOCOL, PI_ERROR, "Unknown Tunnel type", EXPFILL }},
15618
16
        { &ei_bgp_attr_pmsi_opaque_type, { "bgp.attr.pmsi.opaque_type", PI_PROTOCOL, PI_ERROR, "Invalid pmsi opaque type", EXPFILL }},
15619
16
        { &ei_bgp_attr_aigp_type, { "bgp.attr.aigp.type", PI_MALFORMED, PI_NOTE, "Unknown AIGP attribute type", EXPFILL}},
15620
16
        { &ei_bgp_prefix_length_err, { "bgp.prefix.length", PI_MALFORMED, PI_ERROR, "Invalid IPv6 prefix length", EXPFILL}},
15621
16
        { &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}},
15622
16
        { &ei_bgp_next_hop_ipv6_scope, { "bgp.next_hop.ipv6.scope", PI_PROTOCOL, PI_WARN, "Invalid IPv6 address scope", EXPFILL}},
15623
16
        { &ei_bgp_next_hop_rd_nonzero, { "bgp.next_hop.rd.nonzero", PI_PROTOCOL, PI_WARN, "Route Distinguisher in Next Hop Network Address nonzero", EXPFILL}},
15624
16
        { &ei_bgp_mup_unknown_at, { "bgp.mup.unknown_at", PI_PROTOCOL, PI_ERROR, "Unknown architecture type", EXPFILL }},
15625
16
        { &ei_bgp_mup_unknown_rt, { "bgp.mup.unknown_rt", PI_PROTOCOL, PI_ERROR, "Unknown route type", EXPFILL }},
15626
16
        { &ei_bgp_mup_nlri_addr_len_err, { "bgp.mup.nlri.addr_len_err", PI_PROTOCOL, PI_ERROR, "Address length invalid", EXPFILL }},
15627
16
        { &ei_bgp_mup_nlri_tlv_len_err, { "bgp.mup.nlri.tlv_len_err", PI_MALFORMED, PI_ERROR, "TLV length invalid", EXPFILL }},
15628
16
    };
15629
15630
16
    module_t *bgp_module;
15631
16
    expert_module_t* expert_bgp;
15632
15633
16
    static const enum_val_t asn_len[] = {
15634
16
        {"auto-detect", "Auto-detect", 0},
15635
16
        {"2", "2 octet", 2},
15636
16
        {"4", "4 octet", 4},
15637
16
        {NULL, NULL, -1}
15638
16
    };
15639
15640
16
    proto_bgp = proto_register_protocol("Border Gateway Protocol", "BGP", "bgp");
15641
16
    proto_register_field_array(proto_bgp, hf, array_length(hf));
15642
16
    proto_register_subtree_array(ett, array_length(ett));
15643
16
    expert_bgp = expert_register_protocol(proto_bgp);
15644
16
    expert_register_field_array(expert_bgp, ei, array_length(ei));
15645
15646
16
    bgp_module = prefs_register_protocol(proto_bgp, NULL);
15647
16
    prefs_register_bool_preference(bgp_module, "desegment",
15648
16
      "Reassemble BGP messages spanning multiple TCP segments",
15649
16
      "Whether the BGP dissector should reassemble messages spanning multiple TCP segments."
15650
16
      " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
15651
16
      &bgp_desegment);
15652
16
    prefs_register_bool_preference(bgp_module, "ext_msg",
15653
16
      "Allow BGP Extended Messages",
15654
16
      "Whether the BGP dissector should allow packets with a length exceeding 4096 octets.",
15655
16
      &bgp_ext_msg);
15656
16
    prefs_register_enum_preference(bgp_module, "asn_len",
15657
16
      "Length of the AS number",
15658
16
      "BGP dissector detect the length of the AS number in AS_PATH attributes automatically or manually (NOTE: Automatic detection is not 100% accurate)",
15659
16
      &bgp_asn_len, asn_len, false);
15660
15661
16
    bgp_handle = register_dissector("bgp", dissect_bgp, proto_bgp);
15662
16
    register_dissector("bgp.pdu", dissect_bgp_pdu, proto_bgp);
15663
16
}
15664
15665
void
15666
proto_reg_handoff_bgp(void)
15667
16
{
15668
16
    dissector_add_uint_with_preference("tcp.port", BGP_TCP_PORT, bgp_handle);
15669
16
}
15670
/*
15671
* Editor modelines - https://www.wireshark.org/tools/modelines.html
15672
*
15673
* Local variables:
15674
* c-basic-offset: 4
15675
* tab-width: 8
15676
* indent-tabs-mode: nil
15677
* End:
15678
*
15679
* ex: set shiftwidth=4 tabstop=8 expandtab:
15680
* :indentSize=4:tabSize=8:noTabs=true:
15681
*/