Zbigniew Jędrzejewski-Szmek
b2ac2b01c8
Merge pull request #10996 from poettering/oci-prep
...
Preparation for the nspawn-OCI work
2018-11-30 10:09:00 +01:00
Zbigniew Jędrzejewski-Szmek
049af8ad0c
Split out part of mount-util.c into mountpoint-util.c
...
The idea is that anything which is related to actually manipulating mounts is
in mount-util.c, but functions for mountpoint introspection are moved to the
new file. Anything which requires libmount must be in mount-util.c.
This was supposed to be a preparation for further changes, with no functional
difference, but it results in a significant change in linkage:
$ ldd build/libnss_*.so.2
(before)
build/libnss_myhostname.so.2:
linux-vdso.so.1 (0x00007fff77bf5000)
librt.so.1 => /lib64/librt.so.1 (0x00007f4bbb7b2000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007f4bbb755000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4bbb734000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4bbb56e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4bbb8c1000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f4bbb51b000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f4bbb512000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f4bbb4e3000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f4bbb45e000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f4bbb458000)
build/libnss_mymachines.so.2:
linux-vdso.so.1 (0x00007ffc19cc0000)
librt.so.1 => /lib64/librt.so.1 (0x00007fdecb74b000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fdecb744000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007fdecb6e7000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdecb6c6000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdecb500000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdecb8a9000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fdecb4ad000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fdecb4a2000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fdecb475000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fdecb3f0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fdecb3ea000)
build/libnss_resolve.so.2:
linux-vdso.so.1 (0x00007ffe8ef8e000)
librt.so.1 => /lib64/librt.so.1 (0x00007fcf314bd000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fcf314b6000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007fcf31459000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcf31438000)
libc.so.6 => /lib64/libc.so.6 (0x00007fcf31272000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf31615000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007fcf3121f000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fcf31214000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fcf311e7000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fcf31162000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fcf3115c000)
build/libnss_systemd.so.2:
linux-vdso.so.1 (0x00007ffda6d17000)
librt.so.1 => /lib64/librt.so.1 (0x00007f610b83c000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f610b835000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007f610b7d8000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f610b7b7000)
libc.so.6 => /lib64/libc.so.6 (0x00007f610b5f1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f610b995000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f610b59e000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f610b593000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f610b566000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f610b4e1000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f610b4db000)
(after)
build/libnss_myhostname.so.2:
linux-vdso.so.1 (0x00007fff0b5e2000)
librt.so.1 => /lib64/librt.so.1 (0x00007fde0c328000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fde0c307000)
libc.so.6 => /lib64/libc.so.6 (0x00007fde0c141000)
/lib64/ld-linux-x86-64.so.2 (0x00007fde0c435000)
build/libnss_mymachines.so.2:
linux-vdso.so.1 (0x00007ffdc30a7000)
librt.so.1 => /lib64/librt.so.1 (0x00007f06ecabb000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f06ecab4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f06eca93000)
libc.so.6 => /lib64/libc.so.6 (0x00007f06ec8cd000)
/lib64/ld-linux-x86-64.so.2 (0x00007f06ecc15000)
build/libnss_resolve.so.2:
linux-vdso.so.1 (0x00007ffe95747000)
librt.so.1 => /lib64/librt.so.1 (0x00007fa56a80f000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fa56a808000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa56a7e7000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa56a621000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa56a964000)
build/libnss_systemd.so.2:
linux-vdso.so.1 (0x00007ffe67b51000)
librt.so.1 => /lib64/librt.so.1 (0x00007ffb32113000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007ffb3210c000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffb320eb000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffb31f25000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffb3226a000)
I don't quite understand what is going on here, but let's not be too picky.
2018-11-29 21:03:44 +01:00
Lennart Poettering
3a47c40d97
tree-wide: port various parts of the code to use parse_dev()
2018-11-29 20:03:56 +01:00
Susant Sahani
926062f083
networkd: add support to configure ip rule port range and protocol.
...
Please see:
iprule: support for ip_proto, sport and dport match options
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f686f764682745daf6a93b0a6330ba42a961f858
Closes 10622
2018-11-28 20:06:28 +05:30
Lennart Poettering
cb3108669d
tree-wide: more IOVEC_MAKE() conversions
2018-11-28 13:08:19 +09:00
Lennart Poettering
5cfa2c3dc0
tree-wide: use IOVEC_MAKE() at many places
2018-11-27 10:12:27 +01:00
Susant Sahani
2266864b04
networkd: Add support for ERSPAN tunnel
...
Please see: https://patchwork.ozlabs.org/patch/800327/
```
[NetDev]
Name=erspan-test
Kind=erspan
[Tunnel]
Independent=true
ERSPANIndex=123
Local = 172.16.1.200
Remote = 172.16.1.100
Key=101
SerializeTunneledPackets=true
```
2018-11-27 11:04:42 +09:00
Yu Watanabe
916707cca5
sd-device: do not call device_monitor_enable_receiving() for passed fd from pid1
...
Before c4b69e990f , if the socket fd is
passed from pid1, `udev_monitor_enable_receiving()` (now it is a wrapper
of `device_monitor_enable_receiving`) was not called.
Let's preserve the original logic.
Fixes #10754 .
2018-11-25 20:14:17 +09:00
Yu Watanabe
f1d7b7874e
sd-device: check whether filter is updated or not in sd_device_monitor_filter_update()
2018-11-25 15:26:43 +09:00
Yu Watanabe
5cee547a94
sd-device: update log message
2018-11-25 14:06:56 +09:00
Yu Watanabe
779c923467
sd-device: fix return value on error path
2018-11-25 14:06:27 +09:00
Zbigniew Jędrzejewski-Szmek
e5e0a79623
pid1,sd-device: use PATH_STARTSWITH_SET more
2018-11-23 13:37:47 +01:00
Yu Watanabe
a5a59a2447
test: add more tests for subsystem filter
2018-11-23 06:46:29 +09:00
Yu Watanabe
65fe9c319f
sd-device-monitor: fix subsystem filter
...
This fixes a bug introduced by 759d9f3f8d .
Fixes #10882 .
2018-11-23 02:49:28 +09:00
Zbigniew Jędrzejewski-Szmek
886cf317c4
coccinelle: also mark previous synthetic errnos as such
2018-11-22 10:54:38 +01:00
Zbigniew Jędrzejewski-Szmek
baaa35ad70
coccinelle: make use of SYNTHETIC_ERRNO
...
Ideally, coccinelle would strip unnecessary braces too. But I do not see any
option in coccinelle for this, so instead, I edited the patch text using
search&replace to remove the braces. Unfortunately this is not fully automatic,
in particular it didn't deal well with if-else-if-else blocks and ifdefs, so
there is an increased likelikehood be some bugs in such spots.
I also removed part of the patch that coccinelle generated for udev, where we
returns -1 for failure. This should be fixed independently.
2018-11-22 10:54:38 +01:00
Lennart Poettering
012c2f761b
tree-wide: use __ prefixed gcc attributes ( #10843 )
...
As suggest here:
https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
"You may optionally specify attribute names with ‘__’ preceding and
following the name. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
you may use the attribute name __noreturn__ instead of noreturn. "
2018-11-20 12:34:08 +09:00
Yu Watanabe
af18705f8e
test: also tests enumerating subsystems
2018-11-17 18:18:22 +01:00
Yu Watanabe
d44325cb96
sd-event: also introduce event_source_is_enabled()
2018-11-16 22:57:42 +09:00
Yu Watanabe
2701983ce8
sd-event: introduce event_source_disable()
2018-11-16 22:57:42 +09:00
Yu Watanabe
764c08e6b7
sd-event: introduce event_reset_time()
2018-11-16 22:57:42 +09:00
Yu Watanabe
a137a1c3ff
sd-event: split definition of event_source to event-source.h
2018-11-16 22:57:37 +09:00
Lennart Poettering
ac0a94f743
sd-bus: make strict asan shut up
...
asan doesn't like it if we use strndup() (i.e. a string function) on a
non-NULL terminated buffer (i.e. something that isn't really a string).
Let's hence use memdup_suffix0() instead of strndup(), which is more
appropriate for binary data that is to become a string.
Fixes : #10385
2018-11-16 14:32:41 +01:00
Zbigniew Jędrzejewski-Szmek
08c1eb0e30
sd-event: make sd_event_source_get_enabled return more info
2018-11-16 09:03:41 +01:00
Zbigniew Jędrzejewski-Szmek
7d92a1a490
sd-event: do not use assert_return for something that is not an error
...
It's totally OK for description to be unset, so let's not log about this
even at debug level.
2018-11-16 09:00:33 +01:00
Zbigniew Jędrzejewski-Szmek
cd5a29ce98
Merge pull request #10742 from poettering/c-utf8
...
default to C.UTF-8 locale, and many improvements to env var file parsing/kernel cmdline parsing
2018-11-15 12:47:17 +01:00
Lennart Poettering
042cad5737
Merge pull request #10753 from keszybz/pager-no-interrupt
...
Add mode in journalctl where ^C is handled by the pager
2018-11-14 20:09:39 +01:00
Lennart Poettering
13df9c398d
fileio: automatically add NULL sentinel to parse_env_file()
...
Let's modernize things a bit.
2018-11-14 17:01:55 +01:00
Lennart Poettering
aa8fbc74e3
fileio: drop "newline" parameter for env file parsers
...
Now that we don't (mis-)use the env file parser to parse kernel command
lines there's no need anymore to override the used newline character
set. Let's hence drop the argument and just "\n\r" always. This nicely
simplifies our code.
2018-11-14 17:01:54 +01:00
Zbigniew Jędrzejewski-Szmek
fde32028a4
Move LONG_LINE_MAX definition to fileio.h
...
All users of the macro (except for one, in serialize.c), use the macro in
connection with read_line(), so they must include fileio.h. Let's not play
libc games and require multiple header file to be included for the most common
use of a function.
The removal of def.h includes is not exact. I mostly went over the commits that
switch over to use read_line() and add def.h at the same time and reverted the
addition of def.h in those files.
2018-11-14 16:25:32 +01:00
Lennart Poettering
0a885dd055
sd-bus: port over to namespace_fork()
...
This is pretty similar code, let's replace it with the generic
namespace_fork() implementation.
2018-11-13 10:49:18 +01:00
Yu Watanabe
e559eca1b6
sd-bus: use SD_BUS_ERROR_NULL macro
...
Follow-up for e8f280bd0a .
2018-11-12 16:32:10 +09:00
Lennart Poettering
5fb0720ebb
Merge pull request #10728 from keszybz/four-unrelated-cleanups
...
Four unrelated cleanups
2018-11-11 21:16:14 +01:00
Yu Watanabe
deb2b7348e
sd-device: drop priority and description from sd_device_monitor_attach_event() and sd_device_monitor_start()
...
Now we have sd_device_monitor_get_event_soruce(). So, it is not
necessary to include these parameters in the functions for sd_device_monitor.
2018-11-10 22:53:00 +09:00
Yu Watanabe
bf7712b63e
sd-device: add sd_device_monitor_get_event_source()
2018-11-10 22:53:00 +09:00
Yu Watanabe
8d578a2e73
sd-device: fix possible use of uninitialized value
2018-11-10 11:59:32 +01:00
Zbigniew Jędrzejewski-Szmek
e8f280bd0a
sd_bus: use structured intialization in one more place
2018-11-09 21:40:21 +01:00
Lennart Poettering
c4e48030cf
sd-bus: make "close+flush-on-exit" optional when using sd-event with sd-bus
...
This adds a new pair of API calls sd_bus_set_close_on_exit() and
sd_bus_get_close_on_exit(). They control whether an sd_bus object
attached to a an sd-event loop shall automatically be flushed/closed
when the event loop goes down. Usually that's a good thing, except for
very few cases where the bus connection is longer living than the event
loop it is attached on. Specifically, this is the case for nspawn, where
we run the event loop only while the container is up, but afterwards
still want to be able to use the bus connection.
2018-11-09 17:08:59 +01:00
Lennart Poettering
cc83d5197c
random-util: optionally allow randomness to be generated via RDRAND
...
We only use this when we don't require the best randomness. The primary
usecase for this is UUID generation, as this means we don't drain
randomness from the kernel pool for them. Since UUIDs are usually not
secrets RDRAND should be goot enough for them to avoid real-life
collisions.
2018-11-08 09:44:27 +01:00
Lennart Poettering
94d457e8d9
random-util: change high_quality_required bool parameter into a flags parameter
...
No change in behaviour, just some refactoring.
2018-11-08 09:44:27 +01:00
Lennart Poettering
3335dc2d75
random-util: rename acquire_random_bytes() → genuine_random_bytes()
...
It's more descriptive, since we also have a function random_bytes()
which sounds very similar.
Also rename pseudorandom_bytes() to pseudo_random_bytes(). This way the
two functions are nicely systematic, one returning genuine random bytes
and the other pseudo random ones.
2018-11-08 09:44:27 +01:00
Zbigniew Jędrzejewski-Szmek
e44c5a3ba6
Merge pull request #10594 from poettering/env-reload-fix
...
change handling of environment block of PID1's manager object
2018-11-07 12:49:13 +01:00
Lennart Poettering
9edcbc4f44
Merge pull request #10602 from yuwata/sd-device-logs
...
update log messages
2018-11-06 19:33:51 +03:00
Lennart Poettering
b992109b3e
Merge pull request #10633 from yuwata/sd-resolve-destroy
...
Another solution to fix wireguard issues
2018-11-06 19:30:59 +03:00
Yu Watanabe
7cadbe09e9
sd-device: use write_string_file() helper to write sysattr
2018-11-06 21:24:03 +09:00
Yu Watanabe
a5db6debcd
test: check returned value of sd_device_get_usec_since_initialized()
2018-11-06 15:45:22 +09:00
Yu Watanabe
754d6c26b4
test: show is_initialized flag in log message of test-sd-device
...
And drop devpath, as it is redundant for most cases.
2018-11-06 15:45:22 +09:00
Yu Watanabe
ecbe9873a9
test: show name of testing functions in test-sd-device
2018-11-06 15:45:22 +09:00
Yu Watanabe
c7d54daef9
sd-device: normalize debug messages
2018-11-06 15:45:22 +09:00
Yu Watanabe
38d1555d7c
sd-device: drop subsystem from log_device_*()
...
The sd_device object always has syspath and sysname, but subsytem may not.
Also, it may take some costs to get subsystem.
So, let's drop subsystem from logs.
2018-11-06 15:45:22 +09:00