shill: Manager: Allow Wake on LAN to be disabled

Add a Manager property which all Ethernet devices check to test whether
Wake on LAN should be enabled.  When bringing up link on an Ethernet
device, this flag will be used to enable or disable wakeup on magic
packet.  This change preserves the default behavior which is to enable
Wake on LAN by default.  This property in the Manager is not persisted.

Add a utility script for changing Wake on LAN behavior.

CQ-DEPEND=CL:211477
BUG=chromium:398277
TEST=Manual (see below)
  1. On a system with a connected USB-to-Ethernet adapter, run:

       ethtool eth0 | grep -e '^.Wake'

     and observe that by default the output is:

       Wake-on: g

     as a result of https://chromium-review.googlesource.com/192665

  2. Run the following command:

      dbus-send --system --print-reply --dest=org.chromium.flimflam \
          / org.chromium.flimflam.Manager.SetProperty string:WakeOnLanEnabled \
          variant:boolean:false

  3. Repeat step 1 and note that the output is still "Wake-on: g"

  4. Detach and re-attach Ethernet and not the output from step 1 i snow "Wake-on: d"

  5. Run "restart shill" and note the output from step 1 is back to "Wake-on: g"

Change-Id: I99e645f7e96fafcb19524a3355673d16f6bf5c15
Reviewed-on: https://chromium-review.googlesource.com/211495
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.h b/manager.h
index 980f7c2..ecf0b3a 100644
--- a/manager.h
+++ b/manager.h
@@ -242,6 +242,9 @@
   virtual bool IsTechnologyLinkMonitorEnabled(
       Technology::Identifier technology) const;
 
+  // Return whether the Wake on LAN feature is enabled.
+  virtual bool IsWakeOnLanEnabled() const { return is_wake_on_lan_enabled_; }
+
   // Called by Profile when a |storage| completes initialization.
   void OnProfileStorageInitialized(StoreInterface *storage);
 
@@ -629,6 +632,9 @@
   // Is a suspend delay currently registered with the power manager?
   bool suspend_delay_registered_;
 
+  // Whether Wake on LAN should be enabled for all Ethernet devices.
+  bool is_wake_on_lan_enabled_;
+
   // Maps tags to callbacks for monitoring default service changes.
   std::map<int, ServiceCallback> default_service_callbacks_;
   int default_service_callback_tag_;