slirp: Port redirection option behave differently on Linux and Windows
PATCH 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
--- 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 ) || +#ifdef _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
Am 13.08.2013 22:00, schrieb Taimoor:
Quoted 18 lines
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]>--- 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 630
Quoted 4 lines
slirp/socket.c +1
-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) || +#ifdef _WIN32
Shouldn't this be replaced by #ifndef _WIN32?
Quoted 5 lines
slirp/socket.c +1
-0(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 */
Thanks for reviewing the patch
Quoted 21 lines · Stefan Weil
Am 13.08.2013 22:00, schrieb Taimoor:
Quoted 20 lines
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]>--- slirp/socket.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)slirp/socket.c +0
-0@@ -627,7 +627,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, addr.sin_port = hport;
Quoted 4 lines
slirp/socket.c tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, · line 630
Quoted 2 lines
slirp/socket.c +1
-0if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) || +#ifdef _WIN32Shouldn't this be replaced by #ifndef
_WIN32?
Yes it should be. I am resending the patch
Quoted 7 lines
slirp/socket.c tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, · line 635
Quoted 6 lines
slirp/socket.c +1
-0(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 */
-Taimoor
PATCH 1/1 slirp: Port redirection option behave differently on Linux and Windows
In reply to TaimoorFrom: 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
--- 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 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
When resending a patch, please use a v2 in the subject line (git send-email --subject-prefix PATCHv2), send as a top-level thread, and include a changelog after the --- divider that explains what changed from v1. See http://wiki.qemu.org/Contribute/SubmitAPatch for more hints.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 9 lines · Eric Blake
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 4 lines
When resending a patch, please use a v2 in the subject line (git send-email --subject-prefix PATCHv2), send as a top-level thread, and include a changelog after the --- divider that explains what changed from v1. See http://wiki.qemu.org/Contribute/SubmitAPatch for more hints.
Thanks Eric. Should I resend with changelog of v2 and v2 in subject line?
Quoted 5 lines
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Quoted 10 lines · Taimoor Mirza
Quoted 9 lines · Eric Blake
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 7 lines
Quoted 4 lines
When resending a patch, please use a v2 in the subject line (git send-email --subject-prefix PATCHv2), send as a top-level thread, and include a changelog after the --- divider that explains what changed from v1. See http://wiki.qemu.org/Contribute/SubmitAPatch for more hints.
Thanks Eric. Should I resend with changelog of v2 and v2 in subject line?
Yes, doing so will give it better visibility.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org