summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/runner.c
AgeCommit message (Collapse)Author
2011-05-16murder struct path and make sure smtpd uses simpler structures that do notGilles Chehade
bring a shitload of unnecessary information everywhere. this required many parts of smtpd to be refactored and more specifically envelope expansion. in the process lots of code got simplified, and the envelope expansion code has been isolated to lka_session.c with some longstanding bugs fixed. Diff has been tested by many with no major regression reported. armani@ spotted a bug in a setup where a domain is listed a both primary and virtual, I will fix that in-tree as it's becoming painful to maintain this diff out.
2011-05-01the smtpd env is meant to be global, so do not pass it all around.Eric Faurot
discussed with and ok gilles@
2011-04-17cleanups, cosmethic changes, functions that should be static are now staticGilles Chehade
no functionnal change
2011-04-17a structure describing an envelope should be called struct envelope, notGilles Chehade
struct message ...
2011-04-15whenever an envelope is reinserted into the ramqueue after a trip to mda orGilles Chehade
mta, call runner_reset_events() so runner starts reprocessing ramqueue
2011-04-15kill message_id and message_uidGilles Chehade
smtpd now has an evpid associated to each delivery message, the evpid is an u_int64_t where the upper 32 bits are the msgid, and the 32 bits are the envelope unique identifier for that message. this results in lots of space saved in both disk-based and ram-based queues, but also simplifies a lot of code. change has been stressed on my desktop, and has ran on my MX for the entire afternoon without a regression.
2011-04-15temporarily add fsqueue_hash() prototype until runner is fully converted toGilles Chehade
queue_backend API
2011-04-14bye bye queue_hash() you can now rest in peace.Gilles Chehade
2011-04-14- implement fsqueue_message_create() and fsqueue_message_commit()Gilles Chehade
- change a few prototypes to allow bounce messages to use the queue_backend API until it gets merged in - kill functions of the queue API that have been deprecated
2011-04-14fsqueue now provides fsqueue_message_fd_r() and fsqueue_message_fd_rw() toGilles Chehade
obtain a read{-only,/write} descriptor to the message file. make sure smtpd uses the new API everywhere it needs a fd, and kill the many functions that were used until now.
2011-04-14fsqueue queue backend will implement a filesystem queue:Gilles Chehade
- fsqueue->setup() performs the queue initialization; - fsqueue->message() controls messages; - fsqueue->envelope() controls envelopes; This commit brings the following to fsbackend: fsqueue_setup(), fsqueue_message_delete(), fsqueue_envelope_load(), fsqueue_envelope_update(), fsqueue_envelope_delete(). It also makes smtpd use the queue_backend API for these operations.
2011-04-13following an idea from jacekm@, smtpd now uses a ram-queue instead of doingGilles Chehade
a continuous walk on the disk-queue. the implementation differs from what jacekm@ commited (and I backed out) a while ago in that it uses a queue and a host tree required for upcoming features. code will be improved in tree, it requires changes to be done in queue and bounce API, I just wanted to commit a working version first ... tested by todd@ and I
2010-11-28remove all unused headersGilles Chehade
2010-11-28a bit of .h cleanups, no functionnal changeGilles Chehade
2010-11-24add *maxactive statsTodd T. Fries
"ok and no need to keep them for yourself" gilles@
2010-10-28teach smtpd how to handle per-rule delays for message expiry, this allowsGilles Chehade
some rules to have a longer expiry delay than the default: accept for [...] relay expire 8d # will stay 8 days in queue I added the man page bits so I don't forget but I need to reword it a bit
2010-10-09these need to be re-added tooGilles Chehade
2010-06-01new queue, again; gcc2 compile tested by deraadtJacek Masiulaniec
2010-06-01New queue doesn't compile on gcc2, back out. Spotted by deraadt@Jacek Masiulaniec
2010-05-31Rewrite entire queue code.Jacek Masiulaniec
Major goals: 1) Fix bad performance caused by the runner process doing full queue read in 1s intervals. My Soekris can now happily accept >50 msg/s while having multi-thousand queue; before, one hundred queue would bring the system to its knees. 2) Introduce Qmail-like scheduler that doesn't write as much to the disk so that it needs less code for servicing error conditions, which in some places can be tricky to get right. 3) Introduce separation between the scheduler and the backend; these two queue aspects shouldn't be too tied too each other. This means that eg. storing queue in SQL requires rewrite of just queue_backend.c. 4) Make on-disk queue format architecture independent, and more easily extensible, to reduce number of flag days in the future. Minor goals: ENOSPC no longer prevents delivery attempts, fixed session limiting for relayed mail, improved batching of "relay via" mails, human-readable mailq output, "show queue raw" command, clearer logging, sending of single bounce about multiple recipients, exact delay= computation, zero delay between deliveries while within session limit (currently 1s delay between re-scheduling is enforced), mta no longer requests content fd, corrected session limit for bounce submissions, tiny <100B queue files instead of multi-KB, detect loops before accepting mail, reduce traffic on imsg channels by killing enormous struct submit_status.
2010-05-19cleanup-only commit, removes unrequired includes, no functionnal changeGilles Chehade
2010-04-22Fix a case of runner trying to send imsg directly to smtp process insteadJacek Masiulaniec
of forwarding it via queue.
2010-04-22- kill the runner_imsg_compose wrapper to reduce indirectionJacek Masiulaniec
- kill noisy log_debug
2010-04-21Runner process is just a helper for queue, so tear down its imsgJacek Masiulaniec
channels to parent, mda, mta, lka, smtp, and control. This leaves just the channel to queue, which forwards imsgs on runner's behalf and redirects any replies back to it. OK gilles@
2010-04-21Remove unusable ifdef DEBUG code.Jacek Masiulaniec
2010-04-21Fix logic error just like the one in previous revision.Jacek Masiulaniec
2010-04-20Fix crash that could happen when attempting ``smtpctl remove'' whileJacek Masiulaniec
the message is being delivered.
2010-04-20Kill *2400* lines of code by abstracting common bits of the imsg handlers.Jacek Masiulaniec
2010-04-19Simplify local delivery codepath:Jacek Masiulaniec
- replace uses of struct batch in the parent with simpler struct delivery. - replace IMSG_BATCH_* dance with single IMSG_MDA_SESS_NEW. - make mda assume it delivers to external program over a pipe. - fork helper process when delivering to maildir or a file. New feature: upon external mda failure use last line of its output as an error message. With input and tests from nicm@. OK nicm@ gilles@
2010-01-10- teach runner how to remove a message from queue given a message id/uidGilles Chehade
and assuming message is not in processing/scheduled state - teach smtpctl how to request message removal from runner discussed with todd@, idea ok jacekm@
2010-01-03Implement "log verbose" and "log brief" to enable or disable verbose debugCharles Longeau
logging on runtime. Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd. With help/ideas/testing from gilles@ jacekm@ todd@ ok jacekm@
2009-12-14Tweak the logic behind setting the fd limits so that smtpd is less likelyJacek Masiulaniec
to get upset by custom soft/hard ulimit settings. Suggested by todd@
2009-12-14Control maximum number of bounce sessions similarly to how the mta and mdaJacek Masiulaniec
are now controlled.
2009-12-14Impose sessions limit on the delivery sessions (mta and mda).Jacek Masiulaniec
2009-12-13Use safe fd limits in smtp, lka, queue, and control. Removes aJacek Masiulaniec
possibility for fd-starvation fatal when under heavy load.
2009-11-08rework a bit expansion and data structures involved in the expansion so weGilles Chehade
no longer have a direct mapping between structures saved in aliases/virtual db and structures used at runtime during expansion. side effects ? struct alias is smaller, databases are smaller and it is no longer necessary to rebuild aliases/virtual databases each time jacekm@ or I make changes to some obscure structure used indirectely during expansion rebuild databases, flush queues, make clean
2009-11-08- make aliases expansion use a rb tree instead of a tail queue, the codeGilles Chehade
doesn't take advantage of the new structure yet, but this was a needed change for upcoming improvements. - introduce aliasestree_{lookup,insert,remove} to the aliases api - rename queue_generate_id() to generate_uid() and move it to utils.c as it is used all over the place and not only in queue tree idea discussed with jacekm@, if you update rebuild aliases db, make clean and flush queue
2009-11-03Improve error logging.Jacek Masiulaniec
2009-11-01fix a couple log_info()s,Gilles Chehade
from Tim van der Molen <tbvdm@xs4all.nl>
2009-10-12- fix a null deref which could happen after a couple iterations of theGilles Chehade
aliases/virtual domains resolution code. - fix a logic bug which caused virtual domains not to be correctly handled after one iteration of the aliases resolution code. - introduce a few helper functions to help clean up and simplify the lka code. - simplify the IS_EXT/IS_MAILBOX/IS_RELAY macros so they manipulate a struct path * instead of the mess of dereferences we were passing them.
2009-09-04Fix scheduling of bounces that could not be delivered.Jacek Masiulaniec
ok gilles@
2009-09-04Fix scheduling of bounce messages.Jacek Masiulaniec
From gilles@
2009-09-04Fix a crash when messagep->batch_id is read from disk and used longJacek Masiulaniec
after the batch has ceased to exist. From gilles@
2009-09-03imsg_get sets errno so use fatal instead of fatalx.Jacek Masiulaniec
2009-08-27Implement client side of the SMTP protocol in a library-like module.Jacek Masiulaniec
Make bounce code and /usr/sbin/sendmail interface use this new API. The mta process continues to use its own implementation, but eventually will be switched to use this shared module. Buffer routines are taken from buffer.c rather than from evbuffer. This is one step forward to using a single buffer API across the program. "it looks sexy" gilles@
2009-08-11call reset_flags in bounce_session failure code path.Jacek Masiulaniec
2009-08-11do not repeat flag resetting code, introduce reset_flags().Jacek Masiulaniec
discussed with gilles
2009-08-08import some changes from portable smtpd to reduce the delta between both.Gilles Chehade
this commit contains mostly missing casts and cosmethic changes, do not expect to build this anywhere but on OpenBSD, it does not contain any of the portable glue.
2009-08-06- change all occurences of T_DAEMON_BATCH,MESSAGE to T_BOUNCE_BATCH/MESSAGEGilles Chehade
- make sure T_BOUNCE_MESSAGE is no longer OR-ed to T_MDA/MTA_MESSAGE - define F_MESSAGE_BOUNCE flag and make sure bounce sessions set it - teach smtpctl show queue how to recognize a bounce message
2009-08-06replace X-OpenSMPTD-Loop with Delivered-ToGilles Chehade
idea by jacekm@ a few weeks ago, discussed with pyr