[ovs-dev] [PATCH] dpif-linux: Don't reset kernel upcall_pids unintentionally.
Ben Pfaff
blp at nicira.com
Fri Oct 7 16:42:22 PDT 2011
Commit b063d9f0 "datapath: Use unicast Netlink sockets for upcalls" that
introduced an 'upcall_pid' member into struct dpif_linux_vport, struct
dpif_linux_dp, and struct dpif_linux_flow neglected to do so only if the
member was nonzero. This caused every datapath, vport, and flow operation
to supply an upcall_pid. In particular, the netdev_set_config() called at
startup when a vport already existed caused the upcall_pid for that vport
to be reset to 0, which in turn caused all packets received on the vport to
be dropped instead of forwarded to ovs-vswitchd.
Reported-by: Shih-Hao Li <shli at nicira.com>
---
lib/dpif-linux.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 8981500..65b57f0 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -1367,7 +1367,9 @@ dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *vport,
nl_msg_put_string(buf, OVS_VPORT_ATTR_NAME, vport->name);
}
- nl_msg_put_u32(buf, OVS_VPORT_ATTR_UPCALL_PID, vport->upcall_pid);
+ if (vport->upcall_pid) {
+ nl_msg_put_u32(buf, OVS_VPORT_ATTR_UPCALL_PID, vport->upcall_pid);
+ }
if (vport->stats) {
nl_msg_put_unspec(buf, OVS_VPORT_ATTR_STATS,
@@ -1521,7 +1523,9 @@ dpif_linux_dp_to_ofpbuf(const struct dpif_linux_dp *dp, struct ofpbuf *buf)
nl_msg_put_string(buf, OVS_DP_ATTR_NAME, dp->name);
}
- nl_msg_put_u32(buf, OVS_DP_ATTR_UPCALL_PID, dp->upcall_pid);
+ if (dp->upcall_pid) {
+ nl_msg_put_u32(buf, OVS_DP_ATTR_UPCALL_PID, dp->upcall_pid);
+ }
/* Skip OVS_DP_ATTR_STATS since we never have a reason to serialize it. */
@@ -1691,7 +1695,9 @@ dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow *flow,
flow->actions, flow->actions_len);
}
- nl_msg_put_u32(buf, OVS_FLOW_ATTR_UPCALL_PID, flow->upcall_pid);
+ if (flow->upcall_pid) {
+ nl_msg_put_u32(buf, OVS_FLOW_ATTR_UPCALL_PID, flow->upcall_pid);
+ }
/* We never need to send these to the kernel. */
assert(!flow->stats);
--
1.7.4.4
More information about the dev
mailing list