]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: update MTU after CAN specific configs applied
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Nov 2023 20:19:24 +0000 (05:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Dec 2023 01:47:42 +0000 (10:47 +0900)
Changing FD mode may trigger change of MTU and maximum MTU size.
See kernel documents about CAN FD mode:
https://docs.kernel.org/networking/can.html#can-fd-flexible-data-rate-driver-support

src/network/networkd-setlink.c

index 2b37c86d2351a791aca2cf26d12a01f2579c725f..854699833d0b6b1fdc47ddb5af1f97eabc405b4d 100644 (file)
@@ -563,12 +563,20 @@ static int link_is_ready_to_set_link(Link *link, Request *req) {
                 break;
         }
         case REQUEST_TYPE_SET_LINK_MTU: {
-                Request req_ipoib = {
-                        .link = link,
-                        .type = REQUEST_TYPE_SET_LINK_IPOIB,
-                };
+                if (ordered_set_contains(link->manager->request_queue,
+                                         &(const Request) {
+                                                 .link = link,
+                                                 .type = REQUEST_TYPE_SET_LINK_IPOIB,
+                                         }))
+                        return false;
 
-                return !ordered_set_contains(link->manager->request_queue, &req_ipoib);
+                /* Changing FD mode may affect MTU. */
+                if (ordered_set_contains(link->manager->request_queue,
+                                         &(const Request) {
+                                                 .link = link,
+                                                 .type = REQUEST_TYPE_SET_LINK_CAN,
+                                         }))
+                        return false;
         }
         default:
                 break;