diff options
author | Tom Gundersen <teg@jklm.no> | 2013-11-25 01:33:04 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-11-25 14:53:56 +0100 |
commit | d2df0d0ed3a88e491405b403e6022e6619750130 (patch) | |
tree | d9bccbc34a4c2283403498b9b7ca7ce0d702a6c7 /src/udev | |
parent | 517dcac840fe8d5bf30a05c0084eff219af10a4a (diff) |
udev: net_setup_link - don't use Description as Alias
Use Description only internally, and allow Alias to be set
as a separate option. For instance SNMP uses ifalias for
a specific purpose, so let's not write to it by default.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/net/link-config-gperf.gperf | 1 | ||||
-rw-r--r-- | src/udev/net/link-config.c | 13 | ||||
-rw-r--r-- | src/udev/net/link-config.h | 1 |
3 files changed, 5 insertions, 10 deletions
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf index 1fe0b93e53..950fb15286 100644 --- a/src/udev/net/link-config-gperf.gperf +++ b/src/udev/net/link-config-gperf.gperf @@ -25,6 +25,7 @@ Link.MACAddressPolicy, config_parse_mac_policy, 0, offsetof(link Link.MACAddress, config_parse_hwaddr, 0, offsetof(link_config, mac) Link.NamePolicy, config_parse_name_policy, 0, offsetof(link_config, name_policy) Link.Name, config_parse_ifname, 0, offsetof(link_config, name) +Link.Alias, config_parse_ifalias, 0, offsetof(link_config, alias) Link.MTU, config_parse_unsigned, 0, offsetof(link_config, mtu) Link.SpeedMBytes, config_parse_unsigned, 0, offsetof(link_config, speed) Link.Duplex, config_parse_duplex, 0, offsetof(link_config, duplex) diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 5156ba6f8a..37918d35e3 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -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); } @@ -364,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", @@ -439,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; } diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h index 9747003635..f74a790d55 100644 --- a/src/udev/net/link-config.h +++ b/src/udev/net/link-config.h @@ -59,6 +59,7 @@ struct link_config { MACPolicy mac_policy; NamePolicy *name_policy; char *name; + char *alias; unsigned int mtu; unsigned int speed; Duplex duplex; |