dpif-linux: Fix a bug in creating port.
authorAlex Wang <alexw@nicira.com>
Tue, 29 Apr 2014 05:05:05 +0000 (22:05 -0700)
committerAlex Wang <alexw@nicira.com>
Tue, 29 Apr 2014 14:54:23 +0000 (07:54 -0700)
commitaeaae11fceb0939001705b7e4024cff37dd94c5c
tree2a1055320846ebf50291b5403668fd457f012cc5
parent60cda7d69b0bfd242045d346f2cd169836a3d78e
dpif-linux: Fix a bug in creating port.

Based on the policy of 'OVS_VPORT_ATTR_UPCALL_PID', if upcall should
not be sent to userspace (i.e. the number of handler threads is zero),
the netlink message for creating vport should be an one-element array of
value 0.  However, dpif_linux_port_add__() fails to obey it and generates
zero-payload netlink message which causes the netlink transaction failing
with ERANGE error.

This is particularly bad when the 'flow-restore-wait' is set during upgrade,
since number of handler threads is not set in dpif-linux module and ovs is
not able to add port in datapath until the 'flow-restore-wait' is disabled.
Connection may lose due to this bug.

This bug was introduced by commit 1579cf677fc (dpif-linux: Implement the
API functions to allow multiple handler threads read upcall.).

This commit fixes the bug by fixing the dpif_linux_port_add__() to generate
the correct netlink message when the number of handler threads is not set.

Bug #1239914.
Bug #1240598.
Bug #1240626.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/dpif-linux.c