qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Set SO_REUSEADDR at the right time
@ 2006-03-04  2:18 Nickolai Zeldovich
  2006-03-04 10:39 ` [Qemu-devel] PPC linking error Fausto Saporito
  0 siblings, 1 reply; 3+ messages in thread
From: Nickolai Zeldovich @ 2006-03-04  2:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: nickolai

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 <nickolai@cs.stanford.edu>
To: qemu-devel@nongnu.org
Cc: nickolai@cs.stanford.edu
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);

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

end of thread, other threads:[~2006-03-05  5:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-04  2:18 [Qemu-devel] [PATCH] Set SO_REUSEADDR at the right time Nickolai Zeldovich
2006-03-04 10:39 ` [Qemu-devel] PPC linking error Fausto Saporito
2006-03-05 10:53   ` Mulyadi Santosa

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).