systemd-link: ethtool add support for more Wake up Lan setting (#6331)
This works supports to configure nicast, multicast, broadcast, arp and SecureOn.
This commit is contained in:
parent
ec9d3a7e1d
commit
617da14cfd
|
@ -385,6 +385,30 @@
|
||||||
<para>Wake on PHY activity.</para>
|
<para>Wake on PHY activity.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>unicast</literal></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Wake on unicast messages.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>multicast</literal></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Wake on multicast messages.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>broadcast</literal></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Wake on broadcast messages.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>arp</literal></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Wake on ARP.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>magic</literal></term>
|
<term><literal>magic</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -392,6 +416,13 @@
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><literal>secureon</literal></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Enable secureon(tm) password for MagicPacket(tm).
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>off</literal></term>
|
<term><literal>off</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
@ -41,9 +41,14 @@ DEFINE_STRING_TABLE_LOOKUP(duplex, Duplex);
|
||||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_duplex, duplex, Duplex, "Failed to parse duplex setting");
|
DEFINE_CONFIG_PARSE_ENUM(config_parse_duplex, duplex, Duplex, "Failed to parse duplex setting");
|
||||||
|
|
||||||
static const char* const wol_table[_WOL_MAX] = {
|
static const char* const wol_table[_WOL_MAX] = {
|
||||||
[WOL_PHY] = "phy",
|
[WOL_PHY] = "phy",
|
||||||
[WOL_MAGIC] = "magic",
|
[WOL_UCAST] = "unicast",
|
||||||
[WOL_OFF] = "off"
|
[WOL_MCAST] = "multicast",
|
||||||
|
[WOL_BCAST] = "broadcast",
|
||||||
|
[WOL_ARP] = "arp",
|
||||||
|
[WOL_MAGIC] = "magic",
|
||||||
|
[WOL_MAGICSECURE] = "secureon",
|
||||||
|
[WOL_OFF] = "off"
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STRING_TABLE_LOOKUP(wol, WakeOnLan);
|
DEFINE_STRING_TABLE_LOOKUP(wol, WakeOnLan);
|
||||||
|
@ -195,26 +200,56 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) {
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
switch (wol) {
|
switch (wol) {
|
||||||
case WOL_PHY:
|
case WOL_PHY:
|
||||||
if (ecmd.wolopts != WAKE_PHY) {
|
if (ecmd.wolopts != WAKE_PHY) {
|
||||||
ecmd.wolopts = WAKE_PHY;
|
ecmd.wolopts = WAKE_PHY;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WOL_MAGIC:
|
case WOL_UCAST:
|
||||||
if (ecmd.wolopts != WAKE_MAGIC) {
|
if (ecmd.wolopts != WAKE_UCAST) {
|
||||||
ecmd.wolopts = WAKE_MAGIC;
|
ecmd.wolopts = WAKE_UCAST;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WOL_OFF:
|
case WOL_MCAST:
|
||||||
if (ecmd.wolopts != 0) {
|
if (ecmd.wolopts != WAKE_MCAST) {
|
||||||
ecmd.wolopts = 0;
|
ecmd.wolopts = WAKE_MCAST;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case WOL_BCAST:
|
||||||
break;
|
if (ecmd.wolopts != WAKE_BCAST) {
|
||||||
|
ecmd.wolopts = WAKE_BCAST;
|
||||||
|
need_update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WOL_ARP:
|
||||||
|
if (ecmd.wolopts != WAKE_ARP) {
|
||||||
|
ecmd.wolopts = WAKE_ARP;
|
||||||
|
need_update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WOL_MAGIC:
|
||||||
|
if (ecmd.wolopts != WAKE_MAGIC) {
|
||||||
|
ecmd.wolopts = WAKE_MAGIC;
|
||||||
|
need_update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WOL_MAGICSECURE:
|
||||||
|
if (ecmd.wolopts != WAKE_MAGICSECURE) {
|
||||||
|
ecmd.wolopts = WAKE_MAGICSECURE;
|
||||||
|
need_update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WOL_OFF:
|
||||||
|
if (ecmd.wolopts != 0) {
|
||||||
|
ecmd.wolopts = 0;
|
||||||
|
need_update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_update) {
|
if (need_update) {
|
||||||
|
|
|
@ -37,7 +37,12 @@ typedef enum Duplex {
|
||||||
|
|
||||||
typedef enum WakeOnLan {
|
typedef enum WakeOnLan {
|
||||||
WOL_PHY,
|
WOL_PHY,
|
||||||
|
WOL_UCAST,
|
||||||
|
WOL_MCAST,
|
||||||
|
WOL_BCAST,
|
||||||
|
WOL_ARP,
|
||||||
WOL_MAGIC,
|
WOL_MAGIC,
|
||||||
|
WOL_MAGICSECURE,
|
||||||
WOL_OFF,
|
WOL_OFF,
|
||||||
_WOL_MAX,
|
_WOL_MAX,
|
||||||
_WOL_INVALID = -1
|
_WOL_INVALID = -1
|
||||||
|
|
Loading…
Reference in a new issue