int err;
err = -EINVAL;
- if (!a[OVS_DP_ATTR_NAME])
+ if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID])
goto err;
err = ovs_dp_cmd_validate(a);
parms.options = NULL;
parms.dp = dp;
parms.port_no = OVSP_LOCAL;
- if (a[OVS_DP_ATTR_UPCALL_PID])
- parms.upcall_pid = nla_get_u32(a[OVS_DP_ATTR_UPCALL_PID]);
- else
- parms.upcall_pid = NETLINK_CB(skb).pid;
+ parms.upcall_pid = nla_get_u32(a[OVS_DP_ATTR_UPCALL_PID]);
vport = new_vport(&parms);
if (IS_ERR(vport)) {
int err;
err = -EINVAL;
- if (!a[OVS_VPORT_ATTR_NAME] || !a[OVS_VPORT_ATTR_TYPE])
+ if (!a[OVS_VPORT_ATTR_NAME] || !a[OVS_VPORT_ATTR_TYPE] ||
+ !a[OVS_VPORT_ATTR_UPCALL_PID])
goto exit;
err = ovs_vport_cmd_validate(a);
parms.options = a[OVS_VPORT_ATTR_OPTIONS];
parms.dp = dp;
parms.port_no = port_no;
- if (a[OVS_VPORT_ATTR_UPCALL_PID])
- parms.upcall_pid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]);
- else
- parms.upcall_pid = NETLINK_CB(skb).pid;
+ parms.upcall_pid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]);
vport = new_vport(&parms);
err = PTR_ERR(vport);
{
struct dpif_linux_dp dp_request, dp;
struct ofpbuf *buf;
+ uint32_t upcall_pid;
int error;
error = dpif_linux_init();
/* Create or look up datapath. */
dpif_linux_dp_init(&dp_request);
- dp_request.cmd = create ? OVS_DP_CMD_NEW : OVS_DP_CMD_GET;
+ if (create) {
+ dp_request.cmd = OVS_DP_CMD_NEW;
+ upcall_pid = 0;
+ dp_request.upcall_pid = &upcall_pid;
+ } else {
+ dp_request.cmd = OVS_DP_CMD_GET;
+ }
dp_request.name = name;
error = dpif_linux_dp_transact(&dp_request, &dp, &buf);
if (error) {