shill: Make nl80211 broadcast callback a list of callbacks.

This will allow multiple callbacks to be called when an nl80211 message
is received.  This allows a user to add a callback without displacing
others (e.g. disconnect metrics).

BUG=chromium-os:35468
TEST=unit tests, manual tests

Change-Id: I19d6cfac5754ea1d2a699de80d4465c49fec888c
Reviewed-on: https://gerrit.chromium.org/gerrit/36061
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Wade Guthrie <wdg@google.com>
Tested-by: Wade Guthrie <wdg@google.com>
diff --git a/netlink_socket.cc b/netlink_socket.cc
index 7108275..9d8caa3 100644
--- a/netlink_socket.cc
+++ b/netlink_socket.cc
@@ -26,6 +26,7 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <string.h>
 
 #include <net/if.h>
 #include <netlink/attr.h>
@@ -146,7 +147,8 @@
   // NetlinkSocket::SetNetlinkCallback).
   int result = nl_recvmsgs_default(nl_sock_);
   if (result < 0) {
-    LOG(ERROR) << "Failed call to nl_recvmsgs_default: " << result;
+    LOG(ERROR) << "Failed call to nl_recvmsgs_default: " << strerror(-result)
+               << " (" << result << ")";
     return false;
   }
   return true;
@@ -159,7 +161,8 @@
 
   int result = nl_recvmsgs(nl_sock_, on_netlink_data->cb_);
   if (result < 0) {
-    LOG(ERROR) << "Failed call to nl_recvmsgs: " << result;
+    LOG(ERROR) << "Failed call to nl_recvmsgs: " << strerror(-result)
+               << " (" << result << ")";
     return false;
   }
   return true;
@@ -175,7 +178,8 @@
   int result = nl_socket_modify_cb(nl_sock_, NL_CB_VALID, NL_CB_CUSTOM,
                                    on_netlink_data, callback_parameter);
   if (result) {
-    LOG(ERROR) << "nl_socket_modify_cb returned " << result;
+    LOG(ERROR) << "nl_socket_modify_cb returned " << strerror(-result)
+               << " (" << result << ")";
     return false;
   }
   return true;