> Commit 33ab38d9 (meta-flow: Simplify mf_from_ofp_port_string())
> inadvertently removed a check for minus sign at the beginning of a
> port number string introduced by commit 05dddba (meta-flow: Don't
> allow negative port numbers).  This check is still needed, so put it
> back, but to ofputil_port_from_string() this time.
> 
> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>

Reviewed-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>

> ---
>  lib/ofp-util.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index af2d853..a990f46 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -5394,8 +5394,12 @@ ofputil_port_to_ofp11(ofp_port_t ofp10_port)
>  bool
>  ofputil_port_from_string(const char *s, ofp_port_t *portp)
>  {
> -    uint32_t port32;
> +    unsigned int port32; /* int is at least 32 bits wide. */
>  
> +    if (*s == '-') {
> +        VLOG_WARN("Negative values are not supported as port numbers.");
> +        return false;
> +    }
>      *portp = 0;
>      if (str_to_uint(s, 10, &port32)) {
>          if (port32 < ofp_to_u16(OFPP_MAX)) {
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to