From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 31B4F5A026B; Mon, 31 Oct 2022 12:20:59 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH v2 2/5] tap: Support for detection of existing sockets on ramfs Date: Mon, 31 Oct 2022 12:20:56 +0100 Message-Id: <20221031112059.170269-3-sbrivio@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221031112059.170269-1-sbrivio@redhat.com> References: <20221031112059.170269-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: AELPXGIKFJMPSZU4DCYZM3OMRI56SWC2 X-Message-ID-Hash: AELPXGIKFJMPSZU4DCYZM3OMRI56SWC2 X-MailFrom: sbrivio@passt.top 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.3 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: On ramfs, connecting to a non-existent UNIX domain socket yields EACCESS, instead of ENOENT. This is visible if we use passt directly on rootfs (a ramfs instance) from an initramfs image. It's probably wrong for ramfs to return EACCES, but given the simplicity of the filesystem, I doubt we should try to fix it there at the possible cost of added complexity. Also, this whole beauty should go away once qrap-less usage is established, so just accept EACCES as indication that a conflicting socket does not, in fact, exist. Signed-off-by: Stefano Brivio --- tap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tap.c b/tap.c index 4dcff4f..0a3ccce 100644 --- a/tap.c +++ b/tap.c @@ -912,7 +912,8 @@ static void tap_sock_unix_init(struct ctx *c) } ret = connect(ex, (const struct sockaddr *)&addr, sizeof(addr)); - if (!ret || (errno != ENOENT && errno != ECONNREFUSED)) { + if (!ret || (errno != ENOENT && errno != ECONNREFUSED && + errno != EACCES)) { if (*c->sock_path) { err("Socket path %s already in use", path); exit(EXIT_FAILURE); -- 2.35.1