Commit Graph

33433 Commits

Author SHA1 Message Date
Yu Watanabe
0c9cdcb9d4 Merge pull request #19476 from yuwata/network-can
network: several CAN device related updates
2021-05-01 15:03:22 +09:00
Yu Watanabe
bff97a251d Merge pull request #18904 from yuwata/udev-watch
udev: several inotify watch fixups
2021-05-01 15:02:43 +09:00
Yu Watanabe
c068a17f6a sd-bus: fix vtable named argument logic
Fixes #19468.
2021-04-30 17:06:29 +01:00
Yu Watanabe
e7f781e473 udev,sd_device: also save map from device ID to watch handle in /run/udev/watch
Previously, watch handle is saved in the udev databse. But in most cases,
the handle saved in the database is not updated. Especially, when udevd
is restarted, the inotify watch is restarted, but the database is not
updated.

Moreover, it is not necessary to save watch handle in the database, as
the handle is only take a effect during udevd is running, and the value
is meaningless when udevd is restarted.

So, this makes the opposite map from device ID to watch handle is saved
in /run/udev/watch as a symbolic link, and the handle not saved in the
database anymore.

Fixes #18525.
2021-04-30 19:41:41 +09:00
Yu Watanabe
5e0d051067 udev: make udev_watch_end() noop when device does not have devname 2021-04-30 19:32:14 +09:00
Yu Watanabe
4956f220a1 sd-device: cleanup sd_device_get_subsystem() 2021-04-30 19:32:10 +09:00
Yu Watanabe
6e25642f8e sd-device: drop sysname_set flag
When device_set_sysname() succeeds, sysname is always set.
2021-04-30 19:21:18 +09:00
Yu Watanabe
ff7a8d2938 sd-device: minor optimization for sd_device_new_from_device_id() 2021-04-30 19:21:18 +09:00
Yu Watanabe
db2bad4368 sd-device: check the validity of device id
The device id is used as filename under /run/udev/data or
/run/udev/watch.
2021-04-30 19:21:18 +09:00
Yu Watanabe
fe7323815d sd-device: rename device_get_id_filename() -> device_get_device_id()
We have sd_device_new_from_device_id(), which takes device ID generated
from device_get_id_filename(). For consistency, let's rename the
function.
2021-04-30 19:21:18 +09:00
Yu Watanabe
0d77bc4a18 udev: refuse to enable inotify watch on remove event
Some udev rule may erroneously set inotify watch on remove event.
For safety, silently ignore such an inotify watch enablement.

This also moves inotify watch enablement code to udev-event.c.
2021-04-30 19:21:18 +09:00
Yu Watanabe
4cac2260c8 udev: also propagate error in udev_rules_apply_to_event() on remove event
When udev rules are not applied correctly, then run program lists is
not perfect. So, udev_event_execute_run() later in
worker_process_device() should not be called.
2021-04-30 19:21:18 +09:00
Yu Watanabe
75b4984638 udev: shorten code a bit 2021-04-30 19:21:18 +09:00
Yu Watanabe
fa5d8899aa udev: drop unused variable 2021-04-30 19:21:18 +09:00
Yu Watanabe
99e0c96f31 sd-device: drop doubled empty lines 2021-04-30 19:21:18 +09:00
Yu Watanabe
df7ee95913 udev: do not store inotify fd in a global variable
When manager_exit() or manager_free() is called, the global variable in
udev-watch.c is not set '-1'. Of course, that is safe, as the event source
for the inotify fd is unref()ed in manager_exit() and manager_free().
But let's not store fd globally.
2021-04-30 19:21:18 +09:00
Yu Watanabe
36161cba7c network: do not bring up CAN interface on configure 2021-04-30 19:16:15 +09:00
Yu Watanabe
d9fc3b0da9 network: make CAN device follow activation policy 2021-04-30 19:16:15 +09:00
Yu Watanabe
04952b25e8 network: introduce link_activate() 2021-04-30 19:16:15 +09:00
Yu Watanabe
600b7898e8 network: do not try to configure address or etc on can device 2021-04-30 19:16:02 +09:00
Yu Watanabe
e361398e48 network: can: shorten code a bit 2021-04-30 19:11:25 +09:00
Yu Watanabe
ed52cce33f network: can: do not warn if link does not exist anymore 2021-04-30 19:11:25 +09:00
Yu Watanabe
f282ce20aa network: drop duplicated link_up_can() 2021-04-30 19:11:25 +09:00
Yu Watanabe
2ff739a6ac kernel-insteall: do not remove the first slash in $ENTRY_DIR
Follow-up for cd0d230e7b.

Fixes #19456.
2021-04-30 15:37:34 +09:00
Yu Watanabe
5aa87ec7ec network: neighbor: use sd_netlink_message_read_data() at one more place 2021-04-30 05:44:58 +09:00
Yu Watanabe
2775e1c578 network: introduce log_neighbor_debug() 2021-04-30 05:44:14 +09:00
Yu Watanabe
7653a9dcd3 network: reduce indentation in log_address_debug() or friends 2021-04-30 05:43:22 +09:00
Yu Watanabe
ae8e3c2b25 ether-addr-util: introduce ether_addr_to_string_alloc() 2021-04-30 05:39:10 +09:00
Lennart Poettering
c3a5240e3a Merge pull request #19458 from yuwata/network-route-remove
network: fix route removal logic a bit
2021-04-29 21:39:30 +02:00
Viktor Mihajlovski
5a7eb46c02 udev: allow onboard index up to 65535
The maximum allowed value of the sysfs device index entry was limited to
16383 (2^14-1) to avoid the generation of unreasonable onboard interface
names.
For s390 the index can assume a value of up to 65535 (2^16-1) which is
now allowed depending on the new naming flag NAMING_16BIT_INDEX.
Larger index values are considered unreasonable and remain to be
ignored.
2021-04-29 21:38:21 +02:00
Lennart Poettering
ac8a4f6b78 hostnamectl: add --json= switch for JSON output
This wraps the new Describe() bus call of hostnamed.
2021-04-29 16:39:09 +02:00
Lennart Poettering
7ecead8f08 hostnamed: add Describe() call to hostnamed, returning all props a JSON 2021-04-29 16:39:09 +02:00
Lennart Poettering
f8da67cdf2 hostnamed: drop unused enums 2021-04-29 16:39:09 +02:00
Lennart Poettering
f2a434a5b8 hostnamed: split out how we determine the hostname a bit
No changes in code, just some splitting out of code we want to use
elsewhere soon.
2021-04-29 16:39:09 +02:00
Lennart Poettering
61d44b6beb hostnamed: refactor vendor/model querying a bit, reuse function 2021-04-29 16:39:09 +02:00
Lennart Poettering
c52e295d68 hostnamed: use byte array when we need a byte array
it's more corect this way, but shouldn#t change a thing binary-wise
2021-04-29 16:39:09 +02:00
Lennart Poettering
66ee229879 hostnamed: retrieve product UUID after authentication, not before 2021-04-29 16:39:09 +02:00
Lennart Poettering
b4be4ff8ae id128-util: use common implementation of helper to get/validate product ID 2021-04-29 16:39:09 +02:00
Yu Watanabe
3c7f1c0757 network: do not set nexthop ID, gateway, and multipath routes simultaneously
See kernel's rtm_to_fib_config() in net/ipv4/fib_frontend.c and
rtm_to_fib6_config() in net/ipv6/route.c.

Note that if both gateway and multipath routes are specified, then
kernel ignores gateway. So, strictly speaking, setting both gateway and
multipath routes is allowed by kernel. But such situation is mostly
user's misconfiguration. Let's refuse it.

Note that the conditions newly added in route_configure() are redundant,
as all static configurations are already verified in
route_section_verify(), and dynamic configurations do not set
nexthop_id or multipath routes. Just for safety.
2021-04-29 22:54:40 +09:00
caoxia2008cxx
f813b62316 set boot time from monotonic time (#19444)
utmp: calculate boot timestamp from monotonic timestamp instead of realtime timestamp
2021-04-29 11:05:01 +02:00
Yu Watanabe
8a9ce525d1 network: do not remove reject type routes more than once
Usually, removing non-existing addresses, routes, and etc, are safe.
However, when multiple interfaces lost their carriers simultaneously,
then manager_drop_routes() and manager_drop_nexthop() are called multiple
times. If a route with a blackhole nexthop is removed in that process,
the later removal requests of the route fail with -EINVAL, rathar
than -ESRCH, as the corresponding nexthop does not exist anymore.

So, let's not remove routes which managed by Manager more than once.
2021-04-29 09:11:36 +09:00
Yu Watanabe
c3fa1257da network: do not set route type on specific route removal 2021-04-29 09:08:55 +09:00
Yu Watanabe
fd221544f2 network: unify log_link_message_full_errno() and log_message_warning_errno()
This also introduces log_message_error_errno() or friends.
2021-04-29 09:07:42 +09:00
Yu Watanabe
e558d4f47a network: dhcp4: downgrade log level when interface is removed 2021-04-29 08:58:13 +09:00
Yu Watanabe
4cbd379e01 network: drop meaningless bitfield specifiers 2021-04-29 08:58:13 +09:00
Yu Watanabe
bf8a5f6473 Merge pull request #19449 from yuwata/network-downgrade-log-level
network: downgrade log level and fix typo
2021-04-29 08:54:08 +09:00
Yu Watanabe
086a351ad9 network: ndisc: fix ipv6 route preference for routes with Gateway=_ipv6ra 2021-04-29 08:50:54 +09:00
Lennart Poettering
fd98562099 Merge pull request #19374 from yuwata/network-dhcp-routes-to-ntp
network: dhcp4: introduce RoutesToNTP= boolean setting
2021-04-28 22:47:21 +02:00
Lennart Poettering
249e7b6692 Merge pull request #19441 from keszybz/riscv-syscall-lists
Add syscall list for riscv
2021-04-28 21:17:43 +02:00
Yu Watanabe
27a213392f network: neighbor: downgrade log level
As commented in the code, kernel sends messages about neighbors after
a link is removed.
2021-04-29 03:16:30 +09:00