[PATCH V2] Makefile.am: Avoid redirection of input and output files
by Khem Raj
Ensure that directory is created before its written to
This can cause a build race in a highly parallelised build where a directory is not yet created but
output file is being written using redirection e.g.
rst2man.py --strict --no-raw --no-generator --no-datestamp < ../git/monitor/iwmon.rst > monitor/iwmon.1
/bin/sh: monitor/iwmon.1: No such file or directory
make[1]: *** [Makefile:3544: monitor/iwmon.1] Error 1
---
v2: create directory before emitting doc files into it
Makefile.am | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 823b7d02..1bd0005c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -626,8 +626,9 @@ SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
< $< > $@
if RUN_RST2MAN
-RST2MAN_PROCESS = $(AM_V_GEN)$(RST2MAN) --strict --no-raw --no-generator \
- --no-datestamp < $< > $@
+RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+ $(AM_V_GEN)$(RST2MAN) --strict --no-raw \
+ --no-generator --no-datestamp $< $@
else
RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
{ echo "Generated manual page $@ does not exist"; false; }
--
2.24.0
2 years, 3 months
[PATCH 1/4] p2putil: Replace free with clear in function names
by Andrew Zaborowski
All these functions free up the resources used by the struct but don't
free the struct itself (allowing it to be static) so rename the
functions to avoid confusion.
---
The patch probably would be easier to read without -n / -u
---
src/p2putil.c | 132 +++++++++++++++++++++++++-------------------------
src/p2putil.h | 30 ++++++------
2 files changed, 81 insertions(+), 81 deletions(-)
diff --git a/src/p2putil.c b/src/p2putil.c
index ce53b2a2..02c02b4d 100644
--- a/src/p2putil.c
+++ b/src/p2putil.c
@@ -321,7 +321,7 @@ static bool extract_p2p_device_info(const uint8_t *attr, size_t len,
return true;
}
-static void p2p_free_client_info_descriptor(void *data)
+static void p2p_clear_client_info_descriptor(void *data)
{
struct p2p_client_info_descriptor *desc = data;
@@ -397,7 +397,7 @@ static bool extract_p2p_group_info(const uint8_t *attr, size_t len,
return true;
error:
- l_queue_destroy(*out, p2p_free_client_info_descriptor);
+ l_queue_destroy(*out, p2p_clear_client_info_descriptor);
*out = NULL;
return false;
@@ -502,7 +502,7 @@ static bool extract_p2p_advertisement_id(const uint8_t *attr, size_t len,
return true;
}
-static void p2p_free_advertised_service_descriptor(void *data)
+static void p2p_clear_advertised_service_descriptor(void *data)
{
struct p2p_advertised_service_descriptor *desc = data;
@@ -548,7 +548,7 @@ static bool extract_p2p_advertised_service_info(const uint8_t *attr, size_t len,
return true;
error:
- l_queue_destroy(*out, p2p_free_advertised_service_descriptor);
+ l_queue_destroy(*out, p2p_clear_advertised_service_descriptor);
return false;
}
@@ -758,7 +758,7 @@ int p2p_parse_beacon(const uint8_t *pdu, size_t len, struct p2p_beacon *out)
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_beacon(&d);
+ p2p_clear_beacon(&d);
return r;
}
@@ -784,7 +784,7 @@ int p2p_parse_probe_req(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_probe_req(&d);
+ p2p_clear_probe_req(&d);
/*
* The additional WSC IE attributes are already covered by
@@ -814,7 +814,7 @@ int p2p_parse_probe_resp(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_probe_resp(&d);
+ p2p_clear_probe_resp(&d);
return r;
}
@@ -837,7 +837,7 @@ int p2p_parse_association_req(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_association_req(&d);
+ p2p_clear_association_req(&d);
return r;
}
@@ -961,7 +961,7 @@ int p2p_parse_go_negotiation_req(const uint8_t *pdu, size_t len,
return 0;
error:
- p2p_free_go_negotiation_req(&d);
+ p2p_clear_go_negotiation_req(&d);
return r;
}
@@ -1020,7 +1020,7 @@ int p2p_parse_go_negotiation_resp(const uint8_t *pdu, size_t len,
return 0;
error:
- p2p_free_go_negotiation_resp(&d);
+ p2p_clear_go_negotiation_resp(&d);
return r;
}
@@ -1049,7 +1049,7 @@ int p2p_parse_go_negotiation_confirmation(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_go_negotiation_confirmation(&d);
+ p2p_clear_go_negotiation_confirmation(&d);
return r;
}
@@ -1101,7 +1101,7 @@ done:
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_invitation_req(&d);
+ p2p_clear_invitation_req(&d);
return r;
}
@@ -1131,7 +1131,7 @@ int p2p_parse_invitation_resp(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_invitation_resp(&d);
+ p2p_clear_invitation_resp(&d);
return r;
}
@@ -1254,7 +1254,7 @@ int p2p_parse_provision_disc_req(const uint8_t *pdu, size_t len,
return 0;
error:
- p2p_free_provision_disc_req(&d);
+ p2p_clear_provision_disc_req(&d);
return r;
}
@@ -1332,7 +1332,7 @@ int p2p_parse_provision_disc_resp(const uint8_t *pdu, size_t len,
return 0;
error:
- p2p_free_provision_disc_resp(&d);
+ p2p_clear_provision_disc_resp(&d);
return r;
}
@@ -1353,7 +1353,7 @@ int p2p_parse_notice_of_absence(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_notice_of_absence(&d);
+ p2p_clear_notice_of_absence(&d);
return r;
}
@@ -1379,7 +1379,7 @@ int p2p_parse_presence_req(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_presence_req(&d);
+ p2p_clear_presence_req(&d);
return r;
}
@@ -1406,7 +1406,7 @@ int p2p_parse_presence_resp(const uint8_t *pdu, size_t len,
if (r >= 0)
memcpy(out, &d, sizeof(d));
else
- p2p_free_presence_resp(&d);
+ p2p_clear_presence_resp(&d);
return r;
}
@@ -1420,132 +1420,132 @@ int p2p_parse_go_disc_req(const uint8_t *pdu, size_t len)
return 0;
}
-static void p2p_free_channel_list_attr(struct p2p_channel_list_attr *attr)
+static void p2p_clear_channel_list_attr(struct p2p_channel_list_attr *attr)
{
l_queue_destroy(attr->channel_entries, l_free);
attr->channel_entries = NULL;
}
-static void p2p_free_notice_of_absence_attr(
+static void p2p_clear_notice_of_absence_attr(
struct p2p_notice_of_absence_attr *attr)
{
l_queue_destroy(attr->descriptors, l_free);
attr->descriptors = NULL;
}
-static void p2p_free_device_info_attr(struct p2p_device_info_attr *attr)
+static void p2p_clear_device_info_attr(struct p2p_device_info_attr *attr)
{
l_queue_destroy(attr->secondary_device_types, l_free);
attr->secondary_device_types = NULL;
}
-static void p2p_free_group_info_attr(struct l_queue **group_clients)
+static void p2p_clear_group_info_attr(struct l_queue **group_clients)
{
- l_queue_destroy(*group_clients, p2p_free_client_info_descriptor);
+ l_queue_destroy(*group_clients, p2p_clear_client_info_descriptor);
*group_clients = NULL;
}
-static void p2p_free_interface_attr(struct p2p_interface_attr *attr)
+static void p2p_clear_interface_attr(struct p2p_interface_attr *attr)
{
l_queue_destroy(attr->interface_addrs, l_free);
attr->interface_addrs = NULL;
}
-static void p2p_free_svc_hash_attr(struct l_queue **hashes)
+static void p2p_clear_svc_hash_attr(struct l_queue **hashes)
{
l_queue_destroy(*hashes, l_free);
*hashes = NULL;
}
-static void p2p_free_advertised_service_info_attr(struct l_queue **descriptors)
+static void p2p_clear_advertised_service_info_attr(struct l_queue **descriptors)
{
- l_queue_destroy(*descriptors, p2p_free_advertised_service_descriptor);
+ l_queue_destroy(*descriptors, p2p_clear_advertised_service_descriptor);
*descriptors = NULL;
}
-void p2p_free_beacon(struct p2p_beacon *data)
+void p2p_clear_beacon(struct p2p_beacon *data)
{
- p2p_free_notice_of_absence_attr(&data->notice_of_absence);
+ p2p_clear_notice_of_absence_attr(&data->notice_of_absence);
}
-void p2p_free_probe_req(struct p2p_probe_req *data)
+void p2p_clear_probe_req(struct p2p_probe_req *data)
{
- p2p_free_device_info_attr(&data->device_info);
- p2p_free_svc_hash_attr(&data->service_hashes);
+ p2p_clear_device_info_attr(&data->device_info);
+ p2p_clear_svc_hash_attr(&data->service_hashes);
}
-void p2p_free_probe_resp(struct p2p_probe_resp *data)
+void p2p_clear_probe_resp(struct p2p_probe_resp *data)
{
- p2p_free_notice_of_absence_attr(&data->notice_of_absence);
- p2p_free_device_info_attr(&data->device_info);
- p2p_free_group_info_attr(&data->group_clients);
- p2p_free_advertised_service_info_attr(&data->advertised_svcs);
+ p2p_clear_notice_of_absence_attr(&data->notice_of_absence);
+ p2p_clear_device_info_attr(&data->device_info);
+ p2p_clear_group_info_attr(&data->group_clients);
+ p2p_clear_advertised_service_info_attr(&data->advertised_svcs);
}
-void p2p_free_association_req(struct p2p_association_req *data)
+void p2p_clear_association_req(struct p2p_association_req *data)
{
- p2p_free_device_info_attr(&data->device_info);
- p2p_free_interface_attr(&data->interface);
+ p2p_clear_device_info_attr(&data->device_info);
+ p2p_clear_interface_attr(&data->interface);
}
-void p2p_free_association_resp(struct p2p_association_resp *data)
+void p2p_clear_association_resp(struct p2p_association_resp *data)
{
}
-void p2p_free_go_negotiation_req(struct p2p_go_negotiation_req *data)
+void p2p_clear_go_negotiation_req(struct p2p_go_negotiation_req *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
- p2p_free_device_info_attr(&data->device_info);
+ p2p_clear_channel_list_attr(&data->channel_list);
+ p2p_clear_device_info_attr(&data->device_info);
}
-void p2p_free_go_negotiation_resp(struct p2p_go_negotiation_resp *data)
+void p2p_clear_go_negotiation_resp(struct p2p_go_negotiation_resp *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
- p2p_free_device_info_attr(&data->device_info);
+ p2p_clear_channel_list_attr(&data->channel_list);
+ p2p_clear_device_info_attr(&data->device_info);
}
-void p2p_free_go_negotiation_confirmation(
+void p2p_clear_go_negotiation_confirmation(
struct p2p_go_negotiation_confirmation *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
+ p2p_clear_channel_list_attr(&data->channel_list);
}
-void p2p_free_invitation_req(struct p2p_invitation_req *data)
+void p2p_clear_invitation_req(struct p2p_invitation_req *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
- p2p_free_device_info_attr(&data->device_info);
+ p2p_clear_channel_list_attr(&data->channel_list);
+ p2p_clear_device_info_attr(&data->device_info);
}
-void p2p_free_invitation_resp(struct p2p_invitation_resp *data)
+void p2p_clear_invitation_resp(struct p2p_invitation_resp *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
+ p2p_clear_channel_list_attr(&data->channel_list);
}
-void p2p_free_provision_disc_req(struct p2p_provision_discovery_req *data)
+void p2p_clear_provision_disc_req(struct p2p_provision_discovery_req *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
- p2p_free_device_info_attr(&data->device_info);
+ p2p_clear_channel_list_attr(&data->channel_list);
+ p2p_clear_device_info_attr(&data->device_info);
}
-void p2p_free_provision_disc_resp(struct p2p_provision_discovery_resp *data)
+void p2p_clear_provision_disc_resp(struct p2p_provision_discovery_resp *data)
{
- p2p_free_channel_list_attr(&data->channel_list);
- p2p_free_device_info_attr(&data->device_info);
+ p2p_clear_channel_list_attr(&data->channel_list);
+ p2p_clear_device_info_attr(&data->device_info);
}
-void p2p_free_notice_of_absence(struct p2p_notice_of_absence *data)
+void p2p_clear_notice_of_absence(struct p2p_notice_of_absence *data)
{
- p2p_free_notice_of_absence_attr(&data->notice_of_absence);
+ p2p_clear_notice_of_absence_attr(&data->notice_of_absence);
}
-void p2p_free_presence_req(struct p2p_presence_req *data)
+void p2p_clear_presence_req(struct p2p_presence_req *data)
{
- p2p_free_notice_of_absence_attr(&data->notice_of_absence);
+ p2p_clear_notice_of_absence_attr(&data->notice_of_absence);
}
-void p2p_free_presence_resp(struct p2p_presence_resp *data)
+void p2p_clear_presence_resp(struct p2p_presence_resp *data)
{
- p2p_free_notice_of_absence_attr(&data->notice_of_absence);
+ p2p_clear_notice_of_absence_attr(&data->notice_of_absence);
}
struct p2p_attr_builder {
diff --git a/src/p2putil.h b/src/p2putil.h
index 681d9e33..09c72c74 100644
--- a/src/p2putil.h
+++ b/src/p2putil.h
@@ -462,22 +462,22 @@ int p2p_parse_presence_resp(const uint8_t *pdu, size_t len,
struct p2p_presence_resp *out);
int p2p_parse_go_disc_req(const uint8_t *pdu, size_t len);
-void p2p_free_beacon(struct p2p_beacon *data);
-void p2p_free_probe_req(struct p2p_probe_req *data);
-void p2p_free_probe_resp(struct p2p_probe_resp *data);
-void p2p_free_association_req(struct p2p_association_req *data);
-void p2p_free_association_resp(struct p2p_association_resp *data);
-void p2p_free_go_negotiation_req(struct p2p_go_negotiation_req *data);
-void p2p_free_go_negotiation_resp(struct p2p_go_negotiation_resp *data);
-void p2p_free_go_negotiation_confirmation(
+void p2p_clear_beacon(struct p2p_beacon *data);
+void p2p_clear_probe_req(struct p2p_probe_req *data);
+void p2p_clear_probe_resp(struct p2p_probe_resp *data);
+void p2p_clear_association_req(struct p2p_association_req *data);
+void p2p_clear_association_resp(struct p2p_association_resp *data);
+void p2p_clear_go_negotiation_req(struct p2p_go_negotiation_req *data);
+void p2p_clear_go_negotiation_resp(struct p2p_go_negotiation_resp *data);
+void p2p_clear_go_negotiation_confirmation(
struct p2p_go_negotiation_confirmation *data);
-void p2p_free_invitation_req(struct p2p_invitation_req *data);
-void p2p_free_invitation_resp(struct p2p_invitation_resp *data);
-void p2p_free_provision_disc_req(struct p2p_provision_discovery_req *data);
-void p2p_free_provision_disc_resp(struct p2p_provision_discovery_resp *data);
-void p2p_free_notice_of_absence(struct p2p_notice_of_absence *data);
-void p2p_free_presence_req(struct p2p_presence_req *data);
-void p2p_free_presence_resp(struct p2p_presence_resp *data);
+void p2p_clear_invitation_req(struct p2p_invitation_req *data);
+void p2p_clear_invitation_resp(struct p2p_invitation_resp *data);
+void p2p_clear_provision_disc_req(struct p2p_provision_discovery_req *data);
+void p2p_clear_provision_disc_resp(struct p2p_provision_discovery_resp *data);
+void p2p_clear_notice_of_absence(struct p2p_notice_of_absence *data);
+void p2p_clear_presence_req(struct p2p_presence_req *data);
+void p2p_clear_presence_resp(struct p2p_presence_resp *data);
uint8_t *p2p_build_beacon(const struct p2p_beacon *data, size_t *out_len);
uint8_t *p2p_build_probe_req(const struct p2p_probe_req *data, size_t *out_len);
--
2.20.1
2 years, 7 months
[PATCH v6] rrm: add packed struct for beacon reports
by James Prestwood
build_report_for_bss was refactored to use this packed structure rather
than l_put_* APIs.
---
src/rrm.c | 64 ++++++++++++++++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 24 deletions(-)
-v6:
* Used L_CPU_TO_LE* macros
diff --git a/src/rrm.c b/src/rrm.c
index 660565eb..cc940c05 100644
--- a/src/rrm.c
+++ b/src/rrm.c
@@ -122,6 +122,21 @@ struct rrm_state {
uint64_t last_request;
};
+/* 802.11, Section 9.4.2.22.7 */
+struct rrm_beacon_report {
+ uint8_t oper_class;
+ uint8_t channel;
+ __le64 scan_start_time;
+ __le16 duration;
+ uint8_t frame_info;
+ uint8_t rcpi;
+ uint8_t rsni;
+ uint8_t bssid[6];
+ uint8_t antenna_id;
+ __le32 parent_tsf;
+ uint8_t subelements[0];
+} __attribute__ ((packed));
+
static struct l_queue *states;
static struct l_genl_family *nl80211;
static uint32_t netdev_watch;
@@ -225,6 +240,17 @@ static void rrm_build_measurement_report(struct rrm_request_info *info,
memcpy(to, report, report_len);
}
+/* 802.11 Table 9-154 */
+static uint8_t mdb_to_rcpi(int32_t mdb)
+{
+ if (mdb <= 10950)
+ return 0;
+ else if (mdb >= -10950 && mdb < 0)
+ return (uint8_t)((2 * (mdb + 11000)) / 100);
+ else
+ return 220;
+}
+
/*
* 802.11-2016 11.11.9.1 Beacon report
*
@@ -246,38 +272,28 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
struct scan_bss *bss,
uint8_t *to)
{
- uint8_t *start = to;
-
- *to++ = beacon->oper_class;
- *to++ = scan_freq_to_channel(bss->frequency, NULL);
- l_put_le64(beacon->scan_start_time, to);
- to += 8;
- l_put_le16(beacon->duration, to);
- to += 2;
- *to++ = rrm_phy_type(bss);
-
- /* 802.11 Table 9-154 - RCPI values */
- if (bss->signal_strength < -10950)
- *to++ = 0;
- else if (bss->signal_strength >= -10950 && bss->signal_strength < 0)
- *to++ = (uint8_t)((2 * (bss->signal_strength + 11000)) / 100);
- else
- *to++ = 220;
+ struct rrm_beacon_report *report = (struct rrm_beacon_report *) to;
+
+ report->oper_class = beacon->oper_class;
+ report->channel = scan_freq_to_channel(bss->frequency, NULL);
+ report->scan_start_time = L_CPU_TO_LE64(beacon->scan_start_time);
+ report->duration = L_CPU_TO_LE16(beacon->duration);
+ report->frame_info = rrm_phy_type(bss);
+ report->rcpi = mdb_to_rcpi(bss->signal_strength);
/* RSNI not available (could get this from GET_SURVEY) */
- *to++ = 255;
- memcpy(to, bss->addr, 6);
- to += 6;
+ report->rsni = 255;
+ memcpy(report->bssid, bss->addr, 6);
/* Antenna identifier unknown */
- *to++ = 0;
+ report->antenna_id = 0;
+
/*
* 802.11 9.4.2.22.7 Beacon report
*
* "The Parent TSF field contains the lower 4 octets of the measuring
* STA's TSF timer value"
*/
- l_put_le32((uint32_t)(bss->parent_tsf & 0xffffffff), to);
- to += 4;
+ report->parent_tsf = L_CPU_TO_LE32((uint32_t) bss->parent_tsf);
/*
* TODO: Support optional subelements
@@ -285,7 +301,7 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
* (see "TODO: Support Reported Frame Body..." below)
*/
- return to - start;
+ return sizeof(struct rrm_beacon_report);
}
static bool bss_in_request_range(struct rrm_beacon_req_info *beacon,
--
2.17.1
2 years, 7 months
[PATCH] test-runner: print which file failed to fchown
by James Prestwood
---
tools/test-runner.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/test-runner.c b/tools/test-runner.c
index 5e10f542..71c5f14e 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -589,7 +589,7 @@ static pid_t execute_program(char *argv[], char *envp[], bool wait,
fd = open(log_file, O_WRONLY | O_CREAT | O_APPEND,
S_IRUSR | S_IWUSR);
if (fchown(fd, log_uid, log_gid) < 0)
- l_error("fchown failed");
+ l_error("failed to fchown %s", log_file);
}
if (fd > -1) {
@@ -3190,7 +3190,7 @@ int main(int argc, char *argv[])
mkdir(log_dir, 0755);
if (chown(log_dir, log_uid, log_gid) < 0)
- l_error("fchown failed");
+ l_error("failed to fchown %s", log_dir);
break;
case 'h':
--
2.17.1
2 years, 7 months
[PATCH v5 1/4] scan: parse the scan start time
by James Prestwood
The kernel sends NL80211_ATTR_SCAN_START_TIME_TSF with CMD_TRIGGER and
RRM requires this value for beacon measurement reports.
The start time is parsed during CMD_TRIGGER and set into the scan request.
A getter was added to obtain this time value for an already triggered
scan.
After making the change, the SCAN_ABORTED case was cleaned up a bit to
remove the local scan_request usage in favor of the one used for all the
other cases.
---
src/scan.c | 41 ++++++++++++++++++++++++++++++++++-------
src/scan.h | 2 ++
2 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/src/scan.c b/src/scan.c
index e007ce5d..e2d73601 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -75,6 +75,8 @@ struct scan_request {
scan_destroy_func_t destroy;
bool passive:1; /* Active or Passive scan? */
struct l_queue *cmds;
+ /* The time the current scan was started. Reported in TRIGGER_SCAN */
+ uint64_t start_time_tsf;
};
struct scan_context {
@@ -778,6 +780,25 @@ bool scan_periodic_stop(uint64_t wdev_id)
return true;
}
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id)
+{
+ struct scan_context *sc;
+ struct scan_request *sr;
+
+ sc = l_queue_find(scan_contexts, scan_context_match, &wdev_id);
+ if (!sc)
+ return 0;
+
+ if (!sc->triggered)
+ return 0;
+
+ sr = l_queue_find(sc->requests, scan_request_match, L_UINT_TO_PTR(id));
+ if (!sr)
+ return 0;
+
+ return sr->start_time_tsf;
+}
+
static void scan_periodic_timeout(struct l_timeout *timeout, void *user_data)
{
struct scan_context *sc = user_data;
@@ -1439,6 +1460,8 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
uint32_t wiphy_id;
struct scan_context *sc;
bool active_scan = false;
+ uint64_t start_time_tsf = 0;
+ struct scan_request *sr;
cmd = l_genl_msg_get_command(msg);
@@ -1461,15 +1484,22 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
case NL80211_ATTR_SCAN_SSIDS:
active_scan = true;
break;
+ case NL80211_ATTR_SCAN_START_TIME_TSF:
+ if (len != sizeof(uint64_t))
+ return;
+
+ start_time_tsf = l_get_u64(data);
+ break;
}
}
+ sr = l_queue_peek_head(sc->requests);
+
switch (cmd) {
case NL80211_CMD_NEW_SCAN_RESULTS:
{
struct l_genl_msg *scan_msg;
struct scan_results *results;
- struct scan_request *sr = l_queue_peek_head(sc->requests);
bool send_next = false;
bool get_results = false;
@@ -1543,12 +1573,11 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
else
sc->state = SCAN_STATE_PASSIVE;
+ sr->start_time_tsf = start_time_tsf;
+
break;
case NL80211_CMD_SCAN_ABORTED:
- {
- struct scan_request *sr = l_queue_peek_head(sc->requests);
-
if (sc->state == SCAN_STATE_NOT_RUNNING)
break;
@@ -1557,8 +1586,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
if (sc->triggered) {
sc->triggered = false;
- scan_finished(sc, -ECANCELED, NULL,
- l_queue_peek_head(sc->requests));
+ scan_finished(sc, -ECANCELED, NULL, sr);
} else if (sr && !sc->start_cmd_id && !sc->get_scan_cmd_id) {
/*
* If this was an external scan that got aborted
@@ -1572,7 +1600,6 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
break;
}
- }
}
uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band)
diff --git a/src/scan.h b/src/scan.h
index 8fc2aa56..b6c4e12d 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -124,6 +124,8 @@ void scan_periodic_start(uint64_t wdev_id, scan_trigger_func_t trigger,
scan_notify_func_t func, void *userdata);
bool scan_periodic_stop(uint64_t wdev_id);
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id);
+
void scan_bss_free(struct scan_bss *bss);
int scan_bss_rank_compare(const void *a, const void *b, void *user);
--
2.17.1
2 years, 7 months
[PATCH v4 1/3] scan: parse the scan start time
by James Prestwood
The kernel sends NL80211_ATTR_SCAN_START_TIME_TSF with CMD_TRIGGER and
RRM requires this value for beacon measurement reports.
The start time is parsed during CMD_TRIGGER and set into the scan request.
A getter was added to obtain this time value for an already triggered
scan.
After making the change, the SCAN_ABORTED case was cleaned up a bit to
remove the local scan_request usage in favor of the one used for all the
other cases.
---
src/scan.c | 41 ++++++++++++++++++++++++++++++++++-------
src/scan.h | 2 ++
2 files changed, 36 insertions(+), 7 deletions(-)
-v4:
* Store the start time in the request, no context
* Move the scan request peek outside of the switch so all cases can
use it.
diff --git a/src/scan.c b/src/scan.c
index e007ce5d..e2d73601 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -75,6 +75,8 @@ struct scan_request {
scan_destroy_func_t destroy;
bool passive:1; /* Active or Passive scan? */
struct l_queue *cmds;
+ /* The time the current scan was started. Reported in TRIGGER_SCAN */
+ uint64_t start_time_tsf;
};
struct scan_context {
@@ -778,6 +780,25 @@ bool scan_periodic_stop(uint64_t wdev_id)
return true;
}
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id)
+{
+ struct scan_context *sc;
+ struct scan_request *sr;
+
+ sc = l_queue_find(scan_contexts, scan_context_match, &wdev_id);
+ if (!sc)
+ return 0;
+
+ if (!sc->triggered)
+ return 0;
+
+ sr = l_queue_find(sc->requests, scan_request_match, L_UINT_TO_PTR(id));
+ if (!sr)
+ return 0;
+
+ return sr->start_time_tsf;
+}
+
static void scan_periodic_timeout(struct l_timeout *timeout, void *user_data)
{
struct scan_context *sc = user_data;
@@ -1439,6 +1460,8 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
uint32_t wiphy_id;
struct scan_context *sc;
bool active_scan = false;
+ uint64_t start_time_tsf = 0;
+ struct scan_request *sr;
cmd = l_genl_msg_get_command(msg);
@@ -1461,15 +1484,22 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
case NL80211_ATTR_SCAN_SSIDS:
active_scan = true;
break;
+ case NL80211_ATTR_SCAN_START_TIME_TSF:
+ if (len != sizeof(uint64_t))
+ return;
+
+ start_time_tsf = l_get_u64(data);
+ break;
}
}
+ sr = l_queue_peek_head(sc->requests);
+
switch (cmd) {
case NL80211_CMD_NEW_SCAN_RESULTS:
{
struct l_genl_msg *scan_msg;
struct scan_results *results;
- struct scan_request *sr = l_queue_peek_head(sc->requests);
bool send_next = false;
bool get_results = false;
@@ -1543,12 +1573,11 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
else
sc->state = SCAN_STATE_PASSIVE;
+ sr->start_time_tsf = start_time_tsf;
+
break;
case NL80211_CMD_SCAN_ABORTED:
- {
- struct scan_request *sr = l_queue_peek_head(sc->requests);
-
if (sc->state == SCAN_STATE_NOT_RUNNING)
break;
@@ -1557,8 +1586,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
if (sc->triggered) {
sc->triggered = false;
- scan_finished(sc, -ECANCELED, NULL,
- l_queue_peek_head(sc->requests));
+ scan_finished(sc, -ECANCELED, NULL, sr);
} else if (sr && !sc->start_cmd_id && !sc->get_scan_cmd_id) {
/*
* If this was an external scan that got aborted
@@ -1572,7 +1600,6 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
break;
}
- }
}
uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band)
diff --git a/src/scan.h b/src/scan.h
index 8fc2aa56..b6c4e12d 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -124,6 +124,8 @@ void scan_periodic_start(uint64_t wdev_id, scan_trigger_func_t trigger,
scan_notify_func_t func, void *userdata);
bool scan_periodic_stop(uint64_t wdev_id);
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id);
+
void scan_bss_free(struct scan_bss *bss);
int scan_bss_rank_compare(const void *a, const void *b, void *user);
--
2.17.1
2 years, 7 months
[PATCH v3 1/3] scan: parse the scan start time
by James Prestwood
The kernel sends NL80211_ATTR_SCAN_START_TIME_TSF with CMD_TRIGGER and
RRM requires this value for beacon measurement reports.
The start time is parsed during CMD_TRIGGER and set into the scan context.
A getter was added to obtain this time value for an already triggered
scan.
---
src/scan.c | 31 +++++++++++++++++++++++++++++++
src/scan.h | 2 ++
2 files changed, 33 insertions(+)
-v3:
* Added getter for scan triggered time rather than storing it in each
bss individually.
diff --git a/src/scan.c b/src/scan.c
index e007ce5d..43e4cb84 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -91,6 +91,9 @@ struct scan_context {
unsigned int start_cmd_id;
/* Non-zero if GET_SCAN is still running */
unsigned int get_scan_cmd_id;
+
+ /* The time the current scan was started. Reported in TRIGGER_SCAN */
+ uint64_t start_time_tsf;
/*
* Whether the top request in the queue has triggered the current
* scan. May be set and cleared multiple times during a single
@@ -778,6 +781,25 @@ bool scan_periodic_stop(uint64_t wdev_id)
return true;
}
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id)
+{
+ struct scan_context *sc;
+ struct scan_request *sr;
+
+ sc = l_queue_find(scan_contexts, scan_context_match, &wdev_id);
+ if (!sc)
+ return 0;
+
+ sr = l_queue_find(sc->requests, scan_request_match, L_UINT_TO_PTR(id));
+ if (!sr)
+ return 0;
+
+ if (!sc->triggered)
+ return 0;
+
+ return sc->start_time_tsf;
+}
+
static void scan_periodic_timeout(struct l_timeout *timeout, void *user_data)
{
struct scan_context *sc = user_data;
@@ -1439,6 +1461,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
uint32_t wiphy_id;
struct scan_context *sc;
bool active_scan = false;
+ uint64_t start_time_tsf = 0;
cmd = l_genl_msg_get_command(msg);
@@ -1461,6 +1484,12 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
case NL80211_ATTR_SCAN_SSIDS:
active_scan = true;
break;
+ case NL80211_ATTR_SCAN_START_TIME_TSF:
+ if (len != sizeof(uint64_t))
+ return;
+
+ start_time_tsf = l_get_u64(data);
+ break;
}
}
@@ -1543,6 +1572,8 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
else
sc->state = SCAN_STATE_PASSIVE;
+ sc->start_time_tsf = start_time_tsf;
+
break;
case NL80211_CMD_SCAN_ABORTED:
diff --git a/src/scan.h b/src/scan.h
index 8fc2aa56..b6c4e12d 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -124,6 +124,8 @@ void scan_periodic_start(uint64_t wdev_id, scan_trigger_func_t trigger,
scan_notify_func_t func, void *userdata);
bool scan_periodic_stop(uint64_t wdev_id);
+uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id);
+
void scan_bss_free(struct scan_bss *bss);
int scan_bss_rank_compare(const void *a, const void *b, void *user);
--
2.17.1
2 years, 7 months
iwd needs connman service?
by Jeff Chua
Prior to Nov 09, I could connect with connman, but git pull after that
doesn't work with connman service, and even with connman, I still can't iwd.
Missing net.connman.iwd service ... how can I fix that?
Failed to activate service 'net.connman.iwd': timed out
(service_start_timeout=25000ms)]- [Failed to retrieve IWD dbus objects,
quitting...
Thanks.
My best.,
Jeff
2 years, 7 months