Message ID | 1619505706-19876-1-git-send-email-wangyunjian@huawei.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] bridge: fix type mismatch | expand |
Friendly ping > -----Original Message----- > From: wangyunjian > Sent: Tuesday, April 27, 2021 2:42 PM > To: dev@openvswitch.org; i.maximets@ovn.org > Cc: dingxiaoxiong <dingxiaoxiong@huawei.com>; wangyunjian > <wangyunjian@huawei.com> > Subject: [ovs-dev] [PATCH] bridge: fix type mismatch > > From: Yunjian Wang <wangyunjian@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@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
Applied, thanks. On Wed, Jun 23, 2021 at 10:47:16AM +0000, wangyunjian wrote: > Friendly ping > > > -----Original Message----- > > From: wangyunjian > > Sent: Tuesday, April 27, 2021 2:42 PM > > To: dev@openvswitch.org; i.maximets@ovn.org > > Cc: dingxiaoxiong <dingxiaoxiong@huawei.com>; wangyunjian > > <wangyunjian@huawei.com> > > Subject: [ovs-dev] [PATCH] bridge: fix type mismatch > > > > From: Yunjian Wang <wangyunjian@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@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 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
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),