iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes
@ 2023-02-23 18:14 James Prestwood
  2023-02-23 18:14 ` [PATCH 2/2] netdev: check iftype in channel switch event James Prestwood
  2023-02-27 16:25 ` [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: James Prestwood @ 2023-02-23 18:14 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 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,
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] netdev: check iftype in channel switch event
  2023-02-23 18:14 [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes James Prestwood
@ 2023-02-23 18:14 ` James Prestwood
  2023-02-27 16:25 ` [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: James Prestwood @ 2023-02-23 18:14 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

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.");
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes
  2023-02-23 18:14 [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes James Prestwood
  2023-02-23 18:14 ` [PATCH 2/2] netdev: check iftype in channel switch event James Prestwood
@ 2023-02-27 16:25 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2023-02-27 16:25 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 2/23/23 12:14, James Prestwood wrote:
> ---
>   monitor/nlmon.c | 23 +++++++++++++++++++----
>   1 file changed, 19 insertions(+), 4 deletions(-)

Both applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-27 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 18:14 [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes James Prestwood
2023-02-23 18:14 ` [PATCH 2/2] netdev: check iftype in channel switch event James Prestwood
2023-02-27 16:25 ` [PATCH 1/2] monitor: print contents of beacon head/tail, and probe attributes Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).