From f43ce810c408ee491b6edfc14c7680ee29274238 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 23 Nov 2023 04:56:58 +0900 Subject: [PATCH] network: do not try to update IP sysctl settings for CAN devices CAN devices do not support IP layer. Most of the functions below are never called for CAN devices, but link_set_ipv6_mtu() may be called after setting interface MTU, and warn about the failure. For safety, let's unconditionally check if the interface is not a CAN device. --- src/network/networkd-sysctl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c index 24525a10c1..2b226b2e2a 100644 --- a/src/network/networkd-sysctl.c +++ b/src/network/networkd-sysctl.c @@ -22,6 +22,12 @@ static bool link_is_configured_for_family(Link *link, int family) { if (link->flags & IFF_LOOPBACK) return false; + /* CAN devices do not support IP layer. Most of the functions below are never called for CAN devices, + * but link_set_ipv6_mtu() may be called after setting interface MTU, and warn about the failure. For + * safety, let's unconditionally check if the interface is not a CAN device. */ + if (IN_SET(family, AF_INET, AF_INET6) && link->iftype == ARPHRD_CAN) + return false; + if (family == AF_INET6 && !socket_ipv6_is_supported()) return false; -- 2.25.1