Commit Graph

26 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek d3472f9b50 test-bpf: rename to test-bpf-firewall
Let's make the name better reflect its scope.
2019-11-10 23:22:15 +01:00
Zbigniew Jędrzejewski-Szmek 2899aac46a core: constify bpf program arrays
In cases where the programs were modified after being initially declared,
reorder operations so that the declaration is already in final form.
2019-11-10 23:22:14 +01:00
Yu Watanabe f5947a5e92 tree-wide: drop missing.h 2019-10-31 17:57:03 +09:00
Kai Lüke fab347489f bpf-firewall: custom BPF programs through IP(Ingress|Egress)FilterPath=
Takes a single /sys/fs/bpf/pinned_prog string as argument, but may be
specified multiple times. An empty assignment resets all previous filters.

Closes https://github.com/systemd/systemd/issues/10227
2019-06-25 09:56:16 +02:00
Evgeny Vereshchagin 6bd1457afe tests: skip test-bpf only when we're 100% sure it's run in containers
This is just a follow-up to https://github.com/systemd/systemd/pull/12617.
2019-05-30 06:11:35 +03:00
Michael Biebl 98a3c188a1 test-bpf: skip test when run inside containers
The test reliably fails inside LXC and Docker when run on a new enough
kernel. It's unclear whether this is a kernel, LXC/Docker or systemd
issue and apparently there is no real interest to get this fixed, so
let's skip this test.
As this also covers Travis CI, there is no need for this additional
check anymore.

See https://github.com/systemd/systemd/issues/9666
2019-05-19 20:57:07 +02:00
Ben Boeckel 5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
Yu Watanabe 01234e1fe7 tree-wide: drop several missing_*.h and import relevant headers from kernel-5.0 2019-04-11 19:00:37 +02:00
Lennart Poettering 3dffcfc78b test-bpf: check if we can mlock() before trying bpf 2019-01-24 23:50:26 +01:00
Evgeny Vereshchagin f9cf349147 travis: skip test-bpf on Travis CI
More generally IPAddress[Allow|Deny] are broken in docker and lxc containers.
2018-12-24 08:49:17 +01:00
Lennart Poettering ed4ac965fa manager: rework test flags set
No reason to avoid bit 0.

Also, fix some tests that pass "true" as flags value, which is just
wrong.
2018-10-09 19:43:43 +02:00
Zbigniew Jędrzejewski-Szmek 6d7c403324 tests: use a helper function to parse environment and open logging
The advantages are that we save a few lines, and that we can override
logging using environment variables in more test executables.
2018-09-14 09:29:57 +02:00
Zbigniew Jędrzejewski-Szmek 317bb217d3 tests: add helper to unify skipping a test and exiting 2018-09-14 09:29:57 +02:00
Yu Watanabe 964bc0ad60 test: log when skipping tests in more cases
Follow-up for the previous commit.
2018-09-13 12:07:34 +02:00
Filipe Brandenburger 55890a40c3 test: remove support for suffix in get_testdata_dir()
Instead, use path_join() in callers wherever needed.
2018-09-12 09:49:03 -07:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek c70cac548a Introduce _cleanup_(manager_freep) 2018-03-11 16:33:57 +01:00
Lennart Poettering 2ae7ee58fa bpf: beef up bpf detection, check if BPF_F_ALLOW_MULTI is supported
This improves the BPF/cgroup detection logic, and looks whether
BPF_ALLOW_MULTI is supported. This flag allows execution of multiple
BPF filters in a recursive fashion for a whole cgroup tree. It enables
us to properly report IP accounting for slice units, as well as
delegation of BPF support to units without breaking our own IP
accounting.
2018-02-21 16:43:36 +01:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Dimitri John Ledkov 02ec6e04fd test-bpf: use /bin/ping path (#7276)
This path to ping is compatible with both debian-like and usr-merged
distros. This keeps the test simple, and should thus pass everywhere.

Fixes: #7267
2017-11-08 20:04:55 +01:00
Yu Watanabe 85e55d14de tree-wide: do not work in assert() (#7271)
Fixes #7270.
2017-11-07 16:04:20 +03:00
Zbigniew Jędrzejewski-Szmek 651d47d14b tests: skip tests when cg_pid_get_path fails (#7033)
v2:
- cast the fstype_t type to ull, because it varies between arches.
  Making it long long should be on the safe side.
2017-10-10 20:55:20 +02:00
Daniel Mack db3a59308c Add test for eBPF firewall code 2017-09-22 15:24:55 +02:00