[ovs-dev] [PATCH branch-1.9] ofproto-dpif: Better tolerate running out of ports.
Ben Pfaff
blp at nicira.com
Tue Jul 16 18:27:41 UTC 2013
The dpif interface supports 65536 ports, but OpenFlow 1.0 supports fewer,
so ofproto-dpif needs to filter out port numbers larger than OF1.0 supports
and report an error to the caller.
Reported-by: Hiroshi Tanaka <htanaka at vmware.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
ofproto/ofproto-dpif.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index ce2ae7f..fcca99b 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -2545,6 +2545,11 @@ port_add(struct ofproto *ofproto_, struct netdev *netdev, uint16_t *ofp_portp)
int error;
error = dpif_port_add(ofproto->dpif, netdev, &odp_port);
+ if (!error && odp_port >= OFPP_MAX) {
+ /* Out of ports in the OpenFlow range. */
+ dpif_port_del(ofproto->dpif, odp_port);
+ error = EFBIG;
+ }
if (!error) {
*ofp_portp = odp_port_to_ofp_port(odp_port);
}
--
1.7.2.5
More information about the dev
mailing list