shill: Makes WiFi device get available wifi frequencies from kernel.
Plus a couple of whitespace fixes. This CL is in preparation for
passing the list of wifi frequencies to a scan request.
BUG=chromium:222088
TEST=unittest and manual tests. The manual tests consist of:
- Start shill with log=-10/wifi. On the target, in a shell window,
do the following:
o stop shill
o shill --log-level=-10 --log-scopes=wifi
- Wait five seconds (the code will do everything it needs to at
startup).
- Look in /var/log/net.log and verify the following:
o Found frequency[xx] = yyyy
o There should be several frequencies (at least in the open at Google).
o 'xx' is a number, I'd expect it to start at 0.
o 'yyyy' is a number in the 5000s or the 2000x.
Change-Id: I8f0526abc22a7e9e60fd964c96d05eb95fa10e78
Reviewed-on: https://gerrit.chromium.org/gerrit/49271
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
diff --git a/nl80211_message.cc b/nl80211_message.cc
index 3fc8baa..9f53b69 100644
--- a/nl80211_message.cc
+++ b/nl80211_message.cc
@@ -24,10 +24,10 @@
#include "shill/nl80211_message.h"
-#include <limits.h>
#include <netlink/msg.h>
#include <netlink/netlink.h>
+#include <limits>
#include <map>
#include <string>
#include <vector>
@@ -425,7 +425,9 @@
// Nl80211Frame
Nl80211Frame::Nl80211Frame(const ByteString &raw_frame)
- : frame_type_(kIllegalFrameType), reason_(UINT16_MAX), status_(UINT16_MAX),
+ : frame_type_(kIllegalFrameType),
+ reason_(std::numeric_limits<uint16_t>::max()),
+ status_(std::numeric_limits<uint16_t>::max()),
frame_(raw_frame) {
const IEEE_80211::ieee80211_frame *frame =
reinterpret_cast<const IEEE_80211::ieee80211_frame *>(
@@ -563,6 +565,11 @@
const uint8_t GetWiphyMessage::kCommand = NL80211_CMD_GET_WIPHY;
const char GetWiphyMessage::kCommandString[] = "NL80211_CMD_GET_WIPHY";
+GetWiphyMessage::GetWiphyMessage() : Nl80211Message(kCommand, kCommandString) {
+ attributes()->CreateAttribute(
+ NL80211_ATTR_IFINDEX, Bind(&NetlinkAttribute::NewNl80211AttributeFromId));
+}
+
const uint8_t JoinIbssMessage::kCommand = NL80211_CMD_JOIN_IBSS;
const char JoinIbssMessage::kCommandString[] = "NL80211_CMD_JOIN_IBSS";