1
0
mirror of https://github.com/systemd/systemd synced 2026-03-20 03:54:45 +01:00

Compare commits

..

7 Commits

Author SHA1 Message Date
Lennart Poettering
f533cda5a8 mkosi: initialize /usr/lib/os-release' IMAGE_ID + IMAGE_VERSION fields from build
If it's passed into the build, use it, so that the mkosi build version
is propagated into the image itself.
2021-07-03 11:07:00 +01:00
Dan Streetman
d3b8e38409 test: optionally, only save test journal for failing tests
Saving the journal for passing tests creates a huge amount of unneeded
data stored for each full test run. Add a env var to allow saving the
journal only for failed tests.
2021-07-03 10:48:31 +01:00
Zbigniew Jędrzejewski-Szmek
5f9fa7a5f3
Merge pull request #20108 from yuwata/network-fix-ndisc-and-dhcp6-issue-20050
network: remove old addresses and routes after new ones are configured
2021-07-03 09:17:29 +02:00
Yu Watanabe
899034ba81 network: fix overflow issue in address lifetime calculation
Fixes another issue reported in #20050. See
https://github.com/systemd/systemd/issues/20050#issuecomment-872967337.
2021-07-02 22:26:07 +09:00
Yu Watanabe
e95ec7cd1e network: drop old dhcp6 addresses or routes after new ones are configured
Fixes the issue similar to #20050 but for DHCP6.
2021-07-02 20:59:38 +09:00
Yu Watanabe
fe139e8ef9 network: drop old ndisc configurations after new ones are configured
Previously, `ndisc_remove_old_one()` checked `ndisc_{addresses,routes}_configured`
flags, but they are not unset when all addresses or routes are already
assigned.
After the request queue is implemented, the address or route requests
are not processed within the same event of ndisc handler is called, but
will processed later when they are ready. So, calling `ndisc_remove_old()`
in the event of ndisc handler will remove all addresses and routes
previously assigned even they are requested to be updated.

This makes `ndisc_remove_old()` do nothing when there exist some
requests to configure addresses and routes, thus previously assigned
addresses and routes are kept until all requests are processed.

Fixes #20050.
2021-07-02 20:59:38 +09:00
Yu Watanabe
790736e42e network: fix log message 2021-07-02 20:59:32 +09:00
5 changed files with 60 additions and 17 deletions

View File

@ -134,6 +134,28 @@ Kernel \r on an \m (\l)
EOF
if [ -n "$IMAGE_ID" ] ; then
mkdir -p "$DESTDIR"/usr/lib
sed -n \
-e '/^IMAGE_ID=/!p' \
-e '$aIMAGE_ID='$IMAGE_ID < /usr/lib/os-release > "$DESTDIR"/usr/lib/os-release
OSRELEASEFILE="$DESTDIR"/usr/lib/os-release
else
OSRELEASEFILE=/usr/lib/os-release
fi
if [ -n "$IMAGE_VERSION" ] ; then
mkdir -p "$DESTDIR"/usr/lib
sed -n \
-e '/^IMAGE_VERSION=/!p' \
-e '$aIMAGE_VERSION='$IMAGE_VERSION < $OSRELEASEFILE > /tmp/os-release.tmp
cat /tmp/os-release.tmp > "$DESTDIR"/usr/lib/os-release
rm /tmp/os-release.tmp
fi
# Manually update the boot loader from the one we just built
mkdir -p "$DESTDIR"/boot/efi/EFI/systemd "$DESTDIR"/boot/efi/EFI/BOOT
cp "$DESTDIR"/usr/lib/systemd/boot/efi/systemd-bootx64.efi "$DESTDIR"/boot/efi/EFI/systemd/systemd-bootx64.efi

View File

@ -145,7 +145,7 @@ static int dhcp6_pd_remove_old(Link *link, bool force) {
assert(link);
assert(link->manager);
if (!force && (link->dhcp6_pd_address_messages != 0 || link->dhcp6_pd_route_messages != 0))
if (!force && (link->dhcp6_pd_address_messages > 0 || link->dhcp6_pd_route_messages > 0))
return 0;
if (set_isempty(link->dhcp6_pd_addresses_old) && set_isempty(link->dhcp6_pd_routes_old))
@ -740,7 +740,7 @@ static int dhcp6_remove_old(Link *link, bool force) {
assert(link);
if (!force && (!link->dhcp6_address_configured || !link->dhcp6_route_configured))
if (!force && (link->dhcp6_address_messages > 0 || link->dhcp6_route_messages > 0))
return 0;
if (set_isempty(link->dhcp6_addresses_old) && set_isempty(link->dhcp6_routes_old))

View File

@ -519,7 +519,8 @@ void link_check_ready(Link *link) {
/* When DHCP[46], NDisc, or IPv4LL is enabled, at least one protocol must be finished. */
return (void) log_link_debug(link, "%s(): dynamic addresses or routes are not configured.", __func__);
log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp_routes:%s dhcp_pd_addresses:%s dhcp_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s",
log_link_debug(link, "%s(): dhcp4:%s ipv4ll:%s dhcp6_addresses:%s dhcp6_routes:%s "
"dhcp6_pd_addresses:%s dhcp6_pd_routes:%s ndisc_addresses:%s ndisc_routes:%s",
__func__,
yes_no(link->dhcp4_configured),
yes_no(link->ipv4ll_address_configured),

View File

@ -128,9 +128,6 @@ static int ndisc_remove_old_one(Link *link, const struct in6_addr *router, bool
if (!force) {
bool set_callback = false;
if (!link->ndisc_addresses_configured || !link->ndisc_routes_configured)
return 0;
SET_FOREACH(na, link->ndisc_addresses)
if (!na->marked && in6_addr_equal(&na->router, router)) {
set_callback = true;
@ -212,6 +209,10 @@ static int ndisc_remove_old(Link *link) {
assert(link);
if (link->ndisc_addresses_messages > 0 ||
link->ndisc_routes_messages > 0)
return 0;
routers = set_new(&in6_addr_hash_ops);
if (!routers)
return -ENOMEM;
@ -818,8 +819,10 @@ static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *r
r = address_get(link, address, &e);
if (r > 0) {
/* If the address is already assigned, but not valid anymore, then refuse to
* update the address. */
if (e->cinfo.tstamp / 100 + e->cinfo.ifa_valid < time_now / USEC_PER_SEC)
* update the address, and it will be removed. */
if (e->cinfo.ifa_valid != CACHE_INFO_INFINITY_LIFE_TIME &&
usec_add(e->cinfo.tstamp / 100 * USEC_PER_SEC,
e->cinfo.ifa_valid * USEC_PER_SEC) < time_now)
continue;
}

View File

@ -1117,6 +1117,15 @@ check_asan_reports() {
}
save_journal() {
# Default to always saving journal
local save="yes"
if [ "${TEST_SAVE_JOURNAL}" = "no" ]; then
save="no"
elif [ "${TEST_SAVE_JOURNAL}" = "fail" ] && [ "$2" = "0" ]; then
save="no"
fi
if [ -n "${ARTIFACT_DIRECTORY}" ]; then
dest="${ARTIFACT_DIRECTORY}/${testname:?}.journal"
else
@ -1124,9 +1133,9 @@ save_journal() {
fi
for j in "${1:?}"/*; do
"$SYSTEMD_JOURNAL_REMOTE" \
-o "$dest" \
--getter="$JOURNALCTL -o export -D $j"
if [ "$save" = "yes" ]; then
"$SYSTEMD_JOURNAL_REMOTE" -o "$dest" --getter="$JOURNALCTL -o export -D $j"
fi
if [ -n "${TEST_SHOW_JOURNAL}" ]; then
echo "---- $j ----"
@ -1136,6 +1145,10 @@ save_journal() {
rm -r "$j"
done
if [ "$save" != "yes" ]; then
return 0
fi
if [ -n "${SUDO_USER}" ]; then
setfacl -m "user:${SUDO_USER:?}:r-X" "$dest"*
fi
@ -1171,10 +1184,10 @@ check_result_common() {
ret=3
fi
save_journal "$workspace/var/log/journal"
check_asan_reports "$workspace" || ret=4
save_journal "$workspace/var/log/journal" $ret
if [ -d "${ARTIFACT_DIRECTORY}" ] && [ -f "$workspace/strace.out" ]; then
cp "$workspace/strace.out" "${ARTIFACT_DIRECTORY}/"
fi
@ -1252,10 +1265,12 @@ check_result_nspawn_unittests() {
fi
fi
save_journal "$workspace/var/log/journal"
[[ -n "${TIMED_OUT:=}" ]] && ret=1
save_journal "$workspace/var/log/journal" $ret
_umount_dir "${initdir:?}"
[[ -n "${TIMED_OUT:=}" ]] && ret=1
return $ret
}
@ -1282,10 +1297,12 @@ check_result_qemu_unittests() {
fi
fi
save_journal "$initdir/var/log/journal"
[[ -n "${TIMED_OUT:=}" ]] && ret=1
save_journal "$initdir/var/log/journal" $ret
_umount_dir "$initdir"
[[ -n "${TIMED_OUT:=}" ]] && ret=1
return $ret
}