summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relay.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2010-11-30 14:38:46 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2010-11-30 14:38:46 +0000
commit7ea40dff4280f76e0960ee9f89356940ef086de8 (patch)
tree6b9fb3462a9cbdc8af6180a1105ce6e1ca1d2169 /usr.sbin/relayd/relay.c
parent9620c54f3a872c8681d22dc31eaecc6545b83540 (diff)
The relayd processes did already bump up the socket file descriptor
resource limits to the maximum of the daemon class but the host check process (hce/health checks) didn't and was limited to a fairly low default of 128 open sockets (openfiles-cur=128 in login.conf). This was reached fairly quickly with "check tcp" of many hosts. This diff increases the maximum number of monitored hosts and concurrent health checks in relayd in a significant way and may fix issues for people that have around 100 or more hosts (or fewer hosts with multiple checked ports). tested by phessler@ ok jsg@
Diffstat (limited to 'usr.sbin/relayd/relay.c')
-rw-r--r--usr.sbin/relayd/relay.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index a9d9caff74b..a5825d5b281 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.125 2010/11/24 13:57:05 jsg Exp $ */
+/* $OpenBSD: relay.c,v 1.126 2010/11/30 14:38:45 reyk Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -24,7 +24,6 @@
#include <sys/un.h>
#include <sys/tree.h>
#include <sys/hash.h>
-#include <sys/resource.h>
#include <net/if.h>
#include <netinet/in_systm.h>
@@ -460,19 +459,9 @@ relay_init(void)
struct relay *rlay;
struct host *host;
struct timeval tv;
- struct rlimit rl;
- if (getrlimit(RLIMIT_NOFILE, &rl) == -1)
- fatal("relay_init: failed to get resource limit");
- log_debug("relay_init: max open files %d", rl.rlim_max);
-
- /*
- * Allow the maximum number of open file descriptors for this
- * login class (which should be the class "daemon" by default).
- */
- rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
- fatal("relay_init: failed to set resource limit");
+ /* Unlimited file descriptors (use system limits) */
+ socket_rlimit(-1);
TAILQ_FOREACH(rlay, env->sc_relays, rl_entry) {
if ((rlay->rl_conf.flags & (F_SSL|F_SSLCLIENT)) &&