diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-10-06 21:44:02 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-10-06 21:44:02 +0900 |
commit | 20274ab86ac234e4d1f216257f660ba0c0e3841e (patch) | |
tree | abb9f8cda63082f873c338992f287f3dae2e21ec /src/shared/ethtool-util.c | |
parent | b4b2a492870b441ab078ecd8db2aee1a6d0c1d08 (diff) | |
download | systemd-20274ab86ac234e4d1f216257f660ba0c0e3841e.tar.gz |
ethtool-util: do not try to enable unsupported WoL options
Diffstat (limited to 'src/shared/ethtool-util.c')
-rw-r--r-- | src/shared/ethtool-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c index 0b5f64c1a3..618ec8d2c3 100644 --- a/src/shared/ethtool-util.c +++ b/src/shared/ethtool-util.c @@ -425,6 +425,16 @@ int ethtool_set_wol(int *ethtool_fd, const char *ifname, uint32_t wolopts) { if (ioctl(*ethtool_fd, SIOCETHTOOL, &ifr) < 0) return -errno; + if ((wolopts & ~ecmd.supported) != 0) { + _cleanup_free_ char *str = NULL; + + (void) wol_options_to_string_alloc(wolopts & ~ecmd.supported, &str); + log_debug("Network interface %s does not support requested Wake on LAN option(s) \"%s\", ignoring.", + ifname, strna(str)); + + wolopts &= ecmd.supported; + } + UPDATE(ecmd.wolopts, wolopts, need_update); if (!need_update) |