[ovs-dev] [PATCH 2/3] ofp-errors: Use OFPERR_OFPBRC_BAD_PORT

Simon Horman horms at verge.net.au
Thu Sep 6 02:15:31 UTC 2012


On Wed, Sep 05, 2012 at 10:28:22AM -0700, Ben Pfaff wrote:
> On Wed, Sep 05, 2012 at 11:50:37AM +0900, Simon Horman wrote:
> > * In the case of OpenFlow 1.2+ OFPERR_OFPBRC_BAD_PORT is defined
> >   in the specification and seems to be the most appropriate error
> >   to use when an invalid port is encountered in a Packet Out request.
> > 
> > * In the case of OpenFlow 1.0 and 1.1 no appropriate error message
> >   seems to exist. Perhaps because an invalid port is not possible?
> >   I'm unsure.
> > 
> >   In any case, make use of a non-standard error code (1,514).
> >   This was formerly known as OFPERR_NXBRC_BAD_IN_PORT but
> >   has been rolled into OFPERR_NXBRC_BAD_IN_PORT to allow the
> >   latter to be used without concern for the prevailing Open Flow version.
> > 
> > Signed-off-by: Simon Horman <horms at verge.net.au>
> 
> I noticed that this added OF1.0(1,514) as a standard error code when
> it's clearly an extension (e.g. NX1.0(1,514)) and extract-ofp-errors
> didn't complain.  So I did s/OF/NX/ in a couple of places and then
> added the following commit to prevent these errors in the future:

Thanks, sorry for the mix-up.

> --8<--------------------------cut here-------------------------->8--
> 
> From: Ben Pfaff <blp at nicira.com>
> Date: Wed, 5 Sep 2012 10:18:56 -0700
> Subject: [PATCH] extract-ofp-errors: Check that error codes are in the expected ranges.
> 
> All real OpenFlow error codes are small numbers, and for Nicira extensions
> we've intentionally chosen large numbers.  This commit adds a check that
> standard and extension codes are properly designated in the ofp-errors.h
> header.
> 
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  build-aux/extract-ofp-errors |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors
> index bd4ab9e..db28af8 100755
> --- a/build-aux/extract-ofp-errors
> +++ b/build-aux/extract-ofp-errors
> @@ -238,6 +238,11 @@ def extract_ofp_errors(filenames):
>                                "NX1.2":  ("OF1.2",)}
>                  if targets not in target_map:
>                      fatal("%s: unknown error domain" % targets)
> +                if targets.startswith('NX') and code < 0x100:
> +                    fatal("%s: NX domain code cannot be less than 0x100" % dst)
> +                if targets.startswith('OF') and code >= 0x100:
> +                    fatal("%s: OF domain code cannot be greater than 0x100"
> +                          % dst)
>                  for target in target_map[targets]:
>                      domain[target].setdefault(type_, {})
>                      if code in domain[target][type_]:
> -- 
> 1.7.2.5
> 
> I applied it, with that change.
> 



More information about the dev mailing list