From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from imap.gmail.com [173.194.76.109] by localhost with POP3 (fetchmail-6.3.26) for (single-drop); Wed, 22 May 2024 22:59:37 +0200 (CEST) Received: by 2002:a05:6a11:2489:b0:55f:c3c0:ed08 with SMTP id sg9csp910647pxb; Wed, 22 May 2024 13:59:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXccugixRPLvbI1xuDlmfNmXaI/k2zxte7CKl/qM8vFfPw596EAhmol66zqceQ2kdWhXL7N/XwERzjbU9X/sL/Nxya+tNZjCEs= X-Google-Smtp-Source: AGHT+IEQMcWLukzR7DBdd5Re+bz6096WLgaMN6/js1yQlKWtDHkLy3Z5hzRirNL46m1Y3lkQwMcb X-Received: by 2002:a05:622a:5298:b0:43e:3d64:882 with SMTP id d75a77b69052e-43f9e0df82fmr38983331cf.34.1716411566360; Wed, 22 May 2024 13:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716411566; cv=none; d=google.com; s=arc-20160816; b=U5Jp4YfGhWCEev7twamY4sOYaUJNAmzLdlRs/v2AMjdwYzHOWJWGjpcDyUCkOTunAK Qswd5o5s93VoIkYrngcvR1IfBxmrkNDeGUxC0psFpwfjd19RbHe6au3cTDo0jP1QNlFi SkqoNbiqfR/V13YCJ3wQYpyVUd+eKoag7anS5ciw/p4zv8JhjHvuQZnCh4X6eEppM6u1 E0Gxd+CvZQ/StFDKFy90AKrENCYBOSTCE0I5hPbT6vEjj3sd4Z+DvzWo8J/KUxRpYbJC 8D24PdXBqXQ5+TvyiRSOwrhqr2gJqsegBAxSkjFyH2kp637lqtNYwDgxs1aAEqdz66xa b2wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:list-unsubscribe:list-subscribe:list-post :list-owner:list-help:list-archive:list-archive:archived-at :archived-at:list-id:precedence:cc:message-id-hash:mime-version :references:in-reply-to:message-id:date:subject:to:from:delivered-to; bh=oVuFmQ8F21qbnEfrF7m5D7X4iZU2b50cHDMczDBcRg0=; fh=Sda5+ix8pPMDNzAK4mfqRvxwOV3J+P0OHYKuDzXzUCA=; b=IDElKCT13Y8rPqa7l+kKXGj82nKva/14m/ilhAokaSYy/mpwRnkHzmA6l/KtOgLsS2 MyNl6n4Jby9y1ZTQMA0aVWnan5NjcehnXyaACxGHFLiU/+sAYcjukh1Q9QRVakZFzljx 0Cg7zO9qABliyeKrrqJGcjZF3QNXQk/r+NquUgmpXVnxpo9ay8KQWEtpsvslTUSby77c RZBbJlEX6bzYDSv9Q3ptDsjfKMF1ECqqqOnYDIZGpcYiC5WLNkdwEcM0e00QSVF5TJvq qN1VrWkKYKwRbfAHOZMP4rjCGqDbF1opF/gUjguNsJQMeFY6zstwWES8vsGoC5ynNmVz JLGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of passt-dev-bounces@passt.top designates 88.198.0.164 as permitted sender) smtp.mailfrom=passt-dev-bounces@passt.top Return-Path: Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com. [205.139.110.120]) by mx.google.com with ESMTPS id d75a77b69052e-43df96ac38fsi4717231cf.356.2024.05.22.13.59.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 13:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of passt-dev-bounces@passt.top designates 88.198.0.164 as permitted sender) client-ip=88.198.0.164; Authentication-Results: mx.google.com; spf=pass (google.com: domain of passt-dev-bounces@passt.top designates 88.198.0.164 as permitted sender) smtp.mailfrom=passt-dev-bounces@passt.top Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-286-GsXQTPBmMcmyJb3sc4UvCg-1; Wed, 22 May 2024 16:59:24 -0400 X-MC-Unique: GsXQTPBmMcmyJb3sc4UvCg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DA1751955E85 for ; Wed, 22 May 2024 20:59:23 +0000 (UTC) Received: by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) id C973B197F039; Wed, 22 May 2024 20:59:23 +0000 (UTC) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.58]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C711F197F037 for ; Wed, 22 May 2024 20:59:23 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7ED9A1955E83 for ; Wed, 22 May 2024 20:59:23 +0000 (UTC) Received: from passt.top (passt.top [88.198.0.164]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-HPCSPiPvOzmkrUnc2hIKng-1; Wed, 22 May 2024 16:59:18 -0400 X-MC-Unique: HPCSPiPvOzmkrUnc2hIKng-1 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by passt.top (Postfix) with ESMTP id D42A85A0313; Wed, 22 May 2024 22:59:14 +0200 (CEST) Received: by passt.top (Postfix, from userid 1000) id BA78A5A0308; Wed, 22 May 2024 22:59:11 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 3/8] passt, tap: Don't use -1 as uninitialised value for fd_tap_listen Date: Wed, 22 May 2024 22:59:06 +0200 Message-ID: <20240522205911.261325-4-sbrivio@redhat.com> In-Reply-To: <20240522205911.261325-1-sbrivio@redhat.com> References: <20240522205911.261325-1-sbrivio@redhat.com> MIME-Version: 1.0 Message-ID-Hash: IDT5EDTCHIBIM4I7KDNDKT5C6GWL6HJ6 X-Message-ID-Hash: IDT5EDTCHIBIM4I7KDNDKT5C6GWL6HJ6 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 , "'Richard W . M . Jones'" , Minxi Hou 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: X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition;Similar Internal Domain=false;Similar Monitored External Domain=false;Custom External Domain=false;Mimecast External Domain=false;Newly Observed Domain=false;Internal User Name=false;Custom Display Name List=false;Reply-to Address Mismatch=false;Targeted Threat Dictionary=false;Mimecast Threat Dictionary=false;Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII"; x-default=true This is a remnant from the time we kept access to the original filesystem and we could reinitialise the listening AF_UNIX socket. Since commit 0515adceaa8f ("passt, pasta: Namespace-based sandboxing, defer seccomp policy application"), however, we can't re-bind the listening socket once we're up and running. Drop the -1 initalisation and the corresponding check. Signed-off-by: Stefano Brivio --- passt.c | 2 +- tap.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/passt.c b/passt.c index 771b8a7..1df1dc4 100644 --- a/passt.c +++ b/passt.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) =20 =09isolate_initial(); =20 -=09c.pasta_netns_fd =3D c.fd_tap =3D c.fd_tap_listen =3D -1; +=09c.pasta_netns_fd =3D c.fd_tap =3D -1; =20 =09sigemptyset(&sa.sa_mask); =09sa.sa_flags =3D 0; diff --git a/tap.c b/tap.c index 177fe26..cb6df5a 100644 --- a/tap.c +++ b/tap.c @@ -1304,8 +1304,7 @@ void tap_sock_init(struct ctx *c) =09} =20 =09if (c->mode =3D=3D MODE_PASST) { -=09=09if (c->fd_tap_listen =3D=3D -1) -=09=09=09tap_sock_unix_init(c); +=09=09tap_sock_unix_init(c); =20 =09=09/* In passt mode, we don't know the guest's MAC address until it =09=09 * sends us packets. Use the broadcast address so that our --=20 2.43.0