From: Ben Pfaff Date: Thu, 2 May 2013 00:08:20 +0000 (-0700) Subject: dpif-linux: Close channel Netlink sockets when a port number gets recycled. X-Git-Tag: sliver-openvswitch-1.10.90-3~17^2~11 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=48f6fbe1972a4ab6d47e87913fcf537125e7dcb4;p=sliver-openvswitch.git dpif-linux: Close channel Netlink sockets when a port number gets recycled. When ovs-vswitchd deletes a port with dpif_linux_port_del(), that function uses del_channel() to delete the corresponding channel, including closing its Netlink socket fd. However, if the vport gets removed by some other process (e.g. "ip link delete" for veths) then this function never gets called and thus the channel never gets deleted. This commit partially fixes the problem. Now, if a port number gets reused, add_channel() closes the old Netlink socket assigned to that port before it installs the new one. Bug #16784. Reported-by: Paul Ingram Signed-off-by: Ben Pfaff --- diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 39acc9aa8..933aabed1 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -337,6 +337,7 @@ add_channel(struct dpif_linux *dpif, uint32_t port_no, struct nl_sock *sock) return errno; } + nl_sock_destroy(dpif->channels[port_no].sock); dpif->channels[port_no].sock = sock; dpif->channels[port_no].last_poll = LLONG_MIN;