repositories
/
deb_libnfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
59f298f
)
Try to rotate the ports we assign when root better so we dont reuse
author
Ronnie Sahlberg
<ronniesahlberg@gmail.com>
Mon, 2 Jan 2012 20:25:25 +0000
(07:25 +1100)
committer
Ronnie Sahlberg
<ronniesahlberg@gmail.com>
Mon, 2 Jan 2012 20:25:25 +0000
(07:25 +1100)
a port htat is in time-wait too frequently
lib/socket.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/socket.c
b/lib/socket.c
index 23c3f1028af169383a454ce8483e951e058af304..ea16d8c9e508f7ab247ec892b29196136717828c 100644
(file)
--- a/
lib/socket.c
+++ b/
lib/socket.c
@@
-381,14
+381,17
@@
static int rpc_connect_sockaddr_async(struct rpc_context *rpc, struct sockaddr_s
* to make the executable able to bind to a system port.
*/
if (1) {
- int port;
+ static int port = 200;
+ int i;
int one = 1;
setsockopt(rpc->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one));
- for (
port = 200; port < 500; port
++) {
+ for (
i = 0; i < 500; i
++) {
struct sockaddr_in sin;
+ if(++port > 700) port = 200;
+
memset(&sin, 0, sizeof(sin));
sin.sin_port = htons(port);
sin.sin_family = AF_INET;