Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe 1e84213a43 dhcp6: make dhcp6_option_parse_{address,pdprefix}() return -EINVAL when received address or prefix is refused
And then the caller ignores the error.
Otherwise, `ret_liftime_valid` is not set even if they succeeds.
2021-02-23 19:36:23 +09:00
Yu Watanabe cf6c33bd6b dhcp6: do not use input value before checking 2021-02-23 18:49:11 +09:00
Yu Watanabe c83e44110c Merge pull request #18718 from yuwata/network-nexthop-blackhole
network: introduce Blackhole= setting in [NextHop] section
2021-02-23 04:44:12 +09:00
Yu Watanabe e82a0ef1cf Merge pull request #18734 from poettering/cryptsetup-description-escape
cryptsetup: unescape ID_PART_ENTRY_NAME udev field
2021-02-23 04:43:22 +09:00
Yu Watanabe 518339d89f Merge pull request #18731 from yuwata/backlight-trivial-cleanups
backlight: trivial cleanups
2021-02-23 04:42:09 +09:00
Yu Watanabe 69a91c704e test-network: add tests for Blackhole= setting in [NextHop] section 2021-02-23 02:21:35 +09:00
Yu Watanabe 484555f3f2 network: route: shorten code a bit 2021-02-23 02:21:31 +09:00
Yu Watanabe 30f1083709 network: nexthop: add Blackhole= setting in [NextHop] section
As similar to unreachable type routes, blackhole nexthops do not have
NHA_OID attribute, so they are managed by Manager.
2021-02-23 02:21:17 +09:00
Yu Watanabe b77c929934 backlight: reindent comments 2021-02-22 23:45:55 +09:00
Yu Watanabe d17d66f0ab backlight: reduce indentation a bit 2021-02-22 23:25:00 +09:00
Yu Watanabe ba6c9b7994 backlight: same_device() may return negative errno 2021-02-22 23:11:28 +09:00
Yu Watanabe 7a9737bc7d backlight: exit earlier when unknown verb is specified 2021-02-22 23:00:46 +09:00
Yu Watanabe 84d32bf59b test-network: test wireguard peer in drop-in config
Closes #18241.
2021-02-22 21:33:36 +09:00
Yu Watanabe 5e63f2915b man: fix typo 2021-02-21 19:20:47 +01:00
Yu Watanabe a9f2f1c13a Merge pull request #18711 from yuwata/network-nexthop-onlink
network: nexthop: add OnLink= setting
2021-02-21 10:33:36 +09:00
Yu Watanabe e2d9bc5cfd test-network: add a test for OnLink= in [NextHop] section 2021-02-21 05:16:27 +09:00
Yu Watanabe 2ddd52d1e2 network: nexthop: add OnLink= setting 2021-02-21 05:16:23 +09:00
Yu Watanabe 1f22fc3828 mount-tool: sd_device_get_sysattr_value() returns 0 on success 2021-02-21 04:40:23 +09:00
Yu Watanabe 9520c2f62b sd-device-enumerator: shorten code a bit 2021-02-21 04:40:23 +09:00
Yu Watanabe 3f15ce66e0 unit: ignore exit code of "udevadm trigger"
Suggested at https://github.com/systemd/systemd/pull/18559#issuecomment-781626226.

Some drivers may be broken and return unexpected errors on triggering
events. That should be logged but should not boot-up to be affected.
2021-02-21 04:40:23 +09:00
Yu Watanabe 6c99c26500 udevadm-trigger: introduce --quiet option
This may be useful to invoke the command by non-privileged users.
2021-02-21 04:40:23 +09:00
Yu Watanabe 0e789e6d48 udevadm-trigger: do not return immediately on EACCES
Prompted by https://github.com/systemd/systemd/pull/18559.
2021-02-21 04:40:23 +09:00
Yu Watanabe 21012e20a4 udevadm-trigger: use sd_device_trigger() for triggering uevent 2021-02-21 04:40:23 +09:00
Yu Watanabe 25677a055c udev: use sd_device_trigger() to trigger uevent 2021-02-21 04:40:23 +09:00
Yu Watanabe f4d36efa75 sd-device: introduce tiny wrapper sd_device_trigger() 2021-02-21 04:40:23 +09:00
Yu Watanabe 297d1370f8 sd-device: do not cache action string for uevent file written by sd_device_set_sysattr_value()
As sd_device_get_sysattr_value() may be already used to read uevent
file. The read value of uevent file may be usually quite different
from the action string.
2021-02-21 04:40:23 +09:00
Yu Watanabe 1dff135bf9 test: add more tests for path_startswith() 2021-02-21 04:40:23 +09:00
Yu Watanabe 9dcde1034c sd-device: make devpath check stricter
See assertion in sd_device_get_devpath().
2021-02-21 04:40:23 +09:00
Yu Watanabe 45e093a968 sd-device: make sd_device_get_xxx() accept NULL for storing result
Though, setting NULL for some getters, e.g. sd_device_get_syspath()
may be meaningless, but anyway also let's make them accept NULL for
consistency.
2021-02-21 04:40:23 +09:00
Yu Watanabe 163e0a882c sd-device: use appropriate error code 2021-02-21 04:40:23 +09:00
Yu Watanabe 66efcbb149 sd-device: add a brief comment in device_cache_sysattr_value() 2021-02-21 04:40:23 +09:00
Yu Watanabe acfc2a1d15 sd-device: ignore error in device_cache_sysattr_value() and propagate original error code
There are three calls of device_cache_sysattr_value(). Two of them are
just caching the value. Hence, let's ignore its failure, and propagate
original error code.

One exception is the last call in sd_device_get_sysattr_value().
Unfortunately, it returns `const char *` instead of `char *`. So,
sd_device object must have the reference of the returned value.
Hence, error in updating the cache by device_cache_sysattr_value()
is critical, and we need to propagate the error in that case.
2021-02-21 04:40:17 +09:00
Yu Watanabe 32a739afe0 sd-device: the last argument of sd_device_get_sysattr_value() may be NULL 2021-02-21 04:30:42 +09:00
Yu Watanabe 2a394d0bf2 sd-device: use delete_trailing_chars()
Also, this drops trailing '\r' from sysattr value set in
sd_device_set_sysattr_value().
2021-02-21 04:30:42 +09:00
Yu Watanabe 23ff570ba8 sd-device: do not cache an empty string but clear cache on failre
And propagate the original error on write.
Note that some attributes are read-only.
2021-02-21 04:30:42 +09:00
Yu Watanabe 2f7a2e3952 sd-device: move comment about NULL value
It is not intuitive, and I do not know why the function behave so.
But let's keep that behavior for compatibility, as such behavior
may be already used explicitly by callers.
2021-02-21 04:30:42 +09:00
Yu Watanabe 2a0ebc0569 sd-device: rename device_{add,get,remove}_sysattr_value()
They just handle cache of sysattr values. Hence, let's use more
explanatory names.
2021-02-21 04:30:42 +09:00
Yu Watanabe 27edd36eaa network: fix typo 2021-02-20 18:58:07 +09:00
Yu Watanabe aa3069977e Merge pull request #18689 from yuwata/network-address-broadcast-no
network: make Broadcast= accept "no"
2021-02-20 16:55:28 +09:00
Yu Watanabe 045db4fa0d test-network: add tests for Broadcast= with boolean settings 2021-02-20 14:23:07 +09:00
Yu Watanabe 832583ada8 network: make Broadcast= accept boolean value
And disable it for wireguard interfaces by default.

Closes #18492.
2021-02-20 14:23:00 +09:00
Yu Watanabe 7f37ecf7e5 Merge pull request #18699 from yuwata/network-route-add-nexthop-setting
network: add NextHop= setting in [Route] section
2021-02-20 14:17:17 +09:00
Yu Watanabe ace0bd14ba Merge pull request #18695 from keszybz/xdg-generator-silence-warning
xdg-autostart-generator: silence warning
2021-02-20 01:00:18 +09:00
Yu Watanabe cee0f719d8 test-network: add tests for NextHop= setting in [Route] 2021-02-19 22:42:39 +09:00
Yu Watanabe e918b3c12a network: add nexthop ID in debugging logs 2021-02-19 22:42:39 +09:00
Yu Watanabe 324e342219 network: add NextHop= setting in [Route] section 2021-02-19 22:42:39 +09:00
Yu Watanabe 69e244e321 network: also manage nexthops by ID
It will be used in later commits.
2021-02-19 22:42:39 +09:00
Yu Watanabe bfe6043454 network: nexthop: update ID of nexthop created without specifiying ID
Otherwise, nexthop_configure() -> nexthop_add() creates NextHop object
without ID in link->nexthop, and then, manager_rtnl_process_nexthop() ->
nexthop_add_foreign() also creates another NextHop object with ID in
link->nexthop_foreign.
2021-02-19 08:41:52 +01:00
Yu Watanabe f345918d8d network: configure nexthop before routes that requires gateway
This is a preparation for later commits. When RTA_NH_ID is set to a
route, then the corresponding nexthop must be exist.
2021-02-19 08:34:12 +01:00
Yu Watanabe b480543cf0 tree-wide: fix typo 2021-02-19 07:56:22 +01:00
Yu Watanabe 4c72d851cd network: warn when any positive boolean string is specified for IPMasquerade=
Previously, any positive boolean string for IPMasquerade= enables only IPv4
masquerade. The commit 48ed276647 adds
IPv6 masquerade support. However, only "yes" is handled as "ipv4", and other
positive boolean strings are handled as "both".

This makes all positive boolean strings considered as "ipv4", warn that they
are deprecated, and suggest to use "ipv4" or "both".

Follow-up for 48ed276647.
2021-02-19 14:24:10 +09:00
Yu Watanabe da0e2baea3 network: address: reuse Address:ip_masquerade_done for IPv6 case
It is not necessary to use different flag for each address family.

Follow-up for 48ed276647.
2021-02-19 14:22:32 +09:00
Yu Watanabe 5be5d1f2a1 Merge pull request #18659 from poettering/permyriadification
use scaling relative to UINT32_MAX instead of percentages/permyriads wherever we can
2021-02-19 14:22:10 +09:00
Yu Watanabe 71894e1831 table: drop trailing white spaces of the last cell in row
Fixes #18415.
2021-02-19 14:04:32 +09:00
Yu Watanabe 38ba3da0a1 network: rename UseFQDN= -> UseHostname=
Prompted by
https://github.com/systemd/systemd/pull/18543#issuecomment-780798451.
2021-02-18 21:47:37 +01:00
Yu Watanabe ccbd74f602 network: NHA_ID should be always set 2021-02-18 03:56:26 +09:00
Yu Watanabe c004cd2bbe network: constify arguments 2021-02-18 03:54:50 +09:00
Yu Watanabe 56223d926d network: introduce log_nexthop_debug() 2021-02-18 03:54:50 +09:00
Yu Watanabe c633628daf tree-wide: constify variables if possible 2021-02-18 03:48:07 +09:00
Yu Watanabe 94af46fc66 network: use temporary buffer for safety 2021-02-18 03:48:07 +09:00
Yu Watanabe 5380707aba network: use in_addr_prefix_to_string() 2021-02-18 03:48:07 +09:00
Yu Watanabe b1dea5cffa resolve: use sockaddr_in_addr() 2021-02-18 03:48:07 +09:00
Yu Watanabe bb3b08ad98 resolve: make manager_find_ifindex() or friends return earlier 2021-02-18 03:48:07 +09:00
Yu Watanabe 94876904bb tree-wide: use in_addr_is_set() or friends 2021-02-18 03:48:07 +09:00
Yu Watanabe 275468c033 network: assign values after all checks are passed 2021-02-18 03:48:07 +09:00
Yu Watanabe fa55043450 in-addr-util: introduce in6_addr_equal() 2021-02-18 03:48:06 +09:00
Yu Watanabe 1235befadd in-addr-util: introduce in6_addr_is_link_local() 2021-02-18 03:48:06 +09:00
Yu Watanabe 7653dcc328 in-addr-util: introduce in_addr_is_set() or friends 2021-02-18 03:48:06 +09:00
Yu Watanabe 0c0585ca25 network: enumerate nexthops before routes
Preparation for the later commits.
Routes may have RTA_NH_ID attribute. To resolve the nexthop ID, all
nexthops must be enumerated earlier.
2021-02-17 19:40:02 +01:00
Yu Watanabe 055e4909de network: nexthop: first create nexthops with ID
Otherwise, an ID-less nexthop may conflict with a later nexthop with ID.
2021-02-17 19:39:37 +01:00
Yu Watanabe 9997507421 firewall-util: replace nft_in6addr_to_range() with in_addr_prefix_range() 2021-02-17 22:57:37 +09:00
Yu Watanabe 1534c5791a in-addr-util: introduce in_addr_prefix_range()
This will replace nft_in6addr_to_range() in later commit.
2021-02-17 22:57:37 +09:00
Yu Watanabe 9164338b2e in-addr-util: make in_addr_prefix_nth() always return valid prefix
Previously, e.g. in_addr_prefix_nth(2400::1, prefixlen=32, nth=1)
does not return 2400:1:: but does 2400:1::1.
2021-02-17 22:57:37 +09:00
Yu Watanabe 7b6b05cff9 in-addr-util: make in_addr_prefix_nth() refuse prefixlen larger than maximum size 2021-02-17 22:57:37 +09:00
Yu Watanabe 518b6da5d3 in-addr-util: make in_addr_prefix_nth() returns 0 on success 2021-02-17 22:57:37 +09:00
Yu Watanabe 40785f53ba network: refuse IPv4 multipath route for IPv6 route 2021-02-17 22:08:15 +09:00
Yu Watanabe 35d39c94a9 network: Route::gw_family may be AF_UNSPEC 2021-02-17 21:11:13 +09:00
Yu Watanabe 6cd8f9b5f2 test-network: add tests for Family= in [NextHop] 2021-02-17 15:55:37 +09:00
Yu Watanabe 26ff450550 man: update explanations of settings in [NextHop] section 2021-02-17 15:55:37 +09:00
Yu Watanabe acfd8491fb network: nexthop: refuse 0 id
We usually do not accept values which will be handled as unspecified.
Instead, this makes config_parse_nexthop_id() accept an empty string.
2021-02-17 15:55:37 +09:00
Yu Watanabe f1923efccb network: nexthop: introduce Family= setting in [NextHop] section
This is an alias of `Gateway=0.0.0.0` or `Gateway=::`.
2021-02-17 15:55:37 +09:00
Yu Watanabe e9c4253d47 network: allow to configure nexthop with null address
Closes #18446.
2021-02-17 15:55:37 +09:00
Yu Watanabe 0008b5aee2 network: nexthop: unset gateway when an empty string is assigned 2021-02-17 15:55:37 +09:00
Yu Watanabe 3b4e3ebb51 netlink: introduce sd_netlink_message_has_flag() 2021-02-16 22:36:24 +01:00
Yu Watanabe 955b11ffd3 Merge pull request #18629 from yuwata/sd-netlink-nexthop-types
sd-netlink: add nexthop related types
2021-02-17 04:06:15 +09:00
Yu Watanabe 8900c05e6e netlink: drop sd_rtnl_message_{route,nexthop}_set_family()
The family is already set when the message is created.
2021-02-17 02:06:26 +09:00
Yu Watanabe fc80ed5f97 network: drop unnecessary family setting
It is already set in sd_rtnl_message_new_nexthop().
2021-02-17 02:06:26 +09:00
Yu Watanabe ccb4072e21 man: fix indentation 2021-02-16 17:59:21 +01:00
Yu Watanabe 735a3d73b7 netlink: fix assertions 2021-02-17 01:21:03 +09:00
Yu Watanabe 4684ec5e3d netlink: add nexthop related types 2021-02-17 01:16:42 +09:00
Yu Watanabe f5b7deb969 sd-netlink: add RTA_NH_ID attribute support 2021-02-17 01:16:10 +09:00
Yu Watanabe 0f1f933b6e tree-wide: fix typo 2021-02-15 10:15:04 +01:00
Yu Watanabe f24cbe56d7 Merge pull request #18588 from poettering/refuse-loops
resolved: try hard to never enter packet loops between resolved's stub and resolved's client
2021-02-15 11:10:32 +09:00
Yu Watanabe fcf99d0ec7 Merge pull request #18587 from poettering/rr-count-workaround
two fixes for handling misformed packets more gracefully.
2021-02-15 10:55:10 +09:00
Yu Watanabe 547f9b0dc5 Merge pull request #18563 from poettering/nss-resolve-no-valid
timesyncd: for off dnssec in resolved
2021-02-15 10:43:49 +09:00
Yu Watanabe 9ae4f96056 Merge pull request #18555 from yuwata/network-address-set-flag-on-remove
network: address: also set IFA_FLAGS on remove
2021-02-13 17:44:58 +09:00
Yu Watanabe b2af6d66fb Merge pull request #18455 from yuwata/network-change-link-state-only-when-new-address-or-route-will-be-assigned
network: change link state only when new address or route will be assigned
2021-02-13 17:43:27 +09:00
Yu Watanabe 4a70450104 test-network: merge test_address_static and test_address_preferred_lifetime_zero_ipv6 2021-02-12 23:09:21 +09:00
Yu Watanabe 53ae4762ef network: address: do not set IFA_F_PERMANENT flag
The flag is automatically set by kernel when the valid lifetime is
infinite. Note that the flag in netlink message for IPv4 address is
ignored. See set_ifa_lifetime() in kernel's net/ipv4/devinet.c.
But the flag is honored for IPv6 address. And if the flag is set with
finite valid lifetime, the address will not removed automatically by
the kernel.
2021-02-12 23:09:21 +09:00
Yu Watanabe a8481354f0 network: address: also set IFA_FLAGS on remove
If an address is assigned with IFA_F_MANAGETEMPADDR, then the flag must
be also set on remove. Otherwise, temporary addresses will not be
removed. See also inet6_rtm_deladdr() in kernel's net/ipv6/addrconf.c.

Fixes #13218.
2021-02-12 23:09:21 +09:00