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
|
/* packet-openflow_v1.c
* Routines for OpenFlow dissection
* Copyright 2013, Anders Broman <anders.broman@ericsson.com>
* Copyright 2013, Zoltan Lajos Kis <zoltan.lajos.kis@ericsson.com>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Ref https://www.opennetworking.org/sdn-resources/onf-specifications/openflow
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
void proto_register_openflow_v1(void);
void proto_reg_handoff_openflow_v1(void);
static dissector_handle_t eth_withoutfcs_handle;
/* Initialize the protocol and registered fields */
static int proto_openflow_v1;
static int hf_openflow_version;
static int hf_openflow_1_0_type;
static int hf_openflow_length;
static int hf_openflow_xid;
static int hf_openflow_datapath_id;
static int hf_openflow_datapath_mac;
static int hf_openflow_datapath_impl;
static int hf_openflow_n_buffers;
static int hf_openflow_n_tables;
/* static int hf_openflow_auxiliary_id; */
static int hf_openflow_capabilities;
static int hf_openflow_actions;
/* static int hf_openflow_reserved32; */
static int hf_openflow_cap_flow_stats;
static int hf_openflow_table_stats;
static int hf_openflow_port_stats;
static int hf_openflow_group_stats;
static int hf_openflow_ip_reasm;
static int hf_openflow_queue_stats;
static int hf_openflow_port_blocked;
static int hf_openflow_output; /* Output to switch port. */
static int hf_openflow_set_vlan_vid; /* Set the 802.1q VLAN id. */
static int hf_openflow_set_vlan_pcp; /* Set the 802.1q priority. */
static int hf_openflow_strip_vlan; /* Strip the 802.1q header. */
static int hf_openflow_set_dl_src; /* Ethernet source address. */
static int hf_openflow_set_dl_dst; /* Ethernet destination address. */
static int hf_openflow_set_nw_src; /* IP source address. */
static int hf_openflow_set_nw_dst; /* IP destination address. */
static int hf_openflow_set_nw_tos; /* IP ToS (DSCP field, 6 bits). */
static int hf_openflow_set_tp_src; /* TCP/UDP source port. */
static int hf_openflow_set_tp_dst; /* TCP/UDP destination port. */
static int hf_openflow_enqueue; /* Output to queue. */
static int hf_openflow_port_no;
static int hf_openflow_hw_addr;
static int hf_openflow_port_name;
static int hf_openflow_port_config;
static int hf_openflow_port_state;
static int hf_openflow_port_curr;
static int hf_openflow_port_advertised;
static int hf_openflow_port_supported;
static int hf_openflow_port_peer;
static int hf_openflow_port_down; /* Port is administratively down. */
static int hf_openflow_no_stp; /* Disable 802.1D spanning tree on port. */
static int hf_openflow_no_recv; /* Drop all packets except 802.1D spanning tree packets. */
static int hf_openflow_no_recv_stp; /* Drop received 802.1D STP packets. */
static int hf_openflow_no_flood; /* Do not include this port when flooding. */
static int hf_openflow_no_fwd; /* Drop packets forwarded to port. */
static int hf_openflow_no_packet_in; /* Do not send packet-in msgs for port. */
static int hf_openflow_link_down; /* No physical link present. */
static int hf_openflow_10mb_hd; /* 10 Mb half-duplex rate support. */
static int hf_openflow_10mb_fd; /* 10 Mb full-duplex rate support. */
static int hf_openflow_100mb_hd; /* 100 Mb half-duplex rate support. */
static int hf_openflow_100mb_fd; /* 100 Mb full-duplex rate support. */
static int hf_openflow_1gb_hd; /* 1 Gb half-duplex rate support. */
static int hf_openflow_1gb_fd; /* 1 Gb full-duplex rate support. */
static int hf_openflow_10gb_fd; /* 10 Gb full-duplex rate support. */
static int hf_openflow_copper; /* Copper medium. */
static int hf_openflow_fiber; /* Fiber medium. */
static int hf_openflow_autoneg; /* Auto-negotiation. */
static int hf_openflow_pause; /* Pause. */
static int hf_openflow_pause_asym; /* Asymmetric pause. */
static int hf_openflow_config_flags;
static int hf_openflow_miss_send_len;
static int hf_openflow_buffer_id;
static int hf_openflow_total_len;
static int hf_openflow_in_port;
static int hf_openflow_reason;
static int hf_openflow_pkt_in_pad;
static int hf_openflow_flow_removed_cookie;
static int hf_openflow_flow_removed_priority;
static int hf_openflow_flow_removed_reason;
static int hf_openflow_flow_removed_pad1;
static int hf_openflow_flow_removed_duration_sec;
static int hf_openflow_flow_removed_duration_nsec;
static int hf_openflow_flow_removed_idle_timeout;
static int hf_openflow_flow_removed_pad2;
static int hf_openflow_flow_removed_packet_count;
static int hf_openflow_flow_removed_byte_count;
static int hf_openflow_table_id;
static int hf_openflow_cookie;
/* static int hf_openflow_cookie_mask; */
static int hf_openflow_features_reply_pad;
static int hf_openflow_actions_len;
static int hf_openflow_action_type;
static int hf_openflow_action_len;
static int hf_openflow_output_port;
static int hf_openflow_max_len;
static int hf_openflow_wildcards;
static int hf_openflow_command;
static int hf_openflow_eth_src;
static int hf_openflow_eth_dst;
static int hf_openflow_dl_vlan;
static int hf_openflow_dl_vlan_pcp;
static int hf_openflow_ofp_match_pad;
static int hf_openflow_match_dl_type;
static int hf_openflow_ofp_match_tos;
static int hf_openflow_ofp_match_nw_proto;
static int hf_openflow_ofp_source_addr;
static int hf_openflow_ofp_dest_addr;
static int hf_openflow_ofp_source_port;
static int hf_openflow_ofp_dest_port;
static int hf_openflow_idle_timeout;
static int hf_openflow_hard_timeout;
static int hf_openflow_priority;
static int hf_openflow_out_port;
/* static int hf_openflow_out_group; */
static int hf_openflow_flags;
static int hf_openflow_v1_stats_type;
static int hf_openflow_v1_flow_stats_request_pad;
/* Initialize the subtree pointers */
static int ett_openflow;
static int ett_openflow_path_id;
static int ett_openflow_cap;
static int ett_openflow_act;
static int ett_openflow_port;
static int ett_openflow_port_cnf;
static int ett_openflow_port_state;
static int ett_openflow_port_cf;
/* static expert_field ei_openflow_undecoded_data; */
static expert_field ei_openflow_action_type;
static expert_field ei_openflow_1_0_type;
static const value_string openflow_version_values[] = {
{ 0x01, "1.0" },
{ 0, NULL }
};
/* Immutable messages. */
#define OFPT_1_0_HELLO 0 /* Symmetric message */
#define OFPT_1_0_ERROR 1 /* Symmetric message */
#define OFPT_1_0_ECHO_REQUEST 2 /* Symmetric message */
#define OFPT_1_0_ECHO_REPLY 3 /* Symmetric message */
#define OFPT_1_0_VENDOR 4 /* Symmetric message */
/* Switch configuration messages. */
#define OFPT_1_0_FEATURES_REQUEST 5 /* Controller/switch message */
#define OFPT_1_0_FEATURES_REPLY 6 /* Controller/switch message */
#define OFPT_1_0_GET_CONFIG_REQUEST 7 /* Controller/switch message */
#define OFPT_1_0_GET_CONFIG_REPLY 8 /* Controller/switch message */
#define OFPT_1_0_SET_CONFIG 9 /* Controller/switch message */
/* Asynchronous messages. */
#define OFPT_1_0_PACKET_IN 10 /* Async message */
#define OFPT_1_0_FLOW_REMOVED 11 /* Async message */
#define OFPT_1_0_PORT_STATUS 12 /* Async message */
/* Controller command messages. */
#define OFPT_1_0_PACKET_OUT 13 /* Controller/switch message */
#define OFPT_1_0_FLOW_MOD 14 /* Controller/switch message */
#define OFPT_1_0_PORT_MOD 15 /* Controller/switch message */
/* Statistics messages. */
#define OFPT_1_0_STATS_REQUEST 16 /* Controller/switch message */
#define OFPT_1_0_STATS_REPLY 17 /* Controller/switch message */
/* Barrier messages. */
#define OFPT_1_0_BARRIER_REQUEST 18 /* Controller/switch message */
#define OFPT_1_0_BARRIER_REPLY 19 /* Controller/switch message */
/* Queue Configuration messages. */
#define OFPT_1_0_QUEUE_GET_CONFIG_REQUEST 20 /* Controller/switch message */
#define OFPT_1_0_QUEUE_GET_CONFIG_REPLY 21 /* Controller/switch message */
static const value_string openflow_1_0_type_values[] = {
/* Immutable messages. */
{ 0, "OFPT_HELLO" }, /* Symmetric message */
{ 1, "OFPT_ERROR" }, /* Symmetric message */
{ 2, "OFPT_ECHO_REQUEST" }, /* Symmetric message */
{ 3, "OFPT_ECHO_REPLY" }, /* Symmetric message */
{ 4, "OFPT_VENDOR" }, /* Symmetric message */
/* Switch configuration messages. */
{ 5, "OFPT_FEATURES_REQUEST" }, /* Controller/switch message */
{ 6, "OFPT_FEATURES_REPLY" }, /* Controller/switch message */
{ 7, "OFPT_GET_CONFIG_REQUEST" }, /* Controller/switch message */
{ 8, "OFPT_GET_CONFIG_REPLY" }, /* Controller/switch message */
{ 9, "OFPT_SET_CONFIG" }, /* Controller/switch message */
/* Asynchronous messages. */
{ 10, "OFPT_PACKET_IN" }, /* Async message */
{ 11, "OFPT_FLOW_REMOVED" }, /* Async message */
{ 12, "OFPT_PORT_STATUS" }, /* Async message */
/* Controller command messages. */
{ 13, "OFPT_PACKET_OUT" }, /* Controller/switch message */
{ 14, "OFPT_FLOW_MOD" }, /* Controller/switch message */
{ 15, "OFPT_PORT_MOD" }, /* Controller/switch message */
/* Statistics messages. */
{ 16, "OFPT_STATS_REQUEST" }, /* Controller/switch message */
{ 17, "OFPT_STATS_REPLY" }, /* Controller/switch message */
/* Barrier messages. */
{ 18, "OFPT_BARRIER_REQUEST" }, /* Controller/switch message */
{ 19, "OFPT_BARRIER_REPLY" }, /* Controller/switch message */
/* Queue Configuration messages. */
{ 20, "OFPT_QUEUE_GET_CONFIG_REQUEST" }, /* Controller/switch message */
{ 21, "OFPT_QUEUE_GET_CONFIG_REPLY" }, /* Controller/switch message */
{ 0, NULL }
};
static value_string_ext openflow_1_0_type_values_ext = VALUE_STRING_EXT_INIT(openflow_1_0_type_values);
#define OFPC_FLOW_STATS 1<<0 /* Flow statistics. */
#define OFPC_TABLE_STATS 1<<1 /* Table statistics. */
#define OFPC_PORT_STATS 1<<2 /* Port statistics. */
#define OFPC_GROUP_STATS 1<<3 /* Group statistics. */
#define OFPC_IP_REASM 1<<5 /* Can reassemble IP fragments. */
#define OFPC_QUEUE_STATS 1<<6 /* Queue statistics. */
#define OFPC_PORT_BLOCKED 1<<8 /* Switch will block looping ports. */
#define OFPAT_OUTPUT_MASK 1<<0 /* Output to switch port. */
#define OFPAT_SET_VLAN_VID_MASK 1<<1 /* Set the 802.1q VLAN id. */
#define OFPAT_SET_VLAN_PCP_MASK 1<<2 /* Set the 802.1q priority. */
#define OFPAT_STRIP_VLAN_MASK 1<<3 /* Strip the 802.1q header. */
#define OFPAT_SET_DL_SRC_MASK 1<<4 /* Ethernet source address. */
#define OFPAT_SET_DL_DST_MASK 1<<5 /* Ethernet destination address. */
#define OFPAT_SET_NW_SRC_MASK 1<<6 /* IP source address. */
#define OFPAT_SET_NW_DST_MASK 1<<7 /* IP destination address. */
#define OFPAT_SET_NW_TOS_MASK 1<<8 /* IP ToS (DSCP field, 6 bits). */
#define OFPAT_SET_TP_SRC_MASK 1<<9 /* TCP/UDP source port. */
#define OFPAT_SET_TP_DST_MASK 1<<10 /* TCP/UDP destination port. */
#define OFPAT_ENQUEUE_MASK 1<<11 /* Output to queue. */
#define OFPPC_PORT_DOWN 1<<0 /* Port is administratively down. */
#define OFPPC_NO_STP 1<<1 /* Disable 802.1D spanning tree on port. */
#define OFPPC_NO_RECV 1<<2 /* Drop all packets except 802.1D spanning tree packets. */
#define OFPPC_NO_RECV_STP 1<<3 /* Drop received 802.1D STP packets. */
#define OFPPC_NO_FLOOD 1<<4 /* Do not include this port when flooding. */
#define OFPPC_NO_FWD 1<<5 /* Drop packets forwarded to port. */
#define OFPPC_NO_PACKET_IN 1<<6 /* Do not send packet-in msgs for port. */
#define OFP_MAX_PORT_NAME_LEN 16
#define OFPPS_LINK_DOWN 1<<0 /* No physical link present. */
#define OFPPS_STP_LISTEN 0<<8 /* Not learning or relaying frames. */
#define OFPPS_STP_LEARN 1<<8 /* Learning but not relaying frames. */
#define OFPPS_STP_FORWARD 2<<8 /* Learning and relaying frames. */
#define OFPPS_STP_BLOCK 3<<8 /* Not part of spanning tree. */
#define OFPPS_STP_MASK 3<<8 /* Bit mask for OFPPS_STP_* values. */
#define OFPPF_10MB_HD 1<<0 /* 10 Mb half-duplex rate support. */
#define OFPPF_10MB_FD 1<<1 /* 10 Mb full-duplex rate support. */
#define OFPPF_100MB_HD 1<<2 /* 100 Mb half-duplex rate support. */
#define OFPPF_100MB_FD 1<<3 /* 100 Mb full-duplex rate support. */
#define OFPPF_1GB_HD 1<<4 /* 1 Gb half-duplex rate support. */
#define OFPPF_1GB_FD 1<<5 /* 1 Gb full-duplex rate support. */
#define OFPPF_10GB_FD 1<<6 /* 10 Gb full-duplex rate support. */
#define OFPPF_COPPER 1<<7 /* Copper medium. */
#define OFPPF_FIBER 1<<8 /* Fiber medium. */
#define OFPPF_AUTONEG 1<<9 /* Auto-negotiation. */
#define OFPPF_PAUSE 1<<10 /* Pause. */
#define OFPPF_PAUSE_ASYM 1<<11 /* Asymmetric pause. */
#define OFPAT_OUTPUT 0 /* Output to switch port. */
#define OFPAT_SET_VLAN_VID 1 /* Set the 802.1q VLAN id. */
#define OFPAT_SET_VLAN_PCP 2 /* Set the 802.1q priority. */
#define OFPAT_STRIP_VLAN 3 /* Strip the 802.1q header. */
#define OFPAT_SET_DL_SRC 4 /* Ethernet source address. */
#define OFPAT_SET_DL_DST 5 /* Ethernet destination address. */
#define OFPAT_SET_NW_SRC 6 /* IP source address. */
#define OFPAT_SET_NW_DST 7 /* IP destination address. */
#define OFPAT_SET_TP_SRC 8 /* TCP/UDP source port. */
#define OFPAT_SET_TP_DST 9 /* TCP/UDP destination port. */
#define OFPAT_VENDOR 0xffff
static int
dissect_openflow_ofp_match_v1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* uint32_t wildcards; Wildcard fields. */
proto_tree_add_item(tree, hf_openflow_wildcards, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* uint16_t in_port; Input switch port. */
proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint8_t dl_src[OFP_ETH_ALEN]; Ethernet source address. */
proto_tree_add_item(tree, hf_openflow_eth_src, tvb, offset, 6, ENC_NA);
offset+=6;
/* uint8_t dl_dst[OFP_ETH_ALEN]; Ethernet destination address. */
proto_tree_add_item(tree, hf_openflow_eth_dst, tvb, offset, 6, ENC_NA);
offset+=6;
/* uint16_t dl_vlan; Input VLAN id. */
proto_tree_add_item(tree, hf_openflow_dl_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint8_t dl_vlan_pcp; Input VLAN priority. */
proto_tree_add_item(tree, hf_openflow_dl_vlan_pcp, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* uint8_t pad1[1]; Align to 64-bits */
proto_tree_add_item(tree, hf_openflow_ofp_match_pad, tvb, offset, 1, ENC_NA);
offset++;
/* uint16_t dl_type; Ethernet frame type. */
proto_tree_add_item(tree, hf_openflow_match_dl_type, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint8_t nw_tos; IP ToS (actually DSCP field, 6 bits). */
proto_tree_add_item(tree, hf_openflow_ofp_match_tos, tvb, offset, 1, ENC_NA);
offset++;
/* uint8_t nw_proto; IP protocol or lower 8 bits of
* ARP opcode.
*/
proto_tree_add_item(tree, hf_openflow_ofp_match_nw_proto, tvb, offset, 1, ENC_NA);
offset++;
/* uint8_t pad2[2]; Align to 64-bits */
proto_tree_add_item(tree, hf_openflow_ofp_match_pad, tvb, offset, 2, ENC_NA);
offset += 2;
/* uint32_t nw_src; IP source address. */
proto_tree_add_item(tree, hf_openflow_ofp_source_addr, tvb, offset, 4, ENC_NA);
offset += 4;
/* uint32_t nw_dst; IP destination address. */
proto_tree_add_item(tree, hf_openflow_ofp_dest_addr, tvb, offset, 4, ENC_NA);
offset += 4;
/* uint16_t tp_src; TCP/UDP source port. */
proto_tree_add_item(tree, hf_openflow_ofp_source_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint16_t tp_dst; TCP/UDP destination port. */
proto_tree_add_item(tree, hf_openflow_ofp_dest_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
return offset;
}
static int
dissect_openflow_flow_stats_request_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
/* struct ofp_match match; Fields to match */
offset = dissect_openflow_ofp_match_v1(tvb, pinfo, tree, offset);
/* uint8_t table_id; ID of table to read (from ofp_table_stats),
* 0xff for all tables or 0xfe for emergency.
*/
proto_tree_add_item(tree, hf_openflow_table_id, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* uint8_t pad; Align to 32 bits. */
proto_tree_add_item(tree, hf_openflow_v1_flow_stats_request_pad, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* uint16_t out_port; */
proto_tree_add_item(tree, hf_openflow_out_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
return offset;
}
static const value_string openflow_action_values[] = {
{ OFPAT_OUTPUT, "Output to switch port" },
{ OFPAT_SET_VLAN_VID, "Set the 802.1q VLAN id" },
{ OFPAT_SET_VLAN_PCP, "Set the 802.1q priority" },
{ OFPAT_STRIP_VLAN, "Strip the 802.1q header" },
{ OFPAT_SET_DL_SRC, "Ethernet source address" },
{ OFPAT_SET_DL_DST, "Ethernet destination address" },
{ OFPAT_SET_NW_SRC, "IP source address" },
{ OFPAT_SET_NW_DST, "IP destination address" },
{ OFPAT_SET_TP_SRC, "TCP/UDP source port" },
{ OFPAT_SET_TP_DST, "TCP/UDP destination port" },
{ OFPAT_VENDOR, "Vendor specific action"},
{ 0, NULL }
};
static int
dissect_openflow_action_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
uint16_t action_type, action_len;
proto_item* ti;
/* uint16_t type; One of OFPAT_*. */
action_type = tvb_get_ntohs(tvb, offset);
ti = proto_tree_add_item(tree, hf_openflow_action_type, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* Length of action, including this
* header. This is the length of action,
* including any padding to make it
* 64-bit aligned.
*/
action_len = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_openflow_action_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
switch(action_type){
case OFPAT_OUTPUT:
/* uint16_t port; Output port. */
proto_tree_add_item(tree, hf_openflow_output_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint16_t max_len; Max length to send to controller. */
proto_tree_add_item(tree, hf_openflow_max_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
break;
default:
expert_add_info(pinfo, ti, &ei_openflow_action_type);
offset+=(action_len-4);
break;
}
return offset;
}
static void
dissect_openflow_phy_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
proto_item *ti;
proto_tree *port_cnf_tree, *port_state_tree, *port_cf_tree;
proto_tree_add_item(tree, hf_openflow_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
proto_tree_add_item(tree, hf_openflow_hw_addr, tvb, offset, 6, ENC_NA);
offset+=6;
proto_tree_add_item(tree, hf_openflow_port_name, tvb, offset, OFP_MAX_PORT_NAME_LEN, ENC_ASCII);
offset+=OFP_MAX_PORT_NAME_LEN;
/* Bitmap of OFPPC_* flags. */
ti = proto_tree_add_item(tree, hf_openflow_port_config, tvb, offset, 4, ENC_BIG_ENDIAN);
port_cnf_tree = proto_item_add_subtree(ti, ett_openflow_port_cnf);
/* Port is administratively down. */
proto_tree_add_item(port_cnf_tree, hf_openflow_port_down, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Disable 802.1D spanning tree on port. */
proto_tree_add_item(port_cnf_tree, hf_openflow_no_stp, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Drop all packets except 802.1D spanning tree packets. */
proto_tree_add_item(port_cnf_tree, hf_openflow_no_recv, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Drop received 802.1D STP packets. */
proto_tree_add_item(port_cnf_tree, hf_openflow_no_recv_stp, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Do not include this port when flooding. */
proto_tree_add_item(port_cnf_tree, hf_openflow_no_flood, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Drop packets forwarded to port. */
proto_tree_add_item(port_cnf_tree, hf_openflow_no_fwd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Do not send packet-in msgs for port. */
proto_tree_add_item(port_cnf_tree, hf_openflow_no_packet_in, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* Bitmap of OFPPS_* flags. */
ti = proto_tree_add_item(tree, hf_openflow_port_state, tvb, offset, 4, ENC_BIG_ENDIAN);
port_state_tree = proto_item_add_subtree(ti, ett_openflow_port_state);
/* No physical link present. */
proto_tree_add_item(port_state_tree, hf_openflow_link_down, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* Current features. */
ti = proto_tree_add_item(tree, hf_openflow_port_curr, tvb, offset, 4, ENC_BIG_ENDIAN);
port_cf_tree = proto_item_add_subtree(ti, ett_openflow_port_cf);
/* 10 Mb half-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_10mb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* 10 Mb full-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_10mb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* 100 Mb half-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_100mb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* 100 Mb full-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_100mb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* 1 Gb half-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_1gb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* 1 Gb full-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_1gb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* 10 Gb full-duplex rate support. */
proto_tree_add_item(port_cf_tree, hf_openflow_10gb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Copper medium. */
proto_tree_add_item(port_cf_tree, hf_openflow_copper, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Fiber medium. */
proto_tree_add_item(port_cf_tree, hf_openflow_fiber, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Auto-negotiation. */
proto_tree_add_item(port_cf_tree, hf_openflow_autoneg, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Pause. */
proto_tree_add_item(port_cf_tree, hf_openflow_pause, tvb, offset, 4, ENC_BIG_ENDIAN);
/* Asymmetric pause. */
proto_tree_add_item(port_cf_tree, hf_openflow_pause_asym, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* Features being advertised by the port. */
proto_tree_add_item(tree, hf_openflow_port_advertised, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* Features supported by the port. */
proto_tree_add_item(tree, hf_openflow_port_supported, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* Features advertised by peer. */
proto_tree_add_item(tree, hf_openflow_port_peer, tvb, offset, 4, ENC_BIG_ENDIAN);
}
#if 0
/*
* Switch features.
*/
struct ofp_switch_features {
struct ofp_header header;
uint64_t datapath_id; /* Datapath unique ID. The lower 48-bits are for
a MAC address, while the upper 16-bits are
implementer-defined. */
uint32_t n_buffers; /* Max packets buffered at once. */
uint8_t n_tables; /* Number of tables supported by datapath. */
uint8_t pad[3]; /* Align to 64-bits. */
/* Features. */
uint32_t capabilities; /* Bitmap of support "ofp_capabilities". */
uint32_t actions; /* Bitmap of supported "ofp_action_type"s. */
/* Port info.*/
struct ofp_phy_port ports[0]; /* Port definitions. The number of ports
is inferred from the length field in
the header. */
#endif
static void
dissect_openflow_features_reply_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length)
{
proto_item *ti;
proto_tree *path_id_tree, *cap_tree, *act_tree;
uint16_t length_remaining;
ti = proto_tree_add_item(tree, hf_openflow_datapath_id, tvb, offset, 8, ENC_BIG_ENDIAN);
path_id_tree = proto_item_add_subtree(ti, ett_openflow_path_id);
proto_tree_add_item(path_id_tree, hf_openflow_datapath_impl, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
proto_tree_add_item(path_id_tree, hf_openflow_datapath_mac, tvb, offset, 6, ENC_NA);
offset+=6;
proto_tree_add_item(tree, hf_openflow_n_buffers, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
proto_tree_add_item(tree, hf_openflow_n_tables, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(tree, hf_openflow_features_reply_pad, tvb, offset, 3, ENC_NA);
offset+=3;
ti = proto_tree_add_item(tree, hf_openflow_capabilities, tvb, offset, 4, ENC_BIG_ENDIAN);
cap_tree = proto_item_add_subtree(ti, ett_openflow_cap);
/* Dissect flags */
proto_tree_add_item(cap_tree, hf_openflow_cap_flow_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(cap_tree, hf_openflow_table_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(cap_tree, hf_openflow_port_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(cap_tree, hf_openflow_group_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(cap_tree, hf_openflow_ip_reasm, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(cap_tree, hf_openflow_queue_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(cap_tree, hf_openflow_port_blocked, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
ti = proto_tree_add_item(tree, hf_openflow_actions, tvb, offset, 4, ENC_BIG_ENDIAN);
act_tree = proto_item_add_subtree(ti, ett_openflow_act);
/* Dissect flags */
proto_tree_add_item(act_tree, hf_openflow_output, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_vlan_vid, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_vlan_pcp, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_strip_vlan, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_dl_src, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_dl_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_nw_src, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_nw_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_nw_tos, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_tp_src, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_set_tp_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(act_tree, hf_openflow_enqueue, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
length_remaining = length-32;
if(length_remaining > 0){
uint16_t num_ports = length_remaining/48;
int i;
if((length_remaining&0x003f) != 0){
/* protocol_error */
}
for(i=0; i<num_ports ;i++){
proto_tree *port_tree;
port_tree = proto_tree_add_subtree_format(tree, tvb, offset, 48, ett_openflow_port, NULL, "Port data %u",i+1);
dissect_openflow_phy_port(tvb, pinfo, port_tree, offset);
offset+=48;
}
}
}
static void
dissect_openflow_switch_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, uint16_t length _U_)
{
/* ofp_config_flags */
proto_tree_add_item(tree, hf_openflow_config_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* miss_send_len */
proto_tree_add_item(tree, hf_openflow_miss_send_len, tvb, offset, 2, ENC_BIG_ENDIAN);
/*offset+=2;*/
}
#define OFPR_NO_MATCH 0 /* No matching flow (table-miss flow entry). */
#define OFPR_ACTION 1 /* Action explicitly output to controller. */
#define OFPR_INVALID_TTL 2 /* Packet has invalid TTL */
static const value_string openflow_reason_values[] = {
{ OFPR_NO_MATCH, "No matching flow (table-miss flow entry)" },
{ OFPR_ACTION, "Action explicitly output to controller" },
{ OFPR_INVALID_TTL, "Packet has invalid TTL" },
{ 0, NULL }
};
static void
dissect_openflow_pkt_in(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length)
{
tvbuff_t *next_tvb;
/* uint32_t buffer_id; ID assigned by datapath. */
proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* uint16_t total_len; Full length of frame. */
proto_tree_add_item(tree, hf_openflow_total_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint16_t in_port; Port on which frame was received. */
proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint8_t reason; Reason packet is being sent (one of OFPR_*) */
proto_tree_add_item(tree, hf_openflow_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(tree, hf_openflow_pkt_in_pad, tvb, offset, 1, ENC_NA);
offset+=1;
next_tvb = tvb_new_subset_length(tvb, offset, length-offset);
call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
}
#define OFPRR_IDLE_TIMEOUT 0
#define OFPRR_HARD_TIMEOUT 1
#define OFPRR_DELETE 2
static const value_string openflow_flow_removed_reason_values[] = {
{ OFPRR_IDLE_TIMEOUT, "OFPRR_IDLE_TIMEOUT" },
{ OFPRR_HARD_TIMEOUT, "OFPRR_HARD_TIMEOUT" },
{ OFPRR_DELETE, "OFPRR_DELETE" },
{ 0, NULL }
};
static void
dissect_openflow_flow_removed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length _U_)
{
/* struct match; */
offset = dissect_openflow_ofp_match_v1(tvb, pinfo, tree, offset);
/* uint64_t cookie; */
proto_tree_add_item(tree, hf_openflow_flow_removed_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
offset+=8;
/* uint16_t priority; */
proto_tree_add_item(tree, hf_openflow_flow_removed_priority, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint8_t reason; */
proto_tree_add_item(tree, hf_openflow_flow_removed_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
offset+=1;
/* uint8_t pad1; */
proto_tree_add_item(tree, hf_openflow_flow_removed_pad1, tvb, offset, 1, ENC_BIG_ENDIAN);
offset+=1;
/* uint32_t duration_sec; */
proto_tree_add_item(tree, hf_openflow_flow_removed_duration_sec, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* uint32_t duration_nsec; */
proto_tree_add_item(tree, hf_openflow_flow_removed_duration_nsec, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* uint16_t idle_timeout; */
proto_tree_add_item(tree, hf_openflow_flow_removed_idle_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint8_t pad2; */
proto_tree_add_item(tree, hf_openflow_flow_removed_pad2, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint64_t packet_count; */
proto_tree_add_item(tree, hf_openflow_flow_removed_packet_count, tvb, offset, 8, ENC_BIG_ENDIAN);
offset+=8;
/* uint64_t byte_count; */
proto_tree_add_item(tree, hf_openflow_flow_removed_byte_count, tvb, offset, 8, ENC_BIG_ENDIAN);
}
static void
dissect_openflow_pkt_out(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length)
{
tvbuff_t *next_tvb;
int32_t buffer_id;
/* uint32_t buffer_id; ID assigned by datapath. */
buffer_id = tvb_get_ntohl(tvb, offset);
proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
/* uint32_t in_port; Packet's input port or OFPP_CONTROLLER. */
proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* uint16_t actions_len; Size of action array in bytes. */
proto_tree_add_item(tree, hf_openflow_actions_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* struct ofp_action_header actions[0]; Action list. */
offset = dissect_openflow_action_header(tvb, pinfo, tree, offset);
/* Packet data. The length is inferred
from the length field in the header.
(Only meaningful if buffer_id == -1.)
*/
if(buffer_id == -1){
next_tvb = tvb_new_subset_length(tvb, offset, length-offset);
call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
}
}
#define OFPFC_ADD 0 /* New flow. */
#define OFPFC_MODIFY 1 /* Modify all matching flows. */
#define OFPFC_MODIFY_STRICT 2 /* Modify entry strictly matching wildcards */
#define OFPFC_DELETE 3 /* Delete all matching flows. */
#define OFPFC_DELETE_STRICT 4 /* Strictly match wildcards and priority. */
static const value_string openflow_command_values[] = {
{ OFPFC_ADD, "New flow" },
{ OFPFC_MODIFY, "Modify all matching flows" },
{ OFPFC_MODIFY_STRICT, "Modify entry strictly matching wildcards" },
{ OFPFC_DELETE, "Delete all matching flows" },
{ OFPFC_DELETE_STRICT, "Strictly match wildcards and priority" },
{ 0, NULL }
};
static void
dissect_openflow_flow_mod(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length _U_)
{
/* struct ofp_match match; Fields to match */
offset = dissect_openflow_ofp_match_v1(tvb, pinfo, tree, offset);
/* uint64_t cookie; Opaque controller-issued identifier. */
proto_tree_add_item(tree, hf_openflow_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
/* uint16_t command; One of OFPFC_*. */
proto_tree_add_item(tree, hf_openflow_command, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint16_t idle_timeout; Idle time before discarding (seconds). */
proto_tree_add_item(tree, hf_openflow_idle_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint16_t hard_timeout; Max time before discarding (seconds). */
proto_tree_add_item(tree, hf_openflow_hard_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint16_t priority; Priority level of flow entry. */
proto_tree_add_item(tree, hf_openflow_priority, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint32_t buffer_id; Buffered packet to apply to, or OFP_NO_BUFFER.
Not meaningful for OFPFC_DELETE*.
*/
proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
/* uint32_t out_port; For OFPFC_DELETE* commands, require
matching entries to include this as an output port. A value of OFPP_ANY
indicates no restriction.
*/
proto_tree_add_item(tree, hf_openflow_out_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint16_t flags; One of OFPFF_*. */
proto_tree_add_item(tree, hf_openflow_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
dissect_openflow_action_header(tvb, pinfo, tree, offset);
}
#define OFPST_DESC 0
#define OFPST_FLOW 1
#define OFPST_AGGREGATE 2
#define OFPST_TABLE 3
#define OFPST_PORT 4
#define OFPST_QUEUE 5
#define OFPST_VENDOR 0xffff
static const value_string openflow_stats_type_values[] = {
{ OFPST_DESC, "OFPST_DESC" },
{ OFPST_FLOW, "OFPST_FLOW" },
{ OFPST_AGGREGATE, "OFPST_AGGREGATE" },
{ OFPST_TABLE, "OFPST_TABLE" },
{ OFPST_PORT, "OFPST_PORT" },
{ OFPST_QUEUE, "OFPST_QUEUE" },
{ OFPST_VENDOR, "OFPST_VENDOR" },
{ 0, NULL }
};
static int
dissect_openflow_stats_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length _U_)
{
proto_item *type_item;
uint32_t type;
/* uint16_t type; */
type_item = proto_tree_add_item_ret_uint(tree, hf_openflow_v1_stats_type, tvb, offset, 2, ENC_BIG_ENDIAN, &type);
offset += 2;
/* uint16_t flags; OFPSF_REQ_* flags (none yet defined). */
proto_tree_add_item(tree, hf_openflow_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint8_t body[0]; Body of the request. */
switch (type) {
case OFPST_DESC:
/* The request body is empty. */
break;
case OFPST_FLOW:
dissect_openflow_flow_stats_request_v1(tvb, pinfo, tree, offset);
break;
default:
expert_add_info(pinfo, type_item, &ei_openflow_1_0_type);
break;
}
return offset;
}
static int
dissect_openflow_stats_resp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint16_t length)
{
proto_item *type_item;
uint32_t type;
/* uint16_t type; */
type_item = proto_tree_add_item_ret_uint(tree, hf_openflow_v1_stats_type, tvb, offset, 2, ENC_BIG_ENDIAN, &type);
offset += 2;
/* uint16_t flags; OFPSF_REQ_ */
proto_tree_add_item(tree, hf_openflow_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* uint8_t body[0]; Body of the request. */
if (length == 12 ) {
/* No body */
return offset;
}
switch (type) {
case OFPST_DESC:
/* The request body is empty. */
break;
case OFPST_FLOW:
/* fall trough */
default:
expert_add_info(pinfo, type_item, &ei_openflow_1_0_type);
break;
}
return offset;
}
static int
dissect_openflow_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti, *type_item;
proto_tree *openflow_tree;
unsigned offset = 0;
uint8_t type;
uint16_t length;
type = tvb_get_uint8(tvb, 1);
col_append_fstr(pinfo->cinfo, COL_INFO, "Type: %s",
val_to_str_ext_const(type, &openflow_1_0_type_values_ext, "Unknown message type"));
/* Stop the Ethernet frame from overwriting the columns */
if((type == OFPT_1_0_PACKET_IN) || (type == OFPT_1_0_PACKET_OUT)){
col_set_writable(pinfo->cinfo, -1, false);
}
/* Create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_openflow_v1, tvb, 0, -1, ENC_NA);
openflow_tree = proto_item_add_subtree(ti, ett_openflow);
/* A.1 OpenFlow Header. */
/* OFP_VERSION. */
proto_tree_add_item(openflow_tree, hf_openflow_version, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* One of the OFPT_ constants. */
type_item = proto_tree_add_item(openflow_tree, hf_openflow_1_0_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Length including this ofp_header. */
length = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(openflow_tree, hf_openflow_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
/* Transaction id associated with this packet. Replies use the same id as was in the request
* to facilitate pairing.
*/
proto_tree_add_item(openflow_tree, hf_openflow_xid, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
switch(type){
case OFPT_1_0_HELLO: /* 0 */
/* 5.5.1 Hello
* The OFPT_HELLO message has no body;
*/
break;
case OFPT_1_0_FEATURES_REQUEST: /* 5 */
/* 5.3.1 Handshake
* Upon TLS session establishment, the controller sends an OFPT_FEATURES_REQUEST
* message. This message does not contain a body beyond the OpenFlow header.
*/
break;
case OFPT_1_0_FEATURES_REPLY: /* 6 */
dissect_openflow_features_reply_v1(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_GET_CONFIG_REQUEST: /* 7 */
/* A.3.2 There is no body for OFPT_GET_CONFIG_REQUEST beyond the OpenFlow header. */
break;
case OFPT_1_0_GET_CONFIG_REPLY: /* 8 */
/* Fall trough */
case OFPT_1_0_SET_CONFIG: /* 9 */
dissect_openflow_switch_config(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_PACKET_IN: /* 10 */
dissect_openflow_pkt_in(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_FLOW_REMOVED: /* 11 */
dissect_openflow_flow_removed(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_PACKET_OUT: /* 13 */
dissect_openflow_pkt_out(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_FLOW_MOD: /* 14 */
dissect_openflow_flow_mod(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_STATS_REQUEST: /* 16 */
dissect_openflow_stats_req(tvb, pinfo, openflow_tree, offset, length);
break;
case OFPT_1_0_STATS_REPLY: /* 17 */
dissect_openflow_stats_resp(tvb, pinfo, openflow_tree, offset, length);
break;
default:
if(length>8){
expert_add_info(pinfo, type_item, &ei_openflow_1_0_type);
}
break;
}
return tvb_reported_length(tvb);
}
/*
* Register the protocol with Wireshark.
*/
void
proto_register_openflow_v1(void)
{
static hf_register_info hf[] = {
{ &hf_openflow_version,
{ "Version", "openflow.version",
FT_UINT8, BASE_HEX, VALS(openflow_version_values), 0x7f,
NULL, HFILL }
},
{ &hf_openflow_1_0_type,
{ "Type", "openflow_1_0.type",
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &openflow_1_0_type_values_ext, 0x0,
NULL, HFILL }
},
{ &hf_openflow_xid,
{ "Transaction ID", "openflow.xid",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_length,
{ "Length", "openflow.length",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_datapath_id,
{ "Datapath unique ID", "openflow.datapath_id",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_datapath_mac,
{ "MAC addr", "openflow.datapath_mac",
FT_ETHER, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_datapath_impl,
{ "Implementers part", "openflow.datapath_imp",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_n_buffers,
{ "n_buffers", "openflow.n_buffers",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_n_tables,
{ "n_tables", "openflow.n_tables",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
{ &hf_openflow_auxiliary_id,
{ "auxiliary_id", "openflow.auxiliary_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
{ &hf_openflow_capabilities,
{ "capabilities", "openflow.capabilities",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_actions,
{ "actions", "openflow.actions",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
#if 0
{ &hf_openflow_reserved32,
{ "Reserved", "openflow.reserved32",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
{ &hf_openflow_cap_flow_stats,
{ "Flow statistics", "openflow.flow_stats",
FT_BOOLEAN, 32, NULL, OFPC_FLOW_STATS,
NULL, HFILL }
},
{ &hf_openflow_table_stats,
{ "Table statistics", "openflow.table_stats",
FT_BOOLEAN, 32, NULL, OFPC_TABLE_STATS,
NULL, HFILL }
},
{ &hf_openflow_port_stats,
{ "Port statistics", "openflow.port_stats",
FT_BOOLEAN, 32, NULL, OFPC_PORT_STATS,
NULL, HFILL }
},
{ &hf_openflow_group_stats,
{ "Group statistics", "openflow.group_stats",
FT_BOOLEAN, 32, NULL, OFPC_GROUP_STATS,
NULL, HFILL }
},
{ &hf_openflow_ip_reasm,
{ "Can reassemble IP fragments", "openflow.ip_reasm",
FT_BOOLEAN, 32, NULL, OFPC_IP_REASM,
NULL, HFILL }
},
{ &hf_openflow_queue_stats,
{ "Queue statistics", "openflow.queue_stats",
FT_BOOLEAN, 32, NULL, OFPC_QUEUE_STATS,
NULL, HFILL }
},
{ &hf_openflow_port_blocked,
{ "Switch will block looping ports", "openflow.port_blocked",
FT_BOOLEAN, 32, NULL, OFPC_PORT_BLOCKED,
NULL, HFILL }
},
{ &hf_openflow_output,
{ "Output to switch port", "openflow.output",
FT_BOOLEAN, 32, NULL, OFPAT_OUTPUT_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_vlan_vid,
{ "Set the 802.1q VLAN id", "openflow.set_vlan_vid",
FT_BOOLEAN, 32, NULL, OFPAT_SET_VLAN_VID_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_vlan_pcp,
{ "Set the 802.1q priority", "openflow.set_vlan_pcp",
FT_BOOLEAN, 32, NULL, OFPAT_SET_VLAN_PCP_MASK,
NULL, HFILL }
},
{ &hf_openflow_strip_vlan,
{ "Strip the 802.1q header", "openflow.strip_vlan",
FT_BOOLEAN, 32, NULL, OFPAT_STRIP_VLAN_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_dl_src,
{ "Ethernet source address", "openflow.set_dl_src",
FT_BOOLEAN, 32, NULL, OFPAT_SET_DL_SRC_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_dl_dst,
{ "Ethernet destination address", "openflow.set_dl_ds",
FT_BOOLEAN, 32, NULL, OFPAT_SET_DL_DST_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_nw_src,
{ "IP source address", "openflow.set_nw_src",
FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_SRC_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_nw_dst,
{ "IP destination address", "openflow.set_nw_ds",
FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_DST_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_nw_tos,
{ "IP ToS (DSCP field, 6 bits)", "openflow.set_nw_tos",
FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_TOS_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_tp_src,
{ "TCP/UDP source port", "openflow.set_tp_src",
FT_BOOLEAN, 32, NULL, OFPAT_SET_TP_SRC_MASK,
NULL, HFILL }
},
{ &hf_openflow_set_tp_dst,
{ "TCP/UDP destination port", "openflow.set_tp_dst",
FT_BOOLEAN, 32, NULL, OFPAT_SET_TP_DST_MASK,
NULL, HFILL }
},
{ &hf_openflow_enqueue,
{ "Output to queue", "openflow.enqueue",
FT_BOOLEAN, 32, NULL, OFPAT_ENQUEUE_MASK,
NULL, HFILL }
},
{ &hf_openflow_port_no,
{ "Port number", "openflow.port_no",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_hw_addr,
{ "HW Address", "openflow.hw_add",
FT_ETHER, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_name,
{ "Port Name", "openflow.port_name",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_config,
{ "Config flags", "openflow.port_config",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_state,
{ "State flags", "openflow.port_state",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_curr,
{ "Current features", "openflow.port_curr",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_advertised,
{ "Advertised features", "openflow.port_advertised",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_supported,
{ "Features supported", "openflow.port_supported",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_peer,
{ "Features advertised by peer", "openflow.port_peer",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_port_down,
{ "Port is administratively down", "openflow.port_down",
FT_BOOLEAN, 32, NULL, OFPPC_PORT_DOWN,
NULL, HFILL }
},
{ &hf_openflow_no_stp,
{ "Disable 802.1D spanning tree on port", "openflow.no_stp",
FT_BOOLEAN, 32, NULL, OFPPC_NO_STP,
NULL, HFILL }
},
{ &hf_openflow_no_recv,
{ "Drop all packets except 802.1D spanning tree packets", "openflow.no_recv",
FT_BOOLEAN, 32, NULL, OFPPC_NO_RECV,
NULL, HFILL }
},
{ &hf_openflow_no_recv_stp,
{ "Drop received 802.1D STP packets", "openflow.no_recv_stp",
FT_BOOLEAN, 32, NULL, OFPPC_NO_RECV_STP,
NULL, HFILL }
},
{ &hf_openflow_no_flood,
{ "Do not include this port when flooding", "openflow.no_flood",
FT_BOOLEAN, 32, NULL, OFPPC_NO_FLOOD,
NULL, HFILL }
},
{ &hf_openflow_no_fwd,
{ "Drop packets forwarded to port", "openflow.no_fwd",
FT_BOOLEAN, 32, NULL, OFPPC_NO_FWD,
NULL, HFILL }
},
{ &hf_openflow_no_packet_in,
{ "Do not send packet-in msgs for port", "openflow.no_packet_in",
FT_BOOLEAN, 32, NULL, OFPPC_NO_PACKET_IN,
NULL, HFILL }
},
{ &hf_openflow_link_down,
{ "No physical link present", "openflow.link_down",
FT_BOOLEAN, 32, NULL, OFPPS_LINK_DOWN,
NULL, HFILL }
},
{ &hf_openflow_10mb_hd,
{ "10 Mb half-duplex rate support", "openflow.10mb_hd",
FT_BOOLEAN, 32, NULL, OFPPF_10MB_HD,
NULL, HFILL }
},
{ &hf_openflow_10mb_fd,
{ "10 Mb full-duplex rate support", "openflow.10mb_fd",
FT_BOOLEAN, 32, NULL, OFPPF_10MB_FD,
NULL, HFILL }
},
{ &hf_openflow_100mb_hd,
{ "100 Mb half-duplex rate support", "openflow.100mb_hd",
FT_BOOLEAN, 32, NULL, OFPPF_100MB_HD,
NULL, HFILL }
},
{ &hf_openflow_100mb_fd,
{ "100 Mb full-duplex rate support", "openflow.100mb_0fd",
FT_BOOLEAN, 32, NULL, OFPPF_100MB_FD,
NULL, HFILL }
},
{ &hf_openflow_1gb_hd,
{ "1 Gb half-duplex rate support", "openflow.1gb_hd",
FT_BOOLEAN, 32, NULL, OFPPF_1GB_HD,
NULL, HFILL }
},
{ &hf_openflow_1gb_fd,
{ "1 Gb full-duplex rate support", "openflow.1gb_fd",
FT_BOOLEAN, 32, NULL, OFPPF_1GB_FD,
NULL, HFILL }
},
{ &hf_openflow_10gb_fd,
{ "10 Gb full-duplex rate support", "openflow.10gb_fd",
FT_BOOLEAN, 32, NULL, OFPPF_10GB_FD,
NULL, HFILL }
},
{ &hf_openflow_copper,
{ "Copper medium", "openflow.copper",
FT_BOOLEAN, 32, NULL, OFPPF_COPPER,
NULL, HFILL }
},
{ &hf_openflow_fiber,
{ "Fiber medium", "openflow.fiber",
FT_BOOLEAN, 32, NULL, OFPPF_FIBER,
NULL, HFILL }
},
{ &hf_openflow_autoneg,
{ "Auto-negotiation", "openflow.autoneg",
FT_BOOLEAN, 32, NULL, OFPPF_AUTONEG,
NULL, HFILL }
},
{ &hf_openflow_pause,
{ "Pause", "openflow.pause",
FT_BOOLEAN, 32, NULL, OFPPF_PAUSE,
NULL, HFILL }
},
{ &hf_openflow_pause_asym,
{ "Asymmetric pause", "openflow.pause_asym",
FT_BOOLEAN, 32, NULL, OFPPF_PAUSE_ASYM,
NULL, HFILL }
},
{ &hf_openflow_config_flags,
{ "Config flags", "openflow.config_flags",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_miss_send_len,
{ "Max bytes of packet", "openflow.miss_send_len",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_buffer_id,
{ "Buffer Id", "openflow.buffer_id",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_total_len,
{ "Total length", "openflow.total_len",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_in_port,
{ "In port", "openflow.in_port",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_reason,
{ "Reason", "openflow.reason",
FT_UINT8, BASE_DEC, VALS(openflow_reason_values), 0x0,
NULL, HFILL }
},
{ &hf_openflow_pkt_in_pad,
{ "Pad", "openflow.pkt_in.pad",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_cookie,
{ "Cookie", "openflow.flow_removed.cookie",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_priority,
{ "Priority", "openflow.flow_removed.priority",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_reason,
{ "Reason", "openflow.flow_removed.reason",
FT_UINT8, BASE_DEC, VALS(openflow_flow_removed_reason_values), 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_pad1,
{ "Pad1", "openflow.flow_removed.pad1",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_duration_sec,
{ "Duration sec", "openflow.flow_removed.duration_sec",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_duration_nsec,
{ "Duration nsec", "openflow.flow_removed.duration_nsec",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_idle_timeout,
{ "Idle timeout", "openflow.flow_removed.idle_timeout",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_pad2,
{ "Pad2", "openflow.flow_removed.pad2",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_packet_count,
{ "Packet count", "openflow.flow_removed.packet_count",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_flow_removed_byte_count,
{ "Byte count", "openflow.flow_removed.byte_count",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_table_id,
{ "Table Id", "openflow.table_id",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_cookie,
{ "Cookie", "openflow.cookie",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
#if 0
{ &hf_openflow_cookie_mask,
{ "Cookie mask", "openflow.cookie_mask",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
#endif
{ &hf_openflow_features_reply_pad,
{ "Pad", "openflow.features_reply.pad",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_actions_len,
{ "Actions length", "openflow.actions_len",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_action_type,
{ "Actions type", "openflow.action_typ",
FT_UINT16, BASE_DEC, VALS(openflow_action_values), 0x0,
NULL, HFILL }
},
{ &hf_openflow_action_len,
{ "Action length", "openflow.action_len",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_output_port,
{ "Output port", "openflow.output_port",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_max_len,
{ "Max length", "openflow.max_len",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_wildcards,
{ "Wildcards", "openflow.wildcards",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_command,
{ "Command", "openflow.command",
FT_UINT16, BASE_DEC, VALS(openflow_command_values), 0x0,
NULL, HFILL }
},
{ &hf_openflow_eth_src,
{ "Ethernet source address", "openflow.eth_src",
FT_ETHER, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_eth_dst,
{ "Ethernet destination address", "openflow.eth_dst",
FT_ETHER, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_dl_vlan,
{ "Input VLAN id", "openflow.dl_vlan",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_dl_vlan_pcp,
{ "Input VLAN priority", "openflow.dl_vlan_pcp",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_match_pad,
{ "Pad", "openflow.ofp_match.pad",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_match_dl_type,
{ "Dl type", "openflow.ofp_match.dl_type",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_match_tos,
{ "IP ToS", "openflow.ofp_match.tos",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_match_nw_proto,
{ "IP protocol", "openflow.ofp_match.nw_proto",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_source_addr,
{ "Source Address", "openflow.ofp_match.source_addr",
FT_IPv4, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_dest_addr,
{ "Destination Address", "openflow.ofp_match.dest_addr",
FT_IPv4, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_source_port,
{ "Source Port", "openflow.ofp_match.source_port",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_ofp_dest_port,
{ "Destination Port", "openflow.ofp_match.dest_port",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_idle_timeout,
{ "Idle time-out", "openflow.idle_timeout",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_hard_timeout,
{ "hard time-out", "openflow.hard_timeout",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_priority,
{ "Priority", "openflow.priority",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_out_port,
{ "Out port", "openflow.out_port",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
{ &hf_openflow_out_group,
{ "Out group", "openflow.out_group",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
{ &hf_openflow_flags,
{ "Flags", "openflow.flags",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_openflow_v1_stats_type,
{ "Type", "openflow.stats.type",
FT_UINT16, BASE_DEC, VALS(openflow_stats_type_values), 0x0,
NULL, HFILL }
},
{ &hf_openflow_v1_flow_stats_request_pad,
{ "Pad", "openflow.stats.request_pad",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
};
static int *ett[] = {
&ett_openflow,
&ett_openflow_path_id,
&ett_openflow_cap,
&ett_openflow_act,
&ett_openflow_port,
&ett_openflow_port_cnf,
&ett_openflow_port_state,
&ett_openflow_port_cf
};
static ei_register_info ei[] = {
#if 0
{ &ei_openflow_undecoded_data, { "openflow.undecoded_data", PI_UNDECODED, PI_WARN, "Data not dissected yet", EXPFILL }},
#endif
{ &ei_openflow_action_type, { "openflow.action_typ.undecoded", PI_UNDECODED, PI_WARN, "Action not dissected yet", EXPFILL }},
{ &ei_openflow_1_0_type, { "openflow_1_0.type.undecoded", PI_UNDECODED, PI_WARN, "Message data not dissected yet", EXPFILL }},
};
expert_module_t* expert_openflow_v1;
/* Register the protocol name and description */
proto_openflow_v1 = proto_register_protocol("OpenFlow 1.0", "openflow_v1", "openflow_v1");
register_dissector("openflow_v1", dissect_openflow_v1, proto_openflow_v1);
/* Required function calls to register the header fields and subtrees */
proto_register_field_array(proto_openflow_v1, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_openflow_v1 = expert_register_protocol(proto_openflow_v1);
expert_register_field_array(expert_openflow_v1, ei, array_length(ei));
}
void
proto_reg_handoff_openflow_v1(void)
{
eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_openflow_v1);
}
/*
* 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:
*/
|