Yu Watanabe
76a86ffdbe
network: ipv4acd: first probe address and then assign it
...
Previously, if IPv4 ACD is enabled on an address, then we first
assign the address, and start sd-ipv4acd daemon for the address.
This is not only RFC incompliant, but also the address is always
dropped, as the daemon always considers the address is conflicted.
This commit makes networkd first starts sd-ipv4acd daemon to probe
the address, and then the address is configured if no conflict is
detected.
Fixes #17235 .
2021-07-01 00:49:03 +09:00
Yu Watanabe
475ec3346f
network: make request_drop() accept NULL
2021-07-01 00:49:03 +09:00
Yu Watanabe
c0c04a4b22
network: acquire address on request configure rather than on configure
...
A preparation for later commits.
2021-07-01 00:49:03 +09:00
Yu Watanabe
9155da08ee
network: rename dhcp_lease_lost() -> dhcp4_lease_lost() and expose it
...
A preparation for later commits.
2021-07-01 00:49:02 +09:00
Yu Watanabe
d5e3b3eb8c
network: address: do not send tentative flag
...
Currently, networkd does not set tentative flag on create, and kernel
ignore the flag on remove. So, this commit does not change any current
behaviour. This is just a preparation for later commits.
2021-07-01 00:49:02 +09:00
Yu Watanabe
8c29f484d5
network: introduce link_request_static_address()
2021-07-01 00:49:02 +09:00
Yu Watanabe
99b466693e
network: introduce address_dup() and replace address_copy() with it
2021-07-01 00:49:02 +09:00
Yu Watanabe
f8d6397ac2
network: ipv4ll: reset MAC address without stopping sd-ipv4ll engine
2021-07-01 00:49:02 +09:00
Yu Watanabe
a1e35fca46
network: ipv4ll: refuse to configure IPv4LL address on interface where the length of the hardware address is not ETH_ALEN
...
Currently, sd-ipv4acd assumes hardware address is ETH_ALEN.
2021-07-01 00:49:02 +09:00
Yu Watanabe
89d8ed9932
network: ipv4ll: make link enter failed state on failure of restarting ipv4ll engine
2021-07-01 00:49:02 +09:00
Yu Watanabe
fe321d457c
network: introduce link_get_by_hw_addr()
2021-07-01 00:49:02 +09:00
Yu Watanabe
6eab614db8
network: rename Manager::links -> Manager::links_by_index
...
This also renames link_get() -> link_get_by_index().
2021-07-01 00:49:02 +09:00
Yu Watanabe
907d5ce4d4
ether-addr-util: introduce hw_addr_hash_ops
2021-07-01 00:49:02 +09:00
Yu Watanabe
1e59122d45
sd-ipv4ll: introduce sd_ipv4ll_set_check_mac_callback()
2021-07-01 00:49:02 +09:00
Yu Watanabe
9e5aa34fc8
sd-ipv4ll: allow to set MAC address without stopping sd-ipv4ll engine
2021-07-01 00:49:02 +09:00
Yu Watanabe
7f77917c0e
sd-ipv4acd: update condition of address conflict
...
See RFC 5227 section 2.1.1.
This introduces a callback which intend to a library user, e.g.
networkd, checks whether the sender hardware address is a MAC address of
the host's intrerface or not.
2021-07-01 00:49:02 +09:00
Yu Watanabe
5c35c13a4d
sd-ipv4acd: allow to change requesting address without restarting sd-ipv4acd
2021-07-01 00:49:02 +09:00
Yu Watanabe
3d817902c4
sd-ipv4acd: set defend window in timeout event and state is IPV4ACD_STATE_STARTED
2021-07-01 00:49:02 +09:00
Yu Watanabe
fcb7345950
sd-ipv4acd: allow to change MAC address without restarting sd-ipv4acd
...
This also makes sd_ipv4acd_set_mac() refuses null MAC address.
2021-07-01 00:49:02 +09:00
Yu Watanabe
d17ed573aa
arp-util: split out logic of setting BPF code into a function
2021-07-01 00:49:02 +09:00
Yu Watanabe
ecad63f850
arp-util: use struct in_addr
2021-07-01 00:49:02 +09:00
Yu Watanabe
e1a3915b41
arp-util: make arp_send_{probe,announcement}() inline
2021-07-01 00:49:02 +09:00
Yu Watanabe
28ba416c99
arp-util: shorten code a bit
2021-07-01 00:49:02 +09:00
Yu Watanabe
504bf2b54a
arp-util: check ifindex and mac address
2021-07-01 00:49:02 +09:00
Yu Watanabe
f6720fe62e
arp-util: check sent message size
2021-07-01 00:49:02 +09:00
Yu Watanabe
51d113512f
arp-util: align elements
2021-07-01 00:49:02 +09:00
Yu Watanabe
265b6d4e0c
sd-ipv4acd: include announced address in log message
2021-07-01 00:49:02 +09:00
Yu Watanabe
9be2ba5e12
sd-ipv4acd: use struct in_addr instead of be32_t
2021-07-01 00:49:02 +09:00
Yu Watanabe
387f695526
tree-wide: "a" -> "an"
2021-06-30 23:33:00 +09:00
Yu Watanabe
3d62af7d23
tree-wide: fix "the the" and "a a"
2021-06-30 23:32:43 +09:00
Yu Watanabe
857f0e0ae3
man: fix typo
2021-06-30 20:47:57 +09:00
Yu Watanabe
11537375e3
sd-netlink: use usec_sub_unsigned() and USEC_INFINITY
...
And shorten code more.
2021-06-27 03:58:34 +09:00
Yu Watanabe
2b01228800
sd-netlink: shorten code a bit
...
This also reduces scope of variables, fixes and reduces indentations,
drop unnecessary initializations.
2021-06-27 03:58:34 +09:00
Yu Watanabe
7bb9f0d014
sd-netlink: do not call lookup_nlmsg_type() for known generic netlink family
2021-06-27 03:58:30 +09:00
Yu Watanabe
0f97cfb9be
sd-netlink: rename variables and functions for generic netlink
...
`id` or `type` is ambiguous. Let's use `nlmsg_type`. Also, use `ret` for
function arguments to store results.
This also adds several assertions.
2021-06-27 03:02:22 +09:00
Yu Watanabe
eee15fff40
sd-netlink: do not trigger assertion by calling socket_broadcast_group_unref() with an arbitrary group number
...
socket_broadcast_group_unref() is only called in netlink_slot_disconnect(),
so the assertion should not be triggered as the match slot was
successfully created.
But, we usually design `_ref/unref()` functions as they can be called
for any inputs. So, let's also follow the design rule here.
2021-06-27 02:47:34 +09:00
Yu Watanabe
db4735b7db
sd-netlink: shorten code a bit
...
This also fixes comments, a log message, and coding style nits.
2021-06-27 02:47:25 +09:00
Yu Watanabe
33989b967e
udev-test: add a testcase for string_escape=replace
2021-06-27 00:02:24 +09:00
Yu Watanabe
7dc846f99a
udev: reduce scope of variables
...
Then, hopefully, we can easily find the bug fixed by the previous
commit.
2021-06-26 23:52:38 +09:00
Yu Watanabe
7db6b67275
udev: fix use of invalid pointer
...
Fixes a bug introduced by ea0f4578a7 .
Fixes CID#1457766.
2021-06-26 23:35:02 +09:00
Yu Watanabe
57ccd9f6c0
core/namespace: drop unnecessary initializations
2021-06-26 11:32:59 +01:00
Yu Watanabe
11c89a85eb
udev: update log messages
...
Suggested at https://github.com/systemd/systemd/pull/19312#discussion_r658556983 .
2021-06-26 10:12:13 +02:00
Yu Watanabe
70160c6eee
sd-device: allow to read sysattr which contains embedded NUL
...
This effectively reverts the commit 2a394d0bf2 .
But drop trailing '\r' of the read value, as sd_device_set_sysattr_value() drops it.
Fixes #20025 .
2021-06-26 10:48:28 +09:00
Yu Watanabe
3b955af56f
networkctl: drop unused member in struct VxLanInfo
2021-06-26 08:39:25 +09:00
Yu Watanabe
c8de9b0ec5
man: document about NAMING_REPLACE_STRICTLY network interface naming policy
...
Follow-up for b4d885f0e8 and
068b0f7728 .
2021-06-25 14:51:24 +01:00
Yu Watanabe
4dce1b9f05
udev/scsi: use the scsi device type number directly
...
Previously, the value is once stringified, and later again parsed,
that is completely redundant.
Follow-up for 1001167ca5 .
Replaces #20013 .
2021-06-25 13:31:19 +02:00
Yu Watanabe
5181630f26
core: do not set nosuid mount option when SELinux is enabled
...
The mount option has special meaning when SELinux is enabled. To make
NoNewPrivileges=yes not break SELinux enabled systems, let's not set the
mount flag on such systems.
2021-06-25 15:37:35 +09:00
Yu Watanabe
6720e356c1
Revert "Revert "Mount all fs nosuid when NoNewPrivileges=yes""
...
This reverts commit 1753d30215 .
Let's re-enable that feature now. As reported when the original commit
was merged, this causes some trouble on SELinux enabled systems. So,
in the subsequent commit, the feature will be disabled when SELinux is enabled.
But, anyway, this commit just re-enable that feature unconditionally.
2021-06-25 15:16:34 +09:00
Yu Watanabe
38e980a6a5
sd-dhcp-client: tentatively ignore FORCERENEW command
...
This makes DHCP client ignore FORCERENEW requests, as unauthenticated
FORCERENEW requests causes a security issue (TALOS-2020-1142, CVE-2020-13529).
Let's re-enable this after RFC3118 (Authentication for DHCP Messages)
and/or RFC6704 (Forcerenew Nonce Authentication) are implemented.
Fixes #16774 .
2021-06-24 11:25:26 +09:00
Yu Watanabe
551ad0b7de
sd-dhcp-client: logs when dhcp client unexpectedly gains a new lease
...
Previously, such situation is handled silently.
2021-06-24 11:25:26 +09:00
Yu Watanabe
d57b62be0d
sd-dhcp-client: shorten code a bit
2021-06-24 11:25:26 +09:00
Yu Watanabe
67d8cd8193
sd-dhcp-client: check error earlier and reduce indentation
2021-06-24 11:25:26 +09:00
Yu Watanabe
f565b8676f
dirent-util: use readdir_ensure_type() in readdir_no_dot() and FOREACH_DIRENT()
2021-06-24 04:29:40 +09:00
Yu Watanabe
98f7a4c8bb
dirent-util: introduce readdir_ensure_type()
2021-06-24 04:19:38 +09:00
Yu Watanabe
5118e8e71d
udev: remove unsafe characters from ID_SERIAL for nvme
...
Fixes #19309 .
2021-06-23 17:11:27 +09:00
Yu Watanabe
91c27ac686
man: update description of "string_escape=" udev option
2021-06-23 17:11:23 +09:00
Yu Watanabe
ea0f4578a7
udev: replace unsafe characters on assigning ENV{key}="val" when OPTIONS="string_escape=replace" is set
...
Strictly speaking, this breaks backward compatibility, as previously
`ENV{key}="val"` ignored `string_escape=` option. But, introducing
a new option such as `string_escape=hoge` sounds overkill for me.
The default escape mode is `ESCAPE_UNSET`, so I hope this merely break
existing rules.
2021-06-23 16:40:52 +09:00
Yu Watanabe
51c2f543d1
udev: fix key name in debug log
2021-06-23 16:33:14 +09:00
Yu Watanabe
068b0f7728
udev: refuse invalid ifname earlier
2021-06-23 16:32:42 +09:00
Yu Watanabe
b4d885f0e8
udev: introduce new netif naming scheme flag to strictly replace ifname
2021-06-23 16:10:26 +09:00
Yu Watanabe
d37f3e3ec5
udev: only network interface can be renamed
2021-06-23 16:02:43 +09:00
Yu Watanabe
e1ecfef16f
udev-util: introduce udev_replace_ifname()
2021-06-23 16:02:05 +09:00
Yu Watanabe
5a3586db9a
socket-util: split out checking valid character for ifname into ifname_valid_char()
2021-06-23 15:59:44 +09:00
Yu Watanabe
b905f3bbba
Merge pull request #19990 from mrc0mmand/test-tweaks
...
A couple of stability-related test tweaks
2021-06-23 01:45:04 +09:00
Yu Watanabe
de806cd6b6
Merge pull request #19991 from bluca/bash_compl_unbound_vars
...
completion: fix 'unbound variables' errors
2021-06-23 01:44:30 +09:00
Yu Watanabe
4bee2333cf
mount-util: add one more assertion
2021-06-22 14:42:03 +09:00
Yu Watanabe
9b23679e53
mount-util: use EXTRACT_KEEP_QUOTE to handle mount options
...
Otherwise, the quotes which wrap SELinux options are dropped.
2021-06-21 21:34:50 +09:00
Yu Watanabe
25086b4c17
mount-util: reduce scope of variable
2021-06-21 21:34:10 +09:00
Yu Watanabe
f59551f18e
test: add test cases for EXTRACT_KEEP_QUOTE and EXTRACT_UNQUOTE
2021-06-21 21:34:07 +09:00
Yu Watanabe
1104d11429
extract-word: introduce EXTRACT_KEEP_QUOTE flag
2021-06-21 21:14:20 +09:00
Yu Watanabe
1c092b62db
mount-util: make mount_flags_to_string() show flag name instead of number
...
This also adds missing MS_NOSYMFOLLOW flag. Moreover, this makes the
function always add unhandled flags in number.
2021-06-21 21:14:20 +09:00
Yu Watanabe
d3d1559435
nspawn: replace strextend_with_separator() -> strextendf_with_separator()
...
Fixes a bug introduced by cfea7618f2 .
Before this commit:
mode=1777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=,sys.id:sys.role:systemd.nspawn.container.fs:s0,
After this commit:
mode=1777,size=10%,nr_inodes=400k,uid=496107520,gid=496107520,context=sys.id:sys.role:systemd.nspawn.container.fs:s0
Fixes #19976 .
2021-06-21 21:14:20 +09:00
Yu Watanabe
f75817172f
time-util: coding style fixes
...
Follow-ups for 45eb4d2261 .
2021-06-21 13:00:10 +01:00
Yu Watanabe
932feb79b3
virt: improve log message when we cannot read /sys/firmware/dmi/entries/0-0/raw
...
As the file is usually readable by only root.
Prompted by https://github.com/systemd/systemd/issues/19978#issuecomment-864561357 .
2021-06-21 12:12:07 +01:00
Yu Watanabe
16ecf8066d
Merge pull request #19981 from gablank/relative-time-unit-singular
...
time-util: don't use plural units indiscriminately
2021-06-21 14:04:31 +09:00
Yu Watanabe
1cf4ed142d
network: always enable IPv4 ACD for statically configured IPv4LL address
2021-06-16 13:19:26 +09:00
Yu Watanabe
f4c48492fe
man: fix RFC number and its title
2021-06-16 10:32:28 +09:00
Yu Watanabe
bd5146c67e
network: IFA_F_NODAD flag is only for IPv6 addresses
2021-06-16 08:33:54 +09:00
Yu Watanabe
566c8176da
NEWS: fix typo
2021-06-16 06:01:25 +09:00
Yu Watanabe
2568bb1085
NEWS: drop journal file truncation feature
...
Follow-up for 0aa649b11d .
2021-06-16 05:54:02 +09:00
Yu Watanabe
7422405623
test: fix syscall existence check
...
Follow-up for 0643eb47a0 .
This also drops errnously introduced hashmap_put() in the commit.
2021-06-15 21:00:51 +02:00
Yu Watanabe
9b682672e4
network: use void* to correctly store SetLinkOperation in Request
...
Previously, when `link_request_queue()` is called in link_request_set_link(),
`SetLinkOperation` is casted with INT_TO_PTR(), and the value is assigned to
`void *object`. However the value was read directly through the member
`SetLinkOperation set_link_operation` of the union which `object`
beloging to. Thus, read value was always 0 on big-endian systems.
Fixes configuring link issue on s390x systems.
2021-06-15 20:58:20 +02:00
Yu Watanabe
b2e8fdc896
Merge pull request #19928 from yuwata/riscv32
...
riscv32 support
2021-06-16 00:53:30 +09:00
Yu Watanabe
0aa649b11d
Revert "journal-file: truncate archived journals"
...
This reverts commit 592d419ce6 .
The commit makes journald unstable, and is just an optimization
for the size of journal. Hence, it is safe to revert the commit.
Fixes #19895 .
2021-06-15 15:50:36 +02:00
Yu Watanabe
e19b0746f1
unit: use alias name of man page
2021-06-15 12:14:26 +01:00
Yu Watanabe
21d03e6c63
man: add an example to configure default route on device with table
...
Prompted by #19911 .
2021-06-15 11:29:20 +01:00
Yu Watanabe
fc75007b32
missing_syscall: add riscv32 support
2021-06-15 19:07:36 +09:00
Yu Watanabe
18adce1566
syscalls: add riscv32
2021-06-15 19:07:32 +09:00
Yu Watanabe
d34e3b76e5
syscalls: update tables
2021-06-15 19:07:11 +09:00
Yu Watanabe
a3f5f4a5c0
fix typo
2021-06-15 14:19:30 +09:00
Yu Watanabe
7802194ac0
tree-wide: add missing whitespace at the end of comments
2021-06-15 14:09:29 +09:00
Yu Watanabe
f7bef77a16
Merge pull request #19924 from yuwata/sd-event-fix-assertion
...
sd-event: fix assrtion in sleep_between()
2021-06-15 13:34:03 +09:00
Yu Watanabe
9868493e17
Merge pull request #19913 from yuwata/network-fix-counter
...
network: add missing increment of Link::set_flags_messages
2021-06-15 10:51:24 +09:00
Yu Watanabe
2502e7befe
Merge pull request #19905 from yuwata/network-set-mac-try-again
...
network: try to bring down interface before setting MAC address
2021-06-15 05:35:45 +09:00
Yu Watanabe
710fa1b3fb
network: update wlan information when IFF_LOWER_UP flag is gained
...
Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860269320 .
2021-06-15 05:14:22 +09:00
Yu Watanabe
7f80fa12c2
network: add brief comment about reconfiguring interfaces
...
This also renames link_reconfigure_internal() -> link_reconfigure_impl().
2021-06-15 05:12:25 +09:00
Yu Watanabe
ecb3deccdc
network: do not partially update wlan information on failure
2021-06-15 04:32:31 +09:00
Yu Watanabe
7149bde4ba
network: add missing increment of Link::set_flags_messages
...
link_up_or_down() will decrement the counter when the subsequent
RTM_GETLINK netlink method is finished. So, we need to increment
the counter here.
Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860255692 .
2021-06-15 03:58:59 +09:00
Yu Watanabe
2429808b29
test: add a test case for #19920
2021-06-15 03:06:09 +09:00
Yu Watanabe
0f97b7c338
core/service: fix assertion when Type=dbus but BusName= is not specified
...
Fixes #19920 .
2021-06-15 03:06:09 +09:00