[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Set SO_REUSEADDR at the right time
From: |
Nickolai Zeldovich |
Subject: |
[Qemu-devel] [PATCH] Set SO_REUSEADDR at the right time |
Date: |
Fri, 3 Mar 2006 18:18:38 -0800 (PST) |
I sent this a while back, but I just ran into this problem on a second
machine myself, so following John Hogerhuis's advice, I'm resubmitting
this patch with a [PATCH] prefix in the subject line..
-- kolya
---------- Forwarded message ----------
Date: Mon, 16 Jan 2006 16:03:32 -0800 (PST)
From: Nickolai Zeldovich <address@hidden>
To: address@hidden
Cc: address@hidden
Subject: Set SO_REUSEADDR at the right time
It looks like qemu (at least version 0.7.2, which is what I'm running
here) doesn't set SO_REUSEADDR before calling bind(), which makes that
fairly useless. This obvious patch moves up setting SO_REUSEADDR to the
right place, just before bind().
Apologies if this is already fixed in 0.8.0.
-- kolya
--- slirp/socket.c.orig 2006-01-16 15:54:40.993024000 -0800
+++ slirp/socket.c 2006-01-16 15:55:06.049849000 -0800
@@ -573,6 +573,7 @@
addr.sin_port = port;
if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
+ (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) ||
(bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
(listen(s,1) < 0)) {
int tmperrno = errno; /* Don't clobber the real reason we
failed */
@@ -587,7 +588,6 @@
#endif
return NULL;
}
- setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
getsockname(s,(struct sockaddr *)&addr,&addrlen);
- [Qemu-devel] [PATCH] Set SO_REUSEADDR at the right time,
Nickolai Zeldovich <=