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