Coverage Report

Created: 2025-08-04 07:15

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