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