Commit f4f8e738 authored by Joe Stringer's avatar Joe Stringer Committed by David S. Miller

openvswitch: Fix serialization of non-masked set actions.

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: 83d2b9ba ("net: openvswitch: Support masked set actions.")
Signed-off-by: default avatarJoe Stringer <joestringer@nicira.com>
Acked-by: default avatarJarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0ae93b2c
...@@ -2253,14 +2253,20 @@ static int masked_set_action_to_set_action_attr(const struct nlattr *a, ...@@ -2253,14 +2253,20 @@ static int masked_set_action_to_set_action_attr(const struct nlattr *a,
struct sk_buff *skb) struct sk_buff *skb)
{ {
const struct nlattr *ovs_key = nla_data(a); const struct nlattr *ovs_key = nla_data(a);
struct nlattr *nla;
size_t key_len = nla_len(ovs_key) / 2; size_t key_len = nla_len(ovs_key) / 2;
/* Revert the conversion we did from a non-masked set action to /* Revert the conversion we did from a non-masked set action to
* masked set action. * 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; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment