Commits


Standardize logging with bgpd OK claudio@


Convert various reyk proc.c daemons over to new imsgbuf_init and imsgbuf_allow_fdpass. OK tb@


Convert the common imsgbuf_read calls to the post EAGAIN world. OK tb@


Use imsgbuf_clear() where appropriate instead of msgbuf_clear(). OK tb@


Rename imsg_init, imsg_clear, imsg_read, imsg_write and imsg_flush to imsgbuf_init, imsgbuf_clear, imsgbuf_read, imsgbuf_write and imsgbuf_flush. This separates the imsgbuf API from the per-imsg API. OK tb@


Convert imsg_write() callers to the new simplified return logic. OK tb@


Introduce imsg_write() and use it instead of msgbuf_write(). imsg_write() is just a thin wrapper around msgbuf_write(). So this is mostly search and replace. OK tb@


Delete obsolete /* ARGSUSED */ lint comments. ok miod@ millert@


Move TAILQ initialization to files where they are used. These priv-sep daemons all follow a similar design and use TAILQs for tracking control process connections. In most cases, the TAILQs are initialized separate from where they are used. Since the scope of use is generally confined to a specific control process file, this commit also removes any extern definitions and exposing the TAILQ structures to other compilation units. ok bluhm@, tb@


Stop accessing verbose and debug variables from log.c directly. This replaces log_verbose() and "extern int verbose" with the two functions log_setverbose() and log_getverbose(). Pointed out by benno@ OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)


Replace hand-rolled for(;;) traversal of ctl_conns TAILQ with TAILQ_FOREACH(). No intentional functional change. ok reyk@


spacing


As done in httpd, remove ps_ninstances and p_instance. OK benno@ rzalamena@


EAGAIN handling for imsg_read. OK henning@ benno@


In most cases we don't need all arguments of proc_compose*_imsg(), so add a shortcut proc_compose*() that skips all of them. Only use the full argument list if needed. The functions with full argument lists can eventually be replaced with a nicer transaction-based approach later. OK benno@


Use SOCK_NONBLOCK in relayd as well. OK benno@


Do not try to unlink the control socket in an unprivileged child process on shutdown. Found while working on tame(2). OK benno@


Clean up the relayd headers with help of include-what-you-use and some manual review. Based on common practice, relayd.h now includes the necessary headers for itself. OK benno@


Adapt to <limits.h> universe. ok millert


Tweak error checking for msgbuf_write() as recommended by the imsg gurus. ok reyk@ benno@


handle msgbuf_write() returning EAGAIN


handle ECONNABORTED errors from accept(). In many code blocks they can be ignored silently and without aborting, much like EINTR and EWOULDBLOCK are. ok's from various maintainers of these directories...


relayd re-uses the event callbacks and passes the value of iev.data as the third argument (so that should be a copy of the 5th argument of event_set(). it boggles the mind.


delete excessive evtimer_pending; ok claudio


Do rate limiting of accept() when under pressure, like in other recent daemons. Light testing by some relayd users; let me know if issues develop.