Commit Graph

3452 Commits

Author SHA1 Message Date
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
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
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
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
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
Yu Watanabe
83e7c37b19 network: link: downgrade log level
The error is harmless, and will be ignored. Let's downgrade log level.
2021-04-29 03:16:30 +09:00
Yu Watanabe
dec2ed3e75 network: dhcp4: downgrade log level
It is not necessary to log such information on higher level.
2021-04-29 03:12:29 +09:00
Uwe Kleine-König
cbcdcaaa0e Add support for conditions on the machines firmware
This allows to limit units to machines that run on a certain firmware
type. For device tree defined machines checking against the machine's
compatible is also possible.
2021-04-28 10:55:55 +02:00
William A. Kennington III
192a9d95ea network: neighbor: Always add neighbors with replace
We were duplicating setting flags for the message and a combination of
NLM_F_APPEND and NLM_F_CREATE which does not make sense. We should have
been using NLM_F_REPLACE and NLM_F_CREATE since the kernel can
dynamically create neighbors prior to us adding an entry. Otherwise, we
can end up with cases where the message will time out after ~25s even
though the neighbor still gets added. This delays the rest of the setup
of the interface even though the error is ultimately ignored.
2021-04-28 00:06:20 +09:00
Yu Watanabe
d7b0450639 network: dhcp4: introduce RoutesToNTP= boolean setting 2021-04-27 00:01:18 +09:00
Yu Watanabe
949b2c95c9 network: dhcp4: split and rename link_set_dns_routes() 2021-04-27 00:01:18 +09:00
Yu Watanabe
7057030610 network: dhcp4: enable RoutesToDNS= by default 2021-04-27 00:01:18 +09:00
Zbigniew Jędrzejewski-Szmek
2b4d791e41 Merge pull request #19286 from yuwata/network-dhcp-routes-to-dns-19077
network: dhcp4: set gateway for route to dns server if it is not in the same network
2021-04-26 15:10:41 +02:00
Yu Watanabe
0e27527170 network: update comment and log message
After 4b30f2e135, reading stable_secret
sysctl property fails with -ENOMEM, instead of -EIO.
This is due to read_full_virtual_file() uses read() as the backend while
read_one_line_file() uses fgetc(). And each functions return different
error on fails.

Anyway, the failure is harmless here. So, the log message and comment is
updated.

Closes one of the issues in #19410.
2021-04-26 10:08:41 +01:00
Luca Boccassi
bb35478bf9 Merge pull request #19421 from yuwata/fix-typo
core, network: Fix typo
2021-04-26 10:08:07 +01:00
Yu Watanabe
25054e1bfb network: add missing sections
Follow-up for 4e26a5baa0.

Fixes one of issues in #19410.
2021-04-26 10:07:52 +02:00
Yu Watanabe
cead8ed66e network: fix typo
Follow-up for 4b409e855b.
2021-04-26 09:19:41 +09:00
Yu Watanabe
3e42968342 network: dhcp4: ignore null dns address 2021-04-23 08:49:29 +09:00
Yu Watanabe
afe23f876e network: dhcp4: set gateway for route to DNS server if it is not in the same network
Fixes #19077.
2021-04-23 08:49:29 +09:00
Yu Watanabe
7f206276ad network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network
This also configures routes to gateways in static routes if the
destination is not in the same network.
2021-04-23 08:49:29 +09:00
Yu Watanabe
b714d9a6e3 network: dhcp4: also set route MTU to prefix route and DNS routes 2021-04-23 08:49:29 +09:00
Yu Watanabe
ec39af3249 Merge pull request #19392 from yuwata/network-dhcp-split-link_set_dhcp_routes
network: split link_set_dhcp_routes() into smaller functions
2021-04-23 08:32:46 +09:00
Dimitri John Ledkov
a25100488b Merge pull request #19346 from mihajlov/dhcp_broadcast_l3
network: enable DHCP broadcast flag if required by interface
2021-04-22 14:22:50 +01:00
Jóhann B. Guðmundsson
eb34cce178 fix: point to the correct drop-ins subdirectory for confs 2021-04-22 09:36:14 +02:00
Yu Watanabe
e1c08a3d0a network: dhcp4: simplify link_set_dns_routes() 2021-04-22 12:49:56 +09:00
Yu Watanabe
ff2cf67740 network: dhcp4: introduce link_set_dhcp_gateway() and link_set_dhcp_route_to_gateway() 2021-04-22 12:49:56 +09:00
Yu Watanabe
7872d0f7b6 network: dhcp4: introduce link_set_dhcp_static_routes() 2021-04-22 12:49:56 +09:00
Yu Watanabe
c0fef8f349 network: dhcp4: introduce link_set_dhcp_prefix_route() 2021-04-22 12:49:56 +09:00
Lennart Poettering
6f4a5f25fc Merge pull request #19271 from yuwata/dhcp-duid-uuid
network: fix issues arround DHCP DUID-UUID
2021-04-21 21:59:35 +02:00
Zbigniew Jędrzejewski-Szmek
1f2a7ca7ac Merge pull request #19362 from yuwata/network-dhcp6-pd-log-19354
network: dhcp6: add logs about delegated prefix
2021-04-21 18:20:49 +02:00
Viktor Mihajlovski
e70eca9b48 network: enable DHCP broadcast flag if required by interface
Some interfaces require that the DHCPOFFER message is sent via broadcast
if they can't receive unicast messages before they've been configured
with an IP address.

E.g., s390 ccwgroup network interfaces operating in layer3 mode face
this limitation. This can prevent the interfaces from receiving an
IP address via DHCP, if the have been configured for layer3.

To allow DHCP over such interfaces, we're introducing a new device
property ID_NET_DHCP_BROADCAST which can be set for those.
The networkd DHCP client will check whether this property is set
for an interface, and if so will set the broadcast flag, unless
the network configuration for the interface has an explicit
RequestBroadcast setting.

Besides that, we're adding a udev rule to set this device property
for ccwgroup devices operating in layer3 mode, which is the case
if the ID_NET_DRIVER property is qeth_l3.

Supercedes #18829
2021-04-21 18:11:18 +02:00
Yu Watanabe
28f9667d05 network: dhcp: constify link_get_duid() 2021-04-21 21:00:45 +09:00
Yu Watanabe
8c72f5c077 network: dhcp: introduce duid_needs_product_uuid() helper function 2021-04-21 21:00:45 +09:00
Yu Watanabe
294f129b0d network: configure non-dhcp configs earlier even DUID-UUID is used by DHCP clients
Previously, if DUID-UUID is used, all configurations are configured
after networkd gets product uuid of machine.

This makes only DHCP clients are delayed, and other configs are
configured earlier.
2021-04-21 21:00:45 +09:00
Yu Watanabe
4e26a5baa0 network: make IAID and DUID for DHCPv6 configurable explicitly
Closes #18996.
2021-04-21 21:00:11 +09:00