]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not try to update IP sysctl settings for CAN devices
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Nov 2023 19:56:58 +0000 (04:56 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Dec 2023 01:47:42 +0000 (10:47 +0900)
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

index 24525a10c1af9f135eafe950e9c8f3f50dd48f87..2b226b2e2a1836cedd969917de85973c4832f272 100644 (file)
@@ -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;