linux-um archives
 help / color / mirror / Atom feed
From: Michael Clark <michael@metaparadigm.com>
To: UML Devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] [PATCH] make port channel use setsockopt SO_REUSEADDR
Date: Tue, 06 Jul 2004 19:09:29 +0800	[thread overview]
Message-ID: <40EA8869.8050602@metaparadigm.com> (raw)

[-- 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);

             reply	other threads:[~2004-07-06 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-06 11:09 Michael Clark [this message]
2004-07-13 19:05 ` [uml-devel] [PATCH] make port channel use setsockopt SO_REUSEADDR Jeff Dike
2004-07-14  0:11   ` Michael Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40EA8869.8050602@metaparadigm.com \
    --to=michael@metaparadigm.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox