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