shill: add ability to blacklist devices

BUG=chromium-os:16787
TEST=ebuild + manual

manual testing: set up mac80211_hwsim and hostapd on a device.
run shill, observe that it core dumps. run shill again, with
"--black-list=mon.wlan1", observe that it does not core dump.

Change-Id: Id43ed8badc2d8ac414c8a2ceb7487ecb85dc851c
Reviewed-on: http://gerrit.chromium.org/gerrit/4414
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/device_info.cc b/device_info.cc
index 4540f6b..9e61026 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -20,6 +20,7 @@
 #include <base/hash_tables.h>
 #include <base/logging.h>
 #include <base/memory/scoped_ptr.h>
+#include <base/stl_util-inl.h>
 #include <base/stringprintf.h>
 
 #include "shill/control_interface.h"
@@ -62,6 +63,10 @@
 
 DeviceInfo::~DeviceInfo() {}
 
+void DeviceInfo::AddDeviceToBlackList(const string &device_name) {
+  black_list_.insert(device_name);
+}
+
 void DeviceInfo::Start() {
   link_listener_.reset(
       new RTNLListener(RTNLHandler::kRequestLink, link_callback_.get()));
@@ -146,7 +151,11 @@
     VLOG(2) << "add link index "  << dev_index << " name " << link_name;
 
     if (link_name) {
-      technology = GetDeviceTechnology(link_name);
+      if (ContainsKey(black_list_, link_name)) {
+        technology = Device::kBlacklisted;
+      } else {
+        technology = GetDeviceTechnology(link_name);
+      }
     }
 
     switch (technology) {