summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpctl.c
AgeCommit message (Collapse)Author
2012-10-10teach smtpctl how to display envelopes and messages using their id.Gilles Chehade
this allows an admin to inspect the queue without having to manually extract bucket and find the path to an envelope or message. diff by Sunil Nimmagadda <sunil@poolp.org> ok eric@, chl@ and I
2012-09-19use lower case for envelope fields.Eric Faurot
requested by gilles@
2012-09-19Remove DF_ENQUEUE flag. It is mostly unused and logically broken.Eric Faurot
Ignore it in existing envelopes until it gets completely dropped. Change "smtpctl show queue" to display the address family of the envelope source instead of the ENQUEUE flag. ok gilles@
2012-08-30- rename show_envelope() to show_queue_envelope()Gilles Chehade
- remove SHOW_RUNQUEUE it was a noop since runqueues have been removed years ago from smtpd
2012-08-25- introduce struct stat_valueGilles Chehade
- statistics can now have a type (counter, timestamp, timeval, timespec and possibly others in the future) - stat_increment() / stat_decrement() now take an increment/decrement value and are at the moment only of type counter - stat_set() now takes a stat_value - provide helpers to convert raw values to stat_value ok eric@, ok chl@ while at it fix a rq_queue_dump() call using a bogus timestamp in scheduler ramqueue.
2012-08-19coding style: replace all occurences of u_int* with uint*Charles Longeau
ok eric@
2012-08-18- introduce stat_backend, an API for pluggable statistic backendsGilles Chehade
> statistics are no longer static structures in shared memory > statistics are only set, smtpd never uses them in its logic > each statistic is a key/value where key can be any (dynamic) string - convert all uses of the former API to use the new one - implement stat_ramstat that keeps non-persistent stats in ram structure ok eric@, ok chl@
2012-08-08remove useless definesEric Faurot
ok gilles@ chl@
2012-08-07fix evpid parsing on 32bit archsEric Faurot
ok gilles@
2012-07-09- runner is the terminology we used back when we had runqueues, we noGilles Chehade
longer have them and runner is actually a scheduler so rename. - introduce scheduler_backend which does the same to scheduler than queue_backend does to queue and map_backend does to maps - remove all occurences of RUNNER and runner, replace them with SCHEDULER and scheduler ok eric@, ok chl@
2012-07-02Lookup queue and scheduler backends by name, rather than enum.Eric Faurot
Add a command-line option to specify the backend to use at runtime. ok gilles@
2012-06-20Finally get rid of the queue_kind enum in the queue API. Keep thatEric Faurot
internally in fsqueue backend for now, and let the fsqueue_message() and fsqueue_envelope() dispatchers do the right thing. Based on a diff by chl@ ok chl@ gilles@
2012-05-13Remove sizes entry so it doesn't appear as a valid command in theNicholas Marriott
"smtpctl show" output, and use errx rather than err for the unknown message error. ok gilles
2012-04-15Remove dead assignments and newly created unused variables.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok gilles@
2012-01-28- introduce the scheduler_backend APIGilles Chehade
- introduce the scheduler_ramqueue backend - remove all occurences of ramqueue outside of the ramqueue backend - teach runner how to use the new API it is now possible to write custom schedulers ! ok eric@, ok chl@
2012-01-24Add a parameter to the queue backend init() call to specify wether theEric Faurot
call is issued by smtpd or smtpctl. In the latter case, only perform sanity checks and do not touch directories. A running server no longer lose its "incoming/" directory each time smtpctl is called... ok gilles@
2012-01-12The status field in the envelope is confusing. Its only purpose is toEric Faurot
notify the runner of what happened with an envelope that has been scheduled. It is not part of the state of the envelope, and it is not even dumped. So it should only be set by mta/mda, checked by runner to decide what to do with the envelope, and ignored everywhere else. ok gilles@
2012-01-12Remove dead code for config reloading for now. It is not functionnalEric Faurot
and confusing. ok gilles@
2011-12-18Add missing header needed by PRI format stringCharles Longeau
ok eric@
2011-12-14move show_queue() and related functions from queue_shared.cEric Faurot
to smtpctl.c ok gilles@
2011-11-23Fix Segmentation Fault when launching mailq(8)Charles Longeau
Bug reported by Mark Patruck <mark at wrapped.cx> ok gilles@ eric@
2011-11-15Qwalk, our API to linearly walk over the persistent queue, did not take theGilles Chehade
queue_backend into account and assumed a filesystem with a specific layout. This commit does plenty of things: - make qwalk an abstraction in the queue_backend API, and impose queue drivers to implement qwalk_open(), qwalk() and qwalk_close(); - move previous qwalk_open(), qwalk() and qwalk_close() to the fsqueue driver since they were fsqueue specific ... - make qwalk API work with msgid/evpid instead of pathnames since we're going to use the queue_backend API to load envelopes by evpid anyway; - makes smtpd use *solely* the queue_backend API when manipulating the queue. pathnames were removed from smtpd.h and moved into the fsqueue which means we can now store a queue anywhere ... as long as we write the ten functions or so required for a queue driver ;-) ok eric@, ok chl@
2011-10-26- fix smtpctl pause/resume so the ramqueue scheduling is done correctlyGilles Chehade
- rename IMSG and smtpctl pause/resume parameters - update man page tested by me, ok chl@, eric@
2011-10-23- smtpctl schedule no longer works, instead, use 'smtpctl schedule-id <id>'Gilles Chehade
- introduce 'smtpctl schedule-all' ok eric@
2011-10-23fsqueue no longer stores envelopes by dumping the structure, instead use aGilles Chehade
couple of load/dump functions to convert to and from a human readable fmt. while at it kill struct delivery and merge back its fields to the envelope. this basically means we shouldn't require users to flush their queues every time we make a change to struct envelope. work is not done, but we're at a better state than the binary fsqueue so we'll improve it in-tree. has been running on my own box for the last 12 hours or so ok eric@, chl@
2011-09-01Introduce a small set of functions to manage stat counters in aEric Faurot
simpler and hopefully saner way. ok gilles@ chl@
2011-08-30fix format stringCharles Longeau
ok gilles@
2011-08-29cast all printed time_t to long long int, and change format string accordingly.Charles Longeau
ok gilles@
2011-08-26add missing header needed by time()Charles Longeau
ok gilles@
2011-08-16smtpctl show sizes, displays the size of queue-related structures, usefulGilles Chehade
for developers to see the impact of structure changes on memory and disk usage, and useful for users to better understand 'smtpctl show stats'
2011-08-16add a host-tree and an envelope-tree in the ramqueue, they will be used toGilles Chehade
improve scheduling and general ramqueue operations. unused yet
2011-07-21- update smtpctl.8 to reflect realityGilles Chehade
- bring back 'smtpctl schedule' and 'smtpctl remove' to life Things you should know: The ramqueue data structure is not finished yet and lacks an envelope tree for evpid lookups. I wanted to wait until I'm done but too many people are affected by not being able to reschedule envelopes, this is a quick fix. So right now there's an O(rrible) complexity as both commands will perform a (possibly aborted) queue scan leading to O(n). I will make that O(log n) soon. Also, smtpctl remove no longer supports removing an entire message, I will fix that very soon too.
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-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
2011-04-02add stat counters for the lookup agentEric Faurot
ok gilles@
2011-03-09smtpctl show stats displays inet4/inet6 repartition for incoming sessionsGilles Chehade
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-09backout the "new" queue code commited 4 months ago. it has many good ideas,Gilles Chehade
is way more optimized than what we had earlier and there's definitely stuff we want to keep, however it is early optimization that doesn't account for many features and makes them hard (if not impossible) to write without ugly workarounds that ruin the purpose of the optimizations. the backout goes to 30 May's right before the commit and catches up on all the non-queue related commits that happened since then. i'll work on reintroducing the ideas from this queue when the basic features we expect from a MTA are implemented. suggested on tech@ about a week ago, no objections, several "please make smtpd move forward" mails from hackers and tech readers.
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-06-01Include birth time in smtpctl show queue raw.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-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-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-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