chiark / gitweb /
trivial coding style clean ups
[elogind.git] / src / udev / net / link-config.c
index cb4af143dc1fb78996dda39cee77cbc7625c40fb..f25afa60c791e8bc356675a7ceb2d773bf56edcc 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->alias);
 
                 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;
 
-
         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);
@@ -202,7 +202,7 @@ static bool enable_name_policy(void) {
                 return true;
 
         FOREACH_WORD_QUOTED(w, l, line, state)
-                if (l == sizeof("net.ifnames=0") - 1 && strneq(w, "net.ifnames=0", l))
+                if (strneq(w, "net.ifnames=0", l))
                         return false;
 
         return true;
@@ -334,7 +334,7 @@ static int get_mac(struct udev_device *device, bool want_random, struct ether_ad
 
         srandom(seed);
 
-        for(i = 0; i < ETH_ALEN; i++) {
+        for (i = 0; i < ETH_ALEN; i++) {
                 mac->ether_addr_octet[i] = random();
         }
 
@@ -365,14 +365,6 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
         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",
@@ -440,9 +432,9 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
                         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) {
-                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;
         }