Commit Graph

46161 Commits

Author SHA1 Message Date
Yu Watanabe e55265184b network: do not assume static addresses are configured
link_request_set_routes() is also called when a dynamic address is
configured. At that time, static addresses may not be configured yet.

Fixes #16546.
2020-07-29 02:05:05 +09:00
Yu Watanabe 15797d6a2b network: check at least one dynamic address is assigned when DHCP is enabled 2020-07-29 02:05:05 +09:00
Yu Watanabe 1633c45731 network: dhcp6: drop addresses and delegated prefixes on client stop
Previously, we did not drop addresses and delegated prefixes when
DHCP6 client is stopped.

Fixes #15455.
Fixes #13564.
2020-07-29 02:05:05 +09:00
Yu Watanabe 1c09d84e42 network: rename ipv4ll_address -> ipv4ll_address_configured 2020-07-29 02:05:05 +09:00
Yu Watanabe b0b9776656 network: ndisc: also remove old DNSSL or RDNSS records after an SLAAC address is ready 2020-07-29 02:05:05 +09:00
Yu Watanabe 69203fba70 network: ndisc: remove old addresses and routes after at least one SLAAC address becomes ready
Otherwise, the old addresses will exist in deperecated state.
2020-07-29 02:05:05 +09:00
Yu Watanabe 6e537f62d7 network: dhcp4: release old lease after the new address become ready
Previously, on DHCPv4 address renewal, the old address may be removed
while the new address is not ready yet.

This also simplifies the logic of removing address and routes.
2020-07-29 02:05:05 +09:00
Yu Watanabe 80b0e86084 network: make address/route_configure optionally return created Address/Route object 2020-07-29 02:05:05 +09:00
Yu Watanabe 8eec0b9da5 network: set key destructor in several hash_ops 2020-07-29 02:05:05 +09:00
Yu Watanabe 5f58af25e6 network: make link_check_ready() return earlier if the link is not in 'configuring' state 2020-07-29 02:05:05 +09:00
Yu Watanabe 3336e946da network: ndisc: do not set configured flags when addresses or routes are not assigned yet
Just for safety.
2020-07-29 02:05:05 +09:00
Yu Watanabe 5d8c3ec1e9 network: make link enter failed state if address_update() failed 2020-07-29 02:05:05 +09:00
Yu Watanabe 97f000744f network: introduce callback called when an address becomes ready 2020-07-29 02:05:00 +09:00
Yu Watanabe c9d223e803 test-network: add tests for prefix routes 2020-07-29 01:50:54 +09:00
Yu Watanabe 3606ca659e network: add debug log for configuring address 2020-07-29 01:50:54 +09:00
Lennart Poettering f6ad6248e8 update TODO 2020-07-28 11:25:08 +02:00
Lennart Poettering 39cf0351c5 tree-wide: make use of new relative time events in sd-event.h 2020-07-28 11:24:55 +02:00
Lennart Poettering 4c5e74f71b man: document new relative time APIs in sd-event 2020-07-28 11:24:37 +02:00
Lennart Poettering d6a83dc48a sd-event: add relative timer calls
We frequently want to set a timer relative to the current time. Let's
add an explicit API for this. This not only saves us a few lines of code
everywhere and simplifies things, but also allows us to do correct
overflow checking.
2020-07-28 11:23:41 +02:00
Zbigniew Jędrzejewski-Szmek c21ed6812e test-ndisc-rs: increase timeouts
Timestamp: Mon 2020-07-27 13:50:50 UTC
Monotonic: 985702942708
Hop limit: 64
Flags: <|MANAGED>
Preference: medium
Lifetime: 180
No MTU set
>> Option 3
Valid Lifetime: 500
Preferred Lifetime: 440
Flags: <ONLINK|AUTO>
Prefix Length: 64
Prefix: 2001:db8:dead:beef::
>> Option 25
DNS: 2001:db8:dead:beef::1
Lifetime: 60
>> Option 31
Domain: lab.intra
Lifetime: 60
>> Option 1
Address: 782bcbb36d53
NDISC: Started IPv6 Router Solicitation client
backoff timeout interval  1 3.600s <= 3.987s <= 4.400s
NDISC: Sent Router Solicitation, next solicitation in 3s
backoff timeout interval  2 7.576s <= 8.114s <= 8.374s
NDISC: Sent Router Solicitation, next solicitation in 8s
Assertion 'false' failed at src/libsystemd-network/test-ndisc-rs.c:172, function test_rs_hangcheck(). Aborting.
2020-07-28 10:49:13 +02:00
Zbigniew Jędrzejewski-Szmek 500727c220 test-path: increase timeout
The tests fail in Fedora's koji with a timeout. Let's just bump
the timeout:
--- stderr ---
Failed to connect to system bus: No such file or directory
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-exists.service: Failed to create cgroup /system.slice/kojid.service/path-exists.service: Permission denied
path-exists.service: Succeeded.
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-exists.service: Failed to create cgroup /system.slice/kojid.service/path-exists.service: Permission denied
path-exists.service: Succeeded.
path-exists.path: Succeeded.
Failed to connect to system bus: No such file or directory
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-existsglob.service: Failed to create cgroup /system.slice/kojid.service/path-existsglob.service: Permission denied
path-existsglob.service: Succeeded.
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-existsglob.service: Failed to create cgroup /system.slice/kojid.service/path-existsglob.service: Permission denied
path-existsglob.service: Succeeded.
path-existsglob.path: Succeeded.
Failed to connect to system bus: No such file or directory
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-changed.service: Failed to create cgroup /system.slice/kojid.service/path-changed.service: Permission denied
path-changed.service: Succeeded.
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-changed.service: Failed to create cgroup /system.slice/kojid.service/path-changed.service: Permission denied
path-changed.service: Succeeded.
path-changed.path: Succeeded.
Failed to connect to system bus: No such file or directory
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-modified.service: Failed to create cgroup /system.slice/kojid.service/path-modified.service: Permission denied
path-modified.service: Succeeded.
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-modified.service: Failed to create cgroup /system.slice/kojid.service/path-modified.service: Permission denied
path-modified.service: Succeeded.
path-modified.path: Succeeded.
Failed to connect to system bus: No such file or directory
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-mycustomunit.service: Failed to create cgroup /system.slice/kojid.service/path-mycustomunit.service: Permission denied
path-mycustomunit.service: Succeeded.
path-unit.path: Succeeded.
Failed to connect to system bus: No such file or directory
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-directorynotempty.service: Failed to create cgroup /system.slice/kojid.service/path-directorynotempty.service: Permission denied
path-directorynotempty.service: Succeeded.
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
path-directorynotempty.service: Failed to create cgroup /system.slice/kojid.service/path-directorynotempty.service: Permission denied
path-directorynotempty.service: Failed to attach to cgroup /system.slice/kojid.service/path-directorynotempty.service: No such file or directory
path-directorynotempty.service: Failed at step CGROUP spawning /bin/true: No such file or directory
path-directorynotempty.service: Main process exited, code=exited, status=219/CGROUP
path-directorynotempty.service: Failed with result 'exit-code'.
Test timeout when testing path-directorynotempty.path
2020-07-28 10:47:15 +02:00
Zbigniew Jędrzejewski-Szmek 933ab8199d test-fs-util: do not assume /dev is always real
When building in Fedora's koji, test-fs-util would fail:
--- command ---
10:18:29 SYSTEMD_LANGUAGE_FALLBACK_MAP='/builddir/build/BUILD/systemd-246-rc2/src/locale/language-fallback-map' PATH='/builddir/build/BUILD/systemd-246-rc2/x86_64-redhat-linux-gnu:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin' SYSTEMD_KBD_MODEL_MAP='/builddir/build/BUILD/systemd-246-rc2/src/locale/kbd-model-map' /builddir/build/BUILD/systemd-246-rc2/x86_64-redhat-linux-gnu/test-fs-util
--- stderr ---
/* test_chase_symlinks */
/* test_unlink_noerrno */
/* test_readlink_and_make_absolute */
/* test_var_tmp */
/* test_dot_or_dot_dot */
/* test_access_fd */
/* test_touch_file */
/* test_unlinkat_deallocate */
/* test_fsync_directory_of_file */
/* test_rename_noreplace */
/* test_path_is_encrypted */
/home encrypted: yes
/var encrypted: yes
/ encrypted: yes
/proc encrypted: no
/sys encrypted: no
/dev encrypted: yes
Assertion 'expect < 0 || ((r > 0) == (expect > 0))' failed at src/test/test-fs-util.c:863, function test_path_is_encrypted_one(). Aborting.
-------

It seems / is encrypted, but /dev is just a normal directory.
2020-07-28 10:39:41 +02:00
Daan De Meyer 31363bd564 firstboot: Check if the given shell exists 2020-07-28 09:58:24 +02:00
Beniamino Galvani af710b535b dhcp6: remove assertions in dhcp6_option_parse_domainname()
Assertions are for programming errors; here the input comes directly
from the DHCP response packet.
2020-07-28 09:09:28 +02:00
Michael Marley 97efde65d8 network: radv: Send RA on newly-added dynamic prefix
When a prefix is delegated to an interface that is already sending
RAs, send an RA immediately to inform clients of the new prefix.
This allows them to start using it immediately instead of waiting
up to nearly 10 minutes (depending on when the last timed RA was
sent).  This type of situation might occur if, for example, an
outage of the WAN connection caused the addresses and prefixes to
be lost and later regained after service was restored.  The
condition for the number of RAs sent being above 0 simultaneously
ensures that RADV is already running and that this code doesn't
send any RAs before the timed RAs have started when the interface
first comes up.
2020-07-27 05:28:33 +09:00
Christian Göttsche c8f12abc73 Fix clang-11 issues
Tested with clang 11.0.0-++20200715043845+0e377e253c1-1~exp1 on Debian sid

../src/network/test-networkd-conf.c:104:56: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        test_config_parse_duid_rawdata_one(BYTES_0_128 + 2, 0, &(DUID){0, 128, BYTES_1_128});
                                           ~~~~~~~~~~~~^~~
../src/network/test-networkd-conf.c:104:56: note: use array indexing to silence this warning
        test_config_parse_duid_rawdata_one(BYTES_0_128 + 2, 0, &(DUID){0, 128, BYTES_1_128});
                                                       ^
                                           &           [  ]
1 warning generated.

../src/test/test-clock.c:52:17: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
                ftruncate(fileno(f), 0);
                ^~~~~~~~~ ~~~~~~~~~~~~
1 warning generated.

(gdb) run
Starting program: systemd/build/test-alloc-util
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
x1: 0x7fffffffd2d0
x2: 0x7fffffffdac0
y: 0x7fffffffd2cc
z: 0x7fffffffd2c0
cleanup2(0x7fffffffd2cc)
cleanup3(0x7fffffffd2c0)
cleanup1(0x7fffffffdac0)
cleanup1(0x7fffffffd2d0)
*** buffer overflow detected ***: terminated

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt full
        set = {__val = {0, 18446744073709551615, 0, 0, 0, 0, 140737348658240, 140737348659520, 0, 0, 0, 0, 0, 0, 0, 0}}
        pid = <optimized out>
        tid = <optimized out>
        ret = <optimized out>
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x22ff0, sa_sigaction = 0x22ff0}, sa_mask = {__val = {140737349888603, 4217127, 4217127, 4217127, 4217127, 4217383, 0, 0, 0, 0, 143329, 143344, 140737351162752, 8959, 18446744073709551328, 4289072}},
          sa_flags = -138460788, sa_restorer = 0xffffffffffffffff}
        sigs = {__val = {32, 0 <repeats 15 times>}}
        ap = {{gp_offset = 24, fp_offset = 0, overflow_arg_area = 0x7fffffffd280, reg_save_area = 0x7fffffffd210}}
        fd = <optimized out>
        list = <optimized out>
        nlist = <optimized out>
        cp = <optimized out>
No locals.
No locals.
No locals.
No locals.
No locals.
        l = 0
No locals.
        p1 = 0x405500 "\223Nd\n\351\301mA\214\262A\247\306b\276\317\327\353\346k\035\024\273{\276&!kλ\233\217\t\207\276\327\347\351\355\307R\276\063{\235w=\237E\357\277KL\245\374\245\066M\201+\333\064\272\332g>1<@"
        p2 = <optimized out>
        i = <optimized out>
No locals.
2020-07-26 11:32:06 +02:00
Piotr Drąg 116d6d2965 catalog: update Polish translation 2020-07-26 11:28:29 +02:00
Yu Watanabe f527c6fa08 resolvectl: fix older resolved or networkd support to set DNS servers
Fixes #16573.
2020-07-26 11:05:06 +02:00
Yu Watanabe e128723dae
Merge pull request #16566 from poettering/nspawn-osrelease-fixes
nspawn: os-release reorganization, second try
2020-07-24 13:37:31 +09:00
Yu Watanabe a8bd4bab75
Merge pull request #16567 from keszybz/more-news
NEWS and hwdb update for v246-rc2
2020-07-24 13:35:09 +09:00
Axel Rasmussen 199a892218 selinux: handle getcon_raw producing a NULL pointer, despite returning 0
Previously, we assumed that success meant we definitely got a valid
pointer. There is at least one edge case where this is not true (i.e.,
we can get both a 0 return value, and *also* a NULL pointer):
4246bb550d/libselinux/src/procattr.c (L175)

When this case occurrs, if we don't check the pointer we SIGSEGV in
early initialization.
2020-07-24 13:34:27 +09:00
Dan Streetman d05f7b5007 semaphoreci: update Debian release to bullseye
The Debian upstream-ci branch is updating to require debhelper 13,
which is only currently available from bullseye, or buster-backports.
2020-07-24 01:45:44 +03:00
Lennart Poettering 38821a0e29 update TODO 2020-07-23 18:47:38 +02:00
Lennart Poettering d64e32c245 nspawn: rework how /run/host/ is set up
Let's find the right os-release file on the host side, and only mount
the one that matters, i.e. /etc/os-release if it exists and
/usr/lib/os-release otherwise. Use the fixed path /run/host/os-release
for that.

Let's also mount /run/host as a bind mount on itself before we set up
/run/host, and let's mount it MS_RDONLY after we are done, so that it
remains immutable as a whole.
2020-07-23 18:47:38 +02:00
Luca Boccassi 62b0ee9eb1 portabled: update host's os-release path 2020-07-23 18:47:38 +02:00
Luca Boccassi 98aac2ad5a doc: update os-release spec with new path for container host's file 2020-07-23 18:47:38 +02:00
Luca Boccassi 549719699c NEWS: fix typo in path 2020-07-23 18:47:38 +02:00
Lennart Poettering d130181fd8 nspawn: add missing spdx header 2020-07-23 18:47:38 +02:00
Lennart Poettering e9769453e3
Merge pull request #16561 from yuwata/test-ordered-set
test: clarify that ordered_set_put() returns -EEXIST if entry is duplicated
2020-07-23 18:31:03 +02:00
Lennart Poettering 8047ac8fdc core: clean more env vars from env block pid1 receives
We generally clean all env vars we use ourselves to communicate with out
childrens. We forgot some more recent additions however. Let's correct
that.
2020-07-23 18:30:15 +02:00
Zbigniew Jędrzejewski-Szmek 337f0b0094 NEWS: reorder entries a bit and add a few items 2020-07-23 17:53:39 +02:00
Zbigniew Jędrzejewski-Szmek 8b25484af3 NEWS: update contributors list for v246-pre 2020-07-23 17:30:54 +02:00
Zbigniew Jędrzejewski-Szmek c015d657ec hwdb: update again for v246
Just a few minor changes.
2020-07-23 17:25:40 +02:00
Lennart Poettering b226422cd7 firstboot: don't create /etc/passwd with mode 000
It needs to be world readable (unlike /etc/shadow) when created anew.

This fixes systems that boot with "systemd-nspawn --volatile=yes", i.e.
come up with an entirely empty /etc/ and thus no existing /etc/passwd
file when firstboot runs.
2020-07-23 17:09:11 +02:00
Lennart Poettering 2a2e78e969 nspawn: fix MS_SHARED mount propagation for userns containers
We want our OS trees to be MS_SHARED by default, so that our service
namespacing logic can work correctly. Thus in nspawn we mount everything
MS_SHARED when organizing our tree. We do this early on, before changing
the user namespace (if that's requested). However CLONE_NEWUSER actually
resets MS_SHARED to MS_SLAVE for all mounts (so that less privileged
environments can't affect the more privileged ones). Hence, when
invoking it we have to reset things to MS_SHARED afterwards again. This
won't reestablish propagation, but it will make sure we get a new set of
mount peer groups everywhere that then are honoured for the mount
namespaces/propagated mounts set up inside the container further down.
2020-07-23 17:08:39 +02:00
szb512 fe224669fb Update mkosi.ubuntu to 'focal'
[zjs: Looking at https://packages.ubuntu.com/bionic/iptables-dev, iptables-dev
was a transitional package that was pulling in libxtables-dev, libip4tc-dev,
and libip6tc-dev (as listed by @GiedriusS). iptables-dev is gone in focal, so
replace it by the expanded list.]
2020-07-23 16:44:09 +02:00
Yu Watanabe 6f5d73aba6 network: compare with peer address if it is specified
Follow-ups for dfef713f3e.
2020-07-23 16:37:56 +02:00
Zbigniew Jędrzejewski-Szmek 01b92946c5
Merge pull request #16532 from yuwata/network-sync-state-file
network: sync link state file on dbus call, and ndisc cleanups
2020-07-23 16:34:38 +02:00
Zbigniew Jędrzejewski-Szmek d4fa0493a7 test-ordered-set: add a case where we get 0 for duplicate entries
This API is a complete mess. We forgot to do a hashed comparison for duplicate
entries and we use a direct pointer comparison. For trivial_hash_ops the result
is the same. For all other case, it's not. Fixing this properly will require
auditing all the uses of set_put() and ordered_set_put(). For now, let's just
acknowledge the breakage.
2020-07-23 15:47:21 +02:00
Zbigniew Jędrzejewski-Szmek 5cf821acf8 man: do not say that isolate is like switching runlevels
We need to do better here, but for now let's at least not trick
users into nuking their graphical environment. Inspired by #16548.
2020-07-23 15:30:35 +02:00