Commit Graph
1533 Commits
Author SHA1 Message Date
Joachim Nilsson f10a724503 Add mention of dropping UDP connections from blocked interfaces
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-14 17:23:54 +01:00
Joachim Nilsson 33037b012a Merge pull request #88 from ccb3/master
Drop UDP packets from unwanted interfaces
2017-12-14 10:44:29 +01:00
Lennart Eriksson 0c75e59b77 Drop UDP packets from unwanted interfaces
Previously UDP packets were never dropped and if a request came
from a not valid interface inetd got stuck in an inifinite
loop looking at the same packet every time and not dropping it.

Signed-off-by: Lennart Eriksson <lennart.eriksson@westermo.se>
2017-12-14 10:34:07 +01:00
Joachim Nilsson 8e55a76732 Initial draft of v3.1 release notes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-14 09:13:13 +01:00
Joachim Nilsson 32b9096e31 Fix #87: Allow inetd services to be registered with an id != 1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 22:20:30 +01:00
Joachim Nilsson f51723e8b7 Fix #86: Ensure that run/tasks are run at least once per runlevel
This patch fixes the problem with run/task jobs with conditions, run at
runlevel S (bootstrap), not being given enough time to actually start
and run even once.

The new svc counter 'once' is now inspected before transitioning away
from runlevel S to the configured runlevel.  A global (currently hard
coded) timeout of 10 sec is given to all run/tasks.

As a spin-off, this patch starts up the event loop much earlier than
before.  Meaning the initial runlevel change at boot is now done in
a finalize() callback when all run/tasks have completed, or when the
global timeout has expired.  Starting the event loop earlier gives us
the possibility to rely on the pidfile plugin to provide our run/tasks
with the conditions necessary to start.

TODO: What remains is to add similar handling to all runlevel
      transitions, not just the initial one at boot.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 9e31bd8a23 Fix #18: Add support for calling run/tasks on HOOK points
This patch implements support for calling run/task jobs on the built-in
`HOOK_*` points in Finit.  To map each HOOK point to a condition a new
classification was made, as shown in plugin.h and in the example below.

task <hook/mount/root> /sbin/attachubi.sh      # run in parallel with other tasks/services
run  <hook/net/up>     /sbin/dosomething.sh    # run in sequence with other commands

Please note, only rudimentary tested.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson e841984a4e service_step(): Fix problem with double start of service/run/tasks
Make svc state transition to RUNNING *before* service_start(), because
in that function we may call service_step() as well, which would start
the svc again (since it was still in READY).

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 594476c4fc Fix progress print-out ordering bug, and run HOOK_SVC_START only on success
Only run HOOK_SVC_START on successful start, and *after* having printed
the result of the started service, otherwise any print-outs from plugins
or tasks we start may overwrite the started service's progress.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 9c423dfca4 Disable toggling of log/debug in fsck() loop
Don't really see the point of this code anymore, was possibly an issue
before we refactored the logging subsystem.  Comment out for now, and
remove later.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 77cd0f0243 Fix problem with duplicate log messages before syslogd has started
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 5dc4e7c058 cond_update(): Minor, log service description as well as cmd
If you have lots of service/run/tasks using the same cmd it's impossible
to tell them apart in debug mode.  This patch logs description as well
as cmd to improve on this situation a bit.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 3c015f384d Track run/tasks, should run at least once per declared runlevel
This patch adds a 'once' counter to the svc_t for run/task jobs.  This
counter is incremented when Finit calls service_start() and is reset on
runlevel changes.

Also, at the end of a runlevel each run/task have their state reset to
SVC_HALTED_STATE so they can be launched again for the new runlevel, if
so declared.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 5117b723c2 Minor, fix missing rlim2str() declaration
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson b55a609834 Handle /etc overlayfs: reload /etc/finit.d/*.conf after mount -a
Systems running OverlayFS, or similar, on /etc may have new/modified
.conf files in /etc/finit.d.  This patch makes sure to reload them
after `mount -a` has run so any configured bootstrap tasks and the
new hook callback scripts may run as expected.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 60eccbac31 Refactor, relocate+rename service_enabled() --> svc_enabled()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson b182e6bcc5 Minor update and refactor, use kernel doc style comments
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson b8bf26b107 Refactor, rename restart counter and change type to char, MAX=10
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-12-13 17:58:48 +01:00
Joachim Nilsson 14c0d80f63 Merge pull request #85 from reverendhomer/doc-fix-typo
doc: fix couple of typos in config.md
2017-12-01 18:45:20 +01:00
Reverend Homer 1f55f677d1 doc: fix couple of typos in config.md 2017-12-01 20:07:58 +03:00
Joachim Nilsson 40267a5f0f Minor, comment fixes and additions
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-28 08:07:06 +01:00
Joachim Nilsson 9f50b033d9 Abort service kill if already terminated, otherwise kill(0, SIGKILL)
This patch fixes a rather nasty bug in the SIGTERM+SIGKILL logic
employed by Finit when stopping tasks, e.g. at a runlevel change.

When a process terminates, after Finit having sent it SIGTERM, and the
SIGKILL timer expires *before* the timer has been cancelled, then the
timer callback would cause kill(0, SIGKILL).

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-28 08:00:46 +01:00
Joachim Nilsson bbaa7a1403 TODO: Process callbacks replaced with conditions in Finit 3.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-27 22:37:38 +01:00
Joachim Nilsson b68c5c1291 Fix #45: add support for rlimit per service/run/task/inetd/tty
This patch extends the existing rlimit implementation to support setting
limits per service, run/task, inetd, and tty.

Use rlimit in /etc/finit.conf to change the global setting, which is
then inherited to each /etc/finit.d/*.conf.  For each .conf file the
rlimit is reinitialized to the global finit.conf settings.

Also, add `unlimited` keyword, to replace the now deprecated `infinity`
keyword.  The latter is however kept, for compatibility with previous
releases, for the foreseeable future.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-26 16:35:37 +01:00
Joachim Nilsson 44007c86f2 initctl: Fix problem with start/stop using job ID
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-24 08:51:50 +01:00
Joachim Nilsson cd73c1c951 Replace libite:fmode() with stat(), removed in libite v2
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-22 14:40:02 +01:00
Joachim Nilsson 5406af2054 watchdog: Adjust WDT timeout (30 sec), use half that as kick period
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 16:51:33 +01:00
Joachim Nilsson 3c800f6508 Refactor, simplify registration of built-in watchdog daemon
This patch not only greatly simplifies the registration of the built-in
watchdog daemon, it also fixes a nasty race condition with an external
watchdog daemon.  The INIT_CMD_WDOG_HELLO could reach finit in reversed
order, leading to the built-in daemon shutting down, but finit killing
the just registered external daemon.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 16:48:32 +01:00
Joachim Nilsson e0fb2b036d Improve debug of initctl api
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 16:45:07 +01:00
Joachim Nilsson 0ee4657f1c Follow-up to 6c563a2, clean up unused variables
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 16:39:27 +01:00
Joachim Nilsson ec2382b6d4 Silence, remove "Starting ..." of inetd services from boot progress
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 12:30:04 +01:00
Joachim Nilsson 0fc2df1a65 Silence, remove "Loading %sconfiguration ..." from boot progress
Most Linux distributions, embedded or otherwise, do not need this
and only confuses the user of an OS with Finit.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 12:29:31 +01:00
Joachim Nilsson 6c563a2b22 Silence, remove "Loading plugins ..." from boot progress
Most Linux distributions, embedded or otherwise, do not need this
and only confuses the user of an OS with Finit.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 12:27:57 +01:00
Joachim Nilsson 6a2911223d Fix screen_init() regression introduced in a6290da
A simple missing semicolon caused initscr() to not be called properly.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-19 12:26:45 +01:00
Joachim Nilsson 7f499ed1d0 watchdog: Kick one last time before handover to external watchdogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-18 14:48:46 +01:00
Joachim Nilsson 2d2807bc65 Change log message for crashing services, remove dev. debug info
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-18 14:48:08 +01:00
Joachim Nilsson 4af7974fb9 Travis-CI: Install new required version of libuEv, v2.1.0
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 15:26:12 +01:00
Joachim Nilsson 3fd45eac7c bootmisc: Handle _PATH_VARDB inconsistency gracefully
Some systems use /var/db while others use /var/lib/misc, we need to
support both and cannot rely on _PATH_VARDB, since it too might not
be set properly.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 15:24:25 +01:00
Joachim Nilsson bb4578292f Bump version for v3.1 release cycle
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 15:01:02 +01:00
Joachim Nilsson 656fa3d0e7 Bump required libuEv version to v2.1.0, fixed failure mode support
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 15:00:36 +01:00
Joachim Nilsson 9a75813350 api.c: Handle domain socket errors more gracefully, restart socket
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 15:00:05 +01:00
Joachim Nilsson 5af1f05606 plugin: Only close() PID file descriptors >0, skip -1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 14:34:08 +01:00
Joachim Nilsson fcdb5c2965 initctl: Refactor, reduce code duplication
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 22:58:50 +01:00
Joachim Nilsson af3e560d79 tty.c: Refactor, move LIST_REMOVE() to tty_unregister()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 21:33:22 +01:00
Joachim Nilsson b6e695b656 Bump required libuEv version to v2.0.0, with failure mode support
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 19:40:54 +01:00
Joachim Nilsson 123df18847 Travis-CI: Bump required libuEv version to v2.0
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 19:40:28 +01:00
Joachim Nilsson dae21d9d64 Simplify rlimit documentation a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 19:18:32 +01:00
Joachim Nilsson bf4a0abe5c conf_parse_rlimit(): Refactor, replace 'new' with 'cfg'
'new' is a reserved keyword in C++, it is recommnded to avoid it also in C.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 14:57:22 +01:00
Joachim Nilsson 6826d7ee3f Handle event loop watcher failure modes
When alibuEv event watcher callback has `UEV_ERROR` in the events mask
we must handle the error.  Unfortunately, in most cases there is not
much we can do but ignore it or log the error.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 11:18:12 +01:00
Joachim Nilsson 168da2a5c6 plugin: Update list of available events for I/O plugins
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-12 02:47:33 +01:00