Skip to content

Commit

Permalink
datapath: Use correct reply values in datapath and vport ops
Browse files Browse the repository at this point in the history
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.

This commit backports upstream net-next's commit 804fe108fc92e59
("openvswitch: Use correct reply values in datapath and vport ops").

Signed-off-by: Yifeng Sun <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
yifsun authored and blp committed Oct 17, 2018
1 parent f941780 commit 229486c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,14 +1196,14 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
ovs_header->dp_ifindex,
reply, info->snd_portid,
info->snd_seq, 0,
OVS_FLOW_CMD_NEW,
OVS_FLOW_CMD_SET,
ufid_flags);
BUG_ON(error < 0);
}
} else {
/* Could not alloc without acts before locking. */
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);

if (unlikely(IS_ERR(reply))) {
Expand Down Expand Up @@ -1279,7 +1279,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,
OVS_FLOW_CMD_NEW, true, ufid_flags);
OVS_FLOW_CMD_GET, true, ufid_flags);
if (IS_ERR(reply)) {
err = PTR_ERR(reply);
goto unlock;
Expand Down Expand Up @@ -1405,7 +1405,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,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
OVS_FLOW_CMD_NEW, ufid_flags) < 0)
OVS_FLOW_CMD_GET, ufid_flags) < 0)
break;

cb->args[0] = bucket;
Expand Down Expand Up @@ -1744,7 +1744,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
ovs_dp_change(dp, info->attrs);

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);

ovs_unlock();
Expand Down Expand Up @@ -1775,7 +1775,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
goto err_unlock_free;
}
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);
ovs_unlock();

Expand All @@ -1799,7 +1799,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
if (i >= skip &&
ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI,
OVS_DP_CMD_NEW) < 0)
OVS_DP_CMD_GET) < 0)
break;
i++;
}
Expand Down Expand Up @@ -2116,7 +2116,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),
info->snd_portid, info->snd_seq, 0,
OVS_VPORT_CMD_NEW);
OVS_VPORT_CMD_SET);
BUG_ON(err < 0);
ovs_unlock();

Expand Down Expand Up @@ -2198,7 +2198,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
goto exit_unlock_free;
err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
info->snd_portid, info->snd_seq, 0,
OVS_VPORT_CMD_NEW);
OVS_VPORT_CMD_GET);
BUG_ON(err < 0);
rcu_read_unlock();

Expand Down Expand Up @@ -2234,7 +2234,7 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
NLM_F_MULTI,
OVS_VPORT_CMD_NEW) < 0)
OVS_VPORT_CMD_GET) < 0)
goto out;

j++;
Expand Down

0 comments on commit 229486c

Please sign in to comment.