chiark / gitweb /
udev: net_setup_link - don't use Description as Alias
[elogind.git] / src / udev / net / link-config.c
index 726945816dc79580da31dfd04a3ea2a43eaec469..37918d35e3e07cda73ad539a82363b76444ec0ba 100644 (file)
@@ -124,6 +124,7 @@ static void link_configs_free(link_config_ctx *ctx) {
                 free(link->match_driver);
                 free(link->match_type);
                 free(link->description);
                 free(link->match_driver);
                 free(link->match_type);
                 free(link->description);
+                free(link->alias);
 
                 free(link);
         }
 
                 free(link);
         }
@@ -169,11 +170,10 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
         link->wol = _WOL_INVALID;
         link->duplex = _DUP_INVALID;
 
         link->wol = _WOL_INVALID;
         link->duplex = _DUP_INVALID;
 
-
         r = config_parse(NULL, filename, file, "Match\0Link\0Ethernet\0", config_item_perf_lookup,
                          (void*) link_config_gperf_lookup, false, false, link);
         if (r < 0) {
         r = config_parse(NULL, filename, file, "Match\0Link\0Ethernet\0", config_item_perf_lookup,
                          (void*) link_config_gperf_lookup, false, false, link);
         if (r < 0) {
-                log_warning("Colud not parse config file %s: %s", filename, strerror(-r));
+                log_warning("Could not parse config file %s: %s", filename, strerror(-r));
                 goto failure;
         } else
                 log_debug("Parsed configuration file %s", filename);
                 goto failure;
         } else
                 log_debug("Parsed configuration file %s", filename);
@@ -202,7 +202,7 @@ static bool enable_name_policy(void) {
                 return true;
 
         FOREACH_WORD_QUOTED(w, l, line, state)
                 return true;
 
         FOREACH_WORD_QUOTED(w, l, line, state)
-                if (strneq(w, "net.ifnames=0", l))
+                if (l == sizeof("net.ifnames=0") - 1 && strneq(w, "net.ifnames=0", l))
                         return false;
 
         return true;
                         return false;
 
         return true;
@@ -365,14 +365,6 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
         if (!old_name)
                 return -EINVAL;
 
         if (!old_name)
                 return -EINVAL;
 
-        if (config->description) {
-                r = udev_device_set_sysattr_value(device, "ifalias",
-                                                  config->description);
-                if (r < 0)
-                        log_warning("Could not set description of %s to '%s': %s",
-                                    old_name, config->description, strerror(-r));
-        }
-
         r = ethtool_set_speed(ctx->ethtool_fd, old_name, config->speed, config->duplex);
         if (r < 0)
                 log_warning("Could not set speed or duplex of %s to %u Mbytes (%s): %s",
         r = ethtool_set_speed(ctx->ethtool_fd, old_name, config->speed, config->duplex);
         if (r < 0)
                 log_warning("Could not set speed or duplex of %s to %u Mbytes (%s): %s",
@@ -440,9 +432,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
                         mac = config->mac;
         }
 
                         mac = config->mac;
         }
 
-        r = rtnl_set_link_properties(ctx->rtnl, ifindex, mac, config->mtu);
+        r = rtnl_set_link_properties(ctx->rtnl, ifindex, config->alias, mac, config->mtu);
         if (r < 0) {
         if (r < 0) {
-                log_warning("Could not set MACAddress or MTU on %s: %s", old_name, strerror(-r));
+                log_warning("Could not set Alias, MACAddress or MTU on %s: %s", old_name, strerror(-r));
                 return r;
         }
 
                 return r;
         }