/* Attributes. */
const char *name; /* OVS_DP_ATTR_NAME. */
const uint32_t *upcall_pid; /* OVS_DP_ATTR_UPCALL_PID. */
+ uint32_t user_features; /* OVS_DP_ATTR_USER_FEATURES */
struct ovs_dp_stats stats; /* OVS_DP_ATTR_STATS. */
struct ovs_dp_megaflow_stats megaflow_stats;
/* OVS_DP_ATTR_MEGAFLOW_STATS.*/
upcall_pid = 0;
dp_request.upcall_pid = &upcall_pid;
} else {
- dp_request.cmd = OVS_DP_CMD_GET;
+ /* Use OVS_DP_CMD_SET to report user features */
+ dp_request.cmd = OVS_DP_CMD_SET;
}
dp_request.name = name;
+ dp_request.user_features |= OVS_DP_F_UNALIGNED;
error = dpif_linux_dp_transact(&dp_request, &dp, &buf);
if (error) {
return error;
/* The ODPP_NONE "reserved" port number uses the "ovs-system"'s
* channel, since it is not heavily loaded. */
uint32_t idx = port_idx >= dpif->uc_array_size ? 0 : port_idx;
- pid = nl_sock_pid(dpif->channels[idx].sock);
+ const struct nl_sock *sock = dpif->channels[idx].sock;
+ pid = sock ? nl_sock_pid(sock) : 0;
}
ovs_mutex_unlock(&dpif->upcall_lock);
return EINVAL;
}
- memset(upcall, 0, sizeof *upcall);
+ /* (Re)set ALL fields of '*upcall' on successful return. */
upcall->type = type;
upcall->key = CONST_CAST(struct nlattr *,
nl_attr_get(a[OVS_PACKET_ATTR_KEY]));
nl_msg_put_u32(buf, OVS_DP_ATTR_UPCALL_PID, *dp->upcall_pid);
}
+ if (dp->user_features) {
+ nl_msg_put_u32(buf, OVS_DP_ATTR_USER_FEATURES, dp->user_features);
+ }
+
/* Skip OVS_DP_ATTR_STATS since we never have a reason to serialize it. */
}