diff options
Diffstat (limited to 'src/udev/net/ethtool-util.c')
-rw-r--r-- | src/udev/net/ethtool-util.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c index bc0deaf347..0dcec03f67 100644 --- a/src/udev/net/ethtool-util.c +++ b/src/udev/net/ethtool-util.c @@ -31,18 +31,18 @@ static const char* const wol_table[_WOL_MAX] = { [WOL_ARP] = "arp", [WOL_MAGIC] = "magic", [WOL_MAGICSECURE] = "secureon", - [WOL_OFF] = "off" + [WOL_OFF] = "off", }; DEFINE_STRING_TABLE_LOOKUP(wol, WakeOnLan); DEFINE_CONFIG_PARSE_ENUM(config_parse_wol, wol, WakeOnLan, "Failed to parse WakeOnLan setting"); -static const char* const port_table[_NET_DEV_PORT_MAX] = { +static const char* const port_table[] = { [NET_DEV_PORT_TP] = "tp", [NET_DEV_PORT_AUI] = "aui", [NET_DEV_PORT_MII] = "mii", [NET_DEV_PORT_FIBRE] = "fibre", - [NET_DEV_PORT_BNC] = "bnc" + [NET_DEV_PORT_BNC] = "bnc", }; DEFINE_STRING_TABLE_LOOKUP(port, NetDevPort); @@ -583,7 +583,7 @@ int ethtool_set_glinksettings(int *fd, const char *ifname, struct link_config *l struct ifreq ifr = {}; int r; - if (link->autonegotiation != 0) { + if (link->autonegotiation != AUTONEG_DISABLE && eqzero(link->advertise)) { log_info("link_config: autonegotiation is unset or enabled, the speed and duplex are not writable."); return 0; } @@ -612,9 +612,11 @@ int ethtool_set_glinksettings(int *fd, const char *ifname, struct link_config *l if (link->port != _NET_DEV_PORT_INVALID) u->base.port = link->port; - u->base.autoneg = link->autonegotiation; + if (link->autonegotiation >= 0) + u->base.autoneg = link->autonegotiation; if (!eqzero(link->advertise)) { + u->base.autoneg = AUTONEG_ENABLE; memcpy(&u->link_modes.advertising, link->advertise, sizeof(link->advertise)); memzero((uint8_t*) &u->link_modes.advertising + sizeof(link->advertise), ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES - sizeof(link->advertise)); |