public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Paul Holzinger <pholzing@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: Race condition with pasta COMMAND...
Date: Tue, 31 Jan 2023 14:02:46 +0100	[thread overview]
Message-ID: <20230131140246.33b39a31@elisabeth> (raw)
In-Reply-To: <984f4c24-8fe4-71db-1fa6-174a1f5b055f@redhat.com>

Hi Paul,

On Mon, 30 Jan 2023 19:08:14 +0100
Paul Holzinger <pholzing@redhat.com> 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


  reply	other threads:[~2023-01-31 13:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 18:08 Race condition with pasta COMMAND Paul Holzinger
2023-01-31 13:02 ` Stefano Brivio [this message]
2023-01-31 18:00   ` Paul Holzinger
2023-01-31 18:43     ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131140246.33b39a31@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=pholzing@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).