[ovs-dev] [PATCH] bridge: fix type mismatch

wangyunjian wangyunjian at huawei.com
Wed Jun 23 10:47:16 UTC 2021


Friendly ping

> -----Original Message-----
> From: wangyunjian
> Sent: Tuesday, April 27, 2021 2:42 PM
> To: dev at openvswitch.org; i.maximets at ovn.org
> Cc: dingxiaoxiong <dingxiaoxiong at huawei.com>; wangyunjian
> <wangyunjian at huawei.com>
> Subject: [ovs-dev] [PATCH] bridge: fix type mismatch
> 
> From: Yunjian Wang <wangyunjian at huawei.com>
> 
> Currently the function ofproto_set_flow_limit() was not checking
> 'limit' value. It maybe negative, which will be lead to a big
> unsigned value. The 'limit' should never be negative so it's better
> to just use smap_get_uint() to get it right.
> 
> And fix ofproto_set_max_idle(), ofproto_set_min_revalidate_pps(),
> ofproto_set_max_revalidator() and ofproto_set_bundle_idle_timeout()
> together.
> 
> Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
> ---
>  vswitchd/bridge.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 5ed7e8234..985e05099 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -822,19 +822,19 @@ bridge_reconfigure(const struct
> ovsrec_open_vswitch *ovs_cfg)
> 
>      COVERAGE_INC(bridge_reconfigure);
> 
> -    ofproto_set_flow_limit(smap_get_int(&ovs_cfg->other_config,
> "flow-limit",
> +    ofproto_set_flow_limit(smap_get_uint(&ovs_cfg->other_config,
> "flow-limit",
> 
> OFPROTO_FLOW_LIMIT_DEFAULT));
> -    ofproto_set_max_idle(smap_get_int(&ovs_cfg->other_config,
> "max-idle",
> +    ofproto_set_max_idle(smap_get_uint(&ovs_cfg->other_config,
> "max-idle",
> 
> OFPROTO_MAX_IDLE_DEFAULT));
> -    ofproto_set_max_revalidator(smap_get_int(&ovs_cfg->other_config,
> +    ofproto_set_max_revalidator(smap_get_uint(&ovs_cfg->other_config,
>                                               "max-revalidator",
> 
> OFPROTO_MAX_REVALIDATOR_DEFAULT));
>      ofproto_set_min_revalidate_pps(
> -        smap_get_int(&ovs_cfg->other_config, "min-revalidate-pps",
> +        smap_get_uint(&ovs_cfg->other_config, "min-revalidate-pps",
>                       OFPROTO_MIN_REVALIDATE_PPS_DEFAULT));
>      ofproto_set_vlan_limit(smap_get_int(&ovs_cfg->other_config,
> "vlan-limit",
> 
> LEGACY_MAX_VLAN_HEADERS));
> -
> ofproto_set_bundle_idle_timeout(smap_get_int(&ovs_cfg->other_config,
> +
> ofproto_set_bundle_idle_timeout(smap_get_uint(&ovs_cfg->other_config,
> 
> "bundle-idle-timeout", 0));
>      ofproto_set_threads(
>          smap_get_int(&ovs_cfg->other_config, "n-handler-threads", 0),
> --
> 2.18.1



More information about the dev mailing list