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 95FBA5A0274 for ; Mon, 7 Aug 2023 08:02:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691388117; bh=kHjOEOJ8w6UC+mDFe6mHlq/3RwgrEAWAOSptPNA+RR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZU/Ib7qI6AJjLy0WpWBch6ifKCtb9i60pLmOjD2XZS0hLjubA8Z61ux0uSuVH4zgx sWI8wQsokyFP0OQRiQDm6ki4GmGKNHudo5z8lv/qkou708ISJM9Fy2px9Txvc+8TZq Z8nSIo3x5bbDbatrinLOsKiNChcrEHH6RWlxl1OY= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RK5LY6rNGz4wjG; Mon, 7 Aug 2023 16:01:57 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 2/4] tap: More sensible behaviour for error on listening qemu socket Date: Mon, 7 Aug 2023 16:01:53 +1000 Message-ID: <20230807060155.271388-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230807060155.271388-1-david@gibson.dropbear.id.au> References: <20230807060155.271388-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: TP5KPPCCH3PGPLWXTIWWTD5WFZYQ4V3Q X-Message-ID-Hash: TP5KPPCCH3PGPLWXTIWWTD5WFZYQ4V3Q 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 b4967d0..7e8b890 100644 --- a/tap.c +++ b/tap.c @@ -1284,8 +1284,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