summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 04f0fe50..daf9d054 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1305,7 +1305,7 @@ sk_passive_connected(sock *s, int type)
log(L_ERR "SOCK: Incoming connection: %s%#m", t->err);
/* FIXME: handle it better in rfree() */
- close(t->fd);
+ close(t->fd);
t->fd = -1;
rfree(t);
return 1;
@@ -1348,7 +1348,7 @@ sk_open(sock *s)
bind_addr = s->saddr;
do_bind = bind_port || ipa_nonzero(bind_addr);
break;
-
+
case SK_UDP:
fd = socket(af, SOCK_DGRAM, IPPROTO_UDP);
bind_port = s->sport;
@@ -1399,6 +1399,14 @@ sk_open(sock *s)
}
#endif
}
+#ifdef IP_PORTRANGE
+ else if (s->flags & SKF_HIGH_PORT)
+ {
+ int range = IP_PORTRANGE_HIGH;
+ if (setsockopt(fd, IPPROTO_IP, IP_PORTRANGE, &range, sizeof(range)) < 0)
+ log(L_WARN "Socket error: %s%#m", "IP_PORTRANGE");
+ }
+#endif
sockaddr_fill(&sa, af, bind_addr, s->iface, bind_port);
if (bind(fd, &sa.sa, SA_LEN(sa)) < 0)
@@ -1661,7 +1669,7 @@ sk_rx_ready(sock *s)
redo:
rv = select(s->fd+1, &rd, &wr, NULL, &timo);
-
+
if ((rv < 0) && (errno == EINTR || errno == EAGAIN))
goto redo;
@@ -2026,5 +2034,3 @@ test_old_bird(char *path)
die("I found another BIRD running.");
close(fd);
}
-
-