From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 747B25A026F for ; Tue, 1 Aug 2023 13:51:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690890669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ml3r9DSj274sKS+tY0+DsdACM9oi6sGMiJgeC7u8RWU=; b=cvA4OkTkNo/oijUROhyLtmXt4b4qIe7qSizAUw58TCzCrSoUaHO7vDuEKRpIwNBAO9lNEG A+eQzdnVwicj3/eQf66u4zHGsI7kp+/K29UpJQQGesdUJF7eVSoPrIRltA2TUvFk/HarDU Xqo5cikIT8cderU3pQgx103Cw/1iz9M= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-464-Om4lmNHpNOO8sHFM6oNNTg-1; Tue, 01 Aug 2023 07:51:07 -0400 X-MC-Unique: Om4lmNHpNOO8sHFM6oNNTg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6E3321C31C50 for ; Tue, 1 Aug 2023 11:51:07 +0000 (UTC) Received: from pholzing-fedora.redhat.com (unknown [10.39.194.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id D809A401061; Tue, 1 Aug 2023 11:51:06 +0000 (UTC) From: Paul Holzinger To: passt-dev@passt.top Subject: [PATCH] tap: include errno in error when tap_ns_tun() fails Date: Tue, 1 Aug 2023 13:50:17 +0200 Message-ID: <20230801115016.37118-2-pholzing@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: CMKSZTVJQISOLCYDK6PD6J2KIJX2Z57B X-Message-ID-Hash: CMKSZTVJQISOLCYDK6PD6J2KIJX2Z57B X-MailFrom: pholzing@redhat.com 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: Paul Holzinger 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: It is important to know why a syscall failed so pasta should include the errno in the error message. This is still not perfect as we do not know which of functions (open, ioctl, if_nametoindex) failed but it should at least include more important context. This change was inspiered by a podman issue[1]. [1] https://github.com/containers/podman/issues/19428 Signed-off-by: Paul Holzinger --- tap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tap.c b/tap.c index a6a73d3..c212616 100644 --- a/tap.c +++ b/tap.c @@ -1205,7 +1205,8 @@ static void tap_sock_tun_init(struct ctx *c) NS_CALL(tap_ns_tun, c); if (tun_ns_fd == -1) - die("Failed to open tun socket in namespace"); + die("Failed to open tun socket in namespace: %s", + strerror(errno)); pasta_ns_conf(c); -- 2.41.0