aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:49 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:49 +0200
commit4adae47c40e2f1bb66e8699747daa2eabee425f7 (patch)
tree3761d1bb58bfbf94f6c9e8219ebd9aa5bbe567c3
parent17337a736ff0e7ebd7d5272eba7466a627795215 (diff)
downloadpasst-4adae47c40e2f1bb66e8699747daa2eabee425f7.tar
passt-4adae47c40e2f1bb66e8699747daa2eabee425f7.tar.gz
passt-4adae47c40e2f1bb66e8699747daa2eabee425f7.tar.bz2
passt-4adae47c40e2f1bb66e8699747daa2eabee425f7.tar.lz
passt-4adae47c40e2f1bb66e8699747daa2eabee425f7.tar.xz
passt-4adae47c40e2f1bb66e8699747daa2eabee425f7.tar.zst
passt-4adae47c40e2f1bb66e8699747daa2eabee425f7.zip
passt: Close UNIX domain socket on failure before accepting new connections
The socket isn't necessarily closed, make sure we close it before getting a new one from accept(), so that we don't mix it up with protocol sockets numbering. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--passt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/passt.c b/passt.c
index 6b6a317..12b10dc 100644
--- a/passt.c
+++ b/passt.c
@@ -876,8 +876,10 @@ loop:
if (events[i].events & EPOLLRDHUP ||
events[i].events & EPOLLHUP ||
events[i].events & EPOLLERR ||
- tap_handler(&c, &now))
+ tap_handler(&c, &now)) {
+ close(c.fd_unix);
goto listen;
+ }
} else {
sock_handler(&c, events[i].data.fd, events[i].events,
&now);