From: "Alex Bennée" <alex.bennee@linaro.org>
To: cminyard@mvista.com
Cc: fam@euphon.net, berrange@redhat.com, stefanb@linux.vnet.ibm.com,
richard.henderson@linaro.org, qemu-devel@nongnu.org,
f4bug@amsat.org, Kamil Rytarowski <kamil@netbsd.org>,
cota@braap.org, stefanha@redhat.com, marcandre.lureau@redhat.com,
pbonzini@redhat.com, aurelien@aurel32.net
Subject: Re: [PATCH v1 5/6] tests: only run ipmi-bt-test if CONFIG_LINUX
Date: Mon, 04 Nov 2019 19:42:15 +0000 [thread overview]
Message-ID: <87o8xrjunc.fsf@linaro.org> (raw)
In-Reply-To: <20191104183632.GO3093@minyard.net>
Corey Minyard <cminyard@mvista.com> writes:
> On Mon, Nov 04, 2019 at 05:36:53PM +0000, Alex Bennée wrote:
>> This test has been unstable on NetBSD for awhile. It seems the
>> mechanism used to listen to a random port is a Linux-ism (although a
>> received wisdom Linux-ism rather than a well documented one). As
>
> Hmm. I got reports of this issue and tried to reproduce, but I was
> never able to. I thought I had fixed it via other means, but I had no
> idea this was the cause of the issue.
>
> It's not a Linux-ism, I don't think, Richard Steven's "Unix Network
> Programming" mentions that is how this works (at least on UDP), and that
> is pre-Linux. That's probably where I got this technique. I've saw
> some web pages mention that Solaris and Windows do it this way.
>
> However, it's not specified, so it's probably a bad idea. The only way
> I can think to do it another way is to remove the bind() call, then it
> should randomly assign the port (per the spec, I think). The trouble
> with that is the address will be INADDR_ANY, so it will be bound on
> other interfaces besides the loopback, which make me slightly worried
> from a security point of view.
The other option is to keep the bind but seed it ourselves with a random
port. However then you need to loop until you succeed and avoid locking
up if something fatal has gone wrong.
> I'm ok with this being linux-only, but I'd like to fix it so it works
> everywhere.
One option could be to use the glib networking stuff to set this up.
That has options for creating dynamic ports for incoming connections
although the docs are a bit light on details.
g_socket_listener_add_any_inet_port certainly seems to do the retry
approach (for a weirdly arbitrary 37 times). It leaves the fancy stuff
to a hopefully well tested library although I note QEMU's own use of
g_io APIs seems to be pretty sporadic.
>
> -corey
>
>> working around would add more hard to test complexity to the test I've
>> gone for the easier option of making it CONFIG_LINUX only.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Cc: Corey Minyard <cminyard@mvista.com>
>> Cc: Kamil Rytarowski <kamil@netbsd.org>
>> ---
>> tests/Makefile.include | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>> index 534ee487436..8566f5f119d 100644
>> --- a/tests/Makefile.include
>> +++ b/tests/Makefile.include
>> @@ -177,7 +177,9 @@ check-qtest-i386-$(CONFIG_SGA) += tests/boot-serial-test$(EXESUF)
>> check-qtest-i386-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
>> check-qtest-i386-y += tests/rtc-test$(EXESUF)
>> check-qtest-i386-$(CONFIG_ISA_IPMI_KCS) += tests/ipmi-kcs-test$(EXESUF)
>> +ifdef CONFIG_LINUX
>> check-qtest-i386-$(CONFIG_ISA_IPMI_BT) += tests/ipmi-bt-test$(EXESUF)
>> +endif
>> check-qtest-i386-y += tests/i440fx-test$(EXESUF)
>> check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
>> check-qtest-i386-y += tests/device-plug-test$(EXESUF)
>> --
>> 2.20.1
>>
--
Alex Bennée
next prev parent reply other threads:[~2019-11-04 19:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 17:36 [PATCH v1 0/6] testing/next (netbsd stuff) Alex Bennée
2019-11-04 17:36 ` [PATCH v1 1/6] tests/vm: netbsd autoinstall, using serial console Alex Bennée
2019-11-04 18:44 ` Philippe Mathieu-Daudé
2019-11-04 18:57 ` Philippe Mathieu-Daudé
2019-11-11 14:20 ` Thomas Huth
2019-11-04 17:36 ` [PATCH v1 2/6] tests/vm: add console_consume helper Alex Bennée
2019-11-04 18:44 ` Philippe Mathieu-Daudé
2019-11-04 17:36 ` [PATCH v1 3/6] tests/vm: use console_consume for netbsd Alex Bennée
2019-11-04 18:46 ` Philippe Mathieu-Daudé
2019-11-04 19:43 ` Alex Bennée
2019-11-04 17:36 ` [PATCH v1 4/6] tests/vm: update netbsd to version 8.1 Alex Bennée
2019-11-04 18:45 ` Philippe Mathieu-Daudé
2019-11-04 17:36 ` [PATCH v1 5/6] tests: only run ipmi-bt-test if CONFIG_LINUX Alex Bennée
2019-11-04 18:36 ` Corey Minyard
2019-11-04 19:42 ` Alex Bennée [this message]
2019-11-04 17:36 ` [PATCH v1 6/6] tests/vm: support sites with sha512 checksums Alex Bennée
2019-11-04 18:50 ` Philippe Mathieu-Daudé
2019-11-07 17:46 ` [PATCH v1 0/6] testing/next (netbsd stuff) Peter Maydell
2019-11-07 17:53 ` Kamil Rytarowski
2019-11-07 17:58 ` Peter Maydell
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=87o8xrjunc.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=cminyard@mvista.com \
--cc=cota@braap.org \
--cc=f4bug@amsat.org \
--cc=fam@euphon.net \
--cc=kamil@netbsd.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=stefanha@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.
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 NNTP newsgroup(s).