summaryrefslogtreecommitdiff
path: root/src/shared/ethtool-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-10-06 21:44:02 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-10-06 21:44:02 +0900
commit20274ab86ac234e4d1f216257f660ba0c0e3841e (patch)
treeabb9f8cda63082f873c338992f287f3dae2e21ec /src/shared/ethtool-util.c
parentb4b2a492870b441ab078ecd8db2aee1a6d0c1d08 (diff)
downloadsystemd-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.c10
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)