Commit 804fe108 authored by Yifeng Sun's avatar Yifeng Sun Committed by David S. Miller

openvswitch: Use correct reply values in datapath and vport ops

This patch fixes the bug that all datapath and vport ops are returning
wrong values (OVS_FLOW_CMD_NEW or OVS_DP_CMD_NEW) in their replies.
Signed-off-by: default avatarYifeng Sun <pkusunyifeng@gmail.com>
Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 80ece6a0
...@@ -1182,14 +1182,14 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info) ...@@ -1182,14 +1182,14 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
ovs_header->dp_ifindex, ovs_header->dp_ifindex,
reply, info->snd_portid, reply, info->snd_portid,
info->snd_seq, 0, info->snd_seq, 0,
OVS_FLOW_CMD_NEW, OVS_FLOW_CMD_SET,
ufid_flags); ufid_flags);
BUG_ON(error < 0); BUG_ON(error < 0);
} }
} else { } else {
/* Could not alloc without acts before locking. */ /* Could not alloc without acts before locking. */
reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex, reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex,
info, OVS_FLOW_CMD_NEW, false, info, OVS_FLOW_CMD_SET, false,
ufid_flags); ufid_flags);
if (IS_ERR(reply)) { if (IS_ERR(reply)) {
...@@ -1265,7 +1265,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info) ...@@ -1265,7 +1265,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
} }
reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex, info, reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex, info,
OVS_FLOW_CMD_NEW, true, ufid_flags); OVS_FLOW_CMD_GET, true, ufid_flags);
if (IS_ERR(reply)) { if (IS_ERR(reply)) {
err = PTR_ERR(reply); err = PTR_ERR(reply);
goto unlock; goto unlock;
...@@ -1389,7 +1389,7 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1389,7 +1389,7 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
if (ovs_flow_cmd_fill_info(flow, ovs_header->dp_ifindex, skb, if (ovs_flow_cmd_fill_info(flow, ovs_header->dp_ifindex, skb,
NETLINK_CB(cb->skb).portid, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh->nlmsg_seq, NLM_F_MULTI,
OVS_FLOW_CMD_NEW, ufid_flags) < 0) OVS_FLOW_CMD_GET, ufid_flags) < 0)
break; break;
cb->args[0] = bucket; cb->args[0] = bucket;
...@@ -1730,7 +1730,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info) ...@@ -1730,7 +1730,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
ovs_dp_change(dp, info->attrs); ovs_dp_change(dp, info->attrs);
err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
info->snd_seq, 0, OVS_DP_CMD_NEW); info->snd_seq, 0, OVS_DP_CMD_SET);
BUG_ON(err < 0); BUG_ON(err < 0);
ovs_unlock(); ovs_unlock();
...@@ -1761,7 +1761,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) ...@@ -1761,7 +1761,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
goto err_unlock_free; goto err_unlock_free;
} }
err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
info->snd_seq, 0, OVS_DP_CMD_NEW); info->snd_seq, 0, OVS_DP_CMD_GET);
BUG_ON(err < 0); BUG_ON(err < 0);
ovs_unlock(); ovs_unlock();
...@@ -1785,7 +1785,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1785,7 +1785,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
if (i >= skip && if (i >= skip &&
ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh->nlmsg_seq, NLM_F_MULTI,
OVS_DP_CMD_NEW) < 0) OVS_DP_CMD_GET) < 0)
break; break;
i++; i++;
} }
...@@ -2101,7 +2101,7 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) ...@@ -2101,7 +2101,7 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
info->snd_portid, info->snd_seq, 0, info->snd_portid, info->snd_seq, 0,
OVS_VPORT_CMD_NEW); OVS_VPORT_CMD_SET);
BUG_ON(err < 0); BUG_ON(err < 0);
ovs_unlock(); ovs_unlock();
...@@ -2182,7 +2182,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info) ...@@ -2182,7 +2182,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
goto exit_unlock_free; goto exit_unlock_free;
err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info), err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
info->snd_portid, info->snd_seq, 0, info->snd_portid, info->snd_seq, 0,
OVS_VPORT_CMD_NEW); OVS_VPORT_CMD_GET);
BUG_ON(err < 0); BUG_ON(err < 0);
rcu_read_unlock(); rcu_read_unlock();
...@@ -2218,7 +2218,7 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -2218,7 +2218,7 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
NETLINK_CB(cb->skb).portid, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, cb->nlh->nlmsg_seq,
NLM_F_MULTI, NLM_F_MULTI,
OVS_VPORT_CMD_NEW) < 0) OVS_VPORT_CMD_GET) < 0)
goto out; goto out;
j++; j++;
......
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