From: Yu Watanabe Date: Wed, 6 Oct 2021 12:44:02 +0000 (+0900) Subject: ethtool-util: do not try to enable unsupported WoL options X-Git-Tag: v250-rc1~557^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20274ab86ac234e4d1f216257f660ba0c0e3841e;p=thirdparty%2Fsystemd.git ethtool-util: do not try to enable unsupported WoL options --- diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c index 0b5f64c1a33..618ec8d2c35 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)