]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ethtool-util: do not try to enable unsupported WoL options
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Oct 2021 12:44:02 +0000 (21:44 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Oct 2021 12:44:02 +0000 (21:44 +0900)
src/shared/ethtool-util.c

index 0b5f64c1a33335c06db29060ef3e0239540643fe..618ec8d2c3573c52e68bb71ce1518534f3a08042 100644 (file)
@@ -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)