1 /* packet-openflow_v1.c
2 * Routines for OpenFlow dissection
3 * Copyright 2013, Anders Broman <anders.broman@ericsson.com>
4 * Copyright 2013, Zoltan Lajos Kis <zoltan.lajos.kis@ericsson.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Ref https://www.opennetworking.org/sdn-resources/onf-specifications/openflow
31 #include <epan/packet.h>
32 #include <epan/prefs.h>
34 void proto_register_openflow_v1(void);
35 void proto_reg_handoff_openflow_v1(void);
37 static dissector_handle_t eth_withoutfcs_handle;
39 /* Initialize the protocol and registered fields */
40 static int proto_openflow_v1 = -1;
41 static int hf_openflow_version = -1;
42 static int hf_openflow_1_0_type = -1;
43 static int hf_openflow_length = -1;
44 static int hf_openflow_xid = -1;
46 static int hf_openflow_datapath_id = -1;
47 static int hf_openflow_datapath_mac = -1;
48 static int hf_openflow_datapath_impl = -1;
49 static int hf_openflow_n_buffers = -1;
50 static int hf_openflow_n_tables = -1;
51 /* static int hf_openflow_auxiliary_id = -1; */
52 /* static int hf_openflow_pad3 = -1; */
53 static int hf_openflow_capabilities = -1;
54 static int hf_openflow_actions = -1;
55 /* static int hf_openflow_reserved32 = -1; */
56 static int hf_openflow_cap_flow_stats = -1;
57 static int hf_openflow_table_stats = -1;
58 static int hf_openflow_port_stats = -1;
59 static int hf_openflow_group_stats = -1;
60 static int hf_openflow_ip_reasm = -1;
61 static int hf_openflow_queue_stats = -1;
62 static int hf_openflow_port_blocked = -1;
64 static int hf_openflow_output = -1; /* Output to switch port. */
65 static int hf_openflow_set_vlan_vid = -1; /* Set the 802.1q VLAN id. */
66 static int hf_openflow_set_vlan_pcp = -1; /* Set the 802.1q priority. */
67 static int hf_openflow_strip_vlan = -1; /* Strip the 802.1q header. */
68 static int hf_openflow_set_dl_src = -1; /* Ethernet source address. */
69 static int hf_openflow_set_dl_dst = -1; /* Ethernet destination address. */
70 static int hf_openflow_set_nw_src = -1; /* IP source address. */
71 static int hf_openflow_set_nw_dst = -1; /* IP destination address. */
72 static int hf_openflow_set_nw_tos = -1; /* IP ToS (DSCP field, 6 bits). */
73 static int hf_openflow_set_tp_src = -1; /* TCP/UDP source port. */
74 static int hf_openflow_set_tp_dst = -1; /* TCP/UDP destination port. */
75 static int hf_openflow_enqueue = -1; /* Output to queue. */
77 static int hf_openflow_port_no = -1;
78 static int hf_openflow_hw_addr = -1;
79 static int hf_openflow_port_name = -1;
82 static int hf_openflow_port_config = -1;
83 static int hf_openflow_port_state = -1;
84 static int hf_openflow_port_curr = -1;
85 static int hf_openflow_port_advertised = -1;
86 static int hf_openflow_port_supported = -1;
87 static int hf_openflow_port_peer = -1;
89 static int hf_openflow_port_down = -1; /* Port is administratively down. */
90 static int hf_openflow_no_stp = -1; /* Disable 802.1D spanning tree on port. */
91 static int hf_openflow_no_recv = -1; /* Drop all packets except 802.1D spanning tree packets. */
92 static int hf_openflow_no_recv_stp = -1; /* Drop received 802.1D STP packets. */
93 static int hf_openflow_no_flood = -1; /* Do not include this port when flooding. */
94 static int hf_openflow_no_fwd = -1; /* Drop packets forwarded to port. */
95 static int hf_openflow_no_packet_in = -1; /* Do not send packet-in msgs for port. */
97 static int hf_openflow_link_down = -1; /* No physical link present. */
99 static int hf_openflow_10mb_hd = -1; /* 10 Mb half-duplex rate support. */
100 static int hf_openflow_10mb_fd = -1; /* 10 Mb full-duplex rate support. */
101 static int hf_openflow_100mb_hd = -1; /* 100 Mb half-duplex rate support. */
102 static int hf_openflow_100mb_fd = -1; /* 100 Mb full-duplex rate support. */
103 static int hf_openflow_1gb_hd = -1; /* 1 Gb half-duplex rate support. */
104 static int hf_openflow_1gb_fd = -1; /* 1 Gb full-duplex rate support. */
105 static int hf_openflow_10gb_fd = -1; /* 10 Gb full-duplex rate support. */
106 static int hf_openflow_copper = -1; /* Copper medium. */
107 static int hf_openflow_fiber = -1; /* Fiber medium. */
108 static int hf_openflow_autoneg = -1; /* Auto-negotiation. */
109 static int hf_openflow_pause = -1; /* Pause. */
110 static int hf_openflow_pause_asym = -1; /* Asymmetric pause. */
112 static int hf_openflow_config_flags = -1;
113 static int hf_openflow_miss_send_len = -1;
115 static int hf_openflow_buffer_id = -1;
116 static int hf_openflow_total_len = -1;
117 static int hf_openflow_in_port = -1;
118 static int hf_openflow_reason = -1;
119 /* static int hf_openflow_table_id = -1; */
120 static int hf_openflow_cookie = -1;
121 /* static int hf_openflow_cookie_mask = -1; */
122 static int hf_openflow_padd8 = -1;
123 /* static int hf_openflow_padd16 = -1; */
124 /* static int hf_openflow_padd48 = -1; */
125 static int hf_openflow_actions_len = -1;
126 static int hf_openflow_action_type = -1;
127 static int hf_openflow_action_len = -1;
128 static int hf_openflow_output_port = -1;
129 static int hf_openflow_max_len = -1;
130 static int hf_openflow_wildcards = -1;
131 static int hf_openflow_command = -1;
132 static int hf_openflow_eth_src = -1;
133 static int hf_openflow_eth_dst = -1;
134 static int hf_openflow_dl_vlan = -1;
135 static int hf_openflow_dl_vlan_pcp = -1;
136 static int hf_openflow_idle_timeout = -1;
137 static int hf_openflow_hard_timeout = -1;
138 static int hf_openflow_priority = -1;
139 static int hf_openflow_out_port = -1;
140 /* static int hf_openflow_out_group = -1; */
141 static int hf_openflow_flags = -1;
143 /* Initialize the subtree pointers */
144 static gint ett_openflow = -1;
145 static gint ett_openflow_path_id = -1;
146 static gint ett_openflow_cap = -1;
147 static gint ett_openflow_act = -1;
148 static gint ett_openflow_port = -1;
149 static gint ett_openflow_port_cnf = -1;
150 static gint ett_openflow_port_state = -1;
151 static gint ett_openflow_port_cf = -1;
153 static const value_string openflow_version_values[] = {
159 /* Immutable messages. */
160 #define OFPT_1_0_HELLO 0 /* Symmetric message */
161 #define OFPT_1_0_ERROR 1 /* Symmetric message */
162 #define OFPT_1_0_ECHO_REQUEST 2 /* Symmetric message */
163 #define OFPT_1_0_ECHO_REPLY 3 /* Symmetric message */
164 #define OFPT_1_0_VENDOR 4 /* Symmetric message */
165 /* Switch configuration messages. */
166 #define OFPT_1_0_FEATURES_REQUEST 5 /* Controller/switch message */
167 #define OFPT_1_0_FEATURES_REPLY 6 /* Controller/switch message */
168 #define OFPT_1_0_GET_CONFIG_REQUEST 7 /* Controller/switch message */
169 #define OFPT_1_0_GET_CONFIG_REPLY 8 /* Controller/switch message */
170 #define OFPT_1_0_SET_CONFIG 9 /* Controller/switch message */
171 /* Asynchronous messages. */
172 #define OFPT_1_0_PACKET_IN 10 /* Async message */
173 #define OFPT_1_0_FLOW_REMOVED 11 /* Async message */
174 #define OFPT_1_0_PORT_STATUS 12 /* Async message */
175 /* Controller command messages. */
176 #define OFPT_1_0_PACKET_OUT 13 /* Controller/switch message */
177 #define OFPT_1_0_FLOW_MOD 14 /* Controller/switch message */
178 #define OFPT_1_0_PORT_MOD 15 /* Controller/switch message */
179 /* Statistics messages. */
180 #define OFPT_1_0_STATS_REQUEST 16 /* Controller/switch message */
181 #define OFPT_1_0_STATS_REPLY 17 /* Controller/switch message */
182 /* Barrier messages. */
183 #define OFPT_1_0_BARRIER_REQUEST 18 /* Controller/switch message */
184 #define OFPT_1_0_BARRIER_REPLY 19 /* Controller/switch message */
185 /* Queue Configuration messages. */
186 #define OFPT_1_0_QUEUE_GET_CONFIG_REQUEST 20 /* Controller/switch message */
187 #define OFPT_1_0_QUEUE_GET_CONFIG_REPLY 21 /* Controller/switch message */
190 static const value_string openflow_1_0_type_values[] = {
191 /* Immutable messages. */
193 /* Immutable messages. */
194 { 0, "OFPT_HELLO" }, /* Symmetric message */
195 { 1, "OFPT_ERROR" }, /* Symmetric message */
196 { 2, "OFPT_ECHO_REQUEST" }, /* Symmetric message */
197 { 3, "OFPT_ECHO_REPLY" }, /* Symmetric message */
198 { 4, "OFPT_VENDOR" }, /* Symmetric message */
199 /* Switch configuration messages. */
200 { 5, "OFPT_FEATURES_REQUEST" }, /* Controller/switch message */
201 { 6, "OFPT_FEATURES_REPLY" }, /* Controller/switch message */
202 { 7, "OFPT_GET_CONFIG_REQUEST" }, /* Controller/switch message */
203 { 8, "OFPT_GET_CONFIG_REPLY" }, /* Controller/switch message */
204 { 9, "OFPT_SET_CONFIG" }, /* Controller/switch message */
205 /* Asynchronous messages. */
206 { 10, "OFPT_PACKET_IN" }, /* Async message */
207 { 11, "OFPT_FLOW_REMOVED" }, /* Async message */
208 { 12, "OFPT_PORT_STATUS" }, /* Async message */
209 /* Controller command messages. */
210 { 13, "OFPT_PACKET_OUT" }, /* Controller/switch message */
211 { 14, "OFPT_FLOW_MOD" }, /* Controller/switch message */
212 { 15, "OFPT_PORT_MOD" }, /* Controller/switch message */
213 /* Statistics messages. */
214 { 16, "OFPT_STATS_REQUEST" }, /* Controller/switch message */
215 { 17, "OFPT_STATS_REPLY" }, /* Controller/switch message */
216 /* Barrier messages. */
217 { 18, "OFPT_BARRIER_REQUEST" }, /* Controller/switch message */
218 { 19, "OFPT_BARRIER_REPLY" }, /* Controller/switch message */
219 /* Queue Configuration messages. */
220 { 20, "OFPT_QUEUE_GET_CONFIG_REQUEST" }, /* Controller/switch message */
221 { 21, "OFPT_QUEUE_GET_CONFIG_REPLY" }, /* Controller/switch message */
226 #define OFPC_FLOW_STATS 1<<0 /* Flow statistics. */
227 #define OFPC_TABLE_STATS 1<<1 /* Table statistics. */
228 #define OFPC_PORT_STATS 1<<2 /* Port statistics. */
229 #define OFPC_GROUP_STATS 1<<3 /* Group statistics. */
230 #define OFPC_IP_REASM 1<<5 /* Can reassemble IP fragments. */
231 #define OFPC_QUEUE_STATS 1<<6 /* Queue statistics. */
232 #define OFPC_PORT_BLOCKED 1<<8 /* Switch will block looping ports. */
234 #define OFPAT_OUTPUT_MASK 1<<0 /* Output to switch port. */
235 #define OFPAT_SET_VLAN_VID_MASK 1<<1 /* Set the 802.1q VLAN id. */
236 #define OFPAT_SET_VLAN_PCP_MASK 1<<2 /* Set the 802.1q priority. */
237 #define OFPAT_STRIP_VLAN_MASK 1<<3 /* Strip the 802.1q header. */
238 #define OFPAT_SET_DL_SRC_MASK 1<<4 /* Ethernet source address. */
239 #define OFPAT_SET_DL_DST_MASK 1<<5 /* Ethernet destination address. */
240 #define OFPAT_SET_NW_SRC_MASK 1<<6 /* IP source address. */
241 #define OFPAT_SET_NW_DST_MASK 1<<7 /* IP destination address. */
242 #define OFPAT_SET_NW_TOS_MASK 1<<8 /* IP ToS (DSCP field, 6 bits). */
243 #define OFPAT_SET_TP_SRC_MASK 1<<9 /* TCP/UDP source port. */
244 #define OFPAT_SET_TP_DST_MASK 1<<10 /* TCP/UDP destination port. */
245 #define OFPAT_ENQUEUE_MASK 1<<11 /* Output to queue. */
247 #define OFPPC_PORT_DOWN 1<<0 /* Port is administratively down. */
248 #define OFPPC_NO_STP 1<<1 /* Disable 802.1D spanning tree on port. */
249 #define OFPPC_NO_RECV 1<<2 /* Drop all packets except 802.1D spanning tree packets. */
250 #define OFPPC_NO_RECV_STP 1<<3 /* Drop received 802.1D STP packets. */
251 #define OFPPC_NO_FLOOD 1<<4 /* Do not include this port when flooding. */
252 #define OFPPC_NO_FWD 1<<5 /* Drop packets forwarded to port. */
253 #define OFPPC_NO_PACKET_IN 1<<6 /* Do not send packet-in msgs for port. */
255 #define OFP_MAX_PORT_NAME_LEN 16
257 #define OFPPS_LINK_DOWN 1<<0 /* No physical link present. */
258 #define OFPPS_STP_LISTEN 0<<8 /* Not learning or relaying frames. */
259 #define OFPPS_STP_LEARN 1<<8 /* Learning but not relaying frames. */
260 #define OFPPS_STP_FORWARD 2<<8 /* Learning and relaying frames. */
261 #define OFPPS_STP_BLOCK 3<<8 /* Not part of spanning tree. */
262 #define OFPPS_STP_MASK 3<<8 /* Bit mask for OFPPS_STP_* values. */
265 #define OFPPF_10MB_HD 1<<0 /* 10 Mb half-duplex rate support. */
266 #define OFPPF_10MB_FD 1<<1 /* 10 Mb full-duplex rate support. */
267 #define OFPPF_100MB_HD 1<<2 /* 100 Mb half-duplex rate support. */
268 #define OFPPF_100MB_FD 1<<3 /* 100 Mb full-duplex rate support. */
269 #define OFPPF_1GB_HD 1<<4 /* 1 Gb half-duplex rate support. */
270 #define OFPPF_1GB_FD 1<<5 /* 1 Gb full-duplex rate support. */
271 #define OFPPF_10GB_FD 1<<6 /* 10 Gb full-duplex rate support. */
272 #define OFPPF_COPPER 1<<7 /* Copper medium. */
273 #define OFPPF_FIBER 1<<8 /* Fiber medium. */
274 #define OFPPF_AUTONEG 1<<9 /* Auto-negotiation. */
275 #define OFPPF_PAUSE 1<<10 /* Pause. */
276 #define OFPPF_PAUSE_ASYM 1<<11 /* Asymmetric pause. */
279 #define OFPAT_OUTPUT 0 /* Output to switch port. */
280 #define OFPAT_SET_VLAN_VID 1 /* Set the 802.1q VLAN id. */
281 #define OFPAT_SET_VLAN_PCP 2 /* Set the 802.1q priority. */
282 #define OFPAT_STRIP_VLAN 3 /* Strip the 802.1q header. */
283 #define OFPAT_SET_DL_SRC 4 /* Ethernet source address. */
284 #define OFPAT_SET_DL_DST 5 /* Ethernet destination address. */
285 #define OFPAT_SET_NW_SRC 6 /* IP source address. */
286 #define OFPAT_SET_NW_DST 7 /* IP destination address. */
287 #define OFPAT_SET_TP_SRC 8 /* TCP/UDP source port. */
288 #define OFPAT_SET_TP_DST 9 /* TCP/UDP destination port. */
289 #define OFPAT_VENDOR 0xffff
292 dissect_openflow_ofp_match_v1(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
295 /* uint32_t wildcards; Wildcard fields. */
296 proto_tree_add_item(tree, hf_openflow_wildcards, tvb, offset, 4, ENC_BIG_ENDIAN);
298 /* uint16_t in_port; Input switch port. */
299 proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
302 /* uint8_t dl_src[OFP_ETH_ALEN]; Ethernet source address. */
303 proto_tree_add_item(tree, hf_openflow_eth_src, tvb, offset, 6, ENC_NA);
305 /* uint8_t dl_dst[OFP_ETH_ALEN]; Ethernet destination address. */
306 proto_tree_add_item(tree, hf_openflow_eth_dst, tvb, offset, 6, ENC_NA);
308 /* uint16_t dl_vlan; Input VLAN id. */
309 proto_tree_add_item(tree, hf_openflow_dl_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
311 /* uint8_t dl_vlan_pcp; Input VLAN priority. */
312 proto_tree_add_item(tree, hf_openflow_dl_vlan_pcp, tvb, offset, 1, ENC_BIG_ENDIAN);
314 /* uint8_t pad1[1]; Align to 64-bits */
315 proto_tree_add_item(tree, hf_openflow_padd8, tvb, offset, 1, ENC_BIG_ENDIAN);
317 /* uint16_t dl_type; Ethernet frame type. */
318 /* uint8_t nw_tos; IP ToS (actually DSCP field, 6 bits). */
319 /* uint8_t nw_proto; IP protocol or lower 8 bits of
322 /* uint8_t pad2[2]; Align to 64-bits */
323 /* uint32_t nw_src; IP source address. */
324 /* uint32_t nw_dst; IP destination address. */
325 /* uint16_t tp_src; TCP/UDP source port. */
326 /* uint16_t tp_dst; TCP/UDP destination port. */
327 proto_tree_add_text(tree, tvb, offset, 18, "Data not dissected yet");
334 static const value_string openflow_action_values[] = {
335 { OFPAT_OUTPUT, "Output to switch port" },
336 { OFPAT_SET_VLAN_VID, "Set the 802.1q VLAN id" },
337 { OFPAT_SET_VLAN_PCP, "Set the 802.1q priority" },
338 { OFPAT_STRIP_VLAN, "Strip the 802.1q header" },
339 { OFPAT_SET_DL_SRC, "Ethernet source address" },
340 { OFPAT_SET_DL_DST, "Ethernet destination address" },
341 { OFPAT_SET_NW_SRC, "IP source address" },
342 { OFPAT_SET_NW_DST, "IP destination address" },
343 { OFPAT_SET_TP_SRC, "TCP/UDP source port" },
344 { OFPAT_SET_TP_DST, "TCP/UDP destination port" },
345 { OFPAT_VENDOR, "Vendor specific action"},
350 dissect_openflow_action_header(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
352 guint16 action_type, action_len;
354 /* uint16_t type; One of OFPAT_*. */
355 action_type = tvb_get_ntohs(tvb, offset);
356 proto_tree_add_item(tree, hf_openflow_action_type, tvb, offset, 2, ENC_BIG_ENDIAN);
358 /* Length of action, including this
359 * header. This is the length of action,
360 * including any padding to make it
363 action_len = tvb_get_ntohs(tvb, offset);
364 proto_tree_add_item(tree, hf_openflow_action_len, tvb, offset, 2, ENC_BIG_ENDIAN);
369 /* uint16_t port; Output port. */
370 proto_tree_add_item(tree, hf_openflow_output_port, tvb, offset, 2, ENC_BIG_ENDIAN);
372 /* uint16_t max_len; Max length to send to controller. */
373 proto_tree_add_item(tree, hf_openflow_max_len, tvb, offset, 2, ENC_BIG_ENDIAN);
377 proto_tree_add_text(tree, tvb, offset, action_len-4, "Action not dissected yet");
378 offset+=(action_len-4);
385 dissect_openflow_phy_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
388 proto_tree *port_cnf_tree, *port_state_tree, *port_cf_tree;
390 proto_tree_add_item(tree, hf_openflow_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
392 proto_tree_add_item(tree, hf_openflow_hw_addr, tvb, offset, 6, ENC_NA);
394 proto_tree_add_item(tree, hf_openflow_port_name, tvb, offset, OFP_MAX_PORT_NAME_LEN, ENC_ASCII|ENC_NA);
395 offset+=OFP_MAX_PORT_NAME_LEN;
397 /* Bitmap of OFPPC_* flags. */
398 ti = proto_tree_add_item(tree, hf_openflow_port_config, tvb, offset, 4, ENC_BIG_ENDIAN);
399 port_cnf_tree = proto_item_add_subtree(ti, ett_openflow_port_cnf);
401 /* Port is administratively down. */
402 proto_tree_add_item(port_cnf_tree, hf_openflow_port_down, tvb, offset, 4, ENC_BIG_ENDIAN);
403 /* Disable 802.1D spanning tree on port. */
404 proto_tree_add_item(port_cnf_tree, hf_openflow_no_stp, tvb, offset, 4, ENC_BIG_ENDIAN);
405 /* Drop all packets except 802.1D spanning tree packets. */
406 proto_tree_add_item(port_cnf_tree, hf_openflow_no_recv, tvb, offset, 4, ENC_BIG_ENDIAN);
407 /* Drop received 802.1D STP packets. */
408 proto_tree_add_item(port_cnf_tree, hf_openflow_no_recv_stp, tvb, offset, 4, ENC_BIG_ENDIAN);
409 /* Do not include this port when flooding. */
410 proto_tree_add_item(port_cnf_tree, hf_openflow_no_flood, tvb, offset, 4, ENC_BIG_ENDIAN);
411 /* Drop packets forwarded to port. */
412 proto_tree_add_item(port_cnf_tree, hf_openflow_no_fwd, tvb, offset, 4, ENC_BIG_ENDIAN);
413 /* Do not send packet-in msgs for port. */
414 proto_tree_add_item(port_cnf_tree, hf_openflow_no_packet_in, tvb, offset, 4, ENC_BIG_ENDIAN);
417 /* Bitmap of OFPPS_* flags. */
418 ti = proto_tree_add_item(tree, hf_openflow_port_state, tvb, offset, 4, ENC_BIG_ENDIAN);
419 port_state_tree = proto_item_add_subtree(ti, ett_openflow_port_state);
421 /* No physical link present. */
422 proto_tree_add_item(port_state_tree, hf_openflow_link_down, tvb, offset, 4, ENC_BIG_ENDIAN);
426 /* Current features. */
427 ti = proto_tree_add_item(tree, hf_openflow_port_curr, tvb, offset, 4, ENC_BIG_ENDIAN);
428 port_cf_tree = proto_item_add_subtree(ti, ett_openflow_port_cf);
429 /* 10 Mb half-duplex rate support. */
430 proto_tree_add_item(port_cf_tree, hf_openflow_10mb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
431 /* 10 Mb full-duplex rate support. */
432 proto_tree_add_item(port_cf_tree, hf_openflow_10mb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
433 /* 100 Mb half-duplex rate support. */
434 proto_tree_add_item(port_cf_tree, hf_openflow_100mb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
435 /* 100 Mb full-duplex rate support. */
436 proto_tree_add_item(port_cf_tree, hf_openflow_100mb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
437 /* 1 Gb half-duplex rate support. */
438 proto_tree_add_item(port_cf_tree, hf_openflow_1gb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
439 /* 1 Gb full-duplex rate support. */
440 proto_tree_add_item(port_cf_tree, hf_openflow_1gb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
441 /* 10 Gb full-duplex rate support. */
442 proto_tree_add_item(port_cf_tree, hf_openflow_10gb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
444 proto_tree_add_item(port_cf_tree, hf_openflow_copper, tvb, offset, 4, ENC_BIG_ENDIAN);
446 proto_tree_add_item(port_cf_tree, hf_openflow_fiber, tvb, offset, 4, ENC_BIG_ENDIAN);
447 /* Auto-negotiation. */
448 proto_tree_add_item(port_cf_tree, hf_openflow_autoneg, tvb, offset, 4, ENC_BIG_ENDIAN);
450 proto_tree_add_item(port_cf_tree, hf_openflow_pause, tvb, offset, 4, ENC_BIG_ENDIAN);
451 /* Asymmetric pause. */
452 proto_tree_add_item(port_cf_tree, hf_openflow_pause_asym, tvb, offset, 4, ENC_BIG_ENDIAN);
455 /* Features being advertised by the port. */
456 proto_tree_add_item(tree, hf_openflow_port_advertised, tvb, offset, 4, ENC_BIG_ENDIAN);
459 /* Features supported by the port. */
460 proto_tree_add_item(tree, hf_openflow_port_supported, tvb, offset, 4, ENC_BIG_ENDIAN);
462 /* Features advertised by peer. */
463 proto_tree_add_item(tree, hf_openflow_port_peer, tvb, offset, 4, ENC_BIG_ENDIAN);
473 struct ofp_switch_features {
474 struct ofp_header header;
475 uint64_t datapath_id; /* Datapath unique ID. The lower 48-bits are for
476 a MAC address, while the upper 16-bits are
477 implementer-defined. */
478 uint32_t n_buffers; /* Max packets buffered at once. */
479 uint8_t n_tables; /* Number of tables supported by datapath. */
480 uint8_t pad[3]; /* Align to 64-bits. */
482 uint32_t capabilities; /* Bitmap of support "ofp_capabilities". */
483 uint32_t actions; /* Bitmap of supported "ofp_action_type"s. */
485 struct ofp_phy_port ports[0]; /* Port definitions. The number of ports
486 is inferred from the length field in
491 dissect_openflow_features_reply_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 length)
494 proto_tree *path_id_tree, *cap_tree, *act_tree;
496 guint16 length_remaining;
498 ti = proto_tree_add_item(tree, hf_openflow_datapath_id, tvb, offset, 8, ENC_BIG_ENDIAN);
499 path_id_tree = proto_item_add_subtree(ti, ett_openflow_path_id);
500 proto_tree_add_item(path_id_tree, hf_openflow_datapath_mac, tvb, offset, 6, ENC_NA);
502 proto_tree_add_item(path_id_tree, hf_openflow_datapath_impl, tvb, offset, 2, ENC_BIG_ENDIAN);
505 proto_tree_add_item(tree, hf_openflow_n_buffers, tvb, offset, 4, ENC_BIG_ENDIAN);
508 proto_tree_add_item(tree, hf_openflow_n_tables, tvb, offset, 1, ENC_BIG_ENDIAN);
511 ti = proto_tree_add_item(tree, hf_openflow_capabilities, tvb, offset, 4, ENC_BIG_ENDIAN);
512 cap_tree = proto_item_add_subtree(ti, ett_openflow_cap);
515 proto_tree_add_item(cap_tree, hf_openflow_cap_flow_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
516 proto_tree_add_item(cap_tree, hf_openflow_table_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
517 proto_tree_add_item(cap_tree, hf_openflow_port_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
518 proto_tree_add_item(cap_tree, hf_openflow_group_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
519 proto_tree_add_item(cap_tree, hf_openflow_ip_reasm, tvb, offset, 4, ENC_BIG_ENDIAN);
520 proto_tree_add_item(cap_tree, hf_openflow_queue_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
521 proto_tree_add_item(cap_tree, hf_openflow_port_blocked, tvb, offset, 4, ENC_BIG_ENDIAN);
524 ti = proto_tree_add_item(tree, hf_openflow_actions, tvb, offset, 4, ENC_BIG_ENDIAN);
525 act_tree = proto_item_add_subtree(ti, ett_openflow_act);
527 proto_tree_add_item(act_tree, hf_openflow_output, tvb, offset, 4, ENC_BIG_ENDIAN);
528 proto_tree_add_item(act_tree, hf_openflow_set_vlan_vid, tvb, offset, 4, ENC_BIG_ENDIAN);
529 proto_tree_add_item(act_tree, hf_openflow_set_vlan_pcp, tvb, offset, 4, ENC_BIG_ENDIAN);
530 proto_tree_add_item(act_tree, hf_openflow_strip_vlan, tvb, offset, 4, ENC_BIG_ENDIAN);
531 proto_tree_add_item(act_tree, hf_openflow_set_dl_src, tvb, offset, 4, ENC_BIG_ENDIAN);
532 proto_tree_add_item(act_tree, hf_openflow_set_dl_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
533 proto_tree_add_item(act_tree, hf_openflow_set_nw_src, tvb, offset, 4, ENC_BIG_ENDIAN);
534 proto_tree_add_item(act_tree, hf_openflow_set_nw_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
535 proto_tree_add_item(act_tree, hf_openflow_set_nw_tos, tvb, offset, 4, ENC_BIG_ENDIAN);
536 proto_tree_add_item(act_tree, hf_openflow_set_tp_src, tvb, offset, 4, ENC_BIG_ENDIAN);
537 proto_tree_add_item(act_tree, hf_openflow_set_tp_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
538 proto_tree_add_item(act_tree, hf_openflow_enqueue, tvb, offset, 4, ENC_BIG_ENDIAN);
541 length_remaining = length-32;
542 if(length_remaining > 0){
543 guint16 num_ports = length_remaining/48;
545 if ((length_remaining&0x003f) != 0){
548 for(i=0; i<num_ports ;i++){
549 proto_tree *port_tree;
551 port_tree = proto_tree_add_subtree_format(tree, tvb, offset, 48, ett_openflow_port, NULL, "Port data %u",i+1);
552 dissect_openflow_phy_port(tvb, pinfo, port_tree, offset);
561 dissect_openflow_switch_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
564 /* ofp_config_flags */
565 proto_tree_add_item(tree, hf_openflow_config_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
568 proto_tree_add_item(tree, hf_openflow_miss_send_len, tvb, offset, 2, ENC_BIG_ENDIAN);
573 #define OFPR_NO_MATCH 0 /* No matching flow (table-miss flow entry). */
574 #define OFPR_ACTION 1 /* Action explicitly output to controller. */
575 #define OFPR_INVALID_TTL 2 /* Packet has invalid TTL */
577 static const value_string openflow_reason_values[] = {
578 { OFPR_NO_MATCH, "No matching flow (table-miss flow entry)" },
579 { OFPR_ACTION, "Action explicitly output to controller" },
580 { OFPR_INVALID_TTL, "Packet has invalid TTL" },
585 dissect_openflow_pkt_in(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length)
589 /* uint32_t buffer_id; ID assigned by datapath. */
590 proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
592 /* uint16_t total_len; Full length of frame. */
593 proto_tree_add_item(tree, hf_openflow_total_len, tvb, offset, 2, ENC_BIG_ENDIAN);
596 /* uint16_t in_port; Port on which frame was received. */
597 proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
600 /* uint8_t reason; Reason packet is being sent (one of OFPR_*) */
601 proto_tree_add_item(tree, hf_openflow_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
604 proto_tree_add_item(tree, hf_openflow_padd8, tvb, offset, 1, ENC_BIG_ENDIAN);
607 /*proto_tree_add_text(tree, tvb, offset, length-offset, "Offset=%u, remaining %u", offset, length-offset);*/
608 next_tvb = tvb_new_subset_length(tvb, offset, length-offset);
609 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
614 dissect_openflow_pkt_out(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
619 /* uint32_t buffer_id; ID assigned by datapath. */
620 buffer_id = tvb_get_ntohl(tvb, offset);
621 proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
624 /* uint32_t in_port; Packet's input port or OFPP_CONTROLLER. */
625 proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
628 /* uint16_t actions_len; Size of action array in bytes. */
629 proto_tree_add_item(tree, hf_openflow_actions_len, tvb, offset, 2, ENC_BIG_ENDIAN);
632 /* struct ofp_action_header actions[0]; Action list. */
633 offset = dissect_openflow_action_header(tvb, pinfo, tree, offset);
634 /* Packet data. The length is inferred
635 from the length field in the header.
636 (Only meaningful if buffer_id == -1.)
639 /* proto_tree_add_text(tree, tvb, offset, -1, "Packet data"); */
640 next_tvb = tvb_new_subset_length(tvb, offset, length-offset);
641 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
645 #define OFPFC_ADD 0 /* New flow. */
646 #define OFPFC_MODIFY 1 /* Modify all matching flows. */
647 #define OFPFC_MODIFY_STRICT 2 /* Modify entry strictly matching wildcards */
648 #define OFPFC_DELETE 3 /* Delete all matching flows. */
649 #define OFPFC_DELETE_STRICT 4 /* Strictly match wildcards and priority. */
651 static const value_string openflow_command_values[] = {
652 { OFPFC_ADD, "New flow" },
653 { OFPFC_MODIFY, "Modify all matching flows" },
654 { OFPFC_MODIFY_STRICT, "Modify entry strictly matching wildcards" },
655 { OFPFC_DELETE, "Delete all matching flows" },
656 { OFPFC_DELETE_STRICT, "Strictly match wildcards and priority" },
661 dissect_openflow_flow_mod(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 length _U_)
664 /* struct ofp_match match; Fields to match */
665 offset = dissect_openflow_ofp_match_v1(tvb, pinfo, tree, offset);
667 /* uint64_t cookie; Opaque controller-issued identifier. */
668 proto_tree_add_item(tree, hf_openflow_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
671 /* uint16_t command; One of OFPFC_*. */
672 proto_tree_add_item(tree, hf_openflow_command, tvb, offset, 2, ENC_BIG_ENDIAN);
675 /* uint16_t idle_timeout; Idle time before discarding (seconds). */
676 proto_tree_add_item(tree, hf_openflow_idle_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
678 /* uint16_t hard_timeout; Max time before discarding (seconds). */
679 proto_tree_add_item(tree, hf_openflow_hard_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
681 /* uint16_t priority; Priority level of flow entry. */
682 proto_tree_add_item(tree, hf_openflow_priority, tvb, offset, 2, ENC_BIG_ENDIAN);
684 /* uint32_t buffer_id; Buffered packet to apply to, or OFP_NO_BUFFER.
685 Not meaningful for OFPFC_DELETE*.
687 proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
689 /* uint32_t out_port; For OFPFC_DELETE* commands, require
690 matching entries to include this as an output port. A value of OFPP_ANY
691 indicates no restriction.
693 proto_tree_add_item(tree, hf_openflow_out_port, tvb, offset, 2, ENC_BIG_ENDIAN);
696 /* uint16_t flags; One of OFPFF_*. */
697 proto_tree_add_item(tree, hf_openflow_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
702 dissect_openflow_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
705 proto_tree *openflow_tree;
710 type = tvb_get_guint8(tvb, 1);
712 col_append_fstr(pinfo->cinfo, COL_INFO, "Type: %s",
713 val_to_str_const(type, openflow_1_0_type_values, "Unknown message type"));
715 /* Stop the Ethernet frame from overwriting the columns */
716 if((type == OFPT_1_0_PACKET_IN) || (type == OFPT_1_0_PACKET_OUT)){
717 col_set_writable(pinfo->cinfo, FALSE);
720 /* Create display subtree for the protocol */
721 ti = proto_tree_add_item(tree, proto_openflow_v1, tvb, 0, -1, ENC_NA);
722 openflow_tree = proto_item_add_subtree(ti, ett_openflow);
724 /* A.1 OpenFlow Header. */
726 proto_tree_add_item(openflow_tree, hf_openflow_version, tvb, offset, 1, ENC_BIG_ENDIAN);
729 /* One of the OFPT_ constants. */
730 proto_tree_add_item(openflow_tree, hf_openflow_1_0_type, tvb, offset, 1, ENC_BIG_ENDIAN);
733 /* Length including this ofp_header. */
734 length = tvb_get_ntohs(tvb, offset);
735 proto_tree_add_item(openflow_tree, hf_openflow_length, tvb, offset, 2, ENC_BIG_ENDIAN);
738 /* Transaction id associated with this packet. Replies use the same id as was in the request
739 * to facilitate pairing.
741 proto_tree_add_item(openflow_tree, hf_openflow_xid, tvb, offset, 4, ENC_BIG_ENDIAN);
745 case OFPT_1_0_HELLO: /* 0 */
747 * The OFPT_HELLO message has no body;
750 case OFPT_1_0_FEATURES_REQUEST: /* 5 */
752 * Upon TLS session establishment, the controller sends an OFPT_FEATURES_REQUEST
753 * message. This message does not contain a body beyond the OpenFlow header.
756 case OFPT_1_0_FEATURES_REPLY: /* 6 */
757 dissect_openflow_features_reply_v1(tvb, pinfo, openflow_tree, offset, length);
759 case OFPT_1_0_GET_CONFIG_REQUEST: /* 7 */
760 /* A.3.2 There is no body for OFPT_GET_CONFIG_REQUEST beyond the OpenFlow header. */
762 case OFPT_1_0_GET_CONFIG_REPLY: /* 8 */
764 case OFPT_1_0_SET_CONFIG: /* 9 */
765 dissect_openflow_switch_config(tvb, pinfo, openflow_tree, offset, length);
767 case OFPT_1_0_PACKET_IN: /* 10 */
768 dissect_openflow_pkt_in(tvb, pinfo, openflow_tree, offset, length);
770 case OFPT_1_0_PACKET_OUT: /* 13 */
771 dissect_openflow_pkt_out(tvb, pinfo, openflow_tree, offset, length);
773 case OFPT_1_0_FLOW_MOD: /* 14 */
774 dissect_openflow_flow_mod(tvb, pinfo, openflow_tree, offset, length);
778 proto_tree_add_text(tree, tvb, offset, -1, "Message data not dissected yet");
783 return tvb_reported_length(tvb);
789 * Register the protocol with Wireshark.
792 proto_register_openflow_v1(void)
794 static hf_register_info hf[] = {
795 { &hf_openflow_version,
796 { "Version", "openflow.version",
797 FT_UINT8, BASE_HEX, VALS(openflow_version_values), 0x7f,
800 { &hf_openflow_1_0_type,
801 { "Type", "openflow_1_0.type",
802 FT_UINT8, BASE_DEC, VALS(openflow_1_0_type_values), 0x0,
806 { "Transaction ID", "openflow.xid",
807 FT_UINT32, BASE_DEC, NULL, 0x0,
810 { &hf_openflow_length,
811 { "Length", "openflow.length",
812 FT_UINT16, BASE_DEC, NULL, 0x0,
815 { &hf_openflow_datapath_id,
816 { "Datapath unique ID", "openflow.datapath_id",
817 FT_UINT64, BASE_HEX, NULL, 0x0,
820 { &hf_openflow_datapath_mac,
821 { "MAC addr", "openflow.datapath_mac",
822 FT_ETHER, BASE_NONE, NULL, 0x0,
825 { &hf_openflow_datapath_impl,
826 { "Implementers part", "openflow.datapath_imp",
827 FT_UINT16, BASE_HEX, NULL, 0x0,
830 { &hf_openflow_n_buffers,
831 { "n_buffers", "openflow.n_buffers",
832 FT_UINT32, BASE_DEC, NULL, 0x0,
835 { &hf_openflow_n_tables,
836 { "n_tables", "openflow.n_tables",
837 FT_UINT8, BASE_DEC, NULL, 0x0,
841 { &hf_openflow_auxiliary_id,
842 { "auxiliary_id", "openflow.auxiliary_id",
843 FT_UINT8, BASE_DEC, NULL, 0x0,
849 { "Padding", "openflow.pad3",
850 FT_UINT24, BASE_DEC, NULL, 0x0,
854 { &hf_openflow_capabilities,
855 { "capabilities", "openflow.capabilities",
856 FT_UINT32, BASE_HEX, NULL, 0x0,
859 { &hf_openflow_actions,
860 { "actions", "openflow.actions",
861 FT_UINT32, BASE_HEX, NULL, 0x0,
865 { &hf_openflow_reserved32,
866 { "Reserved", "openflow.reserved32",
867 FT_UINT32, BASE_DEC, NULL, 0x0,
871 { &hf_openflow_cap_flow_stats,
872 { "Flow statistics", "openflow.flow_stats",
873 FT_BOOLEAN, 32, NULL, OFPC_FLOW_STATS,
876 { &hf_openflow_table_stats,
877 { "Table statistics", "openflow.table_stats",
878 FT_BOOLEAN, 32, NULL, OFPC_TABLE_STATS,
881 { &hf_openflow_port_stats,
882 { "Port statistics", "openflow.port_stats",
883 FT_BOOLEAN, 32, NULL, OFPC_PORT_STATS,
886 { &hf_openflow_group_stats,
887 { "Group statistics", "openflow.group_stats",
888 FT_BOOLEAN, 32, NULL, OFPC_GROUP_STATS,
891 { &hf_openflow_ip_reasm,
892 { "Can reassemble IP fragments", "openflow.ip_reasm",
893 FT_BOOLEAN, 32, NULL, OFPC_IP_REASM,
896 { &hf_openflow_queue_stats,
897 { "Queue statistics", "openflow.queue_stats",
898 FT_BOOLEAN, 32, NULL, OFPC_QUEUE_STATS,
901 { &hf_openflow_port_blocked,
902 { "Switch will block looping ports", "openflow.port_blocked",
903 FT_BOOLEAN, 32, NULL, OFPC_PORT_BLOCKED,
906 { &hf_openflow_output,
907 { "Output to switch port", "openflow.output",
908 FT_BOOLEAN, 32, NULL, OFPAT_OUTPUT_MASK,
911 { &hf_openflow_set_vlan_vid,
912 { "Set the 802.1q VLAN id", "openflow.set_vlan_vid",
913 FT_BOOLEAN, 32, NULL, OFPAT_SET_VLAN_VID_MASK,
916 { &hf_openflow_set_vlan_pcp,
917 { "Set the 802.1q priority", "openflow.set_vlan_pcp",
918 FT_BOOLEAN, 32, NULL, OFPAT_SET_VLAN_PCP_MASK,
921 { &hf_openflow_strip_vlan,
922 { "Strip the 802.1q header", "openflow.strip_vlan",
923 FT_BOOLEAN, 32, NULL, OFPAT_STRIP_VLAN_MASK,
926 { &hf_openflow_set_dl_src,
927 { "Ethernet source address", "openflow.set_dl_src",
928 FT_BOOLEAN, 32, NULL, OFPAT_SET_DL_SRC_MASK,
931 { &hf_openflow_set_dl_dst,
932 { "Ethernet destination address", "openflow.set_dl_ds",
933 FT_BOOLEAN, 32, NULL, OFPAT_SET_DL_DST_MASK,
936 { &hf_openflow_set_nw_src,
937 { "IP source address", "openflow.set_nw_src",
938 FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_SRC_MASK,
941 { &hf_openflow_set_nw_dst,
942 { "IP destination address", "openflow.set_nw_ds",
943 FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_DST_MASK,
946 { &hf_openflow_set_nw_tos,
947 { "IP ToS (DSCP field, 6 bits)", "openflow.set_nw_tos",
948 FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_TOS_MASK,
951 { &hf_openflow_set_tp_src,
952 { "TCP/UDP source port", "openflow.set_tp_src",
953 FT_BOOLEAN, 32, NULL, OFPAT_SET_TP_SRC_MASK,
956 { &hf_openflow_set_tp_dst,
957 { "TCP/UDP destination port", "openflow.set_tp_dst",
958 FT_BOOLEAN, 32, NULL, OFPAT_SET_TP_DST_MASK,
961 { &hf_openflow_enqueue,
962 { "Output to queue", "openflow.enqueue",
963 FT_BOOLEAN, 32, NULL, OFPAT_ENQUEUE_MASK,
966 { &hf_openflow_port_no,
967 { "Port number", "openflow.port_no",
968 FT_UINT16, BASE_DEC, NULL, 0x0,
971 { &hf_openflow_hw_addr,
972 { "HW Address", "openflow.hw_add",
973 FT_ETHER, BASE_NONE, NULL, 0x0,
976 { &hf_openflow_port_name,
977 { "Name", "openflow.hw_add",
978 FT_STRING, BASE_NONE, NULL, 0x0,
981 { &hf_openflow_port_config,
982 { "Config flags", "openflow.port_config",
983 FT_UINT32, BASE_HEX, NULL, 0x0,
986 { &hf_openflow_port_state,
987 { "State flags", "openflow.port_state",
988 FT_UINT32, BASE_HEX, NULL, 0x0,
991 { &hf_openflow_port_curr,
992 { "Current features", "openflow.port_curr",
993 FT_UINT32, BASE_HEX, NULL, 0x0,
996 { &hf_openflow_port_advertised,
997 { "Advertised features", "openflow.port_advertised",
998 FT_UINT32, BASE_HEX, NULL, 0x0,
1001 { &hf_openflow_port_supported,
1002 { "Features supported", "openflow.port_supported",
1003 FT_UINT32, BASE_HEX, NULL, 0x0,
1006 { &hf_openflow_port_peer,
1007 { "Features advertised by peer", "openflow.port_peer",
1008 FT_UINT32, BASE_HEX, NULL, 0x0,
1011 { &hf_openflow_port_down,
1012 { "Port is administratively down", "openflow.port_down",
1013 FT_BOOLEAN, 32, NULL, OFPPC_PORT_DOWN,
1016 { &hf_openflow_no_stp,
1017 { "Disable 802.1D spanning tree on port", "openflow.no_stp",
1018 FT_BOOLEAN, 32, NULL, OFPPC_NO_STP,
1021 { &hf_openflow_no_recv,
1022 { "Drop all packets except 802.1D spanning tree packets", "openflow.no_recv",
1023 FT_BOOLEAN, 32, NULL, OFPPC_NO_RECV,
1026 { &hf_openflow_no_recv_stp,
1027 { "Drop received 802.1D STP packets", "openflow.no_recv",
1028 FT_BOOLEAN, 32, NULL, OFPPC_NO_RECV_STP,
1031 { &hf_openflow_no_flood,
1032 { "Do not include this port when flooding", "openflow.no_flood",
1033 FT_BOOLEAN, 32, NULL, OFPPC_NO_FLOOD,
1036 { &hf_openflow_no_fwd,
1037 { "Drop packets forwarded to port", "openflow.no_fwd",
1038 FT_BOOLEAN, 32, NULL, OFPPC_NO_FWD,
1041 { &hf_openflow_no_packet_in,
1042 { "Do not send packet-in msgs for port", "openflow.no_packet_in",
1043 FT_BOOLEAN, 32, NULL, OFPPC_NO_PACKET_IN,
1046 { &hf_openflow_link_down,
1047 { "No physical link present", "openflow.link_down",
1048 FT_BOOLEAN, 32, NULL, OFPPS_LINK_DOWN,
1051 { &hf_openflow_10mb_hd,
1052 { "10 Mb half-duplex rate support", "openflow.10mb_hd",
1053 FT_BOOLEAN, 32, NULL, OFPPF_10MB_HD,
1056 { &hf_openflow_10mb_fd,
1057 { "10 Mb full-duplex rate support", "openflow.10mb_fd",
1058 FT_BOOLEAN, 32, NULL, OFPPF_10MB_FD,
1061 { &hf_openflow_100mb_hd,
1062 { "100 Mb half-duplex rate support", "openflow.100mb_hd",
1063 FT_BOOLEAN, 32, NULL, OFPPF_100MB_HD,
1066 { &hf_openflow_100mb_fd,
1067 { "100 Mb full-duplex rate support", "openflow.100mb_0fd",
1068 FT_BOOLEAN, 32, NULL, OFPPF_100MB_FD,
1071 { &hf_openflow_1gb_hd,
1072 { "1 Gb half-duplex rate support", "openflow.1gb_hd",
1073 FT_BOOLEAN, 32, NULL, OFPPF_1GB_HD,
1076 { &hf_openflow_1gb_fd,
1077 { "1 Gb full-duplex rate support", "openflow.1gb_fd",
1078 FT_BOOLEAN, 32, NULL, OFPPF_1GB_FD,
1081 { &hf_openflow_10gb_fd,
1082 { "10 Gb full-duplex rate support", "openflow.10gb_fd",
1083 FT_BOOLEAN, 32, NULL, OFPPF_10GB_FD,
1086 { &hf_openflow_copper,
1087 { "Copper medium", "openflow.copper",
1088 FT_BOOLEAN, 32, NULL, OFPPF_COPPER,
1091 { &hf_openflow_fiber,
1092 { "Fiber medium", "openflow.fiber",
1093 FT_BOOLEAN, 32, NULL, OFPPF_FIBER,
1096 { &hf_openflow_autoneg,
1097 { "Auto-negotiation", "openflow.autoneg",
1098 FT_BOOLEAN, 32, NULL, OFPPF_AUTONEG,
1101 { &hf_openflow_pause,
1102 { "Pause", "openflow.pause",
1103 FT_BOOLEAN, 32, NULL, OFPPF_PAUSE,
1106 { &hf_openflow_pause_asym,
1107 { "Asymmetric pause", "openflow.pause_asym",
1108 FT_BOOLEAN, 32, NULL, OFPPF_PAUSE_ASYM,
1111 { &hf_openflow_config_flags,
1112 { "Config flags", "openflow.config_flags",
1113 FT_UINT16, BASE_HEX, NULL, 0x0,
1116 { &hf_openflow_miss_send_len,
1117 { "Max bytes of packet", "openflow.miss_send_len",
1118 FT_UINT16, BASE_HEX, NULL, 0x0,
1121 { &hf_openflow_buffer_id,
1122 { "Buffer Id", "openflow.buffer_id",
1123 FT_UINT32, BASE_HEX, NULL, 0x0,
1126 { &hf_openflow_total_len,
1127 { "Total length", "openflow.total_len",
1128 FT_UINT16, BASE_DEC, NULL, 0x0,
1131 { &hf_openflow_in_port,
1132 { "In port", "openflow.in_port",
1133 FT_UINT16, BASE_DEC, NULL, 0x0,
1136 { &hf_openflow_reason,
1137 { "Reason", "openflow.reason",
1138 FT_UINT8, BASE_DEC, VALS(openflow_reason_values), 0x0,
1142 { &hf_openflow_table_id,
1143 { "Table Id", "openflow.table_id",
1144 FT_UINT8, BASE_DEC, NULL, 0x0,
1148 { &hf_openflow_cookie,
1149 { "Cookie", "openflow.cookie",
1150 FT_UINT64, BASE_HEX, NULL, 0x0,
1154 { &hf_openflow_cookie_mask,
1155 { "Cookie mask", "openflow.cookie",
1156 FT_UINT64, BASE_HEX, NULL, 0x0,
1160 { &hf_openflow_padd8,
1161 { "Padding", "openflow.padding8",
1162 FT_UINT8, BASE_DEC, NULL, 0x0,
1166 { &hf_openflow_padd16,
1167 { "Padding", "openflow.padding16",
1168 FT_UINT16, BASE_DEC, NULL, 0x0,
1173 { &hf_openflow_padd48,
1174 { "Padding", "openflow.padding48",
1175 FT_UINT64, BASE_DEC, NULL, 0x0,
1179 { &hf_openflow_actions_len,
1180 { "Actions length", "openflow.actions_len",
1181 FT_UINT16, BASE_DEC, NULL, 0x0,
1184 { &hf_openflow_action_type,
1185 { "Actions type", "openflow.action_typ",
1186 FT_UINT16, BASE_DEC, VALS(openflow_action_values), 0x0,
1189 { &hf_openflow_action_len,
1190 { "Action length", "openflow.action_len",
1191 FT_UINT16, BASE_DEC, NULL, 0x0,
1194 { &hf_openflow_output_port,
1195 { "Output port", "openflow.output_port",
1196 FT_UINT16, BASE_DEC, NULL, 0x0,
1199 { &hf_openflow_max_len,
1200 { "Max length", "openflow.max_len",
1201 FT_UINT16, BASE_DEC, NULL, 0x0,
1204 { &hf_openflow_wildcards,
1205 { "Wildcards", "openflow.wildcards",
1206 FT_UINT32, BASE_DEC, NULL, 0x0,
1209 { &hf_openflow_command,
1210 { "Command", "openflow.command",
1211 FT_UINT16, BASE_DEC, VALS(openflow_command_values), 0x0,
1214 { &hf_openflow_eth_src,
1215 { "Ethernet source address", "openflow.eth_src",
1216 FT_ETHER, BASE_NONE, NULL, 0x0,
1219 { &hf_openflow_eth_dst,
1220 { "Ethernet destination address", "openflow.eth_src",
1221 FT_ETHER, BASE_NONE, NULL, 0x0,
1224 { &hf_openflow_dl_vlan,
1225 { "Input VLAN id", "openflow.dl_vlan",
1226 FT_UINT16, BASE_DEC, NULL, 0x0,
1229 { &hf_openflow_dl_vlan_pcp,
1230 { "Input VLAN priority", "openflow.dl_vlan_pcp",
1231 FT_UINT8, BASE_DEC, NULL, 0x0,
1234 { &hf_openflow_idle_timeout,
1235 { "Idle time-out", "openflow.idle_timeout",
1236 FT_UINT16, BASE_DEC, NULL, 0x0,
1239 { &hf_openflow_hard_timeout,
1240 { "hard time-out", "openflow.hard_timeout",
1241 FT_UINT16, BASE_DEC, NULL, 0x0,
1244 { &hf_openflow_priority,
1245 { "Priority", "openflow.priority",
1246 FT_UINT16, BASE_DEC, NULL, 0x0,
1249 { &hf_openflow_out_port,
1250 { "Out port", "openflow.out_port",
1251 FT_UINT32, BASE_DEC, NULL, 0x0,
1255 { &hf_openflow_out_group,
1256 { "Out group", "openflow.out_group",
1257 FT_UINT32, BASE_DEC, NULL, 0x0,
1261 { &hf_openflow_flags,
1262 { "Flags", "openflow.flags",
1263 FT_UINT16, BASE_DEC, NULL, 0x0,
1268 static gint *ett[] = {
1270 &ett_openflow_path_id,
1274 &ett_openflow_port_cnf,
1275 &ett_openflow_port_state,
1276 &ett_openflow_port_cf
1279 /* Register the protocol name and description */
1280 proto_openflow_v1 = proto_register_protocol("OpenFlow 1.0",
1281 "openflow_v1", "openflow_v1");
1283 new_register_dissector("openflow_v1", dissect_openflow_v1, proto_openflow_v1);
1285 eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
1287 /* Required function calls to register the header fields and subtrees */
1288 proto_register_field_array(proto_openflow_v1, hf, array_length(hf));
1289 proto_register_subtree_array(ett, array_length(ett));