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/expert.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_capabilities = -1;
53 static int hf_openflow_actions = -1;
54 /* static int hf_openflow_reserved32 = -1; */
55 static int hf_openflow_cap_flow_stats = -1;
56 static int hf_openflow_table_stats = -1;
57 static int hf_openflow_port_stats = -1;
58 static int hf_openflow_group_stats = -1;
59 static int hf_openflow_ip_reasm = -1;
60 static int hf_openflow_queue_stats = -1;
61 static int hf_openflow_port_blocked = -1;
63 static int hf_openflow_output = -1; /* Output to switch port. */
64 static int hf_openflow_set_vlan_vid = -1; /* Set the 802.1q VLAN id. */
65 static int hf_openflow_set_vlan_pcp = -1; /* Set the 802.1q priority. */
66 static int hf_openflow_strip_vlan = -1; /* Strip the 802.1q header. */
67 static int hf_openflow_set_dl_src = -1; /* Ethernet source address. */
68 static int hf_openflow_set_dl_dst = -1; /* Ethernet destination address. */
69 static int hf_openflow_set_nw_src = -1; /* IP source address. */
70 static int hf_openflow_set_nw_dst = -1; /* IP destination address. */
71 static int hf_openflow_set_nw_tos = -1; /* IP ToS (DSCP field, 6 bits). */
72 static int hf_openflow_set_tp_src = -1; /* TCP/UDP source port. */
73 static int hf_openflow_set_tp_dst = -1; /* TCP/UDP destination port. */
74 static int hf_openflow_enqueue = -1; /* Output to queue. */
76 static int hf_openflow_port_no = -1;
77 static int hf_openflow_hw_addr = -1;
78 static int hf_openflow_port_name = -1;
81 static int hf_openflow_port_config = -1;
82 static int hf_openflow_port_state = -1;
83 static int hf_openflow_port_curr = -1;
84 static int hf_openflow_port_advertised = -1;
85 static int hf_openflow_port_supported = -1;
86 static int hf_openflow_port_peer = -1;
88 static int hf_openflow_port_down = -1; /* Port is administratively down. */
89 static int hf_openflow_no_stp = -1; /* Disable 802.1D spanning tree on port. */
90 static int hf_openflow_no_recv = -1; /* Drop all packets except 802.1D spanning tree packets. */
91 static int hf_openflow_no_recv_stp = -1; /* Drop received 802.1D STP packets. */
92 static int hf_openflow_no_flood = -1; /* Do not include this port when flooding. */
93 static int hf_openflow_no_fwd = -1; /* Drop packets forwarded to port. */
94 static int hf_openflow_no_packet_in = -1; /* Do not send packet-in msgs for port. */
96 static int hf_openflow_link_down = -1; /* No physical link present. */
98 static int hf_openflow_10mb_hd = -1; /* 10 Mb half-duplex rate support. */
99 static int hf_openflow_10mb_fd = -1; /* 10 Mb full-duplex rate support. */
100 static int hf_openflow_100mb_hd = -1; /* 100 Mb half-duplex rate support. */
101 static int hf_openflow_100mb_fd = -1; /* 100 Mb full-duplex rate support. */
102 static int hf_openflow_1gb_hd = -1; /* 1 Gb half-duplex rate support. */
103 static int hf_openflow_1gb_fd = -1; /* 1 Gb full-duplex rate support. */
104 static int hf_openflow_10gb_fd = -1; /* 10 Gb full-duplex rate support. */
105 static int hf_openflow_copper = -1; /* Copper medium. */
106 static int hf_openflow_fiber = -1; /* Fiber medium. */
107 static int hf_openflow_autoneg = -1; /* Auto-negotiation. */
108 static int hf_openflow_pause = -1; /* Pause. */
109 static int hf_openflow_pause_asym = -1; /* Asymmetric pause. */
111 static int hf_openflow_config_flags = -1;
112 static int hf_openflow_miss_send_len = -1;
114 static int hf_openflow_buffer_id = -1;
115 static int hf_openflow_total_len = -1;
116 static int hf_openflow_in_port = -1;
117 static int hf_openflow_reason = -1;
118 static int hf_openflow_pkt_in_pad = -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_features_reply_pad = -1;
123 static int hf_openflow_actions_len = -1;
124 static int hf_openflow_action_type = -1;
125 static int hf_openflow_action_len = -1;
126 static int hf_openflow_output_port = -1;
127 static int hf_openflow_max_len = -1;
128 static int hf_openflow_wildcards = -1;
129 static int hf_openflow_command = -1;
130 static int hf_openflow_eth_src = -1;
131 static int hf_openflow_eth_dst = -1;
132 static int hf_openflow_dl_vlan = -1;
133 static int hf_openflow_dl_vlan_pcp = -1;
134 static int hf_openflow_ofp_match_pad = -1;
135 static int hf_openflow_idle_timeout = -1;
136 static int hf_openflow_hard_timeout = -1;
137 static int hf_openflow_priority = -1;
138 static int hf_openflow_out_port = -1;
139 /* static int hf_openflow_out_group = -1; */
140 static int hf_openflow_flags = -1;
142 /* Initialize the subtree pointers */
143 static gint ett_openflow = -1;
144 static gint ett_openflow_path_id = -1;
145 static gint ett_openflow_cap = -1;
146 static gint ett_openflow_act = -1;
147 static gint ett_openflow_port = -1;
148 static gint ett_openflow_port_cnf = -1;
149 static gint ett_openflow_port_state = -1;
150 static gint ett_openflow_port_cf = -1;
152 static expert_field ei_openflow_undecoded_data = EI_INIT;
153 static expert_field ei_openflow_action_type = EI_INIT;
154 static expert_field ei_openflow_1_0_type = EI_INIT;
156 static const value_string openflow_version_values[] = {
162 /* Immutable messages. */
163 #define OFPT_1_0_HELLO 0 /* Symmetric message */
164 #define OFPT_1_0_ERROR 1 /* Symmetric message */
165 #define OFPT_1_0_ECHO_REQUEST 2 /* Symmetric message */
166 #define OFPT_1_0_ECHO_REPLY 3 /* Symmetric message */
167 #define OFPT_1_0_VENDOR 4 /* Symmetric message */
168 /* Switch configuration messages. */
169 #define OFPT_1_0_FEATURES_REQUEST 5 /* Controller/switch message */
170 #define OFPT_1_0_FEATURES_REPLY 6 /* Controller/switch message */
171 #define OFPT_1_0_GET_CONFIG_REQUEST 7 /* Controller/switch message */
172 #define OFPT_1_0_GET_CONFIG_REPLY 8 /* Controller/switch message */
173 #define OFPT_1_0_SET_CONFIG 9 /* Controller/switch message */
174 /* Asynchronous messages. */
175 #define OFPT_1_0_PACKET_IN 10 /* Async message */
176 #define OFPT_1_0_FLOW_REMOVED 11 /* Async message */
177 #define OFPT_1_0_PORT_STATUS 12 /* Async message */
178 /* Controller command messages. */
179 #define OFPT_1_0_PACKET_OUT 13 /* Controller/switch message */
180 #define OFPT_1_0_FLOW_MOD 14 /* Controller/switch message */
181 #define OFPT_1_0_PORT_MOD 15 /* Controller/switch message */
182 /* Statistics messages. */
183 #define OFPT_1_0_STATS_REQUEST 16 /* Controller/switch message */
184 #define OFPT_1_0_STATS_REPLY 17 /* Controller/switch message */
185 /* Barrier messages. */
186 #define OFPT_1_0_BARRIER_REQUEST 18 /* Controller/switch message */
187 #define OFPT_1_0_BARRIER_REPLY 19 /* Controller/switch message */
188 /* Queue Configuration messages. */
189 #define OFPT_1_0_QUEUE_GET_CONFIG_REQUEST 20 /* Controller/switch message */
190 #define OFPT_1_0_QUEUE_GET_CONFIG_REPLY 21 /* Controller/switch message */
193 static const value_string openflow_1_0_type_values[] = {
194 /* Immutable messages. */
196 /* Immutable messages. */
197 { 0, "OFPT_HELLO" }, /* Symmetric message */
198 { 1, "OFPT_ERROR" }, /* Symmetric message */
199 { 2, "OFPT_ECHO_REQUEST" }, /* Symmetric message */
200 { 3, "OFPT_ECHO_REPLY" }, /* Symmetric message */
201 { 4, "OFPT_VENDOR" }, /* Symmetric message */
202 /* Switch configuration messages. */
203 { 5, "OFPT_FEATURES_REQUEST" }, /* Controller/switch message */
204 { 6, "OFPT_FEATURES_REPLY" }, /* Controller/switch message */
205 { 7, "OFPT_GET_CONFIG_REQUEST" }, /* Controller/switch message */
206 { 8, "OFPT_GET_CONFIG_REPLY" }, /* Controller/switch message */
207 { 9, "OFPT_SET_CONFIG" }, /* Controller/switch message */
208 /* Asynchronous messages. */
209 { 10, "OFPT_PACKET_IN" }, /* Async message */
210 { 11, "OFPT_FLOW_REMOVED" }, /* Async message */
211 { 12, "OFPT_PORT_STATUS" }, /* Async message */
212 /* Controller command messages. */
213 { 13, "OFPT_PACKET_OUT" }, /* Controller/switch message */
214 { 14, "OFPT_FLOW_MOD" }, /* Controller/switch message */
215 { 15, "OFPT_PORT_MOD" }, /* Controller/switch message */
216 /* Statistics messages. */
217 { 16, "OFPT_STATS_REQUEST" }, /* Controller/switch message */
218 { 17, "OFPT_STATS_REPLY" }, /* Controller/switch message */
219 /* Barrier messages. */
220 { 18, "OFPT_BARRIER_REQUEST" }, /* Controller/switch message */
221 { 19, "OFPT_BARRIER_REPLY" }, /* Controller/switch message */
222 /* Queue Configuration messages. */
223 { 20, "OFPT_QUEUE_GET_CONFIG_REQUEST" }, /* Controller/switch message */
224 { 21, "OFPT_QUEUE_GET_CONFIG_REPLY" }, /* Controller/switch message */
229 #define OFPC_FLOW_STATS 1<<0 /* Flow statistics. */
230 #define OFPC_TABLE_STATS 1<<1 /* Table statistics. */
231 #define OFPC_PORT_STATS 1<<2 /* Port statistics. */
232 #define OFPC_GROUP_STATS 1<<3 /* Group statistics. */
233 #define OFPC_IP_REASM 1<<5 /* Can reassemble IP fragments. */
234 #define OFPC_QUEUE_STATS 1<<6 /* Queue statistics. */
235 #define OFPC_PORT_BLOCKED 1<<8 /* Switch will block looping ports. */
237 #define OFPAT_OUTPUT_MASK 1<<0 /* Output to switch port. */
238 #define OFPAT_SET_VLAN_VID_MASK 1<<1 /* Set the 802.1q VLAN id. */
239 #define OFPAT_SET_VLAN_PCP_MASK 1<<2 /* Set the 802.1q priority. */
240 #define OFPAT_STRIP_VLAN_MASK 1<<3 /* Strip the 802.1q header. */
241 #define OFPAT_SET_DL_SRC_MASK 1<<4 /* Ethernet source address. */
242 #define OFPAT_SET_DL_DST_MASK 1<<5 /* Ethernet destination address. */
243 #define OFPAT_SET_NW_SRC_MASK 1<<6 /* IP source address. */
244 #define OFPAT_SET_NW_DST_MASK 1<<7 /* IP destination address. */
245 #define OFPAT_SET_NW_TOS_MASK 1<<8 /* IP ToS (DSCP field, 6 bits). */
246 #define OFPAT_SET_TP_SRC_MASK 1<<9 /* TCP/UDP source port. */
247 #define OFPAT_SET_TP_DST_MASK 1<<10 /* TCP/UDP destination port. */
248 #define OFPAT_ENQUEUE_MASK 1<<11 /* Output to queue. */
250 #define OFPPC_PORT_DOWN 1<<0 /* Port is administratively down. */
251 #define OFPPC_NO_STP 1<<1 /* Disable 802.1D spanning tree on port. */
252 #define OFPPC_NO_RECV 1<<2 /* Drop all packets except 802.1D spanning tree packets. */
253 #define OFPPC_NO_RECV_STP 1<<3 /* Drop received 802.1D STP packets. */
254 #define OFPPC_NO_FLOOD 1<<4 /* Do not include this port when flooding. */
255 #define OFPPC_NO_FWD 1<<5 /* Drop packets forwarded to port. */
256 #define OFPPC_NO_PACKET_IN 1<<6 /* Do not send packet-in msgs for port. */
258 #define OFP_MAX_PORT_NAME_LEN 16
260 #define OFPPS_LINK_DOWN 1<<0 /* No physical link present. */
261 #define OFPPS_STP_LISTEN 0<<8 /* Not learning or relaying frames. */
262 #define OFPPS_STP_LEARN 1<<8 /* Learning but not relaying frames. */
263 #define OFPPS_STP_FORWARD 2<<8 /* Learning and relaying frames. */
264 #define OFPPS_STP_BLOCK 3<<8 /* Not part of spanning tree. */
265 #define OFPPS_STP_MASK 3<<8 /* Bit mask for OFPPS_STP_* values. */
268 #define OFPPF_10MB_HD 1<<0 /* 10 Mb half-duplex rate support. */
269 #define OFPPF_10MB_FD 1<<1 /* 10 Mb full-duplex rate support. */
270 #define OFPPF_100MB_HD 1<<2 /* 100 Mb half-duplex rate support. */
271 #define OFPPF_100MB_FD 1<<3 /* 100 Mb full-duplex rate support. */
272 #define OFPPF_1GB_HD 1<<4 /* 1 Gb half-duplex rate support. */
273 #define OFPPF_1GB_FD 1<<5 /* 1 Gb full-duplex rate support. */
274 #define OFPPF_10GB_FD 1<<6 /* 10 Gb full-duplex rate support. */
275 #define OFPPF_COPPER 1<<7 /* Copper medium. */
276 #define OFPPF_FIBER 1<<8 /* Fiber medium. */
277 #define OFPPF_AUTONEG 1<<9 /* Auto-negotiation. */
278 #define OFPPF_PAUSE 1<<10 /* Pause. */
279 #define OFPPF_PAUSE_ASYM 1<<11 /* Asymmetric pause. */
282 #define OFPAT_OUTPUT 0 /* Output to switch port. */
283 #define OFPAT_SET_VLAN_VID 1 /* Set the 802.1q VLAN id. */
284 #define OFPAT_SET_VLAN_PCP 2 /* Set the 802.1q priority. */
285 #define OFPAT_STRIP_VLAN 3 /* Strip the 802.1q header. */
286 #define OFPAT_SET_DL_SRC 4 /* Ethernet source address. */
287 #define OFPAT_SET_DL_DST 5 /* Ethernet destination address. */
288 #define OFPAT_SET_NW_SRC 6 /* IP source address. */
289 #define OFPAT_SET_NW_DST 7 /* IP destination address. */
290 #define OFPAT_SET_TP_SRC 8 /* TCP/UDP source port. */
291 #define OFPAT_SET_TP_DST 9 /* TCP/UDP destination port. */
292 #define OFPAT_VENDOR 0xffff
295 dissect_openflow_ofp_match_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
298 /* uint32_t wildcards; Wildcard fields. */
299 proto_tree_add_item(tree, hf_openflow_wildcards, tvb, offset, 4, ENC_BIG_ENDIAN);
301 /* uint16_t in_port; Input switch port. */
302 proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
305 /* uint8_t dl_src[OFP_ETH_ALEN]; Ethernet source address. */
306 proto_tree_add_item(tree, hf_openflow_eth_src, tvb, offset, 6, ENC_NA);
308 /* uint8_t dl_dst[OFP_ETH_ALEN]; Ethernet destination address. */
309 proto_tree_add_item(tree, hf_openflow_eth_dst, tvb, offset, 6, ENC_NA);
311 /* uint16_t dl_vlan; Input VLAN id. */
312 proto_tree_add_item(tree, hf_openflow_dl_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
314 /* uint8_t dl_vlan_pcp; Input VLAN priority. */
315 proto_tree_add_item(tree, hf_openflow_dl_vlan_pcp, tvb, offset, 1, ENC_BIG_ENDIAN);
317 /* uint8_t pad1[1]; Align to 64-bits */
318 proto_tree_add_item(tree, hf_openflow_ofp_match_pad, tvb, offset, 1, ENC_NA);
320 /* uint16_t dl_type; Ethernet frame type. */
321 /* uint8_t nw_tos; IP ToS (actually DSCP field, 6 bits). */
322 /* uint8_t nw_proto; IP protocol or lower 8 bits of
325 /* uint8_t pad2[2]; Align to 64-bits */
326 /* uint32_t nw_src; IP source address. */
327 /* uint32_t nw_dst; IP destination address. */
328 /* uint16_t tp_src; TCP/UDP source port. */
329 /* uint16_t tp_dst; TCP/UDP destination port. */
330 proto_tree_add_expert(tree, pinfo, &ei_openflow_undecoded_data, tvb, offset, 18);
337 static const value_string openflow_action_values[] = {
338 { OFPAT_OUTPUT, "Output to switch port" },
339 { OFPAT_SET_VLAN_VID, "Set the 802.1q VLAN id" },
340 { OFPAT_SET_VLAN_PCP, "Set the 802.1q priority" },
341 { OFPAT_STRIP_VLAN, "Strip the 802.1q header" },
342 { OFPAT_SET_DL_SRC, "Ethernet source address" },
343 { OFPAT_SET_DL_DST, "Ethernet destination address" },
344 { OFPAT_SET_NW_SRC, "IP source address" },
345 { OFPAT_SET_NW_DST, "IP destination address" },
346 { OFPAT_SET_TP_SRC, "TCP/UDP source port" },
347 { OFPAT_SET_TP_DST, "TCP/UDP destination port" },
348 { OFPAT_VENDOR, "Vendor specific action"},
353 dissect_openflow_action_header(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
355 guint16 action_type, action_len;
358 /* uint16_t type; One of OFPAT_*. */
359 action_type = tvb_get_ntohs(tvb, offset);
360 ti = proto_tree_add_item(tree, hf_openflow_action_type, tvb, offset, 2, ENC_BIG_ENDIAN);
362 /* Length of action, including this
363 * header. This is the length of action,
364 * including any padding to make it
367 action_len = tvb_get_ntohs(tvb, offset);
368 proto_tree_add_item(tree, hf_openflow_action_len, tvb, offset, 2, ENC_BIG_ENDIAN);
373 /* uint16_t port; Output port. */
374 proto_tree_add_item(tree, hf_openflow_output_port, tvb, offset, 2, ENC_BIG_ENDIAN);
376 /* uint16_t max_len; Max length to send to controller. */
377 proto_tree_add_item(tree, hf_openflow_max_len, tvb, offset, 2, ENC_BIG_ENDIAN);
381 expert_add_info(pinfo, ti, &ei_openflow_action_type);
382 offset+=(action_len-4);
389 dissect_openflow_phy_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
392 proto_tree *port_cnf_tree, *port_state_tree, *port_cf_tree;
394 proto_tree_add_item(tree, hf_openflow_port_no, tvb, offset, 2, ENC_BIG_ENDIAN);
396 proto_tree_add_item(tree, hf_openflow_hw_addr, tvb, offset, 6, ENC_NA);
398 proto_tree_add_item(tree, hf_openflow_port_name, tvb, offset, OFP_MAX_PORT_NAME_LEN, ENC_ASCII|ENC_NA);
399 offset+=OFP_MAX_PORT_NAME_LEN;
401 /* Bitmap of OFPPC_* flags. */
402 ti = proto_tree_add_item(tree, hf_openflow_port_config, tvb, offset, 4, ENC_BIG_ENDIAN);
403 port_cnf_tree = proto_item_add_subtree(ti, ett_openflow_port_cnf);
405 /* Port is administratively down. */
406 proto_tree_add_item(port_cnf_tree, hf_openflow_port_down, tvb, offset, 4, ENC_BIG_ENDIAN);
407 /* Disable 802.1D spanning tree on port. */
408 proto_tree_add_item(port_cnf_tree, hf_openflow_no_stp, tvb, offset, 4, ENC_BIG_ENDIAN);
409 /* Drop all packets except 802.1D spanning tree packets. */
410 proto_tree_add_item(port_cnf_tree, hf_openflow_no_recv, tvb, offset, 4, ENC_BIG_ENDIAN);
411 /* Drop received 802.1D STP packets. */
412 proto_tree_add_item(port_cnf_tree, hf_openflow_no_recv_stp, tvb, offset, 4, ENC_BIG_ENDIAN);
413 /* Do not include this port when flooding. */
414 proto_tree_add_item(port_cnf_tree, hf_openflow_no_flood, tvb, offset, 4, ENC_BIG_ENDIAN);
415 /* Drop packets forwarded to port. */
416 proto_tree_add_item(port_cnf_tree, hf_openflow_no_fwd, tvb, offset, 4, ENC_BIG_ENDIAN);
417 /* Do not send packet-in msgs for port. */
418 proto_tree_add_item(port_cnf_tree, hf_openflow_no_packet_in, tvb, offset, 4, ENC_BIG_ENDIAN);
421 /* Bitmap of OFPPS_* flags. */
422 ti = proto_tree_add_item(tree, hf_openflow_port_state, tvb, offset, 4, ENC_BIG_ENDIAN);
423 port_state_tree = proto_item_add_subtree(ti, ett_openflow_port_state);
425 /* No physical link present. */
426 proto_tree_add_item(port_state_tree, hf_openflow_link_down, tvb, offset, 4, ENC_BIG_ENDIAN);
430 /* Current features. */
431 ti = proto_tree_add_item(tree, hf_openflow_port_curr, tvb, offset, 4, ENC_BIG_ENDIAN);
432 port_cf_tree = proto_item_add_subtree(ti, ett_openflow_port_cf);
433 /* 10 Mb half-duplex rate support. */
434 proto_tree_add_item(port_cf_tree, hf_openflow_10mb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
435 /* 10 Mb full-duplex rate support. */
436 proto_tree_add_item(port_cf_tree, hf_openflow_10mb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
437 /* 100 Mb half-duplex rate support. */
438 proto_tree_add_item(port_cf_tree, hf_openflow_100mb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
439 /* 100 Mb full-duplex rate support. */
440 proto_tree_add_item(port_cf_tree, hf_openflow_100mb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
441 /* 1 Gb half-duplex rate support. */
442 proto_tree_add_item(port_cf_tree, hf_openflow_1gb_hd, tvb, offset, 4, ENC_BIG_ENDIAN);
443 /* 1 Gb full-duplex rate support. */
444 proto_tree_add_item(port_cf_tree, hf_openflow_1gb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
445 /* 10 Gb full-duplex rate support. */
446 proto_tree_add_item(port_cf_tree, hf_openflow_10gb_fd, tvb, offset, 4, ENC_BIG_ENDIAN);
448 proto_tree_add_item(port_cf_tree, hf_openflow_copper, tvb, offset, 4, ENC_BIG_ENDIAN);
450 proto_tree_add_item(port_cf_tree, hf_openflow_fiber, tvb, offset, 4, ENC_BIG_ENDIAN);
451 /* Auto-negotiation. */
452 proto_tree_add_item(port_cf_tree, hf_openflow_autoneg, tvb, offset, 4, ENC_BIG_ENDIAN);
454 proto_tree_add_item(port_cf_tree, hf_openflow_pause, tvb, offset, 4, ENC_BIG_ENDIAN);
455 /* Asymmetric pause. */
456 proto_tree_add_item(port_cf_tree, hf_openflow_pause_asym, tvb, offset, 4, ENC_BIG_ENDIAN);
459 /* Features being advertised by the port. */
460 proto_tree_add_item(tree, hf_openflow_port_advertised, tvb, offset, 4, ENC_BIG_ENDIAN);
463 /* Features supported by the port. */
464 proto_tree_add_item(tree, hf_openflow_port_supported, tvb, offset, 4, ENC_BIG_ENDIAN);
466 /* Features advertised by peer. */
467 proto_tree_add_item(tree, hf_openflow_port_peer, tvb, offset, 4, ENC_BIG_ENDIAN);
477 struct ofp_switch_features {
478 struct ofp_header header;
479 uint64_t datapath_id; /* Datapath unique ID. The lower 48-bits are for
480 a MAC address, while the upper 16-bits are
481 implementer-defined. */
482 uint32_t n_buffers; /* Max packets buffered at once. */
483 uint8_t n_tables; /* Number of tables supported by datapath. */
484 uint8_t pad[3]; /* Align to 64-bits. */
486 uint32_t capabilities; /* Bitmap of support "ofp_capabilities". */
487 uint32_t actions; /* Bitmap of supported "ofp_action_type"s. */
489 struct ofp_phy_port ports[0]; /* Port definitions. The number of ports
490 is inferred from the length field in
495 dissect_openflow_features_reply_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 length)
498 proto_tree *path_id_tree, *cap_tree, *act_tree;
500 guint16 length_remaining;
502 ti = proto_tree_add_item(tree, hf_openflow_datapath_id, tvb, offset, 8, ENC_BIG_ENDIAN);
503 path_id_tree = proto_item_add_subtree(ti, ett_openflow_path_id);
504 proto_tree_add_item(path_id_tree, hf_openflow_datapath_mac, tvb, offset, 6, ENC_NA);
506 proto_tree_add_item(path_id_tree, hf_openflow_datapath_impl, tvb, offset, 2, ENC_BIG_ENDIAN);
509 proto_tree_add_item(tree, hf_openflow_n_buffers, tvb, offset, 4, ENC_BIG_ENDIAN);
512 proto_tree_add_item(tree, hf_openflow_n_tables, tvb, offset, 1, ENC_BIG_ENDIAN);
515 proto_tree_add_item(tree, hf_openflow_features_reply_pad, tvb, offset, 3, ENC_NA);
518 ti = proto_tree_add_item(tree, hf_openflow_capabilities, tvb, offset, 4, ENC_BIG_ENDIAN);
519 cap_tree = proto_item_add_subtree(ti, ett_openflow_cap);
522 proto_tree_add_item(cap_tree, hf_openflow_cap_flow_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
523 proto_tree_add_item(cap_tree, hf_openflow_table_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
524 proto_tree_add_item(cap_tree, hf_openflow_port_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
525 proto_tree_add_item(cap_tree, hf_openflow_group_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
526 proto_tree_add_item(cap_tree, hf_openflow_ip_reasm, tvb, offset, 4, ENC_BIG_ENDIAN);
527 proto_tree_add_item(cap_tree, hf_openflow_queue_stats, tvb, offset, 4, ENC_BIG_ENDIAN);
528 proto_tree_add_item(cap_tree, hf_openflow_port_blocked, tvb, offset, 4, ENC_BIG_ENDIAN);
531 ti = proto_tree_add_item(tree, hf_openflow_actions, tvb, offset, 4, ENC_BIG_ENDIAN);
532 act_tree = proto_item_add_subtree(ti, ett_openflow_act);
534 proto_tree_add_item(act_tree, hf_openflow_output, tvb, offset, 4, ENC_BIG_ENDIAN);
535 proto_tree_add_item(act_tree, hf_openflow_set_vlan_vid, tvb, offset, 4, ENC_BIG_ENDIAN);
536 proto_tree_add_item(act_tree, hf_openflow_set_vlan_pcp, tvb, offset, 4, ENC_BIG_ENDIAN);
537 proto_tree_add_item(act_tree, hf_openflow_strip_vlan, tvb, offset, 4, ENC_BIG_ENDIAN);
538 proto_tree_add_item(act_tree, hf_openflow_set_dl_src, tvb, offset, 4, ENC_BIG_ENDIAN);
539 proto_tree_add_item(act_tree, hf_openflow_set_dl_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
540 proto_tree_add_item(act_tree, hf_openflow_set_nw_src, tvb, offset, 4, ENC_BIG_ENDIAN);
541 proto_tree_add_item(act_tree, hf_openflow_set_nw_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
542 proto_tree_add_item(act_tree, hf_openflow_set_nw_tos, tvb, offset, 4, ENC_BIG_ENDIAN);
543 proto_tree_add_item(act_tree, hf_openflow_set_tp_src, tvb, offset, 4, ENC_BIG_ENDIAN);
544 proto_tree_add_item(act_tree, hf_openflow_set_tp_dst, tvb, offset, 4, ENC_BIG_ENDIAN);
545 proto_tree_add_item(act_tree, hf_openflow_enqueue, tvb, offset, 4, ENC_BIG_ENDIAN);
548 length_remaining = length-32;
549 if(length_remaining > 0){
550 guint16 num_ports = length_remaining/48;
552 if ((length_remaining&0x003f) != 0){
555 for(i=0; i<num_ports ;i++){
556 proto_tree *port_tree;
558 port_tree = proto_tree_add_subtree_format(tree, tvb, offset, 48, ett_openflow_port, NULL, "Port data %u",i+1);
559 dissect_openflow_phy_port(tvb, pinfo, port_tree, offset);
568 dissect_openflow_switch_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
571 /* ofp_config_flags */
572 proto_tree_add_item(tree, hf_openflow_config_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
575 proto_tree_add_item(tree, hf_openflow_miss_send_len, tvb, offset, 2, ENC_BIG_ENDIAN);
580 #define OFPR_NO_MATCH 0 /* No matching flow (table-miss flow entry). */
581 #define OFPR_ACTION 1 /* Action explicitly output to controller. */
582 #define OFPR_INVALID_TTL 2 /* Packet has invalid TTL */
584 static const value_string openflow_reason_values[] = {
585 { OFPR_NO_MATCH, "No matching flow (table-miss flow entry)" },
586 { OFPR_ACTION, "Action explicitly output to controller" },
587 { OFPR_INVALID_TTL, "Packet has invalid TTL" },
592 dissect_openflow_pkt_in(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length)
596 /* uint32_t buffer_id; ID assigned by datapath. */
597 proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
599 /* uint16_t total_len; Full length of frame. */
600 proto_tree_add_item(tree, hf_openflow_total_len, tvb, offset, 2, ENC_BIG_ENDIAN);
603 /* uint16_t in_port; Port on which frame was received. */
604 proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
607 /* uint8_t reason; Reason packet is being sent (one of OFPR_*) */
608 proto_tree_add_item(tree, hf_openflow_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
611 proto_tree_add_item(tree, hf_openflow_pkt_in_pad, tvb, offset, 1, ENC_NA);
614 next_tvb = tvb_new_subset_length(tvb, offset, length-offset);
615 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
620 dissect_openflow_pkt_out(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
625 /* uint32_t buffer_id; ID assigned by datapath. */
626 buffer_id = tvb_get_ntohl(tvb, offset);
627 proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
630 /* uint32_t in_port; Packet's input port or OFPP_CONTROLLER. */
631 proto_tree_add_item(tree, hf_openflow_in_port, tvb, offset, 2, ENC_BIG_ENDIAN);
634 /* uint16_t actions_len; Size of action array in bytes. */
635 proto_tree_add_item(tree, hf_openflow_actions_len, tvb, offset, 2, ENC_BIG_ENDIAN);
638 /* struct ofp_action_header actions[0]; Action list. */
639 offset = dissect_openflow_action_header(tvb, pinfo, tree, offset);
640 /* Packet data. The length is inferred
641 from the length field in the header.
642 (Only meaningful if buffer_id == -1.)
645 next_tvb = tvb_new_subset_length(tvb, offset, length-offset);
646 call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);
650 #define OFPFC_ADD 0 /* New flow. */
651 #define OFPFC_MODIFY 1 /* Modify all matching flows. */
652 #define OFPFC_MODIFY_STRICT 2 /* Modify entry strictly matching wildcards */
653 #define OFPFC_DELETE 3 /* Delete all matching flows. */
654 #define OFPFC_DELETE_STRICT 4 /* Strictly match wildcards and priority. */
656 static const value_string openflow_command_values[] = {
657 { OFPFC_ADD, "New flow" },
658 { OFPFC_MODIFY, "Modify all matching flows" },
659 { OFPFC_MODIFY_STRICT, "Modify entry strictly matching wildcards" },
660 { OFPFC_DELETE, "Delete all matching flows" },
661 { OFPFC_DELETE_STRICT, "Strictly match wildcards and priority" },
666 dissect_openflow_flow_mod(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 length _U_)
669 /* struct ofp_match match; Fields to match */
670 offset = dissect_openflow_ofp_match_v1(tvb, pinfo, tree, offset);
672 /* uint64_t cookie; Opaque controller-issued identifier. */
673 proto_tree_add_item(tree, hf_openflow_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
676 /* uint16_t command; One of OFPFC_*. */
677 proto_tree_add_item(tree, hf_openflow_command, tvb, offset, 2, ENC_BIG_ENDIAN);
680 /* uint16_t idle_timeout; Idle time before discarding (seconds). */
681 proto_tree_add_item(tree, hf_openflow_idle_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
683 /* uint16_t hard_timeout; Max time before discarding (seconds). */
684 proto_tree_add_item(tree, hf_openflow_hard_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
686 /* uint16_t priority; Priority level of flow entry. */
687 proto_tree_add_item(tree, hf_openflow_priority, tvb, offset, 2, ENC_BIG_ENDIAN);
689 /* uint32_t buffer_id; Buffered packet to apply to, or OFP_NO_BUFFER.
690 Not meaningful for OFPFC_DELETE*.
692 proto_tree_add_item(tree, hf_openflow_buffer_id, tvb, offset, 4, ENC_BIG_ENDIAN);
694 /* uint32_t out_port; For OFPFC_DELETE* commands, require
695 matching entries to include this as an output port. A value of OFPP_ANY
696 indicates no restriction.
698 proto_tree_add_item(tree, hf_openflow_out_port, tvb, offset, 2, ENC_BIG_ENDIAN);
701 /* uint16_t flags; One of OFPFF_*. */
702 proto_tree_add_item(tree, hf_openflow_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
707 dissect_openflow_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
709 proto_item *ti, *type_item;
710 proto_tree *openflow_tree;
715 type = tvb_get_guint8(tvb, 1);
717 col_append_fstr(pinfo->cinfo, COL_INFO, "Type: %s",
718 val_to_str_const(type, openflow_1_0_type_values, "Unknown message type"));
720 /* Stop the Ethernet frame from overwriting the columns */
721 if((type == OFPT_1_0_PACKET_IN) || (type == OFPT_1_0_PACKET_OUT)){
722 col_set_writable(pinfo->cinfo, FALSE);
725 /* Create display subtree for the protocol */
726 ti = proto_tree_add_item(tree, proto_openflow_v1, tvb, 0, -1, ENC_NA);
727 openflow_tree = proto_item_add_subtree(ti, ett_openflow);
729 /* A.1 OpenFlow Header. */
731 proto_tree_add_item(openflow_tree, hf_openflow_version, tvb, offset, 1, ENC_BIG_ENDIAN);
734 /* One of the OFPT_ constants. */
735 type_item = proto_tree_add_item(openflow_tree, hf_openflow_1_0_type, tvb, offset, 1, ENC_BIG_ENDIAN);
738 /* Length including this ofp_header. */
739 length = tvb_get_ntohs(tvb, offset);
740 proto_tree_add_item(openflow_tree, hf_openflow_length, tvb, offset, 2, ENC_BIG_ENDIAN);
743 /* Transaction id associated with this packet. Replies use the same id as was in the request
744 * to facilitate pairing.
746 proto_tree_add_item(openflow_tree, hf_openflow_xid, tvb, offset, 4, ENC_BIG_ENDIAN);
750 case OFPT_1_0_HELLO: /* 0 */
752 * The OFPT_HELLO message has no body;
755 case OFPT_1_0_FEATURES_REQUEST: /* 5 */
757 * Upon TLS session establishment, the controller sends an OFPT_FEATURES_REQUEST
758 * message. This message does not contain a body beyond the OpenFlow header.
761 case OFPT_1_0_FEATURES_REPLY: /* 6 */
762 dissect_openflow_features_reply_v1(tvb, pinfo, openflow_tree, offset, length);
764 case OFPT_1_0_GET_CONFIG_REQUEST: /* 7 */
765 /* A.3.2 There is no body for OFPT_GET_CONFIG_REQUEST beyond the OpenFlow header. */
767 case OFPT_1_0_GET_CONFIG_REPLY: /* 8 */
769 case OFPT_1_0_SET_CONFIG: /* 9 */
770 dissect_openflow_switch_config(tvb, pinfo, openflow_tree, offset, length);
772 case OFPT_1_0_PACKET_IN: /* 10 */
773 dissect_openflow_pkt_in(tvb, pinfo, openflow_tree, offset, length);
775 case OFPT_1_0_PACKET_OUT: /* 13 */
776 dissect_openflow_pkt_out(tvb, pinfo, openflow_tree, offset, length);
778 case OFPT_1_0_FLOW_MOD: /* 14 */
779 dissect_openflow_flow_mod(tvb, pinfo, openflow_tree, offset, length);
783 expert_add_info(pinfo, type_item, &ei_openflow_1_0_type);
788 return tvb_reported_length(tvb);
794 * Register the protocol with Wireshark.
797 proto_register_openflow_v1(void)
799 static hf_register_info hf[] = {
800 { &hf_openflow_version,
801 { "Version", "openflow.version",
802 FT_UINT8, BASE_HEX, VALS(openflow_version_values), 0x7f,
805 { &hf_openflow_1_0_type,
806 { "Type", "openflow_1_0.type",
807 FT_UINT8, BASE_DEC, VALS(openflow_1_0_type_values), 0x0,
811 { "Transaction ID", "openflow.xid",
812 FT_UINT32, BASE_DEC, NULL, 0x0,
815 { &hf_openflow_length,
816 { "Length", "openflow.length",
817 FT_UINT16, BASE_DEC, NULL, 0x0,
820 { &hf_openflow_datapath_id,
821 { "Datapath unique ID", "openflow.datapath_id",
822 FT_UINT64, BASE_HEX, NULL, 0x0,
825 { &hf_openflow_datapath_mac,
826 { "MAC addr", "openflow.datapath_mac",
827 FT_ETHER, BASE_NONE, NULL, 0x0,
830 { &hf_openflow_datapath_impl,
831 { "Implementers part", "openflow.datapath_imp",
832 FT_UINT16, BASE_HEX, NULL, 0x0,
835 { &hf_openflow_n_buffers,
836 { "n_buffers", "openflow.n_buffers",
837 FT_UINT32, BASE_DEC, NULL, 0x0,
840 { &hf_openflow_n_tables,
841 { "n_tables", "openflow.n_tables",
842 FT_UINT8, BASE_DEC, NULL, 0x0,
846 { &hf_openflow_auxiliary_id,
847 { "auxiliary_id", "openflow.auxiliary_id",
848 FT_UINT8, BASE_DEC, NULL, 0x0,
852 { &hf_openflow_capabilities,
853 { "capabilities", "openflow.capabilities",
854 FT_UINT32, BASE_HEX, NULL, 0x0,
857 { &hf_openflow_actions,
858 { "actions", "openflow.actions",
859 FT_UINT32, BASE_HEX, NULL, 0x0,
863 { &hf_openflow_reserved32,
864 { "Reserved", "openflow.reserved32",
865 FT_UINT32, BASE_DEC, NULL, 0x0,
869 { &hf_openflow_cap_flow_stats,
870 { "Flow statistics", "openflow.flow_stats",
871 FT_BOOLEAN, 32, NULL, OFPC_FLOW_STATS,
874 { &hf_openflow_table_stats,
875 { "Table statistics", "openflow.table_stats",
876 FT_BOOLEAN, 32, NULL, OFPC_TABLE_STATS,
879 { &hf_openflow_port_stats,
880 { "Port statistics", "openflow.port_stats",
881 FT_BOOLEAN, 32, NULL, OFPC_PORT_STATS,
884 { &hf_openflow_group_stats,
885 { "Group statistics", "openflow.group_stats",
886 FT_BOOLEAN, 32, NULL, OFPC_GROUP_STATS,
889 { &hf_openflow_ip_reasm,
890 { "Can reassemble IP fragments", "openflow.ip_reasm",
891 FT_BOOLEAN, 32, NULL, OFPC_IP_REASM,
894 { &hf_openflow_queue_stats,
895 { "Queue statistics", "openflow.queue_stats",
896 FT_BOOLEAN, 32, NULL, OFPC_QUEUE_STATS,
899 { &hf_openflow_port_blocked,
900 { "Switch will block looping ports", "openflow.port_blocked",
901 FT_BOOLEAN, 32, NULL, OFPC_PORT_BLOCKED,
904 { &hf_openflow_output,
905 { "Output to switch port", "openflow.output",
906 FT_BOOLEAN, 32, NULL, OFPAT_OUTPUT_MASK,
909 { &hf_openflow_set_vlan_vid,
910 { "Set the 802.1q VLAN id", "openflow.set_vlan_vid",
911 FT_BOOLEAN, 32, NULL, OFPAT_SET_VLAN_VID_MASK,
914 { &hf_openflow_set_vlan_pcp,
915 { "Set the 802.1q priority", "openflow.set_vlan_pcp",
916 FT_BOOLEAN, 32, NULL, OFPAT_SET_VLAN_PCP_MASK,
919 { &hf_openflow_strip_vlan,
920 { "Strip the 802.1q header", "openflow.strip_vlan",
921 FT_BOOLEAN, 32, NULL, OFPAT_STRIP_VLAN_MASK,
924 { &hf_openflow_set_dl_src,
925 { "Ethernet source address", "openflow.set_dl_src",
926 FT_BOOLEAN, 32, NULL, OFPAT_SET_DL_SRC_MASK,
929 { &hf_openflow_set_dl_dst,
930 { "Ethernet destination address", "openflow.set_dl_ds",
931 FT_BOOLEAN, 32, NULL, OFPAT_SET_DL_DST_MASK,
934 { &hf_openflow_set_nw_src,
935 { "IP source address", "openflow.set_nw_src",
936 FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_SRC_MASK,
939 { &hf_openflow_set_nw_dst,
940 { "IP destination address", "openflow.set_nw_ds",
941 FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_DST_MASK,
944 { &hf_openflow_set_nw_tos,
945 { "IP ToS (DSCP field, 6 bits)", "openflow.set_nw_tos",
946 FT_BOOLEAN, 32, NULL, OFPAT_SET_NW_TOS_MASK,
949 { &hf_openflow_set_tp_src,
950 { "TCP/UDP source port", "openflow.set_tp_src",
951 FT_BOOLEAN, 32, NULL, OFPAT_SET_TP_SRC_MASK,
954 { &hf_openflow_set_tp_dst,
955 { "TCP/UDP destination port", "openflow.set_tp_dst",
956 FT_BOOLEAN, 32, NULL, OFPAT_SET_TP_DST_MASK,
959 { &hf_openflow_enqueue,
960 { "Output to queue", "openflow.enqueue",
961 FT_BOOLEAN, 32, NULL, OFPAT_ENQUEUE_MASK,
964 { &hf_openflow_port_no,
965 { "Port number", "openflow.port_no",
966 FT_UINT16, BASE_DEC, NULL, 0x0,
969 { &hf_openflow_hw_addr,
970 { "HW Address", "openflow.hw_add",
971 FT_ETHER, BASE_NONE, NULL, 0x0,
974 { &hf_openflow_port_name,
975 { "Name", "openflow.hw_add",
976 FT_STRING, BASE_NONE, NULL, 0x0,
979 { &hf_openflow_port_config,
980 { "Config flags", "openflow.port_config",
981 FT_UINT32, BASE_HEX, NULL, 0x0,
984 { &hf_openflow_port_state,
985 { "State flags", "openflow.port_state",
986 FT_UINT32, BASE_HEX, NULL, 0x0,
989 { &hf_openflow_port_curr,
990 { "Current features", "openflow.port_curr",
991 FT_UINT32, BASE_HEX, NULL, 0x0,
994 { &hf_openflow_port_advertised,
995 { "Advertised features", "openflow.port_advertised",
996 FT_UINT32, BASE_HEX, NULL, 0x0,
999 { &hf_openflow_port_supported,
1000 { "Features supported", "openflow.port_supported",
1001 FT_UINT32, BASE_HEX, NULL, 0x0,
1004 { &hf_openflow_port_peer,
1005 { "Features advertised by peer", "openflow.port_peer",
1006 FT_UINT32, BASE_HEX, NULL, 0x0,
1009 { &hf_openflow_port_down,
1010 { "Port is administratively down", "openflow.port_down",
1011 FT_BOOLEAN, 32, NULL, OFPPC_PORT_DOWN,
1014 { &hf_openflow_no_stp,
1015 { "Disable 802.1D spanning tree on port", "openflow.no_stp",
1016 FT_BOOLEAN, 32, NULL, OFPPC_NO_STP,
1019 { &hf_openflow_no_recv,
1020 { "Drop all packets except 802.1D spanning tree packets", "openflow.no_recv",
1021 FT_BOOLEAN, 32, NULL, OFPPC_NO_RECV,
1024 { &hf_openflow_no_recv_stp,
1025 { "Drop received 802.1D STP packets", "openflow.no_recv",
1026 FT_BOOLEAN, 32, NULL, OFPPC_NO_RECV_STP,
1029 { &hf_openflow_no_flood,
1030 { "Do not include this port when flooding", "openflow.no_flood",
1031 FT_BOOLEAN, 32, NULL, OFPPC_NO_FLOOD,
1034 { &hf_openflow_no_fwd,
1035 { "Drop packets forwarded to port", "openflow.no_fwd",
1036 FT_BOOLEAN, 32, NULL, OFPPC_NO_FWD,
1039 { &hf_openflow_no_packet_in,
1040 { "Do not send packet-in msgs for port", "openflow.no_packet_in",
1041 FT_BOOLEAN, 32, NULL, OFPPC_NO_PACKET_IN,
1044 { &hf_openflow_link_down,
1045 { "No physical link present", "openflow.link_down",
1046 FT_BOOLEAN, 32, NULL, OFPPS_LINK_DOWN,
1049 { &hf_openflow_10mb_hd,
1050 { "10 Mb half-duplex rate support", "openflow.10mb_hd",
1051 FT_BOOLEAN, 32, NULL, OFPPF_10MB_HD,
1054 { &hf_openflow_10mb_fd,
1055 { "10 Mb full-duplex rate support", "openflow.10mb_fd",
1056 FT_BOOLEAN, 32, NULL, OFPPF_10MB_FD,
1059 { &hf_openflow_100mb_hd,
1060 { "100 Mb half-duplex rate support", "openflow.100mb_hd",
1061 FT_BOOLEAN, 32, NULL, OFPPF_100MB_HD,
1064 { &hf_openflow_100mb_fd,
1065 { "100 Mb full-duplex rate support", "openflow.100mb_0fd",
1066 FT_BOOLEAN, 32, NULL, OFPPF_100MB_FD,
1069 { &hf_openflow_1gb_hd,
1070 { "1 Gb half-duplex rate support", "openflow.1gb_hd",
1071 FT_BOOLEAN, 32, NULL, OFPPF_1GB_HD,
1074 { &hf_openflow_1gb_fd,
1075 { "1 Gb full-duplex rate support", "openflow.1gb_fd",
1076 FT_BOOLEAN, 32, NULL, OFPPF_1GB_FD,
1079 { &hf_openflow_10gb_fd,
1080 { "10 Gb full-duplex rate support", "openflow.10gb_fd",
1081 FT_BOOLEAN, 32, NULL, OFPPF_10GB_FD,
1084 { &hf_openflow_copper,
1085 { "Copper medium", "openflow.copper",
1086 FT_BOOLEAN, 32, NULL, OFPPF_COPPER,
1089 { &hf_openflow_fiber,
1090 { "Fiber medium", "openflow.fiber",
1091 FT_BOOLEAN, 32, NULL, OFPPF_FIBER,
1094 { &hf_openflow_autoneg,
1095 { "Auto-negotiation", "openflow.autoneg",
1096 FT_BOOLEAN, 32, NULL, OFPPF_AUTONEG,
1099 { &hf_openflow_pause,
1100 { "Pause", "openflow.pause",
1101 FT_BOOLEAN, 32, NULL, OFPPF_PAUSE,
1104 { &hf_openflow_pause_asym,
1105 { "Asymmetric pause", "openflow.pause_asym",
1106 FT_BOOLEAN, 32, NULL, OFPPF_PAUSE_ASYM,
1109 { &hf_openflow_config_flags,
1110 { "Config flags", "openflow.config_flags",
1111 FT_UINT16, BASE_HEX, NULL, 0x0,
1114 { &hf_openflow_miss_send_len,
1115 { "Max bytes of packet", "openflow.miss_send_len",
1116 FT_UINT16, BASE_HEX, NULL, 0x0,
1119 { &hf_openflow_buffer_id,
1120 { "Buffer Id", "openflow.buffer_id",
1121 FT_UINT32, BASE_HEX, NULL, 0x0,
1124 { &hf_openflow_total_len,
1125 { "Total length", "openflow.total_len",
1126 FT_UINT16, BASE_DEC, NULL, 0x0,
1129 { &hf_openflow_in_port,
1130 { "In port", "openflow.in_port",
1131 FT_UINT16, BASE_DEC, NULL, 0x0,
1134 { &hf_openflow_reason,
1135 { "Reason", "openflow.reason",
1136 FT_UINT8, BASE_DEC, VALS(openflow_reason_values), 0x0,
1140 { &hf_openflow_pkt_in_pad,
1141 { "Pad", "openflow.pkt_in.pad",
1142 FT_BYTES, BASE_NONE, NULL, 0x0,
1146 { &hf_openflow_table_id,
1147 { "Table Id", "openflow.table_id",
1148 FT_UINT8, BASE_DEC, NULL, 0x0,
1152 { &hf_openflow_cookie,
1153 { "Cookie", "openflow.cookie",
1154 FT_UINT64, BASE_HEX, NULL, 0x0,
1158 { &hf_openflow_cookie_mask,
1159 { "Cookie mask", "openflow.cookie",
1160 FT_UINT64, BASE_HEX, NULL, 0x0,
1164 { &hf_openflow_features_reply_pad,
1165 { "Pad", "openflow.features_reply.pad",
1166 FT_BYTES, BASE_NONE, NULL, 0x0,
1169 { &hf_openflow_actions_len,
1170 { "Actions length", "openflow.actions_len",
1171 FT_UINT16, BASE_DEC, NULL, 0x0,
1174 { &hf_openflow_action_type,
1175 { "Actions type", "openflow.action_typ",
1176 FT_UINT16, BASE_DEC, VALS(openflow_action_values), 0x0,
1179 { &hf_openflow_action_len,
1180 { "Action length", "openflow.action_len",
1181 FT_UINT16, BASE_DEC, NULL, 0x0,
1184 { &hf_openflow_output_port,
1185 { "Output port", "openflow.output_port",
1186 FT_UINT16, BASE_DEC, NULL, 0x0,
1189 { &hf_openflow_max_len,
1190 { "Max length", "openflow.max_len",
1191 FT_UINT16, BASE_DEC, NULL, 0x0,
1194 { &hf_openflow_wildcards,
1195 { "Wildcards", "openflow.wildcards",
1196 FT_UINT32, BASE_DEC, NULL, 0x0,
1199 { &hf_openflow_command,
1200 { "Command", "openflow.command",
1201 FT_UINT16, BASE_DEC, VALS(openflow_command_values), 0x0,
1204 { &hf_openflow_eth_src,
1205 { "Ethernet source address", "openflow.eth_src",
1206 FT_ETHER, BASE_NONE, NULL, 0x0,
1209 { &hf_openflow_eth_dst,
1210 { "Ethernet destination address", "openflow.eth_src",
1211 FT_ETHER, BASE_NONE, NULL, 0x0,
1214 { &hf_openflow_dl_vlan,
1215 { "Input VLAN id", "openflow.dl_vlan",
1216 FT_UINT16, BASE_DEC, NULL, 0x0,
1219 { &hf_openflow_dl_vlan_pcp,
1220 { "Input VLAN priority", "openflow.dl_vlan_pcp",
1221 FT_UINT8, BASE_DEC, NULL, 0x0,
1224 { &hf_openflow_ofp_match_pad,
1225 { "Pad", "openflow.ofp_match.pad",
1226 FT_BYTES, BASE_NONE, NULL, 0x0,
1229 { &hf_openflow_idle_timeout,
1230 { "Idle time-out", "openflow.idle_timeout",
1231 FT_UINT16, BASE_DEC, NULL, 0x0,
1234 { &hf_openflow_hard_timeout,
1235 { "hard time-out", "openflow.hard_timeout",
1236 FT_UINT16, BASE_DEC, NULL, 0x0,
1239 { &hf_openflow_priority,
1240 { "Priority", "openflow.priority",
1241 FT_UINT16, BASE_DEC, NULL, 0x0,
1244 { &hf_openflow_out_port,
1245 { "Out port", "openflow.out_port",
1246 FT_UINT32, BASE_DEC, NULL, 0x0,
1250 { &hf_openflow_out_group,
1251 { "Out group", "openflow.out_group",
1252 FT_UINT32, BASE_DEC, NULL, 0x0,
1256 { &hf_openflow_flags,
1257 { "Flags", "openflow.flags",
1258 FT_UINT16, BASE_DEC, NULL, 0x0,
1263 static gint *ett[] = {
1265 &ett_openflow_path_id,
1269 &ett_openflow_port_cnf,
1270 &ett_openflow_port_state,
1271 &ett_openflow_port_cf
1274 static ei_register_info ei[] = {
1275 { &ei_openflow_undecoded_data, { "openflow.undecoded_data", PI_UNDECODED, PI_WARN, "Data not dissected yet", EXPFILL }},
1276 { &ei_openflow_action_type, { "openflow.action_typ.undecoded", PI_UNDECODED, PI_WARN, "Action not dissected yet", EXPFILL }},
1277 { &ei_openflow_1_0_type, { "openflow_1_0.type.undecoded", PI_UNDECODED, PI_WARN, "Message data not dissected yet", EXPFILL }},
1280 expert_module_t* expert_openflow_v1;
1282 /* Register the protocol name and description */
1283 proto_openflow_v1 = proto_register_protocol("OpenFlow 1.0",
1284 "openflow_v1", "openflow_v1");
1286 new_register_dissector("openflow_v1", dissect_openflow_v1, proto_openflow_v1);
1288 eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
1290 /* Required function calls to register the header fields and subtrees */
1291 proto_register_field_array(proto_openflow_v1, hf, array_length(hf));
1292 proto_register_subtree_array(ett, array_length(ett));
1293 expert_openflow_v1 = expert_register_protocol(proto_openflow_v1);
1294 expert_register_field_array(expert_openflow_v1, ei, array_length(ei));
1298 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1303 * indent-tabs-mode: nil
1306 * vi: set shiftwidth=4 tabstop=8 expandtab:
1307 * :indentSize=4:tabSize=8:noTabs=true: