Ben Pfaff <b...@nicira.com> 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 <htan...@vmware.com>
> Signed-off-by: Ben Pfaff <b...@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);
>      }
> 

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().

  Jarno

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to