Yu Watanabe [Thu, 10 Feb 2022 07:14:21 +0000 (16:14 +0900)]
test-dhcp6-client: cleanups
This does many cleanups. Most prominently,
- check the sents packet more strictly,
- make the packets used in the test more readable,
- unify callbacks.
Yu Watanabe [Mon, 7 Feb 2022 15:30:56 +0000 (00:30 +0900)]
fuzz-dhcp6-client: test multiple states
Then, now all three paths client_process_information(),
client_process_reply(), and client_process_advertise_or_rapid_commit_reply()
in client_receive_message() are fuzzed.
Yu Watanabe [Thu, 10 Feb 2022 12:44:28 +0000 (21:44 +0900)]
sd-dhcp6-client: append extra options before elapsed time option
The value of elapsed time option is determined in runtime and not
deterministic. It is hard to test the sent packets if it is located
in the intermidiate of the packet.
Yu Watanabe [Mon, 7 Feb 2022 14:36:49 +0000 (23:36 +0900)]
network: do not restart DHCPv6 client when it is already running in managed mode
Otherwise, if a network has two router and one provides M flag and the
other provides O flag, then the DHCPv6 client switches the running mode
repeatedly. That makes the IPv6 network configuration of the host
unstable.
Yu Watanabe [Sun, 6 Feb 2022 17:48:03 +0000 (02:48 +0900)]
sd-dhcp6-client: drop unnecessary event_source_disable()
The event source will be soon re-enabled in the same function.
The function client_timeout_resend() may return earlier without
re-enabling the timer souce. However,
- the timer event source is one shot by default. Hence, it is not
necessary to disable in the callback function,
- when it returns early, then client_set_state() or client_stop() is
called before return, and they re-ernable or disable the timer.
Yu Watanabe [Sun, 6 Feb 2022 17:36:55 +0000 (02:36 +0900)]
sd-dhcp6-client: set lease expiration timer in client_enter_bound_state()
The timer must be active until the client get re-enter bound state,
and the timeout must be determined by the lease acquired when entering
the bound state.
Yu Watanabe [Sun, 6 Feb 2022 14:51:43 +0000 (23:51 +0900)]
sd-dhcp6-client: fix lifetime handling
This fixes the following issues:
- if T1 is finite and T2 is infinite, then the timer for T1 was not
enabled,
- after T1 and T2 are randomized, T1 may be longer than T2.
Yu Watanabe [Sun, 6 Feb 2022 12:59:07 +0000 (21:59 +0900)]
sd-dhcp6-client: introduce client_process_*()
This is mostly for shortening `client_receive_message()`.
This also fixes the following:
- do not trigger SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST notification
when non-reply message,
- add several missing error handlings caused in client_start().
Joerie de Gram [Tue, 8 Feb 2022 13:56:26 +0000 (22:56 +0900)]
network: attempt to trigger kernel IPv6LL address generation
Try to ensure kernel IPv6 link local address generation occurs by
setting the per-if addr_gen_mode sysctl when the link is already up,
instead of the netlink interface (IFLA_INET6_ADDR_GEN_MODE).
The netlink setting is sufficient in cases where the interface is not
yet up when networkd configures an interface - bringing the interface
up will trigger in-kernel address generation.
If the interface is already up, yet the interface has no IPv6LL assigned
setting IFLA_INET6_ADDR_GEN_MODE has no effect.
Writing the addr_gen_mode sysctl is a best effort attempt at triggering
address generation regardless of interface state because it also works
in cases where the interface is already up.
Alvin Šipraga [Thu, 10 Feb 2022 07:19:28 +0000 (08:19 +0100)]
udev/net: support Match.Firmware= in .link files (#22462)
In cbcdcaaa0ec5 ("Add support for conditions on the machines firmware")
a new Firmware= directive was added for .netdev and .network files.
While it was also documented to work on .link files, in actual fact the
support was missing. Add that one extra line to make it work, and also
update the fuzzer directives.
Luca Boccassi [Tue, 8 Feb 2022 13:19:52 +0000 (13:19 +0000)]
meson: disable export-dbus-interfaces target when cross-compiling
ERROR:
Cannot use target systemd as a generator because it is built for the
host machine and no exe wrapper is defined or needs_exe_wrapper is
true. You might want to set `native: true` instead to build it for
the build machine.
Santa Wiryaman [Mon, 3 May 2021 22:48:26 +0000 (18:48 -0400)]
Add support for `isolated` parameter
Add the "Isolated" parameter in the *.network file, e.g.,
[Bridge]
Isolated=true|false
When the Isolated parameter is true, traffic coming out of this port
will only be forward to other ports whose Isolated parameter is false.
When Isolated is not specified, the port uses the kernel default
setting (false).
The "Isolated" parameter was introduced in Linux 4.19.
See man bridge(8) for more details.
But even though the kernel and bridge/iproute2 recognize the "Isolated"
parameter, systemd-networkd did not have a way to set it.
some actions like Coverity and CFLite aren't run on every PR so to make
sure they are more or less fine when they are changed it makes sense to
at least check them with superlinter/actionlint: https://github.com/rhysd/actionlint
The following warnings were fixed along the way:
```
.github/workflows/mkosi.yml:55:7: shellcheck reported issue in this script: SC2086:info:6:14: Double quote to prevent globbing and word splitting [shellcheck]
|
55 | run: |
| ^~~~
.github/workflows/mkosi.yml:55:7: shellcheck reported issue in this script: SC2046:warning:6:40: Quote this to prevent word splitting [shellcheck]
|
55 | run: |
| ^~~~
.github/workflows/mkosi.yml:55:7: shellcheck reported issue in this script: SC2006:style:6:40: Use $(...) notation instead of legacy backticked `...` [shellcheck]
|
55 | run: |
| ^~~~
```
```
.github/workflows/coverity.yml:31:9: shellcheck reported issue in this script: SC2086:info:1:93: Double quote to prevent globbing and word splitting [shellcheck]
|
31 | run: echo "COVERITY_SCAN_NOTIFICATION_EMAIL=$(git log -1 ${{ github.sha }} --pretty=\"%aE\")" >> $GITHUB_ENV
| ^~~~
```