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
Yu Watanabe
111ce98419
network: dhcp6: change link state into "configuring" only when a new address or route will be assigned
2021-02-12 22:44:05 +09:00
Yu Watanabe
24b445c2ce
network: ndisc: change link state into "configuring" only when a new address or route will be assigned
2021-02-12 22:44:05 +09:00
Yu Watanabe
b54aed29c6
network: dhcp6: fix condtion check
2021-02-12 22:43:39 +09:00
Yu Watanabe
0ef9f3c76f
network: set return value at the end of the function
...
The later netlink_call_async() call may fail. We should not touch the
return value when the function failed.
2021-02-12 22:43:10 +09:00
Yu Watanabe
d9eee312a7
network: make address_configure() or friends return 1 when the address is new
2021-02-12 22:43:10 +09:00
Yu Watanabe
0ef0c9caf7
Merge pull request #18554 from yuwata/network-address-set-NLM_F_REPLACE-flag-automatically
...
network: automatically set NLM_F_REPLACE flag
2021-02-12 13:47:58 +09:00
Yu Watanabe
b3f9c17a6b
tree-wide: use free_and_strdup_warn()
2021-02-12 03:05:08 +09:00
Yu Watanabe
37c0b60177
network: automatically set NLM_F_REPLACE flag
...
The difference between sd_rtnl_message_new_addr() and
sd_rtnl_message_new_addr_update() is only whether NLM_F_REPLACE flag
will be set or not.
If an address is already assigned, then we need to set NLM_F_REPLACE
flag, otherwise, address_configure() will be fail.
This makes address_configure() judge whether we should use the flag or
not.
2021-02-12 01:50:14 +09:00
Yu Watanabe
fe44ce8dba
network: address: also logs preferred lifetime
2021-02-12 01:49:59 +09:00
Yu Watanabe
7fb1d980af
tree-wide: propagate error in xxx_from-string()
2021-02-12 01:19:18 +09:00
Yu Watanabe
bde8467a0d
network: dhcp: use string table
2021-02-12 01:19:18 +09:00
Yu Watanabe
58f99ed8a8
string-table: introduce DEFINE_STRING_TABLE_LOOKUP_FROM_STRING()
2021-02-12 01:19:18 +09:00
Yu Watanabe
e4ffe10367
network: route: use _WITH_FALLBACK macros
2021-02-12 01:19:18 +09:00
Yu Watanabe
0fcc4e7484
networkd: lldp: use string table
2021-02-12 01:19:13 +09:00
Yu Watanabe
641bcbc56b
string-table: introduce DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN()
2021-02-12 01:17:13 +09:00
Yu Watanabe
b98680b2b8
tree-wide: use error codes in xxx_from_string()
2021-02-12 01:17:13 +09:00
Yu Watanabe
0cbb768aba
conf-parser: use return codes in xxx_from_string()
...
Follow-up for #11484 .
2021-02-12 01:17:06 +09:00
Yu Watanabe
23c32ff830
network: use SD_BUS_METHOD_WITH_ARGS() macro
2021-02-10 21:34:47 +01:00
Yu Watanabe
01e3d04ee6
Merge pull request #18536 from poettering/uid-refs-simplify
...
dynamic uid/gid reference handling simplifications
2021-02-11 03:18:15 +09:00
Yu Watanabe
fa7924db0b
Merge pull request #11484 from keszybz/udevadm-error-logs
...
Use real return codes in _from_string() functions
2021-02-11 03:17:47 +09:00
Yu Watanabe
aba1c9c85b
bash-completion: loginctl: add -P option
2021-02-11 02:51:00 +09:00
Yu Watanabe
e56aa17084
bash-completion: coredumpctl: add --json and -n options
2021-02-11 02:50:54 +09:00
Yu Watanabe
9a67c080b0
Merge pull request #18506 from keszybz/fuzz-systemctl-parse-argv
...
Fuzzer for systemctl argline parsing
2021-02-11 00:29:22 +09:00
Yu Watanabe
7bc38f59dc
log: do not use uninitialized value
...
Follow-up for 85cf96e3f5 .
2021-02-09 13:58:12 +01:00
Yu Watanabe
beb75dd31d
test-network: support protocol and linkdown flag for ff00::/8 route
...
Fixes #18507 .
2021-02-09 12:25:27 +01:00
Yu Watanabe
8087644a13
tree-wide: replace strverscmp() and str_verscmp() with strverscmp_improved()
2021-02-09 14:25:03 +09:00
Yu Watanabe
87b7d9b6ff
string-util: introduce strverscmp_improved()
...
Unfortunately, strverscmp() from libc or str_verscmp() do not correctly
handle pre-release version, e.g. 247 vs 247~rc1.
This implement a new comparison function, which is based on the RPM's
rpmvercmp().
2021-02-09 14:24:58 +09:00
Yu Watanabe
e5bc5f1f5a
fundamental: move several macros and functions into src/fundamental/
...
sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.
Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.
2021-02-09 14:22:54 +09:00
Yu Watanabe
822be62fb2
hostnamectl: use Table
2021-02-09 13:49:27 +09:00
Yu Watanabe
f2d3ec7abf
hostnamectl: show hint when user try to set transient hostname but static hostname is already used
2021-02-09 13:49:27 +09:00
Yu Watanabe
e8acf09186
hostname: use free_and_strdup_and_warn()
2021-02-09 13:49:27 +09:00
Yu Watanabe
ba12e41d05
hostname: re-read file later when failed to update file
...
Previously, even when writing e.g. /etc/hostname fails, the static
hostname in Context is not restored. So, the subsequent call of the same
method succeeds:
```
$ sudo chattr +i /etc/hostname
$ sudo hostnamectl --static set-hostname aaa
Could not set static hostname: Access denied
$ echo $?
1
$ sudo hostnamectl --static set-hostname aaa
$ echo $?
0
```
This makes when updating file is failed, the saved stat is cleared. So,
the static hostname or machine information in the context are always
consistent to the corresponding files.
2021-02-09 13:49:27 +09:00
Yu Watanabe
c388618ec0
hostnamectl: unset pretty hostname only when no target is specified
2021-02-09 13:49:27 +09:00
Yu Watanabe
2d79e90a1f
hostnamectl: try to set transient hostname even if updating static or pretty hostname failed
...
If no target (--pretty, --static, or --transient) is specified, then
let's try to set transient hostname even if setting static or pretty
hostname failed. This may be useful for read-only filesystem.
2021-02-09 13:49:15 +09:00
Yu Watanabe
957991b7ac
hostname: introduce two bus errors for updating file
2021-02-09 13:37:27 +09:00
Yu Watanabe
0ce2a086da
bus-error: align error definitions
2021-02-09 13:37:27 +09:00
Yu Watanabe
5c3d2e3f43
hostnamectl: improve log message on failure
2021-02-09 13:37:27 +09:00
Yu Watanabe
7bac23e8af
man: fix typo
2021-02-04 19:17:50 +01:00
Yu Watanabe
436cde839f
Merge pull request #18462 from poettering/copy-time
...
timestamp fixes in copy.c
2021-02-04 14:04:37 +09:00
Yu Watanabe
245f4b384d
Merge pull request #18459 from poettering/discover-image
...
shared: rename machine-image.[ch] → discover-image.[ch]
2021-02-04 13:57:37 +09:00
Yu Watanabe
0fb613000d
test-network: disable NDISC on veth-peer
...
This should speed the tests up.
2021-02-03 22:09:07 +00:00
Yu Watanabe
27897cecff
Merge pull request #18319 from yuwata/udev-move-tx-rx-queues
...
network,udev: move TransmitQueues=/ReceiveQueues= from .network to .link
2021-02-03 18:18:57 +09:00
Yu Watanabe
89d2da287b
Merge pull request #18423 from DaanDeMeyer/sd-boot-no-include
...
More sd-boot cleanups
2021-02-03 15:04:26 +09:00
Yu Watanabe
face9fcc16
network,udev: move TransmitQueues=/ReceiveQueues= from .network to .link
...
As the settings are mostly hardware setup, and merely see from network
layer.
See also discussions in
https://github.com/systemd/systemd/pull/18170#issuecomment-758807497
https://github.com/orgs/systemd/teams/systemd/discussions/1
2021-02-03 14:44:51 +09:00
Yu Watanabe
1f8dc96c06
udev: rename TxQueueLength= -> TransmitQueueLength=
...
As we usually (unfortunately not always though) do not use abbreviations.
Tx may be standard abbreviation, but we already have e.g.
TransmitChecksumOffload=. So, let's use Transmit instead of Tx.
Follow-up for ef4a91a7e8 .
2021-02-03 14:43:49 +09:00
Yu Watanabe
d96d8a81ef
test: add tests for RouteTable= setting
2021-02-03 14:39:25 +09:00
Yu Watanabe
552b90a2f2
network: use defined route table name in debug logs
...
And rename route_table_from_string_full() to
manager_get_route_table_from_string().
2021-02-03 14:36:50 +09:00
Yu Watanabe
310eff7274
network: make RouteTable= setting can take multiple name:number pairs in a line
...
Follow-up for c038ce4606 .
2021-02-03 14:32:26 +09:00
Yu Watanabe
ecf83c2429
libudev: add one more assertion
2021-02-02 03:23:31 +09:00
Yu Watanabe
65c637ad2c
libudev: unset uptodate flag before free()ing entries
...
udev_list_entry_free() also removes the entry from LIST if the flag is
set. This slightly optimizes the cleanup logic.
2021-02-02 02:34:23 +09:00
Yu Watanabe
8e5ce38727
libudev: also drop the entry from LIST even if unique flag is set
...
Otherwise, the list becomes dirty when an entry is freed.
This also remove the entry from the hashmap only when its name is set.
The name should be always set, so that does not change anything. But
just for safety.
2021-02-02 02:28:33 +09:00
Yu Watanabe
140716a516
libudev: set entry->list after the entry is stored in the list
...
This should not change anything. As hashmap_remove() is called before
hashmap_ensure_put(). So, even if hashmap_ensure_put() fails, a wrong
entry will not removed from the hashmap by udev_list_entry_free().
But anyway, just for safety.
2021-02-02 02:22:59 +09:00
Yu Watanabe
eaef130d3f
libudev: use hashmap_ensure_put()
2021-02-02 02:22:35 +09:00
Yu Watanabe
8b9708d1d3
sd-event: retrieve more events when epoll_wait() returns number equivalent to the buffer size
...
When epoll_wait() returns number equivalent to the buffer size, there
may exist remaining events which may have higher priority. To make priority
sorting correctly, let's retrieve all events.
2021-02-02 01:14:39 +09:00