1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

56311 Commits

Author SHA1 Message Date
Frantisek Sumsal
d282e57e2a test: check for (possibly) missing test coverage
If the test logs contain lines like:

```
...systemd-resolved[735885]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-250.a.p/base-filesystem.c.gcda:Cannot open
```

it means we're possibly missing some coverage since gcov can't write the stats,
usually due to the sandbox being too restrictive (e.g. ProtectSystem=yes,
ProtectHome=yes) or the $BUILD_DIR being inaccessible to non-root users.
2022-02-14 12:20:02 +01:00
Frantisek Sumsal
e4c822e9ac test: set ACLs for the build dir when built with coverage
Otherwise unprivileged processes (like systemd-resolved) can't write
coverage data.
2022-02-14 11:58:54 +01:00
Matija Skala
1b46eb23bc do not call __register_atfork directly
this way it is cleaner and more portable and systemd links against libpthread anyway
2022-02-14 10:49:43 +01:00
Ludwig Nussel
2a3a5288cb systemctl: fix halt -f
Commit adefc8789b always asks logind for shutdown first. So I broke halt
-f which is supposed to issue a direct syscall in that case.
2022-02-14 09:35:12 +01:00
Ludwig Nussel
54141d8ddd logind: more verbose struct initialization 2022-02-14 09:35:12 +01:00
Ludwig Nussel
1831759a70 logind: increase max wall message length to 4096 2022-02-14 09:35:12 +01:00
Ludwig Nussel
d2fc0ecf9a logind: style fixes 2022-02-14 09:35:12 +01:00
Ludwig Nussel
138224fc80 logind: add handle enum to struct
Avoid pointer arithmetic at the expense of repeating the enum value
in the struct.
2022-02-14 09:35:12 +01:00
Yu Watanabe
119c00c1fa test-dhcp6-client: add test for rapid commit 2022-02-14 15:09:37 +09:00
Yu Watanabe
1f28019113 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.
2022-02-14 15:09:28 +09:00
Yu Watanabe
bccb8fc61a fuzz-dhcp6-client: add prefix hint and vendor option to sent message 2022-02-14 15:02:33 +09:00
Yu Watanabe
7b53d3ead3 fuzz-dhcp6-client: merge with fuzz-dhcp6-client-send 2022-02-14 15:02:33 +09:00
Yu Watanabe
013c6904fa 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.
2022-02-14 15:02:33 +09:00
Yu Watanabe
bbe3f62a16 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.
2022-02-14 15:02:33 +09:00
Yu Watanabe
e261d31557 sd-dhcp6-client: logs invalid NTP option
Returning negative errno triggers to produce debugging log in
dhcp6_lease_parse_message().
2022-02-14 15:02:33 +09:00
Yu Watanabe
3f09d563f4 sd-dhcp6-client: split dhcp6-internal.h into two
Also, this moves string tables to dhcp6-protocol.c.
2022-02-14 15:02:33 +09:00
Yu Watanabe
8b1cfab962 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.
2022-02-14 15:02:33 +09:00
Yu Watanabe
dd73db7850 sd-dhcp6-client: reset Information Refresh Time on stop 2022-02-14 15:02:30 +09:00
Yu Watanabe
e1774086a7 sd-dhcp6-client: add log about Information Refresh Time
And store IRT only when the client is running in information
requesting mode.
2022-02-14 15:01:02 +09:00
Yu Watanabe
9c9fee8002 sd-dhcp6-client: use memcmp_nn() at one more place 2022-02-14 15:01:02 +09:00
Yu Watanabe
ac680f766d dhcp-identifier: generate static and constant DUID-EN when the client is running in test mode
Follow-up for 9216fddc5a.
2022-02-14 15:00:59 +09:00
Yu Watanabe
5e1618fafa dhcp-identifier: introduce dhcp_identifier_set_duid() 2022-02-14 14:58:49 +09:00
Yu Watanabe
f9971018eb dhcp-identifier: introduce duid_type_to_string() 2022-02-14 14:58:49 +09:00
Yu Watanabe
6f3fc86131 sd-dhcp6-client: do not expose set_transaction_id()
This is mostly for tests or fuzzers. Hence, this makes the function
requires that the client is running in the test mode.

Also, now the function mask the value for message type.
2022-02-14 14:58:49 +09:00
Yu Watanabe
9e4dee4cec sd-dhcp6-client: use OrderedSet for vendor option
This also fixes memleak.
2022-02-14 14:58:49 +09:00
Yu Watanabe
885ea2ab1c ordered-set: introduce ordered_set_clear() 2022-02-14 14:58:49 +09:00
Yu Watanabe
1978efb9a5 sd-dhcp6-client: use struct hw_addr_data 2022-02-14 14:58:49 +09:00
Yu Watanabe
6f8ff34218 sd-dhcp6-client: stop IO event source when client entered bound state
Also when the client receives a reply when running in information
requesting mode.
2022-02-14 14:58:49 +09:00
Yu Watanabe
6f4490bb0c sd-dhcp6-client: adjust assertions 2022-02-14 14:58:46 +09:00
Yu Watanabe
65b85f2340 sd-dhcp6-client: log state transition 2022-02-14 14:57:35 +09:00
Yu Watanabe
e5d69be216 sd-dhcp6-client: rename client_set_state() -> client_start_transaction()
Previously, it obeys state transition, but now it is only used when
(re-)starting transaction. Let's rename again in more explanative name.
2022-02-14 14:57:35 +09:00
Yu Watanabe
fa78d165bb sd-dhcp6-client: use proper type for string table lookup funcs 2022-02-14 14:57:35 +09:00
Yu Watanabe
a8d1012f30 sd-dhcp6-client: voidify client_set_state() 2022-02-14 14:57:34 +09:00
Yu Watanabe
cfcc85bbca sd-dhcp6-client: log message is processed before state is changed 2022-02-14 14:57:34 +09:00
Yu Watanabe
c50c9e509f sd-dhcp6-client: move client_timeout_resend() and client_set_state()
These are deeply related to client_message_send(). Hence, move them near
the function.
2022-02-14 14:57:34 +09:00
Yu Watanabe
0eca25ba00 sd-dhcp6-client: move client_ensure_iaid()
No functional change.
2022-02-14 14:57:34 +09:00
Yu Watanabe
af2b484141 sd-dhcp6-client: merge client_start() and client_reset() 2022-02-14 14:56:54 +09:00
Yu Watanabe
ec7baf998d sd-dhcp6-client: use event_reset_time_relative() at one more place 2022-02-14 14:54:08 +09:00
Yu Watanabe
22ad018b5e sd-dhcp6-client: max_retransmit_count is only used when client is in DHCP6_STATE_REQUEST 2022-02-14 14:54:08 +09:00
Yu Watanabe
0f3b8b809c 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.
2022-02-14 14:51:19 +09:00
Yu Watanabe
3bb18e707c 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.
2022-02-14 14:45:14 +09:00
Yu Watanabe
30b31359b0 sd-dhcp6-client: drop unnecessary assignment 2022-02-14 14:45:14 +09:00
Yu Watanabe
8ef959cd09 sd-dhcp6-client: initialize IO event source in sd_dhcp6_client_start() 2022-02-14 14:45:14 +09:00
Yu Watanabe
f814cd80de sd-dhcp6-client: make state transition stricter 2022-02-14 14:45:14 +09:00
Yu Watanabe
c2c878d806 sd-dhcp6-client: prohibit spurious state transition
Previously, `client_set_state(client, DHCP6_STATE_STOPPED)` might make
the client enter the SOLICIT state.
2022-02-14 14:45:14 +09:00
Yu Watanabe
220a88ca75 sd-dhcp6-client: disable T1 timer on T2
Otherwise, the client may be enter RENEW state after REBIND state.
2022-02-14 14:45:14 +09:00
Yu Watanabe
c41bdb17fc sd-dhcp6-client: call client_notify() in client_enter_bound_state() 2022-02-14 14:45:14 +09:00
Yu Watanabe
cdf3d8c584 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.
2022-02-14 14:45:07 +09:00
Yu Watanabe
1d6cb4ce2a sd-dhcp6-client: use event_reset_time_relative() 2022-02-14 14:43:45 +09:00
Yu Watanabe
02354ee738 sd-dhcp6-client: introduce client_enter_bound_state()
To make client_set_state() smaller. This should not change any behavior.
2022-02-14 14:43:45 +09:00