From: Stefan Hajnoczi <stefanha@gmail.com>
To: Sebastian Ottlik <ottlik@fzi.de>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 0/5] Do not set SO_REUSEADDR on Windows
Date: Wed, 18 Sep 2013 14:42:23 +0200 [thread overview]
Message-ID: <20130918124223.GE13359@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1379341429-29141-1-git-send-email-ottlik@fzi.de>
On Mon, Sep 16, 2013 at 04:23:44PM +0200, Sebastian Ottlik wrote:
> This patchset disables most uses of SO_REUSEADDR on Windows and replaces it with
> calls to the new function socket_set_fast_reuse. On Windows systems the default
> behaviour is equivalent to SO_REUSEADDR on other operating systems. SO_REUSEADDR
> can still be set but results in undesired behaviour in most cases. It may even
> lead to situations were system behaviour is unspecified. More information on
> this can be found at:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx
>
> I originally encountered this issue when accidentally launching two QEMU
> instances with identical GDB ports at the same time. In which case QEMU won't
> fail as one might expect.
>
> Note that patch #4 fails checkpatch.pl. This is intentional (see v3 changes).
>
> v5 Changes:
> - Fixed inverted silent flag on all call sites of socket_set_fast_reuse
>
> v4 Changes:
> - Added the silent flag to socket_set_fast_reuse controlling error reporting
> One location where SO_REUSEADDR was set would report errors if setting the
> option failed. Keeping the reporting code there would be somewhat unclean, so
> I moved it to socket_set_fast_reuse. A side effect of this was that the error
> reporting was added for all locations that now use socket_set_fast_reuse. Here
> a new flag is added to control error reporting, which means this patchset
> won't change QEMU behaviour (except for not setting SO_REUSEADDR on Windows).
>
> - Fixed a commit message typo
>
> - Rebased to current master (2d1fe1873a984d1c2c89ffa3d12949cafc718551).
>
> v3 Changes:
> - Fixed coding style issues.
> According to checkpatch.pl patch #4 still introduces style errors as tabs are
> used instead of space for some indentation. I keept the tabs to stay
> consistent with the sourrounding code, as tabs seem to be used consitently in
> parts (all?) of the slirp code.
>
> - Changed patch #3 to keep SO_REUSEADDR for multicast sockets on windows and
> added an explainatory comment.
>
> - Rebased to current master (94c2b6aff43cdfcfdfb552773a6b6b973a72ef0b).
>
> v2 Changes:
>
> - Introduce a function with os specific implementation instead of using #ifdef
> I named it socket_set_fast_reuse instead of the suggested qemu_set_reuseaddr
> so the name better reflects what the function actually does.
>
> gdbstub.c | 6 ++----
> include/qemu/sockets.h | 1 +
> net/socket.c | 18 ++++++++++--------
> slirp/misc.c | 3 +--
> slirp/socket.c | 4 +---
> slirp/tcp_subr.c | 6 ++----
> slirp/udp.c | 4 ++--
> util/oslib-posix.c | 14 ++++++++++++++
> util/oslib-win32.c | 10 ++++++++++
> util/qemu-sockets.c | 6 +++---
> 10 files changed, 46 insertions(+), 26 deletions(-)
>
> util: add socket_set_fast_reuse function which will
> gdbstub: call socket_set_fast_reuse instead of
> net: call socket_set_fast_reuse instead of setting
> slirp: call socket_set_fast_reuse instead of setting
> util: call socket_set_fast_reuse instead of setting
>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
prev parent reply other threads:[~2013-09-18 12:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 14:23 [Qemu-devel] [PATCH v5 0/5] Do not set SO_REUSEADDR on Windows Sebastian Ottlik
2013-09-16 14:23 ` [Qemu-devel] [PATCH v5 1/5] util: add socket_set_fast_reuse function which will replace setting SO_REUSEADDR Sebastian Ottlik
2013-09-16 14:23 ` [Qemu-devel] [PATCH v5 2/5] gdbstub: call socket_set_fast_reuse instead of " Sebastian Ottlik
2013-09-16 14:23 ` [Qemu-devel] [PATCH v5 3/5] net: " Sebastian Ottlik
2013-09-16 14:23 ` [Qemu-devel] [PATCH v5 4/5] slirp: " Sebastian Ottlik
2013-09-16 14:23 ` [Qemu-devel] [PATCH v5 5/5] util: " Sebastian Ottlik
2013-09-16 14:55 ` [Qemu-devel] [PATCH v5 0/5] Do not set SO_REUSEADDR on Windows Paolo Bonzini
2013-09-16 15:10 ` Sebastian Ottlik
2013-09-18 16:58 ` Stefan Weil
2013-09-23 10:33 ` Sebastian Ottlik
2013-10-01 8:11 ` Sebastian Ottlik
2013-10-01 16:44 ` Stefan Weil
2013-09-18 12:42 ` Stefan Hajnoczi [this message]
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=20130918124223.GE13359@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=ottlik@fzi.de \
--cc=qemu-devel@nongnu.org \
--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).