From 20274ab86ac234e4d1f216257f660ba0c0e3841e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 6 Oct 2021 21:44:02 +0900 Subject: [PATCH] ethtool-util: do not try to enable unsupported WoL options --- src/shared/ethtool-util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)