diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2015-02-22 20:14:14 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2015-02-22 20:14:14 +0100 |
commit | 9c89560e6cdf44a21b2eff8765973ed8665fa07f (patch) | |
tree | ef22b54c7c05b5c44776bab239d19bf60a1d9265 /sysdep/unix | |
parent | 6cf72d7ad7cbe1eb2f5b63660be6967d29b37044 (diff) |
Use IP_PORTRANGE_HIGH for BFD where available
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/io.c | 16 |
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); } - - |