summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2013-11-28 13:13:57 +0000
committerEric Faurot <eric@cvs.openbsd.org>2013-11-28 13:13:57 +0000
commit8dfa88f8a11b4711c88499388d0444e6ba28129a (patch)
treee83f86046465318ce811e976b6d5799d8e4ebd79 /usr.sbin
parent19d017c28a2b4e3d999af0eac4c83907caa2bd5f (diff)
limit the number of envelopes to recall in the hoststat cache.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/mta.c5
-rw-r--r--usr.sbin/smtpd/parse.y9
-rw-r--r--usr.sbin/smtpd/smtpd.h4
3 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 7c827ab675a..0dd3abde268 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.171 2013/11/06 10:01:29 eric Exp $ */
+/* $OpenBSD: mta.c,v 1.172 2013/11/28 13:13:56 eric Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -2292,6 +2292,9 @@ mta_hoststat_cache(const char *host, uint64_t evpid)
if (hs == NULL)
return;
+ if (tree_count(&hs->deferred) >= env->sc_mta_max_deferred)
+ return;
+
tree_set(&hs->deferred, evpid, NULL);
}
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 31bfb25c67e..8be31337428 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.131 2013/11/25 19:17:07 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.132 2013/11/28 13:13:56 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -141,7 +141,7 @@ typedef struct {
%}
-%token AS QUEUE COMPRESSION ENCRYPTION MAXMESSAGESIZE LISTEN ON ANY PORT EXPIRE
+%token AS QUEUE COMPRESSION ENCRYPTION MAXMESSAGESIZE MAXMTADEFERRED LISTEN ON ANY PORT EXPIRE
%token TABLE SECURE SMTPS CERTIFICATE DOMAIN BOUNCEWARN LIMIT INET4 INET6
%token RELAY BACKUP VIA DELIVER TO LMTP MAILDIR MBOX HOSTNAME HOSTNAMES
%token ACCEPT REJECT INCLUDE ERROR MDA FROM FOR SOURCE MTA PKI SCHEDULER
@@ -577,6 +577,9 @@ main : BOUNCEWARN {
| MAXMESSAGESIZE size {
conf->sc_maxsize = $2;
}
+ | MAXMTADEFERRED NUMBER {
+ conf->sc_mta_max_deferred = $2;
+ }
| LIMIT MDA limits_mda
| LIMIT MTA FOR DOMAIN STRING {
struct mta_limits *d;
@@ -1144,6 +1147,7 @@ lookup(char *s)
{ "maildir", MAILDIR },
{ "mask-source", MASK_SOURCE },
{ "max-message-size", MAXMESSAGESIZE },
+ { "max-mta-deferred", MAXMTADEFERRED },
{ "mbox", MBOX },
{ "mda", MDA },
{ "mta", MTA },
@@ -1555,6 +1559,7 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts)
conf->sc_qexpire = SMTPD_QUEUE_EXPIRY;
conf->sc_opts = opts;
+ conf->sc_mta_max_deferred = 100;
conf->sc_scheduler_max_inflight = 5000;
conf->sc_mda_max_session = 50;
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index a2278d417ae..087ab13d663 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.436 2013/11/20 09:22:42 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.437 2013/11/28 13:13:56 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -511,6 +511,8 @@ struct smtpd {
size_t sc_mda_task_lowat;
size_t sc_mda_task_release;
+ size_t sc_mta_max_deferred;
+
size_t sc_scheduler_max_inflight;
int sc_qexpire;