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