Commit Graph

35645 Commits

Author SHA1 Message Date
Yu Watanabe
435910b3a6 network: address: use passed Address object if possible
Then, we can avoid unnecessary duplication.
2021-10-27 23:34:47 +09:00
Yu Watanabe
eef5ebec97 Merge pull request #21143 from yuwata/sd-radv-router-lifetime
sd-radv: several cleanups for router lifetime
2021-10-27 22:14:35 +09:00
Lennart Poettering
6663b509d8 bootctl: refuse parsing unknown special '@' entry ids
Let's make sure '@' is never written as entry ID into any EFI variable,
as we want the ability to add new ids like this later on, with them
resulting in a clear error on older implementations.
2021-10-27 22:12:07 +09:00
Yu Watanabe
1ad83d9500 Merge pull request #21144 from yuwata/sd-radv-trivial-cleanups
sd-radv: trivial cleanups
2021-10-27 19:52:57 +09:00
Yu Watanabe
8524db5021 conf-parse: make config_parse_many() optionally save 'struct stat' for each file
Fixes #21113.
2021-10-27 19:49:55 +09:00
Yu Watanabe
4f1ac4a38d network: radv: refuse invalid router lifetime in conf parser 2021-10-27 19:29:05 +09:00
Yu Watanabe
804775577d sd-radv: update how to calculate interval of sending advertisements 2021-10-27 19:27:23 +09:00
Yu Watanabe
0945767012 sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
See RFC 4861 section 6.2.1.
2021-10-27 19:27:07 +09:00
Yu Watanabe
72db0a714b sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC 2021-10-27 19:05:55 +09:00
Yu Watanabe
e786c2e50f sd-radv: add several notes about constants 2021-10-27 19:03:58 +09:00
Yu Watanabe
03ec10fdf4 sd-radv: make several constants not exposed 2021-10-27 19:03:35 +09:00
Yu Watanabe
d6fc0d674f sd-radv: drop SD_ prefix for unexposed constants 2021-10-27 19:03:31 +09:00
Lennart Poettering
3f9335e8e3 Merge pull request #21130 from systemd/wip/hadess/webcams
Tag IR cameras and allow media* access
2021-10-27 12:03:30 +02:00
Yu Watanabe
68cbac5bd4 sd-radv: use IPv6 specific functions 2021-10-27 16:41:04 +09:00
Yu Watanabe
acbb5500e2 sd-radv: use assert_return() 2021-10-27 16:41:04 +09:00
Yu Watanabe
7003b11487 sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t) 2021-10-27 16:13:09 +09:00
Greg Zuro
cfee6b9551 change indicator used for later versions of VirtualBox (#21127)
Detection of VirtualBox is accomplished in the existing code by *either* `innotek GmbH`
or `Oracle Corporation` existing in any of:

- /sys/class/dmi/id/product_name
- /sys/class/dmi/id/sys_vendor
- /sys/class/dmi/id/board_vendor
- /sys/class/dmi/id/bios_vendor

With Oracle's physical servers, both `/sys/class/dmi/id/sys_vendor` and
`/sys/class/dmi/id/board_vendor` contain `Oracle Corporation`, so those
servers are detected as `oracle` (VirtualBox).

VirtualBox has the following values in the latest versions:

- /sys/class/dmi/id/product_name: `VirtualBox`
- /sys/class/dmi/id/sys_vendor: `innotek GmbH`
- /sys/class/dmi/id/board_vendor: `Oracle Corporation`
- /sys/class/dmi/id/bios_vendor: `innotek GmbH`

Presumably the existing check for `innotek GmbH` is meant to detect
older versions of VirtualBox, while changing the second checked value
from `Oracle Corporation` to `VirtualBox` will reliably detect later and future
versions.
2021-10-27 13:02:37 +09:00
Yu Watanabe
b81070ff13 Merge pull request #21129 from yuwata/network-dhcp6-pd-vs-ndisc
network: several follow-ups for DHCPv6-PD
2021-10-27 12:15:18 +09:00
Lennart Poettering
8f1daefce6 json: do something remotely reasonable when we see NaN/infinity
JSON doesn't have NaN/infinity/-infinity concepts in the spec.
Implementations vary what they do with it. JSON5 + Python simply
generate special words "NAN" and "Inifinity" from it. Others generate
"null" for it.

At this point we never actually want to output this, so let's be
conservative and generate RFC compliant JSON, i.e. convert to null.

One day should JSON5 actually become a thing we can revisit this, but in
that case we should implement things via a flag, and only optinally
process nan/infinity/-infinity.

This patch is extremely simple: whenever accepting a
nan/infinity/-infinity from outside it converts it to NULL. I.e. we
convert on input, not output.
2021-10-26 22:26:27 +02:00
Yu Watanabe
0e45721e3d network: dhcp6: make UplinkInterface=:self imply WithoutRA=solicit 2021-10-27 00:33:44 +09:00
Yu Watanabe
fac19a21cf network: do not restart DHCPv6 client when WithoutRA= is set
Previously, even if WithoutRA= is specified, the DHCPv6 client may be
restarted in undesired mode when a RA is received.
2021-10-27 00:33:44 +09:00
Yu Watanabe
483566e5ba network: deprecate ForceDHCPv6PDOtherInformation= setting
The setting is completely meaningless, as WithoutRA= and UseDelegatedPrefix=
in [DHCPv6] section, and DHCPv6Client= in [IPv6AcceptRA] section control
the behavior.
2021-10-27 00:33:44 +09:00
Yu Watanabe
dc5cae6c9d network: dhcp6: introduce UplinkInterface= for DHCP6 prefix delegation 2021-10-26 20:43:10 +09:00
Yu Watanabe
2cba2146ac network: move config_parse_uplink() to networkd-dhcp-common.[ch] 2021-10-26 20:43:10 +09:00
Yu Watanabe
47e9c655b4 network: dhcp6pd: do not trigger prefix reassignment for all downstreams when a new downstream appears
It is not necessary to reconfigure other interfaces.
2021-10-26 20:43:08 +09:00
Yu Watanabe
079f94edfa network: dhcp6: do not reconfigure/restart DHCPv6 clients when a new downstream appears
Previously, when a downstream appears which requests delegated prefix to
be assigned, then possibly restart all DHCPv6 clients for another
interfaces.

This makes networkd always honor the UseDelegatedPrefix= setting, and
not restart DHCPv6 clients.
2021-10-26 20:40:20 +09:00
Yu Watanabe
0f5ef9b62a network: dhcp6: introduce UseDelegatedPrefix= setting and enable by default
Previously, the prefix delegation is enabled when at least one
downstream interfaces request it. But, when the DHCPv6 client on the
upstream interface is configured, some downstream interfaces may not
exist yet, nor have .network file assigned.

Also, if a system has thousands of interfaces, then the previous logic
introduce O(n^2) search.

This makes the prefix delegation is always enabled, except when it is
explicitly disabled. Hopefully, that should not break anything, as the
DHCPv6 server should ignore the prefix delegation request if the server
do not have any prefix to delegate.
2021-10-26 20:29:08 +09:00
Bastien Nocera
63fbfc598f hwdb: Allow console users access to media* nodes
Newer webcams and video devices have controls only available through
/dev/media* nodes. Make sure they're accessible in the same way as
/dev/video* nodes.

Closes: #21054
2021-10-26 11:57:30 +02:00
Yu Watanabe
adef6d089b Merge pull request #21122 from yuwata/network-optimize-reload
network: slightly optimize "networkctl reload"
2021-10-26 15:55:01 +09:00
Yu Watanabe
b4564f4e8f network: delay dropping addresses or so on reloading .network files
When a .network file is updated but its change is not so big, it is not
necessary to first drop all configs and then reassign later again.
This slightly optimize such situation. First foreignize all configs, and
then drop later when it is not requested by the updated .network file.
2021-10-26 08:20:22 +09:00
Lennart Poettering
1845ba368e homework: replace homegrown "dir-is-empty" check with dir_is_empty_at() 2021-10-26 08:13:15 +09:00
Yu Watanabe
b1ccd7d737 Merge pull request #21097 from poettering/dir-is-empty-fix
dir_is_empty_at() tweaks
2021-10-26 08:12:50 +09:00
Yu Watanabe
0f96a82311 network: dhcp6pd: do not assign downstream prefix when RADV is requested but not configured yet 2021-10-26 08:11:44 +09:00
Yu Watanabe
928112a487 network: ndisc: fix behavior when DHCPv6Client=always
The man page says that when 'always' is set, the DHCPv6 client always
starts in managed mode, and that means we need to ignore the RA flags.
2021-10-26 08:11:19 +09:00
Yu Watanabe
e817f5b0f9 Merge pull request #21119 from yuwata/network-dhcp6-pd-cleanups
network: dhcp6pd: several cleanups
2021-10-26 08:10:56 +09:00
Yu Watanabe
a84171ce6f libsystemd-network: do not warn when log_dhcp_client() or friends with NULL 2021-10-26 08:09:40 +09:00
Lennart Poettering
0dbce03c37 tree-wide: explicitly unpoison getdents64() memory
Apparently memory sanitizer doesn't grok getdents64() properly. Let's
address that by explicitly marken memory initialized by getdents64() as
unpoisoned.
2021-10-25 21:51:37 +02:00
Lennart Poettering
bfc569b060 test: add test for dir_is_empty_at() 2021-10-25 21:51:37 +02:00
Lennart Poettering
d96f21eec2 stat-util: make sure dir_is_empty_at() does something useful in all cases 2021-10-25 21:51:37 +02:00
Lennart Poettering
a068aceafb stat-util: optimize dir_is_empty_at() a bit, by using getdents64()
That way we have a single syscall only for it, instead of the multiple
readdir() and friends do. And we can operate entirely on the stack, no
malloc() implicit.
2021-10-25 21:51:37 +02:00
Lennart Poettering
a4e70ef7ba dirent-util: add FOREACH macro for iterating through getdents64() buffers
We already have a similar loop twice, let's make it easier to read via
an iteration macro.

(The new macro is a bit more careful even, as it verifies the full
dirent fits into the remaining buffer when returning it)
2021-10-25 21:51:37 +02:00
Lennart Poettering
ca664db258 dirent-util: move getdents64() related definitions to common header
We want to reuse getdents64() wherever necessary, let's hence move
definitions useful for that into public code.
2021-10-25 21:50:20 +02:00
Lennart Poettering
b9d0652263 stat-util: specify O_DIRECTORY when reopening dir in dir_is_empty_at()
That way we can fail earlier if the specified fd is not actually a
directory.

(Also, it's not exactly according to standards to open things without
either O_RDONLY/O_RDWR...)
2021-10-25 21:39:05 +02:00
Yu Watanabe
6681eb021a udev: do not try to rename interface if it is already up
See dev_change_name() in kernel's net/core/dev.c.

Fixes #21105.
2021-10-25 20:18:53 +01:00
Yu Watanabe
756f1f5fd0 network: rename function 2021-10-26 02:27:26 +09:00
Yu Watanabe
df8bf72631 network: dhcp6: rename variables 2021-10-26 00:35:22 +09:00
Yu Watanabe
78e50edfd4 network: dhcp6pd: move logic of acquiring subnet prefix into dhcp6_pd_assign_prefix()
Preparation for later commits.
2021-10-26 00:35:22 +09:00
Yu Watanabe
56bbe0ef02 network: dhcp6pd: introduce a simplified and unified method to calculate subnet prefix 2021-10-26 00:35:22 +09:00
Yu Watanabe
f595b2e9b4 Merge pull request #21116 from poettering/test-cleaner
make tests a bit cleaner in regards to oomd handling
2021-10-25 23:16:14 +09:00
Yu Watanabe
f8aa82e43f Merge pull request #21077 from poettering/mount-setattr
optimize remounting with mount_setattr() syscall
2021-10-25 23:15:10 +09:00