Compare commits
13 Commits
57c9133b99
...
8403c1a2a0
Author | SHA1 | Date |
---|---|---|
![]() |
8403c1a2a0 | |
![]() |
eee7aa41fc | |
![]() |
c6c34be994 | |
![]() |
710653d3bc | |
![]() |
d9826d303b | |
![]() |
10ed8cda58 | |
![]() |
a035eaa227 | |
![]() |
e8881f09c5 | |
![]() |
60bcd98228 | |
![]() |
90755dac69 | |
![]() |
6d88e4a4b4 | |
![]() |
bf478dcffb | |
![]() |
ec65c29e51 |
|
@ -25,7 +25,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
- uses: systemd/mkosi@7e4ec15aee6b98300b2ee14265bc647a716a9f8a
|
- uses: systemd/mkosi@dbb4020beee2cdf250f93a425794f1cf8b0fe693
|
||||||
|
|
||||||
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
||||||
# immediately, we remove the files in the background. However, we first move them to a different location
|
# immediately, we remove the files in the background. However, we first move them to a different location
|
||||||
|
@ -90,7 +90,6 @@ jobs:
|
||||||
sudo mkosi sandbox -- \
|
sudo mkosi sandbox -- \
|
||||||
meson setup \
|
meson setup \
|
||||||
--buildtype=debugoptimized \
|
--buildtype=debugoptimized \
|
||||||
-Dintegration-tests=true \
|
|
||||||
build
|
build
|
||||||
|
|
||||||
- name: Build image
|
- name: Build image
|
||||||
|
@ -120,7 +119,8 @@ jobs:
|
||||||
meson test \
|
meson test \
|
||||||
-C build \
|
-C build \
|
||||||
--no-rebuild \
|
--no-rebuild \
|
||||||
--suite integration-tests \
|
--setup=integration \
|
||||||
|
--suite=integration-tests \
|
||||||
--print-errorlogs \
|
--print-errorlogs \
|
||||||
--no-stdsplit \
|
--no-stdsplit \
|
||||||
--num-processes "$(($(nproc) - 1))" \
|
--num-processes "$(($(nproc) - 1))" \
|
||||||
|
|
|
@ -120,7 +120,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
- uses: systemd/mkosi@7e4ec15aee6b98300b2ee14265bc647a716a9f8a
|
- uses: systemd/mkosi@dbb4020beee2cdf250f93a425794f1cf8b0fe693
|
||||||
|
|
||||||
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
# Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space
|
||||||
# immediately, we remove the files in the background. However, we first move them to a different location
|
# immediately, we remove the files in the background. However, we first move them to a different location
|
||||||
|
@ -197,7 +197,6 @@ jobs:
|
||||||
sudo mkosi sandbox -- \
|
sudo mkosi sandbox -- \
|
||||||
meson setup \
|
meson setup \
|
||||||
--buildtype=debugoptimized \
|
--buildtype=debugoptimized \
|
||||||
-Dintegration-tests=true \
|
|
||||||
-Dbpf-framework=disabled \
|
-Dbpf-framework=disabled \
|
||||||
build
|
build
|
||||||
|
|
||||||
|
@ -233,7 +232,8 @@ jobs:
|
||||||
meson test \
|
meson test \
|
||||||
-C build \
|
-C build \
|
||||||
--no-rebuild \
|
--no-rebuild \
|
||||||
--suite integration-tests \
|
--setup=integration \
|
||||||
|
--suite=integration-tests \
|
||||||
--print-errorlogs \
|
--print-errorlogs \
|
||||||
--no-stdsplit \
|
--no-stdsplit \
|
||||||
--num-processes "$(($(nproc) - 1))" \
|
--num-processes "$(($(nproc) - 1))" \
|
||||||
|
|
5
NEWS
5
NEWS
|
@ -489,6 +489,11 @@ CHANGES WITH 257:
|
||||||
existing interfaces, and invoke 'networkctl reload' or restart
|
existing interfaces, and invoke 'networkctl reload' or restart
|
||||||
systemd-networkd.
|
systemd-networkd.
|
||||||
|
|
||||||
|
* systemd-networkd now supports configuring the timeout for IPv4
|
||||||
|
Duplicate Address Detection via a new setting
|
||||||
|
IPv4DuplicateAddressDetectionTimeout=. The default timeout value has
|
||||||
|
been changed from 7 seconds to 200 milliseconds.
|
||||||
|
|
||||||
systemd-boot, systemd-stub, and related tools:
|
systemd-boot, systemd-stub, and related tools:
|
||||||
|
|
||||||
* The EFI stub now supports loading of .ucode sections with microcode
|
* The EFI stub now supports loading of .ucode sections with microcode
|
||||||
|
|
|
@ -987,6 +987,17 @@ DuplicateAddressDetection=none</programlisting></para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>IPv4DuplicateAddressDetectionTimeout=</varname></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Configures the maximum timeout for IPv4 Duplicate Address Detection (RFC 5227). Must be a
|
||||||
|
value between 1 millisecond and 60 seconds. If set, Duplicate Address Detection takes a randomized
|
||||||
|
time between 57% (4/7) and 100% of the given value. If unset, defaults to 200 milliseconds.</para>
|
||||||
|
|
||||||
|
<xi:include href="version-info.xml" xpointer="v258"/>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>IPv4ReversePathFilter=</varname></term>
|
<term><varname>IPv4ReversePathFilter=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -1738,8 +1749,10 @@ NFTSet=prefix:netdev:filter:eth_ipv4_prefix</programlisting>
|
||||||
<term><varname>FirewallMark=</varname></term>
|
<term><varname>FirewallMark=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the iptables firewall mark value to match (a number in the range
|
<para>Specifies the iptables firewall mark value to match (a number in the range
|
||||||
1…4294967295). Optionally, the firewall mask (also a number between 1…4294967295) can be
|
0…4294967295). Optionally, the firewall mask (also a number between 0…4294967295) can be
|
||||||
suffixed with a slash (<literal>/</literal>), e.g., <literal>7/255</literal>.</para>
|
suffixed with a slash (<literal>/</literal>), e.g., <literal>7/255</literal>. When the
|
||||||
|
mark value is non-zero and no mask is explicitly specified, all bits of the mark are
|
||||||
|
compared. </para>
|
||||||
|
|
||||||
<xi:include href="version-info.xml" xpointer="v235"/>
|
<xi:include href="version-info.xml" xpointer="v235"/>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
11
meson.build
11
meson.build
|
@ -13,6 +13,12 @@ project('systemd', 'c',
|
||||||
meson_version : '>= 0.62.0',
|
meson_version : '>= 0.62.0',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_test_setup(
|
||||||
|
'default',
|
||||||
|
exclude_suites : ['integration-tests'],
|
||||||
|
is_default : true,
|
||||||
|
)
|
||||||
|
|
||||||
project_major_version = meson.project_version().split('.')[0].split('~')[0]
|
project_major_version = meson.project_version().split('.')[0].split('~')[0]
|
||||||
if meson.project_version().contains('.')
|
if meson.project_version().contains('.')
|
||||||
project_minor_version = meson.project_version().split('.')[-1].split('~')[0]
|
project_minor_version = meson.project_version().split('.')[-1].split('~')[0]
|
||||||
|
@ -339,7 +345,6 @@ meson_build_sh = find_program('tools/meson-build.sh')
|
||||||
want_tests = get_option('tests')
|
want_tests = get_option('tests')
|
||||||
want_slow_tests = want_tests != 'false' and get_option('slow-tests')
|
want_slow_tests = want_tests != 'false' and get_option('slow-tests')
|
||||||
want_fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
|
want_fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
|
||||||
want_integration_tests = want_tests != 'false' and get_option('integration-tests')
|
|
||||||
install_tests = want_tests != 'false' and get_option('install-tests')
|
install_tests = want_tests != 'false' and get_option('install-tests')
|
||||||
|
|
||||||
if add_languages('cpp', native : false, required : fuzzer_build)
|
if add_languages('cpp', native : false, required : fuzzer_build)
|
||||||
|
@ -2661,10 +2666,6 @@ endif
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
mkosi = find_program('mkosi', required : false)
|
mkosi = find_program('mkosi', required : false)
|
||||||
if want_integration_tests and not mkosi.found()
|
|
||||||
error('Could not find mkosi which is required to run the integration tests')
|
|
||||||
endif
|
|
||||||
|
|
||||||
mkosi_depends = public_programs
|
mkosi_depends = public_programs
|
||||||
|
|
||||||
foreach executable : ['systemd-journal-remote', 'systemd-sbsign', 'systemd-keyutil']
|
foreach executable : ['systemd-journal-remote', 'systemd-sbsign', 'systemd-keyutil']
|
||||||
|
|
|
@ -509,7 +509,7 @@ option('install-tests', type : 'boolean', value : false,
|
||||||
description : 'install test executables')
|
description : 'install test executables')
|
||||||
option('log-message-verification', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
option('log-message-verification', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||||
description : 'do fake printf() calls to verify format strings')
|
description : 'do fake printf() calls to verify format strings')
|
||||||
option('integration-tests', type : 'boolean', value : false,
|
option('integration-tests', type : 'boolean', value : false, deprecated : true,
|
||||||
description : 'run the integration tests')
|
description : 'run the integration tests')
|
||||||
|
|
||||||
option('ok-color', type : 'combo',
|
option('ok-color', type : 'combo',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
[Config]
|
[Config]
|
||||||
MinimumVersion=commit:7e4ec15aee6b98300b2ee14265bc647a716a9f8a
|
MinimumVersion=commit:dbb4020beee2cdf250f93a425794f1cf8b0fe693
|
||||||
Dependencies=
|
Dependencies=
|
||||||
exitrd
|
exitrd
|
||||||
initrd
|
initrd
|
||||||
|
@ -78,8 +78,7 @@ KernelCommandLine=
|
||||||
oops=panic
|
oops=panic
|
||||||
panic=-1
|
panic=-1
|
||||||
softlockup_panic=1
|
softlockup_panic=1
|
||||||
# Disabled due to BTRFS issue, waiting for the fix to become available
|
panic_on_warn=1
|
||||||
panic_on_warn=0
|
|
||||||
psi=1
|
psi=1
|
||||||
mitigations=off
|
mitigations=off
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
Distribution=arch
|
Distribution=arch
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
|
PrepareScripts=systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
systemd
|
systemd
|
||||||
systemd-libs
|
systemd-libs
|
||||||
|
|
|
@ -5,6 +5,7 @@ Distribution=|centos
|
||||||
Distribution=|fedora
|
Distribution=|fedora
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
|
PrepareScripts=systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
systemd
|
systemd
|
||||||
systemd-boot
|
systemd-boot
|
||||||
|
|
|
@ -5,6 +5,7 @@ Distribution=|debian
|
||||||
Distribution=|ubuntu
|
Distribution=|ubuntu
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
|
PrepareScripts=systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
libnss-myhostname
|
libnss-myhostname
|
||||||
libnss-mymachines
|
libnss-mymachines
|
||||||
|
|
|
@ -11,6 +11,7 @@ Repositories=non-oss
|
||||||
SandboxTrees=macros.db_backend:/etc/rpm/macros.db_backend
|
SandboxTrees=macros.db_backend:/etc/rpm/macros.db_backend
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
|
PrepareScripts=systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
libsystemd0
|
libsystemd0
|
||||||
libudev1
|
libudev1
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=arch
|
Distribution=arch
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/arch/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/arch/systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
systemd
|
systemd
|
||||||
systemd-libs
|
systemd-libs
|
||||||
|
|
|
@ -5,6 +5,6 @@ Distribution=|centos
|
||||||
Distribution=|fedora
|
Distribution=|fedora
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
systemd-standalone-shutdown
|
systemd-standalone-shutdown
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
Distribution=debian
|
Distribution=debian
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
systemd-standalone-shutdown
|
systemd-standalone-shutdown
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=opensuse
|
Distribution=opensuse
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
diffutils
|
diffutils
|
||||||
grep
|
grep
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=ubuntu
|
Distribution=ubuntu
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare
|
||||||
VolatilePackages=
|
VolatilePackages=
|
||||||
libsystemd-shared
|
libsystemd-shared
|
||||||
libsystemd0
|
libsystemd0
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=arch
|
Distribution=arch
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/arch/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/arch/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
btrfs-progs
|
btrfs-progs
|
||||||
tpm2-tools
|
tpm2-tools
|
||||||
|
|
|
@ -5,7 +5,7 @@ Distribution=|centos
|
||||||
Distribution=|fedora
|
Distribution=|fedora
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
tpm2-tools
|
tpm2-tools
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ Distribution=|debian
|
||||||
Distribution=|ubuntu
|
Distribution=|ubuntu
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
btrfs-progs
|
btrfs-progs
|
||||||
tpm2-tools
|
tpm2-tools
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=opensuse
|
Distribution=opensuse
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
btrfs-progs
|
btrfs-progs
|
||||||
kmod
|
kmod
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=arch
|
Distribution=arch
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/arch/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/arch/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
inetutils
|
inetutils
|
||||||
iproute
|
iproute
|
||||||
|
|
|
@ -5,7 +5,7 @@ Distribution=|centos
|
||||||
Distribution=|fedora
|
Distribution=|fedora
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/centos-fedora/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
hostname
|
hostname
|
||||||
iproute
|
iproute
|
||||||
|
|
|
@ -5,7 +5,7 @@ Distribution=|debian
|
||||||
Distribution=|ubuntu
|
Distribution=|ubuntu
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
hostname
|
hostname
|
||||||
iproute2
|
iproute2
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Distribution=opensuse
|
Distribution=opensuse
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/mkosi.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/opensuse/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
diffutils
|
diffutils
|
||||||
grep
|
grep
|
||||||
|
|
|
@ -25,18 +25,26 @@
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "time-util.h"
|
#include "time-util.h"
|
||||||
|
|
||||||
/* Constants from the RFC */
|
/* Intervals from the RFC in seconds, need to be multiplied by the time unit */
|
||||||
#define PROBE_WAIT_USEC (1U * USEC_PER_SEC)
|
#define PROBE_WAIT 1U
|
||||||
#define PROBE_NUM 3U
|
#define PROBE_MIN 1U
|
||||||
#define PROBE_MIN_USEC (1U * USEC_PER_SEC)
|
#define PROBE_MAX 2U
|
||||||
#define PROBE_MAX_USEC (2U * USEC_PER_SEC)
|
#define ANNOUNCE_WAIT 2U
|
||||||
#define ANNOUNCE_WAIT_USEC (2U * USEC_PER_SEC)
|
#define TOTAL_TIME_UNITS 7U
|
||||||
#define ANNOUNCE_NUM 2U
|
|
||||||
|
/* Intervals from the RFC not adjusted to the time unit */
|
||||||
#define ANNOUNCE_INTERVAL_USEC (2U * USEC_PER_SEC)
|
#define ANNOUNCE_INTERVAL_USEC (2U * USEC_PER_SEC)
|
||||||
#define MAX_CONFLICTS 10U
|
|
||||||
#define RATE_LIMIT_INTERVAL_USEC (60U * USEC_PER_SEC)
|
#define RATE_LIMIT_INTERVAL_USEC (60U * USEC_PER_SEC)
|
||||||
#define DEFEND_INTERVAL_USEC (10U * USEC_PER_SEC)
|
#define DEFEND_INTERVAL_USEC (10U * USEC_PER_SEC)
|
||||||
|
|
||||||
|
/* Other constants from the RFC */
|
||||||
|
#define PROBE_NUM 3U
|
||||||
|
#define ANNOUNCE_NUM 2U
|
||||||
|
#define MAX_CONFLICTS 10U
|
||||||
|
|
||||||
|
/* Default timeout from the RFC */
|
||||||
|
#define TIMEOUT_DEFAULT_USEC (200 * USEC_PER_MSEC)
|
||||||
|
|
||||||
typedef enum IPv4ACDState {
|
typedef enum IPv4ACDState {
|
||||||
IPV4ACD_STATE_INIT,
|
IPV4ACD_STATE_INIT,
|
||||||
IPV4ACD_STATE_STARTED,
|
IPV4ACD_STATE_STARTED,
|
||||||
|
@ -60,6 +68,10 @@ struct sd_ipv4acd {
|
||||||
unsigned n_iteration;
|
unsigned n_iteration;
|
||||||
unsigned n_conflict;
|
unsigned n_conflict;
|
||||||
|
|
||||||
|
/* Indicates the duration of a "time unit", i.e. one second in the RFC but scaled to the
|
||||||
|
* chosen total duration. Represents 1/7 of the total conflict detection timeout. */
|
||||||
|
uint64_t time_unit;
|
||||||
|
|
||||||
sd_event_source *receive_message_event_source;
|
sd_event_source *receive_message_event_source;
|
||||||
sd_event_source *timer_event_source;
|
sd_event_source *timer_event_source;
|
||||||
|
|
||||||
|
@ -150,6 +162,7 @@ int sd_ipv4acd_new(sd_ipv4acd **ret) {
|
||||||
*acd = (sd_ipv4acd) {
|
*acd = (sd_ipv4acd) {
|
||||||
.n_ref = 1,
|
.n_ref = 1,
|
||||||
.state = IPV4ACD_STATE_INIT,
|
.state = IPV4ACD_STATE_INIT,
|
||||||
|
.time_unit = TIMEOUT_DEFAULT_USEC / TOTAL_TIME_UNITS,
|
||||||
.ifindex = -1,
|
.ifindex = -1,
|
||||||
.fd = -EBADF,
|
.fd = -EBADF,
|
||||||
};
|
};
|
||||||
|
@ -218,14 +231,20 @@ static int ipv4acd_on_timeout(sd_event_source *s, uint64_t usec, void *userdata)
|
||||||
case IPV4ACD_STATE_STARTED:
|
case IPV4ACD_STATE_STARTED:
|
||||||
acd->defend_window = 0;
|
acd->defend_window = 0;
|
||||||
|
|
||||||
|
log_ipv4acd(acd,
|
||||||
|
"Started on address " IPV4_ADDRESS_FMT_STR " with a max timeout of %s",
|
||||||
|
IPV4_ADDRESS_FMT_VAL(acd->address),
|
||||||
|
FORMAT_TIMESPAN(acd->time_unit * TOTAL_TIME_UNITS, USEC_PER_MSEC));
|
||||||
|
|
||||||
ipv4acd_set_state(acd, IPV4ACD_STATE_WAITING_PROBE, true);
|
ipv4acd_set_state(acd, IPV4ACD_STATE_WAITING_PROBE, true);
|
||||||
|
|
||||||
if (acd->n_conflict >= MAX_CONFLICTS) {
|
if (acd->n_conflict >= MAX_CONFLICTS) {
|
||||||
log_ipv4acd(acd, "Max conflicts reached, delaying by %s",
|
log_ipv4acd(acd, "Max conflicts reached, delaying by %s",
|
||||||
FORMAT_TIMESPAN(RATE_LIMIT_INTERVAL_USEC, 0));
|
FORMAT_TIMESPAN(RATE_LIMIT_INTERVAL_USEC, 0));
|
||||||
r = ipv4acd_set_next_wakeup(acd, RATE_LIMIT_INTERVAL_USEC, PROBE_WAIT_USEC);
|
r = ipv4acd_set_next_wakeup(
|
||||||
|
acd, RATE_LIMIT_INTERVAL_USEC, PROBE_WAIT * acd->time_unit);
|
||||||
} else
|
} else
|
||||||
r = ipv4acd_set_next_wakeup(acd, 0, PROBE_WAIT_USEC);
|
r = ipv4acd_set_next_wakeup(acd, 0, PROBE_WAIT * acd->time_unit);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -245,13 +264,16 @@ static int ipv4acd_on_timeout(sd_event_source *s, uint64_t usec, void *userdata)
|
||||||
if (acd->n_iteration < PROBE_NUM - 2) {
|
if (acd->n_iteration < PROBE_NUM - 2) {
|
||||||
ipv4acd_set_state(acd, IPV4ACD_STATE_PROBING, false);
|
ipv4acd_set_state(acd, IPV4ACD_STATE_PROBING, false);
|
||||||
|
|
||||||
r = ipv4acd_set_next_wakeup(acd, PROBE_MIN_USEC, (PROBE_MAX_USEC-PROBE_MIN_USEC));
|
r = ipv4acd_set_next_wakeup(
|
||||||
|
acd,
|
||||||
|
PROBE_MIN * acd->time_unit,
|
||||||
|
(PROBE_MAX - PROBE_MIN) * acd->time_unit);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
ipv4acd_set_state(acd, IPV4ACD_STATE_WAITING_ANNOUNCE, true);
|
ipv4acd_set_state(acd, IPV4ACD_STATE_WAITING_ANNOUNCE, true);
|
||||||
|
|
||||||
r = ipv4acd_set_next_wakeup(acd, ANNOUNCE_WAIT_USEC, 0);
|
r = ipv4acd_set_next_wakeup(acd, ANNOUNCE_WAIT * acd->time_unit, 0);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -442,6 +464,19 @@ int sd_ipv4acd_set_ifname(sd_ipv4acd *acd, const char *ifname) {
|
||||||
return free_and_strdup(&acd->ifname, ifname);
|
return free_and_strdup(&acd->ifname, ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sd_ipv4acd_set_timeout(sd_ipv4acd *acd, uint64_t timeout_usec) {
|
||||||
|
assert_return(acd, -EINVAL);
|
||||||
|
|
||||||
|
if (timeout_usec == 0)
|
||||||
|
timeout_usec = TIMEOUT_DEFAULT_USEC;
|
||||||
|
|
||||||
|
/* Clamp the total duration to a value between 1ms and 1 minute */
|
||||||
|
acd->time_unit = DIV_ROUND_UP(
|
||||||
|
CLAMP(timeout_usec, 1U * USEC_PER_MSEC, 1U * USEC_PER_MINUTE), TOTAL_TIME_UNITS);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int sd_ipv4acd_get_ifname(sd_ipv4acd *acd, const char **ret) {
|
int sd_ipv4acd_get_ifname(sd_ipv4acd *acd, const char **ret) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,12 @@ int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sd_ipv4ll_set_timeout(sd_ipv4ll *ll, uint64_t timeout_usec) {
|
||||||
|
assert_return(ll, -EINVAL);
|
||||||
|
|
||||||
|
return sd_ipv4acd_set_timeout(ll->acd, timeout_usec);
|
||||||
|
}
|
||||||
|
|
||||||
int sd_ipv4ll_detach_event(sd_ipv4ll *ll) {
|
int sd_ipv4ll_detach_event(sd_ipv4ll *ll) {
|
||||||
assert_return(ll, -EINVAL);
|
assert_return(ll, -EINVAL);
|
||||||
|
|
||||||
|
|
|
@ -161,12 +161,13 @@ static int socket_recv_message(int fd, void *buf, size_t buf_size, uint32_t *ret
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
assert(peek || (buf && buf_size > 0));
|
assert(peek || (buf && buf_size > 0));
|
||||||
|
|
||||||
|
/* Note: this might return successfully, but with a zero size under some transient conditions, such
|
||||||
|
* as the reception of a non-kernel message. In such a case the passed buffer might or might not be
|
||||||
|
* modified. Caller must treat a zero return as "no message, but also not an error". */
|
||||||
|
|
||||||
n = recvmsg_safe(fd, &msg, peek ? (MSG_PEEK|MSG_TRUNC) : 0);
|
n = recvmsg_safe(fd, &msg, peek ? (MSG_PEEK|MSG_TRUNC) : 0);
|
||||||
if (ERRNO_IS_NEG_TRANSIENT(n)) {
|
if (ERRNO_IS_NEG_TRANSIENT(n))
|
||||||
if (ret_mcast_group)
|
goto transient;
|
||||||
*ret_mcast_group = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (n == -ENOBUFS)
|
if (n == -ENOBUFS)
|
||||||
return log_debug_errno(n, "sd-netlink: kernel receive buffer overrun");
|
return log_debug_errno(n, "sd-netlink: kernel receive buffer overrun");
|
||||||
if (n == -ECHRNG)
|
if (n == -ECHRNG)
|
||||||
|
@ -181,15 +182,16 @@ static int socket_recv_message(int fd, void *buf, size_t buf_size, uint32_t *ret
|
||||||
log_debug("sd-netlink: ignoring message from PID %"PRIu32, sender.nl.nl_pid);
|
log_debug("sd-netlink: ignoring message from PID %"PRIu32, sender.nl.nl_pid);
|
||||||
|
|
||||||
if (peek) {
|
if (peek) {
|
||||||
/* drop the message */
|
/* Drop the message. Note that we ignore ECHRNG/EXFULL errors here, which
|
||||||
|
* recvmsg_safe() returns in case the payload or cdata is truncated. Given we just
|
||||||
|
* want to drop the message we also don't care if its payload or cdata was
|
||||||
|
* truncated. */
|
||||||
n = recvmsg_safe(fd, &msg, 0);
|
n = recvmsg_safe(fd, &msg, 0);
|
||||||
if (n < 0)
|
if (n < 0 && !IN_SET(n, -ECHRNG, -EXFULL))
|
||||||
return (int) n;
|
return (int) n;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret_mcast_group)
|
goto transient;
|
||||||
*ret_mcast_group = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret_mcast_group) {
|
if (ret_mcast_group) {
|
||||||
|
@ -203,6 +205,12 @@ static int socket_recv_message(int fd, void *buf, size_t buf_size, uint32_t *ret
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) n;
|
return (int) n;
|
||||||
|
|
||||||
|
transient:
|
||||||
|
if (ret_mcast_group)
|
||||||
|
*ret_mcast_group = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
|
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
|
||||||
|
|
|
@ -25,7 +25,7 @@ DEFINE_PRIVATE_HASH_OPS_FULL(
|
||||||
bool link_ipv4acd_supported(Link *link) {
|
bool link_ipv4acd_supported(Link *link) {
|
||||||
assert(link);
|
assert(link);
|
||||||
|
|
||||||
if (link->flags & IFF_LOOPBACK)
|
if (link->flags & (IFF_LOOPBACK | IFF_NOARP))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* ARPHRD_INFINIBAND seems to potentially support IPv4ACD.
|
/* ARPHRD_INFINIBAND seems to potentially support IPv4ACD.
|
||||||
|
@ -39,13 +39,6 @@ bool link_ipv4acd_supported(Link *link) {
|
||||||
if (ether_addr_is_null(&link->hw_addr.ether))
|
if (ether_addr_is_null(&link->hw_addr.ether))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (streq_ptr(link->kind, "vrf"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* L3 or L3S mode do not support ARP. */
|
|
||||||
if (IN_SET(link_get_ipvlan_mode(link), NETDEV_IPVLAN_MODE_L3, NETDEV_IPVLAN_MODE_L3S))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +205,7 @@ int ipv4acd_configure(Link *link, const Address *address) {
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
assert(link->manager);
|
assert(link->manager);
|
||||||
|
assert(link->network);
|
||||||
assert(address);
|
assert(address);
|
||||||
|
|
||||||
if (address->family != AF_INET)
|
if (address->family != AF_INET)
|
||||||
|
@ -256,6 +250,10 @@ int ipv4acd_configure(Link *link, const Address *address) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
r = sd_ipv4acd_set_timeout(acd, link->network->ipv4_dad_timeout);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
r = sd_ipv4acd_set_callback(acd, on_acd, link);
|
r = sd_ipv4acd_set_callback(acd, on_acd, link);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -223,6 +223,7 @@ int ipv4ll_configure(Link *link) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
assert(link->network);
|
||||||
|
|
||||||
if (!link_ipv4ll_enabled(link))
|
if (!link_ipv4ll_enabled(link))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -253,6 +254,10 @@ int ipv4ll_configure(Link *link) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
r = sd_ipv4ll_set_timeout(link->ipv4ll, link->network->ipv4_dad_timeout);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
r = sd_ipv4ll_set_ifindex(link->ipv4ll, link->ifindex);
|
r = sd_ipv4ll_set_ifindex(link->ipv4ll, link->ifindex);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -139,6 +139,7 @@ Network.IPv6PrivacyExtensions, config_parse_ipv6_privacy_extension
|
||||||
Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ndisc)
|
Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ndisc)
|
||||||
Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ndisc)
|
Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ndisc)
|
||||||
Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits)
|
Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits)
|
||||||
|
Network.IPv4DuplicateAddressDetectionTimeout, config_parse_sec, 0, offsetof(Network, ipv4_dad_timeout)
|
||||||
Network.IPv6HopLimit, config_parse_uint8, 0, offsetof(Network, ipv6_hop_limit)
|
Network.IPv6HopLimit, config_parse_uint8, 0, offsetof(Network, ipv6_hop_limit)
|
||||||
Network.IPv6RetransmissionTimeSec, config_parse_sec, 0, offsetof(Network, ipv6_retransmission_time)
|
Network.IPv6RetransmissionTimeSec, config_parse_sec, 0, offsetof(Network, ipv6_retransmission_time)
|
||||||
Network.IPv6ProxyNDP, config_parse_tristate, 0, offsetof(Network, ipv6_proxy_ndp)
|
Network.IPv6ProxyNDP, config_parse_tristate, 0, offsetof(Network, ipv6_proxy_ndp)
|
||||||
|
|
|
@ -112,6 +112,7 @@ struct Network {
|
||||||
char **bind_carrier;
|
char **bind_carrier;
|
||||||
bool default_route_on_device;
|
bool default_route_on_device;
|
||||||
AddressFamily ip_masquerade;
|
AddressFamily ip_masquerade;
|
||||||
|
usec_t ipv4_dad_timeout;
|
||||||
|
|
||||||
/* Protocol independent settings */
|
/* Protocol independent settings */
|
||||||
UseDomains use_domains;
|
UseDomains use_domains;
|
||||||
|
|
|
@ -615,7 +615,7 @@ static int routing_policy_rule_set_netlink_message(const RoutingPolicyRule *rule
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (rule->fwmark > 0) {
|
if (rule->fwmark > 0 || rule->fwmask > 0) {
|
||||||
r = sd_netlink_message_append_u32(m, FRA_FWMARK, rule->fwmark);
|
r = sd_netlink_message_append_u32(m, FRA_FWMARK, rule->fwmark);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -1315,14 +1315,12 @@ static int parse_fwmark_fwmask(const char *s, uint32_t *ret_fwmark, uint32_t *re
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (fwmark > 0) {
|
|
||||||
if (slash) {
|
if (slash) {
|
||||||
r = safe_atou32(slash + 1, &fwmask);
|
r = safe_atou32(slash + 1, &fwmask);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
} else
|
} else if (fwmark > 0)
|
||||||
fwmask = UINT32_MAX;
|
fwmask = UINT32_MAX;
|
||||||
}
|
|
||||||
|
|
||||||
*ret_fwmark = fwmark;
|
*ret_fwmark = fwmark;
|
||||||
*ret_fwmask = fwmask;
|
*ret_fwmask = fwmask;
|
||||||
|
|
|
@ -48,6 +48,7 @@ int sd_ipv4acd_set_ifindex(sd_ipv4acd *acd, int interface_index);
|
||||||
int sd_ipv4acd_get_ifindex(sd_ipv4acd *acd);
|
int sd_ipv4acd_get_ifindex(sd_ipv4acd *acd);
|
||||||
int sd_ipv4acd_set_ifname(sd_ipv4acd *acd, const char *interface_name);
|
int sd_ipv4acd_set_ifname(sd_ipv4acd *acd, const char *interface_name);
|
||||||
int sd_ipv4acd_get_ifname(sd_ipv4acd *acd, const char **ret);
|
int sd_ipv4acd_get_ifname(sd_ipv4acd *acd, const char **ret);
|
||||||
|
int sd_ipv4acd_set_timeout(sd_ipv4acd *acd, uint64_t timeout_usec);
|
||||||
int sd_ipv4acd_set_address(sd_ipv4acd *acd, const struct in_addr *address);
|
int sd_ipv4acd_set_address(sd_ipv4acd *acd, const struct in_addr *address);
|
||||||
int sd_ipv4acd_is_running(sd_ipv4acd *acd);
|
int sd_ipv4acd_is_running(sd_ipv4acd *acd);
|
||||||
int sd_ipv4acd_is_bound(sd_ipv4acd *acd);
|
int sd_ipv4acd_is_bound(sd_ipv4acd *acd);
|
||||||
|
|
|
@ -44,6 +44,7 @@ int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address);
|
||||||
int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdata);
|
int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdata);
|
||||||
int sd_ipv4ll_set_check_mac_callback(sd_ipv4ll *ll, sd_ipv4ll_check_mac_callback_t cb, void *userdata);
|
int sd_ipv4ll_set_check_mac_callback(sd_ipv4ll *ll, sd_ipv4ll_check_mac_callback_t cb, void *userdata);
|
||||||
int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr);
|
int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr);
|
||||||
|
int sd_ipv4ll_set_timeout(sd_ipv4ll *ll, uint64_t timeout_usec);
|
||||||
int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int interface_index);
|
int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int interface_index);
|
||||||
int sd_ipv4ll_get_ifindex(sd_ipv4ll *ll);
|
int sd_ipv4ll_get_ifindex(sd_ipv4ll *ll);
|
||||||
int sd_ipv4ll_set_ifname(sd_ipv4ll *ll, const char *interface_name);
|
int sd_ipv4ll_set_ifname(sd_ipv4ll *ll, const char *interface_name);
|
||||||
|
|
|
@ -38,14 +38,14 @@ directory (`OutputDirectory=`) to point to the other directory using `mkosi/mkos
|
||||||
After the image has been built, the integration tests can be run with:
|
After the image has been built, the integration tests can be run with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ env SYSTEMD_INTEGRATION_TESTS=1 mkosi -f sandbox -- meson test -C build --suite integration-tests --num-processes "$(($(nproc) / 4))"
|
$ mkosi -f sandbox -- meson test -C build --setup=integration --suite integration-tests --num-processes "$(($(nproc) / 4))"
|
||||||
```
|
```
|
||||||
|
|
||||||
As usual, specific tests can be run in meson by appending the name of the test
|
As usual, specific tests can be run in meson by appending the name of the test
|
||||||
which is usually the name of the directory e.g.
|
which is usually the name of the directory e.g.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ env SYSTEMD_INTEGRATION_TESTS=1 mkosi -f sandbox -- meson test -C build -v TEST-01-BASIC
|
$ mkosi -f sandbox -- meson test -C build --setup=integration -v TEST-01-BASIC
|
||||||
```
|
```
|
||||||
|
|
||||||
See `mkosi -f sandbox -- meson introspect build --tests` for a list of tests.
|
See `mkosi -f sandbox -- meson introspect build --tests` for a list of tests.
|
||||||
|
@ -55,7 +55,7 @@ To interactively debug a failing integration test, the `--interactive` option
|
||||||
newer:
|
newer:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ env SYSTEMD_INTEGRATION_TESTS=1 mkosi -f sandbox -- meson test -C build -i TEST-01-BASIC
|
$ mkosi -f sandbox -- meson test -C build --setup=integration -i TEST-01-BASIC
|
||||||
```
|
```
|
||||||
|
|
||||||
Due to limitations in meson, the integration tests do not yet depend on the
|
Due to limitations in meson, the integration tests do not yet depend on the
|
||||||
|
@ -64,7 +64,7 @@ running the integration tests. To rebuild the image and rerun a test, the
|
||||||
following command can be used:
|
following command can be used:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ mkosi -f sandbox -- meson compile -C build mkosi && env SYSTEMD_INTEGRATION_TESTS=1 mkosi -f sandbox -- meson test -C build -v TEST-01-BASIC
|
$ mkosi -f sandbox -- meson compile -C build mkosi && mkosi -f sandbox -- meson test -C build --setup=integration -v TEST-01-BASIC
|
||||||
```
|
```
|
||||||
|
|
||||||
The integration tests use the same mkosi configuration that's used when you run
|
The integration tests use the same mkosi configuration that's used when you run
|
||||||
|
@ -78,7 +78,7 @@ To iterate on an integration test, let's first get a shell in the integration te
|
||||||
the following:
|
the following:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ mkosi -f sandbox -- meson compile -C build mkosi && env SYSTEMD_INTEGRATION_TESTS=1 TEST_SHELL=1 mkosi -f sandbox -- meson test -C build -i TEST-01-BASIC
|
$ mkosi -f sandbox -- meson compile -C build mkosi && mkosi -f sandbox -- meson test -C build --setup=shell -i TEST-01-BASIC
|
||||||
```
|
```
|
||||||
|
|
||||||
This will get us a shell in the integration test environment after booting the machine without running the
|
This will get us a shell in the integration test environment after booting the machine without running the
|
||||||
|
@ -107,7 +107,7 @@ re-running the test will first install the new packages we just built, make a ne
|
||||||
the test again. You can keep running the loop of `mkosi -R`, `systemctl soft-reboot` and
|
the test again. You can keep running the loop of `mkosi -R`, `systemctl soft-reboot` and
|
||||||
`systemctl start ...` until the changes to the integration test are working.
|
`systemctl start ...` until the changes to the integration test are working.
|
||||||
|
|
||||||
If you're debugging a failing integration test (running `meson test --interactive` without `TEST_SHELL`),
|
If you're debugging a failing integration test (running `meson test --interactive`),
|
||||||
there's no need to run `systemctl start ...`, running `systemctl soft-reboot` on its own is sufficient to
|
there's no need to run `systemctl start ...`, running `systemctl soft-reboot` on its own is sufficient to
|
||||||
rerun the test.
|
rerun the test.
|
||||||
|
|
||||||
|
@ -120,10 +120,6 @@ rerun the test.
|
||||||
`TEST_NO_KVM=1`: Disable qemu KVM auto-detection (may be necessary when you're
|
`TEST_NO_KVM=1`: Disable qemu KVM auto-detection (may be necessary when you're
|
||||||
trying to run the *vanilla* qemu and have both qemu and qemu-kvm installed)
|
trying to run the *vanilla* qemu and have both qemu and qemu-kvm installed)
|
||||||
|
|
||||||
`TEST_SHELL=1`: Configure the machine to be more *user-friendly* for
|
|
||||||
interactive debugging (e.g. by setting a usable default terminal, suppressing
|
|
||||||
the shutdown after the test, etc.).
|
|
||||||
|
|
||||||
`TEST_MATCH_SUBTEST=subtest`: If the test makes use of `run_subtests` use this
|
`TEST_MATCH_SUBTEST=subtest`: If the test makes use of `run_subtests` use this
|
||||||
variable to provide a POSIX extended regex to run only subtests matching the
|
variable to provide a POSIX extended regex to run only subtests matching the
|
||||||
expression.
|
expression.
|
||||||
|
|
|
@ -361,7 +361,7 @@ def statfs(path: Path) -> str:
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument('--mkosi', required=True)
|
parser.add_argument('--mkosi', default=None)
|
||||||
parser.add_argument('--meson-source-dir', required=True, type=Path)
|
parser.add_argument('--meson-source-dir', required=True, type=Path)
|
||||||
parser.add_argument('--meson-build-dir', required=True, type=Path)
|
parser.add_argument('--meson-build-dir', required=True, type=Path)
|
||||||
parser.add_argument('--name', required=True)
|
parser.add_argument('--name', required=True)
|
||||||
|
@ -379,6 +379,12 @@ def main() -> None:
|
||||||
parser.add_argument('mkosi_args', nargs='*')
|
parser.add_argument('mkosi_args', nargs='*')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.mkosi:
|
||||||
|
args.mkosi = shutil.which('mkosi')
|
||||||
|
if not args.mkosi:
|
||||||
|
print('Could not find mkosi which is required to run the integration tests', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# The meson source directory can either be the top-level repository directory or the
|
# The meson source directory can either be the top-level repository directory or the
|
||||||
# test/integration-tests/standalone subdirectory in the repository directory. The mkosi configuration
|
# test/integration-tests/standalone subdirectory in the repository directory. The mkosi configuration
|
||||||
# will always be a parent directory of one of these directories and at most 4 levels upwards, so don't
|
# will always be a parent directory of one of these directories and at most 4 levels upwards, so don't
|
||||||
|
@ -395,13 +401,6 @@ def main() -> None:
|
||||||
)
|
)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if not bool(int(os.getenv('SYSTEMD_INTEGRATION_TESTS', '0'))):
|
|
||||||
print(
|
|
||||||
f'SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping {args.name}',
|
|
||||||
file=sys.stderr,
|
|
||||||
)
|
|
||||||
exit(77)
|
|
||||||
|
|
||||||
if args.slow and not bool(int(os.getenv('SYSTEMD_SLOW_TESTS', '0'))):
|
if args.slow and not bool(int(os.getenv('SYSTEMD_SLOW_TESTS', '0'))):
|
||||||
print(
|
print(
|
||||||
f'SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.name}',
|
f'SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.name}',
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
|
# We'd give these more descriptive names but only alphanumeric characters are allowed.
|
||||||
|
add_test_setup('integration')
|
||||||
|
add_test_setup('shell', env : {'TEST_SHELL' : '1'})
|
||||||
|
|
||||||
integration_test_wrapper = find_program('integration-test-wrapper.py')
|
integration_test_wrapper = find_program('integration-test-wrapper.py')
|
||||||
integration_tests = []
|
integration_tests = []
|
||||||
integration_test_template = {
|
integration_test_template = {
|
||||||
|
@ -129,11 +133,11 @@ foreach integration_test : integration_tests
|
||||||
integration_test_args += ['--skip']
|
integration_test_args += ['--skip']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if not mkosi.found()
|
if mkosi.found()
|
||||||
continue
|
integration_test_args += ['--mkosi', mkosi.full_path()]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
integration_test_args += ['--mkosi', mkosi.full_path(), '--']
|
integration_test_args += ['--']
|
||||||
|
|
||||||
if integration_test['cmdline'].length() > 0
|
if integration_test['cmdline'].length() > 0
|
||||||
integration_test_args += [
|
integration_test_args += [
|
||||||
|
@ -151,19 +155,12 @@ foreach integration_test : integration_tests
|
||||||
|
|
||||||
integration_test_args += integration_test['mkosi-args']
|
integration_test_args += integration_test['mkosi-args']
|
||||||
|
|
||||||
integration_test_env = {}
|
|
||||||
|
|
||||||
if want_integration_tests
|
|
||||||
integration_test_env += {'SYSTEMD_INTEGRATION_TESTS': '1'}
|
|
||||||
endif
|
|
||||||
|
|
||||||
# We don't explicitly depend on the "mkosi" target because that means the image is rebuilt on every
|
# We don't explicitly depend on the "mkosi" target because that means the image is rebuilt on every
|
||||||
# "ninja -C build". Instead, the mkosi target has to be rebuilt manually before running the
|
# "ninja -C build". Instead, the mkosi target has to be rebuilt manually before running the
|
||||||
# integration tests with mkosi.
|
# integration tests with mkosi.
|
||||||
test(
|
test(
|
||||||
integration_test['name'],
|
integration_test['name'],
|
||||||
integration_test_wrapper,
|
integration_test_wrapper,
|
||||||
env : integration_test_env,
|
|
||||||
args : integration_test_args,
|
args : integration_test_args,
|
||||||
timeout : integration_test['timeout'],
|
timeout : integration_test['timeout'],
|
||||||
priority : integration_test['priority'],
|
priority : integration_test['priority'],
|
||||||
|
|
|
@ -16,7 +16,6 @@ project('systemd-testsuite',
|
||||||
|
|
||||||
fs = import('fs')
|
fs = import('fs')
|
||||||
mkosi = find_program('mkosi', required : true)
|
mkosi = find_program('mkosi', required : true)
|
||||||
want_integration_tests = true
|
|
||||||
|
|
||||||
# meson refuses .. in subdir() so we use a symlink to trick it into accepting it anyway.
|
# meson refuses .. in subdir() so we use a symlink to trick it into accepting it anyway.
|
||||||
subdir('integration-tests')
|
subdir('integration-tests')
|
||||||
|
|
|
@ -48,6 +48,24 @@ From=10.1.0.0/16
|
||||||
Priority=104
|
Priority=104
|
||||||
Table=12
|
Table=12
|
||||||
|
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
IncomingInterface=test1
|
||||||
|
FirewallMark=0/1
|
||||||
|
Priority=200
|
||||||
|
Table=20
|
||||||
|
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
IncomingInterface=test1
|
||||||
|
FirewallMark=7/255
|
||||||
|
Priority=201
|
||||||
|
Table=21
|
||||||
|
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
IncomingInterface=test1
|
||||||
|
FirewallMark=9999
|
||||||
|
Priority=202
|
||||||
|
Table=22
|
||||||
|
|
||||||
# The four routing policy rules below intentionally have the same config
|
# The four routing policy rules below intentionally have the same config
|
||||||
# excepts for their To= addresses. See issue #35874.
|
# excepts for their To= addresses. See issue #35874.
|
||||||
[RoutingPolicyRule]
|
[RoutingPolicyRule]
|
||||||
|
|
|
@ -3890,6 +3890,18 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
print(output)
|
print(output)
|
||||||
self.assertIn('104: from 10.1.0.0/16 iif test1 lookup 12 nop', output)
|
self.assertIn('104: from 10.1.0.0/16 iif test1 lookup 12 nop', output)
|
||||||
|
|
||||||
|
output = check_output('ip rule list iif test1 priority 200')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('200: from all fwmark 0/0x1 iif test1 lookup 20', output)
|
||||||
|
|
||||||
|
output = check_output('ip rule list iif test1 priority 201')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('201: from all fwmark 0x7/0xff iif test1 lookup 21', output)
|
||||||
|
|
||||||
|
output = check_output('ip rule list iif test1 priority 202')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('202: from all fwmark 0x270f iif test1 lookup 22', output)
|
||||||
|
|
||||||
output = check_output('ip rule list to 192.0.2.0/26')
|
output = check_output('ip rule list to 192.0.2.0/26')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertIn('to 192.0.2.0/26 lookup 1001', output)
|
self.assertIn('to 192.0.2.0/26 lookup 1001', output)
|
||||||
|
|
Loading…
Reference in New Issue