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:36 +0200 (CEST) Received: by 2002:a05:6a11:2489:b0:55f:c3c0:ed08 with SMTP id sg9csp910633pxb; Wed, 22 May 2024 13:59:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWHyG+8JZEIvAGBa30/ixuQYEwvbeEN3Q/d+AopmFb67eV3VLVhy+AjlpKYGyF917d1lYqIGgxYQoL2P0bxjJOs+Omc3Ik4IBc= X-Google-Smtp-Source: AGHT+IH9E1z69ofj7qzFMgQ17/ylRp/4DRUzc1HF2P+hpHVEGetYtiTh9LaQHQzlpjeJTlhqQV0l X-Received: by 2002:a05:6214:5c05:b0:6a9:d99f:739d with SMTP id 6a1803df08f44-6ab7f36796fmr48798946d6.32.1716411565424; Wed, 22 May 2024 13:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716411565; cv=none; d=google.com; s=arc-20160816; b=ngYRWHdSN8aOwH97qL4tR+lp5aAASqbOxrJVR+AeeUHtdY/g9dgKsS+X1+eQy+H/57 2nSrVK7/tPjggx6oQ4m1p0Kbhh6OC98fVmwTFiDBqwwucMPXE6xLDtoBLG9/RnoA99VV Y5OYFX/FxaK/Y0AX+tB1boccUndJCY/Xd6vMY+wnl3/5XQMb+yDqFss8jy+rV4QDaJug jZ7FPTJgJkYNHZZvV8L3CWz+xHPEq5f13KprhGNpU4M2Hfp8c2w4pYYJNSnGIgo1qRvM 1p/JhUQR2qiY9lti5bM09JiTIRMLMkqFUjrmiC3wttbeqrhWxx52XVq0Ce13exvvxapa cbqQ== 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=+IVB0c8VWSKLIDKsHJaMz25oE8grdEGIyJyrfo8glNs=; fh=Sda5+ix8pPMDNzAK4mfqRvxwOV3J+P0OHYKuDzXzUCA=; b=z3S2dsCzbF54z0RFClu7GV60VJO7+hN7XesO5xdaJg0ebIu6xKPzM6e7KMhK2KkVow b6sRnDH6suIg4WDZfMlyaQAYEuuTIIIGAjz5KcQabVu07vjcUO6tE05rdfMnbAnOc/0d 3H47Ou5KIMj3r9poHuAkY/kSsgUbV4q9jFEDmph29DXKmr6gmvM8wolFsaeUyF1GzUJH D5hGKDUVgmuAzW2mwAKA91/9CI1/zeKGtN/769+oUJv9uZexazlkxv7DPid9A8GA/Aus BkBfnZqcAqeuAnX9IDDz/BMukOmlgStaecLrUZsYypu6ipsQx/CK6Vg22z+YuPz+bjmi ykLQ==; 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 6a1803df08f44-6ab4e1062fdsi69310586d6.256.2024.05.22.13.59.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 13:59:25 -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-03.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-154-Gvz9YperPDyDEi2MLGhRMA-1; Wed, 22 May 2024 16:59:23 -0400 X-MC-Unique: Gvz9YperPDyDEi2MLGhRMA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 916E61955F37 for ; Wed, 22 May 2024 20:59:22 +0000 (UTC) Received: by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) id 82AAA1955D97; Wed, 22 May 2024 20:59:22 +0000 (UTC) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.46]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 803331955D94 for ; Wed, 22 May 2024 20:59:22 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [170.10.128.131]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2CACD1956087 for ; Wed, 22 May 2024 20:59:22 +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-563-uzXj1gUoPzaDtjaDA2-8kg-1; Wed, 22 May 2024 16:59:17 -0400 X-MC-Unique: uzXj1gUoPzaDtjaDA2-8kg-1 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by passt.top (Postfix) with ESMTP id CD7235A0311; Wed, 22 May 2024 22:59:14 +0200 (CEST) Received: by passt.top (Postfix, from userid 1000) id B82B45A0307; Wed, 22 May 2024 22:59:11 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 2/8] tap: Move all-ones initialisation of mac_guest to tap_sock_init() Date: Wed, 22 May 2024 22:59:05 +0200 Message-ID: <20240522205911.261325-3-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: ZGN3PP2CL3AOIXBPBSNJNO3Z6O65ZN4Z X-Message-ID-Hash: ZGN3PP2CL3AOIXBPBSNJNO3Z6O65ZN4Z 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.12 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 It has nothing to do with tap_sock_unix_init(). It used to be there as that function could be called multiple times per passt instance, but it's not the case anymore. This also takes care of the fact that, with --fd, we wouldn't set the initial MAC address, so we would need to wait for the guest to send us an ARP packet before we could exchange data. Fixes: 6b4e68383c66 ("passt, tap: Add --fd option") Signed-off-by: Stefano Brivio --- tap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tap.c b/tap.c index 91fd2e2..177fe26 100644 --- a/tap.c +++ b/tap.c @@ -1111,12 +1111,6 @@ static void tap_sock_unix_init(struct ctx *c) =09if (fd < 0) =09=09die("UNIX socket: %s", strerror(errno)); =20 -=09/* In passt mode, we don't know the guest's MAC until it sends -=09 * us packets. Use the broadcast address so our first packets -=09 * will reach it. -=09 */ -=09memset(&c->mac_guest, 0xff, sizeof(c->mac_guest)); - =09for (i =3D 1; i < UNIX_SOCK_MAX; i++) { =09=09char *path =3D addr.sun_path; =09=09int ex, ret; @@ -1312,6 +1306,12 @@ void tap_sock_init(struct ctx *c) =09if (c->mode =3D=3D MODE_PASST) { =09=09if (c->fd_tap_listen =3D=3D -1) =09=09=09tap_sock_unix_init(c); + +=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 +=09=09 * first packets will reach it. +=09=09 */ +=09=09memset(&c->mac_guest, 0xff, sizeof(c->mac_guest)); =09} else { =09=09tap_sock_tun_init(c); =09} --=20 2.43.0