[PATCH 1/6] test-runner: remove special case for "root" namespace
by James Prestwood
This was a placeholder at one point but modules grew to depend on it
being a string. Fix these dependencies and set the root namespace
name to None so there is no more special case needed to handle both
a named namespace and the original 'root' namespace.
---
autotests/util/hwsim.py | 8 ++++----
autotests/util/iwd.py | 2 +-
tools/test-runner | 10 ++--------
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/autotests/util/hwsim.py b/autotests/util/hwsim.py
index cc62495c..26092379 100755
--- a/autotests/util/hwsim.py
+++ b/autotests/util/hwsim.py
@@ -301,15 +301,15 @@ class Hwsim(iwd.AsyncOpAbstract):
_instances = WeakValueDictionary()
def __new__(cls, namespace=ctx):
- name = namespace.name
+ key = id(namespace)
- if name not in cls._instances.keys():
+ if key not in cls._instances.keys():
obj = object.__new__(cls)
obj._initialized = False
- cls._instances[name] = obj
+ cls._instances[key] = obj
- return cls._instances[name]
+ return cls._instances[key]
def __init__(self, namespace=ctx):
if self._initialized:
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 730659ac..63b526fd 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -1053,7 +1053,7 @@ class IWD(AsyncOpAbstract):
# reference so that __del__ gets called when it's released. This is only
# done for the root namespace in order to allow testutil to function
# correctly in non-namespace tests.
- if self.namespace.name == "root":
+ if self.namespace.name is None:
IWD._default_instance = weakref.ref(self)
def __del__(self):
diff --git a/tools/test-runner b/tools/test-runner
index 9e4d0780..210e4f5f 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -599,12 +599,6 @@ class Namespace:
return self._bus
def start_process(self, args, env=None, **kwargs):
- # Special case for 'root' namespace (aka TestContext)
- if self.name == "root":
- ns = None
- else:
- ns = self.name
-
if not env:
env = os.environ.copy()
@@ -612,7 +606,7 @@ class Namespace:
# In case this process needs DBus...
env['DBUS_SYSTEM_BUS_ADDRESS'] = self.dbus_address
- p = Process(args, namespace=ns, env=env, **kwargs)
+ p = Process(args, namespace=self.name, env=env, **kwargs)
if not kwargs.get('wait', False):
self.processes.append(p)
@@ -791,7 +785,7 @@ class TestContext(Namespace):
such as processes, radios, interfaces and test results.
'''
def __init__(self, args):
- self.name = "root"
+ self.name = None
self.processes = []
self.args = args
self.hw_config = None
--
2.31.1
8 months, 1 week
[PATCH 1/2] netconfig: Actually use the DNS override values
by Andrew Zaborowski
In netconfig_load_settings apply the DNS overrides strings we've loaded
instead of leaking them.
Fixes: ad228461abbf ("netconfig: Move loading settings to new method, refactor")
---
src/netconfig.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/netconfig.c b/src/netconfig.c
index 9bbaece5..c748630b 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -1293,6 +1293,8 @@ bool netconfig_load_settings(struct netconfig *netconfig,
mac_address, ETH_ALEN);
netconfig->active_settings = active_settings;
+ netconfig->dns4_overrides = dns4_overrides;
+ netconfig->dns6_overrides = dns6_overrides;
return true;
err_v6_addr:
--
2.30.2
8 months, 2 weeks
[PATCH 1/2] autotests: Extend a testP2P timeout
by Andrew Zaborowski
With various versions of wpa_supplicant tested, after an IWD GO tears
the group down, the wpa_supplicant P2P client will not immediately
signal that the group has disappeared but will at least wait for the
lost beacon signal, wait some more and try reconnecting and all that
takes it 10s or a little longer. Possibly sending Deauthenticate frames
to clients first would improve this.
---
autotests/testP2P/connection_test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/autotests/testP2P/connection_test.py b/autotests/testP2P/connection_test.py
index 46440053..76613fa6 100644
--- a/autotests/testP2P/connection_test.py
+++ b/autotests/testP2P/connection_test.py
@@ -130,7 +130,7 @@ class Test(unittest.TestCase):
if not go:
wd.wait_for_object_condition(wpas, 'len(obj.p2p_clients) == 0', max_wait=3)
else:
- wd.wait_for_object_condition(wpas, 'obj.p2p_group is None', max_wait=3)
+ wd.wait_for_object_condition(wpas, 'obj.p2p_group is None', max_wait=15)
self.assertEqual(peer.connected, False)
def setUp(self):
--
2.30.2
8 months, 2 weeks
[PATCH v3 1/3] netdev: factor out scan_bss from CMD_CONNECT builder
by James Prestwood
In order to support OWE in the CMD_CONNECT path the scan_bss parameter
needs to be removed since this is lost after netdev_connect returns.
Nearly everything needed is also stored in the handshake except the
privacy capability which is now being mirrored in the netdev object
itself.
---
src/netdev.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index a5d1b8ed..8592685c 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -181,6 +181,7 @@ struct netdev {
bool events_ready : 1;
bool retry_auth : 1;
bool in_reassoc : 1;
+ bool privacy : 1;
};
struct netdev_preauth_state {
@@ -788,6 +789,7 @@ static void netdev_connect_free(struct netdev *netdev)
netdev->ignore_connect_event = false;
netdev->expect_connect_failure = false;
netdev->cur_rssi_low = false;
+ netdev->privacy = false;
if (netdev->connect_cmd) {
l_genl_msg_unref(netdev->connect_cmd);
@@ -2901,7 +2903,6 @@ static void netdev_fils_tx_associate(struct iovec *fils_iov, size_t n_fils_iov,
}
static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
- struct scan_bss *bss,
struct handshake_state *hs,
const uint8_t *prev_bssid,
const struct iovec *vendor_ies,
@@ -2924,10 +2925,9 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
msg = l_genl_msg_new_sized(NL80211_CMD_CONNECT, 512);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
l_genl_msg_append_attr(msg, NL80211_ATTR_WIPHY_FREQ,
- 4, &bss->frequency);
- l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, bss->addr);
- l_genl_msg_append_attr(msg, NL80211_ATTR_SSID,
- bss->ssid_len, bss->ssid);
+ 4, &netdev->frequency);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, hs->aa);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_SSID, hs->ssid_len, hs->ssid);
l_genl_msg_append_attr(msg, NL80211_ATTR_AUTH_TYPE, 4, &auth_type);
switch (nhs->type) {
@@ -2950,7 +2950,7 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
l_genl_msg_append_attr(msg, NL80211_ATTR_PREV_BSSID, ETH_ALEN,
prev_bssid);
- if (bss->capability & IE_BSS_CAP_PRIVACY)
+ if (netdev->privacy)
l_genl_msg_append_attr(msg, NL80211_ATTR_PRIVACY, 0, NULL);
l_genl_msg_append_attr(msg, NL80211_ATTR_SOCKET_OWNER, 0, NULL);
@@ -3476,6 +3476,10 @@ static void netdev_connect_common(struct netdev *netdev,
bool is_rsn = hs->supplicant_ie != NULL;
const uint8_t *prev_bssid = prev_bss ? prev_bss->addr : NULL;
+ netdev->frequency = bss->frequency;
+ netdev->privacy = bss->capability & IE_BSS_CAP_PRIVACY;
+ handshake_state_set_authenticator_address(hs, bss->addr);
+
if (!is_rsn)
goto build_cmd_connect;
@@ -3519,8 +3523,8 @@ static void netdev_connect_common(struct netdev *netdev,
break;
default:
build_cmd_connect:
- cmd_connect = netdev_build_cmd_connect(netdev, bss, hs,
- prev_bssid, vendor_ies, num_vendor_ies);
+ cmd_connect = netdev_build_cmd_connect(netdev, hs, prev_bssid,
+ vendor_ies, num_vendor_ies);
if (!is_offload(hs) && (is_rsn || hs->settings_8021x)) {
sm = eapol_sm_new(hs);
@@ -3536,13 +3540,10 @@ build_cmd_connect:
netdev->user_data = user_data;
netdev->handshake = hs;
netdev->sm = sm;
- netdev->frequency = bss->frequency;
netdev->cur_rssi = bss->signal_strength / 100;
netdev_rssi_level_init(netdev);
netdev_cqm_rssi_update(netdev);
- handshake_state_set_authenticator_address(hs, bss->addr);
-
if (!wiphy_has_ext_feature(netdev->wiphy,
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0))
handshake_state_set_no_rekey(hs, true);
--
2.31.1
8 months, 2 weeks
[PATCH v2 1/3] netdev: factor out scan_bss from CMD_CONNECT builder
by James Prestwood
In order to support OWE in the CMD_CONNECT path the scan_bss parameter
needs to be removed since this is lost after netdev_connect returns.
Nearly everything needed is also stored in the handshake except the
privacy capability which is now being mirrored in the netdev object
itself.
---
src/netdev.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index a5d1b8ed..8592685c 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -181,6 +181,7 @@ struct netdev {
bool events_ready : 1;
bool retry_auth : 1;
bool in_reassoc : 1;
+ bool privacy : 1;
};
struct netdev_preauth_state {
@@ -788,6 +789,7 @@ static void netdev_connect_free(struct netdev *netdev)
netdev->ignore_connect_event = false;
netdev->expect_connect_failure = false;
netdev->cur_rssi_low = false;
+ netdev->privacy = false;
if (netdev->connect_cmd) {
l_genl_msg_unref(netdev->connect_cmd);
@@ -2901,7 +2903,6 @@ static void netdev_fils_tx_associate(struct iovec *fils_iov, size_t n_fils_iov,
}
static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
- struct scan_bss *bss,
struct handshake_state *hs,
const uint8_t *prev_bssid,
const struct iovec *vendor_ies,
@@ -2924,10 +2925,9 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
msg = l_genl_msg_new_sized(NL80211_CMD_CONNECT, 512);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
l_genl_msg_append_attr(msg, NL80211_ATTR_WIPHY_FREQ,
- 4, &bss->frequency);
- l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, bss->addr);
- l_genl_msg_append_attr(msg, NL80211_ATTR_SSID,
- bss->ssid_len, bss->ssid);
+ 4, &netdev->frequency);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, hs->aa);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_SSID, hs->ssid_len, hs->ssid);
l_genl_msg_append_attr(msg, NL80211_ATTR_AUTH_TYPE, 4, &auth_type);
switch (nhs->type) {
@@ -2950,7 +2950,7 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
l_genl_msg_append_attr(msg, NL80211_ATTR_PREV_BSSID, ETH_ALEN,
prev_bssid);
- if (bss->capability & IE_BSS_CAP_PRIVACY)
+ if (netdev->privacy)
l_genl_msg_append_attr(msg, NL80211_ATTR_PRIVACY, 0, NULL);
l_genl_msg_append_attr(msg, NL80211_ATTR_SOCKET_OWNER, 0, NULL);
@@ -3476,6 +3476,10 @@ static void netdev_connect_common(struct netdev *netdev,
bool is_rsn = hs->supplicant_ie != NULL;
const uint8_t *prev_bssid = prev_bss ? prev_bss->addr : NULL;
+ netdev->frequency = bss->frequency;
+ netdev->privacy = bss->capability & IE_BSS_CAP_PRIVACY;
+ handshake_state_set_authenticator_address(hs, bss->addr);
+
if (!is_rsn)
goto build_cmd_connect;
@@ -3519,8 +3523,8 @@ static void netdev_connect_common(struct netdev *netdev,
break;
default:
build_cmd_connect:
- cmd_connect = netdev_build_cmd_connect(netdev, bss, hs,
- prev_bssid, vendor_ies, num_vendor_ies);
+ cmd_connect = netdev_build_cmd_connect(netdev, hs, prev_bssid,
+ vendor_ies, num_vendor_ies);
if (!is_offload(hs) && (is_rsn || hs->settings_8021x)) {
sm = eapol_sm_new(hs);
@@ -3536,13 +3540,10 @@ build_cmd_connect:
netdev->user_data = user_data;
netdev->handshake = hs;
netdev->sm = sm;
- netdev->frequency = bss->frequency;
netdev->cur_rssi = bss->signal_strength / 100;
netdev_rssi_level_init(netdev);
netdev_cqm_rssi_update(netdev);
- handshake_state_set_authenticator_address(hs, bss->addr);
-
if (!wiphy_has_ext_feature(netdev->wiphy,
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0))
handshake_state_set_no_rekey(hs, true);
--
2.31.1
8 months, 2 weeks
[PATCH 1/2] test-runner: fix --monitor option
by James Prestwood
Two issues:
- log-gid/uid was not being set
- the log file was being appended if it already existed
---
tools/test-runner | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/test-runner b/tools/test-runner
index fc57cd81..9e4d0780 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -183,7 +183,9 @@ class Process(subprocess.Popen):
args = ['ip', 'netns', 'exec', namespace] + args
if outfile:
- self._append_outfile(outfile)
+ # outfile is only used by iwmon, in which case we don't want
+ # to append to an existing file.
+ self._append_outfile(outfile, append=False)
if self.ctx.args.log:
logfile = '%s/%s/%s' % (self.ctx.args.log,
@@ -240,7 +242,7 @@ class Process(subprocess.Popen):
return True
- def _append_outfile(self, file):
+ def _append_outfile(self, file, append=True):
gid = int(self.ctx.args.log_gid)
uid = int(self.ctx.args.log_uid)
dir = os.path.dirname(file)
@@ -253,7 +255,7 @@ class Process(subprocess.Popen):
# If the out file exists, append. Useful for processes like
# hostapd_cli where it is called multiple times independently.
- if os.path.isfile(file):
+ if os.path.isfile(file) and append:
mode = 'a'
else:
mode = 'w'
@@ -1708,6 +1710,9 @@ class Main:
self.args.monitor = os.path.abspath(self.args.monitor)
mon_parent_dir = os.path.abspath(os.path.join(self.args.monitor, os.pardir))
+ options += ' --log-gid %u' % int(os.environ['SUDO_GID'])
+ options += ' --log-uid %u' % int(os.environ['SUDO_UID'])
+
denylist = [
'auto_tests',
'sub_tests',
--
2.31.1
8 months, 2 weeks
[PATCH 1/3] netdev: factor out scan_bss from CMD_CONNECT builder
by James Prestwood
In order to support OWE in the CMD_CONNECT path the scan_bss parameter
needs to be removed since this is lost after netdev_connect returns.
Nearly everything needed is also stored in the handshake except the
privacy capability which is now being mirrored in the netdev object
itself.
---
src/netdev.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index a5d1b8ed..8592685c 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -181,6 +181,7 @@ struct netdev {
bool events_ready : 1;
bool retry_auth : 1;
bool in_reassoc : 1;
+ bool privacy : 1;
};
struct netdev_preauth_state {
@@ -788,6 +789,7 @@ static void netdev_connect_free(struct netdev *netdev)
netdev->ignore_connect_event = false;
netdev->expect_connect_failure = false;
netdev->cur_rssi_low = false;
+ netdev->privacy = false;
if (netdev->connect_cmd) {
l_genl_msg_unref(netdev->connect_cmd);
@@ -2901,7 +2903,6 @@ static void netdev_fils_tx_associate(struct iovec *fils_iov, size_t n_fils_iov,
}
static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
- struct scan_bss *bss,
struct handshake_state *hs,
const uint8_t *prev_bssid,
const struct iovec *vendor_ies,
@@ -2924,10 +2925,9 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
msg = l_genl_msg_new_sized(NL80211_CMD_CONNECT, 512);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
l_genl_msg_append_attr(msg, NL80211_ATTR_WIPHY_FREQ,
- 4, &bss->frequency);
- l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, bss->addr);
- l_genl_msg_append_attr(msg, NL80211_ATTR_SSID,
- bss->ssid_len, bss->ssid);
+ 4, &netdev->frequency);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, hs->aa);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_SSID, hs->ssid_len, hs->ssid);
l_genl_msg_append_attr(msg, NL80211_ATTR_AUTH_TYPE, 4, &auth_type);
switch (nhs->type) {
@@ -2950,7 +2950,7 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
l_genl_msg_append_attr(msg, NL80211_ATTR_PREV_BSSID, ETH_ALEN,
prev_bssid);
- if (bss->capability & IE_BSS_CAP_PRIVACY)
+ if (netdev->privacy)
l_genl_msg_append_attr(msg, NL80211_ATTR_PRIVACY, 0, NULL);
l_genl_msg_append_attr(msg, NL80211_ATTR_SOCKET_OWNER, 0, NULL);
@@ -3476,6 +3476,10 @@ static void netdev_connect_common(struct netdev *netdev,
bool is_rsn = hs->supplicant_ie != NULL;
const uint8_t *prev_bssid = prev_bss ? prev_bss->addr : NULL;
+ netdev->frequency = bss->frequency;
+ netdev->privacy = bss->capability & IE_BSS_CAP_PRIVACY;
+ handshake_state_set_authenticator_address(hs, bss->addr);
+
if (!is_rsn)
goto build_cmd_connect;
@@ -3519,8 +3523,8 @@ static void netdev_connect_common(struct netdev *netdev,
break;
default:
build_cmd_connect:
- cmd_connect = netdev_build_cmd_connect(netdev, bss, hs,
- prev_bssid, vendor_ies, num_vendor_ies);
+ cmd_connect = netdev_build_cmd_connect(netdev, hs, prev_bssid,
+ vendor_ies, num_vendor_ies);
if (!is_offload(hs) && (is_rsn || hs->settings_8021x)) {
sm = eapol_sm_new(hs);
@@ -3536,13 +3540,10 @@ build_cmd_connect:
netdev->user_data = user_data;
netdev->handshake = hs;
netdev->sm = sm;
- netdev->frequency = bss->frequency;
netdev->cur_rssi = bss->signal_strength / 100;
netdev_rssi_level_init(netdev);
netdev_cqm_rssi_update(netdev);
- handshake_state_set_authenticator_address(hs, bss->addr);
-
if (!wiphy_has_ext_feature(netdev->wiphy,
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0))
handshake_state_set_no_rekey(hs, true);
--
2.31.1
8 months, 2 weeks