From patchwork Wed Jan 3 18:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510413 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 638CF1CA81 for ; Wed, 3 Jan 2024 18:46:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HO1nf1Jk" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-781df3bc08fso103208985a.2 for ; Wed, 03 Jan 2024 10:46:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307616; x=1704912416; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0CK+cEINYpyo2ATfomlbUmVtK/y40YR1O/Eme6ImURg=; b=HO1nf1JkqC5RbXektr0MF3jNyLzTFWXQQReH4E+TkAqZ75gqb5hWZPXnbbMdpN1ZWL Z1ubIKzkykp3fbKdbLEj21ekm1dri9kIo9hlSUmLcjt2H6+RNLsyckm7aqhYtE8eMI9N Pbxh9jBw2tFTrSGIKL66yEtdd/4YbVEAFfgkNaqlqKuzW9BTPje+iVybgIrAD1lvMs8l ZmDoglpc8afwY6vPjd3h8iigXmmwgckaVRdV/u/ZnLO7ovfiT7F86PINFXrnwEIabAm2 P6ijAv20Ots/lQ3F+J8vSC7GhCpYtOCQKGLivvgiwvKEm2AQgoSIlLKqUi4NmPam5iD3 YYmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307616; x=1704912416; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0CK+cEINYpyo2ATfomlbUmVtK/y40YR1O/Eme6ImURg=; b=ijMhIBndmDAx4nq4sN1U/2bTRoEHMLiDsghlFaK5RaHXocIjgc6VdWoEpo2u3iBMO7 hAevZOkVILn7L8wdQKo8ApJ5rsye3xxx1ZvBa1FgR2G8Xm05HlXF29asUjwQMLT2LfzS bpw4qqD66IXsDthu1X0p7fXSvMcYRGPUrGHqNAopCMHDUi8KSecF/WnF8fAv80guksg2 j8byHWQ4ovtDXa04d1PxZhVBkJlPWYAaFkQvtttEY5sh1AEbxr7doq5vXpbjW7hZZ5Z5 3zITeGYdrBGtnCGnxBaQNsCuRYRQe/2nYtOZOPLQHCpIldjMp2WAKTmd9eNzUn7Y6f6y YE5Q== X-Gm-Message-State: AOJu0YzLIu0Y08lInThAXAsiMtxGHfV2oWAJG1RnrQnFUijLYDje4JPF gp2gj8f36UVOlcf7+oV33U8o+HFgwHXThg== X-Google-Smtp-Source: AGHT+IFuIvWlTbiB3wOfpppIqKxTDO0+ZAstmXF4WlL0TryGit1PDkVRRHkIjqh98IwDq8+o4ewQVQ== X-Received: by 2002:a05:620a:17a9:b0:781:182c:f668 with SMTP id ay41-20020a05620a17a900b00781182cf668mr17528838qkb.29.1704307615846; Wed, 03 Jan 2024 10:46:55 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:46:55 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/8] station: handle netconfig after roaming for FW roams Date: Wed, 3 Jan 2024 10:46:31 -0800 Message-Id: <20240103184638.533221-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This was not taken into account for FW roams and would result in the station state being set to connected regardless of netconfig's result. --- src/station.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/station.c b/src/station.c index 73de26bb..5c9ede8b 100644 --- a/src/station.c +++ b/src/station.c @@ -3406,6 +3406,16 @@ static void station_beacon_lost(struct station *station) station_roam_timeout_rearm(station, LOSS_ROAM_RATE_LIMIT); } +static void station_event_roaming(struct station *station) +{ + if (station->netconfig && station->state != STATION_STATE_CONNECTED) { + netconfig_reset(station->netconfig); + station->netconfig_after_roam = true; + } + + station_enter_state(station, STATION_STATE_FW_ROAMING); +} + static void station_netdev_event(struct netdev *netdev, enum netdev_event event, void *event_data, void *user_data) { @@ -3433,7 +3443,7 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event, station_signal_agent_notify(station); break; case NETDEV_EVENT_ROAMING: - station_enter_state(station, STATION_STATE_FW_ROAMING); + station_event_roaming(station); break; case NETDEV_EVENT_ROAMED: station_event_roamed(station, (struct scan_bss *) event_data); From patchwork Wed Jan 3 18:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510414 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B673E1CA82 for ; Wed, 3 Jan 2024 18:46:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ov+EbyWs" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6dbfe3fe308so2402462a34.1 for ; Wed, 03 Jan 2024 10:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307617; x=1704912417; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=igAAo3g1l3VHhGPJSjX2tgH+xOx4tYN1jMtUohUPvSI=; b=Ov+EbyWsuG1O4VZtl9aL5hln8pO5QL7phpuRo5h4VF+l0tc+Bt1TO5Omb+vyf3EKNK LJ24+g2JdHVIQ3NE1tqOvbwR1Gn2v/KS7mIyeVqWr8V3VPoxPTqp1AkGXqYKIc7JfnVf ohBdA0psGR+pBdgClmSvFavDuR1J6T3vdXrhNzKoNBzR7GKc+QFfntiCiIs/pKLrxMrl 7vyKN6kqX29LpdR4vAGXomjw8El2BIah64MKf3aCtW58aWlXmbCZcD8hq65RNTVJIPGI IRRqXtMGnzfdKTvzz8Tiq8i286Vp2pIGm3bZSC0VE+UYBUmr0nbWiCBuSQUduH9n2nZn M2qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307617; x=1704912417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=igAAo3g1l3VHhGPJSjX2tgH+xOx4tYN1jMtUohUPvSI=; b=EskDfBC981xide+qQChwp714Wg+HnhALS93Yd291cTVl6JzFCH1eofnAWEmu2Zq1fT DtZyssD92HNqJazH53OJiOy+UuWbyiCKktHYfuTn/xE/7CrzbcVQztSCIoWFMLWvKRSc Nx34nJiP7oinY5iqJGMlpGXr1MA1EAD7Au1JsN3bON9MfEz3dScdwXKxI/RAWFxbHWdA hQGAsHHXng87iRba8Y4uSxZjMbFd9SdWHS2p3KXjysYCtYPsfH20GcGz+4MR72FQmJ09 RDboJehu+wqGAAF/5RJO3oXUMlcSvrVTqnUaY5u/R3pMosHflOgyi06yGIVsE2lbM/Ot FfOw== X-Gm-Message-State: AOJu0YwEZH6jrBgW0vANVoI9wR4Lc4NmVWH9odfa3huzCRp/wRSq1fXO dN9pX3CAA055Y8SK/NnMcPsOjUXc3bM1iQ== X-Google-Smtp-Source: AGHT+IG8b1zR+MANf4LZDBHFFZrCsZK8omKdSHDvGC90PLPhEJgv0GPzMVfGXYgXh07nPmsVVRF7DA== X-Received: by 2002:a05:6871:3a0b:b0:203:535d:102e with SMTP id pu11-20020a0568713a0b00b00203535d102emr9821469oac.21.1704307617335; Wed, 03 Jan 2024 10:46:57 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:46:56 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/8] station: add additional internal state, STATION_STATE_NETCONFIG Date: Wed, 3 Jan 2024 10:46:32 -0800 Message-Id: <20240103184638.533221-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is still treated as "connecting" from a DBus perspective but will allow for better handling internally for some roaming corner cases. --- src/dpp.c | 1 + src/station.c | 5 +++++ src/station.h | 1 + src/wsc.c | 1 + 4 files changed, 8 insertions(+) diff --git a/src/dpp.c b/src/dpp.c index af6574fb..74b4c2bc 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -3761,6 +3761,7 @@ static void dpp_station_state_watch(enum station_state state, void *user_data) case STATION_STATE_CONNECTING: case STATION_STATE_CONNECTED: case STATION_STATE_CONNECTING_AUTO: + case STATION_STATE_NETCONFIG: if (L_WARN_ON(dpp->role == DPP_CAPABILITY_CONFIGURATOR)) dpp_reset(dpp); diff --git a/src/station.c b/src/station.c index 5c9ede8b..57d22e91 100644 --- a/src/station.c +++ b/src/station.c @@ -1497,6 +1497,8 @@ static const char *station_state_to_string(enum station_state state) return "ft-roaming"; case STATION_STATE_FW_ROAMING: return "fw-roaming"; + case STATION_STATE_NETCONFIG: + return "connecting (netconfig)"; } return "invalid"; @@ -1633,6 +1635,7 @@ static void station_enter_state(struct station *station, station_set_drop_unicast_l2_multicast(station, false); break; case STATION_STATE_DISCONNECTING: + case STATION_STATE_NETCONFIG: break; case STATION_STATE_ROAMING: case STATION_STATE_FT_ROAMING: @@ -3344,6 +3347,7 @@ static void station_disconnect_event(struct station *station, void *event_data) case STATION_STATE_CONNECTED: case STATION_STATE_FT_ROAMING: case STATION_STATE_FW_ROAMING: + case STATION_STATE_NETCONFIG: station_disassociated(station); return; default: @@ -4274,6 +4278,7 @@ static bool station_property_get_state(struct l_dbus *dbus, break; case STATION_STATE_CONNECTING: case STATION_STATE_CONNECTING_AUTO: + case STATION_STATE_NETCONFIG: statestr = "connecting"; break; case STATION_STATE_CONNECTED: diff --git a/src/station.h b/src/station.h index 0d502a08..a38327e4 100644 --- a/src/station.h +++ b/src/station.h @@ -45,6 +45,7 @@ enum station_state { STATION_STATE_ROAMING, /* Reassociation */ STATION_STATE_FT_ROAMING, /* Fast transition */ STATION_STATE_FW_ROAMING, /* Firmware roamed by itself */ + STATION_STATE_NETCONFIG, }; enum station_event { diff --git a/src/wsc.c b/src/wsc.c index cda877cf..f88f5deb 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -654,6 +654,7 @@ static void wsc_check_can_connect(struct wsc_station_dbus *wsc, case STATION_STATE_CONNECTING: case STATION_STATE_CONNECTING_AUTO: case STATION_STATE_CONNECTED: + case STATION_STATE_NETCONFIG: if (station_disconnect(wsc->station) < 0) goto error; From patchwork Wed Jan 3 18:46:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510415 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5448B1C6BC for ; Wed, 3 Jan 2024 18:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VTi91vuk" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-7810c332a2cso934353485a.1 for ; Wed, 03 Jan 2024 10:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307619; x=1704912419; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WUfQaeQFiY/hrzbSzl8jYqU9JdCp/0PNe7cSdz9EVOU=; b=VTi91vukLHF5eTUAXLD9UjU3f8ra4QgY4dbvJJAFOSm/myyAvFr/ZIX757bhvjVvGe wHb3WDxqWbJnCufJt5k+KceRf/8FP3bakEixg/raf9T/XWFC5dqDIIL0+Y+eupkRjWwE MIGQinCHzF/ntgsz4oPpvP0uHUVk9c8d+h+gYjI9RbEPLVPMcpxh8uYLTGWVHE/ND3AW 4DqNeMNHhqwIxYkLu+N3ki6SYa3jLMRYoU5wQWzby5sLy89skwxmJTQTCy6hDGJ1zUt7 Y4bVYHiI6tQyzsjb9XNtOv573bsm3LkNpTvNUNeYIMocRf9qV9lcbJI/cf/XvqzLngMN szQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307619; x=1704912419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WUfQaeQFiY/hrzbSzl8jYqU9JdCp/0PNe7cSdz9EVOU=; b=w9ljByQeH9v5SIXjKm1cMPgx/WKsvp0DU8/DCGLrBU1OjWZYRk5a3YR+tx0yfZJ2Me 9Hfczzn9pbVtOeL8ZhOysxj3jDBb4xGR63Ybe2awoTe89CIRB3ah4rr5zDEGWfKn0O6f DCMDC8kDSyEQdUwzy5Z0YWle+JE8N2uEdDIbNnLAXfiY+Ts9fo/u+VKm6I5lFqsmSMje eTJMbVNsW9KZRKC3i20DyUMgrKH9LypWoxbdesElKr580fQ66pzOevMCYHVQoHsLTX/s CEMF3iAGmcHpD0WR6aI840UI8Wodrpv6RUcrxRksi2pwIJTeEALGl/wHeHw4DBhPZHPa vpCQ== X-Gm-Message-State: AOJu0Ywbsm/hIA+DdpxfetQ0Uf0WVkpIce5y0U+FnpV+tWivE7HM/Sdc qggIe0lPC46vCaDIgXKOJ2eVfuOFx8eC2g== X-Google-Smtp-Source: AGHT+IFUbas4qpjOMMj7rpX0F9957YmCIMFXotaP83TJ3/jV0Y/NiTwxkCDox0OLGbGzHgD8dZ2/FQ== X-Received: by 2002:a05:620a:11a7:b0:781:2560:3ceb with SMTP id c7-20020a05620a11a700b0078125603cebmr23391065qkk.89.1704307618826; Wed, 03 Jan 2024 10:46:58 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:46:58 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/8] station: add handling for new NETCONFIG state Date: Wed, 3 Jan 2024 10:46:33 -0800 Message-Id: <20240103184638.533221-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There was an unhandled corner case if netconfig was running and multiple roam conditions happened in sequence, all before netconfig had completed. A single roam before netconfig was already handled (23f0f5717c) but this did not take into account any additional roam conditions. If IWD is in this state, having started netconfig, then roamed, and again restarted netconfig it is still in a roaming state which will prevent any further roams. IWD will remain "stuck" on the current BSS until netconfig completes or gets disconnected. To fix this a new internal station state was added (no changes to the DBus API) to distinguish between a purely WiFi connecting state (STATION_STATE_CONNECTING/AUTO) and netconfig (STATION_STATE_NETCONFIG). This allows IWD roam as needed if netconfig is still running. The change is mainly just adding STATION_STATE_NETCONFIG anywhere that STATION_STATE_CONNECTING is to maintain the same behavior, except within the netconfig event handler. In this case we should never get here without being in either a NETCONFIG or ROAMING state. For some background this scenario happens if the DHCP server goes down for an extended period, e.g. if its being upgraded/serviced. --- src/station.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/station.c b/src/station.c index 57d22e91..8f310ec8 100644 --- a/src/station.c +++ b/src/station.c @@ -1768,6 +1768,7 @@ static void station_reset_connection_state(struct station *station) if (station->state == STATION_STATE_CONNECTED || station->state == STATION_STATE_CONNECTING || station->state == STATION_STATE_CONNECTING_AUTO || + station->state == STATION_STATE_NETCONFIG || station_is_roaming(station)) network_disconnected(network); } @@ -2043,8 +2044,9 @@ static void station_netconfig_event_handler(enum netconfig_event event, dbus_pending_reply(&station->connect_pending, reply); } - if (L_IN_SET(station->state, STATION_STATE_CONNECTING, - STATION_STATE_CONNECTING_AUTO)) + if (L_IN_SET(station->state, STATION_STATE_NETCONFIG, + STATION_STATE_ROAMING, STATION_STATE_FT_ROAMING, + STATION_STATE_FW_ROAMING)) network_connect_failed(station->connected_network, false); @@ -2070,9 +2072,14 @@ static bool netconfig_after_roam(struct station *station) network_get_settings(network))) return false; - return netconfig_configure(station->netconfig, + if (L_WARN_ON(!netconfig_configure(station->netconfig, station_netconfig_event_handler, - station); + station))) + return false; + + station_enter_state(station, STATION_STATE_NETCONFIG); + + return true; } static void station_roamed(struct station *station) @@ -3255,6 +3262,8 @@ static void station_connect_ok(struct station *station) station_netconfig_event_handler, station))) return; + + station_enter_state(station, STATION_STATE_NETCONFIG); } else station_enter_state(station, STATION_STATE_CONNECTED); } @@ -4067,7 +4076,8 @@ static struct l_dbus_message *station_dbus_scan(struct l_dbus *dbus, return dbus_error_busy(message); if (station->state == STATION_STATE_CONNECTING || - station->state == STATION_STATE_CONNECTING_AUTO) + station->state == STATION_STATE_CONNECTING_AUTO || + station->state == STATION_STATE_NETCONFIG) return dbus_error_busy(message); station->dbus_scan_subset_idx = 0; @@ -5025,7 +5035,8 @@ static struct l_dbus_message *station_debug_scan(struct l_dbus *dbus, return dbus_error_busy(message); if (station->state == STATION_STATE_CONNECTING || - station->state == STATION_STATE_CONNECTING_AUTO) + station->state == STATION_STATE_CONNECTING_AUTO || + station->state == STATION_STATE_NETCONFIG) return dbus_error_busy(message); if (!l_dbus_message_get_arguments(message, "aq", &iter)) From patchwork Wed Jan 3 18:46:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510416 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11E771C6BC for ; Wed, 3 Jan 2024 18:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RaLcLnS9" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7818ab57d7dso410562685a.2 for ; Wed, 03 Jan 2024 10:47:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307620; x=1704912420; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=498VsVdajc3ch3Mu/qKE96ri+I/+iWfSAVzJ64kLtgY=; b=RaLcLnS9u7NUEJ0rxrRcc+tNoIu2xhsXA3VyoYwZwFN88hV911bXCy7otKR01tlQkj rZzg/kDul9dfq5mInM4MLJxSoElBH97n+Uucuwwsrb4EWudHGWYF8FsIJHGNJsPxJaxm RrbwnCVOH531+oyeJd5TfGKx9aNVKjk/mSn2mtqX55Ay/gGetTi8xS5u+Y3NuzKh60Yv tZ9h31wdT0W9UrjQ3xuCahegbEfoZ4iUvM6CuUy0u+1GJHCLVsVNnSN1qDalO48iAfSE ZoGMsNUXSkK2ALB+wKsK98Sl7BYfm9WWEIx880cp2AZi6mw+9wNkkWvY1LXRZtGVDIql c/Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307620; x=1704912420; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=498VsVdajc3ch3Mu/qKE96ri+I/+iWfSAVzJ64kLtgY=; b=jZB/FCdXD4KWCMHOwaofmrR6D4EJSW/3rKtcokUDqUuLCZ+AIn+h7zPZRjQY9Z2vsj 9JJiaYsggdUTKR7Qlo+x5/LgpNxS72S6NpsK27R4awCO/hsA5M50s+drQqea8nsC4OP1 9esyISJqWdPg2TjYoz7yNhtysNh0KERvaDLujxt8c7QBzQCRyhvxVvr2WCgdA9hhso22 4pBaox9jeZrymEYkM/l8oeT8bYpIC4lVcTwTqD7D6Q1kE/85Do68yXJGHGSF58apuiNz zzm3YTGXYfe2qGopAVHi9pGw8lyemBs2RUoIepseCH0HgykC+wadbNMOVv7PaI6dAzTX qF5Q== X-Gm-Message-State: AOJu0Ywev9Hll9Mi3nA8qRyRQFq7RAVYh2yJ44CmOyesTf+Jwq4xOibd gUNWOB2YKs7INv8OLckCsFGQqRVW64QDSw== X-Google-Smtp-Source: AGHT+IH+kkMkps3us0n0VAwLWIk1/Epvn9w3K7C6m2yPH8Pqw4o93zDl/OtgOPDoXNVxhlsEOcBo8Q== X-Received: by 2002:ae9:f10b:0:b0:781:5549:d12e with SMTP id k11-20020ae9f10b000000b007815549d12emr14079209qkg.3.1704307620124; Wed, 03 Jan 2024 10:47:00 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:46:59 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/8] station: add debug events for internal states Date: Wed, 3 Jan 2024 10:46:34 -0800 Message-Id: <20240103184638.533221-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This gives the tests a lot more fine-tune control to wait for specific state transitions rather than only what is exposed over DBus. The additional events for "ft-roam" and "reassoc-roam" were removed since these are now covered by the more generic state change events ("ft-roaming" and "roaming" respectively). --- src/station.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/station.c b/src/station.c index 8f310ec8..79f25d73 100644 --- a/src/station.c +++ b/src/station.c @@ -1556,6 +1556,8 @@ static void station_enter_state(struct station *station, station_state_to_string(station->state), station_state_to_string(state)); + station_debug_event(station, station_state_to_string(state)); + disconnected = !station_is_busy(station); if ((disconnected && state > STATION_STATE_AUTOCONNECT_FULL) || @@ -2222,8 +2224,6 @@ static int station_transition_reassociate(struct station *station, station->preparing_roam = false; station_enter_state(station, STATION_STATE_ROAMING); - station_debug_event(station, "reassoc-roam"); - return 0; } @@ -2366,8 +2366,6 @@ try_next: station->preparing_roam = false; station_enter_state(station, STATION_STATE_FT_ROAMING); - station_debug_event(station, "ft-roam"); - break; case -EINVAL: /* From patchwork Wed Jan 3 18:46:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510417 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE49D1C6AE for ; Wed, 3 Jan 2024 18:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jY2Dh1wZ" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-78109a21144so870041785a.0 for ; Wed, 03 Jan 2024 10:47:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307621; x=1704912421; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ClWw0PW0rEcg5naiCSnI54wGpoVumWsibWgdEU3XJqA=; b=jY2Dh1wZBQh04Z9gsXoovCueiFfxygVxpGF+HV/PStbm6Fu8pBgKmPzmD3KZe/7pdT lsAld2YRlL+Uh/1wqb2P+72LMosvfV30aCg8xeEE+JfCRmtH5TkONXX0+/Kh2I6/L1GG IWD0pta06mftQuDUqmjDVk6FJSBrY1+2Q3MDO+AQOsmOfovG+3TNpiaSEX/jxG1sNSeq Rwk4r6wBMw4iNjIf2eQ7dyNtDwhD9f9W+SFIDL3B6qx4sJhFg2d6Z1K1IButTGZZQYyq JgaQicsY8vcEYu+Mp7AfFsO6qyDJHTSzz2JeDsVTW+3QhNl4Oz03fg0IOCuLCVzgHoi8 oT+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307621; x=1704912421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ClWw0PW0rEcg5naiCSnI54wGpoVumWsibWgdEU3XJqA=; b=ubxaT3Zrr1ubSd2ZjWu1Hy/iuaiUqUCzmCbXXB6Oq0dDcN0kfHBAU4+UVIkQ0/F1Hd 7qqiLO4CNLn5y/mbpG7pKsCLrm9LaS3yP1zCzhEFNOevDnetrKRNG+WfmpZRE1ZGVgKc IChZiUB1Cl18yzvn8gegIce+5RBLioCEXjCU8r4E0+aCd81Sk2dZQoUvGFc0AcHBUoRE bsMYX2Q1Gua4wG3X78HXtIRNB9uxr7t5Q9TXJEXNGekaZkosbhaE/B+vTUMQ9HI0cbib rOf+hvHGYccmQPxwY7qeD1THsroTZDxxDsv37xBy4X/7p6sMQjdOV5het4+T3DxoznLi nKKg== X-Gm-Message-State: AOJu0Yxcrr6s6mSrBZxlhTndJ1udvatmNuMf94HbRHazmyi6DQ+BDfGe mPKVauPdmbljLKYtSlS9PQFAX0i+wEpugA== X-Google-Smtp-Source: AGHT+IGXnvSPMEuiv+jNvrQXU5UfAJl1s/flI80pkLzTKx6LK6+eEa+lAGtr78qnohSRNMwglXbeaA== X-Received: by 2002:a05:620a:2808:b0:781:dd78:5260 with SMTP id f8-20020a05620a280800b00781dd785260mr3074251qkp.138.1704307621561; Wed, 03 Jan 2024 10:47:01 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:47:00 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/8] auto-t: update roam test to use new debug events Date: Wed, 3 Jan 2024 10:46:35 -0800 Message-Id: <20240103184638.533221-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- autotests/testPSK-roam/failed_roam_test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autotests/testPSK-roam/failed_roam_test.py b/autotests/testPSK-roam/failed_roam_test.py index d42002d4..ccdec2c6 100644 --- a/autotests/testPSK-roam/failed_roam_test.py +++ b/autotests/testPSK-roam/failed_roam_test.py @@ -60,7 +60,7 @@ class Test(unittest.TestCase): self.rule0.enabled = False # IWD should then try BSS 2, and succeed - device.wait_for_event('ft-roam', timeout=60) + device.wait_for_event('ft-roaming', timeout=60) self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2]) self.bss_hostapd[2].deauthenticate(device.address) @@ -75,7 +75,7 @@ class Test(unittest.TestCase): self.connect(self.wd, device, self.bss_hostapd[0]) - device.wait_for_event('ft-roam', timeout=60) + device.wait_for_event('ft-roaming', timeout=60) condition = 'obj.state == DeviceState.disconnected' self.wd.wait_for_object_condition(device, condition) @@ -101,14 +101,14 @@ class Test(unittest.TestCase): # IWD should connect, then attempt a roam to BSS 1, which should # fail and cause a fallback to reassociation device.wait_for_event('ft-fallback-to-reassoc', timeout=60) - device.wait_for_event('reassoc-roam', timeout=60) + device.wait_for_event('roaming', timeout=60) self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2]) # Trigger another roam self.rule_bss2.signal = -8000 - device.wait_for_event('ft-roam', timeout=60) + device.wait_for_event('ft-roaming', timeout=60) # Ensure an FT roam back to a properly configured AP works. self.verify_roam(self.wd, device, self.bss_hostapd[2], self.bss_hostapd[1]) @@ -141,7 +141,7 @@ class Test(unittest.TestCase): # fail and cause the rank to be re-computed. This should then put # bss 1 as the next candidate (since the FT factor is removed) device.wait_for_event('ft-fallback-to-reassoc', timeout=60) - device.wait_for_event('ft-roam', timeout=60) + device.wait_for_event('ft-roaming', timeout=60) self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[1]) From patchwork Wed Jan 3 18:46:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510418 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A74E41C6AE for ; Wed, 3 Jan 2024 18:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JVU5yCmq" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-7815aca9a4eso416032985a.0 for ; Wed, 03 Jan 2024 10:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307623; x=1704912423; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M5vQSPwqHuKwKL0XPeLXtZhU8xw+uT2KJ5YGKGIIlRE=; b=JVU5yCmqh0jkCIUcctcSzMg+bItt6w5TX3X5dqSDLv/XZc3cPYSoe40HgvEvrGON58 +Xq5oqxpgDDkRKzusdUh1BvL6iou4lC/BRgnbPVhRNHcq67+SY1U/EwLonRl9r+6wRS4 LCuvDFNyPyptZvSdNu+V0/CSmtrq8yRMkjkIzwVe6VvrM/K3IoyIjTKwiMI+4C2LWk+3 ayxy5/1yx75djLpPaLTp/OMA1AyIrM3soIRhwpNLJSzE0eV8D6iEndeOwi5wT2OboYEf impQysc/SJgGE5zutNljDcC9zDjS8pbdWrSk3Fs9KK9nXeAJy3RNIDUVg+Eh65JhuBpI HTDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307623; x=1704912423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M5vQSPwqHuKwKL0XPeLXtZhU8xw+uT2KJ5YGKGIIlRE=; b=XmZHVbZ99NhJuXpAayPH2nxcaRnPQf+ULR5pufJc4vhq6JEFs12ipy1mJLjVCw9r01 Pfr4+jV5scwQpd+wssLfZTz+JzzGKTJXFoSyOy4o4fk77UDqK1kEDSE85hCZOqtRUJdq 1/q1fnWyNWGSozCCIHymtHURLwdEAiYm0xAY7HFWcq5eH3QbtCUp6jpT3gdEqaqeMu9D ZtDJm2iGql8NDgfqyJhrM5Ae77dh4hRZ25MXgTW0PSWtA4wrKy4gkq8pJpaAZNtc/Fvu v5/mVMq5kdJh3Df/YdYMcDuqn8mWq2/EMEBUWnmj48QhllBk4p4T+Vk/Og4u+T37ytL+ xrtA== X-Gm-Message-State: AOJu0YwnQuUqKjzZJR44MdScRyxUOhbDbi/zpgOgObj319iZa2P7I67m wi2f4KGxioGjuuozvE6bxs4DxPp7XL988A== X-Google-Smtp-Source: AGHT+IEp9BLrUBVlsXPmOl8uEzkQQUoX7EeyqaUROVYXyeckHwOplw4vrcW/RruXsTZcSxrmLTSvHw== X-Received: by 2002:a05:620a:24d4:b0:781:ea80:edb7 with SMTP id m20-20020a05620a24d400b00781ea80edb7mr1000773qkn.23.1704307623234; Wed, 03 Jan 2024 10:47:03 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:47:02 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 6/8] auto-t: add test for roaming + netconfig Date: Wed, 3 Jan 2024 10:46:36 -0800 Message-Id: <20240103184638.533221-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This test ensures IWD will continue to roam and restart netconfig if roam conditions are met prior to netconfig finishing. --- autotests/testNetconfigRoam/TestFT.psk | 2 + .../testNetconfigRoam/ft-psk-ccmp-1.conf | 41 +++++++++ .../testNetconfigRoam/ft-psk-ccmp-2.conf | 41 +++++++++ autotests/testNetconfigRoam/hw.conf | 8 ++ autotests/testNetconfigRoam/main.conf | 3 + .../testNetconfigRoam/netconfig_roam_test.py | 88 +++++++++++++++++++ 6 files changed, 183 insertions(+) create mode 100644 autotests/testNetconfigRoam/TestFT.psk create mode 100644 autotests/testNetconfigRoam/ft-psk-ccmp-1.conf create mode 100644 autotests/testNetconfigRoam/ft-psk-ccmp-2.conf create mode 100644 autotests/testNetconfigRoam/hw.conf create mode 100644 autotests/testNetconfigRoam/main.conf create mode 100644 autotests/testNetconfigRoam/netconfig_roam_test.py diff --git a/autotests/testNetconfigRoam/TestFT.psk b/autotests/testNetconfigRoam/TestFT.psk new file mode 100644 index 00000000..e82d1295 --- /dev/null +++ b/autotests/testNetconfigRoam/TestFT.psk @@ -0,0 +1,2 @@ +[Security] +Passphrase=EasilyGuessedPassword diff --git a/autotests/testNetconfigRoam/ft-psk-ccmp-1.conf b/autotests/testNetconfigRoam/ft-psk-ccmp-1.conf new file mode 100644 index 00000000..b46d1f27 --- /dev/null +++ b/autotests/testNetconfigRoam/ft-psk-ccmp-1.conf @@ -0,0 +1,41 @@ +hw_mode=g +channel=1 +ssid=TestFT +utf8_ssid=1 +ctrl_interface=/var/run/hostapd + +r1_key_holder=120000000001 +nas_identifier=dummy1 + +wpa=2 +# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same +# time but we want to force FT +wpa_key_mgmt=FT-PSK +wpa_pairwise=CCMP +wpa_passphrase=EasilyGuessedPassword +ieee80211w=1 +rsn_preauth=1 +rsn_preauth_interfaces=lo +disable_pmksa_caching=0 +# Allow PMK cache to be shared opportunistically among configured interfaces +# and BSSes (i.e., all configurations within a single hostapd process). +okc=1 +mobility_domain=1234 +reassociation_deadline=60000 +r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f +r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f +r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f +r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f +# Push mode only needed for 8021x, not PSK mode since msk already known +pmk_r1_push=0 +# Allow locally generated FT response so we don't have to configure push/pull +# between BSSes running as separate hostapd processes as in the test-runner +# case. Only works with FT-PSK, otherwise brctl needs to be installed and +# CONFIG_BRIDGE enabled in the kernel. +ft_psk_generate_local=1 +rkh_pull_timeout=50 +ft_over_ds=0 +ap_table_expiration_time=36000 +ap_table_max_size=10 +rrm_neighbor_report=1 +ocv=1 diff --git a/autotests/testNetconfigRoam/ft-psk-ccmp-2.conf b/autotests/testNetconfigRoam/ft-psk-ccmp-2.conf new file mode 100644 index 00000000..3e215457 --- /dev/null +++ b/autotests/testNetconfigRoam/ft-psk-ccmp-2.conf @@ -0,0 +1,41 @@ +hw_mode=g +channel=2 +ssid=TestFT +utf8_ssid=1 +ctrl_interface=/var/run/hostapd + +r1_key_holder=120000000002 +nas_identifier=dummy2 + +wpa=2 +# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same +# time but we want to force FT +wpa_key_mgmt=FT-PSK +wpa_pairwise=CCMP +wpa_passphrase=EasilyGuessedPassword +ieee80211w=1 +rsn_preauth=1 +rsn_preauth_interfaces=lo +disable_pmksa_caching=0 +# Allow PMK cache to be shared opportunistically among configured interfaces +# and BSSes (i.e., all configurations within a single hostapd process). +okc=1 +mobility_domain=1234 +reassociation_deadline=60000 +r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f +r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f +r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f +r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f +# Push mode only needed for 8021x, not PSK mode since msk already known +pmk_r1_push=0 +# Allow locally generated FT response so we don't have to configure push/pull +# between BSSes running as separate hostapd processes as in the test-runner +# case. Only works with FT-PSK, otherwise brctl needs to be installed and +# CONFIG_BRIDGE enabled in the kernel. +ft_psk_generate_local=1 +rkh_pull_timeout=50 +ft_over_ds=0 +ap_table_expiration_time=36000 +ap_table_max_size=10 +rrm_neighbor_report=1 +ocv=1 diff --git a/autotests/testNetconfigRoam/hw.conf b/autotests/testNetconfigRoam/hw.conf new file mode 100644 index 00000000..c2b35d6e --- /dev/null +++ b/autotests/testNetconfigRoam/hw.conf @@ -0,0 +1,8 @@ +[SETUP] +num_radios=3 +start_iwd=0 +hwsim_medium=yes + +[HOSTAPD] +rad0=ft-psk-ccmp-1.conf +rad1=ft-psk-ccmp-2.conf diff --git a/autotests/testNetconfigRoam/main.conf b/autotests/testNetconfigRoam/main.conf new file mode 100644 index 00000000..aedd4ebd --- /dev/null +++ b/autotests/testNetconfigRoam/main.conf @@ -0,0 +1,3 @@ +[General] +EnableNetworkConfiguration=true +RoamRetryInterval=1 diff --git a/autotests/testNetconfigRoam/netconfig_roam_test.py b/autotests/testNetconfigRoam/netconfig_roam_test.py new file mode 100644 index 00000000..c66fc107 --- /dev/null +++ b/autotests/testNetconfigRoam/netconfig_roam_test.py @@ -0,0 +1,88 @@ +#! /usr/bin/python3 + +import unittest +import sys, os + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import PSKAgent +from iwd import NetworkType +from iwd import DeviceState +from hwsim import Hwsim +from hostapd import HostapdCLI +import testutil + +class Test(unittest.TestCase): + def test_roam_before_netconfig(self): + wd = IWD(True) + + device = wd.list_devices(1)[0] + device.autoconnect = True + + self.bss_hostapd[1].wait_for_event(f'AP-STA-CONNECTED {device.address}') + device.wait_for_event("connecting (netconfig)") + + roam_to = 0 + roam_from = 1 + + # Roam back and forth, ensuring that the state transitions between + # roaming and connecting (netconfig). + for _ in range(0, 5): + self.rules[roam_to].signal = -2000 + self.rules[roam_from].signal = -8000 + + condition = 'obj.state == DeviceState.roaming' + wd.wait_for_object_condition(device, condition) + + self.bss_hostapd[roam_to].wait_for_event(f'AP-STA-CONNECTED {device.address}') + device.wait_for_event("connecting (netconfig)") + + tmp = roam_from + roam_from = roam_to + roam_to = tmp + + self.bss_hostapd[roam_from].deauthenticate(device.address) + condition = 'obj.state == DeviceState.disconnected' + wd.wait_for_object_condition(device, condition) + + def tearDown(self): + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') + + @classmethod + def setUpClass(cls): + hwsim = Hwsim() + + IWD.copy_to_storage('TestFT.psk') + + cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), + HostapdCLI(config='ft-psk-ccmp-2.conf') ] + + rule0 = hwsim.rules.create() + rule0.source = cls.bss_hostapd[0].bssid + rule0.signal = -6000 + rule0.enabled = True + + rule1 = hwsim.rules.create() + rule1.source = cls.bss_hostapd[1].bssid + rule1.signal = -2000 + rule1.enabled = True + + cls.rules = [rule0, rule1] + + cls.bss_hostapd[0].set_address('12:00:00:00:00:01') + cls.bss_hostapd[1].set_address('12:00:00:00:00:02') + + HostapdCLI.group_neighbors(*cls.bss_hostapd) + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + cls.bss_hostapd = None + cls.rules = None + +if __name__ == '__main__': + unittest.main(exit=True) From patchwork Wed Jan 3 18:46:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510419 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14E621C6AB for ; Wed, 3 Jan 2024 18:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YaEuDxmD" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-204ec50010eso3151335fac.3 for ; Wed, 03 Jan 2024 10:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307625; x=1704912425; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=80PvfFBt8thHLOeFqpvd019AWlbEdsq+2OkJNyj5GRc=; b=YaEuDxmDsCtk8muvvEAZAD8PBjjO8WHYVz+U5U6XdSEe+45KER6NfkX5c3OcTN+ccK Hp2IZ6058YAqM31b3A2RyzXBlRR7GVBgAISq2q490oLgKB3zsrbId+zT9Krx7boEfghR JkFxW70vcqh+EvkH5wmeXaHaYCzetxid4wsYB3lD5H9KAv/3SVzh/sJ5WSO8Y1xtGHxQ ItCfcE4bw6HSku5FSdOFirkiTNl5p0xMLqIaGAc12Bxc+Mzi5JxCyJlKWLrmAUrDM1Rs A3twJ9XJNeE1yyjfV99OJs6I/iNCBB+Qa400vu7UTogeJ7fJSeDA7ihE8NTscEV9AYXL eDHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307625; x=1704912425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=80PvfFBt8thHLOeFqpvd019AWlbEdsq+2OkJNyj5GRc=; b=Xea7ugHw7I+fKLtHWy4QxmPaFY9MKMgaBmuAfdC2CYrWVl7HOwE3JzfX1/q6Xd4i9L 11w5x2YGngBJ3l68sDCYHhbnBkDUnKNKzPOHYDJKgU/ZjT8ZUI2mGBiKsG+EDuruV0YV 5hRxkTg3BeNCCmi5zHWWzfhGD+eKAwfmi/eVKgzxXJJU4HYS8AGNJ5n4FoK8m9T3XMwA stG2wNUaXcEVH49ZBuG6t925D8UYIClJQ24Kh1DfgpUgd65hki0ZZczoRk8XVxIlA8v8 mO5PdWvm6auL3DSkBbg/Zk1eJo+qv1KdKQgYRw0XMJcdGwdicQMEMqCoWk7AuCwhFKd0 +MIw== X-Gm-Message-State: AOJu0YyBNcaQH6r7ioSr+iWKa+p1cFR1ZT7/zJkFBEma6JrkIuitIl/8 WRK/T/b8Ifhn4eAtYeXoSmW+w+uHrJFc3w== X-Google-Smtp-Source: AGHT+IEoVjpNf925QAw+Nddj2Q1gGw87YTMv/HyozOcIFR9rh/IsA5xjeZJCkATTbzg14iJgRMAO4Q== X-Received: by 2002:a05:6870:7010:b0:1fa:f81d:2402 with SMTP id u16-20020a056870701000b001faf81d2402mr18766398oae.12.1704307624737; Wed, 03 Jan 2024 10:47:04 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:47:04 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 7/8] auto-t: improve failure handling in testPSK-roam Date: Wed, 3 Jan 2024 10:46:37 -0800 Message-Id: <20240103184638.533221-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This really needs to be done to many more autotests but since this one seems to have random failures ensure that all the tests still run if one fails. In addition add better cleanup for hwsim rules. --- autotests/testPSK-roam/connection_test.py | 25 +++++++++---------- autotests/testPSK-roam/failed_roam_test.py | 3 +++ .../testPSK-roam/roam_ap_disconnect_test.py | 11 +++++--- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py index 8db4e4cb..2dbf1473 100644 --- a/autotests/testPSK-roam/connection_test.py +++ b/autotests/testPSK-roam/connection_test.py @@ -91,13 +91,9 @@ class Test(unittest.TestCase): wd.wait_for_object_condition(device, condition) def test_ft_psk(self): - wd = IWD(True) - - self.validate_connection(wd) + self.validate_connection(self.wd) def test_ft_psk_over_ds(self): - wd = IWD(True) - self.bss_hostapd[0].set_value('ft_over_ds', '1') self.bss_hostapd[0].reload() self.bss_hostapd[0].wait_for_event("AP-ENABLED") @@ -106,11 +102,9 @@ class Test(unittest.TestCase): self.bss_hostapd[1].reload() self.bss_hostapd[1].wait_for_event("AP-ENABLED") - self.validate_connection(wd, over_ds=True) + self.validate_connection(self.wd, over_ds=True) def test_reassociate_psk(self): - wd = IWD(True) - self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK') self.bss_hostapd[0].reload() self.bss_hostapd[0].wait_for_event("AP-ENABLED") @@ -119,12 +113,10 @@ class Test(unittest.TestCase): self.bss_hostapd[1].reload() self.bss_hostapd[1].wait_for_event("AP-ENABLED") - self.validate_connection(wd) + self.validate_connection(self.wd) def test_roam_packet_loss(self): - wd = IWD(True) - - self.validate_connection(wd, pkt_loss=True) + self.validate_connection(self.wd, pkt_loss=True) def tearDown(self): os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') @@ -139,6 +131,12 @@ class Test(unittest.TestCase): for hapd in self.bss_hostapd: hapd.default() + self.wd.stop() + self.wd = None + + def setUp(self): + self.wd = IWD(True) + @classmethod def setUpClass(cls): hwsim = Hwsim() @@ -178,8 +176,9 @@ class Test(unittest.TestCase): def tearDownClass(cls): IWD.clear_storage() cls.bss_hostapd = None - cls.rule0.enabled = False cls.rule0.remove() + cls.rule1.remove() + cls.rule2.remove() if __name__ == '__main__': unittest.main(exit=True) diff --git a/autotests/testPSK-roam/failed_roam_test.py b/autotests/testPSK-roam/failed_roam_test.py index ccdec2c6..12e439f6 100644 --- a/autotests/testPSK-roam/failed_roam_test.py +++ b/autotests/testPSK-roam/failed_roam_test.py @@ -227,6 +227,9 @@ class Test(unittest.TestCase): cls.bss_hostapd = None cls.rule0.remove() cls.rule1.remove() + cls.rule2.remove() + cls.rule3.remove() + cls.assoc_rule.remove() if __name__ == '__main__': unittest.main(exit=True) diff --git a/autotests/testPSK-roam/roam_ap_disconnect_test.py b/autotests/testPSK-roam/roam_ap_disconnect_test.py index b5775990..76c62ea0 100644 --- a/autotests/testPSK-roam/roam_ap_disconnect_test.py +++ b/autotests/testPSK-roam/roam_ap_disconnect_test.py @@ -14,8 +14,7 @@ class Test(unittest.TestCase): # Tests a crash reported where multiple roam scans combined with an AP # disconnect result in a crash getting scan results. # - def validate(self): - wd = IWD(True) + def validate(self, wd): device = wd.list_devices(1)[0] ordered_network = device.get_ordered_network('TestFT', full_scan=True) @@ -43,14 +42,15 @@ class Test(unittest.TestCase): wd.wait_for_object_condition(device, condition) def test_ap_disconnect_no_neighbors(self): - self.validate() + self.validate(self.wd) def test_ap_disconnect_neighbors(self): HostapdCLI.group_neighbors(*self.bss_hostapd) - self.validate() + self.validate(self.wd) def setUp(self): + self.wd = IWD(True) self.bss_hostapd[0].reload() self.bss_hostapd[0].wait_for_event("AP-ENABLED") @@ -63,6 +63,9 @@ class Test(unittest.TestCase): self.bss_hostapd[0].remove_neighbor(self.bss_hostapd[1].bssid) self.bss_hostapd[1].remove_neighbor(self.bss_hostapd[0].bssid) + self.wd.stop() + self.wd = None + @classmethod def setUpClass(cls): hwsim = Hwsim() From patchwork Wed Jan 3 18:46:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13510420 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 461131C6BB for ; Wed, 3 Jan 2024 18:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bz8i/qvA" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-78104f6f692so54493185a.1 for ; Wed, 03 Jan 2024 10:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704307626; x=1704912426; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QCXbcAh1i9ioyJsqIlaGZCwbC6Zh2xpFqHvGLQWTz9Y=; b=Bz8i/qvAsgKNGsDfjOioE4zEyzaUsdei63V/okw0ndYKH2IsNsdQjnsh+ZRgp3l6ql +/R3nz96A6DD3TTYHdqLRiWx+tUG5VSe9HUtY4UygLV1KwBith0IMmRjmoOVKMqdT3/G Uy6yGua1iQTO/0mv007QriEmoJNJ0YdhYJ6Vzou91qFTit4BlcyKIWXDYLyi6YRtxlrb jNsS5teU6sTyOm7Zrle2eQ5F45Kex8xrdkmn5W1c/96XPruRJ1UTL8ng7cS2bJmWIdCI HojZJrsgoy098d8yA8L3VnPXYB78NsqSQ/fKSw9JqaDRTaD3hFqJyJnn/ShlaLS2Dln6 F/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704307626; x=1704912426; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QCXbcAh1i9ioyJsqIlaGZCwbC6Zh2xpFqHvGLQWTz9Y=; b=YtdEx4xmp6t76M0em3WuJSMmdRbs7g5NiCDzeohEIqKYxonxeebPy8+IVZut8EUecR tALSJE4mY7kMtCyljEDTJoxzag1O6Y20+CFQQZ76CB+kw2sTUeJ54zKinX10ADmThQx7 u/mvScQ0aYGz6rnlov/zM+QJUo8ULLzQsdLRHKt6iTrOTWk30E/LJRFRb9Okp8k5J3+z Y/4hA/soWpq+dvvOJzVnOxv24Vac9B9ozHpuldCgr3gOC11uqXIfVYnItZ9mzXFDQXju R5xpi1IIyqr1PVj3YnJoZw0mG319CZXuPmokQLPqmYpWxH/XtNGjsanP53GzeMm+OvZP BRrQ== X-Gm-Message-State: AOJu0YyHt6o/audj8+maAn67Wb7PLzq2PwSKktAZVdMn6Z9lSpgE2Zw+ Xax217IFcO4dDRAKhmmVOeP4ldmavC5t1Q== X-Google-Smtp-Source: AGHT+IGNV07FCS0m98L6/RtNzGcKqQMx4OEk0Oy4+c4vj2iHfd7nM5H/cR2EDGCfqr6ks0yyHaIlhw== X-Received: by 2002:a37:ac13:0:b0:781:5d82:1ec1 with SMTP id e19-20020a37ac13000000b007815d821ec1mr1877279qkm.28.1704307626023; Wed, 03 Jan 2024 10:47:06 -0800 (PST) Received: from LOCLAP699.rst-01.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a22d500b00781a147e444sm3693370qki.92.2024.01.03.10.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:47:05 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 8/8] auto-t: fix random testPSK-roam failure Date: Wed, 3 Jan 2024 10:46:38 -0800 Message-Id: <20240103184638.533221-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103184638.533221-1-prestwoj@gmail.com> References: <20240103184638.533221-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This was caused by the unused hostapd instance running after being re-enabled by mistake. This cause an additional scan result with the same rank to be seen which would then be connected to by luck of the draw. --- autotests/testPSK-roam/connection_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py index 2dbf1473..8d1658a8 100644 --- a/autotests/testPSK-roam/connection_test.py +++ b/autotests/testPSK-roam/connection_test.py @@ -144,9 +144,10 @@ class Test(unittest.TestCase): IWD.copy_to_storage('TestFT.psk') cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), - HostapdCLI(config='ft-psk-ccmp-2.conf'), - HostapdCLI(config='ft-psk-ccmp-3.conf') ] - cls.bss_hostapd[2].disable() + HostapdCLI(config='ft-psk-ccmp-2.conf') ] + + unused = HostapdCLI(config='ft-psk-ccmp-3.conf') + unused.disable() rad0 = hwsim.get_radio('rad0') rad3 = hwsim.get_radio('rad3')