shill: Add message-specific callbacks to the nl80211 code.
This allows users to create a one-off nl80211 message, install a
callback for that message, and then send the message to the kernel.
When the response is issued, the callback will be called and then
removed from the system.
BUG=chromium-os:35129
TEST=Manual and unit tests (including new ones).
Change-Id: I06bf8d16629f3eac226209b49827289e7a9cdca3
Reviewed-on: https://gerrit.chromium.org/gerrit/36904
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Ready: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
diff --git a/netlink_socket.cc b/netlink_socket.cc
index 9d8caa3..15fa99c 100644
--- a/netlink_socket.cc
+++ b/netlink_socket.cc
@@ -168,6 +168,18 @@
return true;
}
+unsigned int NetlinkSocket::GetSequenceNumber() {
+ unsigned int number = nl_socket_use_seq(nl_sock_);
+ if (number == 0) {
+ number = nl_socket_use_seq(nl_sock_);
+ }
+ if (number == 0) {
+ LOG(WARNING) << "Couldn't get non-zero sequence number";
+ number = 1;
+ }
+ return number;
+}
+
bool NetlinkSocket::SetNetlinkCallback(nl_recvmsg_msg_cb_t on_netlink_data,
void *callback_parameter) {
if (!nl_sock_) {