From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 4FC055A026D for ; Fri, 4 Aug 2023 10:32:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691137955; bh=41Q53JvKpha9/lUWDZO5SahCXOGEox9kueqdpg+UhJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnXSm2Yt/9iTYKJkQr9aLS6ntu4wWQXGT8TNRhMem1HNlDlYJLwB79nSdwEeIFNUW QftBCBWHB9k7QY0UhFPw+xunzsx5bgcYf3/EfDFFPQYdp5x8qSDNTlfubkTR1IYxSe j1iQYtkZyYEkNtqBAMHVI/4y9dNjrQl+AbK8AA00= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RHJql4wYcz4wy6; Fri, 4 Aug 2023 18:32:35 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 2/2] tap: More sensible behaviour for error on listening qemu socket Date: Fri, 4 Aug 2023 18:32:32 +1000 Message-ID: <20230804083232.1298624-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230804083232.1298624-1-david@gibson.dropbear.id.au> References: <20230804083232.1298624-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: SUOZ5OTWIDZAG256743B6FQ3URZC4A4V X-Message-ID-Hash: SUOZ5OTWIDZAG256743B6FQ3URZC4A4V X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: We call tap_sock_unix_new() to handle a new connection to the qemu socket if we get an EPOLLIN event on c->fd_tap_listen. If we get an error event on c->fd_tap_listen instead, we'll fall through to the "tap reset" path. However, this won't do anything useful for an error on the listening socket, it will just close the already connected socket. If we wanted to handle errors on this socket, we'd need to do something different than for an error on the connected socket. So, change the logic to explicitly do nothing for any !EPOLLIN events on the listening socket. Signed-off-by: David Gibson --- tap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tap.c b/tap.c index 3a43263..a8e5ce6 100644 --- a/tap.c +++ b/tap.c @@ -1281,8 +1281,9 @@ static void tap_sock_reset(struct ctx *c) void tap_handler(struct ctx *c, int fd, uint32_t events, const struct timespec *now) { - if (fd == c->fd_tap_listen && events == EPOLLIN) { - tap_sock_unix_new(c); + if (fd == c->fd_tap_listen) { + if (events == EPOLLIN) + tap_sock_unix_new(c); return; } -- 2.41.0