[PATCH 1/6] anqp: Only register for frames on station interfaces
by Andrew Zaborowski
Check the iftype before registering ANQP on new interface.
Not that the check here and in rrm.c (which already checks the iftype)
may need to be extended to run on NETDEV_WATCH_EVENT_UP because a device
could be created with a different iftype and then have the iftype changed
before powering up.
---
src/anqp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/anqp.c b/src/anqp.c
index f3171456..6627bd81 100644
--- a/src/anqp.c
+++ b/src/anqp.c
@@ -374,7 +374,9 @@ static void anqp_netdev_watch(struct netdev *netdev,
{
switch (event) {
case NETDEV_WATCH_EVENT_NEW:
- anqp_register_frame(netdev_get_ifindex(netdev));
+ if (netdev_get_iftype(netdev) == NETDEV_IFTYPE_STATION)
+ anqp_register_frame(netdev_get_ifindex(netdev));
+
return;
default:
break;
--
2.20.1
2 years, 6 months
[PATCH v2 1/6] monitor: print START_TIME_TSF/BSSID values
by James Prestwood
---
monitor/nlmon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index 94d16979..4c0e045f 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -5578,6 +5578,10 @@ static const struct attr_entry attr_table[] = {
"FTM Responder" },
{ NL80211_ATTR_FTM_RESPONDER_STATS,
"FTM Responder Stats" },
+ { NL80211_ATTR_SCAN_START_TIME_TSF,
+ "Scan Start Time", ATTR_U64 },
+ { NL80211_ATTR_SCAN_START_TIME_TSF_BSSID,
+ "Scan Start Time BSSID", ATTR_ADDRESS },
{ }
};
--
2.17.1
2 years, 6 months
[PATCH 1/6] monitor: print START_TIME_TSF/BSSID values
by James Prestwood
---
monitor/nlmon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index 94d16979..4c0e045f 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -5578,6 +5578,10 @@ static const struct attr_entry attr_table[] = {
"FTM Responder" },
{ NL80211_ATTR_FTM_RESPONDER_STATS,
"FTM Responder Stats" },
+ { NL80211_ATTR_SCAN_START_TIME_TSF,
+ "Scan Start Time", ATTR_U64 },
+ { NL80211_ATTR_SCAN_START_TIME_TSF_BSSID,
+ "Scan Start Time BSSID", ATTR_ADDRESS },
{ }
};
--
2.17.1
2 years, 6 months
[PATCH] rrm: remove use of floating point math
by James Prestwood
The RCPI value was using floating point values as per the spec. But instead
we can just use the signal strength coming from the kernel in mili mdm and
scale the hard coded values by a factor of 100.
---
src/rrm.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/rrm.c b/src/rrm.c
index 4c736910..2b0a22fb 100644
--- a/src/rrm.c
+++ b/src/rrm.c
@@ -25,7 +25,6 @@
#endif
#include <stdint.h>
-#include <math.h>
#include <linux/if_ether.h>
#include <ell/ell.h>
@@ -247,7 +246,6 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
uint8_t *to)
{
uint8_t *start = to;
- double dbms = bss->signal_strength / 100;
*to++ = beacon->oper_class;
*to++ = scan_freq_to_channel(bss->frequency, NULL);
@@ -259,10 +257,10 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
*to++ = rrm_phy_type(bss);
/* 802.11 Table 9-154 - RCPI values */
- if (dbms < -109.5)
+ if (bss->signal_strength < -10950)
*to++ = 0;
- else if (dbms >= -109.5 && dbms < 0)
- *to++ = (uint8_t)floor(2 * (dbms + 110));
+ else if (bss->signal_strength >= -10950 && bss->signal_strength < 0)
+ *to++ = (uint8_t)((2 * (bss->signal_strength + 11000)) / 100);
else
*to++ = 220;
--
2.17.1
2 years, 6 months
[RFCv3] Document P2P dbus interfaces
by Andrew Zaborowski
From: Andrew Zaborowski <andrew.zaborowski(a)intel.com>
Proposed minimum P2P interfaces for establishing basic connections. The
device discovery results in creation of P2PPeer objects.
In the Wi-Fi Display API we are passing raw IE data because there's a
relatively big set of different values that may be encoded in them. We
could reduce them to 2-3 bools and integers but this might limit the
client implementations feature set.
---
doc/p2p-api.txt | 82 ++++++++++++++++++++++++++++++++++
doc/p2p-peer-api.txt | 66 +++++++++++++++++++++++++++
doc/p2p-wfd-agent-api.txt | 34 ++++++++++++++
doc/signal-level-agent-api.txt | 4 ++
4 files changed, 186 insertions(+)
create mode 100644 doc/p2p-api.txt
create mode 100644 doc/p2p-peer-api.txt
create mode 100644 doc/p2p-wfd-agent-api.txt
diff --git a/doc/p2p-api.txt b/doc/p2p-api.txt
new file mode 100644
index 00000000..84f862e5
--- /dev/null
+++ b/doc/p2p-api.txt
@@ -0,0 +1,82 @@
+P2P hierarchy
+=============
+
+Service net.connman.iwd
+Interface net.connman.iwd.P2P [Experimental]
+Object path /{phy0,phy1,...}
+
+Methods array(on) GetPeers()
+
+ Returns a list (possibly empty) of detected P2P peers.
+ Each record returned contains a tuple of the following
+ values.
+
+ object Object
+
+ net.connman.iwd.P2PPeer object representing
+ the peer device.
+
+ int16 SignalStrength
+
+ Peer's maximum signal strength expressed
+ in 100 * dBm. The value is the range of 0
+ (strongest signal) to -10000 (weakest signal)
+
+ void RegisterSignalLevelAgent(object path,
+ array(int16) levels)
+
+ Register the agent object to receive signal strength
+ level change notifications on the
+ net.connman.iwd.SignalLevelAgent interface, see
+ signal-level-agent-api.txt. The "levels"
+ parameters decides the thresholds in dBm that will
+ generate a call to the agent's Changed
+ method whenever current RSSI crosses any of the
+ values. The values must be passed in descending
+ order. The number and distance between requested
+ threshold values is a compromise between resolution
+ and the frequency of system wakeups and
+ context-switches that are going to be occuring to
+ update the client's signal meter. Only one agent
+ can be registered at any time.
+
+ Possible Errors: [service].Error.InvalidArguments
+ [service].Error.Failed
+ [service].Error.AlreadyExists
+ [service].Error.NotSupported
+
+ void RegisterWFDService(object path, array(byte) payload)
+
+ Register the Wi-Fi Display service running on local
+ host with this P2P device so that device discovery
+ and connection setup phases include necessary WFD
+ information for the peers and receive peer's WFD
+ service information. An object may be provided to
+ receive relevant WFD information about peers and
+ connections through method calls on the object's
+ net.connman.iwd.P2PWFDAgent interface. See
+ p2p-wfd-agent-api.txt. Only one agent can be
+ registered at any time. The byte array provided
+ will be included in WFD Information Elements
+ present in relevant frames sent to peers.
+
+ Possible Errors: [service].Error.InvalidArguments
+ [service].Error.AlreadyExists
+ [service].Error.NotSupported
+
+Properties boolean Enabled [readwrite]
+
+ Whether local P2P device is started, i.e. is scanning
+ for peers, is discoverable by peers and/or connected
+ to peer(s).
+
+ string Name [readwrite]
+
+ Sets local P2P device name as it is going to be
+ presented on other devices that we will connect to
+ or ones that discover us in scanning.
+
+ uint16 MaxConnections [readonly]
+
+ Maximum number of concurrent P2P peers that local
+ hardware is capable of connecting to. Often 1.
diff --git a/doc/p2p-peer-api.txt b/doc/p2p-peer-api.txt
new file mode 100644
index 00000000..898f4fb9
--- /dev/null
+++ b/doc/p2p-peer-api.txt
@@ -0,0 +1,66 @@
+P2PPeer hierarchy
+=================
+
+Service net.connman.iwd
+Interface net.connman.iwd.P2PPeer [Experimental]
+Object path /{phy0,phy1,...}/p2p_peers/{aa_bb_cc_dd_ee_ff}
+
+Methods ConnectPushButton()
+
+ Connect to the P2P peer in the Push Button mode
+ using the device pointed to by the .Device property.
+ Returns when connection is complete.
+
+ Possible errors: net.connman.iwd.Aborted
+ net.connman.iwd.Busy
+ net.connman.iwd.Failed
+ net.connman.iwd.NotSupported
+ net.connman.iwd.Timeout
+ net.connman.iwd.InProgress
+
+ ConnectPIN(string pin)
+
+ Connect to the P2P peer in PIN mode. Returns when
+ connection is complete.
+
+ See net.connman.iwd.WiFiSimpleConfiguration.StartPIN()
+ for how the pin argument is used.
+
+ Possible errors: net.connman.iwd.Aborted
+ net.connman.iwd.Busy
+ net.connman.iwd.Failed
+ net.connman.iwd.NotSupported
+ net.connman.iwd.Timeout
+ net.connman.iwd.InProgress
+
+ Disconnect() [optional]
+
+ If connected, disconnect from this peer.
+
+ Possible errors: net.connman.iwd.Failed
+
+Properties string Name [readonly]
+
+ P2P Peer's display name
+
+ string DeviceCategory [readonly]
+
+ The category part of the peer's declared
+ Primary Device Type.
+
+ string DeviceSubcategory [readonly, optional]
+
+ The Sub Category part of the peer's declared
+ Primary Device Type.
+
+ object Device [readonly]
+
+ The object with a net.connman.iwd.P2P interface
+ that discovered this peer.
+
+ boolean Connected [readonly]
+
+ Whether there's currently an active connection
+ to this peer. The property is read-only and
+ changes as a result of the Connect and
+ Disconnect methods calls.
diff --git a/doc/p2p-wfd-agent-api.txt b/doc/p2p-wfd-agent-api.txt
new file mode 100644
index 00000000..be0ee01b
--- /dev/null
+++ b/doc/p2p-wfd-agent-api.txt
@@ -0,0 +1,34 @@
+P2PWFDAgent hierarchy
+=====================
+
+Service unique name
+Interface net.connman.iwd.P2PWFDAgent
+Object path freely definable
+
+Methods void Release(object device)
+
+ This method gets called when IWD unregisters the
+ WFD service on a specific P2P device. An agent can
+ use it to do cleanup tasks. There is no need to
+ unregister the agent, because when this method
+ gets called it has already been unregistered.
+
+ void WFDPeersChanged(object device,
+ array(object, array(byte)) peers)
+
+ Called when the set of discovered WFD-capable
+ peers has changed during device discovery.
+
+ The device object has the net.connman.iwd.P2P
+ interface while the objects in the peers array
+ have net.connman.iwd.P2PPeer interfaces. The byte
+ array included contains the reassembled payload of
+ the WFD Information Elements presented by the peer.
+
+ void NewConnection(object peer, array(byte) payload)
+
+ Called when a new P2P connection has been established
+ to a WFD-capable peer. The peer object has the
+ net.connman.iwd.P2PPerr interface. The byte array
+ contains the reassembled payload of the WFD
+ Information Elements presented by the peer.
diff --git a/doc/signal-level-agent-api.txt b/doc/signal-level-agent-api.txt
index 847e7ca3..1c786d96 100644
--- a/doc/signal-level-agent-api.txt
+++ b/doc/signal-level-agent-api.txt
@@ -31,3 +31,7 @@ Methods void Release(object device)
0 would mean signal is received at -40 or more dBm
and 3 would mean below -60 dBm and might correspond
to 1 out of 4 bars on a UI signal meter.
+
+ The device parameter may be either a
+ net.connman.iwd.Station object or a
+ net.connman.iwd.P2PPeer object.
--
2.20.1
2 years, 6 months
[PATCH v2 1/7] scan: add scan_passive_full variant
by James Prestwood
Just like active scans, add an API for passive scans which take in
the full scan_parameters structure.
---
src/scan.c | 10 ++++++++++
src/scan.h | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/src/scan.c b/src/scan.c
index a3d6e5d8..ad6d3ad4 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -556,6 +556,16 @@ uint32_t scan_passive(uint64_t wdev_id, struct scan_freq_set *freqs,
userdata, destroy);
}
+uint32_t scan_passive_full(uint64_t wdev_id,
+ const struct scan_parameters *params,
+ scan_trigger_func_t trigger,
+ scan_notify_func_t notify, void *userdata,
+ scan_destroy_func_t destroy)
+{
+ return scan_common(wdev_id, true, params, trigger,
+ notify, userdata, destroy);
+}
+
uint32_t scan_active(uint64_t wdev_id, uint8_t *extra_ie, size_t extra_ie_size,
scan_trigger_func_t trigger,
scan_notify_func_t notify, void *userdata,
diff --git a/src/scan.h b/src/scan.h
index 626de80b..6c5133aa 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -102,6 +102,11 @@ static inline bool scan_bss_addr_eq(const struct scan_bss *a1,
uint32_t scan_passive(uint64_t wdev_id, struct scan_freq_set *freqs,
scan_trigger_func_t trigger, scan_notify_func_t notify,
void *userdata, scan_destroy_func_t destroy);
+uint32_t scan_passive_full(uint64_t wdev_id,
+ const struct scan_parameters *params,
+ scan_trigger_func_t trigger,
+ scan_notify_func_t notify, void *userdata,
+ scan_destroy_func_t destroy);
uint32_t scan_active(uint64_t wdev_id, uint8_t *extra_ie, size_t extra_ie_size,
scan_trigger_func_t trigger,
scan_notify_func_t notify, void *userdata,
--
2.17.1
2 years, 6 months
[PATCH 1/4] scan: add scan_passive_full variant
by James Prestwood
Just like active scans, add an API for passive scans which take in
the full scan_parameters structure.
---
src/scan.c | 10 ++++++++++
src/scan.h | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/src/scan.c b/src/scan.c
index a3d6e5d8..ad6d3ad4 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -556,6 +556,16 @@ uint32_t scan_passive(uint64_t wdev_id, struct scan_freq_set *freqs,
userdata, destroy);
}
+uint32_t scan_passive_full(uint64_t wdev_id,
+ const struct scan_parameters *params,
+ scan_trigger_func_t trigger,
+ scan_notify_func_t notify, void *userdata,
+ scan_destroy_func_t destroy)
+{
+ return scan_common(wdev_id, true, params, trigger,
+ notify, userdata, destroy);
+}
+
uint32_t scan_active(uint64_t wdev_id, uint8_t *extra_ie, size_t extra_ie_size,
scan_trigger_func_t trigger,
scan_notify_func_t notify, void *userdata,
diff --git a/src/scan.h b/src/scan.h
index 626de80b..6c5133aa 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -102,6 +102,11 @@ static inline bool scan_bss_addr_eq(const struct scan_bss *a1,
uint32_t scan_passive(uint64_t wdev_id, struct scan_freq_set *freqs,
scan_trigger_func_t trigger, scan_notify_func_t notify,
void *userdata, scan_destroy_func_t destroy);
+uint32_t scan_passive_full(uint64_t wdev_id,
+ const struct scan_parameters *params,
+ scan_trigger_func_t trigger,
+ scan_notify_func_t notify, void *userdata,
+ scan_destroy_func_t destroy);
uint32_t scan_active(uint64_t wdev_id, uint8_t *extra_ie, size_t extra_ie_size,
scan_trigger_func_t trigger,
scan_notify_func_t notify, void *userdata,
--
2.17.1
2 years, 6 months
[PATCH] rrm: fix invalid IE tag when rejecting request
by James Prestwood
The rejection report actually contained a request IE, not a report IE
---
src/rrm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rrm.c b/src/rrm.c
index b4c5655f..e451448b 100644
--- a/src/rrm.c
+++ b/src/rrm.c
@@ -196,7 +196,7 @@ static void rrm_reject_measurement_request(struct rrm_state *rrm,
frame[0] = 0x05; /* Category: Radio Measurement */
frame[1] = 0x01; /* Action: Radio Measurement Report */
frame[2] = info->dialog_token;
- frame[3] = IE_TYPE_MEASUREMENT_REQUEST;
+ frame[3] = IE_TYPE_MEASUREMENT_REPORT;
frame[4] = 3;
frame[5] = info->mtoken;
frame[6] = mode;
--
2.17.1
2 years, 6 months
[PATCH 1/2] monitor: add support for parsing RRM Requests
by James Prestwood
Only beacon requests are parsed for now
---
monitor/nlmon.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index 15ff4ecb..b5734052 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -1861,6 +1861,110 @@ static void print_qos_map(unsigned int level, const char *label,
print_attr(level, "QoS Map");
}
+static void print_measurement_request_beacon(unsigned int level,
+ const void *data,
+ uint16_t size)
+{
+ uint8_t mode;
+
+ if (size < 13)
+ return;
+
+ print_attr(level, "Operating Class: %u", l_get_u8(data));
+ print_attr(level, "Channel: %u", l_get_u8(data + 1));
+ print_attr(level, "Randomization Interval: %u", l_get_le16(data + 2));
+ print_attr(level, "Duration: %u", l_get_le16(data + 4));
+
+ mode = l_get_u8(data + 6);
+
+ switch (mode) {
+ case 0:
+ print_attr(level, "Measurement: Passive");
+ break;
+ case 1:
+ print_attr(level, "Measurement: Active");
+ break;
+ case 2:
+ print_attr(level, "Measurement: Table");
+ break;
+ default:
+ print_attr(level, "Measurement: Invalid (%u)", mode);
+ return;
+ }
+
+ print_attr(level, "BSSID: "MAC, MAC_STR(((const uint8_t *)data + 7)));
+}
+
+static const char *rrm_measurement_types[] = {
+ [0] = "Basic",
+ [1] = "Clear Channel Assessment",
+ [2] = "Receive Power Indication",
+ [3] = "Channel Load",
+ [4] = "Noise Histogram",
+ [5] = "Beacon",
+ [6] = "Frame",
+ [7] = "STA Statistics",
+ [8] = "LCI",
+ [9] = "Transmit Stream/Category Measurement",
+ [10] = "Multicast Diagnostics",
+ [11] = "Location Civic",
+ [12] = "Location Identifier",
+ [13] = "Directional Channel Quality",
+ [14] = "Directional Measurement",
+ [15] = "Directional Statistics",
+ [16] = "Fine Timing Measurement Range",
+ [255] = "Measurement Pause"
+};
+
+static void print_measurement_request(unsigned int level, const char *label,
+ const void *data,
+ uint16_t size)
+{
+ uint8_t mode;
+ uint8_t type;
+
+ print_attr(level, "Measurement Request");
+
+ if (size < 3)
+ return;
+
+ print_attr(level + 1, "Token: %u", l_get_u8(data));
+
+ mode = l_get_u8(data + 1);
+
+ print_attr(level + 1, "Request Mode: %u", mode);
+
+ if (util_is_bit_set(mode, 0))
+ print_attr(level + 2, "Parallel bit set");
+
+ if (util_is_bit_set(mode, 1))
+ print_attr(level + 2, "Enable bit set");
+
+ if (util_is_bit_set(mode, 2))
+ print_attr(level + 2, "Request bit set");
+
+ if (util_is_bit_set(mode, 3))
+ print_attr(level + 2, "Report bit set");
+
+ if (util_is_bit_set(mode, 4))
+ print_attr(level + 2, "Duration Mandatory set");
+
+ type = l_get_u8(data + 2);
+
+ if (type > 16 && type != 255) {
+ print_attr(level + 1, "Type: Invalid (%u)", type);
+ return;
+ }
+
+ print_attr(level + 1, "Type: %s", rrm_measurement_types[type]);
+
+ switch (type) {
+ case 5:
+ print_measurement_request_beacon(level + 1, data + 3, size - 3);
+ break;
+ }
+}
+
static struct attr_entry ie_entry[] = {
{ IE_TYPE_SSID, "SSID",
ATTR_CUSTOM, { .function = print_ie_ssid } },
@@ -1911,6 +2015,8 @@ static struct attr_entry ie_entry[] = {
{ .function = print_ie_supported_operating_classes } },
{ IE_TYPE_QOS_MAP_SET, "QoS Map",
ATTR_CUSTOM, { .function = print_qos_map } },
+ { IE_TYPE_MEASUREMENT_REQUEST, "Measurement Request",
+ ATTR_CUSTOM, { .function = print_measurement_request } },
{ },
};
@@ -3974,6 +4080,18 @@ static void print_public_action_frame(unsigned int level, const uint8_t *body,
}
}
+static void print_rm_request(unsigned int level, const uint8_t *body,
+ size_t body_len)
+{
+ if (body_len < 3)
+ return;
+
+ print_attr(level, "Dialog Token: %u", body[0]);
+ print_attr(level, "Repetitions: %u", l_get_le16(body + 1));
+
+ print_ie(level, "IEs", body + 3, body_len - 3);
+}
+
static void print_rm_action_frame(unsigned int level, const uint8_t *body,
size_t body_len)
{
@@ -3998,6 +4116,12 @@ static void print_rm_action_frame(unsigned int level, const uint8_t *body,
category = "Unknown";
print_attr(level, "Radio Measurement Action: %s (%u)", category, body[0]);
+
+ switch (body[0]) {
+ case 0:
+ print_rm_request(level + 1, body + 1, body_len - 1);
+ break;
+ }
}
static void print_action_mgmt_frame(unsigned int level,
--
2.17.1
2 years, 6 months
[PATCH 1/2] auto-t: give testEAP-TTLS-MSCHAPv2 a longer timeout
by James Prestwood
When logging is turned on this test consistently fails due to a
timeout. Giving it a bit more time allows it to pass.
---
autotests/testEAP-TTLS-MSCHAPv2/hw.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/autotests/testEAP-TTLS-MSCHAPv2/hw.conf b/autotests/testEAP-TTLS-MSCHAPv2/hw.conf
index 406e830d..3535d56a 100644
--- a/autotests/testEAP-TTLS-MSCHAPv2/hw.conf
+++ b/autotests/testEAP-TTLS-MSCHAPv2/hw.conf
@@ -2,6 +2,7 @@
num_radios=2
tmpfs_extra_stuff=../misc/certs:eap-user-ttls-mschapv2.text
start_iwd=False
+max_test_exec_interval_sec=45
[HOSTAPD]
rad0=ssidEAP-TTLS-MSCHAPv2.conf
--
2.17.1
2 years, 6 months