[PATCH] dpp: fix 2 spelling errors
by Diederik de Haas
---
Hopefully I did it correctly.
src/dpp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dpp.c b/src/dpp.c
index f33b655b..78e8ffc5 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -1254,7 +1254,7 @@ static void dpp_presence_announce(struct dpp_sm *dpp)
iov[1].iov_base = attrs;
iov[1].iov_len = ptr - attrs;
- l_debug("Sending presense annoucement on frequency %u and waiting %u",
+ l_debug("Sending presence announcement on frequency %u and waiting %u",
dpp->current_freq, dpp->dwell);
dpp_send_frame(dpp, iov, 2, dpp->current_freq);
--
2.34.1
5 months, 1 week
[PATCH v2 1/7] nl80211util: support ATTR_FRAME in parse_attrs()
by James Prestwood
---
src/nl80211util.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/nl80211util.c b/src/nl80211util.c
index d663c6dc..9cd538ec 100644
--- a/src/nl80211util.c
+++ b/src/nl80211util.c
@@ -118,6 +118,16 @@ static bool extract_flag(const void *data, uint16_t len, void *o)
return true;
}
+static bool extract_iovec(const void *data, uint16_t len, void *o)
+{
+ struct iovec *iov = o;
+
+ iov->iov_base = (void *) data;
+ iov->iov_len = len;
+
+ return true;
+}
+
static attr_handler handler_for_type(enum nl80211_attrs type)
{
switch (type) {
@@ -145,6 +155,8 @@ static attr_handler handler_for_type(enum nl80211_attrs type)
case NL80211_ATTR_CENTER_FREQ1:
case NL80211_ATTR_CENTER_FREQ2:
return extract_uint32;
+ case NL80211_ATTR_FRAME:
+ return extract_iovec;
default:
break;
}
--
2.31.1
5 months, 2 weeks
[PATCH 01/10] auto-t: update wpas.py to use non_block_wait
by James Prestwood
This should be used as a replacement for the common GLib
wait loop (internally this is all it does).
---
autotests/util/wpas.py | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/autotests/util/wpas.py b/autotests/util/wpas.py
index c26f116c..0caa947f 100644
--- a/autotests/util/wpas.py
+++ b/autotests/util/wpas.py
@@ -58,29 +58,20 @@ class Wpas:
f.close()
return dict([[v.strip() for v in kv] for kv in [l.split('#', 1)[0].split('=', 1) for l in lines] if len(kv) == 2])
- def wait_for_event(self, event, timeout=10):
- self._wait_timed_out = False
-
- def wait_timeout_cb():
- self._wait_timed_out = True
- return False
-
- timeout = GLib.timeout_add_seconds(timeout, wait_timeout_cb)
- context = ctx.mainloop.get_context()
+ def _check_event(self, event):
+ if not event and len(self._rx_data) >= 1:
+ print("returning %s" % self._rx_data[0])
+ return self._rx_data[0]
- while True:
- context.iteration(may_block=True)
+ for e in self._rx_data:
+ if event in e:
+ return self._rx_data
- if not event and len(self._rx_data) >= 1:
- return self._rx_data[0]
+ return False
- for e in self._rx_data:
- if event in e:
- GLib.source_remove(timeout)
- return self._rx_data
-
- if self._wait_timed_out:
- raise TimeoutError('waiting for wpas event timed out')
+ def wait_for_event(self, event, timeout=10):
+ self._rx_data = []
+ return ctx.non_block_wait(self._check_event, timeout, event)
def wait_for_result(self, timeout=10):
self._rx_data = []
--
2.31.1
5 months, 2 weeks
[PATCH v2 1/6] wiphy: define work priorities in one place
by James Prestwood
Work priority was never explicitly defined anywhere, and a module
using wiphy_radio_work APIs needed to ensure it was not inserting
at a priority that would interfere with other work.
Now all the types of work have been defined with their own priority
and future priorities can easily be added before, after, or in
between existing priorities.
---
src/wiphy.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/wiphy.h b/src/wiphy.h
index 592eba70..fee5d41f 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -45,6 +45,12 @@ struct wiphy_radio_work_item {
const struct wiphy_radio_work_item_ops *ops;
};
+#define WIPHY_WORK_PRIORITY_FRAME 0
+#define WIPHY_WORK_PRIORITY_OFFCHANNEL 0
+#define WIPHY_WORK_PRIORITY_CONNECT 1
+#define WIPHY_WORK_PRIORITY_SCAN 2
+#define WIPHY_WORK_PRIORITY_PERIODIC_SCAN 3
+
enum wiphy_state_watch_event {
WIPHY_STATE_WATCH_EVENT_POWERED,
WIPHY_STATE_WATCH_EVENT_RFKILLED,
--
2.31.1
5 months, 2 weeks
[PATCH 1/3] scan: fix double space
by James Prestwood
---
src/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/scan.c b/src/scan.c
index 97b0a933..54159dfd 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -1695,7 +1695,7 @@ static void scan_finished(struct scan_context *sc,
if (bss_list)
discover_hidden_network_bsses(sc, bss_list);
- if (sr) {
+ if (sr) {
l_queue_remove(sc->requests, sr);
sc->started = false;
sc->work_started = false;
--
2.31.1
5 months, 2 weeks
[PATCH] unit: add checksum/random check for test-dpp
by James Prestwood
---
unit/test-dpp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/unit/test-dpp.c b/unit/test-dpp.c
index 1d4846c7..c40fd8b5 100644
--- a/unit/test-dpp.c
+++ b/unit/test-dpp.c
@@ -143,7 +143,9 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
- l_test_add("DPP test key derivation", test_key_derivation, NULL);
+ if (l_checksum_is_supported(L_CHECKSUM_SHA256, true) &&
+ l_getrandom_is_supported())
+ l_test_add("DPP test key derivation", test_key_derivation, NULL);
return l_test_run();
}
--
2.31.1
5 months, 2 weeks
[PATCH v1] dpp: fix implicit declaration of function explicit_bzero warning
by Peter Seiderer
- add missing src/missing.h include for explicit_bzero, fixes uclibc
compile/linking
Fixes:
src/dpp.c:166:2: warning: implicit declaration of function ‘explicit_bzero’ [-Wimplicit-function-declaration]
166 | explicit_bzero(dpp->r_nonce, dpp->nonce_len);
| ^~~~~~~~~~~~~~
---
src/dpp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/dpp.c b/src/dpp.c
index 84e89f6c..8091ded1 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -30,6 +30,7 @@
#include "linux/nl80211.h"
+#include "src/missing.h"
#include "src/dbus.h"
#include "src/netdev.h"
#include "src/module.h"
--
2.34.1
5 months, 2 weeks
[PATCH v2 1/6] dpp: don't allocate transient ssid strings
by James Prestwood
These can be kept on the stack and avoid the need for
allocated memory and unneeded auto-free functionality.
---
src/dpp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/dpp.c b/src/dpp.c
index 20c27a57..61c6b36d 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -400,7 +400,7 @@ static void send_config_result(struct dpp_sm *dpp, const uint8_t *to)
static void dpp_write_config(struct dpp_configuration *config,
struct network *network)
{
- _auto_(l_free) char *ssid = l_malloc(config->ssid_len + 1);
+ char ssid[33];
_auto_(l_settings_free) struct l_settings *settings = l_settings_new();
_auto_(l_free) char *path;
_auto_(l_free) uint8_t *psk = NULL;
@@ -494,7 +494,7 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
struct network *network;
struct scan_bss *bss = NULL;
- _auto_(l_free) char *ssid = NULL;
+ char ssid[33];
if (dpp->state != DPP_STATE_CONFIGURING)
return;
@@ -618,7 +618,6 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
return;
}
- ssid = l_malloc(config->ssid_len + 1);
memcpy(ssid, config->ssid, config->ssid_len);
ssid[config->ssid_len] = '\0';
--
2.31.1
5 months, 2 weeks
Doesn't create global config file or its directory (/etc/iwd/)
by Diederik de Haas
Hi,
I recently filed a Debian Bug against iwd and this is a forward for it:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002575
"I needed the "EnableNetworkConfiguration=true" setting, which IIUC
should be done in /etc/iwd/main.conf, but I noticed that that file
and directory didn't exist. I resolved it by using mkdir and creating
the file with vim (as root) and I'm assuming/hoping things like
permissions are set correctly. But I did wonder whether I was doing it
incorrectly (and I may have, but it's working)."
The Debian maintainer informed me that there isn't such a config file in the
upstream source code and I think it would be helpful if the directory with the
correct permissions and the config file, which could f.e. only contain a
commented reference to the iwd.config man page, would be created OOTB.
Cheers,
Diederik
5 months, 2 weeks
[PATCH 1/5] dpp: don't allocate transient ssid strings
by James Prestwood
These can be kept on the stack and avoid the need for
allocated memory and unneeded auto-free functionality.
---
src/dpp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/dpp.c b/src/dpp.c
index 20c27a57..61c6b36d 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -400,7 +400,7 @@ static void send_config_result(struct dpp_sm *dpp, const uint8_t *to)
static void dpp_write_config(struct dpp_configuration *config,
struct network *network)
{
- _auto_(l_free) char *ssid = l_malloc(config->ssid_len + 1);
+ char ssid[33];
_auto_(l_settings_free) struct l_settings *settings = l_settings_new();
_auto_(l_free) char *path;
_auto_(l_free) uint8_t *psk = NULL;
@@ -494,7 +494,7 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
struct network *network;
struct scan_bss *bss = NULL;
- _auto_(l_free) char *ssid = NULL;
+ char ssid[33];
if (dpp->state != DPP_STATE_CONFIGURING)
return;
@@ -618,7 +618,6 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
return;
}
- ssid = l_malloc(config->ssid_len + 1);
memcpy(ssid, config->ssid, config->ssid_len);
ssid[config->ssid_len] = '\0';
--
2.31.1
5 months, 2 weeks