From patchwork Tue Aug 9 23:04:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12940048 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 571664A0C for ; Tue, 9 Aug 2022 23:04:42 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id t22so13113844pjy.1 for ; Tue, 09 Aug 2022 16:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=w5duT/nPJGlFO14/looRu87ErZukYHkxP7tNj0kPUaA=; b=mUJy0Gak4pM9kEs3OUISLmHofoSuBUH9bCQwwOw5/Xk6Oj6VSfRykocoZlSHqBvJao +xgOugivD2XauxcR+JE/FY01RW5u3HhwG66BwR82XCq0dBXClsiAA/3Vg0ctnAUHGefr sxPqBdRNv47eCCduDYLup3tYbDWEWRdH6/3fT9MyuLanmtsv1CCoxyHJeIjd2BnkKgu5 5+qoPfzJnji0gaIgXXqXvCO7ndWyjjC5kwsrYeVQDqFE8iYhdl8DSopH1x5FTMSvBiJE 3E5Vc25tDFOTpCo8NluIr1ar3kQEO6y0PkaCsyDHTbAWF0iSsNl0kQ2irUkhReO5ZBWn qJjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=w5duT/nPJGlFO14/looRu87ErZukYHkxP7tNj0kPUaA=; b=cSh+OSksHKTDl27A8YCdEQirNqxFFVZn/w280U/TWUcEAYXfHyibBNbvunkHSpdat1 xOFAw8Du/LMS53LpTSM/zrlfIPeNC8o4DEQ7kp9h9hEssbVhn14bim6ZzJdtaMMRXwZW Xops7jhF07+fd4Tu3aTdfAJsTK1vDcI81uDwbxar55WWqMfalqUGc48FwAADmLTlIpry lKuXtT8l2V+qdB08a/1oxNjKdNQEccjZDeanH/VRRJWwsiBehRHJ5d4q2VhFpITW6KWa Y7Dv5C0oq0aFreV4/vPcds+RS/Gg3fiAiftpEzZAGA9pao1PMEEuTyWCTPw5v+zBdT9b BV7g== X-Gm-Message-State: ACgBeo2BT92N4kAdd5cx6OwNUifBmzhY2L6DCfQmtVXXsd3q2AGTUqyk WYXNjGAxozG7/cpkn+jtfNWVIkk7Kas= X-Google-Smtp-Source: AA6agR5kqGd79/wBLb0tpP+ZQcIU5GliYgpRq8ylnYkdktTejA0smWVF1NcEqH6524iJquRQ07HpRg== X-Received: by 2002:a17:902:8c92:b0:170:aff6:e3a6 with SMTP id t18-20020a1709028c9200b00170aff6e3a6mr10472136plo.164.1660086281617; Tue, 09 Aug 2022 16:04:41 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.168.145]) by smtp.gmail.com with ESMTPSA id w13-20020a62820d000000b0052d748498edsm459063pfd.13.2022.08.09.16.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 16:04:41 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood , mjohnson459@gmail.com Subject: [RFC 1/4] station: react to (new) netdev packet loss event Date: Tue, 9 Aug 2022 16:04:25 -0700 Message-Id: <20220809230428.215970-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220809230428.215970-1-prestwoj@gmail.com> References: <20220809230428.215970-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds a new netdev event for packet loss notifications from the kernel. Depending on the scenario a station may see packet loss events without any other indications like low RSSI. In these cases IWD should still roam since there is no data flowing. --- src/netdev.h | 1 + src/station.c | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/netdev.h b/src/netdev.h index f093c499..d13bc5e6 100644 --- a/src/netdev.h +++ b/src/netdev.h @@ -49,6 +49,7 @@ enum netdev_event { NETDEV_EVENT_RSSI_THRESHOLD_LOW, NETDEV_EVENT_RSSI_THRESHOLD_HIGH, NETDEV_EVENT_RSSI_LEVEL_NOTIFY, + NETDEV_EVENT_PACKET_LOSS_NOTIFY, }; enum netdev_watch_event { diff --git a/src/station.c b/src/station.c index b9038431..458c6ee2 100644 --- a/src/station.c +++ b/src/station.c @@ -2535,15 +2535,10 @@ static void station_neighbor_report_cb(struct netdev *netdev, int err, station_roam_failed(station); } -static void station_roam_trigger_cb(struct l_timeout *timeout, void *user_data) +static void station_start_roam(struct station *station) { - struct station *station = user_data; int r; - l_debug("%u", netdev_get_ifindex(station->netdev)); - - l_timeout_remove(station->roam_trigger_timeout); - station->roam_trigger_timeout = NULL; station->preparing_roam = true; /* @@ -2577,6 +2572,18 @@ static void station_roam_trigger_cb(struct l_timeout *timeout, void *user_data) station_roam_failed(station); } +static void station_roam_trigger_cb(struct l_timeout *timeout, void *user_data) +{ + struct station *station = user_data; + + l_debug("%u", netdev_get_ifindex(station->netdev)); + + l_timeout_remove(station->roam_trigger_timeout); + station->roam_trigger_timeout = NULL; + + station_start_roam(station); +} + static void station_roam_timeout_rearm(struct station *station, int seconds) { struct timespec now, min_timeout; @@ -3057,6 +3064,23 @@ static void station_disconnect_event(struct station *station, void *event_data) l_warn("Unexpected disconnect event"); } +#define STATION_PKT_LOSS_THRESHOLD 10 + +static void station_packets_lost(struct station *station, uint32_t num_pkts) +{ + l_debug("Packets lost event: %u", num_pkts); + + if (num_pkts < STATION_PKT_LOSS_THRESHOLD) + return; + + if (station_cannot_roam(station)) + return; + + station_debug_event(station, "packet-loss-roam"); + + station_start_roam(station); +} + static void station_netdev_event(struct netdev *netdev, enum netdev_event event, void *event_data, void *user_data) { @@ -3092,6 +3116,9 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event, case NETDEV_EVENT_CHANNEL_SWITCHED: station_event_channel_switched(station, l_get_u32(event_data)); break; + case NETDEV_EVENT_PACKET_LOSS_NOTIFY: + station_packets_lost(station, l_get_u32(event_data)); + break; } } From patchwork Tue Aug 9 23:04:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12940050 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 E3F024A10 for ; Tue, 9 Aug 2022 23:04:42 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id q9-20020a17090a2dc900b001f58bcaca95so395552pjm.3 for ; Tue, 09 Aug 2022 16:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=u30MDtW1UtsxmMMVo6xoX3AqgyeaBZ6h5XaWhS9Xljo=; b=FGBcFvSrdCuuymYDZ8la5BhO5j6z2QTSrNlbCmEMsUG+iITopXg6A8bNN2K8a2THlG 8PYGMBZ2Ts8TAurIBS6leBMvlFsyT485QE5YDR8Km1FPyf0rHItmwTUy3zxDYeM+8ocI eEHkFAhtaE0enCtq3oTrM0feKg/tojBVDVxpeS0pCdD0ebw6vs6LSXP2lLZ2Xj7bjJsw eTNXdVT1CsYdHmmq+E8qg+Dma2PTU/CzvMf9urblNUBcmh982omIgPOIt719gtwQWiyP Sa1WQfOvBEW99sJ4hyi9hWcQAIPwBxShFlzkUt/XEn49FqfeWJrJuMfU1ImZLoGWhU3x 5vNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=u30MDtW1UtsxmMMVo6xoX3AqgyeaBZ6h5XaWhS9Xljo=; b=lN02ZPihfeYklfx6sYqCrvabcvVOkJOvLX1m5UWjnj3ti0JJb6f2WdCdSC7oXhQ4lM NmmyZNR0I3DwveqjgqL5VM1Z1NXwrcmKMQC13yiFR5jNwhmZp73c+ES4zWCRZ7PeExgh ADx1gjiK4rSZ0NFm3LqwLXNrikAIWXrY7+dliKGOStELDE1CvL4XdiWJ+U7b6dVpoBvh o4yUwbcFOWNF79MvOA/e36KfFzdneovBzP4hCNp7swLfvg3h+rDZ488Vp3PWnZOsMs2k XEIy+ZnXvDDjr9/dSq/bG4niCrM27cRcIN5phfJmL9t0YAmxBJM9gNoZc+HCik/KH0da su9w== X-Gm-Message-State: ACgBeo1kib9eUdyn6b/MDUUll617uchyuiaY3r/YQ4fxrR0uhny9+bLj qvV21IGBzkFD1GAva8mGwk1GP0gnwbY= X-Google-Smtp-Source: AA6agR65PvWex1TJk0pFA8waiwVLYbpgeqdkvSf0NY2bvqfQSbHo3dXDJMBD2JPbalToizESihghAQ== X-Received: by 2002:a17:902:dacb:b0:16f:6d84:b6ca with SMTP id q11-20020a170902dacb00b0016f6d84b6camr24536382plx.19.1660086282206; Tue, 09 Aug 2022 16:04:42 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.168.145]) by smtp.gmail.com with ESMTPSA id w13-20020a62820d000000b0052d748498edsm459063pfd.13.2022.08.09.16.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 16:04:41 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood , mjohnson459@gmail.com Subject: [RFC 2/4] netdev: handle packet loss notification Date: Tue, 9 Aug 2022 16:04:26 -0700 Message-Id: <20220809230428.215970-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220809230428.215970-1-prestwoj@gmail.com> References: <20220809230428.215970-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This attribute was already handled and simply printed. Now a netdev event will be sent to notify any listeners. --- src/netdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 47e076e2..0d48631c 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -1073,6 +1073,7 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev) const void *data; uint32_t *rssi_event = NULL; int32_t *rssi_val = NULL; + uint32_t *pkt_event = NULL; if (!l_genl_attr_init(&attr, msg)) return; @@ -1096,8 +1097,7 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev) if (len != 4) continue; - l_debug("Packets lost event: %d", - *(uint32_t *) data); + pkt_event = (uint32_t *) data; break; case NL80211_ATTR_CQM_BEACON_LOSS_EVENT: @@ -1128,7 +1128,9 @@ static void netdev_cqm_event(struct l_genl_msg *msg, struct netdev *netdev) l_debug("Signal change event (above=%d)", *rssi_event); netdev_cqm_event_rssi_threshold(netdev, *rssi_event); } - } + } else if (pkt_event && netdev->event_filter) + netdev->event_filter(netdev, NETDEV_EVENT_PACKET_LOSS_NOTIFY, + pkt_event, netdev->user_data); } static void netdev_rekey_offload_event(struct l_genl_msg *msg, From patchwork Tue Aug 9 23:04:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12940051 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.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 78F054A1D for ; Tue, 9 Aug 2022 23:04:43 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id 130so12078704pfv.13 for ; Tue, 09 Aug 2022 16:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ZS+9KtQWxdCUZrmdPm4dxJLH4O/1o6nTgSbJ2anXDdk=; b=ApBgBdgwukvEtqiBRnmsQkRr3sH1wUtw0vbLrfeUz5BvPlegYAwZzIbVEz6bTZDrge EQ4R28hzWtsPdMciiN4ylHE4cApNLUW9OUoS9rg7GFdCSOWe+aGiB6PtTUkoF4p4Xsds 5KzDXxp2fqczxjwjTxwS+lFZf+Ieana60ZhOqiTIUamGWauAIIF9m5vmhBptfJCd8+JU lYOVoL5C0mtjnQSjGk2Nd5QpgQvBN7ohuRkZlmyJVa1PR2MEh6XirvUFHpYHYtPSdiUp gZqwDrbItXtYH9vGgLgKngWNUgjfd7ELxQieQjhjpnQRbFQ+MGDR+dyGjdqQdPy8y71C z51g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ZS+9KtQWxdCUZrmdPm4dxJLH4O/1o6nTgSbJ2anXDdk=; b=Eta1czmhjbhjUR71k2NvYpASbhqZIBPfZqceqoNMn5xSYaeJyY6ynFP7OeQBW/6l5w /wFmeptdv8+N02yAdl97qhKWTKXWzd1u/9Cn6FIC0In7BNuJFmzCeNanRiME3broLLDJ l7cQILLOXqHKgVd0WxKm+LuDh2gT+dNX8TPyz5/Xc0mnYOtB4OkjWTdhFSooNTWUaETx rkP83q57fO+HhDYym6BQnbMEJaZjxZDN4+M/9ecd207c7J4UAYDeg2VMJEPVmhy8cpvF VT6+TBw9K2PAspqXo7VX969gNB1b6Q4x65lQNvksU4pt7P+5krYzxUWyAH0M9VbPNfn3 yRZg== X-Gm-Message-State: ACgBeo2SMndo/tgWe7EI9ShB7guX8OaXqIhbSZnexULqBW32P1Yku1ig SQMv+umnVv4LFAw+YPI5xT3RaBvyqco= X-Google-Smtp-Source: AA6agR6KeCb4LNscrsPxGvU5e+xZ3jfz7xAYJ85djK4jwF+p+Q8djoPnbwh61dPUS1s7bzk1NIztVQ== X-Received: by 2002:a05:6a00:4306:b0:52e:3bdc:2635 with SMTP id cb6-20020a056a00430600b0052e3bdc2635mr24647870pfb.79.1660086282774; Tue, 09 Aug 2022 16:04:42 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.168.145]) by smtp.gmail.com with ESMTPSA id w13-20020a62820d000000b0052d748498edsm459063pfd.13.2022.08.09.16.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 16:04:42 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood , mjohnson459@gmail.com Subject: [RFC 3/4] auto-t: add generic tx_packet function Date: Tue, 9 Aug 2022 16:04:27 -0700 Message-Id: <20220809230428.215970-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220809230428.215970-1-prestwoj@gmail.com> References: <20220809230428.215970-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This sends data over the raw sockets similar to test_ifaces_connected --- autotests/util/testutil.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autotests/util/testutil.py b/autotests/util/testutil.py index eae4dd89..37de49a2 100644 --- a/autotests/util/testutil.py +++ b/autotests/util/testutil.py @@ -53,6 +53,13 @@ def tx(fromsock, tosock, src, dst): return (frame, fromsock, tosock, src, dst) +def tx_packets(if0, if1, num): + sock0, addr0 = raw_if_socket(if0) + sock1, addr1 = raw_if_socket(if1) + + for i in range(num): + tx(sock0, sock1, addr0, addr1) + def test_connected(if0=None, if1=None, group=True, expect_fail=False): if expect_fail: timeout = 0 From patchwork Tue Aug 9 23:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12940052 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 37D4546A6 for ; Tue, 9 Aug 2022 23:04:44 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id o3-20020a17090a0a0300b001f7649cd317so443863pjo.0 for ; Tue, 09 Aug 2022 16:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=RdJ1dDIHJDjz5RHNjANj7VhqJxpB/ypC6aa8Xd9xbtI=; b=T6Cas1Vb9Zy2feF+NonqZhqfC6hkq1YPQrlFl/4TbqYkMsAq17e9v5DAAaVe13P0Oy HZhWxzffO1eFFvgHE1pvDSvISclhkiaWiBUusrsRSMfdWyePhQjqcBilrXGhJhPHgTgP Spq56DiktuAoVIz3zdkZr0Oe4LjqSW/OevxbtcblKKIioXFeZxzry6VpPmrZ3aILpcEt s4z26E5Wgtyg2EZNj79b2WS0HNDhWlD4i7MXl2AHKxIBD2RCMWnrmlAJrB8VPdgGZqfR 8rZYS4Wsp3VqBUGQwVZFTJTbxx7Xf4EeqLGTk73kbJCiBdfgn0X3pL+lWS2Zalz3q6LP eF4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=RdJ1dDIHJDjz5RHNjANj7VhqJxpB/ypC6aa8Xd9xbtI=; b=pgUA7Atd0appzyANzCNoxRuWtpleuJwirdgkBtYefcQc9q5t9hyTXOlsfyIYcsJZAs abDp4L8ProfGnUM0TstSTCi8mF+8xHcO8CY1LiiUnA+NMzbFPwj+rbKm/KBZ53S7PqSp lpP/WfpRPrqAnmWT095bIQyQWVqfXYvGbHbCTs0Nw1UVa7ndQJyLTsvA6+jgTwIejLjQ fmP2Aa5XzlhT+V0nYvop2fdGwTtHI+0GdL7slroP0dH4lx71v9iSVfBLJHyVfDXmMIVn 6kijYYZoDzaaHvUnML5jHcIalVSdE6Ok2AwQldWFOACkXevRCxzgPu0bxgYohWjQ4DgF uM1A== X-Gm-Message-State: ACgBeo1mKLlafMrxxegXtRY1QKq6bp4fz1yU8bgJUg6bG3KjV1zYW51q HDcV/yesw80jSQpoxOtYc0SZpppELJk= X-Google-Smtp-Source: AA6agR5vFZDdNEvCvTghEWzj/+sho9QP3/YFZJR7J/sxnS52rxSvP8bIz7QuCv1OU9CXym3O/OXvbg== X-Received: by 2002:a17:902:f608:b0:16d:c44:137 with SMTP id n8-20020a170902f60800b0016d0c440137mr25563045plg.173.1660086283494; Tue, 09 Aug 2022 16:04:43 -0700 (PDT) Received: from jprestwo-xps.none ([50.39.168.145]) by smtp.gmail.com with ESMTPSA id w13-20020a62820d000000b0052d748498edsm459063pfd.13.2022.08.09.16.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 16:04:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood , mjohnson459@gmail.com Subject: [RFC 4/4] auto-t: add packet loss test to testPSK-roam Date: Tue, 9 Aug 2022 16:04:28 -0700 Message-Id: <20220809230428.215970-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220809230428.215970-1-prestwoj@gmail.com> References: <20220809230428.215970-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A new test which blocks all data frames once connected, then tries to send 100 packets. This should result in the kernel sending a packet loss event to userspace, which IWD should react to and roam. --- autotests/testPSK-roam/connection_test.py | 46 ++++++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py index f1b43130..c926e255 100644 --- a/autotests/testPSK-roam/connection_test.py +++ b/autotests/testPSK-roam/connection_test.py @@ -13,7 +13,7 @@ from hostapd import HostapdCLI import testutil class Test(unittest.TestCase): - def validate_connection(self, wd, over_ds=False): + def validate_connection(self, wd, over_ds=False, pkt_loss=False): device = wd.list_devices(1)[0] ordered_network = device.get_ordered_network('TestFT', full_scan=True) @@ -41,11 +41,24 @@ class Test(unittest.TestCase): if over_ds: self.rule0.enabled = True - device.roam(self.bss_hostapd[1].bssid) + if pkt_loss: + # Drop all data frames + self.rule1.enabled = True + # Set the current BSS signal lower so we have roam candidates + self.rule2.enabled = True + # Send 100 packets (to be dropped), should trigger beacon loss + testutil.tx_packets(device.name, self.bss_hostapd[0].ifname, 100) + device.wait_for_event('packet-loss-roam', timeout=30) + else: + device.roam(self.bss_hostapd[1].bssid) condition = 'obj.state == DeviceState.roaming' wd.wait_for_object_condition(device, condition) + if pkt_loss: + self.rule1.enabled = False + self.rule2.enabled = False + # Check that iwd is on BSS 1 once out of roaming state and doesn't # go through 'disconnected', 'autoconnect', 'connecting' in between from_condition = 'obj.state == DeviceState.roaming' @@ -132,6 +145,23 @@ class Test(unittest.TestCase): self.validate_connection(wd) + def test_roam_packet_loss(self): + wd = IWD(True) + + self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK') + self.bss_hostapd[0].set_value('ft_over_ds', '0') + self.bss_hostapd[0].set_value('ocv', '1') + self.bss_hostapd[0].reload() + self.bss_hostapd[0].wait_for_event("AP-ENABLED") + + self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK') + self.bss_hostapd[1].set_value('ft_over_ds', '0') + self.bss_hostapd[0].set_value('ocv', '1') + self.bss_hostapd[1].reload() + self.bss_hostapd[1].wait_for_event("AP-ENABLED") + + self.validate_connection(wd, pkt_loss=True) + 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') @@ -139,6 +169,8 @@ class Test(unittest.TestCase): os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') self.rule0.enabled = False + self.rule1.enabled = False + self.rule2.enabled = False @classmethod def setUpClass(cls): @@ -148,6 +180,7 @@ class Test(unittest.TestCase): cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), HostapdCLI(config='ft-psk-ccmp-2.conf') ] + rad0 = hwsim.get_radio('rad0') rad2 = hwsim.get_radio('rad2') cls.rule0 = hwsim.rules.create() @@ -157,6 +190,15 @@ class Test(unittest.TestCase): cls.rule0.prefix = 'b0' cls.rule0.drop = True + cls.rule1 = hwsim.rules.create() + cls.rule1.source = rad2.addresses[0] + cls.rule1.prefix = '08' + cls.rule1.drop = True + + cls.rule2 = hwsim.rules.create() + cls.rule2.source = rad0.addresses[0] + cls.rule2.signal = -4000 + # Set interface addresses to those expected by hostapd config files os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up')