Looks good. Acked-by: Jarno Rajahalme <[email protected]>
On Oct 8, 2013, at 1:00 PM, Ben Pfaff <[email protected]> wrote: > On Tue, Oct 08, 2013 at 12:41:11PM -0700, Jarno Rajahalme wrote: >> Ben Pfaff <[email protected]> wrote: >> >>> 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 <[email protected]> >>> Signed-off-by: Ben Pfaff <[email protected]> >>> >>> --- >>> 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); >>> } >>> >> >> The check would seem more proper after the ODP port number has been >> translated to an OFP one, right after odp_port_to_ofp_port(). > > Thanks for the review. > > In OVS 1.9, there was barely any difference between ODP and OpenFlow > port numbers, so this code should work. But I agree that checking the > OpenFlow port number is more conceptually correct. > > How about this version? > > --8<--------------------------cut here-------------------------->8-- > > From: Ben Pfaff <[email protected]> > Date: Tue, 8 Oct 2013 12:57:40 -0700 > Subject: [PATCH] ofproto-dpif: Better tolerate running out of ports. > > 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 <[email protected]> > Signed-off-by: Ben Pfaff <[email protected]> > --- > ofproto/ofproto-dpif.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c > index 173eb5a..fa639a6 100644 > --- a/ofproto/ofproto-dpif.c > +++ b/ofproto/ofproto-dpif.c > @@ -2547,6 +2547,11 @@ port_add(struct ofproto *ofproto_, struct netdev > *netdev, uint16_t *ofp_portp) > error = dpif_port_add(ofproto->dpif, netdev, &odp_port); > if (!error) { > *ofp_portp = odp_port_to_ofp_port(odp_port); > + if (*ofp_portp >= OFPP_MAX) { > + /* Out of ports in the OpenFlow range. */ > + dpif_port_del(ofproto->dpif, odp_port); > + error = EFBIG; > + } > } > return error; > } > -- > 1.7.10.4 > _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
