]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not try to configure address or etc on can device
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 29 Apr 2021 22:10:34 +0000 (07:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 30 Apr 2021 10:16:02 +0000 (19:16 +0900)
src/network/networkd-can.c
src/network/networkd-link.c
src/network/networkd-link.h

index 1279d1b89f06fbdd9be710ac3cd1cdb29744fb04..e448a1ad02c4effea6cdaddf64e494cfe1e56928 100644 (file)
@@ -69,6 +69,9 @@ static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link)
 
         log_link_debug(link, "Link set");
 
+        link->can_configured = true;
+        link_check_ready(link);
+
         return 1;
 }
 
@@ -269,5 +272,8 @@ int link_configure_can(Link *link) {
                 }
         }
 
+        link->can_configured = true;
+        link_check_ready(link);
+
         return 0;
 }
index c93cdf7bb149c6bbeabd01c67047073bda28bdae..7da08c5430f9f8f98f60a2aa4287a44f8206a2a9 100644 (file)
@@ -764,6 +764,15 @@ void link_check_ready(Link *link) {
         if (!link->network)
                 return;
 
+        if (link->iftype == ARPHRD_CAN) {
+                /* let's shortcut things for CAN which doesn't need most of checks below. */
+                if (!link->can_configured)
+                        return (void) log_link_debug(link, "%s(): CAN device is not configured.", __func__);
+
+                link_enter_configured(link);
+                return;
+        }
+
         if (!link->addresses_configured)
                 return (void) log_link_debug(link, "%s(): static addresses are not configured.", __func__);
 
@@ -2076,6 +2085,7 @@ int link_configure(Link *link) {
                 return r;
 
         if (link->iftype == ARPHRD_CAN)
+                /* let's shortcut things for CAN which doesn't need most of what's done below. */
                 return link_configure_can(link);
 
         r = link_set_sysctl(link);
@@ -2567,6 +2577,10 @@ static int link_carrier_gained(Link *link) {
 
         assert(link);
 
+        if (link->iftype == ARPHRD_CAN)
+                /* let's shortcut things for CAN which doesn't need most of what's done below. */
+                return link_handle_bound_by_list(link);
+
         r = wifi_get_info(link);
         if (r < 0)
                 return r;
@@ -2625,6 +2639,10 @@ static int link_carrier_lost(Link *link) {
         if (link->network && link->network->ignore_carrier_loss)
                 return 0;
 
+        if (link->iftype == ARPHRD_CAN)
+                /* let's shortcut things for CAN which doesn't need most of what's done below. */
+                return link_handle_bound_by_list(link);
+
         /* Some devices reset itself while setting the MTU. This causes the DHCP client fall into a loop.
          * setting_mtu keep track whether the device got reset because of setting MTU and does not drop the
          * configuration and stop the clients as well. */
index f4a2b1f2402fa7da71b950837da2749dd4b5ffcf..541231b4b94457b7b5f7558eb18c9678764de924 100644 (file)
@@ -131,6 +131,7 @@ typedef struct Link {
         bool setting_genmode:1;
         bool ipv6_mtu_set:1;
         bool bridge_mdb_configured:1;
+        bool can_configured:1;
         bool activated:1;
 
         sd_dhcp_server *dhcp_server;