From: Yu Watanabe Date: Wed, 22 Nov 2023 19:56:58 +0000 (+0900) Subject: network: do not try to update IP sysctl settings for CAN devices X-Git-Tag: v256-rc1~1515^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f43ce810c408ee491b6edfc14c7680ee29274238;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c index 24525a10c1a..2b226b2e2a1 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;