Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 113880

Summary: Wake on LAN support within net.ethX scripts
Product: Gentoo Linux Reporter: Ryan Phillips (RETIRED) <rphillips>
Component: [OLD] baselayoutAssignee: Roy Marples (RETIRED) <uberlord>
Status: RESOLVED FIXED    
Severity: normal CC: ahbritto, anigel, base-system, gengor, jcabillot, martin.danjou14, martin.hierling, stolz, wschlich
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Wake On LAN patch

Description Ryan Phillips (RETIRED) gentoo-dev 2005-11-29 00:38:49 UTC
I figured out how to get WOL support working nicely with Gentoo, but it requires
a  change to the net.ethX script to _not_ bring down the driver and network
card.  A configuration option would be useful to designate which NIC not to
bring down and also run: 

ethtool -s ethX wol g
(g being a magic packet, but it could be configurable, "pumbagsd" are all valid
options to ethtool)

Another requirement is that /etc/init.d/shutdown.sh needs the 'i' removed from
the a halt command to prevent the network cards from automatically being
shutdown by halt.

Comments?
Comment 1 SpanKY gentoo-dev 2005-11-29 06:45:15 UTC
lets get wol into the netscripts before we worry about using -i ;)
Comment 2 Roy Marples (RETIRED) gentoo-dev 2005-11-29 07:23:34 UTC
I'm not too sure about integrating ethtool myself - all it's commands would be
very system specific, so you might as well do this in /etc/conf.d/net

down_eth0="no" # unimplented, but trivial if required
postdown() {
   # Enable WOL for eth0
   if [[ ${IFACE} == "eth0" ]]; then
      ethtool -s "${IFACE}" wol g
   fi
}

We could always document that in /etc/conf.d/net.example

OR we could do this

down_eth0="no" # unimplented, but trivial if required
ethtool_eth0="wol g"

Easier to configure perhaps, but with the added weight of another module

Thoughts?
Comment 3 Ryan Phillips (RETIRED) gentoo-dev 2005-11-29 11:01:30 UTC
I think the postdown() and down_ethX is much cleaner, and could be more useful.
 All that is really required by the net scripts is not bringing down the
interface.  Add a comment in the postdown() method regarding WOL and we should
be done.
Comment 4 Roy Marples (RETIRED) gentoo-dev 2005-11-29 14:34:15 UTC
Created attachment 73811 [details, diff]
Wake On LAN patch

This patch adds an example in the postdown function for WOL and adds the
RC_DOWN_INTERFACE variable to /etc/conf.d/rc which is used by net.lo and
shutdown.sh

Wanna test it against baselayout-1.12.0_pre11-r3 ?
Comment 5 Roy Marples (RETIRED) gentoo-dev 2005-12-14 01:48:47 UTC
Right, 2 people have added themselves to this bug - could either they or the 
reporter please give some indication whether this patch enables a working WOL 
or not. 
Comment 6 Ryan Phillips (RETIRED) gentoo-dev 2005-12-20 15:33:53 UTC
I shall try it out
Comment 7 Ryan Phillips (RETIRED) gentoo-dev 2005-12-20 15:58:22 UTC
It worked fine for me.  I tested with the AMD magic packet tool for windows.
Comment 8 Roy Marples (RETIRED) gentoo-dev 2005-12-21 03:09:28 UTC
Applied to our SVN repo - will be in baselayout-1.12.0_pre13
Comment 9 Roy Marples (RETIRED) gentoo-dev 2005-12-21 03:10:05 UTC
.
Comment 10 Stolz 2005-12-21 20:17:52 UTC
It worked for me too :), thanks.

But instead of using postdown() suggested on the patch, I've used the one from comment #2, because ethtool complains if you try to activate WOL for "lo" ;)

BTW,for enabling WoL I used to add the "ethtool -s ethX wol g" at /etc/conf.d/local.stop but it stopped working. Does anyone knowns the reason?
Comment 11 Roy Marples (RETIRED) gentoo-dev 2005-12-22 04:59:17 UTC
(In reply to comment #10)
> It worked for me too :), thanks.
> 
> But instead of using postdown() suggested on the patch, I've used the one from
> comment #2, because ethtool complains if you try to activate WOL for "lo" ;)

OK, example updated to this

[[ ${IFACE} != "lo" ]] && ethtool -s "${IFACE}" wol g
Comment 12 Roy Marples (RETIRED) gentoo-dev 2005-12-22 05:00:25 UTC
(In reply to comment #10)
> BTW,for enabling WoL I used to add the "ethtool -s ethX wol g" at
> /etc/conf.d/local.stop but it stopped working. Does anyone knowns the reason?

local gets stopped before net.eth0 - so WOL gets applied by local and then forgotten as net.eth0 takes the interface down.

Just a guess .....
Comment 13 Roy Marples (RETIRED) gentoo-dev 2006-01-04 00:24:08 UTC
Fixed in pre13
Comment 14 Martin d'Anjou 2006-02-01 14:02:14 UTC
Please consider the following comment:

3c59x cards don't appear to work well with ethtool:
# ethtool -s eth0 wol g
Cannot get current wake-on-lan settings: Operation not supported
  not setting wol

On the other hand, when I use ifconfig eth0 down, I am able to put the adapter in D3 mode (the mode where I can wake up from lan). See this:

BEFORE:
00:0f.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
  ...
  Status: D0 PME-Enable- DSel=0 DScale=2 PME-

# ifconfig eth0 down

00:0f.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
  ...
  Status: D3 PME-Enable- DSel=0 DScale=2 PME-

Please make sure we can pick either ethtool or ifconfig to put the ethernet card in WOL mode. Thanks.
Comment 15 Hubert Mercier (RETIRED) gentoo-dev 2006-05-05 07:18:00 UTC
Great !

This new baselayout release allowed me to make wol work. ASUS A8NSLI / skge module. Just had to add ethtool -s eth0 wol g to /etc/conf.d/local.stop

Thanks !
Comment 16 SpanKY gentoo-dev 2006-08-12 17:25:16 UTC
*** Bug 143695 has been marked as a duplicate of this bug. ***