Commit Graph

1563 Commits

Author SHA1 Message Date
David Wood 7354900ddd network: Fix split in `SendOption=` on client and server
When specifying `DHCPv4.SendOption=`, it is used by systemd-networkd to
set the value of that option within the DHCP request that is sent out.
This differs to setting `DHCPServer.SendOption=`, which will place all
the options together as suboptions into the vendor-specific information
(code 43) option.

This commit adds two new config options, `DHCPv4.SendVendorOption=` and
`DHCPServer.SendVendorOption=`. These both have the behaviour of the old
`DHCPServer.SendOption=` flag, and set the value of the suboption in the
vendor-specific information option.

The behaviour of `DHCPServer.SendOption=` is then changed to reflect
that of `DHCPv4.SendOption=`. It will set the value of the corresponding
option in the DHCP request.
2020-03-19 09:08:40 +01:00
Zbigniew Jędrzejewski-Szmek 8c357762c7
Merge pull request #14749 from msekletar/cpu-aff-numa-v3
core: add support for setting CPUAffinity= to special "numa" value
2020-03-18 13:35:58 +01:00
Zbigniew Jędrzejewski-Szmek 34bc838f15
Merge pull request #15136 from yuwata/network-dhcp4-use-gateway
network: add a flag to ignore gateway provided by DHCP server
2020-03-17 16:51:18 +01:00
Yu Watanabe 74f0fb9095 network: can: add support for listen-only mode
Closes #15129.
2020-03-17 00:32:35 +09:00
Yu Watanabe 0d7bd445d2 test-network: add a test case for DHCPv4.UseGateway=no 2020-03-16 19:34:47 +09:00
Yu Watanabe b453122789 network: add a flag to ignore gateway provided by DHCP server
Closes #15117.
2020-03-16 19:34:43 +09:00
Michal Sekletár e2b2fb7f56 core: add support for setting CPUAffinity= to special "numa" value
systemd will automatically derive CPU affinity mask from NUMA node
mask.

Fixes #13248
2020-03-16 08:57:28 +01:00
Frantisek Sumsal 197298ff9f test: wait a bit after starting the test service
otherwise we might end up being faster than the unit itself, causing
unexpected fails, like:

```
testsuite.sh[297]: + systemctl start issue_14566_test
testsuite.sh[297]: + systemctl status issue_14566_test
testsuite.sh[304]: ● issue_14566_test.service - Issue 14566 Repro
testsuite.sh[304]:      Loaded: loaded (/etc/systemd/system/issue_14566_test.service; static; vendor preset: enabled)
testsuite.sh[304]:      Active: active (running) since Sat 2020-03-14 02:02:23 UTC; 417ms ago
testsuite.sh[304]:    Main PID: 301 ((repro.sh))
testsuite.sh[304]:       Tasks: 1 (limit: 535)
testsuite.sh[304]:      Memory: 180.0K
testsuite.sh[304]:         CPU: 122ms
testsuite.sh[304]:      CGroup: /system.slice/issue_14566_test.service
testsuite.sh[304]:              └─301 [(repro.sh)]
testsuite.sh[307]: ++ cat /leakedtestpid
testsuite.sh[307]: cat: /leakedtestpid: No such file or directory
testsuite.sh[297]: + leaked_pid=
```
2020-03-16 12:28:14 +09:00
Yu Watanabe 970ab1fcc0 test-network: add a test case for HHF 2020-03-12 15:47:03 +09:00
Susant Sahani 7f22402007 network: TC - introduce HHF
Please see https://lwn.net/Articles/577208/
2020-03-12 15:39:12 +09:00
Yu Watanabe 41bb371bb0 test-network: add a test case for PFIFOFast 2020-03-12 15:39:10 +09:00
Susant Sahani 1a95964bfa network: TC - introduce pfifo_fast
pfifo_fast - three-band first in, first out queue

Please see https://linux.die.net/man/8/tc-pfifo_fast
2020-03-12 15:38:18 +09:00
Yu Watanabe 73136507ac test-network: add a test case for PFIFOHeadDrop 2020-03-12 15:38:15 +09:00
Susant Sahani 053a2ddbb2 network: TC - introduce pfifo_head_drop
This adds the required changes to gain access to
the head drop classfull queuing discipline named
pfifo_head_drop.
2020-03-12 15:37:17 +09:00
Yu Watanabe 7b1a31a3d0 test-network: add a test case for BFIFO 2020-03-12 15:37:15 +09:00
Susant Sahani c853f594d4 network: TC - introduce BFIFO
bfifo - Byte limited First In, First Out queue
2020-03-12 15:35:51 +09:00
Yu Watanabe 557fa421ff test-network: add a test case for DRR 2020-03-12 15:35:51 +09:00
Yu Watanabe ad365c5de7 network: tc: introduce DRR class 2020-03-12 15:35:51 +09:00
Susant Sahani f5fc04417e network: TC - introduce DRR
Introduce the Deficit Round Robin Scheduler is a classful queuing discipline as
a more flexible replacement for Stochastic Fairness Queuing.

http://man7.org/linux/man-pages/man8/tc-drr.8.html
2020-03-12 15:35:51 +09:00
Yu Watanabe be94e591fb test-network: add test case for PIE 2020-03-12 15:34:46 +09:00
Susant Sahani bde4ae88c8 network: tc- introduce PIE
Proportional Integral controller-Enhanced (PIE) is a control
theoretic active queue management scheme. It is based on the
proportional integral controller but aims to control delay.

http://man7.org/linux/man-pages/man8/tc-pie.8.html
2020-03-12 13:58:35 +09:00
Anita Zhang c1566ef0d2 core: transition to FINAL_SIGTERM state after ExecStopPost=
Fixes #14566
2020-03-11 10:15:33 +01:00
Frantisek Sumsal e9cdcbed77 test: ignore IAB capabilities in `test-execute`
libcap v2.33 introduces a new capability set called IAB[0] which is shown
in the output of `capsh --print` and interferes with the test checks. Let's
drop the IAB set from the output, for now, to mitigate this.

This could be (and probably should be) replaced in the future by the
newly introduced testing options[1][2] in libcap v2.32, namely:
    --has-p=xxx
    --has-i=xxx
    --has-a=xxx

but this needs to wait until the respective libcap version gets a wider
adoption. Until then, let's stick with the relatively ugly sed.

Fixes: #15046

[0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=943b011b5e53624eb9cab4e96c1985326e077cdd
[1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=588d0439cb6495b03f0ab9f213f0b6b339e7d4b7
[2] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=e7709bbc1c4712f2ddfc6e6f42892928a8a03782
2020-03-09 18:22:16 +01:00
Yu Watanabe a834cb5247
Merge pull request #15036 from yuwata/can-termination-mod
network: add CAN Termination tristate option
2020-03-07 19:11:03 +09:00
Matt Ranostay 52aa38f14a network: add CAN Termination tristate option 2020-03-07 02:00:02 +09:00
Yu Watanabe bba1f90ff5
Merge pull request #14890 from yuwata/network-tc-next
network: tc-next
2020-03-07 01:44:15 +09:00
Yu Watanabe a34811e4ef udev: support to update flow control parameter
Closes #14770.
2020-03-07 01:43:26 +09:00
Yu Watanabe d739fddeb5 network: add setting to support RA without DHCPv6 client
Closes #13991.
2020-03-07 01:39:26 +09:00
Susant Sahani cd305af1fe network: Allow DHCPv6 client to start without router's managed flag. 2020-03-07 01:38:26 +09:00
Chris Down 5bb67b107f
Merge pull request #14956 from ssahani/delegated-prefix-14474
nettwork: introduce delegated prefix assign
2020-03-06 16:13:13 +00:00
Jörg Thalheim ff12a7954c treewide: more portable bash shebangs
As in 2a5fcfae02
and in 3e67e5c992
using /usr/bin/env allows bash to be looked up in PATH
rather than being hard-coded.

As with the previous changes the same arguments apply
- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

In particular this makes testing from git easier on NixOS where do not provide
/bin/bash to improve compose-ability.
2020-03-05 17:27:07 +01:00
Zbigniew Jędrzejewski-Szmek 33eb1f2497 tree-wide: drop printk.devkmsg=on setting in various places
Since 6123dfaa72 this should not be necessary anymore.
2020-03-03 15:02:53 +01:00
Yu Watanabe f6c6af3811 test-network: add a test case for CAKE 2020-03-02 15:59:37 +09:00
Susant Sahani ad8352f4ff network: tc: introduce cake
CAKE (Common Applications Kept Enhanced)

Please see http://man7.org/linux/man-pages/man8/tc-cake.8.html
2020-03-02 15:59:37 +09:00
Yu Watanabe f2c5c1296a test-network: add a test case for sfb 2020-03-02 15:48:24 +09:00
Susant Sahani 982998b087 network: TC introduce sfb - Stochastic Fair Blue
Please see https://www.systutorials.com/docs/linux/man/8-tc-sfb/
2020-03-02 15:48:24 +09:00
Yu Watanabe 95edcf3fac test-network: add a test case for GRED 2020-03-02 15:48:24 +09:00
Susant Sahani 609e8340bb network: TC introduce GRED, Generic Random Early Detection
http://tldp.org/en/Traffic-Control-HOWTO/ar01s06.html
2020-03-02 15:48:24 +09:00
Yu Watanabe bc0769c9f7 test-network: add a test case for PFIFO 2020-03-02 15:48:11 +09:00
Susant Sahani a74760653c network: TC introduce PFIFO 2020-03-02 15:48:00 +09:00
Yu Watanabe f1de1eb3e3 test-network: add test case for HTB class 2020-03-02 15:46:28 +09:00
Yu Watanabe 19f86a6351 network: tc: support HTB class 2020-03-02 15:46:28 +09:00
Yu Watanabe 931c8c824a test-network: add a test case for HTB 2020-03-02 15:46:28 +09:00
Yu Watanabe b934ac3d6e network: tc: support Hierarchy Token Bucket (HTB) 2020-03-02 15:46:28 +09:00
Yu Watanabe 834ea1a466 test-network: remove unnecessary dummy interface 2020-03-02 15:44:03 +09:00
Yu Watanabe 4c2e1833ec test-network: add a test case for [DHCPv4] UseRoutes=no 2020-03-02 01:28:27 +09:00
Yu Watanabe 3c874fd79d test-network: add a test case for [IPv6Prefix] Assign=yes 2020-03-01 00:49:24 +09:00
Susant Sahani bd6379ec57 network: introduce IPv6 prefix assign
Expose a boolean flag to automatically add an address from the delegated prefix to the interface
2020-03-01 00:49:19 +09:00
Nate Jones ecf63c9102 execute: Make '+' exec prefix ignore PrivateTmp=yes
The man pages state that the '+' prefix in Exec* directives should
ignore filesystem namespacing options such as PrivateTmp. Now it does.

This is very similar to #8842, just with PrivateTmp instead of
PrivateDevices.
2020-02-29 19:32:01 +09:00
Yu Watanabe 40afe4916a test-network: add one more test case for VRF= 2020-02-26 19:21:53 +09:00
Yu Watanabe 1d6cfd25a2
Merge pull request #14833 from kpfleming/multiple-ipv6token-addresses
Support multiple IPv6Token 'static' addreses on an interface
2020-02-12 02:10:44 +09:00
Kevin P. Fleming c24c83dc67 network: Allow multiple IPv6Token 'static' items to generate addresses
This patch allows multiple addresses using 'static' IPv6Tokens to
be generated for a single network interface.
2020-02-10 18:40:57 +09:00
Yu Watanabe 38d1255a52 test-network: add tests for qdisc Handle= 2020-02-10 17:49:02 +09:00
Susant Sahani d8b2396d34 network: add support for qdisc handle 2020-02-10 17:48:53 +09:00
Yu Watanabe f7ada4b8ec test-network: tentatively stops .socket units for udevd
To suppress the following warning:
---
Warning: Stopping systemd-udevd.service, but it can still be activated by:
  systemd-udevd-control.socket
  systemd-udevd-kernel.socket
2020-02-10 00:51:00 +09:00
Kevin P. Fleming b241fa00e9 network: Add test for explicit 'static' IPv6Token
Add a test case for an explicitly-specified 'static' IPv6Token.

Signed-off-by: Kevin P. Fleming <kevin@km6g.us>
2020-02-10 00:41:34 +09:00
Frantisek Sumsal 5f04f4e470 test: give systemd chance to actually start the unit
In certain cases the expected enqueue-start-replace-continue
sequence would end up as enqueue-replace-start-continue which causes
unexpected fails even though the serialization/deserialization part
works as expected. As we can't use `--wait` in this case, let's give
sysetmd a second to actually start the unit before replacing it with
another one.

Also, switch from the single-letter test output to a bit verbose format.

Fixes: #14632
2020-02-08 11:38:24 +01:00
Zbigniew Jędrzejewski-Szmek c3b41d8811
Merge pull request #14805 from yuwata/network-ipv6-token-follow-up
network: rename eui64 to static
2020-02-07 17:05:33 +01:00
Yu Watanabe 3d55b5a9de test-network: add test for teql 2020-02-07 17:41:49 +09:00
Yu Watanabe 9b749c11e2 network: tc: support teql
Closes #14792.
2020-02-07 17:41:49 +09:00
Yu Watanabe ab9dc1db47 test-network: add more tests for traffic control 2020-02-07 17:41:43 +09:00
Yu Watanabe f0c1ad308d network: fix ABRT
Fixes #14811 and oss-fuzz#20548.
2020-02-07 17:18:58 +09:00
Yu Watanabe 2ed5f6d5de network: introduce new [QDisc] section to support Parent=ingress
Follow-up for 18de0969c5.
2020-02-07 13:48:54 +09:00
Yu Watanabe e2c4070edf network: rename eui64 to static
See RFC 4291.

Follow-up for 5f506a5560.
2020-02-07 13:30:40 +09:00
Zbigniew Jędrzejewski-Szmek 5bbcff2a1d
Merge pull request #14415 from ssahani/prefixstable-rfc-7217-new
network: Allow to specify multiple IPv6Token for SLAAC
2020-02-05 17:05:33 +01:00
Frantisek Sumsal 9569e38503 test: adapt to the new capsh format
Since libcap v2.29 the format of cap_to_text() has been changed which
makes certain `test-execute` subtest fail. Let's remove the offending
part of the output (dropped capabilities) to make it compatible with
both the old and the new libcap.
2020-02-05 10:11:42 +01:00
Yu Watanabe 87bbebeab6 test-network: add tests for IPv6Token= 2020-02-05 17:44:42 +09:00
Yu Watanabe 641aa41200 test-network: use udevd in build directory
Fixes #14764.
2020-02-05 17:25:35 +09:00
Zbigniew Jędrzejewski-Szmek 427928caa4
network: change "Gateway=dhcp" to "Gateway=_dhcp" (#14774)
This way we avoid confusion with a DNS name. Fixes #14773.
2020-02-05 13:41:30 +09:00
Yu Watanabe f2f1b52c6f
Merge pull request #14767 from yuwata/network-split-qdisc-section
network: split TrafficControlQueueingDiscipline section into small pieces
2020-02-05 13:35:25 +09:00
Zbigniew Jędrzejewski-Szmek ca58d00c68 network: FairQueueTrafficPolicing→FairQueueing
This never made into a release, so we can change the name with impunity.
Suggested by Davide Pesavento.

I opted to add the "ing" ending. "Fair queuing" is the name of the general
concept and algorithm, and "Fair queue" is mostly used for the implementation
name.
2020-02-04 17:37:16 +01:00
Zbigniew Jędrzejewski-Szmek 60ed2dcfc7 network: TokenBufferFilter→TokenBucketFilter
This never made into a release, so we can change the name with impunity.
Noticed by Davide Pesavento.
2020-02-04 17:28:15 +01:00
Yu Watanabe 18de0969c5 network: split TrafficControlQueueingDiscipline section into small pieces
Closes #14763.
2020-02-04 21:45:39 +09:00
Yu Watanabe 41fd8fe716 test-network: add a test case for IPv6PrefixDelegation.DNS=linklocal 2020-02-04 13:57:12 +09:00
Yu Watanabe bf2334c054 udev: add {Receive,Transmit}ChecksumOffload= settings
Closes #14661.
2020-02-03 12:31:31 +09:00
Naïm Favier 53e1ba280f
network: add SuppressPrefixLength option to RoutingPolicyRule (#14736)
Closes #14724.
2020-02-03 08:25:48 +09:00
David Michael 649916d356 sysusers: support creating users with a specific primary group
This extends the "uid:gid" syntax for "u" lines so that a group
name can be given instead of a GID.  This requires that the group
is either queued for creation by sysusers, or it is already defined
on the system.

Closes #14340
2020-02-02 16:53:22 +01:00
Yu Watanabe 6be8e78e32 test-network: add test for UID based routing policy 2020-02-02 22:43:38 +09:00
Yu Watanabe ea471a4695 network: support UID based routing policy
Closes #14666.
2020-02-02 22:43:38 +09:00
Frantisek Sumsal 2273ecfeda test: don't install /etc/securetty
Having /etc/securetty in test containers prevents root from logging into
them:

```
Jan 31 10:15:11 systemd-testsuite login[69]: pam_securetty(login:auth): access denied: tty 'pts/0' is not secure !
Jan 31 10:15:11 systemd-testsuite login[69]: FAILED LOGIN 1 FROM pts/0 FOR root, Authentication failure
```
2020-02-01 11:55:17 +01:00
Lennart Poettering db23d83bd4 test: add simple test for log namespaces 2020-01-31 15:04:05 +01:00
Evgeny Vereshchagin 9a1862bfa6 tests: unset LD_PRELOAD in testsuite.service when it's run under ASan
This should help to address the "grep" issue we ran into in
https://github.com/systemd/systemd-centos-ci/pull/217.
2020-01-31 13:13:04 +01:00
Lennart Poettering 6ead39170a test: add test case for homed 2020-01-28 22:36:51 +01:00
Yu Watanabe a05a6e8bba test-network: fix test_qdisc2()
quantum and initial_quantum may suffixed with 'b'.
2020-01-28 22:33:31 +01:00
Yu Watanabe 11a182aa1e test: drop sector-size line from output of sfdisk
The following commit adds 'sector-size' line to the output of sfdisk
command:
e56ca06815

Fixes #14664.
2020-01-28 15:16:13 +01:00
dann frazier 37b9966e25 test: Synchronize journal before reading from it
There's a race condition in the sysuser test where it may try to read
entries from the journal before they are available. Fix it by adding a
`journalctl --sync` call.

BugLink: https://bugs.launchpad.net/bugs/1776654
2020-01-28 15:11:58 +01:00
Zbigniew Jędrzejewski-Szmek 5e176a4dee Merge pull request #14368 from poettering/repart 2020-01-23 19:07:02 +01:00
Lennart Poettering 2f62a8c688 test: add repart test 2020-01-20 17:42:03 +01:00
Lennart Poettering e56a8790a0 test: add test for https://github.com/systemd/systemd/issues/14560 2020-01-20 17:19:51 +01:00
Dan Streetman 0c020321c8 test-network: simplify wait_online() by calling wait_operstate()
The wait_operstate() function now rechecks the condition for a timeout,
so the wait_online() function can simply call it to check for the
setup_state.
2020-01-09 15:19:19 -05:00
Dan Streetman a4632dc7d1 test-network: convert wait_operstate() to recheck condition for timeout seconds
Failing after a single check leads to extra sleeps scattered through
test cases, and can also lead to false failures.  Instead perform a
recheck for a number of seconds until the state matches, and fail only
if the timeout is exceeded.

This allows removing all the manual sleeps in the testcases.
2020-01-09 15:19:19 -05:00
Dan Streetman 19cf3143cf test-network: rename check_operstate() to wait_operstate()
Rename only, no functional change; this makes following patches easier
to read.
2020-01-09 15:19:19 -05:00
Lennart Poettering 0aa9bffe10
Merge pull request #14448 from yuwata/network-permanent-mac-address
network, udev: support permanent mac address
2020-01-08 15:36:27 +01:00
Zbigniew Jędrzejewski-Szmek 629548c405
Merge pull request #14488 from yuwata/networkctl-show-logs
networkctl: status command also shows logs of networkd
2020-01-08 10:49:39 +01:00
Yu Watanabe 4bb7cc8287 network, udev: introduce PermanentMACAddress= setting in [Match] section
Closes #13983.
2020-01-08 17:54:54 +09:00
Anita Zhang ffe61e19cb
Merge pull request #14472 from poettering/test-43-fixes
Various robustness fixes for TEST-43-PRIVATEUSER-UNPRIV
2020-01-07 10:53:13 -08:00
Yu Watanabe fc79e6ff5e test-network: suppress logs in status command 2020-01-07 22:20:43 +09:00
Yu Watanabe 214c5bae09 test-network: add test for Gateway=DHCP 2020-01-07 19:11:19 +09:00
Lennart Poettering f9aefc91f1 testsuite: drop "systemctl is-system-running --wait" invocation
We wait for "basic.target" being reached in the user instance anyway
before allowing the user's session to start, hence doing such a wait is
unnecessary, since that would just mean we'd wait for "default.target"
on top of "basic.target", but we shouldn#t need anything of that...

Hence, let's simplify this, reduce explicit sync points.
2020-01-06 13:41:56 +01:00
Lennart Poettering e9786a5c01 test: don't rely on "nobody" user for TEST-43
The name is not as universal as we want, still, hence let's use our own
user we create with sysusers.d/. That should yield same behaviour
everywhere (and also test sysusers a bit as side effect).
2020-01-06 13:25:33 +01:00
Lennart Poettering 6e0ed2865e test: hardcode shell to use
let's make sure we always invoke our commands through /bin/sh, since
on some distros su will use /bin/nologin (or whatever is listed in
/etc/passwd) as shell otherwise and we don#t want that.
2020-01-06 13:25:33 +01:00
Lennart Poettering ff963ea6ba test: use symlinks for Makefiles
for some reason the newer tests used file copyies instead of symlinks.
let's fix that.
2020-01-03 21:36:58 +01:00
Lennart Poettering dc5737470e
Merge pull request #14194 from yuwata/network-multipath-routing-12541
network: introduce multipath routing
2020-01-03 15:38:03 +01:00
Lennart Poettering 49d418d4ab
Merge pull request #14444 from yuwata/network-codel-more
network: more CoDel settings
2020-01-02 14:51:55 +01:00
Lennart Poettering cb68406c6a
Merge pull request #14441 from GothAck/gothack_type.d_dropin_test_master
Fix type.d drop-in ordering for #14439 - duplicate against master
2020-01-02 13:41:16 +01:00
Yu Watanabe a3d3565451 test-network: add a test case for CoDel 2019-12-28 22:25:49 +09:00
Yu Watanabe b078e52855 network: add more settings for CoDel 2019-12-28 22:25:12 +09:00
Susant Sahani c695dcf929 network: Add support to configure DHCPv4 route MTU
This is useful for transitioning systems from small frames to jumbo frames.

Closes #14302
2019-12-28 21:37:26 +09:00
Susant Sahani a9a5d632da network: tc introduce codel
Please see http://man7.org/linux/man-pages/man8/tc-codel.8.html
2019-12-28 21:35:39 +09:00
Greg "GothAck" Miell f5dd6e50a7 Add failing test to show service.d global drop-in does not get overridden by more specific dropins 2019-12-27 14:53:32 +00:00
Yu Watanabe 0fd8b71809 test-network: add a test case for DHCPv4.SendDecline= 2019-12-21 00:26:44 +09:00
Susant Sahani 0f3ff4eae2 network: DHCP4 introduce send decline 2019-12-21 00:26:44 +09:00
Anita Zhang b6657e2c53 test: add test case for PrivateDevices=y and Group=daemon
For root, group enforcement needs to come after PrivateDevices=y set up
according to 096424d123. Add a test to
verify this is the case.
2019-12-18 11:09:30 -08:00
Anita Zhang e5f10cafe0 core: create inaccessible nodes for users when making runtime dirs
To support ProtectHome=y in a user namespace (which mounts the inaccessible
nodes), the nodes need to be accessible by the user. Create these paths and
devices in the user runtime directory so they can be used later if needed.
2019-12-18 11:09:30 -08:00
Filipe Brandenburger a49ad4c482 core: add test case for PrivateUsers=true in user manager
The test exercises that PrivateTmp=yes and ProtectHome={read-only,tmpfs}
directives work as expected when PrivateUsers=yes in a user manager.

Some code is also added to test-functions to help set up test cases that
exercise the user manager.
2019-12-18 11:09:30 -08:00
Yu Watanabe de697db05b network: introduce AddPrefixRoute= and deprecate PrefixRoute=
PrefixRoute= was added by e63be0847c,
but unfortunately, the meaning of PrefixRoute= is inverted; when true
IFA_F_NOPREFIXROUTE flag is added. This introduces AddPrefixRoute=
setting.
2019-12-18 16:32:31 +01:00
Yu Watanabe a0ce990e71 test-network: add test case for multipath routing 2019-12-18 22:12:57 +09:00
Yu Watanabe 6ff5cc6b7a network: introduce multipath route
Closes #12541.
2019-12-18 22:12:57 +09:00
Topi Miettinen 7a670b1dd9 shared/dropin: fix assert for invalid drop-in
Don't try to show top level drop-in for non-existent units or when trying to
instantiate non-instantiated units:

$ systemctl cat nonexistent@.service
Assertion 'name' failed at src/shared/dropin.c:143, function unit_file_find_dirs(). Aborting.
$ systemctl cat systemd-journald@.service
Assertion 'name' failed at src/shared/dropin.c:143, function unit_file_find_dirs(). Aborting.
2019-12-18 08:43:40 +01:00
Yu Watanabe 6e5df4036f
Merge pull request #14337 from yuwata/network-tc-fq-more
network: tc: introduce more FQ settings
2019-12-17 23:30:10 +09:00
Anita Zhang 1209ef94bd [import] fix stdin/stdout pipe behavior in import/export tar/raw
The code existed in machinectl to use stdin/stdout if the path for
import/export tar/raw was empty or dash (-) but a check to
`fd_verify_regular` in importd prevented it from working.

Update the check instead to explicitly check for regular file or
pipe/fifo.

Fixes #14346
2019-12-17 23:14:53 +09:00
Yu Watanabe ef1d2c07f9 udev: introduce AlternativeNamesPolicy= setting 2019-12-17 15:44:43 +09:00
Lennart Poettering 3b5cd25f4d
Merge pull request #14196 from keszybz/gpt-auto-generator-debugging
gpt-auto-generator debugging
2019-12-16 09:24:02 +01:00
Yu Watanabe 7a2f6fb6f1 test-network: pass environment variables to networkctl 2019-12-16 10:56:02 +09:00
Yu Watanabe 6934ace05d test-network: add a test case for netdev altname 2019-12-16 10:56:02 +09:00
Yu Watanabe a5053a158b udev: support AlternativeName= setting in .link file 2019-12-16 10:52:22 +09:00
Yu Watanabe 4ef289250f test-network: add a test case for new FQ settings 2019-12-14 12:33:37 +09:00
Yu Watanabe e83562e51e network: tc: add more settings for FQ 2019-12-13 23:36:17 +09:00
Yu Watanabe 2e048b14eb
Merge pull request #13915 from ddstreet/ipv6_mtu
Set ipv6 mtu after link-up or device mtu change
2019-12-13 18:33:04 +09:00
Yu Watanabe f7c79f0911
Merge pull request #14320 from yuwata/network-tc-fq_codel-more
network: tc: introduce more FQ-CoDel settings
2019-12-13 11:09:36 +09:00
Christian Ehrhardt eae1ef076d test: increase qemu timeout for TEST-08 and TEST-09
These tests two have shown to be flaky in Ubuntu test infrastructure,
but got more reliable with increased timeouts of 300 seconds each.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-12-12 19:42:04 +01:00
Shengjing Zhu 679ecd3616 nspawn: allow combination of private-network and network-namespace-path
Fixes: #14289
2019-12-12 19:26:32 +01:00
Lennart Poettering 3e761fe2c9
Merge pull request #14321 from yuwata/network-generator-14319
network-generator: allow empty hostname
2019-12-12 17:52:09 +01:00
Yu Watanabe 9401e48855 test-network: add a test case for the new settings of FQ-CoDel 2019-12-12 23:37:03 +09:00
Yu Watanabe ac810b75c1 network: tc: support more attributes for FQ-CoDel 2019-12-12 23:36:48 +09:00
Yu Watanabe dd1e09971b test: add a test case for network-generator 2019-12-12 19:02:25 +09:00
Yu Watanabe 0baddbd5ee test-network: add a test case for FQ 2019-12-12 17:26:31 +09:00
Susant Sahani 7234b91596 network tc: inroduce FQ - Fair Queue traffic policing
Please see http://man7.org/linux/man-pages/man8/tc-fq.8.html
2019-12-12 17:26:20 +09:00
Yu Watanabe 40821c2ac3 test-network: add a test case for fq-codel 2019-12-11 00:06:31 +09:00
Susant Sahani 4e5ef14919 network tc: Add support to conkfigure CoDel - Controlled-Delay Active Queue Management algorithm
```
$ tc qdisc show dev dummy99
qdisc fq_codel 8005: dev dummy99 root refcnt 2 limit 1000p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn
$ network cat dumm99.network
[Match]
Name=dummy99

[TrafficControlQueueingDiscipline]
Parent=root
FairQueuingControlledDelayPacketLimit=1000

```
2019-12-11 00:06:31 +09:00
Yu Watanabe bfb68540d5
Merge pull request #14280 from yuwata/network-tbf-more
network: tc: add more options for TBF
2019-12-11 00:02:43 +09:00
Yu Watanabe 886e07a9cf test-network: add tests for new TBF settings 2019-12-10 01:28:38 +09:00
Yu Watanabe dcfc23ae77 network: tc: add more options for TBF 2019-12-10 01:28:38 +09:00
Yu Watanabe 0810e6d787 test-network: add a test case for SendOption= 2019-12-10 01:28:09 +09:00
Yu Watanabe bc942f69aa test-network: make test_bind_carrier more stable 2019-12-08 19:52:01 +00:00
Yu Watanabe debda5a4e5
Merge pull request #14273 from ssahani/ifb
network: introduce IFB
2019-12-08 05:13:08 +09:00
Yu Watanabe b076d5d76d test-network: add test case for IFB 2019-12-08 00:03:29 +09:00
Yu Watanabe dc7d3c5fd4 test-network: add test case for IPv4 DAD 2019-12-06 23:29:28 +09:00
Dan Streetman 7db0544705 test-network: add tests to verify IPv6MTUBytes 2019-12-05 17:53:10 -05:00
Dan Streetman 3e82152543 test-network: disable restart limiting for networkd
Some of the tests restart networkd rapidly, so restart limiting
must be disabled to avoid start ratelimiting from causing test
failures.
2019-12-05 17:53:10 -05:00
Dan Streetman fd372b1a68 test-network: in wait_online() allow a few seconds to reach setup_state 2019-12-05 17:53:03 -05:00
Dan Streetman befd4b8b60 test-network: read link attribute at any depth 2019-12-05 17:50:15 -05:00
Dan Streetman 9dfc1a9339 test-network: allow specifying only individual drop-in files 2019-12-05 17:50:10 -05:00
Yu Watanabe 0ab9279132 test-network: add a test case for SFQ 2019-12-04 20:58:33 +09:00
Susant Sahani 9942b71089 network: tc introduce sfq - Stochastic Fairness Queueing
Stochastic Fairness Queueing is a classless queueing discipline.
SFQ does not shape traffic but only schedules the transmission of packets, based on 'flows'.
The goal is to ensure fairness so that each flow is able to send data in turn,
thus preventing any single flow from drowning out the rest.
2019-12-04 20:58:17 +09:00
Yu Watanabe 1b628c4f64 test-network: add test case for TBF 2019-12-04 20:57:48 +09:00
Susant Sahani ba5841b520 networkd tc: introduce tbf
See https://linux.die.net/man/8/tc-tbf
2019-12-04 20:55:48 +09:00
Zbigniew Jędrzejewski-Szmek 46c41478c9 tree-wise: standarize on "auto-detection" spelling 2019-11-30 17:42:13 +01:00
Lennart Poettering 5bb4503d3a test-functions: make sure we use the right library path for binaries without RPATH
Meson appears to set the rpath only for some binaries it builds, but not
all. (The rules are not clear to me, but that's besides the point of
this commit).

Let's make sure if our test script operates on a binary that has no
rpath set we fall back preferably to the BUILD_DIR rather than directly
to the host.

This matters if a test uses a libsystemd symbol introduced in a version
newer than the one on the host. In that case "ldd" will not work on the
test binary if rpath is not set. With this fix that behaviour is
corrected, and "ldd" works correctly even in this case.

(Or in other words: before this fix on binaries lacking rpath we'd base
dependency info on the libraries of the host, not the buidl tree, if
they exist in both.)
2019-11-28 09:20:40 +01:00
Zbigniew Jędrzejewski-Szmek 83dbb4df99 fuzz-unit-file: add new items to the corpus 2019-11-25 14:02:58 +01:00
Lennart Poettering 4e67759960 core: be more lenient when checking whether sandboxing is necessary
In some containers unshare() is made unavailable entirely. Let's deal
with this that more gracefully and disable our sandboxing of services
then, so that we work in a container, under the assumption the container
manager is then responsible for sandboxing if we can't do it ourselves.

Previously, we'd insist on sandboxing as soon as any form of BindPath=
is used. With this change we only insist on it if we have a setting like
that where source and destination differ, i.e. there's a mapping
established that actually rearranges things, and thus would result in
systematically different behaviour if skipped (as opposed to mappings
that just make stuff read-only/writable that otherwise arent').

(Let's also update a test that intended to test for this behaviour with
a more specific configuration that still triggers the behaviour with
this change in place)

Fixes: #13955

(For testing purposes unshare() can easily be blocked with
systemd-nspawn --system-call-filter=~unshare.)
2019-11-20 12:30:04 +01:00
Lennart Poettering b82e818f5c test: make sure our tests get exclusive TTY access
This sould make our test suite a bit more robust if it is slow running.
A few of our test services use StandardOutput=tty or StandardError=tty
in the tests in order to connect test services to the container console.
This gets into conflict with the container getty which wants exclusive
access to the console. Since the container getty is started with
Type=idle it typically gets started after a timeout only if the TTY is
already used, which hence introduces a race: if the test finishes
earlier all is good, if not, then the test gets kicked off the TTY which
then causes bash to abort since it cannot write any error messages
anymore.

Let's fix this hence: all tests that connect to the tty are now
synchronized to getty-pre.target, so they finish before any getty is
started.
2019-11-20 09:39:54 +01:00
Yu Watanabe d8b736bd0c network: rename SendRawOption= to SendOption=
As DHCPv4.SendOption= and DHCPServer.SendRawOption= take the same
format.
2019-11-18 23:35:48 +09:00
Lennart Poettering 8af381679d
Merge pull request #13940 from keur/protect_kernel_logs
Add ProtectKernelLogs to systemd.exec
2019-11-15 16:26:10 +01:00
Filipe Brandenburger 14e0259b49 test: Disable LUKS devices from initramfs in QEMU tests
We currently use the host's kernel and initramfs in our QEMU tests.

If the host is running on an encrypted LUKS partition, then the initramfs
will have a crypttab setup looking for the particular root disk it needs to
encrypt before booting into the system.

However, this disk obviously doesn't exist in our QEMU VM, so it turns out
our tests end up waiting for this device to become available, which will
never actually happen, and boot hangs for 90s until that service times out.

[***   ] A start job is running for /dev/disk/by-uuid/01234567-abcd-1234-abcd-0123456789ab (20s / 1min 30s)

In order to prevent this issue, let's pass "rd.luks=0" to disable LUKS in
the initramfs only as part of our default kernel command-line in our QEMU
tests.

This is enough to disable this behavior and prevent the timeout, while at
the same time doesn't conflict with our tests that actually check for LUKS
behavior in the systemd running under test (such as TEST-02-CRYPTSETUP).

Tested: `sudo make -C TEST-02-CRYPTSETUP/ clean setup run`
2019-11-13 19:55:18 -08:00
Kevin Kuehler 07cab0f72b tests: Add capability tests for ProtectKernelLogs 2019-11-11 12:12:02 -08:00
Anita Zhang 3e1db806b0 core: change top-level drop-in from -.service.d to service.d
Discussed in #13743, the -.service semantic conflicts with the
existing root mount and slice names, making this feature not
uniformly extensible to all types. Change the name to be
<type>.d instead.

Updating to this format also extends the top-level dropin to
unit types.
2019-11-07 08:34:53 +01:00
Yu Watanabe c631c3d6a3
Merge pull request #13939 from yuwata/network-fix-memleak-and-13938
network: fix memleak and invalid free function
2019-11-05 20:16:06 +09:00
Lorenz Bauer 09d0b46ab6 journal: refresh cached credentials of stdout streams
journald assumes that getsockopt(SO_PEERCRED) correctly identifies the
process on the remote end of the socket. However, this is incorrect
according to man 7 socket:

    The returned  credentials  are  those that were in effect at the
    time of the call to connect(2) or socketpair(2).

This becomes a problem when a new process inherits the stdout stream
from a parent. First, log messages from the child process will
be attributed to the parent. Second, the struct ucred used by journald
becomes invalid as soon as the parent exits. Further sendmsg calls then
fail with ENOENT. Logs for the child process then vanish from the journal.

Fix this by using recvmsg on the stdout stream, and refreshing the cached
struct ucred if SCM_CREDENTIALS indicate a new process.

Fixes #13708
2019-11-05 10:41:03 +01:00
Yu Watanabe c1ed516cde test: add testcase for issue #13938 2019-11-05 10:49:07 +09:00
Dan Streetman 426654d728 test-network: Remove/replace non-capturing group regex
The systemd-networkd-tests.py has some regex that uses non-capturing
groups, but there is no need to use that with assertRegex; the
groups aren't referenced so it doesn't matter if it's capturing or
non-capturing.  However, there are a few places where optional groups
should have been used instead, so this changes that.

Specifically, groups like this:
(?:whatever |)
should actually be:
(whatever )?

Additionally, this is specifically needed for these tests to run on
Debian systems, because this assertRegex:
'Link File: (?:/usr)/lib/systemd/network/99-default.link'
needs to be:
'Link File: (/usr)?/lib/systemd/network/99-default.link'
2019-11-01 12:32:49 -04:00
Dan Streetman 7471bcb06e test: check /usr/lib and /lib for systemd binaries
Fedora uses /usr/lib while Debian uses /lib; find the right location
2019-11-01 12:00:57 -04:00
Dan Streetman 856423f14d test/test-network/systemd-networkd-tests.py: suppress stderr for functionality checks 2019-11-01 12:00:53 -04:00
Susant Sahani b9c5aa3c65 qdisc: netem add support to duplicate packets.
using this option the chosen percent of packets is duplicated before
queuing them
2019-10-31 10:36:28 +01:00
Susant Sahani 564ca98484 networkd: dhcp server Support Vendor specific 43
Implementes https://tools.ietf.org/html/rfc2132

```
[DHCPServer]
SendRawOption=26:uint32:1400
SendRawOption=23:uint8:10

```
Frame 448: 350 bytes on wire (2800 bits), 350 bytes captured (2800 bits) on interface 0
Linux cooked capture
Internet Protocol Version 4, Src: 192.168.5.1, Dst: 192.168.5.11
User Datagram Protocol, Src Port: 67, Dst Port: 68
Dynamic Host Configuration Protocol (ACK)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x71f8de9d
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 192.168.5.11
    Next server IP address: 0.0.0.0
    Relay agent IP address: 0.0.0.0
    Client MAC address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (ACK)
        Length: 1
        DHCP: ACK (5)
    Option: (51) IP Address Lease Time
        Length: 4
        IP Address Lease Time: (3600s) 1 hour
    Option: (1) Subnet Mask (255.255.255.0)
        Length: 4
        Subnet Mask: 255.255.255.0
    Option: (3) Router
        Length: 4
        Router: 192.168.5.1
    Option: (6) Domain Name Server
        Length: 4
        Domain Name Server: 192.168.5.1
    Option: (42) Network Time Protocol Servers
        Length: 4
        Network Time Protocol Server: 192.168.5.1
    Option: (101) TCode
        Length: 13
        TZ TCode: Europe/Berlin
    Option: (43) Vendor-Specific Information
        Length: 9
        Value: 1701311a0431343030
    Option: (54) DHCP Server Identifier (192.168.5.1)
        Length: 4
        DHCP Server Identifier: 192.168.5.1
    Option: (255) End
        Option End: 255

```
2019-10-31 09:03:43 +09:00
Zbigniew Jędrzejewski-Szmek 864edb39cf network: rename SendOptions= to SendOption=
The name with plural made more sense where multiple options could be specified
in one line. After changes in the pull request, this option only accepts one
value, so from users' POV it should be singular.

(The field in the data structure remains plural, because it actually stores
multiple values.)
2019-10-30 08:56:18 +01:00
Yu Watanabe ef3c8a92b7 test-network: add tests for qdisc 2019-10-30 09:33:51 +09:00
Susant Sahani 0f5bd7fe24 network: introduce TrafficControl
Add network delay to a interface
2019-10-30 09:33:51 +09:00
Zbigniew Jędrzejewski-Szmek a5f6f346d3
Merge pull request #13423 from pwithnall/12035-session-time-limits
Add `RuntimeMaxSec=` support to scope units (time-limited login sessions)
2019-10-28 14:57:00 +01:00
Philip Withnall 9ed7de605d scope: Support RuntimeMaxSec= directive in scope units
Just as `RuntimeMaxSec=` is supported for service units, add support for
it to scope units. This will gracefully kill a scope after the timeout
expires from the moment the scope enters the running state.

This could be used for time-limited login sessions, for example.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #12035
2019-10-28 09:44:31 +01:00
Yu Watanabe 78404d22cc network: support matching based on wifi interfece type 2019-10-25 16:43:18 +09:00
Zbigniew Jędrzejewski-Szmek 1048436869
Merge pull request #13452 from yuwata/network-reload
network: add networkctl reload and reconfigure
2019-10-24 11:07:24 +02:00
Yu Watanabe 235ecb6d75 test: drop duplicated 's'
This fixes the following log message
```
Container TEST-07-ISSUE-1981 terminated by signal KILL.
E: test timed out after 30s s
```
2019-10-24 08:39:31 +02:00
Yu Watanabe dcd9f07ccf network: add tests for "networkctl reconfigure" 2019-10-24 14:23:17 +09:00
Yu Watanabe 66de86712c test-network: add tests for "networkctl reload" 2019-10-24 14:20:48 +09:00
Zbigniew Jędrzejewski-Szmek 510c4bb31f
Merge pull request #13142 from yuwata/network-wifi-ssid-support-nl80211
network: wifi ssid support with nl80211
2019-10-23 14:51:23 +02:00
Dan Streetman dfec314d41 test: correct TEST-41 StartLimitBurst test
TEST-41 verifies that the StartLimitBurst property will correctly
limit the number of unit restarts, but the test currently doesn't
adjust the StartLimitIntervalSec which defaults to 10 seconds.

On Ubuntu CI, running under un-accelerated qemu, it can take more than
10 seconds to perform all 3 restarts, which avoids the burst limit,
and fails the test.

Instead, specify a long StartLimitIntervalSec in the test, so we can
be sure to correctly test StartLimitBurst even on slow testbeds.

Fixes #13794.
2019-10-18 15:51:43 -04:00
David Tardon 02baf239d8 add test for ExecStopPost
This is a follow-up to #4843.
2019-10-18 16:13:47 +02:00
Dan Streetman 626fbf7f70 test: blacklist TEST-41 on Ubuntu CI
This test has been failing on Ubuntu CI since introduced, let's
blacklist it until we can debug what's causing it to fail.
2019-10-18 15:21:32 +02:00
Jan Synacek a7ab6b7e6b rule-syntax-check: add CONST 2019-10-18 10:02:35 +09:00
Chris Down 959daf9bfc
Merge pull request #13743 from anitazha/dropin_all_the_things
core: support top level drop-ins through -.service.d for service units
2019-10-16 23:10:05 -04:00
Anita Zhang d727acb650
Merge pull request #13754 from claudiozz/master
Allow restart for oneshot units
2019-10-16 14:21:59 -07:00
Claudio Zumbo 10e72727ee Allow restart for oneshot units
Picked up from https://github.com/systemd/systemd/pull/7474 , so
coauthored by @robermorales.
2019-10-16 09:44:20 -07:00
Zbigniew Jędrzejewski-Szmek c8966bffdd
Merge pull request #13663 from ssahani/dhcp-send-option-data
network: DHCPv4 client- add support to send arbitary option and data
2019-10-16 11:31:22 +02:00
Anita Zhang d272467882 shared/dropin: support -.service.d/ top level drop-in for service units
Closes #12830
2019-10-15 11:14:54 -07:00
Yu Watanabe 277ba8d1ab network: add support matching based on BSSID= 2019-10-15 01:59:56 +09:00
Yu Watanabe 8d968fdd99 network: support matching based on wifi SSID 2019-10-15 01:59:06 +09:00
Yu Watanabe 7acb7707ff test-network: disable IPv6AcceptRA= to speed up tests 2019-10-15 00:14:09 +09:00
Susant Sahani cb29c15605 network: DHCPv4 client: add support to send arbitary option and data 2019-10-15 00:14:02 +09:00
Yu Watanabe 086bcf5dca test-network: add a test case for nexthop 2019-10-14 21:55:57 +09:00