Commit Graph

28 Commits

Author SHA1 Message Date
Kay Sievers 1b09f548c7 turn kdbus support into a runtime option
./configure --enable/disable-kdbus can be used to set the default
behavior regarding kdbus.

If no kdbus kernel support is available, dbus-dameon will be used.

With --enable-kdbus, the kernel command line option "kdbus=0" can
be used to disable kdbus.

With --disable-kdbus, the kernel command line option "kdbus=1" is
required to enable kdbus support.
2015-06-17 18:01:49 +02:00
Daniel Mack 78d298bbc5 kmod-setup: don't print warning on -ENOSYS
-ENOSYS is returned from kmod_module_probe_insert_module() if a module isn't
available, not -ENOENT. Don't spit out a warning in that case unless the
warn_if_unavailable flag is set.

Also factor out the condition into an own variable for better readability.
2015-06-11 16:49:24 +02:00
Lennart Poettering d814f9904b kmod-setup: when we fail to load a kmod, log the error cause
(Also, downgrade message from LOG_ERROR to LOG_WARNING, after all we
don't care much and just proceed)
2015-06-11 12:13:58 +02:00
Daniel Mack 85c675538f kmod-setup: split warn flags
Traditionally, we used to warn about ipv6 being a module or being
unavailable. This was changed in b4aa82f16 ("kmod-setup: don't warn
when ipv6 can't be loaded") in a way that neither of the two conditions
will cause a log message.

Now, while running a setup without any IPv6 is completely fine and
shouldn't cause any warning, we should still warn about ipv6 being a
module instead of built-in.

To achieve this, split the boolean warn flag into two: one for a
feature not being built-in but shipped as a module, and one to
print an error when a module is entirely unavailable.

We will, however, still warn if kmod returns anything else than
-ENOENT in the attempt of loading the module, and at the very least,
turn the message into a debug log.
2015-06-08 20:39:23 +02:00
Daniel Mack b4aa82f168 kmod-setup: don't warn when ipv6 can't be loaded
Not having IPv6 is a valid setup. Let's not print a warning in that
case.

Addresses:

  https://bugs.freedesktop.org/show_bug.cgi?id=87475
2015-06-05 14:59:36 +02:00
Lennart Poettering a363680faa kmod-setup: conditionalize kmod autoloading properly
Load kdbus.ko only if we are built with kdbus, and load ip_tables.ko
only if we are built with iptables support.
2015-05-18 17:27:42 +02:00
David Herrmann d79acc3093 bus: don't switch to kdbus if not requested
Whenever systemd is re-executed, it tries to create a system bus via
kdbus. If the system did not have kdbus loaded during bootup, but the
module is loaded later on manually, this will cause two system buses
running (kdbus and dbus-daemon in parallel).

This patch makes sure we never try to create kdbus buses if it wasn't
explicitly requested on the command-line.
2015-05-06 18:21:51 +02:00
Lennart Poettering 1d3087978a kmod-setup: load ip_tables kmod at boot
The module is currently no auto-loadable (and this is unlikely to change
anytime soon, given it's API is via getsockopt/setsockopt). It is needed
by networkd and nspawn currently.

Users who really don't like the module to be loaded have the option to
blacklist it still, or not compile it at all. But for all others this
should make things work out-of-the-box.
2015-04-22 13:50:56 +02:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Lennart Poettering 3da44ef53b kmod-setup: simplify kernel command line parsing 2014-11-27 22:05:24 +01:00
Lennart Poettering 79008bddf6 log: rearrange log function naming
- Rename log_meta() → log_internal(), to follow naming scheme of most
  other log functions that are usually invoked through macros, but never
  directly.

- Rename log_info_object() to log_object_info(), simply because the
  object should be before any other parameters, to follow OO-style
  programming style.
2014-11-27 22:05:24 +01:00
Lennart Poettering 086891e5c1 log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers
This change has two benefits:

- The format string %m will now resolve to the specified error (or to
  errno if the specified error is 0. This allows getting rid of a ton of
  strerror() invocations, a function that is not thread-safe.

- The specified error can be passed to the journal in the ERRNO= field.

Now of course, we just need somebody to convert all cases of this:

        log_error("Something happened: %s", strerror(-r));

into thus:

        log_error_errno(-r, "Something happened: %m");
2014-11-27 22:05:23 +01:00
Lennart Poettering 68d4c45263 core: reindent mount/kmod tables 2014-11-26 15:43:20 +01:00
Lennart Poettering 5f68e74b6a kmod-setup: improve for "kdbus" word on the kernel cmdline
We really shouldn't check for words with "strstr()"...
2014-11-14 18:02:30 +01:00
Lennart Poettering f84f9974d8 kmod: move #ifdef checks for kmod-setup out of main.c into kmod-setup.c 2014-11-14 17:58:32 +01:00
Daniel Mack 63cc4c3138 sd-bus: sync with kdbus upstream (ABI break)
kdbus has seen a larger update than expected lately, most notably with
kdbusfs, a file system to expose the kdbus control files:

 * Each time a file system of this type is mounted, a new kdbus
   domain is created.

 * The layout inside each mount point is the same as before, except
   that domains are not hierarchically nested anymore.

 * Domains are therefore also unnamed now.

 * Unmounting a kdbusfs will automatically also detroy the
   associated domain.

 * Hence, the action of creating a kdbus domain is now as
   privileged as mounting a filesystem.

 * This way, we can get around creating dev nodes for everything,
   which is last but not least something that is not limited by
   20-bit minor numbers.

The kdbus specific bits in nspawn have all been dropped now, as nspawn
can rely on the container OS to set up its own kdbus domain, simply by
mounting a new instance.

A new set of mounts has been added to mount things *after* the kernel
modules have been loaded. For now, only kdbus is in this set, which is
invoked with mount_setup_late().
2014-11-13 20:41:52 +01:00
Lennart Poettering b5884878a2 util: simplify proc_cmdline() to reuse get_process_cmdline()
Also, make all parsing of the kernel cmdline non-fatal.
2014-11-07 01:19:56 +01:00
Lennart Poettering c47fc1f025 kmod: conditionalize kmod setup on CAP_SYS_MODULE, not whether we run in a container
It's generally preferrable to conditionalize on the actual ability to do
something then the context we run in.
2014-06-17 03:26:40 +02:00
Lennart Poettering bcfce235a3 macro: introduce a nice macro for disabling -Wformat-nonliteral temporarily 2014-02-20 18:18:32 +01:00
Kay Sievers b43b8f7a7e do not run kmod-setup in a container 2013-12-19 01:32:55 +01:00
Kay Sievers 7491e6e7c5 temporarily support "kdbus" keyword on the kernel commandline to load the module 2013-12-18 23:56:35 +01:00
Lennart Poettering b4b879648c kmod-setup: properly iterate through module table
Previously we skipped every second entry.

This also cleans up much of the code and removes some dead code.
2013-05-07 17:52:23 +02:00
Kay Sievers 3dfb265083 kmod-setup: mounting efivarfs, *after* we tried to mount it, is pointless
The mount() system call, which we issue before loading modules, will trigger
a modprobe by the kernel and block until it returns. Trying to load it again
later, will have exactly the same result as the first time.
2012-11-04 17:00:57 +01:00
Kay Sievers 1022373284 kmod-setup: add conditional module loading callback 2012-11-04 16:54:19 +01:00
Lee, Chun-Yi f271dd9762 systemd: mount the EFI variable filesystem
Add efivarfs to the mount_table in mount-setup.c, so the EFI variable
filesystem will be mounted when systemd executed.

The EFI variable filesystem will merge in v3.7 or v3.8 linux kernel.

Cc: Kay Sievers <kay@vrfy.org>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Mantas Mikulėnas <grawity@gmail.com>
Cc: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
2012-10-30 03:40:42 +01:00
Michal Schmidt e62abb6268 modules-load: use correct va_list logging function 2012-06-28 00:52:14 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Kay Sievers b30e2f4c18 move libsystemd_core.la sources into core/ 2012-04-11 16:03:51 +02:00
Renamed from src/kmod-setup.c (Browse further)