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

37517 Commits

Author SHA1 Message Date
Yu Watanabe
709055dabb network: rename REQUEST_TYPE_STACKED_NETDEV -> REQUEST_TYPE_NETDEV_STACKED 2022-02-15 15:54:02 +09:00
Yu Watanabe
6dc07e095d meson: sort listed files 2022-02-15 15:54:02 +09:00
Yu Watanabe
f3376ee8fa
Merge pull request #22487 from poettering/bootspec-source-flags
bootctl: show all discovered entries, but show state + type in details
2022-02-15 04:45:59 +09:00
Yu Watanabe
88586e5d32
Merge pull request #22508 from poettering/stat-ino-compare
stat-util: add new stat_inode_same() helper
2022-02-15 04:45:31 +09:00
Yu Watanabe
d1e7fa02ca
Merge pull request #22507 from poettering/id128-compare-tweaks
sd-id128: comparison tweaks
2022-02-15 04:40:53 +09:00
Lennart Poettering
d6b218e742 sd-daemon: use path_join() instead of manual path concat 2022-02-14 17:27:24 +01:00
Lennart Poettering
c20c77eff8 coredump: fix inode check
When checking if we look at the root directory we actually need to
compare both st_dev *and* st_ino. The existing check only checked the
latter. Fix that.
2022-02-14 17:27:21 +01:00
Lennart Poettering
675e7fc22c fd-util: use ERRNO_IS_XYZ() macros where appropriate 2022-02-14 17:27:18 +01:00
Lennart Poettering
a9dac7a6dd tree-wide: port various places over to new stat_inode_same() helper 2022-02-14 17:27:14 +01:00
Lennart Poettering
38db6211b5 stat-util: add helper stat_inode_same() for comparing stat's st_dev/st_ino in one
We do this all over the place, hence let's add a simple helper that does
this and particularly carefully and thoroughly.
2022-02-14 17:27:09 +01:00
Luca Boccassi
d74da762a3
Merge pull request #22506 from poettering/devnum-zero-btrfs-block-dev
gpt-auto: some (primarily cosmetic) fixes to backing block device detection in gpt-auto-generator/sd-device
2022-02-14 16:17:04 +00:00
Luca Boccassi
bfba9946a1
Merge pull request #22445 from lnussel/logind
logind: post review fixes
2022-02-14 16:16:39 +00:00
Lennart Poettering
d5ac1d4e10 bootspec: avoid zero size VLA
apparently some checkers don't like that. Let's be entirely safe here,
and use malloc() based allocation, given that the entries are user
controlled.
2022-02-14 16:24:04 +01:00
Lennart Poettering
f63b5ad935 boot: suppress XBOOTLDR if same device as ESP when enumerating entries
On my local system I linked up the ESP and XBOOTLDR partitions, and
ended up with duplicate entries being listed. Try hard to detect that
and only enumerate entries in the ESP if it turns out that both dirs
have the same dev_t.

This should detect both bind mounted and symlinked cases and should make
our list output less confusing.
2022-02-14 16:24:04 +01:00
Lennart Poettering
5635040091 bootspec: make sure all return values are initialized on return of find_esp_and_warn()
THis makes sure that find_esp_and_warn() + find_xbootldr_and_warn()
follow our usual coding style that on success all return values are
initialized. We got that right in most successful codepaths out of these
functions, but missed the one where the paths are manually overwritten
via env vars.
2022-02-14 15:44:07 +01:00
Lennart Poettering
bb68205768 bootctl: show more information about boot entry state in list
Let's improve display of boot entries and show what type they have (i.e.
boot loader spec type 1, or type 2, or auto-discovered or reported by
boot loader), and in particular mark entries the boot loader discovered
but we can't find (i.e. that likely vanished, or possibly couldn't be
found due to a misconfiguration) and that the boot loader didn't find
but we see (which are new, or possibly also the result of
misconfiguraiton).

This is supposed to be a replacement for #22161, but instead of hiding
vanished entries, highlights them, which I think is more appropriate for
a low-level tool such bootctl.

Replaces: #22161 #22398
2022-02-14 15:44:07 +01:00
Lennart Poettering
a78e472dfd bootspec: also collect/mark the "selected" boot entry (i.e. the one currently booted)
it's helpful and easy, so let's do it
2022-02-14 15:44:07 +01:00
Lennart Poettering
d403d8f0d6 bootspec: also parse new 'beep' loader.conf variable 2022-02-14 15:44:07 +01:00
Lennart Poettering
fdc5c04299 bootspec: parse/show devicetree-overlay field too
It has been defined in the boot loader spec, and is the only field we
currently don't parse, hence fix that.
2022-02-14 15:44:07 +01:00
Lennart Poettering
736783d420 bootspec: port one more use of basename() to path_extract_filename() 2022-02-14 15:44:07 +01:00
Lennart Poettering
9951736b7f Revert "bootctl: Ignore boot entries (continue #22041)" 2022-02-14 15:44:07 +01:00
Lennart Poettering
93e0d3204c veritysetup: whitespace fix 2022-02-14 15:14:17 +01:00
Lennart Poettering
fe9bd5ad36 homed: use SD_ID128_TO_UUID_STRING() at one more place 2022-02-14 15:14:14 +01:00
Lennart Poettering
e46433bb92 tree-wide: use id128_equal_string() at various places 2022-02-14 15:14:11 +01:00
Lennart Poettering
75a505c600 id128-util: add new helper id128_equal_string()
Quite often we compare uuids/id128 formatted as strings with specific
values. So far we usually used streq() for that. let's add a new
explicit helper for this in id128_equal_string() that compares a string
with an sd_id128_t and is more robust than a simple string comparison.
Moreover, we can mroe easily reuse the various defines we have for
specific UUIDs, for example those from gpt.h.
2022-02-14 15:14:03 +01:00
Lennart Poettering
b74163607b sd128: export sd_id128_to_uuid_string()
We expose various other forms of UUID helpers already, i.e.
SD_ID128_UUID_FORMAT_STR and SD_ID128_MAKE_UUID_STR(), and we parse
UUIDs, hence add a high-level helper for formatting UUIDs too.

This doesn't add any new code, it just moves some helpers
id128-util.[ch] → sd-id128.[ch], to make them public.
2022-02-14 15:13:23 +01:00
Yu Watanabe
42672c80dc test: check if running in container earlier 2022-02-14 13:46:17 +00:00
Luca Boccassi
d0ebe2a835
Merge pull request #22496 from yuwata/network-cleanups-keep-configuration
network: cleanups for KeepConfiguration= setting
2022-02-14 13:17:23 +00:00
Lennart Poettering
d5cb053cd9 gpt-auto: properly handle case where we can't determine devno of /usr/ fs
get_block_device_harder() returns == 0 if the fs is valid, but it is not
backed by a single devno. (As opposed to returning > 0 if the devno is
valid). Let's catch this case and log a clear message, and don't bother
open the device in that case.

This is mostly cosmetical, as either way, systemd-gpt-auto-generator
doesn't work in scenarios like that.

Prompted-by: #22504
2022-02-14 13:40:59 +01:00
Lennart Poettering
f1ad2c9238 sd-device: refuse opening device mit major/minor of zero early
device nodes with 0 dev_t are not real (and for that reason such inodes
are used as whiteouts in overlayfs, for example), hence refuse them
early. It seems wrong going to sysfs for something we know can't exist
anyway.
2022-02-14 13:40:56 +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
Yu Watanabe
cc5184823f sd-dhcp6-client: fix overflow in calculating timeout value 2022-02-14 14:43:45 +09:00
Yu Watanabe
d0875a07dd sd-dhcp6-client: disable event source when client is stopped or freed 2022-02-14 14:43:45 +09:00
Yu Watanabe
7771233127 sd-dhcp6-client: use in6_addr_to_string() 2022-02-14 14:43:45 +09:00
Yu Watanabe
4db6334c9a sd-dhcp6-client: stop client on error in client state transition 2022-02-14 14:43:45 +09:00
Yu Watanabe
bfa1139af4 sd-dhcp6-client: add missing one more error handling 2022-02-14 14:43:45 +09:00
Yu Watanabe
06d5e856f8 sd-dhcp6-client: rename client_start() -> client_set_state() 2022-02-14 14:43:45 +09:00
Yu Watanabe
07a3b3408b 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().
2022-02-14 14:43:45 +09:00
Yu Watanabe
0123b2dbac sd-dhcp6-client: fix possible unaligned read or write 2022-02-14 14:43:45 +09:00
Yu Watanabe
16347c15d8 sd-dhcp6-client: voidify client_reset() 2022-02-14 14:43:45 +09:00
Yu Watanabe
65ece4c85b sd-dhcp6-client: introduce dhcp6_lease_new_from_message() 2022-02-14 14:43:45 +09:00
Yu Watanabe
c930925841 sd-dhcp6-client: use structured initializer 2022-02-14 14:43:45 +09:00
Yu Watanabe
f4fbea7a0f sd-dhcp6-lease: unify lease lifetime calculation 2022-02-14 14:43:45 +09:00
Yu Watanabe
126277aceb sd-dhcp6-client: always use ENODATA when a lease does not have requested data 2022-02-14 14:43:45 +09:00
Yu Watanabe
29858a0f9e sd-dhcp6-client: unify dhcp6_option_append_{ia,pd}() 2022-02-14 14:43:45 +09:00
Yu Watanabe
877bfc78fd sd-dhcp6-client: store PD prefix hint in ia_pd
And allows to specify multiple hints.
2022-02-14 14:43:45 +09:00
Yu Watanabe
e5b0b87f51 sd-dhcp6-client: introduce dhcp6_ia_free() 2022-02-14 14:43:45 +09:00
Yu Watanabe
4b0f27173c sd-dhcp6-client: unify IA option header
This also fixes possible unaligned read of message.
2022-02-14 14:43:45 +09:00
Yu Watanabe
93bd7c4192 sd-dhcp6-lease: reset client or server ID when length is zero
Addresses https://github.com/systemd/systemd/pull/22406#issuecomment-1029391091.
2022-02-14 14:43:45 +09:00
Yu Watanabe
049fddfa7d sd-dhcp6-lease: convert assert_return() -> assert() in non-public functions 2022-02-14 14:43:45 +09:00
Yu Watanabe
7c999d38fa sd-dhcp6-client: rename ia -> ia_na, pd -> ia_pd in sd_dhcp6_lease
The previous naming is quite misleading.
2022-02-14 14:43:45 +09:00
Yu Watanabe
43b7a412b1 sd-dhcp6-client: fix typo ia_pd -> ia_na
Fortunately, currently both ia_pd and ia_na in sd_dhcp6_client are
equivalent now.
2022-02-14 14:43:45 +09:00
Yu Watanabe
5e4d135c60 sd-dhcp6-client: introduce two helpers to create message 2022-02-14 14:43:45 +09:00
Yu Watanabe
6fcf356b9a sd-dhcp6-client: trigger assertion whn invalid IA type is provided
If the condition hits, then it is an error in coding, instead of a user
misconfiguration or invalid receivd message.
2022-02-14 14:40:57 +09:00
Yu Watanabe
81db4f3dd8 network: drop managed configs on reconfigure when KeepConfiguration=yes
Otherwise, the managed configs, that is addresses, routes and so on
configured by the previously assigned .network file will not be dropped
on reconfiguring the interface.
2022-02-13 20:01:42 +09:00
Yu Watanabe
07c160a65c network: drop redundant condition
The function `link_drop_foreign_addresses()` is only called in
`link_drop_foreign_config()`, and the same condition is located in the
caller.
2022-02-13 20:01:29 +09:00
Yu Watanabe
74c60fcbec cgroup-util: refuse the case that both path and suffix are empty strings
Fixes CID#1322378.
2022-02-12 11:01:52 +00:00
Jan Janssen
ac3979abd7 boot: Correctly check the return value of CheckEvent
Fixes: #22428
2022-02-11 17:07:05 +00:00
Lennart Poettering
5483fca07a pid1: export cgroup ID among per-unit cgroup information
It's really interesting for debugging purposes and we have it already,
hence expose it as dbus property.
2022-02-11 13:36:39 +01:00
Lennart Poettering
a561253f0b cgroup-util: minor modernizations
Rename return parameters to "ret", use ternary op without second
argument, rebreak comments, use isempty() more.
2022-02-11 13:36:39 +01:00
Lennart Poettering
1b42022388 cgroup: downgrade warning if we can't get ID off cgroup
The cgroupid feature was not available in old cgroupvs2 kernels, hence
try to get it but if we can't because it's not supported, then only
debug log about it and proceed.

(We only needs this for cgroup bpf stuff, but that isn't available on
such old kernels anyway)

Fixes: #22483
2022-02-11 13:36:39 +01:00
Zbigniew Jędrzejewski-Szmek
e01e68e70a basic: do not warn in mkdir_p() when parent directory exists
This effectively disables warnings about type/mode/ownership of existing
directories when recursively creating parent directories. (Or files. If there's
a file in a place we expect a directory, the code will later try to create
a file and fail. This follows the general pattern where we do (void)mkdir()
if the mkdir() is immediately followed by opening of a file.)

I was recently debugging an issue with the fstab-generator [1], and it says:
'Directory "/tmp" already exists, but has mode 0777 that is too permissive (0644 was requested), refusing.'
which is very specific but totally wrong in this context.
This output was added in 37c1d5e97d, and I still
think it is worth to do it, because if you actually *do* want the directory, if
there's something wrong, the precise error message will make it much easier to
diagnose. And we can't easily pass the information what failed up the call chain
because there are multiple things we check (ownership, permission mask, type)…
So passing a param whether to warn or not down into the library code seems like
the best solution, despite not being very elegant.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2051285
2022-02-11 10:05:21 +01:00
Evgeny Vereshchagin
a38f3ceeda resolve: describe mdns event sources
when they go down resolved prints
```
Event source mdns-ipv4 (type io) returned error, disabling
```
instead of
```
Event source n/a (type io) returned error, disabling
```
2022-02-11 07:01:58 +09:00
Frantisek Sumsal
da185cd04d tree-wide: move unsigned to the start of type declaration
Even though ISO C11 doesn't mandate in which order the type specifiers
should appear, having `unsigned` at the beginning of each type
declaration feels more natural and, more importantly, it unbreaks
Coccinelle, which has a hard time parsing `long unsigned` and others:

```
init_defs_builtins: /usr/lib64/coccinelle/standard.h
init_defs: /home/mrc0mmand/repos/systemd/coccinelle/macros.h
HANDLING: src/shared/mount-util.c
: 1: strange type1, maybe because of weird order: long unsigned
```

Most of the codebase already "complies", so let's fix the remaining
"offenders".
2022-02-10 21:00:22 +01:00
Yu Watanabe
8448321571 sd-dhcp6-client: add missing address existence check
This adds similar check as 58da18251f.
2022-02-10 21:50:02 +09:00
Yu Watanabe
2d88df457a
Merge pull request #22471 from yuwata/network-bridge-vlan-protocol
network: bridge: fix vlan protocol
2022-02-10 20:40:04 +09:00
Yu Watanabe
ac7e18be76
Merge pull request #22452 from yuwata/network-ipv6ll
network: use sysctl to set IPv6LL address generation mode when the interface is already up
2022-02-10 20:38:56 +09:00
Yu Watanabe
6eb35be8e0 network: bridge: fix endian of vlan protocol
Fixes #22469.
2022-02-10 17:47:17 +09:00
Joerie de Gram
77d65e5659 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.

Fixes #22424.
2022-02-10 17:35:41 +09:00
Yu Watanabe
2b25f4eb23 network: move link_set_ipv6ll_stable_secret() to networkd-ipv6ll.c 2022-02-10 17:34:06 +09:00
Yu Watanabe
05b8fc498e network: skip to set IPv6LL address generation mode if the requested mode is already set 2022-02-10 17:34:06 +09:00
Yu Watanabe
6614116458 network: use log_link_warning_errno() or friends where applicable 2022-02-10 17:34:06 +09:00
Yu Watanabe
7d0d832d67 network: monitor current IPv6LL address generation mode 2022-02-10 17:34:06 +09:00
Yu Watanabe
80f2647dfb network: introduce two helper functions for setting IPv6LL address generation mode 2022-02-10 17:34:02 +09:00
Alvin Šipraga
19ff06b3a4
udev/net: support Match.Firmware= in .link files (#22462)
In cbcdcaaa0e ("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.
2022-02-10 16:19:28 +09:00
Luca Boccassi
0b0ad494a0
Merge pull request #22458 from poettering/parse-safe-string
some safety tweaks to conf-parser.[ch]
2022-02-09 16:59:14 +00:00
Yu Watanabe
e6e2b66b8f
Merge pull request #22248 from yuwata/network-tc-use-request-queue
network: tc: use request queue to configure QDisc or TClass
2022-02-09 18:57:37 +09:00
Lennart Poettering
65a0ede2ed conf-parser: add specific parser for PID values 2022-02-09 10:17:37 +01:00
Lennart Poettering
a99a85242c tree-wide: use config_parse_safe_string() at various places 2022-02-09 10:17:33 +01:00
Lennart Poettering
0b95409928 conf-parser: update config_item_*_lookup() to follow modern coding style
Let's rename the return parameters ret_xyz, and always initialize them
if we return >= 0, as per our current coding style.
2022-02-09 10:17:23 +01:00
Lennart Poettering
cec7f09dc8 conf-parser: refuse section headers with control characters early, just in case 2022-02-09 10:17:20 +01:00
Lennart Poettering
73a4ac8a75 conf-parser: minor refactorings/modernizations 2022-02-09 10:17:17 +01:00
Lennart Poettering
deec0b6dd5 conf-parser: use _cleanup_free_ where appropriate 2022-02-09 10:17:13 +01:00
Lennart Poettering
2d17d699bb conf-parse: add generic config_parse_safe_string() helper
This helper is just like config_parse_string() but does some superficial
checks for control characters and quotes.

In most cases we currently use config_parse_string() we probably want to
use config_parse_safe_string() for safety reasons.
2022-02-09 10:16:42 +01:00
Santa Wiryaman
97f27f8a16 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.
2022-02-09 17:37:37 +09:00
Yu Watanabe
e4bbd9c61e network: tc: use hashmap to store traffic control settings in .network files
As now each qdisc or tclass is configured when it is ready.
2022-02-09 14:43:19 +09:00
Yu Watanabe
7ec1846242 network: tc: introduce order dependency of traffic control 2022-02-09 14:43:19 +09:00
Yu Watanabe
1dec9d816b network: tc: use request queue to configure traffic control
But no dependency resolution is implemented.
2022-02-09 14:43:19 +09:00
Yu Watanabe
b3208e0fad network: tc/teql: set tca_kind in verify()
Then, qdisc_configure() can be simplified.
2022-02-09 14:43:19 +09:00
Yu Watanabe
828a81a937 network: tc: monitor qdisc and tclass 2022-02-09 14:43:19 +09:00
Yu Watanabe
e8b8b3eacb sd-netlink: allow to dump qdisc and tclass 2022-02-09 14:43:19 +09:00
Yu Watanabe
27e93a4b66 sd-netlink: make traffic control related message can be monitored 2022-02-09 14:43:19 +09:00
Yu Watanabe
1f38b6f9c6 sd-netlink: introduce sd_rtnl_message_traffic_control_get_{ifindex,parent,handle}() 2022-02-09 14:38:23 +09:00
Yu Watanabe
f50b93fed7 sd-netlink: unify sd_rtnl_message_new_qdisc() and sd_rtnl_message_new_tclass()
As the netlink message header types for both qdisc and tclass are
equivalent.
2022-02-09 14:35:25 +09:00
Yu Watanabe
89346ac6f6 network: coding style fixes 2022-02-09 14:35:25 +09:00
Yu Watanabe
55c6f705ba network: tc: drop unnecessary conditions
As TC_H_UNSPEC is 0.
2022-02-09 14:35:25 +09:00
Yu Watanabe
058fd55efa network: tc: drop unused QDisc::family element 2022-02-09 14:35:25 +09:00
Lennart Poettering
4d6ce52e7b
Merge pull request #22446 from poettering/sd-boot-cpuid-vm-tscd
sd-boot: don't read TSC in VM environments, and other TSC fixes
2022-02-08 21:57:38 +01:00
Yu Watanabe
de2f372ea2 network: move ipv6ll related functions to networkd-ipv6ll.[ch] 2022-02-09 02:14:40 +09:00
Yu Watanabe
5573ed2230
Merge pull request #22448 from poettering/coredump-raise-sizes
coredump: raise limits
2022-02-09 01:23:07 +09:00
Yu Watanabe
18f84f8aba udev/net: support to set MDI-X mode
Closes #22386.
2022-02-08 15:47:46 +00:00
Lennart Poettering
74694002e6
Merge pull request #22423 from poettering/repart-sector-size
repart: fix sector size handling
2022-02-08 14:47:00 +01:00
Curtis Klein
d6463a399d watchdog: saturate to kernel's max watchdog timeout
Since version 4.5, the max possible timeout is UINT_MAX / 1000 since it
does calculations in milliseconds. A small helper function is added to
make this conversion and saturation and will be used more in the next
commit.

Also document the usage of signed integers by the kernel userspace API.
2022-02-08 14:43:12 +01:00