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.129.124]) by passt.top (Postfix) with ESMTP id 86E5B5A0082 for ; Tue, 31 Jan 2023 14:03:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675170181; 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: in-reply-to:in-reply-to:references:references; bh=kXPm1Z2bB6aQCeqjSKi+9HmA+E4MBsQq+IjPWuJi4SE=; b=I9bx5Le5/SWR56/ck4zwoUjvsL9cbNx8sBACMtRVUfkAb8MCJ4u2SGkNyFS7t2xb4t5JqD QnWd5buR539gfBvAscxuEQDobd/P76hkQchIC5W1cu8gHM12Dl4aV8IURoBWZEhp6bjbaE +Ky4XQBAODj1Br1HprbfHA5mQ1gHLfM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-sXZSymeTPdKLbedmdc1j6A-1; Tue, 31 Jan 2023 08:02:59 -0500 X-MC-Unique: sXZSymeTPdKLbedmdc1j6A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0035185530E for ; Tue, 31 Jan 2023 13:02:59 +0000 (UTC) Received: from maya.cloud.tilaa.com (ovpn-208-4.brq.redhat.com [10.40.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDF5C492B05; Tue, 31 Jan 2023 13:02:58 +0000 (UTC) Date: Tue, 31 Jan 2023 14:02:46 +0100 From: Stefano Brivio To: Paul Holzinger Subject: Re: Race condition with pasta COMMAND... Message-ID: <20230131140246.33b39a31@elisabeth> In-Reply-To: <984f4c24-8fe4-71db-1fa6-174a1f5b055f@redhat.com> References: <984f4c24-8fe4-71db-1fa6-174a1f5b055f@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: C7DS4HGS6SY7BJHENAVE7QPIUBTZ3RQ4 X-Message-ID-Hash: C7DS4HGS6SY7BJHENAVE7QPIUBTZ3RQ4 X-MailFrom: sbrivio@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: passt-dev@passt.top 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: Hi Paul, On Mon, 30 Jan 2023 19:08:14 +0100 Paul Holzinger wrote: > Hi all, > > while debugging some things I used `./pasta --config-net -- nslookup > google.com 1.1.1.1` to test dns. > The problem is that does not work because the nslookup process will be > executed before pasta is > ready with the netns setup, i.e. compare `./pasta --config-net -- ip a`. Thanks for the report. I also hit this a couple of months ago but I couldn't find yet the time to deal with it: https://bugs.passt.top/show_bug.cgi?id=37 > So a workaround is to spawn a shell and sleep: `sh -c "sleep 1; nslookup > google.com 1.1.1.1"` > However this is ugly and does not ensure that the netns is ready after > one second. As a user > I would expect pasta to wait until the setup is finished before it calls > exec(). Absolutely, yes. As I mentioned on that ticket, I *think* that the only way to make sure the setup is actually complete is to query back via netlink addresses and routes we configured -- simply waiting until we successfully sent netlink messages isn't enough, because it takes a (substantial) while until addresses and routes are actually available. > I can send a patch if you agree and I find some time. That would be great, thanks in advance! If you get to it, I think you could reuse nl_route() and nl_addr() from netlink.c to perform the checks -- they might need to be extended a bit, I'm not sure. -- Stefano