From patchwork Thu Feb 23 18:14:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13150644 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 013532F2A for ; Thu, 23 Feb 2023 18:14:21 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id z2so14164363plf.12 for ; Thu, 23 Feb 2023 10:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RqQLC+YqVjBTf+SVPVv08aG43iKbqZtKviJGYQ/UurY=; b=iewkOZAt950OIbJtyAQJaSbSYCiDx5SpFp7OcWiLX8Ag1a25ePuGfvVQISKGhnJzhc qYDAEyN0lLAm6JqNJw1MGgJLd6Z1SnNO61ZHs27WJgurfbgwi/xSXmLvwL1QPmtf7rQY 5wmJ8lfTwUbbC7pFUZJp4g8pI5knncJUEkPVoMRc5qQNfjalZU0pmvzk1dFvsGz6bLCO j4LWDi/iq9TGou+J2wlYdN7Z5C+U4QmoLREImJihMCEUQvD0f6Wnz2tC+RoSPPQEBHsZ u9EJLYnsHClz5KGRvV0d/6qJTtfQtFev1tleX/kO5do6703NvMnIFjRguS5zWw0dr1nz uP6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=RqQLC+YqVjBTf+SVPVv08aG43iKbqZtKviJGYQ/UurY=; b=TPIRLxf6pwfwfAPGQXT6yMCgvUg46pp9ZvsEhiLf/0r+Xo2dRVx20C+4aqmRzn1ezY XEoo8Q4TbouwPq7aETa0nA+nwLoipqo9as3TqLVPaoCnMZbZgDpOkz5gB9YD9EX7md7W U4OYFXxdnxL9KvPEnLzLI85eH3NuoxqLCEYnj9RTJo3Mt3kG1yL6VewUnZL1+O9b3uxh Pdl/5Xad3izOguzi/vvXCxYEF/r82CAamEqmUaHOhc2eBHgaehyegYHrlCpG+9TCuSzM irL1DFR+bU6mKMsIVhLcE7jDxTvuaEgrKoWhDMutAD4FMpUomwArSevjUkyxqHzZmfQv cl5g== X-Gm-Message-State: AO0yUKX7wUZv3ztYyD9KkkCFy4TT9a/zK9xoDmtp0gy/qXdS2DHWd5Ia fDRzYAbTEjR6wPiPUtlWmQOCOm2HPj8= X-Google-Smtp-Source: AK7set+9chpf/42mveEF4imqsY1e4t1DNi5eW/VL1QE0l9KxpCsWs96dnuPfqTO3O1GZCgsY+R2pcw== X-Received: by 2002:a05:6a20:50f:b0:cb:7958:7071 with SMTP id 15-20020a056a20050f00b000cb79587071mr7922339pzp.19.1677176061099; Thu, 23 Feb 2023 10:14:21 -0800 (PST) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id x9-20020a63aa49000000b004fc2582aedbsm6070173pgo.17.2023.02.23.10.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 10:14:20 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes Date: Thu, 23 Feb 2023 10:14:16 -0800 Message-Id: <20230223181417.1384624-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- monitor/nlmon.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/monitor/nlmon.c b/monitor/nlmon.c index 25a15154..a7ce2412 100644 --- a/monitor/nlmon.c +++ b/monitor/nlmon.c @@ -5068,6 +5068,16 @@ static void print_probe_response(unsigned int level, (const uint8_t *) mmpdu + len - resp->ies); } +static void print_beacon(unsigned int level, + const struct mmpdu_header *mmpdu, size_t len) +{ + const struct mmpdu_beacon *beacon = mmpdu_body(mmpdu); + + print_attr(level, "Subtype: Beacon"); + print_ie(level + 1, "Beacon IEs", beacon->ies, + (const uint8_t *) mmpdu + len - beacon->ies); +} + static void print_frame_type(unsigned int level, const char *label, const void *data, uint16_t size) { @@ -5122,7 +5132,10 @@ static void print_frame_type(unsigned int level, const char *label, str = "Timing Advertisement"; break; case 0x08: - str = "Beacon"; + if (mpdu) + print_beacon(level + 1, mpdu, size); + else + str = "Beacon"; break; case 0x09: str = "ATIM"; @@ -6240,9 +6253,10 @@ static const struct attr_entry attr_table[] = { { NL80211_ATTR_DTIM_PERIOD, "DTIM Period", ATTR_U32 }, { NL80211_ATTR_BEACON_HEAD, - "Beacon Head", ATTR_BINARY }, + "Beacon Head", ATTR_CUSTOM, { .function = print_frame } }, { NL80211_ATTR_BEACON_TAIL, - "Beacon Tail", ATTR_BINARY }, + "Beacon Tail", ATTR_CUSTOM, + { .function = print_management_ies } }, { NL80211_ATTR_STA_AID, "Station AID", ATTR_U16 }, { NL80211_ATTR_STA_FLAGS, @@ -6520,7 +6534,8 @@ static const struct attr_entry attr_table[] = { { NL80211_ATTR_PROBE_RESP_OFFLOAD, "Probe Response Offload" }, { NL80211_ATTR_PROBE_RESP, - "Probe Response" }, + "Probe Response", ATTR_CUSTOM, + { .function = print_frame} }, { NL80211_ATTR_DFS_REGION, "DFS Region", ATTR_U8 }, { NL80211_ATTR_DISABLE_HT, From patchwork Thu Feb 23 18:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13150645 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 EA9902F55 for ; Thu, 23 Feb 2023 18:14:22 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id k21-20020a17090aaa1500b002376652e160so206851pjq.0 for ; Thu, 23 Feb 2023 10:14:22 -0800 (PST) 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:subject:date :message-id:reply-to; bh=tL1DyDz7YrnBygu8GlhOcxPnFTNvCo3MRzSw3Fl3BvY=; b=mvJLFieqW0O4dOpm3SPHLD3gTS0/jcVhsATn0vtnuvTDF/hdvDL1GeF+jjt/ceoShp FQPUIMuaSMstLs3Nz9p2iNOj/V6HXC8Qbmd76PhgDIs2xHUggudGuw2Sfu55yZvi0yiw v/IynHTbs5KldYwsRm8MEq6VVSTfSkk/HnIgSwhxVVkqq4eVHHH9NqCBRK0Vs4U1pr9w 23h8P70tvPocLxzyO9X5S15yxbET2W7NhawnLsMuWirC5U7KzJb7aN27+eXhfXBibDiP s9W0rfeFATfhstY1xiUC30Evsu4NuDidtbhO2neSeo6lwCkYZxU5pluareW75bw7Nlo4 X4vQ== 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 :subject:date:message-id:reply-to; bh=tL1DyDz7YrnBygu8GlhOcxPnFTNvCo3MRzSw3Fl3BvY=; b=p6Nwb4Ssdvz1tk46dbugMGkyy1M8npJ8oV5nGxvsW9VZH/oUM+6gUUdBguXqhXvI+K yMTdsa9y0KmFieKAyyNaye2uIgu2sZ7rfeLQwQd/o0500YeTtw5UNPauLiJ6w1hfJ3DR uGPjx9GdmHzjdo+EcxIie7ly1w1NlPdw3kG+YkjC+VJ6jKVEjtpyyDr/K880Aq0Swk3K T0cvQqsEt/hv5nUI9iNfNSEXRbdAE6mXbecisE873Lr4bzfRaHuc+RwlhPo04QD3qSx5 S6snsorclx9F4bf5WMWzQjqZOOlwOWfQA6BoWbORwz0Q2T8TS5cvBe226xv3I2a0KWbR +URw== X-Gm-Message-State: AO0yUKVuo29Xhzhc1UCH9yOAi67WjsCF3g0sJJQyUmNsylfyJJD6XOQN zSZnHK0idXBxLJULNh6vegOTYs1WZhY= X-Google-Smtp-Source: AK7set+6Yxnaa+ITFjEr5DQ2rMbo99p5xcxDT+pC8WmORu0YAwZLZ7MiTQKu6fCm0QJ5VrNFVW7zkA== X-Received: by 2002:a05:6a21:3385:b0:c7:684a:e4ae with SMTP id yy5-20020a056a21338500b000c7684ae4aemr15732603pzb.15.1677176062112; Thu, 23 Feb 2023 10:14:22 -0800 (PST) Received: from jprestwo-xps.none ([50.39.160.234]) by smtp.gmail.com with ESMTPSA id x9-20020a63aa49000000b004fc2582aedbsm6070173pgo.17.2023.02.23.10.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 10:14:21 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/2] netdev: check iftype in channel switch event Date: Thu, 23 Feb 2023 10:14:17 -0800 Message-Id: <20230223181417.1384624-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20230223181417.1384624-1-prestwoj@gmail.com> References: <20230223181417.1384624-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some drivers send this event when starting AP mode which means the handshake object is NULL, causing a crash. --- src/netdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 035dbd00..dbfdff1a 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -5145,8 +5145,12 @@ static void netdev_send_sa_query_delay(struct l_timeout *timeout, static void netdev_channel_switch_event(struct l_genl_msg *msg, struct netdev *netdev) { - _auto_(l_free) struct band_chandef *chandef = - l_new(struct band_chandef, 1); + _auto_(l_free) struct band_chandef *chandef = NULL; + + if (netdev->type != NL80211_IFTYPE_STATION) + return; + + chandef = l_new(struct band_chandef, 1); if (nl80211_parse_chandef(msg, chandef) < 0) { l_debug("Couldn't parse operating channel info.");