Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-sflow.c
Line
Count
Source
1
/* packet-sflow.c
2
 * Routines for sFlow v5 dissection implemented according to the specifications
3
 * at http://www.sflow.org/sflow_version_5.txt
4
 *
5
 * Additional 802.11 structures support implemented according to the
6
 * specifications at http://www.sflow.org/sflow_80211.txt
7
 *
8
 * By Yi Yu <yiyu.inbox@gmail.com>
9
 *
10
 * TODO:
11
 *   802.11 aggregation data dissection                         (sFlow v5)
12
 *
13
 *
14
 * Based on Jeff Rizzo's <riz@boogers.sf.ca.us> dissector for sFlow v2/4
15
 * in Wireshark 1.0.8 public release.
16
 *
17
 * Wireshark - Network traffic analyzer
18
 * By Gerald Combs <gerald@wireshark.org>
19
 * Copyright 1998 Gerald Combs
20
 *
21
 * SPDX-License-Identifier: GPL-2.0-or-later
22
 *
23
 *
24
 * This file (mostly) implements a dissector for sFlow (RFC3176),
25
 * from the version 4 spec at http://www.sflow.org/SFLOW-DATAGRAM.txt .
26
 *
27
 * TODO:
28
 *   Fix the highlighting of the datastream when bits are selected
29
 *   split things out into packet-sflow.h ?
30
 *   make routines more consistent as to whether they return
31
 *     'offset' or bytes consumed ('len')                       (sFlow v2/4)
32
 *   implement sampled_ipv4 and sampled_ipv6 packet data types  (sFlow v2/4)
33
 *   implement extended_user                                    (sFlow v2/4)
34
 *   implement extended_url                                     (sFlow v2/4)
35
 *   implement non-generic counters sampling                    (sFlow v2/4)
36
 */
37
38
#include "config.h"
39
40
#include <epan/packet.h>
41
#include <epan/exceptions.h>
42
#include <epan/prefs.h>
43
#include <epan/expert.h>
44
#include <epan/to_str.h>
45
#include <epan/etypes.h>
46
#include <epan/tfs.h>
47
#include <epan/unit_strings.h>
48
49
#include <wsutil/array.h>
50
#include <wsutil/ws_roundup.h>
51
#include <wsutil/ws_padding_to.h>
52
53
#include "packet-sflow.h"
54
#include "packet-iana-data.h"
55
56
14
#define SFLOW_UDP_PORTS "6343"
57
58
void proto_register_sflow(void);
59
60
static dissector_handle_t sflow_handle;
61
62
/*
63
 *  sflow_245_ports : holds the currently used range of ports for sflow
64
 */
65
static bool global_dissect_samp_headers = true;
66
static bool global_analyze_samp_ip_headers;
67
68
0
#define ENTERPRISE_DEFAULT 0
69
70
0
#define ADDR_TYPE_UNKNOWN 0
71
0
#define ADDR_TYPE_IPV4    1
72
0
#define ADDR_TYPE_IPV6    2
73
74
0
#define FLOWSAMPLE 1
75
0
#define COUNTERSSAMPLE 2
76
0
#define EXPANDED_FLOWSAMPLE 3
77
0
#define EXPANDED_COUNTERSSAMPLE 4
78
0
#define LAG_PORT_STATS 7
79
80
static const value_string sflow_agent_address_types[] = {
81
    { ADDR_TYPE_IPV4, "IPv4" },
82
    { ADDR_TYPE_IPV6, "IPv6" },
83
    { 0, NULL }
84
};
85
86
static const value_string sflow_245_sampletype[] = {
87
    { FLOWSAMPLE,              "Flow sample"},
88
    { COUNTERSSAMPLE,          "Counters sample"},
89
    { EXPANDED_FLOWSAMPLE,     "Expanded flow sample"},
90
    { EXPANDED_COUNTERSSAMPLE, "Expanded counters sample"},
91
    { LAG_PORT_STATS,          "Lag Port stats"},
92
    { 0, NULL}
93
};
94
95
#define SFLOW_5_IEEE80211_VERSION_A 1
96
#define SFLOW_5_IEEE80211_VERSION_B 2
97
#define SFLOW_5_IEEE80211_VERSION_G 3
98
#define SFLOW_5_IEEE80211_VERSION_N 4
99
100
static const value_string sflow_5_ieee80211_versions [] = {
101
    { SFLOW_5_IEEE80211_VERSION_A, "802.11a"},
102
    { SFLOW_5_IEEE80211_VERSION_B, "802.11b"},
103
    { SFLOW_5_IEEE80211_VERSION_G, "802.11g"},
104
    { SFLOW_5_IEEE80211_VERSION_N, "802.11n"},
105
    { 0, NULL}
106
};
107
108
/* interface counter types */
109
0
#define SFLOW_245_COUNTERS_GENERIC 1
110
0
#define SFLOW_245_COUNTERS_ETHERNET 2
111
0
#define SFLOW_245_COUNTERS_TOKENRING 3
112
0
#define SFLOW_245_COUNTERS_FDDI 4
113
0
#define SFLOW_245_COUNTERS_VG 5
114
0
#define SFLOW_245_COUNTERS_WAN 6
115
0
#define SFLOW_245_COUNTERS_VLAN 7
116
117
static const value_string sflow_245_counterstype[] = {
118
    { SFLOW_245_COUNTERS_GENERIC,  "Generic counters"},
119
    { SFLOW_245_COUNTERS_ETHERNET, "Ethernet counters"},
120
    { SFLOW_245_COUNTERS_TOKENRING,"Token Ring counters"},
121
    { SFLOW_245_COUNTERS_FDDI,     "FDDI counters"},
122
    { SFLOW_245_COUNTERS_VG,       "100baseVG counters"},
123
    { SFLOW_245_COUNTERS_WAN,      "WAN counters"},
124
    { SFLOW_245_COUNTERS_VLAN,     "VLAN counters"},
125
    { 0, NULL}
126
};
127
128
#define MAX_HEADER_SIZE 256
129
130
0
#define SFLOW_245_PACKET_DATA_TYPE_HEADER 1
131
0
#define SFLOW_245_PACKET_DATA_TYPE_IPV4 2
132
0
#define SFLOW_245_PACKET_DATA_TYPE_IPV6 3
133
134
static const value_string sflow_245_packet_information_type[] = {
135
    { SFLOW_245_PACKET_DATA_TYPE_HEADER, "Packet headers are sampled"},
136
    { SFLOW_245_PACKET_DATA_TYPE_IPV4,   "IP Version 4 data"},
137
    { SFLOW_245_PACKET_DATA_TYPE_IPV6,   "IP Version 6 data"},
138
    { 0, NULL}
139
};
140
141
static const value_string extended_80211_suite_type_vals[] = {
142
    { 0, "Use group cipher suite"},
143
    { 1, "WEP-40"},
144
    { 2, "TKIP"},
145
    { 4, "CCMP"},
146
    { 5, "WEP-104"},
147
    { 0, NULL}
148
};
149
150
static const value_string sflow_ifdirection_vals[] = {
151
    { 1, "Full-Duplex"},
152
    { 2, "Half-Duplex"},
153
    { 3, "In"},
154
    { 4, "Out"},
155
    { 0, NULL}
156
};
157
158
static const true_false_string tfs_minimize_monetary_normal = { "Minimize Monetary", "Normal" };
159
160
static const value_string sflow_245_header_protocol[] = {
161
    { SFLOW_245_HEADER_ETHERNET,           "Ethernet"},
162
    { SFLOW_245_HEADER_TOKENBUS,           "Token Bus"},
163
    { SFLOW_245_HEADER_TOKENRING,          "Token Ring"},
164
    { SFLOW_245_HEADER_FDDI,               "FDDI"},
165
    { SFLOW_245_HEADER_FRAME_RELAY,        "Frame Relay"},
166
    { SFLOW_245_HEADER_X25,                "X.25"},
167
    { SFLOW_245_HEADER_PPP,                "PPP"},
168
    { SFLOW_245_HEADER_SMDS,               "SMDS"},
169
    { SFLOW_245_HEADER_AAL5,               "ATM AAL5"},
170
    { SFLOW_245_HEADER_AAL5_IP,            "ATM AAL5-IP (e.g., Cisco AAL5 mux)"},
171
    { SFLOW_245_HEADER_IPv4,               "IPv4"},
172
    { SFLOW_245_HEADER_IPv6,               "IPv6"},
173
    { SFLOW_245_HEADER_MPLS,               "MPLS"},
174
    { SFLOW_5_HEADER_POS,                  "PPP over SONET/SDH (RFC 1662, 2615)"},
175
    { SFLOW_5_HEADER_80211_MAC,            "802.11 MAC"},
176
    { SFLOW_5_HEADER_80211_AMPDU,          "802.11n Aggregated MPDU"},
177
    { SFLOW_5_HEADER_80211_AMSDU_SUBFRAME, "A-MSDU Subframe"},
178
    { 0, NULL}
179
};
180
static value_string_ext sflow_245_header_protocol_ext = VALUE_STRING_EXT_INIT(sflow_245_header_protocol);
181
182
/* extended packet data types */
183
0
#define SFLOW_245_EXTENDED_SWITCH 1
184
0
#define SFLOW_245_EXTENDED_ROUTER 2
185
0
#define SFLOW_245_EXTENDED_GATEWAY 3
186
0
#define SFLOW_245_EXTENDED_USER 4
187
0
#define SFLOW_245_EXTENDED_URL 5
188
189
static const value_string sflow_245_extended_data_types[] = {
190
    { SFLOW_245_EXTENDED_SWITCH, "Extended switch information"},
191
    { SFLOW_245_EXTENDED_ROUTER, "Extended router information"},
192
    { SFLOW_245_EXTENDED_GATEWAY, "Extended gateway information"},
193
    { SFLOW_245_EXTENDED_USER, "Extended user information"},
194
    { SFLOW_245_EXTENDED_URL, "Extended URL information"},
195
    { 0, NULL}
196
};
197
198
199
#define SFLOW_245_AS_SET 1
200
#define SFLOW_245_AS_SEQUENCE 2
201
202
static const value_string sflow_245_as_types[] = {
203
    { SFLOW_245_AS_SET, "AS Set"},
204
    { SFLOW_245_AS_SEQUENCE, "AS Sequence"},
205
    { 0, NULL}
206
};
207
208
#define SFLOW_245_IPV4_PRECEDENCE_ROUTINE 0
209
#define SFLOW_245_IPV4_PRECEDENCE_PRIORITY 1
210
#define SFLOW_245_IPV4_PRECEDENCE_IMMEDIATE 2
211
#define SFLOW_245_IPV4_PRECEDENCE_FLASH 3
212
#define SFLOW_245_IPV4_PRECEDENCE_FLASH_OVERRIDE 4
213
#define SFLOW_245_IPV4_PRECEDENCE_CRITIC_ECP 5
214
#define SFLOW_245_IPV4_PRECEDENCE_INTERNETWORK_CONTROL 6
215
#define SFLOW_245_IPV4_PRECEDENCE_NETWORK_CONTROL 7
216
217
static const value_string sflow_245_ipv4_precedence_types[] = {
218
    { SFLOW_245_IPV4_PRECEDENCE_ROUTINE, "Routine"},
219
    { SFLOW_245_IPV4_PRECEDENCE_PRIORITY, "Priority"},
220
    { SFLOW_245_IPV4_PRECEDENCE_IMMEDIATE, "Immediate"},
221
    { SFLOW_245_IPV4_PRECEDENCE_FLASH, "Flash"},
222
    { SFLOW_245_IPV4_PRECEDENCE_FLASH_OVERRIDE, "Flash Override"},
223
    { SFLOW_245_IPV4_PRECEDENCE_CRITIC_ECP, "CRITIC/ECP"},
224
    { SFLOW_245_IPV4_PRECEDENCE_INTERNETWORK_CONTROL, "Internetwork Control"},
225
    { SFLOW_245_IPV4_PRECEDENCE_NETWORK_CONTROL, "Network Control"},
226
    { 0, NULL}
227
};
228
229
/* sFlow v5 flow record formats */
230
0
#define SFLOW_5_RAW_PACKET_HEADER    1
231
0
#define SFLOW_5_ETHERNET_FRAME       2
232
0
#define SFLOW_5_IPV4                 3
233
0
#define SFLOW_5_IPV6                 4
234
0
#define SFLOW_5_SWITCH            1001
235
0
#define SFLOW_5_ROUTER            1002
236
0
#define SFLOW_5_GATEWAY           1003
237
0
#define SFLOW_5_USER              1004
238
0
#define SFLOW_5_URL               1005
239
0
#define SFLOW_5_MPLS_DATA         1006
240
0
#define SFLOW_5_NAT               1007
241
0
#define SFLOW_5_MPLS_TUNNEL       1008
242
0
#define SFLOW_5_MPLS_VC           1009
243
0
#define SFLOW_5_MPLS_FEC          1010
244
0
#define SFLOW_5_MPLS_LVP_FEC      1011
245
0
#define SFLOW_5_VLAN_TUNNEL       1012
246
0
#define SFLOW_5_80211_PAYLOAD     1013
247
0
#define SFLOW_5_80211_RX          1014
248
0
#define SFLOW_5_80211_TX          1015
249
0
#define SFLOW_5_80211_AGGREGATION 1016
250
251
252
static const value_string sflow_5_flow_record_type[] = {
253
    { SFLOW_5_RAW_PACKET_HEADER, "Raw packet header"},
254
    { SFLOW_5_ETHERNET_FRAME,    "Ethernet frame data"},
255
    { SFLOW_5_IPV4,              "IPv4 data"},
256
    { SFLOW_5_IPV6,              "IPv6 data"},
257
    { SFLOW_5_SWITCH,            "Extended switch data"},
258
    { SFLOW_5_ROUTER,            "Extended router data"},
259
    { SFLOW_5_GATEWAY,           "Extended gateway data"},
260
    { SFLOW_5_USER,              "Extended user data"},
261
    { SFLOW_5_URL,               "Extended URL data"},
262
    { SFLOW_5_MPLS_DATA,         "Extended MPLS data"},
263
    { SFLOW_5_NAT,               "Extended NAT data"},
264
    { SFLOW_5_MPLS_TUNNEL,       "Extended MPLS tunnel data"},
265
    { SFLOW_5_MPLS_VC,           "Extended MPLS VC data"},
266
    { SFLOW_5_MPLS_FEC,          "Extended MPLS FEC data"},
267
    { SFLOW_5_MPLS_LVP_FEC,      "Extended MPLS LVP FEC data"},
268
    { SFLOW_5_VLAN_TUNNEL,       "Extended VLAN tunnel"},
269
    { SFLOW_5_80211_PAYLOAD,     "Extended 802.11 payload"},
270
    { SFLOW_5_80211_RX,          "Extended 802.11 RX"},
271
    { SFLOW_5_80211_TX,          "Extended 802.11 TX"},
272
    { SFLOW_5_80211_AGGREGATION, "Extended 802.11 aggregation"},
273
    { 0, NULL}
274
};
275
static value_string_ext sflow_5_flow_record_type_ext = VALUE_STRING_EXT_INIT(sflow_5_flow_record_type);
276
277
/* sFlow v5 counters record formats */
278
0
#define SFLOW_5_GENERIC_INTERFACE 1
279
0
#define SFLOW_5_ETHERNET_INTERFACE 2
280
0
#define SFLOW_5_TOKEN_RING 3
281
0
#define SFLOW_5_100BASE_VG_INTERFACE 4
282
0
#define SFLOW_5_VLAN 5
283
0
#define SFLOW_5_80211_COUNTERS 6
284
0
#define SFLOW_5_LAG 7
285
0
#define SFLOW_5_PROCESSOR 1001
286
0
#define SFLOW_5_RADIO_UTILIZATION 1002
287
288
static const value_string sflow_5_counters_record_type[] = {
289
    { SFLOW_5_GENERIC_INTERFACE,    "Generic interface counters"},
290
    { SFLOW_5_ETHERNET_INTERFACE,   "Ethernet interface counters"},
291
    { SFLOW_5_TOKEN_RING,           "Token ring counters"},
292
    { SFLOW_5_100BASE_VG_INTERFACE, "100 Base VG interface counters"},
293
    { SFLOW_5_VLAN,                 "VLAN counters"},
294
    { SFLOW_5_LAG,                  "LAG counters"},
295
    { SFLOW_5_80211_COUNTERS,       "IEEE 802.11 counters"},
296
    { SFLOW_5_PROCESSOR,            "Processor information"},
297
    { SFLOW_5_RADIO_UTILIZATION,    "Radio utilization"},
298
    { 0, NULL}
299
};
300
301
/* sFlow v5 interface formats */
302
14
#define SFLOW_5_INT_FORMAT 0xC0000000
303
28
#define SFLOW_5_INT_VALUE  0x3FFFFFFF
304
305
0
#define SFLOW_5_INT_FORMAT_IFINDEX  0
306
0
#define SFLOW_5_INT_FORMAT_DISCARD  1
307
0
#define SFLOW_5_INT_FORMAT_MULTIPLE 2
308
309
static const value_string interface_format[] = {
310
    { SFLOW_5_INT_FORMAT_IFINDEX,       "ifindex"},
311
    { SFLOW_5_INT_FORMAT_DISCARD,       "packet discarded"},
312
    { SFLOW_5_INT_FORMAT_MULTIPLE,      "multiple interfaces"},
313
    { 0, NULL}
314
};
315
316
static const value_string interface_discard[] = {
317
    {   0, "Net Unreachable"},
318
    {   1, "Host Unreachable"},
319
    {   2, "Protocol Unreachable"},
320
    {   3, "Port Unreachable"},
321
    {   4, "Fragmentation Needed and Don't Fragment was Set"},
322
    {   5, "Source Route Failed"},
323
    {   6, "Destination Network Unknown"},
324
    {   7, "Destination Host Unknown"},
325
    {   8, "Source Host Isolated"},
326
    {   9, "Communication with Destination Network is Administratively Prohibited"},
327
    {  10, "Communication with Destination Host is Administratively Prohibited"},
328
    {  11, "Destination Network Unreachable for Type of Service"},
329
    {  12, "Destination Host Unreachable for Type of Service"},
330
    {  13, "Communication Administratively Prohibited"},
331
    {  14, "Host Precedence Violation"},
332
    {  15, "Precedence cutoff in effect"},
333
    { 256, "unknown"},
334
    { 257, "ttl exceeded"},
335
    { 258, "ACL"},
336
    { 259, "no buffer space"},
337
    { 260, "RED"},
338
    { 261, "traffic shaping/rate limiting"},
339
    { 262, "packet too big (for protocols that don't support fragmentation)"},
340
    { 263, "Source MAC is multicast"},
341
    { 264, "VLAN tag mismatch"},
342
    { 265, "Ingress VLAN filter"},
343
    { 266, "Ingress spanning tree filter"},
344
    { 267, "Port list is empty"},
345
    { 268, "Port loopback filter"},
346
    { 269, "Blackhole route"},
347
    { 270, "Non IP"},
348
    { 271, "Unicast destination IP over multicast destination MAC"},
349
    { 272, "Destination IP is loopback address"},
350
    { 273, "Source IP is multicast"},
351
    { 274, "Source IP is looback address"},
352
    { 275, "IP header corrupted"},
353
    { 276, "IPv4 source address is limited broadcast"},
354
    { 277, "IPv6 multicast destination IP reserved scope"},
355
    { 278, "IPv6 multicast destination IP interface local scope"},
356
    { 279, "Unresolved neighbor"},
357
    { 280, "Multicast reverse path forwarding"},
358
    { 281, "Non routable packet"},
359
    { 282, "Decap error"},
360
    { 283, "Overlay source MAC is multicast"},
361
    { 284, "Unknown L2"},
362
    { 285, "Unknown L3"},
363
    { 286, "Unknown L3 exception"},
364
    { 287, "Unknown buffer"},
365
    { 288, "Unknown tunnel"},
366
    { 289, "Unknown L4"},
367
    { 290, "Source IP in unspecified"},
368
    { 291, "Mlag port isolation"},
369
    { 292, "Blackhole ARP neighbor"},
370
    { 293, "Source MAC is destination MAC"},
371
    { 294, "Destination MAC is reserved"},
372
    { 295, "Source IP class E"},
373
    { 296, "Multicast destination MAC mismatch"},
374
    { 297, "Source IP is destination IP"},
375
    { 298, "Destination IP is local network"},
376
    { 299, "Destination IP is link local"},
377
    { 300, "Overlay source MAC is destination MAC"},
378
    { 301, "Egress VLAN filter"},
379
    { 302, "Unicast reverse path forwarding"},
380
    { 303, "Split horizon"},
381
    { 304, "locked_port"},
382
    { 305, "dmac_filter"},
383
    { 306, "blackhole_nexthop"},
384
    { 307, "vxlan_parsing"},
385
    { 308, "llc_snap_parsing"},
386
    { 309, "vlan_parsing"},
387
    { 310, "pppoe_ppp_parsing"},
388
    { 311, "mpls_parsing"},
389
    { 312, "arp_parsing"},
390
    { 313, "ip_1_parsing"},
391
    { 314, "ip_n_parsing"},
392
    { 315, "gre_parsing"},
393
    { 316, "udp_parsing"},
394
    { 317, "tcp_parsing"},
395
    { 318, "ipsec_parsing"},
396
    { 319, "sctp_parsing"},
397
    { 320, "dccp_parsing"},
398
    { 321, "gtp_parsing"},
399
    { 322, "esp_parsing"},
400
    { 323, "unknown_parsing"},
401
    { 324, "pkt_too_small"},
402
    { 325, "unhandled_proto"},
403
    { 326, "ipv6disabled"},
404
    { 327, "invalid_proto"},
405
    { 328, "ip_noproto"},
406
    { 329, "skb_csum"},
407
    { 330, "skb_ucopy_fault"},
408
    { 331, "dev_ready"},
409
    { 332, "dev_hdr"},
410
    { 333, "dup_frag"},
411
    { 334, "skb_gso_seg"},
412
    { 335, "reverse_path_forwarding"},
413
    { 336, "icmp_parsing"},
414
    { 337, "tcp_md5notfound"},
415
    { 338, "tcp_md5unexpected"},
416
    { 339, "tcp_md5failure"},
417
    { 340, "tcp_flags"},
418
    { 341, "tcp_zerowindow"},
419
    { 342, "tcp_old_data"},
420
    { 343, "tcp_overwindow"},
421
    { 344, "tcp_ofomerge"},
422
    { 345, "tcp_rfc7323_paws"},
423
    { 346, "tcp_invalid_sequence"},
424
    { 347, "tcp_reset"},
425
    { 348, "tcp_invalid_syn"},
426
    { 349, "tcp_close"},
427
    { 350, "tcp_fastopen"},
428
    { 351, "tcp_old_ack"},
429
    { 352, "tcp_too_old_ack"},
430
    { 353, "tcp_ack_unsent_data"},
431
    { 354, "tcp_ofo_queue_prune"},
432
    { 355, "tcp_ofo_drop"},
433
    { 356, "tcp_minttl"},
434
    { 357, "ipv6_bad_exthdr"},
435
    { 358, "ipv6_ndisc_frag"},
436
    { 359, "ipv6_ndisc_hop_limit"},
437
    { 360, "ipv6_ndisc_bad_code"},
438
    { 361, "ipv6_ndisc_bad_options"},
439
    { 362, "ipv6_ndisc_ns_otherhost"},
440
    { 363, "tap_filter"},
441
    { 364, "tap_txfilter"},
442
    { 365, "tc_ingress"},
443
    { 366, "tc_egress"},
444
    { 367, "xdp"},
445
    { 368, "cpu_backlog"},
446
    { 369, "bpf_cgroup_egress"},
447
    { 370, "xfrm_policy"},
448
    { 371, "socket_filter"},
449
    { 372, "bgp_flowspec"},
450
    { 0, NULL}
451
};
452
453
/* ethernet counters.  These will be preceded by generic counters. */
454
struct ethernet_counters {
455
    uint32_t dot3StatsAlignmentErrors;
456
    uint32_t dot3StatsFCSErrors;
457
    uint32_t dot3StatsSingleCollisionFrames;
458
    uint32_t dot3StatsMultipleCollisionFrames;
459
    uint32_t dot3StatsSQETestErrors;
460
    uint32_t dot3StatsDeferredTransmissions;
461
    uint32_t dot3StatsLateCollisions;
462
    uint32_t dot3StatsExcessiveCollisions;
463
    uint32_t dot3StatsInternalMacTransmitErrors;
464
    uint32_t dot3StatsCarrierSenseErrors;
465
    uint32_t dot3StatsFrameTooLongs;
466
    uint32_t dot3StatsInternalMacReceiveErrors;
467
    uint32_t dot3StatsSymbolErrors;
468
};
469
470
struct sflow_address_type {
471
    int hf_addr_v4;
472
    int hf_addr_v6;
473
};
474
475
476
/* Initialize the protocol and registered fields */
477
static int proto_sflow;
478
static int hf_sflow_version;
479
static int hf_sflow_agent_address_type;
480
static int hf_sflow_agent_address_v4;
481
static int hf_sflow_agent_address_v6;
482
static int hf_sflow_5_sub_agent_id;
483
static int hf_sflow_5_sample_length;
484
static int hf_sflow_5_flow_data_length;
485
/* static int hf_sflow_5_counters_data_length; */
486
static int hf_sflow_245_seqnum;
487
static int hf_sflow_245_sysuptime;
488
static int hf_sflow_245_numsamples;
489
static int hf_sflow_245_header_protocol;
490
static int hf_sflow_245_sampletype;
491
static int hf_sflow_245_sampletype12;
492
static int hf_sflow_245_ipv4_precedence_type;
493
static int hf_sflow_5_flow_record_format;
494
static int hf_sflow_5_counters_record_format;
495
static int hf_sflow_245_header;
496
static int hf_sflow_245_packet_information_type;
497
static int hf_sflow_245_extended_information_type;
498
static int hf_sflow_245_vlan_in; /* incoming 802.1Q VLAN ID */
499
static int hf_sflow_245_vlan_out; /* outgoing 802.1Q VLAN ID */
500
static int hf_sflow_245_pri_in; /* incoming 802.1p priority */
501
static int hf_sflow_245_pri_out; /* outgoing 802.1p priority */
502
static int hf_sflow_245_nexthop_v4; /* nexthop address */
503
static int hf_sflow_245_nexthop_v6; /* nexthop address */
504
static int hf_sflow_245_ipv4_src;
505
static int hf_sflow_245_ipv4_dst;
506
static int hf_sflow_245_ipv6_src;
507
static int hf_sflow_245_ipv6_dst;
508
static int hf_sflow_245_nexthop_src_mask;
509
static int hf_sflow_245_nexthop_dst_mask;
510
511
512
/* extended gateway (all versions) */
513
static int hf_sflow_245_as;
514
static int hf_sflow_245_src_as;
515
static int hf_sflow_245_src_peer_as;
516
static int hf_sflow_245_dst_as_entries; /* aka length */
517
static int hf_sflow_245_dst_as;
518
/* extended gateway (>= version 4) */
519
static int hf_sflow_245_community_entries;
520
/* static int hf_sflow_245_community; */
521
static int hf_sflow_245_localpref;
522
523
/* generic interface counter */
524
static int hf_sflow_245_ifindex;
525
static int hf_sflow_245_iftype;
526
static int hf_sflow_245_ifspeed;
527
static int hf_sflow_245_ifdirection;
528
static int hf_sflow_245_ifadmin_status;
529
static int hf_sflow_245_ifoper_status;
530
static int hf_sflow_245_ifinoct;
531
static int hf_sflow_245_ifinpkt;
532
static int hf_sflow_245_ifinmcast;
533
static int hf_sflow_245_ifinbcast;
534
static int hf_sflow_245_ifinerr;
535
static int hf_sflow_245_ifindisc;
536
static int hf_sflow_245_ifinunk;
537
static int hf_sflow_245_ifoutoct;
538
static int hf_sflow_245_ifoutpkt;
539
static int hf_sflow_245_ifoutmcast;
540
static int hf_sflow_245_ifoutbcast;
541
static int hf_sflow_245_ifoutdisc;
542
static int hf_sflow_245_ifouterr;
543
static int hf_sflow_245_ifpromisc;
544
545
/* ethernet interface counter */
546
static int hf_sflow_245_dot3StatsAlignmentErrors;
547
static int hf_sflow_245_dot3StatsFCSErrors;
548
static int hf_sflow_245_dot3StatsSingleCollisionFrames;
549
static int hf_sflow_245_dot3StatsMultipleCollisionFrames;
550
static int hf_sflow_245_dot3StatsSQETestErrors;
551
static int hf_sflow_245_dot3StatsDeferredTransmissions;
552
static int hf_sflow_245_dot3StatsLateCollisions;
553
static int hf_sflow_245_dot3StatsExcessiveCollisions;
554
static int hf_sflow_245_dot3StatsInternalMacTransmitErrors;
555
static int hf_sflow_245_dot3StatsCarrierSenseErrors;
556
static int hf_sflow_245_dot3StatsFrameTooLongs;
557
static int hf_sflow_245_dot3StatsInternalMacReceiveErrors;
558
static int hf_sflow_245_dot3StatsSymbolErrors;
559
560
/* token ring counter */
561
static int hf_sflow_245_dot5StatsLineErrors;
562
static int hf_sflow_245_dot5StatsBurstErrors;
563
static int hf_sflow_245_dot5StatsACErrors;
564
static int hf_sflow_245_dot5StatsAbortTransErrors;
565
static int hf_sflow_245_dot5StatsInternalErrors;
566
static int hf_sflow_245_dot5StatsLostFrameErrors;
567
static int hf_sflow_245_dot5StatsReceiveCongestions;
568
static int hf_sflow_245_dot5StatsFrameCopiedErrors;
569
static int hf_sflow_245_dot5StatsTokenErrors;
570
static int hf_sflow_245_dot5StatsSoftErrors;
571
static int hf_sflow_245_dot5StatsHardErrors;
572
static int hf_sflow_245_dot5StatsSignalLoss;
573
static int hf_sflow_245_dot5StatsTransmitBeacons;
574
static int hf_sflow_245_dot5StatsRecoveries;
575
static int hf_sflow_245_dot5StatsLobeWires;
576
static int hf_sflow_245_dot5StatsRemoves;
577
static int hf_sflow_245_dot5StatsSingles;
578
static int hf_sflow_245_dot5StatsFreqErrors;
579
580
/* 100 BaseVG interface counters */
581
static int hf_sflow_245_dot12InHighPriorityFrames;
582
static int hf_sflow_245_dot12InHighPriorityOctets;
583
static int hf_sflow_245_dot12InNormPriorityFrames;
584
static int hf_sflow_245_dot12InNormPriorityOctets;
585
static int hf_sflow_245_dot12InIPMErrors;
586
static int hf_sflow_245_dot12InOversizeFrameErrors;
587
static int hf_sflow_245_dot12InDataErrors;
588
static int hf_sflow_245_dot12InNullAddressedFrames;
589
static int hf_sflow_245_dot12OutHighPriorityFrames;
590
static int hf_sflow_245_dot12OutHighPriorityOctets;
591
static int hf_sflow_245_dot12TransitionIntoTrainings;
592
static int hf_sflow_245_dot12HCInHighPriorityOctets;
593
static int hf_sflow_245_dot12HCInNormPriorityOctets;
594
static int hf_sflow_245_dot12HCOutHighPriorityOctets;
595
596
/* VLAN counters */
597
static int hf_sflow_245_vlan_id;
598
static int hf_sflow_245_octets;
599
static int hf_sflow_245_ucastPkts;
600
static int hf_sflow_245_multicastPkts;
601
static int hf_sflow_245_broadcastPkts;
602
static int hf_sflow_245_discards;
603
604
/* 802.11 interface counters */
605
static int hf_sflow_5_dot11TransmittedFragmentCount;
606
static int hf_sflow_5_dot11MulticastTransmittedFrameCount;
607
static int hf_sflow_5_dot11FailedCount;
608
static int hf_sflow_5_dot11RetryCount;
609
static int hf_sflow_5_dot11MultipleRetryCount;
610
static int hf_sflow_5_dot11FrameDuplicateCount;
611
static int hf_sflow_5_dot11RTSSuccessCount;
612
static int hf_sflow_5_dot11RTSFailureCount;
613
static int hf_sflow_5_dot11ACKFailureCount;
614
static int hf_sflow_5_dot11ReceivedFragmentCount;
615
static int hf_sflow_5_dot11MulticastReceivedFrameCount;
616
static int hf_sflow_5_dot11FCSErrorCount;
617
static int hf_sflow_5_dot11TransmittedFrameCount;
618
static int hf_sflow_5_dot11WEPUndecryptableCount;
619
static int hf_sflow_5_dot11QoSDiscardedFragmentCount;
620
static int hf_sflow_5_dot11AssociatedStationCount;
621
static int hf_sflow_5_dot11QoSCFPollsReceivedCount;
622
static int hf_sflow_5_dot11QoSCFPollsUnusedCount;
623
static int hf_sflow_5_dot11QoSCFPollsUnusableCount;
624
static int hf_sflow_5_dot11QoSCFPollsLostCount;
625
/* static int hf_sflow_5_ieee80211_version; */
626
627
628
/* processor information */
629
static int hf_sflow_5_cpu_5s;
630
static int hf_sflow_5_cpu_1m;
631
static int hf_sflow_5_cpu_5m;
632
static int hf_sflow_5_total_memory;
633
static int hf_sflow_5_free_memory;
634
635
/* radio utilisation */
636
static int hf_sflow_5_elapsed_time;
637
static int hf_sflow_5_on_channel_time;
638
static int hf_sflow_5_on_channel_busy_time;
639
640
/* Generated from convert_proto_tree_add_text.pl */
641
static int hf_sflow_5_extended_80211_suite_type;
642
static int hf_sflow_5_extended_80211_rx_channel;
643
static int hf_sflow_flow_sample_input_interface;
644
static int hf_sflow_counters_sample_sampling_interval;
645
static int hf_sflow_5_extended_url_host_length;
646
static int hf_sflow_245_ip_tcp_flag_syn;
647
static int hf_sflow_24_flow_sample_output_interface;
648
static int hf_sflow_5_flow_sample_output_interface;
649
static int hf_sflow_5_flow_sample_output_interface_form;
650
static int hf_sflow_5_flow_sample_output_interface_val;
651
static int hf_sflow_5_flow_sample_output_interface_val_discard;
652
static int hf_sflow_245_length_of_ip_packet;
653
static int hf_sflow_counters_sample_counters_type;
654
static int hf_sflow_5_extended_mpls_tunnel_id;
655
static int hf_sflow_flow_sample_sample_pool;
656
static int hf_sflow_5_extended_80211_tx_speed;
657
static int hf_sflow_5_extended_vlan_tunnel_tpid_tci_pair;
658
static int hf_sflow_245_extended_mpls_out_label_stack_entries;
659
static int hf_sflow_flow_sample_input_interface_value;
660
static int hf_sflow_flow_sample_sampling_rate;
661
static int hf_sflow_5_extended_80211_rx_rcpi;
662
static int hf_sflow_enterprise;
663
static int hf_sflow_enterprise_length;
664
static int hf_sflow_enterprise_data;
665
static int hf_sflow_245_header_frame_length;
666
static int hf_sflow_5_extended_user_destination_character_set;
667
static int hf_sflow_5_extended_80211_rx_bssid;
668
static int hf_sflow_5_extended_80211_tx_retransmission_duration;
669
static int hf_sflow_245_ethernet_length_of_mac_packet;
670
static int hf_sflow_245_ip_tcp_flag_psh;
671
static int hf_sflow_flow_sample_flow_record;
672
static int hf_sflow_245_extended_mpls_in_label;
673
static int hf_sflow_5_extended_user_source_character_set;
674
static int hf_sflow_5_extended_user_destination_user_string_length;
675
static int hf_sflow_counters_sample_sequence_number;
676
static int hf_sflow_5_extended_80211_rx_speed;
677
static int hf_sflow_5_extended_80211_rx_rsni;
678
static int hf_sflow_flow_sample_source_id_index;
679
static int hf_sflow_245_ip_tcp_flag_ece;
680
static int hf_sflow_245_ipv4_throughput;
681
static int hf_sflow_5_extended_80211_oui;
682
static int hf_sflow_counters_sample_source_id_type;
683
static int hf_sflow_flow_sample_input_interface_format;
684
static int hf_sflow_5_extended_80211_tx_channel;
685
static int hf_sflow_245_ip_tcp_flag_urg;
686
static int hf_sflow_5_extended_mpls_tunnel_name_length;
687
static int hf_sflow_5_extended_80211_tx_version;
688
static int hf_sflow_245_ipv4_delay;
689
static int hf_sflow_flow_sample_source_id_class;
690
static int hf_sflow_245_ethernet_source_mac_address;
691
static int hf_sflow_5_extended_mpls_ftn_mask;
692
static int hf_sflow_245_extended_mpls_out_label;
693
static int hf_sflow_245_ipv6_priority;
694
static int hf_sflow_245_ip_tcp_flag_fin;
695
static int hf_sflow_245_ip_destination_port;
696
static int hf_sflow_5_extended_mpls_vc_label_cos_value;
697
static int hf_sflow_5_extended_80211_rx_packet_duration;
698
static int hf_sflow_5_extended_80211_tx_packet_duration;
699
static int hf_sflow_245_ipv4_reliability;
700
static int hf_sflow_5_extended_80211_tx_power;
701
static int hf_sflow_24_flow_sample_multiple_outputs;
702
static int hf_sflow_5_extended_user_source_user_string_length;
703
static int hf_sflow_5_extended_80211_payload_length;
704
static int hf_sflow_5_flow_sample_output_interface_expanded_format;
705
static int hf_sflow_245_ethernet_packet_type;
706
static int hf_sflow_counters_sample_expanded_source_id_type;
707
static int hf_sflow_245_ip_source_port;
708
static int hf_sflow_245_extended_mpls_in_label_stack_entries;
709
static int hf_sflow_5_extended_mpls_vc_instance_name_length;
710
static int hf_sflow_245_ipv4_cost;
711
static int hf_sflow_5_extended_mpls_ftn_description_length;
712
static int hf_sflow_5_extended_vlan_tunnel_number_of_layers;
713
static int hf_sflow_5_extended_80211_tx_bssid;
714
static int hf_sflow_245_ip_tcp_flag_rst;
715
static int hf_sflow_245_ip_tcp_flag_ack;
716
static int hf_sflow_245_ip_tcp_flag_cwr;
717
static int hf_sflow_5_extended_80211_tx_retransmissions;
718
static int hf_sflow_5_extended_80211_rx_version;
719
static int hf_sflow_flow_sample_dropped_packets;
720
static int hf_sflow_counters_sample_expanded_source_id_index;
721
static int hf_sflow_245_header_payload_stripped;
722
static int hf_sflow_245_sampled_header_length;
723
static int hf_sflow_245_ethernet_destination_mac_address;
724
static int hf_sflow_counters_sample_source_id_class;
725
static int hf_sflow_5_extended_url_url_length;
726
static int hf_sflow_flow_sample_source_id_type;
727
static int hf_sflow_5_extended_mpls_fec_address_prefix_length;
728
static int hf_sflow_flow_sample_sequence_number;
729
static int hf_sflow_counters_sample_source_id_index;
730
static int hf_sflow_counters_sample_counters_records;
731
static int hf_sflow_5_extended_mpls_tunnel_cos_value;
732
static int hf_sflow_5_extended_mpls_vc_id;
733
static int hf_sflow_24_flow_sample_output_interface_value;
734
static int hf_sflow_5_flow_sample_output_interface_expanded_value;
735
static int hf_sflow_5_flow_sample_output_interface_expanded_value_discarded;
736
static int hf_sflow_5_flow_sample_output_interface_expanded_value_number;
737
static int hf_sflow_5_flow_sample_output_interface_expanded_value_ifindex;
738
static int hf_sflow_5_extended_user_destination_user;
739
static int hf_sflow_245_as_type;
740
static int hf_sflow_counters_sample_index;
741
static int hf_sflow_5_extended_url_url;
742
static int hf_sflow_flow_sample_index;
743
static int hf_sflow_5_extended_80211_rx_ssid;
744
static int hf_sflow_5_extended_mpls_vc_instance_name;
745
static int hf_sflow_5_extended_mpls_tunnel_name;
746
static int hf_sflow_5_extended_80211_payload;
747
static int hf_sflow_5_extended_user_source_user;
748
static int hf_sflow_5_extended_url_host;
749
static int hf_sflow_5_extended_80211_tx_ssid;
750
static int hf_sflow_5_extended_url_direction;
751
static int hf_sflow_5_extended_mpls_ftn_description;
752
static int hf_sflow_245_ip_protocol;
753
754
static int hf_sflow_lag_port_padding;
755
static int hf_sflow_lag_port_actorsystemid;
756
static int hf_sflow_lag_port_partneropersystemid;
757
static int hf_sflow_lag_port_attachedaggid;
758
static int hf_sflow_lag_port_state;
759
static int hf_sflow_lag_port_actoradminstate;
760
static int hf_sflow_lag_port_actoroperstate;
761
static int hf_sflow_lag_port_partneradminstate;
762
static int hf_sflow_lag_port_partneroperstate;
763
static int hf_sflow_lag_port_reserved;
764
static int hf_sflow_5_lag_port_actoradminstate;
765
static int hf_sflow_5_lag_port_actoroperstate;
766
static int hf_sflow_5_lag_port_partneradminstate;
767
static int hf_sflow_5_lag_port_partneroperstate;
768
static int hf_sflow_lag_port_stats_lacpdusrx;
769
static int hf_sflow_lag_port_stats_markerpdusrx;
770
static int hf_sflow_lag_port_stats_markerresponsepdusrx;
771
static int hf_sflow_lag_port_stats_unknownrx;
772
static int hf_sflow_lag_port_stats_illegalrx;
773
static int hf_sflow_lag_port_stats_lacpdustx;
774
static int hf_sflow_lag_port_stats_markerpdustx;
775
static int hf_sflow_lag_port_stats_markerresponsepdustx;
776
777
/* Initialize the subtree pointers */
778
static int ett_sflow_245;
779
static int ett_sflow_245_sample;
780
static int ett_sflow_5_flow_record;
781
static int ett_sflow_5_counters_record;
782
static int ett_sflow_5_mpls_in_label_stack;
783
static int ett_sflow_5_mpls_out_label_stack;
784
static int ett_sflow_245_extended_data;
785
static int ett_sflow_245_gw_as_dst;
786
static int ett_sflow_245_gw_as_dst_seg;
787
static int ett_sflow_245_gw_community;
788
static int ett_sflow_245_sampled_header;
789
static int ett_sflow_lag_port_state_flags;
790
static int ett_sflow_5_output_interface;
791
792
static expert_field ei_sflow_invalid_address_type;
793
static expert_field ei_sflow_unknown_record_format;
794
795
static dissector_table_t   header_subdissector_table;
796
797
static const unit_name_string units_total_packets = { " total packet", " total packets" };
798
799
void proto_reg_handoff_sflow_245(void);
800
801
/* dissect a sampled header - layer 2 protocols */
802
static int
803
dissect_sflow_245_sampled_header(tvbuff_t *tvb, packet_info *pinfo,
804
0
                                 proto_tree *tree, volatile int offset) {
805
0
    uint32_t          version, header_proto, frame_length;
806
0
    uint32_t header_length;
807
0
    tvbuff_t         *next_tvb;
808
0
    proto_tree       *sflow_245_header_tree;
809
0
    proto_item       *ti;
810
    /* stuff for saving column state before calling other dissectors.
811
     * Thanks to Guy Harris for the tip. */
812
0
    bool              save_writable;
813
0
    bool              save_in_error_pkt;
814
0
    address           save_dl_src, save_dl_dst, save_net_src, save_net_dst, save_src, save_dst;
815
816
0
    version = tvb_get_ntohl(tvb, 0);
817
0
    header_proto = tvb_get_ntohl(tvb, offset);
818
0
    proto_tree_add_item(tree, hf_sflow_245_header_protocol, tvb, offset, 4, ENC_BIG_ENDIAN);
819
0
    offset += 4;
820
0
    frame_length = tvb_get_ntohl(tvb, offset);
821
0
    proto_tree_add_item(tree, hf_sflow_245_header_frame_length, tvb, offset, 4, ENC_BIG_ENDIAN);
822
0
    offset += 4;
823
824
0
    if (version == 5) {
825
0
        proto_tree_add_item(tree, hf_sflow_245_header_payload_stripped, tvb, offset, 4, ENC_BIG_ENDIAN);
826
0
        offset += 4;
827
0
    }
828
829
0
    proto_tree_add_item_ret_uint(tree, hf_sflow_245_sampled_header_length, tvb, offset, 4, ENC_BIG_ENDIAN, &header_length);
830
0
    offset += 4;
831
832
0
    ti = proto_tree_add_item(tree, hf_sflow_245_header, tvb, offset, header_length, ENC_NA);
833
0
    sflow_245_header_tree = proto_item_add_subtree(ti, ett_sflow_245_sampled_header);
834
835
    /* hand the header off to the appropriate dissector.  It's probably
836
     * a short frame, so ignore any exceptions. */
837
0
    next_tvb = tvb_new_subset_length_caplen(tvb, offset, header_length, frame_length);
838
839
    /* save some state */
840
0
    save_writable = col_get_writable(pinfo->cinfo, -1);
841
842
    /*
843
       If sFlow samples a TCP packet it is very likely that the
844
       TCP analysis will flag the packet as having some error with
845
       the sequence numbers.  sFlow only report on a "sample" of
846
       traffic so many packets will not be reported on.  This is
847
       most obvious if the colorizing rules are on, but will also
848
       cause confusion if you attempt to filter on
849
       "tcp.analysis.flags".
850
851
       The following only works to suppress IP/TCP errors, but
852
       it is a start anyway.  Other protocols carried as payloads
853
       may exhibit similar issues.
854
855
       I think what is really needed is a more general
856
       "protocol_as_payload" flag.  Of course then someone has to
857
       play whack-a-mole and add code to implement it to any
858
       protocols that could be carried as a payload.  In the case
859
       of sFlow that pretty much means anything on your network.
860
     */
861
0
    save_in_error_pkt = pinfo->flags.in_error_pkt;
862
0
    if (!global_analyze_samp_ip_headers) {
863
0
        pinfo->flags.in_error_pkt = true;
864
0
    }
865
866
0
    col_set_writable(pinfo->cinfo, -1, false);
867
0
    copy_address_shallow(&save_dl_src, &pinfo->dl_src);
868
0
    copy_address_shallow(&save_dl_dst, &pinfo->dl_dst);
869
0
    copy_address_shallow(&save_net_src, &pinfo->net_src);
870
0
    copy_address_shallow(&save_net_dst, &pinfo->net_dst);
871
0
    copy_address_shallow(&save_src, &pinfo->src);
872
0
    copy_address_shallow(&save_dst, &pinfo->dst);
873
874
0
    TRY
875
0
    {
876
0
        if ((global_dissect_samp_headers == false) ||
877
0
            !dissector_try_uint(header_subdissector_table, header_proto, next_tvb, pinfo, sflow_245_header_tree))
878
0
        {
879
0
            call_data_dissector(next_tvb, pinfo, sflow_245_header_tree);
880
0
        }
881
0
    }
882
883
0
    CATCH_BOUNDS_ERRORS {
884
0
    }
885
0
    ENDTRY;
886
887
    /* restore saved state */
888
0
    col_set_writable(pinfo->cinfo, -1, save_writable);
889
0
    pinfo->flags.in_error_pkt = save_in_error_pkt;
890
0
    copy_address_shallow(&pinfo->dl_src, &save_dl_src);
891
0
    copy_address_shallow(&pinfo->dl_dst, &save_dl_dst);
892
0
    copy_address_shallow(&pinfo->net_src, &save_net_src);
893
0
    copy_address_shallow(&pinfo->net_dst, &save_net_dst);
894
0
    copy_address_shallow(&pinfo->src, &save_src);
895
0
    copy_address_shallow(&pinfo->dst, &save_dst);
896
897
    /* XDR requires 4-byte alignment */
898
0
    offset += WS_ROUNDUP_4(header_length);
899
0
    return offset;
900
0
}
901
902
static int
903
dissect_sflow_245_address_type(tvbuff_t *tvb, packet_info *pinfo,
904
                               proto_tree *tree, int offset,
905
                               struct sflow_address_type *hf_type,
906
0
                               address *addr) {
907
0
    uint32_t addr_type;
908
0
    int len;
909
910
0
    addr_type = tvb_get_ntohl(tvb, offset);
911
0
    offset += 4;
912
913
0
    switch (addr_type) {
914
0
    case ADDR_TYPE_UNKNOWN:
915
0
        len = 0;
916
0
        break;
917
0
    case ADDR_TYPE_IPV4:
918
0
        len = 4;
919
0
        proto_tree_add_item(tree, hf_type->hf_addr_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
920
0
        break;
921
0
    case ADDR_TYPE_IPV6:
922
0
        len = 16;
923
0
        proto_tree_add_item(tree, hf_type->hf_addr_v6, tvb, offset, 16, ENC_NA);
924
0
        break;
925
0
    default:
926
        /* Invalid address type, or a type we don't understand; we don't
927
           know the length. We treat it as having no contents; that
928
           doesn't trap us in an endless loop, as we at least include
929
           the address type and thus at least advance the offset by 4.
930
           Note that we have a problem, though. */
931
0
        len = 0;
932
0
        proto_tree_add_expert_format(tree, pinfo, &ei_sflow_invalid_address_type, tvb,
933
0
                                     offset - 4, 4, "Unknown address type (%u)", addr_type);
934
0
    }
935
936
0
    if (addr) {
937
0
        switch (len) {
938
0
        default:
939
0
            clear_address(addr);
940
0
            break;
941
0
        case 4:
942
0
            set_address_tvb(addr, AT_IPv4, len, tvb, offset);
943
0
            break;
944
0
        case 16:
945
0
            set_address_tvb(addr, AT_IPv6, len, tvb, offset);
946
0
            break;
947
0
        }
948
0
    }
949
950
0
    return offset + len;
951
0
}
952
953
/* extended switch data, after the packet data */
954
static int
955
0
dissect_sflow_245_extended_switch(tvbuff_t *tvb, proto_tree *tree, int offset) {
956
0
    proto_tree_add_item(tree, hf_sflow_245_vlan_in, tvb, offset, 4, ENC_BIG_ENDIAN);
957
0
    offset += 4;
958
0
    proto_tree_add_item(tree, hf_sflow_245_pri_in, tvb, offset, 4, ENC_BIG_ENDIAN);
959
0
    offset += 4;
960
0
    proto_tree_add_item(tree, hf_sflow_245_vlan_out, tvb, offset, 4, ENC_BIG_ENDIAN);
961
0
    offset += 4;
962
0
    proto_tree_add_item(tree, hf_sflow_245_pri_out, tvb, offset, 4, ENC_BIG_ENDIAN);
963
0
    offset += 4;
964
965
0
    return offset;
966
0
}
967
968
/* extended router data, after the packet data */
969
static int
970
0
dissect_sflow_245_extended_router(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
971
0
    struct sflow_address_type addr_type;
972
973
0
    addr_type.hf_addr_v4 = hf_sflow_245_nexthop_v4;
974
0
    addr_type.hf_addr_v6 = hf_sflow_245_nexthop_v6;
975
976
0
    offset = dissect_sflow_245_address_type(tvb, pinfo, tree, offset, &addr_type, NULL);
977
0
    proto_tree_add_item(tree, hf_sflow_245_nexthop_src_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
978
0
    offset += 4;
979
0
    proto_tree_add_item(tree, hf_sflow_245_nexthop_dst_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
980
0
    offset += 4;
981
0
    return offset;
982
0
}
983
984
/* extended MPLS data */
985
static int
986
0
dissect_sflow_5_extended_mpls_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
987
0
    uint32_t    in_label_count, out_label_count, label, i, j;
988
0
    proto_tree *in_stack;
989
0
    proto_tree *out_stack;
990
0
    struct sflow_address_type addr_type;
991
992
0
    addr_type.hf_addr_v4 = hf_sflow_245_nexthop_v4;
993
0
    addr_type.hf_addr_v6 = hf_sflow_245_nexthop_v6;
994
995
0
    offset = dissect_sflow_245_address_type(tvb, pinfo, tree, offset, &addr_type, NULL);
996
997
0
    in_label_count = tvb_get_ntohl(tvb, offset);
998
0
    proto_tree_add_item(tree, hf_sflow_245_extended_mpls_in_label_stack_entries, tvb, offset, 4, ENC_BIG_ENDIAN);
999
0
    offset += 4;
1000
1001
0
    in_stack = proto_tree_add_subtree(tree, tvb, offset, -1, ett_sflow_5_mpls_in_label_stack, NULL, "In Label Stack");
1002
1003
    /* by applying the mask, we avoid possible corrupted data that causes huge number of loops
1004
     * 255 is a sensible limit of label count */
1005
0
    for (i = 0, j = 0; i < (in_label_count & 0x000000ff); i++, j += 4) {
1006
0
        label = tvb_get_ntohl(tvb, offset + j);
1007
0
        proto_tree_add_uint_format(in_stack, hf_sflow_245_extended_mpls_in_label, tvb, offset, 4,
1008
0
            label, "Label %u: %u", i + 1, label);
1009
0
    }
1010
0
    offset += (in_label_count * 4);
1011
1012
0
    out_label_count = tvb_get_ntohl(tvb, offset);
1013
0
    proto_tree_add_item(tree, hf_sflow_245_extended_mpls_out_label_stack_entries, tvb, offset, 4, ENC_BIG_ENDIAN);
1014
0
    offset += 4;
1015
1016
0
    out_stack = proto_tree_add_subtree(tree, tvb, offset, -1, ett_sflow_5_mpls_in_label_stack, NULL, "Out Label Stack");
1017
1018
    /* by applying the mask, we avoid possible corrupted data that causes huge number of loops
1019
     * 255 is a sensible limit of label count */
1020
0
    for (i = 0, j = 0; i < (out_label_count & 0x000000ff); i++, j += 4) {
1021
0
        label = tvb_get_ntohl(tvb, offset + j);
1022
0
        proto_tree_add_uint_format(out_stack, hf_sflow_245_extended_mpls_out_label, tvb, offset, 4,
1023
0
            label, "Label %u: %u", i + 1, label);
1024
0
    }
1025
0
    offset = offset + out_label_count * 4;
1026
1027
0
    return offset;
1028
0
}
1029
1030
/* extended NAT data */
1031
static int
1032
0
dissect_sflow_5_extended_nat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
1033
0
    struct sflow_address_type addr_type;
1034
1035
0
    addr_type.hf_addr_v4 = hf_sflow_245_ipv4_src;
1036
0
    addr_type.hf_addr_v6 = hf_sflow_245_ipv6_src;
1037
1038
0
    offset = dissect_sflow_245_address_type(tvb, pinfo, tree, offset, &addr_type, NULL);
1039
1040
0
    addr_type.hf_addr_v4 = hf_sflow_245_ipv4_dst;
1041
0
    addr_type.hf_addr_v6 = hf_sflow_245_ipv6_dst;
1042
1043
0
    offset = dissect_sflow_245_address_type(tvb, pinfo, tree, offset, &addr_type, NULL);
1044
1045
0
    return offset;
1046
0
}
1047
1048
/* extended gateway data, after the packet data */
1049
static int
1050
0
dissect_sflow_245_extended_gateway(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
1051
0
    int32_t len = 0;
1052
0
    int32_t i, j, comm_len, dst_len, dst_seg_len;
1053
0
    uint32_t path_type;
1054
0
    int32_t kludge;
1055
1056
0
    uint32_t version = tvb_get_ntohl(tvb, 0); /* get sFlow version */
1057
0
    proto_item *ti;
1058
0
    proto_tree *sflow_245_dst_as_tree;
1059
0
    proto_tree *sflow_245_comm_tree;
1060
0
    proto_tree *sflow_245_dst_as_seg_tree;
1061
1062
    /* sFlow v5 contains next hop router IP address */
1063
0
    if (version == 5) {
1064
0
        struct sflow_address_type addr_type;
1065
1066
0
        addr_type.hf_addr_v4 = hf_sflow_245_nexthop_v4;
1067
0
        addr_type.hf_addr_v6 = hf_sflow_245_nexthop_v6;
1068
1069
0
        offset = dissect_sflow_245_address_type(tvb, pinfo, tree, offset, &addr_type, NULL);
1070
0
    }
1071
1072
0
    proto_tree_add_item(tree, hf_sflow_245_as, tvb, offset + len, 4, ENC_BIG_ENDIAN);
1073
0
    len += 4;
1074
1075
0
    proto_tree_add_item(tree, hf_sflow_245_src_as, tvb, offset + len, 4, ENC_BIG_ENDIAN);
1076
0
    len += 4;
1077
1078
0
    proto_tree_add_item(tree, hf_sflow_245_src_peer_as, tvb, offset + len, 4, ENC_BIG_ENDIAN);
1079
0
    len += 4;
1080
1081
0
    dst_len = tvb_get_ntohl(tvb, offset + len);
1082
0
    ti = proto_tree_add_uint(tree, hf_sflow_245_dst_as_entries, tvb, offset + len, 4, dst_len);
1083
0
    sflow_245_dst_as_tree = proto_item_add_subtree(ti, ett_sflow_245_gw_as_dst);
1084
0
    len += 4;
1085
1086
0
    for (i = 0; i < dst_len; i++) {
1087
0
        if (version < 4) {
1088
            /* Version 2 AS paths are different than versions >= 4 as
1089
               follows:
1090
1091
               There is no type encoded in the packet.
1092
1093
               The destination ASs are encoded as an array of integers
1094
               rather as an array of arrays of integers.  I just
1095
               pretended they were encoded as an array of arrays with
1096
               an implicit length of 1 to not have to do two
1097
               completely separate blocks for the different versions.
1098
1099
               Having a subtree for "arrays" guaranteed to have only a
1100
               single element proved cumbersome to navigate so I moved
1101
               the creation of the subtree to only happen for versions
1102
               >= 4.
1103
             */
1104
0
            dst_seg_len = 1;
1105
0
            sflow_245_dst_as_seg_tree = sflow_245_dst_as_tree;
1106
0
        } else {
1107
0
            path_type = tvb_get_ntohl(tvb, offset + len);
1108
0
            len += 4;
1109
0
            dst_seg_len = tvb_get_ntohl(tvb, offset + len);
1110
0
            len += 4;
1111
0
            kludge = 8;
1112
0
            ti = proto_tree_add_uint_format(tree, hf_sflow_245_as_type, tvb, offset + len - kludge, kludge, path_type,
1113
0
                    "%s, (%u entries)", val_to_str_const(path_type, sflow_245_as_types, "Unknown AS type"), dst_seg_len);
1114
0
            sflow_245_dst_as_seg_tree = proto_item_add_subtree(ti, ett_sflow_245_gw_as_dst_seg);
1115
0
        }
1116
1117
0
        for (j = 0; j < dst_seg_len; j++) {
1118
0
            proto_tree_add_item(sflow_245_dst_as_seg_tree, hf_sflow_245_dst_as, tvb, offset + len, 4, ENC_BIG_ENDIAN);
1119
0
            len += 4;
1120
0
        }
1121
0
    }
1122
1123
1124
0
    if (version >= 4) {
1125
0
        comm_len = tvb_get_ntohl(tvb, offset + len);
1126
1127
0
        ti = proto_tree_add_uint(tree, hf_sflow_245_community_entries, tvb, offset + len, 4, comm_len);
1128
0
        sflow_245_comm_tree = proto_item_add_subtree(ti, ett_sflow_245_gw_community);
1129
0
        len += 4;
1130
0
        for (i = 0; i < comm_len; i++) {
1131
0
            proto_tree_add_item(sflow_245_comm_tree,
1132
0
                    hf_sflow_245_dst_as, tvb, offset + len,
1133
0
                    4, ENC_BIG_ENDIAN);
1134
0
            len += 4;
1135
0
        }
1136
1137
0
        proto_tree_add_item(tree, hf_sflow_245_localpref, tvb, offset + len, 4, ENC_BIG_ENDIAN);
1138
0
        len += 4;
1139
1140
0
    }
1141
1142
0
    return offset + len;
1143
0
}
1144
1145
/* sflow v5 ethernet frame data */
1146
static int
1147
0
dissect_sflow_5_ethernet_frame(tvbuff_t *tvb, proto_tree *tree, int offset) {
1148
1149
0
    proto_tree_add_item(tree, hf_sflow_245_ethernet_length_of_mac_packet, tvb, offset, 4, ENC_BIG_ENDIAN);
1150
0
    offset += 4;
1151
1152
0
    proto_tree_add_item(tree, hf_sflow_245_ethernet_source_mac_address, tvb, offset, 6, ENC_NA);
1153
    /* Padded to 4 byte offset */
1154
0
    offset += 8;
1155
1156
0
    proto_tree_add_item(tree, hf_sflow_245_ethernet_destination_mac_address, tvb, offset, 6, ENC_NA);
1157
    /* Padded to 4 byte offset */
1158
0
    offset += 8;
1159
1160
0
    proto_tree_add_item(tree, hf_sflow_245_ethernet_packet_type, tvb, offset, 4, ENC_BIG_ENDIAN);
1161
0
    offset += 4;
1162
1163
0
    return offset;
1164
0
}
1165
1166
/* sflow v5 IPv4 data */
1167
static int
1168
0
dissect_sflow_5_ipv4(tvbuff_t *tvb, proto_tree *tree, int offset) {
1169
1170
0
    proto_tree_add_item(tree, hf_sflow_245_length_of_ip_packet, tvb, offset, 4, ENC_BIG_ENDIAN);
1171
0
    offset += 4;
1172
1173
0
    proto_tree_add_item(tree, hf_sflow_245_ip_protocol, tvb, offset, 4, ENC_BIG_ENDIAN);
1174
0
    offset += 4;
1175
1176
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_src, tvb, offset, 4, ENC_BIG_ENDIAN);
1177
0
    offset += 4;
1178
1179
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
1180
0
    offset += 4;
1181
1182
0
    proto_tree_add_item(tree, hf_sflow_245_ip_source_port, tvb, offset, 4, ENC_BIG_ENDIAN);
1183
0
    offset += 4;
1184
1185
0
    proto_tree_add_item(tree, hf_sflow_245_ip_destination_port, tvb, offset, 4, ENC_BIG_ENDIAN);
1186
0
    offset += 4;
1187
1188
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_cwr, tvb, offset, 4, ENC_BIG_ENDIAN);
1189
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_ece, tvb, offset, 4, ENC_BIG_ENDIAN);
1190
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_urg, tvb, offset, 4, ENC_BIG_ENDIAN);
1191
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_ack, tvb, offset, 4, ENC_BIG_ENDIAN);
1192
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_psh, tvb, offset, 4, ENC_BIG_ENDIAN);
1193
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_rst, tvb, offset, 4, ENC_BIG_ENDIAN);
1194
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_syn, tvb, offset, 4, ENC_BIG_ENDIAN);
1195
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_fin, tvb, offset, 4, ENC_BIG_ENDIAN);
1196
0
    offset += 4;
1197
1198
    /* 7 bits for type of service, plus 1 reserved bit */
1199
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_precedence_type, tvb, offset, 4, ENC_BIG_ENDIAN);
1200
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_delay, tvb, offset, 4, ENC_BIG_ENDIAN);
1201
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_throughput, tvb, offset, 4, ENC_BIG_ENDIAN);
1202
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_reliability, tvb, offset, 4, ENC_BIG_ENDIAN);
1203
0
    proto_tree_add_item(tree, hf_sflow_245_ipv4_cost, tvb, offset, 4, ENC_BIG_ENDIAN);
1204
0
    offset += 4;
1205
1206
0
    return offset;
1207
0
}
1208
1209
/* sflow v5 IPv6 data */
1210
static int
1211
0
dissect_sflow_5_ipv6(tvbuff_t *tvb, proto_tree *tree, int offset) {
1212
1213
0
    proto_tree_add_item(tree, hf_sflow_245_length_of_ip_packet, tvb, offset, 4, ENC_BIG_ENDIAN);
1214
0
    offset += 4;
1215
1216
0
    proto_tree_add_item(tree, hf_sflow_245_ip_protocol, tvb, offset, 4, ENC_BIG_ENDIAN);
1217
0
    offset += 4;
1218
1219
0
    proto_tree_add_item(tree, hf_sflow_245_ipv6_src, tvb, offset, 16, ENC_NA);
1220
0
    offset += 16;
1221
1222
0
    proto_tree_add_item(tree, hf_sflow_245_ipv6_dst, tvb, offset, 16, ENC_NA);
1223
0
    offset += 16;
1224
1225
0
    proto_tree_add_item(tree, hf_sflow_245_ip_source_port, tvb, offset, 4, ENC_BIG_ENDIAN);
1226
0
    offset += 4;
1227
1228
0
    proto_tree_add_item(tree, hf_sflow_245_ip_destination_port, tvb, offset, 4, ENC_BIG_ENDIAN);
1229
0
    offset += 4;
1230
1231
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_cwr, tvb, offset, 4, ENC_BIG_ENDIAN);
1232
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_ece, tvb, offset, 4, ENC_BIG_ENDIAN);
1233
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_urg, tvb, offset, 4, ENC_BIG_ENDIAN);
1234
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_ack, tvb, offset, 4, ENC_BIG_ENDIAN);
1235
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_psh, tvb, offset, 4, ENC_BIG_ENDIAN);
1236
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_rst, tvb, offset, 4, ENC_BIG_ENDIAN);
1237
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_syn, tvb, offset, 4, ENC_BIG_ENDIAN);
1238
0
    proto_tree_add_item(tree, hf_sflow_245_ip_tcp_flag_fin, tvb, offset, 4, ENC_BIG_ENDIAN);
1239
0
    offset += 4;
1240
1241
    /* Priority -- Traffic class field enables a source to identify the desired
1242
       delivery priority of the packets. Priority values are divided into
1243
       ranges: traffic where the source provides congestion control and
1244
       non-congestion control traffic.
1245
1246
       It is displayed as unsigned integer here according to sFlow specification */
1247
1248
0
    proto_tree_add_item(tree, hf_sflow_245_ipv6_priority, tvb, offset, 4, ENC_BIG_ENDIAN);
1249
0
    offset += 4;
1250
1251
0
    return offset;
1252
0
}
1253
1254
/* sflow v5 user data */
1255
static int
1256
0
dissect_sflow_5_extended_user(tvbuff_t *tvb, proto_tree *tree, int offset) {
1257
0
    uint32_t src_length, dest_length;
1258
1259
    /* charset is not processed here, all chars are assumed to be ASCII */
1260
0
    proto_tree_add_item(tree, hf_sflow_5_extended_user_source_character_set, tvb, offset, 4, ENC_BIG_ENDIAN);
1261
0
    offset += 4;
1262
1263
0
    src_length = tvb_get_ntohl(tvb, offset);
1264
0
    proto_tree_add_item(tree, hf_sflow_5_extended_user_source_user_string_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1265
0
    offset += 4;
1266
1267
    /* extract source user info char by char */
1268
0
    proto_tree_add_item(tree, hf_sflow_5_extended_user_source_user, tvb, offset, src_length, ENC_ASCII);
1269
0
    offset += src_length;
1270
    /* get the correct offset by adding padding byte count */
1271
0
    offset += WS_PADDING_TO_4(src_length);
1272
1273
    /* charset is not processed here, all chars are assumed to be ASCII */
1274
0
    proto_tree_add_item(tree, hf_sflow_5_extended_user_destination_character_set, tvb, offset, 4, ENC_BIG_ENDIAN);
1275
0
    offset += 4;
1276
1277
0
    dest_length = tvb_get_ntohl(tvb, offset);
1278
0
    proto_tree_add_item(tree, hf_sflow_5_extended_user_destination_user_string_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1279
0
    offset += 4;
1280
1281
    /* extract destination user info char by char */
1282
0
    proto_tree_add_item(tree, hf_sflow_5_extended_user_destination_user, tvb, offset, dest_length, ENC_ASCII);
1283
0
    offset += dest_length;
1284
    /* get the correct offset by adding padding byte count */
1285
0
    offset += WS_PADDING_TO_4(dest_length);
1286
1287
0
    return offset;
1288
0
}
1289
1290
/* sflow v5 URL data */
1291
static int
1292
0
dissect_sflow_5_extended_url(tvbuff_t *tvb, proto_tree *tree, int offset) {
1293
0
    uint32_t direction, url_length, host_length;
1294
1295
0
    direction = tvb_get_ntohl(tvb, offset);
1296
0
    switch (direction) {
1297
0
        case 1:
1298
0
            proto_tree_add_uint_format(tree, hf_sflow_5_extended_url_direction, tvb, offset, 4, direction,
1299
0
                                        "Source Address is Server(%u)", direction);
1300
0
            break;
1301
0
        case 2:
1302
0
            proto_tree_add_uint_format(tree, hf_sflow_5_extended_url_direction, tvb, offset, 4, direction,
1303
0
                                        "Destination Address is Server (%u)", direction);
1304
0
            break;
1305
0
        default:
1306
0
            proto_tree_add_uint_format(tree, hf_sflow_5_extended_url_direction, tvb, offset, 4, direction,
1307
0
                                        "Server Unspecified (%u)", direction);
1308
0
            break;
1309
0
    }
1310
0
    offset += 4;
1311
1312
0
    url_length = tvb_get_ntohl(tvb, offset);
1313
0
    proto_tree_add_item(tree, hf_sflow_5_extended_url_url_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1314
0
    offset += 4;
1315
1316
    /* extract URL char by char */
1317
0
    proto_tree_add_item(tree, hf_sflow_5_extended_url_url, tvb, offset, url_length, ENC_ASCII);
1318
0
    offset += url_length;
1319
    /* get the correct offset by adding padding byte count */
1320
0
    offset += WS_PADDING_TO_4(url_length);
1321
1322
0
    host_length = tvb_get_ntohl(tvb, offset);
1323
0
    proto_tree_add_item(tree, hf_sflow_5_extended_url_host_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1324
0
    offset += 4;
1325
1326
    /* extract host info char by char */
1327
0
    proto_tree_add_item(tree, hf_sflow_5_extended_url_host, tvb, offset, host_length, ENC_ASCII);
1328
0
    offset += host_length;
1329
    /* get the correct offset by adding padding byte count */
1330
0
    offset += WS_PADDING_TO_4(host_length);
1331
1332
0
    return offset;
1333
0
}
1334
1335
/* sflow v5 MPLS tunnel */
1336
static int
1337
0
dissect_sflow_5_extended_mpls_tunnel(tvbuff_t *tvb, proto_tree *tree, int offset) {
1338
0
    uint32_t name_length;
1339
1340
0
    name_length = tvb_get_ntohl(tvb, offset);
1341
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_tunnel_name_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1342
0
    offset += 4;
1343
1344
    /* extract tunnel name char by char */
1345
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_tunnel_name, tvb, offset, name_length, ENC_ASCII);
1346
0
    offset += name_length;
1347
    /* get the correct offset by adding padding byte count */
1348
0
    offset += WS_PADDING_TO_4(name_length);
1349
1350
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_tunnel_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1351
0
    offset += 4;
1352
1353
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_tunnel_cos_value, tvb, offset, 4, ENC_BIG_ENDIAN);
1354
0
    offset += 4;
1355
1356
0
    return offset;
1357
0
}
1358
1359
/* sflow v5 MPLS VC */
1360
static int
1361
0
dissect_sflow_5_extended_mpls_vc(tvbuff_t *tvb, proto_tree *tree, int offset) {
1362
0
    uint32_t name_length;
1363
1364
0
    name_length = tvb_get_ntohl(tvb, offset);
1365
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_vc_instance_name_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1366
0
    offset += 4;
1367
1368
    /* extract source user info char by char */
1369
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_vc_instance_name, tvb, offset, name_length, ENC_ASCII);
1370
0
    offset += name_length;
1371
    /* get the correct offset by adding padding byte count */
1372
0
    offset += WS_PADDING_TO_4(name_length);
1373
1374
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_vc_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1375
0
    offset += 4;
1376
1377
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_vc_label_cos_value, tvb, offset, 4, ENC_BIG_ENDIAN);
1378
0
    offset += 4;
1379
1380
0
    return offset;
1381
0
}
1382
1383
/* sflow v5 MPLS FEC */
1384
static int
1385
0
dissect_sflow_5_extended_mpls_fec(tvbuff_t *tvb, proto_tree *tree, int offset) {
1386
0
    uint32_t length;
1387
1388
0
    length = tvb_get_ntohl(tvb, offset);
1389
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_ftn_description_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1390
0
    offset += 4;
1391
1392
    /* extract MPLS FTN description char by char */
1393
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_ftn_description, tvb, offset, length, ENC_ASCII);
1394
0
    offset += length;
1395
    /* get the correct offset by adding padding byte count */
1396
0
    offset += WS_PADDING_TO_4(length);
1397
1398
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_ftn_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
1399
0
    offset += 4;
1400
1401
0
    return offset;
1402
0
}
1403
1404
/* sflow v5 MPLS LVP FEC */
1405
static int
1406
0
dissect_sflow_5_extended_mpls_lvp_fec(tvbuff_t *tvb, proto_tree *tree, int offset) {
1407
1408
0
    proto_tree_add_item(tree, hf_sflow_5_extended_mpls_fec_address_prefix_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1409
0
    offset += 4;
1410
0
    return offset;
1411
0
}
1412
1413
/* sflow v5 extended VLAN tunnel */
1414
static int
1415
0
dissect_sflow_5_extended_vlan_tunnel(tvbuff_t *tvb, proto_tree *tree, int offset) {
1416
0
    uint32_t num, i;
1417
1418
0
    num = tvb_get_ntohl(tvb, offset);
1419
0
    proto_tree_add_item(tree, hf_sflow_5_extended_vlan_tunnel_number_of_layers, tvb, offset, 4, ENC_BIG_ENDIAN);
1420
0
    offset += 4;
1421
1422
    /* loop strip 802.1Q TPID/TCI layers. each TPID/TCI pair is represented as a
1423
       single 32 bit integer layers listed from outermost to innermost */
1424
0
    for (i = 0; i < num; i++) {
1425
0
        proto_tree_add_item(tree, hf_sflow_5_extended_vlan_tunnel_tpid_tci_pair, tvb, offset, 4, ENC_BIG_ENDIAN);
1426
0
        offset += 4;
1427
0
    }
1428
1429
0
    return offset;
1430
0
}
1431
1432
/* sflow v5 extended 802.11 payload */
1433
static int
1434
0
dissect_sflow_5_extended_80211_payload(tvbuff_t *tvb, proto_tree *tree, int offset) {
1435
0
    uint32_t cipher_suite, OUI, suite_type, length;
1436
1437
0
    cipher_suite = tvb_get_ntohl(tvb, offset);
1438
0
    OUI = cipher_suite >> 8;
1439
0
    suite_type = cipher_suite & 0x000000ff;
1440
1441
0
    if (OUI == 0x000FAC) {
1442
0
        proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_oui, tvb, offset, 3, OUI, "Default (0x%X)", OUI);
1443
0
        offset += 3;
1444
0
        proto_tree_add_item(tree, hf_sflow_5_extended_80211_suite_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1445
0
    } else {
1446
0
        proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_oui, tvb, offset, 3, OUI, "Other vendor (0x%X)", OUI);
1447
0
        offset += 3;
1448
0
        proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_suite_type, tvb, offset, 1,
1449
0
            suite_type, "vendor specific (%u)", suite_type);
1450
0
    }
1451
0
    offset++;
1452
1453
0
    length = tvb_get_ntohl(tvb, offset);
1454
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_payload_length, tvb, offset, 4, ENC_BIG_ENDIAN);
1455
0
    offset += 4;
1456
1457
    /* extract data byte by byte */
1458
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_payload, tvb, offset, length, ENC_NA);
1459
0
    offset += length;
1460
    /* get the correct offset by adding padding byte count */
1461
0
    offset += WS_PADDING_TO_4(length);
1462
1463
0
    return offset;
1464
0
}
1465
1466
/* sflow v5 extended 802.11 rx */
1467
static int
1468
0
dissect_sflow_5_extended_80211_rx(tvbuff_t *tvb, proto_tree *tree, int offset) {
1469
0
    uint32_t ssid_length, duration;
1470
1471
    /* extract SSID char by char. max char count = 32 */
1472
0
    ssid_length = tvb_get_ntohl(tvb, offset);
1473
0
    offset += 4;
1474
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_ssid, tvb, offset, ssid_length, ENC_ASCII);
1475
0
    offset += ssid_length;
1476
    /* get the correct offset by adding padding byte count */
1477
0
    offset += WS_PADDING_TO_4(ssid_length);
1478
1479
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_bssid, tvb, offset, 6, ENC_NA);
1480
    /* Padded to 4 byte offset */
1481
0
    offset += 8;
1482
1483
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_version, tvb, offset, 4, ENC_BIG_ENDIAN);
1484
0
    offset += 4;
1485
1486
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_channel, tvb, offset, 4, ENC_BIG_ENDIAN);
1487
0
    offset += 4;
1488
1489
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_speed, tvb, offset, 8, ENC_BIG_ENDIAN);
1490
0
    offset += 8;
1491
1492
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_rsni, tvb, offset, 4, ENC_BIG_ENDIAN);
1493
0
    offset += 4;
1494
1495
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_rcpi, tvb, offset, 4, ENC_BIG_ENDIAN);
1496
0
    offset += 4;
1497
1498
0
    duration = tvb_get_ntohl(tvb, offset);
1499
0
    if (duration == 0) {
1500
0
        proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_rx_packet_duration, tvb, offset, 4, duration, "Unknown");
1501
0
    } else {
1502
0
        proto_tree_add_item(tree, hf_sflow_5_extended_80211_rx_packet_duration, tvb, offset, 4, ENC_BIG_ENDIAN);
1503
0
    }
1504
0
    offset += 4;
1505
1506
0
    return offset;
1507
0
}
1508
1509
/* sflow v5 extended 802.11 tx */
1510
static int
1511
0
dissect_sflow_5_extended_80211_tx(tvbuff_t *tvb, proto_tree *tree, int offset) {
1512
0
    uint32_t ssid_length, transmissions, packet_duration, retrans_duration;
1513
1514
    /* extract SSID char by char. max char count = 32 */
1515
0
    ssid_length = tvb_get_ntohl(tvb, offset);
1516
0
    if (ssid_length > 32)
1517
0
        ssid_length = 32;
1518
0
    offset += 4;
1519
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_ssid, tvb, offset, ssid_length, ENC_ASCII);
1520
0
    offset += ssid_length;
1521
    /* get the correct offset by adding padding byte count */
1522
0
    offset += WS_PADDING_TO_4(ssid_length);
1523
1524
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_bssid, tvb, offset, 6, ENC_NA);
1525
    /* Padded to 4 byte offset */
1526
0
    offset += 8;
1527
1528
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_version, tvb, offset, 4, ENC_BIG_ENDIAN);
1529
0
    offset += 4;
1530
1531
0
    transmissions = tvb_get_ntohl(tvb, offset);
1532
0
    switch (transmissions) {
1533
0
        case 0:
1534
0
            proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_tx_retransmissions, tvb, offset, 4,
1535
0
                    0, "Unknown");
1536
0
            break;
1537
0
        case 1:
1538
0
            proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_tx_retransmissions, tvb, offset, 4,
1539
0
                    1, "Packet transmitted successfully on first attempt");
1540
0
            break;
1541
0
        default:
1542
0
            proto_tree_add_uint(tree, hf_sflow_5_extended_80211_tx_retransmissions, tvb, offset, 4, transmissions - 1);
1543
0
            break;
1544
0
    }
1545
0
    offset += 4;
1546
1547
0
    packet_duration = tvb_get_ntohl(tvb, offset);
1548
0
    if (packet_duration == 0) {
1549
0
        proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_tx_packet_duration, tvb, offset, 4, packet_duration, "Unknown");
1550
0
    } else {
1551
0
        proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_packet_duration, tvb, offset, 4, ENC_BIG_ENDIAN);
1552
0
    }
1553
0
    offset += 4;
1554
1555
0
    retrans_duration = tvb_get_ntohl(tvb, offset);
1556
0
    if (retrans_duration == 0) {
1557
0
        proto_tree_add_uint_format_value(tree, hf_sflow_5_extended_80211_tx_retransmission_duration, tvb, offset, 4, retrans_duration, "Unknown");
1558
0
    } else {
1559
0
        proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_retransmission_duration, tvb, offset, 4, ENC_BIG_ENDIAN);
1560
0
    }
1561
0
    offset += 4;
1562
1563
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_channel, tvb, offset, 4, ENC_BIG_ENDIAN);
1564
0
    offset += 4;
1565
1566
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_speed, tvb, offset, 8, ENC_BIG_ENDIAN);
1567
0
    offset += 8;
1568
1569
0
    proto_tree_add_item(tree, hf_sflow_5_extended_80211_tx_power, tvb, offset, 4, ENC_BIG_ENDIAN);
1570
0
    offset += 4;
1571
1572
0
    return offset;
1573
0
}
1574
1575
/* sflow v5 extended 802.11 aggregation */
1576
static int
1577
0
dissect_sflow_5_extended_80211_aggregation(tvbuff_t *tvb _U_, proto_tree *tree _U_, int offset) {
1578
1579
0
    return offset;
1580
0
}
1581
1582
/* dissect an sflow v2/4 flow sample */
1583
static int
1584
dissect_sflow_24_flow_sample(tvbuff_t *tvb, packet_info *pinfo,
1585
0
        proto_tree *tree, int offset, proto_item *parent) {
1586
0
    uint32_t    sequence_number, sampling_rate, output;
1587
1588
0
    proto_tree *extended_data_tree;
1589
0
    proto_item *ti;
1590
0
    uint32_t    packet_type, extended_data, ext_type, i;
1591
1592
0
    sequence_number = tvb_get_ntohl(tvb, offset);
1593
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
1594
0
    proto_item_append_text(parent, ", seq %u", sequence_number);
1595
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_source_id_class, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
1596
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_index, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
1597
0
    sampling_rate = tvb_get_ntohl(tvb, offset + 8);
1598
0
    proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sampling_rate, tvb, offset + 8, 4,
1599
0
            sampling_rate, "1 out of %u packets",
1600
0
            sampling_rate);
1601
1602
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_sample_pool, tvb, offset + 12, 4, ENC_BIG_ENDIAN);
1603
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_dropped_packets, tvb, offset + 16, 4, ENC_BIG_ENDIAN);
1604
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_input_interface, tvb, offset + 20, 4, ENC_BIG_ENDIAN);
1605
0
    output = tvb_get_ntohl(tvb, offset + 24);
1606
0
    if (output & 0x80000000) {
1607
0
        output & 0x7fffffff ?
1608
0
            proto_tree_add_uint_format_value(tree, hf_sflow_24_flow_sample_multiple_outputs, tvb, offset + 24, 4,
1609
0
                output & 0x7fffffff, "%u interfaces", output & 0x7fffffff) :
1610
0
            proto_tree_add_uint_format_value(tree, hf_sflow_24_flow_sample_multiple_outputs, tvb, offset + 24, 4,
1611
0
                0x80000000, "unknown number");
1612
0
    } else {
1613
0
        proto_tree_add_item(tree, hf_sflow_24_flow_sample_output_interface, tvb, offset + 24, 4, ENC_BIG_ENDIAN);
1614
0
    }
1615
0
    offset += 28;
1616
1617
    /* what kind of flow sample is it? */
1618
0
    packet_type = tvb_get_ntohl(tvb, offset);
1619
0
    proto_tree_add_item(tree, hf_sflow_245_packet_information_type, tvb, offset, 4, ENC_BIG_ENDIAN);
1620
0
    offset += 4;
1621
0
    switch (packet_type) {
1622
0
        case SFLOW_245_PACKET_DATA_TYPE_HEADER:
1623
0
            offset = dissect_sflow_245_sampled_header(tvb, pinfo, tree, offset);
1624
0
            break;
1625
0
        case SFLOW_245_PACKET_DATA_TYPE_IPV4:
1626
0
        case SFLOW_245_PACKET_DATA_TYPE_IPV6:
1627
0
        default:
1628
0
            break;
1629
0
    }
1630
    /* still need to dissect extended data */
1631
0
    extended_data = tvb_get_ntohl(tvb, offset);
1632
0
    offset += 4;
1633
1634
0
    for (i = 0; i < extended_data; i++) {
1635
        /* figure out what kind of extended data it is */
1636
0
        ext_type = tvb_get_ntohl(tvb, offset);
1637
1638
        /* create a subtree.  Might want to move this to
1639
         * the end, so more info can be correct.
1640
         */
1641
0
        ti = proto_tree_add_uint(tree, hf_sflow_245_extended_information_type, tvb, offset, 4, ext_type);
1642
0
        extended_data_tree = proto_item_add_subtree(ti, ett_sflow_245_extended_data);
1643
0
        offset += 4;
1644
1645
0
        switch (ext_type) {
1646
0
            case SFLOW_245_EXTENDED_SWITCH:
1647
0
                offset = dissect_sflow_245_extended_switch(tvb, extended_data_tree, offset);
1648
0
                break;
1649
0
            case SFLOW_245_EXTENDED_ROUTER:
1650
0
                offset = dissect_sflow_245_extended_router(tvb, pinfo, extended_data_tree, offset);
1651
0
                break;
1652
0
            case SFLOW_245_EXTENDED_GATEWAY:
1653
0
                offset = dissect_sflow_245_extended_gateway(tvb, pinfo, extended_data_tree, offset);
1654
0
                break;
1655
0
            case SFLOW_245_EXTENDED_USER:
1656
0
                break;
1657
0
            case SFLOW_245_EXTENDED_URL:
1658
0
                break;
1659
0
            default:
1660
0
                break;
1661
0
        }
1662
0
        proto_item_set_end(ti, tvb, offset);
1663
0
    }
1664
0
    return offset;
1665
1666
0
}
1667
1668
/* dissect an sflow v5 flow record */
1669
static int
1670
0
dissect_sflow_5_flow_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
1671
0
    proto_tree *flow_data_tree;
1672
0
    proto_item *ti, *expert_ti;
1673
0
    uint32_t    enterprise_format, enterprise, format, length;
1674
1675
    /* what kind of flow sample is it? */
1676
0
    enterprise_format = tvb_get_ntohl(tvb, offset);
1677
0
    enterprise = enterprise_format >> 12;
1678
0
    format = enterprise_format & 0x00000fff;
1679
1680
    /* only accept default enterprise 0 (InMon sFlow) */
1681
0
    if (enterprise == ENTERPRISE_DEFAULT) {
1682
0
        flow_data_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_sflow_5_flow_record, &ti,
1683
0
                val_to_str_ext_const(format, &sflow_5_flow_record_type_ext, "Unknown sample format"));
1684
1685
0
        proto_tree_add_uint_format_value(flow_data_tree, hf_sflow_enterprise, tvb, offset, 4,
1686
0
                            enterprise, "standard sFlow (%u)", enterprise);
1687
0
        proto_tree_add_item(flow_data_tree, hf_sflow_5_flow_record_format, tvb, offset, 4, ENC_BIG_ENDIAN);
1688
0
        offset += 4;
1689
1690
0
        proto_tree_add_item_ret_uint(flow_data_tree, hf_sflow_5_flow_data_length, tvb, offset, 4, ENC_BIG_ENDIAN, &length);
1691
0
        offset += 4;
1692
1693
0
        switch (format) {
1694
0
            case SFLOW_5_RAW_PACKET_HEADER:
1695
0
                offset = dissect_sflow_245_sampled_header(tvb, pinfo, flow_data_tree, offset);
1696
0
                break;
1697
0
            case SFLOW_5_ETHERNET_FRAME:
1698
0
                offset = dissect_sflow_5_ethernet_frame(tvb, flow_data_tree, offset);
1699
0
                break;
1700
0
            case SFLOW_5_IPV4:
1701
0
                offset = dissect_sflow_5_ipv4(tvb, flow_data_tree, offset);
1702
0
                break;
1703
0
            case SFLOW_5_IPV6:
1704
0
                offset = dissect_sflow_5_ipv6(tvb, flow_data_tree, offset);
1705
0
                break;
1706
0
            case SFLOW_5_SWITCH:
1707
0
                offset = dissect_sflow_245_extended_switch(tvb, flow_data_tree, offset);
1708
0
                break;
1709
0
            case SFLOW_5_ROUTER:
1710
0
                offset = dissect_sflow_245_extended_router(tvb, pinfo, flow_data_tree, offset);
1711
0
                break;
1712
0
            case SFLOW_5_GATEWAY:
1713
0
                offset = dissect_sflow_245_extended_gateway(tvb, pinfo, flow_data_tree, offset);
1714
0
                break;
1715
0
            case SFLOW_5_USER:
1716
0
                offset = dissect_sflow_5_extended_user(tvb, flow_data_tree, offset);
1717
0
                break;
1718
0
            case SFLOW_5_URL:
1719
0
                offset = dissect_sflow_5_extended_url(tvb, flow_data_tree, offset);
1720
0
                break;
1721
0
            case SFLOW_5_MPLS_DATA:
1722
0
                offset = dissect_sflow_5_extended_mpls_data(tvb, pinfo, flow_data_tree, offset);
1723
0
                break;
1724
0
            case SFLOW_5_NAT:
1725
0
                offset = dissect_sflow_5_extended_nat(tvb, pinfo, flow_data_tree, offset);
1726
0
                break;
1727
0
            case SFLOW_5_MPLS_TUNNEL:
1728
0
                offset = dissect_sflow_5_extended_mpls_tunnel(tvb, flow_data_tree, offset);
1729
0
                break;
1730
0
            case SFLOW_5_MPLS_VC:
1731
0
                offset = dissect_sflow_5_extended_mpls_vc(tvb, flow_data_tree, offset);
1732
0
                break;
1733
0
            case SFLOW_5_MPLS_FEC:
1734
0
                offset = dissect_sflow_5_extended_mpls_fec(tvb, flow_data_tree, offset);
1735
0
                break;
1736
0
            case SFLOW_5_MPLS_LVP_FEC:
1737
0
                offset = dissect_sflow_5_extended_mpls_lvp_fec(tvb, flow_data_tree, offset);
1738
0
                break;
1739
0
            case SFLOW_5_VLAN_TUNNEL:
1740
0
                offset = dissect_sflow_5_extended_vlan_tunnel(tvb, flow_data_tree, offset);
1741
0
                break;
1742
0
            case SFLOW_5_80211_PAYLOAD:
1743
0
                offset = dissect_sflow_5_extended_80211_payload(tvb, flow_data_tree, offset);
1744
0
                break;
1745
0
            case SFLOW_5_80211_RX:
1746
0
                offset = dissect_sflow_5_extended_80211_rx(tvb, flow_data_tree, offset);
1747
0
                break;
1748
0
            case SFLOW_5_80211_TX:
1749
0
                offset = dissect_sflow_5_extended_80211_tx(tvb, flow_data_tree, offset);
1750
0
                break;
1751
0
            case SFLOW_5_80211_AGGREGATION:
1752
0
                offset = dissect_sflow_5_extended_80211_aggregation(tvb, flow_data_tree, offset);
1753
0
                break;
1754
0
            default:
1755
0
                expert_ti = proto_tree_add_item(flow_data_tree, hf_sflow_enterprise_data, tvb, offset, length, ENC_NA);
1756
0
                expert_add_info(pinfo, expert_ti, &ei_sflow_unknown_record_format);
1757
0
                offset += WS_ROUNDUP_4(length);
1758
0
                break;
1759
0
        }
1760
0
    } else {
1761
        /* unknown enterprise format, what to do?? */
1762
0
        flow_data_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
1763
0
            ett_sflow_5_flow_record, &ti, "Unknown enterprise format");
1764
0
        proto_tree_add_uint_format_value(flow_data_tree, hf_sflow_enterprise, tvb, offset, 4,
1765
0
                                    enterprise, "Non-standard sFlow (%u)", enterprise);
1766
0
        offset += 4;
1767
        /* get length */
1768
0
        proto_tree_add_item_ret_uint(flow_data_tree, hf_sflow_enterprise_length, tvb, offset, 4, ENC_BIG_ENDIAN, &length);
1769
0
        offset += 4;
1770
        /* show data as bytes */
1771
0
        proto_tree_add_item(flow_data_tree, hf_sflow_enterprise_data, tvb, offset, length, ENC_NA);
1772
0
        offset += length;
1773
        /* get the correct offset by adding padding byte count */
1774
0
        offset += WS_PADDING_TO_4(length);
1775
0
    }
1776
0
    proto_item_set_end(ti, tvb, offset);
1777
1778
0
    return offset;
1779
0
}
1780
1781
/* dissect generic interface counters */
1782
static int
1783
0
dissect_sflow_5_generic_interface(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
1784
1785
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifindex, tvb, offset, 4, ENC_BIG_ENDIAN);
1786
0
    offset += 4;
1787
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_iftype, tvb, offset, 4, ENC_BIG_ENDIAN);
1788
0
    offset += 4;
1789
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifspeed, tvb, offset, 8, ENC_BIG_ENDIAN);
1790
0
    offset += 8;
1791
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifdirection, tvb, offset, 4, ENC_BIG_ENDIAN);
1792
0
    offset += 4;
1793
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifadmin_status, tvb, offset, 4, ENC_BIG_ENDIAN);
1794
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifoper_status, tvb, offset, 4, ENC_BIG_ENDIAN);
1795
0
    offset += 4;
1796
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifinoct, tvb, offset, 8, ENC_BIG_ENDIAN);
1797
0
    offset += 8;
1798
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifinpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
1799
0
    offset += 4;
1800
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifinmcast, tvb, offset, 4, ENC_BIG_ENDIAN);
1801
0
    offset += 4;
1802
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifinbcast, tvb, offset, 4, ENC_BIG_ENDIAN);
1803
0
    offset += 4;
1804
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifindisc, tvb, offset, 4, ENC_BIG_ENDIAN);
1805
0
    offset += 4;
1806
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifinerr, tvb, offset, 4, ENC_BIG_ENDIAN);
1807
0
    offset += 4;
1808
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifinunk, tvb, offset, 4, ENC_BIG_ENDIAN);
1809
0
    offset += 4;
1810
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifoutoct, tvb, offset, 8, ENC_BIG_ENDIAN);
1811
0
    offset += 8;
1812
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifoutpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
1813
0
    offset += 4;
1814
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifoutmcast, tvb, offset, 4, ENC_BIG_ENDIAN);
1815
0
    offset += 4;
1816
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifoutbcast, tvb, offset, 4, ENC_BIG_ENDIAN);
1817
0
    offset += 4;
1818
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifoutdisc, tvb, offset, 4, ENC_BIG_ENDIAN);
1819
0
    offset += 4;
1820
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifouterr, tvb, offset, 4, ENC_BIG_ENDIAN);
1821
0
    offset += 4;
1822
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ifpromisc, tvb, offset, 4, ENC_BIG_ENDIAN);
1823
0
    offset += 4;
1824
1825
0
    return offset;
1826
0
}
1827
1828
/* dissect ethernet interface counters */
1829
static int
1830
0
dissect_sflow_5_ethernet_interface(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
1831
1832
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsAlignmentErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1833
0
    offset += 4;
1834
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsFCSErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1835
0
    offset += 4;
1836
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsSingleCollisionFrames, tvb, offset, 4, ENC_BIG_ENDIAN);
1837
0
    offset += 4;
1838
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsMultipleCollisionFrames, tvb, offset, 4, ENC_BIG_ENDIAN);
1839
0
    offset += 4;
1840
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsSQETestErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1841
0
    offset += 4;
1842
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsDeferredTransmissions, tvb, offset, 4, ENC_BIG_ENDIAN);
1843
0
    offset += 4;
1844
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsLateCollisions, tvb, offset, 4, ENC_BIG_ENDIAN);
1845
0
    offset += 4;
1846
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsExcessiveCollisions, tvb, offset, 4, ENC_BIG_ENDIAN);
1847
0
    offset += 4;
1848
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsInternalMacTransmitErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1849
0
    offset += 4;
1850
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsCarrierSenseErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1851
0
    offset += 4;
1852
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsFrameTooLongs, tvb, offset, 4, ENC_BIG_ENDIAN);
1853
0
    offset += 4;
1854
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsInternalMacReceiveErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1855
0
    offset += 4;
1856
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot3StatsSymbolErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1857
0
    offset += 4;
1858
1859
0
    return offset;
1860
0
}
1861
1862
/* dissect token ring counters */
1863
static int
1864
0
dissect_sflow_5_token_ring(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
1865
1866
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsLineErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1867
0
    offset += 4;
1868
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsBurstErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1869
0
    offset += 4;
1870
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsACErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1871
0
    offset += 4;
1872
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsAbortTransErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1873
0
    offset += 4;
1874
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsInternalErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1875
0
    offset += 4;
1876
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsLostFrameErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1877
0
    offset += 4;
1878
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsReceiveCongestions, tvb, offset, 4, ENC_BIG_ENDIAN);
1879
0
    offset += 4;
1880
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsFrameCopiedErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1881
0
    offset += 4;
1882
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsTokenErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1883
0
    offset += 4;
1884
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsSoftErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1885
0
    offset += 4;
1886
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsHardErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1887
0
    offset += 4;
1888
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsSignalLoss, tvb, offset, 4, ENC_BIG_ENDIAN);
1889
0
    offset += 4;
1890
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsTransmitBeacons, tvb, offset, 4, ENC_BIG_ENDIAN);
1891
0
    offset += 4;
1892
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsRecoveries, tvb, offset, 4, ENC_BIG_ENDIAN);
1893
0
    offset += 4;
1894
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsLobeWires, tvb, offset, 4, ENC_BIG_ENDIAN);
1895
0
    offset += 4;
1896
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsRemoves, tvb, offset, 4, ENC_BIG_ENDIAN);
1897
0
    offset += 4;
1898
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsSingles, tvb, offset, 4, ENC_BIG_ENDIAN);
1899
0
    offset += 4;
1900
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot5StatsFreqErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1901
0
    offset += 4;
1902
1903
0
    return offset;
1904
0
}
1905
1906
/* dissect 100 BaseVG interface counters */
1907
static int
1908
0
dissect_sflow_5_vg_interface(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
1909
1910
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InHighPriorityFrames, tvb, offset, 4, ENC_BIG_ENDIAN);
1911
0
    offset += 4;
1912
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InHighPriorityOctets, tvb, offset, 8, ENC_BIG_ENDIAN);
1913
0
    offset += 8;
1914
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InNormPriorityFrames, tvb, offset, 4, ENC_BIG_ENDIAN);
1915
0
    offset += 4;
1916
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InNormPriorityOctets, tvb, offset, 8, ENC_BIG_ENDIAN);
1917
0
    offset += 8;
1918
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InIPMErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1919
0
    offset += 4;
1920
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InOversizeFrameErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1921
0
    offset += 4;
1922
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InDataErrors, tvb, offset, 4, ENC_BIG_ENDIAN);
1923
0
    offset += 4;
1924
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12InNullAddressedFrames, tvb, offset, 4, ENC_BIG_ENDIAN);
1925
0
    offset += 4;
1926
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12OutHighPriorityFrames, tvb, offset, 4, ENC_BIG_ENDIAN);
1927
0
    offset += 4;
1928
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12OutHighPriorityOctets, tvb, offset, 8, ENC_BIG_ENDIAN);
1929
0
    offset += 8;
1930
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12TransitionIntoTrainings, tvb, offset, 4, ENC_BIG_ENDIAN);
1931
0
    offset += 4;
1932
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12HCInHighPriorityOctets, tvb, offset, 8, ENC_BIG_ENDIAN);
1933
0
    offset += 8;
1934
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12HCInNormPriorityOctets, tvb, offset, 8, ENC_BIG_ENDIAN);
1935
0
    offset += 8;
1936
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_dot12HCOutHighPriorityOctets, tvb, offset, 8, ENC_BIG_ENDIAN);
1937
0
    offset += 8;
1938
1939
0
    return offset;
1940
0
}
1941
1942
/* dissect VLAN counters */
1943
static int
1944
0
dissect_sflow_5_vlan(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
1945
1946
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_vlan_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1947
0
    offset += 4;
1948
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_octets, tvb, offset, 8, ENC_BIG_ENDIAN);
1949
0
    offset += 8;
1950
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_ucastPkts, tvb, offset, 4, ENC_BIG_ENDIAN);
1951
0
    offset += 4;
1952
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_multicastPkts, tvb, offset, 4, ENC_BIG_ENDIAN);
1953
0
    offset += 4;
1954
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_broadcastPkts, tvb, offset, 4, ENC_BIG_ENDIAN);
1955
0
    offset += 4;
1956
0
    proto_tree_add_item(counter_data_tree, hf_sflow_245_discards, tvb, offset, 4, ENC_BIG_ENDIAN);
1957
0
    offset += 4;
1958
1959
0
    return offset;
1960
0
}
1961
1962
static int * const sflow_5_lag_port_state_flags[] = {
1963
    &hf_sflow_5_lag_port_actoradminstate,
1964
    &hf_sflow_5_lag_port_actoroperstate,
1965
    &hf_sflow_5_lag_port_partneradminstate,
1966
    &hf_sflow_5_lag_port_partneroperstate,
1967
    NULL
1968
};
1969
1970
static int
1971
0
dissect_sflow_5_lag(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
1972
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_actorsystemid, tvb, offset, 6, ENC_NA);
1973
0
    offset += 6;
1974
    /* XDR requires 4-byte alignment */
1975
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_padding, tvb, offset, 2, ENC_NA);
1976
0
    offset += 2;
1977
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_partneropersystemid, tvb, offset, 6, ENC_NA);
1978
0
    offset += 6;
1979
    /* XDR requires 4-byte alignment */
1980
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_padding, tvb, offset, 2, ENC_NA);
1981
0
    offset += 2;
1982
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_attachedaggid, tvb, offset, 4, ENC_BIG_ENDIAN);
1983
0
    offset += 4;
1984
0
    proto_tree_add_bitmask(counter_data_tree, tvb, offset, hf_sflow_lag_port_state, ett_sflow_lag_port_state_flags, sflow_5_lag_port_state_flags, ENC_BIG_ENDIAN);
1985
0
    offset += 4;
1986
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_lacpdusrx, tvb, offset, 4, ENC_BIG_ENDIAN);
1987
0
    offset += 4;
1988
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_markerpdusrx, tvb, offset, 4, ENC_BIG_ENDIAN);
1989
0
    offset += 4;
1990
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_markerresponsepdusrx, tvb, offset, 4, ENC_BIG_ENDIAN);
1991
0
    offset += 4;
1992
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_unknownrx, tvb, offset, 4, ENC_BIG_ENDIAN);
1993
0
    offset += 4;
1994
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_illegalrx, tvb, offset, 4, ENC_BIG_ENDIAN);
1995
0
    offset += 4;
1996
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_lacpdustx, tvb, offset, 4, ENC_BIG_ENDIAN);
1997
0
    offset += 4;
1998
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_markerpdustx, tvb, offset, 4, ENC_BIG_ENDIAN);
1999
0
    offset += 4;
2000
0
    proto_tree_add_item(counter_data_tree, hf_sflow_lag_port_stats_markerresponsepdustx, tvb, offset, 4, ENC_BIG_ENDIAN);
2001
0
    offset += 4;
2002
2003
0
    return offset;
2004
0
}
2005
2006
/* dissect 802.11 counters */
2007
static int
2008
0
dissect_sflow_5_80211_counters(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
2009
2010
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11TransmittedFragmentCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2011
0
    offset += 4;
2012
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11MulticastTransmittedFrameCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2013
0
    offset += 4;
2014
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11FailedCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2015
0
    offset += 4;
2016
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11RetryCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2017
0
    offset += 4;
2018
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11MultipleRetryCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2019
0
    offset += 4;
2020
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11FrameDuplicateCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2021
0
    offset += 4;
2022
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11RTSSuccessCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2023
0
    offset += 4;
2024
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11RTSFailureCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2025
0
    offset += 4;
2026
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11ACKFailureCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2027
0
    offset += 4;
2028
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11ReceivedFragmentCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2029
0
    offset += 4;
2030
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11MulticastReceivedFrameCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2031
0
    offset += 4;
2032
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11FCSErrorCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2033
0
    offset += 4;
2034
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11TransmittedFrameCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2035
0
    offset += 4;
2036
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11WEPUndecryptableCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2037
0
    offset += 4;
2038
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11QoSDiscardedFragmentCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2039
0
    offset += 4;
2040
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11AssociatedStationCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2041
0
    offset += 4;
2042
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11QoSCFPollsReceivedCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2043
0
    offset += 4;
2044
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11QoSCFPollsUnusedCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2045
0
    offset += 4;
2046
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11QoSCFPollsUnusableCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2047
0
    offset += 4;
2048
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_dot11QoSCFPollsLostCount, tvb, offset, 4, ENC_BIG_ENDIAN);
2049
0
    offset += 4;
2050
2051
0
    return offset;
2052
0
}
2053
2054
/* dissect processor information */
2055
static int
2056
0
dissect_sflow_5_processor_information(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
2057
2058
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_cpu_5s, tvb, offset, 4, ENC_BIG_ENDIAN);
2059
0
    offset += 4;
2060
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_cpu_1m, tvb, offset, 4, ENC_BIG_ENDIAN);
2061
0
    offset += 4;
2062
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_cpu_5m, tvb, offset, 4, ENC_BIG_ENDIAN);
2063
0
    offset += 4;
2064
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_total_memory, tvb, offset, 8, ENC_BIG_ENDIAN);
2065
0
    offset += 8;
2066
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_free_memory, tvb, offset, 8, ENC_BIG_ENDIAN);
2067
0
    offset += 8;
2068
2069
0
    return offset;
2070
0
}
2071
2072
/* dissect radio utilization */
2073
static int
2074
0
dissect_sflow_5_radio_utilization(proto_tree *counter_data_tree, tvbuff_t *tvb, int offset) {
2075
2076
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_elapsed_time, tvb, offset, 4, ENC_BIG_ENDIAN);
2077
0
    offset += 4;
2078
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_on_channel_time, tvb, offset, 4, ENC_BIG_ENDIAN);
2079
0
    offset += 4;
2080
0
    proto_tree_add_item(counter_data_tree, hf_sflow_5_on_channel_busy_time, tvb, offset, 4, ENC_BIG_ENDIAN);
2081
0
    offset += 4;
2082
2083
0
    return offset;
2084
0
}
2085
2086
/* dissect an sflow v5 counters record */
2087
static int
2088
0
dissect_sflow_5_counters_record(tvbuff_t *tvb, proto_tree *tree, int offset) {
2089
0
    proto_tree *counter_data_tree;
2090
0
    proto_item *ti, *expert_ti;
2091
0
    uint32_t    enterprise_format, enterprise, format, length;
2092
2093
    /* what kind of flow sample is it? */
2094
0
    enterprise_format = tvb_get_ntohl(tvb, offset);
2095
0
    enterprise = enterprise_format >> 12;
2096
0
    format = enterprise_format & 0x00000fff;
2097
2098
0
    if (enterprise == ENTERPRISE_DEFAULT) { /* only accept default enterprise 0 (InMon sFlow) */
2099
0
        counter_data_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_sflow_5_counters_record, &ti,
2100
0
                val_to_str_const(format, sflow_5_counters_record_type, "Unknown sample format"));
2101
2102
0
        proto_tree_add_uint_format_value(counter_data_tree, hf_sflow_enterprise, tvb, offset, 4,
2103
0
                                enterprise, "standard sFlow (%u)", enterprise);
2104
2105
0
        proto_tree_add_item(counter_data_tree, hf_sflow_5_counters_record_format, tvb, offset, 4, ENC_BIG_ENDIAN);
2106
0
        offset += 4;
2107
2108
0
        proto_tree_add_item_ret_uint(counter_data_tree, hf_sflow_5_flow_data_length, tvb, offset, 4, ENC_BIG_ENDIAN, &length);
2109
0
        offset += 4;
2110
2111
0
        switch (format) {
2112
0
            case SFLOW_5_GENERIC_INTERFACE:
2113
0
                offset = dissect_sflow_5_generic_interface(counter_data_tree, tvb, offset);
2114
0
                break;
2115
0
            case SFLOW_5_ETHERNET_INTERFACE:
2116
0
                offset = dissect_sflow_5_ethernet_interface(counter_data_tree, tvb, offset);
2117
0
                break;
2118
0
            case SFLOW_5_TOKEN_RING:
2119
0
                offset = dissect_sflow_5_token_ring(counter_data_tree, tvb, offset);
2120
0
                break;
2121
0
            case SFLOW_5_100BASE_VG_INTERFACE:
2122
0
                offset = dissect_sflow_5_vg_interface(counter_data_tree, tvb, offset);
2123
0
                break;
2124
0
            case SFLOW_5_VLAN:
2125
0
                offset = dissect_sflow_5_vlan(counter_data_tree, tvb, offset);
2126
0
                break;
2127
0
            case SFLOW_5_LAG:
2128
0
                offset = dissect_sflow_5_lag(counter_data_tree, tvb, offset);
2129
0
                break;
2130
0
            case SFLOW_5_80211_COUNTERS:
2131
0
                offset = dissect_sflow_5_80211_counters(counter_data_tree, tvb, offset);
2132
0
                break;
2133
0
            case SFLOW_5_PROCESSOR:
2134
0
                offset = dissect_sflow_5_processor_information(counter_data_tree, tvb, offset);
2135
0
                break;
2136
0
            case SFLOW_5_RADIO_UTILIZATION:
2137
0
                offset = dissect_sflow_5_radio_utilization(counter_data_tree, tvb, offset);
2138
0
                break;
2139
0
            default:
2140
0
                expert_ti = proto_tree_add_item(counter_data_tree, hf_sflow_enterprise_data, tvb, offset, length, ENC_NA);
2141
0
                expert_add_info(NULL, expert_ti, &ei_sflow_unknown_record_format);
2142
0
                offset += WS_ROUNDUP_4(length);
2143
0
                break;
2144
0
        }
2145
0
    } else { /* unknown enterprise format, what to do?? */
2146
0
        counter_data_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
2147
0
            ett_sflow_5_counters_record, &ti, "Unknown enterprise format");
2148
0
        proto_tree_add_uint_format_value(counter_data_tree, hf_sflow_enterprise, tvb, offset, 4,
2149
0
                        enterprise, "Non-standard sFlow (%u)", enterprise);
2150
0
        offset += 4;
2151
        /* get length */
2152
0
        proto_tree_add_item_ret_uint(counter_data_tree, hf_sflow_enterprise_length, tvb, offset, 4, ENC_BIG_ENDIAN, &length);
2153
0
        offset += 4;
2154
        /* show data as bytes */
2155
0
        proto_tree_add_item(counter_data_tree, hf_sflow_enterprise_data, tvb, offset, length, ENC_NA);
2156
0
        offset += length;
2157
        /* get the correct offset by adding padding byte count */
2158
0
        offset += WS_PADDING_TO_4(length);
2159
0
    }
2160
0
    proto_item_set_end(ti, tvb, offset);
2161
2162
0
    return offset;
2163
0
}
2164
2165
/* dissect an sflow v5 flow sample */
2166
static void
2167
dissect_sflow_5_flow_sample(tvbuff_t *tvb, packet_info *pinfo,
2168
0
        proto_tree *tree, int offset, proto_item *parent) {
2169
2170
0
    uint32_t sequence_number, sampling_rate,
2171
0
            output, records, i, output_format;
2172
0
    proto_item *ti;
2173
0
    proto_tree *output_interface_tree;
2174
2175
0
    sequence_number = tvb_get_ntohl(tvb, offset);
2176
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
2177
0
    offset += 4;
2178
0
    proto_item_append_text(parent, ", seq %u", sequence_number);
2179
2180
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_source_id_class, tvb, offset, 4, ENC_BIG_ENDIAN);
2181
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_index, tvb, offset, 4, ENC_BIG_ENDIAN);
2182
0
    offset += 4;
2183
0
    sampling_rate = tvb_get_ntohl(tvb, offset);
2184
0
    proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sampling_rate, tvb, offset, 4,
2185
0
            sampling_rate, "1 out of %u packets", sampling_rate);
2186
0
    offset += 4;
2187
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_sample_pool, tvb, offset, 4, ENC_BIG_ENDIAN);
2188
0
    offset += 4;
2189
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_dropped_packets, tvb, offset, 4, ENC_BIG_ENDIAN);
2190
0
    offset += 4;
2191
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_input_interface, tvb, offset, 4, ENC_BIG_ENDIAN);
2192
0
    offset += 4;
2193
0
    ti = proto_tree_add_item_ret_uint(tree, hf_sflow_5_flow_sample_output_interface, tvb, offset, 4, ENC_BIG_ENDIAN, &output);
2194
0
    output_interface_tree = proto_item_add_subtree(ti, ett_sflow_5_output_interface);
2195
0
    output_format = output >> 30;
2196
0
    proto_tree_add_item(output_interface_tree, hf_sflow_5_flow_sample_output_interface_form, tvb, offset, 4, ENC_BIG_ENDIAN);
2197
0
    switch(output_format) {
2198
0
        case SFLOW_5_INT_FORMAT_DISCARD:
2199
0
            proto_tree_add_item(output_interface_tree, hf_sflow_5_flow_sample_output_interface_val_discard, tvb, offset, 4, ENC_BIG_ENDIAN);
2200
0
            break;
2201
0
        case SFLOW_5_INT_FORMAT_MULTIPLE:
2202
0
            ti =proto_tree_add_item(output_interface_tree, hf_sflow_5_flow_sample_output_interface_val, tvb, offset, 4, ENC_BIG_ENDIAN);
2203
0
            if (output == 0x80000000) {
2204
0
                proto_item_append_text(ti, " unknown number of interfaces greater than 1");
2205
0
            }
2206
0
            break;
2207
0
        case SFLOW_5_INT_FORMAT_IFINDEX:
2208
0
        default:
2209
0
            proto_tree_add_item(output_interface_tree, hf_sflow_5_flow_sample_output_interface_val, tvb, offset, 4, ENC_BIG_ENDIAN);
2210
0
            break;
2211
0
    }
2212
0
    offset += 4;
2213
0
    records = tvb_get_ntohl(tvb, offset);
2214
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_flow_record, tvb, offset, 4, ENC_BIG_ENDIAN);
2215
0
    offset += 4;
2216
2217
    /* start loop processing flow records */
2218
    /* we set an upper records limit to 255 in case corrupted data causes
2219
     * huge number of loops! */
2220
0
    for (i = 0; i < (records&0x000000ff); i++) {
2221
0
        offset = dissect_sflow_5_flow_record(tvb, pinfo, tree, offset);
2222
0
    }
2223
2224
0
}
2225
2226
/* dissect an expanded flow sample */
2227
static void
2228
dissect_sflow_5_expanded_flow_sample(tvbuff_t *tvb, packet_info *pinfo,
2229
0
        proto_tree *tree, int offset, proto_item *parent) {
2230
2231
0
    proto_item *ti;
2232
0
    uint32_t sequence_number, sampling_rate, records, i, output_format, output_value;
2233
2234
0
    sequence_number = tvb_get_ntohl(tvb, offset);
2235
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
2236
0
    offset += 4;
2237
0
    proto_item_append_text(parent, ", seq %u", sequence_number);
2238
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_source_id_type, tvb, offset, 4, ENC_BIG_ENDIAN);
2239
0
    offset += 4;
2240
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_source_id_index, tvb, offset, 4, ENC_BIG_ENDIAN);
2241
0
    offset += 4;
2242
0
    sampling_rate = tvb_get_ntohl(tvb, offset);
2243
0
    proto_tree_add_uint_format_value(tree, hf_sflow_flow_sample_sampling_rate, tvb, offset, 4,
2244
0
            sampling_rate, "1 out of %u packets", sampling_rate);
2245
0
    offset += 4;
2246
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_sample_pool, tvb, offset, 4, ENC_BIG_ENDIAN);
2247
0
    offset += 4;
2248
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_dropped_packets, tvb, offset, 4, ENC_BIG_ENDIAN);
2249
0
    offset += 4;
2250
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_input_interface_format, tvb, offset, 4, ENC_BIG_ENDIAN);
2251
0
    offset += 4;
2252
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_input_interface_value, tvb, offset, 4, ENC_BIG_ENDIAN);
2253
0
    offset += 4;
2254
0
    proto_tree_add_item_ret_uint(tree, hf_sflow_5_flow_sample_output_interface_expanded_format, tvb, offset, 4, ENC_BIG_ENDIAN, &output_format);
2255
0
    offset += 4;
2256
0
    switch(output_format) {
2257
0
        case SFLOW_5_INT_FORMAT_DISCARD:
2258
0
            proto_tree_add_item(tree, hf_sflow_5_flow_sample_output_interface_expanded_value_discarded, tvb, offset, 4, ENC_BIG_ENDIAN);
2259
0
            break;
2260
0
        case SFLOW_5_INT_FORMAT_MULTIPLE:
2261
0
            ti =proto_tree_add_item_ret_uint(tree, hf_sflow_5_flow_sample_output_interface_expanded_value_number, tvb, offset, 4, ENC_BIG_ENDIAN, &output_value);
2262
0
            if (output_value == 0x0) {
2263
0
                proto_item_append_text(ti, " unknown number of interfaces greater than 1");
2264
0
            }
2265
0
            break;
2266
0
        case SFLOW_5_INT_FORMAT_IFINDEX:
2267
0
            proto_tree_add_item(tree, hf_sflow_5_flow_sample_output_interface_expanded_value_ifindex, tvb, offset, 4, ENC_BIG_ENDIAN);
2268
0
            break;
2269
0
        default:
2270
0
            proto_tree_add_item(tree, hf_sflow_5_flow_sample_output_interface_expanded_value, tvb, offset, 4, ENC_BIG_ENDIAN);
2271
0
            break;
2272
0
    }
2273
0
    offset += 4;
2274
0
    records = tvb_get_ntohl(tvb, offset);
2275
0
    proto_tree_add_item(tree, hf_sflow_flow_sample_flow_record, tvb, offset, 4, ENC_BIG_ENDIAN);
2276
0
    offset += 4;
2277
2278
    /* start loop processing flow records
2279
     * we limit record count to 255 in case corrupted data may cause huge number of loops */
2280
0
    for (i = 0; i < (records&0x000000ff); i++) {
2281
0
        offset = dissect_sflow_5_flow_record(tvb, pinfo, tree, offset);
2282
0
    }
2283
0
}
2284
2285
/* dissect an sflow v2/4 counters sample */
2286
static int
2287
0
dissect_sflow_24_counters_sample(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *parent) {
2288
2289
0
    uint32_t sequence_number, counters_type;
2290
2291
0
    sequence_number = tvb_get_ntohl(tvb, offset);
2292
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
2293
0
    proto_item_append_text(parent, ", seq %u", sequence_number);
2294
2295
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_source_id_class, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2296
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_index, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2297
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_sampling_interval, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
2298
0
    counters_type = tvb_get_ntohl(tvb, offset + 12);
2299
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_counters_type, tvb, offset + 12, 4, ENC_BIG_ENDIAN);
2300
2301
0
    offset += 16;
2302
2303
    /* most counters types have the "generic" counters first */
2304
0
    switch (counters_type) {
2305
0
        case SFLOW_245_COUNTERS_GENERIC:
2306
0
        case SFLOW_245_COUNTERS_ETHERNET:
2307
0
        case SFLOW_245_COUNTERS_TOKENRING:
2308
0
        case SFLOW_245_COUNTERS_FDDI:
2309
0
        case SFLOW_245_COUNTERS_VG:
2310
0
        case SFLOW_245_COUNTERS_WAN:
2311
0
            proto_tree_add_item(tree, hf_sflow_245_ifindex, tvb, offset, 4, ENC_BIG_ENDIAN);
2312
0
            proto_item_append_text(parent, ", ifIndex %u", tvb_get_ntohl(tvb, offset));
2313
0
            offset += 4;
2314
0
            proto_tree_add_item(tree, hf_sflow_245_iftype, tvb, offset, 4, ENC_BIG_ENDIAN);
2315
0
            offset += 4;
2316
0
            proto_tree_add_item(tree, hf_sflow_245_ifspeed, tvb, offset, 8, ENC_BIG_ENDIAN);
2317
0
            offset += 8;
2318
0
            proto_tree_add_item(tree, hf_sflow_245_ifdirection, tvb, offset, 4, ENC_BIG_ENDIAN);
2319
0
            offset += 4;
2320
0
            proto_tree_add_item(tree, hf_sflow_245_ifadmin_status, tvb, offset, 4, ENC_BIG_ENDIAN);
2321
0
            proto_tree_add_item(tree, hf_sflow_245_ifoper_status, tvb, offset, 4, ENC_BIG_ENDIAN);
2322
0
            offset += 4;
2323
0
            proto_tree_add_item(tree, hf_sflow_245_ifinoct, tvb, offset, 8, ENC_BIG_ENDIAN);
2324
0
            offset += 8;
2325
0
            proto_tree_add_item(tree, hf_sflow_245_ifinpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
2326
0
            offset += 4;
2327
0
            proto_tree_add_item(tree, hf_sflow_245_ifinmcast, tvb, offset, 4, ENC_BIG_ENDIAN);
2328
0
            offset += 4;
2329
0
            proto_tree_add_item(tree, hf_sflow_245_ifinbcast, tvb, offset, 4, ENC_BIG_ENDIAN);
2330
0
            offset += 4;
2331
0
            proto_tree_add_item(tree, hf_sflow_245_ifindisc, tvb, offset, 4, ENC_BIG_ENDIAN);
2332
0
            offset += 4;
2333
0
            proto_tree_add_item(tree, hf_sflow_245_ifinerr, tvb, offset, 4, ENC_BIG_ENDIAN);
2334
0
            offset += 4;
2335
0
            proto_tree_add_item(tree, hf_sflow_245_ifinunk, tvb, offset, 4, ENC_BIG_ENDIAN);
2336
0
            offset += 4;
2337
0
            proto_tree_add_item(tree, hf_sflow_245_ifoutoct, tvb, offset, 8, ENC_BIG_ENDIAN);
2338
0
            offset += 8;
2339
0
            proto_tree_add_item(tree, hf_sflow_245_ifoutpkt, tvb, offset, 4, ENC_BIG_ENDIAN);
2340
0
            offset += 4;
2341
0
            proto_tree_add_item(tree, hf_sflow_245_ifoutmcast, tvb, offset, 4, ENC_BIG_ENDIAN);
2342
0
            offset += 4;
2343
0
            proto_tree_add_item(tree, hf_sflow_245_ifoutbcast, tvb, offset, 4, ENC_BIG_ENDIAN);
2344
0
            offset += 4;
2345
0
            proto_tree_add_item(tree, hf_sflow_245_ifoutdisc, tvb, offset, 4, ENC_BIG_ENDIAN);
2346
0
            offset += 4;
2347
0
            proto_tree_add_item(tree, hf_sflow_245_ifouterr, tvb, offset, 4, ENC_BIG_ENDIAN);
2348
0
            offset += 4;
2349
0
            proto_tree_add_item(tree, hf_sflow_245_ifpromisc, tvb, offset, 4, ENC_BIG_ENDIAN);
2350
0
            offset += 4;
2351
0
            break;
2352
0
    }
2353
2354
    /* Some counter types have other info to gather */
2355
0
    switch (counters_type) {
2356
0
        case SFLOW_245_COUNTERS_ETHERNET:
2357
0
            offset += (int)sizeof (struct ethernet_counters);
2358
0
            break;
2359
0
        case SFLOW_245_COUNTERS_TOKENRING:
2360
0
            offset = dissect_sflow_5_token_ring(tree, tvb, offset);
2361
0
            break;
2362
0
        case SFLOW_245_COUNTERS_VG:
2363
0
            offset = dissect_sflow_5_vg_interface(tree, tvb, offset);
2364
0
            break;
2365
0
        case SFLOW_245_COUNTERS_VLAN:
2366
0
            offset = dissect_sflow_5_vlan(tree, tvb, offset);
2367
0
            break;
2368
0
        default:
2369
0
            break;
2370
0
    }
2371
0
    return offset;
2372
0
}
2373
2374
/* dissect an sflow v5 counters sample */
2375
static void
2376
0
dissect_sflow_5_counters_sample(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *parent) {
2377
0
    uint32_t sequence_number, records, i;
2378
2379
    /* grab the flow header.  This will remain in network byte
2380
       order, so must convert each item before use */
2381
0
    sequence_number = tvb_get_ntohl(tvb, offset);
2382
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
2383
0
    proto_item_append_text(parent, ", seq %u", sequence_number);
2384
0
    offset += 4;
2385
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_source_id_type, tvb, offset, 4, ENC_BIG_ENDIAN);
2386
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_source_id_index, tvb, offset, 4, ENC_BIG_ENDIAN);
2387
0
    offset += 4;
2388
0
    records = tvb_get_ntohl(tvb, offset);
2389
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_counters_records, tvb, offset, 4, ENC_BIG_ENDIAN);
2390
0
    offset += 4;
2391
2392
    /* start loop processing counters records
2393
     * limit record count to 255 in case corrupted data may cause huge number of loops */
2394
0
    for (i = 0; i < (records&0x000000ff); i++) {
2395
0
        offset = dissect_sflow_5_counters_record(tvb, tree, offset);
2396
0
    }
2397
0
}
2398
2399
/* dissect an expanded counters sample */
2400
static void
2401
0
dissect_sflow_5_expanded_counters_sample(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *parent) {
2402
0
    uint32_t sequence_number, records, i;
2403
2404
0
    sequence_number = tvb_get_ntohl(tvb, offset);
2405
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
2406
0
    proto_item_append_text(parent, ", seq %u", sequence_number);
2407
0
    offset += 4;
2408
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_expanded_source_id_type, tvb, offset, 4, ENC_BIG_ENDIAN);
2409
0
    offset += 4;
2410
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_expanded_source_id_index, tvb, offset, 4, ENC_BIG_ENDIAN);
2411
0
    offset += 4;
2412
0
    records = tvb_get_ntohl(tvb, offset);
2413
0
    proto_tree_add_item(tree, hf_sflow_counters_sample_counters_records, tvb, offset, 4, ENC_BIG_ENDIAN);
2414
0
    offset += 4;
2415
2416
    /* start loop processing counters records
2417
     * limit record count to 255 in case corrupted data may cause huge number of loops */
2418
0
    for (i = 0; i < (records&0x000000ff); i++) {
2419
0
        offset = dissect_sflow_5_counters_record(tvb, tree, offset);
2420
0
    }
2421
0
}
2422
2423
static int * const sflow_lag_port_state_flags[] = {
2424
    &hf_sflow_lag_port_actoradminstate,
2425
    &hf_sflow_lag_port_actoroperstate,
2426
    &hf_sflow_lag_port_partneradminstate,
2427
    &hf_sflow_lag_port_partneroperstate,
2428
    &hf_sflow_lag_port_reserved,
2429
    NULL
2430
};
2431
2432
/* dissect an LAG Port Stats ( http://www.sflow.org/sflow_lag.txt ) */
2433
static void
2434
0
dissect_sflow_5_lag_port_stats(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *parent _U_) {
2435
2436
0
    proto_tree_add_item(tree, hf_sflow_lag_port_actorsystemid, tvb, offset, 6, ENC_NA);
2437
0
    offset += 6;
2438
2439
0
    proto_tree_add_item(tree, hf_sflow_lag_port_partneropersystemid, tvb, offset, 6, ENC_NA);
2440
0
    offset += 6;
2441
2442
0
    proto_tree_add_item(tree, hf_sflow_lag_port_attachedaggid, tvb, offset, 4, ENC_BIG_ENDIAN);
2443
0
    offset += 4;
2444
2445
0
    proto_tree_add_bitmask(tree, tvb, offset, hf_sflow_lag_port_state, ett_sflow_lag_port_state_flags, sflow_lag_port_state_flags, ENC_BIG_ENDIAN);
2446
0
    offset += 4;
2447
2448
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_lacpdusrx, tvb, offset, 4, ENC_BIG_ENDIAN);
2449
0
    offset += 4;
2450
2451
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_markerpdusrx, tvb, offset, 4, ENC_BIG_ENDIAN);
2452
0
    offset += 4;
2453
2454
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_markerresponsepdusrx, tvb, offset, 4, ENC_BIG_ENDIAN);
2455
0
    offset += 4;
2456
2457
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_unknownrx, tvb, offset, 4, ENC_BIG_ENDIAN);
2458
0
    offset += 4;
2459
2460
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_illegalrx, tvb, offset, 4, ENC_BIG_ENDIAN);
2461
0
    offset += 4;
2462
2463
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_lacpdustx, tvb, offset, 4, ENC_BIG_ENDIAN);
2464
0
    offset += 4;
2465
2466
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_markerpdustx, tvb, offset, 4, ENC_BIG_ENDIAN);
2467
0
    offset += 4;
2468
2469
0
    proto_tree_add_item(tree, hf_sflow_lag_port_stats_markerresponsepdustx, tvb, offset, 4, ENC_BIG_ENDIAN);
2470
    /*offset += 4;*/
2471
0
}
2472
2473
/* Code to dissect the sflow v2/4/5 samples */
2474
static int
2475
0
dissect_sflow_245_samples(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint32_t version) {
2476
0
    proto_tree *sflow_245_sample_tree;
2477
0
    proto_item *ti;             /* tree item */
2478
0
    uint32_t    sample_type, enterprise, format, length;
2479
2480
    /* decide what kind of sample it is. */
2481
0
    sample_type = tvb_get_ntohl(tvb, offset);
2482
0
    if (version == 5) {
2483
0
        enterprise = sample_type >> 12;
2484
0
        format = sample_type & 0x00000fff;
2485
2486
0
        if (enterprise == ENTERPRISE_DEFAULT) { /* only accept default enterprise 0 (InMon sFlow) */
2487
0
            sflow_245_sample_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_sflow_245_sample, &ti,
2488
0
                    val_to_str_const(format, sflow_245_sampletype, "Unknown sample format"));
2489
2490
0
            proto_tree_add_uint_format_value(sflow_245_sample_tree, hf_sflow_enterprise, tvb, offset, 4, enterprise, "standard sFlow (%u)", enterprise);
2491
0
            proto_tree_add_item(sflow_245_sample_tree, hf_sflow_245_sampletype12, tvb, offset, 4, ENC_BIG_ENDIAN);
2492
0
            offset += 4;
2493
2494
0
            length = tvb_get_ntohl(tvb, offset);
2495
0
            proto_tree_add_item(sflow_245_sample_tree, hf_sflow_5_sample_length, tvb, offset, 4, ENC_BIG_ENDIAN);
2496
0
            offset += 4;
2497
2498
0
            switch (format) {
2499
0
                case FLOWSAMPLE:
2500
0
                    dissect_sflow_5_flow_sample(tvb, pinfo, sflow_245_sample_tree, offset, ti);
2501
0
                    break;
2502
0
                case COUNTERSSAMPLE:
2503
0
                    dissect_sflow_5_counters_sample(tvb, sflow_245_sample_tree, offset, ti);
2504
0
                    break;
2505
0
                case EXPANDED_FLOWSAMPLE:
2506
0
                    dissect_sflow_5_expanded_flow_sample(tvb, pinfo, sflow_245_sample_tree, offset, ti);
2507
0
                    break;
2508
0
                case EXPANDED_COUNTERSSAMPLE:
2509
0
                    dissect_sflow_5_expanded_counters_sample(tvb, sflow_245_sample_tree, offset, ti);
2510
0
                    break;
2511
0
                case LAG_PORT_STATS:
2512
0
                    dissect_sflow_5_lag_port_stats(tvb, sflow_245_sample_tree, offset, ti);
2513
0
                    break;
2514
0
                default:
2515
0
                    break;
2516
0
            }
2517
            /* Make sure the length doesn't run past the end of the packet */
2518
0
            tvb_ensure_bytes_exist(tvb, offset, length);
2519
            /* current offset points to sample length field, which is 4 bytes from the beginning of the packet*/
2520
0
            offset += length;
2521
0
        } else { /* unknown enterprise format, what to do?? */
2522
0
            sflow_245_sample_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
2523
0
                        ett_sflow_245_sample, &ti, "Unknown enterprise format");
2524
0
            proto_tree_add_uint_format_value(sflow_245_sample_tree, hf_sflow_enterprise, tvb, offset, 4,
2525
0
                            enterprise, "Non-standard sFlow (%u)", enterprise);
2526
0
            offset = tvb_captured_length(tvb);
2527
0
        }
2528
2529
0
    } else { /* version 2 or 4 */
2530
0
        sflow_245_sample_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_sflow_245_sample, &ti,
2531
0
                val_to_str_const(sample_type, sflow_245_sampletype, "Unknown sample type"));
2532
2533
0
        proto_tree_add_item(sflow_245_sample_tree, hf_sflow_245_sampletype, tvb, offset, 4, ENC_BIG_ENDIAN);
2534
0
        offset += 4;
2535
2536
0
        switch (sample_type) {
2537
0
            case FLOWSAMPLE:
2538
0
                offset = dissect_sflow_24_flow_sample(tvb, pinfo, sflow_245_sample_tree, offset, ti);
2539
0
                break;
2540
0
            case COUNTERSSAMPLE:
2541
0
                offset = dissect_sflow_24_counters_sample(tvb, sflow_245_sample_tree, offset, ti);
2542
0
                break;
2543
0
            default:
2544
0
                break;
2545
0
        }
2546
0
    }
2547
0
    proto_item_set_end(ti, tvb, offset);
2548
2549
0
    return offset;
2550
0
}
2551
2552
/* Code to actually dissect the packets */
2553
static int
2554
dissect_sflow_245(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2555
9
{
2556
    /* Set up structures needed to add the protocol subtree and manage it */
2557
9
    proto_item                   *ti;
2558
9
    proto_tree                   *sflow_245_tree;
2559
9
    uint32_t                      version, sub_agent_id, seqnum;
2560
9
    address                       addr_details;
2561
9
    int                           sflow_addr_type;
2562
9
    struct sflow_address_type     addr_type;
2563
9
    uint32_t                      uptime;
2564
2565
9
    uint32_t       numsamples;
2566
9
    unsigned       offset = 0;
2567
9
    unsigned       i      = 0;
2568
2569
9
    addr_type.hf_addr_v4 = hf_sflow_agent_address_v4;
2570
9
    addr_type.hf_addr_v6 = hf_sflow_agent_address_v6;
2571
2572
    /*
2573
     * We fetch the version and address type so that we can determine,
2574
     * ahead of time, whether this is an sFlow packet or not, before
2575
     * we do *anything* to the columns or the protocol tree.
2576
     *
2577
     * XXX - we might want to deem this "not sFlow" if we don't have at
2578
     * least 8 bytes worth of data.
2579
     */
2580
9
    version = tvb_get_ntohl(tvb, offset);
2581
9
    if (version != 2 && version != 4 && version != 5) {
2582
       /* Unknown version; assume it's not an sFlow packet. */
2583
9
       return 0;
2584
9
    }
2585
2586
0
    sflow_addr_type = tvb_get_ntohl(tvb, offset + 4);
2587
0
    switch (sflow_addr_type) {
2588
0
        case ADDR_TYPE_UNKNOWN:
2589
0
        case ADDR_TYPE_IPV4:
2590
0
        case ADDR_TYPE_IPV6:
2591
0
            break;
2592
2593
0
        default:
2594
            /*
2595
             * Address type we don't know about; assume it's not an sFlow
2596
             * packet.
2597
             */
2598
0
            return 0;
2599
0
    }
2600
    /* Make entries in Protocol column and Info column on summary display */
2601
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "sFlow");
2602
2603
    /* create display subtree for the protocol */
2604
0
    ti = proto_tree_add_item(tree, proto_sflow, tvb, 0, -1, ENC_NA);
2605
2606
0
    sflow_245_tree = proto_item_add_subtree(ti, ett_sflow_245);
2607
2608
0
    col_add_fstr(pinfo->cinfo, COL_INFO, "V%u", version);
2609
0
    proto_tree_add_item(sflow_245_tree, hf_sflow_version, tvb, offset, 4, ENC_BIG_ENDIAN);
2610
0
    offset += 4;
2611
2612
0
    proto_tree_add_item(sflow_245_tree, hf_sflow_agent_address_type, tvb, offset, 4, ENC_BIG_ENDIAN);
2613
0
    offset = dissect_sflow_245_address_type(tvb, pinfo, sflow_245_tree, offset,
2614
0
                                            &addr_type, &addr_details);
2615
0
    switch (sflow_addr_type) {
2616
0
        case ADDR_TYPE_UNKNOWN:
2617
0
            break;
2618
0
        case ADDR_TYPE_IPV4:
2619
0
        case ADDR_TYPE_IPV6:
2620
0
            col_append_fstr(pinfo->cinfo, COL_INFO, ", agent %s", address_to_str(pinfo->pool, &addr_details));
2621
0
            break;
2622
0
    }
2623
2624
0
    if (version == 5) {
2625
0
        sub_agent_id = tvb_get_ntohl(tvb, offset);
2626
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ", sub-agent ID %u", sub_agent_id);
2627
0
        proto_tree_add_uint(sflow_245_tree, hf_sflow_5_sub_agent_id, tvb, offset, 4, sub_agent_id);
2628
0
        offset += 4;
2629
0
    }
2630
0
    seqnum = tvb_get_ntohl(tvb, offset);
2631
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ", seq %u", seqnum);
2632
0
    proto_tree_add_uint(sflow_245_tree, hf_sflow_245_seqnum, tvb, offset, 4, seqnum);
2633
0
    offset += 4;
2634
0
    uptime = tvb_get_ntohl(tvb, offset);
2635
0
    proto_tree_add_uint_format_value(sflow_245_tree, hf_sflow_245_sysuptime, tvb, offset, 4, uptime, "%s (%ums)",
2636
0
        unsigned_time_secs_to_str(pinfo->pool, uptime / 1000), uptime);
2637
0
    offset += 4;
2638
0
    numsamples = tvb_get_ntohl(tvb, offset);
2639
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ", %u samples", numsamples);
2640
0
    proto_tree_add_uint(sflow_245_tree, hf_sflow_245_numsamples, tvb, offset, 4, numsamples);
2641
0
    offset += 4;
2642
2643
    /* Ok, we're now at the end of the sflow_245 datagram header;
2644
     * everything from here out should be samples. Loop over
2645
     * the expected number of samples, and pass them to the appropriate
2646
     * dissectors.
2647
     */
2648
2649
    /* limit number of samples to 255 to avoid huge number of loops
2650
     * caused by corrupted data */
2651
0
    for (i = 0; i < (numsamples & 0x000000ff); i++) {
2652
0
        offset = dissect_sflow_245_samples(tvb, pinfo, sflow_245_tree, offset, version);
2653
0
    }
2654
2655
0
    return tvb_captured_length(tvb);
2656
0
}
2657
2658
/* Register the protocol with Wireshark */
2659
2660
void
2661
14
proto_register_sflow(void) {
2662
2663
14
    module_t *sflow_245_module;
2664
2665
    /* Setup list of header fields  See Section 1.6.1 for details*/
2666
14
    static hf_register_info hf[] = {
2667
14
        { &hf_sflow_version,
2668
14
            { "Datagram version", "sflow_245.version",
2669
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2670
14
                "sFlow datagram version", HFILL}},
2671
14
        { &hf_sflow_agent_address_type,
2672
14
            { "Agent address type", "sflow_245.agenttype",
2673
14
                FT_UINT32, BASE_DEC, VALS(sflow_agent_address_types), 0x0,
2674
14
                "sFlow agent address type", HFILL}},
2675
14
        { &hf_sflow_agent_address_v4,
2676
14
            { "Agent address", "sflow_245.agent",
2677
14
                FT_IPv4, BASE_NONE, NULL, 0x0,
2678
14
                "sFlow Agent IP address", HFILL}},
2679
14
        { &hf_sflow_agent_address_v6,
2680
14
            { "Agent address", "sflow_245.agent.v6",
2681
14
                FT_IPv6, BASE_NONE, NULL, 0x0,
2682
14
                "sFlow Agent IPv6 address", HFILL}},
2683
14
        { &hf_sflow_5_sub_agent_id,
2684
14
            { "Sub-agent ID", "sflow_245.sub_agent_id",
2685
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2686
14
                "sFlow sub-agent ID", HFILL}},
2687
14
        { &hf_sflow_5_sample_length,
2688
14
            { "Sample length (byte)", "sflow_5.sample_length",
2689
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2690
14
                "sFlow sample length", HFILL}},
2691
14
        { &hf_sflow_5_flow_data_length,
2692
14
            { "Flow data length (byte)", "sflow_5.flow_data_length",
2693
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2694
14
                "sFlow flow data length", HFILL}},
2695
#if 0
2696
        { &hf_sflow_5_counters_data_length,
2697
            { "Counters data length (byte)", "sflow_5.counter_data_length",
2698
                FT_UINT32, BASE_DEC, NULL, 0x0,
2699
                "sFlow counters data length", HFILL}},
2700
#endif
2701
14
        { &hf_sflow_245_seqnum,
2702
14
            { "Sequence number", "sflow_245.sequence_number",
2703
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2704
14
                "sFlow datagram sequence number", HFILL}},
2705
14
        { &hf_sflow_245_sysuptime,
2706
14
            { "SysUptime", "sflow_245.sysuptime",
2707
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2708
14
                "System Uptime", HFILL}},
2709
14
        { &hf_sflow_245_numsamples,
2710
14
            { "NumSamples", "sflow_245.numsamples",
2711
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2712
14
                "Number of samples in sFlow datagram", HFILL}},
2713
14
        { &hf_sflow_245_sampletype,
2714
14
            { "sFlow sample type", "sflow_245.sampletype",
2715
14
                FT_UINT32, BASE_DEC, VALS(sflow_245_sampletype), 0x0,
2716
14
                "Type of sFlow sample", HFILL}},
2717
14
        { &hf_sflow_245_sampletype12,
2718
14
            { "sFlow sample type", "sflow_245.sampletype",
2719
14
                FT_UINT32, BASE_DEC, VALS(sflow_245_sampletype), 0x00000FFF,
2720
14
                "Type of sFlow sample", HFILL}},
2721
#if 0
2722
        { &hf_sflow_5_ieee80211_version,
2723
            { "Version", "sflow_245.ieee80211_version",
2724
                FT_UINT32, BASE_DEC, VALS(sflow_5_ieee80211_versions), 0x0,
2725
                "IEEE 802.11 Version", HFILL}},
2726
#endif
2727
14
        { &hf_sflow_245_ipv4_precedence_type,
2728
14
            { "Precedence", "sflow_245.ipv4_precedence_type",
2729
14
                FT_UINT32, BASE_DEC, VALS(sflow_245_ipv4_precedence_types), 0xE0,
2730
14
                "IPv4 Precedence Type", HFILL}},
2731
14
        { &hf_sflow_5_flow_record_format,
2732
14
            { "Format", "sflow_245.flow_record_format",
2733
14
                FT_UINT32, BASE_DEC | BASE_EXT_STRING, &sflow_5_flow_record_type_ext, 0x00000FFF,
2734
14
                "Format of sFlow flow record", HFILL}},
2735
14
        { &hf_sflow_5_counters_record_format,
2736
14
            { "Format", "sflow_245.counters_record_format",
2737
14
                FT_UINT32, BASE_DEC, VALS(sflow_5_counters_record_type), 0x00000FFF,
2738
14
                "Format of sFlow counters record", HFILL}},
2739
14
        { &hf_sflow_245_header_protocol,
2740
14
            { "Header protocol", "sflow_245.header_protocol",
2741
14
                FT_UINT32, BASE_DEC | BASE_EXT_STRING, &sflow_245_header_protocol_ext, 0x0,
2742
14
                "Protocol of sampled header", HFILL}},
2743
14
        { &hf_sflow_245_header,
2744
14
            { "Header of sampled packet", "sflow_245.header",
2745
14
                FT_BYTES, BASE_NONE, NULL, 0x0,
2746
14
                "Data from sampled header", HFILL}},
2747
14
        { &hf_sflow_245_packet_information_type,
2748
14
            { "Sample type", "sflow_245.packet_information_type",
2749
14
                FT_UINT32, BASE_DEC, VALS(sflow_245_packet_information_type), 0x0,
2750
14
                "Type of sampled information", HFILL}},
2751
14
        { &hf_sflow_245_extended_information_type,
2752
14
            { "Extended information type", "sflow_245.extended_information_type",
2753
14
                FT_UINT32, BASE_DEC, VALS(sflow_245_extended_data_types), 0x0,
2754
14
                "Type of extended information", HFILL}},
2755
14
        { &hf_sflow_245_vlan_in,
2756
14
            { "Incoming 802.1Q VLAN", "sflow_245.vlan.in",
2757
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2758
14
                "Incoming VLAN ID", HFILL}},
2759
14
        { &hf_sflow_245_vlan_out,
2760
14
            { "Outgoing 802.1Q VLAN", "sflow_245.vlan.out",
2761
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2762
14
                "Outgoing VLAN ID", HFILL}},
2763
14
        { &hf_sflow_245_pri_in,
2764
14
            { "Incoming 802.1p priority", "sflow_245.pri.in",
2765
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2766
14
                NULL, HFILL}},
2767
14
        { &hf_sflow_245_pri_out,
2768
14
            { "Outgoing 802.1p priority", "sflow_245.pri.out",
2769
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2770
14
                NULL, HFILL}},
2771
14
        { &hf_sflow_245_nexthop_v4,
2772
14
            { "Next hop", "sflow_245.nexthop",
2773
14
                FT_IPv4, BASE_NONE, NULL, 0x0,
2774
14
                "Next hop address", HFILL}},
2775
14
        { &hf_sflow_245_ipv4_src,
2776
14
            { "Source IP address", "sflow_245.ipv4_src",
2777
14
                FT_IPv4, BASE_NONE, NULL, 0x0,
2778
14
                "Source IPv4 address", HFILL}},
2779
14
        { &hf_sflow_245_ipv4_dst,
2780
14
            { "Destination IP address", "sflow_245.ipv4_dst",
2781
14
                FT_IPv4, BASE_NONE, NULL, 0x0,
2782
14
                "Destination IPv4 address", HFILL}},
2783
14
        { &hf_sflow_245_nexthop_v6,
2784
14
            { "Next hop", "sflow_245.nexthop.v6",
2785
14
                FT_IPv6, BASE_NONE, NULL, 0x0,
2786
14
                "Next hop address", HFILL}},
2787
14
        { &hf_sflow_245_ipv6_src,
2788
14
            { "Source IP address", "sflow_245.ipv6_src",
2789
14
                FT_IPv6, BASE_NONE, NULL, 0x0,
2790
14
                "Source IPv6 address", HFILL}},
2791
14
        { &hf_sflow_245_ipv6_dst,
2792
14
            { "Destination IP address", "sflow_245.ipv6_dst",
2793
14
                FT_IPv6, BASE_NONE, NULL, 0x0,
2794
14
                "Destination IPv6 address", HFILL}},
2795
14
        { &hf_sflow_245_nexthop_src_mask,
2796
14
            { "Next hop source mask", "sflow_245.nexthop.src_mask",
2797
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2798
14
                "Next hop source mask bits", HFILL}},
2799
14
        { &hf_sflow_245_nexthop_dst_mask,
2800
14
            { "Next hop destination mask", "sflow_245.nexthop.dst_mask",
2801
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2802
14
                "Next hop destination mask bits", HFILL}},
2803
14
        { &hf_sflow_245_ifindex,
2804
14
            { "Interface index", "sflow_245.ifindex",
2805
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2806
14
                NULL, HFILL}},
2807
14
        { &hf_sflow_245_as,
2808
14
            { "AS Router", "sflow_245.as",
2809
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2810
14
                "Autonomous System of Router", HFILL}},
2811
14
        { &hf_sflow_245_src_as,
2812
14
            { "AS Source", "sflow_245.srcAS",
2813
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2814
14
                "Autonomous System of Source", HFILL}},
2815
14
        { &hf_sflow_245_src_peer_as,
2816
14
            { "AS Peer", "sflow_245.peerAS",
2817
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2818
14
                "Autonomous System of Peer", HFILL}},
2819
14
        { &hf_sflow_245_dst_as_entries,
2820
14
            { "AS Destinations", "sflow_245.dstASentries",
2821
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2822
14
                "Autonomous System destinations", HFILL}},
2823
14
        { &hf_sflow_245_dst_as,
2824
14
            { "AS Destination", "sflow_245.dstAS",
2825
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2826
14
                "Autonomous System destination", HFILL}},
2827
        /* Needed for sFlow >= 4.  If I had a capture to test... */
2828
14
        { &hf_sflow_245_community_entries,
2829
14
            { "Gateway Communities", "sflow_245.communityEntries",
2830
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2831
14
                NULL, HFILL}},
2832
#if 0
2833
        { &hf_sflow_245_community,
2834
            { "Gateway Community", "sflow_245.community",
2835
                FT_UINT32, BASE_DEC, NULL, 0x0,
2836
                "Gateway Communities", HFILL}},
2837
#endif
2838
14
        { &hf_sflow_245_localpref,
2839
14
            { "localpref", "sflow_245.localpref",
2840
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2841
14
                "Local preferences of AS route", HFILL}},
2842
        /**/
2843
14
        { &hf_sflow_245_iftype,
2844
14
            { "Interface Type", "sflow_245.iftype",
2845
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2846
14
                NULL, HFILL}},
2847
14
        { &hf_sflow_245_ifspeed,
2848
14
            { "Interface Speed", "sflow_245.ifspeed",
2849
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
2850
14
                NULL, HFILL}},
2851
14
        { &hf_sflow_245_ifdirection,
2852
14
            { "Interface Direction", "sflow_245.ifdirection",
2853
14
                FT_UINT32, BASE_DEC, VALS(sflow_ifdirection_vals), 0x0,
2854
14
                NULL, HFILL}},
2855
14
        { &hf_sflow_245_ifadmin_status,
2856
14
            { "IfAdminStatus", "sflow_245.ifadmin_status",
2857
14
                FT_BOOLEAN, 32, TFS(&tfs_up_down), 0x00000001,
2858
14
                NULL, HFILL}},
2859
14
        { &hf_sflow_245_ifoper_status,
2860
14
            { "IfOperStatus", "sflow_245.ifoper_status",
2861
14
                FT_BOOLEAN, 32, TFS(&tfs_up_down), 0x00000002,
2862
14
                NULL, HFILL}},
2863
14
        { &hf_sflow_245_ifinoct,
2864
14
            { "Input Octets", "sflow_245.ifinoct",
2865
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
2866
14
                NULL, HFILL}},
2867
14
        { &hf_sflow_245_ifinpkt,
2868
14
            { "Input Packets", "sflow_245.ifinpkt",
2869
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2870
14
                NULL, HFILL}},
2871
14
        { &hf_sflow_245_ifinmcast,
2872
14
            { "Input Multicast Packets", "sflow_245.ifinmcast",
2873
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2874
14
                NULL, HFILL}},
2875
14
        { &hf_sflow_245_ifinbcast,
2876
14
            { "Input Broadcast Packets", "sflow_245.ifinbcast",
2877
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2878
14
                NULL, HFILL}},
2879
14
        { &hf_sflow_245_ifindisc,
2880
14
            { "Input Discarded Packets", "sflow_245.ifindisc",
2881
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2882
14
                NULL, HFILL}},
2883
14
        { &hf_sflow_245_ifinerr,
2884
14
            { "Input Errors", "sflow_245.ifinerr",
2885
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2886
14
                NULL, HFILL}},
2887
14
        { &hf_sflow_245_ifinunk,
2888
14
            { "Input Unknown Protocol Packets", "sflow_245.ifinunk",
2889
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2890
14
                NULL, HFILL}},
2891
14
        { &hf_sflow_245_ifoutoct,
2892
14
            { "Output Octets", "sflow_245.ifoutoct",
2893
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
2894
14
                NULL, HFILL}},
2895
14
        { &hf_sflow_245_ifoutpkt,
2896
14
            { "Output Packets", "sflow_245.ifoutpkt",
2897
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2898
14
                NULL, HFILL}},
2899
14
        { &hf_sflow_245_ifoutmcast,
2900
14
            { "Output Multicast Packets", "sflow_245.ifoutmcast",
2901
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2902
14
                NULL, HFILL}},
2903
14
        { &hf_sflow_245_ifoutbcast,
2904
14
            { "Output Broadcast Packets", "sflow_245.ifoutbcast",
2905
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2906
14
                NULL, HFILL}},
2907
14
        { &hf_sflow_245_ifoutdisc,
2908
14
            { "Output Discarded Packets", "sflow_245.ifoutdisc",
2909
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2910
14
                NULL, HFILL}},
2911
14
        { &hf_sflow_245_ifouterr,
2912
14
            { "Output Errors", "sflow_245.ifouterr",
2913
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2914
14
                NULL, HFILL}},
2915
14
        { &hf_sflow_245_ifpromisc,
2916
14
            { "Promiscuous Mode", "sflow_245.ifpromisc",
2917
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2918
14
                NULL, HFILL}},
2919
14
        { &hf_sflow_245_dot3StatsAlignmentErrors,
2920
14
            { "Alignment Errors", "sflow_245.dot3StatsAlignmentErrors",
2921
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2922
14
                "dot3 Stats Alignment Errors", HFILL}},
2923
14
        { &hf_sflow_245_dot3StatsFCSErrors,
2924
14
            { "FCS Errors", "sflow_245.dot3StatsFCSErrors",
2925
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2926
14
                "dot3 Stats FCS Errors", HFILL}},
2927
14
        { &hf_sflow_245_dot3StatsSingleCollisionFrames,
2928
14
            { "Single Collision Frames", "sflow_245.dot3StatsSingleCollisionFrames",
2929
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2930
14
                "dot3 Stats Single Collision Frames", HFILL}},
2931
14
        { &hf_sflow_245_dot3StatsMultipleCollisionFrames,
2932
14
            { "Multiple Collision Frames", "sflow_245.dot3StatsMultipleCollisionFrames",
2933
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2934
14
                "dot3 Stats Multiple Collision Frames", HFILL}},
2935
14
        { &hf_sflow_245_dot3StatsSQETestErrors,
2936
14
            { "SQE Test Errors", "sflow_245.dot3StatsSQETestErrors",
2937
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2938
14
                "dot3 Stats SQE Test Errors", HFILL}},
2939
14
        { &hf_sflow_245_dot3StatsDeferredTransmissions,
2940
14
            { "Deferred Transmissions", "sflow_245.dot3StatsDeferredTransmissions",
2941
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2942
14
                "dot3 Stats Deferred Transmissions", HFILL}},
2943
14
        { &hf_sflow_245_dot3StatsLateCollisions,
2944
14
            { "Late Collisions", "sflow_245.dot3StatsLateCollisions",
2945
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2946
14
                "dot3 Stats Late Collisions", HFILL}},
2947
14
        { &hf_sflow_245_dot3StatsExcessiveCollisions,
2948
14
            { "Excessive Collisions", "sflow_245.dot3StatsExcessiveCollisions",
2949
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2950
14
                "dot3 Stats Excessive Collisions", HFILL}},
2951
14
        { &hf_sflow_245_dot3StatsInternalMacTransmitErrors,
2952
14
            { "Internal Mac Transmit Errors", "sflow_245.dot3StatsInternalMacTransmitErrors",
2953
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2954
14
                "dot3 Stats Internal Mac Transmit Errors", HFILL}},
2955
14
        { &hf_sflow_245_dot3StatsCarrierSenseErrors,
2956
14
            { "Carrier Sense Errors", "sflow_245.dot3StatsCarrierSenseErrors",
2957
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2958
14
                "dot3 Stats Carrier Sense Errors", HFILL}},
2959
14
        { &hf_sflow_245_dot3StatsFrameTooLongs,
2960
14
            { "Frame Too Longs", "sflow_245.dot3StatsFrameTooLongs",
2961
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2962
14
                "dot3 Stats Frame Too Longs", HFILL}},
2963
14
        { &hf_sflow_245_dot3StatsInternalMacReceiveErrors,
2964
14
            { "Internal Mac Receive Errors", "sflow_245.dot3StatsInternalMacReceiveErrors",
2965
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2966
14
                "dot3 Stats Internal Mac Receive Errors", HFILL}},
2967
14
        { &hf_sflow_245_dot3StatsSymbolErrors,
2968
14
            { "Symbol Errors", "sflow_245.dot3StatsSymbolErrors",
2969
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2970
14
                "dot3 Stats Symbol Errors", HFILL}},
2971
14
        { &hf_sflow_245_dot5StatsLineErrors,
2972
14
            { "Line Errors", "sflow_245.dot5StatsLineErrors",
2973
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2974
14
                "dot5 Stats Line Errors", HFILL}},
2975
14
        { &hf_sflow_245_dot5StatsBurstErrors,
2976
14
            { "Burst Errors", "sflow_245.dot5StatsBurstErrors",
2977
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2978
14
                "dot5 Stats Burst Errors", HFILL}},
2979
14
        { &hf_sflow_245_dot5StatsACErrors,
2980
14
            { "AC Errors", "sflow_245.dot5StatsACErrors",
2981
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2982
14
                "dot5 Stats AC Errors", HFILL}},
2983
14
        { &hf_sflow_245_dot5StatsAbortTransErrors,
2984
14
            { "Abort Trans Errors", "sflow_245.dot5StatsAbortTransErrors",
2985
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2986
14
                "dot5 Stats Abort Trans Errors", HFILL}},
2987
14
        { &hf_sflow_245_dot5StatsInternalErrors,
2988
14
            { "Internal Errors", "sflow_245.dot5StatsInternalErrors",
2989
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2990
14
                "dot5 Stats Internal Errors", HFILL}},
2991
14
        { &hf_sflow_245_dot5StatsLostFrameErrors,
2992
14
            { "Lost Frame Errors", "sflow_245.dot5StatsLostFrameErrors",
2993
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2994
14
                "dot5 Stats Lost Frame Errors", HFILL}},
2995
14
        { &hf_sflow_245_dot5StatsReceiveCongestions,
2996
14
            { "Receive Congestions", "sflow_245.dot5StatsReceiveCongestions",
2997
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
2998
14
                "dot5 Stats Receive Congestions", HFILL}},
2999
14
        { &hf_sflow_245_dot5StatsFrameCopiedErrors,
3000
14
            { "Frame Copied Errors", "sflow_245.dot5StatsFrameCopiedErrors",
3001
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3002
14
                "dot5 Stats Frame Copied Errors", HFILL}},
3003
14
        { &hf_sflow_245_dot5StatsTokenErrors,
3004
14
            { "Token Errors", "sflow_245.dot5StatsTokenErrors",
3005
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3006
14
                "dot5 Stats Token Errors", HFILL}},
3007
14
        { &hf_sflow_245_dot5StatsSoftErrors,
3008
14
            { "Soft Errors", "sflow_245.dot5StatsSoftErrors",
3009
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3010
14
                "dot5 Stats Soft Errors", HFILL}},
3011
14
        { &hf_sflow_245_dot5StatsHardErrors,
3012
14
            { "Hard Errors", "sflow_245.dot5StatsHardErrors",
3013
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3014
14
                "dot5 Stats Hard Errors", HFILL}},
3015
14
        { &hf_sflow_245_dot5StatsSignalLoss,
3016
14
            { "Signal Loss", "sflow_245.dot5StatsSignalLoss",
3017
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3018
14
                "dot5 Stats Signal Loss", HFILL}},
3019
14
        { &hf_sflow_245_dot5StatsTransmitBeacons,
3020
14
            { "Transmit Beacons", "sflow_245.dot5StatsTransmitBeacons",
3021
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3022
14
                "dot5 Stats Transmit Beacons", HFILL}},
3023
14
        { &hf_sflow_245_dot5StatsRecoveries,
3024
14
            { "Recoveries", "sflow_245.dot5StatsRecoveries",
3025
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3026
14
                "dot5 Stats Recoveries", HFILL}},
3027
14
        { &hf_sflow_245_dot5StatsLobeWires,
3028
14
            { "Lobe Wires", "sflow_245.dot5StatsLobeWires",
3029
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3030
14
                "dot5 Stats Lobe Wires", HFILL}},
3031
14
        { &hf_sflow_245_dot5StatsRemoves,
3032
14
            { "Removes", "sflow_245.dot5StatsRemoves",
3033
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3034
14
                "dot5 Stats Removes", HFILL}},
3035
14
        { &hf_sflow_245_dot5StatsSingles,
3036
14
            { "Singles", "sflow_245.dot5StatsSingles",
3037
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3038
14
                "dot5 Stats Singles", HFILL}},
3039
14
        { &hf_sflow_245_dot5StatsFreqErrors,
3040
14
            { "Freq Errors", "sflow_245.dot5StatsFreqErrors",
3041
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3042
14
                "dot5 Stats Freq Errors", HFILL}},
3043
14
        { &hf_sflow_245_dot12InHighPriorityFrames,
3044
14
            { "In High Priority Frames", "sflow_245.dot12InHighPriorityFrames",
3045
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3046
14
                "dot12 Input High Priority Frames", HFILL}},
3047
14
        { &hf_sflow_245_dot12InHighPriorityOctets,
3048
14
            { "In High Priority Octets", "sflow_245.dot12InHighPriorityOctets",
3049
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3050
14
                "dot12 Input High Priority Octets", HFILL}},
3051
14
        { &hf_sflow_245_dot12InNormPriorityFrames,
3052
14
            { "In Normal Priority Frames", "sflow_245.dot12InNormPriorityFrames",
3053
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3054
14
                "dot12 Input Normal Priority Frames", HFILL}},
3055
14
        { &hf_sflow_245_dot12InNormPriorityOctets,
3056
14
            { "In Normal Priority Octets", "sflow_245.dot12InNormPriorityOctets",
3057
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3058
14
                "dot12 Input Normal Priority Octets", HFILL}},
3059
14
        { &hf_sflow_245_dot12InIPMErrors,
3060
14
            { "In IPM Errors", "sflow_245.dot12InIPMErrors",
3061
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3062
14
                "dot12 Input IPM Errors", HFILL}},
3063
14
        { &hf_sflow_245_dot12InOversizeFrameErrors,
3064
14
            { "In Oversize Frame Errors", "sflow_245.dot12InOversizeFrameErrors",
3065
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3066
14
                "dot12 Input Oversize Frame Errors", HFILL}},
3067
14
        { &hf_sflow_245_dot12InDataErrors,
3068
14
            { "In Data Errors", "sflow_245.dot12InDataErrors",
3069
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3070
14
                "dot12 Input Data Errors", HFILL}},
3071
14
        { &hf_sflow_245_dot12InNullAddressedFrames,
3072
14
            { "In Null Addressed Frames", "sflow_245.dot12InNullAddressedFrames",
3073
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3074
14
                "dot12 Input Null Addressed Frames", HFILL}},
3075
14
        { &hf_sflow_245_dot12OutHighPriorityFrames,
3076
14
            { "Out High Priority Frames", "sflow_245.dot12OutHighPriorityFrames",
3077
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3078
14
                "dot12 Output High Priority Frames", HFILL}},
3079
14
        { &hf_sflow_245_dot12OutHighPriorityOctets,
3080
14
            { "Out High Priority Octets", "sflow_245.dot12OutHighPriorityOctets",
3081
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3082
14
                "dot12 Out High Priority Octets", HFILL}},
3083
14
        { &hf_sflow_245_dot12TransitionIntoTrainings,
3084
14
            { "Transition Into Trainings", "sflow_245.dot12TransitionIntoTrainings",
3085
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3086
14
                "dot12 Transition Into Trainings", HFILL}},
3087
14
        { &hf_sflow_245_dot12HCInHighPriorityOctets,
3088
14
            { "HC In High Priority Octets", "sflow_245.dot12HCInHighPriorityOctets",
3089
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3090
14
                "dot12 HC Input High Priority Octets", HFILL}},
3091
14
        { &hf_sflow_245_dot12HCInNormPriorityOctets,
3092
14
            { "HC In Normal Priority Octets", "sflow_245.dot12HCInNormPriorityOctets",
3093
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3094
14
                "dot12 HC Input Normal Priority Octets", HFILL}},
3095
14
        { &hf_sflow_245_dot12HCOutHighPriorityOctets,
3096
14
            { "HC Out High Priority Octets", "sflow_245.dot12HCOutHighPriorityOctets",
3097
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3098
14
                "dot12 HC Output High Priority Octets", HFILL}},
3099
14
        { &hf_sflow_245_vlan_id,
3100
14
            { "VLAN ID", "sflow_245.vlan_id",
3101
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3102
14
                NULL, HFILL}},
3103
14
        { &hf_sflow_245_octets,
3104
14
            { "Octets", "sflow_245.octets",
3105
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3106
14
                NULL, HFILL}},
3107
14
        { &hf_sflow_245_ucastPkts,
3108
14
            { "Unicast Packets", "sflow_245.ucastPkts",
3109
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3110
14
                NULL, HFILL}},
3111
14
        { &hf_sflow_245_multicastPkts,
3112
14
            { "Multicast Packets", "sflow_245.multicastPkts",
3113
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3114
14
                NULL, HFILL}},
3115
14
        { &hf_sflow_245_broadcastPkts,
3116
14
            { "Broadcast Packets", "sflow_245.broadcastPkts",
3117
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3118
14
                NULL, HFILL}},
3119
14
        { &hf_sflow_245_discards,
3120
14
            { "Discards", "sflow_245.discards",
3121
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3122
14
                NULL, HFILL}},
3123
14
        { &hf_sflow_5_dot11TransmittedFragmentCount,
3124
14
            { "Transmitted Fragment Count", "sflow_5.dot11TransmittedFragmentCount",
3125
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3126
14
                NULL, HFILL}},
3127
14
        { &hf_sflow_5_dot11MulticastTransmittedFrameCount,
3128
14
            { "Multicast Transmitted Frame Count", "sflow_5.dot11MulticastTransmittedFrameCount",
3129
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3130
14
                NULL, HFILL}},
3131
14
        { &hf_sflow_5_dot11FailedCount,
3132
14
            { "Failed Count", "sflow_5.dot11FailedCount",
3133
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3134
14
                NULL, HFILL}},
3135
14
        { &hf_sflow_5_dot11RetryCount,
3136
14
            { "Retry Count", "sflow_5.dot11RetryCount",
3137
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3138
14
                NULL, HFILL}},
3139
14
        { &hf_sflow_5_dot11MultipleRetryCount,
3140
14
            { "Multiple Retry Count", "sflow_5.dot11MultipleRetryCount",
3141
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3142
14
                NULL, HFILL}},
3143
14
        { &hf_sflow_5_dot11FrameDuplicateCount,
3144
14
            { "Frame Duplicate Count", "sflow_5.dot11FrameDuplicateCount",
3145
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3146
14
                NULL, HFILL}},
3147
14
        { &hf_sflow_5_dot11RTSSuccessCount,
3148
14
            { "RTS Success Count", "sflow_5.dot11RTSSuccessCount",
3149
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3150
14
                NULL, HFILL}},
3151
14
        { &hf_sflow_5_dot11RTSFailureCount,
3152
14
            { "Failure Count", "sflow_5.dot11RTSFailureCount",
3153
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3154
14
                NULL, HFILL}},
3155
14
        { &hf_sflow_5_dot11ACKFailureCount,
3156
14
            { "ACK Failure Count", "sflow_5.dot11ACKFailureCount",
3157
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3158
14
                NULL, HFILL}},
3159
14
        { &hf_sflow_5_dot11ReceivedFragmentCount,
3160
14
            { "Received Fragment Count", "sflow_5.dot11ReceivedFragmentCount",
3161
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3162
14
                NULL, HFILL}},
3163
14
        { &hf_sflow_5_dot11MulticastReceivedFrameCount,
3164
14
            { "Multicast Received Frame Count", "sflow_5.dot11MulticastReceivedFrameCount",
3165
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3166
14
                NULL, HFILL}},
3167
14
        { &hf_sflow_5_dot11FCSErrorCount,
3168
14
            { "FCS Error Count", "sflow_5.dot11FCSErrorCount",
3169
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3170
14
                NULL, HFILL}},
3171
14
        { &hf_sflow_5_dot11TransmittedFrameCount,
3172
14
            { "Transmitted Frame Count", "sflow_5.dot11TransmittedFrameCount",
3173
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3174
14
                NULL, HFILL}},
3175
14
        { &hf_sflow_5_dot11WEPUndecryptableCount,
3176
14
            { "WEP Undecryptable Count", "sflow_5.dot11WEPUndecryptableCount",
3177
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3178
14
                NULL, HFILL}},
3179
14
        { &hf_sflow_5_dot11QoSDiscardedFragmentCount,
3180
14
            { "QoS Discarded Fragment Count", "sflow_5.dot11QoSDiscardedFragmentCount",
3181
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3182
14
                NULL, HFILL}},
3183
14
        { &hf_sflow_5_dot11AssociatedStationCount,
3184
14
            { "Associated Station Count", "sflow_5.dot11AssociatedStationCount",
3185
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3186
14
                NULL, HFILL}},
3187
14
        { &hf_sflow_5_dot11QoSCFPollsReceivedCount,
3188
14
            { "QoS CF Polls Received Count", "sflow_5.dot11QoSCFPollsReceivedCount",
3189
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3190
14
                NULL, HFILL}},
3191
14
        { &hf_sflow_5_dot11QoSCFPollsUnusedCount,
3192
14
            { "QoS CF Polls Unused Count", "sflow_5.dot11QoSCFPollsUnusedCount",
3193
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3194
14
                NULL, HFILL}},
3195
14
        { &hf_sflow_5_dot11QoSCFPollsUnusableCount,
3196
14
            { "QoS CF Polls Unusable Count", "sflow_5.dot11QoSCFPollsUnusableCount",
3197
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3198
14
                NULL, HFILL}},
3199
14
        { &hf_sflow_5_dot11QoSCFPollsLostCount,
3200
14
            { "QoS CF Polls Lost Count", "sflow_5.dot11QoSCFPollsLostCount",
3201
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3202
14
                NULL, HFILL}},
3203
14
        { &hf_sflow_5_cpu_5s,
3204
14
            { "5s CPU Load (100 = 1%)", "sflow_5.cpu_5s",
3205
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3206
14
                "Average CPU Load Over 5 Seconds (100 = 1%)", HFILL}},
3207
14
        { &hf_sflow_5_cpu_1m,
3208
14
            { "1m CPU Load (100 = 1%)", "sflow_5.cpu_1m",
3209
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3210
14
                "Average CPU Load Over 1 Minute (100 = 1%)", HFILL}},
3211
14
        { &hf_sflow_5_cpu_5m,
3212
14
            { "5m CPU Load (100 = 1%)", "sflow_5.cpu_5m",
3213
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3214
14
                "Average CPU Load Over 5 Minutes (100 = 1%)", HFILL}},
3215
14
        { &hf_sflow_5_total_memory,
3216
14
            { "Total Memory", "sflow_5.total_memory",
3217
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3218
14
                NULL, HFILL}},
3219
14
        { &hf_sflow_5_free_memory,
3220
14
            { "Free Memory", "sflow_5.free_memory",
3221
14
                FT_UINT64, BASE_DEC, NULL, 0x0,
3222
14
                NULL, HFILL}},
3223
14
        { &hf_sflow_5_elapsed_time,
3224
14
            { "Elapsed Time (ms)", "sflow_5.elapsed_time",
3225
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3226
14
                "Elapsed Time in ms", HFILL}},
3227
14
        { &hf_sflow_5_on_channel_time,
3228
14
            { "On Channel (ms)", "sflow_5.on_channel_time",
3229
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3230
14
                "Time in ms Spent on Channel", HFILL}},
3231
14
        { &hf_sflow_5_on_channel_busy_time,
3232
14
            { "On Channel Busy (ms)", "sflow_5.channel_busy_time",
3233
14
                FT_UINT32, BASE_DEC, NULL, 0x0,
3234
14
                "Time in ms Spent on Channel and Busy", HFILL}},
3235
3236
      /* Generated from convert_proto_tree_add_text.pl */
3237
14
      { &hf_sflow_245_header_frame_length,
3238
14
        { "Frame Length", "sflow_245.header.frame_length",
3239
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3240
14
          NULL, HFILL }
3241
14
      },
3242
14
      { &hf_sflow_245_header_payload_stripped,
3243
14
        { "Payload stripped", "sflow_245.header.payload_stripped",
3244
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3245
14
          NULL, HFILL }
3246
14
      },
3247
14
      { &hf_sflow_245_sampled_header_length,
3248
14
        { "Sampled header length", "sflow_245.header.sampled_header_length",
3249
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3250
14
          NULL, HFILL }
3251
14
      },
3252
14
      { &hf_sflow_245_extended_mpls_in_label_stack_entries,
3253
14
        { "In Label Stack Entries", "sflow_245.extended_mpls.in_label_stack_entries",
3254
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3255
14
          NULL, HFILL }
3256
14
      },
3257
14
      { &hf_sflow_245_extended_mpls_in_label,
3258
14
        { "Label", "sflow_245.extended_mpls.in_label",
3259
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3260
14
          NULL, HFILL }
3261
14
      },
3262
14
      { &hf_sflow_245_extended_mpls_out_label_stack_entries,
3263
14
        { "Out Label Stack Entries", "sflow_245.extended_mpls.out_label_stack_entries",
3264
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3265
14
          NULL, HFILL }
3266
14
      },
3267
14
      { &hf_sflow_245_extended_mpls_out_label,
3268
14
        { "Label", "sflow_245.extended_mpls.out_label",
3269
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3270
14
          NULL, HFILL }
3271
14
      },
3272
14
      { &hf_sflow_245_ethernet_length_of_mac_packet,
3273
14
        { "Length of MAC Packet", "sflow_245.ethernet.length",
3274
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3275
14
          NULL, HFILL }
3276
14
      },
3277
14
      { &hf_sflow_245_ethernet_source_mac_address,
3278
14
        { "Source MAC Address", "sflow_245.ethernet.source_mac_address",
3279
14
          FT_ETHER, BASE_NONE, NULL, 0x0,
3280
14
          NULL, HFILL }
3281
14
      },
3282
14
      { &hf_sflow_245_ethernet_destination_mac_address,
3283
14
        { "Destination MAC Address", "sflow_245.ethernet.destination_mac_address",
3284
14
          FT_ETHER, BASE_NONE, NULL, 0x0,
3285
14
          NULL, HFILL }
3286
14
      },
3287
14
      { &hf_sflow_245_ethernet_packet_type,
3288
14
        { "Ethernet Packet Type", "sflow_245.ethernet.packet_type",
3289
14
          FT_UINT32, BASE_HEX, VALS(etype_vals), 0x0,
3290
14
          NULL, HFILL }
3291
14
      },
3292
14
      { &hf_sflow_245_length_of_ip_packet,
3293
14
        { "Length of IP Packet", "sflow_245.ip.length",
3294
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3295
14
          NULL, HFILL }
3296
14
      },
3297
14
      { &hf_sflow_245_ip_source_port,
3298
14
        { "Source Port", "sflow_245.ip.source_port",
3299
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3300
14
          NULL, HFILL }
3301
14
      },
3302
14
      { &hf_sflow_245_ip_destination_port,
3303
14
        { "Destination Port", "sflow.ip.destination_port",
3304
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3305
14
          NULL, HFILL }
3306
14
      },
3307
14
      { &hf_sflow_245_ip_tcp_flag_cwr,
3308
14
        { "TCP Flag (CWR)", "sflow_245.ip.tcp_flag.cwr",
3309
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000080,
3310
14
          NULL, HFILL }
3311
14
      },
3312
14
      { &hf_sflow_245_ip_tcp_flag_ece,
3313
14
        { "TCP Flag (ECE)", "sflow_245.ip.tcp_flag.ece",
3314
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000040,
3315
14
          NULL, HFILL }
3316
14
      },
3317
14
      { &hf_sflow_245_ip_tcp_flag_urg,
3318
14
        { "TCP Flag (URG)", "sflow_245.ip.tcp_flag.urg",
3319
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000020,
3320
14
          NULL, HFILL }
3321
14
      },
3322
14
      { &hf_sflow_245_ip_tcp_flag_ack,
3323
14
        { "TCP Flag (ACK)", "sflow_245.ip.tcp_flag.ack",
3324
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000010,
3325
14
          NULL, HFILL }
3326
14
      },
3327
14
      { &hf_sflow_245_ip_tcp_flag_psh,
3328
14
        { "TCP Flag (PSH)", "sflow_245.ip.tcp_flag.psh",
3329
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000008,
3330
14
          NULL, HFILL }
3331
14
      },
3332
14
      { &hf_sflow_245_ip_tcp_flag_rst,
3333
14
        { "TCP Flag (RST)", "sflow_245.ip.tcp_flag.rst",
3334
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000004,
3335
14
          NULL, HFILL }
3336
14
      },
3337
14
      { &hf_sflow_245_ip_tcp_flag_syn,
3338
14
        { "TCP Flag (SYN)", "sflow_245.ip.tcp_flag.syn",
3339
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000002,
3340
14
          NULL, HFILL }
3341
14
      },
3342
14
      { &hf_sflow_245_ip_tcp_flag_fin,
3343
14
        { "TCP Flag (FIN)", "sflow_245.ip.tcp_flag.fin",
3344
14
          FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x00000001,
3345
14
          NULL, HFILL }
3346
14
      },
3347
14
      { &hf_sflow_245_ipv4_delay,
3348
14
        { "Delay", "sflow_245.ipv4_delay",
3349
14
          FT_BOOLEAN, 32, TFS(&tfs_low_normal), 0x00000010,
3350
14
          NULL, HFILL }
3351
14
      },
3352
14
      { &hf_sflow_245_ipv4_throughput,
3353
14
        { "Throughput", "sflow_245.ipv4_throughput",
3354
14
          FT_BOOLEAN, 32, TFS(&tfs_high_normal), 0x00000008,
3355
14
          NULL, HFILL }
3356
14
      },
3357
14
      { &hf_sflow_245_ipv4_reliability,
3358
14
        { "Reliability", "sflow_245.ipv4_reliability",
3359
14
          FT_BOOLEAN, 32, TFS(&tfs_high_normal), 0x00000004,
3360
14
          NULL, HFILL }
3361
14
      },
3362
14
      { &hf_sflow_245_ipv4_cost,
3363
14
        { "Cost (RFC1349)", "sflow_245.ipv4_cost",
3364
14
          FT_BOOLEAN, 32, TFS(&tfs_minimize_monetary_normal), 0x00000002,
3365
14
          NULL, HFILL }
3366
14
      },
3367
14
      { &hf_sflow_245_ipv6_priority,
3368
14
        { "Priority", "sflow_245.ipv6_priority",
3369
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3370
14
          NULL, HFILL }
3371
14
      },
3372
14
      { &hf_sflow_5_extended_user_source_character_set,
3373
14
        { "Source Character Set", "sflow_5.extended_user.source_character_set",
3374
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3375
14
          NULL, HFILL }
3376
14
      },
3377
14
      { &hf_sflow_5_extended_user_source_user_string_length,
3378
14
        { "Source User String Length (bytes)", "sflow_5.extended_user.source_user_string_length",
3379
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3380
14
          NULL, HFILL }
3381
14
      },
3382
14
      { &hf_sflow_5_extended_user_destination_character_set,
3383
14
        { "Destination Character Set", "sflow_5.extended_user.destination_character_set",
3384
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3385
14
          NULL, HFILL }
3386
14
      },
3387
14
      { &hf_sflow_5_extended_user_destination_user_string_length,
3388
14
        { "Destination User String Length (bytes)", "sflow_5.extended_user.destination_user_string_length",
3389
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3390
14
          NULL, HFILL }
3391
14
      },
3392
14
      { &hf_sflow_5_extended_url_url_length,
3393
14
        { "URL Length (bytes)", "sflow_5.extended_url.url_length",
3394
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3395
14
          NULL, HFILL }
3396
14
      },
3397
14
      { &hf_sflow_5_extended_url_host_length,
3398
14
        { "Host Length (bytes)", "sflow_5.extended_url.host_length",
3399
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3400
14
          NULL, HFILL }
3401
14
      },
3402
14
      { &hf_sflow_5_extended_mpls_tunnel_name_length,
3403
14
        { "Tunnel Name Length (bytes)", "sflow_5.extended_mpls_tunnel.name_length",
3404
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3405
14
          NULL, HFILL }
3406
14
      },
3407
14
      { &hf_sflow_5_extended_mpls_tunnel_id,
3408
14
        { "Tunnel ID", "sflow_5.extended_mpls_tunnel.id",
3409
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3410
14
          NULL, HFILL }
3411
14
      },
3412
14
      { &hf_sflow_5_extended_mpls_tunnel_cos_value,
3413
14
        { "Tunnel COS Value", "sflow_5.extended_mpls_tunnel.cos_value",
3414
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3415
14
          NULL, HFILL }
3416
14
      },
3417
14
      { &hf_sflow_5_extended_mpls_vc_instance_name_length,
3418
14
        { "VC Instance Name Length (bytes)", "sflow_5.extended_mpls_vc.instance_name_length",
3419
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3420
14
          NULL, HFILL }
3421
14
      },
3422
14
      { &hf_sflow_5_extended_mpls_vc_id,
3423
14
        { "VLL/VC ID", "sflow_5.extended_mpls_vc.id",
3424
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3425
14
          NULL, HFILL }
3426
14
      },
3427
14
      { &hf_sflow_5_extended_mpls_vc_label_cos_value,
3428
14
        { "VC Label COS Value", "sflow_5.extended_mpls_vc.label_cos_value",
3429
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3430
14
          NULL, HFILL }
3431
14
      },
3432
14
      { &hf_sflow_5_extended_mpls_ftn_description_length,
3433
14
        { "MPLS FTN Description Length (bytes)", "sflow_5.extended_mpls.ftn_description_length",
3434
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3435
14
          NULL, HFILL }
3436
14
      },
3437
14
      { &hf_sflow_5_extended_mpls_ftn_mask,
3438
14
        { "MPLS FTN Mask", "sflow_5.extended_mpls.ftn_mask",
3439
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3440
14
          NULL, HFILL }
3441
14
      },
3442
14
      { &hf_sflow_5_extended_mpls_fec_address_prefix_length,
3443
14
        { "MPLS FEC Address Prefix Length (bytes)", "sflow_5.extended_mpls.fec_address_prefix_length",
3444
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3445
14
          NULL, HFILL }
3446
14
      },
3447
14
      { &hf_sflow_5_extended_vlan_tunnel_number_of_layers,
3448
14
        { "Number of Layers", "sflow_5.extended_vlan_tunnel.number_of_layers",
3449
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3450
14
          NULL, HFILL }
3451
14
      },
3452
14
      { &hf_sflow_5_extended_vlan_tunnel_tpid_tci_pair,
3453
14
        { "TPID/TCI Pair as Integer", "sflow_5.extended_vlan_tunnel.tpid_tci_pair",
3454
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3455
14
          NULL, HFILL }
3456
14
      },
3457
14
      { &hf_sflow_5_extended_80211_oui,
3458
14
        { "OUI", "sflow_5.extended_80211.oui",
3459
14
          FT_UINT24, BASE_HEX, NULL, 0x0,
3460
14
          NULL, HFILL }
3461
14
      },
3462
14
      { &hf_sflow_5_extended_80211_suite_type,
3463
14
        { "Suite Type", "sflow_5.extended_80211.suite_type",
3464
14
          FT_UINT8, BASE_DEC, VALS(extended_80211_suite_type_vals), 0x0,
3465
14
          NULL, HFILL }
3466
14
      },
3467
14
      { &hf_sflow_5_extended_80211_payload_length,
3468
14
        { "Payload Length", "sflow_5.extended_80211.payload_length",
3469
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3470
14
          NULL, HFILL }
3471
14
      },
3472
14
      { &hf_sflow_5_extended_80211_rx_bssid,
3473
14
        { "BSSID", "sflow_5.extended_80211.rx.bssid",
3474
14
          FT_ETHER, BASE_NONE, NULL, 0x0,
3475
14
          NULL, HFILL }
3476
14
      },
3477
14
      { &hf_sflow_5_extended_80211_rx_version,
3478
14
        { "Version", "sflow_5.extended_80211.rx.version",
3479
14
          FT_UINT32, BASE_DEC, VALS(sflow_5_ieee80211_versions), 0x0,
3480
14
          NULL, HFILL }
3481
14
      },
3482
14
      { &hf_sflow_5_extended_80211_rx_channel,
3483
14
        { "Channel", "sflow_5.extended_80211.rx.channel",
3484
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3485
14
          NULL, HFILL }
3486
14
      },
3487
14
      { &hf_sflow_5_extended_80211_rx_speed,
3488
14
        { "Speed", "sflow_5.extended_80211.rx.speed",
3489
14
          FT_UINT64, BASE_DEC, NULL, 0x0,
3490
14
          NULL, HFILL }
3491
14
      },
3492
14
      { &hf_sflow_5_extended_80211_rx_rsni,
3493
14
        { "RSNI", "sflow_5.extended_80211.rx.rsni",
3494
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3495
14
          NULL, HFILL }
3496
14
      },
3497
14
      { &hf_sflow_5_extended_80211_rx_rcpi,
3498
14
        { "RCPI", "sflow_5.extended_80211.rx.rcpi",
3499
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3500
14
          NULL, HFILL }
3501
14
      },
3502
14
      { &hf_sflow_5_extended_80211_rx_packet_duration,
3503
14
        { "Packet Duration (ms)", "sflow_5.extended_80211.rx.packet_duration",
3504
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3505
14
          NULL, HFILL }
3506
14
      },
3507
14
      { &hf_sflow_5_extended_80211_tx_bssid,
3508
14
        { "BSSID", "sflow_5.extended_80211.tx.bssid",
3509
14
          FT_ETHER, BASE_NONE, NULL, 0x0,
3510
14
          NULL, HFILL }
3511
14
      },
3512
14
      { &hf_sflow_5_extended_80211_tx_version,
3513
14
        { "Version", "sflow_5.extended_80211.tx.version",
3514
14
          FT_UINT32, BASE_DEC, VALS(sflow_5_ieee80211_versions), 0x0,
3515
14
          NULL, HFILL }
3516
14
      },
3517
14
      { &hf_sflow_5_extended_80211_tx_retransmissions,
3518
14
        { "Retransmissions", "sflow_5.extended_80211.tx.retransmissions",
3519
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3520
14
          NULL, HFILL }
3521
14
      },
3522
14
      { &hf_sflow_5_extended_80211_tx_packet_duration,
3523
14
        { "Packet Duration (ms)", "sflow_5.extended_80211.tx.packet_duration",
3524
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3525
14
          NULL, HFILL }
3526
14
      },
3527
14
      { &hf_sflow_5_extended_80211_tx_retransmission_duration,
3528
14
        { "Retransmission Duration (ms)", "sflow_5.extended_80211.tx.retransmission_duration",
3529
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3530
14
          NULL, HFILL }
3531
14
      },
3532
14
      { &hf_sflow_5_extended_80211_tx_channel,
3533
14
        { "Channel", "sflow_5.extended_80211.tx.channel",
3534
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3535
14
          NULL, HFILL }
3536
14
      },
3537
14
      { &hf_sflow_5_extended_80211_tx_speed,
3538
14
        { "Speed", "sflow_5.extended_80211.tx.speed",
3539
14
          FT_UINT64, BASE_DEC, NULL, 0x0,
3540
14
          NULL, HFILL }
3541
14
      },
3542
14
      { &hf_sflow_5_extended_80211_tx_power,
3543
14
        { "Power", "sflow_5.extended_80211.tx.power",
3544
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3545
14
          NULL, HFILL }
3546
14
      },
3547
14
      { &hf_sflow_flow_sample_sequence_number,
3548
14
        { "Sequence number", "sflow.flow_sample.sequence_number",
3549
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3550
14
          NULL, HFILL }
3551
14
      },
3552
14
      { &hf_sflow_flow_sample_source_id_class,
3553
14
        { "Source ID class", "sflow.flow_sample.source_id_class",
3554
14
          FT_UINT32, BASE_DEC, NULL, 0xFF000000,
3555
14
          NULL, HFILL }
3556
14
      },
3557
14
      { &hf_sflow_flow_sample_sampling_rate,
3558
14
        { "Sampling rate", "sflow.flow_sample.sampling_rate",
3559
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3560
14
          NULL, HFILL }
3561
14
      },
3562
14
      { &hf_sflow_flow_sample_sample_pool,
3563
14
        { "Sample pool", "sflow.flow_sample.sample_pool",
3564
14
          FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_total_packets), 0x0,
3565
14
          NULL, HFILL }
3566
14
      },
3567
14
      { &hf_sflow_flow_sample_dropped_packets,
3568
14
        { "Dropped packets", "sflow.flow_sample.dropped_packets",
3569
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3570
14
          NULL, HFILL }
3571
14
      },
3572
14
      { &hf_sflow_flow_sample_input_interface,
3573
14
        { "Input interface (ifIndex)", "sflow.flow_sample.input_interface",
3574
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3575
14
          NULL, HFILL }
3576
14
      },
3577
14
      { &hf_sflow_24_flow_sample_multiple_outputs,
3578
14
        { "Multiple outputs", "sflow.flow_sample.multiple_outputs",
3579
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3580
14
          NULL, HFILL }
3581
14
      },
3582
14
      { &hf_sflow_5_flow_sample_output_interface_expanded_format,
3583
14
        { "Output interface expanded format", "sflow.flow_sample.output_interface.expanded.format",
3584
14
          FT_UINT32, BASE_DEC, VALS(interface_format), 0x0,
3585
14
          NULL, HFILL }
3586
14
      },
3587
14
      { &hf_sflow_24_flow_sample_output_interface,
3588
14
        { "Output interface (ifIndex)", "sflow.flow_sample.output_interface",
3589
14
          FT_UINT32, BASE_DEC, NULL, 0x7fffffff,
3590
14
          NULL, HFILL }
3591
14
      },
3592
14
      { &hf_sflow_5_flow_sample_output_interface,
3593
14
        { "Output interface", "sflow.flow_sample.output_interface",
3594
14
          FT_UINT32, BASE_HEX, NULL, 0x0,
3595
14
          NULL, HFILL }
3596
14
      },
3597
14
      { &hf_sflow_5_flow_sample_output_interface_form,
3598
14
        { "Output interface format", "sflow.flow_sample.output_interface_format",
3599
14
          FT_UINT32, BASE_DEC, VALS(interface_format), SFLOW_5_INT_FORMAT,
3600
14
          NULL, HFILL }
3601
14
      },
3602
14
      { &hf_sflow_5_flow_sample_output_interface_val,
3603
14
        { "Output interface value", "sflow.flow_sample.output_interface_value",
3604
14
          FT_UINT32, BASE_DEC, NULL, SFLOW_5_INT_VALUE,
3605
14
          NULL, HFILL }
3606
14
      },
3607
14
      { &hf_sflow_5_flow_sample_output_interface_val_discard,
3608
14
        { "Output interface value", "sflow.flow_sample.output_interface_value",
3609
14
          FT_UINT32, BASE_DEC, VALS(interface_discard), SFLOW_5_INT_VALUE,
3610
14
          NULL, HFILL }
3611
14
      },
3612
14
      { &hf_sflow_enterprise,
3613
14
        { "Enterprise", "sflow.enterprise",
3614
14
          FT_UINT32, BASE_DEC, NULL, 0xFFFFF000,
3615
14
          NULL, HFILL }
3616
14
      },
3617
14
      { &hf_sflow_enterprise_length,
3618
14
        { "Length", "sflow.enterprise.length",
3619
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3620
14
          NULL, HFILL }
3621
14
      },
3622
14
      { &hf_sflow_enterprise_data,
3623
14
        { "Data", "sflow.enterprise.data",
3624
14
          FT_BYTES, BASE_NONE, NULL, 0x0,
3625
14
          NULL, HFILL }
3626
14
      },
3627
14
      { &hf_sflow_flow_sample_flow_record,
3628
14
        { "Flow record", "sflow.flow_sample.flow_record",
3629
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3630
14
          NULL, HFILL }
3631
14
      },
3632
14
      { &hf_sflow_flow_sample_source_id_type,
3633
14
        { "Source ID type", "sflow.flow_sample.source_id_type",
3634
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3635
14
          NULL, HFILL }
3636
14
      },
3637
14
      { &hf_sflow_flow_sample_source_id_index,
3638
14
        { "Source ID index", "sflow.flow_sample.source_id_index",
3639
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3640
14
          NULL, HFILL }
3641
14
      },
3642
14
      { &hf_sflow_flow_sample_input_interface_format,
3643
14
        { "Input interface format", "sflow.flow_sample.input_interface_format",
3644
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3645
14
          NULL, HFILL }
3646
14
      },
3647
14
      { &hf_sflow_flow_sample_input_interface_value,
3648
14
        { "Input interface value", "sflow.flow_sample.input_interface_value",
3649
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3650
14
          NULL, HFILL }
3651
14
      },
3652
14
      { &hf_sflow_24_flow_sample_output_interface_value,
3653
14
        { "Output interface value", "sflow.flow_sample.output_interface_value",
3654
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3655
14
          NULL, HFILL }
3656
14
      },
3657
14
      { &hf_sflow_5_flow_sample_output_interface_expanded_value,
3658
14
        { "Output interface expanded value", "sflow.flow_sample.output_interface_expanded.value",
3659
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3660
14
          NULL, HFILL }
3661
14
      },
3662
14
      { &hf_sflow_5_flow_sample_output_interface_expanded_value_discarded,
3663
14
        { "Output interface packet discarded", "sflow.flow_sample.output_interface_expanded.value_discarded",
3664
14
          FT_UINT32, BASE_DEC, VALS(interface_discard), 0x0,
3665
14
          NULL, HFILL }
3666
14
      },
3667
14
      { &hf_sflow_5_flow_sample_output_interface_expanded_value_number,
3668
14
        { "Output inferface number of interfaces", "sflow.flow_sample.output_interface_expanded.number",
3669
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3670
14
          NULL, HFILL }
3671
14
      },
3672
14
      { &hf_sflow_5_flow_sample_output_interface_expanded_value_ifindex,
3673
14
        { "Output interface ifIndex", "sflow.flow_sample.output_interface_expanded.ifindex",
3674
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3675
14
          NULL, HFILL }
3676
14
      },
3677
14
      { &hf_sflow_counters_sample_sequence_number,
3678
14
        { "Sequence number", "sflow.counters_sample.sequence_number",
3679
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3680
14
          NULL, HFILL }
3681
14
      },
3682
14
      { &hf_sflow_counters_sample_source_id_class,
3683
14
        { "Source ID class", "sflow.counters_sample.source_id_class",
3684
14
          FT_UINT32, BASE_DEC, NULL, 0xFF000000,
3685
14
          NULL, HFILL }
3686
14
      },
3687
14
      { &hf_sflow_counters_sample_sampling_interval,
3688
14
        { "Sampling Interval", "sflow.counters_sample.sampling_interval",
3689
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3690
14
          NULL, HFILL }
3691
14
      },
3692
14
      { &hf_sflow_counters_sample_counters_type,
3693
14
        { "Counters type", "sflow.counters_sample.counters_type",
3694
14
          FT_UINT32, BASE_DEC, VALS(sflow_245_counterstype), 0x0,
3695
14
          NULL, HFILL }
3696
14
      },
3697
14
      { &hf_sflow_counters_sample_source_id_type,
3698
14
        { "Source ID type", "sflow.counters_sample.source_id_type",
3699
14
          FT_UINT32, BASE_DEC, NULL, 0xFF000000,
3700
14
          NULL, HFILL }
3701
14
      },
3702
14
      { &hf_sflow_counters_sample_source_id_index,
3703
14
        { "Source ID index", "sflow.counters_sample.source_id_index",
3704
14
          FT_UINT32, BASE_DEC, NULL, 0x00FFFFFF,
3705
14
          NULL, HFILL }
3706
14
      },
3707
14
      { &hf_sflow_counters_sample_counters_records,
3708
14
        { "Counters records", "sflow.counters_sample.counters_records",
3709
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3710
14
          NULL, HFILL }
3711
14
      },
3712
14
      { &hf_sflow_counters_sample_expanded_source_id_type,
3713
14
        { "Source ID type", "sflow.counters_sample.source_id_type",
3714
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3715
14
          NULL, HFILL }
3716
14
      },
3717
14
      { &hf_sflow_counters_sample_expanded_source_id_index,
3718
14
        { "Source ID index", "sflow.counters_sample.source_id_index",
3719
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3720
14
          NULL, HFILL }
3721
14
      },
3722
14
      { &hf_sflow_lag_port_padding,
3723
14
        { "Padding", "sflow.lag_port.padding",
3724
14
          FT_BYTES, BASE_NONE, NULL, 0x0,
3725
14
          NULL, HFILL }
3726
14
      },
3727
14
      { &hf_sflow_lag_port_actorsystemid,
3728
14
        { "Actor System ID", "sflow.lag_port.actor_system_id",
3729
14
          FT_ETHER, BASE_NONE, NULL, 0x0,
3730
14
          NULL, HFILL }
3731
14
      },
3732
14
      { &hf_sflow_lag_port_partneropersystemid,
3733
14
        { "Partner Oper System ID", "sflow.lag_port.partner_oper_system_id",
3734
14
          FT_ETHER, BASE_NONE, NULL, 0x0,
3735
14
          NULL, HFILL }
3736
14
      },
3737
14
      { &hf_sflow_lag_port_attachedaggid,
3738
14
        { "Port Attached Agg ID", "sflow.lag_port.attached_agg_id",
3739
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3740
14
          NULL, HFILL }
3741
14
      },
3742
14
      { &hf_sflow_lag_port_state,
3743
14
        { "State", "sflow.lag_port.state",
3744
14
          FT_UINT32, BASE_HEX, NULL, 0x0,
3745
14
          NULL, HFILL }
3746
14
      },
3747
14
      { &hf_sflow_lag_port_actoradminstate,
3748
14
        { "Actor Admin State", "sflow.lag_port.actor_admin_state",
3749
14
          FT_BOOLEAN, 32, NULL, 0x00000001,
3750
14
          NULL, HFILL }
3751
14
      },
3752
14
      { &hf_sflow_lag_port_actoroperstate,
3753
14
        { "Actor Oper State", "sflow.lag_port.actor_oper_state",
3754
14
          FT_BOOLEAN, 32, NULL, 0x00000002,
3755
14
          NULL, HFILL }
3756
14
      },
3757
14
      { &hf_sflow_lag_port_partneradminstate,
3758
14
        { "Partner Admin State", "sflow.lag_port.partner_admin_state",
3759
14
          FT_BOOLEAN, 32, NULL, 0x00000004,
3760
14
          NULL, HFILL }
3761
14
      },
3762
14
      { &hf_sflow_lag_port_partneroperstate,
3763
14
        { "Partner Oper State", "sflow.lag_port.partner_oper_state",
3764
14
          FT_BOOLEAN, 32, NULL, 0x00000008,
3765
14
          NULL, HFILL }
3766
14
      },
3767
14
      { &hf_sflow_lag_port_reserved,
3768
14
        { "Reserved", "sflow.lag_port.reserved",
3769
14
          FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF0,
3770
14
          NULL, HFILL }
3771
14
      },
3772
14
      { &hf_sflow_5_lag_port_actoradminstate,
3773
14
        { "Actor Admin State", "sflow.lag_port.actor_admin_state",
3774
14
          FT_BOOLEAN, 32, NULL, 0x000000FF,
3775
14
          NULL, HFILL }
3776
14
      },
3777
14
      { &hf_sflow_5_lag_port_actoroperstate,
3778
14
        { "Actor Oper State", "sflow.lag_port.actor_oper_state",
3779
14
          FT_BOOLEAN, 32, NULL, 0x0000FF00,
3780
14
          NULL, HFILL }
3781
14
      },
3782
14
      { &hf_sflow_5_lag_port_partneradminstate,
3783
14
        { "Partner Admin State", "sflow.lag_port.partner_admin_state",
3784
14
          FT_BOOLEAN, 32, NULL, 0x00FF0000,
3785
14
          NULL, HFILL }
3786
14
      },
3787
14
      { &hf_sflow_5_lag_port_partneroperstate,
3788
14
        { "Partner Oper State", "sflow.lag_port.partner_oper_state",
3789
14
          FT_BOOLEAN, 32, NULL, 0xFF000000,
3790
14
          NULL, HFILL }
3791
14
      },
3792
14
      { &hf_sflow_lag_port_stats_lacpdusrx,
3793
14
        { "LACPDUs Rx", "sflow.lag_port.lacpdus.rx",
3794
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3795
14
          NULL, HFILL }
3796
14
      },
3797
14
      { &hf_sflow_lag_port_stats_markerpdusrx,
3798
14
        { "Marker PDUs Rx", "sflow.lag_port.marker_pdus.rx",
3799
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3800
14
          NULL, HFILL }
3801
14
      },
3802
14
      { &hf_sflow_lag_port_stats_markerresponsepdusrx,
3803
14
        { "Marker Response PDUs Rx", "sflow.lag_port.marker_response_pdus.rx",
3804
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3805
14
          NULL, HFILL }
3806
14
      },
3807
14
      { &hf_sflow_lag_port_stats_unknownrx,
3808
14
        { "Unknown Rx", "sflow.lag_port.unknown.rx",
3809
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3810
14
          NULL, HFILL }
3811
14
      },
3812
14
      { &hf_sflow_lag_port_stats_illegalrx,
3813
14
        { "Illegal Rx", "sflow.lag_port.illegal.rx",
3814
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3815
14
          NULL, HFILL }
3816
14
      },
3817
14
      { &hf_sflow_lag_port_stats_lacpdustx,
3818
14
        { "LACPDUs Tx", "sflow.lag_port.lacpdus.tx",
3819
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3820
14
          NULL, HFILL }
3821
14
      },
3822
14
      { &hf_sflow_lag_port_stats_markerpdustx,
3823
14
        { "Marker PDUs Tx", "sflow.lag_port.marker_pdus.tx",
3824
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3825
14
          NULL, HFILL }
3826
14
      },
3827
14
      { &hf_sflow_lag_port_stats_markerresponsepdustx,
3828
14
        { "Marker Response PDUs Tx", "sflow.lag_port.marker_response_pdus.tx",
3829
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3830
14
          NULL, HFILL }
3831
14
      },
3832
3833
14
      { &hf_sflow_245_as_type,
3834
14
        { "AS Type", "sflow.as_type",
3835
14
          FT_UINT32, BASE_DEC, VALS(sflow_245_as_types), 0x0,
3836
14
          NULL, HFILL }
3837
14
      },
3838
14
      { &hf_sflow_245_ip_protocol,
3839
14
        { "IP Protocol", "sflow.ip_protocol",
3840
14
          FT_UINT32, BASE_DEC|BASE_EXT_STRING, &ipproto_val_ext, 0x0,
3841
14
          NULL, HFILL }
3842
14
      },
3843
14
      { &hf_sflow_5_extended_user_source_user,
3844
14
        { "Source User", "sflow_5.extended_user.source_user",
3845
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3846
14
          NULL, HFILL }
3847
14
      },
3848
14
      { &hf_sflow_5_extended_user_destination_user,
3849
14
        { "Destination User", "sflow_5.extended_user.destination_user",
3850
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3851
14
          NULL, HFILL }
3852
14
      },
3853
14
      { &hf_sflow_5_extended_url_direction,
3854
14
        { "Direction", "sflow_5.extended_url.direction",
3855
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3856
14
          NULL, HFILL }
3857
14
      },
3858
14
      { &hf_sflow_5_extended_url_url,
3859
14
        { "URL", "sflow_5.extended_url.url",
3860
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3861
14
          NULL, HFILL }
3862
14
      },
3863
14
      { &hf_sflow_5_extended_url_host,
3864
14
        { "Host", "sflow_5.extended_url.host",
3865
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3866
14
          NULL, HFILL }
3867
14
      },
3868
14
      { &hf_sflow_5_extended_mpls_tunnel_name,
3869
14
        { "Tunnel Name", "sflow_5.extended_mpls_tunnel.tunnel_name",
3870
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3871
14
          NULL, HFILL }
3872
14
      },
3873
14
      { &hf_sflow_5_extended_mpls_vc_instance_name,
3874
14
        { "VC Instance Name", "sflow_5.extended_mpls_vc.vc_instance_name",
3875
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3876
14
          NULL, HFILL }
3877
14
      },
3878
14
      { &hf_sflow_5_extended_mpls_ftn_description,
3879
14
        { "MPLS FTN Description", "sflow_5.extended_mpls.ftn_description",
3880
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3881
14
          NULL, HFILL }
3882
14
      },
3883
14
      { &hf_sflow_5_extended_80211_payload,
3884
14
        { "Payload", "sflow_5.extended_80211.payload",
3885
14
          FT_BYTES, BASE_NONE, NULL, 0x0,
3886
14
          NULL, HFILL }
3887
14
      },
3888
14
      { &hf_sflow_5_extended_80211_rx_ssid,
3889
14
        { "SSID", "sflow_5.extended_80211.rx.ssid",
3890
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3891
14
          NULL, HFILL }
3892
14
      },
3893
14
      { &hf_sflow_5_extended_80211_tx_ssid,
3894
14
        { "SSID", "sflow_5.extended_80211.tx.ssid",
3895
14
          FT_STRING, BASE_NONE, NULL, 0x0,
3896
14
          NULL, HFILL }
3897
14
      },
3898
14
      { &hf_sflow_flow_sample_index,
3899
14
        { "Index", "sflow.flow_sample.index",
3900
14
          FT_UINT32, BASE_DEC, NULL, 0x00FFFFFF,
3901
14
          NULL, HFILL }
3902
14
      },
3903
14
      { &hf_sflow_counters_sample_index,
3904
14
        { "Index", "sflow.counters_sample.index",
3905
14
          FT_UINT32, BASE_DEC, NULL, 0x0,
3906
14
          NULL, HFILL }
3907
14
      },
3908
14
    };
3909
3910
    /* Setup protocol subtree array */
3911
14
    static int * ett[] = {
3912
14
        &ett_sflow_245,
3913
14
        &ett_sflow_245_sample,
3914
14
        &ett_sflow_5_flow_record,
3915
14
        &ett_sflow_5_counters_record,
3916
14
        &ett_sflow_5_mpls_in_label_stack,
3917
14
        &ett_sflow_5_mpls_out_label_stack,
3918
14
        &ett_sflow_245_extended_data,
3919
14
        &ett_sflow_245_gw_as_dst,
3920
14
        &ett_sflow_245_gw_as_dst_seg,
3921
14
        &ett_sflow_245_gw_community,
3922
14
        &ett_sflow_245_sampled_header,
3923
14
        &ett_sflow_lag_port_state_flags,
3924
14
        &ett_sflow_5_output_interface,
3925
14
    };
3926
3927
14
    static ei_register_info ei[] = {
3928
14
        { &ei_sflow_invalid_address_type, { "sflow.invalid_address_type", PI_MALFORMED, PI_ERROR, "Unknown/invalid address type", EXPFILL }},
3929
14
        { &ei_sflow_unknown_record_format, { "sflow.unknown_record_format", PI_UNDECODED, PI_NOTE, "Unknown/invalid record type", EXPFILL }},
3930
14
    };
3931
3932
14
    expert_module_t* expert_sflow;
3933
3934
    /* Register the protocol name and description */
3935
14
    proto_sflow = proto_register_protocol("InMon sFlow", "sFlow", "sflow");
3936
3937
    /* Required function calls to register the header fields and subtrees used */
3938
14
    proto_register_field_array(proto_sflow, hf, array_length(hf));
3939
14
    proto_register_subtree_array(ett, array_length(ett));
3940
14
    expert_sflow = expert_register_protocol(proto_sflow);
3941
14
    expert_register_field_array(expert_sflow, ei, array_length(ei));
3942
3943
14
    header_subdissector_table  = register_dissector_table("sflow_245.header_protocol", "SFLOW header protocol", proto_sflow, FT_UINT32, BASE_DEC);
3944
3945
    /* Register our dissector handle */
3946
14
    sflow_handle = register_dissector("sflow", dissect_sflow_245, proto_sflow);
3947
3948
    /* Register our configuration options for sFlow */
3949
14
    sflow_245_module = prefs_register_protocol(proto_sflow, NULL);
3950
3951
    /*
3952
       If I use a filter like "ip.src == 10.1.1.1" this will, in
3953
       addition to the usual suspects, find every sFlow packet
3954
       where *any* of the payload headers contain 10.1.1.1 as a
3955
       src addr.  I think this may not be the desired behavior.
3956
       It can certainly be confusing since the ip.src being found
3957
       is buried about 3 subtrees deep and the subtrees might be
3958
       under any one of the sampled (payload) header trees. It is
3959
       certainly not quickly obvious why the filter matched.
3960
     */
3961
14
    prefs_register_bool_preference(sflow_245_module, "enable_dissection",
3962
14
            "Dissect data in sampled headers",
3963
14
            "Enabling dissection makes it easy to view protocol details in each of the sampled headers."
3964
14
            "  Disabling dissection may reduce noise caused when display filters match the contents of"
3965
14
            " any sampled header(s).",
3966
14
            &global_dissect_samp_headers);
3967
    /*
3968
       It is not clear to me that it *ever* makes sense to enable
3969
       this option.  However, it was previously the default
3970
       behavior so I'll leave it as an option if someone thinks
3971
       they have a use for it.
3972
     */
3973
14
    prefs_register_bool_preference(sflow_245_module, "enable_analysis",
3974
14
            "Analyze data in sampled IP headers",
3975
14
            "This option only makes sense if dissection of sampled headers is enabled and probably not even then.",
3976
14
            &global_analyze_samp_ip_headers);
3977
14
}
3978
3979
void
3980
14
proto_reg_handoff_sflow_245(void) {
3981
3982
14
    dissector_add_uint_range_with_preference("udp.port", SFLOW_UDP_PORTS, sflow_handle);
3983
14
}
3984
3985
/*
3986
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
3987
 *
3988
 * Local variables:
3989
 * c-basic-offset: 4
3990
 * tab-width: 8
3991
 * indent-tabs-mode: nil
3992
 * End:
3993
 *
3994
 * vi: set shiftwidth=4 tabstop=8 expandtab:
3995
 * :indentSize=4:tabSize=8:noTabs=true:
3996
 */