slirp: Port redirection option behave differently on Linux and Windows
PATCH v3 1/1 slirp: Port redirection option behave differently on Linux and Windows
From: Taimoor Mirza <[email protected]>
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
---
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(-)
slirp/socket.c +2 -0
@@ -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 */
Signature · 1 line
1.7.5.4
Quoted 25 lines · Taimoor
From: Taimoor Mirza <[email protected]>
port redirection code uses
SO_REUSEADDRsocket option before binding to host port. Behavior ofSO_REUSEADDRis 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.htmlSigned-off-by Taimoor Mirza <[email protected]>---
Changes in v3:
- Removed extra commitChanges in v2:
- Changed #ifdef to #ifndef asSO_REUSEADDRshould not be set in case of Windows.slirp/socket.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)slirp/socket.c +0
-0
slirp/socket.c tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, · line 635
Quoted 9 lines
slirp/socket.c +2
-0@@ -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
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Taimoor
From: Taimoor Mirza <[email protected]>
port redirection code uses
SO_REUSEADDRsocket option before binding to host port. Behavior ofSO_REUSEADDRis 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
[]
Quoted 1 line
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
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
Am 01.09.2013 17:46, schrieb Michael Tokarev:
Quoted 20 lines
Quoted 10 lines · Jan Kiszka
Quoted 9 lines · Taimoor
From: Taimoor Mirza <[email protected]>
port redirection code uses
SO_REUSEADDRsocket option before binding to host port. Behavior ofSO_REUSEADDRis 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[]
Quoted 1 line
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_REUSEADDRbehavour on windows and *nix, and the suggested change appears to be correct. So you can count on myReviewed-by Michael Tokarev <[email protected]>
Quoted 8 lines
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
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 [[email protected]]
Sent: Sunday, September 01, 2013 9:13 PM
To: Michael Tokarev
Cc: Jan Kiszka; [email protected]; Mirza, Taimoor; [email protected]
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:
Quoted 20 lines
Quoted 10 lines · Jan Kiszka
Quoted 9 lines · Taimoor
From: Taimoor Mirza <[email protected]>
port redirection code uses
SO_REUSEADDRsocket option before binding to host port. Behavior ofSO_REUSEADDRis 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[]
Quoted 1 line
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_REUSEADDRbehavour on windows and *nix, and the suggested change appears to be correct. So you can count on myReviewed-by Michael Tokarev <[email protected]>
Quoted 8 lines
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
Quoted 28 lines · Stefan Weil
Am 01.09.2013 17:46, schrieb Michael Tokarev:
Quoted 27 lines
Quoted 10 lines · Jan Kiszka
Quoted 9 lines · Taimoor
From: Taimoor Mirza <[email protected]>
port redirection code uses
SO_REUSEADDRsocket option before binding to host port. Behavior ofSO_REUSEADDRis 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[]
Quoted 1 line
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_REUSEADDRbehavour on windows and *nix, and the suggested change appears to be correct. So you can count on myReviewed-by Michael Tokarev <[email protected]>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,
Quoted 8 lines
Quoted 1 line
/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
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux