Coverage Report

Created: 2025-08-04 07:15

/src/wireshark/epan/dissectors/packet-bgp.c
Line
Count
Source (jump to first uncovered line)
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
62
 * TODO:
63
 * Destination Preference Attribute for BGP (work in progress)
64
 * RFC1863 A BGP/IDRP Route Server alternative to a full mesh routing
65
 */
66
/* (c) Copyright 2015, Pratik Yeole <pyeole@ncsu.edu>
67
   -  Fixed incorrect decoding of Network Layer Reachability Information (NLRI) in BGP UPDATE message with add-path support
68
 */
69
70
#include "config.h"
71
72
#include <epan/packet.h>
73
#include <epan/afn.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/ipproto.h>
79
#include <epan/tfs.h>
80
#include <wsutil/str_util.h>
81
#include "packet-ip.h"
82
#include "packet-tcp.h"
83
#include "packet-ldp.h"
84
#include "packet-bgp.h"
85
#include "packet-eigrp.h"
86
87
void proto_register_bgp(void);
88
void proto_reg_handoff_bgp(void);
89
90
static dissector_handle_t bgp_handle;
91
92
/* #define MAX_STR_LEN 256 */
93
94
/* some handy things to know */
95
14.1k
#define BGP_MAX_PACKET_SIZE            4096
96
99.7k
#define BGP_MARKER_SIZE                  16    /* size of BGP marker */
97
52.3k
#define BGP_HEADER_SIZE                  19    /* size of BGP header, including marker */
98
#define BGP_MIN_OPEN_MSG_SIZE            29
99
#define BGP_MIN_UPDATE_MSG_SIZE          23
100
2.36k
#define BGP_MIN_NOTIFICATION_MSG_SIZE    21
101
#define BGP_MIN_KEEPALVE_MSG_SIZE       BGP_HEADER_SIZE
102
14
#define BGP_TCP_PORT                    179
103
18.9k
#define BGP_ROUTE_DISTINGUISHER_SIZE      8
104
105
/* BGP message types */
106
699
#define BGP_OPEN          1
107
21.9k
#define BGP_UPDATE        2
108
2.53k
#define BGP_NOTIFICATION  3
109
346
#define BGP_KEEPALIVE     4
110
1.57k
#define BGP_ROUTE_REFRESH 5
111
944
#define BGP_CAPABILITY    6
112
950
#define BGP_ROUTE_REFRESH_CISCO 0x80
113
114
254k
#define BGP_SIZE_OF_PATH_ATTRIBUTE       2
115
116
117
/* attribute flags, from RFC1771 */
118
63.5k
#define BGP_ATTR_FLAG_OPTIONAL        0x80
119
63.5k
#define BGP_ATTR_FLAG_TRANSITIVE      0x40
120
63.5k
#define BGP_ATTR_FLAG_PARTIAL         0x20
121
63.5k
#define BGP_ATTR_FLAG_EXTENDED_LENGTH 0x10
122
14
#define BGP_ATTR_FLAG_UNUSED          0x0F
123
124
125
/* SSA flags */
126
#define BGP_SSA_TRANSITIVE    0x8000
127
1.67k
#define BGP_SSA_TYPE          0x7FFF
128
129
/* SSA Types */
130
341
#define BGP_SSA_L2TPv3          1
131
1
#define BGP_SSA_mGRE            2
132
3
#define BGP_SSA_IPSec           3
133
3
#define BGP_SSA_MPLS            4
134
209
#define BGP_SSA_L2TPv3_IN_IPSec 5
135
654
#define BGP_SSA_mGRE_IN_IPSec   6
136
137
/* BGP MPLS information */
138
32.9k
#define BGP_MPLS_BOTTOM_L_STACK 0x000001
139
28
#define BGP_MPLS_TRAFFIC_CLASS  0x00000E
140
56
#define BGP_MPLS_LABEL          0xFFFFF0
141
142
/* AS_PATH segment types */
143
14.8k
#define AS_SET             1   /* RFC1771 */
144
2.47k
#define AS_SEQUENCE        2   /* RFC1771 */
145
6.34k
#define AS_CONFED_SET      4   /* RFC1965 has the wrong values, corrected in  */
146
2.24k
#define AS_CONFED_SEQUENCE 3   /* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
147
148
/* BGPsec_PATH attributes */
149
6.55k
#define SEC_PATH_SEG_SIZE 6
150
151
/* OPEN message Optional Parameter types  */
152
250
#define BGP_OPTION_AUTHENTICATION    1   /* RFC1771 */
153
407
#define BGP_OPTION_CAPABILITY        2   /* RFC2842 */
154
183
#define BGP_OPTION_EXTENDED_LEN        255     /* RFC9072 */
155
156
/* https://www.iana.org/assignments/capability-codes/capability-codes.xhtml (last updated 2024-01-23) */
157
/* BGP capability code */
158
1.87k
#define BGP_CAPABILITY_RESERVED                      0  /* RFC5492 */
159
433
#define BGP_CAPABILITY_MULTIPROTOCOL                 1  /* RFC2858 */
160
1.27k
#define BGP_CAPABILITY_ROUTE_REFRESH                 2  /* RFC2918 */
161
594
#define BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING   3  /* RFC5291 */
162
#define BGP_CAPABILITY_MULTIPLE_ROUTE_DEST           4  /* RFC8277 Deprecated */
163
728
#define BGP_CAPABILITY_EXTENDED_NEXT_HOP             5  /* RFC5549 */
164
#define BGP_CAPABILITY_EXTENDED_MESSAGE              6  /* draft-ietf-idr-bgp-extended-messages */
165
490
#define BGP_CAPABILITY_BGPSEC                        7  /* RFC8205 */
166
#define BGP_CAPABILITY_MULTIPLE_LABELS               8  /* RFC8277 */
167
439
#define BGP_CAPABILITY_BGP_ROLE                      9  /* RFC9234 */
168
907
#define BGP_CAPABILITY_GRACEFUL_RESTART             64  /* RFC4724 */
169
422
#define BGP_CAPABILITY_4_OCTET_AS_NUMBER            65  /* RFC6793 */
170
#define BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO     66  /* Cisco Dynamic capability*/
171
418
#define BGP_CAPABILITY_DYNAMIC_CAPABILITY           67  /* draft-ietf-idr-dynamic-cap */
172
#define BGP_CAPABILITY_MULTISESSION                 68  /* draft-ietf-idr-bgp-multisession */
173
621
#define BGP_CAPABILITY_ADDITIONAL_PATHS             69  /* [RFC7911] */
174
395
#define BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH       70  /* [RFC7313] */
175
#define BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART  71  /* draft-uttaro-idr-bgp-persistence */
176
1.48k
#define BGP_CAPABILITY_CP_ORF                       72  /* [RFC7543] */
177
194
#define BGP_CAPABILITY_FQDN                         73  /* draft-walton-bgp-hostname-capability */
178
263
#define BGP_CAPABILITY_BFD_STRICT                   74  /* draft-ietf-idr-bgp-bfd-strict-mode */
179
194
#define BGP_CAPABILITY_SOFT_VERSION                 75  /* draft-abraitis-bgp-version-capability */
180
#define BGP_CAPABILITY_PATHS_LIMIT                  76  /* draft-abraitis-idr-addpath-paths-limit */
181
195
#define BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP          77  /* draft-white-linklocal-capability */
182
613
#define BGP_CAPABILITY_ROUTE_REFRESH_CISCO         128  /* Cisco, RFC8810 */
183
#define BGP_CAPABILITY_RPD_CISCO                   129  /* Cisco, RFC8810 */
184
203
#define BGP_CAPABILITY_ORF_CISCO                   130  /* Cisco, RFC8810 */
185
678
#define BGP_CAPABILITY_MULTISESSION_CISCO          131  /* Cisco, RFC8810 */
186
#define BGP_CAPABILITY_FQDN_CISCO                  184  /* Cisco, RFC8810 */
187
#define BGP_CAPABILITY_OPERATIONAL_MSG_CISCO       185  /* Cisco, RFC8810 */
188
189
90
#define BGP_ORF_COMM            0x02 /* unknown */
190
157
#define BGP_ORF_EXTCOMM         0x03 /* unknown */
191
223
#define BGP_ORF_ASPATH          0x04 /* draft-ietf-idr-aspath-orf (expired) */
192
71
#define BGP_ORF_PREFIX          0x40 /* RFC5292 */
193
270
#define BGP_ORF_CP_ORF          0x41 /* RFC7543 */
194
336
#define BGP_ORF_VPN_PREFIX      0x42 /* draft-ietf-idr-vpn-prefix-orf-06 */
195
365
#define BGP_ORF_PREFIX_CISCO    0x80 /* Cisco, same as 0x40 */
196
403
#define BGP_ORF_COMM_CISCO      0x81 /* Cisco */
197
470
#define BGP_ORF_EXTCOMM_CISCO   0x82 /* Cisco */
198
664
#define BGP_ORF_ASPATH_CISCO    0x83 /* Cisco */
199
200
/* RFC5291 */
201
1.95k
#define BGP_ORF_ACTION      0xc0
202
#define BGP_ORF_ADD         0x00
203
#define BGP_ORF_REMOVE      0x01
204
1.94k
#define BGP_ORF_REMOVEALL   0x02
205
206
14
#define BGP_ORF_MATCH       0x20
207
#define BGP_ORF_PERMIT      0x00
208
#define BGP_ORF_DENY        0x01
209
210
/* well-known communities, as defined by IANA  */
211
/* https://www.iana.org/assignments/bgp-well-known-communities/bgp-well-known-communities.xhtml */
212
#define BGP_COMM_GRACEFUL_SHUTDOWN   0xFFFF0000
213
#define BGP_COMM_ACCEPT_OWN          0xFFFF0001
214
#define BGP_COMM_RT_FLTR_XLTD_V4     0xFFFF0002
215
#define BGP_COMM_RT_FLTR_V4          0xFFFF0003
216
#define BGP_COMM_RT_FLTR_XLTD_V6     0xFFFF0004
217
#define BGP_COMM_RT_FLTR_V6          0xFFFF0005
218
#define BGP_COMM_LLGR_STALE          0xFFFF0006
219
#define BGP_COMM_NO_LLGR             0xFFFF0007
220
#define BGP_COMM_ACCEPT_OWN_HOP      0xFFFF0008
221
#define BGP_COMM_STANDBY_PE          0xFFFF0009
222
#define BGP_COMM_BLACKHOLE           0xFFFF029A
223
#define BGP_COMM_NO_EXPORT           0xFFFFFF01
224
#define BGP_COMM_NO_ADVERTISE        0xFFFFFF02
225
#define BGP_COMM_NO_EXPORT_SUBCONFED 0xFFFFFF03
226
#define BGP_COMM_NOPEER              0xFFFFFF04
227
2.02k
#define FOURHEX0                     0x00000000
228
669
#define FOURHEXF                     0xFFFF0000
229
230
/* IANA assigned AS */
231
1.26k
#define BGP_AS_TRANS        23456
232
233
/* attribute types */
234
1.08k
#define BGPTYPE_ORIGIN               1 /* RFC4271           */
235
2.05k
#define BGPTYPE_AS_PATH              2 /* RFC4271           */
236
833
#define BGPTYPE_NEXT_HOP             3 /* RFC4271           */
237
813
#define BGPTYPE_MULTI_EXIT_DISC      4 /* RFC4271           */
238
492
#define BGPTYPE_LOCAL_PREF           5 /* RFC4271           */
239
449
#define BGPTYPE_ATOMIC_AGGREGATE     6 /* RFC4271           */
240
449
#define BGPTYPE_AGGREGATOR           7 /* RFC4271           */
241
727
#define BGPTYPE_COMMUNITIES          8 /* RFC1997           */
242
365
#define BGPTYPE_ORIGINATOR_ID        9 /* RFC4456           */
243
510
#define BGPTYPE_CLUSTER_LIST        10 /* RFC4456           */
244
#define BGPTYPE_DPA                 11 /* DPA (deprecated) [RFC6938]  */
245
#define BGPTYPE_ADVERTISER          12 /* ADVERTISER (historic) (deprecated) [RFC1863][RFC4223][RFC6938] */
246
#define BGPTYPE_RCID_PATH           13 /* RCID_PATH / CLUSTER_ID (historic) (deprecated) [RFC1863][RFC4223][RFC6938] */
247
8.76k
#define BGPTYPE_MP_REACH_NLRI       14 /* RFC4760           */
248
19.7k
#define BGPTYPE_MP_UNREACH_NLRI     15 /* RFC4760           */
249
1.45k
#define BGPTYPE_EXTENDED_COMMUNITY  16 /* RFC4360           */
250
5.37k
#define BGPTYPE_AS4_PATH            17 /* RFC 6793          */
251
1.62k
#define BGPTYPE_AS4_AGGREGATOR      18 /* RFC 6793          */
252
1.15k
#define BGPTYPE_SAFI_SPECIFIC_ATTR  19 /* SAFI Specific Attribute (SSA) (deprecated) draft-kapoor-nalawade-idr-bgp-ssa-00.txt */
253
#define BGPTYPE_CONNECTOR_ATTRIBUTE 20 /* Connector Attribute (deprecated) [RFC6037] */
254
#define BGPTYPE_AS_PATHLIMIT        21 /* AS_PATHLIMIT (deprecated) [draft-ietf-idr-as-pathlimit] */
255
3.03k
#define BGPTYPE_PMSI_TUNNEL_ATTR    22 /* RFC6514 */
256
981
#define BGPTYPE_TUNNEL_ENCAPS_ATTR  23 /* RFC5512 */
257
#define BGPTYPE_TRAFFIC_ENGINEERING 24 /* Traffic Engineering [RFC5543] */
258
#define BGPTYPE_IPV6_ADDR_SPEC_EC   25 /* IPv6 Address Specific Extended Community [RFC5701] */
259
512
#define BGPTYPE_AIGP                26 /* RFC7311 */
260
#define BGPTYPE_PE_DISTING_LABLES   27 /* PE Distinguisher Labels [RFC6514] */
261
#define BGPTYPE_BGP_ENTROPY_LABEL   28 /* BGP Entropy Label Capability Attribute (deprecated) [RFC6790][RFC7447] */
262
2.50k
#define BGPTYPE_LINK_STATE_ATTR     29 /* RFC7752 */
263
#define BGPTYPE_30                  30 /* Deprecated [RFC8093] */
264
#define BGPTYPE_31                  31 /* Deprecated [RFC8093] */
265
553
#define BGPTYPE_LARGE_COMMUNITY     32 /* RFC8092 */
266
912
#define BGPTYPE_BGPSEC_PATH         33 /* BGPsec_PATH [RFC8205] */
267
290
#define BGPTYPE_OTC                 35 /* BGP Only to Customer [RFC9234] */
268
503
#define BGPTYPE_D_PATH              36 /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
269
#define BGPTYPE_SFP_ATTRIBUTE       37 /* SFP Attribute [RFC9015] */
270
#define BGPTYPE_BFD_DISCRIMINATOR   38 /* BFD Discriminator [RFC9026] */
271
#define BGPTYPE_NEXT_HOP_DEP_CAP    39 /* BGP Next Hop Dependent Capabilities draft-ietf-idr-entropy-label-13 */
272
2.07k
#define BGPTYPE_BGP_PREFIX_SID      40 /* BGP Prefix-SID [RFC8669] */
273
2.99k
#define BGPTYPE_LINK_STATE_OLD_ATTR 99 /* squatted value used by at least 2
274
                                          implementations before IANA assignment */
275
1.17k
#define BGPTYPE_ATTR_SET           128 /* RFC6368           */
276
#define BGPTYPE_129                129 /* Deprecated [RFC8093] */
277
#define BGPTYPE_241                241 /* Deprecated [RFC8093] */
278
#define BGPTYPE_242                242 /* Deprecated [RFC8093] */
279
#define BGPTYPE_243                243 /* Deprecated [RFC8093] */
280
281
/*EVPN Route Types */
282
969
#define EVPN_AD_ROUTE                   1
283
2.32k
#define EVPN_MAC_ROUTE                  2
284
517
#define EVPN_INC_MCAST_TREE             3
285
561
#define EVPN_ETH_SEGMENT_ROUTE          4
286
2.47k
#define EVPN_IP_PREFIX_ROUTE            5  /* draft-rabadan-l2vpn-evpn-prefix-advertisement */
287
458
#define EVPN_MC_ETHER_TAG_ROUTE         6  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
288
2.65k
#define EVPN_IGMP_JOIN_ROUTE            7  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
289
2.23k
#define EVPN_IGMP_LEAVE_ROUTE           8  /* draft-ietf-bess-evpn-igmp-mld-proxy-03 */
290
#define EVPN_PER_REG_I_PMSI_A_D_ROUTE   9  /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
291
18.9k
#define EVPN_S_PMSI_A_D_ROUTE           10 /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
292
#define EVPN_LEAF_A_D_ROUTE             11 /* draft-ietf-bess-evpn-bum-procedure-updates-7 */
293
294
14
#define EVPN_IGMP_MC_FLAG_V1                0x01
295
14
#define EVPN_IGMP_MC_FLAG_V2                0x02
296
14
#define EVPN_IGMP_MC_FLAG_V3                0x04
297
14
#define EVPN_IGMP_MC_FLAG_IE                0x08
298
14
#define EVPN_IGMP_MC_FLAG_RESERVED          0xF0
299
300
/* NLRI type as define in BGP flow spec RFC */
301
1.29k
#define BGPNLRI_FSPEC_DST_PFIX      1 /* RFC 5575         */
302
910
#define BGPNLRI_FSPEC_SRC_PFIX      2 /* RFC 5575         */
303
306
#define BGPNLRI_FSPEC_IP_PROTO      3 /* RFC 5575         */
304
996
#define BGPNLRI_FSPEC_PORT          4 /* RFC 5575         */
305
237
#define BGPNLRI_FSPEC_DST_PORT      5 /* RFC 5575         */
306
480
#define BGPNLRI_FSPEC_SRC_PORT      6 /* RFC 5575         */
307
297
#define BGPNLRI_FSPEC_ICMP_TP       7 /* RFC 5575         */
308
281
#define BGPNLRI_FSPEC_ICMP_CD       8 /* RFC 5575         */
309
1.51k
#define BGPNLRI_FSPEC_TCP_FLAGS     9 /* RFC 5575         */
310
245
#define BGPNLRI_FSPEC_PCK_LEN      10 /* RFC 5575         */
311
924
#define BGPNLRI_FSPEC_DSCP         11 /* RFC 5575         */
312
1.23k
#define BGPNLRI_FSPEC_FRAGMENT     12 /* RFC 5575         */
313
314
/* BGP flow spec NLRI operator bitmask */
315
112k
#define BGPNLRI_FSPEC_END_OF_LST         0x80
316
114k
#define BGPNLRI_FSPEC_AND_BIT            0x40
317
14
#define BGPNLRI_FSPEC_VAL_LEN            0x30
318
14
#define BGPNLRI_FSPEC_UNUSED_BIT4        0x08
319
14
#define BGPNLRI_FSPEC_UNUSED_BIT5        0x04
320
114k
#define BGPNLRI_FSPEC_LESS_THAN          0x04
321
114k
#define BGPNLRI_FSPEC_GREATER_THAN       0x02
322
114k
#define BGPNLRI_FSPEC_EQUAL              0x01
323
14
#define BGPNLRI_FSPEC_TCPF_NOTBIT        0x02
324
14
#define BGPNLRI_FSPEC_TCPF_MATCHBIT      0x01
325
28
#define BGPNLRI_FSPEC_DSCP_BITMASK       0x3F
326
327
/* BGP flow spec specific filter value: TCP flags, Packet fragment ... */
328
36.3k
#define BGPNLRI_FSPEC_TH_FIN  0x01
329
36.3k
#define BGPNLRI_FSPEC_TH_SYN  0x02
330
36.3k
#define BGPNLRI_FSPEC_TH_RST  0x04
331
36.3k
#define BGPNLRI_FSPEC_TH_PUSH 0x08
332
36.3k
#define BGPNLRI_FSPEC_TH_ACK  0x10
333
36.3k
#define BGPNLRI_FSPEC_TH_URG  0x20
334
14
#define BGPNLRI_FSPEC_TH_ECN  0x40
335
14
#define BGPNLRI_FSPEC_TH_CWR  0x80
336
337
22.3k
#define BGPNLRI_FSPEC_FG_DF   0x01
338
22.3k
#define BGPNLRI_FSPEC_FG_ISF  0x02
339
22.3k
#define BGPNLRI_FSPEC_FG_FF   0x04
340
22.3k
#define BGPNLRI_FSPEC_FG_LF   0x08
341
342
/* Extended community type */
343
/* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
344
/* BGP transitive extended community type high octet */
345
/* Range 0x00-0x3f First Come First Served */
346
/* Range 0x80-0x8f Reserved for Experimental */
347
/* Range 0x90-0xbf Standards Action */
348
349
14
#define BGP_EXT_COM_TYPE_AUTH               0x80    /* FCFS or Standard/Early/Experimental allocated */
350
14
#define BGP_EXT_COM_TYPE_TRAN               0x40    /* Non-transitive or Transitive */
351
352
614
#define BGP_EXT_COM_TYPE_HIGH_TR_AS2        0x00    /* Transitive Two-Octet AS-Specific Extended Community */
353
246
#define BGP_EXT_COM_TYPE_HIGH_TR_IP4        0x01    /* Transitive IPv4-Address-specific Extended Community */
354
83
#define BGP_EXT_COM_TYPE_HIGH_TR_AS4        0x02    /* Transitive Four-Octet AS-Specific Extended Community */
355
529
#define BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE     0x03    /* Transitive Opaque Extended Community */
356
144
#define BGP_EXT_COM_TYPE_HIGH_TR_QOS        0x04    /* QoS Marking [Thomas_Martin_Knoll] */
357
96
#define BGP_EXT_COM_TYPE_HIGH_TR_COS        0x05    /* CoS Capability [Thomas_Martin_Knoll] */
358
495
#define BGP_EXT_COM_TYPE_HIGH_TR_EVPN       0x06    /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
359
#define BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I     0x07    /* FlowSpec Transitive Extended Communities [draft-ietf-idr-flowspec-interfaceset] */
360
5
#define BGP_EXT_COM_TYPE_HIGH_TR_FLOW       0x08    /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
361
#define BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R     0x09    /* FlowSpec Redirect to indirection-id Extended Community [draft-ietf-idr-flowspec-path-redirect] */
362
#define BGP_EXT_COM_TYPE_HIGH_TR_TP_CLASS   0x0a    /* Transitive Transport Class [draft-ietf-idr-bgp-ct-30] */
363
#define BGP_EXT_COM_TYPE_HIGH_TR_SFC        0x0b    /* Transitive SFC [RFC9015] */
364
163
#define BGP_EXT_COM_TYPE_HIGH_TR_MUP        0x0c    /* Transitive MUP Extended Community */
365
775
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT        0x80    /* Generic Transitive Extended Community [RFC7153][RFC9184] */
366
139
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT_2      0x81    /* Generic Transitive Extended Community Part 2 [RFC8955][RFC9184] */
367
142
#define BGP_EXT_COM_TYPE_HIGH_TR_EXT_3      0x82    /* Generic Transitive Extended Community Part 3 [RFC8955][RFC9184] */
368
826
#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 */
369
370
/* BGP non transitive extended community type high octet */
371
/* 0x40-0x7f First Come First Served */
372
/* 0xc0-0xcf Reserved for Experimental Use (see [RFC4360]) */
373
/* 0xd0-0xff Standards Action */
374
/* 0x45-0x7f Unassigned */
375
153
#define BGP_EXT_COM_TYPE_HIGH_NTR_AS2       0x40    /* Non-Transitive Two-Octet AS-Specific Extended Community [RFC7153] */
376
68
#define BGP_EXT_COM_TYPE_HIGH_NTR_IP4       0x41    /* Non-Transitive IPv4-Address-specific Extended Community [RFC7153] */
377
66
#define BGP_EXT_COM_TYPE_HIGH_NTR_AS4       0x42    /* Non-Transitive Four-Octet AS-Specific Extended Community [RFC7153] */
378
150
#define BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE    0x43    /* Non-Transitive Opaque Extended Community [RFC7153] */
379
212
#define BGP_EXT_COM_TYPE_HIGH_NTR_QOS       0x44    /* QoS Marking [Thomas_Martin_Knoll] */
380
#define BGP_EXT_COM_TYPE_HIGH_NTR_FLOWSPEC  0x47    /* FlowSpec Non-Transitive Extended Communities [draft-ietf-idr-flowspec-interfaceset] */
381
#define BGP_EXT_COM_TYPE_HIGH_NTR_TRANSPORT 0x4a    /* Non-Transitive Transport Class [draft-ietf-idr-bgp-ct-30] */
382
383
/* EVPN Extended Community Sub-Types */
384
73
#define BGP_EXT_COM_STYPE_EVPN_MMAC         0x00    /* MAC Mobility [draft-ietf-l2vpn-pbb-evpn] */
385
68
#define BGP_EXT_COM_STYPE_EVPN_LABEL        0x01    /* ESI MPLS Label [draft-ietf-l2vpn-evpn] */
386
72
#define BGP_EXT_COM_STYPE_EVPN_IMP          0x02    /* ES Import [draft-sajassi-l2vpn-evpn-segment-route] */
387
71
#define BGP_EXT_COM_STYPE_EVPN_ROUTERMAC    0x03    /* draft-sajassi-l2vpn-evpn-inter-subnet-forwarding */
388
67
#define BGP_EXT_COM_STYPE_EVPN_L2ATTR       0x04    /* RFC 8214 */
389
66
#define BGP_EXT_COM_STYPE_EVPN_ETREE        0x05    /* RFC 8317 */
390
#define BGP_EXT_COM_STYPE_EVPN_DF           0x06    /* RFC 8584 */
391
#define BGP_EXT_COM_STYPE_EVPN_ISID         0x07    /* draft-sajassi-bess-evpn-virtual-eth-segment */
392
#define BGP_EXT_COM_STYPE_EVPN_ND           0x08    /* draft-snr-bess-evpn-na-flags */
393
#define BGP_EXT_COM_STYPE_EVPN_MCFLAGS      0x09    /* draft-ietf-bess-evpn-igmp-mld-proxy */
394
#define BGP_EXT_COM_STYPE_EVPN_EVIRT0       0x0a    /* draft-ietf-bess-evpn-igmp-mld-proxy */
395
#define BGP_EXT_COM_STYPE_EVPN_EVIRT1       0x0b    /* draft-ietf-bess-evpn-igmp-mld-proxy */
396
#define BGP_EXT_COM_STYPE_EVPN_EVIRT2       0x0c    /* draft-ietf-bess-evpn-igmp-mld-proxy */
397
#define BGP_EXT_COM_STYPE_EVPN_EVIRT3       0x0d    /* draft-ietf-bess-evpn-igmp-mld-proxy */
398
#define BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT   0x0e    /* draft-sajassi-bess-evpn-ac-aware-bundling */
399
#define BGP_EXT_COM_STYPE_EVPN_SVC_CARV_TS  0x0f    /* draft-ietf-bess-evpn-fast-df-recovery */
400
#define BGP_EXT_COM_STYPE_EVPN_LINK_BW      0x10    /* draft-ietf-bess-evpn-unequal-lb */
401
#define BGP_EXT_COM_STYPE_EVPN_RT_EC        0x15    /* draft-zzhang-idr-rt-derived-community */
402
403
/* RFC 7432 Flag single active mode */
404
82
#define BGP_EXT_COM_ESI_LABEL_FLAGS         0x01    /* bitmask: set for single active multi-homing site */
405
406
/* RFC 7432 Flag Sticky/Static MAC */
407
87
#define BGP_EXT_COM_EVPN_MMAC_STICKY        0x01    /* Bitmask: Set for sticky/static MAC address */
408
409
/* RFC 8214 Flags EVPN L2 Attributes */
410
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_B         0x0001  /* Backup PE */
411
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_P         0x0002  /* Primary PE */
412
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_C         0x0004  /* Control word required */
413
/* draft-yu-bess-evpn-l2-attributes-04 */
414
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_F         0x0008  /* Send and receive flow label */
415
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI        0x0010  /* CWI extended community can be included */
416
14
#define BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED  0xFFE0  /* Reserved */
417
418
/* RFC 8317 Flags EVPN E-Tree Attributes */
419
14
#define BGP_EXT_COM_EVPN_ETREE_FLAG_L         0x01  /* Leaf-Indication */
420
14
#define BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED  0xFE  /* Reserved */
421
422
/* EPVN route AD NLRI ESI type */
423
486
#define BGP_NLRI_EVPN_ESI_VALUE             0x00    /* ESI type 0, 9 bytes integer */
424
98
#define BGP_NLRI_EVPN_ESI_LACP              0x01    /* ESI type 1, LACP 802.1AX */
425
140
#define BGP_NLRI_EVPN_ESI_MSTP              0x02    /* ESI type 2, MSTP defined ESI */
426
68
#define BGP_NLRI_EVPN_ESI_MAC               0x03    /* ESI type 3, MAC allocated value */
427
3.67k
#define BGP_NLRI_EVPN_ESI_RID               0x04    /* ESI type 4, Router ID as ESI */
428
107
#define BGP_NLRI_EVPN_ESI_ASN               0x05    /* ESI type 5, ASN as ESI */
429
324
#define BGP_NLRI_EVPN_ESI_RES               0xFF    /* ESI 0xFF reserved */
430
431
432
/* Transitive Two-Octet AS-Specific Extended Community Sub-Types */
433
#define BGP_EXT_COM_STYPE_AS2_RT        0x02    /* Route Target [RFC4360] */
434
#define BGP_EXT_COM_STYPE_AS2_RO        0x03    /* Route Origin [RFC4360] */
435
//#define BGP_EXT_COM_STYPE_AS2_LBW       0x04    /* Juniper Transitive Link Bandwidth */
436
#define BGP_EXT_COM_STYPE_AS2_OSPF_DID  0x05    /* OSPF Domain Identifier [RFC4577] */
437
#define BGP_EXT_COM_STYPE_AS2_RT_AGG_P  0x06    /* Route Aggregation Parameter */
438
#define BGP_EXT_COM_STYPE_AS2_DCOLL     0x08    /* BGP Data Collection [RFC4384] */
439
#define BGP_EXT_COM_STYPE_AS2_SRC_AS    0x09    /* Source AS [RFC6514] */
440
#define BGP_EXT_COM_STYPE_AS2_L2VPN     0x0a    /* L2VPN Identifier [RFC6074] */
441
#define BGP_EXT_COM_STYPE_AS2_CVPND     0x10    /* Cisco VPN-Distinguisher [Eric_Rosen] */
442
#define BGP_EXT_COM_STYPE_AS2_RT_REC    0x13    /* Route-Target Record [draft-ietf-bess-service-chaining] */
443
#define BGP_EXT_COM_STYPE_AS2_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community] */
444
//#define BGP_EXT_COM_STYPE_AS2_VNI       0x80    /* Virtual-Network Identifier Extended Community */
445
446
/* Non-Transitive Two-Octet AS-Specific Extended Community Sub-Types */
447
75
#define BGP_EXT_COM_STYPE_AS2_LBW       0x04    /* Link Bandwidth Extended Community [draft-ietf-idr-link-bandwidth-00] */
448
#define BGP_EXT_COM_STYPE_AS2_VNI       0x80    /* Virtual-Network Identifier Extended Community [draft-drao-bgp-l3vpn-virtual-network-overlays] */
449
450
/* Transitive Four-Octet AS-Specific Extended Community Sub-Types */
451
#define BGP_EXT_COM_STYPE_AS4_RT        0x02    /* Route Target [RFC5668] */
452
#define BGP_EXT_COM_STYPE_AS4_RO        0x03    /* Route Origin [RFC5668] */
453
#define BGP_EXT_COM_STYPE_AS4_GEN       0x04    /* Generic (deprecated) [draft-ietf-idr-as4octet-extcomm-generic-subtype] */
454
#define BGP_EXT_COM_STYPE_AS4_OSPF_DID  0x05    /* OSPF Domain Identifier [RFC4577] */
455
#define BGP_EXT_COM_STYPE_AS4_BGP_DC    0x08    /* BGP Data Collection [RFC4384] */
456
#define BGP_EXT_COM_STYPE_AS4_S_AS      0x09    /* Source AS [RFC6514] */
457
#define BGP_EXT_COM_STYPE_AS4_CIS_V     0x10    /* Cisco VPN Identifier [Eric_Rosen] */
458
#define BGP_EXT_COM_STYPE_AS4_RT_REC    0x13    /* Route-Target Record [draft-ietf-bess-service-chaining] */
459
#define BGP_EXT_COM_STYPE_AS4_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community] */
460
461
/* Non-Transitive Four-Octet AS-Specific Extended Community Sub-Types */
462
463
/*
464
 * #define BGP_EXT_COM_STYPE_AS4_GEN       0x04
465
 * Generic (deprecated) [draft-ietf-idr-as4octet-extcomm-generic-subtype]
466
*/
467
468
/* Transitive IPv4-Address-Specific Extended Community Sub-Types */
469
470
#define BGP_EXT_COM_STYPE_IP4_RT        0x02    /* Route Target [RFC4360] */
471
#define BGP_EXT_COM_STYPE_IP4_RO        0x03    /* Route Origin [RFC4360] */
472
#define BGP_EXT_COM_STYPE_IP4_IFIT_TAIL 0x04    /* IPv4-Address-Specific IFIT Tail Community [draft-wang-idr-bgp-ifit-capabilities] */
473
#define BGP_EXT_COM_STYPE_IP4_OSPF_DID  0x05    /* OSPF Domain Identifier [RFC4577] */
474
66
#define BGP_EXT_COM_STYPE_IP4_OSPF_RID  0x07    /* OSPF Router ID [RFC4577] */
475
#define BGP_EXT_COM_STYPE_IP4_NODE_TGT  0x09    /* Node Target Extended Community [draft-ietf-idr-node-target-ext-comm] */
476
#define BGP_EXT_COM_STYPE_IP4_L2VPN     0x0a    /* L2VPN Identifier [RFC6074] */
477
#define BGP_EXT_COM_STYPE_IP4_VRF_I     0x0b    /* VRF Route Import [RFC6514] */
478
#define BGP_EXT_COM_STYPE_IP4_FLOW_RDR  0x0c    /* Flow-spec Redirect to IPv4 [draft-ietf-idr-flowspec-redirect] */
479
#define BGP_EXT_COM_STYPE_IP4_CIS_D     0x10    /* Cisco VPN-Distinguisher [Eric_Rosen] */
480
#define BGP_EXT_COM_STYPE_IP4_SEG_NH    0x12    /* Inter-area P2MP Segmented Next-Hop [RFC7524] */
481
#define BGP_EXT_COM_STYPE_IP4_RT_REC    0x13    /* Route-Target Record [draft-ietf-bess-service-chaining] */
482
#define BGP_EXT_COM_STYPE_IP4_VRF_RNH   0x14    /* VRF-Recursive-Next-Hop-Extended-Community */
483
#define BGP_EXT_COM_STYPE_IP4_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community-00] */
484
#define BGP_EXT_COM_STYPE_IP4_MVPN_RP   0x20    /* MVPN SA RP-address Extended Community [RFC9081] */
485
486
/* Transitive Opaque Extended Community Sub-Types */
487
488
#define BGP_EXT_COM_STYPE_OPA_COST      0x01    /* Cost Community [draft-ietf-idr-custom-decision] */
489
#define BGP_EXT_COM_STYPE_OPA_CP_OSPF   0x03    /* CP-ORF [RFC7543] */
490
#define BGP_EXT_COM_STYPE_OPA_EXTN_SRC  0x04    /* Extranet Source Extended Community [RFC7900] */
491
#define BGP_EXT_COM_STYPE_OPA_EXTN_SEP  0x05    /* Extranet Separation Extended Community [RFC7900] */
492
68
#define BGP_EXT_COM_STYPE_OPA_OSPF_RT   0x06    /* OSPF Route Type [RFC4577] */
493
#define BGP_EXT_COM_STYPE_OPA_PMSI_ATTR 0x07    /* Additional PMSI Tunnel Attribute Flags [RFC7902] */
494
#define BGP_EXT_COM_STYPE_OPA_CTX_LBL   0x08    /* Context-Specific Label Space ID Extended Community [RFC9573] */
495
0
#define BGP_EXT_COM_STYPE_OPA_COLOR     0x0b    /* Color Extended Community [RFC5512] */
496
312
#define BGP_EXT_COM_STYPE_OPA_ENCAP     0x0c    /* Encapsulation Extended Community [RFC5512] */
497
0
#define BGP_EXT_COM_STYPE_OPA_DGTW      0x0d    /* Default Gateway  [Yakov_Rekhter] */
498
#define BGP_EXT_COM_STYPE_OPA_PPMP_LBL  0x0e    /* Point-to-Point-to-Multipoint (PPMP) Label [Rishabh_Parekh] */
499
#define BGP_EXT_COM_STYPE_OPA_GRP_TAG   0x0f    /* BGP Group Policy Class Tag Extended Community [Dhananjaya_Rao] */
500
#define BGP_EXT_COM_STYPE_OPA_HSH_SRT   0x14    /* Consistent Hash Sort Order [draft-ietf-bess-service-chaining] */
501
#define BGP_EXT_COM_STYPE_OPA_GRP_PID   0x17    /* Group Policy ID Extended Community [draft-wlin-bess-group-policy-id-extended-community] */
502
#define BGP_EXT_COM_STYPE_OPA_LCM       0x1b    /* Local Color Mapping (LCM) [draft-ietf-idr-bgp-car-05] */
503
#define BGP_EXT_COM_STYPE_OPA_LOADBAL   0xaa    /* LoadBalance [draft-ietf-bess-service-chaining] */
504
505
/* BGP Cost Community Point of Insertion Types */
506
507
#define BGP_EXT_COM_COST_POI_ORIGIN     1       /* Evaluate after "Prefer lowest Origin" step */
508
#define BGP_EXT_COM_COST_POI_ASPATH     2       /* Evaluate after "Prefer shortest AS_PATH" step */
509
#define BGP_EXT_COM_COST_POI_MED        4       /* Evaluate after "Prefer lowest MED" step */
510
#define BGP_EXT_COM_COST_POI_LP         5       /* Evaluate after "Prefer highest Local Preference" step */
511
#define BGP_EXT_COM_COST_POI_AIGP       26      /* Evaluate after "Prefer lowest Accumulated IGP Cost" step */
512
#define BGP_EXT_COM_COST_POI_ABS        128     /* Pre-bestpath POI */
513
#define BGP_EXT_COM_COST_POI_IGP        129     /* Evaluate after "Prefer smallest IGP metric to next-hop" step */
514
#define BGP_EXT_COM_COST_POI_EI         130     /* Evaluate after "Prefer eBGP to iBGP" step */
515
#define BGP_EXT_COM_COST_POI_RID        131     /* Evaluate after "Prefer lowest BGP RID" step */
516
517
324
#define BGP_EXT_COM_COST_CID_REP        0x80    /* Bitmask - value replace/evaluate after bit */
518
519
/* BGP Tunnel Encapsulation Attribute Tunnel Types */
520
521
#define BGP_EXT_COM_TUNNEL_RESERVED     0       /* Reserved [RFC5512] */
522
#define BGP_EXT_COM_TUNNEL_L2TPV3       1       /* L2TPv3 over IP [RFC5512] */
523
#define BGP_EXT_COM_TUNNEL_GRE          2       /* GRE [RFC5512] */
524
#define BGP_EXT_COM_TUNNEL_ENDP         3       /* Transmit tunnel endpoint [RFC5566] */
525
#define BGP_EXT_COM_TUNNEL_IPSEC        4       /* IPsec in Tunnel-mode [RFC5566] */
526
#define BGP_EXT_COM_TUNNEL_IPIPSEC      5       /* IP in IP tunnel with IPsec Transport Mode [RFC5566] */
527
#define BGP_EXT_COM_TUNNEL_MPLSIP       6       /* MPLS-in-IP tunnel with IPsec Transport Mode [RFC5566] */
528
#define BGP_EXT_COM_TUNNEL_IPIP         7       /* IP in IP [RFC5512] */
529
5.90k
#define BGP_EXT_COM_TUNNEL_VXLAN        8       /* VXLAN Encapsulation [draft-sd-l2vpn-evpn-overlay] */
530
#define BGP_EXT_COM_TUNNEL_NVGRE        9       /* NVGRE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
531
#define BGP_EXT_COM_TUNNEL_MPLS         10      /* MPLS Encapsulation [draft-sd-l2vpn-evpn-overlay] */
532
#define BGP_EXT_COM_TUNNEL_MPLSGRE      11      /* MPLS in GRE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
533
1.95k
#define BGP_EXT_COM_TUNNEL_VXLANGPE     12      /* VxLAN GPE Encapsulation [draft-sd-l2vpn-evpn-overlay] */
534
#define BGP_EXT_COM_TUNNEL_MPLSUDP      13      /* MPLS in UDP Encapsulation [draft-ietf-l3vpn-end-system] */
535
#define BGP_EXT_COM_TUNNEL_IPV6_TUNNEL  14      /* IPv6 Tunnel  [Martin_Djernaes] */
536
#define BGP_EXT_COM_TUNNEL_SE_TE_POLICY 15      /* SR TE Policy Type [draft-ietf-idr-sr-policy-safi-04] */
537
#define BGP_EXT_COM_TUNNEL_BARE         16      /* Bare [Nischal_Sheth] */
538
#define BGP_EXT_COM_TUNNEL_SR_TUNNEL    17      /* SR Tunnel [RFC9125] */
539
#define BGP_EXT_COM_TUNNEL_CLOUD_SEC    18      /* Cloud Security [Ramesh_Babu_Yakkala] */
540
#define BGP_EXT_COM_TUNNEL_GENEVE_ENCAP 19      /* Geneve Encapsulation [RFC8926] */
541
#define BGP_EXT_COM_TUNNEL_ANY_ENCAP    20      /* Any Encapsulation [draft-ietf-bess-bgp-multicast-controller-06] */
542
#define BGP_EXT_COM_TUNNEL_GTP_TUNNEL   21      /* GTP Tunnel Type [Keyur_Patel][Tetsuya_Murakami] */
543
#define BGP_EXT_COM_TUNNEL_DPS_TUNNEL   22      /* Dynamic Path Selection (DPS) Tunnel Encapsulation [Venkit_Kasiviswanathan] */
544
#define BGP_EXT_COM_TUNNEL_OPE          23      /* Originating PE (OPE) [draft-heitz-bess-evpn-option-b-01] */
545
#define BGP_EXT_COM_TUNNEL_DYN_DPS_POL  24      /* Dynamic Path Selection (DPS) Policy [Sarah_Chen] */
546
#define BGP_EXT_COM_TUNNEL_SDWAN_HYB    25      /* SDWAN-Hybrid [draft-ietf-idr-sdwan-edge-discovery-04] */
547
#define BGP_EXT_COM_TUNNEL_X_OVER_UDP   26      /* X-over-UDP [Jeffrey_Haas] */
548
#define BGP_EXT_COM_TUNNEL_DES_ENCAP    27      /* Distributed Etherlink Switch (DES) Tunnel Encapsulation [David_Cronin] */
549
550
/* Non-Transitive Opaque Extended Community Sub-Types */
551
552
#define BGP_EXT_COM_STYPE_OPA_OR_VAL_ST 0x00    /* BGP Origin Validation State [draft-ietf-sidr-origin-validation-signaling] */
553
155
#define BGP_EXT_COM_STYPE_OPA_COST      0x01    /* Cost Community [draft-ietf-idr-custom-decision] */
554
#define BGP_EXT_COM_STYPE_OPA_RT        0x02    /* Route Target [Nischal_Sheth] */
555
#define BGP_EXT_COM_STYPE_OPA_RT_EC     0x15    /* RT-derived-EC [draft-zzhang-idr-rt-derived-community-00] */
556
557
/* Transitive MUP Extended Community Sub-Types */
558
80
#define BGP_EXT_COM_STYPE_MUP_DIRECT_SEG 0x00
559
560
/* BGP Generic Transitive Experimental Use Extended Community Sub-Types */
561
562
72
#define BGP_EXT_COM_STYPE_EXP_OSPF_RT   0x00    /* OSPF Route Type, deprecated [RFC4577] */
563
66
#define BGP_EXT_COM_STYPE_EXP_OSPF_RID  0x01    /* OSPF Router ID, deprecated [RFC4577] */
564
#define BGP_EXT_COM_STYPE_EXP_SEC_GROUP 0x04    /* Security Group [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#security-group] */
565
67
#define BGP_EXT_COM_STYPE_EXP_OSPF_DID  0x05    /* OSPF Domain ID, deprecated [RFC4577] */
566
66
#define BGP_EXT_COM_STYPE_EXP_F_TR      0x06    /* Flow spec traffic-rate [RFC5575] */
567
161
#define BGP_EXT_COM_STYPE_EXP_F_TA      0x07    /* Flow spec traffic-action [RFC5575] */
568
66
#define BGP_EXT_COM_STYPE_EXP_F_RED     0x08    /* Flow spec redirect [RFC5575] */
569
66
#define BGP_EXT_COM_STYPE_EXP_F_RMARK   0x09    /* Flow spec traffic-remarking [RFC5575] */
570
67
#define BGP_EXT_COM_STYPE_EXP_L2        0x0a    /* Layer2 Info Extended Community [RFC4761] */
571
66
#define BGP_EXT_COM_STYPE_EXP_ETREE     0x0b    /* E-Tree Info [RFC7796] */
572
#define BGP_EXT_COM_STYPE_EXP_FLOW_RATE 0x0c    /* Flow spec traffic-rate-packets [RFC8955] */
573
#define BGP_EXT_COM_STYPE_EXP_FLOW_SFC  0x0d    /* Flow Specification for SFC Classifiers [RFC9015] */
574
#define BGP_EXT_COM_STYPE_EXP_TAG       0x84    /* Tag [https://github.com/Juniper/contrail-controller/wiki/BGP-Extended-Communities#tag] */
575
#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] */
576
577
/* BGP Generic Transitive Experimental Use Extended Community Part 2 */
578
579
66
#define BGP_EXT_COM_STYPE_EXP_2_FLOW_RED 0x08
580
581
/* BGP Generic Transitive Experimental Use Extended Community Part 3 */
582
583
#define BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP 0x04
584
66
#define BGP_EXT_COM_STYPE_EXP_3_FLOW_RED  0x08
585
#define BGP_EXT_COM_STYPE_EXP_3_TAG4      0x84
586
#define BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS  0x85
587
588
/* BGP Transitive Experimental EIGRP route attribute Sub-Types */
589
590
225
#define BGP_EXT_COM_STYPE_EXP_EIGRP_FT  0x00    /* Route Flags, Route Tag */
591
67
#define BGP_EXT_COM_STYPE_EXP_EIGRP_AD  0x01    /* ASN, Delay */
592
151
#define BGP_EXT_COM_STYPE_EXP_EIGRP_RHB 0x02    /* Reliability, Hop Count, Bandwidth */
593
67
#define BGP_EXT_COM_STYPE_EXP_EIGRP_LM  0x03    /* Load, MTU */
594
67
#define BGP_EXT_COM_STYPE_EXP_EIGRP_EAR 0x04    /* External ASN, RID of the redistributing router */
595
87
#define BGP_EXT_COM_STYPE_EXP_EIGRP_EPM 0x05    /* External Protocol ID, metric */
596
66
#define BGP_EXT_COM_STYPE_EXP_EIGRP_RID 0x06    /* Originating EIGRP Router ID of the route */
597
598
464
#define BGP_EXT_COM_EXP_EIGRP_FLAG_RT   0x8000  /* Route flag - Internal/External */
599
600
601
/* according to IANA's number assignment at: http://www.iana.org/assignments/bgp-extended-communities */
602
603
                                        /* RFC 4360 */
604
66
#define BGP_EXT_COM_RT_AS2        0x0002  /* Route Target,Format AS(2bytes):AN(4bytes) */
605
80
#define BGP_EXT_COM_RT_IP4        0x0102  /* Route Target,Format IP address:AN(2bytes) */
606
66
#define BGP_EXT_COM_RT_AS4        0x0202  /* Route Target,Format AS(4bytes):AN(2bytes) */
607
608
/* extended community option flow flec action bit S and T */
609
175
#define BGP_EXT_COM_FSPEC_ACT_S 0x02
610
175
#define BGP_EXT_COM_FSPEC_ACT_T 0x01
611
612
/* extended community l2vpn flags */
613
614
14
#define BGP_EXT_COM_L2_FLAG_D     0x80
615
14
#define BGP_EXT_COM_L2_FLAG_Z1    0x40
616
14
#define BGP_EXT_COM_L2_FLAG_F     0x20
617
14
#define BGP_EXT_COM_L2_FLAG_Z345  0x1c
618
14
#define BGP_EXT_COM_L2_FLAG_C     0x02
619
14
#define BGP_EXT_COM_L2_FLAG_S     0x01
620
621
/* extended community E-Tree Info flags */
622
623
14
#define BGP_EXT_COM_ETREE_FLAG_RESERVED   0xFFFC
624
14
#define BGP_EXT_COM_ETREE_FLAG_P          0x0002
625
14
#define BGP_EXT_COM_ETREE_FLAG_V          0x0001
626
627
/* Extended community QoS Marking technology type */
628
#define QOS_TECH_TYPE_DSCP         0x00  /* DiffServ enabled IP (DSCP encoding) */
629
#define QOS_TECH_TYPE_802_1q       0x01  /* Ethernet using 802.1q priority tag */
630
#define QOS_TECH_TYPE_E_LSP        0x02  /* MPLS using E-LSP */
631
#define QOS_TECH_TYPE_VC           0x03  /* Virtual Channel (VC) encoding using separate channels for */
632
                                         /* QoS forwarding / one channel per class (e.g. ATM VCs, FR  */
633
                                         /* VCs, MPLS L-LSPs) */
634
#define QOS_TECH_TYPE_GMPLS_TIME   0x04   /* GMPLS - time slot encoding */
635
#define QOS_TECH_TYPE_GMPLS_LAMBDA 0x05  /* GMPLS - lambda encoding */
636
#define QOS_TECH_TYPE_GMPLS_FIBRE  0x06  /* GMPLS - fibre encoding */
637
638
/* OSPF codes for  BGP_EXT_COM_OSPF_RTYPE draft-rosen-vpns-ospf-bgp-mpls  */
639
#define BGP_OSPF_RTYPE_RTR      1 /* OSPF Router LSA */
640
#define BGP_OSPF_RTYPE_NET      2 /* OSPF Network LSA */
641
#define BGP_OSPF_RTYPE_SUM      3 /* OSPF Summary LSA */
642
#define BGP_OSPF_RTYPE_EXT      5 /* OSPF External LSA, note that ASBR doesn't apply to MPLS-VPN */
643
#define BGP_OSPF_RTYPE_NSSA     7 /* OSPF NSSA External*/
644
#define BGP_OSPF_RTYPE_SHAM     129 /* OSPF-MPLS-VPN Sham link */
645
154
#define BGP_OSPF_RTYPE_METRIC_TYPE 0x1 /* Type-1 (clear) or Type-2 (set) external metric */
646
647
/* Extended community & Route distinguisher formats */
648
2.24k
#define FORMAT_AS2_LOC      0x00    /* Format AS(2bytes):AN(4bytes) */
649
521
#define FORMAT_IP_LOC       0x01    /* Format IP address:AN(2bytes) */
650
562
#define FORMAT_AS4_LOC      0x02    /* Format AS(4bytes):AN(2bytes) */
651
652
/* RFC 4760 subsequent address family numbers (last updated 2024-03-19)
653
 * https://www.iana.org/assignments/safi-namespace/safi-namespace.xhtml
654
 */
655
1.41k
#define SAFNUM_UNICAST          1  /* RFC4760 */
656
3.44k
#define SAFNUM_MULCAST          2  /* RFC4760 */
657
4.54k
#define SAFNUM_UNIMULC          3  /* Deprecated, see RFC4760 */
658
2.81k
#define SAFNUM_MPLS_LABEL       4  /* RFC8277 */
659
7.79k
#define SAFNUM_MCAST_VPN        5  /* RFC6514 */
660
#define SAFNUM_MULTISEG_PW      6  /* RFC7267 */
661
2.56k
#define SAFNUM_ENCAPSULATION    7  /* RFC5512, obsolete and never deployed, see draft-ietf-idr-tunnel-encaps-22 */
662
#define SAFNUM_MCAST_VPLS       8  /* RFC7117 */
663
#define SAFNUM_BGP_SFC          9  /* RFC9015 */
664
2.16k
#define SAFNUM_TUNNEL          64  /* draft-nalawade-kapoor-tunnel-safi-05.txt (Expired) */
665
1.62k
#define SAFNUM_VPLS            65  /* RFC4761, RFC6074 */
666
346
#define SAFNUM_MDT             66  /* RFC6037 */
667
#define SAFNUM_4OVER6          67  /* RFC5747 */
668
#define SAFNUM_6OVER4          68  /* Never specified? Cf. RFC5747 */
669
#define SAFNUM_L1VPN           69  /* RFC5195 */
670
9.78k
#define SAFNUM_EVPN            70  /* RFC7432 */
671
10.7k
#define SAFNUM_BGP_LS          71  /* RFC7752 */
672
2.39k
#define SAFNUM_BGP_LS_VPN      72  /* RFC7752 */
673
440
#define SAFNUM_SR_POLICY       73  /* draft-ietf-idr-segment-routing-te-policy-11 */
674
#define SAFNUM_SD_WAN          74  /* draft-dunbar-idr-sdwan-port-safi-06, expired */
675
#define SAFNUM_RPD             75  /* draft-ietf-idr-rpd-10 */
676
#define SAFNUM_CT              76  /* draft-kaliraj-idr-bgp-classful-transport-planes-07 */
677
#define SAFNUM_FLOWSPEC        77  /* draft-ietf-idr-flowspec-nvo3-13 */
678
#define SAFNUM_MCAST_TREE      78  /* draft-ietf-bess-bgp-multicast-03 */
679
#define SAFNUM_BGP_DPS         79  /* https://www.arista.com/en/cg-veos-router/veos-router-dynamic-path-selection */
680
#define SAFNUM_BGP_LS_SPF      80  /* draft-ietf-lsvr-bgp-spf-15 */
681
#define SAFNUM_BGP_CAR         83  /* draft-ietf-idr-bgp-car-05 */
682
#define SAFNUM_BGP_VPN_CAR     84  /* draft-ietf-idr-bgp-car-05 */
683
6.10k
#define SAFNUM_BGP_MUP         85  /* draft-mpmz-bess-mup-safi-03 */
684
8.15k
#define SAFNUM_LAB_VPNUNICAST 128  /* RFC4364, RFC8277 */
685
3.80k
#define SAFNUM_LAB_VPNMULCAST 129  /* RFC6513, RFC6514 */
686
4.94k
#define SAFNUM_LAB_VPNUNIMULC 130  /* Obsolete and reserved, see RFC4760 */
687
1.96k
#define SAFNUM_ROUTE_TARGET   132  /* RFC 4684 Constrained Route Distribution for BGP/MPLS IP VPN */
688
6.47k
#define SAFNUM_FSPEC_RULE     133  /* RFC 8955 BGP flow spec SAFI */
689
15.9k
#define SAFNUM_FSPEC_VPN_RULE 134  /* RFC 8955 BGP flow spec SAFI VPN */
690
#define SAFNUM_L3VPN          140  /* Withdrawn, draft-ietf-l3vpn-bgpvpn-auto-09 */
691
692
/* BGP Additional Paths Capability */
693
#define BGP_ADDPATH_RECEIVE  0x01
694
#define BGP_ADDPATH_SEND     0x02
695
696
/* mcast-vpn route types RFC 6514 */
697
664
#define MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD 1
698
326
#define MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD 2
699
903
#define MCAST_VPN_RTYPE_SPMSI_AD          3
700
415
#define MCAST_VPN_RTYPE_LEAF_AD           4
701
468
#define MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD  5
702
228
#define MCAST_VPN_RTYPE_SHARED_TREE_JOIN  6
703
1.23k
#define MCAST_VPN_RTYPE_SOURCE_TREE_JOIN  7
704
705
/* RFC 5512 Tunnel Types */
706
3.47k
#define TUNNEL_TYPE_L2TP_OVER_IP      1
707
3.98k
#define TUNNEL_TYPE_GRE               2
708
#define TUNNEL_TYPE_TTE               3
709
#define TUNNEL_TYPE_IPSEC_IN_TM       4
710
#define TUNNEL_TYPE_IP_IN_IP_IPSEC    5
711
#define TUNNEL_TYPE_MPLS_IN_IP_IPSEC  6
712
#define TUNNEL_TYPE_IP_IN_IP          7
713
1.15k
#define TUNNEL_TYPE_VXLAN             8
714
735
#define TUNNEL_TYPE_NVGRE             9
715
#define TUNNEL_TYPE_MPLS             10
716
1.50k
#define TUNNEL_TYPE_MPLS_IN_GRE      11
717
958
#define TUNNEL_TYPE_VXLAN_GPE        12
718
#define TUNNEL_TYPE_MPLS_IN_UDP      13
719
#define TUNNEL_TYPE_IPV6_TUNNEL      14
720
#define TUNNEL_TYPE_SR_TE_POLICY     15
721
#define TUNNEL_TYPE_BARE             16
722
#define TUNNEL_TYPE_SR_TUNNEL        17
723
#define TUNNEL_TYPE_CLOUD_SECURITY   18
724
#define TUNNEL_TYPE_GENEVE_ENCAP     19
725
#define TUNNEL_TYPE_ANY_ENCAP        20
726
#define TUNNEL_TYPE_GTP_TUNNEL_TYPE  21
727
#define TUNNEL_TYPE_DPS_TUNNEL_ENCAP 22
728
#define TUNNEL_TYPE_ORIGINATING_PE   23
729
#define TUNNEL_TYPE_DPS_POLICY       24
730
#define TUNNEL_TYPE_SDWAN_HYBRID     25
731
#define TUNNEL_TYPE_X_OVER_UDP       26
732
#define TUNNEL_TYPE_DES_TUNNEL_ENCAP 27
733
734
735
/*RFC 6514 PMSI Tunnel Types */
736
204
#define PMSI_TUNNEL_NOPRESENT           0
737
211
#define PMSI_TUNNEL_RSVPTE_P2MP         1
738
542
#define PMSI_TUNNEL_MLDP_P2MP           2
739
490
#define PMSI_TUNNEL_PIMSSM              3
740
196
#define PMSI_TUNNEL_PIMSM               4
741
194
#define PMSI_TUNNEL_BIDIR_PIM           5
742
175
#define PMSI_TUNNEL_INGRESS             6
743
951
#define PMSI_TUNNEL_MLDP_MP2MP          7
744
#define PMSI_TUNNEL_TRANPORT            8
745
#define PMSI_TUNNEL_ASS_REPLIC          9
746
#define PMSI_TUNNEL_BIER                11
747
#define PMSI_TUNNEL_SR_MPLS_P2MP        12
748
749
/* RFC 6388, RFC 6826, RFC 6512, RFC 7246, RFC 7442, RFC 8338 */
750
#define PMSI_MLDP_FEC_TYPE_RSVD                     0
751
951
#define PMSI_MLDP_FEC_TYPE_GEN_LSP                  1
752
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SRC         3
753
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SRC         4
754
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_BIDIR       5
755
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_BIDIR       6
756
#define PMSI_MLDP_FEC_TYPE_RECURSE_OPAQUE_VALUE     7
757
#define PMSI_MLDP_FEC_TYPE_VPN_RECURSE_OPAQUE_VALUE 8
758
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_BIDIR      9
759
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_BIDIR      10
760
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SHARED_TREE 11
761
#define PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SHARED_TREE 12
762
#define PMSI_MLDP_FEC_TYPE_L2VPN_MCAST              13
763
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_SRC        250
764
#define PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_SRC        251
765
532
#define PMSI_MLDP_FEC_TYPE_EXT_TYPE                 255
766
767
#define PMSI_MLDP_FEC_ETYPE_RSVD                    0
768
769
/* RFC 7311 AIGP types */
770
288
#define AIGP_TLV_TYPE           1
771
772
/* RFC 9012 (RFC 5512/5640) Sub-TLV Types */
773
1.91k
#define TUNNEL_SUBTLV_ENCAPSULATION     1
774
498
#define TUNNEL_SUBTLV_PROTO_TYPE        2
775
#define TUNNEL_SUBTLV_IPSEC_TA          3
776
282
#define TUNNEL_SUBTLV_COLOR             4
777
783
#define TUNNEL_SUBTLV_LOAD_BALANCE      5
778
#define TUNNEL_SUBTLV_REMOTE_ENDPOINT   6
779
#define TUNNEL_SUBTLV_IPV4_DS_FIELD     7
780
#define TUNNEL_SUBTLV_UDP_DST_PORT      8
781
#define TUNNEL_SUBTLV_EMBEDDED_LABEL    9
782
#define TUNNEL_SUBTLV_MPLS_LABEL        10
783
#define TUNNEL_SUBTLV_PREFIX_SID        11
784
209
#define TUNNEL_SUBTLV_PREFERENCE        12
785
429
#define TUNNEL_SUBTLV_BINDING_SID       13
786
204
#define TUNNEL_SUBTLV_ENLP              14
787
278
#define TUNNEL_SUBTLV_PRIORITY          15
788
789
#define TUNNEL_SUBTLV_SPI_SI_REP        16
790
791
#define TUNNEL_SUBTLV_SRV6_BINDING_SID  20
792
793
#define TUNNEL_SUBTLV_IPSEC_SA_ID       64
794
#define TUNNEL_SUBTLV_EXT_PORT_PROP     65
795
#define TUNNEL_SUBTLV_UNDERLAY_ISP_PROP 66
796
#define TUNNEL_SUBTLV_IPSEC_SA_NONCE    67
797
#define TUNNEL_SUBTLV_IPSEC_PUBLIC_KEY  68
798
#define TUNNEL_SUBTLV_IPSEC_SA_PROPOSAL 69
799
#define TUNNEL_SUBTLV_SIMPL_IPSEC_SA    70
800
801
#define TUNNEL_SUBTLV_NRP               123
802
#define TUNNEL_SUBTLV_RPF               124
803
#define TUNNEL_SUBTLV_TREE_LABEL_STACK  125
804
805
448
#define TUNNEL_SUBTLV_SEGMENT_LIST      128
806
#define TUNNEL_SUBTLV_POLICY_CP_NAME    129
807
212
#define TUNNEL_SUBTLV_POLICY_NAME       130
808
809
#define TUNNEL_SUBTLV_WAN_ID            192
810
#define TUNNEL_SUBTLV_BYTES             193
811
#define TUNNEL_SUBTLV_IPSEC_DIM         194
812
#define TUNNEL_SUBTLV_IPSEC_KEY_EXCH    195
813
#define TUNNEL_SUBTLV_IPSEC_SA_PROPS    196
814
#define TUNNEL_SUBTLV_SRV_SEGMENT_LIST  197
815
#define TUNNEL_SUBTLV_SRV_VTEP          198
816
#define TUNNEL_SUBTLV_DES_ADJACENCY     199
817
818
819
/* BGP Tunnel SubTLV VXLAN Flags bitmask */
820
14
#define TUNNEL_SUBTLV_VXLAN_VALID_VNID          0x80
821
14
#define TUNNEL_SUBTLV_VXLAN_VALID_MAC           0x40
822
14
#define TUNNEL_SUBTLV_VXLAN_RESERVED            0x3F
823
824
/* BGP Tunnel SubTLV VXLAN GPE Flags bitmask */
825
14
#define TUNNEL_SUBTLV_VXLAN_GPE_VERSION         0xC0
826
14
#define TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID      0x20
827
14
#define TUNNEL_SUBTLV_VXLAN_GPE_RESERVED        0x1F
828
829
/* BGP Tunnel SubTLV NVGRE Flags bitmask */
830
14
#define TUNNEL_SUBTLV_NVGRE_VALID_VNID          0x80
831
14
#define TUNNEL_SUBTLV_NVGRE_VALID_MAC           0x40
832
14
#define TUNNEL_SUBTLV_NVGRE_RESERVED            0x3F
833
834
/* BGP Tunnel SubTLV Binding SID Flags bitmask */
835
14
#define TUNNEL_SUBTLV_BINDING_SPECIFIED         0x80
836
14
#define TUNNEL_SUBTLV_BINDING_INVALID           0x40
837
14
#define TUNNEL_SUBTLV_BINDING_RESERVED          0x3F
838
839
/* BGP Segment List SubTLV Types */
840
200
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A   1
841
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B   2
842
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C   3
843
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D   4
844
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E   5
845
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F   6
846
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G   7
847
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H   8
848
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT   9
849
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I   10
850
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J   11
851
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K   12
852
853
/* BGP Tunnel SubTLV Segment List SubTLV Flags bitmask */
854
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION      0x80
855
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM         0x40
856
14
#define TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED          0x3F
857
858
/* Link-State NLRI types */
859
431
#define LINK_STATE_NODE_NLRI                    1
860
1.74k
#define LINK_STATE_LINK_NLRI                    2
861
713
#define LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI    3
862
558
#define LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI    4
863
#define LINK_STATE_SR_POLICY_CANDIDATE_PATH     5
864
540
#define LINK_STATE_SRV6_SID_NLRI                6
865
#define LINK_STATE_STUB_LINK_NLRI               7
866
867
868
/* Link-State NLRI Protocol-ID values */
869
2.04k
#define BGP_LS_NLRI_PROTO_ID_UNKNOWN       0
870
4.45k
#define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 1
871
1.79k
#define BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2 2
872
7.52k
#define BGP_LS_NLRI_PROTO_ID_OSPF_V2       3
873
#define BGP_LS_NLRI_PROTO_ID_DIRECT        4
874
#define BGP_LS_NLRI_PROTO_ID_STATIC        5
875
6.10k
#define BGP_LS_NLRI_PROTO_ID_OSPF_V3       6
876
#define BGP_LS_NLRI_PROTO_ID_BGP           7
877
#define BGP_LS_NLRI_PROTO_ID_RSVP_TE       8
878
#define BGP_LS_NLRI_PROTO_ID_SEGMENT_ROUTING 9
879
880
/* Link-State routing universes */
881
#define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3     0
882
#define BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1     1
883
884
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN    0
885
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA 1
886
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA 2
887
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1 3
888
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2 4
889
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1     5
890
#define BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2     6
891
892
/* RFC7752 */
893
3.62k
#define BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS         256
894
1.53k
#define BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS        257
895
880
#define BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS  258
896
198
#define BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS         259
897
213
#define BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS          260
898
205
#define BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS         261
899
166
#define BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS          262
900
2.70k
#define BGP_NLRI_TLV_MULTI_TOPOLOGY_ID              263
901
1.24k
#define BGP_NLRI_TLV_OSPF_ROUTE_TYPE                264
902
1.39k
#define BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION    265
903
1.04k
#define BGP_NLRI_TLV_NODE_MSD                       266
904
652
#define BGP_NLRI_TLV_LINK_MSD                       267
905
906
432
#define BGP_NLRI_TLV_AUTONOMOUS_SYSTEM              512
907
435
#define BGP_NLRI_TLV_BGP_LS_IDENTIFIER              513
908
132
#define BGP_NLRI_TLV_AREA_ID                        514
909
202
#define BGP_NLRI_TLV_IGP_ROUTER_ID                  515
910
70
#define BGP_NLRI_TLV_BGP_ROUTER_ID                  516
911
66
#define BGP_NLRI_TLV_BGP_CONFEDERATION_MEMBER       517
912
103
#define BGP_NLRI_TLV_SRV6_SID_INFO                  518
913
914
39.1k
#define BGP_NLRI_TLV_NODE_FLAG_BITS                 1024
915
197
#define BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES         1025
916
194
#define BGP_NLRI_TLV_NODE_NAME                      1026
917
194
#define BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER          1027
918
547
#define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE   1028
919
406
#define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE   1029
920
431
#define BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE  1030
921
400
#define BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE  1031
922
923
5.58k
#define BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR     1088
924
47.2k
#define BGP_NLRI_TLV_MAX_LINK_BANDWIDTH             1089
925
399
#define BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH  1090
926
26.5k
#define BGP_NLRI_TLV_UNRESERVED_BANDWIDTH           1091
927
16.5k
#define BGP_NLRI_TLV_TE_DEFAULT_METRIC              1092
928
392k
#define BGP_NLRI_TLV_LINK_PROTECTION_TYPE           1093
929
13.9k
#define BGP_NLRI_TLV_MPLS_PROTOCOL_MASK             1094
930
987
#define BGP_NLRI_TLV_METRIC                         1095
931
136k
#define BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP         1096
932
292
#define BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE          1097
933
195
#define BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE            1098
934
935
790
#define BGP_NLRI_TLV_IGP_FLAGS                      1152
936
642
#define BGP_NLRI_TLV_ROUTE_TAG                      1153
937
664
#define BGP_NLRI_TLV_EXTENDED_TAG                   1154
938
480
#define BGP_NLRI_TLV_PREFIX_METRIC                  1155
939
601
#define BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS        1156
940
198
#define BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE        1157
941
658
#define BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP  1173
942
943
944
/* Link-State NLRI TLV lengths */
945
645
#define BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM              4
946
804
#define BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER              4
947
198
#define BGP_NLRI_TLV_LEN_AREA_ID                        4
948
2.58k
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID                 4
949
2.43k
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID                 16
950
900
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE   BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
951
812
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE   BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
952
668
#define BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE  BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID
953
800
#define BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE  BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID
954
1.36k
#define BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS  8
955
330
#define BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS         4
956
228
#define BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS          4
957
344
#define BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS         16
958
134
#define BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS          16
959
7.28k
#define BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID              2
960
9.99k
#define BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR     4
961
94.3k
#define BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH             4
962
604
#define BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH  4
963
26.8k
#define BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH           32
964
66.1k
#define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD          3
965
16.9k
#define BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW          4
966
392k
#define BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE           2
967
14.1k
#define BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK             1
968
1.19k
#define BGP_NLRI_TLV_LEN_MAX_METRIC                     3
969
589
#define BGP_NLRI_TLV_LEN_IGP_FLAGS                      1
970
766
#define BGP_NLRI_TLV_LEN_PREFIX_METRIC                  4
971
66.3k
#define BGP_NLRI_TLV_LEN_NODE_FLAG_BITS                 1
972
973
/* rfc9085 */
974
/* draft-ietf-idr-bgpls-srv6-ext-14 */
975
614
#define BGP_LS_SR_TLV_SR_CAPABILITY                 1034
976
465
#define BGP_LS_SR_TLV_SR_ALGORITHM                  1035
977
679
#define BGP_LS_SR_TLV_SR_LOCAL_BLOCK                1036
978
408
#define BGP_LS_SR_TLV_SRV6_CAPABILITY               1038
979
1.55k
#define BGP_LS_SR_TLV_FLEX_ALGO_DEF                 1039
980
1.21k
#define BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY    1040
981
1.18k
#define BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY    1041
982
923
#define BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY    1042
983
402
#define BGP_LS_SR_TLV_FLEX_ALGO_DEF_FLAGS           1043
984
405
#define BGP_LS_SR_TLV_FLEX_ALGO_PREFIX_METRIC       1044
985
666
#define BGP_LS_SR_TLV_FLEX_ALGO_EXC_SRLG            1045
986
808
#define BGP_LS_SR_TLV_ADJ_SID                       1099
987
194
#define BGP_LS_SR_TLV_LAN_ADJ_SID                   1100
988
11.1k
#define BGP_LS_SR_TLV_PEER_NODE_SID                 1101
989
7.65k
#define BGP_LS_SR_TLV_PEER_ADJ_SID                  1102
990
6.74k
#define BGP_LS_SR_TLV_PEER_SET_SID                  1103
991
679
#define BGP_LS_SR_TLV_SRV6_END_X_SID                1106
992
1.86k
#define BGP_LS_SR_TLV_SRV6_LAN_END_X_SID            1107
993
1.82k
#define BGP_LS_SR_TLV_PREFIX_SID                    1158
994
194
#define BGP_LS_SR_TLV_RANGE                         1159
995
401
#define BGP_LS_SR_TLV_SRV6_LOCATOR                  1162
996
1.16k
#define BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS             1170
997
605
#define BGP_LS_SR_TLV_SOURCE_ROUTER_ID              1171
998
403
#define BGP_LS_SR_TLV_SRV6_ENDPOINT_BEHAVIOR        1250
999
401
#define BGP_LS_SR_TLV_SRV6_SID_STRUCT               1252
1000
1001
/* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
1002
194
#define BGP_LS_IGP_TE_METRIC_DELAY                  1114
1003
195
#define BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX          1115
1004
194
#define BGP_LS_IGP_TE_METRIC_DELAY_VARIATION        1116
1005
194
#define BGP_LS_IGP_TE_METRIC_LOSS                   1117
1006
194
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL     1118
1007
194
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE    1119
1008
194
#define BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED     1120
1009
1010
14
#define BGP_LS_IGP_TE_METRIC_FLAG_A                 0x80
1011
14
#define BGP_LS_IGP_TE_METRIC_FLAG_RESERVED          0x7F
1012
1013
/* draft-ietf-idr-bgp-ls-app-specific-attr-07 */
1014
1.51M
#define BGP_LS_APP_SPEC_LINK_ATTR                   1122
1015
1016
/* Prefix-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext, RFC 8665-8667:
1017
1018
                             0  1  2  3  4  5  6  7
1019
                            +--+--+--+--+--+--+--+--+
1020
   if Protocol-ID is IS-IS  |R |N |P |E |V |L |  |  |
1021
                            +--+--+--+--+--+--+--+--+
1022
1023
                             0  1  2  3  4  5  6  7
1024
                            +--+--+--+--+--+--+--+--+
1025
   if Protocol-ID is OSPF   |  |NP|M |E |V |L |  |  |
1026
                            +--+--+--+--+--+--+--+--+
1027
*/
1028
14
#define BGP_LS_SR_PREFIX_SID_FLAG_R  0x80
1029
14
#define BGP_LS_SR_PREFIX_SID_FLAG_N  0x40
1030
14
#define BGP_LS_SR_PREFIX_SID_FLAG_NP 0x40
1031
14
#define BGP_LS_SR_PREFIX_SID_FLAG_P  0x20
1032
14
#define BGP_LS_SR_PREFIX_SID_FLAG_M  0x20
1033
14
#define BGP_LS_SR_PREFIX_SID_FLAG_E  0x10
1034
14
#define BGP_LS_SR_PREFIX_SID_FLAG_V  0x08
1035
14
#define BGP_LS_SR_PREFIX_SID_FLAG_L  0x04
1036
1037
/* Adjacency-SID TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext, RFC 8665-8667:
1038
1039
                             0  1  2  3  4  5  6  7
1040
                            +--+--+--+--+--+--+--+--+
1041
   if Protocol-ID is IS-IS  |F |B |V |L |S |P |  |  |
1042
                            +--+--+--+--+--+--+--+--+
1043
1044
                             0  1  2  3  4  5  6  7
1045
                            +--+--+--+--+--+--+--+--+
1046
   if Protocol-ID is OSPF   |B |V |L |G |P |  |  |  |
1047
                            +--+--+--+--+--+--+--+--+
1048
*/
1049
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_FI 0x80
1050
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_BO 0x80
1051
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_BI 0x40
1052
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_VO 0x40
1053
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_VI 0x20
1054
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_LO 0x20
1055
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_LI 0x10
1056
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_GO 0x10
1057
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_SI 0x08
1058
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_PO 0x08
1059
14
#define BGP_LS_SR_ADJACENCY_SID_FLAG_PI 0x04
1060
1061
/* BGP Peering SIDs TLV flags, rfc9086:
1062
1063
   0  1  2  3  4  5  6  7
1064
   +--+--+--+--+--+--+--+--+
1065
   |V |L |B |P |  |  |  |  | rfc9086
1066
   +--+--+--+--+--+--+--+--+
1067
*/
1068
14
#define BGP_LS_SR_PEER_SID_FLAG_V   0x80
1069
14
#define BGP_LS_SR_PEER_SID_FLAG_L   0x40
1070
14
#define BGP_LS_SR_PEER_SID_FLAG_B   0x20
1071
14
#define BGP_LS_SR_PEER_SID_FLAG_P   0x10
1072
1073
/* SR-Capabilities TLV flags, draft-gredler-idr-bgp-ls-segment-routing-ext-01:
1074
1075
                             0  1  2  3  4  5  6  7
1076
                            +--+--+--+--+--+--+--+--+
1077
   if Protocol-ID is IS-IS  |I |V |H |  |  |  |  |  |
1078
                            +--+--+--+--+--+--+--+--+
1079
*/
1080
14
#define BGP_LS_SR_CAPABILITY_FLAG_I 0x80
1081
14
#define BGP_LS_SR_CAPABILITY_FLAG_V 0x40
1082
14
#define BGP_LS_SR_CAPABILITY_FLAG_H 0x20
1083
1084
/* Flexible Algorithm Definition Flags Sub-TLV flags, rfc9350:
1085
1086
                             0  1  2  3  4  5  6  7
1087
                            +--+--+--+--+--+--+--+--+
1088
   if Protocol-ID is IS-IS  |M |  |  |  |  |  |  |  |
1089
                            +--+--+--+--+--+--+--+--+
1090
                             0  1  2  3  4  5  6  7
1091
                            +--+--+--+--+--+--+--+--+
1092
   if Protocol-ID is OSPF   |M |  |  |  |  |  |  |  |
1093
                            +--+--+--+--+--+--+--+--+
1094
*/
1095
14
#define BGP_LS_FLEX_ALGO_DEF_FLAGS_M    0x80000000
1096
1097
/* OSPF Flexible Algorithm Prefix Metric Sub-TLV flags, rfc9350:
1098
1099
                             0  1  2  3  4  5  6  7
1100
                            +--+--+--+--+--+--+--+--+
1101
   if Protocol-ID is OSPF   |E |  |  |  |  |  |  |  |
1102
                            +--+--+--+--+--+--+--+--+
1103
*/
1104
14
#define BGP_LS_FLEX_ALGO_PREFIX_METRIC_FLAGS_E      0x80
1105
1106
/* Prefix Attribute Flags TLV flags, rfc9085:
1107
1108
                             0  1  2  3  4  5  6  7
1109
                            +--+--+--+--+--+--+--+--+
1110
   if Protocol-ID is IS-IS  |X |R |N |E |  |  |  |  | rfc7794,rfc9088
1111
                            +--+--+--+--+--+--+--+--+
1112
1113
                             0  1  2  3  4  5  6  7
1114
                            +--+--+--+--+--+--+--+--+
1115
   if Protocol-ID is OSPF   |A |N |E |  |  |  |  |  | rfc7684,rfc9089
1116
                            +--+--+--+--+--+--+--+--+
1117
*/
1118
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI 0x80
1119
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI 0x40
1120
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI 0x20
1121
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI 0x10
1122
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO 0x80
1123
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO 0x40
1124
14
#define BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO 0x20
1125
1126
/* Link Attribute Application Identifiers, https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml:
1127
1128
   0  1  2  3  4  5  6  7
1129
   +--+--+--+--+--+--+--+--+
1130
   |R |S |F |X |  |  |  |  | rfc8919,rfc8920
1131
   +--+--+--+--+--+--+--+--+
1132
*/
1133
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R  0x80000000
1134
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S  0x40000000
1135
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F  0x20000000
1136
14
#define BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X  0x10000000
1137
1138
/* SRv6 Capabilities TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1139
1140
                            0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16
1141
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1142
   if Protocol-ID is IS-IS  |  |O | Reserved                                | rfc9352
1143
                            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1144
 */
1145
14
#define BGP_LS_SRV6_CAP_FLAG_O         0x4000
1146
#define BGP_LS_SRV6_CAP_FLAG_RESERVED  0x3fff
1147
1148
/* SRv6 End.X SID TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1149
1150
                            0  1  2  3  4  5  6  7
1151
                            +--+--+--+--+--+--+--+--+
1152
   if Protocol-ID is IS-IS  |B |S |P |  |  |  |  |  | rfc9352
1153
                            +--+--+--+--+--+--+--+--+
1154
*/
1155
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_B         0x80
1156
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_S         0x40
1157
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_P         0x20
1158
14
#define BGP_LS_SRV6_ENDX_SID_FLAG_RESERVED  0x1f
1159
1160
/* SRv6 Locator TLV flags, draft-ietf-idr-bgpls-srv6-ext-14
1161
1162
                            0  1  2  3  4  5  6  7  8
1163
                            +--+--+--+--+--+--+--+--+
1164
   if Protocol-ID is IS-IS  |D | Reserved           | rfc9352
1165
                            +--+--+--+--+--+--+--+--+
1166
*/
1167
14
#define BGP_LS_SRV6_LOC_FLAG_D         0x80
1168
14
#define BGP_LS_SRV6_LOC_FLAG_RESERVED  0x7f
1169
1170
/* BGP Prefix-SID TLV type */
1171
431
#define BGP_PREFIX_SID_TLV_LABEL_INDEX     1 /* Label-Index [RFC8669]                           */
1172
#define BGP_PREFIX_SID_TLV_2               2 /* Deprecated [RFC8669]                            */
1173
701
#define BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB 3 /* Originator SRGB [RFC8669]                       */
1174
#define BGP_PREFIX_SID_TLV_4               4 /* Deprecated [draft-ietf-bess-srv6-services]      */
1175
319
#define BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE 5 /* SRv6 L3 Service [draft-ietf-bess-srv6-services] */
1176
421
#define BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE 6 /* SRv6 L2 Service [draft-ietf-bess-srv6-services] */
1177
1178
/* BGP_PREFIX_SID TLV lengths   */
1179
431
#define BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX 7
1180
1181
/* BGP SRv6 Service Sub-TLV */
1182
1.95k
#define SRV6_SERVICE_SRV6_SID_INFORMATION 1
1183
1184
/* BGP SRv6 Service Data Sub-Sub-TLV */
1185
847
#define SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE 1
1186
1187
/* SRv6 Endpoint behavior */
1188
#define SRV6_ENDPOINT_BEHAVIOR_END                    0x0001 /* End [RFC8986]                                                                            */
1189
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP                0x0002 /* End with PSP [RFC8986]                                                                   */
1190
#define SRV6_ENDPOINT_BEHAVIOR_END_USP                0x0003 /* End with USP [RFC8986]                                                                   */
1191
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP            0x0004 /* End with PSP & USP [RFC8986]                                                             */
1192
#define SRV6_ENDPOINT_BEHAVIOR_END_X                  0x0005 /* End.X [RFC8986]                                                                          */
1193
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP              0x0006 /* End.X with PSP [RFC8986]                                                                 */
1194
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USP              0x0007 /* End.X with UPS [RFC8986]                                                                 */
1195
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP          0x0008 /* End.X with PSP & USP [RFC8986]                                                           */
1196
#define SRV6_ENDPOINT_BEHAVIOR_END_T                  0x0009 /* End.T [RFC8986]                                                                          */
1197
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP              0x000A /* End.T with PSP [RFC8986]                                                                 */
1198
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USP              0x000B /* End.T with USP [RFC8986]                                                                 */
1199
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP          0x000C /* End.T with PSP & USP [RFC8986]                                                           */
1200
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT          0x000D /* End.B6.Insert [draft-filsfils-spring-srv6-net-pgm-insertion-04]                          */
1201
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS          0x000E /* End.B6.Encaps [RFC8986]                                                                  */
1202
#define SRV6_ENDPOINT_BEHAVIOR_END_BM                 0x000F /* End.BM [RFC8986]                                                                         */
1203
#define SRV6_ENDPOINT_BEHAVIOR_END_DX6                0x0010 /* End.DX6 [RFC8986]                                                                        */
1204
#define SRV6_ENDPOINT_BEHAVIOR_END_DX4                0x0011 /* End.DX4 [RFC8986]                                                                        */
1205
#define SRV6_ENDPOINT_BEHAVIOR_END_DT6                0x0012 /* End.DT6 [RFC8986]                                                                        */
1206
#define SRV6_ENDPOINT_BEHAVIOR_END_DT4                0x0013 /* End.DT4 [RFC8986]                                                                        */
1207
#define SRV6_ENDPOINT_BEHAVIOR_END_DT46               0x0014 /* End.DT46 [RFC8986]                                                                       */
1208
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2                0x0015 /* End.DX2 [RFC8986]                                                                        */
1209
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2V               0x0016 /* End.DX2V [RFC8986]                                                                       */
1210
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2U               0x0017 /* End.DX2U [RFC8986]                                                                       */
1211
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2M               0x0018 /* End.DT2M [RFC8986]                                                                       */
1212
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT_RED      0x001A /* End.B6.Insert.Red [draft-filsfils-spring-srv6-net-pgm-insertion-04]                      */
1213
#define SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED      0x001B /* End.B6.Encaps.Red [RFC8986]                                                              */
1214
#define SRV6_ENDPOINT_BEHAVIOR_END_USD                0x001C /* End with USD [RFC8986]                                                                   */
1215
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD            0x001D /* End with PSP & USD [RFC8986]                                                             */
1216
#define SRV6_ENDPOINT_BEHAVIOR_END_USP_USD            0x001E /* End with USP & USD [RFC8986]                                                             */
1217
#define SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD        0x001F /* End with PSP, USP & USD [RFC8986]                                                        */
1218
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USD              0x0020 /* End.X with USD [RFC8986]                                                                 */
1219
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD          0x0021 /* End.X with PSP & USD [RFC8986]                                                           */
1220
#define SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD          0x0022 /* End.X with USP & USD [RFC8986]                                                           */
1221
#define SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD      0x0023 /* End.X with PSP, USP & USD [RFC8986]                                                      */
1222
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USD              0x0024 /* End.T with USD [RFC8986]                                                                 */
1223
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD          0x0025 /* End.T with PSP & USD [RFC8986]                                                           */
1224
#define SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD          0x0026 /* End.T with USP & USD [RFC8986]                                                           */
1225
#define SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD      0x0027 /* End.T with PSP, USP & USD [RFC8986]                                                      */
1226
#define SRV6_ENDPOINT_BEHAVIOR_END_MAP                0x0028 /* End.MAP                                                                                  */
1227
#define SRV6_ENDPOINT_BEHAVIOR_END_LIMIT              0x0029 /* End.Limit                                                                                */
1228
#define SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID          0x002A /* End with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1229
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID               0x002B /* End with NEXT-CSID [draft-ietf-spring-srv6-srh-compression]                              */
1230
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP           0x002C /* End with NEXT-CSID & PSP [draft-ietf-spring-srv6-srh-compression]                        */
1231
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP           0x002D /* End with NEXT-CSID & USP [draft-ietf-spring-srv6-srh-compression]                        */
1232
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP       0x002E /* End with NEXT-CSID, PSP & USP [draft-ietf-spring-srv6-srh-compression]                   */
1233
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD           0x002F /* End with NEXT-CSID & USD [draft-ietf-spring-srv6-srh-compression]                        */
1234
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD       0x0030 /* End with NEXT-CSID, PSP & USD [draft-ietf-spring-srv6-srh-compression]                   */
1235
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD       0x0031 /* End with NEXT-CSID, USP & USD [draft-ietf-spring-srv6-srh-compression]                   */
1236
#define SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD   0x0032 /* End with NEXT-CSID, PSP, USP & USD [draft-ietf-spring-srv6-srh-compression]              */
1237
#define SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID        0x0033 /* End.X with NEXT-ONLY-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]            */
1238
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID             0x0034 /* End.X with NEXT-CSID [draft-ietf-spring-srv6-srh-compression]                            */
1239
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP         0x0035 /* End.X with NEXT-CSID & PSP [draft-ietf-spring-srv6-srh-compression]                      */
1240
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP         0x0036 /* End.X with NEXT-CSID & USP [draft-ietf-spring-srv6-srh-compression]                      */
1241
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP     0x0037 /* End.X with NEXT-CSID, PSP & USP [draft-ietf-spring-srv6-srh-compression]                 */
1242
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD         0x0038 /* End.X with NEXT-CSID & USD [draft-ietf-spring-srv6-srh-compression]                      */
1243
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD     0x0039 /* End.X with NEXT-CSID, PSP & USD [draft-ietf-spring-srv6-srh-compression]                 */
1244
#define SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD     0x003A /* End.X with NEXT-CSID, USP & USD [draft-ietf-spring-srv6-srh-compression]                 */
1245
#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]            */
1246
#define SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID           0x003C /* End.DX6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1247
#define SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID           0x003D /* End.DX4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1248
#define SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID           0x003E /* End.DT6 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1249
#define SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID           0x003F /* End.DT4 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1250
#define SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID          0x0040 /* End.DT46 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1251
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID           0x0041 /* End.DX2 with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]               */
1252
#define SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID          0x0042 /* End.DX2V with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1253
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID          0x0043 /* End.DT2U with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1254
#define SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID          0x0044 /* End.DT2M with NEXT-CSID [draft-filsfils-spring-net-pgm-extension-srv6-usid]              */
1255
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6D            0x0045 /* End.M.GTP6.D [RFC9433]                                                                   */
1256
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6DI           0x0046 /* End.M.GTP6.Di [RFC9433]                                                                  */
1257
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6E            0x0047 /* End.M.GTP6.E [RFC9433]                                                                   */
1258
#define SRV6_ENDPOINT_BEHAVIOR_END_M_GTP4E            0x0048 /* End.M.GTP4.E [RFC9433]                                                                   */
1259
 #define SRV6_ENDPOINT_BEHAVIOR_END_M                  0x004A /* End.M (Mirror SID) [draft-ietf-rtgwg-srv6-egress-protection-02]                          */
1260
#define SRV6_ENDPOINT_BEHAVIOR_END_REPLICATE          0x004B /* End.Replicate [RFC9524]                                                                  */
1261
#define SRV6_ENDPOINT_BEHAVIOR_END_NSH                0x0054 /* End.NSH - NSH Segment [RFC9491]                                                          */
1262
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1                0x009E /* End.DX1 [RFC9801]                                                                        */
1263
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1_NEXT_CSID      0x009F /* End.DX1 with NEXT-CSID [RFC9801]                                                         */
1264
#define SRV6_ENDPOINT_BEHAVIOR_END_DX1_REPL_CSID      0x00A0 /* End.DX1 with REPLACE-CSID [RFC9801]                                                      */
1265
#define SRV6_ENDPOINT_BEHAVIOR_OPAQUE                 0xFFFF /* Opaque [RFC8986]                                                                         */
1266
1267
static const value_string bgptypevals[] = {
1268
    { BGP_OPEN,                "OPEN Message" },
1269
    { BGP_UPDATE,              "UPDATE Message" },
1270
    { BGP_NOTIFICATION,        "NOTIFICATION Message" },
1271
    { BGP_KEEPALIVE,           "KEEPALIVE Message" },
1272
    { BGP_ROUTE_REFRESH,       "ROUTE-REFRESH Message" },
1273
    { BGP_CAPABILITY,          "CAPABILITY Message" },
1274
    { BGP_ROUTE_REFRESH_CISCO, "Cisco ROUTE-REFRESH Message" },
1275
    { 0, NULL }
1276
};
1277
1278
static const value_string evpnrtypevals[] = {
1279
    { EVPN_AD_ROUTE,                   "Ethernet AD Route" },
1280
    { EVPN_MAC_ROUTE,                  "MAC Advertisement Route" },
1281
    { EVPN_INC_MCAST_TREE,             "Inclusive Multicast Route" },
1282
    { EVPN_ETH_SEGMENT_ROUTE,          "Ethernet Segment Route" },
1283
    { EVPN_IP_PREFIX_ROUTE,            "IP Prefix route" },
1284
    { EVPN_MC_ETHER_TAG_ROUTE,         "Selective Multicast Ethernet Tag Route" },
1285
    { EVPN_IGMP_JOIN_ROUTE,            "IGMP Join Synch Route" },
1286
    { EVPN_IGMP_LEAVE_ROUTE,           "IGMP Leave Synch Route" },
1287
    { EVPN_PER_REG_I_PMSI_A_D_ROUTE,   "Per-Region I-PMSI A-D route" },
1288
    { EVPN_S_PMSI_A_D_ROUTE,           "S-PMSI A-D Route" },
1289
    { EVPN_LEAF_A_D_ROUTE,             "Leaf A-D route" },
1290
    { 0, NULL }
1291
};
1292
1293
static const value_string evpn_nlri_esi_type[] = {
1294
    { BGP_NLRI_EVPN_ESI_VALUE,      "ESI 9 bytes value" },
1295
    { BGP_NLRI_EVPN_ESI_LACP,       "ESI LACP 802.1AX defined" },
1296
    { BGP_NLRI_EVPN_ESI_MSTP,       "ESI MSTP defined" },
1297
    { BGP_NLRI_EVPN_ESI_MAC,        "ESI MAC address defined" },
1298
    { BGP_NLRI_EVPN_ESI_RID,        "ESI Router ID" },
1299
    { BGP_NLRI_EVPN_ESI_ASN,        "ESI Autonomous System" },
1300
    { BGP_NLRI_EVPN_ESI_RES,        "ESI reserved" },
1301
    { 0, NULL }
1302
};
1303
1304
70
#define BGP_MAJOR_ERROR_MSG_HDR       1
1305
2.90k
#define BGP_MAJOR_ERROR_OPEN_MSG      2
1306
25
#define BGP_MAJOR_ERROR_UPDATE_MSG    3
1307
67
#define BGP_MAJOR_ERROR_HT_EXPIRED    4
1308
80
#define BGP_MAJOR_ERROR_STATE_MACHINE 5
1309
1.53k
#define BGP_MAJOR_ERROR_CEASE         6
1310
108
#define BGP_MAJOR_ERROR_ROUTE_REFRESH 7
1311
#define BGP_MAJOR_ERROR_SH_T_EXPIRED  8
1312
1313
static const value_string bgpnotify_major[] = {
1314
    { BGP_MAJOR_ERROR_MSG_HDR,       "Message Header Error" },
1315
    { BGP_MAJOR_ERROR_OPEN_MSG,      "OPEN Message Error" },
1316
    { BGP_MAJOR_ERROR_UPDATE_MSG,    "UPDATE Message Error" },
1317
    { BGP_MAJOR_ERROR_HT_EXPIRED,    "Hold Timer Expired" },
1318
    { BGP_MAJOR_ERROR_STATE_MACHINE, "Finite State Machine Error" },
1319
    { BGP_MAJOR_ERROR_CEASE,         "Cease" },
1320
    { BGP_MAJOR_ERROR_ROUTE_REFRESH, "ROUTE-REFRESH Message Error" },    /* RFC 7313 - Enhanced Route Refresh Capability for BGP-4 */
1321
    { BGP_MAJOR_ERROR_SH_T_EXPIRED,  "Send Hold Timer Expired" },
1322
    { 0, NULL }
1323
};
1324
1325
static const value_string bgpnotify_minor_msg_hdr[] = {
1326
    { 1, "Connection Not Synchronized" },
1327
    { 2, "Bad Message Length" },
1328
    { 3, "Bad Message Type" },
1329
    { 0, NULL }
1330
};
1331
1332
static const value_string bgpnotify_minor_open_msg[] = {
1333
    { 1,  "Unsupported Version Number" },
1334
    { 2,  "Bad Peer AS" },
1335
    { 3,  "Bad BGP Identifier" },
1336
    { 4,  "Unsupported Optional Parameter" },
1337
    { 5,  "Authentication Failure [Deprecated]" },
1338
    { 6,  "Unacceptable Hold Time" },
1339
    { 7,  "Unsupported Capability" },
1340
    { 8,  "No supported AFI/SAFI (Cisco)" },
1341
    { 11, "Role Mismatch" },
1342
    { 0, NULL }
1343
};
1344
1345
static const value_string bgpnotify_minor_update_msg[] = {
1346
    { 1,  "Malformed Attribute List" },
1347
    { 2,  "Unrecognized Well-known Attribute" },
1348
    { 3,  "Missing Well-known Attribute" },
1349
    { 4,  "Attribute Flags Error" },
1350
    { 5,  "Attribute Length Error" },
1351
    { 6,  "Invalid ORIGIN Attribute" },
1352
    { 7,  "AS Routing Loop [Deprecated]" },
1353
    { 8,  "Invalid NEXT_HOP Attribute" },
1354
    { 9,  "Optional Attribute Error" },
1355
    { 10, "Invalid Network Field" },
1356
    { 11, "Malformed AS_PATH" },
1357
    { 0, NULL }
1358
};
1359
/* RFC6608 Subcodes for BGP Finite State Machine Error */
1360
static const value_string bgpnotify_minor_state_machine[] = {
1361
    { 1, "Receive Unexpected Message in OpenSent State" },
1362
    { 2, "Receive Unexpected Message in OpenConfirm State" },
1363
    { 3, "Receive Unexpected Message in Established State" },
1364
    { 0, NULL }
1365
};
1366
1367
#define BGP_CEASE_MINOR_MAX_REACHED       1
1368
422
#define BGP_CEASE_MINOR_ADMIN_SHUTDOWN    2
1369
#define BGP_CEASE_MINOR_PEER_DE_CONF      3
1370
143
#define BGP_CEASE_MINOR_ADMIN_RESET       4
1371
#define BGP_CEASE_MINOR_CONN_RESET        5
1372
#define BGP_CEASE_MINOR_OTHER_CONF_CHANGE 6
1373
#define BGP_CEASE_MINOR_CONN_COLLISION    7
1374
#define BGP_CEASE_MINOR_OUT_RESOURCES     8
1375
#define BGP_CEASE_MINOR_HARD_RESET        9
1376
#define BGP_CEASE_MINOR_BFD_DOWN          10
1377
1378
/* RFC4486 Subcodes for BGP Cease Notification Message */
1379
static const value_string bgpnotify_minor_cease[] = {
1380
    { BGP_CEASE_MINOR_MAX_REACHED,       "Maximum Number of Prefixes Reached"},
1381
    { BGP_CEASE_MINOR_ADMIN_SHUTDOWN,    "Administratively Shutdown"},
1382
    { BGP_CEASE_MINOR_PEER_DE_CONF,      "Peer De-configured"},
1383
    { BGP_CEASE_MINOR_ADMIN_RESET,       "Administratively Reset"},
1384
    { BGP_CEASE_MINOR_CONN_RESET,        "Connection Rejected"},
1385
    { BGP_CEASE_MINOR_OTHER_CONF_CHANGE, "Other Configuration Change"},
1386
    { BGP_CEASE_MINOR_CONN_COLLISION,    "Connection Collision Resolution"},
1387
    { BGP_CEASE_MINOR_OUT_RESOURCES,     "Out of Resources"},
1388
    { BGP_CEASE_MINOR_HARD_RESET,        "Hard Reset"},
1389
    { BGP_CEASE_MINOR_BFD_DOWN,          "BFD Down"},
1390
    { 0,                                 NULL }
1391
};
1392
1393
/* RFC7313 - Enhanced Route Refresh Capability for BGP-4 */
1394
static const value_string bgpnotify_minor_rr_msg[] = {
1395
    { 1, "Invalid Message Length" },
1396
    { 0, NULL }
1397
};
1398
1399
static const value_string bgpattr_origin[] = {
1400
    { 0, "IGP" },
1401
    { 1, "EGP" },
1402
    { 2, "INCOMPLETE" },
1403
    { 0, NULL }
1404
};
1405
1406
static const value_string bgp_open_opt_vals[] = {
1407
    { BGP_OPTION_AUTHENTICATION, "Authentication" },
1408
    { BGP_OPTION_CAPABILITY, "Capability" },
1409
    { BGP_OPTION_EXTENDED_LEN, "Extended Length"},
1410
    { 0, NULL }
1411
};
1412
1413
static const value_string as_segment_type[] = {
1414
    { 1, "AS_SET" },
1415
    { 2, "AS_SEQUENCE" },
1416
/* RFC1965 has the wrong values, corrected in  */
1417
/* draft-ietf-idr-bgp-confed-rfc1965bis-01.txt */
1418
    { 4, "AS_CONFED_SET" },
1419
    { 3, "AS_CONFED_SEQUENCE" },
1420
    { 0, NULL }
1421
};
1422
1423
static const value_string bgpattr_type[] = {
1424
    { BGPTYPE_ORIGIN,              "ORIGIN" },
1425
    { BGPTYPE_AS_PATH,             "AS_PATH" },
1426
    { BGPTYPE_NEXT_HOP,            "NEXT_HOP" },
1427
    { BGPTYPE_MULTI_EXIT_DISC,     "MULTI_EXIT_DISC" },
1428
    { BGPTYPE_LOCAL_PREF,          "LOCAL_PREF" },
1429
    { BGPTYPE_ATOMIC_AGGREGATE,    "ATOMIC_AGGREGATE" },
1430
    { BGPTYPE_AGGREGATOR,          "AGGREGATOR" },
1431
    { BGPTYPE_COMMUNITIES,         "COMMUNITIES" },
1432
    { BGPTYPE_ORIGINATOR_ID,       "ORIGINATOR_ID" },
1433
    { BGPTYPE_CLUSTER_LIST,        "CLUSTER_LIST" },
1434
    { BGPTYPE_DPA,                 "DPA" },
1435
    { BGPTYPE_ADVERTISER,          "ADVERTISER" },
1436
    { BGPTYPE_RCID_PATH,           "RCID_PATH / CLUSTER_ID" },
1437
    { BGPTYPE_MP_REACH_NLRI,       "MP_REACH_NLRI" },
1438
    { BGPTYPE_MP_UNREACH_NLRI,     "MP_UNREACH_NLRI" },
1439
    { BGPTYPE_EXTENDED_COMMUNITY,  "EXTENDED_COMMUNITIES" },
1440
    { BGPTYPE_AS4_PATH,            "AS4_PATH" },
1441
    { BGPTYPE_AS4_AGGREGATOR,      "AS4_AGGREGATOR" },
1442
    { BGPTYPE_SAFI_SPECIFIC_ATTR,  "SAFI_SPECIFIC_ATTRIBUTE" },
1443
    { BGPTYPE_CONNECTOR_ATTRIBUTE, "Connector Attribute" },
1444
    { BGPTYPE_AS_PATHLIMIT,        "AS_PATHLIMIT "},
1445
    { BGPTYPE_TUNNEL_ENCAPS_ATTR,  "TUNNEL_ENCAPSULATION_ATTRIBUTE" },
1446
    { BGPTYPE_PMSI_TUNNEL_ATTR,    "PMSI_TUNNEL_ATTRIBUTE" },
1447
    { BGPTYPE_TRAFFIC_ENGINEERING, "Traffic Engineering" },
1448
    { BGPTYPE_IPV6_ADDR_SPEC_EC,   "IPv6 Address Specific Extended Community" },
1449
    { BGPTYPE_AIGP,                "AIGP" },
1450
    { BGPTYPE_PE_DISTING_LABLES,   "PE Distinguisher Labels" },
1451
    { BGPTYPE_BGP_ENTROPY_LABEL,   "BGP Entropy Label Capability Attribute" },
1452
    { BGPTYPE_LINK_STATE_ATTR,     "BGP-LS Attribute" },
1453
    { BGPTYPE_30,                  "Deprecated" },
1454
    { BGPTYPE_31,                  "Deprecated" },
1455
    { BGPTYPE_LARGE_COMMUNITY,     "LARGE_COMMUNITY" },
1456
    { BGPTYPE_BGPSEC_PATH,         "BGPsec_PATH" },
1457
    { BGPTYPE_OTC,                 "OTC" },
1458
    { BGPTYPE_D_PATH,              "D_PATH" },
1459
    { BGPTYPE_SFP_ATTRIBUTE,       "SFP Attribute" },
1460
    { BGPTYPE_BFD_DISCRIMINATOR,   "BFD Discriminator" },
1461
    { BGPTYPE_NEXT_HOP_DEP_CAP,    "BGP Next Hop Dependent Capabilities" },
1462
    { BGPTYPE_BGP_PREFIX_SID,      "BGP Prefix-SID" },
1463
    { BGPTYPE_LINK_STATE_OLD_ATTR, "LINK_STATE (unofficial code point)" },
1464
    { BGPTYPE_ATTR_SET,            "ATTR_SET" },
1465
    { BGPTYPE_129,                 "Deprecated" },
1466
    { BGPTYPE_241,                 "Deprecated" },
1467
    { BGPTYPE_242,                 "Deprecated" },
1468
    { BGPTYPE_243,                 "Deprecated" },
1469
    { 0, NULL }
1470
};
1471
1472
static const value_string pmsi_tunnel_type[] = {
1473
    { PMSI_TUNNEL_NOPRESENT,      "Type is not present" },
1474
    { PMSI_TUNNEL_RSVPTE_P2MP,    "RSVP-TE P2MP LSP" },
1475
    { PMSI_TUNNEL_MLDP_P2MP,      "mLDP P2MP LSP" },
1476
    { PMSI_TUNNEL_PIMSSM,         "PIM SSM Tree" },
1477
    { PMSI_TUNNEL_PIMSM,          "PIM SM Tree" },
1478
    { PMSI_TUNNEL_BIDIR_PIM,      "BIDIR-PIM Tree" },
1479
    { PMSI_TUNNEL_INGRESS,        "Ingress Replication" },
1480
    { PMSI_TUNNEL_MLDP_MP2MP,     "mLDP MP2MP LSP" },
1481
    { PMSI_TUNNEL_TRANPORT,       "Transport Tunnel" },
1482
    { PMSI_TUNNEL_ASS_REPLIC,     "Assisted Replication Tunnel" },
1483
    { PMSI_TUNNEL_BIER,           "BIER" },
1484
    { PMSI_TUNNEL_SR_MPLS_P2MP,   "SR-MPLS P2MP Tree" },
1485
    { 0, NULL }
1486
};
1487
1488
static const value_string aigp_tlv_type[] = {
1489
    { AIGP_TLV_TYPE,            "Type AIGP TLV" },
1490
    { 0, NULL }
1491
};
1492
1493
static const value_string pmsi_mldp_fec_opaque_value_type[] = {
1494
    { PMSI_MLDP_FEC_TYPE_RSVD,                      "Reserved" },
1495
    { PMSI_MLDP_FEC_TYPE_GEN_LSP,                   "Generic LSP Identifier" },
1496
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SRC,          "Transit IPv4 Source" },
1497
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SRC,          "Transit IPv6 Source" },
1498
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_BIDIR,        "Transit IPv4 Bidir" },
1499
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_BIDIR,        "Transit IPv6 Bidir" },
1500
    { PMSI_MLDP_FEC_TYPE_RECURSE_OPAQUE_VALUE,      "Recursive Opaque Value" },
1501
    { PMSI_MLDP_FEC_TYPE_VPN_RECURSE_OPAQUE_VALUE,  "VPN-Recursive Opaque Value" },
1502
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_BIDIR,       "Transit VPNv4 Bidir" },
1503
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_BIDIR,       "Transit VPNv6 Bidir" },
1504
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV4_SHARED_TREE,  "Transit IPv4 Shared Tree" },
1505
    { PMSI_MLDP_FEC_TYPE_TRANSIT_IPV6_SHARED_TREE,  "Transit IPv6 Shared Tree" },
1506
    { PMSI_MLDP_FEC_TYPE_L2VPN_MCAST,               "L2VPN-MCAST application" },
1507
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV4_SRC,         "Transit VPNv4 Source" },
1508
    { PMSI_MLDP_FEC_TYPE_TRANSIT_VPNV6_SRC,         "Transit VPNv6 Source" },
1509
    { PMSI_MLDP_FEC_TYPE_EXT_TYPE,                  "Extended Type field in the following two bytes" },
1510
    { 0, NULL}
1511
};
1512
1513
static const value_string pmsi_mldp_fec_opa_extented_type[] = {
1514
    { PMSI_MLDP_FEC_ETYPE_RSVD,         "Reserved" },
1515
    { 0, NULL}
1516
};
1517
1518
static const value_string bgp_attr_tunnel_type[] = {
1519
    { TUNNEL_TYPE_L2TP_OVER_IP, "L2TPv2 over IP" },
1520
    { TUNNEL_TYPE_GRE,          "GRE" },
1521
    { TUNNEL_TYPE_TTE,          "Transmit tunnel endpoint" },
1522
    { TUNNEL_TYPE_IPSEC_IN_TM,  "IPsec in Tunnel-mode" },
1523
    { TUNNEL_TYPE_IP_IN_IP_IPSEC, "IP in IP tunnel with IPsec Transport Mode" },
1524
    { TUNNEL_TYPE_MPLS_IN_IP_IPSEC, "MPLS-in-IP tunnel with IPsec Transport Mode" },
1525
    { TUNNEL_TYPE_IP_IN_IP,     "IP in IP" },
1526
    { TUNNEL_TYPE_VXLAN,        "VXLAN Encapsulation" },
1527
    { TUNNEL_TYPE_NVGRE,        "NVGRE Encapsulation" },
1528
    { TUNNEL_TYPE_MPLS,         "MPLS Encapsulation" },
1529
    { TUNNEL_TYPE_MPLS_IN_GRE,  "MPLS in GRE Encapsulation" },
1530
    { TUNNEL_TYPE_VXLAN_GPE,    "VXLAN GPE Encapsulation" },
1531
    { TUNNEL_TYPE_MPLS_IN_UDP,  "MPLS in UDP Encapsulation" },
1532
    { TUNNEL_TYPE_IPV6_TUNNEL,  "IPv6 Tunnel" },
1533
    { TUNNEL_TYPE_SR_TE_POLICY, "SR TE Policy Type" },
1534
    { TUNNEL_TYPE_BARE,         "Bare" },
1535
    { TUNNEL_TYPE_SR_TUNNEL,    "SR Tunnel" },
1536
    { TUNNEL_TYPE_CLOUD_SECURITY, "Cloud Security" },
1537
    { TUNNEL_TYPE_GENEVE_ENCAP, "Geneve Encapsulation" },
1538
    { TUNNEL_TYPE_ANY_ENCAP,    "Any Encapsulation" },
1539
    { TUNNEL_TYPE_GTP_TUNNEL_TYPE, "GTP Tunnel Type" },
1540
    { TUNNEL_TYPE_DPS_TUNNEL_ENCAP, "Dynamic Path Selection Tunnel Encapsulation" },
1541
    { TUNNEL_TYPE_ORIGINATING_PE, "Originating PE" },
1542
    { TUNNEL_TYPE_DPS_POLICY,   "Dynamic Path Selection Policy" },
1543
    { TUNNEL_TYPE_SDWAN_HYBRID, "SDWAN Hybrid" },
1544
    { TUNNEL_TYPE_X_OVER_UDP,   "X-over-UDP" },
1545
    { TUNNEL_TYPE_DES_TUNNEL_ENCAP, "Distributed Etherlink Switch Tunnel Encapsulation" },
1546
    { 0, NULL }
1547
};
1548
1549
static const value_string subtlv_type[] = {
1550
    { TUNNEL_SUBTLV_ENCAPSULATION,  "Encapsulation" },
1551
    { TUNNEL_SUBTLV_PROTO_TYPE,     "Protocol Type" },
1552
    { TUNNEL_SUBTLV_IPSEC_TA,       "IPsec Tunnel Authenticator" },
1553
    { TUNNEL_SUBTLV_COLOR,          "Color" },
1554
    { TUNNEL_SUBTLV_LOAD_BALANCE,   "Load-Balancing Block" },
1555
    { TUNNEL_SUBTLV_REMOTE_ENDPOINT,"Tunnel Egress Endpoint" },
1556
    { TUNNEL_SUBTLV_IPV4_DS_FIELD,  "IPv4 DS Field" },
1557
    { TUNNEL_SUBTLV_UDP_DST_PORT,   "UDP Destination Port" },
1558
    { TUNNEL_SUBTLV_EMBEDDED_LABEL, "Embedded Label Handling" },
1559
    { TUNNEL_SUBTLV_MPLS_LABEL,     "MPLS Label Stack" },
1560
    { TUNNEL_SUBTLV_PREFIX_SID,     "Prefix SID" },
1561
    { TUNNEL_SUBTLV_PREFERENCE,     "Preference" },
1562
    { TUNNEL_SUBTLV_BINDING_SID,    "Binding SID" },
1563
    { TUNNEL_SUBTLV_ENLP,           "ENLP" },
1564
    { TUNNEL_SUBTLV_PRIORITY,       "Priority" },
1565
    { TUNNEL_SUBTLV_SPI_SI_REP,     "SPI/SI Representation" },
1566
    { TUNNEL_SUBTLV_SRV6_BINDING_SID, "SRv6 Binding SID" },
1567
    { TUNNEL_SUBTLV_IPSEC_SA_ID,    "IPSEC-SA-ID" },
1568
    { TUNNEL_SUBTLV_EXT_PORT_PROP,  "Extended Port Property" },
1569
    { TUNNEL_SUBTLV_UNDERLAY_ISP_PROP, "Underlay ISP Properties" },
1570
    { TUNNEL_SUBTLV_IPSEC_SA_NONCE, "IPsec SA Nonce" },
1571
    { TUNNEL_SUBTLV_IPSEC_PUBLIC_KEY, "IPsec Public Key" },
1572
    { TUNNEL_SUBTLV_IPSEC_SA_PROPOSAL, "IPsec SA Proposal" },
1573
    { TUNNEL_SUBTLV_SIMPL_IPSEC_SA, "Simplified IPsec SA" },
1574
    { TUNNEL_SUBTLV_NRP,            "NRP" },
1575
    { TUNNEL_SUBTLV_RPF,            "RPF" },
1576
    { TUNNEL_SUBTLV_TREE_LABEL_STACK, "Tree Label Stack" },
1577
    { TUNNEL_SUBTLV_SEGMENT_LIST,   "Segment List" },
1578
    { TUNNEL_SUBTLV_POLICY_CP_NAME, "Policy CP Name" },
1579
    { TUNNEL_SUBTLV_POLICY_NAME,    "Policy Name" },
1580
    { TUNNEL_SUBTLV_WAN_ID,         "The WAN ID" },
1581
    { TUNNEL_SUBTLV_BYTES,          "The Bytes" },
1582
    { TUNNEL_SUBTLV_IPSEC_DIM,      "IPSEC DIM" },
1583
    { TUNNEL_SUBTLV_IPSEC_KEY_EXCH, "IPSEC Key Exchange" },
1584
    { TUNNEL_SUBTLV_IPSEC_SA_PROPS, "IPSEC SA Proposals" },
1585
    { TUNNEL_SUBTLV_SRV_SEGMENT_LIST, "Service Segment List" },
1586
    { TUNNEL_SUBTLV_SRV_VTEP,       "Service Vtep" },
1587
    { TUNNEL_SUBTLV_DES_ADJACENCY,  "Distributed Etherlink Switch (DES) Adjacency" },
1588
    { 0, NULL }
1589
};
1590
1591
static const value_string bgp_enlp_type[] = {
1592
    { 0 , "Reserved" },
1593
    { 1 , "Push IPv4, do not push IPv6" },
1594
    { 2 , "Push IPv6, do not push IPv4" },
1595
    { 3 , "Push IPv4, push IPv6" },
1596
    { 4 , "Do not push" },
1597
    { 0, NULL }
1598
};
1599
1600
static const value_string bgp_sr_policy_list_type[] = {
1601
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A,      "Type A MPLS SID sub-TLV" },
1602
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_B,      "Type B SRv6 SID sub-TLV" },
1603
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_C,      "Type C IPv4 Node and SID sub-TLV" },
1604
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_D,      "Type D IPv6 Node and SID for SR-MPLS sub-TLV" },
1605
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_E,      "Type E IPv4 Node, index and SID sub-TLV" },
1606
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_F,      "Type F IPv4 Local/Remote addresses and SID sub-TLV" },
1607
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_G,      "Type G IPv6 Node, index for remote and local pair and SID for SR-MPLS sub-TLV" },
1608
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_H,      "Type H IPv6 Local/Remote addresses and SID sub-TLV" },
1609
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_WEIGHT, "Weight sub-TLV" },
1610
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_I,      "Type I IPv6 Node and SID for SRv6 sub-TLV" },
1611
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_J,      "Type J IPv6 Node, index for remote and local pair and SID for SRv6 sub-TLV" },
1612
    { TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_K,      "Type K IPv6 Local/Remote addresses and SID for SRv6 sub-TLV" },
1613
    { 0, NULL }
1614
};
1615
1616
static const true_false_string tfs_bgpext_com_type_auth = {
1617
    "Allocated on Standard Action, Early Allocation or Experimental Basis",
1618
    "Allocated on First Come First Serve Basis"
1619
};
1620
1621
static const value_string bgpext_com_type_high[] = {
1622
    { BGP_EXT_COM_TYPE_HIGH_TR_AS2,        "Transitive 2-Octet AS-Specific" },
1623
    { BGP_EXT_COM_TYPE_HIGH_TR_IP4,        "Transitive IPv4-Address-Specific" },
1624
    { BGP_EXT_COM_TYPE_HIGH_TR_AS4,        "Transitive 4-Octet AS-Specific" },
1625
    { BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE,     "Transitive Opaque" },
1626
    { BGP_EXT_COM_TYPE_HIGH_TR_QOS,        "Transitive QoS Marking" },
1627
    { BGP_EXT_COM_TYPE_HIGH_TR_COS,        "Transitive CoS Capability" },
1628
    { BGP_EXT_COM_TYPE_HIGH_TR_EVPN,       "Transitive EVPN" },
1629
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_I,     "FlowSpec Transitive" },
1630
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW,       "Transitive Flow spec redirect/mirror to IP next-hop" },
1631
    { BGP_EXT_COM_TYPE_HIGH_TR_FLOW_R,     "Transitive FlowSpec Redirect to indirection-id" },
1632
    { BGP_EXT_COM_TYPE_HIGH_TR_TP_CLASS,   "Transitive Transport Class" },
1633
    { BGP_EXT_COM_TYPE_HIGH_TR_SFC,        "Transitive SFC" },
1634
    { BGP_EXT_COM_TYPE_HIGH_TR_MUP,        "Transitive MUP" },
1635
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT,        "Generic Transitive Extended Community"},
1636
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT_2,      "Generic Transitive Extended Community Part 2"},
1637
    { BGP_EXT_COM_TYPE_HIGH_TR_EXT_3,      "Generic Transitive Extended Community Part 3 "},
1638
    { BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP,  "Transitive Experimental EIGRP" },
1639
    { BGP_EXT_COM_TYPE_HIGH_NTR_AS2,       "Non-Transitive 2-Octet AS-Specific" },
1640
    { BGP_EXT_COM_TYPE_HIGH_NTR_IP4,       "Non-Transitive IPv4-Address-Specific" },
1641
    { BGP_EXT_COM_TYPE_HIGH_NTR_AS4,       "Non-Transitive 4-Octet AS-Specific" },
1642
    { BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE,    "Non-Transitive Opaque" },
1643
    { BGP_EXT_COM_TYPE_HIGH_NTR_QOS,       "Non-Transitive QoS Marking" },
1644
    { BGP_EXT_COM_TYPE_HIGH_NTR_FLOWSPEC,  "FlowSpec Non-Transitive Extended Communities" },
1645
    { BGP_EXT_COM_TYPE_HIGH_NTR_TRANSPORT, "Non-Transitive Transport Class" },
1646
    { 0, NULL}
1647
};
1648
1649
static const value_string bgpext_com_stype_tr_exp_2[] = {
1650
    { BGP_EXT_COM_STYPE_EXP_2_FLOW_RED,      "Flow spec redirect IPv4 format"},
1651
    { 0, NULL}
1652
};
1653
1654
static const value_string bgpext_com_stype_tr_exp_3[] = {
1655
    { BGP_EXT_COM_STYPE_EXP_3_SEC_GROUP,     "Security Group AS4"},
1656
    { BGP_EXT_COM_STYPE_EXP_3_FLOW_RED,      "Flow spec redirect AS-4byte format"},
1657
    { BGP_EXT_COM_STYPE_EXP_3_TAG4,          "Tag4"},
1658
    { BGP_EXT_COM_STYPE_EXP_3_SUB_CLUS,      "Origin Sub-Cluster4"},
1659
    { 0, NULL}
1660
};
1661
1662
static const value_string bgpext_com_stype_tr_evpn[] = {
1663
    { BGP_EXT_COM_STYPE_EVPN_MMAC,        "MAC Mobility" },
1664
    { BGP_EXT_COM_STYPE_EVPN_LABEL,       "ESI Label" },
1665
    { BGP_EXT_COM_STYPE_EVPN_IMP,         "ES-Import Route Target" },
1666
    { BGP_EXT_COM_STYPE_EVPN_ROUTERMAC,   "EVPN Router's MAC" },
1667
    { BGP_EXT_COM_STYPE_EVPN_L2ATTR,      "EVPN Layer 2 Attributes" },
1668
    { BGP_EXT_COM_STYPE_EVPN_ETREE,       "E-Tree" },
1669
    { BGP_EXT_COM_STYPE_EVPN_DF,          "DF Election" },
1670
    { BGP_EXT_COM_STYPE_EVPN_ISID,        "I-SID" },
1671
    { BGP_EXT_COM_STYPE_EVPN_ND,          "ARP/ND" },
1672
    { BGP_EXT_COM_STYPE_EVPN_MCFLAGS,     "Multicast Flags Extended Community" },
1673
    { BGP_EXT_COM_STYPE_EVPN_EVIRT0,      "EVI-RT Type 0 Extended Community" },
1674
    { BGP_EXT_COM_STYPE_EVPN_EVIRT1,      "EVI-RT Type 1 Extended Community" },
1675
    { BGP_EXT_COM_STYPE_EVPN_EVIRT2,      "EVI-RT Type 2 Extended Community" },
1676
    { BGP_EXT_COM_STYPE_EVPN_EVIRT3,      "EVI-RT Type 3 Extended Community" },
1677
    { BGP_EXT_COM_STYPE_EVPN_ATTACHCIRT,  "EVPN Attachment Circuit" },
1678
    { BGP_EXT_COM_STYPE_EVPN_SVC_CARV_TS, "Service Carving Timestamp" },
1679
    { BGP_EXT_COM_STYPE_EVPN_LINK_BW,     "EVPN Link Bandwidth Extended Community" },
1680
    { BGP_EXT_COM_STYPE_EVPN_RT_EC,       "RT-derived-EC" },
1681
    { 0, NULL}
1682
};
1683
1684
static const value_string bgpext_com_stype_tr_as2[] = {
1685
    { BGP_EXT_COM_STYPE_AS2_RT,       "Route Target" },
1686
    { BGP_EXT_COM_STYPE_AS2_RO,       "Route Origin" },
1687
    { BGP_EXT_COM_STYPE_AS2_LBW,      "Link Bandwidth" },
1688
    { BGP_EXT_COM_STYPE_AS2_OSPF_DID, "OSPF Domain Identifier" },
1689
    { BGP_EXT_COM_STYPE_AS2_RT_AGG_P, "Route Aggregation Parameter" },
1690
    { BGP_EXT_COM_STYPE_AS2_DCOLL,    "BGP Data Collection" },
1691
    { BGP_EXT_COM_STYPE_AS2_SRC_AS,   "Source AS" },
1692
    { BGP_EXT_COM_STYPE_AS2_L2VPN,    "L2VPN Identifier" },
1693
    { BGP_EXT_COM_STYPE_AS2_CVPND,    "Cisco VPN-Distinguisher" },
1694
    { BGP_EXT_COM_STYPE_AS2_RT_REC,   "Route Target Record" },
1695
    { BGP_EXT_COM_STYPE_AS2_RT_EC,    "RT-derived-EC" },
1696
    { BGP_EXT_COM_STYPE_AS2_VNI,      "Virtual-Network Identifier" },
1697
    { 0, NULL}
1698
};
1699
1700
static const value_string bgpext_com_stype_ntr_as2[] = {
1701
    { BGP_EXT_COM_STYPE_AS2_LBW, "Link Bandwidth" },
1702
    { BGP_EXT_COM_STYPE_AS2_VNI, "Virtual-Network Identifier" },
1703
    { 0, NULL}
1704
};
1705
1706
static const value_string bgpext_com_stype_tr_as4[] = {
1707
    { BGP_EXT_COM_STYPE_AS4_RT,       "Route Target" },
1708
    { BGP_EXT_COM_STYPE_AS4_RO,       "Route Origin" },
1709
    { BGP_EXT_COM_STYPE_AS4_GEN,      "Generic" },
1710
    { BGP_EXT_COM_STYPE_AS4_BGP_DC,   "BGP Data Collection"},
1711
    { BGP_EXT_COM_STYPE_AS4_OSPF_DID, "OSPF Domain Identifier" },
1712
    { BGP_EXT_COM_STYPE_AS4_S_AS,     "Source AS" },
1713
    { BGP_EXT_COM_STYPE_AS4_CIS_V,    "Cisco VPN Identifier" },
1714
    { BGP_EXT_COM_STYPE_AS4_RT_REC,   "Route-Target Record"},
1715
    { BGP_EXT_COM_STYPE_AS4_RT_EC,    "RT-derived-EC" },
1716
    { 0, NULL}
1717
};
1718
1719
static const value_string bgpext_com_stype_ntr_as4[] = {
1720
    { BGP_EXT_COM_STYPE_AS4_GEN, "Generic" },
1721
    { 0, NULL}
1722
};
1723
1724
static const value_string bgpext_com_stype_tr_IP4[] = {
1725
    { BGP_EXT_COM_STYPE_IP4_RT,       "Route Target" },
1726
    { BGP_EXT_COM_STYPE_IP4_RO,       "Route Origin" },
1727
    { BGP_EXT_COM_STYPE_IP4_IFIT_TAIL,"IPv4-Address-Specific IFIT Tail Community" },
1728
    { BGP_EXT_COM_STYPE_IP4_OSPF_DID, "OSPF Domain Identifier" },
1729
    { BGP_EXT_COM_STYPE_IP4_OSPF_RID, "OSPF Router ID" },
1730
    { BGP_EXT_COM_STYPE_IP4_NODE_TGT, "Node Target Extended Community" },
1731
    { BGP_EXT_COM_STYPE_IP4_L2VPN,    "L2VPN Identifier" },
1732
    { BGP_EXT_COM_STYPE_IP4_VRF_I,    "VRF Route Import" },
1733
    { BGP_EXT_COM_STYPE_IP4_FLOW_RDR, "Flow-spec Redirect to IPv4" },
1734
    { BGP_EXT_COM_STYPE_IP4_CIS_D,    "Cisco VPN-Distinguisher" },
1735
    { BGP_EXT_COM_STYPE_IP4_SEG_NH,   "Inter-area P2MP Segmented Next-Hop" },
1736
    { BGP_EXT_COM_STYPE_IP4_RT_REC,   "Route-Target Record" },
1737
    { BGP_EXT_COM_STYPE_IP4_VRF_RNH,  "VRF-Recursive-Next-Hop-Extended-Community" },
1738
    { BGP_EXT_COM_STYPE_IP4_RT_EC,    "RT-derived-EC" },
1739
    { BGP_EXT_COM_STYPE_IP4_MVPN_RP,  "MVPN SA RP-address Extended Community" },
1740
    { 0, NULL}
1741
};
1742
1743
static const value_string bgpext_com_stype_ntr_IP4[] = {
1744
    { BGP_EXT_COM_STYPE_IP4_NODE_TGT, "Node Target Extended Community" },
1745
    { 0, NULL}
1746
};
1747
1748
static const value_string bgpext_com_stype_tr_opaque[] = {
1749
    { BGP_EXT_COM_STYPE_OPA_COST,      "Cost" },
1750
    { BGP_EXT_COM_STYPE_OPA_CP_OSPF,   "CP-ORF" },
1751
    { BGP_EXT_COM_STYPE_OPA_EXTN_SRC,  "Extranet Source Extended Community" },
1752
    { BGP_EXT_COM_STYPE_OPA_EXTN_SEP,  "Extranet Separation Extended Community" },
1753
    { BGP_EXT_COM_STYPE_OPA_OSPF_RT,   "OSPF Route Type" },
1754
    { BGP_EXT_COM_STYPE_OPA_PMSI_ATTR, "Additional PMSI Tunnel Attribute Flags" },
1755
    { BGP_EXT_COM_STYPE_OPA_CTX_LBL,   "Context-Specific Label Space ID Extended Community" },
1756
    { BGP_EXT_COM_STYPE_OPA_COLOR,     "Color" },
1757
    { BGP_EXT_COM_STYPE_OPA_ENCAP,     "Encapsulation" },
1758
    { BGP_EXT_COM_STYPE_OPA_DGTW,      "Default Gateway" },
1759
    { BGP_EXT_COM_STYPE_OPA_PPMP_LBL,  "Point-to-Point-to-Multipoint (PPMP) Label" },
1760
    { BGP_EXT_COM_STYPE_OPA_GRP_TAG,   "BGP Group Policy Class Tag Extended Community" },
1761
    { BGP_EXT_COM_STYPE_OPA_HSH_SRT,   "Consistent Hash Sort Order" },
1762
    { BGP_EXT_COM_STYPE_OPA_GRP_PID,   "Group Policy ID Extended Community" },
1763
    { BGP_EXT_COM_STYPE_OPA_LCM,       "Local Color Mapping (LCM)" },
1764
    { BGP_EXT_COM_STYPE_OPA_LOADBAL,   "LoadBalance" },
1765
    { 0, NULL}
1766
};
1767
1768
static const value_string bgpext_com_cost_poi_type[] = {
1769
    { BGP_EXT_COM_COST_POI_ORIGIN,  "\"Lowest Origin code\" step" },
1770
    { BGP_EXT_COM_COST_POI_ASPATH,  "\"Shortest AS_PATH\" step" },
1771
    { BGP_EXT_COM_COST_POI_MED,     "\"Lowest MED\" step" },
1772
    { BGP_EXT_COM_COST_POI_LP,      "\"Highest Local Preference\" step" },
1773
    { BGP_EXT_COM_COST_POI_AIGP,    "\"Lowest Accumulated IGP Cost\" step" },
1774
    { BGP_EXT_COM_COST_POI_ABS,     "Before BGP Best Path algorithm" },
1775
    { BGP_EXT_COM_COST_POI_IGP,     "\"Smallest IGP Metric\" step" },
1776
    { BGP_EXT_COM_COST_POI_EI,      "\"Prefer eBGP to iBGP\" step" },
1777
    { BGP_EXT_COM_COST_POI_RID,     "\"Smallest BGP RID\" step" },
1778
    { 0,NULL}
1779
};
1780
1781
static const value_string bgpext_com_tunnel_type[] = {
1782
    { BGP_EXT_COM_TUNNEL_RESERVED,      "Reserved" },
1783
    { BGP_EXT_COM_TUNNEL_L2TPV3,        "L2TPv3 over IP" },
1784
    { BGP_EXT_COM_TUNNEL_GRE,           "GRE" },
1785
    { BGP_EXT_COM_TUNNEL_ENDP,          "Transmit tunnel endpoint" },
1786
    { BGP_EXT_COM_TUNNEL_IPSEC,         "IPsec in Tunnel-mode" },
1787
    { BGP_EXT_COM_TUNNEL_IPIPSEC,       "IP in IP tunnel with IPsec Transport Mode" },
1788
    { BGP_EXT_COM_TUNNEL_MPLSIP,        "MPLS-in-IP tunnel with IPsec Transport Mode" },
1789
    { BGP_EXT_COM_TUNNEL_IPIP,          "IP in IP" },
1790
    { BGP_EXT_COM_TUNNEL_VXLAN,         "VXLAN Encapsulation" },
1791
    { BGP_EXT_COM_TUNNEL_NVGRE,         "NVGRE Encapsulation" },
1792
    { BGP_EXT_COM_TUNNEL_MPLS,          "MPLS Encapsulation" },
1793
    { BGP_EXT_COM_TUNNEL_MPLSGRE,       "MPLS in GRE Encapsulation" },
1794
    { BGP_EXT_COM_TUNNEL_VXLANGPE,      "VxLAN GPE Encapsulation" },
1795
    { BGP_EXT_COM_TUNNEL_MPLSUDP,       "MPLS in UDP Encapsulation" },
1796
    { BGP_EXT_COM_TUNNEL_IPV6_TUNNEL,   "IPv6 Tunnel" },
1797
    { BGP_EXT_COM_TUNNEL_SE_TE_POLICY,  "SR TE Policy Type" },
1798
    { BGP_EXT_COM_TUNNEL_BARE,          "Bare" },
1799
    { BGP_EXT_COM_TUNNEL_SR_TUNNEL,     "SR Tunnel" },
1800
    { BGP_EXT_COM_TUNNEL_CLOUD_SEC,     "Cloud Security" },
1801
    { BGP_EXT_COM_TUNNEL_GENEVE_ENCAP,  "Geneve Encapsulation" },
1802
    { BGP_EXT_COM_TUNNEL_ANY_ENCAP,     "Any Encapsulation" },
1803
    { BGP_EXT_COM_TUNNEL_GTP_TUNNEL,    "GTP Tunnel Type" },
1804
    { BGP_EXT_COM_TUNNEL_DPS_TUNNEL,    "Dynamic Path Selection (DPS) Tunnel Encapsulation" },
1805
    { BGP_EXT_COM_TUNNEL_OPE,           "Originating PE (OPE)" },
1806
    { BGP_EXT_COM_TUNNEL_DYN_DPS_POL,   "Dynamic Path Selection (DPS) Policy" },
1807
    { BGP_EXT_COM_TUNNEL_SDWAN_HYB,     "SDWAN-Hybrid" },
1808
    { BGP_EXT_COM_TUNNEL_X_OVER_UDP,    "X-over-UDP" },
1809
    { BGP_EXT_COM_TUNNEL_DES_ENCAP,     "Distributed Etherlink Switch (DES) Tunnel Encapsulation" },
1810
    { 0, NULL}
1811
};
1812
1813
static const value_string bgpext_com_stype_ntr_opaque[] = {
1814
    { BGP_EXT_COM_STYPE_OPA_OR_VAL_ST,  "BGP Origin Validation state" },
1815
    { BGP_EXT_COM_STYPE_OPA_COST,       "Cost Community" },
1816
    { BGP_EXT_COM_STYPE_OPA_RT,         "Route Target" },
1817
    { BGP_EXT_COM_STYPE_OPA_RT_EC,      "RT-derived-EC" },
1818
    { 0, NULL}
1819
};
1820
1821
static const value_string bgpext_com_stype_tr_exp[] = {
1822
    { BGP_EXT_COM_STYPE_EXP_OSPF_RT,    "OSPF Route Type" },
1823
    { BGP_EXT_COM_STYPE_EXP_OSPF_RID,   "OSPF Router ID" },
1824
    { BGP_EXT_COM_STYPE_EXP_SEC_GROUP,  "Security Group" },
1825
    { BGP_EXT_COM_STYPE_EXP_OSPF_DID,   "OSPF Domain Identifier" },
1826
    { BGP_EXT_COM_STYPE_EXP_F_TR,       "Flow spec traffic-rate" },
1827
    { BGP_EXT_COM_STYPE_EXP_F_TA,       "Flow spec traffic-action" },
1828
    { BGP_EXT_COM_STYPE_EXP_F_RED,      "Flow spec redirect AS 2 bytes" },
1829
    { BGP_EXT_COM_STYPE_EXP_F_RMARK,    "Flow spec traffic-remarking" },
1830
    { BGP_EXT_COM_STYPE_EXP_L2,         "Layer2 Info" },
1831
    { BGP_EXT_COM_STYPE_EXP_ETREE,      "E-Tree Info" },
1832
    { BGP_EXT_COM_STYPE_EXP_FLOW_RATE,  "Flow spec traffic-rate-packets" },
1833
    { BGP_EXT_COM_STYPE_EXP_FLOW_SFC,   "Flow Specification for SFC Classifiers" },
1834
    { BGP_EXT_COM_STYPE_EXP_TAG,        "Tag" },
1835
    { BGP_EXT_COM_STYPE_EXP_SUB_CLUS,   "Origin Sub-Cluster" },
1836
    { 0, NULL}
1837
};
1838
1839
static const value_string bgpext_com_stype_tr_eigrp[] = {
1840
    { BGP_EXT_COM_STYPE_EXP_EIGRP_FT,   "EIGRP Route Flags, Route Tag" },
1841
    { BGP_EXT_COM_STYPE_EXP_EIGRP_AD,   "EIGRP AS Number, Delay" },
1842
    { BGP_EXT_COM_STYPE_EXP_EIGRP_RHB,  "EIGRP Reliability, Hop Count, Bandwidth" },
1843
    { BGP_EXT_COM_STYPE_EXP_EIGRP_LM,   "EIGRP Load, MTU" },
1844
    { BGP_EXT_COM_STYPE_EXP_EIGRP_EAR,  "EIGRP External AS Number, Router ID" },
1845
    { BGP_EXT_COM_STYPE_EXP_EIGRP_EPM,  "EIGRP External Protocol, Metric" },
1846
    { BGP_EXT_COM_STYPE_EXP_EIGRP_RID,  "EIGRP Originating Router ID" },
1847
    { 0, NULL}
1848
};
1849
1850
static const value_string bgpext_com_stype_tr_mup[] = {
1851
    { BGP_EXT_COM_STYPE_MUP_DIRECT_SEG, "MUP Direct-Type Segment Identifier"},
1852
    { 0, NULL}
1853
};
1854
1855
static const value_string flow_spec_op_len_val[] = {
1856
    { 0, "1 byte: 1 <<"  },
1857
    { 1, "2 bytes: 1 <<" },
1858
    { 2, "4 bytes: 1 <<" },
1859
    { 3, "8 bytes: 1 <<" },
1860
    { 0, NULL  }
1861
};
1862
1863
static const value_string qos_tech_type[] = {
1864
    { QOS_TECH_TYPE_DSCP,         "DiffServ enabled IP (DSCP encoding)" },
1865
    { QOS_TECH_TYPE_802_1q,       "Ethernet using 802.1q priority tag" },
1866
    { QOS_TECH_TYPE_E_LSP,        "MPLS using E-LSP" },
1867
    { QOS_TECH_TYPE_VC,           "Virtual Channel (VC) encoding" },
1868
    { QOS_TECH_TYPE_GMPLS_TIME,   "GMPLS - time slot encoding" },
1869
    { QOS_TECH_TYPE_GMPLS_LAMBDA, "GMPLS - lambda encoding" },
1870
    { QOS_TECH_TYPE_GMPLS_FIBRE,  "GMPLS - fibre encoding" },
1871
    { 0, NULL }
1872
};
1873
1874
static const value_string bgp_ssa_type[] = {
1875
    { BGP_SSA_L2TPv3 ,          "L2TPv3 Tunnel" },
1876
    { BGP_SSA_mGRE ,            "mGRE Tunnel" },
1877
    { BGP_SSA_IPSec ,           "IPSec Tunnel" },
1878
    { BGP_SSA_MPLS ,            "MPLS Tunnel" },
1879
    { BGP_SSA_L2TPv3_IN_IPSec , "L2TPv3 in IPSec Tunnel" },
1880
    { BGP_SSA_mGRE_IN_IPSec ,   "mGRE in IPSec Tunnel" },
1881
    { 0, NULL }
1882
};
1883
1884
/*
1885
 * BGP Layer 2 Encapsulation Types
1886
 *
1887
 * RFC 6624
1888
 *
1889
 * http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-l2-encapsulation-types-registry
1890
 */
1891
static const value_string bgp_l2vpn_encaps[] = {
1892
    { 0,  "Reserved"},
1893
    { 1,  "Frame Relay"},
1894
    { 2,  "ATM AAL5 SDU VCC transport"},
1895
    { 3,  "ATM transparent cell transport"},
1896
    { 4,  "Ethernet (VLAN) Tagged mode"},
1897
    { 5,  "Ethernet raw mode"},
1898
    { 6,  "Cisco-HDLC"},
1899
    { 7,  "PPP"},
1900
    { 8,  "SONET/SDH CES"},
1901
    { 9,  "ATM n-to-one VCC cell transport"},
1902
    { 10, "ATM n-to-one VPC cell transport"},
1903
    { 11, "IP layer 2 transport"},
1904
    { 15, "Frame relay port mode"},
1905
    { 17, "Structure agnostic E1 over packet"},
1906
    { 18, "Structure agnostic T1 over packet"},
1907
    { 19, "VPLS"},
1908
    { 20, "Structure agnostic T3 over packet"},
1909
    { 21, "Nx64kbit/s Basic Service using Structure-aware"},
1910
    { 25, "Frame Relay DLCI"},
1911
    { 40, "Structure agnostic E3 over packet"},
1912
    { 41, "Octet-aligned playload for structure-agnostic DS1 circuits"},
1913
    { 42, "E1 Nx64kbit/s with CAS using Structure-aware"},
1914
    { 43, "DS1 (ESF) Nx64kbit/s with CAS using Structure-aware"},
1915
    { 44, "DS1 (SF) Nx64kbit/s with CAS using Structure-aware"},
1916
    { 64, "IP-interworking"},
1917
    { 0, NULL }
1918
};
1919
1920
static const value_string bgpext_com_ospf_rtype[] = {
1921
  { BGP_OSPF_RTYPE_RTR, "Router" },
1922
  { BGP_OSPF_RTYPE_NET, "Network" },
1923
  { BGP_OSPF_RTYPE_SUM, "Summary" },
1924
  { BGP_OSPF_RTYPE_EXT, "External" },
1925
  { BGP_OSPF_RTYPE_NSSA,"NSSA External" },
1926
  { BGP_OSPF_RTYPE_SHAM,"MPLS-VPN Sham" },
1927
  { 0, NULL }
1928
};
1929
1930
/* Subsequent address family identifier, RFC4760 */
1931
static const value_string bgpattr_nlri_safi[] = {
1932
    { 0,                        "Reserved" },
1933
    { SAFNUM_UNICAST,           "Unicast" },
1934
    { SAFNUM_MULCAST,           "Multicast" },
1935
    { SAFNUM_UNIMULC,           "Unicast+Multicast (Deprecated)" },
1936
    { SAFNUM_MPLS_LABEL,        "Labeled Unicast" },
1937
    { SAFNUM_MCAST_VPN,         "MCAST-VPN" },
1938
    { SAFNUM_MULTISEG_PW,       "Multi-Segment Pseudowires" },
1939
    { SAFNUM_ENCAPSULATION,     "Encapsulation (Deprecated)" },
1940
    { SAFNUM_MCAST_VPLS,        "MCAST-VPLS" },
1941
    { SAFNUM_TUNNEL,            "Tunnel (Deprecated)" },
1942
    { SAFNUM_VPLS,              "VPLS" },
1943
    { SAFNUM_MDT,               "Cisco MDT" },
1944
    { SAFNUM_4OVER6,            "4over6" },
1945
    { SAFNUM_6OVER4,            "6over4" },
1946
    { SAFNUM_L1VPN,             "Layer-1 VPN" },
1947
    { SAFNUM_EVPN,              "EVPN" },
1948
    { SAFNUM_BGP_LS,            "BGP-LS" },
1949
    { SAFNUM_BGP_LS_VPN,        "BGP-LS-VPN" },
1950
    { SAFNUM_SR_POLICY,         "SR Policy" },
1951
    { SAFNUM_SD_WAN,            "SD-WAN" },
1952
    { SAFNUM_RPD,               "Routing Policy Distribution" },
1953
    { SAFNUM_CT,                "Classful Transport Planes" },
1954
    { SAFNUM_FLOWSPEC,          "Tunneled Traffic Flowspec" },
1955
    { SAFNUM_MCAST_TREE,        "MCAST-TREE" },
1956
    { SAFNUM_BGP_DPS,           "Dynamic Path Selection" },
1957
    { SAFNUM_BGP_LS_SPF,        "BGP-LS-SPF" },
1958
    { SAFNUM_BGP_CAR,           "BGP-CAR" },
1959
    { SAFNUM_BGP_VPN_CAR,       "BGP-VPN-CAR" },
1960
    { SAFNUM_BGP_MUP,           "BGP-MUP" },
1961
    { SAFNUM_LAB_VPNUNICAST,    "Labeled VPN Unicast" },
1962
    { SAFNUM_LAB_VPNMULCAST,    "Labeled VPN Multicast" },
1963
    { SAFNUM_LAB_VPNUNIMULC,    "Labeled VPN Unicast+Multicast (Deprecated)" },
1964
    { SAFNUM_ROUTE_TARGET,      "Route Target Filter" },
1965
    { SAFNUM_FSPEC_RULE,        "Flow Spec Filter" },
1966
    { SAFNUM_FSPEC_VPN_RULE,    "Flow Spec Filter VPN" },
1967
    { SAFNUM_L3VPN,             "Layer-3 VPN (Deprecated)" },
1968
    { 0, NULL }
1969
};
1970
1971
/* ORF Type, RFC5291 */
1972
static const value_string orf_type_vals[] = {
1973
    /* first 3 entries: questionable origin */
1974
    { BGP_ORF_COMM,           "(unregistered) Communities ORF-Type" },
1975
    { BGP_ORF_EXTCOMM,        "(unregistered) Extended Communities ORF-Type" },
1976
    { BGP_ORF_ASPATH,         "(unregistered) AS-path ORF-Type" },
1977
    /* IANA registered */
1978
    { BGP_ORF_PREFIX,         "Address Prefix ORF" },
1979
    { BGP_ORF_CP_ORF,         "CP-ORF" },
1980
    { BGP_ORF_VPN_PREFIX,     "VPN Prefix ORF" },
1981
    /* vendor-specific */
1982
    { BGP_ORF_PREFIX_CISCO,   "Cisco PrefixList ORF-Type" },
1983
    { BGP_ORF_COMM_CISCO,     "Cisco CommunityList ORF-Type" },
1984
    { BGP_ORF_EXTCOMM_CISCO,  "Cisco Extended CommunityList ORF-Type" },
1985
    { BGP_ORF_ASPATH_CISCO,   "Cisco AsPathList ORF-Type" },
1986
    { 0,        NULL }
1987
};
1988
1989
/* ORF Send/Receive, RFC5291 */
1990
static const value_string orf_send_recv_vals[] = {
1991
    { 1,        "Receive" },
1992
    { 2,        "Send" },
1993
    { 3,        "Both" },
1994
    { 0,        NULL }
1995
};
1996
1997
/* ORF Send/Receive, RFC5291 */
1998
static const value_string orf_when_vals[] = {
1999
    { 1,        "Immediate" },
2000
    { 2,        "Defer" },
2001
    { 0,        NULL }
2002
};
2003
2004
static const value_string orf_entry_action_vals[] = {
2005
    { BGP_ORF_ADD,          "Add" },
2006
    { BGP_ORF_REMOVE,       "Remove" },
2007
    { BGP_ORF_REMOVEALL,    "RemoveAll" },
2008
    { 0,        NULL }
2009
};
2010
2011
static const value_string orf_entry_match_vals[] = {
2012
    { BGP_ORF_PERMIT,   "Permit" },
2013
    { BGP_ORF_DENY,     "Deny" },
2014
    { 0,        NULL }
2015
};
2016
2017
/* BGPsec Send/Receive, RFC8205 */
2018
static const value_string bgpsec_send_receive_vals[] = {
2019
    { 0,        "Receive" },
2020
    { 1,        "Send" },
2021
    { 0,        NULL }
2022
};
2023
2024
/* BGP Role, RFC9234 */
2025
static const value_string bgprole_vals[] = {
2026
    { 0,        "Provider" },
2027
    { 1,        "RS" },
2028
    { 2,        "RS-Client" },
2029
    { 3,        "Customer" },
2030
    { 4,        "Peer" },
2031
    { 0,        NULL }
2032
};
2033
2034
static const value_string capability_vals[] = {
2035
    { BGP_CAPABILITY_RESERVED,                      "Reserved capability" },
2036
    { BGP_CAPABILITY_MULTIPROTOCOL,                 "Multiprotocol extensions capability" },
2037
    { BGP_CAPABILITY_ROUTE_REFRESH,                 "Route refresh capability" },
2038
    { BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING,   "Cooperative route filtering capability" },
2039
    { BGP_CAPABILITY_MULTIPLE_ROUTE_DEST,           "Multiple routes to a destination capability" },
2040
    { BGP_CAPABILITY_EXTENDED_NEXT_HOP,             "Extended Next Hop Encoding" },
2041
    { BGP_CAPABILITY_EXTENDED_MESSAGE,              "BGP-Extended Message" },
2042
    { BGP_CAPABILITY_BGPSEC,                        "BGPsec capability" },
2043
    { BGP_CAPABILITY_MULTIPLE_LABELS,               "Multiple Labels capability" },
2044
    { BGP_CAPABILITY_BGP_ROLE,                      "BGP Role" },
2045
    { BGP_CAPABILITY_GRACEFUL_RESTART,              "Graceful Restart capability" },
2046
    { BGP_CAPABILITY_4_OCTET_AS_NUMBER,             "Support for 4-octet AS number capability" },
2047
    { BGP_CAPABILITY_DYNAMIC_CAPABILITY_CISCO,      "Deprecated Dynamic Capability (Cisco)" },
2048
    { BGP_CAPABILITY_DYNAMIC_CAPABILITY,            "Support for Dynamic capability" },
2049
    { BGP_CAPABILITY_MULTISESSION,                  "Multisession BGP Capability" },
2050
    { BGP_CAPABILITY_ADDITIONAL_PATHS,              "Support for Additional Paths" },
2051
    { BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH,        "Enhanced route refresh capability" },
2052
    { BGP_CAPABILITY_LONG_LIVED_GRACEFUL_RESTART,   "Long-Lived Graceful Restart (LLGR) Capability" },
2053
    { BGP_CAPABILITY_CP_ORF,                        "CP-ORF Capability" },
2054
    { BGP_CAPABILITY_FQDN,                          "FQDN Capability" },
2055
    { BGP_CAPABILITY_BFD_STRICT,                    "BFD Strict-Mode capability" },
2056
    { BGP_CAPABILITY_SOFT_VERSION,                  "Software Version Capability" },
2057
    { BGP_CAPABILITY_PATHS_LIMIT,                   "PATHS-LIMIT Capability" },
2058
    { BGP_CAPABILITY_ROUTE_REFRESH_CISCO,           "Route Refresh Capability (Cisco)" },
2059
    { BGP_CAPABILITY_RPD_CISCO,                     "Routing Policy Distribution (Cisco)" },
2060
    { BGP_CAPABILITY_ORF_CISCO,                     "Outbound Route Filtering (Cisco)" },
2061
    { BGP_CAPABILITY_MULTISESSION_CISCO,            "Multisession (Cisco)" },
2062
    { BGP_CAPABILITY_FQDN_CISCO,                    "FQDN (Cisco)" },
2063
    { BGP_CAPABILITY_OPERATIONAL_MSG_CISCO,         "OPERATIONAL message (Cisco)" },
2064
    { BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP,           "Link-Local Next Hop Capability" },
2065
    { 0, NULL }
2066
};
2067
2068
static const value_string community_vals[] = {
2069
    { BGP_COMM_GRACEFUL_SHUTDOWN,   "GRACEFUL_SHUTDOWN" },
2070
    { BGP_COMM_ACCEPT_OWN,          "ACCEPT_OWN" },
2071
    { BGP_COMM_RT_FLTR_XLTD_V4,     "ROUTE_FILTER_TRANSLATED_v4" },
2072
    { BGP_COMM_RT_FLTR_V4,          "ROUTE_FILTER_v4" },
2073
    { BGP_COMM_RT_FLTR_XLTD_V6,     "ROUTE_FILTER_TRANSLATED_v6" },
2074
    { BGP_COMM_RT_FLTR_V6,          "ROUTE_FILTER_v6" },
2075
    { BGP_COMM_LLGR_STALE,          "LLGR_STALE" },
2076
    { BGP_COMM_NO_LLGR,             "NO_LLGR" },
2077
    { BGP_COMM_ACCEPT_OWN_HOP,      "accept-own-nexthop" },
2078
    { BGP_COMM_STANDBY_PE,          "Standby PE" },
2079
    { BGP_COMM_BLACKHOLE,           "BLACKHOLE" },
2080
    { BGP_COMM_NO_EXPORT,           "NO_EXPORT" },
2081
    { BGP_COMM_NO_ADVERTISE,        "NO_ADVERTISE" },
2082
    { BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
2083
    { BGP_COMM_NOPEER,              "NOPEER" },
2084
    { 0,                            NULL }
2085
};
2086
2087
/* Capability Message action code */
2088
static const value_string bgpcap_action[] = {
2089
    { 0, "advertising a capability" },
2090
    { 1, "removing a capability" },
2091
    { 0, NULL }
2092
};
2093
2094
static const value_string mcast_vpn_route_type[] = {
2095
    { MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD, "Intra-AS I-PMSI A-D route" },
2096
    { MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD, "Inter-AS I-PMSI A-D route" },
2097
    { MCAST_VPN_RTYPE_SPMSI_AD         , "S-PMSI A-D route" },
2098
    { MCAST_VPN_RTYPE_LEAF_AD          , "Leaf A-D route" },
2099
    { MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD , "Source Active A-D route" },
2100
    { MCAST_VPN_RTYPE_SHARED_TREE_JOIN , "Shared Tree Join route" },
2101
    { MCAST_VPN_RTYPE_SOURCE_TREE_JOIN , "Source Tree Join route" },
2102
    { 0, NULL }
2103
};
2104
2105
/* NLRI type value_string as defined in idr-ls */
2106
static const value_string bgp_ls_nlri_type_vals[] = {
2107
    { LINK_STATE_NODE_NLRI,                 "Node NLRI" },
2108
    { LINK_STATE_LINK_NLRI,                 "Link NLRI" },
2109
    { LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI, "IPv4 Topology Prefix NLRI" },
2110
    { LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI, "IPv6 Topology Prefix NLRI" },
2111
    { LINK_STATE_SR_POLICY_CANDIDATE_PATH,  "ST Policy Candidate Path NLRI" },
2112
    { LINK_STATE_SRV6_SID_NLRI,             "SRv6 SID NLRI" },
2113
    { LINK_STATE_STUB_LINK_NLRI,            "Stub Link NLRI" },
2114
    { 0, NULL },
2115
};
2116
2117
/* Link-State NLRI Protocol-ID value strings */
2118
static const value_string link_state_nlri_protocol_id_values[] = {
2119
    { BGP_LS_NLRI_PROTO_ID_UNKNOWN,         "Unknown" },
2120
    { BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1,   "IS-IS Level 1"},
2121
    { BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2,   "IS-IS Level 2"},
2122
    { BGP_LS_NLRI_PROTO_ID_OSPF_V2,         "OSPFv2"},
2123
    { BGP_LS_NLRI_PROTO_ID_DIRECT,          "Direct"},
2124
    { BGP_LS_NLRI_PROTO_ID_STATIC,          "Static"},
2125
    { BGP_LS_NLRI_PROTO_ID_OSPF_V3,         "OSPFv3"},
2126
    { BGP_LS_NLRI_PROTO_ID_BGP,             "BGP"},
2127
    { BGP_LS_NLRI_PROTO_ID_RSVP_TE,         "RSVP-TE" },
2128
    { BGP_LS_NLRI_PROTO_ID_SEGMENT_ROUTING, "Segment Routing" },
2129
    { 0, NULL},
2130
};
2131
2132
/* Link-State routing universes */
2133
static const val64_string link_state_nlri_routing_universe_values[] = {
2134
    { BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_3, "L3 packet topology" },
2135
    { BGP_LS_NLRI_ROUTING_UNIVERSE_LEVEL_1, "L1 optical topology"},
2136
    { 0, NULL}
2137
};
2138
2139
/* Link state prefix NLRI OSPF Route Type */
2140
static const value_string link_state_prefix_descriptors_ospf_route_type[] = {
2141
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_UNKNOWN,     "Unknown" },
2142
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTRA_AREA,  "Intra-Area"},
2143
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_INTER_AREA,  "Inter Area"},
2144
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_1,  "External 1"},
2145
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_EXTERNAL_2,  "External 2"},
2146
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_1,      "NSSA 1"},
2147
    { BGP_LS_PREFIX_OSPF_ROUTE_TYPE_NSSA_2,      "NSSA 2"},
2148
    { 0 , NULL}
2149
};
2150
2151
/* Link state Flex Algo Metric Type: draft-ietf-lsr-flex-algo-17 */
2152
static const value_string flex_algo_metric_types[] = {
2153
    { 0, "IGP Metric"},
2154
    { 1, "Min Unidirectional Link Delay"},
2155
    { 2, "TE Metric"},
2156
    { 0, NULL }
2157
};
2158
2159
/* Link state IGP Algorithm Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
2160
static const value_string igp_algo_types[] = {
2161
    { 0,   "Shortest Path First (SPF)" },
2162
    { 1,   "Strict Shortest Path First (Strict SPF)" },
2163
    { 0,   NULL }
2164
};
2165
2166
/* Link state IGP MSD Type: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml */
2167
static const value_string igp_msd_types[] = {
2168
    { 0,   "Reserved" },
2169
    { 1,   "Base MPLS Imposition MSD" },
2170
    { 2,   "ERLD-MSD" },
2171
    { 41,  "SRH Max SL" },
2172
    { 42,  "SRH Max End Pop" },
2173
    { 44,  "SRH Max H.Encaps" },
2174
    { 45,  "SRH Max End D" },
2175
    { 0,   NULL }
2176
};
2177
2178
/* NLRI type value_string as define in BGP flow spec RFC */
2179
2180
static const value_string flowspec_nlri_opvaluepair_type[] = {
2181
    { BGPNLRI_FSPEC_DST_PFIX, "Destination prefix filter" },
2182
    { BGPNLRI_FSPEC_SRC_PFIX, "Source prefix filter" },
2183
    { BGPNLRI_FSPEC_IP_PROTO, "Protocol / Next Header filter" },
2184
    { BGPNLRI_FSPEC_PORT,     "Port filter" },
2185
    { BGPNLRI_FSPEC_DST_PORT, "Destination port filter" },
2186
    { BGPNLRI_FSPEC_SRC_PORT, "Source port filter" },
2187
    { BGPNLRI_FSPEC_ICMP_TP,  "ICMP type filter" },
2188
    { BGPNLRI_FSPEC_ICMP_CD,  "ICMP code filter" },
2189
    { BGPNLRI_FSPEC_TCP_FLAGS,"TCP flags filter" },
2190
    { BGPNLRI_FSPEC_PCK_LEN,  "Packet Length filter" },
2191
    { BGPNLRI_FSPEC_DSCP,     "DSCP marking filter" },
2192
    { BGPNLRI_FSPEC_FRAGMENT, "IP fragment filter" },
2193
    { 0, NULL },
2194
};
2195
2196
/* Subtype Route Refresh, draft-ietf-idr-bgp-enhanced-route-refresh-02 */
2197
static const value_string route_refresh_subtype_vals[] = {
2198
    { 0, "Normal route refresh request [RFC2918] with/without ORF [RFC5291]" },
2199
    { 1, "Demarcation of the beginning of a route refresh" },
2200
    { 2, "Demarcation of the ending of a route refresh" },
2201
    { 0,  NULL }
2202
};
2203
2204
static const value_string bgp_prefix_sid_type[] = {
2205
    { BGP_PREFIX_SID_TLV_LABEL_INDEX,     "Label-Index" },
2206
    { BGP_PREFIX_SID_TLV_2,               "Deprecated" },
2207
    { BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB, "Originator SRGB" },
2208
    { BGP_PREFIX_SID_TLV_4,               "Deprecated" },
2209
    { BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE, "SRv6 L3 Service" },
2210
    { BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE, "SRv6 L2 Service" },
2211
    { 0, NULL }
2212
};
2213
2214
static const value_string srv6_service_sub_tlv_type[] = {
2215
    { SRV6_SERVICE_SRV6_SID_INFORMATION,   "SRv6 SID Information" },
2216
    { 0,  NULL }
2217
};
2218
2219
static const value_string srv6_service_data_sub_sub_tlv_type[] = {
2220
    { SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE,   "SRv6 SID Structure" },
2221
    { 0,  NULL }
2222
};
2223
2224
/* SRv6 Endpoint behavior value_string [RFC 8986]. */
2225
static const value_string srv6_endpoint_behavior[] = {
2226
    { SRV6_ENDPOINT_BEHAVIOR_END,                    "End" },
2227
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP,                "End with PSP" },
2228
    { SRV6_ENDPOINT_BEHAVIOR_END_USP,                "End with USP" },
2229
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP,            "End with PSP & USP" },
2230
    { SRV6_ENDPOINT_BEHAVIOR_END_X,                  "End.X" },
2231
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP,              "End.X with PSP" },
2232
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USP,              "End.X with USP" },
2233
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP,          "End.X with PSP & USP" },
2234
    { SRV6_ENDPOINT_BEHAVIOR_END_T,                  "End.T" },
2235
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP,              "End.T with PSP" },
2236
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USP,              "End.T with USP" },
2237
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP,          "End.T with PSP & USP" },
2238
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT,          "End.B6.Insert" },
2239
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS,          "End.B6.Encaps" },
2240
    { SRV6_ENDPOINT_BEHAVIOR_END_BM,                 "End.BM" },
2241
    { SRV6_ENDPOINT_BEHAVIOR_END_DX6,                "End.DX6" },
2242
    { SRV6_ENDPOINT_BEHAVIOR_END_DX4,                "End.DX4" },
2243
    { SRV6_ENDPOINT_BEHAVIOR_END_DT6,                "End.DT6" },
2244
    { SRV6_ENDPOINT_BEHAVIOR_END_DT4,                "End.DT4" },
2245
    { SRV6_ENDPOINT_BEHAVIOR_END_DT46,               "End.DT46" },
2246
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2,                "End.DX2" },
2247
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2V,               "End.DX2V" },
2248
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2U,               "End.DT2U" },
2249
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2M,               "End.DT2M" },
2250
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_INSERT_RED,      "End.B6.Insert.Red" },
2251
    { SRV6_ENDPOINT_BEHAVIOR_END_B6_ENCAPS_RED,      "End.B6.Encaps.Red" },
2252
    { SRV6_ENDPOINT_BEHAVIOR_END_USD,                "End with USD" },
2253
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD,            "End with PSP & USD" },
2254
    { SRV6_ENDPOINT_BEHAVIOR_END_USP_USD,            "End with USP & USD" },
2255
    { SRV6_ENDPOINT_BEHAVIOR_END_PSP_USP_USD,        "End with PSP, USP & USD" },
2256
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USD,              "End.X with USD" },
2257
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD,          "End.X with PSP & USD" },
2258
    { SRV6_ENDPOINT_BEHAVIOR_END_X_USP_USD,          "End.X with USP & USD" },
2259
    { SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USP_USD,      "End.X with PSP, USP & USD" },
2260
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USD,              "End.T with USD" },
2261
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USD,          "End.T with PSP & USD" },
2262
    { SRV6_ENDPOINT_BEHAVIOR_END_T_USP_USD,          "End.T with USP & USD" },
2263
    { SRV6_ENDPOINT_BEHAVIOR_END_T_PSP_USP_USD,      "End.T with PSP, USP & USD" },
2264
    { SRV6_ENDPOINT_BEHAVIOR_END_MAP,                "End.MAP" },
2265
    { SRV6_ENDPOINT_BEHAVIOR_END_LIMIT,              "End.Limit" },
2266
    { SRV6_ENDPOINT_BEHAVIOR_END_ONLY_CSID,          "End with NEXT-ONLY-CSID" },
2267
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID,               "End with NEXT-CSID" },
2268
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP,           "End with NEXT-CSID & PSP" },
2269
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP,           "End with NEXT-CSID & USP" },
2270
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP,       "End with NEXT-CSID, PSP & USP" },
2271
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USD,           "End with NEXT-CSID & USD" },
2272
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USD,       "End with NEXT-CSID, PSP & USD" },
2273
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_USP_USD,       "End with NEXT-CSID, USP & USD" },
2274
    { SRV6_ENDPOINT_BEHAVIOR_END_CSID_PSP_USP_USD,   "End with NEXT-CSID, PSP, USP & USD" },
2275
    { SRV6_ENDPOINT_BEHAVIOR_END_X_ONLY_CSID,        "End.X with NEXT-ONLY-CSID" },
2276
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID,             "End.X with NEXT-CSID" },
2277
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP,         "End.X with NEXT-CSID & PSP" },
2278
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP,         "End.X with NEXT-CSID & USP" },
2279
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP,     "End.X with NEXT-CSID, PSP & USP" },
2280
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USD,         "End.X with NEXT-CSID & USD" },
2281
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USD,     "End.X with NEXT-CSID, PSP & USD" },
2282
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_USP_USD,     "End.X with NEXT-CSID, USP & USD" },
2283
    { SRV6_ENDPOINT_BEHAVIOR_END_X_CSID_PSP_USP_USD, "End.X with NEXT-CSID, PSP, USP & USD" },
2284
    { SRV6_ENDPOINT_BEHAVIOR_END_DX6_CSID,           "End.DX6 with NEXT-CSID" },
2285
    { SRV6_ENDPOINT_BEHAVIOR_END_DX4_CSID,           "End.DX4 with NEXT-CSID" },
2286
    { SRV6_ENDPOINT_BEHAVIOR_END_DT6_CSID,           "End.DT6 with NEXT-CSID" },
2287
    { SRV6_ENDPOINT_BEHAVIOR_END_DT4_CSID,           "End.DT4 with NEXT-CSID" },
2288
    { SRV6_ENDPOINT_BEHAVIOR_END_DT46_CSID,          "End.DT46 with NEXT-CSID" },
2289
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2_CSID,           "End.DX2 with NEXT-CSID" },
2290
    { SRV6_ENDPOINT_BEHAVIOR_END_DX2V_CSID,          "End.DX2V with NEXT-CSID" },
2291
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2U_CSID,          "End.DT2U with NEXT-CSID" },
2292
    { SRV6_ENDPOINT_BEHAVIOR_END_DT2M_CSID,          "End.DT2M with NEXT-CSID" },
2293
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6D,            "End.M.GTP6.D" },
2294
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6DI,           "End.M.GTP6.Di" },
2295
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP6E,            "End.M.GTP6.E" },
2296
    { SRV6_ENDPOINT_BEHAVIOR_END_M_GTP4E,            "End.M.GTP4.E" },
2297
    { SRV6_ENDPOINT_BEHAVIOR_END_M,                  "End.M" },
2298
    { SRV6_ENDPOINT_BEHAVIOR_END_REPLICATE,          "End.Replicate" },
2299
    { SRV6_ENDPOINT_BEHAVIOR_END_NSH,                "End.NSH - NSH Segment" },
2300
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1,                "End.DX1" },
2301
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1_NEXT_CSID,      "End.DX1 with NEXT-CSID" },
2302
    { SRV6_ENDPOINT_BEHAVIOR_END_DX1_REPL_CSID,      "End.DX1 with REPLACE-CSID" },
2303
    { SRV6_ENDPOINT_BEHAVIOR_OPAQUE,                 "Opaque" },
2304
    { 0,  NULL }
2305
};
2306
2307
391
#define BGP_MUP_AT_3GPP_5G 1
2308
648
#define BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY 1
2309
392
#define BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY 2
2310
436
#define BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED 3
2311
1.11k
#define BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED 4
2312
2313
static const value_string bgp_mup_architecture_types[] = {
2314
    { BGP_MUP_AT_3GPP_5G,         "3gpp-5g" },
2315
    { 0, NULL }
2316
};
2317
2318
static const value_string bgp_mup_route_types[] = {
2319
    { BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY, "Interwork Segment Discovery route" },
2320
    { BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY,    "Direct Segment Discovery route" },
2321
    { BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED,  "Type 1 Session Transformed (ST) route" },
2322
    { BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED,  "Type 2 Session Transformed (ST) route" },
2323
    { 0, NULL }
2324
};
2325
2326
static const value_string bgp_ext_com_local_admin_types[] = {
2327
    { 0, "VID (802.1Q VLAN ID)" },
2328
    { 1, "VXLAN" },
2329
    { 2, "NVGRE" },
2330
    { 3, "I-SID" },
2331
    { 4, "EVI" },
2332
    { 5, "dual-VID (QinQ VLAN ID)" },
2333
    { 0, NULL }
2334
};
2335
2336
static const true_false_string tfs_non_transitive_transitive = { "Non-transitive", "Transitive" };
2337
static const true_false_string tfs_esi_label_flag = { "Single-Active redundancy", "All-Active redundancy" };
2338
static const true_false_string tfs_ospf_rt_mt = { "Type-2", "Type-1" };
2339
static const true_false_string tfs_eigrp_rtype = { "Internal" , "External" };
2340
static const true_false_string tfs_cost_replace = { "Replaces the original attribute value", "Evaluated after the original attribute value" };
2341
static const true_false_string tfs_exclude_include = { "Exclude", "Include" };
2342
static const true_false_string tfs_manually_auto_derived = { "manually derived", "auto-derived"};
2343
2344
/* Maximal size of an IP address string */
2345
#define MAX_SIZE_OF_IP_ADDR_STRING      16
2346
2347
static const uint8_t rd_zero[BGP_ROUTE_DISTINGUISHER_SIZE] = {0};
2348
2349
static int proto_bgp;
2350
2351
/* BGP header field initialisation */
2352
2353
/* global BGP header field */
2354
2355
static int hf_bgp_marker;
2356
static int hf_bgp_length;
2357
static int hf_bgp_prefix_length;
2358
static int hf_bgp_rd;
2359
static int hf_bgp_continuation;
2360
static int hf_bgp_originating_as;
2361
static int hf_bgp_community_prefix;
2362
static int hf_bgp_endpoint_address;
2363
static int hf_bgp_endpoint_address_ipv6;
2364
static int hf_bgp_label_stack;
2365
static int hf_bgp_large_communities;
2366
static int hf_bgp_large_communities_ga;
2367
static int hf_bgp_large_communities_ldp1;
2368
static int hf_bgp_large_communities_ldp2;
2369
static int hf_bgp_vplsad_length;
2370
static int hf_bgp_vplsad_rd;
2371
static int hf_bgp_bgpad_pe_addr;
2372
static int hf_bgp_vplsbgp_ce_id;
2373
static int hf_bgp_vplsbgp_labelblock_offset;
2374
static int hf_bgp_vplsbgp_labelblock_size;
2375
static int hf_bgp_vplsbgp_labelblock_base;
2376
static int hf_bgp_wildcard_route_target;
2377
static int hf_bgp_type;
2378
2379
/* BGP open message header field */
2380
2381
static int hf_bgp_open_version;
2382
static int hf_bgp_open_myas;
2383
static int hf_bgp_open_holdtime;
2384
static int hf_bgp_open_identifier;
2385
static int hf_bgp_open_opt_len;
2386
static int hf_bgp_open_opt_extension;
2387
static int hf_bgp_open_opt_extension_mark;
2388
static int hf_bgp_open_opt_extension_len;
2389
static int hf_bgp_open_opt_params;
2390
static int hf_bgp_open_opt_param;
2391
static int hf_bgp_open_opt_param_type;
2392
static int hf_bgp_open_opt_param_len;
2393
static int hf_bgp_open_opt_param_auth;
2394
static int hf_bgp_open_opt_param_unknown;
2395
2396
/* BGP notify header field */
2397
2398
static int hf_bgp_notify_major_error;
2399
static int hf_bgp_notify_minor_msg_hdr;
2400
static int hf_bgp_notify_minor_open_msg;
2401
static int hf_bgp_notify_minor_update_msg;
2402
static int hf_bgp_notify_minor_ht_expired;
2403
static int hf_bgp_notify_minor_state_machine;
2404
static int hf_bgp_notify_minor_cease;
2405
static int hf_bgp_notify_minor_rr_msg;
2406
static int hf_bgp_notify_minor_unknown;
2407
static int hf_bgp_notify_data;
2408
static int hf_bgp_notify_error_open_bad_peer_as;
2409
static int hf_bgp_notify_communication_length;
2410
static int hf_bgp_notify_communication;
2411
2412
/* BGP route refresh header field */
2413
2414
static int hf_bgp_route_refresh_afi;
2415
static int hf_bgp_route_refresh_subtype;
2416
static int hf_bgp_route_refresh_safi;
2417
static int hf_bgp_route_refresh_orf;
2418
static int hf_bgp_route_refresh_orf_flag;
2419
static int hf_bgp_route_refresh_orf_type;
2420
static int hf_bgp_route_refresh_orf_length;
2421
static int hf_bgp_route_refresh_orf_entry_prefixlist;
2422
static int hf_bgp_route_refresh_orf_entry_action;
2423
static int hf_bgp_route_refresh_orf_entry_match;
2424
static int hf_bgp_route_refresh_orf_entry_sequence;
2425
static int hf_bgp_route_refresh_orf_entry_prefixmask_lower;
2426
static int hf_bgp_route_refresh_orf_entry_prefixmask_upper;
2427
static int hf_bgp_route_refresh_orf_entry_ip;
2428
2429
/* BGP capabilities header field */
2430
2431
static int hf_bgp_cap;
2432
static int hf_bgp_cap_type;
2433
static int hf_bgp_cap_length;
2434
static int hf_bgp_cap_action;
2435
static int hf_bgp_cap_unknown;
2436
static int hf_bgp_cap_reserved;
2437
static int hf_bgp_cap_mp_afi;
2438
static int hf_bgp_cap_mp_safi;
2439
static int hf_bgp_cap_enh_afi;
2440
static int hf_bgp_cap_enh_safi;
2441
static int hf_bgp_cap_enh_nhafi;
2442
static int hf_bgp_cap_role;
2443
static int hf_bgp_cap_gr_timers;
2444
static int hf_bgp_cap_gr_timers_restart_flag;
2445
static int hf_bgp_cap_gr_timers_notification_flag;
2446
static int hf_bgp_cap_gr_timers_restart_time;
2447
static int hf_bgp_cap_gr_afi;
2448
static int hf_bgp_cap_gr_safi;
2449
static int hf_bgp_cap_gr_flag;
2450
static int hf_bgp_cap_gr_flag_pfs;
2451
static int hf_bgp_cap_4as;
2452
static int hf_bgp_cap_dc;
2453
static int hf_bgp_cap_ap_afi;
2454
static int hf_bgp_cap_ap_safi;
2455
static int hf_bgp_cap_ap_sendreceive;
2456
static int hf_bgp_cap_orf_afi;
2457
static int hf_bgp_cap_orf_safi;
2458
static int hf_bgp_cap_orf_number;
2459
static int hf_bgp_cap_orf_type;
2460
static int hf_bgp_cap_orf_sendreceive;
2461
static int hf_bgp_cap_fqdn_hostname_len;
2462
static int hf_bgp_cap_fqdn_hostname;
2463
static int hf_bgp_cap_fqdn_domain_name_len;
2464
static int hf_bgp_cap_fqdn_domain_name;
2465
static int hf_bgp_cap_multisession_flags;
2466
static int hf_bgp_cap_bgpsec_flags;
2467
static int hf_bgp_cap_bgpsec_version;
2468
static int hf_bgp_cap_bgpsec_sendreceive;
2469
static int hf_bgp_cap_bgpsec_reserved;
2470
static int hf_bgp_cap_bgpsec_afi;
2471
static int hf_bgp_cap_soft_version;
2472
static int hf_bgp_cap_soft_version_len;
2473
2474
/* BGP update global header field */
2475
static int hf_bgp_update_withdrawn_routes_length;
2476
static int hf_bgp_update_withdrawn_routes;
2477
2478
2479
/* BGP update path attribute header field */
2480
static int hf_bgp_update_total_path_attribute_length;
2481
static int hf_bgp_update_path_attributes;
2482
static int hf_bgp_update_path_attributes_unknown;
2483
static int hf_bgp_update_path_attribute_communities;
2484
static int hf_bgp_update_path_attribute_community_well_known;
2485
static int hf_bgp_update_path_attribute_community;
2486
static int hf_bgp_update_path_attribute_community_as;
2487
static int hf_bgp_update_path_attribute_community_value;
2488
static int hf_bgp_update_path_attribute;
2489
static int hf_bgp_update_path_attribute_flags;
2490
static int hf_bgp_update_path_attribute_flags_optional;
2491
static int hf_bgp_update_path_attribute_flags_transitive;
2492
static int hf_bgp_update_path_attribute_flags_partial;
2493
static int hf_bgp_update_path_attribute_flags_extended_length;
2494
static int hf_bgp_update_path_attribute_flags_unused;
2495
static int hf_bgp_update_path_attribute_type_code;
2496
static int hf_bgp_update_path_attribute_length;
2497
static int hf_bgp_update_path_attribute_next_hop;
2498
static int hf_bgp_update_path_attribute_as_path_segment;
2499
static int hf_bgp_update_path_attribute_as_path_segment_type;
2500
static int hf_bgp_update_path_attribute_as_path_segment_length;
2501
static int hf_bgp_update_path_attribute_as_path_segment_as2;
2502
static int hf_bgp_update_path_attribute_as_path_segment_as4;
2503
static int hf_bgp_update_path_attribute_origin;
2504
static int hf_bgp_update_path_attribute_cluster_list;
2505
static int hf_bgp_update_path_attribute_cluster_id;
2506
static int hf_bgp_update_path_attribute_originator_id;
2507
static int hf_bgp_update_path_attribute_local_pref;
2508
static int hf_bgp_update_path_attribute_attrset_origin_as;
2509
static int hf_bgp_update_path_attribute_multi_exit_disc;
2510
static int hf_bgp_update_path_attribute_aggregator_as;
2511
static int hf_bgp_update_path_attribute_aggregator_origin;
2512
static int hf_bgp_update_path_attribute_link_state;
2513
static int hf_bgp_update_path_attribute_mp_reach_nlri_address_family;
2514
static int hf_bgp_update_path_attribute_mp_reach_nlri_safi;
2515
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop;
2516
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd;
2517
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4;
2518
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6;
2519
static int hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local;
2520
static int hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa;
2521
static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length;
2522
static int hf_bgp_update_path_attribute_mp_reach_nlri_snpa;
2523
static int hf_bgp_update_path_attribute_mp_reach_nlri;
2524
static int hf_bgp_update_path_attribute_mp_unreach_nlri_address_family;
2525
static int hf_bgp_update_path_attribute_mp_unreach_nlri_safi;
2526
static int hf_bgp_update_path_attribute_mp_unreach_nlri;
2527
static int hf_bgp_update_path_attribute_aigp;
2528
static int hf_bgp_update_path_attribute_bgpsec_sb_len;
2529
static int hf_bgp_update_path_attribute_bgpsec_algo_id;
2530
static int hf_bgp_update_path_attribute_bgpsec_sps_pcount;
2531
static int hf_bgp_update_path_attribute_bgpsec_sps_flags;
2532
static int hf_bgp_update_path_attribute_bgpsec_sps_as;
2533
static int hf_bgp_update_path_attribute_bgpsec_sp_len;
2534
static int hf_bgp_update_path_attribute_bgpsec_ski;
2535
static int hf_bgp_update_path_attribute_bgpsec_sig_len;
2536
static int hf_bgp_update_path_attribute_bgpsec_sig;
2537
static int hf_bgp_update_path_attribute_otc;
2538
static int hf_bgp_update_path_attribute_d_path;
2539
static int hf_bgp_d_path_ga;
2540
static int hf_bgp_d_path_la;
2541
static int hf_bgp_d_path_length;
2542
static int hf_bgp_d_path_isf_safi;
2543
static int hf_bgp_evpn_nlri;
2544
static int hf_bgp_evpn_nlri_rt;
2545
static int hf_bgp_evpn_nlri_len;
2546
static int hf_bgp_evpn_nlri_rd;
2547
static int hf_bgp_evpn_nlri_esi;
2548
static int hf_bgp_evpn_nlri_esi_type;
2549
static int hf_bgp_evpn_nlri_esi_lacp_mac;
2550
static int hf_bgp_evpn_nlri_esi_portk;
2551
static int hf_bgp_evpn_nlri_esi_remain;
2552
static int hf_bgp_evpn_nlri_esi_value;
2553
static int hf_bgp_evpn_nlri_esi_value_type0;
2554
static int hf_bgp_evpn_nlri_esi_rb_mac;
2555
static int hf_bgp_evpn_nlri_esi_rbprio;
2556
static int hf_bgp_evpn_nlri_esi_sys_mac;
2557
static int hf_bgp_evpn_nlri_esi_mac_discr;
2558
static int hf_bgp_evpn_nlri_esi_router_id;
2559
static int hf_bgp_evpn_nlri_esi_router_discr;
2560
static int hf_bgp_evpn_nlri_esi_asn;
2561
static int hf_bgp_evpn_nlri_esi_asn_discr;
2562
static int hf_bgp_evpn_nlri_esi_reserved;
2563
static int hf_bgp_evpn_nlri_etag;
2564
static int hf_bgp_evpn_nlri_mpls_ls1;
2565
static int hf_bgp_evpn_nlri_mpls_ls2;
2566
static int hf_bgp_evpn_nlri_vni;
2567
static int hf_bgp_evpn_nlri_maclen;
2568
static int hf_bgp_evpn_nlri_mac_addr;
2569
static int hf_bgp_evpn_nlri_iplen;
2570
static int hf_bgp_evpn_nlri_prefix_len;
2571
static int hf_bgp_evpn_nlri_ip_addr;
2572
static int hf_bgp_evpn_nlri_ipv6_addr;
2573
static int hf_bgp_evpn_nlri_ipv4_gtw;
2574
static int hf_bgp_evpn_nlri_ipv6_gtw;
2575
static int hf_bgp_evpn_nlri_igmp_mc_or_length;
2576
static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4;
2577
static int hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6;
2578
static int hf_bgp_evpn_nlri_igmp_mc_reserved;
2579
static int hf_bgp_evpn_nlri_igmp_mc_max_resp_time;
2580
static int hf_bgp_evpn_nlri_igmp_mc_flags;
2581
static int hf_bgp_evpn_nlri_igmp_mc_flags_v1;
2582
static int hf_bgp_evpn_nlri_igmp_mc_flags_v2;
2583
static int hf_bgp_evpn_nlri_igmp_mc_flags_v3;
2584
static int hf_bgp_evpn_nlri_igmp_mc_flags_ie;
2585
static int hf_bgp_evpn_nlri_igmp_mc_flags_reserved;
2586
2587
static int * const evpn_nlri_igmp_mc_flags[] = {
2588
       &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
2589
       &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
2590
       &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
2591
       &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
2592
       &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
2593
       NULL
2594
       };
2595
2596
/* BGP update tunnel encaps attribute RFC 5512 */
2597
2598
static int hf_bgp_update_encaps_tunnel_tlv_len;
2599
static int hf_bgp_update_encaps_tunnel_tlv_type;
2600
static int hf_bgp_update_encaps_tunnel_subtlv_len;
2601
static int hf_bgp_update_encaps_tunnel_subtlv_type;
2602
static int hf_bgp_update_encaps_tunnel_subtlv_session_id;
2603
static int hf_bgp_update_encaps_tunnel_subtlv_cookie;
2604
static int hf_bgp_update_encaps_tunnel_subtlv_gre_key;
2605
static int hf_bgp_update_encaps_tunnel_subtlv_color_value;
2606
static int hf_bgp_update_encaps_tunnel_subtlv_lb_block_length;
2607
static int hf_bgp_update_encaps_tunnel_subtlv_value;
2608
2609
/* draft-ietf-idr-tunnel-encaps */
2610
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags;
2611
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid;
2612
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac;
2613
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved;
2614
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid;
2615
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac;
2616
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved;
2617
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags;
2618
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version;
2619
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid;
2620
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved;
2621
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid;
2622
static int hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved;
2623
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags;
2624
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid;
2625
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac;
2626
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved;
2627
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid;
2628
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac;
2629
static int hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved;
2630
2631
/* draft-ietf-idr-segment-routing-te-policy */
2632
static int hf_bgp_update_encaps_tunnel_subtlv_pref_flags;
2633
static int hf_bgp_update_encaps_tunnel_subtlv_pref_reserved;
2634
static int hf_bgp_update_encaps_tunnel_subtlv_pref_preference;
2635
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags;
2636
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified;
2637
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid;
2638
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved;
2639
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved;
2640
static int hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid;
2641
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_flags;
2642
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved;
2643
static int hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp;
2644
static int hf_bgp_update_encaps_tunnel_subtlv_priority_priority;
2645
static int hf_bgp_update_encaps_tunnel_subtlv_priority_reserved;
2646
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved;
2647
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv;
2648
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type;
2649
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length;
2650
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data;
2651
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags;
2652
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification;
2653
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm;
2654
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved;
2655
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved;
2656
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label;
2657
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class;
2658
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack;
2659
static int hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl;
2660
static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved;
2661
static int hf_bgp_update_encaps_tunnel_subtlv_policy_name_name;
2662
2663
/* RFC 6514 PMSI Tunnel Attribute */
2664
static int hf_bgp_pmsi_tunnel_flags;
2665
static int hf_bgp_pmsi_tunnel_type;
2666
static int hf_bgp_pmsi_tunnel_id;
2667
static int hf_bgp_pmsi_tunnel_not_present;
2668
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_id; /* RFC4875 section 19 */
2669
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id;
2670
static int hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4;
2671
static int hf_bgp_pmsi_tunnel_mldp_fec_el_type; /* RFC 6388 section 2.3 */
2672
static int hf_bgp_pmsi_tunnel_mldp_fec_el_afi;
2673
static int hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len;
2674
static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4;
2675
static int hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6;
2676
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len;
2677
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type;
2678
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len;
2679
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn;
2680
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str;
2681
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type;
2682
static int hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len;
2683
static int hf_bgp_pmsi_tunnel_pimsm_sender;
2684
static int hf_bgp_pmsi_tunnel_pimsm_pmc_group;
2685
static int hf_bgp_pmsi_tunnel_pimssm_root_node;
2686
static int hf_bgp_pmsi_tunnel_pimssm_pmc_group;
2687
static int hf_bgp_pmsi_tunnel_pimbidir_sender;
2688
static int hf_bgp_pmsi_tunnel_pimbidir_pmc_group;
2689
static int hf_bgp_pmsi_tunnel_ingress_rep_addr;
2690
static int hf_bgp_pmsi_tunnel_ingress_rep_addr6;
2691
2692
/* RFC 7311 attribute */
2693
static int hf_bgp_aigp_type;
2694
static int hf_bgp_aigp_tlv_length;
2695
static int hf_bgp_aigp_accu_igp_metric;
2696
2697
2698
/* MPLS labels decoding */
2699
static int hf_bgp_update_mpls_label;
2700
static int hf_bgp_update_mpls_label_value;
2701
static int hf_bgp_update_mpls_label_value_20bits;
2702
static int hf_bgp_update_mpls_traffic_class;
2703
static int hf_bgp_update_mpls_bottom_stack;
2704
2705
/* BGP update path attribute SSA SAFI Specific attribute (deprecated should we keep it ?) */
2706
2707
static int hf_bgp_ssa_t;
2708
static int hf_bgp_ssa_type;
2709
static int hf_bgp_ssa_len;
2710
static int hf_bgp_ssa_value;
2711
static int hf_bgp_ssa_l2tpv3_pref;
2712
static int hf_bgp_ssa_l2tpv3_s;
2713
static int hf_bgp_ssa_l2tpv3_unused;
2714
static int hf_bgp_ssa_l2tpv3_cookie_len;
2715
static int hf_bgp_ssa_l2tpv3_session_id;
2716
static int hf_bgp_ssa_l2tpv3_cookie;
2717
2718
/* BGP NLRI head field */
2719
static int hf_bgp_update_nlri;
2720
2721
static int hf_bgp_mp_reach_nlri_ipv4_prefix;
2722
static int hf_bgp_mp_unreach_nlri_ipv4_prefix;
2723
static int hf_bgp_mp_reach_nlri_ipv6_prefix;
2724
static int hf_bgp_mp_unreach_nlri_ipv6_prefix;
2725
static int hf_bgp_mp_nlri_tnl_id;
2726
static int hf_bgp_withdrawn_prefix;
2727
static int hf_bgp_nlri_prefix;
2728
static int hf_bgp_nlri_path_id;
2729
2730
/* BGP mcast IP VPN nlri header field */
2731
2732
static int hf_bgp_mcast_vpn_nlri_t;
2733
static int hf_bgp_mcast_vpn_nlri_route_type;
2734
static int hf_bgp_mcast_vpn_nlri_length;
2735
static int hf_bgp_mcast_vpn_nlri_rd;
2736
static int hf_bgp_mcast_vpn_nlri_origin_router_ipv4;
2737
static int hf_bgp_mcast_vpn_nlri_origin_router_ipv6;
2738
static int hf_bgp_mcast_vpn_nlri_source_as;
2739
static int hf_bgp_mcast_vpn_nlri_source_length;
2740
static int hf_bgp_mcast_vpn_nlri_group_length;
2741
static int hf_bgp_mcast_vpn_nlri_source_addr_ipv4;
2742
static int hf_bgp_mcast_vpn_nlri_source_addr_ipv6;
2743
static int hf_bgp_mcast_vpn_nlri_group_addr_ipv4;
2744
static int hf_bgp_mcast_vpn_nlri_group_addr_ipv6;
2745
static int hf_bgp_mcast_vpn_nlri_route_key;
2746
2747
/* BGP SR policy nlri field */
2748
static int hf_bgp_sr_policy_nlri_length;
2749
static int hf_bgp_sr_policy_nlri_distinguisher;
2750
static int hf_bgp_sr_policy_nlri_policy_color;
2751
static int hf_bgp_sr_policy_nlri_endpoint_v4;
2752
static int hf_bgp_sr_policy_nlri_endpoint_v6;
2753
2754
/* BGP-LS */
2755
2756
static int hf_bgp_ls_type;
2757
static int hf_bgp_ls_length;
2758
2759
static int hf_bgp_ls_nlri;
2760
static int hf_bgp_ls_safi128_nlri;
2761
static int hf_bgp_ls_safi128_nlri_route_distinguisher;
2762
static int hf_bgp_ls_safi128_nlri_route_distinguisher_type;
2763
static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2;
2764
static int hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4;
2765
static int hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4;
2766
static int hf_bgp_ls_safi128_nlri_route_dist_asnum_2;
2767
static int hf_bgp_ls_safi128_nlri_route_dist_asnum_4;
2768
static int hf_bgp_ls_nlri_type;
2769
static int hf_bgp_ls_nlri_length;
2770
static int hf_bgp_ls_nlri_link_nlri_type;
2771
static int hf_bgp_ls_nlri_link_descriptors_tlv;
2772
static int hf_bgp_ls_nlri_prefix_descriptors_tlv;
2773
static int hf_bgp_ls_nlri_srv6_sid_descriptors_tlv;
2774
static int hf_bgp_ls_nlri_link_local_identifier;
2775
static int hf_bgp_ls_nlri_link_remote_identifier;
2776
static int hf_bgp_ls_nlri_ipv4_interface_address;
2777
static int hf_bgp_ls_nlri_ipv4_neighbor_address;
2778
static int hf_bgp_ls_nlri_ipv6_interface_address;
2779
static int hf_bgp_ls_nlri_ipv6_neighbor_address;
2780
static int hf_bgp_ls_nlri_multi_topology_id;
2781
static int hf_bgp_ls_nlri_ospf_route_type;
2782
static int hf_bgp_ls_nlri_ip_reachability_prefix_ip;
2783
static int hf_bgp_ls_nlri_ip_reachability_prefix_ip6;
2784
static int hf_bgp_ls_nlri_node_nlri_type;
2785
static int hf_bgp_ls_nlri_node_protocol_id;
2786
static int hf_bgp_ls_nlri_node_identifier;
2787
static int hf_bgp_ls_ipv4_topology_prefix_nlri_type;
2788
static int hf_bgp_ls_ipv6_topology_prefix_nlri_type;
2789
static int hf_bgp_ls_nlri_srv6_sid_nlri_type;
2790
2791
/* BGP-LS + SR */
2792
static int hf_bgp_ls_sr_tlv_capabilities;
2793
static int hf_bgp_ls_sr_tlv_capabilities_range_size;
2794
static int hf_bgp_ls_sr_tlv_capabilities_flags;
2795
static int hf_bgp_ls_sr_tlv_capabilities_flags_i;
2796
static int hf_bgp_ls_sr_tlv_capabilities_flags_v;
2797
static int hf_bgp_ls_sr_tlv_capabilities_flags_h;
2798
static int hf_bgp_ls_sr_tlv_capabilities_flags_reserved;
2799
static int hf_bgp_ls_sr_tlv_capabilities_sid_label;
2800
static int hf_bgp_ls_sr_tlv_capabilities_sid_index;
2801
static int hf_bgp_ls_sr_tlv_algorithm;
2802
static int hf_bgp_ls_sr_tlv_algorithm_value;
2803
static int hf_bgp_ls_sr_tlv_local_block;                      /* 1036 */
2804
static int hf_bgp_ls_sr_tlv_local_block_flags;
2805
static int hf_bgp_ls_sr_tlv_local_block_range_size;
2806
static int hf_bgp_ls_sr_tlv_local_block_sid_label;
2807
static int hf_bgp_ls_sr_tlv_local_block_sid_index;
2808
static int hf_bgp_ls_sr_tlv_srv6_cap;                         /* 1037 */
2809
static int hf_bgp_ls_sr_tlv_srv6_cap_flags;
2810
static int hf_bgp_ls_sr_tlv_srv6_cap_flags_o;
2811
static int hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved;
2812
static int hf_bgp_ls_sr_tlv_srv6_cap_reserved;
2813
static int hf_bgp_ls_sr_tlv_flex_algo_def;                    /* 1039 */
2814
static int hf_bgp_ls_sr_tlv_flex_algo_algorithm;
2815
static int hf_bgp_ls_sr_tlv_flex_algo_metric_type;
2816
static int hf_bgp_ls_sr_tlv_flex_algo_calc_type;
2817
static int hf_bgp_ls_sr_tlv_flex_algo_priority;
2818
static int hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity;       /* 1040 */
2819
static int hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity;       /* 1041 */
2820
static int hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity;       /* 1042 */
2821
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags;              /* 1043 */
2822
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags;
2823
static int hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m;
2824
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric;          /* 1044 */
2825
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags;
2826
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e;
2827
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved;
2828
static int hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric;
2829
static int hf_bgp_ls_sr_tlv_flex_algo_exc_srlg;               /* 1045 */
2830
static int hf_bgp_ls_sr_tlv_prefix_sid;
2831
static int hf_bgp_ls_sr_tlv_prefix_sid_flags;
2832
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_r;
2833
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_n;
2834
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_np;
2835
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_p;
2836
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_m;
2837
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_e;
2838
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_v;
2839
static int hf_bgp_ls_sr_tlv_prefix_sid_flags_l;
2840
static int hf_bgp_ls_sr_tlv_prefix_sid_algo;
2841
static int hf_bgp_ls_sr_tlv_prefix_sid_label;
2842
static int hf_bgp_ls_sr_tlv_prefix_sid_index;
2843
static int hf_bgp_ls_sr_tlv_adjacency_sid;
2844
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags;
2845
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi;
2846
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi;
2847
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo;
2848
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi;
2849
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo;
2850
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_li;
2851
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo;
2852
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_si;
2853
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_go;
2854
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi;
2855
static int hf_bgp_ls_sr_tlv_adjacency_sid_flags_po;
2856
static int hf_bgp_ls_sr_tlv_adjacency_sid_weight;
2857
static int hf_bgp_ls_sr_tlv_adjacency_sid_label;
2858
static int hf_bgp_ls_sr_tlv_adjacency_sid_index;
2859
static int hf_bgp_ls_sr_tlv_peer_node_sid;                    /* 1101 */
2860
static int hf_bgp_ls_sr_tlv_peer_adj_sid;                     /* 1102 */
2861
static int hf_bgp_ls_sr_tlv_peer_set_sid;                     /* 1103 */
2862
static int hf_bgp_ls_sr_tlv_peer_sid_flags;
2863
static int hf_bgp_ls_sr_tlv_peer_sid_flags_v;
2864
static int hf_bgp_ls_sr_tlv_peer_sid_flags_l;
2865
static int hf_bgp_ls_sr_tlv_peer_sid_flags_b;
2866
static int hf_bgp_ls_sr_tlv_peer_sid_flags_p;
2867
static int hf_bgp_ls_sr_tlv_peer_sid_weight;
2868
static int hf_bgp_ls_sr_tlv_peer_sid_label;
2869
static int hf_bgp_ls_sr_tlv_peer_sid_index;
2870
static int hf_bgp_ls_sr_tlv_srv6_endx_sid;                   /* 1106 */
2871
static int hf_bgp_ls_sr_tlv_srv6_lan_endx_sid;               /* 1107 */
2872
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior;
2873
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags;
2874
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b;
2875
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s;
2876
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p;
2877
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved;
2878
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_algo;
2879
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_weight;
2880
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved;
2881
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis;
2882
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf;
2883
static int hf_bgp_ls_sr_tlv_srv6_endx_sid_sid;
2884
static int hf_bgp_ls_sr_tlv_srv6_locator;                     /* 1162 */
2885
static int hf_bgp_ls_sr_tlv_srv6_locator_flags;
2886
static int hf_bgp_ls_sr_tlv_srv6_locator_flags_d;
2887
static int hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved;
2888
static int hf_bgp_ls_sr_tlv_srv6_locator_algo;
2889
static int hf_bgp_ls_sr_tlv_srv6_locator_reserved;
2890
static int hf_bgp_ls_sr_tlv_srv6_locator_metric;
2891
static int hf_bgp_ls_sr_tlv_prefix_attr_flags;                /* 1170 */
2892
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags;
2893
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown;
2894
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao;
2895
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no;
2896
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo;
2897
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi;
2898
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri;
2899
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni;
2900
static int hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei;
2901
static int hf_bgp_ls_sr_tlv_source_router_id;                 /* 1171 */
2902
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior;           /* 1250 */
2903
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior;
2904
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags;
2905
static int hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo;
2906
static int hf_bgp_ls_sr_tlv_srv6_sid_struct;                  /* 1252 */
2907
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len;
2908
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len;
2909
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len;
2910
static int hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len;
2911
2912
static int * const srv6_endx_sid_flags[] = {
2913
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b,
2914
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s,
2915
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p,
2916
    &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved,
2917
    NULL
2918
};
2919
2920
/* RFC7752 TLVs */
2921
static int hf_bgp_ls_tlv_local_node_descriptors;              /* 256 */
2922
static int hf_bgp_ls_tlv_remote_node_descriptors;             /* 257 */
2923
static int hf_bgp_ls_tlv_link_local_remote_identifiers;       /* 258 */
2924
static int hf_bgp_ls_tlv_ipv4_interface_address;              /* 259 */
2925
static int hf_bgp_ls_tlv_ipv4_neighbor_address;               /* 260 */
2926
static int hf_bgp_ls_tlv_ipv6_interface_address;              /* 261 */
2927
static int hf_bgp_ls_tlv_ipv6_neighbor_address;               /* 262 */
2928
static int hf_bgp_ls_tlv_multi_topology_id;                   /* 263 */
2929
static int hf_bgp_ls_tlv_ospf_route_type;                     /* 264 */
2930
static int hf_bgp_ls_tlv_ip_reachability_information;         /* 265 */
2931
static int hf_bgp_ls_tlv_node_msd;                            /* 266 */
2932
static int hf_bgp_ls_tlv_link_msd;                            /* 267 */
2933
static int hf_bgp_ls_tlv_igp_msd_type;
2934
static int hf_bgp_ls_tlv_igp_msd_value;
2935
2936
static int hf_bgp_ls_tlv_autonomous_system;                   /* 512 */
2937
static int hf_bgp_ls_tlv_autonomous_system_id;
2938
static int hf_bgp_ls_tlv_bgp_ls_identifier;                   /* 513 */
2939
static int hf_bgp_ls_tlv_bgp_ls_identifier_id;
2940
static int hf_bgp_ls_tlv_area_id;                             /* 514 */
2941
static int hf_bgp_ls_tlv_area_id_id;
2942
static int hf_bgp_ls_tlv_igp_router;                          /* 515 */
2943
static int hf_bgp_ls_tlv_igp_router_id;
2944
static int hf_bgp_ls_tlv_bgp_router_id;                       /* 516 */
2945
static int hf_bgp_ls_tlv_bgp_router_id_id;
2946
static int hf_bgp_ls_tlv_bgp_confederation_member;            /* 517 */
2947
static int hf_bgp_ls_tlv_bgp_confederation_member_as;
2948
static int hf_bgp_ls_tlv_srv6_sid_info;                       /* 518 */
2949
static int hf_bgp_ls_tlv_srv6_sid_info_sid;
2950
2951
static int hf_bgp_ls_tlv_node_flags_bits;                     /* 1024 */
2952
static int hf_bgp_ls_tlv_opaque_node_properties;              /* 1025 */
2953
static int hf_bgp_ls_tlv_opaque_node_properties_value;
2954
static int hf_bgp_ls_tlv_node_name;                           /* 1026 */
2955
static int hf_bgp_ls_tlv_node_name_value;
2956
static int hf_bgp_ls_tlv_is_is_area_identifier;               /* 1027 */
2957
static int hf_bgp_ls_tlv_is_is_area_identifier_value;
2958
static int hf_bgp_ls_tlv_ipv4_router_id_of_local_node;        /* 1028 */
2959
static int hf_bgp_ls_tlv_ipv4_router_id_value;
2960
static int hf_bgp_ls_tlv_ipv6_router_id_value;
2961
static int hf_bgp_ls_tlv_ipv6_router_id_of_local_node;        /* 1029 */
2962
static int hf_bgp_ls_tlv_ipv4_router_id_of_remote_node;       /* 1030 */
2963
static int hf_bgp_ls_tlv_ipv6_router_id_of_remote_node;       /* 1031 */
2964
2965
static int hf_bgp_ls_tlv_administrative_group_color;          /* 1088 */
2966
static int hf_bgp_ls_tlv_administrative_group_color_value;
2967
static int hf_bgp_ls_tlv_administrative_group;
2968
static int hf_bgp_ls_tlv_max_link_bandwidth;                  /* 1089 */
2969
static int hf_bgp_ls_tlv_max_reservable_link_bandwidth;       /* 1090 */
2970
static int hf_bgp_ls_tlv_unreserved_bandwidth;                /* 1091 */
2971
static int hf_bgp_ls_bandwidth_value;
2972
static int hf_bgp_ls_tlv_te_default_metric;                   /* 1092 */
2973
static int hf_bgp_ls_tlv_te_default_metric_value_old;
2974
static int hf_bgp_ls_tlv_te_default_metric_value;
2975
static int hf_bgp_ls_tlv_link_protection_type;                /* 1093 */
2976
static int hf_bgp_ls_tlv_link_protection_type_value;
2977
static int hf_bgp_ls_tlv_mpls_protocol_mask;                  /* 1094 */
2978
static int hf_bgp_ls_tlv_metric;                              /* 1095 */
2979
static int hf_bgp_ls_tlv_metric_value1;
2980
static int hf_bgp_ls_tlv_metric_value2;
2981
static int hf_bgp_ls_tlv_metric_value3;
2982
static int hf_bgp_ls_tlv_shared_risk_link_group;              /* 1096 */
2983
static int hf_bgp_ls_tlv_shared_risk_link_group_value;
2984
static int hf_bgp_ls_tlv_opaque_link_attribute;               /* 1097 */
2985
static int hf_bgp_ls_tlv_opaque_link_attribute_value;
2986
static int hf_bgp_ls_tlv_link_name_attribute;                 /* 1098 */
2987
static int hf_bgp_ls_tlv_link_name_attribute_value;
2988
static int hf_bgp_ls_tlv_app_spec_link_attrs;                 /* 1122 */
2989
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len;
2990
static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len;
2991
static int hf_bgp_ls_tlv_app_spec_link_attrs_reserved;
2992
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm;
2993
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r;
2994
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s;
2995
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f;
2996
static int hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x;
2997
static int hf_bgp_ls_tlv_app_spec_link_attrs_udabm;
2998
2999
static int hf_bgp_ls_tlv_igp_flags;                           /* 1152 */
3000
static int hf_bgp_ls_tlv_route_tag;                           /* 1153 */
3001
static int hf_bgp_ls_tlv_route_tag_value;
3002
static int hf_bgp_ls_tlv_route_extended_tag;                  /* 1154 */
3003
static int hf_bgp_ls_tlv_route_extended_tag_value;
3004
static int hf_bgp_ls_tlv_prefix_metric;                       /* 1155 */
3005
static int hf_bgp_ls_tlv_prefix_metric_value;
3006
static int hf_bgp_ls_ospf_forwarding_address;                 /* 1156 */
3007
static int hf_bgp_ls_ospf_forwarding_address_ipv4_address;
3008
static int hf_bgp_ls_ospf_forwarding_address_ipv6_address;
3009
static int hf_bgp_ls_opaque_prefix_attribute;                 /* 1157 */
3010
static int hf_bgp_ls_opaque_prefix_attribute_value;
3011
static int hf_bgp_ls_extended_administrative_group;           /* 1173 */
3012
static int hf_bgp_ls_extended_administrative_group_value;
3013
3014
3015
/* Link Protection Types */
3016
static int hf_bgp_ls_link_protection_type_extra_traffic;
3017
static int hf_bgp_ls_link_protection_type_unprotected;
3018
static int hf_bgp_ls_link_protection_type_shared;
3019
static int hf_bgp_ls_link_protection_type_dedicated_1to1;
3020
static int hf_bgp_ls_link_protection_type_dedicated_1plus1;
3021
static int hf_bgp_ls_link_protection_type_enhanced;
3022
/* MPLS Protocol Mask flags */
3023
static int hf_bgp_ls_mpls_protocol_mask_flag_l;
3024
static int hf_bgp_ls_mpls_protocol_mask_flag_r;
3025
/* BGP-LS IGP Flags */
3026
static int hf_bgp_ls_igp_flags_flag_d;
3027
/* Node Flag Bits TLV's flags */
3028
static int hf_bgp_ls_node_flag_bits_overload;
3029
static int hf_bgp_ls_node_flag_bits_attached;
3030
static int hf_bgp_ls_node_flag_bits_external;
3031
static int hf_bgp_ls_node_flag_bits_abr;
3032
3033
/* RFC8669 BGP Prefix-SID header field */
3034
static int hf_bgp_prefix_sid_unknown;
3035
static int hf_bgp_prefix_sid_label_index;
3036
static int hf_bgp_prefix_sid_label_index_value;
3037
static int hf_bgp_prefix_sid_label_index_flags;
3038
static int hf_bgp_prefix_sid_originator_srgb;
3039
static int hf_bgp_prefix_sid_originator_srgb_blocks;
3040
static int hf_bgp_prefix_sid_originator_srgb_block;
3041
static int hf_bgp_prefix_sid_originator_srgb_flags;
3042
static int hf_bgp_prefix_sid_originator_srgb_base;
3043
static int hf_bgp_prefix_sid_originator_srgb_range;
3044
static int hf_bgp_prefix_sid_type;
3045
static int hf_bgp_prefix_sid_length;
3046
static int hf_bgp_prefix_sid_value;
3047
static int hf_bgp_prefix_sid_reserved;
3048
3049
/* draft-ietf-bess-srv6-services-05 header field */
3050
static int hf_bgp_prefix_sid_srv6_l3vpn;
3051
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs;
3052
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv;
3053
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type;
3054
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length;
3055
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value;
3056
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved;
3057
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_value;
3058
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_flags;
3059
static int hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior;
3060
static int hf_bgp_prefix_sid_srv6_l3vpn_reserved;
3061
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs;
3062
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv;
3063
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type;
3064
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length;
3065
static int hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value;
3066
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len;
3067
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len;
3068
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len;
3069
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len;
3070
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len;
3071
static int hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset;
3072
static int hf_bgp_prefix_sid_srv6_l2vpn;
3073
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs;
3074
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv;
3075
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type;
3076
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length;
3077
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value;
3078
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved;
3079
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_value;
3080
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_flags;
3081
static int hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior;
3082
static int hf_bgp_prefix_sid_srv6_l2vpn_reserved;
3083
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs;
3084
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv;
3085
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type;
3086
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length;
3087
static int hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value;
3088
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len;
3089
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len;
3090
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len;
3091
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len;
3092
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len;
3093
static int hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset;
3094
3095
/* BGP flow spec nlri header field */
3096
3097
static int hf_bgp_flowspec_nlri_t;
3098
static int hf_bgp_flowspec_nlri_route_distinguisher;
3099
static int hf_bgp_flowspec_nlri_route_distinguisher_type;
3100
static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_2;
3101
static int hf_bgp_flowspec_nlri_route_dist_admin_ipv4;
3102
static int hf_bgp_flowspec_nlri_route_dist_admin_asnum_4;
3103
static int hf_bgp_flowspec_nlri_route_dist_asnum_2;
3104
static int hf_bgp_flowspec_nlri_route_dist_asnum_4;
3105
static int hf_bgp_flowspec_nlri_filter;
3106
static int hf_bgp_flowspec_nlri_filter_type;
3107
static int hf_bgp_flowspec_nlri_length;
3108
static int hf_bgp_flowspec_nlri_dst_pref_ipv4;
3109
static int hf_bgp_flowspec_nlri_src_pref_ipv4;
3110
static int hf_bgp_flowspec_nlri_op_flags;
3111
static int hf_bgp_flowspec_nlri_op_eol;
3112
static int hf_bgp_flowspec_nlri_op_and;
3113
static int hf_bgp_flowspec_nlri_op_val_len;
3114
static int hf_bgp_flowspec_nlri_op_un_bit4;
3115
static int hf_bgp_flowspec_nlri_op_un_bit5;
3116
static int hf_bgp_flowspec_nlri_op_lt;
3117
static int hf_bgp_flowspec_nlri_op_gt;
3118
static int hf_bgp_flowspec_nlri_op_eq;
3119
static int hf_bgp_flowspec_nlri_dec_val_8;
3120
static int hf_bgp_flowspec_nlri_dec_val_16;
3121
static int hf_bgp_flowspec_nlri_dec_val_32;
3122
static int hf_bgp_flowspec_nlri_dec_val_64;
3123
static int hf_bgp_flowspec_nlri_op_flg_not;
3124
static int hf_bgp_flowspec_nlri_op_flg_match;
3125
static int hf_bgp_flowspec_nlri_tcp_flags;
3126
static int hf_bgp_flowspec_nlri_tcp_flags_cwr;
3127
static int hf_bgp_flowspec_nlri_tcp_flags_ecn;
3128
static int hf_bgp_flowspec_nlri_tcp_flags_urg;
3129
static int hf_bgp_flowspec_nlri_tcp_flags_ack;
3130
static int hf_bgp_flowspec_nlri_tcp_flags_push;
3131
static int hf_bgp_flowspec_nlri_tcp_flags_reset;
3132
static int hf_bgp_flowspec_nlri_tcp_flags_syn;
3133
static int hf_bgp_flowspec_nlri_tcp_flags_fin;
3134
static int hf_bgp_flowspec_nlri_fflag;
3135
static int hf_bgp_flowspec_nlri_fflag_lf;
3136
static int hf_bgp_flowspec_nlri_fflag_ff;
3137
static int hf_bgp_flowspec_nlri_fflag_isf;
3138
static int hf_bgp_flowspec_nlri_fflag_df;
3139
static int hf_bgp_flowspec_nlri_dscp;
3140
static int hf_bgp_flowspec_nlri_src_ipv6_pref;
3141
static int hf_bgp_flowspec_nlri_dst_ipv6_pref;
3142
static int hf_bgp_flowspec_nlri_ipv6_pref_len;
3143
static int hf_bgp_flowspec_nlri_ipv6_pref_offset;
3144
3145
/* BGP update safi ndt nlri  draft-nalawade-idr-mdt-safi-03 */
3146
3147
static int hf_bgp_mdt_nlri_safi_rd;
3148
static int hf_bgp_mdt_nlri_safi_ipv4_addr;
3149
static int hf_bgp_mdt_nlri_safi_group_addr;
3150
3151
/* BGP update extended community header field */
3152
3153
static int hf_bgp_ext_communities;
3154
static int hf_bgp_ext_community;
3155
static int hf_bgp_ext_com_type_auth;
3156
static int hf_bgp_ext_com_type_tran;
3157
3158
static int hf_bgp_ext_com_type_high;
3159
static int hf_bgp_ext_com_stype_low_unknown;
3160
static int hf_bgp_ext_com_stype_tr_evpn;
3161
static int hf_bgp_ext_com_stype_tr_as2;
3162
static int hf_bgp_ext_com_stype_ntr_as2;
3163
static int hf_bgp_ext_com_stype_tr_as4;
3164
static int hf_bgp_ext_com_stype_ntr_as4;
3165
static int hf_bgp_ext_com_stype_tr_IP4;
3166
static int hf_bgp_ext_com_stype_ntr_IP4;
3167
static int hf_bgp_ext_com_stype_tr_opaque;
3168
static int hf_bgp_ext_com_stype_ntr_opaque;
3169
static int hf_bgp_ext_com_tunnel_type;
3170
static int hf_bgp_ext_com_stype_tr_mup;
3171
static int hf_bgp_ext_com_stype_tr_exp;
3172
static int hf_bgp_ext_com_stype_tr_exp_2;
3173
static int hf_bgp_ext_com_stype_tr_exp_3;
3174
3175
static int hf_bgp_ext_com_value_as2;
3176
static int hf_bgp_ext_com_value_as4;
3177
static int hf_bgp_ext_com_value_IP4;
3178
static int hf_bgp_ext_com_value_an2;
3179
static int hf_bgp_ext_com_value_an4;
3180
static int hf_bgp_ext_com_value_raw;
3181
static int hf_bgp_ext_com_value_link_bw;
3182
static int hf_bgp_ext_com_value_ospf_rt_area;
3183
static int hf_bgp_ext_com_value_ospf_rt_type;
3184
static int hf_bgp_ext_com_value_ospf_rt_options;
3185
static int hf_bgp_ext_com_value_ospf_rt_options_mt;
3186
static int hf_bgp_ext_com_value_ospf_rid;
3187
static int hf_bgp_ext_com_value_fs_remark;
3188
static int hf_bgp_ext_com_local_admin_flags;
3189
static int hf_bgp_ext_com_local_admin_auto_derived_flag;
3190
static int hf_bgp_ext_com_local_admin_type;
3191
static int hf_bgp_ext_com_local_admin_domain_id;
3192
static int hf_bgp_ext_com_local_admin_service_id;
3193
3194
/* BGP QoS propagation draft-knoll-idr-qos-attribute */
3195
3196
static int hf_bgp_ext_com_qos_flags;
3197
static int hf_bgp_ext_com_qos_flags_remarking;
3198
static int hf_bgp_ext_com_qos_flags_ignore_remarking;
3199
static int hf_bgp_ext_com_qos_flags_agg_marking;
3200
static int hf_bgp_ext_com_cos_flags;
3201
static int hf_bgp_ext_com_cos_flags_be;
3202
static int hf_bgp_ext_com_cos_flags_ef;
3203
static int hf_bgp_ext_com_cos_flags_af;
3204
static int hf_bgp_ext_com_cos_flags_le;
3205
static int hf_bgp_ext_com_qos_set_number;
3206
static int hf_bgp_ext_com_qos_tech_type;
3207
static int hf_bgp_ext_com_qos_marking_o;
3208
static int hf_bgp_ext_com_qos_marking_a;
3209
static int hf_bgp_ext_com_qos_default_to_zero;
3210
3211
/* BGP Flow spec extended community RFC 5575 */
3212
3213
static int hf_bgp_ext_com_flow_rate_float;
3214
static int hf_bgp_ext_com_flow_act_allset;
3215
static int hf_bgp_ext_com_flow_act_term_act;
3216
static int hf_bgp_ext_com_flow_act_samp_act;
3217
3218
/* BGP L2 extended community RFC 4761, RFC 6624 */
3219
/* draft-ietf-l2vpn-vpls-multihoming */
3220
3221
static int hf_bgp_ext_com_l2_encaps;
3222
static int hf_bgp_ext_com_l2_c_flags;
3223
static int hf_bgp_ext_com_l2_mtu;
3224
static int hf_bgp_ext_com_l2_flag_d;
3225
static int hf_bgp_ext_com_l2_flag_z1;
3226
static int hf_bgp_ext_com_l2_flag_f;
3227
static int hf_bgp_ext_com_l2_flag_z345;
3228
static int hf_bgp_ext_com_l2_flag_c;
3229
static int hf_bgp_ext_com_l2_flag_s;
3230
static int hf_bgp_ext_com_l2_esi_label_flag;
3231
static int hf_bgp_ext_com_evpn_mmac_flag;
3232
static int hf_bgp_ext_com_evpn_mmac_seq;
3233
static int hf_bgp_ext_com_evpn_esirt;
3234
static int hf_bgp_ext_com_evpn_routermac;
3235
static int hf_bgp_ext_com_evpn_mmac_flag_sticky;
3236
3237
/* BGP E-Tree Info extended community RFC 7796 */
3238
3239
static int hf_bgp_ext_com_etree_flags;
3240
static int hf_bgp_ext_com_etree_root_vlan;
3241
static int hf_bgp_ext_com_etree_leaf_vlan;
3242
static int hf_bgp_ext_com_etree_flag_reserved;
3243
static int hf_bgp_ext_com_etree_flag_p;
3244
static int hf_bgp_ext_com_etree_flag_v;
3245
3246
/* VPWS Support in EVPN  RFC 8214 */
3247
/* draft-yu-bess-evpn-l2-attributes-04 */
3248
3249
static int hf_bgp_ext_com_evpn_l2attr_flags;
3250
static int hf_bgp_ext_com_evpn_l2attr_flag_reserved;
3251
static int hf_bgp_ext_com_evpn_l2attr_flag_ci;
3252
static int hf_bgp_ext_com_evpn_l2attr_flag_f;
3253
static int hf_bgp_ext_com_evpn_l2attr_flag_c;
3254
static int hf_bgp_ext_com_evpn_l2attr_flag_p;
3255
static int hf_bgp_ext_com_evpn_l2attr_flag_b;
3256
static int hf_bgp_ext_com_evpn_l2attr_l2_mtu;
3257
static int hf_bgp_ext_com_evpn_l2attr_reserved;
3258
3259
/* E-Tree RFC8317 */
3260
3261
static int hf_bgp_ext_com_evpn_etree_flags;
3262
static int hf_bgp_ext_com_evpn_etree_flag_reserved;
3263
static int hf_bgp_ext_com_evpn_etree_flag_l;
3264
static int hf_bgp_ext_com_evpn_etree_reserved;
3265
3266
/* BGP Cost Community */
3267
3268
static int hf_bgp_ext_com_cost_poi;
3269
static int hf_bgp_ext_com_cost_cid;
3270
static int hf_bgp_ext_com_cost_cost;
3271
static int hf_bgp_ext_com_cost_cid_rep;
3272
3273
/* EIGRP route attributes extended communities */
3274
3275
static int hf_bgp_ext_com_stype_tr_exp_eigrp;
3276
static int hf_bgp_ext_com_eigrp_flags;
3277
static int hf_bgp_ext_com_eigrp_flags_rt;
3278
static int hf_bgp_ext_com_eigrp_rtag;
3279
static int hf_bgp_ext_com_eigrp_asn;
3280
static int hf_bgp_ext_com_eigrp_delay;
3281
static int hf_bgp_ext_com_eigrp_rly;
3282
static int hf_bgp_ext_com_eigrp_hops;
3283
static int hf_bgp_ext_com_eigrp_bw;
3284
static int hf_bgp_ext_com_eigrp_load;
3285
static int hf_bgp_ext_com_eigrp_mtu;
3286
static int hf_bgp_ext_com_eigrp_rid;
3287
static int hf_bgp_ext_com_eigrp_e_asn;
3288
static int hf_bgp_ext_com_eigrp_e_rid;
3289
static int hf_bgp_ext_com_eigrp_e_pid;
3290
static int hf_bgp_ext_com_eigrp_e_m;
3291
3292
/* MUP extended community */
3293
3294
static int hf_bgp_ext_com_mup_segment_id2;
3295
static int hf_bgp_ext_com_mup_segment_id4;
3296
3297
/* RFC8571 BGP-LS Advertisement of IGP TE Metric Extensions */
3298
static int hf_bgp_ls_igp_te_metric_flags;
3299
static int hf_bgp_ls_igp_te_metric_flags_a;
3300
static int hf_bgp_ls_igp_te_metric_flags_reserved;
3301
static int hf_bgp_ls_igp_te_metric_delay;
3302
static int hf_bgp_ls_igp_te_metric_delay_value;
3303
static int hf_bgp_ls_igp_te_metric_delay_min_max;
3304
static int hf_bgp_ls_igp_te_metric_delay_min;
3305
static int hf_bgp_ls_igp_te_metric_delay_max;
3306
static int hf_bgp_ls_igp_te_metric_delay_variation;
3307
static int hf_bgp_ls_igp_te_metric_delay_variation_value;
3308
static int hf_bgp_ls_igp_te_metric_link_loss;
3309
static int hf_bgp_ls_igp_te_metric_link_loss_value;
3310
static int hf_bgp_ls_igp_te_metric_bandwidth_residual;
3311
static int hf_bgp_ls_igp_te_metric_bandwidth_residual_value;
3312
static int hf_bgp_ls_igp_te_metric_bandwidth_available;
3313
static int hf_bgp_ls_igp_te_metric_bandwidth_available_value;
3314
static int hf_bgp_ls_igp_te_metric_bandwidth_utilized;
3315
static int hf_bgp_ls_igp_te_metric_bandwidth_utilized_value;
3316
static int hf_bgp_ls_igp_te_metric_reserved;
3317
3318
/* draft-mpmz-bess-mup-safi-03 */
3319
static int hf_bgp_mup_nlri;
3320
static int hf_bgp_mup_nlri_at;
3321
static int hf_bgp_mup_nlri_rt;
3322
static int hf_bgp_mup_nlri_len;
3323
static int hf_bgp_mup_nlri_rd;
3324
static int hf_bgp_mup_nlri_prefixlen;
3325
static int hf_bgp_mup_nlri_ip_prefix;
3326
static int hf_bgp_mup_nlri_ipv6_prefix;
3327
static int hf_bgp_mup_nlri_ip_addr;
3328
static int hf_bgp_mup_nlri_ipv6_addr;
3329
static int hf_bgp_mup_nlri_3gpp_5g_type1_st_route;
3330
static int hf_bgp_mup_nlri_3gpp_5g_teid;
3331
static int hf_bgp_mup_nlri_3gpp_5g_qfi;
3332
static int hf_bgp_mup_nlri_3gpp_5g_ep_addr_len;
3333
static int hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr;
3334
static int hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr;
3335
static int hf_bgp_mup_nlri_3gpp_5g_source_addr_len;
3336
static int hf_bgp_mup_nlri_3gpp_5g_source_ip_addr;
3337
static int hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr;
3338
static int hf_bgp_mup_nlri_3gpp_5g_type2_st_route;
3339
static int hf_bgp_mup_nlri_ep_len;
3340
static int hf_bgp_mup_nlri_ep_ip_addr;
3341
static int hf_bgp_mup_nlri_ep_ipv6_addr;
3342
static int hf_bgp_mup_nlri_3gpp_5g_ep_teid;
3343
static int hf_bgp_mup_nlri_unknown_data;
3344
3345
static int * const ls_igp_te_metric_flags[] = {
3346
       &hf_bgp_ls_igp_te_metric_flags_a,
3347
       &hf_bgp_ls_igp_te_metric_flags_reserved,
3348
       NULL
3349
       };
3350
3351
static int ett_bgp;
3352
static int ett_bgp_prefix;
3353
static int ett_bgp_unfeas;
3354
static int ett_bgp_attrs;
3355
static int ett_bgp_attr;
3356
static int ett_bgp_attr_flags;
3357
static int ett_bgp_mp_nhna;
3358
static int ett_bgp_mp_reach_nlri;
3359
static int ett_bgp_mp_unreach_nlri;
3360
static int ett_bgp_mp_snpa;
3361
static int ett_bgp_nlri;
3362
static int ett_bgp_open;
3363
static int ett_bgp_update;
3364
static int ett_bgp_notification;
3365
static int ett_bgp_route_refresh; /* ROUTE-REFRESH message tree */
3366
static int ett_bgp_capability;
3367
static int ett_bgp_as_path_segment;
3368
static int ett_bgp_as_path_segment_asn;
3369
static int ett_bgp_communities;
3370
static int ett_bgp_community;
3371
static int ett_bgp_cluster_list;  /* cluster list tree          */
3372
static int ett_bgp_options;       /* optional parameters tree   */
3373
static int ett_bgp_option;        /* an optional parameter tree */
3374
static int ett_bgp_options_ext;
3375
static int ett_bgp_cap;           /* an cap parameter tree */
3376
static int ett_bgp_extended_communities; /* extended communities list tree */
3377
static int ett_bgp_extended_community; /* extended community tree for each community of BGP update */
3378
static int ett_bgp_ext_com_type;  /* Extended Community Type High tree (IANA, Transitive bits) */
3379
static int ett_bgp_extended_com_fspec_redir; /* extended communities BGP flow act redirect */
3380
static int ett_bgp_ext_com_flags; /* extended communities flags tree */
3381
static int ett_bgp_ext_com_l2_flags; /* extended communities tree for l2 services flags */
3382
static int ett_bgp_ext_com_etree_flags;
3383
static int ett_bgp_ext_com_evpn_mmac_flags;
3384
static int ett_bgp_ext_com_evpn_l2attr_flags;
3385
static int ett_bgp_ext_com_evpn_etree_flags;
3386
static int ett_bgp_ext_com_cost_cid; /* Cost community CommunityID tree (replace/evaluate after bit) */
3387
static int ett_bgp_ext_com_ospf_rt_opt; /* Tree for Options bitfield of OSPF Route Type extended community */
3388
static int ett_bgp_ext_com_eigrp_flags; /* Tree for EIGRP route flags */
3389
static int ett_bgp_ssa;           /* safi specific attribute */
3390
static int ett_bgp_ssa_subtree;   /* safi specific attribute Subtrees */
3391
static int ett_bgp_orf;           /* orf (outbound route filter) tree */
3392
static int ett_bgp_orf_entry;     /* orf entry tree */
3393
static int ett_bgp_mcast_vpn_nlri;
3394
static int ett_bgp_flow_spec_nlri;
3395
static int ett_bgp_flow_spec_nlri_filter; /* tree decoding multiple op and value pairs */
3396
static int ett_bgp_flow_spec_nlri_op_flags; /* tree decoding each op and val pair within the op and value set */
3397
static int ett_bgp_flow_spec_nlri_tcp;
3398
static int ett_bgp_flow_spec_nlri_ff;
3399
static int ett_bgp_tunnel_tlv;
3400
static int ett_bgp_tunnel_tlv_subtree;
3401
static int ett_bgp_tunnel_subtlv;
3402
static int ett_bgp_tunnel_subtlv_subtree;
3403
static int ett_bgp_link_state;
3404
static int ett_bgp_evpn_nlri;
3405
static int ett_bgp_evpn_nlri_esi;
3406
static int ett_bgp_evpn_nlri_mc;
3407
static int ett_bgp_mpls_labels;
3408
static int ett_bgp_pmsi_tunnel_id;
3409
static int ett_bgp_aigp_attr;
3410
static int ett_bgp_large_communities;
3411
static int ett_bgp_dpath;
3412
static int ett_bgp_prefix_sid_originator_srgb;
3413
static int ett_bgp_prefix_sid_originator_srgb_block;
3414
static int ett_bgp_prefix_sid_originator_srgb_blocks;
3415
static int ett_bgp_prefix_sid_label_index;
3416
static int ett_bgp_prefix_sid_ipv6;
3417
static int ett_bgp_bgpsec_secure_path;
3418
static int ett_bgp_bgpsec_secure_path_segment;
3419
static int ett_bgp_bgpsec_signature_block;
3420
static int ett_bgp_bgpsec_signature_segment;
3421
static int ett_bgp_vxlan;
3422
static int ett_bgp_binding_sid;
3423
static int ett_bgp_segment_list;
3424
static int ett_bgp_prefix_sid_unknown;
3425
static int ett_bgp_prefix_sid_srv6_l3vpn;
3426
static int ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs;
3427
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_information;
3428
static int ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs;
3429
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_structure;
3430
static int ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown;
3431
static int ett_bgp_prefix_sid_srv6_l3vpn_unknown;
3432
static int ett_bgp_prefix_sid_srv6_l2vpn;
3433
static int ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs;
3434
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_information;
3435
static int ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs;
3436
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_structure;
3437
static int ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown;
3438
static int ett_bgp_prefix_sid_srv6_l2vpn_unknown;
3439
static int ett_bgp_mup_nlri;
3440
static int ett_bgp_mup_nlri_3gpp_5g_type1_st_route;
3441
static int ett_bgp_mup_nlri_3gpp_5g_type2_st_route;
3442
3443
static expert_field ei_bgp_marker_invalid;
3444
static expert_field ei_bgp_cap_len_bad;
3445
static expert_field ei_bgp_cap_gr_helper_mode_only;
3446
static expert_field ei_bgp_notify_minor_unknown;
3447
static expert_field ei_bgp_route_refresh_orf_type_unknown;
3448
static expert_field ei_bgp_route_refresh_orf_type_unsupported;
3449
static expert_field ei_bgp_route_refresh_orf_type_unregistered;
3450
static expert_field ei_bgp_route_refresh_orf_action_invalid;
3451
static expert_field ei_bgp_length_invalid;
3452
static expert_field ei_bgp_prefix_length_invalid;
3453
static expert_field ei_bgp_afi_type_not_supported;
3454
static expert_field ei_bgp_unknown_afi;
3455
static expert_field ei_bgp_unknown_safi;
3456
static expert_field ei_bgp_unknown_label_vpn;
3457
static expert_field ei_bgp_ls_error;
3458
static expert_field ei_bgp_ls_warn;
3459
static expert_field ei_bgp_ext_com_len_bad;
3460
static expert_field ei_bgp_attr_pmsi_opaque_type;
3461
static expert_field ei_bgp_attr_pmsi_tunnel_type;
3462
static expert_field ei_bgp_prefix_length_err;
3463
static expert_field ei_bgp_attr_aigp_type;
3464
static expert_field ei_bgp_attr_as_path_as_len_err;
3465
static expert_field ei_bgp_next_hop_ipv6_scope;
3466
static expert_field ei_bgp_next_hop_rd_nonzero;
3467
3468
static expert_field ei_bgp_evpn_nlri_rt_type_err;
3469
static expert_field ei_bgp_evpn_nlri_rt_len_err;
3470
static expert_field ei_bgp_evpn_nlri_esi_type_err;
3471
static expert_field ei_bgp_evpn_nlri_rt4_no_ip;
3472
3473
static expert_field ei_bgp_mup_unknown_at;
3474
static expert_field ei_bgp_mup_unknown_rt;
3475
static expert_field ei_bgp_mup_nlri_addr_len_err;
3476
3477
/* desegmentation */
3478
static bool bgp_desegment = true;
3479
3480
static int bgp_asn_len;
3481
3482
/* FF: BGP-LS is just a collector of IGP link state information. Some
3483
   fields are encoded "as-is" from the IGP, hence in order to dissect
3484
   them properly we must be aware of their origin, e.g. IS-IS or OSPF.
3485
   So, *before* dissecting LINK_STATE attributes we must get the
3486
   'Protocol-ID' field that is present in the MP_[UN]REACH_NLRI
3487
   attribute. The tricky thing is that there is no strict order
3488
   for path attributes on the wire, hence we have to keep track
3489
   of 1) the 'Protocol-ID' from the MP_[UN]REACH_NLRI and 2)
3490
   the offset/len of the LINK_STATE attribute. We store them in
3491
   per-packet proto_data and once we got both we are ready for the
3492
   LINK_STATE attribute dissection.
3493
*/
3494
typedef struct _link_state_data {
3495
    /* Link/Node NLRI Protocol-ID (e.g. OSPF or IS-IS) */
3496
    uint8_t protocol_id;
3497
    /* LINK_STATE attribute coordinates */
3498
    int ostart;  /* offset at which the LINK_STATE path attribute starts */
3499
    int oend;    /* offset at which the LINK_STATE path attribute ends */
3500
    uint16_t tlen; /* length of the LINK_STATE path attribute */
3501
    /* presence flag */
3502
    bool link_state_attr_present;
3503
    /* tree where add LINK_STATE items */
3504
    proto_tree *subtree2;
3505
} link_state_data;
3506
3507
15.3k
#define LINK_STATE_DATA_KEY 0
3508
3509
static void
3510
3.36k
save_link_state_protocol_id(packet_info *pinfo, uint8_t protocol_id) {
3511
3.36k
    link_state_data *data =
3512
3.36k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3513
3.36k
    if (!data) {
3514
1.03k
        data = wmem_new0(pinfo->pool, link_state_data);
3515
1.03k
        data->ostart = -1;
3516
1.03k
        data->oend = -1;
3517
1.03k
        data->tlen = 0;
3518
1.03k
        data->link_state_attr_present = false;
3519
1.03k
        data->subtree2 = NULL;
3520
1.03k
    }
3521
3.36k
    data->protocol_id = protocol_id;
3522
3.36k
    p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3523
3.36k
    return;
3524
3.36k
}
3525
3526
static void
3527
2.99k
save_link_state_attr_position(packet_info *pinfo, int ostart, int oend, uint16_t tlen, proto_tree *subtree2) {
3528
2.99k
    link_state_data *data =
3529
2.99k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3530
2.99k
    if (!data) {
3531
2.04k
        data = wmem_new0(pinfo->pool, link_state_data);
3532
2.04k
        data->protocol_id = BGP_LS_NLRI_PROTO_ID_UNKNOWN;
3533
2.04k
    }
3534
2.99k
    data->ostart = ostart;
3535
2.99k
    data->oend = oend;
3536
2.99k
    data->tlen = tlen;
3537
2.99k
    data->link_state_attr_present = true;
3538
2.99k
    data->subtree2 = subtree2;
3539
2.99k
    p_add_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY, data);
3540
2.99k
    return;
3541
2.99k
}
3542
3543
static link_state_data*
3544
2.65k
load_link_state_data(packet_info *pinfo) {
3545
2.65k
    link_state_data *data =
3546
2.65k
        (link_state_data*)p_get_proto_data(pinfo->pool, pinfo, proto_bgp, LINK_STATE_DATA_KEY);
3547
2.65k
    return data;
3548
2.65k
}
3549
3550
typedef struct _path_attr_data {
3551
    bool encaps_community_present;
3552
    uint16_t encaps_tunnel_type;
3553
} path_attr_data;
3554
3555
7.73k
#define PATH_ATTR_DATA_KEY 1
3556
3557
static void
3558
311
save_path_attr_encaps_tunnel_type(packet_info *pinfo, uint32_t encaps_tunnel_type) {
3559
311
    path_attr_data *data =
3560
311
        (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3561
311
    if (!data) {
3562
227
        data = wmem_new0(wmem_file_scope(), path_attr_data);
3563
227
    }
3564
311
    data->encaps_community_present = true;
3565
311
    data->encaps_tunnel_type = encaps_tunnel_type;
3566
311
    p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY, data);
3567
311
    return;
3568
311
}
3569
3570
static path_attr_data*
3571
7.11k
load_path_attr_data(packet_info *pinfo) {
3572
7.11k
    path_attr_data *data =
3573
7.11k
        (path_attr_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, PATH_ATTR_DATA_KEY);
3574
7.11k
    return data;
3575
7.11k
}
3576
3577
typedef struct _afi_safi_data {
3578
    uint16_t afi;
3579
    uint8_t safi;  /* offset at which the LINK_STATE path attribute starts */
3580
} afi_safi_data;
3581
3582
58.2k
#define AFI_SAFI_DATA_KEY 2
3583
3584
static void
3585
28.8k
save_afi_safi_data(packet_info *pinfo, uint16_t afi, uint8_t safi) {
3586
28.8k
    afi_safi_data *data =
3587
28.8k
        (afi_safi_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY);
3588
28.8k
    if (!data) {
3589
4.99k
        data = wmem_new0(wmem_file_scope(), afi_safi_data);
3590
4.99k
    }
3591
28.8k
    data->afi  = afi;
3592
28.8k
    data->safi = safi;
3593
28.8k
    p_add_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY, data);
3594
28.8k
    return;
3595
28.8k
}
3596
3597
static afi_safi_data*
3598
612
load_afi_safi_data(packet_info *pinfo) {
3599
612
    afi_safi_data *data =
3600
612
        (afi_safi_data*)p_get_proto_data(wmem_file_scope(), pinfo, proto_bgp, AFI_SAFI_DATA_KEY);
3601
612
    return data;
3602
612
}
3603
3604
/*
3605
 * Detect IPv4/IPv6 prefixes  conform to BGP Additional Path but NOT conform to standard BGP
3606
 *
3607
 * A real BGP speaker would rely on the BGP Additional Path in the BGP Open messages.
3608
 * But it is not suitable for a packet analyse because the BGP sessions are not supposed to
3609
 * restart very often, and Open messages from both sides of the session would be needed
3610
 * to determine the result of the capability negotiation.
3611
 * Code inspired from the decode_prefix4 function
3612
 */
3613
static int
3614
7.95k
detect_add_path_prefix46(tvbuff_t *tvb, int offset, int end, int max_bit_length) {
3615
7.95k
    uint32_t addr_len;
3616
7.95k
    uint8_t prefix_len;
3617
7.95k
    int o;
3618
    /* Must be compatible with BGP Additional Path  */
3619
52.6k
    for (o = offset + 4; o < end; o += 4) {
3620
48.0k
        prefix_len = tvb_get_uint8(tvb, o);
3621
48.0k
        if( prefix_len > max_bit_length) {
3622
1.16k
            return 0; /* invalid prefix length - not BGP add-path */
3623
1.16k
        }
3624
46.8k
        addr_len = (prefix_len + 7) / 8;
3625
46.8k
        o += 1 + addr_len;
3626
46.8k
        if( o > end ) {
3627
592
            return 0; /* invalid offset - not BGP add-path */
3628
592
        }
3629
46.2k
        if (prefix_len % 8) {
3630
            /* detect bits set after the end of the prefix */
3631
2.27k
            if( tvb_get_uint8(tvb, o - 1 )  & (0xFF >> (prefix_len % 8)) ) {
3632
1.58k
                return 0; /* invalid prefix content - not BGP add-path */
3633
1.58k
            }
3634
2.27k
        }
3635
46.2k
    }
3636
    /* Must NOT be compatible with standard BGP */
3637
14.1k
    for (o = offset; o < end; ) {
3638
11.6k
        prefix_len = tvb_get_uint8(tvb, o);
3639
11.6k
        if( prefix_len == 0 && end - offset > 1 ) {
3640
670
            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 */
3641
670
        }
3642
11.0k
        if( prefix_len > max_bit_length) {
3643
139
            return 1; /* invalid prefix length - may be BGP add-path */
3644
139
        }
3645
10.8k
        addr_len = (prefix_len + 7) / 8;
3646
10.8k
        o += 1 + addr_len;
3647
10.8k
        if( o > end ) {
3648
1.13k
            return 1; /* invalid offset - may be BGP add-path */
3649
1.13k
        }
3650
9.73k
        if (prefix_len % 8) {
3651
            /* detect bits set after the end of the prefix */
3652
979
            if( tvb_get_uint8(tvb, o - 1 ) & (0xFF >> (prefix_len % 8)) ) {
3653
228
                return 1; /* invalid prefix content - may be BGP add-path (or a bug) */
3654
228
            }
3655
979
        }
3656
9.73k
    }
3657
2.43k
    return 0; /* valid - do not assume Additional Path */
3658
4.60k
}
3659
static int
3660
2.19k
detect_add_path_prefix4(tvbuff_t *tvb, int offset, int end) {
3661
2.19k
    return detect_add_path_prefix46(tvb, offset, end, 32);
3662
2.19k
}
3663
static int
3664
2.20k
detect_add_path_prefix6(tvbuff_t *tvb, int offset, int end) {
3665
2.20k
    return detect_add_path_prefix46(tvb, offset, end, 128);
3666
2.20k
}
3667
/*
3668
 * Decode an IPv4 prefix with Path Identifier
3669
 * Code inspired from the decode_prefix4 function
3670
 */
3671
static int
3672
decode_path_prefix4(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, int offset,
3673
                    const char *tag)
3674
1.21k
{
3675
1.21k
    proto_tree *prefix_tree;
3676
1.21k
    ws_in4_addr ip_addr; /* IP address                         */
3677
1.21k
    uint8_t plen;         /* prefix length                      */
3678
1.21k
    int    length;       /* number of octets needed for prefix */
3679
1.21k
    uint32_t path_identifier;
3680
1.21k
    address addr;
3681
3682
    /* snarf path identifier length and prefix */
3683
1.21k
    path_identifier = tvb_get_ntohl(tvb, offset);
3684
1.21k
    plen = tvb_get_uint8(tvb, offset + 4);
3685
1.21k
    length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 4 + 1, &ip_addr, plen);
3686
1.21k
    if (length < 0) {
3687
100
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4 , 1, "%s length %u invalid (> 32)",
3688
100
            tag, plen);
3689
100
        return -1;
3690
100
    }
3691
    /* put prefix into protocol tree */
3692
1.11k
    set_address(&addr, AT_IPv4, 4, &ip_addr);
3693
1.11k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,  4 + 1 + length,
3694
1.11k
                            ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3695
1.11k
                            address_to_str(pinfo->pool, &addr), plen, path_identifier);
3696
1.11k
    proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3697
1.11k
    proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
3698
1.11k
    proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, ip_addr);
3699
1.11k
    return 4 + 1 + length;
3700
1.21k
}
3701
3702
/*
3703
 * Decode an IPv4 prefix.
3704
 */
3705
static int
3706
decode_prefix4(proto_tree *tree, packet_info *pinfo, proto_item *parent_item, int hf_addr, tvbuff_t *tvb, int offset,
3707
               const char *tag)
3708
4.85k
{
3709
4.85k
    proto_tree *prefix_tree;
3710
4.85k
    ws_in4_addr ip_addr; /* IP address                         */
3711
4.85k
    uint8_t plen;         /* prefix length                      */
3712
4.85k
    int    length;       /* number of octets needed for prefix */
3713
4.85k
    address addr;
3714
3715
    /* snarf length and prefix */
3716
4.85k
    plen = tvb_get_uint8(tvb, offset);
3717
4.85k
    length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 1, &ip_addr, plen);
3718
4.85k
    if (length < 0) {
3719
437
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid (> 32)",
3720
437
            tag, plen);
3721
437
        return -1;
3722
437
    }
3723
3724
    /* put prefix into protocol tree */
3725
4.41k
    set_address(&addr, AT_IPv4, 4, &ip_addr);
3726
4.41k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3727
4.41k
            1 + length, ett_bgp_prefix, NULL,
3728
4.41k
            "%s/%u", address_to_str(pinfo->pool, &addr), plen);
3729
3730
4.41k
    proto_item_append_text(parent_item, " (%s/%u)",
3731
4.41k
                             address_to_str(pinfo->pool, &addr), plen);
3732
3733
4.41k
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3734
4.41k
        tag, plen);
3735
4.41k
    proto_tree_add_ipv4(prefix_tree, hf_addr, tvb, offset + 1, length, ip_addr);
3736
4.41k
    return 1 + length;
3737
4.85k
}
3738
3739
/*
3740
 * Decode an IPv6 prefix with path ID.
3741
 */
3742
static int
3743
decode_path_prefix6(proto_tree *tree, packet_info *pinfo, int hf_path_id, int hf_addr, tvbuff_t *tvb, int offset,
3744
               const char *tag)
3745
411
{
3746
411
    proto_tree          *prefix_tree;
3747
411
    uint32_t path_identifier;
3748
411
    ws_in6_addr   addr;     /* IPv6 address                       */
3749
411
    address             addr_str;
3750
411
    int                 plen;     /* prefix length                      */
3751
411
    int                 length;   /* number of octets needed for prefix */
3752
3753
    /* snarf length and prefix */
3754
411
    path_identifier = tvb_get_ntohl(tvb, offset);
3755
411
    plen = tvb_get_uint8(tvb, offset + 4);
3756
411
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 4 + 1, &addr, plen);
3757
411
    if (length < 0) {
3758
66
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset + 4, 1, "%s length %u invalid",
3759
66
            tag, plen);
3760
66
        return -1;
3761
66
    }
3762
3763
    /* put prefix into protocol tree */
3764
345
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3765
345
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,  4 + 1 + length,
3766
345
                            ett_bgp_prefix, NULL, "%s/%u PathId %u ",
3767
345
                            address_to_str(pinfo->pool, &addr_str), plen, path_identifier);
3768
3769
345
    proto_tree_add_item(prefix_tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
3770
345
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset + 4, 1, plen, "%s prefix length: %u",
3771
345
        tag, plen);
3772
345
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 4 + 1, length, &addr);
3773
3774
345
    return 4 + 1 + length;
3775
411
}
3776
3777
/*
3778
 * Decode an IPv6 prefix.
3779
 */
3780
static int
3781
decode_prefix6(proto_tree *tree, packet_info *pinfo, int hf_addr, tvbuff_t *tvb, int offset,
3782
               uint16_t tlen, const char *tag)
3783
2.10k
{
3784
2.10k
    proto_tree          *prefix_tree;
3785
2.10k
    ws_in6_addr   addr;     /* IPv6 address                       */
3786
2.10k
    address             addr_str;
3787
2.10k
    int                 plen;     /* prefix length                      */
3788
2.10k
    int                 length;   /* number of octets needed for prefix */
3789
3790
    /* snarf length and prefix */
3791
2.10k
    plen = tvb_get_uint8(tvb, offset);
3792
2.10k
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 1, &addr, plen);
3793
2.10k
    if (length < 0) {
3794
138
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1, "%s length %u invalid",
3795
138
            tag, plen);
3796
138
        return -1;
3797
138
    }
3798
3799
    /* put prefix into protocol tree */
3800
1.96k
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3801
1.96k
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3802
1.96k
            tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3803
1.96k
            address_to_str(pinfo->pool, &addr_str), plen);
3804
1.96k
    proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, plen, "%s prefix length: %u",
3805
1.96k
        tag, plen);
3806
1.96k
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 1, length, &addr);
3807
1.96k
    return 1 + length;
3808
2.10k
}
3809
3810
static int
3811
decode_fspec_match_prefix6(proto_tree *tree, proto_item *parent_item, int hf_addr,
3812
                           tvbuff_t *tvb, int offset, uint16_t tlen, packet_info *pinfo)
3813
976
{
3814
976
    proto_tree        *prefix_tree;
3815
976
    ws_in6_addr addr;     /* IPv6 address                       */
3816
976
    address           addr_str;
3817
976
    int               plen;     /* prefix length                      */
3818
976
    int               length;   /* number of octets needed for prefix */
3819
976
    int               poffset_place = 1;
3820
976
    int               plength_place = 0;
3821
3822
    /* snarf length and prefix */
3823
976
    plen = tvb_get_uint8(tvb, offset);
3824
976
    if (plen == 0) /* I should be facing a draft 04 version where the prefix offset is switched with length */
3825
236
    {
3826
236
      plen =  tvb_get_uint8(tvb, offset+1);
3827
236
      poffset_place = 0;
3828
236
      plength_place = 1;
3829
236
    }
3830
976
    length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 2, &addr, plen);
3831
976
    if (length < 0) {
3832
80
        expert_add_info_format(pinfo, parent_item, &ei_bgp_prefix_length_err, "Length is invalid %u", plen);
3833
80
        return -1;
3834
80
    }
3835
3836
    /* put prefix into protocol tree */
3837
896
    set_address(&addr_str, AT_IPv6, 16, addr.bytes);
3838
896
    prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset,
3839
896
            tlen != 0 ? tlen : 1 + length, ett_bgp_prefix, NULL, "%s/%u",
3840
896
            address_to_str(pinfo->pool, &addr_str), plen);
3841
896
    proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_len, tvb, offset + plength_place, 1, ENC_BIG_ENDIAN);
3842
896
    proto_tree_add_item(prefix_tree, hf_bgp_flowspec_nlri_ipv6_pref_offset, tvb, offset + poffset_place, 1, ENC_BIG_ENDIAN);
3843
896
    proto_tree_add_ipv6(prefix_tree, hf_addr, tvb, offset + 2, length, &addr);
3844
896
    if (parent_item != NULL)
3845
840
      proto_item_append_text(parent_item, " (%s/%u)",
3846
840
                             address_to_str(pinfo->pool, &addr_str), plen);
3847
896
    return 2 + length;
3848
976
}
3849
3850
const char*
3851
decode_bgp_rd(wmem_allocator_t *pool, tvbuff_t *tvb, int offset)
3852
15.7k
{
3853
15.7k
    uint16_t rd_type;
3854
15.7k
    wmem_strbuf_t *strbuf;
3855
3856
15.7k
    rd_type = tvb_get_ntohs(tvb,offset);
3857
15.7k
    strbuf = wmem_strbuf_create(pool);
3858
3859
15.7k
    switch (rd_type) {
3860
1.52k
        case FORMAT_AS2_LOC:
3861
1.52k
            wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohs(tvb, offset + 2),
3862
1.52k
                                      tvb_get_ntohl(tvb, offset + 4));
3863
1.52k
            break;
3864
315
        case FORMAT_IP_LOC:
3865
315
            wmem_strbuf_append_printf(strbuf, "%s:%u", tvb_ip_to_str(pool, tvb, offset + 2),
3866
315
                                      tvb_get_ntohs(tvb, offset + 6));
3867
315
            break ;
3868
365
        case FORMAT_AS4_LOC:
3869
365
            wmem_strbuf_append_printf(strbuf, "%u:%u", tvb_get_ntohl(tvb, offset + 2),
3870
365
                                      tvb_get_ntohs(tvb, offset + 6));
3871
365
            break ;
3872
13.5k
        default:
3873
13.5k
            wmem_strbuf_append_printf(strbuf, "Unknown (0x%04x) RD type",rd_type);
3874
13.5k
            break;
3875
15.7k
    } /* switch (rd_type) */
3876
3877
15.7k
    return wmem_strbuf_get_str(strbuf);
3878
15.7k
}
3879
3880
static int
3881
decode_mcast_vpn_nlri_addresses(proto_tree *tree, tvbuff_t *tvb,
3882
                                int offset)
3883
3.52k
{
3884
3.52k
    uint8_t addr_len;
3885
3886
    /* Multicast Source Address */
3887
3.52k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_length, tvb, offset,
3888
3.52k
                        1, ENC_BIG_ENDIAN);
3889
3.52k
    addr_len = tvb_get_uint8(tvb, offset);
3890
3.52k
    if (addr_len != 0 && addr_len != 32 && addr_len != 128)
3891
844
        return -1;
3892
2.67k
    offset++;
3893
2.67k
    switch (addr_len) {
3894
146
        case 32:
3895
146
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv4, tvb,
3896
146
                                offset, 4, ENC_BIG_ENDIAN);
3897
146
            offset += 4;
3898
146
            break;
3899
1.22k
        case 128:
3900
1.22k
             proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_source_addr_ipv6, tvb,
3901
1.22k
                                 offset, 16, ENC_NA);
3902
1.22k
             offset += 16;
3903
1.22k
             break;
3904
2.67k
    }
3905
3906
    /* Multicast Group Address */
3907
2.65k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_length, tvb, offset,
3908
2.65k
                        1, ENC_BIG_ENDIAN);
3909
2.65k
    addr_len = tvb_get_uint8(tvb, offset);
3910
2.65k
    if (addr_len != 0 && addr_len != 32 && addr_len != 128)
3911
215
        return -1;
3912
2.44k
    offset++;
3913
2.44k
    switch(addr_len) {
3914
113
        case 32:
3915
113
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv4, tvb,
3916
113
                                offset, 4, ENC_BIG_ENDIAN);
3917
113
            offset += 4;
3918
113
            break;
3919
210
        case 128:
3920
210
            proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_group_addr_ipv6, tvb,
3921
210
                                offset, 16, ENC_NA);
3922
210
            offset += 16;
3923
210
            break;
3924
2.44k
    }
3925
3926
2.42k
    return offset;
3927
2.44k
}
3928
3929
/*
3930
 * function to decode operator in BGP flow spec NLRI when it address decimal values (TCP ports, UDP ports, ports, ...)
3931
 */
3932
3933
static void
3934
decode_bgp_flow_spec_dec_operator(proto_tree *tree, tvbuff_t *tvb, int offset)
3935
51.0k
{
3936
51.0k
    static int * const flags[] = {
3937
51.0k
        &hf_bgp_flowspec_nlri_op_eol,
3938
51.0k
        &hf_bgp_flowspec_nlri_op_and,
3939
51.0k
        &hf_bgp_flowspec_nlri_op_val_len,
3940
51.0k
        &hf_bgp_flowspec_nlri_op_un_bit4,
3941
51.0k
        &hf_bgp_flowspec_nlri_op_lt,
3942
51.0k
        &hf_bgp_flowspec_nlri_op_gt,
3943
51.0k
        &hf_bgp_flowspec_nlri_op_eq,
3944
51.0k
        NULL
3945
51.0k
    };
3946
3947
51.0k
    proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
3948
51.0k
}
3949
3950
/*
3951
 * Decode an operator and decimal values of BGP flow spec NLRI
3952
 */
3953
static int
3954
decode_bgp_nlri_op_dec_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, int offset)
3955
2.84k
{
3956
2.84k
    uint8_t nlri_operator;
3957
2.84k
    unsigned cursor_op_val=0;
3958
2.84k
    uint8_t value_len=0;
3959
2.84k
    unsigned value=0;
3960
2.84k
    uint8_t shift_amount=0;
3961
2.84k
    unsigned first_loop=0;
3962
3963
2.84k
    proto_item_append_text(parent_item," (");
3964
3965
51.0k
    do {
3966
51.0k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
3967
51.0k
        shift_amount = nlri_operator&0x30;
3968
51.0k
        shift_amount = shift_amount >> 4;
3969
51.0k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
3970
        /* call to a operator decode function */
3971
51.0k
        decode_bgp_flow_spec_dec_operator(parent_tree, tvb, offset+cursor_op_val);
3972
51.0k
        if (first_loop == 0)
3973
2.83k
        {
3974
            /* If first operator we remove a white space and or (||) is not relevant */
3975
            /* BGP flow spec NLRI operator bitmask */
3976
2.83k
            proto_item_append_text(parent_item,"%s%s%s%s",
3977
2.83k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
3978
2.83k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3979
2.83k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3980
2.83k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3981
2.83k
            first_loop = 1;
3982
2.83k
        }
3983
48.2k
        else
3984
48.2k
        {
3985
48.2k
            proto_item_append_text(parent_item," %s%s%s%s",
3986
48.2k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
3987
48.2k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
3988
48.2k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
3989
48.2k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
3990
48.2k
        }
3991
51.0k
        cursor_op_val++;  /* we manage this operator we move to the value */
3992
51.0k
        switch (value_len) {
3993
48.9k
            case 1:
3994
48.9k
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_8, tvb, offset+cursor_op_val, 1,ENC_BIG_ENDIAN);
3995
48.9k
                value = tvb_get_uint8(tvb,offset+cursor_op_val);
3996
48.9k
                break;
3997
598
            case 2:
3998
598
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_16, tvb, offset+cursor_op_val, 2,ENC_BIG_ENDIAN);
3999
598
                value = tvb_get_ntohs(tvb,offset+cursor_op_val);
4000
598
                break;
4001
0
            case 3:
4002
0
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_32, tvb, offset+cursor_op_val, 4, ENC_BIG_ENDIAN);
4003
0
                value = tvb_get_ntohl(tvb,offset+cursor_op_val);
4004
0
                break;
4005
492
            case 4:
4006
492
                proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dec_val_64, tvb, offset+cursor_op_val, 8, ENC_BIG_ENDIAN);
4007
492
                break;
4008
1.03k
            default:
4009
1.03k
                return -1;
4010
51.0k
        }
4011
50.0k
        cursor_op_val = cursor_op_val + value_len;
4012
50.0k
        proto_item_append_text(parent_item,"%u", value);
4013
50.0k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4014
1.79k
    proto_item_append_text(parent_item,")");
4015
1.79k
    return (cursor_op_val);
4016
2.84k
}
4017
4018
4019
/*
4020
 * function to decode operator in BGP flow spec NLRI when it address a bitmask values (TCP flags, fragmentation flags,...)
4021
 */
4022
4023
static void
4024
decode_bgp_flow_spec_bitmask_operator(proto_tree *tree, tvbuff_t *tvb, int offset)
4025
63.3k
{
4026
63.3k
    static int * const flags[] = {
4027
63.3k
        &hf_bgp_flowspec_nlri_op_eol,
4028
63.3k
        &hf_bgp_flowspec_nlri_op_and,
4029
63.3k
        &hf_bgp_flowspec_nlri_op_val_len,
4030
63.3k
        &hf_bgp_flowspec_nlri_op_un_bit4,
4031
63.3k
        &hf_bgp_flowspec_nlri_op_un_bit5,
4032
63.3k
        &hf_bgp_flowspec_nlri_op_flg_not,
4033
63.3k
        &hf_bgp_flowspec_nlri_op_flg_match,
4034
63.3k
        NULL
4035
63.3k
    };
4036
4037
63.3k
    proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
4038
63.3k
}
4039
4040
/*
4041
 * Decode an operator and tcp flags bitmask of BGP flow spec NLRI
4042
 */
4043
static int
4044
decode_bgp_nlri_op_tcpf_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, int offset)
4045
1.51k
{
4046
1.51k
    uint8_t nlri_operator;
4047
1.51k
    uint8_t tcp_flags;
4048
1.51k
    unsigned cursor_op_val=0;
4049
1.51k
    uint8_t value_len=0;
4050
1.51k
    uint8_t shift_amount=0;
4051
1.51k
    unsigned first_loop=0;
4052
4053
1.51k
    static int * const nlri_tcp_flags[] = {
4054
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_cwr,
4055
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_ecn,
4056
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_urg,
4057
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_ack,
4058
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_push,
4059
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_reset,
4060
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_syn,
4061
1.51k
        &hf_bgp_flowspec_nlri_tcp_flags_fin,
4062
1.51k
        NULL
4063
1.51k
    };
4064
4065
1.51k
    proto_item_append_text(parent_item," (");
4066
4067
36.3k
    do {
4068
36.3k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4069
36.3k
        shift_amount = nlri_operator&0x30;
4070
36.3k
        shift_amount = shift_amount >> 4;
4071
36.3k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4072
36.3k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val); /* call to a operator decode function */
4073
36.3k
        if (first_loop == 0)
4074
1.51k
        {
4075
            /* If first operator we remove a white space and or (||) is not relevant */
4076
1.51k
            proto_item_append_text(parent_item,"%s%s%s%s",
4077
1.51k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4078
1.51k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4079
1.51k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4080
1.51k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4081
1.51k
            first_loop = 1;
4082
1.51k
        }
4083
34.8k
        else
4084
34.8k
        {
4085
34.8k
            proto_item_append_text(parent_item," %s%s%s%s",
4086
34.8k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4087
34.8k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4088
34.8k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4089
34.8k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4090
34.8k
        }
4091
36.3k
        cursor_op_val++;  /* we manage this operator we move to the value */
4092
36.3k
        if (value_len == 2) {
4093
2.53k
            cursor_op_val++; /* tcp flags are coded over 2 bytes only the second one is significant, we move to second byte */
4094
2.53k
        }
4095
4096
36.3k
        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);
4097
36.3k
        tcp_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4098
4099
36.3k
        proto_item_append_text(parent_item," %s%s%s%s%s%s",
4100
36.3k
             ((tcp_flags & BGPNLRI_FSPEC_TH_URG) == 0) ? "" : "U",
4101
36.3k
             ((tcp_flags & BGPNLRI_FSPEC_TH_ACK) == 0) ? "" : "A",
4102
36.3k
             ((tcp_flags & BGPNLRI_FSPEC_TH_PUSH) == 0) ? "" : "P",
4103
36.3k
             ((tcp_flags & BGPNLRI_FSPEC_TH_RST) == 0) ? "" : "R",
4104
36.3k
             ((tcp_flags & BGPNLRI_FSPEC_TH_SYN) == 0) ? "" : "S",
4105
36.3k
             ((tcp_flags & BGPNLRI_FSPEC_TH_FIN) == 0) ? "" : "F");
4106
36.3k
        cursor_op_val = cursor_op_val + value_len;
4107
36.3k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4108
1.51k
    proto_item_append_text(parent_item,")");
4109
1.51k
    return (cursor_op_val);
4110
1.51k
}
4111
4112
4113
/*
4114
 * Decode an operator and fragmentation bitmask of BGP flow spec NLRI
4115
 */
4116
static int
4117
decode_bgp_nlri_op_fflag_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, int offset)
4118
1.23k
{
4119
1.23k
    uint8_t nlri_operator;
4120
1.23k
    uint8_t fragment_flags;
4121
1.23k
    unsigned cursor_op_val=0;
4122
1.23k
    uint8_t value_len=0;
4123
1.23k
    uint8_t shift_amount=0;
4124
1.23k
    unsigned first_loop=0;
4125
4126
1.23k
    static int * const nlri_flags[] = {
4127
1.23k
        &hf_bgp_flowspec_nlri_fflag_lf,
4128
1.23k
        &hf_bgp_flowspec_nlri_fflag_ff,
4129
1.23k
        &hf_bgp_flowspec_nlri_fflag_isf,
4130
1.23k
        &hf_bgp_flowspec_nlri_fflag_df,
4131
1.23k
        NULL
4132
1.23k
    };
4133
4134
1.23k
    proto_item_append_text(parent_item," (");
4135
4136
22.7k
    do {
4137
22.7k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4138
22.7k
        shift_amount = nlri_operator&0x30;
4139
22.7k
        shift_amount = shift_amount >> 4;
4140
22.7k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4141
        /* call a function to decode operator addressing bitmask */
4142
22.7k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
4143
22.7k
        if (first_loop == 0)
4144
1.23k
        {
4145
            /* If first operator we remove a white space and or (||) is not relevant */
4146
1.23k
            proto_item_append_text(parent_item,"%s%s%s%s",
4147
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4148
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4149
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4150
1.23k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4151
1.23k
            first_loop = 1;
4152
1.23k
        }
4153
21.5k
        else
4154
21.5k
        {
4155
21.5k
            proto_item_append_text(parent_item," %s%s%s%s",
4156
21.5k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4157
21.5k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4158
21.5k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4159
21.5k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4160
21.5k
        }
4161
22.7k
        cursor_op_val++;  /* we manage this operator we move to the value */
4162
22.7k
        if (value_len != 1) {
4163
485
            return -1; /* frag flags have to be coded in 1 byte */
4164
485
        }
4165
22.3k
        fragment_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4166
4167
22.3k
        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);
4168
4169
22.3k
        proto_item_append_text(parent_item," %s%s%s%s",
4170
22.3k
             ((fragment_flags & BGPNLRI_FSPEC_FG_DF) == 0) ? "" : "DF",
4171
22.3k
             ((fragment_flags & BGPNLRI_FSPEC_FG_ISF) == 0) ? "" : "IsF",
4172
22.3k
             ((fragment_flags & BGPNLRI_FSPEC_FG_FF) == 0) ? "" : "FF",
4173
22.3k
             ((fragment_flags & BGPNLRI_FSPEC_FG_LF) == 0) ? "" : "LF");
4174
22.3k
        cursor_op_val = cursor_op_val + value_len;
4175
22.3k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4176
750
    proto_item_append_text(parent_item,")");
4177
750
    return (cursor_op_val);
4178
1.23k
}
4179
4180
/*
4181
 * Decode an operator and DSCP value of BGP flow spec NLRI
4182
 */
4183
static int
4184
decode_bgp_nlri_op_dscp_value(proto_tree *parent_tree, proto_item *parent_item, tvbuff_t *tvb, int offset)
4185
924
{
4186
924
    uint8_t nlri_operator;
4187
924
    uint8_t dscp_flags;
4188
924
    unsigned cursor_op_val=0;
4189
924
    uint8_t value_len=0;
4190
924
    uint8_t shift_amount=0;
4191
924
    unsigned first_loop=0;
4192
4193
924
    proto_item_append_text(parent_item," (");
4194
4195
4.23k
    do {
4196
4.23k
        nlri_operator = tvb_get_uint8(tvb, offset+cursor_op_val);
4197
4.23k
        shift_amount = nlri_operator&0x30;
4198
4.23k
        shift_amount = shift_amount >> 4;
4199
4.23k
        value_len = 1 << shift_amount; /* as written in RFC 5575 section 4 */
4200
        /* call a function to decode operator addressing bitmask */
4201
4.23k
        decode_bgp_flow_spec_bitmask_operator(parent_tree, tvb, offset+cursor_op_val);
4202
4.23k
        if (first_loop == 0)
4203
924
        {
4204
            /* If first operator we remove a white space and or (||) is not relevant */
4205
924
            proto_item_append_text(parent_item,"%s%s%s%s",
4206
924
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "" : "&& ",
4207
924
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4208
924
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4209
924
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4210
924
            first_loop = 1;
4211
924
        }
4212
3.31k
        else
4213
3.31k
        {
4214
3.31k
            proto_item_append_text(parent_item," %s%s%s%s",
4215
3.31k
                 ((nlri_operator & BGPNLRI_FSPEC_AND_BIT) == 0) ? "|| " : "&& ",
4216
3.31k
                 ((nlri_operator & BGPNLRI_FSPEC_GREATER_THAN) == 0) ? "" : ">",
4217
3.31k
                 ((nlri_operator & BGPNLRI_FSPEC_LESS_THAN) == 0) ? "" : "<",
4218
3.31k
                 ((nlri_operator & BGPNLRI_FSPEC_EQUAL) == 0) ? "" : "=");
4219
3.31k
        }
4220
4.23k
        cursor_op_val++;  /* we manage this operator we move to the value */
4221
4.23k
        if (value_len != 1) {
4222
199
            return -1; /* frag flags have to be coded in 1 byte */
4223
199
        }
4224
4.03k
        dscp_flags = tvb_get_uint8(tvb,offset+cursor_op_val);
4225
4.03k
        proto_tree_add_item(parent_tree, hf_bgp_flowspec_nlri_dscp, tvb, offset+cursor_op_val, 1, ENC_BIG_ENDIAN);
4226
4.03k
        proto_item_append_text(parent_item,"%s",val_to_str_ext_const(dscp_flags,&dscp_vals_ext, "Unknown DSCP"));
4227
4.03k
        cursor_op_val = cursor_op_val + value_len;
4228
4.03k
    } while ((nlri_operator&BGPNLRI_FSPEC_END_OF_LST) == 0);
4229
725
    proto_item_append_text(parent_item,")");
4230
725
    return (cursor_op_val);
4231
924
}
4232
4233
4234
4235
/*
4236
 * Decode an FLOWSPEC nlri as define in RFC 5575
4237
 */
4238
static int
4239
decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t afi, uint8_t safi, packet_info *pinfo)
4240
7.72k
{
4241
7.72k
    unsigned  tot_flow_len;       /* total length of the flow spec NLRI */
4242
7.72k
    unsigned  offset_len;         /* offset of the flow spec NLRI itself could be 1 or 2 bytes */
4243
7.72k
    unsigned  cursor_fspec;       /* cursor to move into flow spec nlri */
4244
7.72k
    int       filter_len = -1;
4245
7.72k
    uint16_t  len_16;
4246
7.72k
    uint32_t  rd_type;
4247
7.72k
    proto_item *item;
4248
7.72k
    proto_item *filter_item;
4249
7.72k
    proto_item *disting_item;
4250
7.72k
    proto_tree *nlri_tree;
4251
7.72k
    proto_tree *disting_tree;
4252
7.72k
    proto_tree *filter_tree;
4253
4254
4255
7.72k
    if (afi != AFNUM_INET && afi != AFNUM_INET6)
4256
0
    {
4257
0
        expert_add_info(pinfo, NULL, &ei_bgp_afi_type_not_supported);
4258
0
        return -1;
4259
0
    }
4260
4261
7.72k
    tot_flow_len = tvb_get_uint8(tvb, offset);
4262
    /* if nlri length is greater than 240 bytes, it is encoded over 2 bytes */
4263
    /* with most significant nibble all in one. 240 is encoded 0xf0f0, 241 0xf0f1 */
4264
    /* max possible value value is 4095 Oxffff */
4265
4266
7.72k
    if (tot_flow_len >= 240)
4267
278
    {
4268
278
        len_16 = tvb_get_ntohs(tvb, offset);
4269
278
        tot_flow_len = len_16 & 0x0FFF; /* remove most significant nibble */
4270
278
        offset_len = 2;
4271
7.44k
    } else {
4272
7.44k
        offset_len = 1;
4273
7.44k
    }
4274
4275
7.72k
    item = proto_tree_add_item(tree, hf_bgp_flowspec_nlri_t, tvb, offset,
4276
7.72k
                               tot_flow_len+offset_len, ENC_NA);
4277
7.72k
    proto_item_set_text(item, "FLOW_SPEC_NLRI (%u byte%s)",
4278
7.72k
                        tot_flow_len+offset_len, plurality(tot_flow_len+offset_len, "", "s"));
4279
4280
7.72k
    nlri_tree = proto_item_add_subtree(item, ett_bgp_flow_spec_nlri);
4281
4282
7.72k
    proto_tree_add_uint(nlri_tree, hf_bgp_flowspec_nlri_length, tvb, offset,
4283
7.72k
                        offset_len, tot_flow_len);
4284
4285
7.72k
    offset = offset + offset_len;
4286
7.72k
    cursor_fspec = 0;
4287
4288
    /* when SAFI is VPN Flow Spec, then write route distinguisher */
4289
7.72k
    if (safi == SAFNUM_FSPEC_VPN_RULE)
4290
1.53k
    {
4291
1.53k
        disting_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_route_distinguisher,
4292
1.53k
                                           tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4293
1.53k
        disting_tree = proto_item_add_subtree(disting_item, ett_bgp_flow_spec_nlri);
4294
1.53k
        proto_tree_add_item_ret_uint(disting_tree, hf_bgp_flowspec_nlri_route_distinguisher_type,
4295
1.53k
                                     tvb, offset, 2, ENC_BIG_ENDIAN, &rd_type);
4296
        /* Route Distinguisher Type */
4297
1.53k
        switch (rd_type) {
4298
721
        case FORMAT_AS2_LOC:
4299
721
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
4300
721
                                tvb, offset + 2, 2, ENC_BIG_ENDIAN);
4301
721
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_4,
4302
721
                                tvb, offset + 4, 4, ENC_BIG_ENDIAN);
4303
721
            break;
4304
4305
206
        case FORMAT_IP_LOC:
4306
206
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
4307
206
                                tvb, offset + 2, 4, ENC_BIG_ENDIAN);
4308
206
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
4309
206
                                tvb, offset + 6, 2, ENC_BIG_ENDIAN);
4310
206
            break;
4311
4312
197
        case FORMAT_AS4_LOC:
4313
197
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
4314
197
                                tvb, offset + 2, 4, ENC_BIG_ENDIAN);
4315
197
            proto_tree_add_item(disting_tree, hf_bgp_flowspec_nlri_route_dist_asnum_2,
4316
197
                                tvb, offset + 6, 2, ENC_BIG_ENDIAN);
4317
197
            break;
4318
4319
399
        default:
4320
399
            expert_add_info_format(pinfo, disting_tree, &ei_bgp_length_invalid,
4321
399
                                   "Unknown Route Distinguisher type (%u)", rd_type);
4322
1.53k
        }
4323
1.49k
        cursor_fspec += BGP_ROUTE_DISTINGUISHER_SIZE;
4324
1.49k
    }
4325
4326
14.4k
    while (cursor_fspec < tot_flow_len)
4327
9.10k
    {
4328
9.10k
        filter_item = proto_tree_add_item(nlri_tree, hf_bgp_flowspec_nlri_filter, tvb, offset+cursor_fspec, 1, ENC_NA);
4329
9.10k
        filter_tree = proto_item_add_subtree(filter_item, ett_bgp_flow_spec_nlri_filter);
4330
9.10k
        proto_tree_add_item(filter_tree, hf_bgp_flowspec_nlri_filter_type, tvb, offset+cursor_fspec, 1, ENC_BIG_ENDIAN);
4331
9.10k
        proto_item_append_text(filter_item, ": %s", val_to_str(tvb_get_uint8(tvb,offset+cursor_fspec), flowspec_nlri_opvaluepair_type, "Unknown filter %d"));
4332
9.10k
        switch (tvb_get_uint8(tvb,offset+cursor_fspec)) {
4333
1.29k
        case BGPNLRI_FSPEC_DST_PFIX:
4334
1.29k
            cursor_fspec++;
4335
1.29k
            if (afi == AFNUM_INET)
4336
619
                filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_dst_pref_ipv4,
4337
619
                                            tvb, offset+cursor_fspec, "Destination IP filter");
4338
675
            else /* AFNUM_INET6 */
4339
675
                filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_dst_ipv6_pref,
4340
675
                                                        tvb, offset+cursor_fspec, 0, pinfo);
4341
1.29k
            if (filter_len == -1)
4342
75
                cursor_fspec= tot_flow_len;
4343
1.29k
            break;
4344
910
        case BGPNLRI_FSPEC_SRC_PFIX:
4345
910
            cursor_fspec++;
4346
910
            if (afi == AFNUM_INET)
4347
609
                filter_len = decode_prefix4(filter_tree, pinfo, filter_item, hf_bgp_flowspec_nlri_src_pref_ipv4,
4348
609
                                            tvb, offset+cursor_fspec, "Source IP filter");
4349
301
            else /* AFNUM_INET6 */
4350
301
                filter_len = decode_fspec_match_prefix6(filter_tree, filter_item, hf_bgp_flowspec_nlri_src_ipv6_pref,
4351
301
                                                        tvb, offset+cursor_fspec, 0, pinfo);
4352
910
            if (filter_len == -1)
4353
74
              cursor_fspec= tot_flow_len;
4354
910
            break;
4355
306
        case BGPNLRI_FSPEC_IP_PROTO:
4356
306
            cursor_fspec++;
4357
306
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4358
306
            break;
4359
996
        case BGPNLRI_FSPEC_PORT:
4360
996
            cursor_fspec++;
4361
996
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4362
996
            break;
4363
237
        case BGPNLRI_FSPEC_DST_PORT:
4364
237
            cursor_fspec++;
4365
237
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4366
237
            break;
4367
480
        case BGPNLRI_FSPEC_SRC_PORT:
4368
480
            cursor_fspec++;
4369
480
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4370
480
            break;
4371
297
        case BGPNLRI_FSPEC_ICMP_TP:
4372
297
            cursor_fspec++;
4373
297
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4374
297
            break;
4375
281
        case BGPNLRI_FSPEC_ICMP_CD:
4376
281
            cursor_fspec++;
4377
281
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4378
281
            break;
4379
1.51k
        case BGPNLRI_FSPEC_TCP_FLAGS:
4380
1.51k
            cursor_fspec++;
4381
1.51k
            filter_len = decode_bgp_nlri_op_tcpf_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4382
1.51k
            break;
4383
245
        case BGPNLRI_FSPEC_PCK_LEN:
4384
245
            cursor_fspec++;
4385
245
            filter_len = decode_bgp_nlri_op_dec_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4386
245
            break;
4387
924
        case BGPNLRI_FSPEC_DSCP:
4388
924
            cursor_fspec++;
4389
924
            filter_len = decode_bgp_nlri_op_dscp_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4390
924
            break;
4391
1.23k
        case BGPNLRI_FSPEC_FRAGMENT:
4392
1.23k
            cursor_fspec++;
4393
1.23k
            filter_len = decode_bgp_nlri_op_fflag_value(filter_tree, filter_item, tvb, offset+cursor_fspec);
4394
1.23k
            break;
4395
381
        default:
4396
381
            return -1;
4397
9.10k
      }
4398
8.60k
      if (filter_len>0)
4399
6.74k
          cursor_fspec += filter_len;
4400
1.86k
      else
4401
1.86k
          break;
4402
6.74k
      proto_item_set_len(filter_item,filter_len+1);
4403
6.74k
    }
4404
7.19k
    return tot_flow_len+offset_len-1;
4405
7.69k
}
4406
4407
/*
4408
 * Decode an MCAST-VPN nlri as defined in draft-ietf-l3vpn-2547bis-mcast-bgp-08.txt .
4409
 */
4410
static int
4411
decode_mcast_vpn_nlri(proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t afi, packet_info *pinfo)
4412
5.79k
{
4413
5.79k
    uint8_t route_type, length, ip_length;
4414
5.79k
    proto_item *item;
4415
5.79k
    proto_tree *nlri_tree;
4416
5.79k
    uint32_t route_key_length;
4417
5.79k
    int ret;
4418
4419
5.79k
    ip_length = (afi == AFNUM_INET) ? 4 : 16;
4420
4421
5.79k
    route_type = tvb_get_uint8(tvb, offset);
4422
5.79k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_route_type, tvb,
4423
5.79k
                               offset, 1, ENC_BIG_ENDIAN);
4424
5.79k
    offset++;
4425
4426
5.79k
    length = tvb_get_uint8(tvb, offset);
4427
5.79k
    proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_length, tvb, offset,
4428
5.79k
                               1, ENC_BIG_ENDIAN);
4429
5.79k
    offset++;
4430
4431
5.79k
    if (length > tvb_reported_length_remaining(tvb, offset))
4432
29
        return -1;
4433
4434
5.76k
    item = proto_tree_add_item(tree, hf_bgp_mcast_vpn_nlri_t, tvb, offset,
4435
5.76k
                               length, ENC_NA);
4436
5.76k
    proto_item_set_text(item, "%s (%u byte%s)",
4437
5.76k
                        val_to_str_const(route_type, mcast_vpn_route_type, "Unknown"),
4438
5.76k
                        length, plurality(length, "", "s"));
4439
4440
5.76k
    nlri_tree = proto_item_add_subtree(item, ett_bgp_mcast_vpn_nlri);
4441
4442
5.76k
    switch (route_type) {
4443
664
        case MCAST_VPN_RTYPE_INTRA_AS_IPMSI_AD:
4444
664
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4445
664
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4446
664
                                       ENC_NA);
4447
664
            proto_item_set_text(item, "Route Distinguisher: %s",
4448
664
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4449
664
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4450
4451
664
            if (afi == AFNUM_INET)
4452
465
                proto_tree_add_item(nlri_tree,
4453
465
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4454
465
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4455
199
            else
4456
199
                proto_tree_add_item(nlri_tree,
4457
199
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4458
199
                                           tvb, offset, ip_length, ENC_NA);
4459
664
            break;
4460
4461
326
        case MCAST_VPN_RTYPE_INTER_AS_IPMSI_AD:
4462
326
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4463
326
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4464
326
                                       ENC_NA);
4465
326
            proto_item_set_text(item, "Route Distinguisher: %s",
4466
326
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4467
326
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4468
4469
326
            proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
4470
326
                                offset, 4, ENC_BIG_ENDIAN);
4471
326
            break;
4472
4473
903
        case MCAST_VPN_RTYPE_SPMSI_AD:
4474
903
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4475
903
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4476
903
                                       ENC_NA);
4477
903
            proto_item_set_text(item, "Route Distinguisher: %s",
4478
903
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4479
903
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4480
4481
903
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4482
903
            if (ret < 0)
4483
77
                return -1;
4484
4485
826
            offset = ret;
4486
4487
826
            if (afi == AFNUM_INET)
4488
608
                proto_tree_add_item(nlri_tree,
4489
608
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4490
608
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4491
218
            else
4492
218
                proto_tree_add_item(nlri_tree,
4493
218
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4494
218
                                           tvb, offset, ip_length, ENC_NA);
4495
826
            break;
4496
4497
415
        case MCAST_VPN_RTYPE_LEAF_AD:
4498
415
            route_key_length = length - ip_length;
4499
415
            item = proto_tree_add_item(nlri_tree,
4500
415
                                       hf_bgp_mcast_vpn_nlri_route_key, tvb,
4501
415
                                       offset, route_key_length, ENC_NA);
4502
415
            proto_item_set_text(item, "Route Key (%u byte%s)", route_key_length,
4503
415
                                plurality(route_key_length, "", "s"));
4504
415
            offset += route_key_length;
4505
4506
415
            if (afi == AFNUM_INET)
4507
213
                proto_tree_add_item(nlri_tree,
4508
213
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
4509
213
                                           tvb, offset, ip_length, ENC_BIG_ENDIAN);
4510
202
            else
4511
202
                proto_tree_add_item(nlri_tree,
4512
202
                                           hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
4513
202
                                           tvb, offset, ip_length, ENC_NA);
4514
415
            break;
4515
4516
468
        case MCAST_VPN_RTYPE_SOURCE_ACTIVE_AD:
4517
468
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4518
468
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4519
468
                                       ENC_NA);
4520
468
            proto_item_set_text(item, "Route Distinguisher: %s",
4521
468
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4522
468
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4523
4524
468
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4525
468
            if (ret < 0)
4526
203
                return -1;
4527
265
            break;
4528
4529
265
        case MCAST_VPN_RTYPE_SHARED_TREE_JOIN:
4530
1.23k
        case MCAST_VPN_RTYPE_SOURCE_TREE_JOIN:
4531
1.23k
            item = proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_rd, tvb,
4532
1.23k
                                       offset, BGP_ROUTE_DISTINGUISHER_SIZE,
4533
1.23k
                                       ENC_NA);
4534
1.23k
            proto_item_set_text(item, "Route Distinguisher: %s",
4535
1.23k
                                decode_bgp_rd(pinfo->pool, tvb, offset));
4536
1.23k
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4537
4538
1.23k
            proto_tree_add_item(nlri_tree, hf_bgp_mcast_vpn_nlri_source_as, tvb,
4539
1.23k
                                offset, 4, ENC_BIG_ENDIAN);
4540
1.23k
            offset += 4;
4541
4542
1.23k
            ret = decode_mcast_vpn_nlri_addresses(nlri_tree, tvb, offset);
4543
1.23k
            if (ret < 0)
4544
238
                return -1;
4545
992
            break;
4546
5.76k
    }
4547
4548
    /* route type field (1 byte) + length field (1 byte) + length */
4549
5.07k
    return 2 + length;
4550
5.76k
}
4551
4552
/*
4553
 * Decode an SR Policy SAFI as defined in draft-ietf-idr-segment-routing-te-policy-08
4554
 */
4555
static int
4556
decode_sr_policy_nlri(proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t afi)
4557
440
{
4558
440
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_length, tvb, offset, 1, ENC_BIG_ENDIAN);
4559
440
   offset += 1;
4560
440
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_distinguisher, tvb, offset, 4, ENC_NA);
4561
440
   offset += 4;
4562
440
   proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_policy_color, tvb, offset, 4, ENC_NA);
4563
440
   offset += 4;
4564
440
   if (afi == AFNUM_INET) {
4565
237
       proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
4566
237
       return 13;
4567
237
   } else {
4568
203
       proto_tree_add_item(tree, hf_bgp_sr_policy_nlri_endpoint_v6, tvb, offset, 16, ENC_NA);
4569
203
       return 25;
4570
203
   }
4571
440
}
4572
4573
/*
4574
 * Decodes an MDT-SAFI message.
4575
 */
4576
static unsigned
4577
decode_mdt_safi(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
4578
346
{
4579
346
    const unsigned ip_length = 4;
4580
346
    const unsigned mdt_safi_nlri_length_bits = 128;
4581
346
    unsigned length; /* length in bits */
4582
346
    int   orig_offset = offset;
4583
346
    proto_item *item;
4584
4585
346
    length = tvb_get_uint8(tvb, offset);
4586
346
    if (length != mdt_safi_nlri_length_bits)
4587
212
        return -1;
4588
134
    offset++;
4589
4590
134
    item = proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_rd, tvb,
4591
134
                               offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
4592
134
    proto_item_set_text(item, "Route Distinguisher: %s",
4593
134
                        decode_bgp_rd(pinfo->pool, tvb, offset));
4594
134
    offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4595
4596
134
    proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_ipv4_addr, tvb,
4597
134
                        offset, ip_length, ENC_BIG_ENDIAN);
4598
134
    offset += ip_length;
4599
4600
134
    proto_tree_add_item(tree, hf_bgp_mdt_nlri_safi_group_addr, tvb,
4601
134
                        offset, ip_length, ENC_BIG_ENDIAN);
4602
134
    offset += ip_length;
4603
4604
134
    return offset - orig_offset;
4605
346
}
4606
4607
/*
4608
 * Decode an MPLS label stack
4609
 * XXX - We should change *buf to **buf, use wmem_alloc() and drop the buflen
4610
 * argument.
4611
 */
4612
static unsigned
4613
decode_MPLS_stack(tvbuff_t *tvb, int offset, wmem_strbuf_t *stack_strbuf)
4614
3.90k
{
4615
3.90k
    uint32_t    label_entry;    /* an MPLS label entry (label + COS field + stack bit   */
4616
3.90k
    int         indx;          /* index for the label stack */
4617
4618
3.90k
    indx = offset ;
4619
3.90k
    label_entry = 0x000000 ;
4620
4621
3.90k
    wmem_strbuf_truncate(stack_strbuf, 0);
4622
4623
15.9k
    while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4624
4625
12.6k
        label_entry = tvb_get_ntoh24(tvb, indx) ;
4626
4627
        /* withdrawn routes may contain 0 or 0x800000 in the first label */
4628
12.6k
        if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4629
642
            wmem_strbuf_append(stack_strbuf, "0 (withdrawn)");
4630
642
            return 1;
4631
642
        }
4632
4633
11.9k
        wmem_strbuf_append_printf(stack_strbuf, "%u%s", label_entry >> 4,
4634
11.9k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4635
4636
11.9k
        indx += 3 ;
4637
11.9k
    }
4638
4639
3.26k
    return (indx - offset) / 3;
4640
3.90k
}
4641
4642
static unsigned
4643
decode_MPLS_stack_tree(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
4644
1.14k
{
4645
1.14k
    uint32_t    label_entry=0;    /* an MPLS label entry (label + COS field + stack bit)   */
4646
1.14k
    int         indx;          /* index for the label stack */
4647
1.14k
    proto_tree  *labels_tree=NULL;
4648
1.14k
    proto_item  *labels_item=NULL;
4649
1.14k
    proto_item  *label_item=NULL;
4650
1.14k
    indx = offset ;
4651
1.14k
    label_entry = 0x000000 ;
4652
4653
1.14k
    labels_item = proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label, tvb, offset, 3, ENC_NA);
4654
1.14k
    proto_item_append_text(labels_item, ": ");
4655
1.14k
    labels_tree = proto_item_add_subtree(labels_item, ett_bgp_mpls_labels);
4656
2.02k
    while ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4657
4658
1.14k
        label_entry = tvb_get_ntoh24(tvb, indx);
4659
1.14k
        label_item = proto_tree_add_item(labels_tree, hf_bgp_update_mpls_label_value, tvb, indx, 3, ENC_BIG_ENDIAN);
4660
        /* withdrawn routes may contain 0 or 0x800000 in the first label */
4661
1.14k
        if((indx == offset)&&(label_entry==0||label_entry==0x800000)) {
4662
141
            proto_item_append_text(labels_item, " (withdrawn)");
4663
141
            proto_item_append_text(label_item, " (withdrawn)");
4664
141
            return 1;
4665
141
        }
4666
4667
1.00k
        proto_item_append_text(labels_item, "%u%s", label_entry >> 4,
4668
1.00k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4669
1.00k
        proto_item_append_text(label_item, "%u%s", label_entry >> 4,
4670
1.00k
                ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) ? "," : " (bottom)");
4671
1.00k
        indx += 3 ;
4672
4673
1.00k
        if ((label_entry & BGP_MPLS_BOTTOM_L_STACK) == 0) {
4674
            /* real MPLS multi-label stack in BGP? - maybe later; for now, it must be a bogus packet */
4675
123
            proto_item_append_text(labels_item, " (BOGUS: Bottom of Stack NOT set!)");
4676
123
            break;
4677
123
        }
4678
1.00k
    }
4679
1.00k
    proto_item_set_len(labels_item, (indx - offset));
4680
1.00k
    return (indx - offset) / 3;
4681
1.14k
}
4682
4683
/*
4684
 * Decode a multiprotocol next hop address that expected to be IPv4.
4685
 * Returns 0 on failure (invalid length).
4686
 */
4687
static int
4688
decode_mp_next_hop_ipv4(tvbuff_t *tvb, proto_tree *tree, int offset, packet_info *pinfo _U_, wmem_strbuf_t *strbuf, int nhlen)
4689
2.63k
{
4690
2.63k
    switch (nhlen) {
4691
270
        case (FT_IPv4_LEN):
4692
270
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4693
270
            wmem_strbuf_append(strbuf, tvb_ip_to_str(pinfo->pool, tvb, offset));
4694
270
            break;
4695
2.36k
        default:
4696
2.36k
            return 0;
4697
2.63k
    }
4698
270
    return nhlen;
4699
2.63k
}
4700
4701
/*
4702
 * Decode a multiprotocol next hop address expected to be VPN-IPv4.
4703
 * Note that the Route Distinguisher is always 0. Returns 0 on failure
4704
 * (invalid length).
4705
 */
4706
static int
4707
decode_mp_next_hop_vpn_ipv4(tvbuff_t *tvb, proto_tree *tree, int offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4708
1.04k
{
4709
1.04k
    proto_item    *ti;
4710
1.04k
    const char    *rd_string;
4711
4712
1.04k
    switch (nhlen) {
4713
343
        case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv4_LEN):
4714
343
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4715
343
            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);
4716
343
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4717
277
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4718
277
            }
4719
343
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4720
343
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4721
343
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4, tvb, offset, FT_IPv4_LEN, ENC_BIG_ENDIAN);
4722
343
            wmem_strbuf_append_printf(strbuf, " IPv4=%s", tvb_ip_to_str(pinfo->pool, tvb, offset));
4723
343
            break;
4724
697
        default:
4725
697
            return 0;
4726
1.04k
    }
4727
343
    return nhlen;
4728
1.04k
}
4729
4730
/*
4731
 * Decode a multiprotocol next hop address that is expected to be IPv6,
4732
 * optionally including a second, link-local, address, differentiating by
4733
 * length. Returns 0 on failure (invalid length).
4734
 */
4735
static int
4736
decode_mp_next_hop_ipv6(tvbuff_t *tvb, proto_tree *tree, int offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4737
3.64k
{
4738
3.64k
    proto_item    *ti;
4739
3.64k
    ws_in6_addr    ipv6_addr;
4740
3.64k
    char           ipv6_buffer[WS_INET6_ADDRSTRLEN];
4741
4742
3.64k
    switch (nhlen) {
4743
223
        case (FT_IPv6_LEN):
4744
223
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4745
223
            wmem_strbuf_append(strbuf, tvb_ip6_to_str(pinfo->pool, tvb, offset));
4746
223
            break;
4747
472
        case (2*FT_IPv6_LEN):
4748
            /* global address followed by link-local */
4749
472
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4750
472
            wmem_strbuf_append_printf(strbuf, "IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4751
472
            offset += FT_IPv6_LEN;
4752
472
            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);
4753
472
            tvb_get_ipv6(tvb, offset, &ipv6_addr);
4754
472
            if (!in6_addr_is_linklocal(&ipv6_addr)) {
4755
406
                expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4756
406
            }
4757
472
            ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4758
472
            wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4759
472
            break;
4760
2.94k
        default:
4761
2.94k
            return 0;
4762
3.64k
    }
4763
695
    return nhlen;
4764
3.64k
}
4765
4766
/*
4767
 * Decode a multiprotocol next hop address that is expected to be VPN-IPv6,
4768
 * optionally including a second, link-local, address. Note that the Route
4769
 * Distinguisher is always 0. Returns 0 on failure (invalid length).
4770
 */
4771
static int
4772
decode_mp_next_hop_vpn_ipv6(tvbuff_t *tvb, proto_tree *tree, int offset, packet_info *pinfo, wmem_strbuf_t *strbuf, int nhlen)
4773
1.26k
{
4774
1.26k
    proto_item    *ti;
4775
1.26k
    const char    *rd_string;
4776
1.26k
    ws_in6_addr    ipv6_addr;
4777
1.26k
    char           ipv6_buffer[WS_INET6_ADDRSTRLEN];
4778
4779
1.26k
    switch (nhlen) {
4780
266
        case (BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN):
4781
266
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4782
266
            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);
4783
266
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4784
199
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4785
199
            }
4786
266
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4787
266
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4788
266
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4789
266
            wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4790
266
            break;
4791
361
        case (2*(BGP_ROUTE_DISTINGUISHER_SIZE + FT_IPv6_LEN)):
4792
361
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4793
361
            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);
4794
361
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4795
290
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4796
290
            }
4797
361
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4798
361
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4799
361
            proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6, tvb, offset, FT_IPv6_LEN, ENC_NA);
4800
361
            wmem_strbuf_append_printf(strbuf, " IPv6=%s", tvb_ip6_to_str(pinfo->pool, tvb, offset));
4801
361
            offset += FT_IPv6_LEN;
4802
361
            rd_string = decode_bgp_rd(pinfo->pool, tvb, offset);
4803
361
            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);
4804
361
            if (tvb_memeql(tvb, offset, rd_zero, BGP_ROUTE_DISTINGUISHER_SIZE) != 0) {
4805
293
                expert_add_info(pinfo, ti, &ei_bgp_next_hop_rd_nonzero);
4806
293
            }
4807
361
            wmem_strbuf_append_printf(strbuf, " RD=%s", rd_string);
4808
361
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
4809
361
            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);
4810
361
            tvb_get_ipv6(tvb, offset, &ipv6_addr);
4811
361
            if (!in6_addr_is_linklocal(&ipv6_addr)) {
4812
327
                expert_add_info_format(pinfo, ti, &ei_bgp_next_hop_ipv6_scope, "Invalid IPv6 address scope; should be link-local");
4813
327
            }
4814
361
            ip6_to_str_buf(&ipv6_addr, ipv6_buffer, WS_INET6_ADDRSTRLEN);
4815
361
            wmem_strbuf_append_printf(strbuf, " Link-local=%s", ipv6_buffer);
4816
361
            break;
4817
641
        default:
4818
641
            return 0;
4819
1.26k
    }
4820
627
    return nhlen;
4821
1.26k
}
4822
4823
/*
4824
 * Decode a multiprotocol next hop address
4825
 */
4826
static int
4827
decode_mp_next_hop(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint16_t afi, uint8_t safi, int nhlen)
4828
8.73k
{
4829
8.73k
    proto_item    *ti;
4830
8.73k
    proto_tree    *next_hop_t;
4831
8.73k
    int            length, offset = 0;
4832
8.73k
    wmem_strbuf_t *strbuf;
4833
4834
8.73k
    strbuf = wmem_strbuf_create(pinfo->pool);
4835
4836
    /* BGP Multiprotocol Next Hop Principles
4837
     *
4838
     * BGP Multiprotocol support is specified over a large variety of
4839
     * RFCs for different <AFI, SAFI> pairs, which leaves some theoretical
4840
     * pairings undefined (e.g., the Abstract of RFC 4760 contemplates
4841
     * supporting the IPX address family) as well as leading to some
4842
     * omissions, contradictions, and inconsistencies. However, some general
4843
     * principles that apply across (nearly) all extant pairs exist.
4844
     *
4845
     * 1. Global IPv6 addresses can be followed by a link-local IPv6 address
4846
     *
4847
     * RFC 2545 specifies in section 3, "Constructing the Next Hop field,"
4848
     * that when the next hop address type is IPv6, the address given should
4849
     * be in global (or site-local) unicast address scope, and it shall be
4850
     * followed by the link-local address if and only if the BGP speaker shares
4851
     * a common subnet with the address and the peer the route is being
4852
     * advertised to.
4853
     *
4854
     * The wording implies that this holds for any <AFI, SAFI> pair where
4855
     * a IPv6 address is used, and RFCs 5549, 7752, and 8950 demonstrate that
4856
     * this explicitly holds for the most common ones, including for VPN-IPv6
4857
     * addresses (where the route distinguisher field also appears, see
4858
     * RFC 4659). Sometimes the possibility is elided where it is known to
4859
     * exist e.g. RFC 7606 7.11 MP_REACH_NLRI "For example, if RFC5549 is in
4860
     * use, then the next hop would have to have a length of 4 or 16." Thus
4861
     * it is possible that its omission in other RFCs covering new <AFI, SAFI>
4862
     * pairs is an oversight.
4863
     *
4864
     * 2. [VPN-]IPv4 NLRI can have [VPN-]IPv6 Next Hop addresses
4865
     *
4866
     * RFCs 5549 and 8950 declare that the next hop address may not necessarily
4867
     * belong to the address family specified by the AFI, updating RFC 2858,
4868
     * specifically addressing the case of IPv6 islands across a IPv4 core
4869
     * and vice versa.
4870
     *
4871
     * IPv4 addresses can easily be mapped into IPv6 addresses, and that
4872
     * is the solution for one case, but in the other the Next Hop must be an
4873
     * IPv6 (or VPN-IPv6) address even though the NLRI is IPv4.
4874
     *
4875
     * The wording of RFC 8950 strongly implies that the intent is to allow
4876
     * IPv6 Net Hop addresses for any case of IPv4 or VPN-IPv4 NLRI, providing
4877
     * a BGP Capability to declare that the BGP speakers supports a different
4878
     * Next Hop AFI for <AFI, SAFI> pairs defined without this capability,
4879
     * and noting those (like <1, 132>, SAFNUM_ROUTE_TARGET, RFC 4684) that
4880
     * consider the possibility from the start.
4881
     *
4882
     * 3. Next Hop Route Distinguisher (RD) is 0 or omitted
4883
     *
4884
     * RDs do not have a meaning in the Next Hop network address. However, when
4885
     * RFC 2547 introduced the VPN-IPv4 address family, at that point the Next
4886
     * Hop address family had to be the same as the NLRI address family, so the
4887
     * RD was set to all 0. Later defined <AFI, SAFI> pairs with RDs in their
4888
     * NLRI have either used this custom of a 0 RD, or else omitted it and
4889
     * only had the IP address in the Next Hop.
4890
     */
4891
4892
8.73k
    ti = proto_tree_add_item(tree, hf_bgp_update_path_attribute_mp_reach_nlri_next_hop, tvb, offset, nhlen + 1, ENC_NA);
4893
8.73k
    next_hop_t = proto_item_add_subtree(ti, ett_bgp_mp_nhna);
4894
8.73k
    offset += 1;
4895
4896
8.73k
    switch (afi) {
4897
3.65k
        case AFNUM_INET:
4898
3.65k
            switch (safi) {
4899
102
                case SAFNUM_UNICAST:       /* RFC 8950 */
4900
469
                case SAFNUM_MULCAST:       /* RFC 8950 */
4901
541
                case SAFNUM_UNIMULC:       /* Deprecated, but as above */
4902
772
                case SAFNUM_MPLS_LABEL:    /* RFC 8277 */
4903
875
                case SAFNUM_MCAST_VPN:     /* RFC 6514 */
4904
972
                case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used"
4905
                                            * according to
4906
                                            * draft-ietf-idr-tunnel-encaps-22
4907
                                            */
4908
1.07k
                case SAFNUM_ROUTE_TARGET:  /* RFC 4684 */
4909
1.30k
                case SAFNUM_BGP_MUP:       /* draft-mpmz-bess-mup-safi-00 */
4910
                    /* IPv4 or IPv6, differentiated by field length, according
4911
                     * to the RFCs cited above. RFC 8950 explicitly addresses
4912
                     * the possible link-local IPv6 address. RFC 6514 depending
4913
                     * on the situation either the Next Hop MUST be the same
4914
                     * as in the IP Address field lower in the network stack,
4915
                     * or simply SHOULD be "a routeable address" of the ASBR/
4916
                     * local PE. */
4917
1.30k
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4918
1.23k
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4919
1.23k
                    }
4920
1.30k
                    break;
4921
380
                case SAFNUM_TUNNEL:
4922
                    /* Internet Draft draft-nalawade-kapoor-tunnel-safi-05
4923
                     * long expired, but "[NLRI] network address... SHOULD be
4924
                     * the same as the [Next Hop] network address."
4925
                     */
4926
380
                    length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4927
380
                    break;
4928
428
                case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
4929
632
                case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
4930
897
                case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
4931
                    /* RFC 8950 indicates that the next hop can be VPN-IPv4 or
4932
                     * VPN-IPv6 (with RD all 0), and in the latter case the
4933
                     * link-local IPv6 address can be included. Note that RFC
4934
                     * 5549 incorrectly did not include the RD in the Next Hop
4935
                     * for VPN-IPv6 (see Erratum ID 5253), but according to
4936
                     * RFC 8950 2. "Changes Compared to RFC 5549":
4937
                     * "As all known and deployed implementations are
4938
                     * interoperable today and use the new proposed encoding,
4939
                     * the change does not break existing interoperability,"
4940
                     * and thus we need not test for a missing RD.
4941
                     */
4942
897
                    if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
4943
623
                        length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4944
623
                    }
4945
897
                    break;
4946
220
                case SAFNUM_FSPEC_RULE:
4947
343
                case SAFNUM_FSPEC_VPN_RULE:
4948
343
                    length = 0;
4949
                    /* When advertising Flow Specifications, the Length of the
4950
                     * Next-Hop Address MUST be set 0. The Network Address of
4951
                     * the Next-Hop field MUST be ignored.
4952
                     */
4953
343
                    if (nhlen != 0) {
4954
255
                        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid,
4955
255
                                               "The length (%d) of Next Hop (FlowSpec) is not zero", nhlen);
4956
255
                        break;
4957
255
                    }
4958
88
                    length++;
4959
88
                    break;
4960
735
                default:
4961
735
                    length = 0;
4962
735
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
4963
735
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
4964
735
                    break;
4965
3.65k
            } /* switch (safi) */
4966
3.65k
            break;
4967
3.65k
        case AFNUM_INET6:
4968
2.71k
            switch (safi) {
4969
92
                case SAFNUM_UNICAST:       /* RFC 8950 */
4970
162
                case SAFNUM_MULCAST:       /* RFC 8950 */
4971
237
                case SAFNUM_UNIMULC:       /* Deprecated, but as above */
4972
854
                case SAFNUM_MPLS_LABEL:    /* RFC 8277 */
4973
1.12k
                case SAFNUM_MCAST_VPN:     /* RFC 6514 */
4974
1.19k
                case SAFNUM_ENCAPSULATION: /* RFC 5512, but "never been used" */
4975
1.38k
                case SAFNUM_TUNNEL:        /* Expired Internet Draft */
4976
1.59k
                case SAFNUM_BGP_MUP:       /* draft-mpmz-bess-mup-safi-00 */
4977
                    /* IPv6 address, possibly followed by link-local address */
4978
1.59k
                    length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4979
1.59k
                    break;
4980
156
                case SAFNUM_LAB_VPNUNICAST: /* RFC 8950 */
4981
482
                case SAFNUM_LAB_VPNMULCAST: /* RFC 8950 */
4982
571
                case SAFNUM_LAB_VPNUNIMULC: /* Deprecated, but as above */
4983
                    /* VPN-IPv6 address, possibly followed by link-local addr */
4984
571
                    length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
4985
571
                    break;
4986
85
                case SAFNUM_FSPEC_RULE:
4987
201
                case SAFNUM_FSPEC_VPN_RULE:
4988
201
                    length = 0;
4989
                    /* When advertising Flow Specifications, the Length of the
4990
                     * Next-Hop Address MUST be set 0. The Network Address of
4991
                     * the Next-Hop field MUST be ignored.
4992
                     */
4993
201
                    if (nhlen != 0) {
4994
110
                        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid,
4995
110
                                               "The length (%d) of Next Hop (FlowSpec) is not zero", nhlen);
4996
110
                        break;
4997
110
                    }
4998
91
                    length++;
4999
91
                    break;
5000
356
                default:
5001
356
                    length = 0;
5002
356
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5003
356
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5004
356
                    break;
5005
2.71k
            } /* switch (safi) */
5006
2.71k
            break;
5007
2.71k
        case AFNUM_L2VPN:
5008
994
        case AFNUM_L2VPN_OLD:
5009
994
            switch (safi) {
5010
                /* XXX: Do these first three really appear with L2VPN AFI? */
5011
107
                case SAFNUM_LAB_VPNUNICAST:
5012
378
                case SAFNUM_LAB_VPNMULCAST:
5013
467
                case SAFNUM_LAB_VPNUNIMULC:
5014
607
                case SAFNUM_VPLS: /* RFC 4761 (VPLS) and RFC 6074 (BGP-AD) */
5015
740
                case SAFNUM_EVPN: /* RFC 7432 */
5016
                    /* The RFCs above specify that the next-hop is simply the
5017
                     * address of the PE (loopback address in some cases for
5018
                     * BGP-AD), either IPv4 or IPv6, differentiated by length.
5019
                     * A RD is included in the NLRI in these cases, but not in
5020
                     * the Next Hop address unlike in AFI 1 or 2.
5021
                     */
5022
740
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5023
672
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5024
672
                    }
5025
740
                    break;
5026
254
                default:
5027
254
                    length = 0;
5028
254
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5029
254
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5030
254
                    break;
5031
994
            } /* switch (safi) */
5032
994
            break;
5033
994
        case AFNUM_BGP_LS:
5034
            /* RFC 7752 section 3.4 "BGP Next-Hop Information" explains that
5035
             * the next-hop address length field specifes the next-hop address
5036
             * family. "If the next-hop length is 4, then the next hop is an
5037
             * IPv4 address; if the next-hop length is 16, then it is a global
5038
             * IPv6 address; and if the next-hop length is 32, then there is
5039
             * one global IPv6 address followed by a link-local IPv6 address"
5040
             */
5041
562
            switch (safi) {
5042
213
                case SAFNUM_BGP_LS:
5043
213
                    if ((length = decode_mp_next_hop_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5044
147
                        length = decode_mp_next_hop_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5045
147
                    }
5046
213
                    break;
5047
143
                case SAFNUM_BGP_LS_VPN:
5048
                    /* RFC 7752 3.4: "For VPN SAFI, as per custom, an 8-byte
5049
                     * Route Distinguisher set to all zero is prepended to the
5050
                     * next hop."
5051
                     */
5052
143
                    if ((length = decode_mp_next_hop_vpn_ipv4(tvb, next_hop_t, offset, pinfo, strbuf, nhlen)) == 0) {
5053
74
                        length = decode_mp_next_hop_vpn_ipv6(tvb, next_hop_t, offset, pinfo, strbuf, nhlen);
5054
74
                    }
5055
143
                    break;
5056
206
                default:
5057
206
                    length = 0;
5058
206
                    expert_add_info_format(pinfo, ti, &ei_bgp_unknown_safi,
5059
206
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
5060
206
                    break;
5061
562
            } /* switch (safi) */
5062
562
            break;
5063
684
        default:
5064
684
            length = 0;
5065
684
            expert_add_info(pinfo, ti, &ei_bgp_unknown_afi);
5066
684
            break;
5067
8.73k
    } /* switch (af) */
5068
5069
8.61k
    if (length) {
5070
2.11k
        proto_item_append_text(ti, ": %s", wmem_strbuf_get_str(strbuf));
5071
6.50k
    } else {
5072
6.50k
        expert_add_info_format(pinfo, ti, &ei_bgp_length_invalid, "Unknown Next Hop length (%u byte%s)", nhlen, plurality(nhlen, "", "s"));
5073
6.50k
        if (nhlen > 0) {
5074
3.98k
            proto_item_append_text(ti, ": %s", tvb_bytes_to_str(pinfo->pool, tvb, offset, nhlen));
5075
3.98k
        }
5076
6.50k
    }
5077
5078
8.61k
    return length;
5079
8.73k
}
5080
5081
static int decode_bgp_link_node_descriptor(tvbuff_t *tvb, proto_tree *tree, int offset, packet_info *pinfo, int length)
5082
781
{
5083
781
    uint16_t sub_length;
5084
781
    uint16_t type;
5085
781
    uint16_t diss_length;
5086
5087
781
    proto_item* tlv_item;
5088
781
    proto_tree* tlv_tree;
5089
5090
781
    diss_length = 0;
5091
5092
2.89k
    while (length > 0 ) {
5093
2.28k
    if (length < 4) {
5094
114
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5095
114
            "Unknown data in Link-State Link NLRI!");
5096
114
        diss_length += length;
5097
114
        break;
5098
114
    }
5099
2.16k
    type = tvb_get_ntohs(tvb, offset);
5100
2.16k
    sub_length = tvb_get_ntohs(tvb, offset + 2);
5101
5102
2.16k
    switch (type) {
5103
432
        case BGP_NLRI_TLV_AUTONOMOUS_SYSTEM:
5104
432
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_autonomous_system, tvb, offset, sub_length+4, ENC_NA);
5105
432
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5106
432
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5107
432
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5108
432
              if (sub_length != BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM) {
5109
213
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5110
213
                                         "Autonomous system TLV length should be %u bytes! (%u)",
5111
213
                                         BGP_NLRI_TLV_LEN_AUTONOMOUS_SYSTEM, sub_length);
5112
213
                  break;
5113
213
              }
5114
219
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_autonomous_system_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5115
219
          break;
5116
435
          case BGP_NLRI_TLV_BGP_LS_IDENTIFIER:
5117
435
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_ls_identifier, tvb, offset, sub_length+4, ENC_NA);
5118
435
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5119
435
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5120
435
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5121
435
              if (sub_length != BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER) {
5122
369
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5123
369
                                         "BGP-LS TLV length should be %u bytes! (%u)",
5124
369
                                         BGP_NLRI_TLV_LEN_BGP_LS_IDENTIFIER, sub_length);
5125
369
                  break;
5126
369
              }
5127
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_ls_identifier_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5128
66
          break;
5129
132
          case BGP_NLRI_TLV_AREA_ID:
5130
132
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_area_id, tvb, offset, sub_length+4, ENC_NA);
5131
132
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5132
132
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5133
132
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5134
132
              if (sub_length != BGP_NLRI_TLV_LEN_AREA_ID) {
5135
66
                  expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5136
66
                                         "Area ID TLV length should be %u bytes! (%u)",
5137
66
                                         BGP_NLRI_TLV_LEN_AREA_ID, sub_length);
5138
66
                  break;
5139
66
              }
5140
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_area_id_id, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5141
66
          break;
5142
202
          case BGP_NLRI_TLV_IGP_ROUTER_ID:
5143
202
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_router, tvb, offset, sub_length+4, ENC_NA);
5144
202
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5145
202
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5146
202
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5147
202
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_router_id, tvb, offset + 4, sub_length, ENC_NA);
5148
202
          break;
5149
70
          case BGP_NLRI_TLV_BGP_ROUTER_ID:
5150
70
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_router_id, tvb, offset, sub_length+4, ENC_NA);
5151
70
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5152
70
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5153
70
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5154
70
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_router_id_id, tvb, offset + 4, sub_length, ENC_BIG_ENDIAN);
5155
70
          break;
5156
66
          case BGP_NLRI_TLV_BGP_CONFEDERATION_MEMBER:
5157
66
              tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_bgp_confederation_member, tvb, offset, sub_length+4, ENC_NA);
5158
66
              tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5159
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5160
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5161
66
              proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_bgp_confederation_member_as, tvb, offset + 4, sub_length, ENC_BIG_ENDIAN);
5162
66
          break;
5163
799
          default:
5164
799
              expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn, "Undefined node Descriptor Sub-TLV type (%u)!", type);
5165
2.16k
    }
5166
5167
2.11k
    length -= 4 + sub_length;
5168
2.11k
    offset += 4 + sub_length;
5169
2.11k
    diss_length += 4 + sub_length;
5170
2.11k
    }
5171
726
    return diss_length;
5172
781
}
5173
5174
5175
/*
5176
 * Decode BGP Link State Local and Remote NODE Descriptors
5177
 */
5178
static int decode_bgp_link_node_nlri_tlvs(tvbuff_t *tvb, proto_tree *tree, int offset, packet_info *pinfo, uint16_t expected_sub_tlv)
5179
4.31k
{
5180
4.31k
    uint16_t length;
5181
4.31k
    uint16_t type;
5182
4.31k
    proto_tree* tlv_tree;
5183
4.31k
    proto_item* tlv_item;
5184
5185
4.31k
    type = tvb_get_ntohs(tvb, offset);
5186
4.31k
    length = tvb_get_ntohs(tvb, offset + 2);
5187
5188
4.31k
    if (expected_sub_tlv != type) {
5189
3.76k
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error, "Expected/actual tlv mismatch, expected: %u, actual: %u", expected_sub_tlv, type);
5190
3.76k
    }
5191
5192
4.31k
    switch(type){
5193
5194
        /*local and remote node descriptors */
5195
524
        case BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS:
5196
524
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_local_node_descriptors, tvb, offset, length+4, ENC_NA);
5197
524
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5198
524
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5199
524
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5200
524
            decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
5201
524
        break;
5202
5203
257
        case BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS:
5204
257
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_remote_node_descriptors, tvb, offset, length+4, ENC_NA);
5205
257
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5206
257
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5207
257
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5208
257
            decode_bgp_link_node_descriptor(tvb, tlv_tree, offset + 4, pinfo, length);
5209
257
        break;
5210
4.31k
        }
5211
5212
4.20k
    return length +4 ;
5213
4.31k
}
5214
5215
/*
5216
 * Dissect Link and Node NLRI common fields (Protocol-ID, Identifier, Local Node Desc.)
5217
 */
5218
static int decode_bgp_link_node_nlri_common_fields(tvbuff_t *tvb,
5219
3.98k
        proto_tree *tree, int offset, packet_info *pinfo, int length) {
5220
3.98k
    int dissected_length;
5221
3.98k
    int tmp_length;
5222
5223
    /* dissect Link NLRI header */
5224
3.98k
    if (length < 12) {
5225
615
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5226
615
                "Link State NLRI length is lower than 12 bytes! (%d)", length);
5227
615
        return length;
5228
615
    }
5229
5230
3.37k
    proto_tree_add_item(tree, hf_bgp_ls_nlri_node_protocol_id, tvb, offset, 1, ENC_BIG_ENDIAN);
5231
3.37k
    save_link_state_protocol_id(pinfo, tvb_get_uint8(tvb, offset));
5232
3.37k
    proto_tree_add_item(tree, hf_bgp_ls_nlri_node_identifier, tvb, offset + 1, 8, ENC_BIG_ENDIAN);
5233
5234
3.37k
    dissected_length = 9;
5235
3.37k
    offset += dissected_length;
5236
3.37k
    length -= dissected_length;
5237
5238
    /* dissect Local Node Descriptors TLV */
5239
3.37k
    if (length < 4) {
5240
266
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5241
266
                "Unknown data in Link-State Link NLRI! length = %d bytes", length);
5242
266
        return dissected_length;
5243
266
    }
5244
5245
3.10k
    tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, tree, offset, pinfo,
5246
3.10k
                                                BGP_NLRI_TLV_LOCAL_NODE_DESCRIPTORS);
5247
3.10k
    if (tmp_length < 0) {
5248
0
       return -1;
5249
0
    }
5250
3.10k
    dissected_length += tmp_length;
5251
5252
3.10k
    return dissected_length;
5253
3.10k
}
5254
5255
5256
/*
5257
 * Decode Link Descriptors
5258
 */
5259
static int decode_bgp_link_nlri_link_descriptors(tvbuff_t *tvb,
5260
929
        proto_tree *tree, int offset, packet_info *pinfo, int length) {
5261
5262
929
    uint16_t sub_length;
5263
929
    uint16_t type;
5264
929
    uint16_t diss_length;
5265
929
    uint16_t tmp16;
5266
5267
929
    proto_item* tlv_item;
5268
929
    proto_tree* tlv_tree;
5269
929
    proto_item* tlv_sub_item;
5270
929
    proto_tree* tlv_sub_tree;
5271
5272
929
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_link_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5273
929
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5274
5275
929
    diss_length = 0;
5276
1.63k
    while (length > 0) {
5277
1.55k
        if (length < 4) {
5278
74
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5279
74
                    "Unknown data in Link-State Link NLRI!");
5280
74
            diss_length += length;
5281
74
            break;
5282
74
        }
5283
5284
1.47k
        type = tvb_get_ntohs(tvb, offset);
5285
1.47k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5286
1.47k
        switch (type) {
5287
136
            case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5288
136
                if(sub_length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS){
5289
70
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5290
70
                                           "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
5291
70
                                           sub_length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
5292
70
                    return -1;
5293
70
                }
5294
66
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5295
66
                                                   hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
5296
66
                                                   sub_length + 4, ENC_NA);
5297
66
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5298
66
            break;
5299
5300
132
            case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
5301
132
                if(sub_length != BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS){
5302
66
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5303
66
                                           "Unexpected IPv4 Interface Address TLV's length (%u), it must be %u bytes!",
5304
66
                                           sub_length, BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS);
5305
66
                    return -1;
5306
66
                }
5307
66
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5308
66
                                                   hf_bgp_ls_tlv_ipv4_interface_address, tvb, offset,
5309
66
                                                   sub_length + 4, ENC_NA);
5310
66
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5311
66
            break;
5312
5313
147
            case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
5314
147
                if(sub_length != BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS){
5315
81
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5316
81
                                           "Unexpected IPv4 Neighbor Address TLV's length (%u), it must be %u bytes!",
5317
81
                                           sub_length, BGP_NLRI_TLV_LEN_IPV4_NEIGHBOR_ADDRESS);
5318
81
                    return -1;
5319
81
                }
5320
66
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5321
66
                                                   hf_bgp_ls_tlv_ipv4_neighbor_address, tvb, offset,
5322
66
                                                   sub_length + 4, ENC_NA);
5323
66
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5324
66
            break;
5325
5326
139
            case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
5327
139
                if(sub_length != BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS){
5328
73
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5329
73
                                           "Unexpected IPv6 Interface Address TLV's length (%u), it must be %u bytes!",
5330
73
                                           sub_length, BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS);
5331
73
                    return -1;
5332
73
                }
5333
66
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5334
66
                                                   hf_bgp_ls_tlv_ipv6_interface_address, tvb, offset,
5335
66
                                                   sub_length + 4, ENC_NA);
5336
66
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5337
66
            break;
5338
5339
100
            case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
5340
100
                if(sub_length != BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS){
5341
34
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5342
34
                                           "Unexpected IPv6 Neighbor Address TLV's length (%u), it must be %u bytes!",
5343
34
                                           sub_length, BGP_NLRI_TLV_LEN_IPV6_NEIGHBOR_ADDRESS);
5344
34
                    return -1;
5345
34
                }
5346
66
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5347
66
                                                   hf_bgp_ls_tlv_ipv6_neighbor_address, tvb, offset,
5348
66
                                                   sub_length + 4, ENC_NA);
5349
66
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5350
66
            break;
5351
5352
476
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5353
476
                if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5354
83
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5355
83
                                           "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5356
83
                                           sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5357
83
                    return -1;
5358
83
                }
5359
393
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5360
393
                        hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5361
393
                        ENC_NA);
5362
393
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5363
393
            break;
5364
5365
313
            default:
5366
313
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5367
313
                        "Unknown Link Descriptor TLV Code (%u)!", type);
5368
313
                return -1;
5369
1.47k
        }
5370
5371
723
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5372
723
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5373
5374
723
        switch (type) {
5375
66
            case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5376
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5377
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
5378
66
            break;
5379
5380
66
            case BGP_NLRI_TLV_IPV4_INTERFACE_ADDRESS:
5381
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_interface_address, tvb, offset + 4,
5382
66
                                    BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
5383
66
            break;
5384
5385
66
            case BGP_NLRI_TLV_IPV4_NEIGHBOR_ADDRESS:
5386
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv4_neighbor_address, tvb, offset + 4,
5387
66
                                    BGP_NLRI_TLV_LEN_IPV4_INTERFACE_ADDRESS, ENC_BIG_ENDIAN);
5388
66
            break;
5389
5390
66
            case BGP_NLRI_TLV_IPV6_INTERFACE_ADDRESS:
5391
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_interface_address, tvb, offset + 4,
5392
66
                                    BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
5393
66
            break;
5394
5395
66
            case BGP_NLRI_TLV_IPV6_NEIGHBOR_ADDRESS:
5396
66
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ipv6_neighbor_address, tvb, offset + 4,
5397
66
                                    BGP_NLRI_TLV_LEN_IPV6_INTERFACE_ADDRESS, ENC_NA);
5398
66
            break;
5399
5400
393
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5401
393
                tmp16 = tvb_get_ntohs(tvb, offset + 4);
5402
393
                tmp16 >>= 12;
5403
393
                if(tmp16){
5404
280
                    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);
5405
280
                }
5406
393
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
5407
393
                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5408
393
            break;
5409
723
        }
5410
5411
707
        length -= 4 + sub_length;
5412
707
        offset += 4 + sub_length;
5413
707
        diss_length += 4 + sub_length;
5414
707
    }
5415
158
    return diss_length;
5416
929
}
5417
5418
/*
5419
 * Decode Prefix Descriptors
5420
 */
5421
static int decode_bgp_link_nlri_prefix_descriptors(tvbuff_t *tvb,
5422
680
        proto_tree *tree, int offset, packet_info *pinfo, int length, int proto) {
5423
5424
680
    uint16_t sub_length;
5425
680
    uint16_t type;
5426
680
    uint16_t diss_length;
5427
680
    uint16_t tmp16;
5428
5429
680
    proto_item* tlv_item;
5430
680
    proto_tree* tlv_tree;
5431
680
    proto_item* tlv_sub_item;
5432
680
    proto_tree* tlv_sub_tree;
5433
5434
680
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_prefix_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5435
680
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5436
5437
680
    diss_length = 0;
5438
2.25k
    while (length > 0) {
5439
2.10k
        if (length < 4) {
5440
68
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5441
68
                    "Unknown data in Link-State Link NLRI!");
5442
68
            diss_length += length;
5443
68
            break;
5444
68
        }
5445
5446
2.03k
        type = tvb_get_ntohs(tvb, offset);
5447
2.03k
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5448
2.03k
        switch (type) {
5449
468
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5450
468
                if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5451
71
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5452
71
                                           "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5453
71
                                           sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5454
71
                    return -1;
5455
71
                }
5456
397
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5457
397
                        hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5458
397
                        ENC_NA);
5459
397
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5460
397
            break;
5461
5462
621
            case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
5463
621
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5464
621
                        hf_bgp_ls_tlv_ospf_route_type, tvb, offset, sub_length + 4,
5465
621
                        ENC_NA);
5466
621
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5467
621
            break;
5468
695
            case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
5469
695
                tlv_sub_item = proto_tree_add_item(tlv_tree,
5470
695
                        hf_bgp_ls_tlv_ip_reachability_information, tvb, offset, sub_length + 4,
5471
695
                        ENC_NA);
5472
695
                tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5473
695
            break;
5474
5475
219
            default:
5476
219
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5477
219
                        "Unknown Prefix Descriptor TLV Code (%u)!", type);
5478
219
                return -1;
5479
2.03k
        }
5480
5481
1.71k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5482
1.71k
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5483
5484
1.71k
        switch (type) {
5485
397
            case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5486
397
                tmp16 = tvb_get_ntohs(tvb, offset + 4);
5487
397
                tmp16 >>= 12;
5488
397
                if(tmp16){
5489
196
                    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);
5490
196
                }
5491
397
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4,
5492
397
                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5493
397
            break;
5494
5495
621
            case BGP_NLRI_TLV_OSPF_ROUTE_TYPE:
5496
5497
621
                if (sub_length != 1) {
5498
331
                    expert_add_info_format(pinfo, tlv_sub_tree, &ei_bgp_ls_error, "OSPF Route Type length must be \"1\"");
5499
331
                    break;
5500
331
                }
5501
290
                proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_ospf_route_type, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5502
290
            break;
5503
5504
695
            case BGP_NLRI_TLV_IP_REACHABILITY_INFORMATION:
5505
695
                if (( proto == IP_PROTO_IPV4 ) && (decode_prefix4(tlv_sub_tree, pinfo, tlv_sub_item, hf_bgp_ls_nlri_ip_reachability_prefix_ip,
5506
347
                               tvb, offset + 4, "Reachability") == -1))
5507
68
                    return diss_length;
5508
627
                if (( proto == IP_PROTO_IPV6 ) && (decode_prefix6(tlv_sub_tree, pinfo, hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
5509
348
                               tvb, offset + 4, 0, "Reachability") == -1))
5510
66
                    return diss_length;
5511
561
            break;
5512
1.71k
        }
5513
5514
1.57k
        length -= 4 + sub_length;
5515
1.57k
        offset += 4 + sub_length;
5516
1.57k
        diss_length += 4 + sub_length;
5517
1.57k
    }
5518
218
    return diss_length;
5519
680
}
5520
5521
/*
5522
 * Decode SRv6 SID Descriptors
5523
 */
5524
static int decode_bgp_link_nlri_srv6_sid_descriptors(tvbuff_t *tvb,
5525
323
        proto_tree *tree, int offset, packet_info *pinfo, int length) {
5526
5527
323
    uint16_t sub_length;
5528
323
    uint16_t type;
5529
323
    uint16_t diss_length;
5530
323
    uint16_t tmp16;
5531
5532
323
    proto_item* tlv_item;
5533
323
    proto_tree* tlv_tree;
5534
323
    proto_item* tlv_sub_item;
5535
323
    proto_tree* tlv_sub_tree;
5536
5537
323
    tlv_item = proto_tree_add_item(tree, hf_bgp_ls_nlri_srv6_sid_descriptors_tlv, tvb, offset, length + 4, ENC_NA);
5538
323
    tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5539
5540
323
    diss_length = 0;
5541
551
    while (length > 0) {
5542
504
        if (length < 4) {
5543
20
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5544
20
                    "Unknown data in Link-State SRv6 SID NLRI!");
5545
20
            diss_length += length;
5546
20
            break;
5547
20
        }
5548
5549
484
        type = tvb_get_ntohs(tvb, offset);
5550
484
        sub_length = tvb_get_ntohs(tvb, offset + 2);
5551
484
        switch (type) {
5552
272
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5553
272
            if(sub_length != BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID){
5554
72
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5555
72
                                       "Unexpected Multi Topology ID TLV's length (%u), it must be %u bytes!",
5556
72
                                       sub_length, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID);
5557
72
                return -1;
5558
72
            }
5559
200
            tlv_sub_item = proto_tree_add_item(tlv_tree,
5560
200
                                               hf_bgp_ls_tlv_multi_topology_id, tvb, offset, sub_length + 4,
5561
200
                                               ENC_NA);
5562
200
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5563
200
            break;
5564
5565
69
        case BGP_NLRI_TLV_SRV6_SID_INFO:
5566
69
            if (sub_length != 16) {
5567
35
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5568
35
                                       "Unexpected SRv6 SID Information TLV's length (%u), it must be 16 bytes!",
5569
35
                                       sub_length);
5570
35
                return -1;
5571
35
            }
5572
34
            tlv_sub_item = proto_tree_add_item(tlv_tree,
5573
34
                                               hf_bgp_ls_tlv_srv6_sid_info, tvb, offset, sub_length + 4,
5574
34
                                               ENC_NA);
5575
34
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_mp_reach_nlri);
5576
34
            break;
5577
5578
116
        default:
5579
116
            expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
5580
116
                                   "Unknown SRv6 SID Descriptor TLV Code (%u)!", type);
5581
116
            return -1;
5582
484
        }
5583
5584
234
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5585
234
        proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5586
5587
234
        switch (type) {
5588
200
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5589
200
            tmp16 = tvb_get_ntohs(tvb, offset + 4);
5590
200
            tmp16 >>= 12;
5591
200
            if (tmp16) {
5592
111
                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);
5593
111
            }
5594
200
            proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_nlri_multi_topology_id,
5595
200
                                tvb, offset + 4, BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5596
200
            break;
5597
5598
34
        case BGP_NLRI_TLV_SRV6_SID_INFO:
5599
34
            proto_tree_add_item(tlv_sub_tree, hf_bgp_ls_tlv_srv6_sid_info_sid,
5600
34
                                tvb, offset + 4, 16, ENC_NA);
5601
34
            break;
5602
234
        }
5603
5604
228
        length -= 4 + sub_length;
5605
228
        offset += 4 + sub_length;
5606
228
        diss_length += 4 + sub_length;
5607
228
    }
5608
67
    return diss_length;
5609
323
}
5610
5611
/*
5612
 * Decode Flex Algo sub-TLVs in BGP-LS attributes
5613
 */
5614
static int
5615
decode_link_state_attribute_flex_algo_subtlv(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, uint8_t _U_ protocol_id)
5616
2.85k
{
5617
2.85k
    uint16_t type;
5618
2.85k
    uint16_t length;
5619
2.85k
    uint16_t tmp16;
5620
2.85k
    int i;
5621
2.85k
    proto_item* tlv_item;
5622
2.85k
    proto_tree* tlv_tree;
5623
2.85k
    proto_item* ti;
5624
5625
2.85k
    type = tvb_get_ntohs(tvb, offset);
5626
2.85k
    length = tvb_get_ntohs(tvb, offset + 2);
5627
5628
2.85k
    switch (type) {
5629
291
    case BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY:
5630
557
    case BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY:
5631
923
    case BGP_LS_SR_TLV_FLEX_ALGO_INC_ALL_AFFINITY:
5632
923
        tlv_item = proto_tree_add_item(tree,
5633
923
                                       (type == BGP_LS_SR_TLV_FLEX_ALGO_EXC_ANY_AFFINITY) ?
5634
291
                                       hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity :
5635
923
                                       ((type == BGP_LS_SR_TLV_FLEX_ALGO_INC_ANY_AFFINITY) ?
5636
266
                                        hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity :
5637
632
                                        hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity),
5638
923
                                       tvb, offset, length + 4, ENC_NA);
5639
923
        tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5640
923
        proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5641
923
        ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5642
923
        if (length % 4 != 0) {
5643
361
            expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u mod 4 != 0)",
5644
361
                                   "Extended Administrative Group", length);
5645
361
            break;
5646
361
        }
5647
562
        tmp16 = length;
5648
1.03k
        while (tmp16) {
5649
476
            proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
5650
476
            tmp16 -= 4;
5651
476
        }
5652
562
        break;
5653
5654
402
    case BGP_LS_SR_TLV_FLEX_ALGO_DEF_FLAGS:
5655
402
        {
5656
402
            static int * const flex_algo_def_flags[] = {
5657
402
                &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m,
5658
402
                NULL
5659
402
            };
5660
402
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def_flags, tvb, offset, length + 4, ENC_NA);
5661
402
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5662
402
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5663
402
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5664
402
            if (length != 4) {
5665
208
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u != 4)",
5666
208
                                       "Flexible Algorithm Definition Flags", length);
5667
208
                break;
5668
208
            }
5669
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);
5670
194
        }
5671
0
        break;
5672
5673
666
    case BGP_LS_SR_TLV_FLEX_ALGO_EXC_SRLG:
5674
666
        tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_exc_srlg, tvb, offset, length + 4, ENC_NA);
5675
666
        tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5676
666
        proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5677
666
        ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5678
666
        if (length % 4 != 0) {
5679
196
            expert_add_info_format(pinfo, ti, &ei_bgp_ls_error, "Unexpected %s TLV's length (%u mod 4 != 0)",
5680
196
                                   "Flexible Algorithm Exclude SRLG", length);
5681
196
            break;
5682
196
        }
5683
1.00k
        for (i = 0; i < length; i += 4) {
5684
534
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + i, 4, ENC_BIG_ENDIAN);
5685
534
        }
5686
470
        break;
5687
5688
813
    default:
5689
813
        expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
5690
813
                               "Unknown BGP-LS Flex-Algo sub-TLV Code (%u)!", type);
5691
813
        break;
5692
2.85k
    }
5693
5694
2.77k
    return length + 4;
5695
2.85k
}
5696
5697
/*
5698
 * Decode a multiprotocol prefix
5699
 */
5700
static int
5701
// NOLINTNEXTLINE(misc-no-recursion)
5702
decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, uint8_t protocol_id)
5703
2.93M
{
5704
2.93M
    uint16_t type;
5705
2.93M
    uint16_t length;
5706
2.93M
    uint8_t tmp8;
5707
2.93M
    uint16_t tmp16;
5708
2.93M
    uint32_t tmp32;
5709
2.93M
    float   tmp_float;
5710
2.93M
    uint32_t mask;
5711
2.93M
    int local_offset, local_length;
5712
2.93M
    int n;
5713
2.93M
    uint8_t sabm_len, udabm_len;
5714
2.93M
    int     advance;
5715
5716
2.93M
    proto_item* tlv_item;
5717
2.93M
    proto_tree* tlv_tree;
5718
2.93M
    proto_item* tlv_sub_item;
5719
2.93M
    proto_tree* tlv_sub_tree;
5720
2.93M
    proto_item* ti;
5721
5722
2.93M
    type = tvb_get_ntohs(tvb, offset);
5723
2.93M
    length = tvb_get_ntohs(tvb, offset + 2);
5724
5725
2.93M
    increment_dissection_depth(pinfo);
5726
2.93M
    switch (type) {
5727
5728
        /* NODE ATTRIBUTE TLVs */
5729
495
        case BGP_NLRI_TLV_MULTI_TOPOLOGY_ID:
5730
495
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_multi_topology_id, tvb, offset, length + 4, ENC_NA);
5731
495
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5732
5733
1.58k
            for (n = 0; n < (length / BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID); n++) {
5734
1.08k
                tmp16 = tvb_get_ntohs(tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID));
5735
1.08k
                tmp16 >>= 12;
5736
1.08k
                if(tmp16){
5737
568
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved bits of Multi Topology ID must be set to zero! (%u)", tmp16);
5738
568
                }
5739
1.08k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_multi_topology_id, tvb, offset + 4 + (n * BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID),
5740
1.08k
                                                    BGP_NLRI_TLV_LEN_MULTI_TOPOLOGY_ID, ENC_BIG_ENDIAN);
5741
1.08k
            }
5742
495
            break;
5743
5744
39.1k
        case BGP_NLRI_TLV_NODE_FLAG_BITS:
5745
39.1k
            {
5746
39.1k
            static int * const flags[] = {
5747
39.1k
                &hf_bgp_ls_node_flag_bits_overload,
5748
39.1k
                &hf_bgp_ls_node_flag_bits_attached,
5749
39.1k
                &hf_bgp_ls_node_flag_bits_external,
5750
39.1k
                &hf_bgp_ls_node_flag_bits_abr,
5751
39.1k
                NULL
5752
39.1k
            };
5753
5754
39.1k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_flags_bits, tvb, offset, length+4, ENC_NA);
5755
39.1k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5756
39.1k
            if(length != BGP_NLRI_TLV_LEN_NODE_FLAG_BITS){
5757
27.2k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Node Flags Bits TLV's length (%u), it must be %u bytes!",
5758
27.2k
                                       length, BGP_NLRI_TLV_LEN_NODE_FLAG_BITS);
5759
27.2k
                break;
5760
27.2k
            }
5761
11.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5762
11.9k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5763
11.9k
            proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
5764
11.9k
            tmp8 = tvb_get_uint8(tvb, offset+4) & 0x0f;
5765
11.9k
            if(tmp8){
5766
11.7k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flag bits are not set to zero (%u).", tmp8);
5767
11.7k
            }
5768
11.9k
            }
5769
0
            break;
5770
5771
197
        case BGP_NLRI_TLV_OPAQUE_NODE_PROPERTIES:
5772
197
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_node_properties, tvb, offset, length+4, ENC_NA);
5773
197
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5774
197
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5775
197
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5776
197
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_node_properties_value, tvb, offset + 4, length, ENC_NA);
5777
197
            break;
5778
5779
194
        case BGP_NLRI_TLV_NODE_NAME:
5780
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_node_name, tvb, offset, length+4, ENC_NA);
5781
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5782
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5783
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5784
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_node_name_value, tvb, offset + 4, length, ENC_ASCII);
5785
194
            break;
5786
5787
194
        case BGP_NLRI_TLV_IS_IS_AREA_IDENTIFIER:
5788
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_is_is_area_identifier, tvb, offset, length+4, ENC_NA);
5789
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5790
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5791
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5792
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_is_is_area_identifier_value, tvb, offset + 4, length, ENC_NA);
5793
194
            break;
5794
5795
614
        case BGP_LS_SR_TLV_SR_CAPABILITY:
5796
614
            {
5797
                /*
5798
                  0  1  2  3  4  5  6  7
5799
                  +--+--+--+--+--+--+--+--+
5800
                  |I |V |H |  |  |  |  |  |
5801
                  +--+--+--+--+--+--+--+--+
5802
                */
5803
614
                static int * const sr_capabilities_flags[] = {
5804
614
                    &hf_bgp_ls_sr_tlv_capabilities_flags_i,
5805
614
                    &hf_bgp_ls_sr_tlv_capabilities_flags_v,
5806
614
                    &hf_bgp_ls_sr_tlv_capabilities_flags_h,
5807
614
                    &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
5808
614
                    NULL
5809
614
                };
5810
614
                int offset2;
5811
614
                int remaining_data;
5812
614
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_capabilities, tvb, offset, length + 4, ENC_NA);
5813
614
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5814
614
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5815
614
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5816
614
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_capabilities_flags,
5817
614
                                       ett_bgp_link_state, sr_capabilities_flags, ENC_BIG_ENDIAN);
5818
                /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
5819
614
                offset2 = offset + 4 + 2;
5820
614
                remaining_data = length - 2;
5821
1.33k
                while (remaining_data > 0) {
5822
719
                    uint16_t sid_len = 0;
5823
                    /* parse and consume the range field */
5824
719
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
5825
719
                    offset2 += 3;
5826
                    /* parse and consume type/len fields */
5827
719
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
5828
719
                    offset2 += 2;
5829
719
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
5830
719
                    sid_len = tvb_get_ntohs(tvb, offset2);
5831
719
                    offset2 += 2;
5832
719
                    if (sid_len == 3) {
5833
                        /* parse and consume the SID/Label field */
5834
391
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
5835
391
                        offset2 += 3;
5836
391
                        remaining_data -= 10;
5837
391
                    } else {
5838
                        /* parse and consume the SID/Index field */
5839
328
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_capabilities_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
5840
328
                        offset2 += 4;
5841
328
                        remaining_data -= 11;
5842
328
                    }
5843
719
                }
5844
614
            }
5845
614
            break;
5846
5847
679
        case BGP_LS_SR_TLV_SR_LOCAL_BLOCK:
5848
679
            {
5849
679
                int offset2;
5850
679
                int remaining_data;
5851
679
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_local_block, tvb, offset, length + 4, ENC_NA);
5852
679
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5853
679
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5854
679
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5855
679
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_flags, tvb, offset + 4, 1, ENC_NA);
5856
                /* past flags and reserved byte, we got one or more range + SID/Label Sub-TLV entries */
5857
679
                offset2 = offset + 4 + 2;
5858
679
                remaining_data = length - 2;
5859
1.56k
                while (remaining_data > 0) {
5860
882
                    uint16_t sid_len = 0;
5861
                    /* parse and consume the range field */
5862
882
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_range_size, tvb, offset2, 3, ENC_BIG_ENDIAN);
5863
882
                    offset2 += 3;
5864
                    /* parse and consume type/len fields */
5865
882
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset2, 2, ENC_BIG_ENDIAN);
5866
882
                    offset2 += 2;
5867
882
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset2, 2, ENC_BIG_ENDIAN);
5868
882
                    sid_len = tvb_get_ntohs(tvb, offset2);
5869
882
                    offset2 += 2;
5870
882
                    if (sid_len == 3) {
5871
                        /* parse and consume the SID/Label field */
5872
532
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_label, tvb, offset2, 3, ENC_BIG_ENDIAN);
5873
532
                        offset2 += 3;
5874
532
                        remaining_data -= 10;
5875
532
                    } else {
5876
                        /* parse and consume the SID/Index field */
5877
350
                        proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_local_block_sid_index, tvb, offset2, 4, ENC_BIG_ENDIAN);
5878
350
                        offset2 += 4;
5879
350
                        remaining_data -= 11;
5880
350
                    }
5881
882
                }
5882
679
            }
5883
679
            break;
5884
5885
465
        case BGP_LS_SR_TLV_SR_ALGORITHM:
5886
465
            {
5887
465
                int offset2;
5888
465
                int remaining_data;
5889
465
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_algorithm, tvb, offset, length+4, ENC_NA);
5890
465
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5891
465
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5892
465
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5893
                /* past type-length fields, we got one or more 'Algorithm N' value */
5894
465
                offset2 = offset + 4;
5895
465
                remaining_data = length;
5896
866
                while (remaining_data > 0) {
5897
401
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_algorithm_value, tvb, offset2, 1, ENC_NA);
5898
401
                    offset2 += 1;
5899
401
                    remaining_data -= 1;
5900
401
                }
5901
465
            }
5902
465
            break;
5903
5904
408
        case BGP_LS_SR_TLV_SRV6_CAPABILITY:
5905
408
            {
5906
408
                static int * const srv6_cap_flags[] = {
5907
408
                    &hf_bgp_ls_sr_tlv_srv6_cap_flags_o,
5908
408
                    &hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved,
5909
408
                    NULL
5910
408
                };
5911
408
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_cap, tvb, offset, length + 4, ENC_NA);
5912
408
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5913
408
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5914
408
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5915
408
                if (length != 4) {
5916
213
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
5917
213
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
5918
213
                                           length, "SRv6 Capabilities", 4);
5919
213
                    break;
5920
213
                }
5921
195
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_srv6_cap_flags,
5922
195
                                       ett_bgp_link_state, srv6_cap_flags, ENC_BIG_ENDIAN);
5923
195
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_cap_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
5924
195
            }
5925
0
            break;
5926
5927
1.55k
        case BGP_LS_SR_TLV_FLEX_ALGO_DEF:
5928
1.55k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_def, tvb, offset, length+4, ENC_NA);
5929
1.55k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5930
1.55k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5931
1.55k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5932
1.55k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
5933
1.55k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_metric_type, tvb, offset + 5, 1, ENC_NA);
5934
1.55k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_calc_type, tvb, offset + 6, 1, ENC_NA);
5935
1.55k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_priority, tvb, offset + 7, 1, ENC_NA);
5936
1.55k
            local_offset = offset + 8;
5937
4.40k
            while (local_offset < offset + length) {
5938
2.85k
                advance = decode_link_state_attribute_flex_algo_subtlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
5939
2.85k
                if (advance < 0) {
5940
0
                    break;
5941
0
                }
5942
2.85k
                local_offset += advance;
5943
2.85k
            }
5944
1.55k
            break;
5945
5946
        /* NODE & LINK ATTRIBUTE TLVs */
5947
391
        case BGP_NLRI_TLV_NODE_MSD:
5948
652
        case BGP_NLRI_TLV_LINK_MSD:
5949
652
            tlv_item = proto_tree_add_item(tree,
5950
652
                                           (type == BGP_NLRI_TLV_NODE_MSD ?
5951
391
                                            hf_bgp_ls_tlv_node_msd : hf_bgp_ls_tlv_link_msd),
5952
652
                                            tvb, offset, length + 4, ENC_NA);
5953
652
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
5954
652
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5955
652
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5956
652
            local_offset = offset + 4;
5957
652
            local_length = length;
5958
1.51k
            while (local_length >= 2) {
5959
862
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_type, tvb, local_offset, 1, ENC_NA);
5960
862
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_igp_msd_value, tvb, local_offset+1, 1, ENC_NA);
5961
862
                local_length -= 2;
5962
862
                local_offset += 2;
5963
862
            }
5964
652
            break;
5965
5966
547
        case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_LOCAL_NODE:
5967
547
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
5968
547
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5969
547
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5970
547
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5971
547
            if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE){
5972
353
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
5973
353
                                    length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_LOCAL_NODE);
5974
353
                break;
5975
353
            }
5976
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
5977
194
            break;
5978
406
        case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_LOCAL_NODE:
5979
406
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_local_node, tvb, offset, length+4, ENC_NA);
5980
406
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
5981
406
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
5982
406
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5983
406
            if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE){
5984
212
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
5985
212
                                    length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_LOCAL_NODE);
5986
212
                break;
5987
212
            }
5988
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);
5989
194
            break;
5990
5991
        /* Link Attribute TLVs */
5992
678
        case BGP_NLRI_TLV_LINK_LOCAL_REMOTE_IDENTIFIERS:
5993
678
            if (length != BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS) {
5994
484
                expert_add_info_format(pinfo, tree, &ei_bgp_ls_error,
5995
484
                                       "Unexpected Link Local/Remote Identifiers TLV's length (%u), it must be %u bytes!",
5996
484
                                       length, BGP_NLRI_TLV_LEN_LINK_LOCAL_REMOTE_IDENTIFIERS);
5997
484
                break;
5998
484
            }
5999
194
            tlv_item = proto_tree_add_item(tree,
6000
194
                                           hf_bgp_ls_tlv_link_local_remote_identifiers, tvb, offset,
6001
194
                                           length + 4, ENC_NA);
6002
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_mp_reach_nlri);
6003
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6004
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6005
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_local_identifier, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6006
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_nlri_link_remote_identifier, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6007
194
            break;
6008
6009
431
        case BGP_NLRI_TLV_IPV4_ROUTER_ID_OF_REMOTE_NODE:
6010
431
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv4_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
6011
431
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6012
431
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6013
431
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6014
431
            if(length != BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE){
6015
237
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv4 Router-ID TLV's length (%u), it must be %u bytes!",
6016
237
                                    length, BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID_OF_REMOTE_NODE);
6017
237
                break;
6018
237
            }
6019
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_ipv4_router_id_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6020
194
            break;
6021
6022
400
        case BGP_NLRI_TLV_IPV6_ROUTER_ID_OF_REMOTE_NODE:
6023
400
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_ipv6_router_id_of_remote_node, tvb, offset, length+4, ENC_NA);
6024
400
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6025
400
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6026
400
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6027
400
            if(length != BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE){
6028
206
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IPv6 Router-ID TLV's length (%u), it must be %u bytes!",
6029
206
                                    length, BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID_OF_REMOTE_NODE);
6030
206
                break;
6031
206
            }
6032
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);
6033
194
            break;
6034
6035
5.58k
        case BGP_NLRI_TLV_ADMINISTRATIVE_GROUP_COLOR:
6036
5.58k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_administrative_group_color, tvb, offset, length+4, ENC_NA);
6037
5.58k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6038
5.58k
            if(length != BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR){
6039
4.40k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Administrative group (color) TLV's length (%u), it must be %u bytes!",
6040
4.40k
                                       length, BGP_NLRI_TLV_LEN_ADMINISTRATIVE_GROUP_COLOR);
6041
4.40k
                break;
6042
4.40k
            }
6043
1.18k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6044
1.18k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6045
1.18k
            tmp32 = tvb_get_ntohl(tvb, offset + 4);
6046
1.18k
            tlv_sub_item = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_administrative_group_color_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6047
1.18k
            tlv_sub_tree = proto_item_add_subtree(tlv_sub_item, ett_bgp_prefix);
6048
1.18k
            mask = 1;
6049
39.0k
            for(n = 0; n<32; n++){
6050
37.8k
                if( tmp32 & mask ) proto_tree_add_uint(tlv_sub_tree, hf_bgp_ls_tlv_administrative_group, tvb, offset + 4, 4, n);
6051
37.8k
                mask <<= 1;
6052
37.8k
            }
6053
1.18k
            break;
6054
6055
47.2k
        case BGP_NLRI_TLV_MAX_LINK_BANDWIDTH:
6056
47.2k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_link_bandwidth, tvb, offset, length+4, ENC_NA);
6057
47.2k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6058
47.2k
            if(length != BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH){
6059
47.0k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Maximum link bandwidth TLV's length (%u), it must be %u bytes!",
6060
47.0k
                                       length, BGP_NLRI_TLV_LEN_MAX_LINK_BANDWIDTH);
6061
47.0k
                break;
6062
47.0k
            }
6063
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6064
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6065
194
            tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
6066
194
            proto_tree_add_float_format(tlv_tree, hf_bgp_ls_bandwidth_value, tvb, offset + 4, 4, tmp_float, "Maximum link bandwidth: %.2f Mbps", tmp_float);
6067
194
            break;
6068
6069
399
        case BGP_NLRI_TLV_MAX_RESERVABLE_LINK_BANDWIDTH:
6070
399
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_max_reservable_link_bandwidth, tvb, offset, length+4, ENC_NA);
6071
399
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6072
399
            if(length != BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH){
6073
205
                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!",
6074
205
                                       length, BGP_NLRI_TLV_LEN_MAX_RESERVABLE_LINK_BANDWIDTH);
6075
205
                break;
6076
205
            }
6077
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6078
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6079
194
            tmp_float = tvb_get_ntohieee_float(tvb, offset + 4)*8/1000000;
6080
194
            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);
6081
194
            break;
6082
6083
26.5k
        case BGP_NLRI_TLV_UNRESERVED_BANDWIDTH:
6084
26.5k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_unreserved_bandwidth, tvb, offset, length+4, ENC_NA);
6085
26.5k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6086
26.5k
            if(length != BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH){
6087
318
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Unreserved bandwidth TLV's length (%u), it must be %u bytes!",
6088
318
                                       length, BGP_NLRI_TLV_LEN_UNRESERVED_BANDWIDTH);
6089
318
                break;
6090
318
            }
6091
26.2k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6092
26.2k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6093
235k
            for(n = 0; n<8; n++){
6094
209k
                tmp_float = tvb_get_ntohieee_float(tvb, offset + 4 + (4 * n))*8/1000000;
6095
209k
                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);
6096
209k
                proto_item_prepend_text(tlv_sub_item, "Priority %u, ", n);
6097
209k
            }
6098
26.2k
            break;
6099
6100
16.5k
        case BGP_NLRI_TLV_TE_DEFAULT_METRIC:
6101
16.5k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_te_default_metric, tvb, offset, length+4, ENC_NA);
6102
16.5k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6103
            /* FF: The 'TE Default Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 04
6104
               was 3 bytes as per RFC5305/3.7, since version 05 is 4 bytes. Here we try to parse both formats
6105
               without complain because there are real implementations out there based on the 3 bytes size. At
6106
               the same time we clearly highlight that 3 is "old" and 4 is correct via expert info. */
6107
16.5k
            if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
6108
16.1k
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
6109
16.1k
                                       "Old TE Default Metric TLV's length (%u), it should be %u bytes!",
6110
16.1k
                                       length,
6111
16.1k
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
6112
                /* just a warning do not give up dissection */
6113
16.1k
            }
6114
16.5k
            if (length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD && length != BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
6115
210
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
6116
210
                                       "Unexpected TE Default Metric TLV's length (%u), it must be %u or %u bytes!",
6117
210
                                       length,
6118
210
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD,
6119
210
                                       BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW);
6120
                /* major error give up dissection */
6121
210
                break;
6122
210
            }
6123
16.3k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6124
16.3k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6125
16.3k
            if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_OLD) {
6126
16.1k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value_old, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
6127
16.1k
            } else if (length == BGP_NLRI_TLV_LEN_TE_DEFAULT_METRIC_NEW) {
6128
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_te_default_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6129
194
            }
6130
16.3k
            break;
6131
6132
392k
        case BGP_NLRI_TLV_LINK_PROTECTION_TYPE:
6133
392k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_protection_type, tvb, offset, length+4, ENC_NA);
6134
392k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6135
392k
            if(length != BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE){
6136
296
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Link Protection Type TLV's length (%u), it must be %u bytes!",
6137
296
                                       length, BGP_NLRI_TLV_LEN_LINK_PROTECTION_TYPE);
6138
296
                break;
6139
296
            }
6140
391k
            else {
6141
391k
                static int * const nlri_flags[] = {
6142
391k
                    &hf_bgp_ls_link_protection_type_extra_traffic,
6143
391k
                    &hf_bgp_ls_link_protection_type_unprotected,
6144
391k
                    &hf_bgp_ls_link_protection_type_shared,
6145
391k
                    &hf_bgp_ls_link_protection_type_dedicated_1to1,
6146
391k
                    &hf_bgp_ls_link_protection_type_dedicated_1plus1,
6147
391k
                    &hf_bgp_ls_link_protection_type_enhanced,
6148
391k
                    NULL
6149
391k
                };
6150
6151
391k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6152
391k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6153
391k
                tmp8 = tvb_get_uint8(tvb, offset + 4);
6154
6155
391k
                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);
6156
391k
                tmp8 >>= 6;
6157
391k
                if(tmp8){
6158
290k
                    expert_add_info_format(pinfo, tlv_sub_item, &ei_bgp_ls_error, "Reserved Protection Capabilities bits are not set to zero (%u).", tmp8);
6159
290k
                }
6160
391k
                tmp8 = tvb_get_uint8(tvb, offset + 4 + 1);
6161
391k
                if(tmp8){
6162
391k
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved field is not set to zero. (%u)", tmp8);
6163
391k
                }
6164
391k
            }
6165
391k
            break;
6166
391k
        case BGP_NLRI_TLV_MPLS_PROTOCOL_MASK:
6167
13.9k
            {
6168
13.9k
            static int * const flags[] = {
6169
13.9k
                &hf_bgp_ls_mpls_protocol_mask_flag_l,
6170
13.9k
                &hf_bgp_ls_mpls_protocol_mask_flag_r,
6171
13.9k
                NULL
6172
13.9k
            };
6173
6174
13.9k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_mpls_protocol_mask, tvb, offset, length+4, ENC_NA);
6175
13.9k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6176
13.9k
            if(length != BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK){
6177
206
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected MPLS Protocol Mask TLV's length (%u), it must be %u bytes!",
6178
206
                                       length, BGP_NLRI_TLV_LEN_MPLS_PROTOCOL_MASK);
6179
206
                break;
6180
206
            }
6181
13.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6182
13.7k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6183
13.7k
            proto_tree_add_bitmask_list(tlv_tree, tvb, offset+4, 1, flags, ENC_NA);
6184
13.7k
            tmp8 = tvb_get_uint8(tvb, offset + 4) & 0x3f;
6185
13.7k
            if(tmp8){
6186
13.5k
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error, tvb, offset + 4, 1,
6187
13.5k
                                             "Reserved flags are not set to zero (%u).", tmp8);
6188
13.5k
            }
6189
13.7k
            }
6190
0
            break;
6191
987
        case BGP_NLRI_TLV_METRIC:
6192
            /* FF: The IGP 'Metric TLV's length changed. From draft-ietf-idr-ls-distribution-00 to 02
6193
               was fixed at 3 bytes, since version 03 is variable 1/2/3 bytes. We cannot complain if
6194
               length is not fixed at 3. */
6195
987
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_metric, tvb, offset, length + 4, ENC_NA);
6196
987
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6197
987
            if (length > BGP_NLRI_TLV_LEN_MAX_METRIC) {
6198
207
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error,
6199
207
                                       "Unexpected Metric TLV's length (%u), it must be less than %u bytes!",
6200
207
                                       length, BGP_NLRI_TLV_LEN_MAX_METRIC);
6201
207
                break;
6202
207
            }
6203
780
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6204
780
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6205
780
            if (length == 1) {
6206
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value1, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6207
586
            } else if (length == 2) {
6208
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value2, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6209
392
            } else if (length == 3) {
6210
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_metric_value3, tvb, offset + 4, 3, ENC_BIG_ENDIAN);
6211
194
            }
6212
780
            break;
6213
136k
        case BGP_NLRI_TLV_SHARED_RISK_LINK_GROUP:
6214
136k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_shared_risk_link_group, tvb, offset, length+4, ENC_NA);
6215
136k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6216
136k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6217
136k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6218
136k
            tmp16 = length;
6219
136k
            n = 0;
6220
136k
            while(tmp16 > 0){
6221
136k
                if(tmp16 < 4) {
6222
135k
                    proto_tree_add_expert_format(tlv_tree, pinfo, &ei_bgp_ls_error,
6223
135k
                                                 tvb, offset + 4 + (n * 4), tmp16,
6224
135k
                                                 "Shared Risk Link Group Value must be 4 bytes long (%u).", tmp16);
6225
135k
                    break;
6226
135k
                }
6227
426
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_shared_risk_link_group_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
6228
426
                tmp16 -= 4;
6229
426
                n++;
6230
426
            }
6231
136k
            break;
6232
6233
292
        case BGP_NLRI_TLV_OPAQUE_LINK_ATTRIBUTE:
6234
292
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_opaque_link_attribute, tvb, offset, length+4, ENC_NA);
6235
292
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6236
292
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6237
292
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6238
292
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_opaque_link_attribute_value, tvb,  offset + 4, length, ENC_NA);
6239
292
            break;
6240
6241
195
        case BGP_NLRI_TLV_LINK_NAME_ATTRIBUTE:
6242
195
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_link_name_attribute, tvb, offset, length+4, ENC_NA);
6243
195
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6244
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6245
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6246
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_link_name_attribute_value, tvb, offset + 4, length, ENC_ASCII);
6247
195
            break;
6248
6249
808
        case BGP_LS_SR_TLV_ADJ_SID:
6250
808
            {
6251
                /*
6252
                   0  1  2  3  4  5  6  7
6253
                  +--+--+--+--+--+--+--+--+
6254
                  |F |B |V |L |S |P |  |  |
6255
                  +--+--+--+--+--+--+--+--+
6256
                */
6257
808
                static int * const adj_sid_isis_flags[] = {
6258
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
6259
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
6260
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
6261
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
6262
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
6263
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi,
6264
808
                    NULL
6265
808
                };
6266
                /*
6267
                   0  1  2  3  4  5  6  7
6268
                  +--+--+--+--+--+--+--+--+
6269
                  |B |V |L |G |P |  |  |  |
6270
                  +--+--+--+--+--+--+--+--+
6271
                */
6272
808
                static int * const adj_sid_ospf_flags[] = {
6273
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
6274
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
6275
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
6276
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_go,
6277
808
                    &hf_bgp_ls_sr_tlv_adjacency_sid_flags_po,
6278
808
                    NULL
6279
808
                };
6280
6281
808
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_adjacency_sid, tvb, offset, length + 4, ENC_NA);
6282
808
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6283
808
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6284
808
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6285
808
                if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6286
397
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
6287
397
                                           ett_bgp_link_state, adj_sid_ospf_flags, ENC_BIG_ENDIAN);
6288
411
                } else {
6289
                    /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6290
411
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_adjacency_sid_flags,
6291
411
                                           ett_bgp_link_state, adj_sid_isis_flags, ENC_BIG_ENDIAN);
6292
411
                }
6293
808
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6294
808
                if (length == 7) {
6295
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6296
614
                } else {
6297
614
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_adjacency_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6298
614
                }
6299
808
            }
6300
808
            break;
6301
6302
194
        case BGP_LS_SR_TLV_LAN_ADJ_SID:
6303
194
            break;
6304
6305
4.42k
        case BGP_LS_SR_TLV_PEER_NODE_SID:
6306
5.33k
        case BGP_LS_SR_TLV_PEER_ADJ_SID:
6307
6.74k
        case BGP_LS_SR_TLV_PEER_SET_SID:
6308
6.74k
            {
6309
                /*
6310
                   0  1  2  3  4  5  6  7
6311
                  +--+--+--+--+--+--+--+--+
6312
                  |V |L |B |P |  |  |  |  | rfc9086
6313
                  +--+--+--+--+--+--+--+--+
6314
                */
6315
6.74k
                static int * const peer_sid_flags[] = {
6316
6.74k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
6317
6.74k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
6318
6.74k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
6319
6.74k
                    &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
6320
6.74k
                    NULL
6321
6.74k
                };
6322
6323
6.74k
                tlv_item = proto_tree_add_item(tree,
6324
6.74k
                                               (type == BGP_LS_SR_TLV_PEER_NODE_SID ?
6325
4.42k
                                                hf_bgp_ls_sr_tlv_peer_node_sid :
6326
6.74k
                                                (type == BGP_LS_SR_TLV_PEER_ADJ_SID ?
6327
910
                                                 hf_bgp_ls_sr_tlv_peer_adj_sid :
6328
2.32k
                                                 hf_bgp_ls_sr_tlv_peer_set_sid)),
6329
6.74k
                                               tvb, offset, length + 4, ENC_NA);
6330
6.74k
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6331
6.74k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6332
6.74k
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6333
6.74k
                if (length != 7 && length != 8) {
6334
6.35k
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6335
6.35k
                                           "Unexpected TLV Length (%u) in BGP-LS Peer SID TLV, it must be either 7 or 8 bytes!",
6336
6.35k
                                           length);
6337
6.35k
                    break;
6338
6.35k
                }
6339
392
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_peer_sid_flags,
6340
392
                                       ett_bgp_link_state, peer_sid_flags, ENC_BIG_ENDIAN);
6341
392
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_weight, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6342
392
                if (length == 7) {
6343
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6344
198
                } else {
6345
198
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_peer_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6346
198
                }
6347
392
            }
6348
0
            break;
6349
6350
679
        case BGP_LS_SR_TLV_SRV6_END_X_SID:
6351
679
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_endx_sid,
6352
679
                                           tvb, offset, length + 4, ENC_NA);
6353
679
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6354
679
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6355
679
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6356
679
            if (length < 20) {
6357
217
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6358
217
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6359
217
                                       length, "SRv6 End.X SID", 20);
6360
217
                break;
6361
217
            }
6362
462
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6363
462
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 6,
6364
462
                                   hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
6365
462
                                   ett_bgp_link_state, srv6_endx_sid_flags, ENC_BIG_ENDIAN);
6366
462
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_algo, tvb, offset + 7, 1, ENC_NA);
6367
462
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_weight, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6368
462
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved, tvb, offset + 9, 1, ENC_BIG_ENDIAN);
6369
462
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_sid, tvb, offset + 10, 16, ENC_NA);
6370
462
            local_offset = offset + 26;
6371
912
            while (local_offset < offset + length) {
6372
450
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6373
450
                if (advance < 0) {
6374
0
                    break;
6375
0
                }
6376
450
                local_offset += advance;
6377
450
            }
6378
462
            break;
6379
6380
1.86k
        case BGP_LS_SR_TLV_SRV6_LAN_END_X_SID:
6381
1.86k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_lan_endx_sid,
6382
1.86k
                                           tvb, offset, length+4, ENC_NA);
6383
1.86k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6384
1.86k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6385
1.86k
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6386
1.86k
            if ((((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) && length < 26) ||
6387
1.86k
                ((protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
6388
1.47k
                  protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) && length < 28)) {
6389
782
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6390
782
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6391
782
                                       length, "SRv6 LAN End.X SID",
6392
782
                                       ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) ? 26 : 28);
6393
782
                break;
6394
782
            }
6395
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);
6396
1.08k
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 6,
6397
1.08k
                                   hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
6398
1.08k
                                   ett_bgp_link_state, srv6_endx_sid_flags, ENC_BIG_ENDIAN);
6399
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_algo, tvb, offset + 7, 1, ENC_NA);
6400
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_weight, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6401
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved, tvb, offset + 9, 1, ENC_BIG_ENDIAN);
6402
1.08k
            local_offset = offset + 10;
6403
1.08k
            if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6404
392
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf, tvb, local_offset, 4, ENC_BIG_ENDIAN);
6405
392
                local_offset += 4;
6406
691
            } else {
6407
                /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6408
691
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis, tvb, local_offset, 6, ENC_NA);
6409
691
                local_offset += 6;
6410
691
            }
6411
1.08k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endx_sid_sid, tvb, local_offset, 16, ENC_NA);
6412
1.08k
            local_offset += 16;
6413
2.10k
            while (local_offset < offset + length) {
6414
1.02k
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6415
1.02k
                if (advance < 0) {
6416
0
                    break;
6417
0
                }
6418
1.02k
                local_offset += advance;
6419
1.02k
            }
6420
1.08k
            break;
6421
6422
1.51M
        case BGP_LS_APP_SPEC_LINK_ATTR:
6423
1.51M
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_app_spec_link_attrs, tvb, offset, length + 4, ENC_NA);
6424
1.51M
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6425
1.51M
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6426
1.51M
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6427
1.51M
            sabm_len = tvb_get_uint8(tvb, offset + 4);
6428
1.51M
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len, tvb, offset + 4, 1, ENC_NA);
6429
1.51M
            if (sabm_len != 0 && sabm_len != 4 && sabm_len != 8) {
6430
35.9k
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6431
35.9k
                                       "Unexpected SABM Length (%u) in BGP-LS Application-Specific Link Attributes TLV, it must be 0/4/8 bytes!",
6432
35.9k
                                       sabm_len);
6433
35.9k
                break;
6434
35.9k
            }
6435
1.47M
            udabm_len = tvb_get_uint8(tvb, offset + 5);
6436
1.47M
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len, tvb, offset + 5, 1, ENC_NA);
6437
1.47M
            if (udabm_len != 0 && udabm_len != 4 && udabm_len != 8) {
6438
56.1k
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6439
56.1k
                                       "Unexpected UDABM Length (%u) in BGP-LS Application Specific Link Attributes TLV, it must be 0/4/8 bytes!",
6440
56.1k
                                       sabm_len);
6441
56.1k
                break;
6442
56.1k
            }
6443
1.42M
            tmp16 = tvb_get_uint16(tvb, offset + 6, ENC_BIG_ENDIAN);
6444
1.42M
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6445
1.42M
            if (tmp16 != 0) {
6446
1.25M
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_warn,
6447
1.25M
                                       "Reserved field must be 0 in BGP-LS Application-Specific Link Attributes TLV");
6448
1.25M
            }
6449
1.42M
            if (sabm_len > 0) {
6450
16.5k
                static int * const app_spec_link_attrs_sabm[] = {
6451
16.5k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
6452
16.5k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
6453
16.5k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
6454
16.5k
                    &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
6455
16.5k
                    NULL
6456
16.5k
                };
6457
16.5k
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 8, hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
6458
16.5k
                                       ett_bgp_link_state, app_spec_link_attrs_sabm, ENC_BIG_ENDIAN);
6459
16.5k
            }
6460
1.42M
            if (udabm_len > 0) {
6461
657
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
6462
657
                                    tvb, offset + 8 + sabm_len, udabm_len, ENC_NA);
6463
657
            }
6464
            /* Decode Link Attribute sub-TLVs */
6465
1.42M
            local_offset = offset + 8 + sabm_len + udabm_len;
6466
4.35M
            while (local_offset < offset + length) {
6467
2.92M
                advance = decode_link_state_attribute_tlv(tlv_tree, tvb, local_offset, pinfo, protocol_id);
6468
2.92M
                if (advance < 0) {
6469
0
                    break;
6470
0
                }
6471
2.92M
                local_offset += advance;
6472
2.92M
            }
6473
1.42M
            break;
6474
6475
        /* Prefix Attribute TLVs */
6476
589
        case BGP_NLRI_TLV_IGP_FLAGS:
6477
589
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_igp_flags, tvb, offset, length+4, ENC_NA);
6478
589
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6479
589
            if(length != BGP_NLRI_TLV_LEN_IGP_FLAGS){
6480
201
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected IGP Flags TLV's length (%u), it must be %u bytes!",
6481
201
                                       length, BGP_NLRI_TLV_IGP_FLAGS);
6482
201
                break;
6483
201
            }
6484
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6485
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6486
388
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_flags_flag_d, tvb, offset + 4, 1, ENC_NA);
6487
388
            tmp8 = tvb_get_uint8(tvb, offset + 4) & 0x7F;
6488
388
            if(tmp8){
6489
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Reserved flags are not set to zero (%u).", tmp8);
6490
194
            }
6491
388
            break;
6492
6493
642
        case BGP_NLRI_TLV_ROUTE_TAG:
6494
642
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_tag, tvb, offset, length+4, ENC_NA);
6495
642
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6496
642
            if(length % 4 != 0) {
6497
195
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Tag TLV's length (%u mod 4 != 0) ",
6498
195
                                       length);
6499
195
                break;
6500
195
            }
6501
447
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6502
447
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6503
447
            tmp16 = length;
6504
447
            n = 0;
6505
894
            while(tmp16){
6506
447
                if(tmp16 < 4) {
6507
0
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Tag must be 4 bytes long (%u).", tmp16);
6508
0
                    break;
6509
0
                }
6510
447
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_tag_value, tvb, offset + 4 + (n * 4), 4, ENC_BIG_ENDIAN);
6511
447
                tmp16 -= 4;
6512
447
                n++;
6513
447
            }
6514
447
            break;
6515
6516
664
        case BGP_NLRI_TLV_EXTENDED_TAG:
6517
664
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_route_extended_tag, tvb, offset, length+4, ENC_NA);
6518
664
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6519
664
            if(length % 8 != 0) {
6520
226
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Route Extended Tag TLV's length (%u mod 8 != 0) ",
6521
226
                                       length);
6522
226
                break;
6523
226
            }
6524
438
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6525
438
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6526
438
            tmp16 = length;
6527
438
            n = 0;
6528
876
            while(tmp16){
6529
438
                if(tmp16 < 8) {
6530
0
                    expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Route Extended Tag must be 8 bytes long (%u).", tmp16);
6531
0
                    break;
6532
0
                }
6533
438
                proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_route_extended_tag_value, tvb, offset + 4 + (n * 8), 8, ENC_BIG_ENDIAN);
6534
438
                tmp16 -= 8;
6535
438
                n++;
6536
438
            }
6537
438
            break;
6538
6539
480
        case BGP_NLRI_TLV_PREFIX_METRIC:
6540
480
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_tlv_prefix_metric, tvb, offset, length+4, ENC_NA);
6541
480
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6542
480
            if(length != BGP_NLRI_TLV_LEN_PREFIX_METRIC){
6543
286
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Prefix Metric TLV's length (%u), it must be %u bytes!",
6544
286
                                       length, BGP_NLRI_TLV_LEN_PREFIX_METRIC);
6545
286
                break;
6546
286
            }
6547
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6548
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6549
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_tlv_prefix_metric_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6550
194
            break;
6551
6552
601
        case BGP_NLRI_TLV_OSPF_FORWARDING_ADDRESS:
6553
601
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_ospf_forwarding_address, tvb, offset, length+4, ENC_NA);
6554
601
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6555
601
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6556
601
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6557
601
            if (length == 4) {
6558
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv4_address, tvb, offset + 4, length, ENC_BIG_ENDIAN);
6559
194
            }
6560
407
            else if (length == 16) {
6561
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_ospf_forwarding_address_ipv6_address, tvb, offset + 4, length,  ENC_NA);
6562
194
            }
6563
213
            else {
6564
213
                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);
6565
213
                break;
6566
213
            }
6567
388
            break;
6568
6569
388
        case BGP_NLRI_TLV_OPAQUE_PREFIX_ATTRIBUTE:
6570
198
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_opaque_prefix_attribute, tvb, offset, length+4, ENC_NA);
6571
198
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6572
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6573
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6574
198
            proto_tree_add_item(tlv_tree, hf_bgp_ls_opaque_prefix_attribute_value, tvb, offset + 4, length, ENC_NA);
6575
198
            break;
6576
6577
658
        case BGP_NLRI_TLV_EXTENDED_ADMINISTRATIVE_GROUP:
6578
658
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_extended_administrative_group, tvb, offset, length+4, ENC_NA);
6579
658
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6580
658
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6581
658
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6582
658
            if(length % 4 != 0) {
6583
194
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_error, "Unexpected Extended Administrative Group TLV's length (%u mod 4 != 0)",
6584
194
                                       length);
6585
194
                break;
6586
194
            }
6587
464
            tmp16 = length;
6588
934
            while(tmp16){
6589
470
                proto_tree_add_item(tlv_tree, hf_bgp_ls_extended_administrative_group_value, tvb, offset + 4 + (length - tmp16), 4, ENC_NA);
6590
470
                tmp16 -= 4;
6591
470
            }
6592
464
            break;
6593
6594
1.82k
        case BGP_LS_SR_TLV_PREFIX_SID:
6595
1.82k
            {
6596
                /*
6597
                   0  1  2  3  4  5  6  7
6598
                  +--+--+--+--+--+--+--+--+
6599
                  |R |N |P |E |V |L |  |  |
6600
                  +--+--+--+--+--+--+--+--+
6601
                */
6602
1.82k
                static int * const prefix_sid_isis_flags[] = {
6603
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
6604
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
6605
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
6606
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
6607
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
6608
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
6609
1.82k
                    NULL
6610
1.82k
                };
6611
                /*
6612
                   0  1  2  3  4  5  6  7
6613
                  +--+--+--+--+--+--+--+--+
6614
                  |  |NP|M |E |V |L |  |  |
6615
                  +--+--+--+--+--+--+--+--+
6616
                */
6617
1.82k
                static int * const prefix_sid_ospf_flags[] = {
6618
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
6619
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
6620
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
6621
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
6622
1.82k
                    &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
6623
1.82k
                    NULL
6624
1.82k
                };
6625
6626
1.82k
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_sid, tvb, offset, length + 4, ENC_NA);
6627
1.82k
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6628
1.82k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6629
1.82k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6630
1.82k
                if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6631
388
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
6632
388
                                           ett_bgp_link_state, prefix_sid_ospf_flags, ENC_BIG_ENDIAN);
6633
1.43k
                } else {
6634
                    /* FF: most common case is IS-IS, so if it is not OSPF we go that way */
6635
1.43k
                    proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_sid_flags,
6636
1.43k
                                           ett_bgp_link_state, prefix_sid_isis_flags, ENC_BIG_ENDIAN);
6637
1.43k
                }
6638
1.82k
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6639
1.82k
                if (length == 7) {
6640
194
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_label, tvb, offset + 8, 3, ENC_BIG_ENDIAN);
6641
1.63k
                } else {
6642
1.63k
                    proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_sid_index, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6643
1.63k
                }
6644
1.82k
            }
6645
1.82k
            break;
6646
6647
194
        case BGP_LS_SR_TLV_RANGE:
6648
194
            break;
6649
6650
401
        case BGP_LS_SR_TLV_SRV6_LOCATOR:
6651
401
            {
6652
401
                static int * const srv6_locator_flags[] = {
6653
401
                    &hf_bgp_ls_sr_tlv_srv6_locator_flags_d,
6654
401
                    &hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved,
6655
401
                    NULL
6656
401
                };
6657
401
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_locator, tvb, offset, length+4, ENC_NA);
6658
401
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6659
401
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6660
401
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6661
401
                if (length < 8) {
6662
196
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6663
196
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes or more!",
6664
196
                                           length, "SRv6 Locator", 8);
6665
196
                    break;
6666
196
                }
6667
205
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_srv6_locator_flags,
6668
205
                                       ett_bgp_link_state, srv6_locator_flags, ENC_NA);
6669
205
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_algo, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6670
205
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6671
205
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_locator_metric, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6672
205
            }
6673
0
            break;
6674
6675
1.16k
        case BGP_LS_SR_TLV_PREFIX_ATTR_FLAGS:
6676
1.16k
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_prefix_attr_flags, tvb, offset, length+4, ENC_NA);
6677
1.16k
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6678
1.16k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6679
1.16k
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6680
1.16k
            if ((protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V2) || (protocol_id == BGP_LS_NLRI_PROTO_ID_OSPF_V3)) {
6681
                /* rfc7684, rfc9089 */
6682
407
                static int * const prefix_attr_ospf_flags[] = {
6683
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
6684
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
6685
407
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
6686
407
                    NULL
6687
407
                };
6688
407
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
6689
407
                                       ett_bgp_link_state, prefix_attr_ospf_flags, ENC_BIG_ENDIAN);
6690
754
            } else if (protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_1 ||
6691
754
                       protocol_id == BGP_LS_NLRI_PROTO_ID_IS_IS_LEVEL_2) {
6692
                /* rfc7794, rfc9088 */
6693
468
                static int * const prefix_attr_isis_flags[] = {
6694
468
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
6695
468
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
6696
468
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
6697
468
                    &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
6698
468
                    NULL
6699
468
                };
6700
468
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
6701
468
                                       ett_bgp_link_state, prefix_attr_isis_flags, ENC_BIG_ENDIAN);
6702
468
            } else {
6703
286
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
6704
286
                                    tvb, offset + 4, tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN), ENC_NA);
6705
286
                expert_add_info_format(pinfo, tlv_tree, &ei_bgp_ls_warn,
6706
286
                                       "Unknown Protocol-ID (%u) for Prefix Attribute Flags TLV",
6707
286
                                       protocol_id);
6708
286
            }
6709
1.16k
            break;
6710
6711
605
        case BGP_LS_SR_TLV_SOURCE_ROUTER_ID:
6712
605
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_source_router_id, tvb, offset, length+4, ENC_NA);
6713
605
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6714
605
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6715
605
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6716
605
            if (length == BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID) {
6717
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);
6718
411
            } else if (length == BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID) {
6719
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);
6720
217
            } else {
6721
217
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6722
217
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be either %u or %u bytes!",
6723
217
                                       length, "Source Router-ID",
6724
217
                                       BGP_NLRI_TLV_LEN_IPV4_ROUTER_ID,
6725
217
                                       BGP_NLRI_TLV_LEN_IPV6_ROUTER_ID);
6726
217
            }
6727
605
            break;
6728
6729
405
        case BGP_LS_SR_TLV_FLEX_ALGO_PREFIX_METRIC:
6730
405
            {
6731
                /* rfc9351, rfc9350 */
6732
405
                static int * const fapm_flags[] = {
6733
405
                    &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e,
6734
405
                    NULL
6735
405
                };
6736
405
                tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric, tvb, offset, length + 4, ENC_NA);
6737
405
                tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6738
405
                proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6739
405
                ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6740
405
                if (length != 8) {
6741
211
                    expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6742
211
                                           "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be 8 bytes!",
6743
211
                                           length, "Flexible Algorithm Prefix Metric");
6744
211
                    break;
6745
211
                }
6746
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_algorithm, tvb, offset + 4, 1, ENC_NA);
6747
194
                proto_tree_add_bitmask(tlv_tree, tvb, offset + 5, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags,
6748
194
                                       ett_bgp_link_state, fapm_flags, ENC_NA);
6749
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6750
194
                proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6751
194
                break;
6752
405
            }
6753
6754
        /* SID Attribute TLVs */
6755
403
        case BGP_LS_SR_TLV_SRV6_ENDPOINT_BEHAVIOR:
6756
403
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior, tvb, offset, length+4, ENC_NA);
6757
403
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6758
403
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6759
403
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6760
403
            if (length != 4) {
6761
209
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6762
209
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6763
209
                                       length, "SRv6 Endpoint Behavior", 4);
6764
209
                break;
6765
209
            }
6766
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
6767
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
6768
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo, tvb, offset + 7, 1, ENC_BIG_ENDIAN);
6769
194
            break;
6770
6771
401
        case BGP_LS_SR_TLV_SRV6_SID_STRUCT:
6772
401
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_sr_tlv_srv6_sid_struct, tvb, offset, length + 4, ENC_NA);
6773
401
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6774
401
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6775
401
            ti = proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6776
401
            if (length != 4) {
6777
207
                expert_add_info_format(pinfo, ti, &ei_bgp_ls_error,
6778
207
                                       "Unexpected TLV Length (%u) in BGP-LS %s TLV, it must be %u bytes!",
6779
207
                                       length, "SRv6 SID Structure", 4);
6780
207
                break;
6781
207
            }
6782
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len, tvb, offset + 4, 1, ENC_NA);
6783
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len, tvb, offset + 5, 1, ENC_NA);
6784
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len, tvb, offset + 6, 1, ENC_NA);
6785
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len, tvb, offset + 7, 1, ENC_NA);
6786
194
            break;
6787
6788
194
        case BGP_LS_IGP_TE_METRIC_DELAY:
6789
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay, tvb, offset, length+4, ENC_NA);
6790
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6791
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6792
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6793
194
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6794
194
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6795
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6796
194
            break;
6797
195
        case BGP_LS_IGP_TE_METRIC_DELAY_MIN_MAX:
6798
195
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_min_max, tvb, offset, length+4, ENC_NA);
6799
195
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6800
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6801
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6802
195
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6803
195
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6804
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_min, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6805
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
6806
195
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_max, tvb, offset + 9, 3, ENC_BIG_ENDIAN);
6807
195
            break;
6808
194
        case BGP_LS_IGP_TE_METRIC_DELAY_VARIATION:
6809
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_delay_variation, tvb, offset, length+4, ENC_NA);
6810
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6811
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6812
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6813
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_reserved, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6814
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_delay_variation_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6815
194
            break;
6816
194
        case BGP_LS_IGP_TE_METRIC_LOSS:
6817
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_link_loss, tvb, offset, length+4, ENC_NA);
6818
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6819
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6820
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6821
194
            proto_tree_add_bitmask(tlv_tree, tvb, offset + 4, hf_bgp_ls_igp_te_metric_flags,
6822
194
                                   ett_bgp_link_state, ls_igp_te_metric_flags, ENC_BIG_ENDIAN);
6823
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_link_loss_value, tvb, offset + 5, 3, ENC_BIG_ENDIAN);
6824
194
            break;
6825
194
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_RESIDUAL:
6826
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_residual, tvb, offset, length+4, ENC_NA);
6827
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6828
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6829
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6830
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_residual_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6831
194
            break;
6832
194
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_AVAILABLE:
6833
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_available, tvb, offset, length+4, ENC_NA);
6834
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6835
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6836
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6837
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_available_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6838
194
            break;
6839
194
        case BGP_LS_IGP_TE_METRIC_BANDWIDTH_UTILIZED:
6840
194
            tlv_item = proto_tree_add_item(tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized, tvb, offset, length+4, ENC_NA);
6841
194
            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_link_state);
6842
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_type, tvb, offset, 2, ENC_BIG_ENDIAN);
6843
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6844
194
            proto_tree_add_item(tlv_tree, hf_bgp_ls_igp_te_metric_bandwidth_utilized_value, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6845
194
            break;
6846
6847
715k
        default:
6848
715k
            expert_add_info_format(pinfo, tree, &ei_bgp_ls_warn,
6849
715k
                "Unknown BGP-LS Attribute TLV Code (%u)!", type);
6850
715k
            break;
6851
2.93M
    }
6852
2.93M
    decrement_dissection_depth(pinfo);
6853
2.93M
    return length + 4;
6854
2.93M
}
6855
6856
5.92k
static int decode_evpn_nlri_esi(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo) {
6857
5.92k
    uint8_t esi_type = 0;
6858
5.92k
    proto_tree *esi_tree;
6859
5.92k
    proto_item *ti;
6860
6861
5.92k
    ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri_esi, tvb, offset, 10, ENC_NA);
6862
5.92k
    esi_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri_esi);
6863
5.92k
    proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6864
5.92k
    esi_type = tvb_get_uint8(tvb, offset);
6865
5.92k
    proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value, tvb, offset+1, 9, ENC_NA);
6866
5.92k
    switch (esi_type) {
6867
486
        case BGP_NLRI_EVPN_ESI_VALUE :
6868
486
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_value_type0, tvb,
6869
486
                                offset+1, 9, ENC_NA);
6870
486
            break;
6871
98
        case BGP_NLRI_EVPN_ESI_LACP :
6872
98
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_lacp_mac, tvb,
6873
98
                                offset+1, 6, ENC_NA);
6874
98
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_portk, tvb,
6875
98
                                offset+7, 2, ENC_BIG_ENDIAN);
6876
98
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6877
98
                                offset+9, 1, ENC_NA);
6878
98
            break;
6879
140
        case BGP_NLRI_EVPN_ESI_MSTP :
6880
140
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rb_mac, tvb,
6881
140
                                offset+1, 6, ENC_NA);
6882
140
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_rbprio, tvb,
6883
140
                                offset+7, 2, ENC_BIG_ENDIAN);
6884
140
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6885
140
                                offset+9, 1, ENC_NA);
6886
140
            break;
6887
68
        case BGP_NLRI_EVPN_ESI_MAC :
6888
68
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_sys_mac, tvb,
6889
68
                                offset+1, 6, ENC_NA);
6890
68
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_mac_discr, tvb,
6891
68
                                offset+7, 2, ENC_NA);
6892
68
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6893
68
                                offset+9, 1, ENC_NA);
6894
68
            break;
6895
3.67k
        case BGP_NLRI_EVPN_ESI_RID :
6896
3.67k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_id, tvb,
6897
3.67k
                                offset+1, 4, ENC_BIG_ENDIAN);
6898
3.67k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_router_discr, tvb,
6899
3.67k
                                offset+5, 4, ENC_NA);
6900
3.67k
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6901
3.67k
                                offset+9, 1, ENC_NA);
6902
3.67k
            break;
6903
107
        case BGP_NLRI_EVPN_ESI_ASN :
6904
107
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn, tvb,
6905
107
                                offset+1, 4, ENC_BIG_ENDIAN);
6906
107
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_asn_discr, tvb,
6907
107
                                offset+5, 4, ENC_NA);
6908
107
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_remain, tvb,
6909
107
                                offset+9, 1, ENC_NA);
6910
107
            break;
6911
324
        case BGP_NLRI_EVPN_ESI_RES :
6912
324
            proto_tree_add_item(esi_tree, hf_bgp_evpn_nlri_esi_reserved, tvb,
6913
324
                                offset+1, 9, ENC_NA);
6914
324
            break;
6915
1.01k
        default :
6916
1.01k
            expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_esi_type_err,
6917
1.01k
                                   "Invalid EVPN ESI (%u)!", esi_type);
6918
1.01k
            return (-1);
6919
5.92k
    }
6920
4.89k
    return 0;
6921
5.92k
}
6922
6923
/*
6924
 * Decode EVPN NLRI, RFC 7432 section 7.7
6925
 */
6926
8.73k
static int decode_evpn_nlri(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo) {
6927
8.73k
    int reader_offset = offset;
6928
8.73k
    int start_offset = offset+2;
6929
8.73k
    proto_tree *prefix_tree;
6930
8.73k
    proto_item *ti;
6931
8.73k
    uint8_t route_type;
6932
8.73k
    uint8_t nlri_len;
6933
8.73k
    uint8_t ip_len;
6934
8.73k
    uint32_t total_length = 0;
6935
8.73k
    uint32_t or_length;
6936
8.73k
    path_attr_data *data = NULL;
6937
8.73k
    proto_item *item;
6938
8.73k
    int ret;
6939
6940
8.73k
    route_type = tvb_get_uint8(tvb, offset);
6941
6942
8.73k
    nlri_len = tvb_get_uint8(tvb, offset + 1);
6943
6944
8.73k
    ti = proto_tree_add_item(tree, hf_bgp_evpn_nlri, tvb, reader_offset,
6945
8.73k
                               nlri_len+2, ENC_NA);
6946
6947
8.73k
    prefix_tree = proto_item_add_subtree(ti, ett_bgp_evpn_nlri);
6948
6949
8.73k
    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rt, tvb, reader_offset,
6950
8.73k
                        1, ENC_BIG_ENDIAN);
6951
8.73k
    proto_item_append_text(ti, ": %s", val_to_str(tvb_get_uint8(tvb, offset), evpnrtypevals, "Unknown capability %d"));
6952
    /* moving to next field */
6953
8.73k
    reader_offset++;
6954
6955
8.73k
    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_len, tvb, reader_offset,
6956
8.73k
                        1, ENC_BIG_ENDIAN);
6957
8.73k
    reader_offset++;
6958
6959
8.73k
    switch (route_type) {
6960
969
    case EVPN_AD_ROUTE:
6961
    /*
6962
                +---------------------------------------+
6963
                |      RD   (8 octets)                  |
6964
                +---------------------------------------+
6965
                |Ethernet Segment Identifier (10 octets)|
6966
                +---------------------------------------+
6967
                |  Ethernet Tag ID (4 octets)           |
6968
                +---------------------------------------+
6969
                |  MPLS Label (3 octets)                |
6970
                +---------------------------------------+
6971
   */
6972
6973
969
        if (nlri_len < 25) {
6974
76
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
6975
76
                                   "Invalid length (%u) of EVPN NLRI Route Type 1 (Ethernet Auto-discovery Route)", nlri_len);
6976
76
            return -1;
6977
76
        }
6978
893
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
6979
893
                                   8, ENC_NA);
6980
893
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
6981
893
        reader_offset += 8;
6982
6983
893
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
6984
893
        reader_offset += 10;
6985
893
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
6986
893
                                   4, ENC_BIG_ENDIAN);
6987
893
        reader_offset += 4;
6988
893
        data = load_path_attr_data(pinfo);
6989
893
        if (data && data->encaps_community_present &&
6990
893
                (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
6991
440
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6992
440
            reader_offset += 3;
6993
453
        } else {
6994
453
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
6995
453
            reader_offset += 3;
6996
453
        }
6997
893
        total_length = reader_offset - offset;
6998
893
        break;
6999
7000
2.32k
    case EVPN_MAC_ROUTE:
7001
/*
7002
        +---------------------------------------+
7003
        |      RD   (8 octets)                  |
7004
        +---------------------------------------+
7005
        |Ethernet Segment Identifier (10 octets)|
7006
        +---------------------------------------+
7007
        |  Ethernet Tag ID (4 octets)           |
7008
        +---------------------------------------+
7009
        |  MAC Address Length (1 octet)         |
7010
        +---------------------------------------+
7011
        |  MAC Address (6 octets)               |
7012
        +---------------------------------------+
7013
        |  IP Address Length (1 octet)          |
7014
        +---------------------------------------+
7015
        |  IP Address (0 or 4 or 16 octets)     |
7016
        +---------------------------------------+
7017
        |  MPLS Label1 (3 octets)               |
7018
        +---------------------------------------+
7019
        |  MPLS Label2 (0 or 3 octets)          |
7020
        +---------------------------------------+
7021
7022
*/
7023
7024
2.32k
        if (nlri_len < 33) {
7025
412
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7026
412
                                   "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7027
412
            return -1;
7028
412
        }
7029
1.91k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7030
1.91k
                                   8, ENC_NA);
7031
1.91k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7032
1.91k
        reader_offset += 8;
7033
7034
1.91k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7035
1.91k
        reader_offset += 10;
7036
7037
1.91k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7038
1.91k
                            4, ENC_BIG_ENDIAN);
7039
1.91k
        reader_offset += 4;
7040
7041
1.91k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_maclen, tvb, reader_offset,
7042
1.91k
                            1, ENC_BIG_ENDIAN);
7043
1.91k
        reader_offset += 1;
7044
7045
1.91k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mac_addr, tvb, reader_offset,
7046
1.91k
                            6, ENC_NA);
7047
1.91k
        reader_offset += 6;
7048
7049
1.91k
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7050
1.91k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7051
1.91k
                            1, ENC_BIG_ENDIAN);
7052
1.91k
        reader_offset++;
7053
7054
1.91k
        if (ip_len == 4) {
7055
            /*IPv4 address*/
7056
133
            if (nlri_len < 37) {
7057
66
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7058
66
                                       "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7059
66
                return -1;
7060
66
            }
7061
67
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7062
67
                                4, ENC_BIG_ENDIAN);
7063
67
            reader_offset += 4;
7064
1.78k
        } else if (ip_len == 16) {
7065
            /*IPv6 address*/
7066
135
            if (nlri_len < 49) {
7067
69
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7068
69
                                       "Invalid length (%u) of EVPN NLRI Route Type 2 (MAC/IP Advertisement Route)", nlri_len);
7069
69
                return -1;
7070
69
            }
7071
66
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7072
66
                                16, ENC_NA);
7073
66
            reader_offset += 16;
7074
1.64k
        } else if (ip_len == 0) {
7075
            /*IP not included*/
7076
1.41k
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset-1, 1);
7077
1.41k
        } else {
7078
235
            return -1;
7079
235
        }
7080
1.54k
        data = load_path_attr_data(pinfo);
7081
1.54k
        if (data && data->encaps_community_present &&
7082
1.54k
                (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7083
648
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7084
648
            reader_offset += 3;
7085
648
            if (reader_offset - start_offset < nlri_len) {
7086
545
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7087
545
                reader_offset += 3;
7088
545
            }
7089
897
        } else {
7090
897
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls1, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7091
897
            reader_offset += 3;
7092
            /* we check if we reached the end of the nlri reading fields one by one */
7093
            /* if not, the second optional label is in the payload */
7094
897
            if (reader_offset - start_offset < nlri_len) {
7095
459
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_mpls_ls2, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7096
459
                reader_offset += 3;
7097
459
            }
7098
897
        }
7099
1.54k
        total_length = reader_offset - offset;
7100
1.54k
        break;
7101
7102
517
    case EVPN_INC_MCAST_TREE:
7103
/*
7104
        +---------------------------------------+
7105
        |      RD   (8 octets)                  |
7106
        +---------------------------------------+
7107
        |  Ethernet Tag ID (4 octets)           |
7108
        +---------------------------------------+
7109
        |  IP Address Length (1 octet)          |
7110
        +---------------------------------------+
7111
        |   Originating Router's IP Addr        |
7112
        |          (4 or 16 octets)             |
7113
        +---------------------------------------+
7114
*/
7115
7116
517
        if (nlri_len < 13) {
7117
124
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7118
124
                                   "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7119
124
            return -1;
7120
124
        }
7121
393
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7122
393
                                   8, ENC_NA);
7123
393
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7124
393
        reader_offset += 8;
7125
7126
393
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7127
393
                            4, ENC_BIG_ENDIAN);
7128
        /* move to next field */
7129
393
        reader_offset += 4;
7130
393
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7131
393
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7132
393
                            1, ENC_BIG_ENDIAN);
7133
393
        reader_offset += 1;
7134
7135
393
        if (ip_len == 4) {
7136
            /*IPv4 address*/
7137
139
            if (nlri_len < 17) {
7138
68
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7139
68
                                       "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7140
68
                return -1;
7141
68
            }
7142
71
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7143
71
                                4, ENC_BIG_ENDIAN);
7144
71
            reader_offset += 4;
7145
254
        } else if (ip_len == 16) {
7146
            /*IPv6 address*/
7147
107
            if (nlri_len < 29) {
7148
37
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7149
37
                                       "Invalid length (%u) of EVPN NLRI Route Type 3 (Inclusive Multicast Ethernet Tag Route)", nlri_len);
7150
37
                return -1;
7151
37
            }
7152
70
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7153
70
                                16, ENC_NA);
7154
70
            reader_offset += 16;
7155
147
        } else if (ip_len == 0) {
7156
            /*IP not included*/
7157
72
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
7158
75
        } else {
7159
75
            return -1;
7160
75
        }
7161
213
        total_length = reader_offset - offset;
7162
213
        break;
7163
7164
561
    case EVPN_ETH_SEGMENT_ROUTE:
7165
/*
7166
        +---------------------------------------+
7167
        |      RD   (8 octets)                  |
7168
        +---------------------------------------+
7169
        |Ethernet Segment Identifier (10 octets)|
7170
        +---------------------------------------+
7171
        |  IP Address Length (1 octet)          |
7172
        +---------------------------------------+
7173
        |   Originating Router's IP Addr        |
7174
        |          (4 or 16 octets)             |
7175
        +---------------------------------------+
7176
*/
7177
7178
561
        if (nlri_len < 19) {
7179
76
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7180
76
                                   "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7181
76
            return -1;
7182
76
        }
7183
485
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7184
485
                                   8, ENC_NA);
7185
485
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7186
485
        reader_offset += 8;
7187
7188
485
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7189
        /* move to next field */
7190
485
        reader_offset += 10;
7191
7192
485
        ip_len = tvb_get_uint8(tvb, reader_offset) / 8;
7193
485
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_iplen, tvb, reader_offset,
7194
485
                            1, ENC_BIG_ENDIAN);
7195
485
        reader_offset++;
7196
7197
485
        if (ip_len == 4) {
7198
            /*IPv4 address*/
7199
146
            if (nlri_len < 23) {
7200
79
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7201
79
                                       "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7202
79
                return -1;
7203
79
            }
7204
67
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7205
67
                                4, ENC_BIG_ENDIAN);
7206
67
            reader_offset += 4;
7207
339
        } else if (ip_len == 16) {
7208
            /*IPv6 address*/
7209
140
            if (nlri_len < 35) {
7210
73
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7211
73
                                       "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7212
73
                return -1;
7213
73
            }
7214
67
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7215
67
                                16, ENC_NA);
7216
67
            reader_offset += 16;
7217
199
        } else if (ip_len == 0) {
7218
            /*IP not included*/
7219
72
            proto_tree_add_expert(prefix_tree, pinfo, &ei_bgp_evpn_nlri_rt4_no_ip, tvb, reader_offset, 1);
7220
127
        } else {
7221
127
            return -1;
7222
127
        }
7223
206
        total_length = reader_offset - offset;
7224
206
        break;
7225
2.47k
    case EVPN_IP_PREFIX_ROUTE:
7226
7227
/*
7228
    +---------------------------------------+
7229
    |      RD   (8 octets)                  |
7230
    +---------------------------------------+
7231
    |Ethernet Segment Identifier (10 octets)|
7232
    +---------------------------------------+
7233
    |  Ethernet Tag ID (4 octets)           |
7234
    +---------------------------------------+
7235
    |  IP Prefix Length (1 octet)           |
7236
    +---------------------------------------+
7237
    |  IP Prefix (4 or 16 octets)           |
7238
    +---------------------------------------+
7239
    |  GW IP Address (4 or 16 octets)       |
7240
    +---------------------------------------+
7241
    |  MPLS Label (3 octets)                |
7242
    +---------------------------------------+
7243
*/
7244
7245
2.47k
        if (nlri_len < 26) {
7246
299
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7247
299
                                   "Invalid length (%u) of EVPN NLRI Route Type 4 (Ethernet Segment Route)", nlri_len);
7248
299
            return -1;
7249
299
        }
7250
2.17k
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7251
2.17k
                                   8, ENC_NA);
7252
2.17k
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7253
2.17k
        reader_offset += 8;
7254
7255
2.17k
        decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7256
2.17k
        reader_offset += 10;
7257
7258
2.17k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7259
2.17k
                            4, ENC_BIG_ENDIAN);
7260
2.17k
        reader_offset += 4;
7261
7262
2.17k
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_prefix_len, tvb, reader_offset,
7263
2.17k
                            1, ENC_BIG_ENDIAN);
7264
2.17k
        reader_offset++;
7265
7266
2.17k
        switch (nlri_len) {
7267
1.38k
            case 34 :
7268
                /* IPv4 address */
7269
1.38k
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ip_addr, tvb, reader_offset,
7270
1.38k
                                    4, ENC_BIG_ENDIAN);
7271
1.38k
                reader_offset += 4;
7272
7273
1.38k
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv4_gtw, tvb, reader_offset,
7274
1.38k
                                    4, ENC_BIG_ENDIAN);
7275
1.38k
                reader_offset += 4;
7276
7277
1.38k
                data = load_path_attr_data(pinfo);
7278
1.38k
                if (data && data->encaps_community_present &&
7279
1.38k
                        (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7280
388
                    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7281
1.00k
                } else {
7282
1.00k
                    decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
7283
1.00k
                }
7284
1.38k
                total_length = 36;
7285
1.38k
                break;
7286
289
            case 58 :
7287
                /* IPv6 address */
7288
289
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_addr, tvb, reader_offset,
7289
289
                                    16, ENC_NA);
7290
289
                reader_offset += 16;
7291
7292
289
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_ipv6_gtw, tvb, reader_offset,
7293
289
                                    16, ENC_NA);
7294
289
                reader_offset += 16;
7295
7296
289
                data = load_path_attr_data(pinfo);
7297
289
                if (data && data->encaps_community_present &&
7298
289
                        (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
7299
132
                    proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_vni, tvb, reader_offset, 3, ENC_BIG_ENDIAN);
7300
157
                } else {
7301
157
                    decode_MPLS_stack_tree(tvb, reader_offset, prefix_tree);
7302
157
                }
7303
289
                total_length = 60;
7304
289
                break;
7305
469
            default :
7306
469
                expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7307
469
                                       "Invalid length (%u) of EVPN NLRI Route Type 5 (IP Prefix Route)", nlri_len);
7308
469
                return -1;
7309
2.17k
        }
7310
1.57k
        break;
7311
7312
1.57k
    case EVPN_MC_ETHER_TAG_ROUTE:
7313
694
    case EVPN_IGMP_JOIN_ROUTE:
7314
1.10k
    case EVPN_IGMP_LEAVE_ROUTE:
7315
1.42k
    case EVPN_S_PMSI_A_D_ROUTE:
7316
/*
7317
          +---------------------------------------+
7318
          |  RD (8 octets)                        |
7319
          +---------------------------------------+
7320
          |  Ethernet Tag ID (4 octets)           |
7321
          +---------------------------------------+
7322
          |  Multicast Source Length (1 octet)    |
7323
          +---------------------------------------+
7324
          |  Multicast Source Address (variable)  |
7325
          +---------------------------------------+
7326
          |  Multicast Group Length (1 octet)     |
7327
          +---------------------------------------+
7328
          |  Multicast Group Address (Variable)   |
7329
          +---------------------------------------+
7330
          |  Originator Router Length (1 octet)   |
7331
          +---------------------------------------+
7332
          |  Originator Router Address (variable) |
7333
          +---------------------------------------+
7334
          |  Flags (1 octets) (optional)          |
7335
          +---------------------------------------+
7336
7337
          +--------------------------------------------------+
7338
          |  RD (8 octets)                                   |
7339
          +--------------------------------------------------+
7340
          |  Ethernet Segment Identifier (10 octets)         |
7341
          +--------------------------------------------------+
7342
          |  Ethernet Tag ID  (4 octets)                     |
7343
          +--------------------------------------------------+
7344
          |  Multicast Source Length (1 octet)               |
7345
          +--------------------------------------------------+
7346
          |  Multicast Source Address (variable)             |
7347
          +--------------------------------------------------+
7348
          |  Multicast Group Length (1 octet)                |
7349
          +--------------------------------------------------+
7350
          |  Multicast Group Address (Variable)              |
7351
          +--------------------------------------------------+
7352
          |  Originator Router Length (1 octet)              |
7353
          +--------------------------------------------------+
7354
          |  Originator Router Address (variable)            |
7355
          +--------------------------------------------------+
7356
          |  Flags (1 octet)                                 |
7357
          +--------------------------------------------------+
7358
7359
          +--------------------------------------------------+
7360
          |  RD (8 octets)                                   |
7361
          +--------------------------------------------------+
7362
          |  Ethernet Segment Identifier (10 octets)         |
7363
          +--------------------------------------------------+
7364
          |  Ethernet Tag ID  (4 octets)                     |
7365
          +--------------------------------------------------+
7366
          |  Multicast Source Length (1 octet)               |
7367
          +--------------------------------------------------+
7368
          |  Multicast Source Address (variable)             |
7369
          +--------------------------------------------------+
7370
          |  Multicast Group Length (1 octet)                |
7371
          +--------------------------------------------------+
7372
          |  Multicast Group Address (Variable)              |
7373
          +--------------------------------------------------+
7374
          |  Originator Router Length (1 octet)              |
7375
          +--------------------------------------------------+
7376
          |  Originator Router Address (variable)            |
7377
          +--------------------------------------------------+
7378
          |  Reserved (4 octets)                             |
7379
          +--------------------------------------------------+
7380
          |  Maximum Response Time (1 octet)                 |
7381
          +--------------------------------------------------+
7382
          |  Flags (1 octet)                                 |
7383
          +--------------------------------------------------+
7384
*/
7385
7386
1.42k
        if (nlri_len < 15) {
7387
443
            expert_add_info_format(pinfo, prefix_tree, &ei_bgp_evpn_nlri_rt_len_err,
7388
443
                                   "Invalid length (%u) of EVPN NLRI Route Type %u", nlri_len, route_type);
7389
443
            return -1;
7390
443
        }
7391
980
        item = proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_rd, tvb, reader_offset,
7392
980
                                   8, ENC_NA);
7393
980
        proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7394
980
        reader_offset += 8;
7395
7396
980
        if (route_type == EVPN_IGMP_JOIN_ROUTE || route_type == EVPN_IGMP_LEAVE_ROUTE) {
7397
469
            decode_evpn_nlri_esi(prefix_tree, tvb, reader_offset, pinfo);
7398
469
            reader_offset += 10;
7399
469
        }
7400
7401
980
        proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_etag, tvb, reader_offset,
7402
980
                            4, ENC_BIG_ENDIAN);
7403
980
        reader_offset += 4;
7404
7405
980
        ret = decode_mcast_vpn_nlri_addresses(prefix_tree, tvb, reader_offset);
7406
980
        if (ret < 0)
7407
541
            return -1;
7408
7409
439
        reader_offset = ret;
7410
439
        proto_tree_add_item_ret_uint(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_length, tvb,
7411
439
                                     reader_offset, 1, ENC_BIG_ENDIAN, &or_length);
7412
439
        reader_offset += 1;
7413
439
        switch(or_length) {
7414
47
            case 32:
7415
47
                proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4, tvb,
7416
47
                                    reader_offset, 4, ENC_BIG_ENDIAN);
7417
47
                reader_offset += 4;
7418
47
                break;
7419
159
            case 128:
7420
159
                 proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6, tvb,
7421
159
                                     reader_offset, 16, ENC_NA);
7422
159
                 reader_offset += 16;
7423
159
                 break;
7424
439
        }
7425
7426
378
        if (route_type == EVPN_IGMP_LEAVE_ROUTE) {
7427
87
            proto_tree_add_item(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_reserved, tvb,
7428
87
                                reader_offset, 4, ENC_NA);
7429
87
            reader_offset += 4;
7430
7431
            /* Maximum Response Time, per RFC2236 (IGMPv2)
7432
             * XXX - What if this is the max response time from RFC3376 (IGMPv3)?
7433
             */
7434
87
            uint8_t tsecs = tvb_get_uint8(tvb, offset);
7435
87
            proto_tree_add_uint_format_value(prefix_tree, hf_bgp_evpn_nlri_igmp_mc_max_resp_time, tvb,
7436
87
                                             reader_offset, 1, tsecs, "%.1f sec (0x%02x)", tsecs*0.1, tsecs);
7437
7438
87
            reader_offset += 1;
7439
87
        }
7440
7441
378
        if (reader_offset - start_offset < nlri_len) {
7442
291
            proto_tree_add_bitmask(prefix_tree, tvb, reader_offset, hf_bgp_evpn_nlri_igmp_mc_flags,
7443
291
                                   ett_bgp_evpn_nlri_mc, evpn_nlri_igmp_mc_flags, ENC_BIG_ENDIAN);
7444
291
            reader_offset += 1;
7445
291
        }
7446
378
        total_length = reader_offset - offset;
7447
378
        break;
7448
7449
462
    default:
7450
462
        expert_add_info_format(pinfo, tree, &ei_bgp_evpn_nlri_rt_type_err,
7451
462
                               "Invalid EVPN Route Type (%u)", route_type);
7452
462
        return -1;
7453
8.73k
    }
7454
7455
4.60k
    return total_length;
7456
8.73k
}
7457
7458
1.07k
static int decode_bgp_mup_nlri_variable_prefix(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, uint16_t afi) {
7459
7460
1.07k
    int reader_offset = offset;
7461
1.07k
    uint32_t total_length = 0;
7462
7463
1.07k
    int         byte_length;
7464
1.07k
    ws_in4_addr ipv4_prefix;
7465
1.07k
    address     ipv4_prefix_addr;
7466
1.07k
    ws_in6_addr ipv6_prefix;
7467
1.07k
    address     ipv6_prefix_addr;
7468
1.07k
    char        *prefix_str;
7469
1.07k
    uint8_t     prefix_length;
7470
7471
1.07k
    prefix_length = tvb_get_uint8(tvb, reader_offset);
7472
1.07k
    proto_tree_add_item(tree, hf_bgp_mup_nlri_prefixlen, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7473
1.07k
    reader_offset++;
7474
7475
1.07k
    switch (afi) {
7476
778
    case AFNUM_INET:
7477
778
        byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &ipv4_prefix, prefix_length);
7478
778
        if (byte_length == -1) {
7479
119
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, reader_offset, -1,
7480
119
                                         "IPv4 prefix has an invalid length: %d bits", prefix_length);
7481
119
            return -1;
7482
119
        }
7483
659
        set_address(&ipv4_prefix_addr, AT_IPv4, 4, &ipv4_prefix);
7484
659
        prefix_str = address_to_str(pinfo->pool, &ipv4_prefix_addr);
7485
659
        proto_tree_add_ipv4_format_value(tree, hf_bgp_mup_nlri_ip_prefix, tvb, reader_offset, byte_length,
7486
659
                                         ipv4_prefix, "%s/%d", prefix_str, prefix_length);
7487
659
        reader_offset += byte_length;
7488
659
        break;
7489
7490
288
    case AFNUM_INET6:
7491
288
        byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, reader_offset, &ipv6_prefix, prefix_length);
7492
288
        if (byte_length == -1) {
7493
72
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, reader_offset, -1,
7494
72
                                         "IPv6 prefix has an invalid length: %d bits", prefix_length);
7495
72
            return -1;
7496
72
        }
7497
216
        set_address(&ipv6_prefix_addr, AT_IPv6, 16, ipv6_prefix.bytes);
7498
216
        prefix_str = address_to_str(pinfo->pool, &ipv6_prefix_addr);
7499
216
        proto_tree_add_ipv6_format_value(tree, hf_bgp_mup_nlri_ipv6_prefix, tvb, reader_offset, byte_length,
7500
216
                                         &ipv6_prefix, "%s/%d", prefix_str, prefix_length);
7501
216
        reader_offset += byte_length;
7502
216
        break;
7503
1.07k
    }
7504
875
    total_length = reader_offset - offset;
7505
875
    return total_length;
7506
1.07k
}
7507
7508
7509
static int decode_bgp_mup_nlri_type1_st_route(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
7510
436
                                              uint16_t afi, uint8_t architecture_type) {
7511
    /*
7512
        +-----------------------------------+
7513
        |           RD  (8 octets)          |
7514
        +-----------------------------------+
7515
        |      Prefix Length (1 octet)      |
7516
        +-----------------------------------+
7517
        |         Prefix (variable)         |
7518
        +-----------------------------------+
7519
        | Architecture specific (variable)  |
7520
        +-----------------------------------+
7521
    */
7522
436
    int reader_offset = offset;
7523
436
    uint32_t total_length = 0;
7524
7525
436
    proto_item  *item;
7526
436
    uint8_t     endpoint_address_length;
7527
436
    uint8_t     source_address_length;
7528
436
    proto_item  *arch_spec_item;
7529
436
    proto_tree  *arch_spec_tree;
7530
436
    int         arch_spec_byte;
7531
7532
436
    item = proto_tree_add_item(tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7533
436
    proto_item_append_text(item, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7534
436
    reader_offset += 8;
7535
7536
436
    reader_offset += decode_bgp_mup_nlri_variable_prefix(tree, tvb, reader_offset, pinfo, afi);
7537
7538
436
    switch (architecture_type) {
7539
346
    case BGP_MUP_AT_3GPP_5G:
7540
        /*
7541
            +-----------------------------------1
7542
            |          TEID (4 octets)          |
7543
            +-----------------------------------+
7544
            |          QFI (1 octet)            |
7545
            +-----------------------------------+
7546
            | Endpoint Address Length (1 octet) |
7547
            +-----------------------------------+
7548
            |    Endpoint Address (variable)    |
7549
            +-----------------------------------+
7550
            |  Source Address Length (1 octet)  |
7551
            +-----------------------------------+
7552
            |     Source Address (variable)     |
7553
            +-----------------------------------+
7554
        */
7555
346
        endpoint_address_length = tvb_get_uint8(tvb, reader_offset+5); // should be multiple of 8
7556
346
        arch_spec_byte = 7 + endpoint_address_length/8;
7557
7558
346
        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);
7559
346
        arch_spec_tree = proto_item_add_subtree(arch_spec_item, ett_bgp_mup_nlri_3gpp_5g_type1_st_route);
7560
7561
346
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_teid, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7562
346
        reader_offset += 4;
7563
7564
346
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_qfi, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7565
346
        reader_offset++;
7566
7567
346
        proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_addr_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7568
346
        reader_offset++;
7569
7570
346
        if (endpoint_address_length==32) {
7571
179
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7572
179
            reader_offset += 4;
7573
179
        } else if (endpoint_address_length==128) {
7574
39
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7575
39
            reader_offset += 16;
7576
128
        } else {
7577
128
            expert_add_info_format(pinfo, arch_spec_tree, &ei_bgp_mup_nlri_addr_len_err,
7578
128
                                   "Invalid length (%u) of Endpoint Address Length", endpoint_address_length);
7579
128
            return -1;
7580
128
        }
7581
218
        source_address_length = tvb_get_uint8(tvb, reader_offset); // should be zero or multiple of 8
7582
218
        reader_offset++;
7583
218
        if (source_address_length==32) {
7584
81
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7585
81
            reader_offset += 4;
7586
137
        } else if (source_address_length==128) {
7587
34
            proto_tree_add_item(arch_spec_tree, hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7588
34
            reader_offset += 16;
7589
103
        } else {
7590
103
            expert_add_info_format(pinfo, arch_spec_tree, &ei_bgp_mup_nlri_addr_len_err,
7591
103
                                   "Invalid length (%u) of Source Address Length", source_address_length);
7592
103
            return -1;
7593
103
        }
7594
115
        break;
7595
115
    default:
7596
        /* return error because the length is unknown */
7597
87
        proto_tree_add_expert_format(tree, pinfo, &ei_bgp_mup_unknown_at, tvb, reader_offset, -1,
7598
87
                                     "Architecture specific type 1 ST route for unknown architecture type: %d", architecture_type);
7599
87
        return -1;
7600
436
    }
7601
7602
108
    total_length = reader_offset - offset;
7603
108
    return total_length;
7604
436
}
7605
7606
static int decode_bgp_mup_nlri_type2_st_route(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
7607
1.11k
                                              uint16_t afi, uint8_t architecture_type) {
7608
    /*
7609
        +-----------------------------------+
7610
        |           RD  (8 octets)          |
7611
        +-----------------------------------+
7612
        |      Endpoint Length (1 octet)    |
7613
        +-----------------------------------+
7614
        |      Endpoint Address (variable)  |
7615
        +-----------------------------------+
7616
        | Architecture specific Endpoint    |
7617
        |         Identifier (variable)     |
7618
        +-----------------------------------+
7619
    */
7620
1.11k
    int reader_offset = offset;
7621
1.11k
    uint32_t total_length = 0;
7622
7623
1.11k
    proto_item  *rd_pi;
7624
1.11k
    int         byte_length = 0;
7625
1.11k
    ws_in4_addr ipv4_prefix;
7626
1.11k
    address     ipv4_prefix_addr;
7627
1.11k
    ws_in6_addr ipv6_prefix;
7628
1.11k
    address     ipv6_prefix_addr;
7629
1.11k
    char        *prefix_str;
7630
1.11k
    uint8_t     prefix_length = 0;
7631
1.11k
    uint8_t     endpoint_length = 0;
7632
7633
1.11k
    uint8_t     arch_spec_endpoint_length = 0;
7634
1.11k
    proto_item  *arch_spec_item;
7635
1.11k
    proto_tree  *arch_spec_tree;
7636
1.11k
    uint32_t    arch_spec_3gpp_5g_teid;
7637
7638
1.11k
    rd_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7639
1.11k
    proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7640
1.11k
    reader_offset += 8;
7641
7642
1.11k
    endpoint_length = tvb_get_uint8(tvb, reader_offset);
7643
1.11k
    proto_tree_add_item(tree, hf_bgp_mup_nlri_ep_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7644
1.11k
    reader_offset++;
7645
7646
1.11k
    switch (afi) {
7647
615
    case AFNUM_INET:
7648
615
        prefix_length = endpoint_length>32 ? 32 : endpoint_length;
7649
615
        byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &ipv4_prefix, prefix_length);
7650
615
        set_address(&ipv4_prefix_addr, AT_IPv4, 4, &ipv4_prefix);
7651
615
        prefix_str = address_to_str(pinfo->pool, &ipv4_prefix_addr);
7652
7653
615
        proto_tree_add_ipv4_format_value(tree, hf_bgp_mup_nlri_ep_ip_addr, tvb, reader_offset, byte_length,
7654
615
                                         ipv4_prefix, "%s/%d", prefix_str, prefix_length);
7655
615
        reader_offset += byte_length;
7656
7657
615
        if (endpoint_length>32) {
7658
243
            arch_spec_endpoint_length = endpoint_length - 32;
7659
243
        }
7660
615
        break;
7661
487
    case AFNUM_INET6:
7662
487
        prefix_length = endpoint_length>128 ? 128 : endpoint_length;
7663
487
        byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, reader_offset, &ipv6_prefix, prefix_length);
7664
487
        set_address(&ipv6_prefix_addr, AT_IPv6, 16, ipv6_prefix.bytes);
7665
487
        prefix_str = address_to_str(pinfo->pool, &ipv6_prefix_addr);
7666
7667
487
        proto_tree_add_ipv6_format_value(tree, hf_bgp_mup_nlri_ep_ipv6_addr, tvb, reader_offset, byte_length,
7668
487
                        &ipv6_prefix, "%s/%d", prefix_str, prefix_length);
7669
487
        reader_offset += byte_length;
7670
7671
487
        if (endpoint_length>128) {
7672
259
            arch_spec_endpoint_length = endpoint_length - 128;
7673
259
        }
7674
487
        break;
7675
1.11k
    }
7676
1.07k
    if (arch_spec_endpoint_length>0) {
7677
502
        switch (architecture_type) {
7678
45
        case BGP_MUP_AT_3GPP_5G:
7679
            /*
7680
            +-----------------------------------+
7681
            |          TEID (0-4 octets)        |
7682
            +-----------------------------------+
7683
            */
7684
45
            byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, reader_offset, &arch_spec_3gpp_5g_teid, arch_spec_endpoint_length);
7685
7686
45
            arch_spec_item = proto_tree_add_item(tree, hf_bgp_mup_nlri_3gpp_5g_type2_st_route, tvb, reader_offset, byte_length, ENC_NA);
7687
45
            arch_spec_tree = proto_item_add_subtree(arch_spec_item, ett_bgp_mup_nlri_3gpp_5g_type2_st_route);
7688
45
            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,
7689
45
                                            "0x%08x/%d", g_ntohl(arch_spec_3gpp_5g_teid), arch_spec_endpoint_length);
7690
45
            reader_offset += byte_length;
7691
45
            break;
7692
457
        default:
7693
            /* for unknown architecture types, just decode as binary */
7694
457
            byte_length = (arch_spec_endpoint_length-1)/8 + 1;
7695
457
            proto_tree_add_item(tree, hf_bgp_mup_nlri_unknown_data, tvb, reader_offset, byte_length, ENC_NA);
7696
457
            reader_offset += byte_length;
7697
7698
457
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_mup_unknown_at, tvb, reader_offset, -1,
7699
457
                                         "Architecture specific type 2 ST route for unknown architecture type: %d", architecture_type);
7700
457
            break;
7701
502
        }
7702
502
    }
7703
7704
1.05k
    total_length = reader_offset - offset;
7705
1.05k
    return total_length;
7706
1.07k
}
7707
7708
/* draft-mpmz-bess-mup-safi-00 */
7709
3.20k
static int decode_bgp_mup_nlri(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, uint16_t afi) {
7710
7711
3.20k
    int reader_offset = offset;
7712
7713
3.20k
    proto_tree *prefix_tree;
7714
3.20k
    proto_item *nlri_pi;
7715
3.20k
    proto_item *rd_pi;
7716
3.20k
    uint8_t architecture_type;
7717
3.20k
    uint16_t route_type;
7718
3.20k
    uint8_t nlri_len;
7719
7720
3.20k
    int decoded_length = 0;
7721
7722
3.20k
    architecture_type = tvb_get_uint8(tvb, offset);
7723
3.20k
    route_type = tvb_get_uint16(tvb, offset + 1, ENC_BIG_ENDIAN);
7724
3.20k
    nlri_len = tvb_get_uint8(tvb, offset + 3);
7725
7726
3.20k
    nlri_pi = proto_tree_add_item(tree, hf_bgp_mup_nlri, tvb, reader_offset, nlri_len+4, ENC_NA);
7727
7728
3.20k
    prefix_tree = proto_item_add_subtree(nlri_pi, ett_bgp_mup_nlri);
7729
7730
3.20k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_at, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7731
3.20k
    proto_item_append_text(nlri_pi, ": %s", val_to_str(architecture_type, bgp_mup_architecture_types,
7732
3.20k
                           "Unknown architecture type %d"));
7733
3.20k
    reader_offset++;
7734
7735
3.20k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rt, tvb, reader_offset, 2, ENC_BIG_ENDIAN);
7736
3.20k
    proto_item_append_text(nlri_pi, ": %s", val_to_str(route_type, bgp_mup_route_types,
7737
3.20k
                           "Unknown route type %d"));
7738
3.20k
    reader_offset += 2;
7739
7740
3.20k
    proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_len, tvb, reader_offset, 1, ENC_BIG_ENDIAN);
7741
3.20k
    reader_offset++;
7742
7743
3.20k
    switch (route_type) {
7744
648
    case BGP_MUP_RT_INTERWORK_SEGMENT_DISCOVERY:
7745
        /*
7746
         +-----------------------------------+
7747
         |           RD  (8 octets)          |
7748
         +-----------------------------------+
7749
         |       Prefix Length (1 octet)     |
7750
         +-----------------------------------+
7751
         |        Prefix (variable)          |
7752
         +-----------------------------------+
7753
        */
7754
648
        rd_pi = proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7755
648
        proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7756
648
        reader_offset += 8;
7757
7758
648
        decoded_length = decode_bgp_mup_nlri_variable_prefix(prefix_tree, tvb, reader_offset, pinfo, afi);
7759
648
        if (decoded_length < 0) {
7760
66
            return -1;
7761
66
        }
7762
582
        break;
7763
7764
582
    case BGP_MUP_RT_DIRECT_SEGMENT_DISCOVERY:
7765
        /*
7766
         +-----------------------------------+
7767
         |           RD  (8 octets)          |
7768
         +-----------------------------------+
7769
         |        Address (4 or 16 octets)   |
7770
         +-----------------------------------+
7771
        */
7772
392
        rd_pi = proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_rd, tvb, reader_offset, 8, ENC_NA);
7773
392
        proto_item_append_text(rd_pi, " (%s)", decode_bgp_rd(pinfo->pool, tvb, reader_offset));
7774
392
        reader_offset += 8;
7775
392
        switch (afi) {
7776
198
        case AFNUM_INET:
7777
198
            proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_ip_addr, tvb, reader_offset, 4, ENC_BIG_ENDIAN);
7778
198
            break;
7779
194
        case AFNUM_INET6:
7780
194
            proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_ipv6_addr, tvb, reader_offset, 16, ENC_NA);
7781
194
            break;
7782
392
        }
7783
376
        break;
7784
7785
436
    case BGP_MUP_RT_TYPE_1_SESSION_TRANSFORMED:
7786
436
        decoded_length = decode_bgp_mup_nlri_type1_st_route(prefix_tree, tvb, reader_offset, pinfo, afi, architecture_type);
7787
436
        if (decoded_length < 0) {
7788
307
            return -1;
7789
307
        }
7790
129
        break;
7791
7792
1.11k
    case BGP_MUP_RT_TYPE_2_SESSION_TRANSFORMED:
7793
1.11k
        decoded_length = decode_bgp_mup_nlri_type2_st_route(prefix_tree, tvb, reader_offset, pinfo, afi, architecture_type);
7794
1.11k
        if (decoded_length < 0) {
7795
0
            return -1;
7796
0
        }
7797
1.11k
        break;
7798
7799
1.11k
    default:
7800
        /* for unknown route types, just decode as binary */
7801
589
        proto_tree_add_item(prefix_tree, hf_bgp_mup_nlri_unknown_data, tvb, reader_offset, nlri_len, ENC_NA);
7802
589
        reader_offset += nlri_len;
7803
589
        proto_tree_add_expert_format(prefix_tree, pinfo, &ei_bgp_mup_unknown_rt, tvb, reader_offset, -1,
7804
589
                                     "Unknown route type: %d", route_type);
7805
589
        break;
7806
3.20k
    }
7807
7808
2.67k
    return nlri_len+4;
7809
3.20k
}
7810
7811
7812
/*
7813
 * Decode a multiprotocol prefix
7814
 */
7815
static int
7816
decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
7817
                 uint16_t afi, uint8_t safi, int tlen, tvbuff_t *tvb, int offset,
7818
                 const char *tag, packet_info *pinfo)
7819
42.6k
{
7820
42.6k
    int                 start_offset = offset;
7821
42.6k
    proto_item          *ti;
7822
42.6k
    proto_tree          *prefix_tree;
7823
42.6k
    proto_item          *nlri_ti;
7824
42.6k
    proto_tree          *nlri_tree;
7825
42.6k
    proto_item          *disting_item;
7826
42.6k
    proto_tree          *disting_tree;
7827
7828
42.6k
    int                 total_length=0;     /* length of the entire item */
7829
42.6k
    int                 length;             /* length of the prefix address, in bytes */
7830
42.6k
    int                 tmp_length;
7831
42.6k
    unsigned            plen;               /* length of the prefix address, in bits */
7832
42.6k
    unsigned            labnum;             /* number of labels             */
7833
42.6k
    uint16_t            tnl_id;             /* Tunnel Identifier */
7834
42.6k
    ws_in4_addr         ip4addr;            /* IPv4 address                 */
7835
42.6k
    address addr;
7836
42.6k
    ws_in6_addr         ip6addr;            /* IPv6 address                 */
7837
42.6k
    uint16_t            nlri_type;          /* NLRI Type                    */
7838
42.6k
    uint16_t            tmp16;
7839
42.6k
    uint32_t            path_identifier=0;
7840
42.6k
    int                 end=0;              /* Message End                  */
7841
7842
42.6k
    wmem_strbuf_t      *stack_strbuf;       /* label stack                  */
7843
42.6k
    wmem_strbuf_t      *comm_strbuf;
7844
7845
42.6k
    switch (afi) {
7846
7847
13.9k
    case AFNUM_INET:
7848
13.9k
        switch (safi) {
7849
7850
532
            case SAFNUM_UNICAST:
7851
1.12k
            case SAFNUM_MULCAST:
7852
1.56k
            case SAFNUM_UNIMULC:
7853
                /* parse each prefix */
7854
7855
1.56k
                end = offset + tlen;
7856
7857
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
7858
1.56k
                if( detect_add_path_prefix4(tvb, offset, end) ) {
7859
                    /* IPv4 prefixes with Path Id */
7860
323
                    total_length = decode_path_prefix4(tree, pinfo, hf_path_id, hf_addr4, tvb, offset, tag);
7861
1.23k
                } else {
7862
1.23k
                    total_length = decode_prefix4(tree, pinfo, NULL,hf_addr4, tvb, offset, tag);
7863
1.23k
                }
7864
1.56k
                if (total_length < 0)
7865
71
                    return -1;
7866
1.49k
                break;
7867
7868
1.49k
            case SAFNUM_MPLS_LABEL:
7869
607
                end = offset + tlen;
7870
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
7871
607
                if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
7872
                    /* snarf path identifier */
7873
164
                    path_identifier = tvb_get_ntohl(tvb, offset);
7874
164
                    offset += 4;
7875
164
                    total_length += 4;
7876
164
                }
7877
                /* snarf length */
7878
607
                plen =  tvb_get_uint8(tvb, offset);
7879
607
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
7880
607
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
7881
7882
607
                offset += (1 + labnum * 3);
7883
607
                if (plen < (labnum * 3*8)) {
7884
263
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
7885
263
                                        "%s Labeled IPv4 prefix length %u invalid",
7886
263
                                        tag, plen);
7887
263
                    return -1;
7888
263
                }
7889
344
                plen -= (labnum * 3*8);
7890
344
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
7891
344
                if (length < 0) {
7892
72
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
7893
72
                                        "%s Labeled IPv4 prefix length %u invalid",
7894
72
                                        tag, plen + (labnum * 3*8));
7895
72
                    return -1;
7896
72
                }
7897
7898
272
                set_address(&addr, AT_IPv4, 4, &ip4addr);
7899
272
                if (total_length > 0) {
7900
109
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
7901
109
                                         (offset + length) - start_offset,
7902
109
                                         ett_bgp_prefix, NULL,
7903
109
                                         "Label Stack=%s IPv4=%s/%u PathID %u",
7904
109
                                         wmem_strbuf_get_str(stack_strbuf),
7905
109
                                         address_to_str(pinfo->pool, &addr), plen, path_identifier);
7906
109
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
7907
109
                    start_offset += 4;
7908
163
                } else {
7909
163
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
7910
163
                                        (offset + length) - start_offset,
7911
163
                                        ett_bgp_prefix, NULL,
7912
163
                                        "Label Stack=%s IPv4=%s/%u",
7913
163
                                        wmem_strbuf_get_str(stack_strbuf),
7914
163
                                        address_to_str(pinfo->pool, &addr), plen);
7915
163
                }
7916
272
                proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
7917
272
                                        "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
7918
272
                proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
7919
272
                                        "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
7920
272
                total_length += (1 + labnum*3) + length;
7921
272
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
7922
272
                break;
7923
3.86k
            case SAFNUM_MCAST_VPN:
7924
3.86k
                total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
7925
3.86k
                if (total_length < 0)
7926
334
                    return -1;
7927
3.52k
                break;
7928
3.52k
            case SAFNUM_MDT:
7929
346
                total_length = decode_mdt_safi(pinfo, tree, tvb, offset);
7930
346
                if (total_length < 0)
7931
212
                    return -1;
7932
134
                break;
7933
897
            case SAFNUM_ROUTE_TARGET:
7934
897
                plen = tvb_get_uint8(tvb, offset);
7935
7936
897
                if (plen == 0) {
7937
400
                    proto_tree_add_string(tree, hf_bgp_wildcard_route_target, tvb, offset, 1, tag);
7938
400
                    total_length = 1;
7939
400
                    break;
7940
400
                }
7941
7942
497
                if ((plen < 32) || (plen > 96)) {
7943
129
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
7944
129
                                        "%s Route target length %u invalid",
7945
129
                                        tag, plen);
7946
129
                    return -1;
7947
129
                }
7948
7949
368
                length = (plen + 7)/8;
7950
368
                comm_strbuf = wmem_strbuf_create(pinfo->pool);
7951
7952
368
                switch (tvb_get_ntohs(tvb, offset + 1 + 4)) {
7953
66
                case BGP_EXT_COM_RT_AS2:
7954
66
                    wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
7955
66
                                              tvb_get_ntohs(tvb, offset + 1 + 6),
7956
66
                                              tvb_get_ntohl(tvb, offset + 1 + 8));
7957
66
                    break;
7958
80
                case BGP_EXT_COM_RT_IP4:
7959
80
                    wmem_strbuf_append_printf(comm_strbuf, "%s:%u",
7960
80
                                              tvb_ip_to_str(pinfo->pool, tvb, offset + 1 + 6),
7961
80
                                              tvb_get_ntohs(tvb, offset + 1 + 10));
7962
80
                    break;
7963
66
                case BGP_EXT_COM_RT_AS4:
7964
66
                    wmem_strbuf_append_printf(comm_strbuf, "%u:%u",
7965
66
                                              tvb_get_ntohl(tvb, 6),
7966
66
                                              tvb_get_ntohs(tvb, offset + 1 + 10));
7967
66
                    break;
7968
129
                default:
7969
129
                    wmem_strbuf_append_printf(comm_strbuf, "Invalid RT type");
7970
129
                    break;
7971
368
                }
7972
320
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, offset + 1, length,
7973
320
                                    ett_bgp_prefix, NULL, "%s %u:%s/%u",
7974
320
                                    tag, tvb_get_ntohl(tvb, offset + 1 + 0),
7975
320
                                    wmem_strbuf_get_str(comm_strbuf),
7976
320
                                    plen);
7977
320
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN);
7978
320
                proto_tree_add_item(prefix_tree, hf_bgp_originating_as, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
7979
320
                proto_tree_add_string(prefix_tree, hf_bgp_community_prefix, tvb, offset + 1 + 4, length - 4, wmem_strbuf_get_str(comm_strbuf));
7980
320
                total_length = 1 + length;
7981
320
                break;
7982
262
            case SAFNUM_ENCAPSULATION:
7983
262
                plen =  tvb_get_uint8(tvb, offset);
7984
262
                if (plen != 32){
7985
196
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
7986
196
                                        "%s IPv4 address length %u invalid",
7987
196
                                        tag, plen);
7988
196
                    return -1;
7989
196
                }
7990
66
                offset += 1;
7991
7992
66
                proto_tree_add_item(tree, hf_bgp_endpoint_address, tvb, offset, 4, ENC_BIG_ENDIAN);
7993
7994
66
                total_length = 5; /* length(1 octet) + address(4 octets) */
7995
66
                break;
7996
212
            case SAFNUM_TUNNEL:
7997
212
                plen =  tvb_get_uint8(tvb, offset);
7998
212
                if (plen <= 16){
7999
70
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8000
70
                                        "%s Tunnel IPv4 prefix length %u invalid",
8001
70
                                        tag, plen);
8002
70
                    return -1;
8003
70
                }
8004
142
                tnl_id = tvb_get_ntohs(tvb, offset + 1);
8005
142
                offset += 3; /* Length + Tunnel Id */
8006
142
                plen -= 16; /* 2-octet Identifier */
8007
142
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset, &ip4addr, plen);
8008
142
                if (length < 0) {
8009
66
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8010
66
                                        "%s Tunnel IPv4 prefix length %u invalid",
8011
66
                                        tag, plen + 16);
8012
66
                    return -1;
8013
66
                }
8014
76
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8015
76
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8016
76
                                         (offset + length) - start_offset,
8017
76
                                         ett_bgp_prefix, NULL,
8018
76
                                         "Tunnel Identifier=0x%x IPv4=%s/%u",
8019
76
                                         tnl_id, address_to_str(pinfo->pool, &addr), plen);
8020
8021
76
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
8022
8023
76
                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
8024
76
                                    start_offset + 1, 2, ENC_BIG_ENDIAN);
8025
76
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset, length, ip4addr);
8026
76
                total_length = 1 + 2 + length; /* length field + Tunnel Id + IPv4 len */
8027
76
                break;
8028
243
            case SAFNUM_SR_POLICY:
8029
243
                total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
8030
243
                if (total_length < 0)
8031
0
                    return -1;
8032
243
                break;
8033
243
            case SAFNUM_LAB_VPNUNICAST:
8034
576
            case SAFNUM_LAB_VPNMULCAST:
8035
1.03k
            case SAFNUM_LAB_VPNUNIMULC:
8036
1.03k
                end = offset + tlen;
8037
                /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
8038
1.03k
                if (detect_add_path_prefix46(tvb, offset, end, 255)) {
8039
                    /* snarf path identifier */
8040
308
                    offset += 4;
8041
308
                    total_length += 4;
8042
308
                }
8043
1.03k
                plen =  tvb_get_uint8(tvb, offset);
8044
1.03k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8045
1.03k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8046
8047
1.03k
                offset += (1 + labnum * 3);
8048
1.03k
                if (plen < (labnum * 3*8 + 8*8)) {
8049
652
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8050
652
                                        "%s Labeled VPN IPv4 prefix length %u invalid",
8051
652
                                        tag, plen);
8052
652
                    return -1;
8053
652
                }
8054
379
                plen -= (labnum * 3*8 + 8*8);
8055
8056
379
                length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset + 8, &ip4addr, plen);
8057
379
                if (length < 0) {
8058
104
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8059
104
                                             "%s Labeled VPN IPv4 prefix length %u invalid",
8060
104
                                             tag, plen + (labnum * 3*8) + 8*8);
8061
104
                     return -1;
8062
104
                }
8063
275
                set_address(&addr, AT_IPv4, 4, &ip4addr);
8064
275
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8065
275
                                                 (offset + 8 + length) - start_offset,
8066
275
                                                 ett_bgp_prefix, NULL, "BGP Prefix");
8067
8068
275
                if (total_length > 0) {
8069
86
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8070
86
                    start_offset += 4;
8071
86
                }
8072
275
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
8073
275
                proto_tree_add_string(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf));
8074
275
                proto_tree_add_string(prefix_tree, hf_bgp_rd, tvb, start_offset + 1 + 3 * labnum, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
8075
8076
275
                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset + 8, length, ip4addr);
8077
8078
275
                total_length += (1 + labnum * 3 + 8) + length;
8079
275
                break;
8080
8081
1.81k
           case SAFNUM_FSPEC_RULE:
8082
2.80k
           case SAFNUM_FSPEC_VPN_RULE:
8083
2.80k
             total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
8084
2.80k
             if(total_length < 0)
8085
96
               return -1;
8086
2.71k
             total_length++;
8087
2.71k
           break;
8088
1.96k
            case SAFNUM_BGP_MUP:
8089
1.96k
                total_length = decode_bgp_mup_nlri(tree, tvb, offset, pinfo, afi);
8090
1.96k
                break;
8091
140
           default:
8092
140
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8093
140
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8094
140
                return -1;
8095
13.9k
        } /* switch (safi) */
8096
10.9k
        break;
8097
8098
12.8k
    case AFNUM_INET6:
8099
12.8k
        switch (safi) {
8100
8101
688
            case SAFNUM_UNICAST:
8102
1.69k
            case SAFNUM_MULCAST:
8103
2.20k
            case SAFNUM_UNIMULC:
8104
                /* parse each prefix */
8105
8106
2.20k
                end = offset + tlen;
8107
8108
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8109
2.20k
                if( detect_add_path_prefix6(tvb, offset, end) ) {
8110
                    /* IPv6 prefixes with Path Id */
8111
411
                    total_length = decode_path_prefix6(tree, pinfo, hf_path_id, hf_addr6, tvb, offset, tag);
8112
1.79k
                } else {
8113
1.79k
                    total_length = decode_prefix6(tree, pinfo, hf_addr6, tvb, offset, 0, tag);
8114
1.79k
                }
8115
2.20k
                if (total_length < 0)
8116
138
                    return -1;
8117
2.07k
                break;
8118
8119
2.07k
            case SAFNUM_MPLS_LABEL:
8120
577
                end = offset + tlen;
8121
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8122
577
                if( detect_add_path_prefix46(tvb, offset, end, 255) ) {
8123
                    /* snarf path identifier */
8124
230
                    path_identifier = tvb_get_ntohl(tvb, offset);
8125
230
                    offset += 4;
8126
230
                    total_length += 4;
8127
230
                }
8128
                /* snarf length */
8129
577
                plen =  tvb_get_uint8(tvb, offset);
8130
577
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8131
577
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8132
8133
577
                offset += (1 + labnum * 3);
8134
577
                if (plen < (labnum * 3*8)) {
8135
188
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8136
188
                                        "%s Labeled IPv6 prefix length %u invalid", tag, plen);
8137
188
                    return -1;
8138
188
                }
8139
389
                plen -= (labnum * 3*8);
8140
8141
389
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
8142
389
                if (length < 0) {
8143
68
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8144
68
                                        "%s Labeled IPv6 prefix length %u invalid",
8145
68
                                        tag, plen  + (labnum * 3*8));
8146
68
                    return -1;
8147
68
                }
8148
8149
321
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8150
321
                if (total_length > 0) {
8151
67
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8152
67
                                    (offset + length) - start_offset,
8153
67
                                    ett_bgp_prefix, NULL,
8154
67
                                    "Label Stack=%s, IPv6=%s/%u PathId %u",
8155
67
                                    wmem_strbuf_get_str(stack_strbuf),
8156
67
                                    address_to_str(pinfo->pool, &addr), plen, path_identifier);
8157
67
                    proto_tree_add_item(prefix_tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8158
67
                    start_offset += 4;
8159
254
                } else {
8160
254
                    prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8161
254
                                    (offset + length) - start_offset,
8162
254
                                    ett_bgp_prefix, NULL,
8163
254
                                    "Label Stack=%s, IPv6=%s/%u",
8164
254
                                    wmem_strbuf_get_str(stack_strbuf),
8165
254
                                    address_to_str(pinfo->pool, &addr), plen);
8166
254
                }
8167
321
                proto_tree_add_uint_format(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, plen + labnum * 3 * 8,
8168
321
                                        "%s Prefix length: %u", tag, plen + labnum * 3 * 8);
8169
321
                proto_tree_add_string_format(prefix_tree, hf_bgp_label_stack, tvb, start_offset + 1, 3 * labnum, wmem_strbuf_get_str(stack_strbuf),
8170
321
                                        "%s Label Stack: %s", tag, wmem_strbuf_get_str(stack_strbuf));
8171
321
                total_length += (1 + labnum*3) + length;
8172
321
                proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
8173
321
                break;
8174
1.93k
            case SAFNUM_MCAST_VPN:
8175
1.93k
                total_length = decode_mcast_vpn_nlri(tree, tvb, offset, afi, pinfo);
8176
1.93k
                if (total_length < 0)
8177
213
                    return -1;
8178
1.72k
                break;
8179
1.72k
            case SAFNUM_ENCAPSULATION:
8180
140
                plen =  tvb_get_uint8(tvb, offset);
8181
140
                if (plen != 128){
8182
74
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_length_invalid, tvb, offset, 1,
8183
74
                                        "%s IPv6 address length %u invalid",
8184
74
                                        tag, plen);
8185
74
                    return -1;
8186
74
                }
8187
66
                offset += 1;
8188
8189
66
                proto_tree_add_item(tree, hf_bgp_endpoint_address_ipv6, tvb, offset, 16, ENC_NA);
8190
8191
66
                total_length = 17; /* length(1 octet) + address(16 octets) */
8192
66
                break;
8193
182
            case SAFNUM_TUNNEL:
8194
182
                plen =  tvb_get_uint8(tvb, offset);
8195
182
                if (plen <= 16){
8196
70
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8197
70
                                        "%s Tunnel IPv6 prefix length %u invalid",
8198
70
                                        tag, plen);
8199
70
                    return -1;
8200
70
                }
8201
112
                tnl_id = tvb_get_ntohs(tvb, offset + 1);
8202
112
                offset += 3; /* Length + Tunnel Id */
8203
112
                plen -= 16; /* 2-octet Identifier */
8204
112
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &ip6addr, plen);
8205
112
                if (length < 0) {
8206
36
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8207
36
                                        "%s Tunnel IPv6 prefix length %u invalid",
8208
36
                                        tag, plen + 16);
8209
36
                    return -1;
8210
36
                }
8211
76
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8212
76
                prefix_tree = proto_tree_add_subtree_format(tree, tvb, start_offset,
8213
76
                                    (offset + length) - start_offset,
8214
76
                                    ett_bgp_prefix, NULL,
8215
76
                                    "Tunnel Identifier=0x%x IPv6=%s/%u",
8216
76
                                    tnl_id, address_to_str(pinfo->pool, &addr), plen);
8217
76
                proto_tree_add_item(prefix_tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_BIG_ENDIAN);
8218
8219
76
                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
8220
76
                                    start_offset + 1, 2, ENC_BIG_ENDIAN);
8221
76
                proto_tree_add_ipv6(prefix_tree, hf_addr6, tvb, offset, length, &ip6addr);
8222
8223
76
                total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */
8224
76
                break;
8225
8226
197
            case SAFNUM_SR_POLICY:
8227
197
                total_length = decode_sr_policy_nlri(tree, tvb, offset, afi);
8228
197
                if (total_length < 0)
8229
0
                    return -1;
8230
197
                break;
8231
8232
1.24k
            case SAFNUM_BGP_MUP:
8233
1.24k
                total_length = decode_bgp_mup_nlri(tree, tvb, offset, pinfo, afi);
8234
1.24k
                break;
8235
747
            case SAFNUM_LAB_VPNUNICAST:
8236
1.16k
            case SAFNUM_LAB_VPNMULCAST:
8237
1.33k
            case SAFNUM_LAB_VPNUNIMULC:
8238
1.33k
                end = offset + tlen;
8239
                /* Heuristic to detect if IPv6 prefix are using Path Identifiers */
8240
1.33k
                if (detect_add_path_prefix46(tvb, offset, end, 255)) {
8241
                    /* snarf path identifier */
8242
530
                    offset += 4;
8243
530
                    total_length += 4;
8244
530
                }
8245
1.33k
                plen =  tvb_get_uint8(tvb, offset);
8246
1.33k
                stack_strbuf = wmem_strbuf_create(pinfo->pool);
8247
1.33k
                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
8248
8249
1.33k
                offset += (1 + labnum * 3);
8250
1.33k
                if (plen < (labnum * 3*8 + 8*8)) {
8251
1.04k
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8252
1.04k
                                        "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
8253
1.04k
                    return -1;
8254
1.04k
                }
8255
294
                plen -= (labnum * 3*8 + 8*8);
8256
8257
294
                length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset + 8, &ip6addr, plen);
8258
294
                if (length < 0) {
8259
74
                    proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1,
8260
74
                                                 "%s Labeled VPN IPv6 prefix length %u invalid",
8261
74
                                                 tag, plen + (labnum * 3*8) + 8*8);
8262
74
                    return -1;
8263
74
                }
8264
8265
220
                if (total_length > 0) {
8266
70
                    proto_tree_add_item(tree, hf_path_id, tvb, start_offset, 4, ENC_BIG_ENDIAN);
8267
70
                    start_offset += 4;
8268
70
                }
8269
220
                proto_tree_add_item(tree, hf_bgp_prefix_length, tvb, start_offset, 1, ENC_NA);
8270
220
                proto_tree_add_string(tree, hf_bgp_label_stack, tvb, start_offset + 1, labnum * 3, wmem_strbuf_get_str(stack_strbuf));
8271
220
                proto_tree_add_string(tree, hf_bgp_rd, tvb, offset, 8, decode_bgp_rd(pinfo->pool, tvb, offset));
8272
8273
8274
220
                set_address(&addr, AT_IPv6, 16, ip6addr.bytes);
8275
220
                proto_tree_add_ipv6_format_value(tree, hf_addr6, tvb, offset + 8, length,
8276
220
                                                 &ip6addr, "%s/%u", address_to_str(pinfo->pool, &addr), plen);
8277
8278
220
                total_length += (1 + labnum * 3 + 8) + length;
8279
8280
220
                break;
8281
4.36k
            case SAFNUM_FSPEC_RULE:
8282
4.91k
            case SAFNUM_FSPEC_VPN_RULE:
8283
4.91k
                total_length = decode_flowspec_nlri(tree, tvb, offset, afi, safi, pinfo);
8284
4.91k
                if(total_length < 0)
8285
285
                    return -1;
8286
4.63k
                total_length++;
8287
4.63k
                break;
8288
77
            default:
8289
77
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8290
77
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8291
77
                return -1;
8292
12.8k
        } /* switch (safi) */
8293
9.91k
        break;
8294
8295
9.91k
    case AFNUM_L2VPN:
8296
10.0k
    case AFNUM_L2VPN_OLD:
8297
10.0k
        switch (safi) {
8298
8299
105
            case SAFNUM_LAB_VPNUNICAST:
8300
569
            case SAFNUM_LAB_VPNMULCAST:
8301
642
            case SAFNUM_LAB_VPNUNIMULC:
8302
1.01k
            case SAFNUM_VPLS:
8303
1.01k
                plen =  tvb_get_ntohs(tvb,offset);
8304
1.01k
                proto_tree_add_item(tree, hf_bgp_vplsad_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8305
8306
1.01k
                proto_tree_add_string(tree, hf_bgp_vplsad_rd, tvb, offset+2, 8, decode_bgp_rd(pinfo->pool, tvb, offset+2));
8307
                /* RFC6074 Section 7 BGP-AD and VPLS-BGP Interoperability
8308
                   Both BGP-AD and VPLS-BGP [RFC4761] use the same AFI/SAFI.  In order
8309
                   for both BGP-AD and VPLS-BGP to co-exist, the NLRI length must be
8310
                   used as a demultiplexer.
8311
8312
                   The BGP-AD NLRI has an NLRI length of 12 bytes, containing only an
8313
                   8-byte RD and a 4-byte VSI-ID. VPLS-BGP [RFC4761] uses a 17-byte
8314
                   NLRI length.  Therefore, implementations of BGP-AD must ignore NLRI
8315
                   that are greater than 12 bytes.
8316
                */
8317
1.01k
                if(plen == 12) /* BGP-AD */
8318
521
                {
8319
521
                    proto_tree_add_item(tree, hf_bgp_bgpad_pe_addr, tvb, offset+10, 4, ENC_BIG_ENDIAN);
8320
521
                }else{ /* VPLS-BGP */
8321
8322
496
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_ce_id, tvb, offset+10, 2, ENC_BIG_ENDIAN);
8323
8324
496
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_offset, tvb, offset+12, 2, ENC_BIG_ENDIAN);
8325
496
                    proto_tree_add_item(tree, hf_bgp_vplsbgp_labelblock_size, tvb, offset+14, 2, ENC_BIG_ENDIAN);
8326
496
                    stack_strbuf = wmem_strbuf_create(pinfo->pool);
8327
496
                    decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
8328
496
                    proto_tree_add_string(tree, hf_bgp_vplsbgp_labelblock_base, tvb, offset+16, plen-14, wmem_strbuf_get_str(stack_strbuf));
8329
8330
496
                }
8331
                /* FIXME there are subTLVs left to decode ... for now lets omit them */
8332
1.01k
                total_length = plen+2;
8333
1.01k
                break;
8334
8335
8.77k
            case SAFNUM_EVPN:
8336
                /* Check for Add Path */
8337
8.77k
                if (tvb_get_uint8(tvb, offset + 4 ) <= EVPN_S_PMSI_A_D_ROUTE && tvb_get_uint8(tvb, offset ) == 0) {
8338
2.96k
                    proto_tree_add_item(tree, hf_path_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8339
2.96k
                    offset += 4;
8340
2.96k
                    total_length = decode_evpn_nlri(tree, tvb, offset, pinfo) + 4;
8341
5.80k
                } else {
8342
5.80k
                     total_length = decode_evpn_nlri(tree, tvb, offset, pinfo);
8343
5.80k
                }
8344
8.77k
                break;
8345
8346
214
            default:
8347
214
                proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_safi, tvb, start_offset, 0,
8348
214
                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
8349
214
                return -1;
8350
10.0k
        } /* switch (safi) */
8351
9.19k
        break;
8352
9.19k
    case AFNUM_BGP_LS:
8353
5.27k
        nlri_type = tvb_get_ntohs(tvb, offset);
8354
5.27k
        total_length = tvb_get_ntohs(tvb, offset + 2);
8355
5.27k
        length = total_length;
8356
5.27k
        total_length += 4;
8357
8358
5.27k
        if (safi == SAFNUM_BGP_LS || safi == SAFNUM_BGP_LS_VPN) {
8359
3.89k
            ti = proto_tree_add_item(tree, hf_bgp_ls_nlri, tvb, offset, total_length , ENC_NA);
8360
3.89k
        } else if (safi == SAFNUM_LAB_VPNUNICAST) {
8361
1.18k
            ti = proto_tree_add_item(tree, hf_bgp_ls_safi128_nlri, tvb, offset, total_length , ENC_NA);
8362
1.18k
        } else
8363
197
            return -1;
8364
8365
5.08k
        prefix_tree = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
8366
5.08k
        proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_type, tvb, offset, 2, ENC_BIG_ENDIAN);
8367
5.08k
        proto_tree_add_item(prefix_tree, hf_bgp_ls_nlri_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
8368
5.08k
        offset += 4;
8369
8370
        /* when SAFI 128, then write route distinguisher */
8371
5.08k
        if (safi == SAFNUM_LAB_VPNUNICAST) {
8372
1.18k
            if (length < BGP_ROUTE_DISTINGUISHER_SIZE) {
8373
391
                if (length == 0) {
8374
194
                    expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
8375
194
                                           "Unexpected end of SAFI 128 NLRI, Route Distinguisher field is required!");
8376
194
                }
8377
391
                if (length > 0) {
8378
197
                    expert_add_info_format(pinfo, prefix_tree, &ei_bgp_ls_error,
8379
197
                                           "Unexpected Route Distinguisher length (%u)!",
8380
197
                                           length);
8381
197
                }
8382
391
                break;
8383
391
            }
8384
798
            disting_item = proto_tree_add_item(prefix_tree, hf_bgp_ls_safi128_nlri_route_distinguisher,
8385
798
                                               tvb, offset, BGP_ROUTE_DISTINGUISHER_SIZE, ENC_NA);
8386
798
            disting_tree = proto_item_add_subtree(disting_item, ett_bgp_mp_reach_nlri);
8387
798
            tmp16 = tvb_get_ntohs(tvb, offset);
8388
798
            proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_distinguisher_type,
8389
798
                                tvb, offset, 2, ENC_BIG_ENDIAN);
8390
            /* Route Distinguisher Type */
8391
798
            switch (tmp16) {
8392
88
            case 0:
8393
88
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
8394
88
                                    tvb, offset + 2, 2, ENC_BIG_ENDIAN);
8395
88
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
8396
88
                                    tvb, offset + 4, 4, ENC_BIG_ENDIAN);
8397
88
                break;
8398
8399
34
            case 1:
8400
34
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
8401
34
                                    tvb, offset + 2, 4, ENC_BIG_ENDIAN);
8402
34
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
8403
34
                                    tvb, offset + 6, 2, ENC_BIG_ENDIAN);
8404
34
                break;
8405
8406
66
            case 2:
8407
66
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
8408
66
                                    tvb, offset + 2, 4, ENC_BIG_ENDIAN);
8409
66
                proto_tree_add_item(disting_tree, hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
8410
66
                                    tvb, offset + 6, 2, ENC_BIG_ENDIAN);
8411
66
                break;
8412
8413
601
            default:
8414
601
                expert_add_info_format(pinfo, disting_tree, &ei_bgp_ls_error,
8415
601
                                       "Unknown Route Distinguisher type (%u)", tmp16);
8416
798
            }
8417
770
            offset += BGP_ROUTE_DISTINGUISHER_SIZE;
8418
770
            length -= BGP_ROUTE_DISTINGUISHER_SIZE;
8419
770
        }
8420
8421
4.66k
        switch (nlri_type) {
8422
1.74k
        case LINK_STATE_LINK_NLRI:
8423
8424
1.74k
            nlri_ti = proto_tree_add_item(prefix_tree,
8425
1.74k
                    hf_bgp_ls_nlri_link_nlri_type, tvb, offset, length,
8426
1.74k
                    ENC_NA);
8427
1.74k
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8428
1.74k
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8429
1.74k
                    offset, pinfo, length);
8430
1.74k
            if (tmp_length < 1)
8431
67
                return -1;
8432
8433
1.68k
            offset += tmp_length;
8434
1.68k
            length -= tmp_length;
8435
8436
            /* dissect Remote Node descriptors TLV */
8437
1.68k
            if (length > 0 && length < 4) {
8438
71
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8439
71
                        "Unknown data in Link-State Link NLRI!");
8440
71
                break;
8441
71
            }
8442
1.61k
            if (length < 1)
8443
329
                break;
8444
8445
1.28k
           tmp_length = decode_bgp_link_node_nlri_tlvs(tvb, nlri_tree, offset,
8446
1.28k
                                                       pinfo, BGP_NLRI_TLV_REMOTE_NODE_DESCRIPTORS);
8447
1.28k
           if (tmp_length < 1)
8448
0
               return -1;
8449
8450
1.28k
           offset += tmp_length;
8451
1.28k
           length -= tmp_length;
8452
8453
           /* dissect Link Descriptor NLRI */
8454
1.28k
           if (length > 0 && length < 4) {
8455
67
               expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8456
67
                       "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
8457
67
               break;
8458
67
           }
8459
1.21k
           if (length < 1)
8460
211
               break;
8461
8462
1.00k
           tmp_length = decode_bgp_link_nlri_link_descriptors(tvb, nlri_tree,
8463
1.00k
                   offset, pinfo, length);
8464
1.00k
           if (tmp_length < 1)
8465
720
               return -1;
8466
8467
283
           break;
8468
8469
431
       case LINK_STATE_NODE_NLRI:
8470
431
            nlri_ti = proto_tree_add_item(prefix_tree,
8471
431
                    hf_bgp_ls_nlri_node_nlri_type, tvb, offset, length,
8472
431
                    ENC_NA);
8473
431
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8474
431
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8475
431
                    offset, pinfo, length);
8476
431
            if (tmp_length < 1)
8477
66
                return -1;
8478
8479
365
            break;
8480
8481
713
        case LINK_STATE_IPV4_TOPOLOGY_PREFIX_NLRI:
8482
713
            nlri_ti = proto_tree_add_item(prefix_tree,
8483
713
                    hf_bgp_ls_ipv4_topology_prefix_nlri_type, tvb, offset, length,
8484
713
                    ENC_NA);
8485
713
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8486
713
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8487
713
                                                                 offset, pinfo, length);
8488
713
            if (tmp_length < 1)
8489
66
                return -1;
8490
8491
647
            offset += tmp_length;
8492
647
            length -= tmp_length;
8493
8494
            /* dissect Prefix Descriptors NLRI */
8495
647
            if (length > 0 && length < 4) {
8496
66
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8497
66
                        "Unknown data in Link-State Link NLRI, length = %d bytes.", length);
8498
66
                break;
8499
66
            }
8500
581
            if (length < 1)
8501
153
                break;
8502
8503
428
            tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
8504
428
                    offset, pinfo, length, IP_PROTO_IPV4);
8505
428
            if (tmp_length < 1)
8506
250
                return -1;
8507
8508
178
            break;
8509
8510
558
        case LINK_STATE_IPV6_TOPOLOGY_PREFIX_NLRI:
8511
558
            nlri_ti = proto_tree_add_item(prefix_tree,
8512
558
                    hf_bgp_ls_ipv6_topology_prefix_nlri_type, tvb, offset, length,
8513
558
                    ENC_NA);
8514
558
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8515
558
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8516
558
                    offset, pinfo, length);
8517
558
            if (tmp_length < 1)
8518
68
                return -1;
8519
8520
490
            offset += tmp_length;
8521
490
            length -= tmp_length;
8522
8523
            /* dissect Prefix Descriptors NLRI */
8524
490
            if (length > 0 && length < 4) {
8525
66
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8526
66
                        "Unknown data in Link-State Link NLRI!");
8527
66
                break;
8528
66
            }
8529
424
            if (length < 1)
8530
135
                break;
8531
8532
289
            tmp_length = decode_bgp_link_nlri_prefix_descriptors(tvb, nlri_tree,
8533
289
                    offset, pinfo, length, IP_PROTO_IPV6);
8534
289
            if (tmp_length < 1)
8535
144
                return -1;
8536
8537
145
            break;
8538
8539
540
        case LINK_STATE_SRV6_SID_NLRI:
8540
540
            nlri_ti = proto_tree_add_item(prefix_tree,
8541
540
                    hf_bgp_ls_nlri_srv6_sid_nlri_type, tvb, offset, length,
8542
540
                    ENC_NA);
8543
540
            nlri_tree = proto_item_add_subtree(nlri_ti, ett_bgp_mp_reach_nlri);
8544
540
            tmp_length = decode_bgp_link_node_nlri_common_fields(tvb, nlri_tree,
8545
540
                    offset, pinfo, length);
8546
540
            if (tmp_length < 1)
8547
67
                return -1;
8548
8549
473
            offset += tmp_length;
8550
473
            length -= tmp_length;
8551
8552
            /* dissect SRv6 SID Descriptors NLRI */
8553
473
            if (length > 0 && length < 4) {
8554
67
                expert_add_info_format(pinfo, nlri_tree, &ei_bgp_ls_error,
8555
67
                        "Unknown data in Link-State SRv6 SID NLRI!");
8556
67
                break;
8557
67
            }
8558
406
            if (length < 1)
8559
60
                break;
8560
8561
346
            tmp_length = decode_bgp_link_nlri_srv6_sid_descriptors(tvb, nlri_tree,
8562
346
                    offset, pinfo, length);
8563
346
            if (tmp_length < 1)
8564
223
                return -1;
8565
8566
123
            break;
8567
8568
671
        default:
8569
671
            proto_tree_add_expert_format(tree, pinfo,  &ei_bgp_ls_error, tvb, start_offset, 0,
8570
671
                                         "Unknown Link-State NLRI type (%u)", afi);
8571
8572
4.66k
        }
8573
2.65k
        break;
8574
8575
2.65k
        default:
8576
629
            proto_tree_add_expert_format(tree, pinfo, &ei_bgp_unknown_afi, tvb, start_offset, 0,
8577
629
                                         "Unknown AFI (%u) value", afi);
8578
629
            return -1;
8579
42.6k
    } /* switch (afi) */
8580
33.0k
    return total_length;
8581
42.6k
}
8582
8583
/*
8584
 * Dissect a BGP capability.
8585
 */
8586
static int
8587
dissect_bgp_capability_item(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, bool action)
8588
10.7k
{
8589
10.7k
    proto_tree *cap_tree;
8590
10.7k
    proto_item *ti;
8591
10.7k
    proto_item *ti_len;
8592
10.7k
    uint8_t ctype;
8593
10.7k
    uint8_t clen;
8594
8595
10.7k
    ti = proto_tree_add_item(tree, hf_bgp_cap, tvb, offset, -1, ENC_NA);
8596
10.7k
    cap_tree = proto_item_add_subtree(ti, ett_bgp_cap);
8597
8598
10.7k
    proto_tree_add_item(cap_tree, hf_bgp_cap_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8599
10.7k
    ctype = tvb_get_uint8(tvb, offset);
8600
10.7k
    proto_item_append_text(ti, ": %s", val_to_str(ctype, capability_vals, "Unknown capability %d"));
8601
10.7k
    offset += 1;
8602
8603
10.7k
    ti_len = proto_tree_add_item(cap_tree, hf_bgp_cap_length, tvb, offset, 1, ENC_BIG_ENDIAN);
8604
10.7k
    clen = tvb_get_uint8(tvb, offset);
8605
10.7k
    proto_item_set_len(ti, clen+2);
8606
10.7k
    offset += 1;
8607
8608
10.7k
    if(action){
8609
1.72k
        proto_tree_add_item(cap_tree, hf_bgp_cap_action, tvb, offset, 1, ENC_BIG_ENDIAN);
8610
1.72k
        proto_item_set_len(ti, clen+3);
8611
1.72k
        offset += 1;
8612
1.72k
    }
8613
8614
    /* check the capability type */
8615
10.7k
    switch (ctype) {
8616
1.87k
        case BGP_CAPABILITY_RESERVED:
8617
1.87k
            if (clen != 0) {
8618
269
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8619
269
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8620
269
            }
8621
1.87k
            offset += clen;
8622
1.87k
            break;
8623
433
        case BGP_CAPABILITY_MULTIPROTOCOL:
8624
433
            if (clen != 4) {
8625
236
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
8626
236
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8627
236
                offset += clen;
8628
236
            }
8629
197
            else {
8630
                /* AFI */
8631
197
                proto_tree_add_item(cap_tree, hf_bgp_cap_mp_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8632
197
                offset += 2;
8633
8634
                /* Reserved */
8635
197
                proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
8636
197
                offset += 1;
8637
8638
                /* SAFI */
8639
197
                proto_tree_add_item(cap_tree, hf_bgp_cap_mp_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8640
197
                offset += 1;
8641
197
            }
8642
433
            break;
8643
728
        case BGP_CAPABILITY_EXTENDED_NEXT_HOP: {
8644
728
            int eclen = offset + clen;
8645
1.02k
                while (offset <= eclen - 6) {
8646
                    /* AFI */
8647
298
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8648
298
                    offset += 2;
8649
8650
                    /* SAFI */
8651
298
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_safi, tvb, offset, 2, ENC_BIG_ENDIAN);
8652
298
                    offset += 2;
8653
8654
                    /* AFI */
8655
298
                    proto_tree_add_item(cap_tree, hf_bgp_cap_enh_nhafi, tvb, offset, 2, ENC_BIG_ENDIAN);
8656
298
                    offset += 2;
8657
298
                }
8658
728
                if (offset != eclen) {
8659
269
                    expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of 6", clen);
8660
269
                    proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, eclen - offset, ENC_NA);
8661
269
                    offset = eclen;
8662
269
                }
8663
728
            }
8664
728
            break;
8665
439
        case BGP_CAPABILITY_BGP_ROLE:
8666
439
            if (clen != 1) {
8667
241
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 1", clen);
8668
241
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8669
241
                offset += clen;
8670
241
            }
8671
198
            else {
8672
198
                proto_tree_add_item(cap_tree, hf_bgp_cap_role, tvb, offset, 1, ENC_BIG_ENDIAN);
8673
198
                offset += 1;
8674
198
            }
8675
439
            break;
8676
907
        case BGP_CAPABILITY_GRACEFUL_RESTART:
8677
907
            if ((clen < 6) && (clen != 2)) {
8678
521
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
8679
521
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8680
521
                offset += clen;
8681
521
            }
8682
386
            else {
8683
386
                int eclen = offset + clen;
8684
8685
386
                static int * const timer_flags[] = {
8686
386
                    &hf_bgp_cap_gr_timers_restart_flag,
8687
386
                    &hf_bgp_cap_gr_timers_notification_flag,
8688
386
                    &hf_bgp_cap_gr_timers_restart_time,
8689
386
                    NULL
8690
386
                };
8691
8692
386
                if (clen == 2){
8693
287
                    expert_add_info(pinfo, ti_len, &ei_bgp_cap_gr_helper_mode_only);
8694
287
                }
8695
8696
                /* Timers */
8697
386
                proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_timers, ett_bgp_cap, timer_flags, ENC_BIG_ENDIAN);
8698
386
                offset += 2;
8699
8700
                /*
8701
                 * what follows is alist of AFI/SAFI/flag triplets
8702
                 * read it until the TLV ends
8703
                 */
8704
674
                while (offset < eclen) {
8705
288
                    static int * const flags[] = {
8706
288
                        &hf_bgp_cap_gr_flag_pfs,
8707
288
                        NULL
8708
288
                    };
8709
8710
                    /* AFI */
8711
288
                    proto_tree_add_item(cap_tree, hf_bgp_cap_gr_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8712
288
                    offset += 2;
8713
8714
                    /* SAFI */
8715
288
                    proto_tree_add_item(cap_tree, hf_bgp_cap_gr_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8716
288
                    offset += 1;
8717
8718
                    /* Flags */
8719
288
                    proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_gr_flag, ett_bgp_cap, flags, ENC_BIG_ENDIAN);
8720
288
                    offset += 1;
8721
288
                }
8722
386
            }
8723
907
            break;
8724
422
        case BGP_CAPABILITY_4_OCTET_AS_NUMBER:
8725
422
            if (clen != 4) {
8726
228
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 4", clen);
8727
228
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8728
228
                offset += clen;
8729
228
            }
8730
194
            else {
8731
194
                proto_tree_add_item(cap_tree, hf_bgp_cap_4as, tvb, offset, 4, ENC_BIG_ENDIAN);
8732
194
                offset += 4;
8733
194
            }
8734
422
            break;
8735
418
        case BGP_CAPABILITY_DYNAMIC_CAPABILITY:
8736
418
            if (clen > 0) {
8737
216
                int eclen = offset + clen;
8738
8739
701
                while (offset < eclen) {
8740
485
                    proto_tree_add_item(cap_tree, hf_bgp_cap_dc, tvb, offset, 1, ENC_BIG_ENDIAN);
8741
485
                    offset += 1;
8742
485
                }
8743
216
            }
8744
418
            break;
8745
621
        case BGP_CAPABILITY_ADDITIONAL_PATHS:
8746
621
            if (clen % 4 != 0) {
8747
195
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be multiple of  4", clen);
8748
195
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8749
195
                offset += clen;
8750
195
            }
8751
426
            else { /* AFI SAFI Send-receive*/
8752
426
                int eclen = offset + clen;
8753
8754
837
                while (offset < eclen){
8755
                    /* AFI */
8756
411
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8757
411
                    offset += 2;
8758
8759
                    /* SAFI */
8760
411
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8761
411
                    offset += 1;
8762
8763
                    /* Send-Receive */
8764
411
                    proto_tree_add_item(cap_tree, hf_bgp_cap_ap_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
8765
411
                    offset += 1;
8766
411
                }
8767
426
            }
8768
621
            break;
8769
8770
194
        case BGP_CAPABILITY_FQDN:{
8771
194
            uint8_t hostname_len, domain_name_len;
8772
8773
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_hostname_len, tvb, offset, 1, ENC_NA);
8774
194
            hostname_len = tvb_get_uint8(tvb, offset);
8775
194
            offset += 1;
8776
8777
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_hostname, tvb, offset, hostname_len, ENC_ASCII);
8778
194
            offset += hostname_len;
8779
8780
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_domain_name_len, tvb, offset, 1, ENC_NA);
8781
194
            domain_name_len = tvb_get_uint8(tvb, offset);
8782
194
            offset += 1;
8783
8784
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_fqdn_domain_name, tvb, offset, domain_name_len, ENC_ASCII);
8785
194
            offset += domain_name_len;
8786
8787
194
            }
8788
194
            break;
8789
8790
195
        case BGP_CAPABILITY_LINK_LOCAL_NEXT_HOP:
8791
395
        case BGP_CAPABILITY_ENHANCED_ROUTE_REFRESH:
8792
613
        case BGP_CAPABILITY_ROUTE_REFRESH_CISCO:
8793
1.27k
        case BGP_CAPABILITY_ROUTE_REFRESH:
8794
1.48k
        case BGP_CAPABILITY_CP_ORF:
8795
1.48k
            if (clen != 0) {
8796
649
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8797
649
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8798
649
            }
8799
1.48k
            offset += clen;
8800
1.48k
            break;
8801
203
        case BGP_CAPABILITY_ORF_CISCO:
8802
594
        case BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING:
8803
594
            if (clen < 6) {
8804
430
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 6", clen);
8805
430
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8806
430
                offset += clen;
8807
430
            }
8808
164
            else {
8809
164
                uint8_t orfnum;       /* number of ORFs */
8810
164
                int i;
8811
                /* AFI */
8812
164
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8813
164
                offset += 2;
8814
8815
                /* Reserved */
8816
164
                proto_tree_add_item(cap_tree, hf_bgp_cap_reserved, tvb, offset, 1, ENC_NA);
8817
164
                offset += 1;
8818
8819
                /* SAFI */
8820
164
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_safi, tvb, offset, 1, ENC_BIG_ENDIAN);
8821
164
                offset += 1;
8822
8823
                /* Number of ORFs */
8824
164
                orfnum = tvb_get_uint8(tvb, offset);
8825
164
                proto_tree_add_item(cap_tree, hf_bgp_cap_orf_number, tvb, offset, 1, ENC_BIG_ENDIAN);
8826
164
                offset += 1;
8827
634
                for (i=0; i<orfnum; i++) {
8828
                    /* ORF Type */
8829
470
                    proto_tree_add_item(cap_tree, hf_bgp_cap_orf_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8830
470
                    offset += 1;
8831
8832
                    /* Send/Receive */
8833
470
                    proto_tree_add_item(cap_tree, hf_bgp_cap_orf_sendreceive, tvb, offset, 1, ENC_BIG_ENDIAN);
8834
470
                    offset += 1;
8835
470
                }
8836
164
            }
8837
8838
594
            break;
8839
678
        case BGP_CAPABILITY_MULTISESSION_CISCO:
8840
678
            if (clen < 1) {
8841
480
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u too short, must be greater than 1", clen);
8842
480
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8843
480
                offset += clen;
8844
480
            }
8845
198
            else {
8846
198
                proto_tree_add_item(cap_tree, hf_bgp_cap_multisession_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
8847
198
                offset += 1;
8848
198
            }
8849
8850
678
            break;
8851
490
        case BGP_CAPABILITY_BGPSEC:
8852
490
            if (clen != 3) {
8853
271
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u is wrong, must be = 3", clen);
8854
271
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8855
271
                offset += clen;
8856
271
            }
8857
219
            else {
8858
219
                static int * const bgpsec_flags[] = {
8859
219
                    &hf_bgp_cap_bgpsec_version,
8860
219
                    &hf_bgp_cap_bgpsec_sendreceive,
8861
219
                    &hf_bgp_cap_bgpsec_reserved,
8862
219
                    NULL
8863
219
                };
8864
8865
                /* BGPsec Flags */
8866
219
                proto_tree_add_bitmask(cap_tree, tvb, offset, hf_bgp_cap_bgpsec_flags, ett_bgp_cap, bgpsec_flags, ENC_BIG_ENDIAN);
8867
219
                offset += 1;
8868
8869
                /* BGPsec AFI */
8870
219
                proto_tree_add_item(cap_tree, hf_bgp_cap_bgpsec_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
8871
219
                offset += 2;
8872
219
            }
8873
8874
490
            break;
8875
8876
263
        case BGP_CAPABILITY_BFD_STRICT:
8877
263
            if (clen != 0) {
8878
194
                expert_add_info_format(pinfo, ti_len, &ei_bgp_cap_len_bad, "Capability length %u wrong, must be = 0", clen);
8879
194
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8880
194
            }
8881
263
            offset += clen;
8882
263
            break;
8883
194
        case BGP_CAPABILITY_SOFT_VERSION:{
8884
194
            uint8_t soft_version_len;
8885
8886
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_soft_version_len, tvb, offset, 1, ENC_NA);
8887
194
            soft_version_len = tvb_get_uint8(tvb, offset);
8888
194
            offset += 1;
8889
8890
194
            proto_tree_add_item(cap_tree, hf_bgp_cap_soft_version, tvb, offset, soft_version_len, ENC_ASCII);
8891
194
            offset += soft_version_len;
8892
194
            }
8893
194
            break;
8894
            /* unknown capability */
8895
777
        default:
8896
777
            if (clen != 0) {
8897
284
                proto_tree_add_item(cap_tree, hf_bgp_cap_unknown, tvb, offset, clen, ENC_NA);
8898
284
            }
8899
777
            offset += clen;
8900
777
            break;
8901
10.7k
    } /* switch (ctype) */
8902
10.2k
    return offset;
8903
10.7k
}
8904
8905
/*
8906
 * Dissect a BGP OPEN message.
8907
 */
8908
8909
static void
8910
dissect_bgp_open(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
8911
349
{
8912
349
    uint16_t        optlen;    /* Option Length */
8913
349
    int             ptype;     /* parameter type        */
8914
349
    int             plen;      /* parameter length      */
8915
349
    int             cend;      /* capabilities end      */
8916
349
    int             oend;      /* options end           */
8917
349
    int             offset;    /* tvb offset counter    */
8918
349
    uint32_t        as_num;    /* AS Number             */
8919
349
    proto_item      *ti;       /* tree item             */
8920
349
    proto_tree      *opt_tree;  /* subtree for options   */
8921
349
    proto_tree      *par_tree;  /* subtree for par options   */
8922
349
    proto_tree      *opt_extension_tree;  /* subtree for par options   */
8923
8924
349
    offset = BGP_MARKER_SIZE + 2 + 1;
8925
8926
349
    proto_tree_add_item(tree, hf_bgp_open_version, tvb, offset, 1, ENC_BIG_ENDIAN);
8927
349
    offset += 1;
8928
8929
349
    ti = proto_tree_add_item_ret_uint(tree, hf_bgp_open_myas, tvb, offset, 2, ENC_BIG_ENDIAN, &as_num);
8930
349
    if (as_num == BGP_AS_TRANS) {
8931
1
        proto_item_append_text(ti, " (AS_TRANS)");
8932
1
    }
8933
349
    offset += 2;
8934
8935
349
    proto_tree_add_item(tree, hf_bgp_open_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN);
8936
349
    offset += 2;
8937
8938
349
    proto_tree_add_item(tree, hf_bgp_open_identifier, tvb, offset, 4, ENC_BIG_ENDIAN);
8939
349
    offset += 4;
8940
8941
349
    proto_tree_add_item(tree, hf_bgp_open_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN);
8942
349
    optlen = tvb_get_uint8(tvb, offset);
8943
349
    offset += 1;
8944
8945
    /* optional parameters */
8946
349
    if (optlen > 0) {
8947
183
        ptype = tvb_get_uint8(tvb, offset);
8948
183
        if (ptype == BGP_OPTION_EXTENDED_LEN) {  /* Extended Length covered by RFC9072 */
8949
56
            optlen = tvb_get_uint16(tvb, offset+1, ENC_BIG_ENDIAN);
8950
8951
56
            ti =  proto_tree_add_item(tree, hf_bgp_open_opt_extension, tvb, offset, 3, ENC_NA);
8952
56
            opt_extension_tree = proto_item_add_subtree(ti, ett_bgp_options_ext);
8953
56
            proto_tree_add_item(opt_extension_tree, hf_bgp_open_opt_extension_mark, tvb, offset, 1, ENC_NA);
8954
56
            proto_tree_add_item(opt_extension_tree, hf_bgp_open_opt_extension_len, tvb, offset +1, 2, ENC_BIG_ENDIAN);
8955
8956
56
            oend = offset + 3 + optlen;
8957
56
            offset += 3;
8958
127
        } else {
8959
127
            oend = offset + optlen;
8960
127
        }
8961
8962
        /* add a subtree */
8963
183
        ti = proto_tree_add_item(tree, hf_bgp_open_opt_params, tvb, offset, optlen, ENC_NA);
8964
183
        opt_tree = proto_item_add_subtree(ti, ett_bgp_options);
8965
8966
        /* step through all of the optional parameters */
8967
1.17k
        while (offset < oend) {
8968
8969
            /* add a subtree */
8970
1.08k
            ti = proto_tree_add_item(opt_tree, hf_bgp_open_opt_param, tvb, offset, -1, ENC_NA);
8971
1.08k
            par_tree = proto_item_add_subtree(ti, ett_bgp_options);
8972
8973
            /* display and grab the type ... */
8974
1.08k
            proto_tree_add_item(par_tree, hf_bgp_open_opt_param_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8975
1.08k
            ptype = tvb_get_uint8(tvb, offset);
8976
1.08k
            proto_item_append_text(ti, ": %s", val_to_str(ptype, bgp_open_opt_vals, "Unknown Parameter %d"));
8977
1.08k
            offset += 1;
8978
8979
            /* ... and length */
8980
1.08k
            proto_tree_add_item(par_tree, hf_bgp_open_opt_param_len, tvb, offset, 1, ENC_BIG_ENDIAN);
8981
1.08k
            plen = tvb_get_uint8(tvb, offset);
8982
1.08k
            proto_item_set_len(ti, plen+2);
8983
1.08k
            offset += 1;
8984
8985
            /* check the type */
8986
1.08k
            switch (ptype) {
8987
250
                case BGP_OPTION_AUTHENTICATION:
8988
250
                    proto_tree_add_item(par_tree, hf_bgp_open_opt_param_auth, tvb, offset, plen, ENC_NA);
8989
250
                    offset += plen;
8990
250
                    break;
8991
407
                case BGP_OPTION_CAPABILITY:
8992
                    /* grab the capability code */
8993
407
                    cend = offset + plen;
8994
8995
                    /* step through all of the capabilities */
8996
814
                    while (offset < cend) {
8997
407
                        offset = dissect_bgp_capability_item(tvb, par_tree, pinfo, offset, false);
8998
407
                    }
8999
407
                    break;
9000
374
                default:
9001
374
                    proto_tree_add_item(opt_tree, hf_bgp_open_opt_param_unknown, tvb, offset, plen, ENC_NA);
9002
374
                    break;
9003
1.08k
            } /* switch (ptype) */
9004
1.08k
        }
9005
183
    }
9006
349
}
9007
9008
/*
9009
 * Heuristic for auto-detection of ASN length 2 or 4 bytes
9010
 */
9011
9012
static uint8_t
9013
heuristic_as2_or_4_from_as_path(tvbuff_t *tvb, int as_path_offset, int end_attr_offset, uint8_t bgpa_type, int *number_as_segment)
9014
2.68k
{
9015
2.68k
    int counter_as_segment=0;
9016
2.68k
    int offset_check=0;
9017
2.68k
    uint8_t assumed_as_len=0;
9018
2.68k
    int asn_is_null=0;
9019
2.68k
    int j=0;
9020
2.68k
    int k=0;
9021
2.68k
    int k_save=0;
9022
2.68k
    uint8_t next_type=0;
9023
2.68k
    uint8_t length=0;
9024
    /* Heuristic is done in two phases
9025
     * First we try to identify the as length (2 or 4 bytes)
9026
     * then we do check that our assumption is ok
9027
     * recalculating the offset and checking we end up with the right result
9028
    * k is used to navigate into the AS_PATH */
9029
2.68k
    k = as_path_offset;
9030
    /* case of AS_PATH type being explicitly 4 bytes ASN */
9031
2.68k
    if (bgpa_type == BGPTYPE_AS4_PATH) {
9032
        /* We calculate numbers of segments and return the as length */
9033
627
        assumed_as_len = 4;
9034
2.22k
        while (k < end_attr_offset)
9035
1.59k
        {
9036
            /* we skip segment type and point to length */
9037
1.59k
            k++;
9038
1.59k
            length = tvb_get_uint8(tvb, k);
9039
            /* length read let's move to first ASN */
9040
1.59k
            k++;
9041
            /* we move to the next segment */
9042
1.59k
            k = k + (length*assumed_as_len);
9043
1.59k
            counter_as_segment++;
9044
1.59k
        }
9045
627
        *number_as_segment = counter_as_segment;
9046
627
        return 4;
9047
627
    }
9048
    /* case of user specified ASN length */
9049
2.05k
    if (bgp_asn_len != 0) {
9050
        /* We calculate numbers of segments and return the as length */
9051
0
        assumed_as_len = bgp_asn_len;
9052
0
        while (k < end_attr_offset)
9053
0
        {
9054
            /* we skip segment type and point to length */
9055
0
            k++;
9056
0
            length = tvb_get_uint8(tvb, k);
9057
            /* length read let's move to first ASN */
9058
0
            k++;
9059
            /* we move to the next segment */
9060
0
            k = k + (length*assumed_as_len);
9061
            /* if I am not facing the last segment k need to point to next length */
9062
0
            counter_as_segment++;
9063
0
        }
9064
0
        *number_as_segment = counter_as_segment;
9065
0
        return bgp_asn_len;
9066
0
    }
9067
    /* case of a empty path attribute */
9068
2.05k
    if (as_path_offset == end_attr_offset)
9069
496
    {
9070
496
        *number_as_segment = 0;
9071
496
        return bgp_asn_len;
9072
496
    }
9073
    /* case of we run the heuristic to find the as length */
9074
1.56k
    k_save = k;
9075
    /* we do run the heuristic on first segment and look at next segment if it exists */
9076
1.56k
    k++;
9077
1.56k
    length = tvb_get_uint8(tvb, k++);
9078
    /* let's do some checking with an as length 2 bytes */
9079
1.56k
    offset_check = k + 2*length;
9080
1.56k
    next_type = tvb_get_uint8(tvb, offset_check);
9081
    /* we do have one segment made of 2 bytes ASN we do reach the end of the attribute taking
9082
     * 2 bytes ASN for our calculation */
9083
1.56k
    if (offset_check == end_attr_offset)
9084
238
        assumed_as_len = 2;
9085
    /* else we do check if we see a valid AS segment type after (length * AS 2 bytes) */
9086
1.32k
    else if (next_type == AS_SET ||
9087
1.32k
            next_type == AS_SEQUENCE ||
9088
1.32k
            next_type == AS_CONFED_SEQUENCE ||
9089
1.32k
            next_type == AS_CONFED_SET) {
9090
        /* 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 */
9091
4.69k
            for (j=0; j < length && !asn_is_null; j++) {
9092
3.80k
                if(tvb_get_ntohs(tvb, k+(2*j)) == 0) {
9093
75
                    asn_is_null = 1;
9094
75
                }
9095
3.80k
            }
9096
893
            if (asn_is_null == 0)
9097
818
                assumed_as_len = 2;
9098
75
            else
9099
75
                assumed_as_len = 4;
9100
893
        }
9101
432
    else
9102
    /* we didn't find a valid AS segment type in the next coming segment assuming 2 bytes ASN */
9103
432
        assumed_as_len = 4;
9104
    /* now that we have our assumed as length let's check we can calculate the attribute length properly */
9105
1.56k
    k = k_save;
9106
3.69k
    while (k < end_attr_offset)
9107
2.13k
    {
9108
        /* we skip the AS type */
9109
2.13k
        k++;
9110
        /* we get the length of the AS segment */
9111
2.13k
        length = tvb_get_uint8(tvb, k);
9112
        /* let's point to the fist byte of the AS segment */
9113
2.13k
        k++;
9114
        /* we move to the next segment */
9115
2.13k
        k = k + (length*assumed_as_len);
9116
2.13k
        counter_as_segment++;
9117
2.13k
    }
9118
1.56k
    if (k == end_attr_offset) {
9119
    /* success */
9120
283
        *number_as_segment = counter_as_segment;
9121
283
        return assumed_as_len;
9122
283
    } else
9123
    /* we are in trouble */
9124
1.28k
    return -1;
9125
1.56k
}
9126
9127
/*
9128
 * Dissect BGP update extended communities
9129
 */
9130
9131
static int
9132
dissect_bgp_update_ext_com(proto_tree *parent_tree, tvbuff_t *tvb, uint16_t tlen, unsigned tvb_off, packet_info *pinfo)
9133
1.24k
{
9134
1.24k
    int             offset=0;
9135
1.24k
    int             end=0;
9136
1.24k
    uint8_t         com_type_high_byte;
9137
1.24k
    uint8_t         com_stype_low_byte;
9138
1.24k
    proto_tree      *communities_tree;
9139
1.24k
    proto_tree      *community_tree;
9140
1.24k
    proto_tree      *community_type_tree;
9141
1.24k
    proto_item      *communities_item=NULL;
9142
1.24k
    proto_item      *community_item=NULL;
9143
1.24k
    proto_item      *community_type_item=NULL;
9144
1.24k
    uint32_t        encaps_tunnel_type;
9145
1.24k
    afi_safi_data   *data = NULL;
9146
9147
1.24k
    offset = tvb_off ;
9148
1.24k
    end = tvb_off + tlen ;
9149
1.24k
    communities_item = proto_tree_add_item(parent_tree, hf_bgp_ext_communities, tvb, offset, tlen, ENC_NA);
9150
1.24k
    communities_tree = proto_item_add_subtree(communities_item, ett_bgp_extended_communities);
9151
1.24k
    proto_item_append_text(communities_item, ": (%u communit%s)", tlen/8, plurality(tlen/8, "y", "ies"));
9152
5.86k
    while (offset < end) {
9153
5.24k
        com_type_high_byte = tvb_get_uint8(tvb,offset); /* high community type octet */
9154
5.24k
        com_stype_low_byte = tvb_get_uint8(tvb,offset+1); /* sub type low community type octet */
9155
5.24k
        community_item = proto_tree_add_item(communities_tree, hf_bgp_ext_community, tvb, offset, 8, ENC_NA);
9156
5.24k
        community_tree = proto_item_add_subtree(community_item,ett_bgp_extended_community);
9157
9158
        /* Add the Type octet as a decoded item to the community_tree right away,
9159
         * and also dissect its two top bits in a subtree.
9160
         */
9161
9162
5.24k
        community_type_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_type_high, tvb, offset, 1, ENC_BIG_ENDIAN);
9163
5.24k
        community_type_tree = proto_item_add_subtree(community_type_item, ett_bgp_ext_com_type);
9164
5.24k
        proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_auth, tvb, offset, 1, ENC_BIG_ENDIAN);
9165
5.24k
        proto_tree_add_item(community_type_tree, hf_bgp_ext_com_type_tran, tvb, offset, 1, ENC_BIG_ENDIAN);
9166
9167
        /* In the switch(), handlers of individual types and subtypes should
9168
         * add and dissect the remaining 7 octets. Dissectors should use the
9169
         * proto_item_set_text() on the community_item to set the community
9170
         * name in the displayed label as specifically as possible, and
9171
         * proto_item_append_text() to add reasonable details.
9172
         *
9173
         * The intended text label of the community_item for each extended
9174
         * community attribute is:
9175
         *
9176
         * Community Name: Values [General Community Type Name]
9177
         *
9178
         * For example:
9179
         * Route Target: 1:1 [Transitive 2-Octet AS-Specific]
9180
         * Unknown subtype 0x01: 0x8081 0x0000 0x2800 [Non-Transitive Opaque]
9181
         * Unknown type 0x88 subtype 0x00: 0x0000 0x0000 0x0000 [Unknown community]
9182
         *
9183
         * The [] part with general community name is added at the end
9184
         * of the switch().
9185
         *
9186
         * The first option (Route Target) shows a fully recognized and
9187
         * dissected extended community. Note that the line immediately calls
9188
         * the community by its most specific known type (Route Target), while
9189
         * the general type is shown in the brackets. The second option shows a
9190
         * community whose Type is recognized (Non-Transitive Opaque) but whose
9191
         * Subtype is not known. The third option shows an unrecognized
9192
         * extended community.
9193
         *
9194
         * Printing out the community raw value as 3 short ints is intentional:
9195
         * With an unknown community, we cannot assume any particular internal
9196
         * value format, and dumping the value in short ints provides for easy
9197
         * readability.
9198
         */
9199
9200
5.24k
        switch (com_type_high_byte) {
9201
614
            case BGP_EXT_COM_TYPE_HIGH_TR_AS2: /* Transitive Two-Octet AS-Specific Extended Community */
9202
9203
614
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9204
614
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9205
614
                data = load_afi_safi_data(pinfo);
9206
9207
614
                if(data && data->afi == AFNUM_L2VPN && data->safi == SAFNUM_EVPN) {
9208
201
                        static int * const local_admin_flags[] = {
9209
201
                            &hf_bgp_ext_com_local_admin_auto_derived_flag,
9210
201
                            &hf_bgp_ext_com_local_admin_type,
9211
201
                            &hf_bgp_ext_com_local_admin_domain_id,
9212
201
                            NULL
9213
201
                        };
9214
201
                        proto_tree_add_bitmask(community_tree, tvb, offset+4, hf_bgp_ext_com_local_admin_flags,
9215
201
                                ett_bgp_vxlan, local_admin_flags, ENC_BIG_ENDIAN);
9216
201
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_local_admin_service_id, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9217
413
                } else {
9218
413
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9219
413
                }
9220
9221
614
                proto_item_set_text(community_item, "%s: %u:%u",
9222
614
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_as2, "Unknown subtype 0x%02x"),
9223
614
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9224
614
                break;
9225
9226
153
            case BGP_EXT_COM_TYPE_HIGH_NTR_AS2: /* Non-Transitive Two-Octet AS-Specific Extended Community */
9227
153
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9228
153
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9229
9230
153
                proto_item_set_text(community_item, "%s:",
9231
153
                        val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_as2, "Unknown subtype 0x%02x"));
9232
9233
153
                switch (com_stype_low_byte) {
9234
75
                    case BGP_EXT_COM_STYPE_AS2_LBW:
9235
75
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_link_bw, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9236
9237
75
                        proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
9238
75
                                tvb_get_ntohs(tvb,offset+2),
9239
75
                                tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
9240
75
                        break;
9241
9242
78
                    default:
9243
78
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9244
9245
78
                        proto_item_append_text(community_item, " %u:%u",
9246
78
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
9247
78
                    break;
9248
153
                }
9249
133
                break;
9250
9251
246
            case BGP_EXT_COM_TYPE_HIGH_TR_IP4: /* Transitive IPv4-Address-specific Extended Community */
9252
246
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9253
9254
246
                proto_item_set_text(community_item, "%s: %s:%u",
9255
246
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_IP4, "Unknown subtype 0x%02x"),
9256
246
                        tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9257
9258
246
                switch(com_stype_low_byte) {
9259
66
                    case BGP_EXT_COM_STYPE_IP4_OSPF_RID:
9260
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9261
66
                        break;
9262
9263
104
                    default:
9264
104
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9265
104
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9266
104
                        break;
9267
246
                }
9268
170
                break;
9269
9270
170
            case BGP_EXT_COM_TYPE_HIGH_NTR_IP4: /* Non-Transitive IPv4-Address-specific Extended Community */
9271
68
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_IP4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9272
68
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9273
68
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9274
9275
68
                proto_item_set_text(community_item, "%s: %s:%u",
9276
68
                        val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_IP4, "Unknown subtype 0x%02x"),
9277
68
                        tvb_ip_to_str(pinfo->pool, tvb, offset+2), tvb_get_ntohs(tvb,offset+6));
9278
68
                break;
9279
9280
83
            case BGP_EXT_COM_TYPE_HIGH_TR_AS4: /* Transitive Four-Octet AS-Specific Extended Community */
9281
83
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9282
83
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9283
83
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9284
9285
83
                proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
9286
83
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_as4, "Unknown subtype 0x%02x"),
9287
83
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
9288
83
                        tvb_get_ntohs(tvb,offset+6));
9289
83
                break;
9290
9291
66
            case BGP_EXT_COM_TYPE_HIGH_NTR_AS4: /* Non-Transitive Four-Octet AS-Specific Extended Community */
9292
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_as4, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9293
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9294
66
                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9295
9296
66
                proto_item_set_text(community_item, "%s: %u.%u(%u):%u",
9297
66
                        val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_as4, "Unknown subtype 0x%02x"),
9298
66
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohl(tvb,offset+2),
9299
66
                        tvb_get_ntohs(tvb,offset+6));
9300
66
                break;
9301
9302
529
            case BGP_EXT_COM_TYPE_HIGH_TR_OPAQUE: /* Transitive Opaque Extended Community */
9303
529
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9304
9305
529
                proto_item_set_text(community_item, "%s:",
9306
529
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_opaque, "Unknown subtype 0x%02x"));
9307
9308
529
                switch(com_stype_low_byte) {
9309
78
                    case BGP_EXT_COM_STYPE_OPA_COST:
9310
78
                        {
9311
78
                        proto_item *cost_com_item;
9312
78
                        proto_tree *cost_com_cid_tree;
9313
9314
78
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9315
78
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9316
78
                        cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
9317
78
                        proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9318
78
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
9319
78
                            offset+4, 4, ENC_BIG_ENDIAN);
9320
78
                        proto_item_append_text(cost_com_item, " (%s)",
9321
78
                            tfs_get_string(tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
9322
9323
78
                        proto_item_append_text(community_item, " %u, POI: %s (%s)",
9324
78
                                tvb_get_ntohl(tvb, offset+4),
9325
78
                                val_to_str(tvb_get_uint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
9326
78
                                (tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
9327
78
                        }
9328
78
                        break;
9329
9330
68
                    case BGP_EXT_COM_STYPE_OPA_OSPF_RT:
9331
68
                        {
9332
68
                        proto_item *ospf_rt_opt_item;
9333
68
                        proto_tree *ospf_rt_opt_tree;
9334
9335
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9336
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9337
68
                        ospf_rt_opt_item = proto_tree_add_item(community_tree,
9338
68
                                hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9339
68
                        ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
9340
68
                        proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
9341
68
                                tvb, offset+7, 1, ENC_BIG_ENDIAN);
9342
68
                        proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
9343
68
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
9344
9345
68
                        proto_item_append_text(community_item, " Area: %s, Type: %s",
9346
68
                                tvb_ip_to_str(pinfo->pool, tvb,offset+2),
9347
68
                                val_to_str_const(tvb_get_uint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
9348
68
                        }
9349
68
                        break;
9350
9351
312
                    case BGP_EXT_COM_STYPE_OPA_ENCAP:
9352
                        /* Community octets 2 through 5 are reserved and carry no useful value according to RFC 5512. */
9353
312
                        proto_tree_add_item_ret_uint(community_tree, hf_bgp_ext_com_tunnel_type, tvb, offset+6, 2, ENC_BIG_ENDIAN, &encaps_tunnel_type);
9354
312
                        save_path_attr_encaps_tunnel_type(pinfo, encaps_tunnel_type);
9355
9356
312
                        proto_item_append_text(community_item, " %s",
9357
312
                                val_to_str_const(tvb_get_ntohs(tvb,offset+6), bgpext_com_tunnel_type, "Unknown"));
9358
312
                        break;
9359
9360
0
                    case BGP_EXT_COM_STYPE_OPA_COLOR:
9361
0
                    case BGP_EXT_COM_STYPE_OPA_DGTW:
9362
71
                    default:
9363
                        /* The particular Opaque subtype is unknown or the
9364
                         * dissector is not written yet. We will dump the
9365
                         * entire community value in 2-byte short words.
9366
                         */
9367
71
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9368
71
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9369
71
                                tvb_get_ntohs(tvb,offset+2),
9370
71
                                tvb_get_ntohs(tvb,offset+4),
9371
71
                                tvb_get_ntohs(tvb,offset+6));
9372
9373
71
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9374
71
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9375
71
                        break;
9376
529
                }
9377
507
                break;
9378
9379
507
            case BGP_EXT_COM_TYPE_HIGH_NTR_OPAQUE: /* Non-Transitive Opaque Extended Community */
9380
150
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_ntr_opaque, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9381
9382
150
                proto_item_set_text(community_item, "%s:",
9383
150
                        val_to_str(com_stype_low_byte, bgpext_com_stype_ntr_opaque, "Unknown subtype 0x%02x"));
9384
9385
150
                switch(com_stype_low_byte) {
9386
77
                    case BGP_EXT_COM_STYPE_OPA_COST:
9387
77
                        {
9388
77
                        proto_item *cost_com_item;
9389
77
                        proto_tree *cost_com_cid_tree;
9390
9391
77
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_poi, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9392
77
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9393
77
                        cost_com_cid_tree = proto_item_add_subtree(cost_com_item, ett_bgp_ext_com_cost_cid);
9394
77
                        proto_tree_add_item(cost_com_cid_tree, hf_bgp_ext_com_cost_cid_rep, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9395
77
                        cost_com_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_cost_cost, tvb,
9396
77
                            offset+4, 4, ENC_BIG_ENDIAN);
9397
77
                        proto_item_append_text(cost_com_item, " (%s)",
9398
77
                            tfs_get_string(tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP, &tfs_cost_replace));
9399
9400
77
                        proto_item_append_text(community_item, " %u, POI: %s (%s)",
9401
77
                                tvb_get_ntohl(tvb, offset+4),
9402
77
                                val_to_str(tvb_get_uint8(tvb, offset+2), bgpext_com_cost_poi_type, "Unknown subtype 0x%02x"),
9403
77
                                (tvb_get_uint8(tvb, offset+3) & BGP_EXT_COM_COST_CID_REP) ? "Replaces attribute value" : "Evaluated after");
9404
77
                        }
9405
77
                        break;
9406
9407
73
                    default:
9408
                            /* The particular Opaque subtype is unknown or the
9409
                             * dissector is not written yet. We will dump the
9410
                             * entire community value in 2-byte short words.
9411
                             */
9412
73
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9413
73
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9414
73
                                tvb_get_ntohs(tvb,offset+2),
9415
73
                                tvb_get_ntohs(tvb,offset+4),
9416
73
                                tvb_get_ntohs(tvb,offset+6));
9417
9418
73
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9419
73
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9420
73
                        break;
9421
150
                }
9422
132
                break;
9423
9424
144
            case BGP_EXT_COM_TYPE_HIGH_TR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
9425
212
            case BGP_EXT_COM_TYPE_HIGH_NTR_QOS: /* QoS Marking [Thomas_Martin_Knoll] */
9426
212
                {
9427
212
                static int * const qos_flags[] = {
9428
212
                    &hf_bgp_ext_com_qos_flags_remarking,
9429
212
                    &hf_bgp_ext_com_qos_flags_ignore_remarking,
9430
212
                    &hf_bgp_ext_com_qos_flags_agg_marking,
9431
212
                    NULL
9432
212
                };
9433
9434
212
                proto_item_set_text(community_item, "QoS Marking");
9435
9436
212
                proto_tree_add_bitmask(community_tree, tvb, offset, hf_bgp_ext_com_qos_flags,
9437
212
                        ett_bgp_ext_com_flags, qos_flags, ENC_BIG_ENDIAN);
9438
9439
212
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_set_number, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9440
212
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_tech_type, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9441
212
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_o, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9442
212
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_marking_a, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9443
212
                proto_tree_add_item(community_tree, hf_bgp_ext_com_qos_default_to_zero, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9444
212
                }
9445
212
                break;
9446
9447
96
            case BGP_EXT_COM_TYPE_HIGH_TR_COS: /* CoS Capability [Thomas_Martin_Knoll] */
9448
96
                {
9449
96
                int i;
9450
9451
96
                proto_item_set_text(community_item, "CoS Capability");
9452
9453
721
                for (i=1; i < 8; i++) {
9454
625
                    static int * const cos_flags[] = {
9455
625
                        &hf_bgp_ext_com_cos_flags_be,
9456
625
                        &hf_bgp_ext_com_cos_flags_ef,
9457
625
                        &hf_bgp_ext_com_cos_flags_af,
9458
625
                        &hf_bgp_ext_com_cos_flags_le,
9459
625
                        NULL
9460
625
                    };
9461
9462
625
                    proto_tree_add_bitmask(community_tree, tvb, offset+i, hf_bgp_ext_com_cos_flags,
9463
625
                            ett_bgp_ext_com_flags, cos_flags, ENC_BIG_ENDIAN);
9464
625
                }
9465
96
                }
9466
96
                break;
9467
9468
495
            case BGP_EXT_COM_TYPE_HIGH_TR_EVPN: /* EVPN (Sub-Types are defined in the "EVPN Extended Community Sub-Types" registry) */
9469
495
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_evpn, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9470
9471
495
                proto_item_set_text(community_item, "%s:",
9472
495
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_evpn, "Unknown subtype 0x%02x"));
9473
9474
495
                switch (com_stype_low_byte) {
9475
73
                    case BGP_EXT_COM_STYPE_EVPN_MMAC:
9476
73
                        {
9477
73
                        proto_tree *evpn_mmac_flag_tree;
9478
73
                        proto_item *evpn_mmac_flag_item;
9479
9480
73
                        evpn_mmac_flag_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9481
73
                        evpn_mmac_flag_tree = proto_item_add_subtree(evpn_mmac_flag_item, ett_bgp_ext_com_evpn_mmac_flags);
9482
73
                        proto_tree_add_item (evpn_mmac_flag_tree, hf_bgp_ext_com_evpn_mmac_flag_sticky, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9483
                        /* Octet at offset 3 is reserved per RFC 7432 Section 7.7 */
9484
73
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_mmac_seq, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9485
9486
73
                        proto_item_append_text(community_item, " %s MAC",
9487
73
                          (tvb_get_uint8(tvb,offset+2) & BGP_EXT_COM_EVPN_MMAC_STICKY) ? "Sticky" : "Movable");
9488
73
                        }
9489
73
                        break;
9490
9491
68
                    case BGP_EXT_COM_STYPE_EVPN_LABEL:
9492
68
                        {
9493
68
                        proto_item *ti;
9494
9495
68
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_esi_label_flag, tvb, offset+2, 1, ENC_BIG_ENDIAN);
9496
                        /* Octets at offsets 3 and 4 are reserved perf RFC 7432 Section 7.5 */
9497
68
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9498
68
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9499
68
                        proto_item_set_generated(ti);
9500
68
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9501
68
                        proto_item_set_generated(ti);
9502
68
                        ti = proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9503
68
                        proto_item_set_generated(ti);
9504
9505
68
                        proto_item_append_text(community_item, " %s, Label: %u",
9506
68
                                tfs_get_string(tvb_get_uint8(tvb, offset+2) & BGP_EXT_COM_ESI_LABEL_FLAGS, &tfs_esi_label_flag),
9507
68
                                tvb_get_ntoh24(tvb,offset+5) >> 4);
9508
68
                        }
9509
68
                        break;
9510
9511
72
                    case BGP_EXT_COM_STYPE_EVPN_IMP:
9512
72
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_esirt, tvb, offset+2, 6, ENC_NA);
9513
9514
72
                        proto_item_append_text(community_item, " RT: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
9515
72
                        break;
9516
9517
71
                    case BGP_EXT_COM_STYPE_EVPN_ROUTERMAC:
9518
71
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_routermac, tvb, offset+2, 6, ENC_NA);
9519
9520
71
                        proto_item_append_text(community_item, " Router's MAC: %s", tvb_ether_to_str(pinfo->pool, tvb, offset+2));
9521
71
                        break;
9522
9523
67
                    case BGP_EXT_COM_STYPE_EVPN_L2ATTR:
9524
67
                        {
9525
67
                        static int * const l2attr_flags[] = {
9526
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
9527
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_ci,
9528
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_f,
9529
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_c,
9530
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_p,
9531
67
                            &hf_bgp_ext_com_evpn_l2attr_flag_b,
9532
67
                            NULL
9533
67
                        };
9534
9535
67
                        proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_l2attr_flags,
9536
67
                            ett_bgp_ext_com_evpn_l2attr_flags, l2attr_flags, ENC_BIG_ENDIAN);
9537
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9538
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_l2attr_reserved, tvb, offset+6, 2, ENC_NA);
9539
9540
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));
9541
67
                        }
9542
67
                        break;
9543
9544
66
                    case BGP_EXT_COM_STYPE_EVPN_ETREE:
9545
66
                        {
9546
66
                        static int * const etree_flags[] = {
9547
66
                            &hf_bgp_ext_com_evpn_etree_flag_reserved,
9548
66
                            &hf_bgp_ext_com_evpn_etree_flag_l,
9549
66
                            NULL
9550
66
                        };
9551
9552
66
                        proto_tree_add_bitmask(community_tree, tvb, offset+2, hf_bgp_ext_com_evpn_etree_flags,
9553
66
                            ett_bgp_ext_com_evpn_etree_flags, etree_flags, ENC_BIG_ENDIAN);
9554
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_evpn_etree_reserved, tvb, offset+3, 2, ENC_NA);
9555
9556
66
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9557
66
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_traffic_class, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9558
66
                        proto_tree_add_item(community_tree, hf_bgp_update_mpls_bottom_stack, tvb, offset+5, 3, ENC_BIG_ENDIAN);
9559
66
                        }
9560
66
                        break;
9561
9562
78
                    default:
9563
                        /* The particular EVPN subtype is unknown or the
9564
                         * dissector is not written yet. We will dump the
9565
                         * entire community value in 2-byte short words.
9566
                         */
9567
78
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9568
78
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9569
78
                                tvb_get_ntohs(tvb,offset+2),
9570
78
                                tvb_get_ntohs(tvb,offset+4),
9571
78
                                tvb_get_ntohs(tvb,offset+6));
9572
9573
78
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9574
78
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9575
78
                        break;
9576
495
                }
9577
455
                break;
9578
9579
455
            case BGP_EXT_COM_TYPE_HIGH_TR_MUP:
9580
163
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_mup, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9581
9582
163
                proto_item_set_text(community_item, "%s:",
9583
163
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_mup, "Unknown subtype 0x%02x"));
9584
163
                switch (com_stype_low_byte) {
9585
80
                    case BGP_EXT_COM_STYPE_MUP_DIRECT_SEG:
9586
                        /* format of this community is open, then display it in 2-byte:4-byte decimal format like route target */
9587
80
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_mup_segment_id2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9588
80
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_mup_segment_id4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9589
80
                        proto_item_append_text(community_item, " %u:%u", tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9590
80
                        break;
9591
83
                    default:
9592
83
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9593
83
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9594
83
                                tvb_get_ntohs(tvb,offset+2),
9595
83
                                tvb_get_ntohs(tvb,offset+4),
9596
83
                                tvb_get_ntohs(tvb,offset+6));
9597
9598
83
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9599
83
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9600
83
                        break;
9601
163
                }
9602
142
                break;
9603
775
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT: /* Generic Transitive Extended Community */
9604
775
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9605
9606
775
                proto_item_set_text(community_item, "%s:",
9607
775
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"));
9608
9609
775
                switch (com_stype_low_byte) {
9610
72
                    case BGP_EXT_COM_STYPE_EXP_OSPF_RT:
9611
72
                        {
9612
72
                        proto_item *ospf_rt_opt_item;
9613
72
                        proto_tree *ospf_rt_opt_tree;
9614
9615
72
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_area, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9616
72
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rt_type, tvb, offset+6, 1, ENC_BIG_ENDIAN);
9617
72
                        ospf_rt_opt_item = proto_tree_add_item(community_tree,
9618
72
                                hf_bgp_ext_com_value_ospf_rt_options, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9619
72
                        ospf_rt_opt_tree = proto_item_add_subtree(ospf_rt_opt_item, ett_bgp_ext_com_ospf_rt_opt);
9620
72
                        proto_tree_add_item(ospf_rt_opt_tree, hf_bgp_ext_com_value_ospf_rt_options_mt,
9621
72
                                tvb, offset+7, 1, ENC_BIG_ENDIAN);
9622
72
                        proto_item_append_text(ospf_rt_opt_item, " (Metric: %s)",
9623
72
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_OSPF_RTYPE_METRIC_TYPE, &tfs_ospf_rt_mt));
9624
9625
72
                        proto_item_append_text(community_item, " Area: %s, Type: %s",
9626
72
                                tvb_ip_to_str(pinfo->pool, tvb,offset+2),
9627
72
                                val_to_str_const(tvb_get_uint8(tvb,offset+6), bgpext_com_ospf_rtype, "Unknown"));
9628
72
                        }
9629
72
                        break;
9630
9631
66
                    case BGP_EXT_COM_STYPE_EXP_OSPF_RID:
9632
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_ospf_rid, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9633
9634
66
                        proto_item_append_text(community_item, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+2));
9635
66
                        break;
9636
9637
67
                    case BGP_EXT_COM_STYPE_EXP_OSPF_DID:
9638
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_as2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9639
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9640
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9641
9642
67
                        proto_item_set_text(community_item, "%s: %u:%u",
9643
67
                                val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp, "Unknown subtype 0x%02x"),
9644
67
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb, offset+4));
9645
67
                        break;
9646
9647
66
                    case BGP_EXT_COM_STYPE_EXP_F_TR:  /* Flow spec traffic-rate [RFC5575] */
9648
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2,
9649
66
                                tvb, offset+2, 2, ENC_BIG_ENDIAN);
9650
                        /* remaining 4 bytes gives traffic rate in IEEE floating point */
9651
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_rate_float, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9652
9653
66
                        proto_item_append_text(community_item, " ASN %u, %.3f Mbps",
9654
66
                                tvb_get_ntohs(tvb,offset+2),
9655
66
                                tvb_get_ntohieee_float(tvb,offset+4)*8/1000000);
9656
66
                        break;
9657
9658
161
                    case BGP_EXT_COM_STYPE_EXP_F_TA:  /* Flow spec traffic-action [RFC5575] */
9659
161
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_allset, tvb, offset+2, 5, ENC_NA);
9660
161
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_samp_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9661
161
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_flow_act_term_act, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9662
9663
161
                        proto_item_append_text(community_item, " Sample: %s, Terminal: %s",
9664
161
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_S, &tfs_yes_no),
9665
161
                                tfs_get_string(tvb_get_uint8(tvb,offset+7) & BGP_EXT_COM_FSPEC_ACT_T, &tfs_yes_no));
9666
161
                        break;
9667
9668
66
                    case BGP_EXT_COM_STYPE_EXP_F_RED: /* Flow spec redirect [RFC5575] */
9669
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as2, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9670
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9671
9672
66
                        proto_item_append_text(community_item, " RT %u:%u",
9673
66
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohl(tvb,offset+4));
9674
66
                        break;
9675
9676
66
                    case BGP_EXT_COM_STYPE_EXP_F_RMARK: /* Flow spec traffic-remarking [RFC5575] */
9677
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_value_fs_remark, tvb, offset+7, 1, ENC_BIG_ENDIAN);
9678
9679
66
                        proto_item_append_text(community_item, " %s",
9680
66
                                val_to_str_ext_const(tvb_get_uint8(tvb,offset+7), &dscp_vals_ext, "Unknown DSCP"));
9681
66
                        break;
9682
9683
67
                    case BGP_EXT_COM_STYPE_EXP_L2:
9684
67
                        {
9685
67
                        static int * const com_l2_flags[] = {
9686
67
                            &hf_bgp_ext_com_l2_flag_d,
9687
67
                            &hf_bgp_ext_com_l2_flag_z1,
9688
67
                            &hf_bgp_ext_com_l2_flag_f,
9689
67
                            &hf_bgp_ext_com_l2_flag_z345,
9690
67
                            &hf_bgp_ext_com_l2_flag_c,
9691
67
                            &hf_bgp_ext_com_l2_flag_s,
9692
67
                            NULL
9693
67
                        };
9694
9695
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_encaps,tvb,offset+2, 1, ENC_BIG_ENDIAN);
9696
9697
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);
9698
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_l2_mtu, tvb, offset+4, 2, ENC_BIG_ENDIAN);
9699
67
                        }
9700
67
                        break;
9701
9702
66
                    case BGP_EXT_COM_STYPE_EXP_ETREE:
9703
66
                        {
9704
66
                        static int * const com_etree_flags[] = {
9705
66
                            &hf_bgp_ext_com_etree_flag_reserved,
9706
66
                            &hf_bgp_ext_com_etree_flag_p,
9707
66
                            &hf_bgp_ext_com_etree_flag_v,
9708
66
                            NULL
9709
66
                        };
9710
9711
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_root_vlan,tvb,offset+2, 2, ENC_BIG_ENDIAN);
9712
66
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_etree_leaf_vlan,tvb,offset+4, 2, ENC_BIG_ENDIAN);
9713
66
                        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);
9714
66
                        }
9715
66
                        break;
9716
9717
78
                    default:
9718
                        /* The particular Experimental subtype is unknown or
9719
                         * the dissector is not written yet. We will dump the
9720
                         * entire community value in 2-byte short words.
9721
                         */
9722
78
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9723
78
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9724
78
                                tvb_get_ntohs(tvb,offset+2),
9725
78
                                tvb_get_ntohs(tvb,offset+4),
9726
78
                                tvb_get_ntohs(tvb,offset+6));
9727
9728
78
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9729
78
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9730
78
                        break;
9731
775
                }
9732
705
                break;
9733
9734
705
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT_2:
9735
139
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_2, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9736
9737
139
                proto_item_set_text(community_item, "%s:",
9738
139
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp_2, "Unknown subtype 0x%02x"));
9739
9740
139
                switch (com_stype_low_byte) {
9741
66
                    case BGP_EXT_COM_STYPE_EXP_2_FLOW_RED:
9742
66
                        {
9743
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_IP4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9744
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9745
66
                        }
9746
66
                        break;
9747
9748
73
                    default:
9749
                        /* The particular Experimental subtype is unknown or
9750
                         * the dissector is not written yet. We will dump the
9751
                         * entire community value in 2-byte short words.
9752
                         */
9753
73
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9754
73
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9755
73
                                tvb_get_ntohs(tvb,offset+2),
9756
73
                                tvb_get_ntohs(tvb,offset+4),
9757
73
                                tvb_get_ntohs(tvb,offset+6));
9758
9759
73
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9760
73
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9761
73
                        break;
9762
139
                }
9763
123
                break;
9764
9765
142
            case BGP_EXT_COM_TYPE_HIGH_TR_EXT_3:
9766
142
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_3, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9767
9768
142
                proto_item_set_text(community_item, "%s:",
9769
142
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_exp_3, "Unknown subtype 0x%02x"));
9770
9771
142
                switch (com_stype_low_byte) {
9772
66
                    case BGP_EXT_COM_STYPE_EXP_3_FLOW_RED:
9773
66
                        {
9774
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_as4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
9775
66
                                proto_tree_add_item(community_tree, hf_bgp_ext_com_value_an2, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9776
66
                        }
9777
66
                        break;
9778
9779
76
                    default:
9780
                        /* The particular Experimental subtype is unknown or
9781
                         * the dissector is not written yet. We will dump the
9782
                         * entire community value in 2-byte short words.
9783
                         */
9784
76
                        proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9785
76
                                tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9786
76
                                tvb_get_ntohs(tvb,offset+2),
9787
76
                                tvb_get_ntohs(tvb,offset+4),
9788
76
                                tvb_get_ntohs(tvb,offset+6));
9789
9790
76
                        proto_item_append_text(community_item, " 0x%04x 0x%04x 0x%04x",
9791
76
                                tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9792
76
                        break;
9793
142
                }
9794
123
                break;
9795
9796
826
            case BGP_EXT_COM_TYPE_HIGH_TR_EXP_EIGRP:
9797
826
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_tr_exp_eigrp, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9798
9799
826
                proto_item_set_text(community_item, "%s:",
9800
826
                        val_to_str(com_stype_low_byte, bgpext_com_stype_tr_eigrp, "Unknown subtype 0x%02x"));
9801
9802
826
                switch(com_stype_low_byte) {
9803
225
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_FT:
9804
225
                        {
9805
225
                        proto_item *eigrp_flags_item;
9806
225
                        proto_tree *eigrp_flags_tree;
9807
9808
225
                        eigrp_flags_item = proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_flags, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9809
225
                        eigrp_flags_tree = proto_item_add_subtree(eigrp_flags_item, ett_bgp_ext_com_eigrp_flags);
9810
9811
225
                        proto_tree_add_item(eigrp_flags_tree, hf_bgp_ext_com_eigrp_flags_rt, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9812
225
                        proto_item_append_text(eigrp_flags_tree, " (%s)",
9813
225
                                tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
9814
225
                        proto_item_append_text(community_tree, " %s route",
9815
225
                                tfs_get_string(tvb_get_ntohs(tvb, offset+2) & BGP_EXT_COM_EXP_EIGRP_FLAG_RT, &tfs_eigrp_rtype));
9816
9817
225
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rtag, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9818
225
                        proto_item_append_text(community_tree, ", Tag: %u", tvb_get_ntohl(tvb, offset+4));
9819
225
                        }
9820
225
                        break;
9821
9822
67
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_AD:
9823
67
                        {
9824
67
                        uint32_t raw_value;
9825
9826
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9827
9828
67
                        raw_value = tvb_get_ntohl(tvb, offset+4);
9829
67
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_delay,
9830
67
                                tvb, offset+4, 4, raw_value, "%u (%u usec)", raw_value, raw_value * 10 / 256);
9831
9832
67
                        proto_item_append_text(community_item, " ASN: %u, D: %u",
9833
67
                                tvb_get_ntohs(tvb, offset+2), raw_value);
9834
67
                        }
9835
67
                        break;
9836
9837
151
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_RHB:
9838
151
                        {
9839
151
                        uint32_t raw_value;
9840
9841
151
                        raw_value = tvb_get_uint8(tvb, offset+2);
9842
151
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_rly,
9843
151
                                tvb, offset+2, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
9844
151
                        proto_item_append_text(community_item, " R: %u", raw_value);
9845
9846
151
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_hops, tvb, offset+3, 1, ENC_BIG_ENDIAN);
9847
151
                        proto_item_append_text(community_tree, ", H: %u", tvb_get_uint8(tvb, offset+3));
9848
9849
151
                        raw_value = tvb_get_ntohl(tvb, offset+4);
9850
151
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_bw,
9851
151
                                tvb, offset+4, 4, raw_value, "%u (%u Kbps)", raw_value, raw_value ? (2560000000U / raw_value) : 0);
9852
151
                        proto_item_append_text(community_tree, ", B: %u", raw_value);
9853
151
                        }
9854
151
                        break;
9855
9856
67
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_LM:
9857
67
                        {
9858
67
                        uint32_t raw_value;
9859
9860
67
                        raw_value = tvb_get_uint8(tvb, offset+3);
9861
67
                        proto_tree_add_uint_format_value(community_tree, hf_bgp_ext_com_eigrp_load,
9862
67
                                tvb, offset+3, 1, raw_value, "%u (%u%%)", raw_value, (raw_value * 100) / 255);
9863
67
                        proto_item_append_text(community_tree, " L: %u", raw_value);
9864
9865
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_mtu, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9866
67
                        proto_item_append_text(community_tree, ", M: %u", tvb_get_ntohl(tvb, offset+4));
9867
67
                        }
9868
67
                        break;
9869
9870
67
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_EAR:
9871
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_asn, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9872
67
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9873
9874
67
                        proto_item_append_text(community_tree, " ASN: %u, RID: %s",
9875
67
                                tvb_get_ntohs(tvb, offset+2), tvb_ip_to_str(pinfo->pool, tvb, offset+4));
9876
67
                        break;
9877
9878
87
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_EPM:
9879
87
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_pid, tvb, offset+2, 2, ENC_BIG_ENDIAN);
9880
87
                        proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_e_m, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9881
9882
87
                        proto_item_append_text(community_tree, " %s, Metric: %u",
9883
87
                          val_to_str(tvb_get_ntohs(tvb, offset+2), eigrp_proto2string, "Unknown protocol %u"),
9884
87
                          tvb_get_ntohl(tvb, offset+4));
9885
87
                        break;
9886
9887
66
                    case BGP_EXT_COM_STYPE_EXP_EIGRP_RID:
9888
66
                       proto_tree_add_item(community_tree, hf_bgp_ext_com_eigrp_rid, tvb, offset+4, 4, ENC_BIG_ENDIAN);
9889
66
                       proto_item_append_text(community_tree, " %s", tvb_ip_to_str(pinfo->pool, tvb, offset+4));
9890
66
                     break;
9891
826
                }
9892
761
                break;
9893
9894
761
            case BGP_EXT_COM_TYPE_HIGH_TR_FLOW: /* Flow spec redirect/mirror to IP next-hop [draft-simpson-idr-flowspec-redirect] */
9895
368
            default:
9896
368
                proto_tree_add_item(community_tree, hf_bgp_ext_com_stype_low_unknown, tvb, offset+1, 1, ENC_BIG_ENDIAN);
9897
9898
368
                proto_tree_add_uint64_format_value(community_tree, hf_bgp_ext_com_value_raw, tvb, offset+2, 6,
9899
368
                        tvb_get_ntoh48 (tvb, offset+2), "0x%04x 0x%04x 0x%04x",
9900
368
                        tvb_get_ntohs(tvb,offset+2),
9901
368
                        tvb_get_ntohs(tvb,offset+4),
9902
368
                        tvb_get_ntohs(tvb,offset+6));
9903
9904
368
                proto_item_set_text(community_item, "Unknown type 0x%02x subtype 0x%02x: 0x%04x 0x%04x 0x%04x",
9905
368
                        com_type_high_byte, com_stype_low_byte,
9906
368
                        tvb_get_ntohs(tvb,offset+2), tvb_get_ntohs(tvb,offset+4), tvb_get_ntohs(tvb,offset+6));
9907
368
                break;
9908
5.24k
        }
9909
4.62k
        proto_item_append_text (community_item, " [%s]", val_to_str_const(com_type_high_byte, bgpext_com_type_high, "Unknown community"));
9910
4.62k
        offset = offset + 8;
9911
4.62k
    }
9912
621
    return 0;
9913
1.24k
}
9914
9915
static int
9916
dissect_bgp_update_pmsi_attr(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, uint16_t tlen, unsigned tvb_off)
9917
3.03k
{
9918
3.03k
    int             offset=0;
9919
3.03k
    uint8_t         tunnel_type=0;
9920
3.03k
    uint8_t         opaque_value_type=0;
9921
3.03k
    uint8_t         rn_addr_length=0;
9922
3.03k
    uint16_t        tunnel_id_len=0;
9923
3.03k
    uint16_t        opaque_value_length=0;
9924
3.03k
    proto_item      *tunnel_id_item=NULL;
9925
3.03k
    proto_item      *opaque_value_type_item=NULL;
9926
3.03k
    proto_item      *pmsi_tunnel_type_item=NULL;
9927
3.03k
    proto_tree      *tunnel_id_tree=NULL;
9928
3.03k
    path_attr_data  *data = NULL;
9929
9930
3.03k
    offset = tvb_off ;
9931
3.03k
    tunnel_id_len = tlen - 5;
9932
9933
3.03k
    proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_flags, tvb, offset,
9934
3.03k
                        1, ENC_BIG_ENDIAN);
9935
9936
3.03k
    pmsi_tunnel_type_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_type, tvb, offset+1,
9937
3.03k
                                                1, ENC_BIG_ENDIAN);
9938
9939
3.03k
    data = load_path_attr_data(pinfo);
9940
3.03k
    if (data && data->encaps_community_present &&
9941
3.03k
            (data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLAN || data->encaps_tunnel_type == BGP_EXT_COM_TUNNEL_VXLANGPE)) {
9942
388
        proto_tree_add_item(parent_tree, hf_bgp_evpn_nlri_vni, tvb, offset+2, 3, ENC_BIG_ENDIAN);
9943
2.64k
    } else {
9944
2.64k
        proto_tree_add_item(parent_tree, hf_bgp_update_mpls_label_value_20bits, tvb, offset+2, 3, ENC_BIG_ENDIAN);
9945
2.64k
    }
9946
9947
3.03k
    tunnel_id_item = proto_tree_add_item(parent_tree, hf_bgp_pmsi_tunnel_id, tvb, offset+5,
9948
3.03k
                        tunnel_id_len, ENC_NA);
9949
3.03k
    tunnel_id_tree = proto_item_add_subtree(tunnel_id_item, ett_bgp_pmsi_tunnel_id);
9950
9951
3.03k
    tunnel_type = tvb_get_uint8(tvb, offset+1);
9952
3.03k
    switch(tunnel_type) {
9953
204
        case PMSI_TUNNEL_NOPRESENT:
9954
204
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_not_present, tvb, offset+1, 1, ENC_NA);
9955
204
            break;
9956
211
        case PMSI_TUNNEL_RSVPTE_P2MP:
9957
211
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_id, tvb, offset+5, 4, ENC_BIG_ENDIAN);
9958
211
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id, tvb, offset+11, 2, ENC_BIG_ENDIAN);
9959
211
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4, tvb, offset+13, 4, ENC_BIG_ENDIAN);
9960
211
            proto_item_append_text(tunnel_id_item, ": Id %u, Ext Id %s",
9961
211
                                tvb_get_ntohs(tvb, offset+11), tvb_ip_to_str(pinfo->pool, tvb, offset+13));
9962
211
            break;
9963
542
        case PMSI_TUNNEL_MLDP_P2MP:
9964
951
        case PMSI_TUNNEL_MLDP_MP2MP:
9965
951
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_type, tvb, offset+5, 1, ENC_BIG_ENDIAN);
9966
951
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_afi, tvb, offset+6, 2, ENC_BIG_ENDIAN);
9967
951
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len, tvb, offset+8, 1, ENC_BIG_ENDIAN);
9968
951
            rn_addr_length = tvb_get_uint8(tvb, offset+8);
9969
951
            if(rn_addr_length == 4)
9970
453
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4, tvb, offset+9, 4, ENC_BIG_ENDIAN);
9971
498
            else
9972
498
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6, tvb, offset+9, 16, ENC_NA);
9973
9974
951
            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);
9975
951
            opaque_value_type_item = proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
9976
951
                                                         tvb, offset+11+rn_addr_length, 1, ENC_BIG_ENDIAN);
9977
951
            opaque_value_type = tvb_get_uint8(tvb, offset+11+rn_addr_length);
9978
951
            if(opaque_value_type == PMSI_MLDP_FEC_TYPE_GEN_LSP) {
9979
419
                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);
9980
419
                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);
9981
419
                proto_item_append_text(tunnel_id_item, ": Type: %s root node: %s Id: %u",
9982
419
                                       val_to_str_const(tvb_get_uint8(tvb, offset+5), fec_types_vals, "Unknown"),
9983
419
                                       tvb_ip_to_str(pinfo->pool, tvb, offset+9),
9984
419
                                       tvb_get_ntohl(tvb, offset+14+rn_addr_length));
9985
532
            } else if (opaque_value_type == PMSI_MLDP_FEC_TYPE_EXT_TYPE) {
9986
67
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type, tvb, offset+12+rn_addr_length, 2, ENC_BIG_ENDIAN);
9987
67
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len, tvb, offset+14+rn_addr_length, 2, ENC_BIG_ENDIAN);
9988
67
                opaque_value_length = tvb_get_ntohs(tvb, offset+14+rn_addr_length);
9989
67
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str, tvb, offset+16+rn_addr_length,
9990
67
                                    opaque_value_length, ENC_ASCII);
9991
67
            }
9992
465
            else {
9993
                /* This covers situation when opaque id is 0 (reserved) or any other value */
9994
465
                expert_add_info_format(pinfo, opaque_value_type_item, &ei_bgp_attr_pmsi_opaque_type,
9995
465
                                            "Opaque Value type %u wrong, must be modulo 1 or 255", opaque_value_type);
9996
465
            }
9997
951
            break;
9998
490
        case PMSI_TUNNEL_PIMSSM:
9999
490
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_root_node, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10000
490
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimssm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10001
490
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10002
490
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10003
490
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10004
490
            break;
10005
196
        case PMSI_TUNNEL_PIMSM:
10006
196
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10007
196
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimsm_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10008
196
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10009
196
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10010
196
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10011
196
            break;
10012
194
        case PMSI_TUNNEL_BIDIR_PIM:
10013
194
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_sender, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10014
194
            proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_pimbidir_pmc_group, tvb, offset+9, 4, ENC_BIG_ENDIAN);
10015
194
            proto_item_append_text(tunnel_id_item, ": < %s, %s >",
10016
194
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+5),
10017
194
                                   tvb_ip_to_str(pinfo->pool, tvb, offset+9));
10018
194
            break;
10019
175
        case PMSI_TUNNEL_INGRESS:
10020
175
            if(tunnel_id_len == 4){
10021
66
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr, tvb, offset+5, 4, ENC_BIG_ENDIAN);
10022
66
                proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
10023
66
                                       tvb_ip_to_str(pinfo->pool, tvb, offset+5));
10024
109
            } else {
10025
109
                proto_tree_add_item(tunnel_id_tree, hf_bgp_pmsi_tunnel_ingress_rep_addr6, tvb, offset+5, 16, ENC_NA);
10026
109
                proto_item_append_text(tunnel_id_item, ": tunnel end point -> %s",
10027
109
                                       tvb_ip6_to_str(pinfo->pool, tvb, offset+5));
10028
109
            }
10029
175
            break;
10030
552
        default:
10031
552
            expert_add_info_format(pinfo, pmsi_tunnel_type_item, &ei_bgp_attr_pmsi_tunnel_type,
10032
552
                                            "Tunnel type %u wrong", tunnel_type);
10033
552
            break;
10034
3.03k
    }
10035
10036
10037
2.86k
    return 0;
10038
3.03k
}
10039
10040
/*
10041
 * Dissect BGP path attributes
10042
 *
10043
 */
10044
void
10045
// NOLINTNEXTLINE(misc-no-recursion)
10046
dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, uint16_t path_attr_len, unsigned tvb_off, packet_info *pinfo)
10047
11.1k
{
10048
11.1k
    uint8_t       bgpa_flags;                 /* path attributes          */
10049
11.1k
    uint8_t       bgpa_type;
10050
11.1k
    int           o;                          /* packet offset            */
10051
11.1k
    int           q=0;                        /* tmp                      */
10052
11.1k
    int           end=0;                      /* message end              */
10053
11.1k
    int           advance;                    /* tmp                      */
10054
11.1k
    proto_item    *ti;                        /* tree item                */
10055
11.1k
    proto_item    *ti_communities;            /* tree communities         */
10056
11.1k
    proto_item    *ti_community;              /* tree for each community  */
10057
11.1k
    proto_item    *ti_as;                     /* tree for each as         */
10058
11.1k
    proto_item    *attr_len_item;
10059
11.1k
    proto_item    *aigp_type_item;
10060
11.1k
    proto_tree    *subtree2;                  /* path attribute subtree   */
10061
11.1k
    proto_tree    *subtree3;                  /* subtree for attributes   */
10062
11.1k
    proto_tree    *subtree4;                  /* subtree for attributes   */
10063
11.1k
    proto_tree    *subtree5;                  /* subtree for attributes   */
10064
11.1k
    proto_tree    *subtree6;                  /* subtree for attributes   */
10065
11.1k
    proto_tree    *subtree7;                  /* subtree for attributes   */
10066
11.1k
    proto_tree    *subtree8;                  /* subtree for attributes   */
10067
11.1k
    proto_tree    *attr_set_subtree;          /* subtree for attr_set     */
10068
11.1k
    proto_tree    *as_path_segment_tree;      /* subtree for AS_PATH segments */
10069
11.1k
    int           number_as_segment=0;        /* Number As segment        */
10070
11.1k
    proto_tree    *communities_tree;          /* subtree for COMMUNITIES  */
10071
11.1k
    proto_tree    *community_tree;            /* subtree for a community  */
10072
11.1k
    proto_tree    *cluster_list_tree;         /* subtree for CLUSTER_LIST */
10073
11.1k
    int           i=0, j, k;                  /* tmp                      */
10074
11.1k
    uint8_t       type=0;                     /* AS_PATH segment type     */
10075
11.1k
    uint8_t       length=0;                   /* AS_PATH segment length   */
10076
11.1k
    uint32_t      aggregator_as;
10077
11.1k
    uint16_t      ssa_type;                   /* SSA T + Type */
10078
11.1k
    uint16_t      ssa_len;                    /* SSA TLV Length */
10079
11.1k
    uint8_t       ssa_v3_len;                 /* SSA L2TPv3 Cookie Length */
10080
11.1k
    uint16_t      encaps_tunnel_type;         /* Encapsulation Tunnel Type */
10081
11.1k
    uint16_t      encaps_tunnel_len;          /* Encapsulation TLV Length */
10082
11.1k
    uint8_t       encaps_tunnel_subtype;      /* Encapsulation Tunnel Sub-TLV Type */
10083
11.1k
    uint16_t      encaps_tunnel_sublen;       /* Encapsulation TLV Sub-TLV Length */
10084
11.1k
    uint16_t      encaps_tunnel_sub_totallen; /* Encapsulation TLV Sub-TLV Length + Type + Length field */
10085
11.1k
    uint8_t       aigp_type;                  /* AIGP TLV type from AIGP attribute */
10086
11.1k
    uint8_t       prefix_sid_subtype;         /* BGP Prefix-SID TLV Type */
10087
11.1k
    uint16_t      prefix_sid_sublen;          /* BGP Prefix-SID TLV Length */
10088
11.1k
    int           prefix_sid_sub_tlv_offset;  /* BGP Prefix-SID SRGB Length */
10089
11.1k
    int           check_srgb;                 /* BGP Prefix-SID SRGB counter */
10090
11.1k
    uint16_t      secpathlen;                 /* BGPsec Secure Path length */
10091
11.1k
    uint16_t      sigblocklen;                /* BGPsec Signature Block length */
10092
11.1k
    uint8_t       secpathcount;               /* Number of Secure Path Segments */
10093
11.1k
    uint16_t      sig_len;                    /* Length of BGPsec Signature */
10094
11.1k
    uint32_t      segment_subtlv_type;        /* Segment List SubTLV Type */
10095
11.1k
    uint32_t      segment_subtlv_length;      /* Segment List SubTLV Length */
10096
11.1k
    uint8_t       srv6_service_subtlv_type;         /* SRv6 Service Sub-TLV type */
10097
11.1k
    uint16_t      srv6_service_subtlv_len;          /* SRv6 Service Sub-TLV length */
10098
11.1k
    uint8_t       srv6_service_data_subsubtlv_type; /* SRv6 Service Data Sub-Sub-TLV type */
10099
11.1k
    uint16_t      srv6_service_data_subsubtlv_len;  /* SRv6 Service Data Sub-Sub-TLV length */
10100
10101
11.1k
    o = tvb_off;
10102
10103
11.1k
    increment_dissection_depth(pinfo);
10104
66.1k
    while (i < path_attr_len) {
10105
63.5k
        proto_item *ti_pa, *ti_flags;
10106
63.5k
        int     off;
10107
63.5k
        int     alen, aoff, tlen, aoff_save;
10108
63.5k
        uint8_t snpa;
10109
63.5k
        uint8_t nexthop_len;
10110
63.5k
        uint8_t asn_len = 0;
10111
63.5k
        uint32_t af, saf, as_num;
10112
10113
63.5k
        static int * const path_flags[] = {
10114
63.5k
            &hf_bgp_update_path_attribute_flags_optional,
10115
63.5k
            &hf_bgp_update_path_attribute_flags_transitive,
10116
63.5k
            &hf_bgp_update_path_attribute_flags_partial,
10117
63.5k
            &hf_bgp_update_path_attribute_flags_extended_length,
10118
63.5k
            &hf_bgp_update_path_attribute_flags_unused,
10119
63.5k
            NULL
10120
63.5k
        };
10121
10122
63.5k
        bgpa_flags = tvb_get_uint8(tvb, o + i);
10123
63.5k
        bgpa_type = tvb_get_uint8(tvb, o + i+1);
10124
10125
        /* check for the Extended Length bit */
10126
63.5k
        if (bgpa_flags & BGP_ATTR_FLAG_EXTENDED_LENGTH) {
10127
1.74k
            alen = tvb_get_ntohs(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
10128
1.74k
            aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+2;
10129
61.7k
        } else {
10130
61.7k
            alen = tvb_get_uint8(tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE);
10131
61.7k
            aoff = BGP_SIZE_OF_PATH_ATTRIBUTE+1;
10132
61.7k
        }
10133
63.5k
        tlen = alen;
10134
10135
63.5k
        ti_pa = proto_tree_add_item(subtree, hf_bgp_update_path_attribute, tvb, o + i, tlen + aoff, ENC_NA);
10136
63.5k
        proto_item_append_text(ti_pa, " - %s", val_to_str(bgpa_type, bgpattr_type, "Unknown (%u)"));
10137
10138
63.5k
        subtree2 = proto_item_add_subtree(ti_pa, ett_bgp_attr);
10139
10140
63.5k
        ti_flags = proto_tree_add_bitmask(subtree2, tvb, o + i, hf_bgp_update_path_attribute_flags, ett_bgp_attr_flags, path_flags, ENC_NA);
10141
10142
63.5k
        if ((bgpa_flags & BGP_ATTR_FLAG_OPTIONAL) == 0)
10143
56.6k
            proto_item_append_text(ti_flags, "%s", ", Well-known");
10144
63.5k
        if ((bgpa_flags & BGP_ATTR_FLAG_TRANSITIVE) == 0)
10145
56.0k
            proto_item_append_text(ti_flags, "%s", ", Non-transitive");
10146
63.5k
        if ((bgpa_flags & BGP_ATTR_FLAG_PARTIAL) == 0)
10147
48.6k
            proto_item_append_text(ti_flags, "%s", ", Complete");
10148
10149
63.5k
        proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_type_code, tvb, o + i + 1, 1, ENC_BIG_ENDIAN);
10150
10151
63.5k
        attr_len_item = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_length, tvb, o + i + BGP_SIZE_OF_PATH_ATTRIBUTE,
10152
63.5k
                                            aoff - BGP_SIZE_OF_PATH_ATTRIBUTE, ENC_BIG_ENDIAN);
10153
63.5k
        if (aoff + tlen > path_attr_len - i) {
10154
646
            proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10155
646
                                         "Path attribute length is invalid: %u byte%s", tlen,
10156
646
                                         plurality(tlen, "", "s"));
10157
646
            return;
10158
646
        }
10159
10160
        /* Path Attribute Type */
10161
62.8k
        switch (bgpa_type) {
10162
1.08k
            case BGPTYPE_ORIGIN:
10163
1.08k
                if (tlen != 1) {
10164
775
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10165
775
                                                 "Origin (invalid): %u byte%s", tlen,
10166
775
                                                 plurality(tlen, "", "s"));
10167
775
                } else {
10168
308
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_origin, tvb,
10169
308
                                        o + i + aoff, 1, ENC_BIG_ENDIAN);
10170
308
                    proto_item_append_text(ti_pa, ": %s", val_to_str_const(tvb_get_uint8(tvb, o + i + aoff), bgpattr_origin, "Unknown"));
10171
308
                }
10172
1.08k
                break;
10173
2.05k
            case BGPTYPE_AS_PATH:
10174
2.68k
            case BGPTYPE_AS4_PATH:
10175
                /* Apply heuristic to guess if we are facing 2 or 4 bytes ASN
10176
                   (o + i + aoff) =
10177
                   (o + current attribute + aoff bytes to first tuple)
10178
                   heuristic also tell us how many AS segments we have */
10179
2.68k
                asn_len = heuristic_as2_or_4_from_as_path(tvb, o+i+aoff, o+i+aoff+tlen,
10180
2.68k
                                                          bgpa_type, &number_as_segment);
10181
2.68k
                if (asn_len == 255)
10182
1.18k
                    {
10183
1.18k
                        expert_add_info_format(pinfo, ti_pa, &ei_bgp_attr_as_path_as_len_err,
10184
1.18k
                                               "ASN length uncalculated by heuristic : %u", asn_len);
10185
1.18k
                        break;
10186
1.18k
                    }
10187
1.50k
                proto_item_append_text(ti_pa,": ");
10188
1.50k
                if(tlen == 0) {
10189
579
                    proto_item_append_text(ti_pa,"empty");
10190
579
                }
10191
1.50k
                q = o + i + aoff;
10192
3.27k
                for (k=0; k < number_as_segment; k++)
10193
1.87k
                {
10194
1.87k
                    type = tvb_get_uint8(tvb, q);
10195
1.87k
                    length = tvb_get_uint8(tvb, q+1);
10196
1.87k
                    ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_as_path_segment, tvb,
10197
1.87k
                                             q, length * asn_len + 2, ENC_NA);
10198
1.87k
                    proto_item_append_text(ti,": ");
10199
1.87k
                    as_path_segment_tree = proto_item_add_subtree(ti, ett_bgp_as_path_segment);
10200
1.87k
                    proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_type, tvb,
10201
1.87k
                                        q, 1, ENC_BIG_ENDIAN);
10202
1.87k
                    proto_tree_add_item(as_path_segment_tree, hf_bgp_update_path_attribute_as_path_segment_length, tvb,
10203
1.87k
                                        q+1, 1, ENC_BIG_ENDIAN);
10204
1.87k
                    switch(type)
10205
1.87k
                    {
10206
538
                        case AS_SET:
10207
538
                            proto_item_append_text(ti_pa, "{");
10208
538
                            proto_item_append_text(ti, "{");
10209
538
                            break;
10210
525
                        case AS_CONFED_SET:
10211
525
                            proto_item_append_text(ti_pa, "[");
10212
525
                            proto_item_append_text(ti, "[");
10213
525
                            break;
10214
131
                        case AS_CONFED_SEQUENCE:
10215
131
                            proto_item_append_text(ti_pa, "(");
10216
131
                            proto_item_append_text(ti, "(");
10217
131
                            break;
10218
1.87k
                    }
10219
10220
1.87k
                    q = q + 2;
10221
5.41k
                    for (j = 0; j < length; j++)
10222
3.54k
                    {
10223
3.54k
                        if(asn_len == 2) {
10224
919
                            ti_as = proto_tree_add_item_ret_uint(as_path_segment_tree,
10225
919
                                                hf_bgp_update_path_attribute_as_path_segment_as2,
10226
919
                                                tvb, q, 2, ENC_BIG_ENDIAN, &as_num);
10227
919
                            if (as_num == BGP_AS_TRANS) {
10228
197
                                proto_item_append_text(ti_as, " (AS_TRANS)");
10229
197
                            }
10230
919
                            proto_item_append_text(ti_pa, "%u",
10231
919
                                                   tvb_get_ntohs(tvb, q));
10232
919
                            proto_item_append_text(ti, "%u",
10233
919
                                                   tvb_get_ntohs(tvb, q));
10234
919
                        }
10235
2.62k
                        else if (asn_len == 4) {
10236
2.62k
                            proto_tree_add_item(as_path_segment_tree,
10237
2.62k
                                                hf_bgp_update_path_attribute_as_path_segment_as4,
10238
2.62k
                                                tvb, q, 4, ENC_BIG_ENDIAN);
10239
2.62k
                            proto_item_append_text(ti_pa, "%u",
10240
2.62k
                                                   tvb_get_ntohl(tvb, q));
10241
2.62k
                            proto_item_append_text(ti, "%u",
10242
2.62k
                                                   tvb_get_ntohl(tvb, q));
10243
2.62k
                        }
10244
3.54k
                        if (j != length-1)
10245
2.80k
                        {
10246
2.80k
                            proto_item_append_text(ti_pa, "%s",
10247
2.80k
                                                   (type == AS_SET || type == AS_CONFED_SET) ?
10248
1.74k
                                                   ", " : " ");
10249
2.80k
                            proto_item_append_text(ti, "%s",
10250
2.80k
                                                   (type == AS_SET || type == AS_CONFED_SET) ?
10251
1.74k
                                                   ", " : " ");
10252
2.80k
                        }
10253
3.54k
                        q += asn_len;
10254
3.54k
                    }
10255
1.87k
                    switch(type)
10256
1.87k
                    {
10257
510
                        case AS_SET:
10258
510
                            proto_item_append_text(ti_pa, "} ");
10259
510
                            proto_item_append_text(ti, "}");
10260
510
                            break;
10261
502
                        case AS_CONFED_SET:
10262
502
                            proto_item_append_text(ti_pa, "] ");
10263
502
                            proto_item_append_text(ti, "]");
10264
502
                            break;
10265
119
                        case AS_CONFED_SEQUENCE:
10266
119
                            proto_item_append_text(ti_pa, ") ");
10267
119
                            proto_item_append_text(ti, ")");
10268
119
                            break;
10269
642
                        default:
10270
642
                            proto_item_append_text(ti_pa, " ");
10271
642
                            break;
10272
1.87k
                    }
10273
1.87k
                }
10274
10275
1.39k
                break;
10276
1.39k
            case BGPTYPE_NEXT_HOP:
10277
833
                if (tlen != 4) {
10278
632
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10279
632
                                                 "Next hop (invalid): %u byte%s", tlen,
10280
632
                                                 plurality(tlen, "", "s"));
10281
632
                } else {
10282
201
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_next_hop, tvb,
10283
201
                                        o + i + aoff, 4, ENC_BIG_ENDIAN);
10284
201
                    proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
10285
201
                }
10286
833
                break;
10287
813
            case BGPTYPE_MULTI_EXIT_DISC:
10288
813
                if (tlen != 4) {
10289
567
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10290
567
                                                 "Multiple exit discriminator (invalid): %u byte%s",
10291
567
                                                 tlen, plurality(tlen, "", "s"));
10292
567
                } else {
10293
246
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_multi_exit_disc, tvb,
10294
246
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10295
246
                    proto_item_append_text(ti_pa,": %u", tvb_get_ntohl(tvb, o + i + aoff));
10296
246
                }
10297
813
                break;
10298
492
            case BGPTYPE_LOCAL_PREF:
10299
492
                if (tlen != 4) {
10300
290
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10301
290
                                                 "Local preference (invalid): %u byte%s", tlen,
10302
290
                                                 plurality(tlen, "", "s"));
10303
290
                } else {
10304
202
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_local_pref, tvb,
10305
202
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10306
202
                    proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
10307
202
                }
10308
492
                break;
10309
449
            case BGPTYPE_ATOMIC_AGGREGATE:
10310
449
                if (tlen != 0) {
10311
225
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10312
225
                                                 "Atomic aggregate (invalid): %u byte%s", tlen,
10313
225
                                                 plurality(tlen, "", "s"));
10314
225
                }
10315
449
                break;
10316
449
            case BGPTYPE_AGGREGATOR:
10317
449
                if (tlen != 6 && tlen != 8) {
10318
316
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10319
316
                                                 "Aggregator (invalid): %u byte%s", tlen,
10320
316
                                                 plurality(tlen, "", "s"));
10321
316
                    break;
10322
316
                }
10323
                /* FALL THROUGH */
10324
540
            case BGPTYPE_AS4_AGGREGATOR:
10325
540
                if (bgpa_type == BGPTYPE_AS4_AGGREGATOR && tlen != 8)
10326
340
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10327
340
                                                 "Aggregator (invalid): %u byte%s", tlen,
10328
340
                                                 plurality(tlen, "", "s"));
10329
200
                else {
10330
200
                    asn_len = tlen - 4;
10331
200
                    aggregator_as = (asn_len == 2) ?
10332
67
                        tvb_get_ntohs(tvb, o + i + aoff) :
10333
200
                        tvb_get_ntohl(tvb, o + i + aoff);
10334
200
                    proto_tree_add_uint(subtree2, hf_bgp_update_path_attribute_aggregator_as, tvb,
10335
200
                                        o + i + aoff, asn_len, aggregator_as);
10336
200
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aggregator_origin, tvb,
10337
200
                                        o + i + aoff + asn_len, 4, ENC_BIG_ENDIAN);
10338
10339
200
                    proto_item_append_text(ti_pa, ": AS: %u origin: %s", aggregator_as,
10340
200
                                           tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff + asn_len));
10341
200
                }
10342
540
                break;
10343
727
            case BGPTYPE_COMMUNITIES:
10344
727
                if (tlen % 4 != 0) {
10345
270
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10346
270
                                                 "Communities (invalid): %u byte%s", tlen,
10347
270
                                                 plurality(tlen, "", "s"));
10348
270
                    break;
10349
270
                }
10350
10351
457
                proto_item_append_text(ti_pa, ": ");
10352
10353
457
                ti_communities = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_communities,
10354
457
                                                     tvb, o + i + aoff, tlen, ENC_NA);
10355
10356
457
                communities_tree = proto_item_add_subtree(ti_communities,
10357
457
                                                          ett_bgp_communities);
10358
457
                proto_item_append_text(ti_communities, ": ");
10359
                /* (o + i + aoff) =
10360
                   (o + current attribute + aoff bytes to first tuple) */
10361
457
                q = o + i + aoff;
10362
457
                end = q + tlen;
10363
10364
                /* snarf each community */
10365
1.46k
                while (q < end) {
10366
                    /* check for reserved values */
10367
1.01k
                    uint32_t community = tvb_get_ntohl(tvb, q);
10368
1.01k
                    if ((community & 0xFFFF0000) == FOURHEX0 ||
10369
1.01k
                        (community & 0xFFFF0000) == FOURHEXF) {
10370
487
                        proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community_well_known,
10371
487
                                            tvb, q, 4, ENC_BIG_ENDIAN);
10372
487
                        proto_item_append_text(ti_pa, "%s ", val_to_str_const(community, community_vals, "Reserved"));
10373
487
                        proto_item_append_text(ti_communities, "%s ", val_to_str_const(community, community_vals, "Reserved"));
10374
487
                    }
10375
523
                    else {
10376
523
                        ti_community = proto_tree_add_item(communities_tree, hf_bgp_update_path_attribute_community, tvb,
10377
523
                                                           q, 4, ENC_NA);
10378
523
                        community_tree = proto_item_add_subtree(ti_community,
10379
523
                                                                ett_bgp_community);
10380
523
                        proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_as,
10381
523
                                            tvb, q, 2, ENC_BIG_ENDIAN);
10382
523
                        proto_tree_add_item(community_tree, hf_bgp_update_path_attribute_community_value,
10383
523
                                            tvb, q+2, 2, ENC_BIG_ENDIAN);
10384
523
                        proto_item_append_text(ti_pa, "%u:%u ",tvb_get_ntohs(tvb, q),
10385
523
                                               tvb_get_ntohs(tvb, q+2));
10386
523
                        proto_item_append_text(ti_communities, "%u:%u ",tvb_get_ntohs(tvb, q),
10387
523
                                               tvb_get_ntohs(tvb, q+2));
10388
523
                        proto_item_append_text(ti_community, ": %u:%u ",tvb_get_ntohs(tvb, q),
10389
523
                                               tvb_get_ntohs(tvb, q+2));
10390
523
                    }
10391
10392
1.01k
                    q += 4;
10393
1.01k
                }
10394
10395
10396
457
                break;
10397
365
            case BGPTYPE_ORIGINATOR_ID:
10398
365
                if (tlen != 4) {
10399
297
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10400
297
                                                 "Originator identifier (invalid): %u byte%s", tlen,
10401
297
                                                 plurality(tlen, "", "s"));
10402
297
                } else {
10403
68
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_originator_id, tvb,
10404
68
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
10405
68
                    proto_item_append_text(ti_pa, ": %s ", tvb_ip_to_str(pinfo->pool, tvb, o + i + aoff));
10406
68
                }
10407
365
                break;
10408
8.76k
            case BGPTYPE_MP_REACH_NLRI:
10409
                /* RFC 2283 says that a MP_[UN]REACH_NLRI path attribute can
10410
                 * have more than one <AFI, SAFI, Next Hop, ..., NLRI> tuple.
10411
                 * However, that doesn't work because the NLRI is also a
10412
                 * variable number of <length, prefix> fields without a field
10413
                 * for the overall length of the NLRI. Thus one would have to
10414
                 * guess whether a particular byte were the length of the next
10415
                 * prefix or a new AFI. So no one ever implemented that, and
10416
                 * RFC 2858, obsoleting 2283, says you can't do that.
10417
                 */
10418
8.76k
                proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_address_family, tvb,
10419
8.76k
                                    o + i + aoff, 2, ENC_BIG_ENDIAN, &af);
10420
8.76k
                proto_tree_add_item_ret_uint(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_safi, tvb,
10421
8.76k
                                    o + i + aoff + 2, 1, ENC_BIG_ENDIAN, &saf);
10422
8.76k
                nexthop_len = tvb_get_uint8(tvb, o + i + aoff + 3);
10423
8.76k
                save_afi_safi_data(pinfo, (uint16_t)af, (uint8_t)saf);
10424
10425
8.76k
                decode_mp_next_hop(tvb_new_subset_length(tvb, o + i + aoff + 3, nexthop_len + 1), subtree2, pinfo, af, saf, nexthop_len);
10426
10427
8.76k
                aoff_save = aoff;
10428
8.76k
                tlen -= nexthop_len + 4;
10429
8.76k
                aoff += nexthop_len + 4;
10430
10431
8.76k
                off = 0;
10432
8.76k
                snpa = tvb_get_uint8(tvb, o + i + aoff);
10433
8.76k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa, tvb,
10434
8.76k
                                         o + i + aoff, 1, ENC_BIG_ENDIAN);
10435
8.76k
                off++;
10436
8.76k
                if (snpa) {
10437
3.31k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_snpa);
10438
18.3k
                    for (/*nothing*/; snpa > 0; snpa--) {
10439
14.9k
                        uint8_t snpa_length = tvb_get_uint8(tvb, o + i + aoff + off);
10440
14.9k
                        proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length, tvb,
10441
14.9k
                                            o + i + aoff + off, 1, ENC_BIG_ENDIAN);
10442
14.9k
                        off++;
10443
14.9k
                        proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_mp_reach_nlri_snpa, tvb,
10444
14.9k
                                            o + i + aoff + off, snpa_length, ENC_NA);
10445
14.9k
                        off += snpa_length;
10446
14.9k
                    }
10447
3.31k
                }
10448
8.76k
                tlen -= off;
10449
8.76k
                aoff += off;
10450
10451
8.76k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_reach_nlri, tvb, o + i + aoff, tlen, ENC_NA);
10452
8.76k
                subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_reach_nlri);
10453
10454
8.76k
                if (tlen)  {
10455
8.01k
                    if (af != AFNUM_INET && af != AFNUM_INET6 && af != AFNUM_L2VPN && af != AFNUM_BGP_LS) {
10456
1.07k
                        proto_tree_add_expert(subtree3, pinfo, &ei_bgp_unknown_afi, tvb, o + i + aoff, tlen);
10457
6.93k
                    } else {
10458
9.92k
                        while (tlen > 0) {
10459
3.23k
                            advance = decode_prefix_MP(subtree3,
10460
3.23k
                                                       hf_bgp_nlri_path_id,
10461
3.23k
                                                       hf_bgp_mp_reach_nlri_ipv4_prefix,
10462
3.23k
                                                       hf_bgp_mp_reach_nlri_ipv6_prefix,
10463
3.23k
                                                       af, saf, tlen,
10464
3.23k
                                                       tvb, o + i + aoff, "MP Reach NLRI", pinfo);
10465
3.23k
                            if (advance < 0)
10466
252
                                break;
10467
2.98k
                            tlen -= advance;
10468
2.98k
                            aoff += advance;
10469
2.98k
                        }
10470
6.93k
                    }
10471
8.01k
                }
10472
8.76k
                aoff = aoff_save;
10473
8.76k
                break;
10474
19.7k
            case BGPTYPE_MP_UNREACH_NLRI:
10475
19.7k
                af = tvb_get_ntohs(tvb, o + i + aoff);
10476
19.7k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_address_family, tvb,
10477
19.7k
                                    o + i + aoff, 2, ENC_BIG_ENDIAN);
10478
19.7k
                saf = tvb_get_uint8(tvb, o + i + aoff + 2) ;
10479
19.7k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri_safi, tvb,
10480
19.7k
                                    o + i + aoff+2, 1, ENC_BIG_ENDIAN);
10481
19.7k
                save_afi_safi_data(pinfo, (uint16_t)af, (uint8_t)saf);
10482
10483
19.7k
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_mp_unreach_nlri, tvb, o + i + aoff + 3, tlen - 3, ENC_NA);
10484
19.7k
                subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_unreach_nlri);
10485
10486
19.7k
                aoff_save = aoff;
10487
19.7k
                tlen -= 3;
10488
19.7k
                aoff += 3;
10489
19.7k
                if (tlen > 0) {
10490
10491
50.2k
                    while (tlen > 0) {
10492
39.4k
                        advance = decode_prefix_MP(subtree3,
10493
39.4k
                                                   hf_bgp_nlri_path_id,
10494
39.4k
                                                   hf_bgp_mp_unreach_nlri_ipv4_prefix,
10495
39.4k
                                                   hf_bgp_mp_unreach_nlri_ipv6_prefix,
10496
39.4k
                                                   af, saf, tlen,
10497
39.4k
                                                   tvb, o + i + aoff, "MP Unreach NLRI", pinfo);
10498
39.4k
                        if (advance < 0)
10499
8.20k
                            break;
10500
31.2k
                        tlen -= advance;
10501
31.2k
                        aoff += advance;
10502
31.2k
                    }
10503
19.0k
                }
10504
19.7k
                aoff = aoff_save;
10505
19.7k
                break;
10506
510
            case BGPTYPE_CLUSTER_LIST:
10507
510
                if (tlen % 4 != 0) {
10508
217
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
10509
217
                                                 "Cluster list (invalid): %u byte%s", tlen,
10510
217
                                                 plurality(tlen, "", "s"));
10511
217
                    break;
10512
217
                }
10513
10514
293
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_cluster_list,
10515
293
                                         tvb, o + i + aoff, tlen, ENC_NA);
10516
293
                cluster_list_tree = proto_item_add_subtree(ti,
10517
293
                                                               ett_bgp_cluster_list);
10518
10519
                /* (o + i + aoff) =
10520
                   (o + current attribute + aoff bytes to first tuple) */
10521
293
                q = o + i + aoff;
10522
293
                end = q + tlen;
10523
293
                proto_item_append_text(ti, ":");
10524
293
                proto_item_append_text(ti_pa, ":");
10525
                /* snarf each cluster identifier */
10526
732
                while (q < end) {
10527
439
                    proto_tree_add_item(cluster_list_tree, hf_bgp_update_path_attribute_cluster_id,
10528
439
                                        tvb, q - 3 + aoff, 4, ENC_BIG_ENDIAN);
10529
439
                    proto_item_append_text(ti, " %s", tvb_ip_to_str(pinfo->pool, tvb, q-3+aoff));
10530
439
                    proto_item_append_text(ti_pa, " %s", tvb_ip_to_str(pinfo->pool, tvb, q-3+aoff));
10531
439
                    q += 4;
10532
439
                }
10533
10534
293
                break;
10535
1.45k
            case BGPTYPE_EXTENDED_COMMUNITY:
10536
1.45k
                if (tlen %8 != 0) {
10537
210
                    expert_add_info_format(pinfo, attr_len_item, &ei_bgp_ext_com_len_bad,
10538
210
                                           "Community length %u wrong, must be modulo 8", tlen);
10539
1.24k
                } else {
10540
1.24k
                    dissect_bgp_update_ext_com(subtree2, tvb, tlen, o+i+aoff, pinfo);
10541
1.24k
                }
10542
1.45k
                break;
10543
1.15k
            case BGPTYPE_SAFI_SPECIFIC_ATTR:
10544
1.15k
                q = o + i + aoff;
10545
1.15k
                end = o + i + aoff + tlen ;
10546
10547
2.35k
                while(q < end) {
10548
1.67k
                    ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
10549
1.67k
                    ssa_len = tvb_get_ntohs(tvb, q + 2);
10550
10551
1.67k
                    subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, MIN(ssa_len + 4, end - q),
10552
1.67k
                                                             ett_bgp_ssa, NULL, "%s Information",
10553
1.67k
                                                             val_to_str_const(ssa_type, bgp_ssa_type, "Unknown SSA"));
10554
10555
1.67k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_t, tvb,
10556
1.67k
                                        q, 1, ENC_BIG_ENDIAN);
10557
1.67k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb, q, 2, ENC_BIG_ENDIAN);
10558
10559
1.67k
                    proto_tree_add_item(subtree3, hf_bgp_ssa_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
10560
10561
1.67k
                    if ((ssa_len == 0) || (q + ssa_len > end)) {
10562
425
                        proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 2,
10563
425
                                                     end - q - 2, "Invalid Length of %u", ssa_len);
10564
425
                        break;
10565
425
                    }
10566
10567
1.25k
                    switch (ssa_type) {
10568
341
                        case BGP_SSA_L2TPv3:
10569
341
                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_pref, tvb,
10570
341
                                                q + 4, 2, ENC_BIG_ENDIAN);
10571
10572
341
                            subtree4 = proto_tree_add_subtree(subtree3, tvb, q + 6, 1, ett_bgp_ssa_subtree, NULL, "Flags");
10573
341
                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_s, tvb,
10574
341
                                                q + 6, 1, ENC_BIG_ENDIAN);
10575
341
                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_unused, tvb,
10576
341
                                                q + 6, 1, ENC_BIG_ENDIAN);
10577
10578
341
                            ssa_v3_len = tvb_get_uint8(tvb, q + 7);
10579
341
                            if (ssa_v3_len + 8 == ssa_len){
10580
132
                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie_len, tvb,
10581
132
                                                    q + 7, 1, ENC_BIG_ENDIAN);
10582
209
                            } else {
10583
209
                                proto_tree_add_expert_format(subtree3, pinfo, &ei_bgp_length_invalid, tvb, q + 7, 1,
10584
209
                                                             "Invalid Cookie Length of %u", ssa_v3_len);
10585
209
                                q += ssa_len + 4; /* 4 from type and length */
10586
209
                                break;
10587
209
                            }
10588
132
                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_session_id, tvb,
10589
132
                                                q + 8, 4, ENC_BIG_ENDIAN);
10590
132
                            if (ssa_v3_len)
10591
66
                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie, tvb,
10592
66
                                                    q + 12, ssa_v3_len, ENC_NA);
10593
132
                            q += ssa_len + 4; /* 4 from type and length */
10594
132
                            break;
10595
1
                        case BGP_SSA_mGRE:
10596
3
                        case BGP_SSA_IPSec:
10597
3
                        case BGP_SSA_MPLS:
10598
220
                        default:
10599
220
                            proto_tree_add_item(subtree3, hf_bgp_ssa_value, tvb,
10600
220
                                                q + 4, ssa_len, ENC_NA);
10601
220
                            q += ssa_len + 4; /* 4 from type and length */
10602
220
                            break;
10603
209
                        case BGP_SSA_L2TPv3_IN_IPSec:
10604
654
                        case BGP_SSA_mGRE_IN_IPSec:
10605
                            /* These contain BGP_SSA_IPSec and BGP_SSA_L2TPv3/BGP_SSA_mGRE */
10606
654
                            q += 4; /* 4 from type and length */
10607
654
                            break;
10608
1.25k
                    } /* switch (bgpa.bgpa_type) */
10609
1.25k
                }
10610
1.10k
                break;
10611
1.10k
            case BGPTYPE_TUNNEL_ENCAPS_ATTR:
10612
981
                q = o + i + aoff;
10613
981
                end = o + i + aoff + tlen;
10614
10615
981
                subtree3 = proto_tree_add_subtree(subtree2, tvb, q, tlen, ett_bgp_tunnel_tlv, NULL, "TLV Encodings");
10616
10617
1.74k
                while (q < end) {
10618
1.01k
                    encaps_tunnel_type = tvb_get_ntohs(tvb, q);
10619
1.01k
                    encaps_tunnel_len = tvb_get_ntohs(tvb, q + 2);
10620
10621
1.01k
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, encaps_tunnel_len + 4,
10622
1.01k
                                         ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
10623
1.01k
                                         val_to_str_const(encaps_tunnel_type, bgp_attr_tunnel_type, "Unknown"), encaps_tunnel_len + 4);
10624
10625
1.01k
                    proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_type, tvb, q, 2, ENC_BIG_ENDIAN);
10626
1.01k
                    proto_tree_add_item(subtree4, hf_bgp_update_encaps_tunnel_tlv_len, tvb, q + 2, 2, ENC_BIG_ENDIAN);
10627
10628
1.01k
                    subtree5 = proto_tree_add_subtree(subtree4, tvb, q + 4, encaps_tunnel_len, ett_bgp_tunnel_subtlv, NULL, "Sub-TLV Encodings");
10629
10630
1.01k
                    q += 4;
10631
1.01k
                    j = q + encaps_tunnel_len;
10632
8.49k
                    while ( q < j ) {
10633
7.73k
                        encaps_tunnel_subtype = tvb_get_uint8(tvb, q);
10634
7.73k
                        if (encaps_tunnel_subtype < 128) {
10635
6.93k
                            encaps_tunnel_sublen = tvb_get_uint8(tvb, q + 1);
10636
6.93k
                            encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 2;
10637
6.93k
                        } else {
10638
804
                            encaps_tunnel_sublen = tvb_get_ntohs(tvb, q + 1);
10639
804
                            encaps_tunnel_sub_totallen = encaps_tunnel_sublen + 3;
10640
804
                        }
10641
7.73k
                        subtree6 = proto_tree_add_subtree_format(subtree5, tvb, q, encaps_tunnel_sub_totallen,
10642
7.73k
                                             ett_bgp_tunnel_tlv_subtree, NULL, "%s (%u bytes)",
10643
7.73k
                                             val_to_str_const(encaps_tunnel_subtype, subtlv_type, "Unknown"), encaps_tunnel_sub_totallen);
10644
7.73k
                        proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
10645
7.73k
                        q += 1;
10646
7.73k
                        if (encaps_tunnel_subtype < 128) {
10647
6.92k
                            proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 1, ENC_BIG_ENDIAN);
10648
6.92k
                            q += 1;
10649
6.92k
                        } else {
10650
812
                            proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_len, tvb, q, 2, ENC_BIG_ENDIAN);
10651
812
                            q += 2;
10652
812
                        }
10653
10654
7.73k
                        switch (encaps_tunnel_subtype) {
10655
1.91k
                            case TUNNEL_SUBTLV_ENCAPSULATION:
10656
1.91k
                                {
10657
1.91k
                                static int * const vxlan_flags[] = {
10658
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
10659
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
10660
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
10661
1.91k
                                    NULL
10662
1.91k
                                    };
10663
1.91k
                                static int * const vxlan_gpe_flags[] = {
10664
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
10665
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
10666
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
10667
1.91k
                                    NULL
10668
1.91k
                                    };
10669
1.91k
                                static int * const nvgre_flags[] = {
10670
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
10671
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
10672
1.91k
                                    &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
10673
1.91k
                                    NULL
10674
1.91k
                                    };
10675
1.91k
                                if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP) {
10676
202
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_session_id, tvb, q, 4, ENC_BIG_ENDIAN);
10677
202
                                    q += 4;
10678
202
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_cookie, tvb, q, encaps_tunnel_sublen - 4, ENC_NA);
10679
202
                                    q += (encaps_tunnel_sublen - 4);
10680
1.71k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_GRE || encaps_tunnel_type == TUNNEL_TYPE_MPLS_IN_GRE) {
10681
557
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 4, ENC_BIG_ENDIAN);
10682
557
                                    q += 4;
10683
1.15k
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN) {
10684
195
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
10685
195
                                            ett_bgp_vxlan, vxlan_flags, ENC_BIG_ENDIAN);
10686
195
                                    q += 1;
10687
195
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
10688
195
                                    q += 3;
10689
195
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac, tvb, q, 6, ENC_NA);
10690
195
                                    q += 6;
10691
195
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
10692
195
                                    q += 2;
10693
958
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_VXLAN_GPE) {
10694
223
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
10695
223
                                            ett_bgp_vxlan, vxlan_gpe_flags, ENC_BIG_ENDIAN);
10696
223
                                    q += 1;
10697
223
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
10698
223
                                    q += 2;
10699
223
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
10700
223
                                    q += 3;
10701
223
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10702
223
                                    q += 1;
10703
735
                                } else if (encaps_tunnel_type == TUNNEL_TYPE_NVGRE) {
10704
218
                                    proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
10705
218
                                            ett_bgp_vxlan, nvgre_flags, ENC_BIG_ENDIAN);
10706
218
                                    q += 1;
10707
218
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid, tvb, q, 3, ENC_BIG_ENDIAN);
10708
218
                                    q += 3;
10709
218
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac, tvb, q, 6, ENC_NA);
10710
218
                                    q += 6;
10711
218
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved, tvb, q, 2, ENC_BIG_ENDIAN);
10712
218
                                    q += 2;
10713
218
                                }
10714
1.91k
                                }
10715
1.91k
                                break;
10716
498
                            case TUNNEL_SUBTLV_PROTO_TYPE:
10717
498
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_gre_key, tvb, q, 2, ENC_BIG_ENDIAN);
10718
498
                                q += 2;
10719
498
                                break;
10720
282
                            case TUNNEL_SUBTLV_COLOR:
10721
282
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_color_value, tvb, q, 4, ENC_BIG_ENDIAN);
10722
282
                                q += 4;
10723
282
                                break;
10724
783
                            case TUNNEL_SUBTLV_LOAD_BALANCE:
10725
783
                                if (encaps_tunnel_type == TUNNEL_TYPE_L2TP_OVER_IP || encaps_tunnel_type == TUNNEL_TYPE_GRE) {
10726
442
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_lb_block_length, tvb, q, 4, ENC_BIG_ENDIAN);
10727
442
                                    q += 4;
10728
442
                                }
10729
783
                                break;
10730
209
                            case TUNNEL_SUBTLV_PREFERENCE:
10731
209
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_flags, tvb, q, 1, ENC_BIG_ENDIAN);
10732
209
                                q += 1;
10733
209
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10734
209
                                q += 1;
10735
209
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_pref_preference, tvb, q, 4, ENC_NA);
10736
209
                                q += 4;
10737
209
                                break;
10738
429
                            case TUNNEL_SUBTLV_BINDING_SID:
10739
429
                                {
10740
429
                                static int * const flags[] = {
10741
429
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
10742
429
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
10743
429
                                    &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
10744
429
                                    NULL
10745
429
                                    };
10746
10747
429
                                proto_tree_add_bitmask(subtree6, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
10748
429
                                        ett_bgp_binding_sid, flags, ENC_BIG_ENDIAN);
10749
429
                                q += 1;
10750
429
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
10751
429
                                        tvb, q, 1, ENC_BIG_ENDIAN);
10752
429
                                q += 1;
10753
429
                                if (encaps_tunnel_sublen > 2) {
10754
217
                                    proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid, tvb, q,
10755
217
                                            encaps_tunnel_sublen - 2, ENC_NA);
10756
217
                                    q += (encaps_tunnel_sublen - 2);
10757
217
                                }
10758
429
                                }
10759
429
                                break;
10760
204
                            case TUNNEL_SUBTLV_ENLP:
10761
204
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_flags, tvb, q, 1, ENC_BIG_ENDIAN);
10762
204
                                q += 1;
10763
204
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10764
204
                                q += 1;
10765
204
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp, tvb, q, 1, ENC_BIG_ENDIAN);
10766
204
                                q += 1;
10767
204
                                break;
10768
278
                            case TUNNEL_SUBTLV_PRIORITY:
10769
278
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_priority, tvb, q, 1, ENC_BIG_ENDIAN);
10770
278
                                q += 1;
10771
278
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_priority_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10772
278
                                q += 1;
10773
278
                                break;
10774
448
                            case TUNNEL_SUBTLV_SEGMENT_LIST:
10775
448
                                {
10776
448
                                static int * const flags[] = {
10777
448
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
10778
448
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
10779
448
                                    &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
10780
448
                                    NULL
10781
448
                                    };
10782
10783
448
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10784
448
                                q += 1;
10785
448
                                ti = proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv, tvb, q,
10786
448
                                        encaps_tunnel_sublen - 1, ENC_NA);
10787
448
                                encaps_tunnel_sublen -= 1;
10788
448
                                subtree7 = proto_item_add_subtree(ti, ett_bgp_segment_list);
10789
1.35k
                                while (encaps_tunnel_sublen > 2) {
10790
924
                                    segment_subtlv_type = tvb_get_uint8(tvb, q);
10791
924
                                    segment_subtlv_length = tvb_get_uint8(tvb, q + 1);
10792
924
                                    subtree8 = proto_tree_add_subtree_format(subtree7, tvb, q, segment_subtlv_length + 2,
10793
924
                                            ett_bgp_segment_list, NULL, "SubTLV: %s", val_to_str_const(segment_subtlv_type,
10794
924
                                            bgp_sr_policy_list_type, "Unknown"));
10795
924
                                    proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type, tvb, q, 1, ENC_BIG_ENDIAN);
10796
924
                                    q += 1;
10797
924
                                    proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length, tvb, q, 1, ENC_BIG_ENDIAN);
10798
924
                                    q += 1;
10799
924
                                    if (segment_subtlv_length > 0) {
10800
421
                                        switch(segment_subtlv_type) {
10801
                                            /* TODO: Dissect further subTLVs data as defined in draft-ietf-idr-segment-routing-te-policy-08 section 2.4.3.2 */
10802
200
                                            case TUNNEL_SUBTLV_SEGMENT_LIST_SUB_TYPE_A:
10803
200
                                                proto_tree_add_bitmask(subtree8, tvb, q, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
10804
200
                                                        ett_bgp_segment_list, flags, ENC_BIG_ENDIAN);
10805
200
                                                q += 1;
10806
200
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
10807
200
                                                        tvb, q, 1, ENC_NA);
10808
200
                                                q += 1;
10809
200
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
10810
200
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
10811
200
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
10812
200
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
10813
200
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
10814
200
                                                        tvb, q, 3, ENC_BIG_ENDIAN);
10815
200
                                                q += 3;
10816
200
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
10817
200
                                                        tvb, q, 1, ENC_BIG_ENDIAN);
10818
200
                                                q += 1;
10819
200
                                                break;
10820
221
                                            default:
10821
221
                                                proto_tree_add_item(subtree8, hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
10822
221
                                                        tvb, q, segment_subtlv_length, ENC_NA);
10823
221
                                                q += segment_subtlv_length;
10824
221
                                                break;
10825
421
                                        }
10826
421
                                    }
10827
910
                                    encaps_tunnel_sublen -= (segment_subtlv_length + 2);
10828
910
                                }
10829
448
                                }
10830
434
                                break;
10831
434
                            case TUNNEL_SUBTLV_POLICY_NAME:
10832
212
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved, tvb, q, 1, ENC_BIG_ENDIAN);
10833
212
                                q += 1;
10834
212
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_policy_name_name, tvb, q,
10835
212
                                        encaps_tunnel_sublen - 1, ENC_ASCII);
10836
212
                                q += (encaps_tunnel_sublen - 1);
10837
212
                                break;
10838
2.35k
                            default:
10839
2.35k
                                proto_tree_add_item(subtree6, hf_bgp_update_encaps_tunnel_subtlv_value, tvb, q, encaps_tunnel_sublen, ENC_NA);
10840
2.35k
                                q += encaps_tunnel_sublen;
10841
2.35k
                                break;
10842
7.73k
                        } /* switch (encaps_tunnel_subtype) */
10843
7.73k
                    }
10844
1.01k
                }
10845
729
                break;
10846
729
            case BGPTYPE_AIGP:
10847
512
                q = o + i + aoff;
10848
512
                ti = proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_aigp, tvb, q, tlen, ENC_NA);
10849
512
                subtree3 = proto_item_add_subtree(ti, ett_bgp_aigp_attr);
10850
512
                aigp_type_item =  proto_tree_add_item(subtree3, hf_bgp_aigp_type, tvb, q, 1, ENC_BIG_ENDIAN);
10851
512
                aigp_type = tvb_get_uint8(tvb,q);
10852
512
                switch (aigp_type) {
10853
288
                    case AIGP_TLV_TYPE :
10854
288
                        proto_tree_add_item(subtree3, hf_bgp_aigp_tlv_length, tvb, q+1, 2, ENC_BIG_ENDIAN);
10855
288
                        proto_tree_add_item(subtree3, hf_bgp_aigp_accu_igp_metric, tvb, q+3, 8, ENC_BIG_ENDIAN);
10856
288
                        proto_item_append_text(ti, ": %" PRIu64, tvb_get_ntoh64(tvb, q+3));
10857
288
                        proto_item_append_text(ti_pa, ": %" PRIu64, tvb_get_ntoh64(tvb, q+3));
10858
288
                        break;
10859
224
                    default :
10860
224
                        expert_add_info_format(pinfo, aigp_type_item, &ei_bgp_attr_aigp_type,
10861
224
                                               "AIGP type %u unknown", aigp_type);
10862
512
                }
10863
502
                break;
10864
2.50k
            case BGPTYPE_LINK_STATE_ATTR:
10865
2.99k
            case BGPTYPE_LINK_STATE_OLD_ATTR:
10866
2.99k
                q = o + i + aoff;
10867
2.99k
                end = o + i + aoff + tlen;
10868
                /* FF: BGPTYPE_LINK_STATE_ATTR body dissection is moved after the while.
10869
                   Here we just save the TLV coordinates and the subtree. */
10870
2.99k
                save_link_state_attr_position(pinfo, q, end, tlen, subtree2);
10871
2.99k
                break;
10872
10873
553
            case BGPTYPE_LARGE_COMMUNITY:
10874
553
                if(tlen == 0 || tlen % 12){
10875
461
                    break;
10876
461
                }
10877
92
                q = o + i + aoff;
10878
92
                end = q + tlen;
10879
92
                wmem_strbuf_t *comm_strbuf;
10880
92
                comm_strbuf = wmem_strbuf_create(pinfo->pool);
10881
266
                while (q < end) {
10882
174
                    uint32_t ga, ldp1, ldp2;
10883
174
                    ga = tvb_get_ntohl(tvb, q);
10884
174
                    ldp1 = tvb_get_ntohl(tvb, q+4);
10885
174
                    ldp2 = tvb_get_ntohl(tvb, q+8);
10886
174
                    ti = proto_tree_add_string_format(subtree2, hf_bgp_large_communities, tvb, q, 12, NULL, "Large communities: %u:%u:%u", ga, ldp1, ldp2);
10887
174
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_large_communities);
10888
174
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ga, tvb,
10889
174
                                            q, 4, ENC_BIG_ENDIAN);
10890
174
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp1, tvb,
10891
174
                                            q + 4, 4, ENC_BIG_ENDIAN);
10892
174
                    proto_tree_add_item(subtree3, hf_bgp_large_communities_ldp2, tvb,
10893
174
                                            q + 8, 4, ENC_BIG_ENDIAN);
10894
174
                    wmem_strbuf_append_printf(comm_strbuf, " %u:%u:%u", ga, ldp1, ldp2);
10895
174
                    q += 12;
10896
174
                }
10897
10898
92
                proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(comm_strbuf));
10899
10900
92
                break;
10901
912
            case BGPTYPE_BGPSEC_PATH:
10902
912
                q = o + i + aoff;
10903
912
                end = q + tlen;
10904
912
                secpathlen = tvb_get_ntohs(tvb, q); /* Secure Path Length */
10905
10906
912
                if (((secpathlen - 2) % SEC_PATH_SEG_SIZE) != 0) { /* SEC_PATH_SEG_SIZE = 6 */
10907
802
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
10908
802
                        "Invalid BGPsec Secure Path length: %u bytes", secpathlen);
10909
802
                }
10910
10911
912
                subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, secpathlen,
10912
912
                                                         ett_bgp_bgpsec_secure_path,
10913
912
                                                         NULL,
10914
912
                                                         "Secure Path (%d byte%s)",
10915
912
                                                         secpathlen,
10916
912
                                                         plurality(secpathlen, "", "s"));
10917
10918
                /* Secure Path Length */
10919
912
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sp_len, tvb, q, 2, ENC_BIG_ENDIAN);
10920
912
                q += 2;
10921
10922
912
                secpathcount = (secpathlen - 2) / SEC_PATH_SEG_SIZE; /* Amount of Secure Path Segments */
10923
912
                j = 0;
10924
3.27k
                while (j < secpathcount) {
10925
2.36k
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, SEC_PATH_SEG_SIZE,
10926
2.36k
                                                             ett_bgp_bgpsec_secure_path_segment,
10927
2.36k
                                                             NULL,
10928
2.36k
                                                             "Secure Path Segment (%d byte%s)",
10929
2.36k
                                                             SEC_PATH_SEG_SIZE,
10930
2.36k
                                                             plurality(SEC_PATH_SEG_SIZE, "", "s"));
10931
10932
                    /* pCount field */
10933
2.36k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_pcount, tvb,
10934
2.36k
                                        q, 1, ENC_BIG_ENDIAN);
10935
2.36k
                    q += 1;
10936
10937
                    /* Flags field */
10938
2.36k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_flags, tvb,
10939
2.36k
                                        q, 1, ENC_BIG_ENDIAN);
10940
2.36k
                    q += 1;
10941
10942
                    /* ASN field */
10943
2.36k
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sps_as, tvb,
10944
2.36k
                                        q, 4, ENC_BIG_ENDIAN);
10945
2.36k
                    q += 4;
10946
2.36k
                    j++;
10947
2.36k
                }
10948
10949
912
                sigblocklen = tvb_get_ntohs(tvb, q); /* Signature Block Length */
10950
10951
912
                subtree3 = proto_tree_add_subtree_format(subtree2, tvb, q, sigblocklen,
10952
912
                                                         ett_bgp_bgpsec_signature_block,
10953
912
                                                         NULL,
10954
912
                                                         "Signature Block (%d byte%s)",
10955
912
                                                         sigblocklen,
10956
912
                                                         plurality(sigblocklen, "", "s"));
10957
10958
                /* Signature Block Length */
10959
912
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_sb_len, tvb, q, 2, ENC_BIG_ENDIAN);
10960
912
                q += 2;
10961
10962
                /* Algorithm Suite ID */
10963
912
                proto_tree_add_item(subtree3, hf_bgp_update_path_attribute_bgpsec_algo_id, tvb, q, 1, ENC_BIG_ENDIAN);
10964
912
                q += 1;
10965
10966
1.05k
                while (q < end) {
10967
145
                    sig_len = tvb_get_ntohs(tvb, q+20); /* Signature Length of current Segment */
10968
10969
145
                    subtree4 = proto_tree_add_subtree_format(subtree3, tvb, q, 22+sig_len,
10970
145
                                                             ett_bgp_bgpsec_signature_segment,
10971
145
                                                             NULL,
10972
145
                                                             "Signature Segment (%d byte%s)",
10973
145
                                                             22+sig_len,
10974
145
                                                             plurality(22+sig_len, "", "s"));
10975
10976
                    /* Subject Key Identifier */
10977
145
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_ski, tvb,
10978
145
                                        q, 20, ENC_NA);
10979
145
                    q += 20;
10980
10981
                    /* Signature Length */
10982
145
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig_len, tvb,
10983
145
                                        q, 2, ENC_BIG_ENDIAN);
10984
145
                    q += 2;
10985
10986
                    /* Signature */
10987
145
                    proto_tree_add_item(subtree4, hf_bgp_update_path_attribute_bgpsec_sig, tvb,
10988
145
                                        q, sig_len, ENC_NA);
10989
145
                    q += sig_len;
10990
145
                }
10991
10992
912
                break;
10993
2.07k
            case BGPTYPE_BGP_PREFIX_SID:
10994
2.07k
                q = o + i + aoff;
10995
2.07k
                end = q + tlen;
10996
2.07k
                proto_item    *tlv_item, *stlv_item, *sstlv_item;
10997
2.07k
                proto_tree    *tlv_tree, *stlv_tree, *sstlv_tree;
10998
2.07k
                proto_item    *srgb_tlv_item;
10999
2.07k
                proto_tree    *srgb_tlv_tree;
11000
2.07k
                proto_item    *srv6_stlv_item;
11001
2.07k
                proto_tree    *srv6_stlv_tree;
11002
2.07k
                proto_item    *srv6_data_sstlv_item;
11003
2.07k
                proto_tree    *srv6_data_sstlv_tree;
11004
2.07k
                int sub_pnt, sub_end;
11005
2.07k
                int sub_sub_pnt, sub_sub_end;
11006
4.00k
                while (q < end) {
11007
2.27k
                    prefix_sid_subtype = tvb_get_uint8(tvb, q);
11008
2.27k
                    prefix_sid_sublen = tvb_get_ntohs(tvb, q + 1);
11009
2.27k
                    switch (prefix_sid_subtype) {
11010
431
                        case BGP_PREFIX_SID_TLV_LABEL_INDEX:
11011
431
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_label_index, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11012
431
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_label_index);
11013
431
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11014
431
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11015
431
                            if (prefix_sid_sublen != BGP_PREFIX_SID_TLV_LEN_LABEL_INDEX){
11016
237
                                proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11017
237
                                    "Invalid BGP Prefix-SID Label Index length: %u bytes", prefix_sid_sublen);
11018
237
                                q += 3 + prefix_sid_sublen;
11019
237
                                break;
11020
237
                            }
11021
194
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11022
194
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_flags, tvb, q + 4, 2, ENC_BIG_ENDIAN);
11023
194
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_label_index_value, tvb, q + 6, 4, ENC_BIG_ENDIAN);
11024
194
                            proto_item_append_text(tlv_tree, ": %u ", tvb_get_ntohl(tvb, q + 6));
11025
194
                            q += 10;
11026
194
                            break;
11027
701
                        case BGP_PREFIX_SID_TLV_ORIGINATOR_SRGB:
11028
701
                            check_srgb = prefix_sid_sublen - 2;
11029
701
                            prefix_sid_sub_tlv_offset = 0;
11030
701
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_originator_srgb, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11031
701
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb);
11032
701
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11033
701
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11034
701
                            if(check_srgb % 3 || check_srgb % 2){
11035
162
                                proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11036
162
                                    "Invalid BGP Prefix-SID SRGB Originator length: %u bytes", prefix_sid_sublen);
11037
162
                                q += 3 + prefix_sid_sublen;
11038
162
                                break;
11039
162
                            }
11040
539
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_flags, tvb, q + 3, 2, ENC_BIG_ENDIAN);
11041
539
                            q += 2;
11042
539
                            tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_blocks, tvb, q , prefix_sid_sublen - 2, ENC_NA);
11043
539
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_originator_srgb_blocks);
11044
1.72k
                            while (prefix_sid_sublen > prefix_sid_sub_tlv_offset + 2) {
11045
1.18k
                                srgb_tlv_item = proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_originator_srgb_block, tvb, q , prefix_sid_sublen - 2, ENC_NA);
11046
1.18k
                                srgb_tlv_tree = proto_item_add_subtree(srgb_tlv_item, ett_bgp_prefix_sid_originator_srgb_block);
11047
1.18k
                                prefix_sid_sub_tlv_offset += 3;
11048
1.18k
                                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);
11049
1.18k
                                prefix_sid_sub_tlv_offset += 3;
11050
1.18k
                                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);
11051
1.18k
                                proto_item_append_text(srgb_tlv_tree, "(%u:%u)", tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset - 3),
11052
1.18k
                                    tvb_get_ntoh24(tvb, q + prefix_sid_sub_tlv_offset));
11053
1.18k
                            }
11054
539
                            q += 3 + prefix_sid_sublen;
11055
539
                            break;
11056
319
                        case BGP_PREFIX_SID_TLV_SRV6_L3_SERVICE:
11057
319
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l3vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11058
319
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l3vpn);
11059
319
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11060
319
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11061
319
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11062
11063
319
                            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);
11064
319
                            srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs);
11065
11066
319
                            sub_pnt = q + 4;
11067
319
                            sub_end = q + 3 + prefix_sid_sublen;
11068
1.86k
                            while (sub_pnt < sub_end) {
11069
1.60k
                                srv6_service_subtlv_type = tvb_get_uint8(tvb, sub_pnt);
11070
1.60k
                                srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
11071
11072
1.60k
                                switch (srv6_service_subtlv_type) {
11073
993
                                    case SRV6_SERVICE_SRV6_SID_INFORMATION:
11074
993
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11075
993
                                                                        hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11076
993
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11077
993
                                        proto_item_append_text(stlv_item, " - %s",
11078
993
                                                               val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11079
993
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_information);
11080
11081
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11082
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11083
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
11084
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
11085
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
11086
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_BIG_ENDIAN);
11087
993
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
11088
11089
993
                                        srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
11090
993
                                                                                   hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
11091
993
                                                                                   tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
11092
993
                                        srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs);
11093
11094
993
                                        sub_sub_pnt = sub_pnt + 24;
11095
993
                                        sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
11096
2.14k
                                        while (sub_sub_pnt < sub_sub_end) {
11097
1.17k
                                            srv6_service_data_subsubtlv_type = tvb_get_uint8(tvb, sub_sub_pnt);
11098
1.17k
                                            srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
11099
11100
1.17k
                                            switch (srv6_service_data_subsubtlv_type) {
11101
547
                                                case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
11102
547
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11103
547
                                                                                     hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11104
547
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11105
547
                                                    proto_item_append_text(sstlv_item, " - %s",
11106
547
                                                                           val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11107
547
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_structure);
11108
11109
547
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11110
547
                                                    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);
11111
547
                                                    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);
11112
547
                                                    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);
11113
547
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
11114
547
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
11115
547
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
11116
547
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
11117
547
                                                    break;
11118
608
                                                default:
11119
608
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11120
608
                                                                                     hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
11121
608
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11122
608
                                                    proto_item_append_text(sstlv_item, " - %s",
11123
608
                                                                           val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11124
608
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown);
11125
11126
608
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11127
608
                                                    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);
11128
608
                                                    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);
11129
608
                                                    break;
11130
1.17k
                                            }
11131
1.15k
                                            sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
11132
1.15k
                                        }
11133
972
                                        break;
11134
972
                                    default:
11135
592
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11136
592
                                                                        hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
11137
592
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11138
592
                                        proto_item_append_text(stlv_item, " - %s", val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11139
592
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l3vpn_unknown);
11140
11141
592
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11142
592
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11143
592
                                        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);
11144
592
                                        break;
11145
1.60k
                                }
11146
1.54k
                                sub_pnt += 3 + srv6_service_subtlv_len;
11147
1.54k
                            }
11148
258
                            q += (3 + prefix_sid_sublen);
11149
258
                            break;
11150
421
                        case BGP_PREFIX_SID_TLV_SRV6_L2_SERVICE:
11151
421
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_srv6_l2vpn, tvb, q , prefix_sid_sublen + 3, ENC_NA);
11152
421
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_srv6_l2vpn);
11153
421
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11154
421
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11155
421
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_reserved, tvb, q + 3, 1, ENC_NA);
11156
11157
421
                            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);
11158
421
                            srv6_stlv_tree = proto_item_add_subtree(srv6_stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs);
11159
11160
421
                            sub_pnt = q + 4;
11161
421
                            sub_end = q + 3 + prefix_sid_sublen;
11162
1.69k
                            while (sub_pnt < sub_end) {
11163
1.32k
                                srv6_service_subtlv_type = tvb_get_uint8(tvb, sub_pnt);
11164
1.32k
                                srv6_service_subtlv_len = tvb_get_ntohs(tvb, sub_pnt + 1);
11165
11166
1.32k
                                switch (srv6_service_subtlv_type) {
11167
965
                                    case SRV6_SERVICE_SRV6_SID_INFORMATION:
11168
965
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11169
965
                                                                        hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11170
965
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11171
965
                                        proto_item_append_text(stlv_item, " - %s",
11172
965
                                                               val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11173
965
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_information);
11174
11175
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11176
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11177
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved, tvb, sub_pnt + 3, 1, ENC_NA);
11178
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_value, tvb, sub_pnt + 4, 16, ENC_NA);
11179
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_flags, tvb, sub_pnt + 20, 1, ENC_NA);
11180
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior, tvb, sub_pnt + 21, 2, ENC_BIG_ENDIAN);
11181
965
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_reserved, tvb, sub_pnt + 23, 1, ENC_NA);
11182
11183
965
                                        srv6_data_sstlv_item = proto_tree_add_item(stlv_tree,
11184
965
                                                                                   hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
11185
965
                                                                                   tvb, sub_pnt + 24, srv6_service_subtlv_len - 21, ENC_NA);
11186
965
                                        srv6_data_sstlv_tree = proto_item_add_subtree(srv6_data_sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs);
11187
11188
965
                                        sub_sub_pnt = sub_pnt + 24;
11189
965
                                        sub_sub_end = sub_pnt + 3 + srv6_service_subtlv_len;
11190
1.56k
                                        while (sub_sub_pnt < sub_sub_end) {
11191
611
                                            srv6_service_data_subsubtlv_type = tvb_get_uint8(tvb, sub_sub_pnt);
11192
611
                                            srv6_service_data_subsubtlv_len = tvb_get_ntohs(tvb, sub_sub_pnt + 1);
11193
11194
611
                                            switch (srv6_service_data_subsubtlv_type) {
11195
300
                                                case SRV6_SERVICE_DATA_SRV6_SID_STRUCTURE:
11196
300
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11197
300
                                                                                     hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11198
300
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11199
300
                                                    proto_item_append_text(sstlv_item, " - %s",
11200
300
                                                                           val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11201
300
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_structure);
11202
11203
300
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11204
300
                                                    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);
11205
300
                                                    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);
11206
300
                                                    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);
11207
300
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len, tvb, sub_sub_pnt + 5, 1, ENC_BIG_ENDIAN);
11208
300
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len, tvb, sub_sub_pnt + 6, 1, ENC_BIG_ENDIAN);
11209
300
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len, tvb, sub_sub_pnt + 7, 1, ENC_BIG_ENDIAN);
11210
300
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset, tvb, sub_sub_pnt + 8, 1, ENC_BIG_ENDIAN);
11211
300
                                                    break;
11212
305
                                                default:
11213
305
                                                    sstlv_item = proto_tree_add_item(srv6_data_sstlv_tree,
11214
305
                                                                                     hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
11215
305
                                                                                     tvb, sub_sub_pnt , srv6_service_data_subsubtlv_len + 3, ENC_NA);
11216
305
                                                    proto_item_append_text(sstlv_item, " - %s",
11217
305
                                                                           val_to_str(srv6_service_data_subsubtlv_type, srv6_service_data_sub_sub_tlv_type, "Unknown (%u)"));
11218
305
                                                    sstlv_tree = proto_item_add_subtree(sstlv_item, ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown);
11219
11220
305
                                                    proto_tree_add_item(sstlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type, tvb, sub_sub_pnt, 1, ENC_BIG_ENDIAN);
11221
305
                                                    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);
11222
305
                                                    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);
11223
305
                                                    break;
11224
611
                                            }
11225
598
                                            sub_sub_pnt += 3 + srv6_service_data_subsubtlv_len;
11226
598
                                        }
11227
952
                                        break;
11228
952
                                    default:
11229
335
                                        stlv_item = proto_tree_add_item(srv6_stlv_tree,
11230
335
                                                                        hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
11231
335
                                                                        tvb, sub_pnt , srv6_service_subtlv_len + 3, ENC_NA);
11232
335
                                        proto_item_append_text(stlv_item, " - %s", val_to_str(srv6_service_subtlv_type, srv6_service_sub_tlv_type, "Unknown (%u)"));
11233
335
                                        stlv_tree = proto_item_add_subtree(stlv_item, ett_bgp_prefix_sid_srv6_l2vpn_unknown);
11234
11235
335
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type, tvb, sub_pnt, 1, ENC_BIG_ENDIAN);
11236
335
                                        proto_tree_add_item(stlv_tree, hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length, tvb, sub_pnt + 1, 2, ENC_BIG_ENDIAN);
11237
335
                                        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);
11238
335
                                        break;
11239
1.32k
                                }
11240
1.27k
                                sub_pnt += 3 + srv6_service_subtlv_len;
11241
1.27k
                            }
11242
375
                            q += (3 + prefix_sid_sublen);
11243
375
                            break;
11244
366
                        default:
11245
366
                            tlv_item = proto_tree_add_item(subtree2, hf_bgp_prefix_sid_unknown, tvb, q, prefix_sid_sublen + 3, ENC_NA);
11246
366
                            proto_item_append_text(tlv_item, " (%s)", val_to_str(prefix_sid_subtype, bgp_prefix_sid_type, "%u"));
11247
366
                            tlv_tree = proto_item_add_subtree(tlv_item, ett_bgp_prefix_sid_unknown);
11248
366
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_type, tvb, q, 1, ENC_BIG_ENDIAN);
11249
366
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_length, tvb, q + 1, 2, ENC_BIG_ENDIAN);
11250
366
                            proto_tree_add_item(tlv_tree, hf_bgp_prefix_sid_value, tvb, q + 3, prefix_sid_sublen - 3, ENC_NA);
11251
366
                            q += (3 + prefix_sid_sublen);
11252
366
                            break;
11253
2.27k
                    }
11254
2.27k
                }
11255
1.72k
                break;
11256
3.03k
            case BGPTYPE_PMSI_TUNNEL_ATTR:
11257
3.03k
                dissect_bgp_update_pmsi_attr(pinfo, subtree2, tvb, tlen, o+i+aoff);
11258
3.03k
                break;
11259
11260
1.17k
            case BGPTYPE_ATTR_SET:
11261
1.17k
                if (alen >= 4) {
11262
790
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_attrset_origin_as, tvb,
11263
790
                                        o + i + aoff, 4, ENC_BIG_ENDIAN);
11264
790
                    if (alen > 4) {
11265
708
                        ti =  proto_tree_add_item(subtree2, hf_bgp_update_path_attributes, tvb, o+i+aoff+4, alen-4, ENC_NA);
11266
708
                        attr_set_subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
11267
708
                        dissect_bgp_path_attr(attr_set_subtree, tvb, alen-4, o+i+aoff+4, pinfo);
11268
708
                    }
11269
790
                } else {
11270
381
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, alen,
11271
381
                                                 "Attribute set (invalid): %u byte%s",
11272
381
                                                 alen, plurality(alen, "", "s"));
11273
381
                }
11274
1.17k
                break;
11275
290
            case BGPTYPE_OTC:
11276
290
                if (tlen != 4) {
11277
224
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
11278
224
                                                 "Only to Customer (invalid): %u byte%s", tlen,
11279
224
                                                 plurality(tlen, "", "s"));
11280
224
                } else {
11281
66
                    proto_tree_add_item(subtree2, hf_bgp_update_path_attribute_otc, tvb,
11282
66
                                        o + i + aoff, tlen, ENC_BIG_ENDIAN);
11283
66
                    proto_item_append_text(ti_pa, ": %u", tvb_get_ntohl(tvb, o + i + aoff));
11284
66
                }
11285
290
                break;
11286
503
            case BGPTYPE_D_PATH:
11287
503
                if(tlen < 8){
11288
231
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
11289
231
                                                 "D-PATH attribute has invalid length (invalid): %u byte%s", tlen,
11290
231
                                                 plurality(tlen, "", "s"));
11291
231
                    break;
11292
231
                }
11293
272
                q = o + i + aoff;
11294
272
                end = q + tlen;
11295
272
                wmem_strbuf_t *dpath_strbuf;
11296
272
                dpath_strbuf = wmem_strbuf_create(pinfo->pool);
11297
272
                uint8_t dpath_len;
11298
272
                dpath_len = tvb_get_uint8(tvb, q);
11299
272
                proto_tree_add_item(subtree2, hf_bgp_d_path_length, tvb,
11300
272
                                        q, 1, ENC_BIG_ENDIAN);
11301
272
                q += 1;
11302
1.43k
                while (dpath_len > 0 && q < end) {
11303
1.16k
                    uint32_t ad;
11304
1.16k
                    uint16_t ld;
11305
1.16k
                    ad = tvb_get_ntohl(tvb, q);
11306
1.16k
                    ld = tvb_get_ntohs(tvb, q+4);
11307
1.16k
                    ti = proto_tree_add_string_format(subtree2, hf_bgp_update_path_attribute_d_path, tvb, q, 6, NULL, "Domain ID: %u:%u", ad, ld);
11308
1.16k
                    subtree3 = proto_item_add_subtree(ti, ett_bgp_dpath);
11309
1.16k
                    proto_tree_add_item(subtree3, hf_bgp_d_path_ga, tvb,
11310
1.16k
                                        q, 4, ENC_BIG_ENDIAN);
11311
1.16k
                    proto_tree_add_item(subtree3, hf_bgp_d_path_la, tvb,
11312
1.16k
                                        q + 4, 2, ENC_BIG_ENDIAN);
11313
1.16k
                    wmem_strbuf_append_printf(dpath_strbuf, " %u:%u", ad, ld);
11314
1.16k
                    q += 6;
11315
1.16k
                    dpath_len -= 1;
11316
1.16k
                }
11317
272
                if (dpath_len != 0 || q >= end) {
11318
141
                    proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen,
11319
141
                                                 "D-PATH list (invalid): %u byte%s", tlen,
11320
141
                                                 plurality(tlen, "", "s"));
11321
141
                    break;
11322
141
                }
11323
131
                proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(dpath_strbuf));
11324
11325
131
                proto_tree_add_item(subtree2, hf_bgp_d_path_isf_safi, tvb,
11326
131
                                    q, 1, ENC_BIG_ENDIAN);
11327
131
                break;
11328
7.88k
            default:
11329
7.88k
                proto_tree_add_item(subtree2, hf_bgp_update_path_attributes_unknown, tvb, o + i + aoff, tlen, ENC_NA);
11330
7.88k
                break;
11331
62.8k
        } /* switch (bgpa.bgpa_type) */ /* end of second switch */
11332
11333
55.0k
        i += alen + aoff;
11334
55.0k
    }
11335
2.65k
    decrement_dissection_depth(pinfo);
11336
2.65k
    {
11337
        /* FF: postponed BGPTYPE_LINK_STATE_ATTR dissection */
11338
2.65k
        link_state_data *data = load_link_state_data(pinfo);
11339
2.65k
        if (data && data->link_state_attr_present) {
11340
2.33k
            ti = proto_tree_add_item(data->subtree2, hf_bgp_update_path_attribute_link_state, tvb, data->ostart, data->tlen, ENC_NA);
11341
2.33k
            subtree3 = proto_item_add_subtree(ti, ett_bgp_link_state);
11342
9.68k
            while (data->ostart < data->oend) {
11343
7.34k
                advance = decode_link_state_attribute_tlv(subtree3, tvb, data->ostart, pinfo, data->protocol_id);
11344
7.34k
                if (advance < 0) {
11345
0
                    break;
11346
0
                }
11347
7.34k
                data->ostart += advance;
11348
7.34k
            }
11349
2.33k
        }
11350
2.65k
    }
11351
2.65k
}
11352
/*
11353
 * Dissect a BGP UPDATE message.
11354
 */
11355
static void
11356
dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11357
10.9k
{
11358
10.9k
    uint16_t        hlen;                       /* message length           */
11359
10.9k
    int             o;                          /* packet offset            */
11360
10.9k
    int             end=0;                      /* message end              */
11361
10.9k
    uint16_t        len;                        /* tmp                      */
11362
10.9k
    proto_item      *ti;                        /* tree item                */
11363
10.9k
    proto_tree      *subtree;                   /* subtree for attributes   */
11364
10.9k
    int             i;                          /* tmp                      */
11365
11366
10.9k
    hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
11367
10.9k
    o = BGP_HEADER_SIZE;
11368
11369
11370
    /* check for withdrawals */
11371
10.9k
    len = tvb_get_ntohs(tvb, o);
11372
10.9k
    proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes_length, tvb, o, 2, ENC_BIG_ENDIAN);
11373
10.9k
    o += 2;
11374
11375
    /* parse unfeasible prefixes */
11376
10.9k
    if (len > 0) {
11377
426
        ti = proto_tree_add_item(tree, hf_bgp_update_withdrawn_routes, tvb, o, len, ENC_NA);
11378
426
        subtree = proto_item_add_subtree(ti, ett_bgp_unfeas);
11379
11380
        /* parse each prefix */
11381
426
        end = o + len;
11382
11383
        /* Heuristic to detect if IPv4 prefix are using Path Identifiers */
11384
426
        if( detect_add_path_prefix4(tvb, o, end) ) {
11385
            /* IPv4 prefixes with Path Id */
11386
695
            while (o < end) {
11387
605
                i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_withdrawn_prefix, tvb, o,
11388
605
                    "Withdrawn route");
11389
605
                if (i < 0)
11390
35
                    return;
11391
570
                o += i;
11392
570
            }
11393
301
        } else {
11394
1.24k
            while (o < end) {
11395
1.04k
                i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_withdrawn_prefix, tvb, o,
11396
1.04k
                    "Withdrawn route");
11397
1.04k
                if (i < 0)
11398
102
                    return;
11399
946
                o += i;
11400
946
            }
11401
301
        }
11402
426
    }
11403
11404
    /* check for advertisements */
11405
10.8k
    len = tvb_get_ntohs(tvb, o);
11406
10.8k
    proto_tree_add_item(tree, hf_bgp_update_total_path_attribute_length, tvb, o, 2, ENC_BIG_ENDIAN);
11407
11408
    /* path attributes */
11409
10.8k
    if (len > 0) {
11410
10.4k
        ti =  proto_tree_add_item(tree, hf_bgp_update_path_attributes, tvb, o+2, len, ENC_NA);
11411
10.4k
        subtree = proto_item_add_subtree(ti, ett_bgp_attrs);
11412
11413
10.4k
        dissect_bgp_path_attr(subtree, tvb, len, o+2, pinfo);
11414
11415
10.4k
        o += 2 + len;
11416
11417
        /* NLRI */
11418
10.4k
        len = hlen - o;
11419
11420
        /* parse prefixes */
11421
10.4k
        if (len > 0) {
11422
1.41k
            ti = proto_tree_add_item(tree, hf_bgp_update_nlri, tvb, o, len, ENC_NA);
11423
1.41k
            subtree = proto_item_add_subtree(ti, ett_bgp_nlri);
11424
1.41k
            end = o + len;
11425
            /*
11426
             * Heuristic to detect if IPv4 prefix are using Path Identifiers
11427
             * we need at least 5 bytes for Add-path prefixes
11428
             */
11429
1.41k
            if( len > 4 && detect_add_path_prefix4(tvb, o, end) ) {
11430
                /* IPv4 prefixes with Path Id */
11431
363
                while (o < end) {
11432
284
                    i = decode_path_prefix4(subtree, pinfo, hf_bgp_nlri_path_id, hf_bgp_nlri_prefix, tvb, o,
11433
284
                                            "NLRI");
11434
284
                    if (i < 0)
11435
0
                       return;
11436
284
                    o += i;
11437
284
                }
11438
1.33k
            } else {
11439
                /* Standard prefixes */
11440
2.10k
                while (o < end) {
11441
897
                    i = decode_prefix4(subtree, pinfo, NULL, hf_bgp_nlri_prefix, tvb, o, "NLRI");
11442
897
                    if (i < 0)
11443
126
                        return;
11444
771
                    o += i;
11445
771
                }
11446
1.33k
            }
11447
1.41k
        }
11448
10.4k
    }
11449
10.8k
}
11450
11451
/*
11452
 * Dissect a BGP CAPABILITY message.
11453
 */
11454
static void
11455
dissect_bgp_capability(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11456
471
{
11457
471
    int offset = 0;
11458
471
    int mend;
11459
11460
471
    mend = offset + tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
11461
471
    offset += BGP_HEADER_SIZE;
11462
    /* step through all of the capabilities */
11463
2.24k
    while (offset < mend) {
11464
1.77k
        offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, true);
11465
1.77k
    }
11466
471
}
11467
11468
/*
11469
 * Dissect a BGP NOTIFICATION message.
11470
 */
11471
static void
11472
dissect_bgp_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11473
1.26k
{
11474
1.26k
    int                     hlen;   /* message length           */
11475
1.26k
    int                     offset;
11476
1.26k
    unsigned                major_error;
11477
1.26k
    proto_item              *ti;
11478
1.26k
    uint8_t                 clen;
11479
1.26k
    uint8_t                 minor_cease;
11480
11481
11482
1.26k
    hlen =  tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
11483
1.26k
    offset = BGP_MARKER_SIZE + 2 + 1;
11484
11485
11486
    /* print error code */
11487
1.26k
    proto_tree_add_item(tree, hf_bgp_notify_major_error, tvb, offset, 1, ENC_BIG_ENDIAN);
11488
1.26k
    major_error = tvb_get_uint8(tvb, offset);
11489
1.26k
    offset += 1;
11490
11491
1.26k
    switch(major_error){
11492
70
        case BGP_MAJOR_ERROR_MSG_HDR:
11493
70
            proto_tree_add_item(tree, hf_bgp_notify_minor_msg_hdr, tvb, offset, 1, ENC_BIG_ENDIAN);
11494
70
        break;
11495
548
        case BGP_MAJOR_ERROR_OPEN_MSG:
11496
548
            proto_tree_add_item(tree, hf_bgp_notify_minor_open_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
11497
548
        break;
11498
25
        case BGP_MAJOR_ERROR_UPDATE_MSG:
11499
25
            proto_tree_add_item(tree,hf_bgp_notify_minor_update_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
11500
25
        break;
11501
67
        case BGP_MAJOR_ERROR_HT_EXPIRED:
11502
67
            proto_tree_add_item(tree, hf_bgp_notify_minor_ht_expired, tvb, offset,  1, ENC_BIG_ENDIAN);
11503
67
        break;
11504
80
        case BGP_MAJOR_ERROR_STATE_MACHINE:
11505
80
            proto_tree_add_item(tree, hf_bgp_notify_minor_state_machine, tvb, offset, 1, ENC_BIG_ENDIAN);
11506
80
        break;
11507
224
        case BGP_MAJOR_ERROR_CEASE:
11508
224
            proto_tree_add_item(tree, hf_bgp_notify_minor_cease, tvb, offset, 1, ENC_BIG_ENDIAN);
11509
224
        break;
11510
108
        case BGP_MAJOR_ERROR_ROUTE_REFRESH:
11511
108
            proto_tree_add_item(tree, hf_bgp_notify_minor_rr_msg, tvb, offset, 1, ENC_BIG_ENDIAN);
11512
108
        break;
11513
127
        default:
11514
127
            ti = proto_tree_add_item(tree, hf_bgp_notify_minor_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
11515
127
            expert_add_info_format(pinfo, ti, &ei_bgp_notify_minor_unknown, "Unknown notification error (%d)",major_error);
11516
127
        break;
11517
1.26k
    }
11518
1.05k
    offset += 1;
11519
11520
    /* only print if there is optional data */
11521
1.05k
    if (hlen > BGP_MIN_NOTIFICATION_MSG_SIZE) {
11522
923
        minor_cease = tvb_get_uint8(tvb, offset - 1);
11523
923
        clen = tvb_get_uint8(tvb, offset);
11524
        /* Might be a idr-shutdown communication, first byte is length */
11525
923
        if (hlen - BGP_MIN_NOTIFICATION_MSG_SIZE - 1 == clen && major_error == BGP_MAJOR_ERROR_CEASE &&
11526
923
                (minor_cease == BGP_CEASE_MINOR_ADMIN_SHUTDOWN || minor_cease == BGP_CEASE_MINOR_ADMIN_RESET) ) {
11527
137
            proto_tree_add_item(tree, hf_bgp_notify_communication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
11528
137
            offset += 1;
11529
137
            proto_tree_add_item(tree, hf_bgp_notify_communication, tvb, offset, clen, ENC_UTF_8);
11530
        /* otherwise just dump the hex data */
11531
786
        } else if ( major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 7 ) {
11532
8.97k
            while (offset < hlen) {
11533
8.57k
                offset = dissect_bgp_capability_item(tvb, tree, pinfo, offset, false);
11534
8.57k
            }
11535
394
        } else if (major_error == BGP_MAJOR_ERROR_OPEN_MSG && minor_cease == 2 ) { /* Display Bad Peer AS Number */
11536
66
            proto_tree_add_item(tree, hf_bgp_notify_error_open_bad_peer_as, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_BIG_ENDIAN);
11537
328
        } else {
11538
328
            proto_tree_add_item(tree, hf_bgp_notify_data, tvb, offset, hlen - BGP_MIN_NOTIFICATION_MSG_SIZE, ENC_NA);
11539
328
        }
11540
923
    }
11541
1.05k
}
11542
11543
/*
11544
 * Dissect a BGP ROUTE-REFRESH message.
11545
 */
11546
static void
11547
dissect_bgp_route_refresh(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo)
11548
789
{
11549
789
    int             p;         /* tvb offset counter    */
11550
789
    int             pend;       /* end of list of entries for one orf type */
11551
789
    uint16_t        hlen;       /* tvb RR msg length */
11552
789
    proto_item      *ti;        /* tree item             */
11553
789
    proto_item      *ti1;       /* tree item             */
11554
789
    proto_tree      *subtree;   /* tree for orf   */
11555
789
    proto_tree      *subtree1;  /* tree for orf entry */
11556
789
    uint8_t         orftype;    /* ORF Type */
11557
789
    uint16_t        orflen;     /* ORF len */
11558
789
    uint8_t         entryflag;  /* ORF Entry flag: action(add,del,delall) match(permit,deny) */
11559
789
    int             entrylen;   /* ORF Entry length */
11560
789
    int             advance;    /* tmp                      */
11561
789
    uint32_t        afi;
11562
789
    uint32_t        safi;
11563
11564
11565
/*
11566
example 1
11567
 00 1c 05       hlen=28
11568
 00 01 00 01    afi,safi= ipv4-unicast
11569
 02 80 00 01    defer, prefix-orf, len=1
11570
    80            removeall
11571
example 2
11572
 00 25 05       hlen=37
11573
 00 01 00 01    afi,saif= ipv4-unicast
11574
 01 80 00 0a    immediate, prefix-orf, len=10
11575
    00            add
11576
    00 00 00 05   seqno = 5
11577
    12            ge = 18
11578
    18            le = 24
11579
    10 07 02      prefix = 7.2.0.0/16
11580
*/
11581
789
    if (!tree)
11582
0
        return;
11583
11584
789
    hlen = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
11585
789
    p = BGP_HEADER_SIZE;
11586
11587
    /* AFI */
11588
789
    proto_tree_add_item_ret_uint(tree, hf_bgp_route_refresh_afi, tvb, p, 2, ENC_BIG_ENDIAN, &afi);
11589
789
    p += 2;
11590
11591
    /*  Subtype in draft-ietf-idr-bgp-enhanced-route-refresh-02 (for Enhanced Route Refresh Capability) before Reserved*/
11592
789
    proto_tree_add_item(tree, hf_bgp_route_refresh_subtype, tvb, p, 1, ENC_BIG_ENDIAN);
11593
789
    p++;
11594
11595
    /* SAFI */
11596
789
    proto_tree_add_item_ret_uint(tree, hf_bgp_route_refresh_safi, tvb, p, 1, ENC_BIG_ENDIAN, &safi);
11597
789
    p++;
11598
789
    save_afi_safi_data(pinfo, (uint16_t)afi, (uint8_t)safi);
11599
11600
789
    if ( hlen == BGP_HEADER_SIZE + 4 )
11601
130
        return;
11602
2.20k
    while (p < hlen) {
11603
        /* ORF type */
11604
11605
1.69k
        ti = proto_tree_add_item(tree, hf_bgp_route_refresh_orf, tvb, p, 4, ENC_NA);
11606
1.69k
        subtree = proto_item_add_subtree(ti, ett_bgp_orf);
11607
11608
1.69k
        proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_flag, tvb, p, 1, ENC_BIG_ENDIAN);
11609
1.69k
        p += 1;
11610
11611
1.69k
        ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_type, tvb, p, 1, ENC_BIG_ENDIAN);
11612
1.69k
        orftype = tvb_get_uint8(tvb, p);
11613
1.69k
        p += 1;
11614
11615
1.69k
        proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_length, tvb, p, 2, ENC_BIG_ENDIAN);
11616
1.69k
        orflen = tvb_get_ntohs(tvb, p);
11617
1.69k
        proto_item_set_len(ti, orflen + 4);
11618
1.69k
        p += 2;
11619
11620
1.69k
        pend = p + orflen;
11621
11622
1.69k
        switch (orftype) {
11623
90
        case BGP_ORF_COMM:
11624
157
        case BGP_ORF_EXTCOMM:
11625
223
        case BGP_ORF_ASPATH:
11626
223
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unregistered, "Deprecated non-IANA ORF Entry type %u", orftype);
11627
223
            break;
11628
11629
71
        case BGP_ORF_PREFIX:
11630
365
        case BGP_ORF_PREFIX_CISCO:
11631
1.43k
            while (p < pend) {
11632
1.13k
                ti1 = proto_tree_add_item(subtree, hf_bgp_route_refresh_orf_entry_prefixlist, tvb, p, 1, ENC_NA);
11633
1.13k
                subtree1 = proto_item_add_subtree(ti1, ett_bgp_orf_entry);
11634
1.13k
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_action, tvb, p, 1, ENC_BIG_ENDIAN);
11635
1.13k
                entryflag = tvb_get_uint8(tvb, p);
11636
1.13k
                if (((entryflag & BGP_ORF_ACTION) >> 6) == BGP_ORF_REMOVEALL) {
11637
332
                    p++;
11638
332
                    continue;
11639
332
                }
11640
806
                if (((entryflag & BGP_ORF_ACTION) >> 6) > BGP_ORF_REMOVEALL) {
11641
617
                    expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_action_invalid, "Invalid ORF action");
11642
617
                    p++;
11643
617
                    continue;
11644
617
                }
11645
189
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_match, tvb, p, 1, ENC_BIG_ENDIAN);
11646
189
                p++;
11647
11648
189
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_sequence, tvb, p, 4, ENC_BIG_ENDIAN);
11649
189
                p +=4;
11650
11651
189
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_lower, tvb, p, 1, ENC_BIG_ENDIAN);
11652
189
                p++;
11653
11654
189
                proto_tree_add_item(subtree1, hf_bgp_route_refresh_orf_entry_prefixmask_upper, tvb, p, 1, ENC_BIG_ENDIAN);
11655
189
                p++;
11656
11657
189
                advance = decode_prefix4(subtree1, pinfo, NULL, hf_bgp_route_refresh_orf_entry_ip, tvb, p, "ORF");
11658
189
                if (advance < 0)
11659
66
                        break;
11660
123
                entrylen = 7 + 1 + advance;
11661
11662
123
                proto_item_set_len(ti1, entrylen);
11663
123
                p += advance;
11664
123
            }
11665
365
            break;
11666
11667
270
        case BGP_ORF_CP_ORF:
11668
336
        case BGP_ORF_VPN_PREFIX:
11669
403
        case BGP_ORF_COMM_CISCO:
11670
470
        case BGP_ORF_EXTCOMM_CISCO:
11671
664
        case BGP_ORF_ASPATH_CISCO:
11672
664
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unsupported, "ORF entry type %u not supported for decoding", orftype);
11673
664
            break;
11674
11675
349
        default:
11676
349
            expert_add_info_format(pinfo, ti1, &ei_bgp_route_refresh_orf_type_unknown, "ORFEntry-Unknown (type %u)", orftype);
11677
1.69k
        }
11678
11679
1.54k
        p = pend;
11680
1.54k
    }
11681
659
}
11682
11683
static int
11684
dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
11685
                void *data _U_)
11686
14.1k
{
11687
14.1k
    uint16_t      bgp_len;          /* Message length             */
11688
14.1k
    uint8_t       bgp_type;         /* Message type               */
11689
14.1k
    const char    *typ;             /* Message type (string)      */
11690
14.1k
    proto_item    *ti = NULL;
11691
14.1k
    proto_item    *ti_marker = NULL;/* marker item                */
11692
14.1k
    proto_item    *ti_len = NULL;   /* length item                */
11693
14.1k
    proto_tree    *bgp_tree = NULL; /* BGP packet tree            */
11694
14.1k
    static const uint8_t valid_marker[BGP_MARKER_SIZE] = {
11695
14.1k
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
11696
14.1k
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
11697
14.1k
    };
11698
11699
14.1k
    bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
11700
14.1k
    bgp_type = tvb_get_uint8(tvb, BGP_MARKER_SIZE + 2);
11701
14.1k
    typ = val_to_str(bgp_type, bgptypevals, "Unknown message type (0x%02x)");
11702
11703
14.1k
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "BGP");
11704
14.1k
    col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, typ);
11705
11706
14.1k
    if (tree) {
11707
14.1k
        ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, ENC_NA);
11708
14.1k
        proto_item_append_text(ti, " - %s", typ);
11709
11710
        /* add a different tree for each message type */
11711
14.1k
        switch (bgp_type) {
11712
350
            case BGP_OPEN:
11713
350
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_open);
11714
350
                break;
11715
10.9k
            case BGP_UPDATE:
11716
10.9k
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_update);
11717
10.9k
                break;
11718
1.26k
            case BGP_NOTIFICATION:
11719
1.26k
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_notification);
11720
1.26k
                break;
11721
174
            case BGP_KEEPALIVE:
11722
174
                bgp_tree = proto_item_add_subtree(ti, ett_bgp);
11723
174
                break;
11724
475
            case BGP_ROUTE_REFRESH_CISCO:
11725
790
            case BGP_ROUTE_REFRESH:
11726
790
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh);
11727
790
                break;
11728
473
            case BGP_CAPABILITY:
11729
473
                bgp_tree = proto_item_add_subtree(ti, ett_bgp_capability);
11730
473
                break;
11731
118
            default:
11732
118
                bgp_tree = proto_item_add_subtree(ti, ett_bgp);
11733
118
                break;
11734
14.1k
        }
11735
11736
14.1k
        ti_marker = proto_tree_add_item(bgp_tree, hf_bgp_marker, tvb, 0,
11737
14.1k
          BGP_MARKER_SIZE, ENC_NA);
11738
14.1k
        if (tvb_memeql(tvb, 0, valid_marker, BGP_MARKER_SIZE) != 0) {
11739
2.80k
             expert_add_info(pinfo, ti_marker, &ei_bgp_marker_invalid);
11740
2.80k
        }
11741
11742
14.1k
        ti_len = proto_tree_add_item(bgp_tree, hf_bgp_length, tvb, 16, 2, ENC_BIG_ENDIAN);
11743
14.1k
    }
11744
11745
14.1k
    if (bgp_len < BGP_HEADER_SIZE || bgp_len > BGP_MAX_PACKET_SIZE) {
11746
37
        expert_add_info_format(pinfo, ti_len, &ei_bgp_length_invalid, "Length is invalid %u", bgp_len);
11747
37
        return tvb_captured_length(tvb);
11748
37
    }
11749
11750
14.1k
    if (tree) {
11751
14.0k
        proto_item_set_len(ti, bgp_len);
11752
14.0k
    }
11753
11754
14.1k
    proto_tree_add_item(bgp_tree, hf_bgp_type, tvb, 16 + 2, 1, ENC_BIG_ENDIAN);
11755
11756
14.1k
    switch (bgp_type) {
11757
349
    case BGP_OPEN:
11758
349
        dissect_bgp_open(tvb, bgp_tree, pinfo);
11759
349
        break;
11760
10.9k
    case BGP_UPDATE:
11761
10.9k
        dissect_bgp_update(tvb, bgp_tree, pinfo);
11762
10.9k
        break;
11763
1.26k
    case BGP_NOTIFICATION:
11764
1.26k
        dissect_bgp_notification(tvb, bgp_tree, pinfo);
11765
1.26k
        break;
11766
172
    case BGP_KEEPALIVE:
11767
        /* no data in KEEPALIVE messages */
11768
172
        break;
11769
475
    case BGP_ROUTE_REFRESH_CISCO:
11770
789
    case BGP_ROUTE_REFRESH:
11771
789
        dissect_bgp_route_refresh(tvb, bgp_tree, pinfo);
11772
789
        break;
11773
471
    case BGP_CAPABILITY:
11774
471
        dissect_bgp_capability(tvb, bgp_tree, pinfo);
11775
471
        break;
11776
91
    default:
11777
91
        break;
11778
14.1k
    }
11779
2.13k
    return bgp_len;
11780
14.1k
}
11781
11782
static unsigned
11783
get_bgp_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
11784
14.2k
{
11785
14.2k
    return tvb_get_ntohs(tvb, offset + BGP_MARKER_SIZE);
11786
14.2k
}
11787
11788
/*
11789
 * Dissect a BGP packet.
11790
 */
11791
static int
11792
dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
11793
11.2k
{
11794
11.2k
    volatile int  offset = 0;   /* offset into the tvbuff           */
11795
11.2k
    static unsigned char marker[] = {   /* BGP message marker               */
11796
11.2k
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
11797
11.2k
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
11798
11.2k
    };
11799
11.2k
    proto_item    *ti;           /* tree item                        */
11800
11.2k
    proto_tree    *bgp_tree;     /* BGP packet tree                  */
11801
11.2k
    tvbuff_t *volatile this_tvb; /* for tcp_dissect_pdus()           */
11802
11803
    /*
11804
     * Scan through the TCP payload looking for a BGP marker.
11805
     */
11806
13.9k
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
11807
        /*
11808
         * Start with a quick search for 0xFFFF, then do the heavier
11809
         * tvb_memeql() once we find it.
11810
         */
11811
13.9k
        offset = tvb_find_uint16(tvb, offset, -1, 0xFFFF);
11812
13.9k
        if (offset < 0) {
11813
            /* Didn't find even the start of a marker */
11814
202
            return 0;
11815
202
        }
11816
13.7k
        else if (0 == tvb_memeql(tvb, offset, marker, BGP_MARKER_SIZE)) {
11817
            /* Found the marker - stop scanning and start processing BGP packets. */
11818
10.9k
            break;
11819
10.9k
        }
11820
2.72k
        else {
11821
            /* Keep scanning through the tvbuff to try to find a marker. */
11822
2.72k
            offset++;
11823
2.72k
        }
11824
13.9k
    }
11825
11826
10.9k
    col_clear(pinfo->cinfo, COL_INFO);
11827
11828
    /*
11829
     * If we skipped any bytes, mark it as a BGP continuation.
11830
     */
11831
10.9k
    if (offset > 0) {
11832
218
        ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, offset, ENC_NA);
11833
218
        bgp_tree = proto_item_add_subtree(ti, ett_bgp);
11834
218
        proto_item_append_text(bgp_tree, " - Continuation");
11835
218
        proto_tree_add_item(bgp_tree, hf_bgp_continuation, tvb, 0, offset, ENC_NA);
11836
11837
        /* Don't include the continuation in PDU reassembly */
11838
218
        this_tvb = tvb_new_subset_remaining(tvb, offset);
11839
218
    }
11840
10.7k
    else {
11841
10.7k
        this_tvb = tvb;
11842
10.7k
    }
11843
11844
    /*
11845
     * Now process the BGP packets in the TCP payload.
11846
     */
11847
10.9k
    tcp_dissect_pdus(this_tvb, pinfo, tree, bgp_desegment, BGP_HEADER_SIZE,
11848
10.9k
                     get_bgp_len, dissect_bgp_pdu, NULL);
11849
10.9k
    return tvb_captured_length(tvb);
11850
11.2k
}
11851
11852
/*
11853
 * Register ourselves.
11854
 */
11855
void
11856
proto_register_bgp(void)
11857
14
{
11858
11859
14
    static hf_register_info hf[] = {
11860
      /* BGP Header */
11861
14
      { &hf_bgp_marker,
11862
14
        { "Marker", "bgp.marker", FT_BYTES, BASE_NONE,
11863
14
          NULL, 0x0, "Must be set to all ones (16 Bytes)", HFILL }},
11864
14
      { &hf_bgp_length,
11865
14
        { "Length", "bgp.length", FT_UINT16, BASE_DEC,
11866
14
          NULL, 0x0, "The total length of the message, including the header in octets", HFILL }},
11867
14
      { &hf_bgp_prefix_length,
11868
14
        { "Prefix Length", "bgp.prefix_length", FT_UINT8, BASE_DEC,
11869
14
          NULL, 0x0, NULL, HFILL }},
11870
14
      { &hf_bgp_rd,
11871
14
        { "Route Distinguisher", "bgp.rd", FT_STRING, BASE_NONE,
11872
14
          NULL, 0x0, NULL, HFILL }},
11873
14
      { &hf_bgp_continuation,
11874
14
        { "Continuation", "bgp.continuation", FT_NONE, BASE_NONE,
11875
14
          NULL, 0x0, NULL, HFILL }},
11876
14
      { &hf_bgp_originating_as,
11877
14
        { "Originating AS", "bgp.originating_as", FT_UINT32, BASE_DEC,
11878
14
          NULL, 0x0, NULL, HFILL }},
11879
14
      { &hf_bgp_community_prefix,
11880
14
        { "Community Prefix", "bgp.community_prefix", FT_STRING, BASE_NONE,
11881
14
          NULL, 0x0, NULL, HFILL }},
11882
14
      { &hf_bgp_endpoint_address,
11883
14
        { "Endpoint Address", "bgp.endpoint_address", FT_IPv4, BASE_NONE,
11884
14
          NULL, 0x0, NULL, HFILL }},
11885
14
      { &hf_bgp_endpoint_address_ipv6,
11886
14
        { "Endpoint Address", "bgp.endpoint_address_ipv6", FT_IPv6, BASE_NONE,
11887
14
          NULL, 0x0, NULL, HFILL }},
11888
14
      { &hf_bgp_label_stack,
11889
14
        { "Label Stack", "bgp.label_stack", FT_STRING, BASE_NONE,
11890
14
          NULL, 0x0, NULL, HFILL }},
11891
14
      { &hf_bgp_vplsad_length,
11892
14
        { "Length", "bgp.vplsad.length", FT_UINT16, BASE_DEC,
11893
14
          NULL, 0x0, NULL, HFILL }},
11894
14
      { &hf_bgp_vplsad_rd,
11895
14
        { "RD", "bgp.vplsad.rd", FT_STRING, BASE_NONE,
11896
14
          NULL, 0x0, NULL, HFILL }},
11897
14
      { &hf_bgp_bgpad_pe_addr,
11898
14
        { "PE Addr", "bgp.ad.pe_addr", FT_IPv4, BASE_NONE,
11899
14
          NULL, 0x0, NULL, HFILL }},
11900
14
      { &hf_bgp_vplsbgp_ce_id,
11901
14
        { "CE-ID", "bgp.vplsbgp.ce_id", FT_UINT16, BASE_DEC,
11902
14
          NULL, 0x0, NULL, HFILL }},
11903
14
      { &hf_bgp_vplsbgp_labelblock_offset,
11904
14
        { "Label Block Offset", "bgp.vplsbgp.labelblock.offset", FT_UINT16, BASE_DEC,
11905
14
          NULL, 0x0, NULL, HFILL }},
11906
14
      { &hf_bgp_vplsbgp_labelblock_size,
11907
14
        { "Label Block Size", "bgp.vplsbgp.labelblock.size", FT_UINT16, BASE_DEC,
11908
14
          NULL, 0x0, NULL, HFILL }},
11909
14
      { &hf_bgp_vplsbgp_labelblock_base,
11910
14
        { "Label Block Base", "bgp.vplsbgp.labelblock.base", FT_STRING, BASE_NONE,
11911
14
          NULL, 0x0, NULL, HFILL }},
11912
14
      { &hf_bgp_wildcard_route_target,
11913
14
        { "Wildcard route target", "bgp.wildcard_route_target", FT_STRING, BASE_NONE,
11914
14
          NULL, 0x0, NULL, HFILL }},
11915
14
      { &hf_bgp_type,
11916
14
        { "Type", "bgp.type", FT_UINT8, BASE_DEC,
11917
14
          VALS(bgptypevals), 0x0, "BGP message type", HFILL }},
11918
      /* Open Message */
11919
14
      { &hf_bgp_open_version,
11920
14
        { "Version", "bgp.open.version", FT_UINT8, BASE_DEC,
11921
14
          NULL, 0x0, "The protocol version number", HFILL }},
11922
14
      { &hf_bgp_open_myas,
11923
14
        { "My AS", "bgp.open.myas", FT_UINT16, BASE_DEC,
11924
14
          NULL, 0x0, "The Autonomous System number of the sender", HFILL }},
11925
14
      { &hf_bgp_open_holdtime,
11926
14
        { "Hold Time", "bgp.open.holdtime", FT_UINT16, BASE_DEC,
11927
14
          NULL, 0x0, "The number of seconds the sender proposes for Hold Time", HFILL }},
11928
14
      { &hf_bgp_open_identifier,
11929
14
        { "BGP Identifier", "bgp.open.identifier", FT_IPv4, BASE_NONE,
11930
14
          NULL, 0x0, "The BGP Identifier of the sender", HFILL }},
11931
14
      { &hf_bgp_open_opt_len,
11932
14
        { "Optional Parameters Length", "bgp.open.opt.len", FT_UINT8, BASE_DEC,
11933
14
          NULL, 0x0, "The total length of the Optional Parameters field in octets", HFILL }},
11934
14
      { &hf_bgp_open_opt_extension,
11935
14
        { "Optional Parameter Extension", "bgp.open.opt.extension", FT_NONE, BASE_NONE,
11936
14
          NULL, 0x0, "Optional Parameters Extension detected", HFILL }},
11937
14
      { &hf_bgp_open_opt_extension_mark,
11938
14
        { "Extension Mark", "bgp.open.opt.extension.mark", FT_UINT8, BASE_DEC,
11939
14
          NULL, 0x0, "Optional Parameters Extension detected", HFILL }},
11940
14
      { &hf_bgp_open_opt_extension_len,
11941
14
        { "Extended Length", "bgp.open.opt.extension_len", FT_UINT16, BASE_DEC,
11942
14
          NULL, 0x0, "The total extended length of the Optional Parameters field in octets", HFILL }},
11943
14
      { &hf_bgp_open_opt_params,
11944
14
        { "Optional Parameters", "bgp.open.opt", FT_NONE, BASE_NONE,
11945
14
          NULL, 0x0, "List of optional parameters", HFILL }},
11946
14
      { &hf_bgp_open_opt_param,
11947
14
        { "Optional Parameter", "bgp.open.opt.param", FT_NONE, BASE_NONE,
11948
14
          NULL, 0x0, NULL, HFILL }},
11949
14
      { &hf_bgp_open_opt_param_type,
11950
14
        { "Parameter Type", "bgp.open.opt.param.type", FT_UINT8, BASE_DEC,
11951
14
          VALS(bgp_open_opt_vals), 0x0, "Unambiguously identifies individual parameters", HFILL }},
11952
14
      { &hf_bgp_open_opt_param_len,
11953
14
        { "Parameter Length", "bgp.open.opt.param.len", FT_UINT8, BASE_DEC,
11954
14
          NULL, 0x0, "Length of the Parameter Value", HFILL }},
11955
14
      { &hf_bgp_open_opt_param_auth,
11956
14
        { "Authentication Data", "bgp.open.opt.param.auth", FT_BYTES, BASE_NONE,
11957
14
          NULL, 0x0, "Deprecated", HFILL }},
11958
14
      { &hf_bgp_open_opt_param_unknown,
11959
14
        { "Unknown", "bgp.open.opt.param.unknown", FT_BYTES, BASE_NONE,
11960
14
          NULL, 0x0, "Unknown Parameter", HFILL }},
11961
        /* Notification error */
11962
14
      { &hf_bgp_notify_major_error,
11963
14
        { "Major error Code", "bgp.notify.major_error", FT_UINT8, BASE_DEC,
11964
14
          VALS(bgpnotify_major), 0x0, NULL, HFILL }},
11965
14
      { &hf_bgp_notify_minor_msg_hdr,
11966
14
        { "Minor error Code (Message Header)", "bgp.notify.minor_error", FT_UINT8, BASE_DEC,
11967
14
          VALS(bgpnotify_minor_msg_hdr), 0x0, NULL, HFILL }},
11968
14
      { &hf_bgp_notify_minor_open_msg,
11969
14
        { "Minor error Code (Open Message)", "bgp.notify.minor_error_open", FT_UINT8, BASE_DEC,
11970
14
          VALS(bgpnotify_minor_open_msg), 0x0, NULL, HFILL }},
11971
14
      { &hf_bgp_notify_minor_update_msg,
11972
14
        { "Minor error Code (Update Message)", "bgp.notify.minor_error_update", FT_UINT8, BASE_DEC,
11973
14
          VALS(bgpnotify_minor_update_msg), 0x0, NULL, HFILL }},
11974
14
      { &hf_bgp_notify_minor_ht_expired,
11975
14
        { "Minor error Code (Hold Timer Expired)", "bgp.notify.minor_error_expired", FT_UINT8, BASE_DEC,
11976
14
          NULL, 0x0, NULL, HFILL }},
11977
14
      { &hf_bgp_notify_minor_state_machine,
11978
14
        { "Minor error Code (State Machine)", "bgp.notify.minor_error_state", FT_UINT8, BASE_DEC,
11979
14
          VALS(bgpnotify_minor_state_machine), 0x0, NULL, HFILL }},
11980
14
      { &hf_bgp_notify_minor_cease,
11981
14
        { "Minor error Code (Cease)", "bgp.notify.minor_error_cease", FT_UINT8, BASE_DEC,
11982
14
          VALS(bgpnotify_minor_cease), 0x0, NULL, HFILL }},
11983
14
      { &hf_bgp_notify_minor_rr_msg,
11984
14
        { "Minor error Code (Route-Refresh message)", "bgp.notify.minor_error_route_refresh", FT_UINT8, BASE_DEC,
11985
14
          VALS(bgpnotify_minor_rr_msg), 0x0, NULL, HFILL }},
11986
14
      { &hf_bgp_notify_minor_unknown,
11987
14
        { "Minor error Code (Unknown)", "bgp.notify.minor_error_unknown", FT_UINT8, BASE_DEC,
11988
14
          NULL, 0x0, NULL, HFILL }},
11989
14
      { &hf_bgp_notify_data,
11990
14
        { "Data", "bgp.notify.minor_data", FT_BYTES, BASE_NONE,
11991
14
           NULL, 0x0, NULL, HFILL }},
11992
14
      { &hf_bgp_notify_error_open_bad_peer_as,
11993
14
        { "Bad Peer AS", "bgp.notify.error_open.bad_peer_as", FT_UINT32, BASE_DEC,
11994
14
           NULL, 0x0, NULL, HFILL }},
11995
14
      { &hf_bgp_notify_communication_length,
11996
14
        { "BGP Shutdown Communication Length", "bgp.notify.communication_length", FT_UINT8, BASE_DEC,
11997
14
          NULL, 0x0, NULL, HFILL }},
11998
14
      { &hf_bgp_notify_communication,
11999
14
        { "Shutdown Communication", "bgp.notify.communication", FT_STRING, BASE_NONE,
12000
14
          NULL, 0x0, NULL, HFILL }},
12001
12002
        /* Route Refresh */
12003
14
      { &hf_bgp_route_refresh_afi,
12004
14
        { "Address family identifier (AFI)", "bgp.route_refresh.afi", FT_UINT16, BASE_DEC,
12005
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12006
14
      { &hf_bgp_route_refresh_subtype,
12007
14
        { "Subtype", "bgp.route_refresh.subtype", FT_UINT8, BASE_DEC,
12008
14
          VALS(route_refresh_subtype_vals), 0x0, NULL, HFILL }},
12009
14
      { &hf_bgp_route_refresh_safi,
12010
14
        { "Subsequent address family identifier (SAFI)", "bgp.route_refresh.safi", FT_UINT8, BASE_DEC,
12011
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12012
14
      { &hf_bgp_route_refresh_orf,
12013
14
        { "ORF information", "bgp.route_refresh.orf", FT_NONE, BASE_NONE,
12014
14
          NULL, 0x0, NULL, HFILL }},
12015
14
      { &hf_bgp_route_refresh_orf_flag,
12016
14
        { "ORF flag", "bgp.route_refresh.orf.flag", FT_UINT8, BASE_DEC,
12017
14
          VALS(orf_when_vals), 0x0, NULL, HFILL }},
12018
14
      { &hf_bgp_route_refresh_orf_type,
12019
14
        { "ORF type", "bgp.route_refresh.orf.type", FT_UINT8, BASE_DEC,
12020
14
          VALS(orf_type_vals), 0x0, NULL, HFILL }},
12021
14
      { &hf_bgp_route_refresh_orf_length,
12022
14
        { "ORF length", "bgp.route_refresh.orf.length", FT_UINT16, BASE_DEC,
12023
14
          NULL, 0x0, NULL, HFILL }},
12024
14
      { &hf_bgp_route_refresh_orf_entry_prefixlist,
12025
14
        { "ORFEntry PrefixList", "bgp.route_refresh.orf.entry", FT_NONE, BASE_NONE,
12026
14
          NULL, 0x0, NULL, HFILL }},
12027
14
      { &hf_bgp_route_refresh_orf_entry_action,
12028
14
        { "ORFEntry Action", "bgp.route_refresh.orf.entry.action", FT_UINT8, BASE_DEC,
12029
14
          VALS(orf_entry_action_vals), BGP_ORF_ACTION, NULL, HFILL }},
12030
14
      { &hf_bgp_route_refresh_orf_entry_match,
12031
14
        { "ORFEntry Match", "bgp.route_refresh.orf.entry.match", FT_UINT8, BASE_DEC,
12032
14
          VALS(orf_entry_match_vals), BGP_ORF_MATCH, NULL, HFILL }},
12033
14
      { &hf_bgp_route_refresh_orf_entry_sequence,
12034
14
        { "ORFEntry Sequence", "bgp.route_refresh.orf.entry.sequence", FT_UINT32, BASE_DEC,
12035
14
          NULL, 0x0, NULL, HFILL }},
12036
14
      { &hf_bgp_route_refresh_orf_entry_prefixmask_lower,
12037
14
        { "ORFEntry PrefixMask length lower bound", "bgp.route_refresh.orf.entry.prefixmask_lower", FT_UINT8, BASE_DEC,
12038
14
          NULL, 0x0, NULL, HFILL }},
12039
14
      { &hf_bgp_route_refresh_orf_entry_prefixmask_upper,
12040
14
        { "ORFEntry PrefixMask length upper bound", "bgp.route_refresh.orf.entry.prefixmask_upper", FT_UINT8, BASE_DEC,
12041
14
          NULL, 0x0, NULL, HFILL }},
12042
14
      { &hf_bgp_route_refresh_orf_entry_ip,
12043
14
        { "ORFEntry IP address", "bgp.route_refresh.orf.entry.ip", FT_IPv4, BASE_NONE,
12044
14
          NULL, 0x0, NULL, HFILL }},
12045
12046
        /* Capability */
12047
14
      { &hf_bgp_cap,
12048
14
        { "Capability", "bgp.cap", FT_NONE, BASE_NONE,
12049
14
          NULL, 0x0, NULL, HFILL }},
12050
14
      { &hf_bgp_cap_type,
12051
14
        { "Type", "bgp.cap.type", FT_UINT8, BASE_DEC,
12052
14
          VALS(capability_vals), 0x0, NULL, HFILL }},
12053
14
      { &hf_bgp_cap_length,
12054
14
        { "Length", "bgp.cap.length", FT_UINT8, BASE_DEC,
12055
14
          NULL, 0x0, NULL, HFILL }},
12056
14
      { &hf_bgp_cap_action,
12057
14
        { "Action", "bgp.cap.action", FT_UINT8, BASE_DEC,
12058
14
          VALS(bgpcap_action), 0x0, NULL, HFILL }},
12059
14
      { &hf_bgp_cap_unknown,
12060
14
        { "Unknown", "bgp.cap.unknown", FT_BYTES, BASE_NONE,
12061
14
          NULL, 0x0, NULL, HFILL }},
12062
14
      { &hf_bgp_cap_reserved,
12063
14
        { "Reserved", "bgp.cap.reserved", FT_BYTES, BASE_NONE,
12064
14
          NULL, 0x0, "Must be Zero", HFILL }},
12065
14
      { &hf_bgp_cap_mp_afi,
12066
14
        { "AFI", "bgp.cap.mp.afi", FT_UINT16, BASE_DEC,
12067
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12068
14
      { &hf_bgp_cap_mp_safi,
12069
14
        { "SAFI", "bgp.cap.mp.safi", FT_UINT8, BASE_DEC,
12070
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12071
14
      { &hf_bgp_cap_enh_afi,
12072
14
        { "AFI", "bgp.cap.enh.afi", FT_UINT16, BASE_DEC,
12073
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12074
14
      { &hf_bgp_cap_enh_safi,
12075
14
        { "SAFI", "bgp.cap.enh.safi", FT_UINT16, BASE_DEC,
12076
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12077
14
      { &hf_bgp_cap_enh_nhafi,
12078
14
        { "Next hop AFI", "bgp.cap.enh.nhafi", FT_UINT16, BASE_DEC,
12079
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12080
14
      { &hf_bgp_cap_role,
12081
14
        { "BGP Role", "bgp.cap.role", FT_UINT8, BASE_DEC,
12082
14
          VALS(bgprole_vals), 0x0, NULL, HFILL }},
12083
14
      { &hf_bgp_cap_gr_timers,
12084
14
        { "Restart Timers", "bgp.cap.gr.timers", FT_UINT16, BASE_HEX,
12085
14
          NULL, 0x0, NULL, HFILL }},
12086
14
      { &hf_bgp_cap_gr_timers_restart_flag,
12087
14
        { "Restart state", "bgp.cap.gr.timers.restart_flag", FT_BOOLEAN, 16,
12088
14
          TFS(&tfs_yes_no), 0x8000, NULL, HFILL }},
12089
14
      { &hf_bgp_cap_gr_timers_notification_flag,
12090
14
        { "Graceful notification", "bgp.cap.gr.timers.notification_flag", FT_BOOLEAN, 16,
12091
14
          TFS(&tfs_yes_no), 0x4000, NULL, HFILL }},
12092
14
      { &hf_bgp_cap_gr_timers_restart_time,
12093
14
        { "Time", "bgp.cap.gr.timers.restart_time", FT_UINT16, BASE_DEC,
12094
14
          NULL, 0x0FFF, "in us", HFILL }},
12095
14
      { &hf_bgp_cap_gr_afi,
12096
14
        { "AFI", "bgp.cap.gr.afi", FT_UINT16, BASE_DEC,
12097
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12098
14
      { &hf_bgp_cap_gr_safi,
12099
14
        { "SAFI", "bgp.cap.gr.safi", FT_UINT8, BASE_DEC,
12100
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12101
14
      { &hf_bgp_cap_gr_flag,
12102
14
        { "Flag", "bgp.cap.gr.flag", FT_UINT8, BASE_HEX,
12103
14
          NULL, 0x0, NULL, HFILL }},
12104
14
      { &hf_bgp_cap_gr_flag_pfs,
12105
14
        { "Preserve forwarding state", "bgp.cap.gr.flag.pfs", FT_BOOLEAN, 8,
12106
14
          TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
12107
14
      { &hf_bgp_cap_4as,
12108
14
        { "AS Number", "bgp.cap.4as", FT_UINT32, BASE_DEC,
12109
14
          NULL, 0x0, NULL, HFILL }},
12110
14
      { &hf_bgp_cap_dc,
12111
14
        { "Capability Dynamic", "bgp.cap.dc", FT_UINT8, BASE_DEC,
12112
14
          VALS(capability_vals), 0x0, NULL, HFILL }},
12113
14
      { &hf_bgp_cap_ap_afi,
12114
14
        { "AFI", "bgp.cap.ap.afi", FT_UINT16, BASE_DEC,
12115
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12116
14
      { &hf_bgp_cap_ap_safi,
12117
14
        { "SAFI", "bgp.cap.ap.safi", FT_UINT8, BASE_DEC,
12118
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12119
14
      { &hf_bgp_cap_ap_sendreceive,
12120
14
        { "Send/Receive", "bgp.cap.ap.sendreceive", FT_UINT8, BASE_DEC,
12121
14
          VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
12122
14
      { &hf_bgp_cap_orf_afi,
12123
14
        { "AFI", "bgp.cap.orf.afi", FT_UINT16, BASE_DEC,
12124
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12125
14
      { &hf_bgp_cap_orf_safi,
12126
14
        { "SAFI", "bgp.cap.orf.safi", FT_UINT8, BASE_DEC,
12127
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12128
14
      { &hf_bgp_cap_orf_number,
12129
14
        { "Number", "bgp.cap.orf.number", FT_UINT8, BASE_DEC,
12130
14
          NULL, 0x0, NULL, HFILL }},
12131
14
      { &hf_bgp_cap_orf_type,
12132
14
        { "Type", "bgp.cap.orf.type", FT_UINT8, BASE_DEC,
12133
14
          VALS(orf_type_vals), 0x0, NULL, HFILL }},
12134
14
      { &hf_bgp_cap_orf_sendreceive,
12135
14
        { "Send Receive", "bgp.cap.orf.sendreceive", FT_UINT8, BASE_DEC,
12136
14
          VALS(orf_send_recv_vals), 0x0, NULL, HFILL }},
12137
14
      { &hf_bgp_cap_fqdn_hostname_len,
12138
14
        { "Hostname Length", "bgp.cap.orf.fqdn.hostname.len", FT_UINT8, BASE_DEC,
12139
14
          NULL, 0x0, NULL, HFILL }},
12140
14
      { &hf_bgp_cap_fqdn_hostname,
12141
14
        { "Hostname", "bgp.cap.orf.fqdn.hostname", FT_STRING, BASE_NONE,
12142
14
          NULL, 0x0, NULL, HFILL }},
12143
14
      { &hf_bgp_cap_fqdn_domain_name_len,
12144
14
        { "Domain Name Length", "bgp.cap.orf.fqdn.domain_name.len", FT_UINT8, BASE_DEC,
12145
14
          NULL, 0x0, NULL, HFILL }},
12146
14
      { &hf_bgp_cap_fqdn_domain_name,
12147
14
        { "Domain Name", "bgp.cap.orf.fqdn.domain_name", FT_STRING, BASE_NONE,
12148
14
          NULL, 0x0, NULL, HFILL }},
12149
14
      { &hf_bgp_cap_multisession_flags,
12150
14
        { "Flag", "bgp.cap.multisession.flags", FT_UINT8, BASE_HEX,
12151
14
          NULL, 0x0, NULL, HFILL }},
12152
14
      { &hf_bgp_cap_bgpsec_flags,
12153
14
        { "Flag", "bgp.cap.bgpsec.flags", FT_UINT8, BASE_HEX,
12154
14
          NULL, 0x0, NULL, HFILL }},
12155
14
      { &hf_bgp_cap_bgpsec_version,
12156
14
        { "Version", "bgp.cap.bgpsec.version", FT_UINT8, BASE_DEC,
12157
14
          NULL, 0xF0, NULL, HFILL }},
12158
14
      { &hf_bgp_cap_bgpsec_sendreceive,
12159
14
        { "Send/Receive", "bgp.cap.bgpsec.sendreceive", FT_UINT8, BASE_DEC,
12160
14
          VALS(bgpsec_send_receive_vals), 0x8, NULL, HFILL }},
12161
14
      { &hf_bgp_cap_bgpsec_reserved,
12162
14
        { "Reserved", "bgp.cap.bgpsec.reserved", FT_UINT8, BASE_HEX,
12163
14
          NULL, 0x7, "Must be Zero", HFILL }},
12164
14
      { &hf_bgp_cap_bgpsec_afi,
12165
14
        { "AFI", "bgp.cap.bgpsec.afi", FT_UINT16, BASE_DEC,
12166
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12167
14
      { &hf_bgp_cap_soft_version_len,
12168
14
        { "Software Version Length", "bgp.cap.software_version.len", FT_UINT8, BASE_DEC,
12169
14
          NULL, 0x0, NULL, HFILL }},
12170
14
      { &hf_bgp_cap_soft_version,
12171
14
        { "Software Version", "bgp.cap.software_version", FT_STRING, BASE_NONE,
12172
14
          NULL, 0x0, NULL, HFILL }},
12173
      /* BGP update */
12174
12175
14
      { &hf_bgp_update_withdrawn_routes_length,
12176
14
        { "Withdrawn Routes Length", "bgp.update.withdrawn_routes.length", FT_UINT16, BASE_DEC,
12177
14
          NULL, 0x0, NULL, HFILL}},
12178
14
      { &hf_bgp_update_withdrawn_routes,
12179
14
        { "Withdrawn Routes", "bgp.update.withdrawn_routes", FT_NONE, BASE_NONE,
12180
14
          NULL, 0x0, NULL, HFILL}},
12181
12182
14
      { &hf_bgp_update_path_attribute_aggregator_as,
12183
14
        { "Aggregator AS", "bgp.update.path_attribute.aggregator_as", FT_UINT32, BASE_DEC,
12184
14
          NULL, 0x0, NULL, HFILL}},
12185
      /* BGP update path attributes */
12186
14
      { &hf_bgp_update_path_attributes,
12187
14
        { "Path attributes", "bgp.update.path_attributes", FT_NONE, BASE_NONE,
12188
14
          NULL, 0x0, NULL, HFILL}},
12189
14
      { &hf_bgp_update_path_attributes_unknown,
12190
14
        { "Unknown Path attributes", "bgp.update.path_attributes.unknown", FT_NONE, BASE_NONE,
12191
14
          NULL, 0x0, NULL, HFILL}},
12192
14
      { &hf_bgp_update_total_path_attribute_length,
12193
14
        { "Total Path Attribute Length", "bgp.update.path_attributes.length", FT_UINT16, BASE_DEC,
12194
14
          NULL, 0x0, NULL, HFILL}},
12195
14
      { &hf_bgp_update_path_attribute_aggregator_origin,
12196
14
        { "Aggregator origin", "bgp.update.path_attribute.aggregator_origin", FT_IPv4, BASE_NONE,
12197
14
          NULL, 0x0, NULL, HFILL}},
12198
14
      { &hf_bgp_update_path_attribute_as_path_segment,
12199
14
        { "AS Path segment", "bgp.update.path_attribute.as_path_segment", FT_NONE, BASE_NONE,
12200
14
          NULL, 0x0, NULL, HFILL}},
12201
14
      { &hf_bgp_update_path_attribute_as_path_segment_type,
12202
14
        { "Segment type", "bgp.update.path_attribute.as_path_segment.type", FT_UINT8, BASE_DEC,
12203
14
          VALS(as_segment_type), 0x0, NULL, HFILL}},
12204
14
      { &hf_bgp_update_path_attribute_as_path_segment_length,
12205
14
        { "Segment length (number of ASN)", "bgp.update.path_attribute.as_path_segment.length", FT_UINT8, BASE_DEC,
12206
14
          NULL, 0x0, NULL, HFILL}},
12207
14
      { &hf_bgp_update_path_attribute_as_path_segment_as2,
12208
14
        { "AS2", "bgp.update.path_attribute.as_path_segment.as2", FT_UINT16, BASE_DEC,
12209
14
          NULL, 0x0, NULL, HFILL}},
12210
14
      { &hf_bgp_update_path_attribute_as_path_segment_as4,
12211
14
        { "AS4", "bgp.update.path_attribute.as_path_segment.as4", FT_UINT32, BASE_DEC,
12212
14
          NULL, 0x0, NULL, HFILL}},
12213
14
      { &hf_bgp_update_path_attribute_communities,
12214
14
        { "Communities", "bgp.update.path_attribute.communities", FT_NONE, BASE_NONE,
12215
14
          NULL, 0x0, NULL, HFILL}},
12216
14
      { &hf_bgp_update_path_attribute_community,
12217
14
        { "Community", "bgp.update.path_attribute.community", FT_NONE, BASE_NONE,
12218
14
          NULL, 0x0, NULL, HFILL}},
12219
14
      { &hf_bgp_update_path_attribute_community_well_known,
12220
14
        { "Community Well-known", "bgp.update.path_attribute.community_wellknown", FT_UINT32, BASE_HEX,
12221
14
          VALS(community_vals), 0x0, "Reserved", HFILL}},
12222
14
      { &hf_bgp_update_path_attribute_community_as,
12223
14
        { "Community AS", "bgp.update.path_attribute.community_as", FT_UINT16, BASE_DEC,
12224
14
          NULL, 0x0, NULL, HFILL}},
12225
14
      { &hf_bgp_update_path_attribute_community_value,
12226
14
        { "Community value", "bgp.update.path_attribute.community_value", FT_UINT16, BASE_DEC,
12227
14
          NULL, 0x0, NULL, HFILL}},
12228
14
      { &hf_bgp_update_path_attribute_local_pref,
12229
14
        { "Local preference", "bgp.update.path_attribute.local_pref", FT_UINT32, BASE_DEC,
12230
14
          NULL, 0x0, NULL, HFILL}},
12231
14
      { &hf_bgp_update_path_attribute_attrset_origin_as,
12232
14
        { "Origin AS", "bgp.update.path_attribute.attr_set.origin_as", FT_UINT32, BASE_DEC,
12233
14
          NULL, 0x0, NULL, HFILL}},
12234
14
      { &hf_bgp_update_path_attribute_multi_exit_disc,
12235
14
        { "Multiple exit discriminator", "bgp.update.path_attribute.multi_exit_disc", FT_UINT32, BASE_DEC,
12236
14
          NULL, 0x0, NULL, HFILL}},
12237
14
      { &hf_bgp_update_path_attribute_next_hop,
12238
14
        { "Next hop", "bgp.update.path_attribute.next_hop", FT_IPv4, BASE_NONE,
12239
14
          NULL, 0x0, NULL, HFILL}},
12240
14
      { &hf_bgp_update_path_attribute_origin,
12241
14
        { "Origin", "bgp.update.path_attribute.origin", FT_UINT8, BASE_DEC,
12242
14
          VALS(bgpattr_origin), 0x0, NULL, HFILL}},
12243
14
      { &hf_bgp_update_path_attribute,
12244
14
        { "Path Attribute", "bgp.update.path_attribute", FT_NONE, BASE_NONE,
12245
14
          NULL, 0x0, NULL, HFILL}},
12246
14
      { &hf_bgp_update_path_attribute_flags,
12247
14
        { "Flags", "bgp.update.path_attribute.flags", FT_UINT8, BASE_HEX,
12248
14
          NULL, 0x0, NULL, HFILL}},
12249
14
      { &hf_bgp_update_path_attribute_flags_optional,
12250
14
        { "Optional", "bgp.update.path_attribute.flags.optional", FT_BOOLEAN, 8,
12251
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_OPTIONAL, NULL, HFILL}},
12252
14
      { &hf_bgp_update_path_attribute_flags_transitive,
12253
14
        { "Transitive", "bgp.update.path_attribute.flags.transitive", FT_BOOLEAN, 8,
12254
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_TRANSITIVE, NULL, HFILL}},
12255
14
      { &hf_bgp_update_path_attribute_flags_partial,
12256
14
        { "Partial", "bgp.update.path_attribute.flags.partial", FT_BOOLEAN, 8,
12257
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_PARTIAL, NULL, HFILL}},
12258
14
      { &hf_bgp_update_path_attribute_flags_extended_length,
12259
14
        { "Extended-Length", "bgp.update.path_attribute.flags.extended_length", FT_BOOLEAN, 8,
12260
14
          TFS(&tfs_set_notset), BGP_ATTR_FLAG_EXTENDED_LENGTH, NULL, HFILL}},
12261
14
      { &hf_bgp_update_path_attribute_flags_unused,
12262
14
        { "Unused", "bgp.update.path_attribute.flags.unused", FT_UINT8, BASE_HEX,
12263
14
          NULL, BGP_ATTR_FLAG_UNUSED, NULL, HFILL}},
12264
14
      { &hf_bgp_update_path_attribute_type_code,
12265
14
        { "Type Code", "bgp.update.path_attribute.type_code", FT_UINT8, BASE_DEC,
12266
14
          VALS(bgpattr_type), 0x0, NULL, HFILL}},
12267
14
      { &hf_bgp_update_path_attribute_length,
12268
14
        { "Length", "bgp.update.path_attribute.length", FT_UINT16, BASE_DEC,
12269
14
          NULL, 0x0, NULL, HFILL}},
12270
14
      { &hf_bgp_update_path_attribute_link_state,
12271
14
        { "Link State", "bgp.update.path_attribute.link_state", FT_NONE, BASE_NONE,
12272
14
          NULL, 0x0, NULL, HFILL}},
12273
12274
      /* BGPsec Path Attributes, RFC8205*/
12275
14
      { &hf_bgp_update_path_attribute_bgpsec_sp_len,
12276
14
        { "Length", "bgp.update.path_attribute.bgpsec.sp.length", FT_UINT16, BASE_DEC,
12277
14
          NULL, 0x0, NULL, HFILL}},
12278
14
      { &hf_bgp_update_path_attribute_bgpsec_sps_pcount,
12279
14
        { "pCount", "bgp.update.path_attribute.bgpsec.sps.pcount", FT_UINT8, BASE_DEC,
12280
14
          NULL, 0x0, NULL, HFILL}},
12281
14
      { &hf_bgp_update_path_attribute_bgpsec_sps_flags,
12282
14
        { "Flags", "bgp.update.path_attribute.bgpsec.sps.flags", FT_UINT8, BASE_DEC,
12283
14
          NULL, 0x0, NULL, HFILL}},
12284
14
      { &hf_bgp_update_path_attribute_bgpsec_sps_as,
12285
14
        { "AS Number", "bgp.update.path_attribute.bgpsec.sps.as", FT_UINT32, BASE_DEC,
12286
14
          NULL, 0x0, NULL, HFILL}},
12287
14
      { &hf_bgp_update_path_attribute_bgpsec_sb_len,
12288
14
        { "Length", "bgp.update.path_attribute.bgpsec.sb.length", FT_UINT16, BASE_DEC,
12289
14
          NULL, 0x0, NULL, HFILL}},
12290
14
      { &hf_bgp_update_path_attribute_bgpsec_algo_id,
12291
14
        { "Algo ID", "bgp.update.path_attribute.bgpsec.sb.algo_id", FT_UINT8, BASE_DEC,
12292
14
          NULL, 0x0, NULL, HFILL}},
12293
14
      { &hf_bgp_update_path_attribute_bgpsec_ski,
12294
14
        { "SKI", "bgp.update.path_attribute.bgpsec.ss.ski", FT_BYTES, SEP_SPACE,
12295
14
          NULL, 0x0, NULL, HFILL}},
12296
14
      { &hf_bgp_update_path_attribute_bgpsec_sig_len,
12297
14
        { "Length", "bgp.update.path_attribute.bgpsec.ss.length", FT_UINT16, BASE_DEC,
12298
14
          NULL, 0x0, NULL, HFILL}},
12299
14
      { &hf_bgp_update_path_attribute_bgpsec_sig,
12300
14
        { "Signature", "bgp.update.path_attribute.bgpsec.ss.sig", FT_BYTES, SEP_SPACE,
12301
14
          NULL, 0x0, NULL, HFILL}},
12302
12303
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_address_family,
12304
14
        { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_reach_nlri.afi", FT_UINT16, BASE_DEC,
12305
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12306
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_safi,
12307
14
        { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_reach_nlri.safi", FT_UINT8, BASE_DEC,
12308
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12309
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop,
12310
14
        { "Next hop", "bgp.update.path_attribute.mp_reach_nlri.next_hop", FT_BYTES, BASE_NO_DISPLAY_VALUE,
12311
14
          NULL, 0x0, NULL, HFILL }},
12312
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_rd,
12313
14
        { "Route Distinguisher", "bgp.update.path_attribute.mp_reach_nlri.next_hop.rd", FT_STRING, BASE_NONE,
12314
14
          NULL, 0x0, "RD is always zero in the Next Hop", HFILL }},
12315
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv4,
12316
14
        { "IPv4 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv4", FT_IPv4, BASE_NONE,
12317
14
          NULL, 0x0, NULL, HFILL}},
12318
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6,
12319
14
        { "IPv6 Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6", FT_IPv6, BASE_NONE,
12320
14
          NULL, 0x0, NULL, HFILL}},
12321
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_next_hop_ipv6_link_local,
12322
14
        { "Link-local Address", "bgp.update.path_attribute.mp_reach_nlri.next_hop.ipv6.link_local", FT_IPv6, BASE_NONE,
12323
14
          NULL, 0x0, NULL, HFILL}},
12324
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_nbr_snpa,
12325
14
        { "Number of Subnetwork points of attachment (SNPA)", "bgp.update.path_attribute.mp_reach_nlri.nbr_snpa", FT_UINT8, BASE_DEC,
12326
14
          NULL, 0x0, NULL, HFILL }},
12327
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa_length,
12328
14
        { "SNPA Length", "bgp.update.path_attribute.mp_reach_nlri.snpa_length", FT_UINT8, BASE_DEC,
12329
14
          NULL, 0x0, NULL, HFILL }},
12330
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri_snpa,
12331
14
        { "SNPA", "bgp.update.path_attribute.mp_reach_nlri.snpa", FT_BYTES, BASE_NONE,
12332
14
          NULL, 0x0, NULL, HFILL }},
12333
14
      { &hf_bgp_update_path_attribute_mp_reach_nlri,
12334
14
        { "Network Layer Reachability Information (NLRI)", "bgp.update.path_attribute.mp_reach_nlri", FT_NONE, BASE_NONE,
12335
14
          NULL, 0x0, NULL, HFILL}},
12336
12337
14
      { &hf_bgp_update_path_attribute_mp_unreach_nlri_address_family,
12338
14
        { "Address family identifier (AFI)", "bgp.update.path_attribute.mp_unreach_nlri.afi", FT_UINT16, BASE_DEC,
12339
14
          VALS(afn_vals), 0x0, NULL, HFILL }},
12340
14
      { &hf_bgp_update_path_attribute_mp_unreach_nlri_safi,
12341
14
        { "Subsequent address family identifier (SAFI)", "bgp.update.path_attribute.mp_unreach_nlri.safi", FT_UINT8, BASE_DEC,
12342
14
          VALS(bgpattr_nlri_safi), 0x0, NULL, HFILL }},
12343
14
      { &hf_bgp_update_path_attribute_mp_unreach_nlri,
12344
14
        { "Withdrawn Routes", "bgp.update.path_attribute.mp_unreach_nlri", FT_NONE, BASE_NONE,
12345
14
          NULL, 0x0, NULL, HFILL}},
12346
12347
14
      { &hf_bgp_pmsi_tunnel_flags,
12348
14
        { "Flags", "bgp.update.path_attribute.pmsi.tunnel.flags", FT_UINT8, BASE_DEC,
12349
14
          NULL, 0x0, NULL, HFILL}},
12350
14
      { &hf_bgp_pmsi_tunnel_type,
12351
14
        { "Tunnel Type", "bgp.update.path_attribute.pmsi.tunnel.type", FT_UINT8, BASE_DEC,
12352
14
          VALS(pmsi_tunnel_type), 0x0, NULL, HFILL}},
12353
14
      { &hf_bgp_pmsi_tunnel_id,
12354
14
        { "Tunnel ID", "bgp.update.path_attribute.pmsi.tunnel.id", FT_NONE, BASE_NONE,
12355
14
          NULL, 0x0, NULL, HFILL}},
12356
14
      { &hf_bgp_pmsi_tunnel_not_present,
12357
14
        { "Tunnel ID not present", "bgp.update.path_attribute.pmsi.tunnel_id.not_present", FT_NONE, BASE_NONE,
12358
14
          NULL, 0x0, NULL, HFILL}},
12359
14
      { &hf_bgp_update_mpls_label,
12360
14
        { "MPLS Label Stack", "bgp.update.path_attribute.mpls_label", FT_NONE,
12361
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12362
14
      { &hf_bgp_update_mpls_label_value_20bits,
12363
14
        { "MPLS Label", "bgp.update.path_attribute.mpls_label_value_20bits", FT_UINT24,
12364
14
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
12365
14
      { &hf_bgp_update_mpls_label_value,
12366
14
        { "MPLS Label", "bgp.update.path_attribute.mpls_label_value", FT_UINT24,
12367
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12368
14
      { &hf_bgp_update_mpls_traffic_class,
12369
14
        { "Traffic Class", "bgp.update.path_attribute.mpls_traffic_class", FT_UINT24,
12370
14
          BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
12371
14
      { &hf_bgp_update_mpls_bottom_stack,
12372
14
        { "Bottom-of-Stack", "bgp.update.path_attribute.mpls_bottom_stack", FT_BOOLEAN,
12373
14
          24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
12374
14
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_id, /* RFC4875 section 19 */
12375
14
        { "RSVP P2MP id", "bgp.update.path_attribute.pmsi.rsvp.id", FT_IPv4, BASE_NONE,
12376
14
          NULL, 0x0, NULL, HFILL}},
12377
14
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_tunnel_id,
12378
14
        { "RSVP P2MP tunnel id", "bgp.update.path_attribute.pmsi.rsvp.tunnel_id", FT_UINT16, BASE_DEC,
12379
14
          NULL, 0x0, NULL, HFILL}},
12380
14
      { &hf_bgp_pmsi_tunnel_rsvp_p2mp_ext_tunnel_idv4,
12381
14
        { "RSVP P2MP extended tunnel id", "bgp.update.path_attribute.pmsi.rsvp.ext_tunnel_idv4", FT_IPv4, BASE_NONE,
12382
14
         NULL, 0x0, NULL, HFILL}},
12383
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_type,
12384
14
        { "mLDP P2MP FEC element type", "bgp.update.path_attribute.pmsi.mldp.fec.type", FT_UINT8, BASE_DEC,
12385
14
         VALS(fec_types_vals), 0x0, NULL, HFILL}},
12386
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_afi,
12387
14
        {"mLDP P2MP FEC element address family", "bgp.update.path_attribute.pmsi.mldp.fec.address_family", FT_UINT16, BASE_DEC,
12388
14
         VALS(afn_vals), 0x0, NULL, HFILL}},
12389
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_adr_len,
12390
14
        {"mLDP P2MP FEC element address length", "bgp.update.path_attribute.pmsi.mldp.fec.address_length", FT_UINT8, BASE_DEC,
12391
14
         NULL, 0x0, NULL, HFILL}},
12392
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev4,
12393
14
        {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev4", FT_IPv4, BASE_NONE,
12394
14
         NULL, 0x0, NULL, HFILL}},
12395
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_root_nodev6,
12396
14
        {"mLDP P2MP FEC element root node address", "bgp.update.path_attribute.pmsi.mldp.fec.root_nodev6", FT_IPv6, BASE_NONE,
12397
14
         NULL, 0x0, NULL, HFILL}},
12398
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_len,
12399
14
        {"mLDP P2MP FEC element opaque length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_length", FT_UINT16, BASE_DEC,
12400
14
         NULL, 0x0, NULL, HFILL}},
12401
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_type,
12402
14
        {"mLDP P2MP FEC element opaque value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_type", FT_UINT8, BASE_DEC,
12403
14
         VALS(pmsi_mldp_fec_opaque_value_type), 0x0, NULL, HFILL}},
12404
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_len,
12405
14
        {"mLDP P2MP FEC element opaque value length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_length", FT_UINT16, BASE_DEC,
12406
14
         NULL, 0x0, NULL, HFILL}},
12407
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_rn,
12408
14
        {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_rn", FT_UINT32, BASE_DEC,
12409
14
         NULL, 0x0, NULL, HFILL}},
12410
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_value_str,
12411
14
        {"mLDP P2MP FEC element opaque value unique Id", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_value_unique_id_str", FT_STRING, BASE_NONE,
12412
14
         NULL, 0x0, NULL, HFILL}},
12413
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_type,
12414
14
        {"mLDP P2MP FEC element opaque extended value type", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_value_type", FT_UINT16, BASE_DEC,
12415
14
         VALS(pmsi_mldp_fec_opa_extented_type), 0x0, NULL, HFILL}},
12416
14
      { &hf_bgp_pmsi_tunnel_mldp_fec_el_opa_val_ext_len,
12417
14
        {"mLDP P2MP FEC element opaque extended length", "bgp.update.path_attribute.pmsi.mldp.fec.opaque_ext_length", FT_UINT16, BASE_DEC,
12418
14
         NULL, 0x0, NULL, HFILL}},
12419
14
      { &hf_bgp_pmsi_tunnel_pimsm_sender,
12420
14
        {"PIM-SM Tree tunnel sender address", "bgp.update.path_attribute.pmsi.pimsm.sender_address", FT_IPv4, BASE_NONE,
12421
14
         NULL, 0x0, NULL, HFILL}},
12422
14
      { &hf_bgp_pmsi_tunnel_pimsm_pmc_group,
12423
14
        {"PIM-SM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimsm.pmulticast_group", FT_IPv4, BASE_NONE,
12424
14
         NULL, 0x0, NULL, HFILL}},
12425
14
      { &hf_bgp_pmsi_tunnel_pimssm_root_node,
12426
14
        {"PIM-SSM Tree tunnel Root Node", "bgp.update.path_attribute.pmsi.pimssm.root_node", FT_IPv4, BASE_NONE,
12427
14
         NULL, 0x0, NULL, HFILL}},
12428
14
      { &hf_bgp_pmsi_tunnel_pimssm_pmc_group,
12429
14
        {"PIM-SSM Tree tunnel P-multicast group", "bgp.update.path_attribute.pmsi.pimssm.pmulticast_group", FT_IPv4, BASE_NONE,
12430
14
         NULL, 0x0, NULL, HFILL}},
12431
14
      { &hf_bgp_pmsi_tunnel_pimbidir_sender,
12432
14
        {"BIDIR-PIM Tree Tunnel sender address", "bgp.update.path_attribute.pmsi.bidir_pim_tree.sender", FT_IPv4, BASE_NONE,
12433
14
         NULL, 0x0, NULL, HFILL}},
12434
14
      { &hf_bgp_pmsi_tunnel_pimbidir_pmc_group,
12435
14
        {"BIDIR-PIM Tree Tunnel P-multicast group", "bgp.update.path_attribute.pmsi.bidir_pim_tree.pmulticast_group", FT_IPv4, BASE_NONE,
12436
14
         NULL, 0x0, NULL, HFILL}},
12437
14
      { &hf_bgp_pmsi_tunnel_ingress_rep_addr,
12438
14
        {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip", FT_IPv4, BASE_NONE,
12439
14
        NULL, 0x0, NULL, HFILL}},
12440
14
      { &hf_bgp_pmsi_tunnel_ingress_rep_addr6,
12441
14
        {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip6", FT_IPv6, BASE_NONE,
12442
14
        NULL, 0x0, NULL, HFILL}},
12443
12444
        /* BGP Only to Customer (OTC) Attribute, RFC9234 */
12445
14
      { &hf_bgp_update_path_attribute_otc,
12446
14
        { "Only to Customer", "bgp.update.path_attribute.otc", FT_UINT32, BASE_DEC,
12447
14
          NULL, 0x0, NULL, HFILL}},
12448
12449
        /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */
12450
14
      { &hf_bgp_update_path_attribute_d_path,
12451
14
        { "Domain Path Attribute", "bgp.update.path_attribute.dpath", FT_STRING, BASE_NONE,
12452
14
          NULL, 0x0, NULL, HFILL}},
12453
14
      { &hf_bgp_d_path_length,
12454
14
        {"Domain Path Attribute length", "bgp.update.attribute.dpath.length", FT_UINT16, BASE_DEC,
12455
14
        NULL, 0x0, NULL, HFILL}},
12456
14
      { &hf_bgp_d_path_ga,
12457
14
        { "Global Administrator", "bgp.update.attribute.dpath.ga", FT_UINT32, BASE_DEC,
12458
14
          NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
12459
14
      { &hf_bgp_d_path_la,
12460
14
        { "Local Administrator", "bgp.update.attribute.dpath.la", FT_UINT16, BASE_DEC,
12461
14
          NULL, 0x0, "A two-octet operator-defined value", HFILL }},
12462
14
      { &hf_bgp_d_path_isf_safi,
12463
14
        { "Inter-Subnet Forwarding SAFI type", "bgp.update.attribute.dpath.isf.safi", FT_UINT8, BASE_DEC,
12464
14
          NULL, 0x0, NULL, HFILL }},
12465
12466
        /* RFC7311 */
12467
14
      { &hf_bgp_update_path_attribute_aigp,
12468
14
        { "AIGP Attribute", "bgp.update.path_attribute.aigp", FT_NONE, BASE_NONE,
12469
14
          NULL, 0x0, NULL, HFILL}},
12470
14
      { &hf_bgp_aigp_type,
12471
14
        {"AIGP attribute type", "bgp.update.attribute.aigp.type", FT_UINT8, BASE_DEC,
12472
14
        VALS(aigp_tlv_type), 0x0, NULL, HFILL }},
12473
14
      { &hf_bgp_aigp_tlv_length,
12474
14
        {"AIGP TLV length", "bgp.update.attribute.aigp.length", FT_UINT16, BASE_DEC,
12475
14
        NULL, 0x0, NULL, HFILL}},
12476
14
      { &hf_bgp_aigp_accu_igp_metric,
12477
14
        {"AIGP Accumulated IGP Metric", "bgp.update.attribute.aigp.accu_igp_metric", FT_UINT64, BASE_DEC,
12478
14
        NULL, 0x0, NULL, HFILL}},
12479
12480
        /* RFC8092 */
12481
14
      { &hf_bgp_large_communities,
12482
14
        { "Large Communities", "bgp.large_communities", FT_STRING, BASE_NONE,
12483
14
          NULL, 0x0, NULL, HFILL }},
12484
14
      { &hf_bgp_large_communities_ga,
12485
14
        { "Global Administrator", "bgp.large_communities.ga", FT_UINT32, BASE_DEC,
12486
14
          NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }},
12487
14
      { &hf_bgp_large_communities_ldp1,
12488
14
        { "Local Data Part 1", "bgp.large_communities.ldp1", FT_UINT32, BASE_DEC,
12489
14
          NULL, 0x0, "A four-octet operator-defined value", HFILL }},
12490
14
      { &hf_bgp_large_communities_ldp2,
12491
14
        { "Local Data Part 2", "bgp.large_communities.ldp2", FT_UINT32, BASE_DEC,
12492
14
          NULL, 0x0, "A four-octet operator-defined value", HFILL }},
12493
12494
        /* RFC4456 */
12495
14
       { &hf_bgp_update_path_attribute_originator_id,
12496
14
        { "Originator identifier", "bgp.update.path_attribute.originator_id", FT_IPv4, BASE_NONE,
12497
14
          NULL, 0x0, NULL, HFILL}},
12498
14
      { &hf_bgp_update_path_attribute_cluster_list,
12499
14
        { "Cluster List", "bgp.path_attribute.cluster_list", FT_NONE, BASE_NONE,
12500
14
          NULL, 0x0, NULL, HFILL}},
12501
14
      { &hf_bgp_update_path_attribute_cluster_id,
12502
14
        { "Cluster ID", "bgp.path_attribute.cluster_id", FT_IPv4, BASE_NONE,
12503
14
          NULL, 0x0, NULL, HFILL}},
12504
12505
        /* RFC8669 */
12506
14
      { &hf_bgp_prefix_sid_unknown,
12507
14
        { "Unknown TLV", "bgp.prefix_sid.unknown", FT_NONE, BASE_NONE,
12508
14
          NULL, 0x0, NULL, HFILL }},
12509
14
      { &hf_bgp_prefix_sid_label_index,
12510
14
        { "Label-Index", "bgp.prefix_sid.label_index", FT_NONE, BASE_NONE,
12511
14
          NULL, 0x0, NULL, HFILL }},
12512
14
      { &hf_bgp_prefix_sid_label_index_value,
12513
14
        { "Label-Index Value", "bgp.prefix_sid.label_index.value", FT_UINT32, BASE_DEC,
12514
14
          NULL, 0x0, "4-octet label index value", HFILL }},
12515
14
      { &hf_bgp_prefix_sid_label_index_flags,
12516
14
        { "Label-Index Flags", "bgp.prefix_sid.label_index.flags", FT_UINT16, BASE_HEX,
12517
14
          NULL, 0x0, "2-octet flags, None is defined", HFILL }},
12518
14
      { &hf_bgp_prefix_sid_originator_srgb_flags,
12519
14
        { "Originator SRGB Flags", "bgp.prefix_sid.originator_srgb.flags", FT_UINT16, BASE_HEX,
12520
14
          NULL, 0x0, "2-octet flags, None is defined", HFILL }},
12521
14
      { &hf_bgp_prefix_sid_originator_srgb,
12522
14
        { "Originator SRGB", "bgp.prefix_sid.originator_srgb", FT_NONE, BASE_NONE,
12523
14
          NULL, 0x0, NULL, HFILL }},
12524
14
      { &hf_bgp_prefix_sid_originator_srgb_blocks,
12525
14
        { "SRGB Blocks", "bgp.prefix_sid.originator_srgb_blocks", FT_NONE, BASE_NONE,
12526
14
          NULL, 0x0, NULL, HFILL }},
12527
14
      { &hf_bgp_prefix_sid_originator_srgb_block,
12528
14
        { "SRGB Block", "bgp.prefix_sid.originator_srgb_block", FT_NONE, BASE_NONE,
12529
14
          NULL, 0x0, NULL, HFILL }},
12530
14
      { &hf_bgp_prefix_sid_originator_srgb_base,
12531
14
        { "SRGB Base", "bgp.prefix_sid.originator_srgb_base", FT_UINT24, BASE_DEC,
12532
14
          NULL, 0x0, "A three-octet value", HFILL }},
12533
14
      { &hf_bgp_prefix_sid_originator_srgb_range,
12534
14
        { "SRGB Range", "bgp.prefix_sid.originator_srgb_range", FT_UINT24, BASE_DEC,
12535
14
          NULL, 0x0, "A three-octet value", HFILL }},
12536
14
      { &hf_bgp_prefix_sid_type,
12537
14
        { "Type", "bgp.prefix_sid.type", FT_UINT8, BASE_DEC,
12538
14
          VALS(bgp_prefix_sid_type), 0x0, "BGP Prefix-SID message type", HFILL }},
12539
14
      { &hf_bgp_prefix_sid_length,
12540
14
        { "Length", "bgp.prefix_sid.length", FT_UINT16, BASE_DEC,
12541
14
          NULL, 0x0, "BGP Prefix-SID message payload", HFILL }},
12542
14
      { &hf_bgp_prefix_sid_value,
12543
14
        { "Value", "bgp.prefix_sid.value", FT_BYTES, BASE_NONE,
12544
14
          NULL, 0x0, "BGP Prefix-SID message value", HFILL }},
12545
14
      { &hf_bgp_prefix_sid_reserved,
12546
14
        { "Reserved", "bgp.prefix_sid.reserved", FT_BYTES,
12547
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
12548
12549
        /* draft-ietf-bess-srv6-services-05 */
12550
14
      { &hf_bgp_prefix_sid_srv6_l3vpn,
12551
14
        { "SRv6 L3 Service", "bgp.prefix_sid.srv6_l3vpn", FT_NONE, BASE_NONE,
12552
14
          NULL, 0x0, NULL, HFILL }},
12553
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
12554
14
        { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_tlvs", FT_NONE, BASE_NONE,
12555
14
          NULL, 0x0, NULL, HFILL }},
12556
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv,
12557
14
        { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_tlv", FT_NONE, BASE_NONE,
12558
14
          NULL, 0x0, NULL, HFILL }},
12559
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_type,
12560
14
        { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
12561
14
          VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
12562
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_length,
12563
14
        { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
12564
14
          NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
12565
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_value,
12566
14
        { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
12567
14
          NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
12568
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_tlv_reserved,
12569
14
        { "Reserved", "bgp.prefix_sid.srv6_l3vpn.sub_tlv.reserved", FT_BYTES,
12570
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
12571
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_value,
12572
14
        { "SRv6 SID Value", "bgp.prefix_sid.srv6_l3vpn.sid_value", FT_IPv6, BASE_NONE,
12573
14
          NULL, 0x0, NULL, HFILL }},
12574
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_flags,
12575
14
        { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l3vpn.sid_flags", FT_UINT8, BASE_HEX,
12576
14
          NULL, 0x0, NULL, HFILL }},
12577
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_srv6_endpoint_behavior,
12578
14
        { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l3vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
12579
14
          VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
12580
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_reserved,
12581
14
        { "Reserved", "bgp.prefix_sid.srv6_l3vpn.reserved", FT_BYTES,
12582
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
12583
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
12584
14
        { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
12585
14
          NULL, 0x0, NULL, HFILL }},
12586
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv,
12587
14
        { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
12588
14
          NULL, 0x0, NULL, HFILL }},
12589
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_type,
12590
14
        { "Type", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
12591
14
          VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
12592
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_length,
12593
14
        { "Length", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
12594
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
12595
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlv_value,
12596
14
        { "Value", "bgp.prefix_sid.srv6_l3vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
12597
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
12598
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_block_len,
12599
14
        { "Locator Block Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
12600
14
          NULL, 0x0, NULL, HFILL }},
12601
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_locator_node_len,
12602
14
        { "Locator Node Length", "bgp.prefix_sid.srv6_l3vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
12603
14
          NULL, 0x0, NULL, HFILL }},
12604
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_func_len,
12605
14
        { "Function Length", "bgp.prefix_sid.srv6_l3vpn.sid.func_len", FT_UINT8, BASE_DEC,
12606
14
          NULL, 0x0, NULL, HFILL }},
12607
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_arg_len,
12608
14
        { "Argument Length", "bgp.prefix_sid.srv6_l3vpn.sid.arg_len", FT_UINT8, BASE_DEC,
12609
14
          NULL, 0x0, NULL, HFILL }},
12610
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_len,
12611
14
        { "Transposition Length", "bgp.prefix_sid.srv6_l3vpn.sid.trans_len", FT_UINT8, BASE_DEC,
12612
14
          NULL, 0x0, NULL, HFILL }},
12613
14
      { &hf_bgp_prefix_sid_srv6_l3vpn_sid_trans_offset,
12614
14
        { "Transposition Offset", "bgp.prefix_sid.srv6_l3vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
12615
14
          NULL, 0x0, NULL, HFILL }},
12616
14
      { &hf_bgp_prefix_sid_srv6_l2vpn,
12617
14
        { "SRv6 L2 Service", "bgp.prefix_sid.srv6_l2vpn", FT_NONE, BASE_NONE,
12618
14
          NULL, 0x0, NULL, HFILL }},
12619
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
12620
14
        { "SRv6 Service Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_tlvs", FT_NONE, BASE_NONE,
12621
14
          NULL, 0x0, NULL, HFILL }},
12622
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv,
12623
14
        { "SRv6 Service Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_tlv", FT_NONE, BASE_NONE,
12624
14
          NULL, 0x0, NULL, HFILL }},
12625
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_type,
12626
14
        { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.type", FT_UINT8, BASE_DEC,
12627
14
          VALS(srv6_service_sub_tlv_type), 0x0, "SRv6 Service Sub-TLV type", HFILL }},
12628
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_length,
12629
14
        { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.length", FT_UINT16, BASE_DEC,
12630
14
          NULL, 0x0, "SRv6 Service Sub-TLV length", HFILL }},
12631
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_value,
12632
14
        { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.value", FT_BYTES, BASE_NONE,
12633
14
          NULL, 0x0, "SRv6 Service Sub-TLV value", HFILL }},
12634
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_tlv_reserved,
12635
14
        { "Reserved", "bgp.prefix_sid.srv6_l2vpn.sub_tlv.reserved", FT_BYTES,
12636
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
12637
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_value,
12638
14
        { "SRv6 SID Value", "bgp.prefix_sid.srv6_l2vpn.sid_value", FT_IPv6, BASE_NONE,
12639
14
          NULL, 0x0, NULL, HFILL }},
12640
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_flags,
12641
14
        { "SRv6 SID Flags", "bgp.prefix_sid.srv6_l2vpn.sid_flags", FT_UINT8, BASE_HEX,
12642
14
          NULL, 0x0, NULL, HFILL }},
12643
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_srv6_endpoint_behavior,
12644
14
        { "SRv6 Endpoint Behavior", "bgp.prefix_sid.srv6_l2vpn.srv6_endpoint_behavior", FT_UINT16, BASE_HEX,
12645
14
          VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
12646
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_reserved,
12647
14
        { "Reserved", "bgp.prefix_sid.srv6_l2vpn.reserved", FT_BYTES,
12648
14
          BASE_NONE, NULL, 0x0, "Unused (must be clear)", HFILL }},
12649
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
12650
14
        { "SRv6 Service Data Sub-Sub-TLVs", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlvs", FT_NONE, BASE_NONE,
12651
14
          NULL, 0x0, NULL, HFILL }},
12652
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv,
12653
14
        { "SRv6 Service Data Sub-Sub-TLV", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv", FT_NONE, BASE_NONE,
12654
14
          NULL, 0x0, NULL, HFILL }},
12655
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_type,
12656
14
        { "Type", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.type", FT_UINT8, BASE_DEC,
12657
14
          VALS(srv6_service_data_sub_sub_tlv_type), 0x0, "SRv6 Service Data Sub-Sub-TLV type", HFILL }},
12658
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_length,
12659
14
        { "Length", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.length", FT_UINT16, BASE_DEC,
12660
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV length", HFILL }},
12661
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlv_value,
12662
14
        { "Value", "bgp.prefix_sid.srv6_l2vpn.sub_sub_tlv.value", FT_BYTES, BASE_NONE,
12663
14
          NULL, 0x0, "SRv6 Service Data Sub-Sub-TLV value", HFILL }},
12664
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_block_len,
12665
14
        { "Locator Block Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_block_len", FT_UINT8, BASE_DEC,
12666
14
          NULL, 0x0, NULL, HFILL }},
12667
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_locator_node_len,
12668
14
        { "Locator Node Length", "bgp.prefix_sid.srv6_l2vpn.sid.locator_node_len", FT_UINT8, BASE_DEC,
12669
14
          NULL, 0x0, NULL, HFILL }},
12670
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_func_len,
12671
14
        { "Function Length", "bgp.prefix_sid.srv6_l2vpn.sid.func_len", FT_UINT8, BASE_DEC,
12672
14
          NULL, 0x0, NULL, HFILL }},
12673
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_arg_len,
12674
14
        { "Argument Length", "bgp.prefix_sid.srv6_l2vpn.sid.arg_len", FT_UINT8, BASE_DEC,
12675
14
          NULL, 0x0, NULL, HFILL }},
12676
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_len,
12677
14
        { "Transposition Length", "bgp.prefix_sid.srv6_l2vpn.sid.trans_len", FT_UINT8, BASE_DEC,
12678
14
          NULL, 0x0, NULL, HFILL }},
12679
14
      { &hf_bgp_prefix_sid_srv6_l2vpn_sid_trans_offset,
12680
14
        { "Transposition Offset", "bgp.prefix_sid.srv6_l2vpn.sid.trans_offset", FT_UINT8, BASE_DEC,
12681
14
          NULL, 0x0, NULL, HFILL }},
12682
12683
        /* RFC5512 : BGP Encapsulation SAFI and the BGP Tunnel Encapsulation Attribute  */
12684
14
      { &hf_bgp_update_encaps_tunnel_tlv_len,
12685
14
        { "length", "bgp.update.encaps_tunnel_tlv_len", FT_UINT16,
12686
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12687
14
      { &hf_bgp_update_encaps_tunnel_tlv_type,
12688
14
        { "Type code", "bgp.update.encaps_tunnel_tlv_type", FT_UINT16, BASE_DEC,
12689
14
          VALS(bgp_attr_tunnel_type), 0x0, NULL, HFILL}},
12690
14
      { &hf_bgp_update_encaps_tunnel_subtlv_len,
12691
14
        { "length", "bgp.update.encaps_tunnel_tlv_sublen", FT_UINT16,
12692
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12693
14
      { &hf_bgp_update_encaps_tunnel_subtlv_type,
12694
14
        { "Type code", "bgp.update.encaps_tunnel_subtlv_type", FT_UINT8, BASE_DEC,
12695
14
          VALS(subtlv_type), 0x0, NULL, HFILL}},
12696
14
      { &hf_bgp_update_encaps_tunnel_subtlv_session_id,
12697
14
        { "Session ID", "bgp.update.encaps_tunnel_tlv_subtlv_session_id", FT_UINT32,
12698
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12699
14
      { &hf_bgp_update_encaps_tunnel_subtlv_cookie,
12700
14
        { "Cookie", "bgp.update.encaps_tunnel_tlv_subtlv_cookie", FT_BYTES,
12701
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12702
14
      { &hf_bgp_update_encaps_tunnel_subtlv_gre_key,
12703
14
        { "GRE Key", "bgp.update.encaps_tunnel_tlv_subtlv_gre_key", FT_UINT32,
12704
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12705
14
      { &hf_bgp_update_encaps_tunnel_subtlv_color_value,
12706
14
        { "Color Value", "bgp.update.encaps_tunnel_tlv_subtlv_color_value", FT_UINT32,
12707
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12708
14
      { &hf_bgp_update_encaps_tunnel_subtlv_lb_block_length,
12709
14
        { "Load-balancing block length", "bgp.update.encaps_tunnel_tlv_subtlv_lb_block_length", FT_UINT32,
12710
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12711
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags,
12712
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags", FT_UINT8,
12713
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12714
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_vnid,
12715
14
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_vnid", FT_BOOLEAN,
12716
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_VNID, NULL, HFILL }},
12717
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_valid_mac,
12718
14
        { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.valid_mac", FT_BOOLEAN,
12719
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_VALID_MAC, NULL, HFILL }},
12720
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_flags_reserved,
12721
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.flags.reserved", FT_UINT8,
12722
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_RESERVED, NULL, HFILL }},
12723
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_vnid,
12724
14
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.vnid", FT_UINT24,
12725
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12726
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_mac,
12727
14
        { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.mac", FT_ETHER,
12728
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12729
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_reserved,
12730
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan.reserved", FT_UINT16,
12731
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12732
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags,
12733
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags", FT_UINT8,
12734
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12735
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_version,
12736
14
        { "Version", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.version", FT_UINT8,
12737
14
          BASE_DEC, NULL, TUNNEL_SUBTLV_VXLAN_GPE_VERSION, NULL, HFILL }},
12738
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_valid_vnid,
12739
14
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.valid_vnid", FT_BOOLEAN,
12740
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_VXLAN_GPE_VALID_VNID, NULL, HFILL }},
12741
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_flags_reserved,
12742
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.flags.reserved", FT_UINT8,
12743
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_VXLAN_GPE_RESERVED, NULL, HFILL }},
12744
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_vnid,
12745
14
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.vnid", FT_UINT24,
12746
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12747
14
      { &hf_bgp_update_encaps_tunnel_subtlv_vxlan_gpe_reserved,
12748
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.vxlan_gpe.reserved", FT_UINT16,
12749
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12750
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags,
12751
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags", FT_UINT8,
12752
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12753
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_vnid,
12754
14
        { "Valid VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_vnid", FT_BOOLEAN,
12755
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_VNID, NULL, HFILL }},
12756
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_valid_mac,
12757
14
        { "Valid MAC address", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.valid_mac", FT_BOOLEAN,
12758
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_NVGRE_VALID_MAC, NULL, HFILL }},
12759
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_flags_reserved,
12760
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.flags.reserved", FT_UINT8,
12761
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_NVGRE_RESERVED, NULL, HFILL }},
12762
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_vnid,
12763
14
        { "VN-ID", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.vnid", FT_UINT24,
12764
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12765
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_mac,
12766
14
        { "MAC", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.mac", FT_ETHER,
12767
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12768
14
      { &hf_bgp_update_encaps_tunnel_subtlv_nvgre_reserved,
12769
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.nvgre.reserved", FT_UINT16,
12770
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12771
14
      { &hf_bgp_update_encaps_tunnel_subtlv_value,
12772
14
        { "Value", "bgp.update.encaps_tunnel_tlv_subtlv.value", FT_BYTES,
12773
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12774
14
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_flags,
12775
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.pref.flags", FT_UINT8,
12776
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12777
14
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_reserved,
12778
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.pref.reserved", FT_UINT8,
12779
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12780
14
      { &hf_bgp_update_encaps_tunnel_subtlv_pref_preference,
12781
14
        { "Preference", "bgp.update.encaps_tunnel_tlv_subtlv.pref.preference", FT_BYTES,
12782
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12783
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags,
12784
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags", FT_UINT8,
12785
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12786
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_specified,
12787
14
        { "Specified-BSID-only", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.specified", FT_BOOLEAN,
12788
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_SPECIFIED, NULL, HFILL }},
12789
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_invalid,
12790
14
        { "Drop Upon Invalid", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.invalid", FT_BOOLEAN,
12791
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_BINDING_INVALID, NULL, HFILL }},
12792
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_flags_reserved,
12793
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.flags.reserved", FT_UINT8,
12794
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_BINDING_RESERVED, NULL, HFILL }},
12795
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_reserved,
12796
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.reserved", FT_UINT8,
12797
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12798
14
      { &hf_bgp_update_encaps_tunnel_subtlv_binding_sid_sid,
12799
14
        { "Binding SID", "bgp.update.encaps_tunnel_tlv_subtlv.binding_sid.sid", FT_BYTES,
12800
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12801
14
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_flags,
12802
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.flags", FT_UINT8,
12803
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12804
14
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_reserved,
12805
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.reserved", FT_UINT8,
12806
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12807
14
      { &hf_bgp_update_encaps_tunnel_subtlv_enlp_enlp,
12808
14
        { "ENLP", "bgp.update.encaps_tunnel_tlv_subtlv.enlp.preference", FT_UINT8,
12809
14
          BASE_DEC, VALS(bgp_enlp_type), 0x0, NULL, HFILL}},
12810
14
      { &hf_bgp_update_encaps_tunnel_subtlv_priority_priority,
12811
14
        { "Priority", "bgp.update.encaps_tunnel_tlv_subtlv.priority.priority", FT_UINT8,
12812
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12813
14
      { &hf_bgp_update_encaps_tunnel_subtlv_priority_reserved,
12814
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.priority.reserved", FT_UINT8,
12815
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12816
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_reserved,
12817
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.reserved", FT_UINT8,
12818
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12819
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv,
12820
14
        { "sub-TLVs", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv", FT_BYTES,
12821
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12822
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_type,
12823
14
        { "Type", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.type", FT_UINT8,
12824
14
          BASE_DEC, VALS(bgp_sr_policy_list_type), 0x0, NULL, HFILL}},
12825
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_length,
12826
14
        { "Length", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.length", FT_UINT8,
12827
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12828
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags,
12829
14
        { "Flags", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags", FT_UINT8,
12830
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12831
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_verification,
12832
14
        { "SID verification", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.verification", FT_BOOLEAN,
12833
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_VERIFICATION, NULL, HFILL }},
12834
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_algorithm,
12835
14
        { "SR Algorithm id", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.algorithm", FT_BOOLEAN,
12836
14
          8, TFS(&tfs_set_notset), TUNNEL_SUBTLV_SEGMENT_LIST_SUB_ALGORITHM, NULL, HFILL }},
12837
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_flags_reserved,
12838
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.flags.reserved", FT_UINT8,
12839
14
          BASE_HEX, NULL, TUNNEL_SUBTLV_SEGMENT_LIST_SUB_RESERVED, NULL, HFILL }},
12840
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_reserved,
12841
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.reserved", FT_BYTES,
12842
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12843
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_mpls_label,
12844
14
        { "MPLS Label", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.mpls_label", FT_UINT24,
12845
14
          BASE_HEX, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
12846
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_traffic_class,
12847
14
        { "Traffic Class", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.traffic_class", FT_UINT24,
12848
14
          BASE_HEX, NULL, BGP_MPLS_TRAFFIC_CLASS, NULL, HFILL}},
12849
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_bottom_stack,
12850
14
        { "Bottom-of-Stack", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.bottom_stack", FT_BOOLEAN,
12851
14
          24, NULL, BGP_MPLS_BOTTOM_L_STACK, NULL, HFILL}},
12852
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_ttl,
12853
14
        { "TTL", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list_subtlv.ttl", FT_UINT8,
12854
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12855
14
      { &hf_bgp_update_encaps_tunnel_subtlv_segment_list_subtlv_data,
12856
14
        { "Data", "bgp.update.encaps_tunnel_tlv_subtlv.segment_list.subtlv.data", FT_BYTES,
12857
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12858
14
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_reserved,
12859
14
        { "Reserved", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.reserved", FT_UINT8,
12860
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
12861
14
      { &hf_bgp_update_encaps_tunnel_subtlv_policy_name_name,
12862
14
        { "Policy name", "bgp.update.encaps_tunnel_tlv_subtlv.policy_name.name", FT_STRING,
12863
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12864
12865
      /* BGP update path attribute SSA SAFI (deprecated IETF draft) */
12866
14
      { &hf_bgp_ssa_t,
12867
14
        { "Transitive bit", "bgp.ssa_t", FT_BOOLEAN, 8,
12868
14
          NULL, 0x80, "SSA Transitive bit", HFILL}},
12869
14
      { &hf_bgp_ssa_type,
12870
14
        { "SSA Type", "bgp.ssa_type", FT_UINT16, BASE_DEC,
12871
14
          VALS(bgp_ssa_type), 0x7FFF, NULL, HFILL}},
12872
14
      { &hf_bgp_ssa_len,
12873
14
        { "Length", "bgp.ssa_len", FT_UINT16, BASE_DEC,
12874
14
          NULL, 0x0, "SSA Length", HFILL}},
12875
14
      { &hf_bgp_ssa_value,
12876
14
        { "Value", "bgp.ssa_value", FT_BYTES, BASE_NONE,
12877
14
          NULL, 0x0, "SSA Value", HFILL}},
12878
14
      { &hf_bgp_ssa_l2tpv3_pref,
12879
14
        { "Preference", "bgp.ssa_l2tpv3_pref", FT_UINT16, BASE_DEC,
12880
14
          NULL, 0x0, NULL, HFILL}},
12881
14
      { &hf_bgp_ssa_l2tpv3_s,
12882
14
        { "Sequencing bit", "bgp.ssa_l2tpv3_s", FT_BOOLEAN, 8,
12883
14
          NULL, 0x80, "Sequencing S-bit", HFILL}},
12884
14
      { &hf_bgp_ssa_l2tpv3_unused,
12885
14
        { "Unused", "bgp.ssa_l2tpv3_Unused", FT_BOOLEAN, 8,
12886
14
          NULL, 0x7F, "Unused Flags", HFILL}},
12887
14
      { &hf_bgp_ssa_l2tpv3_cookie_len,
12888
14
        { "Cookie Length", "bgp.ssa_l2tpv3_cookie_len", FT_UINT8, BASE_DEC,
12889
14
          NULL, 0x0, NULL, HFILL}},
12890
14
      { &hf_bgp_ssa_l2tpv3_session_id,
12891
14
        { "Session ID", "bgp.ssa_l2tpv3_session_id", FT_UINT32, BASE_DEC,
12892
14
          NULL, 0x0, NULL, HFILL}},
12893
14
      { &hf_bgp_ssa_l2tpv3_cookie,
12894
14
        { "Cookie", "bgp.ssa_l2tpv3_cookie", FT_BYTES, BASE_NONE,
12895
14
          NULL, 0x0, NULL, HFILL}},
12896
14
      { &hf_bgp_withdrawn_prefix,
12897
14
        { "Withdrawn prefix", "bgp.withdrawn_prefix", FT_IPv4, BASE_NONE,
12898
14
          NULL, 0x0, NULL, HFILL}},
12899
12900
      /* NLRI header description */
12901
14
      { &hf_bgp_update_nlri,
12902
14
        { "Network Layer Reachability Information (NLRI)", "bgp.update.nlri", FT_NONE, BASE_NONE,
12903
14
          NULL, 0x0, NULL, HFILL}},
12904
      /* Global NLRI description */
12905
14
      { &hf_bgp_mp_reach_nlri_ipv4_prefix,
12906
14
        { "MP Reach NLRI IPv4 prefix", "bgp.mp_reach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
12907
14
          NULL, 0x0, NULL, HFILL}},
12908
14
      { &hf_bgp_mp_unreach_nlri_ipv4_prefix,
12909
14
        { "MP Unreach NLRI IPv4 prefix", "bgp.mp_unreach_nlri_ipv4_prefix", FT_IPv4, BASE_NONE,
12910
14
          NULL, 0x0, NULL, HFILL}},
12911
14
      { &hf_bgp_mp_reach_nlri_ipv6_prefix,
12912
14
        { "MP Reach NLRI IPv6 prefix", "bgp.mp_reach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
12913
14
          NULL, 0x0, NULL, HFILL}},
12914
14
      { &hf_bgp_mp_unreach_nlri_ipv6_prefix,
12915
14
        { "MP Unreach NLRI IPv6 prefix", "bgp.mp_unreach_nlri_ipv6_prefix", FT_IPv6, BASE_NONE,
12916
14
          NULL, 0x0, NULL, HFILL}},
12917
14
      { &hf_bgp_mp_nlri_tnl_id,
12918
14
        { "MP Reach NLRI Tunnel Identifier", "bgp.mp_nlri_tnl_id", FT_UINT16, BASE_HEX,
12919
14
          NULL, 0x0, NULL, HFILL}},
12920
14
      { &hf_bgp_nlri_prefix,
12921
14
        { "NLRI prefix", "bgp.nlri_prefix", FT_IPv4, BASE_NONE,
12922
14
          NULL, 0x0, NULL, HFILL}},
12923
14
      { &hf_bgp_nlri_path_id,
12924
14
        { "NLRI path id", "bgp.nlri_path_id", FT_UINT32, BASE_DEC,
12925
14
          NULL, 0x0, NULL, HFILL}},
12926
12927
      /* mcast vpn nlri and capability */
12928
14
      { &hf_bgp_mcast_vpn_nlri_t,
12929
14
        { "MCAST-VPN nlri", "bgp.mcast_vpn_nlri", FT_BYTES, BASE_NONE,
12930
14
          NULL, 0x0, NULL, HFILL}},
12931
14
      { &hf_bgp_mcast_vpn_nlri_route_type,
12932
14
        { "Route Type", "bgp.mcast_vpn_nlri_route_type", FT_UINT8,
12933
14
          BASE_DEC, VALS(mcast_vpn_route_type), 0x0, NULL, HFILL}},
12934
14
      { &hf_bgp_mcast_vpn_nlri_length,
12935
14
        { "Length", "bgp.mcast_vpn_nlri_length", FT_UINT8,
12936
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12937
14
      { &hf_bgp_mcast_vpn_nlri_rd,
12938
14
        { "Route Distinguisher", "bgp.mcast_vpn_nlri_rd", FT_BYTES,
12939
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12940
14
      { &hf_bgp_mcast_vpn_nlri_origin_router_ipv4,
12941
14
        { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv4", FT_IPv4,
12942
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12943
14
      { &hf_bgp_mcast_vpn_nlri_origin_router_ipv6,
12944
14
        { "Originating Router", "bgp.mcast_vpn_nlri_origin_router_ipv6", FT_IPv6,
12945
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12946
14
      { &hf_bgp_mcast_vpn_nlri_source_as,
12947
14
        { "Source AS", "bgp.mcast_vpn_nlri_source_as", FT_UINT32,
12948
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12949
14
       { &hf_bgp_mcast_vpn_nlri_source_length,
12950
14
        { "Multicast Source Length", "bgp.mcast_vpn_nlri_source_length", FT_UINT8,
12951
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12952
14
       { &hf_bgp_mcast_vpn_nlri_group_length,
12953
14
        { "Multicast Group Length", "bgp.mcast_vpn_nlri_group_length", FT_UINT8,
12954
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12955
14
      { &hf_bgp_mcast_vpn_nlri_source_addr_ipv4,
12956
14
        { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv4", FT_IPv4,
12957
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12958
14
      { &hf_bgp_mcast_vpn_nlri_source_addr_ipv6,
12959
14
        { "Multicast Source Address", "bgp.mcast_vpn_nlri_source_addr_ipv6", FT_IPv6,
12960
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12961
14
      { &hf_bgp_mcast_vpn_nlri_group_addr_ipv4,
12962
14
        { "Multicast Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv4", FT_IPv4,
12963
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12964
14
      { &hf_bgp_mcast_vpn_nlri_group_addr_ipv6,
12965
14
        { "Group Address", "bgp.mcast_vpn_nlri_group_addr_ipv6", FT_IPv6,
12966
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12967
14
      { &hf_bgp_mcast_vpn_nlri_route_key,
12968
14
        { "Route Key", "bgp.mcast_vpn_nlri_route_key", FT_BYTES,
12969
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12970
      /* sr policy nlri*/
12971
14
      { &hf_bgp_sr_policy_nlri_length,
12972
14
        { "NLRI length", "bgp.sr_policy_nlri_length", FT_UINT8,
12973
14
          BASE_DEC, NULL, 0x0, "NLRI length in bits", HFILL}},
12974
14
      { &hf_bgp_sr_policy_nlri_distinguisher,
12975
14
        { "Distinguisher", "bgp.sr_policy_nlri_distinguisher", FT_BYTES,
12976
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12977
14
      { &hf_bgp_sr_policy_nlri_policy_color,
12978
14
        { "Policy color", "bgp.sr_policy_nlri_policy_color", FT_BYTES,
12979
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12980
14
      { &hf_bgp_sr_policy_nlri_endpoint_v4,
12981
14
        { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv4", FT_IPv4,
12982
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12983
14
      { &hf_bgp_sr_policy_nlri_endpoint_v6,
12984
14
        { "Endpoint", "bgp.sr_policy_nlri_endpoint_ipv6", FT_IPv6,
12985
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12986
        /* Bgp flow spec nlri and capability */
12987
14
      { &hf_bgp_flowspec_nlri_t,
12988
14
        { "FLOW-SPEC nlri", "bgp.flowspec_nlri", FT_BYTES, BASE_NONE,
12989
14
          NULL, 0x0, NULL, HFILL}},
12990
14
      { &hf_bgp_flowspec_nlri_route_distinguisher,
12991
14
        { "Route Distinguisher", "bgp.flowspec_route_distinguisher", FT_NONE,
12992
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
12993
14
      { &hf_bgp_flowspec_nlri_route_distinguisher_type,
12994
14
        { "Route Distinguisher Type", "bgp.flowspec_route_distinguisher_type", FT_UINT16,
12995
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12996
14
      { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_2,
12997
14
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_2", FT_UINT16,
12998
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
12999
14
      { &hf_bgp_flowspec_nlri_route_dist_admin_ipv4,
13000
14
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_ipv4", FT_IPv4,
13001
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13002
14
      { &hf_bgp_flowspec_nlri_route_dist_admin_asnum_4,
13003
14
        { "Administrator Subfield", "bgp.flowspec_route_distinguisher_admin_as_num_4", FT_UINT32,
13004
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13005
14
      { &hf_bgp_flowspec_nlri_route_dist_asnum_2,
13006
14
        { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_2", FT_UINT16,
13007
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13008
14
      { &hf_bgp_flowspec_nlri_route_dist_asnum_4,
13009
14
        { "Assigned Number Subfield", "bgp.flowspec_route_distinguisher_asnum_4", FT_UINT32,
13010
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13011
14
      { &hf_bgp_flowspec_nlri_filter,
13012
14
        { "Filter", "bgp.flowspec_nlri.filter", FT_NONE, BASE_NONE,
13013
14
          NULL, 0x0, NULL, HFILL }},
13014
14
      { &hf_bgp_flowspec_nlri_filter_type,
13015
14
        { "Filter type", "bgp.flowspec_nlri.filter_type", FT_UINT8, BASE_DEC,
13016
14
          VALS(flowspec_nlri_opvaluepair_type), 0x0, NULL, HFILL }},
13017
14
      { &hf_bgp_flowspec_nlri_length,
13018
14
        { "NRLI length", "bgp.flowspec_nlri.length", FT_UINT16, BASE_DEC,
13019
14
          NULL, 0x0, NULL, HFILL }},
13020
14
      { &hf_bgp_flowspec_nlri_op_flags,
13021
14
        { "Operator flags", "bgp.flowspec_nlri.opflags", FT_UINT8, BASE_HEX,
13022
14
          NULL, 0x0, NULL, HFILL }},
13023
14
      { &hf_bgp_flowspec_nlri_dst_pref_ipv4,
13024
14
        { "Destination IP filter", "bgp.flowspec_nlri.dst_prefix_filter", FT_IPv4,
13025
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13026
14
      { &hf_bgp_flowspec_nlri_src_pref_ipv4,
13027
14
        { "Source IP filter", "bgp.flowspec_nlri.src_prefix_filter", FT_IPv4,
13028
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13029
14
      { &hf_bgp_flowspec_nlri_op_eol,
13030
14
        { "end-of-list", "bgp.flowspec_nlri.op.eol", FT_BOOLEAN, 8,
13031
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_END_OF_LST, NULL, HFILL }},
13032
14
      { &hf_bgp_flowspec_nlri_op_and,
13033
14
        { "and", "bgp.flowspec_nlri.op.and", FT_BOOLEAN, 8,
13034
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_AND_BIT, NULL, HFILL }},
13035
14
      { &hf_bgp_flowspec_nlri_op_val_len,
13036
14
        { "Value length", "bgp.flowspec_nlri.op.val_len", FT_UINT8, BASE_DEC,
13037
14
          VALS(flow_spec_op_len_val), BGPNLRI_FSPEC_VAL_LEN, NULL, HFILL }},
13038
14
      { &hf_bgp_flowspec_nlri_op_un_bit4,
13039
14
        { "Reserved", "bgp.flowspec_nlri.op.un_bit4", FT_BOOLEAN, 8,
13040
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT4, "Unused (must be zero)",HFILL}},
13041
14
      { &hf_bgp_flowspec_nlri_op_un_bit5,
13042
14
        { "Reserved", "bgp.flowspec_nlri.op.un_bit5", FT_BOOLEAN, 8,
13043
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_UNUSED_BIT5, "Unused (must be zero)", HFILL}},
13044
14
      { &hf_bgp_flowspec_nlri_dec_val_8,
13045
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_8", FT_UINT8, BASE_DEC,
13046
14
          NULL, 0x0, NULL, HFILL }},
13047
14
      { &hf_bgp_flowspec_nlri_dec_val_16,
13048
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_16", FT_UINT16, BASE_DEC,
13049
14
          NULL, 0x0, NULL, HFILL }},
13050
14
      { &hf_bgp_flowspec_nlri_dec_val_32,
13051
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_32", FT_UINT32, BASE_DEC,
13052
14
          NULL, 0x0, NULL, HFILL }},
13053
14
      { &hf_bgp_flowspec_nlri_dec_val_64,
13054
14
        { "Decimal value", "bgp.flowspec_nlri.dec_val_64", FT_UINT64, BASE_DEC,
13055
14
          NULL, 0x0, NULL, HFILL }},
13056
14
      { &hf_bgp_flowspec_nlri_op_lt,
13057
14
        { "less than", "bgp.flowspec_nlri.op.lt", FT_BOOLEAN, 8,
13058
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_LESS_THAN, NULL, HFILL }},
13059
14
      { &hf_bgp_flowspec_nlri_op_gt,
13060
14
        { "greater than", "bgp.flowspec_nlri.op.gt", FT_BOOLEAN, 8,
13061
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_GREATER_THAN, NULL, HFILL }},
13062
14
      { &hf_bgp_flowspec_nlri_op_eq,
13063
14
        { "equal", "bgp.flowspec_nlri.op.equal", FT_BOOLEAN, 8,
13064
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_EQUAL, NULL, HFILL }},
13065
14
      { &hf_bgp_flowspec_nlri_op_flg_not,
13066
14
        { "logical negation", "bgp.flowspec_nlri.op.flg_not", FT_BOOLEAN, 8,
13067
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_NOTBIT, NULL, HFILL }},
13068
14
      { &hf_bgp_flowspec_nlri_op_flg_match,
13069
14
        { "Match bit", "bgp.flowspec_nlri.op.flg_match", FT_BOOLEAN, 8,
13070
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TCPF_MATCHBIT, NULL, HFILL }},
13071
14
      { &hf_bgp_flowspec_nlri_tcp_flags,
13072
14
        { "TCP flags", "bgp.flowspec_nlri.val_tcp.flags", FT_UINT8, BASE_HEX,
13073
14
          NULL, 0x0, NULL, HFILL }},
13074
14
      { &hf_bgp_flowspec_nlri_tcp_flags_cwr,
13075
14
        { "Congestion Window Reduced (CWR)", "bgp.flowspec_nlri.val_tcp.flags.cwr", FT_BOOLEAN, 8,
13076
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_CWR, NULL, HFILL }},
13077
14
      { &hf_bgp_flowspec_nlri_tcp_flags_ecn,
13078
14
        { "ECN-Echo", "bgp.flowspec_nlri.val_tcp.flags.ecn", FT_BOOLEAN, 8,
13079
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ECN, NULL, HFILL }},
13080
14
      { &hf_bgp_flowspec_nlri_tcp_flags_urg,
13081
14
        { "Urgent",  "bgp.flowspec_nlri.val_tcp.flags.urg", FT_BOOLEAN, 8,
13082
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_URG, NULL, HFILL }},
13083
14
      { &hf_bgp_flowspec_nlri_tcp_flags_ack,
13084
14
        { "Acknowledgment", "bgp.flowspec_nlri.val_tcp.flags.ack", FT_BOOLEAN, 8,
13085
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_ACK, NULL, HFILL }},
13086
14
      { &hf_bgp_flowspec_nlri_tcp_flags_push,
13087
14
        { "Push", "bgp.flowspec_nlri.val_tcp.flags.push", FT_BOOLEAN, 8,
13088
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_PUSH, NULL, HFILL }},
13089
14
      { &hf_bgp_flowspec_nlri_tcp_flags_reset,
13090
14
        { "Reset", "bgp.flowspec_nlri.val_tcp.flags.reset", FT_BOOLEAN, 8,
13091
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_RST, NULL, HFILL }},
13092
14
      { &hf_bgp_flowspec_nlri_tcp_flags_syn,
13093
14
        { "Syn", "bgp.flowspec_nlri.val_tcp.flags.syn", FT_BOOLEAN, 8,
13094
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_SYN, NULL, HFILL }},
13095
14
      { &hf_bgp_flowspec_nlri_tcp_flags_fin,
13096
14
        { "Fin", "bgp.flowspec_nlri.val_tcp.flags.fin", FT_BOOLEAN, 8,
13097
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_TH_FIN, NULL, HFILL }},
13098
14
      { &hf_bgp_flowspec_nlri_fflag,
13099
14
        { "Fragment Flag", "bgp.flowspec_nlri.val_frag", FT_UINT8, BASE_HEX,
13100
14
          NULL, 0x0, NULL, HFILL }},
13101
14
      { &hf_bgp_flowspec_nlri_fflag_lf,
13102
14
        { "Last fragment", "bgp.flowspec_nlri.val_frag_lf", FT_BOOLEAN, 8,
13103
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_LF, NULL, HFILL }},
13104
14
      { &hf_bgp_flowspec_nlri_fflag_ff,
13105
14
        { "First fragment", "bgp.flowspec_nlri.val_frag_ff", FT_BOOLEAN, 8,
13106
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_FF, NULL, HFILL }},
13107
14
      { &hf_bgp_flowspec_nlri_fflag_isf,
13108
14
        { "Is a fragment", "bgp.flowspec_nlri.val_frag_isf", FT_BOOLEAN, 8,
13109
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_ISF, NULL, HFILL }},
13110
14
      { &hf_bgp_flowspec_nlri_fflag_df,
13111
14
        { "Don't fragment", "bgp.flowspec_nlri.val_frag_df", FT_BOOLEAN, 8,
13112
14
          TFS(&tfs_set_notset), BGPNLRI_FSPEC_FG_DF, NULL, HFILL }},
13113
14
      { &hf_bgp_flowspec_nlri_dscp,
13114
14
        { "Differentiated Services Codepoint", "bgp.flowspec_nlri.val_dsfield", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
13115
14
          &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
13116
14
      { &hf_bgp_flowspec_nlri_src_ipv6_pref,
13117
14
        { "Source IPv6 prefix", "bgp.flowspec_nlri.src_ipv6_pref", FT_IPv6, BASE_NONE,
13118
14
          NULL, 0x0, NULL, HFILL}},
13119
14
      { &hf_bgp_flowspec_nlri_dst_ipv6_pref,
13120
14
        { "Destination IPv6 prefix", "bgp.flowspec_nlri.dst_ipv6_pref", FT_IPv6, BASE_NONE,
13121
14
          NULL, 0x0, NULL, HFILL}},
13122
14
      { &hf_bgp_flowspec_nlri_ipv6_pref_len,
13123
14
        { "IPv6 prefix length", "bgp.flowspec_nlri.ipv6_pref_length", FT_UINT8, BASE_DEC,
13124
14
          NULL, 0x0, NULL, HFILL}},
13125
14
      { &hf_bgp_flowspec_nlri_ipv6_pref_offset,
13126
14
        { "IPv6 prefix offset", "bgp.flowspec_nlri.ipv6_pref_offset", FT_UINT8, BASE_DEC,
13127
14
          NULL, 0x0, NULL, HFILL}},
13128
        /* end of bgp flow spec */
13129
        /* BGP update safi ndt nlri  draft-nalawade-idr-mdt-safi-03 */
13130
14
      { &hf_bgp_mdt_nlri_safi_rd,
13131
14
        { "Route Distinguisher", "bgp.mdt_safi_rd", FT_BYTES,
13132
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13133
14
      { &hf_bgp_mdt_nlri_safi_ipv4_addr,
13134
14
        { "IPv4 Address", "bgp.mdt_safi_ipv4_addr", FT_IPv4,
13135
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13136
14
      { &hf_bgp_mdt_nlri_safi_group_addr,
13137
14
        { "Group Address", "bgp.mdt_safi_group_addr", FT_IPv4,
13138
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13139
        /* BGP update extended community header field */
13140
14
      { &hf_bgp_ext_communities,
13141
14
        { "Carried extended communities", "bgp.ext_communities", FT_NONE, BASE_NONE,
13142
14
          NULL, 0x0, NULL, HFILL }},
13143
14
      { &hf_bgp_ext_community,
13144
14
        { "Community", "bgp.ext_community", FT_NONE, BASE_NONE,
13145
14
          NULL, 0x0, "Extended Community attribute", HFILL }},
13146
14
      { &hf_bgp_ext_com_type_high,
13147
14
        { "Type", "bgp.ext_com.type", FT_UINT8, BASE_HEX,
13148
14
          VALS(bgpext_com_type_high), 0x0, "Extended Community type", HFILL }},
13149
14
      { &hf_bgp_ext_com_type_auth,
13150
14
        { "IANA Authority", "bgp.ext_com.type.auth", FT_BOOLEAN, 8,
13151
14
          TFS(&tfs_bgpext_com_type_auth), BGP_EXT_COM_TYPE_AUTH, "IANA Type Allocation Policy", HFILL }},
13152
14
      {&hf_bgp_ext_com_type_tran,
13153
14
        { "Transitive across ASes", "bgp.ext_com.type.tran", FT_BOOLEAN, 8,
13154
14
          TFS(&tfs_non_transitive_transitive), BGP_EXT_COM_TYPE_TRAN, "Transitivity of the attribute across autonomous systems", HFILL }},
13155
14
      { &hf_bgp_ext_com_stype_low_unknown,
13156
14
        { "Subtype", "bgp.ext_com.stype_unknown", FT_UINT8, BASE_HEX,
13157
14
          NULL, 0x0, "Extended Community subtype", HFILL }},
13158
14
      { &hf_bgp_ext_com_stype_tr_evpn,
13159
14
        { "Subtype (EVPN)", "bgp.ext_com.stype_tr_evpn", FT_UINT8, BASE_HEX,
13160
14
          VALS(bgpext_com_stype_tr_evpn), 0x0, "EVPN Extended Community subtype", HFILL}},
13161
14
      { &hf_bgp_ext_com_stype_tr_as2,
13162
14
        { "Subtype (AS2)", "bgp.ext_com.stype_tr_as2", FT_UINT8, BASE_HEX,
13163
14
          VALS(bgpext_com_stype_tr_as2), 0x0, "2-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
13164
14
      { &hf_bgp_ext_com_stype_ntr_as2,
13165
14
        { "Subtype (Non-transitive AS2)", "bgp.ext_com.stype_ntr_as2", FT_UINT8, BASE_HEX,
13166
14
          VALS(bgpext_com_stype_ntr_as2), 0x0, "2-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
13167
14
      { &hf_bgp_ext_com_stype_tr_as4,
13168
14
        { "Subtype (AS4)", "bgp.ext_com.stype_tr_as4", FT_UINT8, BASE_HEX,
13169
14
          VALS(bgpext_com_stype_tr_as4), 0x0, "4-Octet AS-Specific Transitive Extended Community subtype", HFILL}},
13170
14
      { &hf_bgp_ext_com_stype_ntr_as4,
13171
14
        { "Subtype (Non-transitive AS4)", "bgp.ext_com.stype_ntr_as4", FT_UINT8, BASE_HEX,
13172
14
          VALS(bgpext_com_stype_ntr_as4), 0x0, "4-Octet AS-Specific Non-transitive Extended Community subtype", HFILL}},
13173
14
      { &hf_bgp_ext_com_stype_tr_IP4,
13174
14
        { "Subtype (IPv4)", "bgp.ext_com.stype_tr_IP4", FT_UINT8, BASE_HEX,
13175
14
          VALS(bgpext_com_stype_tr_IP4), 0x0, "IPv4-Address-Specific Transitive Extended Community subtype", HFILL}},
13176
14
      { &hf_bgp_ext_com_stype_ntr_IP4,
13177
14
        { "Subtype (Non-transitive IPv4)", "bgp.ext_com.stype_ntr_IP4", FT_UINT8, BASE_HEX,
13178
14
          VALS(bgpext_com_stype_ntr_IP4), 0x0, "IPv4-Address-Specific Non-transitive Extended Community subtype", HFILL}},
13179
14
      { &hf_bgp_ext_com_stype_tr_opaque,
13180
14
        { "Subtype (Opaque)", "bgp.ext_com.stype_tr_opaque", FT_UINT8, BASE_HEX,
13181
14
          VALS(bgpext_com_stype_tr_opaque), 0x0, "Opaque Transitive Extended Community subtype", HFILL}},
13182
14
      { &hf_bgp_ext_com_stype_ntr_opaque,
13183
14
        { "Subtype (Non-transitive Opaque)", "bgp.ext_com.stype_ntr_opaque", FT_UINT8, BASE_HEX,
13184
14
          VALS(bgpext_com_stype_ntr_opaque), 0x0, "Opaque Non-transitive Extended Community subtype", HFILL}},
13185
14
      { &hf_bgp_ext_com_tunnel_type,
13186
14
        { "Tunnel type", "bgp.ext_com.tunnel_type", FT_UINT16, BASE_DEC,
13187
14
          VALS(bgpext_com_tunnel_type), 0x0, "Tunnel encapsulation type", HFILL}},
13188
14
      { &hf_bgp_ext_com_stype_tr_mup,
13189
14
        { "Subtype (MUP)", "bgp.ext_com.stype_tr_mup", FT_UINT8, BASE_HEX,
13190
14
          VALS(bgpext_com_stype_tr_mup), 0x0, "MUP Extended Community subtype", HFILL}},
13191
14
      { &hf_bgp_ext_com_stype_tr_exp,
13192
14
        { "Subtype (Experimental)", "bgp.ext_com.stype_tr_exp", FT_UINT8, BASE_HEX,
13193
14
          VALS(bgpext_com_stype_tr_exp), 0x0, "Experimental Transitive Extended Community subtype", HFILL}},
13194
14
      { &hf_bgp_ext_com_stype_tr_exp_2,
13195
14
        { "Subtype (Experimental Part 2)", "bgp.ext_com.stype_tr_exp_2", FT_UINT8, BASE_HEX,
13196
14
          VALS(bgpext_com_stype_tr_exp_2), 0x0, "Generic Transitive Experimental Use Extended Community Part 2 Sub-Types", HFILL}},
13197
14
      { &hf_bgp_ext_com_stype_tr_exp_3,
13198
14
        { "Subtype (Experimental Part 3)", "bgp.ext_com.stype_tr_exp_3", FT_UINT8, BASE_HEX,
13199
14
          VALS(bgpext_com_stype_tr_exp_3), 0x0, "Generic Transitive Experimental Use Extended Community Part 3 Sub-Types", HFILL}},
13200
14
      { &hf_bgp_ext_com_value_as2,
13201
14
        { "2-Octet AS", "bgp.ext_com.value_as2", FT_UINT16, BASE_DEC,
13202
14
          NULL, 0x0, "Global Administrator Field value (2B Autonomous System Number)", HFILL }},
13203
14
      { &hf_bgp_ext_com_value_as4,
13204
14
        { "4-Octet AS", "bgp.ext_com.value_as4", FT_UINT32, BASE_DEC,
13205
14
          NULL, 0x0, "Global Administrator Field value (4B Autonomous System Number)", HFILL }},
13206
14
      { &hf_bgp_ext_com_value_IP4,
13207
14
        { "IPv4 address", "bgp.ext_com.value_IP4", FT_IPv4, BASE_NONE,
13208
14
          NULL, 0x0, "Global Administrator Field value (IPv4 Address)", HFILL }},
13209
14
      { &hf_bgp_ext_com_value_an2,
13210
14
        { "2-Octet AN", "bgp.ext_com.value_an2", FT_UINT16, BASE_DEC,
13211
14
          NULL, 0x0, "Local Administrator Field value (2B Assigned Number)", HFILL }},
13212
14
      { &hf_bgp_ext_com_value_an4,
13213
14
        { "4-Octet AN", "bgp.ext_com.value_an4", FT_UINT32, BASE_DEC,
13214
14
          NULL, 0x0, "Local Administrator Field value (4B Assigned Number)", HFILL }},
13215
14
      { &hf_bgp_ext_com_value_link_bw,
13216
14
        { "Link bandwidth", "bgp.ext_com.value_link_bw", FT_FLOAT, BASE_NONE,
13217
14
          NULL, 0x0, NULL, HFILL}},
13218
14
      { &hf_bgp_ext_com_value_ospf_rt_area,
13219
14
        { "Area ID", "bgp.ext_com.value_ospf_rtype.area", FT_IPv4, BASE_NONE,
13220
14
          NULL, 0x0, "Original OSPF Area ID this route comes from", HFILL }},
13221
14
      { &hf_bgp_ext_com_value_ospf_rt_type,
13222
14
        { "Route type", "bgp.ext_com.value_ospf_rtype.type", FT_UINT8, BASE_DEC,
13223
14
          VALS(bgpext_com_ospf_rtype), 0x0, "Original OSPF LSA Type that carried this route", HFILL}},
13224
14
      { &hf_bgp_ext_com_value_ospf_rt_options,
13225
14
        { "Options", "bgp.ext_com.value_ospf_rtype.options", FT_UINT8, BASE_HEX,
13226
14
          NULL, 0x0, "OSPF Route Type Options bitfield", HFILL }},
13227
14
      { &hf_bgp_ext_com_value_ospf_rt_options_mt,
13228
14
        { "Metric type", "bgp.ext_com.value_ospf_rtype.options.mt", FT_BOOLEAN, 8,
13229
14
          TFS(&tfs_ospf_rt_mt), BGP_OSPF_RTYPE_METRIC_TYPE, "OSPF metric type (Type-1 or Type-2) of the original route", HFILL }},
13230
14
      { &hf_bgp_ext_com_value_ospf_rid,
13231
14
        { "Router ID", "bgp.ext_com.value_ospf_rid", FT_IPv4, BASE_NONE,
13232
14
          NULL, 0x0, "OSPF Router ID of the redistributing PE router", HFILL }},
13233
14
      { &hf_bgp_ext_com_value_fs_remark,
13234
14
        { "Remarking value", "bgp.ext_com.value_fs_dscp", FT_UINT8, BASE_HEX | BASE_EXT_STRING,
13235
14
          &dscp_vals_ext, BGPNLRI_FSPEC_DSCP_BITMASK, NULL, HFILL }},
13236
14
      { &hf_bgp_ext_com_local_admin_flags,
13237
14
        { "Local Administrator", "bgp.ext_com.local_admin", FT_UINT8, BASE_HEX,
13238
14
          NULL, 0x0, NULL, HFILL }},
13239
14
      { &hf_bgp_ext_com_local_admin_auto_derived_flag,
13240
14
        { "A-Bit", "bgp.ext_com.local_admin.auto_derived", FT_BOOLEAN, 8,
13241
14
          TFS(&tfs_manually_auto_derived), 0x80, NULL, HFILL }},
13242
14
      { &hf_bgp_ext_com_local_admin_type,
13243
14
        { "Type", "bgp.ext_com.local_admin.type", FT_UINT8, BASE_DEC,
13244
14
          VALS(bgp_ext_com_local_admin_types), 0x70, NULL, HFILL }},
13245
14
      { &hf_bgp_ext_com_local_admin_domain_id,
13246
14
        { "Domain Id", "bgp.ext_com.local_admin.domain_id", FT_UINT8, BASE_DEC,
13247
14
          NULL, 0x0F, NULL, HFILL }},
13248
14
      { &hf_bgp_ext_com_local_admin_service_id,
13249
14
        { "Service Id", "bgp.ext_com.local_admin.service_id", FT_UINT24, BASE_DEC,
13250
14
          NULL, 0x00, NULL, HFILL }},
13251
14
      { &hf_bgp_ext_com_value_raw,
13252
14
        { "Raw Value", "bgp.ext_com.value_raw", FT_UINT48, BASE_HEX,
13253
14
          NULL, 0x0, "Raw value of the lowmost 6 octets of the Extended Community attribute", HFILL }},
13254
            /* BGP update extended community flow spec RFC 5575 */
13255
14
      { &hf_bgp_ext_com_flow_act_samp_act,
13256
14
        { "Sample", "bgp.ext_com_flow.sample", FT_BOOLEAN, 8,
13257
14
          TFS(&tfs_set_notset), BGP_EXT_COM_FSPEC_ACT_S, NULL, HFILL }},
13258
14
      { &hf_bgp_ext_com_flow_act_term_act,
13259
14
        { "Terminal action", "bgp.ext_com_flow.traff_act", FT_BOOLEAN, 8,
13260
14
          TFS(&tfs_set_notset),BGP_EXT_COM_FSPEC_ACT_T,NULL, HFILL}},
13261
14
      { &hf_bgp_ext_com_flow_rate_float,
13262
14
        { "Rate shaper", "bgp.ext_com_flow.rate_limit", FT_FLOAT, BASE_NONE,
13263
14
          NULL, 0x0, NULL, HFILL}},
13264
14
      { &hf_bgp_ext_com_flow_act_allset,
13265
14
        { "5 Bytes", "bgp.flowspec_ext_com.emptybytes", FT_BYTES, BASE_NONE,
13266
14
          NULL, 0x0, "Must be set to all 0", HFILL }},
13267
            /* BGP QoS propagation draft-knoll-idr-qos-attribute */
13268
14
      { &hf_bgp_ext_com_qos_flags,
13269
14
        { "Flags", "bgp.ext_com_qos.flags", FT_UINT8, BASE_HEX,
13270
14
          NULL, 0, NULL, HFILL}},
13271
14
      { &hf_bgp_ext_com_qos_flags_remarking,
13272
14
        { "Remarking", "bgp.ext_com_qos.flags.remarking", FT_BOOLEAN, 8,
13273
14
          TFS(&tfs_yes_no), 0x10, NULL, HFILL}},
13274
14
      { &hf_bgp_ext_com_qos_flags_ignore_remarking,
13275
14
        { "Ignore remarking", "bgp.ext_com_qos.flags.ignore_remarking", FT_BOOLEAN, 8,
13276
14
          TFS(&tfs_yes_no), 0x08, NULL, HFILL}},
13277
14
      { &hf_bgp_ext_com_qos_flags_agg_marking,
13278
14
        { "Aggregation of markins", "bgp.ext_com_qos.flags.agg_marking", FT_BOOLEAN, 8,
13279
14
          TFS(&tfs_yes_no), 0x04, NULL, HFILL}},
13280
14
      { &hf_bgp_ext_com_cos_flags,
13281
14
        { "Flags byte", "bgp.ext_com_cos.flags", FT_UINT8, BASE_HEX,
13282
14
          NULL, 0, NULL, HFILL}},
13283
14
      { &hf_bgp_ext_com_cos_flags_be,
13284
14
        { "BE class", "bgp.ext_com_cos.flags.be", FT_BOOLEAN, 8,
13285
14
          TFS(&tfs_supported_not_supported), 0x80, NULL, HFILL}},
13286
14
      { &hf_bgp_ext_com_cos_flags_ef,
13287
14
        { "EF class", "bgp.ext_com_cos.flags.ef", FT_BOOLEAN, 8,
13288
14
          TFS(&tfs_supported_not_supported), 0x40, NULL, HFILL}},
13289
14
      { &hf_bgp_ext_com_cos_flags_af,
13290
14
        { "AF class", "bgp.ext_com_cos.flags.af", FT_BOOLEAN, 8,
13291
14
          TFS(&tfs_supported_not_supported), 0x20, NULL, HFILL}},
13292
14
      { &hf_bgp_ext_com_cos_flags_le,
13293
14
        { "LE class", "bgp.ext_com_cos.flags.le", FT_BOOLEAN, 8,
13294
14
          TFS(&tfs_supported_not_supported), 0x10, NULL, HFILL}},
13295
14
      { &hf_bgp_ext_com_qos_set_number,
13296
14
        { "QoS Set Number", "bgp.ext_com_qos.set_number", FT_UINT8, BASE_HEX,
13297
14
          NULL, 0, NULL, HFILL}},
13298
14
      { &hf_bgp_ext_com_qos_tech_type,
13299
14
        { "Technology Type", "bgp.ext_com_qos.tech_type", FT_UINT8, BASE_HEX,
13300
14
          VALS(qos_tech_type), 0, NULL, HFILL}},
13301
14
      { &hf_bgp_ext_com_qos_marking_o,
13302
14
        { "QoS Marking O", "bgp.ext_com_qos.marking_o", FT_UINT16, BASE_HEX,
13303
14
          NULL, 0, NULL, HFILL}},
13304
14
      { &hf_bgp_ext_com_qos_marking_a,
13305
14
        { "QoS Marking A", "bgp.ext_com_qos.marking_a", FT_UINT8, BASE_HEX_DEC,
13306
14
          NULL, 0, NULL, HFILL}},
13307
14
      { &hf_bgp_ext_com_qos_default_to_zero,
13308
14
        { "Defaults to zero", "bgp.ext_com_qos.default_to_zero", FT_UINT8, BASE_HEX,
13309
14
          NULL, 0, NULL, HFILL}},
13310
      /* BGP L2 extended community RFC 4761, RFC 6624 */
13311
            /* draft-ietf-l2vpn-vpls-multihoming */
13312
14
      { &hf_bgp_ext_com_l2_encaps,
13313
14
        { "Encaps Type", "bgp.ext_com_l2.encaps_type", FT_UINT8, BASE_DEC,
13314
14
          VALS(bgp_l2vpn_encaps), 0, NULL, HFILL}},
13315
14
      { &hf_bgp_ext_com_l2_c_flags,
13316
14
        { "Control Flags", "bgp.ext_com_l2.c_flags", FT_UINT8, BASE_HEX,
13317
14
          NULL, 0x0, NULL, HFILL }},
13318
14
      { &hf_bgp_ext_com_l2_flag_d,
13319
14
        { "Down flag", "bgp.ext_com_l2.flag_d",FT_BOOLEAN, 8,
13320
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_D, NULL, HFILL }},
13321
14
      { &hf_bgp_ext_com_l2_flag_z1,
13322
14
        { "Unassigned", "bgp.ext_com_l2.flag_z1",FT_UINT8, BASE_DEC,
13323
14
          NULL, BGP_EXT_COM_L2_FLAG_Z1, "Must be Zero", HFILL }},
13324
14
      { &hf_bgp_ext_com_l2_flag_f,
13325
14
        { "Flush flag", "bgp.ext_com_l2.flag_f",FT_BOOLEAN, 8,
13326
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_F, NULL, HFILL }},
13327
14
      { &hf_bgp_ext_com_l2_flag_z345,
13328
14
        { "Unassigned", "bgp.ext_com_l2.flag_z345",FT_UINT8, BASE_DEC,
13329
14
          NULL, BGP_EXT_COM_L2_FLAG_Z345, "Must be Zero", HFILL }},
13330
14
      { &hf_bgp_ext_com_l2_flag_c,
13331
14
        { "C flag", "bgp.ext_com_l2.flag_c",FT_BOOLEAN, 8,
13332
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_C, NULL, HFILL }},
13333
14
      { &hf_bgp_ext_com_l2_flag_s,
13334
14
        { "S flag", "bgp.ext_com_l2.flag_s",FT_BOOLEAN, 8,
13335
14
          TFS(&tfs_set_notset), BGP_EXT_COM_L2_FLAG_S, NULL, HFILL }},
13336
14
      { &hf_bgp_ext_com_l2_mtu,
13337
14
        { "Layer-2 MTU", "bgp.ext_com_l2.l2_mtu", FT_UINT16, BASE_DEC,
13338
14
          NULL, 0x0, NULL, HFILL}},
13339
14
      { &hf_bgp_ext_com_l2_esi_label_flag,
13340
14
        { "Single active bit", "bgp.ext_com_l2.esi_label_flag",FT_BOOLEAN, 8,
13341
14
          TFS(&tfs_esi_label_flag), BGP_EXT_COM_ESI_LABEL_FLAGS, NULL, HFILL }},
13342
14
      { &hf_bgp_ext_com_etree_root_vlan,
13343
14
        { "Root VLAN", "bgp.ext_com_etree.root_vlan", FT_UINT16, BASE_DEC,
13344
14
          NULL, 0x0FFF, NULL, HFILL }},
13345
14
      { &hf_bgp_ext_com_etree_leaf_vlan,
13346
14
        { "Leaf VLAN", "bgp.ext_com_etree.leaf_vlan", FT_UINT16, BASE_DEC,
13347
14
          NULL, 0x0FFF, NULL, HFILL }},
13348
14
      { &hf_bgp_ext_com_etree_flags,
13349
14
        { "Flags", "bgp.ext_com_etree.flags", FT_UINT16, BASE_HEX,
13350
14
          NULL, 0x0, NULL, HFILL }},
13351
14
      { &hf_bgp_ext_com_etree_flag_reserved,
13352
14
        { "Reserved", "bgp.ext_com_etree.flag_reserved",FT_UINT16, BASE_HEX,
13353
14
          NULL, BGP_EXT_COM_ETREE_FLAG_RESERVED, NULL, HFILL }},
13354
14
      { &hf_bgp_ext_com_etree_flag_p,
13355
14
        { "P", "bgp.ext_com_etree.flag_p",FT_BOOLEAN, 16,
13356
14
          TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_P, "PE is attached with leaf nodes only", HFILL }},
13357
14
      { &hf_bgp_ext_com_etree_flag_v,
13358
14
        { "V", "bgp.ext_com_etree.flag_v",FT_BOOLEAN, 16,
13359
14
          TFS(&tfs_set_notset), BGP_EXT_COM_ETREE_FLAG_V, "VLAN mapping", HFILL }},
13360
14
      { &hf_bgp_ext_com_evpn_mmac_flag,
13361
14
        { "Flags", "bgp.ext_com_evpn.mmac.flags", FT_UINT8, BASE_HEX,
13362
14
          NULL, 0x0, "MAC Mobility flags", HFILL }},
13363
14
      { &hf_bgp_ext_com_evpn_mmac_flag_sticky,
13364
14
        { "Sticky/Static MAC", "bgp.ext_com_evpn.mmac.flags.sticky", FT_BOOLEAN, 8,
13365
14
          TFS(&tfs_yes_no), BGP_EXT_COM_EVPN_MMAC_STICKY, "Indicates whether the MAC address is fixed or movable", HFILL }},
13366
14
      { &hf_bgp_ext_com_evpn_mmac_seq,
13367
14
        { "Sequence number", "bgp.ext_com_evpn.mmac.seq", FT_UINT32, BASE_DEC,
13368
14
          NULL, 0x0, "MAC Mobility Update Sequence number", HFILL }},
13369
14
      { &hf_bgp_ext_com_evpn_esirt,
13370
14
        { "ES-Import Route Target", "bgp.ext_com_evpn.esi.rt", FT_ETHER, BASE_NONE,
13371
14
          NULL, 0x0, "Route Target as a MAC Address", HFILL }},
13372
14
      { &hf_bgp_ext_com_evpn_routermac,
13373
14
        { "Router's MAC", "bgp.ext_com_evpn.esi.router_mac", FT_ETHER, BASE_NONE,
13374
14
          NULL, 0x0, "Router's MAC Address", HFILL }},
13375
14
      { &hf_bgp_ext_com_evpn_l2attr_flags,
13376
14
        { "Flags", "bgp.ext_com_evpn.l2attr.flags", FT_UINT16, BASE_HEX,
13377
14
          NULL, 0x0, "EVPN L2 attribute flags", HFILL }},
13378
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_reserved,
13379
14
        { "Reserved", "bgp.ext_com_evpn.l2attr.flag_reserved", FT_UINT16, BASE_HEX,
13380
14
          NULL, BGP_EXT_COM_EVPN_L2ATTR_FLAG_RESERVED, NULL, HFILL }},
13381
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_ci,
13382
14
        { "CI flag", "bgp.ext_com_evpn.l2attr.flag_ci", FT_BOOLEAN, 16,
13383
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_CI, "Control Word Indicator Extended Community can be advertised", HFILL }},
13384
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_f,
13385
14
        { "F flag", "bgp.ext_com_evpn.l2attr.flag_f", FT_BOOLEAN, 16,
13386
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_F, "PE is capable to send and receive flow label", HFILL }},
13387
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_c,
13388
14
        { "C flag", "bgp.ext_com_evpn.l2attr.flag_c", FT_BOOLEAN, 16,
13389
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_C, "Control word must be present when sending EVPN packets to this PE", HFILL }},
13390
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_p,
13391
14
        { "P flag", "bgp.ext_com_evpn.l2attr.flag_p", FT_BOOLEAN, 16,
13392
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_P, "Primary PE", HFILL }},
13393
14
      { &hf_bgp_ext_com_evpn_l2attr_flag_b,
13394
14
        { "B flag", "bgp.ext_com_evpn.l2attr.flag_b", FT_BOOLEAN, 16,
13395
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_L2ATTR_FLAG_B, "Backup PE", HFILL }},
13396
14
      { &hf_bgp_ext_com_evpn_l2attr_l2_mtu,
13397
14
        { "L2 MTU", "bgp.ext_com_evpn.l2attr.l2_mtu", FT_UINT16, BASE_DEC,
13398
14
          NULL, 0x0, NULL, HFILL }},
13399
14
      { &hf_bgp_ext_com_evpn_l2attr_reserved,
13400
14
        { "Reserved", "bgp.ext_com_evpn.l2attr.reserved", FT_BYTES, BASE_NONE,
13401
14
          NULL, 0x0, NULL, HFILL }},
13402
14
      { &hf_bgp_ext_com_evpn_etree_flags,
13403
14
        { "Flags", "bgp.ext_com_evpn.etree.flags", FT_UINT8, BASE_HEX,
13404
14
          NULL, 0x0, "EVPN E-Tree attribute flags", HFILL }},
13405
14
      { &hf_bgp_ext_com_evpn_etree_flag_reserved,
13406
14
        { "Reserved", "bgp.ext_com_evpn.etree.flag_reserved", FT_UINT8, BASE_HEX,
13407
14
          NULL, BGP_EXT_COM_EVPN_ETREE_FLAG_RESERVED, NULL, HFILL }},
13408
14
      { &hf_bgp_ext_com_evpn_etree_flag_l,
13409
14
        { "L flag", "bgp.ext_com_evpn.etree.flag_l", FT_BOOLEAN, 8,
13410
14
          TFS(&tfs_set_notset), BGP_EXT_COM_EVPN_ETREE_FLAG_L, "Leaf-Indication", HFILL }},
13411
14
      { &hf_bgp_ext_com_evpn_etree_reserved,
13412
14
        { "Reserved", "bgp.ext_com_evpn.etree.reserved", FT_BYTES, BASE_NONE,
13413
14
          NULL, 0x0, NULL, HFILL }},
13414
      /* BGP Cost Community */
13415
14
      { &hf_bgp_ext_com_cost_poi,
13416
14
        { "Point of insertion", "bgp.ext_com_cost.poi", FT_UINT8, BASE_DEC,
13417
14
          VALS(bgpext_com_cost_poi_type), 0x0, "Placement of the Cost value in the BGP Best Path algorithm", HFILL }},
13418
14
      { &hf_bgp_ext_com_cost_cid,
13419
14
        { "Community ID", "bgp.ext_com_cost.cid", FT_UINT8, BASE_DEC,
13420
14
          NULL, 0x0, "Community instance ID to distinguish between multiple Cost communities", HFILL }},
13421
14
      { &hf_bgp_ext_com_cost_cost,
13422
14
        { "Cost", "bgp.ext_com_cost.cost", FT_UINT32, BASE_DEC,
13423
14
          NULL, 0x0, "Cost value", HFILL }},
13424
14
      { &hf_bgp_ext_com_cost_cid_rep,
13425
14
        { "Cost use", "bgp.ext_com_cost.cid.use", FT_BOOLEAN, 8,
13426
14
          TFS(&tfs_cost_replace), BGP_EXT_COM_COST_CID_REP, "Indicates whether the Cost value will replace the original attribute value", HFILL }},
13427
      /* EIGRP Route Metrics Extended Communities */
13428
14
      { &hf_bgp_ext_com_stype_tr_exp_eigrp,
13429
14
        { "Route Attributes", "bgp.ext_com_eigrp", FT_UINT8, BASE_DEC,
13430
14
          VALS(bgpext_com_stype_tr_eigrp), 0x0, "Original EIGRP route attributes", HFILL }},
13431
14
      { &hf_bgp_ext_com_eigrp_flags,
13432
14
        { "Route flags", "bgp.ext_com_eigrp.flags", FT_UINT16, BASE_HEX,
13433
14
          NULL, 0x0, "EIGRP Route flags bitfield", HFILL }},
13434
14
      { &hf_bgp_ext_com_eigrp_flags_rt,
13435
14
        { "Route type", "bgp.ext_com_eigrp.flags.rt", FT_BOOLEAN, 16,
13436
14
          TFS(&tfs_eigrp_rtype), BGP_EXT_COM_EXP_EIGRP_FLAG_RT, "Original EIGRP route type (internal/external)", HFILL }},
13437
14
      { &hf_bgp_ext_com_eigrp_rtag,
13438
14
        { "Route tag", "bgp.ext_com_eigrp.rtag", FT_UINT32, BASE_DEC,
13439
14
          NULL, 0x0, "Original EIGRP route tag", HFILL }},
13440
14
      { &hf_bgp_ext_com_eigrp_asn,
13441
14
        { "AS Number", "bgp.ext_com_eigrp.asn", FT_UINT16, BASE_DEC,
13442
14
          NULL, 0x0, "Original EIGRP Autonomous System Number this route comes from", HFILL }},
13443
14
      { &hf_bgp_ext_com_eigrp_delay,
13444
14
        { "Delay", "bgp.ext_com_eigrp.dly", FT_UINT32, BASE_DEC,
13445
14
          NULL, 0x0, "Original EIGRP route delay metric", HFILL }},
13446
14
      { &hf_bgp_ext_com_eigrp_rly,
13447
14
        { "Reliability", "bgp.ext_com_eigrp.rly", FT_UINT8, BASE_DEC,
13448
14
          NULL, 0x0, "Original EIGRP route reliability metric", HFILL }},
13449
14
      { &hf_bgp_ext_com_eigrp_hops,
13450
14
        { "Hop count", "bgp.ext_com_eigrp.hops", FT_UINT8, BASE_DEC,
13451
14
          NULL, 0x0, "Original EIGRP route hop count", HFILL }},
13452
14
      { &hf_bgp_ext_com_eigrp_bw,
13453
14
        { "Bandwidth", "bgp.ext_com_eigrp.bw", FT_UINT32, BASE_DEC,
13454
14
          NULL, 0x0, "Original EIGRP route bandwidth metric", HFILL }},
13455
14
      { &hf_bgp_ext_com_eigrp_load,
13456
14
        { "Load", "bgp.ext_com_eigrp.load", FT_UINT8, BASE_DEC,
13457
14
          NULL, 0x0, "Original EIGRP route load metric", HFILL }},
13458
14
      { &hf_bgp_ext_com_eigrp_mtu,
13459
14
        { "MTU", "bgp.ext_com_eigrp.mtu", FT_UINT32, BASE_DEC,
13460
14
          NULL, 0x0, "Original EIGRP route path MTU", HFILL }},
13461
14
      { &hf_bgp_ext_com_eigrp_rid,
13462
14
        { "Router ID", "bgp.ext_com_eigrp.rid", FT_IPv4, BASE_NONE,
13463
14
          NULL, 0x0, "EIGRP Router ID of the router that originated the route", HFILL }},
13464
14
      { &hf_bgp_ext_com_eigrp_e_asn,
13465
14
        { "External AS Number", "bgp.ext_com_eigrp.e_asn", FT_UINT16, BASE_DEC,
13466
14
          NULL, 0x0, "Original AS Number of the route before its redistribution into EIGRP", HFILL }},
13467
14
      { &hf_bgp_ext_com_eigrp_e_rid,
13468
14
        { "External Router ID", "bgp.ext_com_eigrp.e_rid", FT_IPv4, BASE_NONE,
13469
14
          NULL, 0x0, "EIGRP Router ID of the router that redistributed this route into EIGRP", HFILL }},
13470
14
      { &hf_bgp_ext_com_eigrp_e_pid,
13471
14
        { "External protocol", "bgp.ext_com_eigrp.e_pid", FT_UINT16, BASE_DEC,
13472
14
          VALS(eigrp_proto2string), 0x0, "Original routing protocol from which this route was redistributed into EIGRP", HFILL }},
13473
14
      { &hf_bgp_ext_com_eigrp_e_m,
13474
14
        { "External metric", "bgp.ext_com_eigrp.e_metric", FT_UINT32, BASE_DEC,
13475
14
          NULL, 0x0, "Original metric of the route before its redistribution into EIGRP", HFILL }},
13476
14
      { &hf_bgp_ext_com_mup_segment_id2,
13477
14
        { "Segment Identifier 2-byte", "bgp.ext_com_mup.segment_id2", FT_UINT16, BASE_DEC,
13478
14
          NULL, 0x0, "Configurable segment identifier value 2-byte", HFILL }},
13479
14
      { &hf_bgp_ext_com_mup_segment_id4,
13480
14
        { "Segment Identifier 4-byte", "bgp.ext_com_mup.segment_id4", FT_UINT32, BASE_DEC,
13481
14
          NULL, 0x0, "Configurable segment identifier value 4-byte", HFILL }},
13482
13483
      /* idr-ls-03 */
13484
14
      { &hf_bgp_ls_type,
13485
14
        { "Type", "bgp.ls.type", FT_UINT16, BASE_DEC,
13486
14
          NULL, 0x0, "BGP-LS message type", HFILL }},
13487
14
      { &hf_bgp_ls_length,
13488
14
        { "Length", "bgp.ls.length", FT_UINT16, BASE_DEC,
13489
14
          NULL, 0x0, "The total length of the message payload in octets", HFILL }},
13490
14
      { &hf_bgp_ls_nlri,
13491
14
        { "BGP-LS NLRI", "bgp.ls.nlri", FT_NONE,
13492
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13493
14
      { &hf_bgp_ls_safi128_nlri,
13494
14
        { "Link State SAFI 128 NLRI", "bgp.ls.nlri_safi128", FT_NONE,
13495
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13496
14
      { &hf_bgp_ls_safi128_nlri_route_distinguisher,
13497
14
        { "Route Distinguisher", "bgp.ls.nlri_safi128_route_distinguisher", FT_NONE,
13498
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13499
14
      { &hf_bgp_ls_safi128_nlri_route_distinguisher_type,
13500
14
        { "Route Distinguisher Type", "bgp.ls.nlri_safi128_route_distinguisher_type", FT_UINT16,
13501
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13502
14
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_2,
13503
14
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_2", FT_UINT16,
13504
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13505
14
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_ipv4,
13506
14
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_ipv4", FT_IPv4,
13507
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13508
14
      { &hf_bgp_ls_safi128_nlri_route_dist_admin_asnum_4,
13509
14
        { "Administrator Subfield", "bgp.ls.nlri_safi128_route_distinguisher_admin_as_num_4", FT_UINT32,
13510
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13511
14
      { &hf_bgp_ls_safi128_nlri_route_dist_asnum_2,
13512
14
        { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_2", FT_UINT16,
13513
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13514
14
      { &hf_bgp_ls_safi128_nlri_route_dist_asnum_4,
13515
14
        { "Assigned Number Subfield", "bgp.ls.nlri_safi128_route_distinguisher_asnum_4", FT_UINT32,
13516
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13517
14
      { &hf_bgp_ls_nlri_type,
13518
14
        { "NLRI Type", "bgp.ls.nlri_type", FT_UINT16,
13519
14
          BASE_DEC, VALS(bgp_ls_nlri_type_vals), 0x0, NULL, HFILL}},
13520
14
      { &hf_bgp_ls_nlri_length,
13521
14
        { "NLRI Length", "bgp.ls.nlri_length", FT_UINT16,
13522
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13523
14
      { &hf_bgp_ls_nlri_link_nlri_type,
13524
14
        { "Link-State NLRI Link NLRI", "bgp.ls.nlri_link", FT_NONE,
13525
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13526
14
      { &hf_bgp_ls_nlri_link_descriptors_tlv,
13527
14
        { "Link Descriptors TLV", "bgp.ls.nlri_link_descriptors_tlv", FT_NONE,
13528
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13529
14
      { &hf_bgp_ls_nlri_prefix_descriptors_tlv,
13530
14
        { "Prefix Descriptors TLV", "bgp.ls.nlri_prefix_descriptors_tlv", FT_NONE,
13531
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13532
14
      { &hf_bgp_ls_nlri_srv6_sid_descriptors_tlv,
13533
14
        { "SRv6 SID Descriptors TLV", "bgp.ls.nlri_srv6_sid_descriptors_tlv", FT_NONE,
13534
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13535
14
      { &hf_bgp_ls_nlri_link_local_identifier,
13536
14
        { "Link Local Identifier", "bgp.ls.nlri_link_local_identifier", FT_UINT32,
13537
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13538
14
      { &hf_bgp_ls_nlri_link_remote_identifier,
13539
14
        { "Link Remote Identifier", "bgp.ls.nlri_link_remote_identifier", FT_UINT32,
13540
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13541
14
      { &hf_bgp_ls_nlri_ipv4_interface_address,
13542
14
        { "IPv4 Interface Address", "bgp.ls.nlri_ipv4_interface_address", FT_IPv4,
13543
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13544
14
      { &hf_bgp_ls_nlri_ipv4_neighbor_address,
13545
14
        { "IPv4 Neighbor Address", "bgp.ls.nlri_ipv4_neighbor_address", FT_IPv4,
13546
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13547
14
      { &hf_bgp_ls_nlri_ipv6_interface_address,
13548
14
        { "IPv6 Interface Address", "bgp.ls.nlri_ipv6_interface_address", FT_IPv6,
13549
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13550
14
      { &hf_bgp_ls_nlri_ipv6_neighbor_address,
13551
14
        { "IPv6 Neighbor Address", "bgp.ls.nlri_ipv6_neighbor_address", FT_IPv6,
13552
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13553
14
      { &hf_bgp_ls_nlri_multi_topology_id,
13554
14
        { "Multi Topology ID", "bgp.ls.nlri_multi_topology_id", FT_UINT16,
13555
14
          BASE_DEC_HEX, NULL, 0x0fff, NULL, HFILL}},
13556
14
      { &hf_bgp_ls_nlri_ospf_route_type,
13557
14
        { "OSPF Route Type", "bgp.ls.nlri_ospf_route_type", FT_UINT8,
13558
14
          BASE_DEC, VALS(link_state_prefix_descriptors_ospf_route_type), 0x0, NULL, HFILL}},
13559
14
      { &hf_bgp_ls_nlri_ip_reachability_prefix_ip,
13560
14
       { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip", FT_IPv4,
13561
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13562
14
      { &hf_bgp_ls_nlri_ip_reachability_prefix_ip6,
13563
14
       { "Reachability prefix", "bgp.ls.nlri_ip_reachability_prefix_ip6", FT_IPv6,
13564
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13565
14
      { &hf_bgp_ls_nlri_node_nlri_type,
13566
14
        { "Link-State NLRI Node NLRI", "bgp.ls.nlri_node", FT_NONE,
13567
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13568
14
      { &hf_bgp_ls_nlri_node_protocol_id,
13569
14
        { "Protocol ID", "bgp.ls.nlri_node.protocol_id", FT_UINT8,
13570
14
          BASE_DEC, VALS(link_state_nlri_protocol_id_values), 0x0, NULL, HFILL }},
13571
14
      { &hf_bgp_ls_nlri_node_identifier,
13572
14
        { "Identifier", "bgp.ls.nlri_node.identifier", FT_UINT64,
13573
14
          BASE_DEC | BASE_VAL64_STRING, VALS64(link_state_nlri_routing_universe_values), 0x0, NULL, HFILL }},
13574
14
      { &hf_bgp_ls_ipv4_topology_prefix_nlri_type,
13575
14
        { "Link-State NLRI IPv4 Topology Prefix", "bgp.ls.ipv4_topology_prefix", FT_NONE,
13576
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13577
14
      { &hf_bgp_ls_ipv6_topology_prefix_nlri_type,
13578
14
        { "Link-State NLRI IPv6 Topology Prefix", "bgp.ls.ipv6_topology_prefix", FT_NONE,
13579
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13580
14
      { &hf_bgp_ls_nlri_srv6_sid_nlri_type,
13581
14
        { "Link-State NLRI SRv6 SID NLRI", "bgp.ls.nlri_srv6_sid", FT_NONE,
13582
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13583
       /* NLRI TLVs */
13584
14
      { &hf_bgp_ls_tlv_local_node_descriptors,
13585
14
        { "Local Node Descriptors TLV", "bgp.ls.tlv.local_node_descriptors", FT_NONE,
13586
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13587
14
      { &hf_bgp_ls_tlv_remote_node_descriptors,
13588
14
        { "Remote Node Descriptors TLV", "bgp.ls.tlv.remote_node_descriptors", FT_NONE,
13589
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13590
14
      { &hf_bgp_ls_tlv_autonomous_system,
13591
14
        { "Autonomous System TLV", "bgp.ls.tlv.autonomous_system", FT_NONE,
13592
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13593
14
      { &hf_bgp_ls_tlv_autonomous_system_id,
13594
14
        { "AS ID", "bgp.ls.tlv.autonomous_system.id", FT_UINT32,
13595
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13596
14
      { &hf_bgp_ls_tlv_bgp_ls_identifier,
13597
14
        { "BGP-LS Identifier TLV", "bgp.ls.tlv.bgp_ls_identifier", FT_NONE,
13598
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13599
14
      { &hf_bgp_ls_tlv_bgp_ls_identifier_id,
13600
14
        { "BGP-LS ID", "bgp.ls.tlv.bgp_ls_identifier_id", FT_UINT32,
13601
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13602
14
      { &hf_bgp_ls_tlv_area_id,
13603
14
        { "Area ID TLV", "bgp.ls.tlv.area_id", FT_NONE,
13604
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13605
14
      { &hf_bgp_ls_tlv_area_id_id,
13606
14
        { "Area ID", "bgp.ls.tlv.area_id.id", FT_UINT32,
13607
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL}},
13608
14
      { &hf_bgp_ls_tlv_ipv4_router_id_of_local_node,
13609
14
        { "IPv4 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv4_router_id_of_local_node", FT_NONE,
13610
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13611
14
      { &hf_bgp_ls_tlv_ipv4_router_id_value,
13612
14
        { "IPv4 Router-ID", "bgp.ls.tlv.ipv4_router_id_value", FT_IPv4,
13613
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13614
14
      { &hf_bgp_ls_tlv_ipv6_router_id_of_local_node,
13615
14
        { "IPv6 Router-ID of Local Node TLV", "bgp.ls.tlv.ipv6_router_id_of_local_node", FT_NONE,
13616
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13617
14
      { &hf_bgp_ls_tlv_ipv6_router_id_value,
13618
14
        { "IPv6 Router-ID", "bgp.ls.tlv.ipv6_router_id_value", FT_IPv6,
13619
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13620
14
      { &hf_bgp_ls_tlv_ipv4_router_id_of_remote_node,
13621
14
        { "IPv4 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv4_router_id_of_remote_node", FT_NONE,
13622
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13623
14
      { &hf_bgp_ls_tlv_ipv6_router_id_of_remote_node,
13624
14
        { "IPv6 Router-ID of Remote Node TLV", "bgp.ls.tlv.ipv6_router_id_of_remote_node", FT_NONE,
13625
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13626
14
      { &hf_bgp_ls_tlv_link_local_remote_identifiers,
13627
14
        { "Link Local/Remote Identifiers TLV", "bgp.ls.tlv.link_local_remote_identifiers", FT_NONE,
13628
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13629
14
      { &hf_bgp_ls_tlv_ipv4_interface_address,
13630
14
        {  "IPv4 interface address TLV", "bgp.ls.tlv.ipv4_interface_address", FT_NONE,
13631
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13632
14
      { &hf_bgp_ls_tlv_ipv4_neighbor_address,
13633
14
        { "IPv4 neighbor address TLV", "bgp.ls.tlv.ipv4_neighbor_address", FT_NONE,
13634
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13635
14
      { &hf_bgp_ls_tlv_ipv6_interface_address,
13636
14
        { "IPv6 interface address TLV", "bgp.ls.tlv.ipv6_interface_address", FT_NONE,
13637
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13638
14
      { &hf_bgp_ls_tlv_ipv6_neighbor_address,
13639
14
        { "IPv6 neighbor address TLV", "bgp.ls.tlv.ipv6_neighbor_address", FT_NONE,
13640
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13641
14
      { &hf_bgp_ls_tlv_node_msd,
13642
14
        { "Node MSD TLV", "bgp.ls.tlv.node_msd", FT_NONE,
13643
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13644
14
      { &hf_bgp_ls_tlv_link_msd,
13645
14
        { "Link MSD TLV", "bgp.ls.tlv.link_msd", FT_NONE,
13646
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13647
14
      { &hf_bgp_ls_tlv_igp_msd_type,
13648
14
        { "MSD Type", "bgp.ls.tlv.igp_msd_type", FT_UINT8,
13649
14
          BASE_DEC, VALS(igp_msd_types), 0x0, NULL, HFILL }},
13650
14
      { &hf_bgp_ls_tlv_igp_msd_value,
13651
14
        { "MSD Value", "bgp.ls.tlv.igp_msd_value", FT_UINT8,
13652
14
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
13653
14
      { &hf_bgp_ls_tlv_multi_topology_id,
13654
14
        { "Multi Topology ID TLV", "bgp.ls.tlv.multi_topology_id", FT_NONE,
13655
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13656
14
      { &hf_bgp_ls_tlv_ospf_route_type,
13657
14
        { "OSPF Route Type TLV", "bgp.ls.tlv.ospf_route_type", FT_NONE,
13658
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13659
14
      { &hf_bgp_ls_tlv_ip_reachability_information,
13660
14
        { "IP Reachability Information TLV", "bgp.ls.tlv.ip_reachability_information", FT_NONE,
13661
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13662
14
      { &hf_bgp_ls_tlv_administrative_group_color,
13663
14
        { "Administrative group (color) TLV", "bgp.ls.tlv.administrative_group_color", FT_NONE,
13664
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13665
14
      { &hf_bgp_ls_tlv_administrative_group_color_value,
13666
14
        { "Group Mask", "bgp.ls.tlv.administrative_group_color_value", FT_UINT32,
13667
14
         BASE_DEC, NULL, 0xffff, NULL, HFILL}},
13668
14
      { &hf_bgp_ls_tlv_administrative_group,
13669
14
        { "Group", "bgp.ls.tlv.administrative_group", FT_UINT32,
13670
14
         BASE_DEC, NULL, 0xffff, NULL, HFILL}},
13671
14
      { &hf_bgp_ls_tlv_max_link_bandwidth,
13672
14
        { "Maximum link bandwidth TLV", "bgp.ls.tlv.maximum_link_bandwidth", FT_NONE,
13673
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13674
14
      { &hf_bgp_ls_tlv_max_reservable_link_bandwidth,
13675
14
        { "Maximum reservable link bandwidth TLV", "bgp.ls.tlv.maximum_reservable_link_bandwidth", FT_NONE,
13676
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13677
14
      { &hf_bgp_ls_tlv_unreserved_bandwidth,
13678
14
        { "Unreserved bandwidth TLV", "bgp.ls.tlv.unreserved_bandwidth", FT_NONE,
13679
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13680
14
      { &hf_bgp_ls_bandwidth_value,
13681
14
        {"Bandwidth", "bgp.ls.bandwidth_value", FT_FLOAT,
13682
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13683
14
      { &hf_bgp_ls_tlv_te_default_metric,
13684
14
        { "TE Default Metric TLV", "bgp.ls.tlv.te_default_metric", FT_NONE,
13685
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13686
14
      { &hf_bgp_ls_tlv_te_default_metric_value_old,
13687
14
        { "TE Default Metric (old format)", "bgp.ls.tlv.te_default_metric_value.old", FT_UINT24,
13688
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
13689
14
      { &hf_bgp_ls_tlv_te_default_metric_value,
13690
14
        { "TE Default Metric", "bgp.ls.tlv.te_default_metric_value", FT_UINT32,
13691
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
13692
14
      { &hf_bgp_ls_tlv_link_protection_type,
13693
14
        { "Link Protection Type TLV", "bgp.ls.tlv.link_protection_type", FT_NONE,
13694
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13695
14
      { &hf_bgp_ls_tlv_link_protection_type_value,
13696
14
        { "Protection Capabilities", "bgp.ls.tlv.link_protection_type_value", FT_UINT8,
13697
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13698
14
      { &hf_bgp_ls_tlv_mpls_protocol_mask,
13699
14
        { "MPLS Protocol Mask TLV", "bgp.ls.tlv.mpls_protocol_mask", FT_NONE,
13700
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13701
14
      { &hf_bgp_ls_tlv_metric,
13702
14
        { "Metric TLV", "bgp.ls.tlv.metric", FT_NONE,
13703
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13704
14
      { &hf_bgp_ls_tlv_metric_value1,
13705
14
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT8,
13706
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13707
14
      { &hf_bgp_ls_tlv_metric_value2,
13708
14
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT16,
13709
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13710
14
      { &hf_bgp_ls_tlv_metric_value3,
13711
14
        { "IGP Metric", "bgp.ls.tlv.metric_value", FT_UINT24,
13712
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13713
14
      { &hf_bgp_ls_tlv_shared_risk_link_group,
13714
14
        { "Shared Risk Link Group TLV", "bgp.ls.tlv.shared_risk_link_group", FT_NONE,
13715
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13716
14
      { &hf_bgp_ls_tlv_shared_risk_link_group_value,
13717
14
        { "Shared Risk Link Group Value", "bgp.ls.tlv.shared_risk_link_group_value", FT_UINT32,
13718
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13719
14
      { &hf_bgp_ls_tlv_opaque_link_attribute,
13720
14
        { "Opaque Link Attribute TLV", "bgp.ls.tlv.opaque_link_attribute", FT_NONE,
13721
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13722
14
      { &hf_bgp_ls_tlv_opaque_link_attribute_value,
13723
14
        { "Opaque link attributes", "bgp.ls.tlv.opaque_link_attribute_value", FT_NONE,
13724
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13725
14
      { &hf_bgp_ls_tlv_link_name_attribute,
13726
14
        { "Opaque Link Attribute TLV", "bgp.ls.tlv.link_name_attribute", FT_NONE,
13727
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13728
14
      { &hf_bgp_ls_tlv_link_name_attribute_value,
13729
14
        {"Link Name", "bgp.ls.tlv.link_name_attribute_value", FT_STRING,
13730
14
          BASE_NONE, NULL, 0, NULL, HFILL }},
13731
14
      { &hf_bgp_ls_tlv_igp_flags,
13732
14
        { "IGP Flags TLV", "bgp.ls.tlv.igp_flags", FT_NONE,
13733
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13734
14
      { &hf_bgp_ls_tlv_route_tag,
13735
14
        { "Route Tag TLV", "bgp.ls.tlv.route_tag", FT_NONE,
13736
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13737
14
      { &hf_bgp_ls_tlv_route_tag_value,
13738
14
        { "Route Tag Value", "bgp.ls.tlv.route_tag_value", FT_UINT32,
13739
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13740
14
      { &hf_bgp_ls_tlv_route_extended_tag,
13741
14
        { "Extended Route Tag TLV", "bgp.ls.tlv.route_extended_tag", FT_NONE,
13742
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13743
14
      { &hf_bgp_ls_tlv_route_extended_tag_value,
13744
14
        {"Extended Route Tag", "bgp.ls.tlv.extended_route_tag_value", FT_UINT64,
13745
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13746
14
      { &hf_bgp_ls_tlv_prefix_metric,
13747
14
        { "Prefix Metric TLV", "bgp.ls.tlv.prefix_metric", FT_NONE,
13748
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13749
14
      { &hf_bgp_ls_tlv_prefix_metric_value,
13750
14
        { "Prefix Metric", "bgp.ls.tlv.prefix_metric_value", FT_UINT32,
13751
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
13752
14
      { &hf_bgp_ls_ospf_forwarding_address,
13753
14
        { "OSPF Forwarding Address TLV", "bgp.ls.tlv.ospf_forwarding_address", FT_NONE,
13754
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13755
14
      { &hf_bgp_ls_ospf_forwarding_address_ipv4_address,
13756
14
        { "OSPF forwarding IPv4 address", "bgp.ls.tlv.ospf_forwarding_address_ipv4", FT_IPv4,
13757
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13758
14
      { &hf_bgp_ls_ospf_forwarding_address_ipv6_address,
13759
14
        { "OSPF forwarding IPv6 address", "bgp.ls.tlv.ospf_forwarding_address_ipv6", FT_IPv6,
13760
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13761
14
      { &hf_bgp_ls_opaque_prefix_attribute,
13762
14
        { "Opaque Prefix Attribute TLV", "bgp.ls.tlv.opaque_prefix_attribute", FT_NONE,
13763
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13764
14
      { &hf_bgp_ls_opaque_prefix_attribute_value,
13765
14
        { "Opaque prefix attributes", "bgp.ls.tlv.opaque_prefix_attribute_value", FT_NONE,
13766
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13767
14
      { &hf_bgp_ls_extended_administrative_group,
13768
14
        { "Extended Administrative Group TLV", "bgp.ls.tlv.extended_administrative_group", FT_NONE,
13769
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13770
14
      { &hf_bgp_ls_extended_administrative_group_value,
13771
14
        { "Extended Administrative Group", "bgp.ls.tlv.extended_administrative_group_value", FT_BYTES,
13772
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13773
14
      { &hf_bgp_ls_tlv_igp_router,
13774
14
        { "IGP Router-ID", "bgp.ls.tlv.igp_router", FT_NONE,
13775
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13776
14
      { &hf_bgp_ls_tlv_igp_router_id,
13777
14
        { "IGP ID", "bgp.ls.tlv.igp_router_id", FT_BYTES,
13778
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13779
14
      { &hf_bgp_ls_tlv_bgp_router_id,
13780
14
        { "BGP Router-ID TLV", "bgp.ls.tlv.bgp_router_id", FT_NONE,
13781
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13782
14
      { &hf_bgp_ls_tlv_bgp_router_id_id,
13783
14
        { "BGP Router-ID", "bgp.ls.tlv.bgp_router_id.id", FT_IPv4,
13784
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13785
14
      { &hf_bgp_ls_tlv_bgp_confederation_member,
13786
14
        { "BGP Confederation Member TLV", "bgp.ls.tlv.confederation_member", FT_NONE,
13787
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13788
14
      { &hf_bgp_ls_tlv_bgp_confederation_member_as,
13789
14
        { "BGP Confederation Member AS", "bgp.ls.tlv.confederation_member.as", FT_UINT32,
13790
14
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
13791
14
      { &hf_bgp_ls_tlv_srv6_sid_info,
13792
14
        { "SRv6 SID Information TLV", "bgp.ls.tlv.srv6_sid_info", FT_NONE,
13793
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13794
14
      { &hf_bgp_ls_tlv_srv6_sid_info_sid,
13795
14
        { "SID", "bgp.ls.tlv.srv6_sid_info.sid", FT_IPv6,
13796
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13797
14
      { &hf_bgp_ls_tlv_node_flags_bits,
13798
14
        { "Node Flags Bits TLV", "bgp.ls.tlv.node_flags_bits", FT_NONE,
13799
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
13800
14
      { &hf_bgp_ls_tlv_opaque_node_properties,
13801
14
        { "Opaque Node Properties TLV", "bgp.ls.tlv.opaque_node_properties", FT_NONE,
13802
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
13803
14
      { &hf_bgp_ls_tlv_opaque_node_properties_value,
13804
14
        { "Opaque Node Properties", "bgp.ls.tlv.opaque_node_properties_value", FT_NONE,
13805
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
13806
14
      { &hf_bgp_ls_tlv_node_name,
13807
14
        { "Node Name TLV", "bgp.ls.tlv.node_name", FT_NONE,
13808
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
13809
14
      { &hf_bgp_ls_tlv_node_name_value,
13810
14
        {"Node name", "bgp.ls.tlv.node_name_value", FT_STRING,
13811
14
         BASE_NONE, NULL, 0, NULL, HFILL }},
13812
14
      { &hf_bgp_ls_tlv_is_is_area_identifier,
13813
14
        { "IS-IS Area Identifier TLV", "bgp.ls.tlv.is_is_area_identifier", FT_NONE,
13814
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
13815
14
      { &hf_bgp_ls_tlv_is_is_area_identifier_value,
13816
14
        { "IS-IS Area Identifier", "bgp.ls.tlv.is_is_area_identifier_value", FT_BYTES,
13817
14
         BASE_NONE, NULL, 0x0, NULL, HFILL}},
13818
      /* Link Protection Types */
13819
14
      { &hf_bgp_ls_link_protection_type_enhanced,
13820
14
        { "Enhanced", "bgp.ls.link_protection_type.enhanced", FT_BOOLEAN, 8,
13821
14
          TFS(&tfs_capable_not_capable), 0x20, NULL, HFILL }},
13822
14
      { &hf_bgp_ls_link_protection_type_dedicated_1plus1,
13823
14
        { "Dedicated 1+1", "bgp.ls.link_protection_type.dedicated_1plus1", FT_BOOLEAN, 8,
13824
14
          TFS(&tfs_capable_not_capable), 0x10, NULL, HFILL }},
13825
14
      { &hf_bgp_ls_link_protection_type_dedicated_1to1,
13826
14
        { "Dedicated 1:1", "bgp.ls.link_protection_type.dedicated_1colon1", FT_BOOLEAN, 8,
13827
14
          TFS(&tfs_capable_not_capable), 0x08, NULL, HFILL }},
13828
14
      { &hf_bgp_ls_link_protection_type_shared,
13829
14
        { "Shared", "bgp.ls.link_protection_type.shared", FT_BOOLEAN, 8,
13830
14
          TFS(&tfs_capable_not_capable), 0x04, NULL, HFILL }},
13831
14
      { &hf_bgp_ls_link_protection_type_unprotected,
13832
14
        { "Unprotected", "bgp.ls.link_protection_type.unprotected", FT_BOOLEAN, 8,
13833
14
          TFS(&tfs_capable_not_capable), 0x02, NULL, HFILL }},
13834
14
      { &hf_bgp_ls_link_protection_type_extra_traffic,
13835
14
        { "Extra Traffic", "bgp.ls.link_protection_type.extra_traffic", FT_BOOLEAN, 8,
13836
14
          TFS(&tfs_capable_not_capable), 0x01, NULL, HFILL }},
13837
      /* MPLS Protocol Mask flags */
13838
14
      { &hf_bgp_ls_mpls_protocol_mask_flag_l,
13839
14
        { "Label Distribution Protocol (LDP)", "bgp.ls.protocol_mask_tlv.mpls_protocol.l", FT_BOOLEAN, 8,
13840
14
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
13841
14
      { &hf_bgp_ls_mpls_protocol_mask_flag_r,
13842
14
        { "Extension to RSVP for LSP Tunnels (RSVP-TE)", "bgp.ls.protocol_mask_tlv.mpls_protocol.r", FT_BOOLEAN, 8,
13843
14
          TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
13844
      /* IGP Flags TLV */
13845
14
      { &hf_bgp_ls_igp_flags_flag_d,
13846
14
        { "IS-IS Up/Down Bit", "bgp.ls.protocol_mask_tlv.igp_flags_flag_d.d", FT_BOOLEAN, 8,
13847
14
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
13848
      /* Node Flag Bits TLV flags */
13849
14
      { &hf_bgp_ls_node_flag_bits_overload,
13850
14
        { "Overload Bit", "bgp.ls.node_flag_bits.overload", FT_BOOLEAN, 8,
13851
14
          TFS(&tfs_set_notset), 0x80, NULL, HFILL}},
13852
14
      { &hf_bgp_ls_node_flag_bits_attached,
13853
14
        { "Attached Bit", "bgp.ls.node_flag_bits.attached", FT_BOOLEAN, 8,
13854
14
          TFS(&tfs_set_notset), 0x40, NULL, HFILL}},
13855
14
      { &hf_bgp_ls_node_flag_bits_external,
13856
14
        { "External Bit", "bgp.ls.node_flag_bits.external", FT_BOOLEAN, 8,
13857
14
          TFS(&tfs_set_notset), 0x20, NULL, HFILL}},
13858
14
      { &hf_bgp_ls_node_flag_bits_abr,
13859
14
        { "ABR Bit", "bgp.ls.node_flag_bits.abr", FT_BOOLEAN, 8,
13860
14
          TFS(&tfs_set_notset), 0x10, NULL, HFILL}},
13861
14
      { &hf_bgp_evpn_nlri,
13862
14
        { "EVPN NLRI", "bgp.evpn.nlri", FT_NONE,
13863
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13864
14
      { &hf_bgp_evpn_nlri_rt,
13865
14
        { "Route Type", "bgp.evpn.nlri.rt", FT_UINT8, BASE_DEC,
13866
14
          VALS(evpnrtypevals), 0x0, NULL, HFILL }},
13867
14
      { &hf_bgp_evpn_nlri_len,
13868
14
        { "Length", "bgp.evpn.nlri.len", FT_UINT8,
13869
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13870
14
      { &hf_bgp_evpn_nlri_rd,
13871
14
        { "Route Distinguisher", "bgp.evpn.nlri.rd", FT_BYTES,
13872
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13873
14
      { &hf_bgp_evpn_nlri_esi,
13874
14
        { "ESI", "bgp.evpn.nlri.esi", FT_BYTES,
13875
14
          SEP_COLON, NULL, 0x0, NULL, HFILL }},
13876
14
      { &hf_bgp_evpn_nlri_esi_type,
13877
14
        { "ESI Type", "bgp.evpn.nlri.esi.type", FT_UINT8,
13878
14
          BASE_DEC, VALS(evpn_nlri_esi_type), 0x0, "EVPN ESI type", HFILL }},
13879
14
      { &hf_bgp_evpn_nlri_esi_lacp_mac,
13880
14
        { "CE LACP system MAC", "bgp.evpn.nlri.esi.lacp_mac", FT_ETHER,
13881
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13882
14
      { &hf_bgp_evpn_nlri_esi_portk,
13883
14
        { "LACP port key", "bgp.evpn.nlri.esi.lacp_portkey", FT_UINT16,
13884
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
13885
14
      { &hf_bgp_evpn_nlri_esi_remain,
13886
14
        { "Remaining bytes", "bgp.evpn.nlri.esi.remaining", FT_BYTES,
13887
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13888
14
      { &hf_bgp_evpn_nlri_esi_reserved,
13889
14
        { "Reserved value all 0xff", "bgp.evpn.nlri.esi.reserved", FT_BYTES,
13890
14
         BASE_NONE, NULL, 0x0, NULL, HFILL }},
13891
14
      { &hf_bgp_evpn_nlri_esi_value,
13892
14
        { "ESI Value", "bgp.evpn.nlri.esi.value", FT_BYTES,
13893
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
13894
14
      { &hf_bgp_evpn_nlri_esi_value_type0,
13895
14
        { "ESI 9 bytes value", "bgp.evpn.nlri.esi.type0", FT_BYTES,
13896
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
13897
14
      { &hf_bgp_evpn_nlri_esi_rb_mac,
13898
14
        { "ESI root bridge MAC", "bgp.evpn.nlri.esi.root_bridge", FT_ETHER,
13899
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13900
14
      { &hf_bgp_evpn_nlri_esi_rbprio,
13901
14
        { "ESI root bridge priority", "bgp.evpn.nlri.esi.rb_prio", FT_UINT16,
13902
14
          BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
13903
14
      { &hf_bgp_evpn_nlri_esi_sys_mac,
13904
14
        { "ESI system MAC", "bgp.evpn.nlri.esi.system_mac", FT_ETHER,
13905
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13906
14
      { &hf_bgp_evpn_nlri_esi_mac_discr,
13907
14
        { "ESI system mac discriminator", "bgp.evpn.nlri.esi.system_mac_discr", FT_BYTES,
13908
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
13909
14
      { &hf_bgp_evpn_nlri_esi_router_id,
13910
14
        { "ESI router ID", "bgp.evpn.nlri.esi.router_id", FT_IPv4,
13911
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
13912
14
      { &hf_bgp_evpn_nlri_esi_router_discr,
13913
14
        { "ESI router discriminator", "bgp.evpn.nlri.esi.router_discr", FT_BYTES,
13914
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
13915
14
      { &hf_bgp_evpn_nlri_esi_asn,
13916
14
        { "ESI ASN", "bgp.evpn.nlri.esi.asn", FT_UINT32,
13917
14
          BASE_DEC, NULL, 0x0, NULL, HFILL }},
13918
14
      { &hf_bgp_evpn_nlri_esi_asn_discr,
13919
14
        { "ESI ASN discriminator", "bgp.evpn.nlri.esi.asn_discr", FT_BYTES,
13920
14
          SEP_SPACE, NULL, 0x0, NULL, HFILL }},
13921
14
      { &hf_bgp_evpn_nlri_etag,
13922
14
       { "Ethernet Tag ID", "bgp.evpn.nlri.etag", FT_UINT32,
13923
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13924
14
      { &hf_bgp_evpn_nlri_mpls_ls1,
13925
14
        { "MPLS Label 1", "bgp.evpn.nlri.mpls_ls1", FT_UINT24,
13926
14
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
13927
14
      { &hf_bgp_evpn_nlri_mpls_ls2,
13928
14
        { "MPLS Label 2", "bgp.evpn.nlri.mpls_ls2", FT_UINT24,
13929
14
          BASE_DEC, NULL, BGP_MPLS_LABEL, NULL, HFILL}},
13930
14
      { &hf_bgp_evpn_nlri_vni,
13931
14
        { "VNI", "bgp.evpn.nlri.vni", FT_UINT24,
13932
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13933
14
      { &hf_bgp_evpn_nlri_maclen,
13934
14
       { "MAC Address Length", "bgp.evpn.nlri.maclen", FT_UINT8,
13935
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13936
14
      { &hf_bgp_evpn_nlri_mac_addr,
13937
14
        { "MAC Address", "bgp.evpn.nlri.mac_addr", FT_ETHER,
13938
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13939
14
      { &hf_bgp_evpn_nlri_iplen,
13940
14
        { "IP Address Length", "bgp.evpn.nlri.iplen", FT_UINT8,
13941
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13942
14
      { &hf_bgp_evpn_nlri_prefix_len,
13943
14
        { "IP prefix length", "bgp.evpn.nlri.prefix_len", FT_UINT8,
13944
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13945
14
      { &hf_bgp_evpn_nlri_ip_addr,
13946
14
        { "IPv4 address", "bgp.evpn.nlri.ip.addr", FT_IPv4,
13947
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13948
14
      { &hf_bgp_evpn_nlri_ipv6_addr,
13949
14
        { "IPv6 address", "bgp.evpn.nlri.ipv6.addr", FT_IPv6,
13950
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13951
14
      { &hf_bgp_evpn_nlri_ipv4_gtw,
13952
14
        { "IPv4 Gateway address", "bgp.evpn.nlri.ipv4.gtw_addr", FT_IPv4,
13953
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13954
14
      { &hf_bgp_evpn_nlri_ipv6_gtw,
13955
14
        { "IPv6 Gateway address", "bgp.evpn.nlri.ipv6.gtw_addr", FT_IPv6,
13956
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13957
     /* segment routing extensions to link state */
13958
     /* Node Attributes TLVs */
13959
14
      { &hf_bgp_ls_sr_tlv_capabilities,
13960
14
        { "SR Capabilities", "bgp.ls.sr.tlv.capabilities", FT_NONE,
13961
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13962
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags,
13963
14
        { "Flags", "bgp.ls.sr.tlv.capabilities.flags", FT_UINT8,
13964
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
13965
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_i,
13966
14
        { "MPLS IPv4 flag (I)", "bgp.ls.sr.tlv.capabilities.flags.i", FT_BOOLEAN,
13967
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_I, NULL, HFILL}},
13968
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_v,
13969
14
        { "MPLS IPv6 flag (V)", "bgp.ls.sr.tlv.capabilities.flags.v", FT_BOOLEAN,
13970
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_V, NULL, HFILL}},
13971
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_h,
13972
14
        { "SR-IPv6 flag (H)", "bgp.ls.sr.tlv.capabilities.flags.h", FT_BOOLEAN,
13973
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_CAPABILITY_FLAG_H, NULL, HFILL}},
13974
14
      { &hf_bgp_ls_sr_tlv_capabilities_flags_reserved,
13975
14
        { "Reserved", "bgp.ls.sr.tlv.capabilities.flags.reserved", FT_UINT8,
13976
14
          BASE_HEX, NULL, 0x1F, NULL, HFILL}},
13977
14
      { &hf_bgp_ls_sr_tlv_capabilities_range_size,
13978
14
        { "Range Size", "bgp.ls.sr.tlv.capabilities.range_size", FT_UINT24,
13979
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13980
14
      { &hf_bgp_ls_sr_tlv_capabilities_sid_label,
13981
14
        { "From Label", "bgp.ls.sr.tlv.capabilities.sid.label", FT_UINT24,
13982
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
13983
14
      { &hf_bgp_ls_sr_tlv_capabilities_sid_index,
13984
14
        { "From Index", "bgp.ls.sr.tlv.capabilities.sid.index", FT_UINT32,
13985
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13986
14
      { &hf_bgp_ls_sr_tlv_algorithm,
13987
14
        { "SR Algorithm TLV", "bgp.ls.sr.tlv.algorithm", FT_NONE,
13988
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13989
14
      { &hf_bgp_ls_sr_tlv_algorithm_value,
13990
14
        { "SR Algorithm", "bgp.ls.sr.tlv.algorithm.value", FT_UINT8,
13991
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
13992
14
      { &hf_bgp_ls_sr_tlv_local_block,
13993
14
        { "SR Local Block", "bgp.ls.sr.tlv.local_block", FT_NONE,
13994
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13995
14
      { &hf_bgp_ls_sr_tlv_srv6_cap,
13996
14
        { "SRv6 Capabilities TLV", "bgp.ls.sr.tlv.srv6_capabilities", FT_NONE,
13997
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
13998
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags,
13999
14
        { "Flags", "bgp.ls.sr.tlv.srv6_capabilities.flags", FT_UINT16,
14000
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14001
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags_o,
14002
14
        { "OAM flag (O)", "bgp.ls.sr.tlv.srv6_capabilities.flags.o", FT_BOOLEAN,
14003
14
          16, TFS(&tfs_set_notset), BGP_LS_SRV6_CAP_FLAG_O, NULL, HFILL}},
14004
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_flags_reserved,
14005
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_capabilities.flags.reserved", FT_UINT16,
14006
14
          BASE_HEX, NULL, 0x3fff, NULL, HFILL}},
14007
14
      { &hf_bgp_ls_sr_tlv_srv6_cap_reserved,
14008
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_capabilities.reserved", FT_UINT16,
14009
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14010
14
      { &hf_bgp_ls_sr_tlv_local_block_flags,
14011
14
        { "Flags", "bgp.ls.sr.tlv.local_block.flags", FT_UINT8,
14012
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14013
14
      { &hf_bgp_ls_sr_tlv_local_block_range_size,
14014
14
        { "Range Size", "bgp.ls.sr.tlv.local_block.range_size", FT_UINT24,
14015
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14016
14
      { &hf_bgp_ls_sr_tlv_local_block_sid_label,
14017
14
        { "From Label", "bgp.ls.sr.tlv.local_block.sid.label", FT_UINT24,
14018
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14019
14
      { &hf_bgp_ls_sr_tlv_local_block_sid_index,
14020
14
        { "From Index", "bgp.ls.sr.tlv.local_block.sid.index", FT_UINT32,
14021
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14022
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def,
14023
14
        { "Flexible Algorithm Definition TLV", "bgp.ls.sr.tlv.flex_algo", FT_NONE,
14024
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14025
14
      { &hf_bgp_ls_sr_tlv_flex_algo_algorithm,
14026
14
        { "Flex-Algorithm", "bgp.ls.sr.tlv.flex_algo.flex_algorithm", FT_UINT8,
14027
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14028
14
      { &hf_bgp_ls_sr_tlv_flex_algo_metric_type,
14029
14
        { "Metric-Type", "bgp.ls.sr.tlv.flex_algo.metric_type", FT_UINT8,
14030
14
          BASE_DEC, VALS(flex_algo_metric_types), 0x0, NULL, HFILL}},
14031
14
      { &hf_bgp_ls_sr_tlv_flex_algo_calc_type,
14032
14
        { "Calculation-Type", "bgp.ls.sr.tlv.flex_algo.calculation_type", FT_UINT8,
14033
14
          BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14034
14
      { &hf_bgp_ls_sr_tlv_flex_algo_priority,
14035
14
        { "Priority", "bgp.ls.sr.tlv.flex_algo.priority", FT_UINT8,
14036
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14037
14
      { &hf_bgp_ls_sr_tlv_flex_algo_exc_any_affinity,
14038
14
        { "Flexible Algorithm Exclude-Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.exclude_any_affinity", FT_NONE,
14039
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14040
14
      { &hf_bgp_ls_sr_tlv_flex_algo_inc_any_affinity,
14041
14
        { "Flexible Algorithm Include-Any Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_any_affinity", FT_NONE,
14042
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14043
14
      { &hf_bgp_ls_sr_tlv_flex_algo_inc_all_affinity,
14044
14
        { "Flexible Algorithm Include-All Affinity TLV", "bgp.ls.sr.tlv.flex_algo.include_all_affinity", FT_NONE,
14045
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14046
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags,
14047
14
        { "Flexible Algorithm Definition Flags TLV", "bgp.ls.sr.tlv.flex_algo.definition_flags", FT_NONE,
14048
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14049
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags,
14050
14
        { "Flags", "bgp.ls.sr.tlv.flex_algo.definition_flags.flags", FT_UINT32,
14051
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14052
14
      { &hf_bgp_ls_sr_tlv_flex_algo_def_flags_flags_m,
14053
14
        { "M-flag (M)", "bgp.ls.sr.tlv.flex_algo.definition_flags.flags.m", FT_BOOLEAN,
14054
14
          32, TFS(&tfs_set_notset), BGP_LS_FLEX_ALGO_DEF_FLAGS_M, NULL, HFILL}},
14055
14
      { &hf_bgp_ls_sr_tlv_flex_algo_exc_srlg,
14056
14
        { "Flexible Algorithm Exclude SRLG TLV", "bgp.ls.sr.tlv.flex_algo.exclude_srlg", FT_NONE,
14057
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14058
     /* Prefix Attribute TLVs */
14059
14
      { &hf_bgp_ls_sr_tlv_prefix_sid,
14060
14
        { "Prefix SID TLV", "bgp.ls.sr.tlv.prefix.sid", FT_NONE,
14061
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14062
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags,
14063
14
        { "Flags", "bgp.ls.sr.tlv.prefix.sid.flags", FT_UINT8,
14064
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14065
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_r,
14066
14
        { "Re-advertisement (R)", "bgp.ls.sr.tlv.prefix.sid.flags.r", FT_BOOLEAN,
14067
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_R, NULL, HFILL}},
14068
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_n,
14069
14
        { "Node-SID (N)", "bgp.ls.sr.tlv.prefix.sid.flags.n", FT_BOOLEAN,
14070
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_N, NULL, HFILL}},
14071
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_np,
14072
14
        { "No-PHP (NP)", "bgp.ls.sr.tlv.prefix.sid.flags.np", FT_BOOLEAN,
14073
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_NP, NULL, HFILL}},
14074
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_p,
14075
14
        { "No-PHP (P)", "bgp.ls.sr.tlv.prefix.sid.flags.p", FT_BOOLEAN,
14076
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_P, NULL, HFILL}},
14077
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_m,
14078
14
        { "Mapping Server Flag (M)", "bgp.ls.sr.tlv.prefix.sid.flags.m", FT_BOOLEAN,
14079
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_M, NULL, HFILL}},
14080
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_e,
14081
14
        { "Explicit-Null (E)", "bgp.ls.sr.tlv.prefix.sid.flags.e", FT_BOOLEAN,
14082
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_E, NULL, HFILL}},
14083
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_v,
14084
14
        { "Value (V)", "bgp.ls.sr.tlv.prefix.sid.flags.v", FT_BOOLEAN,
14085
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_V, NULL, HFILL}},
14086
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_flags_l,
14087
14
        { "Local (L)", "bgp.ls.sr.tlv.prefix.sid.flags.l", FT_BOOLEAN,
14088
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_SID_FLAG_L, NULL, HFILL}},
14089
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_algo,
14090
14
        { "Algorithm", "bgp.ls.sr.tlv.prefix.sid.algo", FT_UINT8,
14091
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14092
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_label,
14093
14
        { "SID/Label", "bgp.ls.sr.tlv.prefix.sid.label", FT_UINT24,
14094
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14095
14
      { &hf_bgp_ls_sr_tlv_prefix_sid_index,
14096
14
        { "SID/Index", "bgp.ls.sr.tlv.prefix.sid.index", FT_UINT32,
14097
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14098
14
      { &hf_bgp_ls_sr_tlv_srv6_locator,
14099
14
        { "SRv6 Locator TLV", "bgp.ls.sr.tlv.srv6_locator", FT_NONE,
14100
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14101
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags,
14102
14
        { "Flags", "bgp.ls.sr.tlv.srv6_locator.flags", FT_UINT8,
14103
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14104
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags_d,
14105
14
        { "Down flag (D)", "bgp.ls.sr.tlv.srv6_locator.flags.d", FT_BOOLEAN,
14106
14
          8, TFS(&tfs_set_notset), BGP_LS_SRV6_LOC_FLAG_D, NULL, HFILL}},
14107
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_flags_reserved,
14108
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_locator.flags.reserved", FT_UINT8,
14109
14
          BASE_HEX, NULL, BGP_LS_SRV6_LOC_FLAG_RESERVED, NULL, HFILL}},
14110
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_algo,
14111
14
        { "Algorithm", "bgp.ls.sr.tlv.srv6_locator.algorithm",
14112
14
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14113
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_reserved,
14114
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_locator.reserved", FT_UINT16,
14115
14
          BASE_HEX, NULL, 0, NULL, HFILL}},
14116
14
      { &hf_bgp_ls_sr_tlv_srv6_locator_metric,
14117
14
        { "Metric", "bgp.ls.sr.tlv.srv6_locator.metric", FT_UINT32,
14118
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14119
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags,
14120
14
        { "Prefix Attribute Flags TLV", "bgp.ls.sr.tlv.prefix.attribute_flags", FT_NONE,
14121
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14122
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags,
14123
14
        { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags", FT_UINT8,
14124
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14125
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_unknown,
14126
14
        { "Flags", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.unknown", FT_BYTES,
14127
14
          SEP_SPACE, NULL, 0x0,NULL, HFILL }},
14128
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ao,
14129
14
        { "Attach (A)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.a", FT_BOOLEAN,
14130
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_AO, NULL, HFILL}},
14131
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_no,
14132
14
        { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
14133
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NO, NULL, HFILL}},
14134
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_eo,
14135
14
        { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
14136
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EO, NULL, HFILL}},
14137
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_xi,
14138
14
        { "External Prefix (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.x", FT_BOOLEAN,
14139
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_XI, NULL, HFILL}},
14140
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ri,
14141
14
        { "Re-advertisement (X)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.r", FT_BOOLEAN,
14142
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_RI, NULL, HFILL}},
14143
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ni,
14144
14
        { "Node (N)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.n", FT_BOOLEAN,
14145
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_NI, NULL, HFILL}},
14146
14
      { &hf_bgp_ls_sr_tlv_prefix_attr_flags_flags_ei,
14147
14
        { "ELC (E)", "bgp.ls.sr.tlv.prefix.attribute_flags.flags.e", FT_BOOLEAN,
14148
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PREFIX_ATTR_FLAGS_FLAG_EI, NULL, HFILL}},
14149
14
      { &hf_bgp_ls_sr_tlv_source_router_id,
14150
14
        { "Source Router-ID TLV", "bgp.ls.sr.tlv.source_router_id", FT_NONE,
14151
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14152
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric,
14153
14
        { "Flexible Algorithm Prefix Metric TLV", "bgp.ls.sr.tlv.flex_algo.prefix_metric", FT_NONE,
14154
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14155
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags,
14156
14
        { "Flags", "bgp.ls.sr.tlv.flex_algo.prefix_metric.flags", FT_UINT8,
14157
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14158
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_flags_e,
14159
14
        { "E bit (E)", "bgp.ls.sr.tlv.flex_algo.prefix_metric.flags.e", FT_BOOLEAN,
14160
14
          8, TFS(&tfs_set_notset), BGP_LS_FLEX_ALGO_PREFIX_METRIC_FLAGS_E, NULL, HFILL}},
14161
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_reserved,
14162
14
        { "Reserved", "bgp.ls.sr.tlv.flex_algo.prefix_metric.reserved", FT_UINT16,
14163
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14164
14
      { &hf_bgp_ls_sr_tlv_flex_algo_prefix_metric_metric,
14165
14
        { "Metric", "bgp.ls.sr.tlv.flex_algo.prefix_metric.metric", FT_UINT32,
14166
14
          BASE_HEX_DEC, NULL, 0x0, NULL, HFILL}},
14167
     /* SID Attribute TLVs */
14168
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior,
14169
14
        { "SRv6 Endpoint Behavior TLV", "bgp.ls.sr.tlv.srv6_endpoint_behavior", FT_NONE,
14170
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14171
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_endpoint_behavior,
14172
14
        { "Endpoint Behavior", "bgp.ls.sr.tlv.srv6_endpoint_behavior.endpoint_behavior", FT_UINT16,
14173
14
          BASE_HEX, VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL}},
14174
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_flags,
14175
14
        { "Flags", "bgp.ls.sr.tlv.srv6_endpoint_behavior.flags", FT_UINT8,
14176
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14177
14
      { &hf_bgp_ls_sr_tlv_srv6_endpoint_behavior_algo,
14178
14
        { "Algorithm", "bgp.ls.sr.tlv.srv6_endpoint_behavior.algorithm",
14179
14
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL}},
14180
     /* Adjacency Attribute TLVs */
14181
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid,
14182
14
        { "Adjacency SID TLV", "bgp.ls.sr.tlv.adjacency.sid", FT_NONE,
14183
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14184
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags,
14185
14
        { "Flags", "bgp.ls.sr.tlv.adjacency.sid.flags", FT_UINT8,
14186
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14187
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_fi,
14188
14
        { "Address-Family flag (F)", "bgp.ls.sr.tlv.adjacency.sid.flags.f", FT_BOOLEAN,
14189
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_FI, NULL, HFILL}},
14190
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bo,
14191
14
        { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
14192
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BO, NULL, HFILL}},
14193
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_bi,
14194
14
        { "Backup Flag (B)", "bgp.ls.sr.tlv.adjacency.sid.flags.b", FT_BOOLEAN,
14195
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_BI, NULL, HFILL}},
14196
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vo,
14197
14
        { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
14198
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VO, NULL, HFILL}},
14199
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_vi,
14200
14
        { "Value Flag (V)", "bgp.ls.sr.tlv.adjacency.sid.flags.v", FT_BOOLEAN,
14201
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_VI, NULL, HFILL}},
14202
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_lo,
14203
14
        { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
14204
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LO, NULL, HFILL}},
14205
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_li,
14206
14
        { "Local Flag (L)", "bgp.ls.sr.tlv.adjacency.sid.flags.l", FT_BOOLEAN,
14207
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_LI, NULL, HFILL}},
14208
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_go,
14209
14
        { "Group Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.g", FT_BOOLEAN,
14210
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_GO, NULL, HFILL}},
14211
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_si,
14212
14
        { "Set Flag (S)", "bgp.ls.sr.tlv.adjacency.sid.flags.s", FT_BOOLEAN,
14213
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_SI, NULL, HFILL}},
14214
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_po,
14215
14
        { "Persistent Flag (P)", "bgp.ls.sr.tlv.adjacency.sid.flags.p", FT_BOOLEAN,
14216
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_PO, NULL, HFILL}},
14217
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_flags_pi,
14218
14
        { "Persistent Flag (P)", "bgp.ls.sr.tlv.adjacency.sid.flags.p", FT_BOOLEAN,
14219
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_ADJACENCY_SID_FLAG_PI, NULL, HFILL}},
14220
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_weight,
14221
14
        { "Weight", "bgp.ls.sr.tlv.adjacency.sid.weight", FT_UINT8,
14222
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14223
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_label,
14224
14
        { "SID/Label", "bgp.ls.sr.tlv.adjacency.sid.label", FT_UINT24,
14225
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14226
14
      { &hf_bgp_ls_sr_tlv_adjacency_sid_index,
14227
14
        { "SID/Index", "bgp.ls.sr.tlv.adjacency.sid.index", FT_UINT32,
14228
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14229
14
      { &hf_bgp_ls_sr_tlv_peer_node_sid,
14230
14
        { "PeerNode SID TLV", "bgp.ls.sr.tlv.peer_node.sid", FT_NONE,
14231
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14232
14
      { &hf_bgp_ls_sr_tlv_peer_adj_sid,
14233
14
        { "PeerAdj SID TLV", "bgp.ls.sr.tlv.peer_adj.sid", FT_NONE,
14234
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14235
14
      { &hf_bgp_ls_sr_tlv_peer_set_sid,
14236
14
        { "PeerSet SID TLV", "bgp.ls.sr.tlv.peer_set.sid", FT_NONE,
14237
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14238
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags,
14239
14
        { "Flags", "bgp.ls.sr.tlv.peer.sid.flags", FT_UINT8,
14240
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14241
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_v,
14242
14
        { "Value flag (V)", "bgp.ls.sr.tlv.peer.sid.flags.v", FT_BOOLEAN,
14243
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_V, NULL, HFILL}},
14244
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_l,
14245
14
        { "Local flag (L)", "bgp.ls.sr.tlv.peer.sid.flags.l", FT_BOOLEAN,
14246
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_L, NULL, HFILL}},
14247
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_b,
14248
14
        { "Backup flag (B)", "bgp.ls.sr.tlv.peer.sid.flags.b", FT_BOOLEAN,
14249
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_B, NULL, HFILL}},
14250
14
      { &hf_bgp_ls_sr_tlv_peer_sid_flags_p,
14251
14
        { "Persistent flag (P)", "bgp.ls.sr.tlv.peer.sid.flags.p", FT_BOOLEAN,
14252
14
          8, TFS(&tfs_set_notset), BGP_LS_SR_PEER_SID_FLAG_P, NULL, HFILL}},
14253
14
      { &hf_bgp_ls_sr_tlv_peer_sid_weight,
14254
14
        { "Weight", "bgp.ls.sr.tlv.peer.sid.weight", FT_UINT8,
14255
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14256
14
      { &hf_bgp_ls_sr_tlv_peer_sid_label,
14257
14
        { "SID/Label", "bgp.ls.sr.tlv.peer.sid.label", FT_UINT24,
14258
14
          BASE_DEC, NULL, 0x0FFFFF, NULL, HFILL}},
14259
14
      { &hf_bgp_ls_sr_tlv_peer_sid_index,
14260
14
        { "SID/Index", "bgp.ls.sr.tlv.peer.sid.index", FT_UINT32,
14261
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14262
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid,
14263
14
        { "SRv6 End.X SID TLV", "bgp.ls.sr.tlv.srv6_endx_sid", FT_NONE,
14264
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14265
14
      { &hf_bgp_ls_sr_tlv_srv6_lan_endx_sid,
14266
14
        { "SRv6 LAN End.X SID TLV", "bgp.ls.sr.tlv.srv6_lan_endx_sid", FT_NONE,
14267
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14268
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_endpoint_behavior,
14269
14
        { "Endpoint Behavior", "bgp.ls.sr.tlv.srv6_endx_sid.endpoint_behavior",
14270
14
          FT_UINT16, BASE_DEC, VALS(srv6_endpoint_behavior), 0x0, NULL, HFILL }},
14271
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags,
14272
14
        { "Flags", "bgp.ls.sr.tlv.srv6_endx_sid.flags", FT_UINT8,
14273
14
          BASE_HEX, NULL, 0x0, NULL, HFILL }},
14274
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_b,
14275
14
        { "Backup flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.b",
14276
14
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_B, NULL, HFILL }},
14277
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_s,
14278
14
        { "Set flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.s",
14279
14
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_S, NULL, HFILL }},
14280
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_p,
14281
14
        { "Persistent flag", "bgp.ls.sr.tlv.srv6_endx_sid.flags.p",
14282
14
          FT_BOOLEAN, 8, TFS(&tfs_set_notset), BGP_LS_SRV6_ENDX_SID_FLAG_P, NULL, HFILL }},
14283
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_flags_reserved,
14284
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_endx_sid.flags.reserved",
14285
14
          FT_UINT8, BASE_HEX, NULL, BGP_LS_SRV6_ENDX_SID_FLAG_RESERVED, NULL, HFILL }},
14286
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_algo,
14287
14
        { "Algorithm", "bgp.ls.sr.tlv.srv6_endx_sid.algorithm",
14288
14
          FT_UINT8, BASE_DEC, VALS(igp_algo_types), 0x0, NULL, HFILL }},
14289
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_weight,
14290
14
        { "Weight", "bgp.ls.sr.tlv.srv6_endx_sid.weight",
14291
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14292
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_reserved,
14293
14
        { "Reserved", "bgp.ls.sr.tlv.srv6_endx_sid.reserved",
14294
14
          FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
14295
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_ospf,
14296
14
        { "Neighbor-ID", "bgp.ls.tlv.srv6_endx_sid.neighbor_id_ospf", FT_IPv4,
14297
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14298
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_neighbor_isis,
14299
14
        { "Neighbor-ID", "bgp.ls.tlv.srv6_endx_sid.neighbor_id_isis", FT_SYSTEM_ID,
14300
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14301
14
      { &hf_bgp_ls_sr_tlv_srv6_endx_sid_sid,
14302
14
        { "SID", "bgp.ls.sr.tlv.srv6_endx_sid.sid",
14303
14
          FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
14304
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct,
14305
14
        { "SRv6 SID Structure TLV", "bgp.ls.sr.tlv.srv6_sid_structure", FT_NONE,
14306
14
          BASE_NONE, NULL, 0x0, NULL, HFILL }},
14307
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_lb_len,
14308
14
        { "Locator Block Length", "bgp.ls.sr.tlv.srv6_sid_structure.locator_block_len",
14309
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14310
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_ln_len,
14311
14
        { "Locator Node Length", "bgp.ls.sr.tlv.srv6_sid_structure.locator_node_len",
14312
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14313
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_fun_len,
14314
14
        { "Function Length", "bgp.ls.sr.tlv.srv6_sid_structure.fun_len",
14315
14
          FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
14316
14
      { &hf_bgp_ls_sr_tlv_srv6_sid_struct_arg_len,
14317
14
        { "Arguments Length", "bgp.ls.sr.tlv.srv6_sid_structure.arg_len",
14318
14
          FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL }},
14319
14
      { &hf_bgp_ls_igp_te_metric_flags,
14320
14
        { "TE Metric Flags", "bgp.ls.igp_te_metric.flags", FT_UINT8,
14321
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14322
14
      { &hf_bgp_ls_igp_te_metric_flags_a,
14323
14
        { "Anomalous (A) bit", "bgp.ls.igp_te_metric.flags.a", FT_BOOLEAN,
14324
14
          8, TFS(&tfs_set_notset), BGP_LS_IGP_TE_METRIC_FLAG_A, NULL, HFILL}},
14325
14
      { &hf_bgp_ls_igp_te_metric_flags_reserved,
14326
14
        { "Reserved", "bgp.ls.igp_te_metric.flags.reserved", FT_UINT8,
14327
14
          BASE_HEX, NULL, BGP_LS_IGP_TE_METRIC_FLAG_RESERVED, NULL, HFILL}},
14328
14
      { &hf_bgp_ls_igp_te_metric_delay,
14329
14
        { "Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay", FT_NONE,
14330
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14331
14
      { &hf_bgp_ls_igp_te_metric_delay_value,
14332
14
        { "Delay", "bgp.ls.igp_te_metric.delay_value", FT_UINT24,
14333
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14334
14
      { &hf_bgp_ls_igp_te_metric_delay_min_max,
14335
14
        { "Min/Max Unidirectional Link Delay TLV", "bgp.ls.igp_te_metric.delay_min_max", FT_NONE,
14336
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14337
14
      { &hf_bgp_ls_igp_te_metric_delay_min,
14338
14
        { "Min Delay", "bgp.ls.igp_te_metric.delay_min", FT_UINT24,
14339
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14340
14
      { &hf_bgp_ls_igp_te_metric_delay_max,
14341
14
        { "Max Delay", "bgp.ls.igp_te_metric.delay_max", FT_UINT24,
14342
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14343
14
      { &hf_bgp_ls_igp_te_metric_delay_variation,
14344
14
        { "Unidirectional Delay Variation TLV", "bgp.ls.igp_te_metric.delay_variation", FT_NONE,
14345
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14346
14
      { &hf_bgp_ls_igp_te_metric_delay_variation_value,
14347
14
        { "Delay Variation", "bgp.ls.igp_te_metric.delay_variation_value", FT_UINT24,
14348
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14349
14
      { &hf_bgp_ls_igp_te_metric_link_loss,
14350
14
        { "Unidirectional Link Loss TLV", "bgp.ls.igp_te_metric.link_loss", FT_NONE,
14351
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14352
14
      { &hf_bgp_ls_igp_te_metric_link_loss_value,
14353
14
        { "Link Loss", "bgp.ls.igp_te_metric.link_loss_value", FT_UINT24,
14354
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14355
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_residual,
14356
14
        { "Unidirectional Residual Bandwidth TLV", "bgp.ls.igp_te_metric.residual_bandwidth", FT_NONE,
14357
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14358
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_residual_value,
14359
14
        { "Residual Bandwidth", "bgp.ls.igp_te_metric.residual_bandwidth_value", FT_UINT32,
14360
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14361
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_available,
14362
14
        { "Unidirectional Available Bandwidth TLV", "bgp.ls.igp_te_metric.available_bandwidth", FT_NONE,
14363
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14364
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_available_value,
14365
14
        { "Residual Bandwidth", "bgp.ls.igp_te_metric.available_bandwidth_value", FT_UINT32,
14366
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14367
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_utilized,
14368
14
        { "Unidirectional Utilized Bandwidth TLV", "bgp.ls.igp_te_metric.utilized_bandwidth", FT_NONE,
14369
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14370
14
      { &hf_bgp_ls_igp_te_metric_bandwidth_utilized_value,
14371
14
        { "Utilized Bandwidth", "bgp.ls.igp_te_metric.utilized_bandwidth_value", FT_UINT32,
14372
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14373
14
      { &hf_bgp_ls_igp_te_metric_reserved,
14374
14
        { "Reserved", "bgp.ls.igp_te_metric.reserved", FT_UINT8,
14375
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14376
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs,
14377
14
        { "Application-Specific Link Attributes TLV", "bgp.ls.tlv.application_specific_link_attributes", FT_NONE,
14378
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14379
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_len,
14380
14
        { "SABM Length", "bgp.ls.tlv.application_specific_link_attributes.sabm_length", FT_UINT8,
14381
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14382
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm_len,
14383
14
        { "UDABM Length", "bgp.ls.tlv.application_specific_link_attributes.udabm_length", FT_UINT8,
14384
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14385
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_reserved,
14386
14
        { "Reserved", "bgp.ls.tlv.application_specific_link_attributes.reserved", FT_UINT16,
14387
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14388
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm,
14389
14
        { "Standard Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.sabm", FT_UINT32,
14390
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14391
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_r,
14392
14
        { "RSVP-TE (R)", "bgp.ls.tlv.application_specific_link_attributes.sabm.r", FT_BOOLEAN,
14393
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_R, NULL, HFILL}},
14394
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_s,
14395
14
        { "Segment Routing Policy (S)", "bgp.ls.tlv.application_specific_link_attributes.sabm.s", FT_BOOLEAN,
14396
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_S, NULL, HFILL}},
14397
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_f,
14398
14
        { "Loop Free Alternate (F)", "bgp.ls.tlv.application_specific_link_attributes.sabm.f", FT_BOOLEAN,
14399
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_F, NULL, HFILL}},
14400
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_sabm_x,
14401
14
        { "Flexible Algorithm (X)", "bgp.ls.tlv.application_specific_link_attributes.sabm.x", FT_BOOLEAN,
14402
14
          32, TFS(&tfs_set_notset), BGP_LS_APP_SPEC_LINK_ATTRS_SABM_X, NULL, HFILL}},
14403
14
      { &hf_bgp_ls_tlv_app_spec_link_attrs_udabm,
14404
14
        { "User-Defined Application Identifier Bit Mask", "bgp.ls.tlv.application_specific_link_attributes.udabm", FT_BYTES,
14405
14
          SEP_SPACE, NULL, 0x0,NULL, HFILL }},
14406
14407
14
      { &hf_bgp_evpn_nlri_igmp_mc_or_length,
14408
14
       { "Originator Router Length", "bgp.evpn.nlri.or_length", FT_UINT8,
14409
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14410
14
      { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv4,
14411
14
       { "Originator Router Address IPv4", "bgp.evpn.nlri.or_addr_ipv4", FT_IPv4,
14412
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14413
14
      { &hf_bgp_evpn_nlri_igmp_mc_or_addr_ipv6,
14414
14
       { "Originator Router Address IPv6", "bgp.evpn.nlri.or_addr_ipv6", FT_IPv6,
14415
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14416
14
      { &hf_bgp_evpn_nlri_igmp_mc_reserved,
14417
14
       { "Reserved", "bgp.evpn.nlri.igmp_mc_reserved", FT_BYTES,
14418
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14419
14
      { &hf_bgp_evpn_nlri_igmp_mc_max_resp_time,
14420
14
       { "Max. response time", "bgp.evpn.nlri.igmp_mc_max_resp_time", FT_UINT8,
14421
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14422
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags,
14423
14
       { "Flags", "bgp.evpn.nlri.igmp_mc_flags", FT_UINT8,
14424
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14425
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v1,
14426
14
        { "IGMP Version 1", "bgp.evpn.nlri.igmp_mc_flags.v1", FT_BOOLEAN,
14427
14
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V1, NULL, HFILL}},
14428
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v2,
14429
14
        { "IGMP Version 2", "bgp.evpn.nlri.igmp_mc_flags.v2", FT_BOOLEAN,
14430
14
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V2, NULL, HFILL}},
14431
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_v3,
14432
14
        { "IGMP Version 3", "bgp.evpn.nlri.igmp_mc_flags.v3", FT_BOOLEAN,
14433
14
          8, TFS(&tfs_set_notset), EVPN_IGMP_MC_FLAG_V3, NULL, HFILL}},
14434
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_ie,
14435
14
        { "Group Type (IE Flag)", "bgp.evpn.nlri.igmp_mc_flags.ie", FT_BOOLEAN,
14436
14
          8, TFS(&tfs_exclude_include), EVPN_IGMP_MC_FLAG_IE, "Group Type (Include/Exclude Flag)", HFILL}},
14437
14
      { &hf_bgp_evpn_nlri_igmp_mc_flags_reserved,
14438
14
        { "Reserved", "bgp.evpn.nlri.igmp_mc_flags.reserved", FT_UINT8,
14439
14
          BASE_HEX, NULL, EVPN_IGMP_MC_FLAG_RESERVED, NULL, HFILL}},
14440
14441
        /* draft-mpmz-bess-mup-safi-00 */
14442
14
      { &hf_bgp_mup_nlri,
14443
14
        { "BGP-MUP NLRI", "bgp.mup.nlri", FT_NONE,
14444
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14445
14
      { &hf_bgp_mup_nlri_at,
14446
14
        { "Architecture Type", "bgp.mup.nlri.at", FT_UINT8, BASE_DEC,
14447
14
          VALS(bgp_mup_architecture_types), 0x0, NULL, HFILL }},
14448
14
      { &hf_bgp_mup_nlri_rt,
14449
14
        { "Route Type", "bgp.mup.nlri.rt", FT_UINT16, BASE_DEC,
14450
14
          VALS(bgp_mup_route_types), 0x0, NULL, HFILL }},
14451
14
      { &hf_bgp_mup_nlri_len,
14452
14
        { "Length", "bgp.mup.nlri.len", FT_UINT8,
14453
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14454
14
      { &hf_bgp_mup_nlri_rd,
14455
14
        { "Route Distinguisher", "bgp.mup.nlri.rd", FT_BYTES,
14456
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14457
14
      { &hf_bgp_mup_nlri_prefixlen,
14458
14
        { "Prefix Length", "bgp.mup.nlri.prefixlen", FT_UINT8,
14459
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14460
14
      { &hf_bgp_mup_nlri_ip_prefix,
14461
14
        { "IPv4 Prefix", "bgp.mup.nlri.ip_prefix", FT_IPv4,
14462
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14463
14
      { &hf_bgp_mup_nlri_ipv6_prefix,
14464
14
        { "IPv6 Prefix", "bgp.mup.nlri.ipv6_prefix", FT_IPv6,
14465
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14466
14
      { &hf_bgp_mup_nlri_ip_addr,
14467
14
        { "IPv4 Address", "bgp.mup.nlri.ip_addr", FT_IPv4,
14468
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14469
14
      { &hf_bgp_mup_nlri_ipv6_addr,
14470
14
        { "IPv6 Address", "bgp.mup.nlri.ipv6_addr", FT_IPv6,
14471
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14472
14
      { &hf_bgp_mup_nlri_3gpp_5g_teid,
14473
14
        { "TEID", "bgp.mup.nlri.3gpp_5g.teid", FT_UINT32,
14474
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14475
14
      { &hf_bgp_mup_nlri_3gpp_5g_qfi,
14476
14
        { "QFI", "bgp.mup.nlri.3gpp_5g.qfi", FT_UINT8,
14477
14
          BASE_HEX, NULL, 0x0, NULL, HFILL}},
14478
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_addr_len,
14479
14
        { "Endpoint Length", "bgp.mup.nlri.3gpp_5g.ep.len", FT_UINT8,
14480
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14481
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_ip_addr,
14482
14
        { "Endpoint Address", "bgp.mup.nlri.3gpp_5g.ep.ip_addr", FT_IPv4,
14483
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14484
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_ipv6_addr,
14485
14
        { "Endpoint Address", "bgp.mup.nlri.3gpp_5g.ep.ipv6_addr", FT_IPv6,
14486
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14487
14
      { &hf_bgp_mup_nlri_3gpp_5g_source_addr_len,
14488
14
        { "Source Address Length", "bgp.mup.nlri.3gpp_5g.source.len", FT_UINT8,
14489
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14490
14
      { &hf_bgp_mup_nlri_3gpp_5g_source_ip_addr,
14491
14
        { "Source Address", "bgp.mup.nlri.3gpp_5g.source.ip_addr", FT_IPv4,
14492
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14493
14
      { &hf_bgp_mup_nlri_3gpp_5g_source_ipv6_addr,
14494
14
        { "Source Address", "bgp.mup.nlri.3gpp_5g.source.ipv6_addr", FT_IPv6,
14495
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14496
14
      { &hf_bgp_mup_nlri_ep_len,
14497
14
        { "Endpoint Length", "bgp.mup.nlri.ep.len", FT_UINT8,
14498
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14499
14
      { &hf_bgp_mup_nlri_ep_ip_addr,
14500
14
        { "Endpoint Address", "bgp.mup.nlri.ep.ip_addr", FT_IPv4,
14501
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14502
14
      { &hf_bgp_mup_nlri_ep_ipv6_addr,
14503
14
        { "Endpoint Address", "bgp.mup.nlri.ep.ipv6_addr", FT_IPv6,
14504
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14505
14
      { &hf_bgp_mup_nlri_3gpp_5g_ep_teid,
14506
14
        { "Endpoint TEID", "bgp.mup.nlri.3gpp_5g.ep.teid", FT_UINT32,
14507
14
          BASE_DEC, NULL, 0x0, NULL, HFILL}},
14508
14
      { &hf_bgp_mup_nlri_3gpp_5g_type1_st_route,
14509
14
        { "3gpp-5g specific Type 1 ST route", "bgp.mup.nlri.3gpp_5g.type1_st_route", FT_NONE,
14510
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14511
14
      { &hf_bgp_mup_nlri_3gpp_5g_type2_st_route,
14512
14
        { "3gpp-5g specific Type 2 ST route", "bgp.mup.nlri.3gpp_5g.type2_st_route", FT_NONE,
14513
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14514
14
      { &hf_bgp_mup_nlri_unknown_data,
14515
14
        { "Unknown Data", "bgp.mup.nlri.unknown_data", FT_BYTES,
14516
14
          BASE_NONE, NULL, 0x0, NULL, HFILL}},
14517
14
};
14518
14519
14
    static int *ett[] = {
14520
14
      &ett_bgp,
14521
14
      &ett_bgp_prefix,
14522
14
      &ett_bgp_unfeas,
14523
14
      &ett_bgp_attrs,
14524
14
      &ett_bgp_attr,
14525
14
      &ett_bgp_attr_flags,
14526
14
      &ett_bgp_mp_nhna,
14527
14
      &ett_bgp_mp_reach_nlri,
14528
14
      &ett_bgp_mp_unreach_nlri,
14529
14
      &ett_bgp_mp_snpa,
14530
14
      &ett_bgp_nlri,
14531
14
      &ett_bgp_open,
14532
14
      &ett_bgp_update,
14533
14
      &ett_bgp_notification,
14534
14
      &ett_bgp_route_refresh,
14535
14
      &ett_bgp_capability,
14536
14
      &ett_bgp_as_path_segment,
14537
14
      &ett_bgp_as_path_segment_asn,
14538
14
      &ett_bgp_communities,
14539
14
      &ett_bgp_community,
14540
14
      &ett_bgp_cluster_list,
14541
14
      &ett_bgp_options,
14542
14
      &ett_bgp_option,
14543
14
      &ett_bgp_options_ext,
14544
14
      &ett_bgp_cap,
14545
14
      &ett_bgp_extended_communities,
14546
14
      &ett_bgp_extended_community,
14547
14
      &ett_bgp_ext_com_type,
14548
14
      &ett_bgp_extended_com_fspec_redir,
14549
14
      &ett_bgp_ext_com_flags,
14550
14
      &ett_bgp_ext_com_l2_flags,
14551
14
      &ett_bgp_ext_com_etree_flags,
14552
14
      &ett_bgp_ext_com_evpn_mmac_flags,
14553
14
      &ett_bgp_ext_com_evpn_l2attr_flags,
14554
14
      &ett_bgp_ext_com_evpn_etree_flags,
14555
14
      &ett_bgp_ext_com_cost_cid,
14556
14
      &ett_bgp_ext_com_ospf_rt_opt,
14557
14
      &ett_bgp_ext_com_eigrp_flags,
14558
14
      &ett_bgp_ssa,
14559
14
      &ett_bgp_ssa_subtree,
14560
14
      &ett_bgp_orf,
14561
14
      &ett_bgp_orf_entry,
14562
14
      &ett_bgp_mcast_vpn_nlri,
14563
14
      &ett_bgp_flow_spec_nlri,
14564
14
      &ett_bgp_flow_spec_nlri_filter,
14565
14
      &ett_bgp_flow_spec_nlri_op_flags,
14566
14
      &ett_bgp_flow_spec_nlri_tcp,
14567
14
      &ett_bgp_flow_spec_nlri_ff,
14568
14
      &ett_bgp_tunnel_tlv,
14569
14
      &ett_bgp_tunnel_tlv_subtree,
14570
14
      &ett_bgp_tunnel_subtlv,
14571
14
      &ett_bgp_tunnel_subtlv_subtree,
14572
14
      &ett_bgp_link_state,
14573
14
      &ett_bgp_evpn_nlri,
14574
14
      &ett_bgp_evpn_nlri_esi,
14575
14
      &ett_bgp_evpn_nlri_mc,
14576
14
      &ett_bgp_mpls_labels,
14577
14
      &ett_bgp_pmsi_tunnel_id,
14578
14
      &ett_bgp_aigp_attr,
14579
14
      &ett_bgp_large_communities,
14580
14
      &ett_bgp_dpath,
14581
14
      &ett_bgp_prefix_sid_label_index,
14582
14
      &ett_bgp_prefix_sid_ipv6,
14583
14
      &ett_bgp_prefix_sid_originator_srgb,
14584
14
      &ett_bgp_prefix_sid_originator_srgb_block,
14585
14
      &ett_bgp_prefix_sid_originator_srgb_blocks,
14586
14
      &ett_bgp_bgpsec_secure_path,
14587
14
      &ett_bgp_bgpsec_secure_path_segment,
14588
14
      &ett_bgp_bgpsec_signature_block,
14589
14
      &ett_bgp_bgpsec_signature_segment,
14590
14
      &ett_bgp_vxlan,
14591
14
      &ett_bgp_binding_sid,
14592
14
      &ett_bgp_segment_list,
14593
14
      &ett_bgp_prefix_sid_unknown,
14594
14
      &ett_bgp_prefix_sid_srv6_l3vpn,
14595
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sub_tlvs,
14596
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_information,
14597
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sub_sub_tlvs,
14598
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_structure,
14599
14
      &ett_bgp_prefix_sid_srv6_l3vpn_sid_unknown,
14600
14
      &ett_bgp_prefix_sid_srv6_l3vpn_unknown,
14601
14
      &ett_bgp_prefix_sid_srv6_l2vpn,
14602
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sub_tlvs,
14603
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_information,
14604
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sub_sub_tlvs,
14605
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_structure,
14606
14
      &ett_bgp_prefix_sid_srv6_l2vpn_sid_unknown,
14607
14
      &ett_bgp_prefix_sid_srv6_l2vpn_unknown,
14608
14
      &ett_bgp_mup_nlri,
14609
14
      &ett_bgp_mup_nlri_3gpp_5g_type1_st_route,
14610
14
      &ett_bgp_mup_nlri_3gpp_5g_type2_st_route,
14611
14
    };
14612
14
    static ei_register_info ei[] = {
14613
14
        { &ei_bgp_marker_invalid, { "bgp.marker_invalid", PI_MALFORMED, PI_ERROR, "Marker is not all ones", EXPFILL }},
14614
14
        { &ei_bgp_cap_len_bad, { "bgp.cap.length.bad", PI_MALFORMED, PI_ERROR, "Capability length is wrong", EXPFILL }},
14615
14
        { &ei_bgp_cap_gr_helper_mode_only, { "bgp.cap.gr.helper_mode_only", PI_REQUEST_CODE, PI_CHAT, "Graceful Restart Capability supported in Helper mode only", EXPFILL }},
14616
14
        { &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }},
14617
14
        { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_UNDECODED, PI_WARN, "unknown ORF type", EXPFILL }},
14618
14
        { &ei_bgp_route_refresh_orf_type_unsupported, { "bgp.route_refresh.orf.type.unsupported", PI_UNDECODED, PI_WARN, "ORF type: decoding not supported", EXPFILL }},
14619
14
        { &ei_bgp_route_refresh_orf_type_unregistered, { "bgp.route_refresh.orf.type.unregistered", PI_MALFORMED, PI_ERROR, "ORF type: unregistered/non-IANA value", EXPFILL }},
14620
14
        { &ei_bgp_route_refresh_orf_action_invalid, { "bgp.route_refresh.orf.action.invalid", PI_MALFORMED, PI_ERROR, "ORF action: invalid value", EXPFILL }},
14621
14
        { &ei_bgp_length_invalid, { "bgp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
14622
14
        { &ei_bgp_prefix_length_invalid, { "bgp.prefix_length.invalid", PI_MALFORMED, PI_ERROR, "Prefix length is invalid", EXPFILL }},
14623
14
        { &ei_bgp_afi_type_not_supported, { "bgp.afi_type_not_supported", PI_PROTOCOL, PI_ERROR, "AFI Type not supported", EXPFILL }},
14624
14
        { &ei_bgp_unknown_afi, { "bgp.unknown_afi", PI_PROTOCOL, PI_ERROR, "Unknown Address Family", EXPFILL }},
14625
14
        { &ei_bgp_unknown_safi, { "bgp.unknown_safi", PI_PROTOCOL, PI_ERROR, "Unknown SAFI", EXPFILL }},
14626
14
        { &ei_bgp_unknown_label_vpn, { "bgp.unknown_label", PI_PROTOCOL, PI_ERROR, "Unknown Label VPN", EXPFILL }},
14627
14
        { &ei_bgp_ls_error, { "bgp.ls.error", PI_PROTOCOL, PI_ERROR, "Link State error", EXPFILL }},
14628
14
        { &ei_bgp_ls_warn, { "bgp.ls.warn", PI_PROTOCOL, PI_WARN, "Link State warning", EXPFILL }},
14629
14
        { &ei_bgp_ext_com_len_bad, { "bgp.ext_com.length.bad", PI_PROTOCOL, PI_ERROR, "Extended community length is wrong", EXPFILL }},
14630
14
        { &ei_bgp_evpn_nlri_rt_type_err, { "bgp.evpn.type", PI_MALFORMED, PI_ERROR, "EVPN Route Type is invalid", EXPFILL }},
14631
14
        { &ei_bgp_evpn_nlri_rt_len_err, { "bgp.evpn.len", PI_MALFORMED, PI_ERROR, "EVPN Length is invalid", EXPFILL }},
14632
14
        { &ei_bgp_evpn_nlri_esi_type_err, { "bgp.evpn.esi_type", PI_MALFORMED, PI_ERROR, "EVPN ESI Type is invalid", EXPFILL }},
14633
14
        { &ei_bgp_evpn_nlri_rt4_no_ip, { "bgp.evpn.no_ip", PI_PROTOCOL, PI_NOTE, "IP Address: NOT INCLUDED", EXPFILL }},
14634
14
        { &ei_bgp_attr_pmsi_tunnel_type, { "bgp.attr.pmsi.tunnel_type", PI_PROTOCOL, PI_ERROR, "Unknown Tunnel type", EXPFILL }},
14635
14
        { &ei_bgp_attr_pmsi_opaque_type, { "bgp.attr.pmsi.opaque_type", PI_PROTOCOL, PI_ERROR, "Invalid pmsi opaque type", EXPFILL }},
14636
14
        { &ei_bgp_attr_aigp_type, { "bgp.attr.aigp.type", PI_MALFORMED, PI_NOTE, "Unknown AIGP attribute type", EXPFILL}},
14637
14
        { &ei_bgp_prefix_length_err, { "bgp.prefix.length", PI_MALFORMED, PI_ERROR, "Invalid IPv6 prefix length", EXPFILL}},
14638
14
        { &ei_bgp_attr_as_path_as_len_err, { "bgp.attr.as_path.as_len", PI_UNDECODED, PI_ERROR, "unable to determine 4 or 2 bytes ASN", EXPFILL}},
14639
14
        { &ei_bgp_next_hop_ipv6_scope, { "bgp.next_hop.ipv6.scope", PI_PROTOCOL, PI_WARN, "Invalid IPv6 address scope", EXPFILL}},
14640
14
        { &ei_bgp_next_hop_rd_nonzero, { "bgp.next_hop.rd.nonzero", PI_PROTOCOL, PI_WARN, "Route Distinguisher in Next Hop Network Address nonzero", EXPFILL}},
14641
14
        { &ei_bgp_mup_unknown_at, { "bgp.mup.unknown_at", PI_PROTOCOL, PI_ERROR, "Unknown architecture type", EXPFILL }},
14642
14
        { &ei_bgp_mup_unknown_rt, { "bgp.mup.unknown_rt", PI_PROTOCOL, PI_ERROR, "Unknown route type", EXPFILL }},
14643
14
        { &ei_bgp_mup_nlri_addr_len_err, { "bgp.mup.nlri.addr_len_err", PI_PROTOCOL, PI_ERROR, "Address length invalid", EXPFILL }},
14644
14
    };
14645
14646
14
    module_t *bgp_module;
14647
14
    expert_module_t* expert_bgp;
14648
14649
14
    static const enum_val_t asn_len[] = {
14650
14
        {"auto-detect", "Auto-detect", 0},
14651
14
        {"2", "2 octet", 2},
14652
14
        {"4", "4 octet", 4},
14653
14
        {NULL, NULL, -1}
14654
14
    };
14655
14656
14
    proto_bgp = proto_register_protocol("Border Gateway Protocol", "BGP", "bgp");
14657
14
    proto_register_field_array(proto_bgp, hf, array_length(hf));
14658
14
    proto_register_subtree_array(ett, array_length(ett));
14659
14
    expert_bgp = expert_register_protocol(proto_bgp);
14660
14
    expert_register_field_array(expert_bgp, ei, array_length(ei));
14661
14662
14
    bgp_module = prefs_register_protocol(proto_bgp, NULL);
14663
14
    prefs_register_bool_preference(bgp_module, "desegment",
14664
14
      "Reassemble BGP messages spanning multiple TCP segments",
14665
14
      "Whether the BGP dissector should reassemble messages spanning multiple TCP segments."
14666
14
      " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
14667
14
      &bgp_desegment);
14668
14
    prefs_register_enum_preference(bgp_module, "asn_len",
14669
14
      "Length of the AS number",
14670
14
      "BGP dissector detect the length of the AS number in AS_PATH attributes automatically or manually (NOTE: Automatic detection is not 100% accurate)",
14671
14
      &bgp_asn_len, asn_len, false);
14672
14673
14
    bgp_handle = register_dissector("bgp", dissect_bgp, proto_bgp);
14674
14
    register_dissector("bgp.pdu", dissect_bgp_pdu, proto_bgp);
14675
14
}
14676
14677
void
14678
proto_reg_handoff_bgp(void)
14679
14
{
14680
14
    dissector_add_uint_with_preference("tcp.port", BGP_TCP_PORT, bgp_handle);
14681
14
}
14682
/*
14683
* Editor modelines - https://www.wireshark.org/tools/modelines.html
14684
*
14685
* Local variables:
14686
* c-basic-offset: 4
14687
* tab-width: 8
14688
* indent-tabs-mode: nil
14689
* End:
14690
*
14691
* ex: set shiftwidth=4 tabstop=8 expandtab:
14692
* :indentSize=4:tabSize=8:noTabs=true:
14693
*/