diff options
Diffstat (limited to 'test')
167 files changed, 1506 insertions, 55 deletions
diff --git a/test/fuzz-regressions/.gitattributes b/test/fuzz-regressions/.gitattributes deleted file mode 100644 index 7b1b3e1835..0000000000 --- a/test/fuzz-regressions/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/*/* -whitespace diff --git a/test/fuzz-regressions/meson.build b/test/fuzz-regressions/meson.build deleted file mode 100644 index 80b062d7c6..0000000000 --- a/test/fuzz-regressions/meson.build +++ /dev/null @@ -1,39 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ - -sanitize_address = custom_target( - 'sanitize-address-fuzzers', - output : 'sanitize-address-fuzzers', - command : [meson_build_sh, - meson.source_root(), - '@OUTPUT@', - 'fuzzers', - '-Db_lundef=false -Db_sanitize=address']) - -sanitizers = [['address', sanitize_address]] - -fuzz_regression_tests = ''' - fuzz-dns-packet/issue-7888 - fuzz-dns-packet/oss-fuzz-5465 - fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 - fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 - fuzz-journal-remote/oss-fuzz-8659 - fuzz-journal-remote/oss-fuzz-8686 - fuzz-journald-syslog/github-9795 - fuzz-journald-syslog/github-9820 - fuzz-journald-syslog/github-9827 - fuzz-journald-syslog/github-9829 - fuzz-unit-file/oss-fuzz-6884 - fuzz-unit-file/oss-fuzz-6885 - fuzz-unit-file/oss-fuzz-6886 - fuzz-unit-file/oss-fuzz-6892 - fuzz-unit-file/oss-fuzz-6897 - fuzz-unit-file/oss-fuzz-6897-evverx - fuzz-unit-file/oss-fuzz-6908 - fuzz-unit-file/oss-fuzz-6917 - fuzz-unit-file/oss-fuzz-6977 - fuzz-unit-file/oss-fuzz-6977-unminimized - fuzz-unit-file/oss-fuzz-7004 - fuzz-unit-file/oss-fuzz-8064 - fuzz-unit-file/oss-fuzz-8827 - fuzz-unit-file/oss-fuzz-10007 -'''.split() diff --git a/test/fuzz-corpus/.gitattributes b/test/fuzz/.gitattributes index 7b1b3e1835..7b1b3e1835 100644 --- a/test/fuzz-corpus/.gitattributes +++ b/test/fuzz/.gitattributes diff --git a/test/fuzz/fuzz-bus-message/crash-26bba7182dedc8848939931d9fcefcb7922f2e56 b/test/fuzz/fuzz-bus-message/crash-26bba7182dedc8848939931d9fcefcb7922f2e56 Binary files differnew file mode 100644 index 0000000000..f1bf3229ef --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-26bba7182dedc8848939931d9fcefcb7922f2e56 diff --git a/test/fuzz/fuzz-bus-message/crash-29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e b/test/fuzz/fuzz-bus-message/crash-29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e Binary files differnew file mode 100644 index 0000000000..4488f0a6c6 --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e diff --git a/test/fuzz/fuzz-bus-message/crash-32bf69483cbd4f2e6d46c25a2f92a472109aee45 b/test/fuzz/fuzz-bus-message/crash-32bf69483cbd4f2e6d46c25a2f92a472109aee45 Binary files differnew file mode 100644 index 0000000000..aa0c6ff7f7 --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-32bf69483cbd4f2e6d46c25a2f92a472109aee45 diff --git a/test/fuzz/fuzz-bus-message/crash-37449529b1ad867f0c2671fa80aca5d7812a2b70 b/test/fuzz/fuzz-bus-message/crash-37449529b1ad867f0c2671fa80aca5d7812a2b70 Binary files differnew file mode 100644 index 0000000000..6a20265a39 --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-37449529b1ad867f0c2671fa80aca5d7812a2b70 diff --git a/test/fuzz/fuzz-bus-message/crash-4162a61a79e4c5a832ca5232212f75fa560a1f75 b/test/fuzz/fuzz-bus-message/crash-4162a61a79e4c5a832ca5232212f75fa560a1f75 Binary files differnew file mode 100644 index 0000000000..5faf3308e7 --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-4162a61a79e4c5a832ca5232212f75fa560a1f75 diff --git a/test/fuzz/fuzz-bus-message/crash-4f0211eb269e28db941961061494bfdbf3345e54 b/test/fuzz/fuzz-bus-message/crash-4f0211eb269e28db941961061494bfdbf3345e54 Binary files differnew file mode 100644 index 0000000000..865b29507c --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-4f0211eb269e28db941961061494bfdbf3345e54 diff --git a/test/fuzz/fuzz-bus-message/crash-603dfd98252375ac7dbced53c2ec312671939a36 b/test/fuzz/fuzz-bus-message/crash-603dfd98252375ac7dbced53c2ec312671939a36 Binary files differnew file mode 100644 index 0000000000..b3fee9e07a --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-603dfd98252375ac7dbced53c2ec312671939a36 diff --git a/test/fuzz/fuzz-bus-message/crash-b88ad9ecf4aacf4a0caca5b5543953265367f084 b/test/fuzz/fuzz-bus-message/crash-b88ad9ecf4aacf4a0caca5b5543953265367f084 Binary files differnew file mode 100644 index 0000000000..52469650b5 --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-b88ad9ecf4aacf4a0caca5b5543953265367f084 diff --git a/test/fuzz/fuzz-bus-message/crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e b/test/fuzz/fuzz-bus-message/crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e Binary files differnew file mode 100644 index 0000000000..2ae1a8715a --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e diff --git a/test/fuzz/fuzz-bus-message/crash-d8f3941c74219b4c03532c9b244d5ea539c61af5 b/test/fuzz/fuzz-bus-message/crash-d8f3941c74219b4c03532c9b244d5ea539c61af5 Binary files differnew file mode 100644 index 0000000000..26262e1149 --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-d8f3941c74219b4c03532c9b244d5ea539c61af5 diff --git a/test/fuzz/fuzz-bus-message/crash-e1b811da5ca494e494b77c6bd8e1c2f2989425c5 b/test/fuzz/fuzz-bus-message/crash-e1b811da5ca494e494b77c6bd8e1c2f2989425c5 Binary files differnew file mode 100644 index 0000000000..9d3fa0035f --- /dev/null +++ b/test/fuzz/fuzz-bus-message/crash-e1b811da5ca494e494b77c6bd8e1c2f2989425c5 diff --git a/test/fuzz/fuzz-bus-message/leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20 b/test/fuzz/fuzz-bus-message/leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20 Binary files differnew file mode 100644 index 0000000000..c371824ffb --- /dev/null +++ b/test/fuzz/fuzz-bus-message/leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20 diff --git a/test/fuzz/fuzz-bus-message/message1 b/test/fuzz/fuzz-bus-message/message1 Binary files differnew file mode 100644 index 0000000000..2df70fd7cb --- /dev/null +++ b/test/fuzz/fuzz-bus-message/message1 diff --git a/test/fuzz/fuzz-bus-message/timeout-08ee8f6446a4064db064e8e0b3d220147f7d0b5b b/test/fuzz/fuzz-bus-message/timeout-08ee8f6446a4064db064e8e0b3d220147f7d0b5b Binary files differnew file mode 100644 index 0000000000..c975f906ee --- /dev/null +++ b/test/fuzz/fuzz-bus-message/timeout-08ee8f6446a4064db064e8e0b3d220147f7d0b5b diff --git a/test/fuzz-corpus/dhcp-server/discover-existing b/test/fuzz/fuzz-dhcp-server/discover-existing Binary files differindex 1e26bf09e2..1e26bf09e2 100644 --- a/test/fuzz-corpus/dhcp-server/discover-existing +++ b/test/fuzz/fuzz-dhcp-server/discover-existing diff --git a/test/fuzz-corpus/dhcp-server/discover-new b/test/fuzz/fuzz-dhcp-server/discover-new Binary files differindex feeae55e5e..feeae55e5e 100644 --- a/test/fuzz-corpus/dhcp-server/discover-new +++ b/test/fuzz/fuzz-dhcp-server/discover-new diff --git a/test/fuzz-corpus/dhcp-server/release b/test/fuzz/fuzz-dhcp-server/release Binary files differindex 4f3eadb2f2..4f3eadb2f2 100644 --- a/test/fuzz-corpus/dhcp-server/release +++ b/test/fuzz/fuzz-dhcp-server/release diff --git a/test/fuzz-corpus/dhcp-server/request-existing b/test/fuzz/fuzz-dhcp-server/request-existing Binary files differindex 9f7a0d88f7..9f7a0d88f7 100644 --- a/test/fuzz-corpus/dhcp-server/request-existing +++ b/test/fuzz/fuzz-dhcp-server/request-existing diff --git a/test/fuzz-corpus/dhcp-server/request-new b/test/fuzz/fuzz-dhcp-server/request-new Binary files differindex fc6f5864a7..fc6f5864a7 100644 --- a/test/fuzz-corpus/dhcp-server/request-new +++ b/test/fuzz/fuzz-dhcp-server/request-new diff --git a/test/fuzz-corpus/dhcp-server/request-reboot b/test/fuzz/fuzz-dhcp-server/request-reboot Binary files differindex fde74b2b91..fde74b2b91 100644 --- a/test/fuzz-corpus/dhcp-server/request-reboot +++ b/test/fuzz/fuzz-dhcp-server/request-reboot diff --git a/test/fuzz-corpus/dhcp-server/request-renew b/test/fuzz/fuzz-dhcp-server/request-renew Binary files differindex 8dcda2ad88..8dcda2ad88 100644 --- a/test/fuzz-corpus/dhcp-server/request-renew +++ b/test/fuzz/fuzz-dhcp-server/request-renew diff --git a/test/fuzz/fuzz-dhcp6-client/crash-4003c06fce43a11fbd22f02584df2807ac333eae b/test/fuzz/fuzz-dhcp6-client/crash-4003c06fce43a11fbd22f02584df2807ac333eae Binary files differnew file mode 100644 index 0000000000..630ee6632c --- /dev/null +++ b/test/fuzz/fuzz-dhcp6-client/crash-4003c06fce43a11fbd22f02584df2807ac333eae diff --git a/test/fuzz/fuzz-dhcp6-client/crash-6e88fcb6b85c9436bcbe05219aa8e550194645ef b/test/fuzz/fuzz-dhcp6-client/crash-6e88fcb6b85c9436bcbe05219aa8e550194645ef Binary files differnew file mode 100644 index 0000000000..44883be9f0 --- /dev/null +++ b/test/fuzz/fuzz-dhcp6-client/crash-6e88fcb6b85c9436bcbe05219aa8e550194645ef diff --git a/test/fuzz/fuzz-dhcp6-client/oss-fuzz-10746 b/test/fuzz/fuzz-dhcp6-client/oss-fuzz-10746 Binary files differnew file mode 100644 index 0000000000..41c0da0db4 --- /dev/null +++ b/test/fuzz/fuzz-dhcp6-client/oss-fuzz-10746 diff --git a/test/fuzz-regressions/fuzz-dns-packet/issue-7888 b/test/fuzz/fuzz-dns-packet/issue-7888 Binary files differindex 19e7eedf51..19e7eedf51 100644 --- a/test/fuzz-regressions/fuzz-dns-packet/issue-7888 +++ b/test/fuzz/fuzz-dns-packet/issue-7888 diff --git a/test/fuzz-regressions/fuzz-dns-packet/oss-fuzz-5465 b/test/fuzz/fuzz-dns-packet/oss-fuzz-5465 Binary files differindex ccd8a4fd6b..ccd8a4fd6b 100644 --- a/test/fuzz-regressions/fuzz-dns-packet/oss-fuzz-5465 +++ b/test/fuzz/fuzz-dns-packet/oss-fuzz-5465 diff --git a/test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 b/test/fuzz/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 Binary files differindex e6a7316805..e6a7316805 100644 --- a/test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 +++ b/test/fuzz/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 diff --git a/test/fuzz-regressions/fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 b/test/fuzz/fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 Binary files differindex 535d49ea7a..535d49ea7a 100644 --- a/test/fuzz-regressions/fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 +++ b/test/fuzz/fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 diff --git a/test/fuzz-corpus/journal-remote/invalid-ts.txt b/test/fuzz/fuzz-journal-remote/invalid-ts.txt Binary files differindex bc036fdcb0..bc036fdcb0 100644 --- a/test/fuzz-corpus/journal-remote/invalid-ts.txt +++ b/test/fuzz/fuzz-journal-remote/invalid-ts.txt diff --git a/test/fuzz-regressions/fuzz-journal-remote/oss-fuzz-8659 b/test/fuzz/fuzz-journal-remote/oss-fuzz-8659 index acc6a0f5e1..acc6a0f5e1 100644 --- a/test/fuzz-regressions/fuzz-journal-remote/oss-fuzz-8659 +++ b/test/fuzz/fuzz-journal-remote/oss-fuzz-8659 diff --git a/test/fuzz-regressions/fuzz-journal-remote/oss-fuzz-8686 b/test/fuzz/fuzz-journal-remote/oss-fuzz-8686 index 7c73c8cd9b..7c73c8cd9b 100644 --- a/test/fuzz-regressions/fuzz-journal-remote/oss-fuzz-8686 +++ b/test/fuzz/fuzz-journal-remote/oss-fuzz-8686 diff --git a/test/fuzz-corpus/journal-remote/sample.txt b/test/fuzz/fuzz-journal-remote/sample.txt index 891c0003ef..891c0003ef 100644 --- a/test/fuzz-corpus/journal-remote/sample.txt +++ b/test/fuzz/fuzz-journal-remote/sample.txt diff --git a/test/fuzz-regressions/fuzz-journald-syslog/github-9795 b/test/fuzz/fuzz-journald-syslog/github-9795 index 0519ecba6e..0519ecba6e 100644 --- a/test/fuzz-regressions/fuzz-journald-syslog/github-9795 +++ b/test/fuzz/fuzz-journald-syslog/github-9795 diff --git a/test/fuzz-regressions/fuzz-journald-syslog/github-9820 b/test/fuzz/fuzz-journald-syslog/github-9820 index 55e1bb5967..55e1bb5967 100644 --- a/test/fuzz-regressions/fuzz-journald-syslog/github-9820 +++ b/test/fuzz/fuzz-journald-syslog/github-9820 diff --git a/test/fuzz-regressions/fuzz-journald-syslog/github-9827 b/test/fuzz/fuzz-journald-syslog/github-9827 index 6787e487a4..6787e487a4 100644 --- a/test/fuzz-regressions/fuzz-journald-syslog/github-9827 +++ b/test/fuzz/fuzz-journald-syslog/github-9827 diff --git a/test/fuzz-regressions/fuzz-journald-syslog/github-9829 b/test/fuzz/fuzz-journald-syslog/github-9829 index 22ded55aa2..22ded55aa2 100644 --- a/test/fuzz-regressions/fuzz-journald-syslog/github-9829 +++ b/test/fuzz/fuzz-journald-syslog/github-9829 diff --git a/test/fuzz/fuzz-ndisc-rs/timeout-2815b773c712fa33bea62f541dfa3017c64ea2f1 b/test/fuzz/fuzz-ndisc-rs/timeout-2815b773c712fa33bea62f541dfa3017c64ea2f1 Binary files differnew file mode 100644 index 0000000000..410cf38c1e --- /dev/null +++ b/test/fuzz/fuzz-ndisc-rs/timeout-2815b773c712fa33bea62f541dfa3017c64ea2f1 diff --git a/test/fuzz/fuzz-ndisc-rs/timeout-61fff7fd1e5dcc07e1b656baab29065ce634ad5b b/test/fuzz/fuzz-ndisc-rs/timeout-61fff7fd1e5dcc07e1b656baab29065ce634ad5b Binary files differnew file mode 100644 index 0000000000..04e871fbcb --- /dev/null +++ b/test/fuzz/fuzz-ndisc-rs/timeout-61fff7fd1e5dcc07e1b656baab29065ce634ad5b diff --git a/test/fuzz-corpus/unit-file/dev-mapper-fedora_krowka\x2dswap.swap b/test/fuzz/fuzz-unit-file/dev-mapper-fedora_krowka\x2dswap.swap index 2886021b1a..2886021b1a 100644 --- a/test/fuzz-corpus/unit-file/dev-mapper-fedora_krowka\x2dswap.swap +++ b/test/fuzz/fuzz-unit-file/dev-mapper-fedora_krowka\x2dswap.swap diff --git a/test/fuzz-corpus/unit-file/directives.service b/test/fuzz/fuzz-unit-file/directives.service index c2334d3b19..b9c1b467b0 100644 --- a/test/fuzz-corpus/unit-file/directives.service +++ b/test/fuzz/fuzz-unit-file/directives.service @@ -769,6 +769,7 @@ KeyringMode= KillExcludeUsers= KillOnlyUsers= KillSignal= +WatchdogSignal= KillUserProcesses= LOCATION= LidSwitchIgnoreInhibited= diff --git a/test/fuzz-corpus/unit-file/empty.scope b/test/fuzz/fuzz-unit-file/empty.scope index 8df7245f62..8df7245f62 100644 --- a/test/fuzz-corpus/unit-file/empty.scope +++ b/test/fuzz/fuzz-unit-file/empty.scope diff --git a/test/fuzz-corpus/unit-file/machine.slice b/test/fuzz/fuzz-unit-file/machine.slice index bf8c6bfc3e..bf8c6bfc3e 100644 --- a/test/fuzz-corpus/unit-file/machine.slice +++ b/test/fuzz/fuzz-unit-file/machine.slice diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-10007 b/test/fuzz/fuzz-unit-file/oss-fuzz-10007 index 893630c83f..893630c83f 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-10007 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-10007 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6884 b/test/fuzz/fuzz-unit-file/oss-fuzz-6884 index 00d105ade5..00d105ade5 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6884 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6884 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6885 b/test/fuzz/fuzz-unit-file/oss-fuzz-6885 index 1859136fdc..1859136fdc 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6885 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6885 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6886 b/test/fuzz/fuzz-unit-file/oss-fuzz-6886 index 1fbe5ffd99..1fbe5ffd99 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6886 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6886 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6892 b/test/fuzz/fuzz-unit-file/oss-fuzz-6892 index 31f746d034..31f746d034 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6892 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6892 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6897 b/test/fuzz/fuzz-unit-file/oss-fuzz-6897 index 742fd9bfeb..742fd9bfeb 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6897 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6897 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6897-evverx b/test/fuzz/fuzz-unit-file/oss-fuzz-6897-evverx index 126678e76c..126678e76c 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6897-evverx +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6897-evverx diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6908 b/test/fuzz/fuzz-unit-file/oss-fuzz-6908 index 8f2404b136..8f2404b136 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6908 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6908 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6917 b/test/fuzz/fuzz-unit-file/oss-fuzz-6917 index 9a79cf00b7..9a79cf00b7 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6917 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6917 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977 b/test/fuzz/fuzz-unit-file/oss-fuzz-6977 index 3d844e6f08..3d844e6f08 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6977 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977-unminimized b/test/fuzz/fuzz-unit-file/oss-fuzz-6977-unminimized index 718f94f0d7..718f94f0d7 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977-unminimized +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-6977-unminimized diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-7004 b/test/fuzz/fuzz-unit-file/oss-fuzz-7004 index 77a5e5e8d6..77a5e5e8d6 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-7004 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-7004 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-8064 b/test/fuzz/fuzz-unit-file/oss-fuzz-8064 index 2c6c1eaee7..2c6c1eaee7 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-8064 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-8064 diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-8827 b/test/fuzz/fuzz-unit-file/oss-fuzz-8827 index c71b75e134..c71b75e134 100644 --- a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-8827 +++ b/test/fuzz/fuzz-unit-file/oss-fuzz-8827 diff --git a/test/fuzz-corpus/unit-file/proc-sys-fs-binfmt_misc.automount b/test/fuzz/fuzz-unit-file/proc-sys-fs-binfmt_misc.automount index 777a123ef4..777a123ef4 100644 --- a/test/fuzz-corpus/unit-file/proc-sys-fs-binfmt_misc.automount +++ b/test/fuzz/fuzz-unit-file/proc-sys-fs-binfmt_misc.automount diff --git a/test/fuzz-corpus/unit-file/syslog.socket b/test/fuzz/fuzz-unit-file/syslog.socket index 2eb316fcaa..2eb316fcaa 100644 --- a/test/fuzz-corpus/unit-file/syslog.socket +++ b/test/fuzz/fuzz-unit-file/syslog.socket diff --git a/test/fuzz-corpus/unit-file/systemd-ask-password-console.path b/test/fuzz/fuzz-unit-file/systemd-ask-password-console.path index 3e12c752de..3e12c752de 100644 --- a/test/fuzz-corpus/unit-file/systemd-ask-password-console.path +++ b/test/fuzz/fuzz-unit-file/systemd-ask-password-console.path diff --git a/test/fuzz-corpus/unit-file/systemd-machined.service b/test/fuzz/fuzz-unit-file/systemd-machined.service index 448f062ecf..448f062ecf 100644 --- a/test/fuzz-corpus/unit-file/systemd-machined.service +++ b/test/fuzz/fuzz-unit-file/systemd-machined.service diff --git a/test/fuzz-corpus/unit-file/systemd-resolved.service b/test/fuzz/fuzz-unit-file/systemd-resolved.service index 0854c5f841..0854c5f841 100644 --- a/test/fuzz-corpus/unit-file/systemd-resolved.service +++ b/test/fuzz/fuzz-unit-file/systemd-resolved.service diff --git a/test/fuzz-corpus/unit-file/systemd-tmpfiles-clean.timer b/test/fuzz/fuzz-unit-file/systemd-tmpfiles-clean.timer index 7db361cd69..7db361cd69 100644 --- a/test/fuzz-corpus/unit-file/systemd-tmpfiles-clean.timer +++ b/test/fuzz/fuzz-unit-file/systemd-tmpfiles-clean.timer diff --git a/test/fuzz-corpus/unit-file/timers.target b/test/fuzz/fuzz-unit-file/timers.target index 171226c680..171226c680 100644 --- a/test/fuzz-corpus/unit-file/timers.target +++ b/test/fuzz/fuzz-unit-file/timers.target diff --git a/test/fuzz-corpus/unit-file/var-lib-machines.mount b/test/fuzz/fuzz-unit-file/var-lib-machines.mount index 9c257d1191..9c257d1191 100644 --- a/test/fuzz-corpus/unit-file/var-lib-machines.mount +++ b/test/fuzz/fuzz-unit-file/var-lib-machines.mount diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build new file mode 100644 index 0000000000..56d0f69660 --- /dev/null +++ b/test/fuzz/meson.build @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: LGPL-2.1+ + +sanitize_address = custom_target( + 'sanitize-address-fuzzers', + output : 'sanitize-address-fuzzers', + command : [meson_build_sh, + meson.source_root(), + '@OUTPUT@', + 'fuzzers', + '-Db_lundef=false -Db_sanitize=address']) + +sanitizers = [['address', sanitize_address]] + +if git.found() + out = run_command( + git, + '--git-dir=@0@/.git'.format(meson.source_root()), + 'ls-files', ':/test/fuzz/*/*') +else + out = run_command( + 'sh', '-c', 'ls @0@/*/*'.format(meson.current_source_dir())) +endif + +fuzz_regression_tests = [] +foreach p : out.stdout().split() + # Remove the last entry which is ''. + # + # Also, backslashes get mangled, so skip test. See + # https://github.com/mesonbuild/meson/issues/1564. + if not p.contains('\\') + fuzz_regression_tests += p + endif +endforeach diff --git a/test/meson.build b/test/meson.build index 9750ff22b9..7e8f2cfa90 100644 --- a/test/meson.build +++ b/test/meson.build @@ -134,6 +134,7 @@ test_data_files = ''' test-execute/exec-systemcallfilter-system-user-nfsnobody.service test-execute/exec-systemcallfilter-system-user-nobody.service test-execute/exec-systemcallfilter-system-user.service + test-execute/exec-systemcallfilter-with-errno-multi.service test-execute/exec-systemcallfilter-with-errno-name.service test-execute/exec-systemcallfilter-with-errno-number.service test-execute/exec-temporaryfilesystem-options.service @@ -256,4 +257,4 @@ if conf.get('ENABLE_HWDB') == 1 endif endif -subdir('fuzz-regressions') +subdir('fuzz') diff --git a/test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service b/test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service index de1a6e7303..bd7881d286 100644 --- a/test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service +++ b/test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service @@ -2,7 +2,8 @@ Description=Test DynamicUser with User= and SupplementaryGroups= [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1" && test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' +ExecStart=/bin/sh -x -c 'HAVE=0; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' Type=oneshot User=1 DynamicUser=yes diff --git a/test/test-execute/exec-dynamicuser-fixeduser.service b/test/test-execute/exec-dynamicuser-fixeduser.service index 1d84af02ed..f28078f242 100644 --- a/test/test-execute/exec-dynamicuser-fixeduser.service +++ b/test/test-execute/exec-dynamicuser-fixeduser.service @@ -2,7 +2,8 @@ Description=Test DynamicUser with User= [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1" && test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' +ExecStart=/bin/sh -x -c 'HAVE=0; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' Type=oneshot User=1 DynamicUser=yes diff --git a/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service b/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service index 72e6d7686f..5efc5483b8 100644 --- a/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service +++ b/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service @@ -10,6 +10,7 @@ ExecStart=test -d /var/lib/test-dynamicuser-migrate ExecStart=test -d /var/lib/test-dynamicuser-migrate2/hoge ExecStart=touch /var/lib/test-dynamicuser-migrate/yay ExecStart=touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay +ExecStart=/bin/sh -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"' Type=oneshot DynamicUser=no diff --git a/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service b/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service index edb0be7ef8..c72302ffd5 100644 --- a/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service +++ b/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service @@ -18,6 +18,7 @@ ExecStart=touch /var/lib/test-dynamicuser-migrate/yay ExecStart=touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay ExecStart=touch /var/lib/private/test-dynamicuser-migrate/yay ExecStart=touch /var/lib/private/test-dynamicuser-migrate2/hoge/yayyay +ExecStart=/bin/sh -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"' Type=oneshot DynamicUser=yes diff --git a/test/test-execute/exec-dynamicuser-statedir.service b/test/test-execute/exec-dynamicuser-statedir.service index f459f3c1eb..2fb7b8660b 100644 --- a/test/test-execute/exec-dynamicuser-statedir.service +++ b/test/test-execute/exec-dynamicuser-statedir.service @@ -10,6 +10,7 @@ ExecStart=test -f /var/lib/waldo/yay ExecStart=test -f /var/lib/quux/pief/yayyay ExecStart=test -f /var/lib/private/waldo/yay ExecStart=test -f /var/lib/private/quux/pief/yayyay +ExecStart=/bin/sh -x -c 'test "$$STATE_DIRECTORY" = "%S/waldo:%S/quux/pief"' # Make sure that /var/lib/private/waldo is really the only writable directory besides the obvious candidates ExecStart=sh -x -c 'test $$(find / \( -path /var/tmp -o -path /tmp -o -path /proc -o -path /dev/mqueue -o -path /dev/shm -o -path /sys/fs/bpf \) -prune -o -type d -writable -print 2>/dev/null | sort -u | tr -d '\\\\n') = /var/lib/private/quux/pief/var/lib/private/waldo' diff --git a/test/test-execute/exec-dynamicuser-supplementarygroups.service b/test/test-execute/exec-dynamicuser-supplementarygroups.service index a47b7fab78..9ee6154f95 100644 --- a/test/test-execute/exec-dynamicuser-supplementarygroups.service +++ b/test/test-execute/exec-dynamicuser-supplementarygroups.service @@ -2,7 +2,9 @@ Description=Test DynamicUser with SupplementaryGroups= [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G | cut -d " " --complement -f 1)" = "1 2 3"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "2" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "3" && HAVE=1; done; test "$$HAVE" -eq 1' Type=oneshot DynamicUser=yes SupplementaryGroups=1 2 3 diff --git a/test/test-execute/exec-runtimedirectory-mode.service b/test/test-execute/exec-runtimedirectory-mode.service index 480f904155..85ae5161c4 100644 --- a/test/test-execute/exec-runtimedirectory-mode.service +++ b/test/test-execute/exec-runtimedirectory-mode.service @@ -3,6 +3,7 @@ Description=Test for RuntimeDirectoryMode [Service] ExecStart=/bin/sh -x -c 'mode=$$(stat -c %%a %t/test-exec_runtimedirectory-mode); test "$$mode" = "750"' +ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectory-mode"' Type=oneshot RuntimeDirectory=test-exec_runtimedirectory-mode RuntimeDirectoryMode=0750 diff --git a/test/test-execute/exec-runtimedirectory.service b/test/test-execute/exec-runtimedirectory.service index 6a4383110f..a33044d23c 100644 --- a/test/test-execute/exec-runtimedirectory.service +++ b/test/test-execute/exec-runtimedirectory.service @@ -4,6 +4,7 @@ Description=Test for RuntimeDirectory [Service] ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectory' ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectory2/hogehoge' +ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectory:%t/test-exec_runtimedirectory2/hogehoge"' Type=oneshot RuntimeDirectory=test-exec_runtimedirectory RuntimeDirectory=./test-exec_runtimedirectory2///./hogehoge/. diff --git a/test/test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service b/test/test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service index a49c9d26a1..1c565b4122 100644 --- a/test/test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service +++ b/test/test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service @@ -2,6 +2,10 @@ Description=Test for Supplementary Group with multiple groups without Group and User [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "0 1 2 3" && test "$$(id -g)" = "0" && test "$$(id -u)" = "0"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "0" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "2" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "3" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'test "$$(id -g)" = "0" && test "$$(id -u)" = "0"' Type=oneshot SupplementaryGroups=1 2 3 diff --git a/test/test-execute/exec-supplementarygroups-multiple-groups-withgid.service b/test/test-execute/exec-supplementarygroups-multiple-groups-withgid.service index 5c62c1d639..45bcf79222 100644 --- a/test/test-execute/exec-supplementarygroups-multiple-groups-withgid.service +++ b/test/test-execute/exec-supplementarygroups-multiple-groups-withgid.service @@ -2,7 +2,10 @@ Description=Test for Supplementary Group with multiple groups and Group=1 [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1 2 3" && test "$$(id -g)" = "1" && test "$$(id -u)" = "0"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "2" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "3" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "0"' Type=oneshot Group=1 SupplementaryGroups=1 2 3 diff --git a/test/test-execute/exec-supplementarygroups-multiple-groups-withuid.service b/test/test-execute/exec-supplementarygroups-multiple-groups-withuid.service index 00523e383b..62e56a2c23 100644 --- a/test/test-execute/exec-supplementarygroups-multiple-groups-withuid.service +++ b/test/test-execute/exec-supplementarygroups-multiple-groups-withuid.service @@ -2,7 +2,9 @@ Description=Test for Supplementary Group with multiple groups and Uid=1 [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1 2 3" && test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "2" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "3" && HAVE=1; done; test "$$HAVE" -eq 1' Type=oneshot User=1 SupplementaryGroups=1 2 3 diff --git a/test/test-execute/exec-supplementarygroups-single-group-user.service b/test/test-execute/exec-supplementarygroups-single-group-user.service index ed6276d303..97f9f9c786 100644 --- a/test/test-execute/exec-supplementarygroups-single-group-user.service +++ b/test/test-execute/exec-supplementarygroups-single-group-user.service @@ -2,7 +2,8 @@ Description=Test for Supplementary Group with only one group and uid 1 [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1" && test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"' Type=oneshot User=1 Group=1 diff --git a/test/test-execute/exec-supplementarygroups-single-group.service b/test/test-execute/exec-supplementarygroups-single-group.service index ee502b3d37..f9b721696b 100644 --- a/test/test-execute/exec-supplementarygroups-single-group.service +++ b/test/test-execute/exec-supplementarygroups-single-group.service @@ -2,7 +2,8 @@ Description=Test for Supplementary Group with only one group [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1" && test "$$(id -g)" = "1" && test "$$(id -u)" = "0"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "0"' Type=oneshot Group=1 SupplementaryGroups=1 diff --git a/test/test-execute/exec-supplementarygroups.service b/test/test-execute/exec-supplementarygroups.service index 43a9a981f2..4dee6af748 100644 --- a/test/test-execute/exec-supplementarygroups.service +++ b/test/test-execute/exec-supplementarygroups.service @@ -2,6 +2,7 @@ Description=Test for Supplementary Group [Service] -ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "0 1"' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "0" && HAVE=1; done; test "$$HAVE" -eq 1' +ExecStart=/bin/sh -x -c 'HAVE=; for g in $$(id -G); do test "$$g" = "1" && HAVE=1; done; test "$$HAVE" -eq 1' Type=oneshot SupplementaryGroups=1 diff --git a/test/test-execute/exec-systemcallfilter-with-errno-multi.service b/test/test-execute/exec-systemcallfilter-with-errno-multi.service new file mode 100644 index 0000000000..951e7ac36b --- /dev/null +++ b/test/test-execute/exec-systemcallfilter-with-errno-multi.service @@ -0,0 +1,9 @@ +[Unit] +Description=Test for SystemCallFilter updating errno +# test for issue #9939 which is fixed by a5404992cc7724ebf7572a0aa89d9fdb26ce0b62 (#9942) + +[Service] +ExecStart=/usr/bin/python3 -c 'import os\ntry: os.uname()\nexcept Exception as e: exit(e.errno)' +Type=oneshot +SystemCallFilter=~uname:ENOENT uname:EILSEQ +SystemCallErrorNumber=EACCES diff --git a/test/test-execute/exec-umask-0177.service b/test/test-execute/exec-umask-0177.service index a5e8fc4dbc..c18293e403 100644 --- a/test/test-execute/exec-umask-0177.service +++ b/test/test-execute/exec-umask-0177.service @@ -2,7 +2,7 @@ Description=Test for UMask [Service] -ExecStart=/bin/sh -x -c 'touch /tmp/test-exec-umask; mode=$$(stat -c %%a /tmp/test-exec-umask); test "$$mode" = "600"' +ExecStart=/bin/sh -x -c 'rm /tmp/test-exec-umask; touch /tmp/test-exec-umask; mode=$$(stat -c %%a /tmp/test-exec-umask); test "$$mode" = "600"' Type=oneshot UMask=0177 PrivateTmp=yes diff --git a/test/test-execute/exec-umask-default.service b/test/test-execute/exec-umask-default.service index 487f5e9b94..bf0573dd42 100644 --- a/test/test-execute/exec-umask-default.service +++ b/test/test-execute/exec-umask-default.service @@ -2,6 +2,6 @@ Description=Test for UMask default [Service] -ExecStart=/bin/sh -x -c 'touch /tmp/test-exec-umask; mode=$$(stat -c %%a /tmp/test-exec-umask); test "$$mode" = "644"' +ExecStart=/bin/sh -x -c 'rm /tmp/test-exec-umask; touch /tmp/test-exec-umask; mode=$$(stat -c %%a /tmp/test-exec-umask); test "$$mode" = "644"' Type=oneshot PrivateTmp=yes diff --git a/test/test-functions b/test/test-functions index a1d9e5c953..f1646b3bcf 100644 --- a/test/test-functions +++ b/test/test-functions @@ -505,9 +505,8 @@ install_execs() { export PKG_CONFIG_PATH=$BUILD_DIR/src/core/ systemdsystemunitdir=$(pkg-config --variable=systemdsystemunitdir systemd) systemduserunitdir=$(pkg-config --variable=systemduserunitdir systemd) - egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/{$systemdsystemunitdir,$systemduserunitdir}/*.service \ - | while read i; do - i=${i##Exec*=}; i=${i##[@+\!-]}; i=${i##\!} + sed -r -n 's|^Exec[a-zA-Z]*=[@+!-]*([^ ]+).*|\1|gp' $initdir/{$systemdsystemunitdir,$systemduserunitdir}/*.service \ + | sort -u | while read i; do # some {rc,halt}.local scripts and programs are okay to not exist, the rest should inst $i || [ "${i%.local}" != "$i" ] || [ "${i%systemd-update-done}" != "$i" ] done diff --git a/test/test-network/conf/11-dummy.netdev b/test/test-network/conf/11-dummy.netdev new file mode 100644 index 0000000000..6797eb4b09 --- /dev/null +++ b/test/test-network/conf/11-dummy.netdev @@ -0,0 +1,3 @@ +[NetDev] +Name=test1 +Kind=dummy diff --git a/test/test-network/conf/12-dummy.netdev b/test/test-network/conf/12-dummy.netdev new file mode 100644 index 0000000000..a7fdc0f7e0 --- /dev/null +++ b/test/test-network/conf/12-dummy.netdev @@ -0,0 +1,3 @@ +[NetDev] +Name=dummy98 +Kind=dummy diff --git a/test/test-network/conf/21-macvlan.netdev b/test/test-network/conf/21-macvlan.netdev new file mode 100644 index 0000000000..e9a3c5b347 --- /dev/null +++ b/test/test-network/conf/21-macvlan.netdev @@ -0,0 +1,3 @@ +[NetDev] +Name=macvlan99 +Kind=macvlan diff --git a/test/test-network/conf/21-macvtap.netdev b/test/test-network/conf/21-macvtap.netdev new file mode 100644 index 0000000000..2c23aacfb2 --- /dev/null +++ b/test/test-network/conf/21-macvtap.netdev @@ -0,0 +1,3 @@ +[NetDev] +Name=macvtap99 +Kind=macvtap diff --git a/test/test-network/conf/21-vlan.netdev b/test/test-network/conf/21-vlan.netdev new file mode 100644 index 0000000000..fe9801c8a2 --- /dev/null +++ b/test/test-network/conf/21-vlan.netdev @@ -0,0 +1,10 @@ +[NetDev] +Name=vlan99 +Kind=vlan + +[VLAN] +Id=99 +GVRP=true +MVRP=true +LooseBinding=true +ReorderHeader=true diff --git a/test/test-network/conf/21-vlan.network b/test/test-network/conf/21-vlan.network new file mode 100644 index 0000000000..a4fa1decde --- /dev/null +++ b/test/test-network/conf/21-vlan.network @@ -0,0 +1,5 @@ +[Match] +Name=test1 + +[Network] +VLAN=vlan99 diff --git a/test/test-network/conf/23-active-slave.network b/test/test-network/conf/23-active-slave.network new file mode 100644 index 0000000000..59a65960e9 --- /dev/null +++ b/test/test-network/conf/23-active-slave.network @@ -0,0 +1,6 @@ +[Match] +Name=dummy98 + +[Network] +Bond=bond199 +ActiveSlave=true diff --git a/test/test-network/conf/23-bond199.network b/test/test-network/conf/23-bond199.network new file mode 100644 index 0000000000..31e5d12f75 --- /dev/null +++ b/test/test-network/conf/23-bond199.network @@ -0,0 +1,2 @@ +[Match] +Name=bond199 diff --git a/test/test-network/conf/23-emit-lldp.network b/test/test-network/conf/23-emit-lldp.network new file mode 100644 index 0000000000..de35045388 --- /dev/null +++ b/test/test-network/conf/23-emit-lldp.network @@ -0,0 +1,5 @@ +[Match] +Name=veth-peer + +[Network] +EmitLLDP=yes diff --git a/test/test-network/conf/23-primary-slave.network b/test/test-network/conf/23-primary-slave.network new file mode 100644 index 0000000000..380ae267a2 --- /dev/null +++ b/test/test-network/conf/23-primary-slave.network @@ -0,0 +1,6 @@ +[Match] +Name=dummy98 + +[Network] +Bond=bond199 +PrimarySlave=true diff --git a/test/test-network/conf/23-test1-bond199.network b/test/test-network/conf/23-test1-bond199.network new file mode 100644 index 0000000000..6e7c28dfe7 --- /dev/null +++ b/test/test-network/conf/23-test1-bond199.network @@ -0,0 +1,6 @@ +[Match] +Name=test1 + +[Network] +Bond=bond199 +PrimarySlave=true diff --git a/test/test-network/conf/24-lldp.network b/test/test-network/conf/24-lldp.network new file mode 100644 index 0000000000..fbdfb1b672 --- /dev/null +++ b/test/test-network/conf/24-lldp.network @@ -0,0 +1,5 @@ +[Match] +Name=veth99 + +[Network] +LLDP=yes diff --git a/test/test-network/conf/24-search-domain.network b/test/test-network/conf/24-search-domain.network new file mode 100644 index 0000000000..970b130ab0 --- /dev/null +++ b/test/test-network/conf/24-search-domain.network @@ -0,0 +1,7 @@ +[Match] +Name=dummy98 + +[Network] +Address=192.168.42.100 +DNS=192.168.42.1 +Domains= one two three four five six seven eight nine ten diff --git a/test/test-network/conf/25-address-link-section.network b/test/test-network/conf/25-address-link-section.network new file mode 100644 index 0000000000..759e83c325 --- /dev/null +++ b/test/test-network/conf/25-address-link-section.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Link] +MACAddress=00:01:02:aa:bb:cc diff --git a/test/test-network/conf/25-address-section-miscellaneous.network b/test/test-network/conf/25-address-section-miscellaneous.network new file mode 100644 index 0000000000..3a37d036ce --- /dev/null +++ b/test/test-network/conf/25-address-section-miscellaneous.network @@ -0,0 +1,10 @@ +[Match] +Name=dummy98 + +[Address] +Address=10.2.3.4/16 +PreferredLifetime=0 +Scope=link + +[Address] +Address=2001:0db8:0:f101::1/64 diff --git a/test/test-network/conf/25-address-section.network b/test/test-network/conf/25-address-section.network new file mode 100644 index 0000000000..d0fae69361 --- /dev/null +++ b/test/test-network/conf/25-address-section.network @@ -0,0 +1,11 @@ +[Match] +Name=dummy98 + +[Address] +Address=10.2.3.4/16 +Peer=10.2.3.5/16 +Label=32 + +[Address] +Address=10.6.7.8/16 +Label=33 diff --git a/test/test-network/conf/25-bond-active-backup-slave.netdev b/test/test-network/conf/25-bond-active-backup-slave.netdev new file mode 100644 index 0000000000..1bbbf75570 --- /dev/null +++ b/test/test-network/conf/25-bond-active-backup-slave.netdev @@ -0,0 +1,6 @@ +[NetDev] +Name=bond199 +Kind=bond + +[Bond] +Mode=active-backup diff --git a/test/test-network/conf/25-bond.netdev b/test/test-network/conf/25-bond.netdev new file mode 100644 index 0000000000..10599108af --- /dev/null +++ b/test/test-network/conf/25-bond.netdev @@ -0,0 +1,13 @@ +[NetDev] +Name=bond99 +Kind=bond + +[Bond] +Mode=802.3ad +TransmitHashPolicy=layer3+4 +MIIMonitorSec=1s +LACPTransmitRate=fast +UpDelaySec=2s +DownDelaySec=2s +ResendIGMP=4 +MinLinks=1 diff --git a/test/test-network/conf/25-bridge.netdev b/test/test-network/conf/25-bridge.netdev new file mode 100644 index 0000000000..e23abd5368 --- /dev/null +++ b/test/test-network/conf/25-bridge.netdev @@ -0,0 +1,13 @@ +[NetDev] +Name=bridge99 +Kind=bridge + +[Bridge] +HelloTimeSec=9 +MaxAgeSec=9 +ForwardDelaySec=9 +AgeingTimeSec=9 +Priority=9 +MulticastQuerier= true +MulticastSnooping=true +STP=true diff --git a/test/test-network/conf/25-geneve.netdev b/test/test-network/conf/25-geneve.netdev new file mode 100644 index 0000000000..279d71324e --- /dev/null +++ b/test/test-network/conf/25-geneve.netdev @@ -0,0 +1,12 @@ +[NetDev] +Name=geneve99 +Kind=geneve + +[GENEVE] +Id=99 +Remote=192.168.22.1 +TTL=1 +UDPChecksum=true +UDP6ZeroChecksumTx=true +UDP6ZeroChecksumRx=true +DestinationPort=6082 diff --git a/test/test-network/conf/25-gre-tunnel.netdev b/test/test-network/conf/25-gre-tunnel.netdev new file mode 100644 index 0000000000..94d9320cdb --- /dev/null +++ b/test/test-network/conf/25-gre-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=gretun99 +Kind=gre + +[Tunnel] +Local=10.65.223.238 +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-gretap-tunnel.netdev b/test/test-network/conf/25-gretap-tunnel.netdev new file mode 100644 index 0000000000..769e7653e4 --- /dev/null +++ b/test/test-network/conf/25-gretap-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=gretap99 +Kind=gretap + +[Tunnel] +Local=10.65.223.238 +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-ip6gre-tunnel.netdev b/test/test-network/conf/25-ip6gre-tunnel.netdev new file mode 100644 index 0000000000..b16e0b4969 --- /dev/null +++ b/test/test-network/conf/25-ip6gre-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=ip6gretap99 +Kind=ip6gretap + +[Tunnel] +Local=2a00:ffde:4567:edde::4987 +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-ip6tnl-tunnel.netdev b/test/test-network/conf/25-ip6tnl-tunnel.netdev new file mode 100644 index 0000000000..713e685ea1 --- /dev/null +++ b/test/test-network/conf/25-ip6tnl-tunnel.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=ip6tnl99 +Kind=ip6tnl + +[Tunnel] +Mode=ip6ip6 +Local=2a00:ffde:4567:edde::4987 +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-ipip-tunnel-independent.netdev b/test/test-network/conf/25-ipip-tunnel-independent.netdev new file mode 100644 index 0000000000..36ff8d9429 --- /dev/null +++ b/test/test-network/conf/25-ipip-tunnel-independent.netdev @@ -0,0 +1,9 @@ +[NetDev] +Name=ipiptun99 +Kind=ipip +MTUBytes=1480 + +[Tunnel] +Local=192.168.223.238 +Remote=192.169.224.239 +Independent=true diff --git a/test/test-network/conf/25-ipip-tunnel.netdev b/test/test-network/conf/25-ipip-tunnel.netdev new file mode 100644 index 0000000000..159ac72703 --- /dev/null +++ b/test/test-network/conf/25-ipip-tunnel.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=ipiptun99 +Kind=ipip +MTUBytes=1480 + +[Tunnel] +Local=192.168.223.238 +Remote=192.169.224.239 diff --git a/test/test-network/conf/25-ipv6-address-label-section.network b/test/test-network/conf/25-ipv6-address-label-section.network new file mode 100644 index 0000000000..945b7dcc45 --- /dev/null +++ b/test/test-network/conf/25-ipv6-address-label-section.network @@ -0,0 +1,6 @@ +[Match] +Name=dummy98 + +[IPv6AddressLabel] +Label=4444 +Prefix=2004:da8:1:0::/64 diff --git a/test/test-network/conf/25-ipvlan.netdev b/test/test-network/conf/25-ipvlan.netdev new file mode 100644 index 0000000000..9921b787a1 --- /dev/null +++ b/test/test-network/conf/25-ipvlan.netdev @@ -0,0 +1,6 @@ +[NetDev] +Name=ipvlan99 +Kind=ipvlan + +[IPVLAN] +Mode=L2 diff --git a/test/test-network/conf/25-link-section-unmanaged.network b/test/test-network/conf/25-link-section-unmanaged.network new file mode 100644 index 0000000000..4fe4916031 --- /dev/null +++ b/test/test-network/conf/25-link-section-unmanaged.network @@ -0,0 +1,6 @@ +[Match] +Name=dummy98 + +[Link] +MACAddress=00:01:02:aa:bb:cc +Unmanaged=true diff --git a/test/test-network/conf/25-route-section.network b/test/test-network/conf/25-route-section.network new file mode 100644 index 0000000000..c9c7a722c5 --- /dev/null +++ b/test/test-network/conf/25-route-section.network @@ -0,0 +1,8 @@ +[Match] +Name=dummy98 + +[Network] +Address=192.168.0.15/24 + +[Route] +Gateway=192.168.0.1 diff --git a/test/test-network/conf/25-route-tcp-window-settings.network b/test/test-network/conf/25-route-tcp-window-settings.network new file mode 100644 index 0000000000..e77a721740 --- /dev/null +++ b/test/test-network/conf/25-route-tcp-window-settings.network @@ -0,0 +1,10 @@ +[Match] +Name=test1 + +[Route] +Destination=192.168.1.1 +InitialCongestionWindow=20 + +[Route] +Destination=192.168.1.2 +InitialAdvertisedReceiveWindow=30 diff --git a/test/test-network/conf/25-route-type.network b/test/test-network/conf/25-route-type.network new file mode 100644 index 0000000000..9a104137de --- /dev/null +++ b/test/test-network/conf/25-route-type.network @@ -0,0 +1,14 @@ +[Match] +Name=dummy98 + +[Route] +Type=blackhole +Destination=202.54.1.2 + +[Route] +Type=unreachable +Destination=202.54.1.3 + +[Route] +Type=prohibit +Destination=202.54.1.4 diff --git a/test/test-network/conf/25-sit-tunnel.netdev b/test/test-network/conf/25-sit-tunnel.netdev new file mode 100644 index 0000000000..406d74bcf0 --- /dev/null +++ b/test/test-network/conf/25-sit-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=sittun99 +Kind=sit + +[Tunnel] +Local=10.65.223.238 +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-sysctl.network b/test/test-network/conf/25-sysctl.network new file mode 100644 index 0000000000..2452fb7e85 --- /dev/null +++ b/test/test-network/conf/25-sysctl.network @@ -0,0 +1,10 @@ +[Match] +Name=dummy98 + +[Network] +IPForward=true +IPv6PrivacyExtensions=true +IPv6DuplicateAddressDetection=3 +IPv6HopLimit=5 +IPv4ProxyARP=true +IPv6ProxyNDP=true diff --git a/test/test-network/conf/25-tap.netdev b/test/test-network/conf/25-tap.netdev new file mode 100644 index 0000000000..bf5e7fe52c --- /dev/null +++ b/test/test-network/conf/25-tap.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=tap99 +Kind=tap + +[Tap] +MultiQueue=true +PacketInfo=true diff --git a/test/test-network/conf/25-tun.netdev b/test/test-network/conf/25-tun.netdev new file mode 100644 index 0000000000..380ab21552 --- /dev/null +++ b/test/test-network/conf/25-tun.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=tun99 +Kind=tun + +[Tun] +MultiQueue=true +PacketInfo=true diff --git a/test/test-network/conf/25-vcan.netdev b/test/test-network/conf/25-vcan.netdev new file mode 100644 index 0000000000..ff1979536a --- /dev/null +++ b/test/test-network/conf/25-vcan.netdev @@ -0,0 +1,3 @@ +[NetDev] +Name=vcan99 +Kind=vcan diff --git a/test/test-network/conf/25-veth.netdev b/test/test-network/conf/25-veth.netdev new file mode 100644 index 0000000000..9ae4ad53b8 --- /dev/null +++ b/test/test-network/conf/25-veth.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=veth99 +Kind=veth +MACAddress=12:34:56:78:9a:bc + +[Peer] +Name=veth-peer +MACAddress=12:34:56:78:9a:bd diff --git a/test/test-network/conf/25-vrf.netdev b/test/test-network/conf/25-vrf.netdev new file mode 100644 index 0000000000..bf949ec293 --- /dev/null +++ b/test/test-network/conf/25-vrf.netdev @@ -0,0 +1,6 @@ +[NetDev] +Name=vrf99 +Kind=vrf + +[VRF] +TableId=42 diff --git a/test/test-network/conf/25-vti-tunnel.netdev b/test/test-network/conf/25-vti-tunnel.netdev new file mode 100644 index 0000000000..cec6259781 --- /dev/null +++ b/test/test-network/conf/25-vti-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=vtitun99 +Kind=vti + +[Tunnel] +Local=10.65.223.238 +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-vti6-tunnel.netdev b/test/test-network/conf/25-vti6-tunnel.netdev new file mode 100644 index 0000000000..d150c9ce86 --- /dev/null +++ b/test/test-network/conf/25-vti6-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=vti6tun99 +Kind=vti6 + +[Tunnel] +Local=2a00:ffde:4567:edde::4987 +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-vxlan.netdev b/test/test-network/conf/25-vxlan.netdev new file mode 100644 index 0000000000..819a58356f --- /dev/null +++ b/test/test-network/conf/25-vxlan.netdev @@ -0,0 +1,16 @@ +[NetDev] +Name=vxlan99 +Kind=vxlan + +[VXLAN] +Id=999 +L2MissNotification=true +L3MissNotification=true +RouteShortCircuit=true +UDPChecksum=true +UDP6ZeroChecksumTx=true +UDP6ZeroChecksumRx=true +RemoteChecksumTx=true +RemoteChecksumRx=true +GroupPolicyExtension=true +DestinationPort=5555 diff --git a/test/test-network/conf/26-bridge-slave-interface-1.network b/test/test-network/conf/26-bridge-slave-interface-1.network new file mode 100644 index 0000000000..84f221d538 --- /dev/null +++ b/test/test-network/conf/26-bridge-slave-interface-1.network @@ -0,0 +1,11 @@ +[Match] +Name=dummy98 + +[Network] +Bridge=bridge99 + +[Bridge] +Cost=400 +HairPin = true +FastLeave = true +UnicastFlood = true diff --git a/test/test-network/conf/26-bridge-slave-interface-2.network b/test/test-network/conf/26-bridge-slave-interface-2.network new file mode 100644 index 0000000000..45ec2de999 --- /dev/null +++ b/test/test-network/conf/26-bridge-slave-interface-2.network @@ -0,0 +1,5 @@ +[Match] +Name=test1 + +[Network] +Bridge=bridge99 diff --git a/test/test-network/conf/26-bridge.netdev b/test/test-network/conf/26-bridge.netdev new file mode 100644 index 0000000000..9b31e06b5b --- /dev/null +++ b/test/test-network/conf/26-bridge.netdev @@ -0,0 +1,3 @@ +[NetDev] +Name=bridge99 +Kind=bridge diff --git a/test/test-network/conf/bridge99.network b/test/test-network/conf/bridge99.network new file mode 100644 index 0000000000..39e48ce2e1 --- /dev/null +++ b/test/test-network/conf/bridge99.network @@ -0,0 +1,6 @@ +[Match] +Name=bridge99 + +[Network] +Address=192.168.0.15/24 +Gateway=192.168.0.1 diff --git a/test/test-network/conf/configure-without-carrier.network b/test/test-network/conf/configure-without-carrier.network new file mode 100644 index 0000000000..5bd9d7e84a --- /dev/null +++ b/test/test-network/conf/configure-without-carrier.network @@ -0,0 +1,7 @@ +[Match] +Name=test1 + +[Network] +Address=192.168.0.15/24 +Gateway=192.168.0.1 +ConfigureWithoutCarrier=true diff --git a/test/test-network/conf/dhcp-client-anonymize.network b/test/test-network/conf/dhcp-client-anonymize.network new file mode 100644 index 0000000000..a910cba0f7 --- /dev/null +++ b/test/test-network/conf/dhcp-client-anonymize.network @@ -0,0 +1,16 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false + +[DHCP] +Anonymize=true +UseMTU=true +UseRoutes=true +SendHostname=true +UseHostname=true +Hostname=test-hostname +ClientIdentifier=mac +VendorClassIdentifier=SusantVendorTest diff --git a/test/test-network/conf/dhcp-client-critical-connection.network b/test/test-network/conf/dhcp-client-critical-connection.network new file mode 100644 index 0000000000..0e65dec0ae --- /dev/null +++ b/test/test-network/conf/dhcp-client-critical-connection.network @@ -0,0 +1,9 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false + +[DHCP] +CriticalConnection=true diff --git a/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network b/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network new file mode 100644 index 0000000000..5c4ca22ab7 --- /dev/null +++ b/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network @@ -0,0 +1,15 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false + +[DHCP] +UseMTU=true +UseRoutes=true +SendHostname=true +UseHostname=true +Hostname=test-hostname +ClientIdentifier=mac +VendorClassIdentifier=SusantVendorTest diff --git a/test/test-network/conf/dhcp-client-ipv4-only-ipv6-disabled.network b/test/test-network/conf/dhcp-client-ipv4-only-ipv6-disabled.network new file mode 100644 index 0000000000..c980bf9fca --- /dev/null +++ b/test/test-network/conf/dhcp-client-ipv4-only-ipv6-disabled.network @@ -0,0 +1,6 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false diff --git a/test/test-network/conf/dhcp-client-ipv4-only.network b/test/test-network/conf/dhcp-client-ipv4-only.network new file mode 100644 index 0000000000..9bc019a674 --- /dev/null +++ b/test/test-network/conf/dhcp-client-ipv4-only.network @@ -0,0 +1,5 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 diff --git a/test/test-network/conf/dhcp-client-ipv6-only.network b/test/test-network/conf/dhcp-client-ipv6-only.network new file mode 100644 index 0000000000..1f70c3b86d --- /dev/null +++ b/test/test-network/conf/dhcp-client-ipv6-only.network @@ -0,0 +1,5 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv6 diff --git a/test/test-network/conf/dhcp-client-ipv6-rapid-commit.network b/test/test-network/conf/dhcp-client-ipv6-rapid-commit.network new file mode 100644 index 0000000000..52fa58729e --- /dev/null +++ b/test/test-network/conf/dhcp-client-ipv6-rapid-commit.network @@ -0,0 +1,8 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv6 + +[DHCP] +RapidCommit=false diff --git a/test/test-network/conf/dhcp-client-listen-port.network b/test/test-network/conf/dhcp-client-listen-port.network new file mode 100644 index 0000000000..73ac364630 --- /dev/null +++ b/test/test-network/conf/dhcp-client-listen-port.network @@ -0,0 +1,8 @@ +[Match] +Name=veth99 + +[Network] +DHCP=yes + +[DHCP] +ListenPort=5555 diff --git a/test/test-network/conf/dhcp-client-route-metric.network b/test/test-network/conf/dhcp-client-route-metric.network new file mode 100644 index 0000000000..aa04aaef33 --- /dev/null +++ b/test/test-network/conf/dhcp-client-route-metric.network @@ -0,0 +1,10 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false + +[DHCP] +UseRoutes=true +RouteMetric=24 diff --git a/test/test-network/conf/dhcp-client-route-table.network b/test/test-network/conf/dhcp-client-route-table.network new file mode 100644 index 0000000000..75f16aa22d --- /dev/null +++ b/test/test-network/conf/dhcp-client-route-table.network @@ -0,0 +1,10 @@ +[Match] +Name=veth99 + +[Network] +DHCP=ipv4 +IPv6AcceptRA=false + +[DHCP] +UseRoutes=true +RouteTable=12 diff --git a/test/test-network/conf/dhcp-client-timezone-router.network b/test/test-network/conf/dhcp-client-timezone-router.network new file mode 100644 index 0000000000..6316f9cf59 --- /dev/null +++ b/test/test-network/conf/dhcp-client-timezone-router.network @@ -0,0 +1,8 @@ +[Match] +Name=veth99 + +[Network] +IPv6AcceptRA=false +DHCP=ipv4 +UseRoutes=true +UseTimezone=true diff --git a/test/test-network/conf/dhcp-client.network b/test/test-network/conf/dhcp-client.network new file mode 100644 index 0000000000..5629bc48e4 --- /dev/null +++ b/test/test-network/conf/dhcp-client.network @@ -0,0 +1,5 @@ +[Match] +Name=veth99 + +[Network] +DHCP=yes diff --git a/test/test-network/conf/dhcp-server-timezone-router.network b/test/test-network/conf/dhcp-server-timezone-router.network new file mode 100644 index 0000000000..3ebbf05d3e --- /dev/null +++ b/test/test-network/conf/dhcp-server-timezone-router.network @@ -0,0 +1,13 @@ +[Match] +Name=veth-peer + +[Network] +IPv6AcceptRA=false +Address=192.168.5.1/24 +DHCPServer=yes + +[DHCPServer] +PoolOffset=10 +PoolSize=50 +EmitRouter=yes +Timezone=Europe/Berlin diff --git a/test/test-network/conf/dhcp-server-veth-peer.network b/test/test-network/conf/dhcp-server-veth-peer.network new file mode 100644 index 0000000000..7b38e72b7e --- /dev/null +++ b/test/test-network/conf/dhcp-server-veth-peer.network @@ -0,0 +1,6 @@ +[Match] +Name=veth-peer + +[Network] +Address=2600::1 +Address=192.168.5.1/24 diff --git a/test/test-network/conf/dhcp-server.network b/test/test-network/conf/dhcp-server.network new file mode 100644 index 0000000000..9e49691a9b --- /dev/null +++ b/test/test-network/conf/dhcp-server.network @@ -0,0 +1,12 @@ +[Match] +Name=veth-peer + +[Network] +Address=192.168.5.1/24 +DHCPServer=yes + +[DHCPServer] +PoolOffset=10 +PoolSize=50 +DNS=192.168.5.1 +NTP=192.168.5.1 diff --git a/test/test-network/conf/dhcp-v4-server-veth-peer.network b/test/test-network/conf/dhcp-v4-server-veth-peer.network new file mode 100644 index 0000000000..5c91d65432 --- /dev/null +++ b/test/test-network/conf/dhcp-v4-server-veth-peer.network @@ -0,0 +1,6 @@ +[Match] +Name=veth-peer + +[Network] +Address=192.168.0.1 +Address=192.168.5.1 diff --git a/test/test-network/conf/gretap.network b/test/test-network/conf/gretap.network new file mode 100644 index 0000000000..88b9250349 --- /dev/null +++ b/test/test-network/conf/gretap.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=gretap99 diff --git a/test/test-network/conf/gretun.network b/test/test-network/conf/gretun.network new file mode 100644 index 0000000000..376074cb1b --- /dev/null +++ b/test/test-network/conf/gretun.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=gretun99 diff --git a/test/test-network/conf/ip6gretap.network b/test/test-network/conf/ip6gretap.network new file mode 100644 index 0000000000..cad0bae04a --- /dev/null +++ b/test/test-network/conf/ip6gretap.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=ip6gretap99 diff --git a/test/test-network/conf/ip6tnl.network b/test/test-network/conf/ip6tnl.network new file mode 100644 index 0000000000..41e3448495 --- /dev/null +++ b/test/test-network/conf/ip6tnl.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=ip6tnl99 diff --git a/test/test-network/conf/ipip.network b/test/test-network/conf/ipip.network new file mode 100644 index 0000000000..4ce6714904 --- /dev/null +++ b/test/test-network/conf/ipip.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=ipiptun99 diff --git a/test/test-network/conf/ipv6-prefix-veth.network b/test/test-network/conf/ipv6-prefix-veth.network new file mode 100644 index 0000000000..3d2acecde2 --- /dev/null +++ b/test/test-network/conf/ipv6-prefix-veth.network @@ -0,0 +1,5 @@ +[Match] +Name=veth99 + +[Network] +IPv6AcceptRA=true diff --git a/test/test-network/conf/ipv6-prefix.network b/test/test-network/conf/ipv6-prefix.network new file mode 100644 index 0000000000..c1932a84d3 --- /dev/null +++ b/test/test-network/conf/ipv6-prefix.network @@ -0,0 +1,10 @@ +[Match] +Name=veth-peer + +[Network] +IPv6PrefixDelegation=yes + +[IPv6Prefix] +Prefix=2002:da8:1:0::/64 +PreferredLifetimeSec=1000s +ValidLifetimeSec=2100s diff --git a/test/test-network/conf/ipvlan.network b/test/test-network/conf/ipvlan.network new file mode 100644 index 0000000000..d053220550 --- /dev/null +++ b/test/test-network/conf/ipvlan.network @@ -0,0 +1,5 @@ +[Match] +Name=test1 + +[Network] +IPVLAN=ipvlan99 diff --git a/test/test-network/conf/macvlan.network b/test/test-network/conf/macvlan.network new file mode 100644 index 0000000000..a41c1f916c --- /dev/null +++ b/test/test-network/conf/macvlan.network @@ -0,0 +1,5 @@ +[Match] +Name=test1 + +[Network] +MACVLAN=macvlan99 diff --git a/test/test-network/conf/macvtap.network b/test/test-network/conf/macvtap.network new file mode 100644 index 0000000000..6ee99ab9ce --- /dev/null +++ b/test/test-network/conf/macvtap.network @@ -0,0 +1,5 @@ +[Match] +Name=test1 + +[Network] +MACVTAP=macvtap99 diff --git a/test/test-network/conf/routing-policy-rule.network b/test/test-network/conf/routing-policy-rule.network new file mode 100644 index 0000000000..46b87c5a9a --- /dev/null +++ b/test/test-network/conf/routing-policy-rule.network @@ -0,0 +1,10 @@ +[Match] +Name=test1 + +[RoutingPolicyRule] +TypeOfService=0x08 +Table=7 +From= 192.168.100.18 +Priority=111 +IncomingInterface=test1 +OutgoingInterface=test1 diff --git a/test/test-network/conf/sit.network b/test/test-network/conf/sit.network new file mode 100644 index 0000000000..84e5af0ff0 --- /dev/null +++ b/test/test-network/conf/sit.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=sittun99 diff --git a/test/test-network/conf/test-static.network b/test/test-network/conf/test-static.network new file mode 100644 index 0000000000..636c55c8e3 --- /dev/null +++ b/test/test-network/conf/test-static.network @@ -0,0 +1,6 @@ +[Match] +Name=dummy98 + +[Network] +Address=192.168.0.15/24 +Gateway=192.168.0.1 diff --git a/test/test-network/conf/vti.network b/test/test-network/conf/vti.network new file mode 100644 index 0000000000..7fbad6a82d --- /dev/null +++ b/test/test-network/conf/vti.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=vtitun99 diff --git a/test/test-network/conf/vti6.network b/test/test-network/conf/vti6.network new file mode 100644 index 0000000000..49a9d11fff --- /dev/null +++ b/test/test-network/conf/vti6.network @@ -0,0 +1,5 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=vti6tun99 diff --git a/test/test-network/conf/vxlan.network b/test/test-network/conf/vxlan.network new file mode 100644 index 0000000000..80b405574c --- /dev/null +++ b/test/test-network/conf/vxlan.network @@ -0,0 +1,5 @@ +[Match] +Name=test1 + +[Network] +VXLAN=vxlan99 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py new file mode 100755 index 0000000000..fc347c6008 --- /dev/null +++ b/test/test-network/systemd-networkd-tests.py @@ -0,0 +1,854 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: LGPL-2.1+ +# systemd-networkd tests + +import os +import sys +import unittest +import subprocess +import time +import shutil +import signal +import socket +import threading +from shutil import copytree + +network_unit_file_path='/var/run/systemd/network' +networkd_ci_path='/var/run/networkd-ci' +network_sysctl_ipv6_path='/proc/sys/net/ipv6/conf' +network_sysctl_ipv4_path='/proc/sys/net/ipv4/conf' + +dnsmasq_config_file='/var/run/networkd-ci/test-dnsmasq.conf' +dnsmasq_pid_file='/var/run/networkd-ci/test-test-dnsmasq.pid' +dnsmasq_log_file='/var/run/networkd-ci/test-dnsmasq-log-file' + +def setUpModule(): + + os.makedirs(network_unit_file_path, exist_ok=True) + os.makedirs(networkd_ci_path, exist_ok=True) + + shutil.rmtree(networkd_ci_path) + copytree(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf'), networkd_ci_path) + +def tearDownModule(): + shutil.rmtree(networkd_ci_path) + +class Utilities(): + dhcp_server_data = [] + + def read_link_attr(self, link, dev, attribute): + with open(os.path.join(os.path.join(os.path.join('/sys/class/net/', link), dev), attribute)) as f: + return f.readline().strip() + + def link_exits(self, link): + return os.path.exists(os.path.join('/sys/class/net', link)) + + def link_remove(self, links): + for link in links: + if os.path.exists(os.path.join('/sys/class/net', link)): + subprocess.call(['ip', 'link', 'del', 'dev', link]) + + def read_ipv6_sysctl_attr(self, link, attribute): + with open(os.path.join(os.path.join(network_sysctl_ipv6_path, link), attribute)) as f: + return f.readline().strip() + + def read_ipv4_sysctl_attr(self, link, attribute): + with open(os.path.join(os.path.join(network_sysctl_ipv4_path, link), attribute)) as f: + return f.readline().strip() + + def copy_unit_to_networkd_unit_path(self, *units): + for unit in units: + shutil.copy(os.path.join(networkd_ci_path, unit), network_unit_file_path) + + def remove_unit_from_networkd_path(self, units): + for unit in units: + if (os.path.exists(os.path.join(network_unit_file_path, unit))): + os.remove(os.path.join(network_unit_file_path, unit)) + + def start_dnsmasq(self): + subprocess.check_call('dnsmasq -8 /var/run/networkd-ci/test-dnsmasq-log-file --log-queries=extra --log-dhcp --pid-file=/var/run/networkd-ci/test-test-dnsmasq.pid --conf-file=/dev/null --interface=veth-peer --enable-ra --dhcp-range=2600::10,2600::20 --dhcp-range=192.168.5.10,192.168.5.200 -R --dhcp-leasefile=/var/run/networkd-ci/lease --dhcp-option=26,1492 --dhcp-option=option:router,192.168.5.1 --dhcp-option=33,192.168.5.4,192.168.5.5', shell=True) + + time.sleep(10) + + def stop_dnsmasq(self, pid_file): + if os.path.exists(pid_file): + with open(pid_file, 'r') as f: + pid = f.read().rstrip(' \t\r\n\0') + os.kill(int(pid), signal.SIGTERM) + + os.remove(pid_file) + + def search_words_in_file(self, word): + if os.path.exists(dnsmasq_log_file): + with open (dnsmasq_log_file) as in_file: + contents = in_file.read() + print(contents) + for part in contents.split(): + if word in part: + in_file.close() + print("%s, %s" % (word, part)) + return True + return False + + def remove_lease_file(self): + if os.path.exists(os.path.join(networkd_ci_path, 'lease')): + os.remove(os.path.join(networkd_ci_path, 'lease')) + + def remove_log_file(self): + if os.path.exists(dnsmasq_log_file): + os.remove(dnsmasq_log_file) + + def start_networkd(self): + subprocess.check_call('systemctl restart systemd-networkd', shell=True) + time.sleep(5) + +global ip +global port + +class DHCPServer(threading.Thread): + def __init__(self, name): + threading.Thread.__init__(self) + self.name = name + + def run(self): + self.start_dhcp_server() + + def start_dhcp_server(self): + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + + server_address = ('0.0.0.0', 67) + sock.bind(server_address) + + print('Starting DHCP Server ...\n') + data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes + + global ip + ip = addr[0] + + global port + port = addr[1] + sock.close() + +class NetworkdNetDevTests(unittest.TestCase, Utilities): + + links =['bridge99', 'bond99', 'bond99', 'vlan99', 'test1', 'macvtap99', + 'macvlan99', 'ipvlan99', 'vxlan99', 'veth99', 'vrf99', 'tun99', + 'tap99', 'vcan99', 'geneve99', 'dummy98', 'ipiptun99', 'sittun99', + 'gretap99', 'vtitun99', 'vti6tun99','ip6tnl99', 'gretun99', 'ip6gretap99'] + + units = ['25-bridge.netdev', '25-bond.netdev', '21-vlan.netdev', '11-dummy.netdev', '21-vlan.network', + '21-macvtap.netdev', 'macvtap.network', '21-macvlan.netdev', 'macvlan.network', 'vxlan.network', + '25-vxlan.netdev', '25-ipvlan.netdev', 'ipvlan.network', '25-veth.netdev', '25-vrf.netdev', + '25-tun.netdev', '25-tun.netdev', '25-vcan.netdev', '25-geneve.netdev', '25-ipip-tunnel.netdev', + '25-ip6tnl-tunnel.netdev', '25-ip6gre-tunnel.netdev','25-sit-tunnel.netdev', '25-gre-tunnel.netdev', + '25-gretap-tunnel.netdev', '25-vti-tunnel.netdev', '25-vti6-tunnel.netdev', '12-dummy.netdev', + 'gre.network', 'ipip.network', 'ip6gretap.network', 'gretun.network', 'ip6tnl.network', '25-tap.netdev', + 'vti6.network', 'vti.network', 'gretap.network', 'sit.network', '25-ipip-tunnel-independent.netdev'] + + def setUp(self): + self.link_remove(self.links) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + + def test_bridge(self): + self.copy_unit_to_networkd_unit_path('25-bridge.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('bridge99')) + + self.assertEqual('900', self.read_link_attr('bridge99', 'bridge', 'hello_time')) + self.assertEqual('900', self.read_link_attr('bridge99', 'bridge', 'max_age')) + self.assertEqual('900', self.read_link_attr('bridge99', 'bridge','forward_delay')) + self.assertEqual('900', self.read_link_attr('bridge99', 'bridge','ageing_time')) + self.assertEqual('9', self.read_link_attr('bridge99', 'bridge','priority')) + self.assertEqual('1', self.read_link_attr('bridge99', 'bridge','multicast_querier')) + self.assertEqual('1', self.read_link_attr('bridge99', 'bridge','multicast_snooping')) + self.assertEqual('1', self.read_link_attr('bridge99', 'bridge','stp_state')) + + def test_bond(self): + self.copy_unit_to_networkd_unit_path('25-bond.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('bond99')) + + self.assertEqual('802.3ad 4', self.read_link_attr('bond99', 'bonding', 'mode')) + self.assertEqual('layer3+4 1', self.read_link_attr('bond99', 'bonding', 'xmit_hash_policy')) + self.assertEqual('1000', self.read_link_attr('bond99', 'bonding', 'miimon')) + self.assertEqual('fast 1', self.read_link_attr('bond99', 'bonding', 'lacp_rate')) + self.assertEqual('2000', self.read_link_attr('bond99', 'bonding', 'updelay')) + self.assertEqual('2000', self.read_link_attr('bond99', 'bonding', 'downdelay')) + self.assertEqual('4', self.read_link_attr('bond99', 'bonding', 'resend_igmp')) + self.assertEqual('1', self.read_link_attr('bond99', 'bonding', 'min_links')) + + def test_vlan(self): + self.copy_unit_to_networkd_unit_path('21-vlan.netdev', '11-dummy.netdev', '21-vlan.network') + + self.start_networkd() + + self.assertTrue(self.link_exits('vlan99')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vlan99']).rstrip().decode('utf-8') + self.assertTrue(output, 'REORDER_HDR') + self.assertTrue(output, 'LOOSE_BINDING') + self.assertTrue(output, 'GVRP') + self.assertTrue(output, 'MVRP') + self.assertTrue(output, '99') + + def test_macvtap(self): + self.copy_unit_to_networkd_unit_path('21-macvtap.netdev', '11-dummy.netdev', 'macvtap.network') + + self.start_networkd() + + self.assertTrue(self.link_exits('macvtap99')) + + def test_macvlan(self): + self.copy_unit_to_networkd_unit_path('21-macvlan.netdev', '11-dummy.netdev', 'macvlan.network') + + self.start_networkd() + + self.assertTrue(self.link_exits('macvlan99')) + + def test_ipvlan(self): + self.copy_unit_to_networkd_unit_path('25-ipvlan.netdev', '11-dummy.netdev', 'ipvlan.network') + + self.start_networkd() + + self.assertTrue(self.link_exits('ipvlan99')) + + def test_veth(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + def test_dummy(self): + self.copy_unit_to_networkd_unit_path('11-dummy.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('test1')) + + def test_tun(self): + self.copy_unit_to_networkd_unit_path('25-tun.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('tun99')) + + def test_tap(self): + self.copy_unit_to_networkd_unit_path('25-tap.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('tap99')) + + def test_vrf(self): + self.copy_unit_to_networkd_unit_path('25-vrf.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('vrf99')) + + def test_vcan(self): + self.copy_unit_to_networkd_unit_path('25-vcan.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('vcan99')) + + def test_geneve(self): + self.copy_unit_to_networkd_unit_path('25-geneve.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('geneve99')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'geneve99']).rstrip().decode('utf-8') + self.assertTrue(output, '192.168.22.1') + self.assertTrue(output, '6082') + self.assertTrue(output, 'udpcsum') + self.assertTrue(output, 'udp6zerocsumrx') + + def test_ipip_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ipip-tunnel.netdev', 'ipip.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('ipiptun99')) + + def test_gre_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gre-tunnel.netdev', 'gretun.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('gretun99')) + + def test_gretap_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gretap-tunnel.netdev', 'gretap.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('gretap99')) + + def test_ip6gretap_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gre-tunnel.netdev', 'ip6gretap.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('ip6gretap99')) + + def test_vti_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti-tunnel.netdev', 'vti.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('vtitun99')) + + def test_vti6_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti6-tunnel.netdev', 'vti6.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('vti6tun99')) + + def test_ip6tnl_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6tnl-tunnel.netdev', 'ip6tnl.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('ip6tnl99')) + + def test_sit_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-sit-tunnel.netdev', 'sit.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('sittun99')) + + def test_tunnel_independent(self): + self.copy_unit_to_networkd_unit_path('25-ipip-tunnel-independent.netdev') + + self.start_networkd() + self.assertTrue(self.link_exits('ipiptun99')) + + def test_vxlan(self): + self.copy_unit_to_networkd_unit_path('25-vxlan.netdev', 'vxlan.network','11-dummy.netdev') + + self.start_networkd() + + self.assertTrue(self.link_exits('vxlan99')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vxlan99']).rstrip().decode('utf-8') + self.assertRegex(output, "999") + self.assertRegex(output, '5555') + self.assertRegex(output, 'l2miss') + self.assertRegex(output, 'l3miss') + self.assertRegex(output, 'udpcsum') + self.assertRegex(output, 'udp6zerocsumtx') + self.assertRegex(output, 'udp6zerocsumrx') + self.assertRegex(output, 'remcsumtx') + self.assertRegex(output, 'remcsumrx') + self.assertRegex(output, 'gbp') + +class NetworkdNetWorkTests(unittest.TestCase, Utilities): + links = ['dummy98', 'test1', 'bond199'] + + units = ['12-dummy.netdev', 'test-static.network', 'configure-without-carrier.network', '11-dummy.netdev', + '23-primary-slave.network', '23-test1-bond199.network', '11-dummy.netdev', '23-bond199.network', + '25-bond-active-backup-slave.netdev', '12-dummy.netdev', '23-active-slave.network', + 'routing-policy-rule.network', '25-address-section.network', '25-address-section-miscellaneous.network', + '25-route-section.network', '25-route-type.network', '25-route-tcp-window-settings.network', + '25-address-link-section.network', '25-ipv6-address-label-section.network', '25-link-section-unmanaged.network', + '25-sysctl.network'] + + def setUp(self): + self.link_remove(self.links) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + + def test_static_address(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', 'test-static.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '192.168.0.15') + self.assertRegex(output, '192.168.0.1') + self.assertRegex(output, 'routable') + + def test_configure_without_carrier(self): + self.copy_unit_to_networkd_unit_path('configure-without-carrier.network', '11-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('test1')) + output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '192.168.0.15') + self.assertRegex(output, '192.168.0.1') + self.assertRegex(output, 'routable') + + def test_bond_active_slave(self): + self.copy_unit_to_networkd_unit_path('23-active-slave.network', '23-bond199.network', '25-bond-active-backup-slave.netdev', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('bond199')) + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'bond199']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'active_slave dummy98') + + def test_bond_primary_slave(self): + self.copy_unit_to_networkd_unit_path('23-primary-slave.network', '23-test1-bond199.network', '25-bond-active-backup-slave.netdev', '11-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('test1')) + self.assertTrue(self.link_exits('bond199')) + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'bond199']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'primary test1') + + def test_routing_policy_rule(self): + self.copy_unit_to_networkd_unit_path('routing-policy-rule.network', '11-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('test1')) + output = subprocess.check_output(['ip', 'rule']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '111') + self.assertRegex(output, 'from 192.168.100.18') + self.assertRegex(output, 'tos 0x08') + self.assertRegex(output, 'iif test1') + self.assertRegex(output, 'oif test1') + self.assertRegex(output, 'lookup 7') + + def test_address_preferred_lifetime_zero_ipv6(self): + self.copy_unit_to_networkd_unit_path('25-address-section-miscellaneous.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['ip', 'address', 'show', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope link deprecated dummy98') + self.assertRegex(output, 'inet6 2001:db8:0:f101::1/64 scope global') + + def test_ip_route(self): + self.copy_unit_to_networkd_unit_path('25-route-section.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['ip', 'route', 'list', 'dev', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '192.168.0.1') + self.assertRegex(output, 'static') + self.assertRegex(output, '192.168.0.0/24') + + def test_ip_route_blackhole_unreachable_prohibit(self): + self.copy_unit_to_networkd_unit_path('25-route-type.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['ip', 'route', 'list']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'blackhole') + self.assertRegex(output, 'unreachable') + self.assertRegex(output, 'prohibit') + + subprocess.call(['ip', 'route', 'del', 'blackhole', '202.54.1.2']) + subprocess.call(['ip', 'route', 'del', 'unreachable', '202.54.1.3']) + subprocess.call(['ip', 'route', 'del', 'prohibit', '202.54.1.4']) + + def test_ip_route_tcp_window(self): + self.copy_unit_to_networkd_unit_path('25-route-tcp-window-settings.network', '11-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('test1')) + + output = subprocess.check_output(['ip', 'route', 'list']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'initcwnd 20') + self.assertRegex(output, 'initrwnd 30') + + def test_ip_link_mac_address(self): + self.copy_unit_to_networkd_unit_path('25-address-link-section.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['ip', 'link', 'show', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '00:01:02:aa:bb:cc') + + def test_ip_link_unmanaged(self): + self.copy_unit_to_networkd_unit_path('25-link-section-unmanaged.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'unmanaged') + + def test_ipv6_address_label(self): + self.copy_unit_to_networkd_unit_path('25-ipv6-address-label-section.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['ip', 'addrlabel', 'list']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '2004:da8:1::/64') + + def test_sysctl(self): + self.copy_unit_to_networkd_unit_path('25-sysctl.network', '12-dummy.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'forwarding'), '1') + self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'use_tempaddr'), '2') + self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'dad_transmits'), '3') + self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'hop_limit'), '5') + self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'proxy_ndp'), '1') + self.assertEqual(self.read_ipv4_sysctl_attr('dummy98', 'forwarding'),'1') + self.assertEqual(self.read_ipv4_sysctl_attr('dummy98', 'proxy_arp'), '1') + +class NetworkdNetWorkBrideTests(unittest.TestCase, Utilities): + links = ['dummy98', 'test1', 'bridge99'] + + units = ['11-dummy.netdev', '12-dummy.netdev', '26-bridge.netdev', '26-bridge-slave-interface-1.network', + '26-bridge-slave-interface-2.network', 'bridge99.network'] + + def setUp(self): + self.link_remove(self.links) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + + def test_bridge_property(self): + self.copy_unit_to_networkd_unit_path('11-dummy.netdev', '12-dummy.netdev', '26-bridge.netdev', + '26-bridge-slave-interface-1.network', '26-bridge-slave-interface-2.network', + 'bridge99.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('test1')) + self.assertTrue(self.link_exits('bridge99')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'test1']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'master') + self.assertRegex(output, 'bridge') + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'master') + self.assertRegex(output, 'bridge') + + output = subprocess.check_output(['ip', 'addr', 'show', 'bridge99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '192.168.0.15') + self.assertRegex(output, '192.168.0.1') + + output = subprocess.check_output(['bridge', '-d', 'link', 'show', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'cost 400') + self.assertRegex(output, 'hairpin on') + self.assertRegex(output, 'flood on') + self.assertRegex(output, 'fastleave on') + +class NetworkdNetWorkLLDPTests(unittest.TestCase, Utilities): + links = ['veth99'] + + units = ['23-emit-lldp.network', '24-lldp.network', '25-veth.netdev'] + + def setUp(self): + self.link_remove(self.links) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + + def test_lldp(self): + self.copy_unit_to_networkd_unit_path('23-emit-lldp.network', '24-lldp.network', '25-veth.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + output = subprocess.check_output(['networkctl', 'lldp']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'veth-peer') + self.assertRegex(output, 'veth99') + +class NetworkdNetworkRATests(unittest.TestCase, Utilities): + links = ['veth99'] + + units = ['25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth.network'] + + def setUp(self): + self.link_remove(self.links) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + + def test_ipv6_prefix_delegation(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '2002:da8:1:0') + +class NetworkdNetworkDHCPServerTests(unittest.TestCase, Utilities): + links = ['veth99', 'dummy98'] + + units = ['25-veth.netdev', 'dhcp-client.network', 'dhcp-server.network', '12-dummy.netdev', '24-search-domain.network', + 'dhcp-client-timezone-router.network', 'dhcp-server-timezone-router.network'] + + def setUp(self): + self.link_remove(self.links) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + + def test_dhcp_server(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-client.network', 'dhcp-server.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + time.sleep(5) + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '192.168.5.*') + self.assertRegex(output, 'Gateway: 192.168.5.1') + self.assertRegex(output, 'DNS: 192.168.5.1') + self.assertRegex(output, 'NTP: 192.168.5.1') + + def test_domain(self): + self.copy_unit_to_networkd_unit_path( '12-dummy.netdev', '24-search-domain.network') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'Address: 192.168.42.100') + self.assertRegex(output, 'DNS: 192.168.42.1') + self.assertRegex(output, 'Search Domains: one') + + def test_emit_router_timezone(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-client-timezone-router.network', 'dhcp-server-timezone-router.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'Gateway: 192.168.5.*') + self.assertRegex(output, '192.168.5.*') + self.assertRegex(output, 'Europe/Berlin') + +class NetworkdNetworkDHCPClientTests(unittest.TestCase, Utilities): + links = ['veth99', 'dummy98'] + + units = ['25-veth.netdev', 'dhcp-server-veth-peer.network','dhcp-client-ipv6-only.network', + 'dhcp-client-ipv4-only-ipv6-disabled.network', 'dhcp-client-ipv4-only.network', + 'dhcp-client-ipv4-dhcp-settings.network', 'dhcp-client-anonymize.network', + 'dhcp-client-ipv6-rapid-commit.network', 'dhcp-client-route-table.network', + 'dhcp-v4-server-veth-peer.network', 'dhcp-client-listen-port.network', + 'dhcp-client-route-metric.network', 'dhcp-client-critical-connection.network'] + + def setUp(self): + self.link_remove(self.links) + self.stop_dnsmasq(dnsmasq_pid_file) + + def tearDown(self): + self.link_remove(self.links) + self.remove_unit_from_networkd_path(self.units) + self.stop_dnsmasq(dnsmasq_pid_file) + self.remove_lease_file() + self.remove_log_file() + + def test_dhcp_client_ipv6_only(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network','dhcp-client-ipv6-only.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '2600::') + self.assertNotRegex(output, '192.168.5') + + def test_dhcp_client_ipv4_only(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network','dhcp-client-ipv4-only-ipv6-disabled.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertNotRegex(output, '2600::') + self.assertRegex(output, '192.168.5') + + def test_dhcp_client_ipv4_ipv6(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv6-only.network', + 'dhcp-client-ipv4-only.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '2600::') + self.assertRegex(output, '192.168.5') + + def test_dhcp_client_settings(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv4-dhcp-settings.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '12:34:56:78:9a:bc') + self.assertRegex(output, '192.168.5') + self.assertRegex(output, '1492') + + output = subprocess.check_output(['ip', 'route']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'default.*dev veth99 proto dhcp') + + self.search_words_in_file('vendor class: SusantVendorTest') + self.search_words_in_file('client MAC address: 12:34:56:78:9a:bc') + self.search_words_in_file('client provides name: test-hostname') + self.search_words_in_file('26:mtu') + + def test_dhcp6_client_settings_rapidcommit_true(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv6-only.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '12:34:56:78:9a:bc') + + self.assertTrue(self.search_words_in_file('14:rapid-commit')) + + def test_dhcp6_client_settings_rapidcommit_false(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv6-rapid-commit.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '12:34:56:78:9a:bc') + + self.assertFalse(self.search_words_in_file('14:rapid-commit')) + + def test_dhcp_client_settings_anonymize(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-anonymize.network') + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + self.start_dnsmasq() + self.assertFalse(self.search_words_in_file('VendorClassIdentifier=SusantVendorTest')) + self.assertFalse(self.search_words_in_file('test-hostname')) + self.assertFalse(self.search_words_in_file('26:mtu')) + + def test_dhcp_client_listen_port(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-listen-port.network') + dh_server = DHCPServer("dhcp_server") + dh_server.start() + + self.start_networkd() + + self.assertTrue(self.link_exits('veth99')) + + global port + global ip + + self.assertRegex(str(port), '5555') + self.assertRegex(str(ip), '0.0.0.0') + + dh_server.join() + + def test_dhcp_route_table_id(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-v4-server-veth-peer.network', 'dhcp-client-route-table.network') + self.start_networkd() + self.start_dnsmasq() + + self.assertTrue(self.link_exits('veth99')) + + output = subprocess.check_output(['ip', 'route', 'show', 'table', '12']).rstrip().decode('utf-8') + print(output) + + self.assertRegex(output, 'veth99 proto dhcp') + self.assertRegex(output, '192.168.5.1') + + def test_dhcp_route_metric(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-v4-server-veth-peer.network', 'dhcp-client-route-metric.network') + self.start_networkd() + self.start_dnsmasq() + + self.assertTrue(self.link_exits('veth99')) + + output = subprocess.check_output(['ip', 'route', 'show', 'dev', 'veth99']).rstrip().decode('utf-8') + print(output) + + self.assertRegex(output, 'metric 24') + + def test_dhcp_route_criticalconnection_true(self): + self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-v4-server-veth-peer.network', 'dhcp-client-critical-connection.network') + self.start_networkd() + self.start_dnsmasq() + + self.assertTrue(self.link_exits('veth99')) + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + + self.assertRegex(output, '192.168.5.*') + # Stoping dnsmasq as networkd won't be allowed to renew the DHCP lease. + self.stop_dnsmasq(dnsmasq_pid_file) + + # Sleep for 120 sec as the dnsmasq minimum lease time can only be set to 120 + time.sleep(125) + + output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '192.168.5.*') + +if __name__ == '__main__': + unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, + verbosity=3)) |