summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2015-11-24 15:21:11 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2015-11-24 15:21:11 +0100
commit90f78507f4a13673ccf0ba7c786b43d9e882fca7 (patch)
treee7881d0b56a45609514a4aa9f75873fcad813f0e /sysdep/unix/io.c
parent8eb8e546dc8cc647fcfa4a3a17dfa8ab36b00958 (diff)
parentad27615760e2795da3efe5e97c0e888281d5ca59 (diff)
Merge branch 'master' into rip-new
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 0724667d..b636e799 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1328,6 +1328,18 @@ sk_passive_connected(sock *s, int type)
log(L_WARN "SOCK: Cannot get remote IP address for TCP<");
}
+ if (fd >= FD_SETSIZE)
+ {
+ /* FIXME: Call err_hook instead ? */
+ log(L_ERR "SOCK: Incoming connection from %I%J (port %d) %s",
+ t->daddr, ipa_is_link_local(t->daddr) ? t->iface : NULL,
+ t->dport, "rejected due to FD_SETSIZE limit");
+ close(fd);
+ t->fd = -1;
+ rfree(t);
+ return 1;
+ }
+
if (sk_setup(t) < 0)
{
/* FIXME: Call err_hook instead ? */
@@ -1404,6 +1416,9 @@ sk_open(sock *s)
if (fd < 0)
ERR("socket");
+ if (fd >= FD_SETSIZE)
+ ERR2("FD_SETSIZE limit reached");
+
s->af = af;
s->fd = fd;