2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ofproto: Limit OVS-assigned port numbers to 32767 and below.

A couple of controller vendors have mentioned to me that they would like to
have some part of the OpenFlow port number space reserved for the
controller to use.  This commit reserves 32768 and up (roughly the upper
half of the OF1.0 port range) to the controller.

Bug #18753.
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2013-11-06 16:12:34 -08:00
parent 9f5bbb005c
commit 484c8355de
3 changed files with 56 additions and 28 deletions

3
NEWS
View File

@@ -6,6 +6,9 @@ Post-v2.0.0
defaults. defaults.
- OpenFlow: - OpenFlow:
* The OpenFlow 1.1+ "Write-Actions" instruction is now supported. * The OpenFlow 1.1+ "Write-Actions" instruction is now supported.
* OVS limits the OpenFlow port numbers it assigns to port 32767 and
below, leaving port numbers above that range free for assignment
by the controller.
- ovs-vswitchd.conf.db.5 man page will contain graphviz/dot - ovs-vswitchd.conf.db.5 man page will contain graphviz/dot
diagram only if graphviz package was installed at the build time. diagram only if graphviz package was installed at the build time.
- Support for Linux kernels up to 3.11 - Support for Linux kernels up to 3.11

View File

@@ -2004,9 +2004,13 @@ alloc_ofp_port(struct ofproto *ofproto, const char *netdev_name)
/* Search for a free OpenFlow port number. We try not to /* Search for a free OpenFlow port number. We try not to
* immediately reuse them to prevent problems due to old * immediately reuse them to prevent problems due to old
* flows. */ * flows.
*
* We limit the automatically assigned port numbers to the lower half
* of the port range, to reserve the upper half for assignment by
* controllers. */
for (;;) { for (;;) {
if (++ofproto->alloc_port_no >= ofproto->max_ports) { if (++ofproto->alloc_port_no >= MIN(ofproto->max_ports, 32768)) {
ofproto->alloc_port_no = 1; ofproto->alloc_port_no = 1;
} }
last_used_at = ofport_get_usage(ofproto, last_used_at = ofport_get_usage(ofproto,

View File

@@ -1254,33 +1254,54 @@
address.</p> address.</p>
</column> </column>
<column name="ofport"> <group title="OpenFlow Port Number">
<p>OpenFlow port number for this interface. Unlike most columns, this <p>
column's value should be set only by Open vSwitch itself. Other When a client adds a new interface, Open vSwitch chooses an OpenFlow
clients should set this column to an empty set (the default) when port number for the new port. If the client that adds the port fills
creating an <ref table="Interface"/>.</p> in <ref column="ofport_request"/>, then Open vSwitch tries to use its
<p>Open vSwitch populates this column when the port number becomes value as the OpenFlow port number. Otherwise, or if the requested
known. If the interface is successfully added, port number is already in use or cannot be used for another reason,
<ref column="ofport"/> will be set to a number between 1 and 65535 Open vSwitch automatically assigns a free port number. Regardless of
(generally either in the range 1 to 65279, inclusive, or 65534, the how the port number was obtained, Open vSwitch then reports in <ref
port number for the OpenFlow ``local port''). If the interface column="ofport"/> the port number actually assigned.
cannot be added then Open vSwitch sets this column </p>
to -1.</p>
<p>When <ref column="ofport_request"/> is not set, Open vSwitch picks
an appropriate value for this column and then tries to keep the value
constant across restarts.</p>
</column>
<column name="ofport_request"> <p>
<p>Requested OpenFlow port number for this interface. The port Open vSwitch limits the port numbers that it automatically assigns to
number must be between 1 and 65279, inclusive. Some datapaths the range 1 through 32,767, inclusive. Controllers therefore have
cannot satisfy all requests for particular port numbers. When free use of ports 32,768 and up.
this column is empty or the request cannot be fulfilled, the </p>
system will choose a free port. The <ref column="ofport"/>
column reports the assigned OpenFlow port number.</p> <column name="ofport">
<p>The port number must be requested in the same transaction <p>
that creates the port.</p> OpenFlow port number for this interface. Open vSwitch sets this
</column> column's value, so other clients should treat it as read-only.
</p>
<p>
The OpenFlow ``local'' port (<code>OFPP_LOCAL</code>) is 65,534.
The other valid port numbers are in the range 1 to 65,279,
inclusive. Value -1 indicates an error adding the interface.
</p>
</column>
<column name="ofport_request"
type='{"type": "integer", "minInteger": 1, "maxInteger": 65279}'>
<p>
Requested OpenFlow port number for this interface.
</p>
<p>
Open vSwitch currently assigns the OpenFlow port number for an
interface once, when the client first adds the interface. It does
not change the port number later if the client sets or changes or
clears <ref column="ofport_request"/>. Therefore, to ensure that
<ref column="ofport_request"/> takes effect, the client should set
it in the same database transaction that creates the interface.
(Future versions of Open vSwitch might honor changes to <ref
column="ofport_request"/>.)
</p>
</column>
</group>
</group> </group>
<group title="System-Specific Details"> <group title="System-Specific Details">