From: Andy Zhou Date: Thu, 20 Jun 2013 23:36:04 +0000 (-0700) Subject: datapath: Return EEXIST on overlapping new flow request X-Git-Tag: sliver-openvswitch-1.10.90-3~6^2~79 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=b21e5b6adaf6f875982053c6de26d7eef99a426b;p=sliver-openvswitch.git datapath: Return EEXIST on overlapping new flow request Flow update still requires unmasked key to match. If not, return EINVAL. CC: Justin Pettit Signed-off-by: Andy Zhou Signed-off-by: Jesse Gross --- diff --git a/datapath/datapath.c b/datapath/datapath.c index ee3d5e4d4..a514e7483 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1343,12 +1343,6 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info) /* We found a matching flow. */ struct sw_flow_actions *old_acts; - /* Make sure the it has the same unmasked key. */ - if (!ovs_flow_cmp_unmasked_key(flow, &key, match.range.end)) { - error = -EINVAL; - goto err_unlock_ovs; - } - /* Bail out if we're not allowed to modify an existing flow. * We accept NLM_F_CREATE in place of the intended NLM_F_EXCL * because Generic Netlink treats the latter as a dump @@ -1360,6 +1354,11 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info) info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_EXCL)) goto err_unlock_ovs; + /* The unmasked key has to be the same for flow updates. */ + error = -EINVAL; + if (!ovs_flow_cmp_unmasked_key(flow, &key, match.range.end)) + goto err_unlock_ovs; + /* Update actions. */ old_acts = ovsl_dereference(flow->sf_acts); rcu_assign_pointer(flow->sf_acts, acts);