All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows
@ 2013-08-15 19:25 Taimoor
  2013-08-30 11:04 ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Taimoor @ 2013-08-15 19:25 UTC (permalink / raw
  To: qemu-devel; +Cc: qemu-trivial, Taimoor Mirza

From: Taimoor Mirza <tmirza@codesourcery.com>

port redirection code uses SO_REUSEADDR socket option before binding to
host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
Relaunching QEMU with same host and guest port redirection values on Linux
throws error but on Windows it does not throw any error.
Problem is discussed in http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html

Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
---
Changes in v3:
- Removed extra commit

Changes in v2:
- Changed #ifdef to #ifndef as SO_REUSEADDR should not be set in case of Windows.

 slirp/socket.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/slirp/socket.c b/slirp/socket.c
index 8e8819c..25d60e7 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -627,7 +627,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
 	addr.sin_port = hport;
 
 	if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) ||
+#ifndef _WIN32
 	    (qemu_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(int)) < 0) ||
+#endif
 	    (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
 	    (listen(s,1) < 0)) {
 		int tmperrno = errno; /* Don't clobber the real reason we failed */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows
  2013-08-15 19:25 [Qemu-devel] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows Taimoor
@ 2013-08-30 11:04 ` Jan Kiszka
  2013-09-01 15:46   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2013-08-30 11:04 UTC (permalink / raw
  To: Taimoor, Stefan Weil; +Cc: qemu-trivial, Taimoor Mirza, qemu-devel

On 2013-08-15 21:25, Taimoor wrote:
> From: Taimoor Mirza <tmirza@codesourcery.com>
> 
> port redirection code uses SO_REUSEADDR socket option before binding to
> host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
> Relaunching QEMU with same host and guest port redirection values on Linux
> throws error but on Windows it does not throw any error.
> Problem is discussed in http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html
> 
> Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
> ---
> Changes in v3:
> - Removed extra commit
> 
> Changes in v2:
> - Changed #ifdef to #ifndef as SO_REUSEADDR should not be set in case of Windows.
> 
>  slirp/socket.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/slirp/socket.c b/slirp/socket.c
> index 8e8819c..25d60e7 100644
> --- a/slirp/socket.c
> +++ b/slirp/socket.c
> @@ -627,7 +627,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
>  	addr.sin_port = hport;
>  
>  	if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) ||
> +#ifndef _WIN32
>  	    (qemu_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(int)) < 0) ||
> +#endif
>  	    (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
>  	    (listen(s,1) < 0)) {
>  		int tmperrno = errno; /* Don't clobber the real reason we failed */
> 

Stefan, can you ack this? Then I would pick it up for the slirp queue.

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows
  2013-08-30 11:04 ` Jan Kiszka
@ 2013-09-01 15:46   ` Michael Tokarev
  2013-09-01 16:13     ` Stefan Weil
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Tokarev @ 2013-09-01 15:46 UTC (permalink / raw
  To: Jan Kiszka; +Cc: qemu-trivial, Stefan Weil, Taimoor, Taimoor Mirza, qemu-devel

30.08.2013 15:04, Jan Kiszka wrote:
> On 2013-08-15 21:25, Taimoor wrote:
>> From: Taimoor Mirza <tmirza@codesourcery.com>
>>
>> port redirection code uses SO_REUSEADDR socket option before binding to
>> host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
>> Relaunching QEMU with same host and guest port redirection values on Linux
>> throws error but on Windows it does not throw any error.
>> Problem is discussed in http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html
[]
> Stefan, can you ack this? Then I would pick it up for the slirp queue.

I remember having exactly the same issue myself a few years back with
the difference of SO_REUSEADDR behavour on windows and *nix, and the
suggested change appears to be correct.  So you can count on my

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

as well.

I applied the v2 of this patch (with a trivial fix) to trivial queue
(before seeing this v3), I can remove it if you like.

Thanks,

/mjt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows
  2013-09-01 15:46   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
@ 2013-09-01 16:13     ` Stefan Weil
  2013-09-02  1:36       ` Mirza, Taimoor
  2013-09-02  6:18       ` Jan Kiszka
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Weil @ 2013-09-01 16:13 UTC (permalink / raw
  To: Michael Tokarev; +Cc: qemu-trivial, Jan Kiszka, Taimoor Mirza, qemu-devel

Am 01.09.2013 17:46, schrieb Michael Tokarev:
> 30.08.2013 15:04, Jan Kiszka wrote:
>> On 2013-08-15 21:25, Taimoor wrote:
>>> From: Taimoor Mirza <tmirza@codesourcery.com>
>>>
>>> port redirection code uses SO_REUSEADDR socket option before binding to
>>> host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
>>> Relaunching QEMU with same host and guest port redirection values on
>>> Linux
>>> throws error but on Windows it does not throw any error.
>>> Problem is discussed in
>>> http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html
> []
>> Stefan, can you ack this? Then I would pick it up for the slirp queue.
>
> I remember having exactly the same issue myself a few years back with
> the difference of SO_REUSEADDR behavour on windows and *nix, and the
> suggested change appears to be correct.  So you can count on my
>
> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
>
> as well.
>
> I applied the v2 of this patch (with a trivial fix) to trivial queue
> (before seeing this v3), I can remove it if you like.
>
> Thanks,
>
> /mjt

Hi Michael,

thanks for your review of this patch. I had no opportunity to test
it myself, but I also think that it is fine.

(v2 + trivial fix) should be identical to v3, so this looks good, too.

Cheers,
Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows
  2013-09-01 16:13     ` Stefan Weil
@ 2013-09-02  1:36       ` Mirza, Taimoor
  2013-09-02  6:18       ` Jan Kiszka
  1 sibling, 0 replies; 6+ messages in thread
From: Mirza, Taimoor @ 2013-09-02  1:36 UTC (permalink / raw
  To: Stefan Weil, Michael Tokarev
  Cc: qemu-trivial@nongnu.org, Jan Kiszka, qemu-devel@nongnu.org

Hi Guys,

Thanks for reviewing the patch. Only difference between v2 and v3 is that v2 had an extra character added at top of the file (socket.c). This was removed in v3.

Regards,
Taimoor


________________________________________
From: Stefan Weil [sw@weilnetz.de]
Sent: Sunday, September 01, 2013 9:13 PM
To: Michael Tokarev
Cc: Jan Kiszka; qemu-trivial@nongnu.org; Mirza, Taimoor; qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows

Am 01.09.2013 17:46, schrieb Michael Tokarev:
> 30.08.2013 15:04, Jan Kiszka wrote:
>> On 2013-08-15 21:25, Taimoor wrote:
>>> From: Taimoor Mirza <tmirza@codesourcery.com>
>>>
>>> port redirection code uses SO_REUSEADDR socket option before binding to
>>> host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
>>> Relaunching QEMU with same host and guest port redirection values on
>>> Linux
>>> throws error but on Windows it does not throw any error.
>>> Problem is discussed in
>>> http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html
> []
>> Stefan, can you ack this? Then I would pick it up for the slirp queue.
>
> I remember having exactly the same issue myself a few years back with
> the difference of SO_REUSEADDR behavour on windows and *nix, and the
> suggested change appears to be correct.  So you can count on my
>
> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
>
> as well.
>
> I applied the v2 of this patch (with a trivial fix) to trivial queue
> (before seeing this v3), I can remove it if you like.
>
> Thanks,
>
> /mjt

Hi Michael,

thanks for your review of this patch. I had no opportunity to test
it myself, but I also think that it is fine.

(v2 + trivial fix) should be identical to v3, so this looks good, too.

Cheers,
Stefan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows
  2013-09-01 16:13     ` Stefan Weil
  2013-09-02  1:36       ` Mirza, Taimoor
@ 2013-09-02  6:18       ` Jan Kiszka
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2013-09-02  6:18 UTC (permalink / raw
  To: Stefan Weil; +Cc: qemu-trivial, Taimoor Mirza, Michael Tokarev, qemu-devel

On 2013-09-01 18:13, Stefan Weil wrote:
> Am 01.09.2013 17:46, schrieb Michael Tokarev:
>> 30.08.2013 15:04, Jan Kiszka wrote:
>>> On 2013-08-15 21:25, Taimoor wrote:
>>>> From: Taimoor Mirza <tmirza@codesourcery.com>
>>>>
>>>> port redirection code uses SO_REUSEADDR socket option before binding to
>>>> host port. Behavior of SO_REUSEADDR is different on Windows and Linux.
>>>> Relaunching QEMU with same host and guest port redirection values on
>>>> Linux
>>>> throws error but on Windows it does not throw any error.
>>>> Problem is discussed in
>>>> http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03089.html
>> []
>>> Stefan, can you ack this? Then I would pick it up for the slirp queue.
>>
>> I remember having exactly the same issue myself a few years back with
>> the difference of SO_REUSEADDR behavour on windows and *nix, and the
>> suggested change appears to be correct.  So you can count on my
>>
>> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
>>
>> as well.
>>
>> I applied the v2 of this patch (with a trivial fix) to trivial queue
>> (before seeing this v3), I can remove it if you like.
>>
>> Thanks,
>>
>> /mjt
> 
> Hi Michael,
> 
> thanks for your review of this patch. I had no opportunity to test
> it myself, but I also think that it is fine.
> 
> (v2 + trivial fix) should be identical to v3, so this looks good, too.

Yep, fine with me as well.

Thanks, everyone.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-02  6:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-15 19:25 [Qemu-devel] [PATCH v3] slirp: Port redirection option behave differently on Linux and Windows Taimoor
2013-08-30 11:04 ` Jan Kiszka
2013-09-01 15:46   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-09-01 16:13     ` Stefan Weil
2013-09-02  1:36       ` Mirza, Taimoor
2013-09-02  6:18       ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.