a9398e380ec2dfd858b5df3d7fc67429d1e3ff2a
[sliver-openvswitch.git] / utilities / ovs-ofctl.8.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .TH ovs\-ofctl 8 "January 2011" "Open vSwitch" "Open vSwitch Manual"
8 .ds PN ovs\-ofctl
9 .
10 .SH NAME
11 ovs\-ofctl \- administer OpenFlow switches
12 .
13 .SH SYNOPSIS
14 .B ovs\-ofctl
15 [\fIoptions\fR] \fIcommand \fR[\fIswitch\fR] [\fIargs\fR\&...]
16 .
17 .SH DESCRIPTION
18 The
19 .B ovs\-ofctl
20 program is a command line tool for monitoring and administering
21 OpenFlow switches.  It can also show the current state of an OpenFlow
22 switch, including features, configuration, and table entries.
23 .
24 .SS "OpenFlow Switch Management Commands"
25 .PP
26 These commands allow \fBovs\-ofctl\fR to monitor and administer an OpenFlow
27 switch.  It is able to show the current state of a switch, including
28 features, configuration, and table entries.
29 .PP
30 Most of these commands take an argument that specifies the method for
31 connecting to an OpenFlow switch.  The following connection methods
32 are supported:
33 .
34 .RS
35 .so lib/vconn-active.man
36 .
37 .IP "\fIfile\fR"
38 This is short for \fBunix:\fIfile\fR, as long as \fIfile\fR does not
39 contain a colon.
40 .
41 .IP \fIbridge\fR
42 This is short for \fBunix:@RUNDIR@/\fIbridge\fB.mgmt\fR, as long as
43 \fIbridge\fR does not contain a colon.
44 .
45 .IP [\fItype\fB@\fR]\fIdp\fR
46 Attempts to look up the bridge associated with \fIdp\fR and open as
47 above.  If \fItype\fR is given, it specifies the datapath provider of
48 \fIdp\fR, otherwise the default provider \fBsystem\fR is assumed.
49 .RE
50 .
51 .TP
52 \fBshow \fIswitch\fR
53 Prints to the console information on \fIswitch\fR, including
54 information on its flow tables and ports.
55 .
56 .TP
57 \fBdump\-tables \fIswitch\fR
58 Prints to the console statistics for each of the flow tables used by
59 \fIswitch\fR.
60 .
61 .TP
62 \fBdump\-ports \fIswitch\fR [\fInetdev\fR]
63 Prints to the console statistics for network devices associated with 
64 \fIswitch\fR.  If \fInetdev\fR is specified, only the statistics
65 associated with that device will be printed.  \fInetdev\fR can be an
66 OpenFlow assigned port number or device name, e.g. \fBeth0\fR.
67 .
68 .TP
69 \fBdump\-ports\-desc \fIswitch\fR
70 Prints to the console detailed information about network devices
71 associated with \fIswitch\fR (version 1.7 or later).  This is a subset
72 of the information provided by the \fBshow\fR command.
73 .
74 .TP
75 \fBmod\-port \fIswitch\fR \fInetdev\fR \fIaction\fR
76 Modify characteristics of an interface monitored by \fIswitch\fR.  
77 \fInetdev\fR can be referred to by its OpenFlow assigned port number or 
78 the device name, e.g. \fBeth0\fR.  The \fIaction\fR may be any one of the
79 following:
80 .
81 .RS
82 .IQ \fBup\fR
83 .IQ \fBdown\fR
84 Enable or disable the interface.  This is equivalent to \fBifconfig
85 up\fR or \fBifconfig down\fR on a Unix system.
86 .
87 .IP \fBstp\fR
88 .IQ \fBno\-stp\fR
89 Enable or disable 802.1D spanning tree protocol (STP) on the
90 interface.  OpenFlow implementations that don't support STP will
91 refuse to enable it.
92 .
93 .IP \fBreceive\fR
94 .IQ \fBno\-receive\fR
95 .IQ \fBreceive\-stp\fR
96 .IQ \fBno\-receive\-stp\fR
97 Enable or disable OpenFlow processing of packets received on this
98 interface.  When packet processing is disabled, packets will be
99 dropped instead of being processed through the OpenFlow table.  The
100 \fBreceive\fR or \fBno\-receive\fR setting applies to all packets
101 except 802.1D spanning tree packets, which are separately controlled
102 by \fBreceive\-stp\fR or \fBno\-receive\-stp\fR.
103 .
104 .IP \fBforward\fR
105 .IQ \fBno\-forward\fR
106 Allow or disallow forwarding of traffic to this interface.  By
107 default, forwarding is enabled.
108 .
109 .IP \fBflood\fR
110 .IQ \fBno\-flood\fR
111 Controls whether an OpenFlow \fBflood\fR action will send traffic out
112 this interface.  By default, flooding is enabled.  Disabling flooding
113 is primarily useful to prevent loops when a spanning tree protocol is
114 not in use.
115 .
116 .IP \fBpacket\-in\fR
117 .IQ \fBno\-packet\-in\fR
118 Controls whether packets received on this interface that do not match
119 a flow table entry generate a ``packet in'' message to the OpenFlow
120 controller.  By default, ``packet in'' messages are enabled.
121 .RE
122 .IP
123 The \fBshow\fR command displays (among other information) the
124 configuration that \fBmod\-port\fR changes.
125 .
126 .IP "\fBget\-frags \fIswitch\fR"
127 Prints \fIswitch\fR's fragment handling mode.  See \fBset\-frags\fR,
128 below, for a description of each fragment handling mode.
129 .IP
130 The \fBshow\fR command also prints the fragment handling mode among
131 its other output.
132 .
133 .IP "\fBset\-frags \fIswitch frag_mode\fR"
134 Configures \fIswitch\fR's treatment of IPv4 and IPv6 fragments.  The
135 choices for \fIfrag_mode\fR are:
136 .RS
137 .IP "\fBnormal\fR"
138 Fragments pass through the flow table like non-fragmented packets.
139 The TCP ports, UDP ports, and ICMP type and code fields are always set
140 to 0, even for fragments where that information would otherwise be
141 available (fragments with offset 0).  This is the default fragment
142 handling mode for an OpenFlow switch.
143 .IP "\fBdrop\fR"
144 Fragments are dropped without passing through the flow table.
145 .IP "\fBreassemble\fR"
146 The switch reassembles fragments into full IP packets before passing
147 them through the flow table.  Open vSwitch does not implement this
148 fragment handling mode.
149 .IP "\fBnx\-match\fR"
150 Fragments pass through the flow table like non-fragmented packets.
151 The TCP ports, UDP ports, and ICMP type and code fields are available
152 for matching for fragments with offset 0, and set to 0 in fragments
153 with nonzero offset.  This mode is a Nicira extension.
154 .RE
155 .IP
156 See the description of \fBip_frag\fR, below, for a way to match on
157 whether a packet is a fragment and on its fragment offset.
158 .
159 .TP
160 \fBdump\-flows \fIswitch \fR[\fIflows\fR]
161 Prints to the console all flow entries in \fIswitch\fR's
162 tables that match \fIflows\fR.  If \fIflows\fR is omitted, all flows
163 in the switch are retrieved.  See \fBFlow Syntax\fR, below, for the
164 syntax of \fIflows\fR.  The output format is described in 
165 \fBTable Entry Output\fR.
166 .
167 .TP
168 \fBdump\-aggregate \fIswitch \fR[\fIflows\fR]
169 Prints to the console aggregate statistics for flows in 
170 \fIswitch\fR's tables that match \fIflows\fR.  If \fIflows\fR is omitted, 
171 the statistics are aggregated across all flows in the switch's flow
172 tables.  See \fBFlow Syntax\fR, below, for the syntax of \fIflows\fR.
173 The output format is described in \fBTable Entry Output\fR.
174 .
175 .IP "\fBqueue\-stats \fIswitch \fR[\fIport \fR[\fIqueue\fR]]"
176 Prints to the console statistics for the specified \fIqueue\fR on
177 \fIport\fR within \fIswitch\fR.  Either of \fIport\fR or \fIqueue\fR
178 or both may be omitted (or equivalently specified as \fBALL\fR).  If
179 both are omitted, statistics are printed for all queues on all ports.
180 If only \fIqueue\fR is omitted, then statistics are printed for all
181 queues on \fIport\fR; if only \fIport\fR is omitted, then statistics
182 are printed for \fIqueue\fR on every port where it exists.
183 .
184 .SS "OpenFlow Switch Flow Table Commands"
185 .
186 These commands manage the flow table in an OpenFlow switch.  In each
187 case, \fIflow\fR specifies a flow entry in the format described in
188 \fBFlow Syntax\fR, below, and \fIfile\fR is a text file that contains
189 zero or more flows in the same syntax, one per line.
190 .
191 .IP "\fBadd\-flow \fIswitch flow\fR"
192 .IQ "\fBadd\-flow \fIswitch \fB\- < \fIfile\fR"
193 .IQ "\fBadd\-flows \fIswitch file\fR"
194 Add each flow entry to \fIswitch\fR's tables.
195 .
196 .IP "[\fB\-\-strict\fR] \fBmod\-flows \fIswitch flow\fR"
197 .IQ "[\fB\-\-strict\fR] \fBmod\-flows \fIswitch \fB\- < \fIfile\fR"
198 Modify the actions in entries from \fIswitch\fR's tables that match
199 the specified flows.  With \fB\-\-strict\fR, wildcards are not treated
200 as active for matching purposes.
201 .
202 .IP "\fBdel\-flows \fIswitch\fR"
203 .IQ "[\fB\-\-strict\fR] \fBdel\-flows \fIswitch \fR[\fIflow\fR]"
204 .IQ "[\fB\-\-strict\fR] \fBdel\-flows \fIswitch \fB\- < \fIfile\fR"
205 Deletes entries from \fIswitch\fR's flow table.  With only a
206 \fIswitch\fR argument, deletes all flows.  Otherwise, deletes flow
207 entries that match the specified flows.  With \fB\-\-strict\fR,
208 wildcards are not treated as active for matching purposes.
209 .
210 .IP "[\fB\-\-readd\fR] \fBreplace\-flows \fIswitch file\fR"
211 Reads flow entries from \fIfile\fR (or \fBstdin\fR if \fIfile\fR is
212 \fB\-\fR) and queries the flow table from \fIswitch\fR.  Then it fixes
213 up any differences, adding flows from \fIflow\fR that are missing on
214 \fIswitch\fR, deleting flows from \fIswitch\fR that are not in
215 \fIfile\fR, and updating flows in \fIswitch\fR whose actions, cookie,
216 or timeouts differ in \fIfile\fR.
217 .
218 .IP
219 With \fB\-\-readd\fR, \fBovs\-ofctl\fR adds all the flows from
220 \fIfile\fR, even those that exist with the same actions, cookie, and
221 timeout in \fIswitch\fR.  This resets all the flow packet and byte
222 counters to 0, which can be useful for debugging.
223 .
224 .IP "\fBdiff\-flows \fIsource1 source2\fR"
225 Reads flow entries from \fIsource1\fR and \fIsource2\fR and prints the
226 differences.  A flow that is in \fIsource1\fR but not in \fIsource2\fR
227 is printed preceded by a \fB\-\fR, and a flow that is in \fIsource2\fR
228 but not in \fIsource1\fR is printed preceded by a \fB+\fR.  If a flow
229 exists in both \fIsource1\fR and \fIsource2\fR with different actions,
230 cookie, or timeouts, then both versions are printed preceded by
231 \fB\-\fR and \fB+\fR, respectively.
232 .IP
233 \fIsource1\fR and \fIsource2\fR may each name a file or a switch.  If
234 a name begins with \fB/\fR or \fB.\fR, then it is considered to be a
235 file name.  A name that contains \fB:\fR is considered to be a switch.
236 Otherwise, it is a file if a file by that name exists, a switch if
237 not.
238 .IP
239 For this command, an exit status of 0 means that no differences were
240 found, 1 means that an error occurred, and 2 means that some
241 differences were found.
242 .
243 .IP "\fBpacket\-out \fIswitch in_port actions packet\fR..."
244 Connects to \fIswitch\fR and instructs it to execute the OpenFlow
245 \fIactions\fR on each \fIpacket\fR.  For the purpose of executing the
246 actions, the packets are considered to have arrived on \fIin_port\fR,
247 which may be an OpenFlow assigned port number, an OpenFlow port name
248 (e.g. \fBeth0\fR), the keyword \fBlocal\fR for the OpenFlow ``local''
249 port \fBOFPP_LOCAL\fR, or the keyword \fBnone\fR to indicate that the
250 packet was generated by the switch itself.
251 .
252 .SS "OpenFlow Switch Monitoring Commands"
253 .
254 .IP "\fBsnoop \fIswitch\fR"
255 Connects to \fIswitch\fR and prints to the console all OpenFlow
256 messages received.  Unlike other \fBovs\-ofctl\fR commands, if
257 \fIswitch\fR is the name of a bridge, then the \fBsnoop\fR command
258 connects to a Unix domain socket named
259 \fB@RUNDIR@/\fIbridge\fB.snoop\fR.  \fBovs\-vswitchd\fR listens on
260 such a socket for each bridge and sends to it all of the OpenFlow
261 messages sent to or received from its configured OpenFlow controller.
262 Thus, this command can be used to view OpenFlow protocol activity
263 between a switch and its controller.
264 .IP
265 When a switch has more than one controller configured, only the
266 traffic to and from a single controller is output.  If none of the
267 controllers is configured as a master or a slave (using a Nicira
268 extension to OpenFlow), then a controller is chosen arbitrarily among
269 them.  If there is a master controller, it is chosen; otherwise, if
270 there are any controllers that are not masters or slaves, one is
271 chosen arbitrarily; otherwise, a slave controller is chosen
272 arbitrarily.  This choice is made once at connection time and does not
273 change as controllers reconfigure their roles.
274 .IP
275 If a switch has no controller configured, or if
276 the configured controller is disconnected, no traffic is sent, so
277 monitoring will not show any traffic.
278 .
279 .IP "\fBmonitor \fIswitch\fR [\fImiss-len\fR] [\fIinvalid_ttl\fR]"
280 Connects to \fIswitch\fR and prints to the console all OpenFlow
281 messages received.  Usually, \fIswitch\fR should specify the name of a
282 bridge in the \fBovs\-vswitchd\fR database.
283 .IP
284 If \fImiss-len\fR is provided, \fBovs\-ofctl\fR sends an OpenFlow ``set
285 configuration'' message at connection setup time that requests
286 \fImiss-len\fR bytes of each packet that misses the flow table.  Open vSwitch
287 does not send these and other asynchronous messages to an
288 \fBovs\-ofctl monitor\fR client connection unless a nonzero value is
289 specified on this argument.  (Thus, if \fImiss\-len\fR is not
290 specified, very little traffic will ordinarily be printed.)
291 .IP
292 .IP
293 If \fBinvalid_ttl\fR is passed, \fBovs\-ofctl\fR sends an OpenFlow ``set
294 configuration'' message at connection setup time that requests
295 \fIINVALID_TTL_TO_CONTROLLER\fR, so that \fBovs\-ofctl monitor\fR can
296 receive ``packets-in'' messages when TTL reaches zero on \fBdec_ttl\fR action.
297 .IP
298
299 This command may be useful for debugging switch or controller
300 implementations.
301 .
302 .SS "OpenFlow Switch and Controller Commands"
303 .
304 The following commands, like those in the previous section, may be
305 applied to OpenFlow switches, using any of the connection methods
306 described in that section.  Unlike those commands, these may also be
307 applied to OpenFlow controllers.
308 .
309 .TP
310 \fBprobe \fItarget\fR
311 Sends a single OpenFlow echo-request message to \fItarget\fR and waits
312 for the response.  With the \fB\-t\fR or \fB\-\-timeout\fR option, this
313 command can test whether an OpenFlow switch or controller is up and
314 running.
315 .
316 .TP
317 \fBping \fItarget \fR[\fIn\fR]
318 Sends a series of 10 echo request packets to \fItarget\fR and times
319 each reply.  The echo request packets consist of an OpenFlow header
320 plus \fIn\fR bytes (default: 64) of randomly generated payload.  This
321 measures the latency of individual requests.
322 .
323 .TP
324 \fBbenchmark \fItarget n count\fR
325 Sends \fIcount\fR echo request packets that each consist of an
326 OpenFlow header plus \fIn\fR bytes of payload and waits for each
327 response.  Reports the total time required.  This is a measure of the
328 maximum bandwidth to \fItarget\fR for round-trips of \fIn\fR-byte
329 messages.
330 .
331 .SS "Flow Syntax"
332 .PP
333 Some \fBovs\-ofctl\fR commands accept an argument that describes a flow or
334 flows.  Such flow descriptions comprise a series
335 \fIfield\fB=\fIvalue\fR assignments, separated by commas or white
336 space.  (Embedding spaces into a flow description normally requires
337 quoting to prevent the shell from breaking the description into
338 multiple arguments.)
339 .PP
340 Flow descriptions should be in \fBnormal form\fR.  This means that a
341 flow may only specify a value for an L3 field if it also specifies a
342 particular L2 protocol, and that a flow may only specify an L4 field
343 if it also specifies particular L2 and L3 protocol types.  For
344 example, if the L2 protocol type \fBdl_type\fR is wildcarded, then L3
345 fields \fBnw_src\fR, \fBnw_dst\fR, and \fBnw_proto\fR must also be
346 wildcarded.  Similarly, if \fBdl_type\fR or \fBnw_proto\fR (the L3
347 protocol type) is wildcarded, so must be \fBtp_dst\fR and
348 \fBtp_src\fR, which are L4 fields.  \fBovs\-ofctl\fR will warn about
349 flows not in normal form.
350 .PP
351 The following field assignments describe how a flow matches a packet.
352 If any of these assignments is omitted from the flow syntax, the field
353 is treated as a wildcard; thus, if all of them are omitted, the
354 resulting flow matches all packets.  The string \fB*\fR or \fBANY\fR
355 may be specified to explicitly mark any of these fields as a wildcard.  
356 (\fB*\fR should be quoted to protect it from shell expansion.)
357 .
358 .IP \fBin_port=\fIport_no\fR
359 Matches OpenFlow port \fIport_no\fR.  Ports are numbered as
360 displayed by \fBovs\-ofctl show\fR.
361 .IP
362 (The \fBresubmit\fR action can search OpenFlow flow tables with
363 arbitrary \fBin_port\fR values, so flows that match port numbers that
364 do not exist from an OpenFlow perspective can still potentially be
365 matched.)
366 .
367 .IP \fBdl_vlan=\fIvlan\fR
368 Matches IEEE 802.1q Virtual LAN tag \fIvlan\fR.  Specify \fB0xffff\fR
369 as \fIvlan\fR to match packets that are not tagged with a Virtual LAN;
370 otherwise, specify a number between 0 and 4095, inclusive, as the
371 12-bit VLAN ID to match.
372 .
373 .IP \fBdl_vlan_pcp=\fIpriority\fR
374 Matches IEEE 802.1q Priority Code Point (PCP) \fIpriority\fR, which is
375 specified as a value between 0 and 7, inclusive.  A higher value
376 indicates a higher frame priority level.
377 .
378 .IP \fBdl_src=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
379 .IQ \fBdl_dst=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
380 Matches an Ethernet source (or destination) address specified as 6
381 pairs of hexadecimal digits delimited by colons
382 (e.g. \fB00:0A:E4:25:6B:B0\fR).
383 .
384 .IP \fBdl_dst=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB/\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
385 Matches an Ethernet destination address specified as 6 pairs of
386 hexadecimal digits delimited by colons (e.g. \fB00:0A:E4:25:6B:B0\fR),
387 with a wildcard mask following the slash.  Only
388 the following masks are allowed:
389 .RS
390 .IP \fB01:00:00:00:00:00\fR
391 Match only the multicast bit.  Thus,
392 \fBdl_dst=01:00:00:00:00:00/01:00:00:00:00:00\fR matches all multicast
393 (including broadcast) Ethernet packets, and
394 \fBdl_dst=00:00:00:00:00:00/01:00:00:00:00:00\fR matches all unicast
395 Ethernet packets.
396 .IP \fBfe:ff:ff:ff:ff:ff\fR
397 Match all bits except the multicast bit.  This is probably not useful.
398 .IP \fBff:ff:ff:ff:ff:ff\fR
399 Exact match (equivalent to omitting the mask).
400 .IP \fB00:00:00:00:00:00\fR
401 Wildcard all bits (equivalent to \fBdl_dst=*\fR.)
402 .RE
403 .
404 .IP \fBdl_type=\fIethertype\fR
405 Matches Ethernet protocol type \fIethertype\fR, which is specified as an
406 integer between 0 and 65535, inclusive, either in decimal or as a 
407 hexadecimal number prefixed by \fB0x\fR (e.g. \fB0x0806\fR to match ARP 
408 packets).
409 .
410 .IP \fBnw_src=\fIip\fR[\fB/\fInetmask\fR]
411 .IQ \fBnw_dst=\fIip\fR[\fB/\fInetmask\fR]
412 When \fBdl_type\fR is 0x0800 (possibly via shorthand, e.g. \fBip\fR
413 or \fBtcp\fR), matches IPv4 source (or destination) address \fIip\fR,
414 which may be specified as an IP address or host name
415 (e.g. \fB192.168.1.1\fR or \fBwww.example.com\fR).  The optional
416 \fInetmask\fR allows restricting a match to an IPv4 address prefix.
417 The netmask may be specified as a dotted quad
418 (e.g. \fB192.168.1.0/255.255.255.0\fR) or as a CIDR block
419 (e.g. \fB192.168.1.0/24\fR).
420 .IP
421 When \fBdl_type=0x0806\fR or \fBarp\fR is specified, matches the
422 \fBar_spa\fR or \fBar_tpa\fR field, respectively, in ARP packets for
423 IPv4 and Ethernet.
424 .IP
425 When \fBdl_type\fR is wildcarded or set to a value other than 0x0800
426 or 0x0806, the values of \fBnw_src\fR and \fBnw_dst\fR are ignored
427 (see \fBFlow Syntax\fR above).
428 .
429 .IP \fBnw_proto=\fIproto\fR
430 When \fBip\fR or \fBdl_type=0x0800\fR is specified, matches IP
431 protocol type \fIproto\fR, which is specified as a decimal number
432 between 0 and 255, inclusive (e.g. 1 to match ICMP packets or 6 to match
433 TCP packets).
434 .IP
435 When \fBipv6\fR or \fBdl_type=0x86dd\fR is specified, matches IPv6
436 header type \fIproto\fR, which is specified as a decimal number between
437 0 and 255, inclusive (e.g. 58 to match ICMPv6 packets or 6 to match
438 TCP).  The header type is the terminal header as described in the
439 \fBDESIGN\fR document.
440 .IP
441 When \fBarp\fR or \fBdl_type=0x0806\fR is specified, matches the lower
442 8 bits of the ARP opcode.  ARP opcodes greater than 255 are treated as
443 0.
444 .IP
445 When \fBdl_type\fR is wildcarded or set to a value other than 0x0800,
446 0x0806, or 0x86dd, the value of \fBnw_proto\fR is ignored (see \fBFlow
447 Syntax\fR above).
448 .
449 .IP \fBnw_tos=\fItos\fR
450 Matches IP ToS/DSCP or IPv6 traffic class field \fItos\fR, which is
451 specified as a decimal number between 0 and 255, inclusive.  Note that
452 the two lower reserved bits are ignored for matching purposes.
453 .IP
454 When \fBdl_type\fR is wildcarded or set to a value other than 0x0800 or
455 0x86dd, the value of \fBnw_tos\fR is ignored (see \fBFlow Syntax\fR
456 above).
457 .
458 .IP \fBnw_ecn=\fIecn\fR
459 Matches \fIecn\fR bits in IP ToS or IPv6 traffic class fields, which is
460 specified as a decimal number between 0 and 3, inclusive.
461 .IP
462 When \fBdl_type\fR is wildcarded or set to a value other than 0x0800 or
463 0x86dd, the value of \fBnw_ecn\fR is ignored (see \fBFlow Syntax\fR
464 above).
465 .
466 .IP \fBnw_ttl=\fIttl\fR
467 Matches IP TTL or IPv6 hop limit value \fIttl\fR, which is
468 specified as a decimal number between 0 and 255, inclusive.
469 .IP
470 When \fBdl_type\fR is wildcarded or set to a value other than 0x0800 or
471 0x86dd, the value of \fBnw_ttl\fR is ignored (see \fBFlow Syntax\fR
472 above).
473 .IP
474 .
475 .IP \fBtp_src=\fIport\fR
476 .IQ \fBtp_dst=\fIport\fR
477 When \fBdl_type\fR and \fBnw_proto\fR specify TCP or UDP, \fBtp_src\fR
478 and \fBtp_dst\fR match the UDP or TCP source or destination port
479 \fIport\fR, respectively, which is specified as a decimal number
480 between 0 and 65535, inclusive (e.g. 80 to match packets originating
481 from a HTTP server).
482 .IP
483 When \fBdl_type\fR and \fBnw_proto\fR take other values, the values of
484 these settings are ignored (see \fBFlow Syntax\fR above).
485 .
486 .IP \fBtp_src=\fIport\fB/\fImask\fR
487 .IQ \fBtp_dst=\fIport\fB/\fImask\fR
488 Bitwise match on TCP (or UDP) source or destination port,
489 respectively.  The \fIport\fR and \fImask\fR are 16-bit numbers
490 written in decimal or in hexadecimal prefixed by \fB0x\fR.  Each 1-bit
491 in \fImask\fR requires that the corresponding bit in \fIport\fR must
492 match.  Each 0-bit in \fImask\fR causes the corresponding bit to be
493 ignored.
494 .IP
495 Bitwise matches on transport ports are rarely useful in isolation, but
496 a group of them can be used to reduce the number of flows required to
497 match on a range of transport ports.  For example, suppose that the
498 goal is to match TCP source ports 1000 to 1999, inclusive.  One way is
499 to insert 1000 flows, each of which matches on a single source port.
500 Another way is to look at the binary representations of 1000 and 1999,
501 as follows:
502 .br
503 .B "01111101000"
504 .br
505 .B "11111001111"
506 .br
507 and then to transform those into a series of bitwise matches that
508 accomplish the same results:
509 .br
510 .B "01111101xxx"
511 .br
512 .B "0111111xxxx"
513 .br
514 .B "10xxxxxxxxx"
515 .br
516 .B "110xxxxxxxx"
517 .br
518 .B "1110xxxxxxx"
519 .br
520 .B "11110xxxxxx"
521 .br
522 .B "1111100xxxx"
523 .br
524 which become the following when written in the syntax required by
525 \fBovs\-ofctl\fR:
526 .br
527 .B "tcp,tp_src=0x03e8/0xfff8"
528 .br
529 .B "tcp,tp_src=0x03f0/0xfff0"
530 .br
531 .B "tcp,tp_src=0x0400/0xfe00"
532 .br
533 .B "tcp,tp_src=0x0600/0xff00"
534 .br
535 .B "tcp,tp_src=0x0700/0xff80"
536 .br
537 .B "tcp,tp_src=0x0780/0xffc0"
538 .br
539 .B "tcp,tp_src=0x07c0/0xfff0"
540 .IP
541 Only Open vSwitch 1.6 and later supports bitwise matching on transport
542 ports.
543 .IP
544 Like the exact-match forms of \fBtp_src\fR and \fBtp_dst\fR described
545 above, the bitwise match forms apply only when \fBdl_type\fR and
546 \fBnw_proto\fR specify TCP or UDP.
547 .
548 .IP \fBicmp_type=\fItype\fR
549 .IQ \fBicmp_code=\fIcode\fR
550 When \fBdl_type\fR and \fBnw_proto\fR specify ICMP or ICMPv6, \fItype\fR
551 matches the ICMP type and \fIcode\fR matches the ICMP code.  Each is
552 specified as a decimal number between 0 and 255, inclusive.
553 .IP
554 When \fBdl_type\fR and \fBnw_proto\fR take other values, the values of
555 these settings are ignored (see \fBFlow Syntax\fR above).
556 .
557 .IP \fBtable=\fInumber\fR
558 If specified, limits the flow manipulation and flow dump commands to
559 only apply to the table with the given \fInumber\fR between 0 and 254.
560 .
561 Behavior varies if \fBtable\fR is not specified (equivalent to
562 specifying 255 as \fInumber\fR).  For flow table
563 modification commands without \fB\-\-strict\fR, the switch will choose
564 the table for these commands to operate on.  For flow table
565 modification commands with \fB\-\-strict\fR, the command will operate
566 on any single matching flow in any table; it will do nothing if there
567 are matches in more than one table.  The \fBdump-flows\fR and
568 \fBdump-aggregate\fR commands will gather statistics about flows from
569 all tables.
570 .IP
571 When this field is specified in \fBadd-flow\fR, \fBadd-flows\fR,
572 \fBmod-flows\fR and \fBdel-flows\fR commands, it activates a Nicira
573 extension to OpenFlow, which as of this writing is only known to be
574 implemented by Open vSwitch.
575 .
576 .PP
577 The following shorthand notations are also available:
578 .
579 .IP \fBip\fR
580 Same as \fBdl_type=0x0800\fR.
581 .
582 .IP \fBicmp\fR
583 Same as \fBdl_type=0x0800,nw_proto=1\fR.
584 .
585 .IP \fBtcp\fR
586 Same as \fBdl_type=0x0800,nw_proto=6\fR.
587 .
588 .IP \fBudp\fR
589 Same as \fBdl_type=0x0800,nw_proto=17\fR.
590 .
591 .IP \fBarp\fR
592 Same as \fBdl_type=0x0806\fR.
593 .
594 .PP
595 The following field assignments require support for the NXM (Nicira
596 Extended Match) extension to OpenFlow.  When one of these is specified,
597 \fBovs\-ofctl\fR will automatically attempt to negotiate use of this
598 extension.  If the switch does not support NXM, then \fBovs\-ofctl\fR
599 will report a fatal error.
600 .
601 .IP \fBvlan_tci=\fItci\fR[\fB/\fImask\fR]
602 Matches modified VLAN TCI \fItci\fR.  If \fImask\fR is omitted,
603 \fItci\fR is the exact VLAN TCI to match; if \fImask\fR is specified,
604 then a 1-bit in \fImask\fR indicates that the corresponding bit in
605 \fItci\fR must match exactly, and a 0-bit wildcards that bit.  Both
606 \fItci\fR and \fImask\fR are 16-bit values that are decimal by
607 default; use a \fB0x\fR prefix to specify them in hexadecimal.
608 .
609 .IP
610 The value that \fBvlan_tci\fR matches against is 0 for a packet that
611 has no 802.1Q header.  Otherwise, it is the TCI value from the 802.1Q
612 header with the CFI bit (with value \fB0x1000\fR) forced to 1.
613 .IP
614 Examples:
615 .RS
616 .IP \fBvlan_tci=0\fR
617 Match only packets without an 802.1Q header.
618 .IP \fBvlan_tci=0xf123\fR
619 Match packets tagged with priority 7 in VLAN 0x123.
620 .IP \fBvlan_tci=0x1123/0x1fff\fR
621 Match packets tagged with VLAN 0x123 (and any priority).
622 .IP \fBvlan_tci=0x5000/0xf000\fR
623 Match packets tagged with priority 2 (in any VLAN).
624 .IP \fBvlan_tci=0/0xfff\fR
625 Match packets with no 802.1Q header or tagged with VLAN 0 (and any
626 priority).
627 .IP \fBvlan_tci=0x5000/0xe000\fR
628 Match packets with no 802.1Q header or tagged with priority 2 (in any
629 VLAN).
630 .IP \fBvlan_tci=0/0xefff\fR
631 Match packets with no 802.1Q header or tagged with VLAN 0 and priority
632 0.
633 .RE
634 .IP
635 Some of these matching possibilities can also be achieved with
636 \fBdl_vlan\fR and \fBdl_vlan_pcp\fR.
637 .
638 .IP \fBip_frag=\fIfrag_type\fR
639 When \fBdl_type\fR specifies IP or IPv6, \fIfrag_type\fR
640 specifies what kind of IP fragments or non-fragments to match.  The
641 following values of \fIfrag_type\fR are supported:
642 .RS
643 .IP "\fBno\fR"
644 Matches only non-fragmented packets.
645 .IP "\fByes\fR"
646 Matches all fragments.
647 .IP "\fBfirst\fR"
648 Matches only fragments with offset 0.
649 .IP "\fBlater\fR"
650 Matches only fragments with nonzero offset.
651 .IP "\fBnot_later\fR"
652 Matches non-fragmented packets and fragments with zero offset.
653 .RE
654 .IP
655 The \fBip_frag\fR match type is likely to be most useful in
656 \fBnx\-match\fR mode.  See the description of the \fBset\-frags\fR
657 command, above, for more details.
658 .
659 .IP \fBarp_sha=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
660 .IQ \fBarp_tha=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
661 When \fBdl_type\fR specifies ARP, \fBarp_sha\fR and \fBarp_tha\fR match
662 the source and target hardware address, respectively.  An address is
663 specified as 6 pairs of hexadecimal digits delimited by colons.
664 .
665 .IP \fBipv6_src=\fIipv6\fR[\fB/\fInetmask\fR]
666 .IQ \fBipv6_dst=\fIipv6\fR[\fB/\fInetmask\fR]
667 When \fBdl_type\fR is 0x86dd (possibly via shorthand, e.g., \fBipv6\fR
668 or \fBtcp6\fR), matches IPv6 source (or destination) address \fIipv6\fR,
669 which may be specified as defined in RFC 2373.  The preferred format is 
670 \fIx\fB:\fIx\fB:\fIx\fB:\fIx\fB:\fIx\fB:\fIx\fB:\fIx\fB:\fIx\fR, where
671 \fIx\fR are the hexadecimal values of the eight 16-bit pieces of the
672 address.  A single instance of \fB::\fR may be used to indicate multiple
673 groups of 16-bits of zeros.  The optional \fInetmask\fR allows
674 restricting a match to an IPv6 address prefix.  A netmask is specified
675 as a CIDR block (e.g. \fB2001:db8:3c4d:1::/64\fR).
676 .
677 .IP \fBipv6_label=\fIlabel\fR
678 When \fBdl_type\fR is 0x86dd (possibly via shorthand, e.g., \fBipv6\fR
679 or \fBtcp6\fR), matches IPv6 flow label \fIlabel\fR.
680 .
681 .IP \fBnd_target=\fIipv6\fR[\fB/\fInetmask\fR]
682 When \fBdl_type\fR, \fBnw_proto\fR, and \fBicmp_type\fR specify
683 IPv6 Neighbor Discovery (ICMPv6 type 135 or 136), matches the target address
684 \fIipv6\fR.  \fIipv6\fR is in the same format described earlier for the
685 \fBipv6_src\fR and \fBipv6_dst\fR fields.
686 .
687 .IP \fBnd_sll=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
688 When \fBdl_type\fR, \fBnw_proto\fR, and \fBicmp_type\fR specify IPv6
689 Neighbor Solicitation (ICMPv6 type 135), matches the source link\-layer
690 address option.  An address is specified as 6 pairs of hexadecimal
691 digits delimited by colons.
692 .
693 .IP \fBnd_tll=\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fB:\fIxx\fR
694 When \fBdl_type\fR, \fBnw_proto\fR, and \fBicmp_type\fR specify IPv6
695 Neighbor Advertisement (ICMPv6 type 136), matches the target link\-layer
696 address option.  An address is specified as 6 pairs of hexadecimal
697 digits delimited by colons.
698 .
699 .IP \fBtun_id=\fItunnel-id\fR[\fB/\fImask\fR]
700 Matches tunnel identifier \fItunnel-id\fR.  Only packets that arrive
701 over a tunnel that carries a key (e.g. GRE with the RFC 2890 key
702 extension and a nonzero key value) will have a nonzero tunnel ID.
703 If \fImask\fR is omitted, \fItunnel-id\fR is the exact tunnel ID to match;
704 if \fImask\fR is specified, then a 1-bit in \fImask\fR indicates that the
705 corresponding bit in \fItunnel-id\fR must match exactly, and a 0-bit
706 wildcards that bit.
707 .
708 .IP "\fBreg\fIidx\fB=\fIvalue\fR[\fB/\fImask\fR]"
709 Matches \fIvalue\fR either exactly or with optional \fImask\fR in
710 register number \fIidx\fR.  The valid range of \fIidx\fR depends on
711 the switch.  \fIvalue\fR and \fImask\fR are 32-bit integers, by
712 default in decimal (use a \fB0x\fR prefix to specify hexadecimal).
713 Arbitrary \fImask\fR values are allowed: a 1-bit in \fImask\fR
714 indicates that the corresponding bit in \fIvalue\fR must match
715 exactly, and a 0-bit wildcards that bit.
716 .IP
717 When a packet enters an OpenFlow switch, all of the registers are set
718 to 0.  Only explicit Nicira extension actions change register values.
719 .
720 .PP
721 Defining IPv6 flows (those with \fBdl_type\fR equal to 0x86dd) requires
722 support for NXM.  The following shorthand notations are available for
723 IPv6-related flows:
724 .
725 .IP \fBipv6\fR
726 Same as \fBdl_type=0x86dd\fR.
727 .
728 .IP \fBtcp6\fR
729 Same as \fBdl_type=0x86dd,nw_proto=6\fR.
730 .
731 .IP \fBudp6\fR
732 Same as \fBdl_type=0x86dd,nw_proto=17\fR.
733 .
734 .IP \fBicmp6\fR
735 Same as \fBdl_type=0x86dd,nw_proto=58\fR.
736 .
737 .PP
738 Finally, field assignments to \fBduration\fR, \fBn_packets\fR, or
739 \fBn_bytes\fR are ignored to allow output from the \fBdump\-flows\fR
740 command to be used as input for other commands that parse flows.
741 .
742 .PP
743 The \fBadd\-flow\fR, \fBadd\-flows\fR, and \fBmod\-flows\fR commands
744 require an additional field, which must be the final field specified:
745 .
746 .IP \fBactions=\fR[\fItarget\fR][\fB,\fItarget\fR...]\fR
747 Specifies a comma-separated list of actions to take on a packet when the 
748 flow entry matches.  If no \fItarget\fR is specified, then packets
749 matching the flow are dropped.  The \fItarget\fR may be a decimal port 
750 number designating the physical port on which to output the packet, or one 
751 of the following keywords:
752 .
753 .RS
754 .IP \fBoutput\fR:\fIport\fR
755 .IQ \fBoutput\fR:\fIsrc\fB[\fIstart\fB..\fIend\fB]
756 Outputs the packet. If \fIport\fR is an OpenFlow port number, outputs directly
757 to it.  Otherwise, outputs to the OpenFlow port number read from \fIsrc\fR
758 which must be an NXM field as described above.  Outputting to an NXM field is
759 an OpenFlow extension which is not supported by standard OpenFlow switches.
760 .IP
761 Example: \fBoutput:NXM_NX_REG0[16..31]\fR outputs to the OpenFlow port number
762 written in the upper half of register 0.
763 .
764 .IP \fBenqueue\fR:\fIport\fB:\fIqueue\fR
765 Enqueues the packet on the specified \fIqueue\fR within port
766 \fIport\fR.  The number of supported queues depends on the switch;
767 some OpenFlow implementations do not support queuing at all.
768 .
769 .IP \fBnormal\fR
770 Subjects the packet to the device's normal L2/L3 processing.  (This
771 action is not implemented by all OpenFlow switches.)
772 .
773 .IP \fBflood\fR
774 Outputs the packet on all switch physical ports other than the port on
775 which it was received and any ports on which flooding is disabled
776 (typically, these would be ports disabled by the IEEE 802.1D spanning
777 tree protocol).
778 .
779 .IP \fBall\fR
780 Outputs the packet on all switch physical ports other than the port on
781 which it was received.
782 .
783 .IP \fBcontroller(\fIkey\fB=\fIvalue\fR...\fB)
784 Sends the packet to the OpenFlow controller as a ``packet in''
785 message.  The supported key-value pairs are:
786 .RS
787 .IP "\fBmax_len=\fInbytes\fR"
788 Limit to \fInbytes\fR the number of bytes of the packet to send to
789 the controller.  By default the entire packet is sent.
790 .IP "\fBreason=\fIreason\fR"
791 Specify \fIreason\fR as the reason for sending the message in the
792 ``packet in'' message.  The supported reasons are \fBaction\fR (the
793 default), \fBno_match\fR, and \fBinvalid_ttl\fR.
794 .IP "\fBid=\fIcontroller-id\fR"
795 Specify \fIcontroller-id\fR, a 16-bit integer, as the connection ID of
796 the OpenFlow controller or controllers to which the ``packet in''
797 message should be sent.  The default is zero.  Zero is also the
798 default connection ID for each controller connection, and a given
799 controller connection will only have a nonzero connection ID if its
800 controller uses the \fBNXT_SET_CONTROLLER_ID\fR Nicira extension to
801 OpenFlow.
802 .RE
803 Any \fIreason\fR other than \fBaction\fR and any nonzero
804 \fIcontroller-id\fR uses a Nicira vendor extension that, as of this
805 writing, is only known to be implemented by Open vSwitch (version 1.6
806 or later).
807 .
808 .IP \fBcontroller\fR
809 .IQ \fBcontroller\fR[\fB:\fInbytes\fR]
810 Shorthand for \fBcontroller()\fR or
811 \fBcontroller(max_len=\fInbytes\fB)\fR, respectively.
812 .
813 .IP \fBlocal\fR
814 Outputs the packet on the ``local port,'' which corresponds to the
815 network device that has the same name as the bridge.
816 .
817 .IP \fBin_port\fR
818 Outputs the packet on the port from which it was received.
819 .
820 .IP \fBdrop\fR
821 Discards the packet, so no further processing or forwarding takes place.
822 If a drop action is used, no other actions may be specified.
823 .
824 .IP \fBmod_vlan_vid\fR:\fIvlan_vid\fR
825 Modifies the VLAN id on a packet.  The VLAN tag is added or modified 
826 as necessary to match the value specified.  If the VLAN tag is added,
827 a priority of zero is used (see the \fBmod_vlan_pcp\fR action to set
828 this).
829 .
830 .IP \fBmod_vlan_pcp\fR:\fIvlan_pcp\fR
831 Modifies the VLAN priority on a packet.  The VLAN tag is added or modified 
832 as necessary to match the value specified.  Valid values are between 0
833 (lowest) and 7 (highest).  If the VLAN tag is added, a vid of zero is used 
834 (see the \fBmod_vlan_vid\fR action to set this).
835 .
836 .IP \fBstrip_vlan\fR
837 Strips the VLAN tag from a packet if it is present.
838 .
839 .IP \fBmod_dl_src\fB:\fImac\fR
840 Sets the source Ethernet address to \fImac\fR.
841 .
842 .IP \fBmod_dl_dst\fB:\fImac\fR
843 Sets the destination Ethernet address to \fImac\fR.
844 .
845 .IP \fBmod_nw_src\fB:\fIip\fR
846 Sets the IPv4 source address to \fIip\fR.
847 .
848 .IP \fBmod_nw_dst\fB:\fIip\fR
849 Sets the IPv4 destination address to \fIip\fR.
850 .
851 .IP \fBmod_tp_src\fB:\fIport\fR
852 Sets the TCP or UDP source port to \fIport\fR.
853 .
854 .IP \fBmod_tp_dst\fB:\fIport\fR
855 Sets the TCP or UDP destination port to \fIport\fR.
856 .
857 .IP \fBmod_nw_tos\fB:\fItos\fR
858 Sets the IPv4 ToS/DSCP field to \fItos\fR.  Valid values are between 0 and
859 255, inclusive.  Note that the two lower reserved bits are never
860 modified.
861 .
862 .RE
863 .IP
864 The following actions are Nicira vendor extensions that, as of this writing, are
865 only known to be implemented by Open vSwitch:
866 .
867 .RS
868 .
869 .IP \fBresubmit\fB:\fIport\fR
870 .IQ \fBresubmit\fB(\fR[\fIport\fR]\fB,\fR[\fItable\fR]\fB)
871 Re-searches this OpenFlow flow table (or the table whose number is
872 specified by \fItable\fR) with the \fBin_port\fR field replaced by
873 \fIport\fR (if \fIport\fR is specified) and executes the actions
874 found, if any, in addition to any other actions in this flow entry.
875 .IP
876 Recursive \fBresubmit\fR actions are obeyed up to an
877 implementation-defined maximum depth.  Open vSwitch 1.0.1 and earlier
878 did not support recursion; Open vSwitch before 1.2.90 did not support
879 \fItable\fR.
880 .
881 .IP \fBset_tunnel\fB:\fIid\fR
882 .IQ \fBset_tunnel64\fB:\fIid\fR
883 If outputting to a port that encapsulates the packet in a tunnel and
884 supports an identifier (such as GRE), sets the identifier to \fIid\fR.
885 If the \fBset_tunnel\fR form is used and \fIid\fR fits in 32 bits,
886 then this uses an action extension that is supported by Open vSwitch
887 1.0 and later.  Otherwise, if \fIid\fR is a 64-bit value, it requires
888 Open vSwitch 1.1 or later.
889 .
890 .IP \fBset_queue\fB:\fIqueue\fR
891 Sets the queue that should be used to \fIqueue\fR when packets are
892 output.  The number of supported queues depends on the switch; some
893 OpenFlow implementations do not support queuing at all.
894 .
895 .IP \fBpop_queue\fR
896 Restores the queue to the value it was before any \fBset_queue\fR
897 actions were applied.
898 .
899 .IP \fBdec_ttl\fR
900 Decrement TTL of IPv4 packet or hop limit of IPv6 packet.  If the
901 TTL or hop limit is initially zero, no decrement occurs.  Instead,
902 a ``packet-in'' message with reason code \fBOFPR_INVALID_TTL\fR is
903 sent to each connected controller that has enabled receiving them,
904 if any.  Processing the current set of actions then stops.
905 However, if the current set of actions was reached through
906 ``resubmit'' then remaining actions in outer levels resume
907 processing.
908 .
909 .IP \fBnote:\fR[\fIhh\fR]...
910 Does nothing at all.  Any number of bytes represented as hex digits
911 \fIhh\fR may be included.  Pairs of hex digits may be separated by
912 periods for readability.
913 The \fBnote\fR action's format doesn't include an exact length for its
914 payload, so the provided bytes will be padded on the right by enough
915 bytes with value 0 to make the total number 6 more than a multiple of
916 8.
917 .
918 .IP "\fBmove:\fIsrc\fB[\fIstart\fB..\fIend\fB]\->\fIdst\fB[\fIstart\fB..\fIend\fB]\fR"
919 Copies the named bits from field \fIsrc\fR to field \fIdst\fR.
920 \fIsrc\fR and \fIdst\fR must be NXM field names as defined in
921 \fBnicira\-ext.h\fR, e.g. \fBNXM_OF_UDP_SRC\fR or \fBNXM_NX_REG0\fR.
922 Each \fIstart\fR and \fIend\fR pair, which are inclusive, must specify
923 the same number of bits and must fit within its respective field.
924 Shorthands for \fB[\fIstart\fB..\fIend\fB]\fR exist: use
925 \fB[\fIbit\fB]\fR to specify a single bit or \fB[]\fR to specify an
926 entire field.
927 .IP
928 Examples: \fBmove:NXM_NX_REG0[0..5]\->NXM_NX_REG1[26..31]\fR copies the
929 six bits numbered 0 through 5, inclusive, in register 0 into bits 26
930 through 31, inclusive;
931 \fBmove:NXM_NX_REG0[0..15]\->NXM_OF_VLAN_TCI[]\fR copies the least
932 significant 16 bits of register 0 into the VLAN TCI field.
933 .
934 .IP "\fBload:\fIvalue\fB\->\fIdst\fB[\fIstart\fB..\fIend\fB]"
935 Writes \fIvalue\fR to bits \fIstart\fR through \fIend\fR, inclusive,
936 in field \fIdst\fR.
937 .IP
938 Example: \fBload:55\->NXM_NX_REG2[0..5]\fR loads value 55 (bit pattern
939 \fB110111\fR) into bits 0 through 5, inclusive, in register 2.
940 .
941 .IP "\fBmultipath(\fIfields\fB, \fIbasis\fB, \fIalgorithm\fB, \fIn_links\fB, \fIarg\fB, \fIdst\fB[\fIstart\fB..\fIend\fB])\fR"
942 Hashes \fIfields\fR using \fIbasis\fR as a universal hash parameter,
943 then the applies multipath link selection \fIalgorithm\fR (with
944 parameter \fIarg\fR) to choose one of \fIn_links\fR output links
945 numbered 0 through \fIn_links\fR minus 1, and stores the link into
946 \fIdst\fB[\fIstart\fB..\fIend\fB]\fR, which must be an NXM field as
947 described above.
948 .IP
949 Currently, \fIfields\fR must be either \fBeth_src\fR or
950 \fBsymmetric_l4\fR and \fIalgorithm\fR must be one of \fBmodulo_n\fR,
951 \fBhash_threshold\fR, \fBhrw\fR, and \fBiter_hash\fR.  Only
952 the \fBiter_hash\fR algorithm uses \fIarg\fR.
953 .IP
954 Refer to \fBnicira\-ext.h\fR for more details.
955 .
956 .IP "\fBautopath(\fIid\fB, \fIdst\fB[\fIstart\fB..\fIend\fB])\fR"
957 Given \fIid\fR, chooses an OpenFlow port and populates it in
958 \fIdst\fB[\fIstart\fB..\fIend\fB]\fR, which must be an NXM field as
959 described above.
960 .IP
961 Currently, \fIid\fR should be the OpenFlow port number of an interface on the
962 bridge.  If it isn't then \fIdst\fB[\fIstart\fB..\fIend\fB]\fR will be
963 populated with the OpenFlow port "none".  If \fIid\fR is a member of a bond,
964 the normal bond selection logic will be used to choose the destination port.
965 Otherwise, the register will be populated with \fIid\fR itself.
966 .IP
967 Refer to \fBnicira\-ext.h\fR for more details.
968 .
969 .IP "\fBbundle(\fIfields\fB, \fIbasis\fB, \fIalgorithm\fB, \fIslave_type\fB, slaves:[\fIs1\fB, \fIs2\fB, ...])\fR"
970 Hashes \fIfields\fR using \fIbasis\fR as a universal hash parameter, then
971 applies the bundle link selection \fIalgorithm\fR to choose one of the listed
972 slaves represented as \fIslave_type\fR.  Currently the only supported
973 \fIslave_type\fR is \fBofport\fR.  Thus, each \fIs1\fR through \fIsN\fR should
974 be an OpenFlow port number. Outputs to the selected slave.
975 .IP
976 Currently, \fIfields\fR must be either \fBeth_src\fR or \fBsymmetric_l4\fR and
977 \fIalgorithm\fR must be one of \fBhrw\fR and \fBactive_backup\fR.
978 .IP
979 Example: \fBbundle(eth_src,0,hrw,ofport,slaves:4,8)\fR uses an Ethernet source
980 hash with basis 0, to select between OpenFlow ports 4 and 8 using the Highest
981 Random Weight algorithm.
982 .IP
983 Refer to \fBnicira\-ext.h\fR for more details.
984 .
985 .IP "\fBbundle_load(\fIfields\fB, \fIbasis\fB, \fIalgorithm\fB, \fIslave_type\fB, \fIdst\fB[\fIstart\fB..\fIend\fB], slaves:[\fIs1\fB, \fIs2\fB, ...])\fR"
986 Has the same behavior as the \fBbundle\fR action, with one exception.  Instead
987 of outputting to the selected slave, it writes its selection to
988 \fIdst\fB[\fIstart\fB..\fIend\fB]\fR, which must be an NXM field as described
989 above.
990 .IP
991 Example: \fBbundle_load(eth_src, 0, hrw, ofport, NXM_NX_REG0[],
992 slaves:4, 8)\fR uses an Ethernet source hash with basis 0, to select
993 between OpenFlow ports 4 and 8 using the Highest Random Weight
994 algorithm, and writes the selection to \fBNXM_NX_REG0[]\fR.
995 .IP
996 Refer to \fBnicira\-ext.h\fR for more details.
997 .
998 .IP "\fBlearn(\fIargument\fR[\fB,\fIargument\fR]...\fB)\fR"
999 This action adds or modifies a flow in an OpenFlow table, similar to
1000 \fBovs\-ofctl \-\-strict mod\-flows\fR.  The arguments specify the
1001 flow's match fields, actions, and other properties, as follows.  At
1002 least one match criterion and one action argument should ordinarily be
1003 specified.
1004 .RS
1005 .IP \fBidle_timeout=\fIseconds\fR
1006 .IQ \fBhard_timeout=\fIseconds\fR
1007 .IQ \fBpriority=\fIvalue\fR
1008 These key-value pairs have the same meaning as in the usual
1009 \fBovs\-ofctl\fR flow syntax.
1010 .
1011 .IP \fBfin_idle_timeout=\fIseconds\fR
1012 .IQ \fBfin_hard_timeout=\fIseconds\fR
1013 Adds a \fBfin_timeout\fR action with the specified arguments to the
1014 new flow.  This feature was added in Open vSwitch 1.5.90.
1015 .
1016 .IP \fBtable=\fInumber\fR
1017 The table in which the new flow should be inserted.  Specify a decimal
1018 number between 0 and 254.  The default, if \fBtable\fR is unspecified,
1019 is table 1.
1020 .
1021 .IP \fIfield\fB=\fIvalue\fR
1022 .IQ \fIfield\fB[\fIstart\fB..\fIend\fB]=\fIsrc\fB[\fIstart\fB..\fIend\fB]\fR
1023 .IQ \fIfield\fB[\fIstart\fB..\fIend\fB]\fR
1024 Adds a match criterion to the new flow.
1025 .IP
1026 The first form specifies that \fIfield\fR must match the literal
1027 \fIvalue\fR, e.g. \fBdl_type=0x0800\fR.  All of the fields and values
1028 for \fBovs\-ofctl\fR flow syntax are available with their usual
1029 meanings.
1030 .IP
1031 The second form specifies that \fIfield\fB[\fIstart\fB..\fIend\fB]\fR
1032 in the new flow must match \fIsrc\fB[\fIstart\fB..\fIend\fB]\fR taken
1033 from the flow currently being processed.
1034 .IP
1035 The third form is a shorthand for the second form.  It specifies that
1036 \fIfield\fB[\fIstart\fB..\fIend\fB]\fR in the new flow must match
1037 \fIfield\fB[\fIstart\fB..\fIend\fB]\fR taken from the flow currently
1038 being processed.
1039 .
1040 .IP \fBload:\fIvalue\fB\->\fIdst\fB[\fIstart\fB..\fIend\fB]
1041 .IQ \fBload:\fIsrc\fB[\fIstart\fB..\fIend\fB]\->\fIdst\fB[\fIstart\fB..\fIend\fB]
1042 .
1043 Adds a \fBload\fR action to the new flow.
1044 .IP
1045 The first form loads the literal \fIvalue\fR into bits \fIstart\fR
1046 through \fIend\fR, inclusive, in field \fIdst\fR.  Its syntax is the
1047 same as the \fBload\fR action described earlier in this section.
1048 .IP
1049 The second form loads \fIsrc\fB[\fIstart\fB..\fIend\fB]\fR, a value
1050 from the flow currently being processed, into bits \fIstart\fR
1051 through \fIend\fR, inclusive, in field \fIdst\fR.
1052 .
1053 .IP \fBoutput:\fIfield\fB[\fIstart\fB..\fIend\fB]\fR
1054 Add an \fBoutput\fR action to the new flow's actions, that outputs to
1055 the OpenFlow port taken from \fIfield\fB[\fIstart\fB..\fIend\fB]\fR,
1056 which must be an NXM field as described above.
1057 .RE
1058 .IP
1059 For best performance, segregate learned flows into a table (using
1060 \fBtable=\fInumber\fR) that is not used for any other flows except
1061 possibly for a lowest-priority ``catch-all'' flow, that is, a flow
1062 with no match criteria.  (This is why the default \fBtable\fR is 1, to
1063 keep the learned flows separate from the primary flow table 0.)
1064 .RE
1065 .
1066 .IP "\fBfin_timeout(\fIargument\fR[\fB,\fIargument\fR]\fB)"
1067 This action changes the idle timeout or hard timeout, or both, of this
1068 OpenFlow rule when the rule matches a TCP packet with the FIN or RST
1069 flag.  When such a packet is observed, the action reduces the rule's
1070 timeouts to those specified on the action.  If the rule's existing
1071 timeout is already shorter than the one that the action specifies,
1072 then that timeout is unaffected.
1073 .IP
1074 \fIargument\fR takes the following forms:
1075 .RS
1076 .IP "\fBidle_timeout=\fIseconds\fR"
1077 Causes the flow to expire after the given number of seconds of
1078 inactivity.
1079 .
1080 .IP "\fBhard_timeout=\fIseconds\fR"
1081 Causes the flow to expire after the given number of seconds,
1082 regardless of activity.  (\fIseconds\fR specifies time since the
1083 flow's creation, not since the receipt of the FIN or RST.)
1084 .RE
1085 .IP
1086 This action was added in Open vSwitch 1.5.90.
1087 .IP "\fBexit\fR"
1088 This action causes Open vSwitch to immediately halt execution of further
1089 actions.  Those actions which have already been executed are unaffected.  Any
1090 further actions, including those which may be in other tables, or different
1091 levels of the \fBresubmit\fR call stack, are ignored.
1092 .
1093 .PP
1094 An opaque identifier called a cookie can be used as a handle to identify
1095 a set of flows:
1096 .
1097 .IP \fBcookie=\fIvalue\fR[\fB/\fImask\fR]
1098 .
1099 A cookie can be associated with a flow using the \fBadd-flow\fR and
1100 \fBadd-flows\fR commands.  \fIvalue\fR can be any 64-bit number and need
1101 not be unique among flows.  If this field is omitted, a default cookie
1102 value of 0 is used.
1103 .IP
1104 When using NXM, the cookie can be used as a handle for querying,
1105 modifying, and deleting flows.  In addition to \fIvalue\fR, an optional
1106 \fImask\fR may be supplied for the \fBdel-flows\fR, \fBmod-flows\fR,
1107 \fBdump-flows\fR, and \fBdump-aggregate\fR commands to limit matching
1108 cookies.  A 1-bit in \fImask\fR indicates that the corresponding bit in
1109 \fIcookie\fR must match exactly, and a 0-bit wildcards that bit.
1110 .
1111 .PP
1112 The following additional field sets the priority for flows added by
1113 the \fBadd\-flow\fR and \fBadd\-flows\fR commands.  For
1114 \fBmod\-flows\fR and \fBdel\-flows\fR when \fB\-\-strict\fR is
1115 specified, priority must match along with the rest of the flow
1116 specification.  For \fBmod\-flows\fR without \fB\-\-strict\fR,
1117 priority is only significant if the command creates a new flow, that
1118 is, non-strict \fBmod\-flows\fR does not match on priority and will
1119 not change the priority of existing flows.  Other commands do not
1120 allow priority to be specified.
1121 .
1122 .IP \fBpriority=\fIvalue\fR
1123 The priority at which a wildcarded entry will match in comparison to
1124 others.  \fIvalue\fR is a number between 0 and 65535, inclusive.  A higher 
1125 \fIvalue\fR will match before a lower one.  An exact-match entry will always 
1126 have priority over an entry containing wildcards, so it has an implicit 
1127 priority value of 65535.  When adding a flow, if the field is not specified, 
1128 the flow's priority will default to 32768.
1129 .IP
1130 OpenFlow leaves behavior undefined when two or more flows with the
1131 same priority can match a single packet.  Some users expect
1132 ``sensible'' behavior, such as more specific flows taking precedence
1133 over less specific flows, but OpenFlow does not specify this and Open
1134 vSwitch does not implement it.  Users should therefore take care to
1135 use priorities to ensure the behavior that they expect.
1136 .
1137 .PP
1138 The \fBadd\-flow\fR, \fBadd\-flows\fR, and \fBmod\-flows\fR commands
1139 support the following additional options.  These options affect only
1140 new flows.  Thus, for \fBadd\-flow\fR and \fBadd\-flows\fR, these
1141 options are always significant, but for \fBmod\-flows\fR they are
1142 significant only if the command creates a new flow, that is, their
1143 values do not update or affect existing flows.
1144 .
1145 .IP "\fBidle_timeout=\fIseconds\fR"
1146 Causes the flow to expire after the given number of seconds of
1147 inactivity.  A value of 0 (the default) prevents a flow from expiring
1148 due to inactivity.
1149 .
1150 .IP \fBhard_timeout=\fIseconds\fR
1151 Causes the flow to expire after the given number of seconds,
1152 regardless of activity.  A value of 0 (the default) gives the flow no
1153 hard expiration deadline.
1154 .
1155 .IP "\fBsend_flow_rem\fR"
1156 Marks the flow with a flag that causes the switch to generate a ``flow
1157 removed'' message and send it to interested controllers when the flow
1158 later expires or is removed.
1159 .
1160 .IP "\fBcheck_overlap\fR"
1161 Forces the switch to check that the flow match does not overlap that
1162 of any different flow with the same priority in the same table.  (This
1163 check is expensive so it is best to avoid it.)
1164 .
1165 .PP
1166 The \fBdump\-flows\fR, \fBdump\-aggregate\fR, \fBdel\-flow\fR 
1167 and \fBdel\-flows\fR commands support one additional optional field:
1168 .
1169 .TP
1170 \fBout_port=\fIport\fR
1171 If set, a matching flow must include an output action to \fIport\fR.
1172 .
1173 .SS "Table Entry Output"
1174 .
1175 The \fBdump\-tables\fR and \fBdump\-aggregate\fR commands print information 
1176 about the entries in a datapath's tables.  Each line of output is a 
1177 flow entry as described in \fBFlow Syntax\fR, above, plus some
1178 additional fields:
1179 .
1180 .IP \fBduration=\fIsecs\fR
1181 The time, in seconds, that the entry has been in the table.
1182 \fIsecs\fR includes as much precision as the switch provides, possibly
1183 to nanosecond resolution.
1184 .
1185 .IP \fBn_packets\fR
1186 The number of packets that have matched the entry.
1187 .
1188 .IP \fBn_bytes\fR
1189 The total number of bytes from packets that have matched the entry.
1190 .
1191 .PP
1192 The following additional fields are included only if the switch is
1193 Open vSwitch 1.6 or later and the NXM flow format is used to dump the
1194 flow (see the description of the \fB\-\-flow-format\fR option below).
1195 The values of these additional fields are approximations only and in
1196 particular \fBidle_age\fR will sometimes become nonzero even for busy
1197 flows.
1198 .
1199 .IP \fBhard_age=\fIsecs\fR
1200 The integer number of seconds since the flow was added or modified.
1201 \fBhard_age\fR is displayed only if it differs from the integer part
1202 of \fBduration\fR.  (This is separate from \fBduration\fR because
1203 \fBmod\-flows\fR restarts the \fBhard_timeout\fR timer without zeroing
1204 \fBduration\fR.)
1205 .
1206 .IP \fBidle_age=\fIsecs\fR
1207 The integer number of seconds that have passed without any packets
1208 passing through the flow.
1209 .
1210 .SH OPTIONS
1211 .TP
1212 \fB\-\-strict\fR
1213 Uses strict matching when running flow modification commands.
1214 .
1215 .IP "\fB\-F \fIformat\fR[\fB,\fIformat\fR...]"
1216 .IQ "\fB\-\-flow\-format=\fIformat\fR[\fB,\fIformat\fR...]"
1217 \fBovs\-ofctl\fR supports the following individual flow formats, any
1218 number of which may be listed as \fIformat\fR:
1219 .RS
1220 .IP "\fBOpenFlow10\-table_id\fR"
1221 This is the standard OpenFlow 1.0 flow format.  All OpenFlow switches
1222 and all versions of Open vSwitch support this flow format.
1223 .
1224 .IP "\fBOpenFlow10+table_id\fR"
1225 This is the standard OpenFlow 1.0 flow format plus a Nicira extension
1226 that allows \fBovs\-ofctl\fR to specify the flow table in which a
1227 particular flow should be placed.  Open vSwitch 1.2 and later supports
1228 this flow format.
1229 .
1230 .IP "\fBNXM\-table_id\fR (Nicira Extended Match)"
1231 This Nicira extension to OpenFlow is flexible and extensible.  It
1232 supports all of the Nicira flow extensions, such as \fBtun_id\fR and
1233 registers.  Open vSwitch 1.1 and later supports this flow format.
1234 .
1235 .IP "\fBNXM+table_id\fR (Nicira Extended Match)"
1236 This combines Nicira Extended match with the ability to place a flow
1237 in a specific table.  Open vSwitch 1.2 and later supports this flow
1238 format.
1239 .RE
1240 .
1241 .IP
1242 \fBovs\-ofctl\fR also supports the following abbreviations for
1243 collections of flow formats:
1244 .RS
1245 .IP "\fBany\fR"
1246 Any supported flow format.
1247 .IP "\fBOpenFlow10\fR"
1248 \fBOpenFlow10\-table_id\fR or \fBOpenFlow10+table_id\fR.
1249 .IP "\fBNXM\fR"
1250 \fBNXM\-table_id\fR or \fBNXM+table_id\fR.
1251 .RE
1252 .
1253 .IP
1254 For commands that modify the flow table, \fBovs\-ofctl\fR by default
1255 negotiates the most widely supported flow format that supports the
1256 flows being added.  For commands that query the flow table,
1257 \fBovs\-ofctl\fR by default uses the most advanced format supported by
1258 the switch.
1259 .IP
1260 This option, where \fIformat\fR is a comma-separated list of one or
1261 more of the formats listed above, limits \fBovs\-ofctl\fR's choice of
1262 flow format.  If a command cannot work as requested using one of the
1263 specified flow formats, \fBovs\-ofctl\fR will report a fatal error.
1264 .
1265 .IP "\fB\-P \fIformat\fR"
1266 .IQ "\fB\-\-packet\-in\-format=\fIformat\fR"
1267 \fBovs\-ofctl\fR supports the following packet_in formats, in order of
1268 increasing capability:
1269 .RS
1270 .IP "\fBopenflow10\fR"
1271 This is the standard OpenFlow 1.0 packet in format. It should be supported by
1272 all OpenFlow switches.
1273 .
1274 .IP "\fBnxm\fR (Nicira Extended Match)"
1275 This packet_in format includes flow metadata encoded using the NXM format.
1276 .
1277 .RE
1278 .IP
1279 Usually, \fBovs\-ofctl\fR prefers the \fBnxm\fR packet_in format, but will
1280 allow the switch to choose its default if \fBnxm\fR is unsupported.  When
1281 \fIformat\fR is one of the formats listed in the above table, \fBovs\-ofctl\fR
1282 will insist on the selected format.  If the switch does not support the
1283 requested format, \fBovs\-ofctl\fR will report a fatal error.  This option only
1284 affects the \fBmonitor\fR command.
1285 .
1286 .IP "\fB\-\-timestamp\fR"
1287 Print a timestamp before each received packet.  This option only
1288 affects the \fBmonitor\fR and \fBsnoop\fR commands.
1289 .
1290 .IP "\fB\-m\fR"
1291 .IQ "\fB\-\-more\fR"
1292 Increases the verbosity of OpenFlow messages printed and logged by
1293 \fBovs\-ofctl\fR commands.  Specify this option more than once to
1294 increase verbosity further.
1295 .
1296 .ds DD \
1297 \fBovs\-ofctl\fR detaches only when executing the \fBmonitor\fR or \
1298 \fBsnoop\fR commands.
1299 .so lib/daemon.man
1300 .SS "Public Key Infrastructure Options"
1301 .so lib/ssl.man
1302 .so lib/vlog.man
1303 .so lib/common.man
1304 .
1305 .SH "RUNTIME MANAGEMENT COMMANDS"
1306 \fBovs\-appctl\fR(8) can send commands to a running \fBovs\-ofctl\fR
1307 process.  The supported commands are listed below.
1308 .
1309 .IP "\fBexit\fR"
1310 Causes \fBovs\-ofctl\fR to gracefully terminate.  This command applies
1311 only when executing the \fBmonitor\fR or \fBsnoop\fR commands.
1312 .
1313 .IP "\fBofctl/set\-output\-file \fIfile\fR"
1314 Causes all subsequent output to go to \fIfile\fR instead of stderr.
1315 This command applies only when executing the \fBmonitor\fR or
1316 \fBsnoop\fR commands.
1317 .
1318 .IP "\fBofctl/send \fIofmsg\fR..."
1319 Sends each \fIofmsg\fR, specified as a sequence of hex digits that
1320 express an OpenFlow message, on the OpenFlow connection.  This command
1321 is useful only when executing the \fBmonitor\fR command.
1322 .
1323 .IP "\fBofctl/barrier\fR"
1324 Sends an OpenFlow barrier request on the OpenFlow connection and waits
1325 for a reply.  This command is useful only for the \fBmonitor\fR
1326 command.
1327 .
1328 .SH EXAMPLES
1329 .
1330 The following examples assume that \fBovs\-vswitchd\fR has a bridge
1331 named \fBbr0\fR configured.
1332 .
1333 .TP
1334 \fBovs\-ofctl dump\-tables br0\fR
1335 Prints out the switch's table stats.  (This is more interesting after
1336 some traffic has passed through.)
1337 .
1338 .TP
1339 \fBovs\-ofctl dump\-flows br0\fR
1340 Prints the flow entries in the switch.
1341 .
1342 .SH "SEE ALSO"
1343 .
1344 .BR ovs\-appctl (8),
1345 .BR ovs\-controller (8),
1346 .BR ovs\-vswitchd (8)