summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2015-12-21 14:57:36 -0800
committerPravin B Shelar <pshelar@nicira.com>2015-12-21 15:24:32 -0800
commit60642e4fa9b53edbc924ebc22aadbc7696b57407 (patch)
tree7ca0c50018e9237c2404d15c833ac633f651b8ca /datapath
parent554c64b092505fdcf058cda24886b538558c5eae (diff)
downloadopenvswitch-60642e4fa9b53edbc924ebc22aadbc7696b57407.tar.gz
datapath: Backport: openvswitch: Fix serialization of non-masked set actions.
I found this missing commit while checking diff against upstream OVS. Upstream Commit msg: Set actions consist of a regular OVS_KEY_ATTR_* attribute nested inside of a OVS_ACTION_ATTR_SET action attribute. When converting masked actions back to regular set actions, the inner attribute length was not changed, ie, double the length being serialized. This patch fixes the bug. Fixes: 83d2b9b ("net: openvswitch: Support masked set actions.") Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: f4f8e738505 ("openvswitch: Fix serialization of non-masked set actions") Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Joe Stringer <joe@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/flow_netlink.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 8df5c69b5..6ffcc53ea 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -2412,14 +2412,20 @@ static int masked_set_action_to_set_action_attr(const struct nlattr *a,
struct sk_buff *skb)
{
const struct nlattr *ovs_key = nla_data(a);
+ struct nlattr *nla;
size_t key_len = nla_len(ovs_key) / 2;
/* Revert the conversion we did from a non-masked set action to
* masked set action.
*/
- if (nla_put(skb, OVS_ACTION_ATTR_SET, nla_len(a) - key_len, ovs_key))
+ nla = nla_nest_start(skb, OVS_ACTION_ATTR_SET);
+ if (!nla)
return -EMSGSIZE;
+ if (nla_put(skb, nla_type(ovs_key), key_len, nla_data(ovs_key)))
+ return -EMSGSIZE;
+
+ nla_nest_end(skb, nla);
return 0;
}