All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [PATCH] make port channel use setsockopt SO_REUSEADDR
@ 2004-07-06 11:09 Michael Clark
  2004-07-13 19:05 ` Jeff Dike
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Clark @ 2004-07-06 11:09 UTC (permalink / raw)
  To: UML Devel

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

Hi All,

Small patch to make port channels allow reuse of local addresses.
Useful in the case where you restart a UML from a script and you
don't want to have to allocate a new port number each time.

~mc

[-- Attachment #2: uml-port-reuseaddr.patch --]
[-- Type: text/x-patch, Size: 575 bytes --]

--- linux-2.6.7-uml/arch/um/drivers/port_user.c.orig	2004-07-06 18:48:45.000000000 +0800
+++ linux-2.6.7-uml/arch/um/drivers/port_user.c	2004-07-06 18:51:11.000000000 +0800
@@ -118,12 +118,16 @@
 int port_listen_fd(int port)
 {
 	struct sockaddr_in addr;
-	int fd, err;
+	int fd, err, arg;
 
 	fd = socket(PF_INET, SOCK_STREAM, 0);
 	if(fd == -1) 
 		return(-errno);
 
+	arg = 1;
+	if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0)
+		return(-errno);
+
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(port);
 	addr.sin_addr.s_addr = htonl(INADDR_ANY);

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

end of thread, other threads:[~2004-07-14  0:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-06 11:09 [uml-devel] [PATCH] make port channel use setsockopt SO_REUSEADDR Michael Clark
2004-07-13 19:05 ` Jeff Dike
2004-07-14  0:11   ` Michael Clark

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.