diff mbox series

nl80211: Include supported RX/TX frames in split phy dumps only

Message ID 20200904091235.11342-1-martin@strongswan.org (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series nl80211: Include supported RX/TX frames in split phy dumps only | expand

Commit Message

Martin Willi Sept. 4, 2020, 9:12 a.m. UTC
With the recent additions of new features, non-split phy dumps exceed the
maximum Netlink size of 4096 bytes. Depending on their feature set, not all
radios are affected, but for example hwsim is.

While userspace dumping phys can request a split dump as a work around,
legacy tools without split support may get oversized dumps. Much more
problematic are phy new/del notifications, which are always limited to
a page size: Generating these messages fails, and Netlink notifications
are silently dropped. This breaks userspace relying on these events.

There is no single commit that broke these events, as their size highly
depends on the phy feature set. Finding attributes to strip is challenging:
The largest attributes are the frequency lists, but they are already
reduced to the minimum and have rather useful information. HE information
probably could be stripped, but the saving is about 200 bytes, not enough
to fix dumps for many cases. The next larger attributes are usually the
RX/TX frame attributes. Removing these attributes can reduce a hwsim phy
dump from 4576 to 3288 bytes, and it seems to be the most reasonable
approach.

This fixes Netlink phy notifications, but obviously removes supported
RX/TX frames from these events and non-split phy dumps. Userspace is
required to use split dumps to receive supported RX/TX frame information.

Signed-off-by: Martin Willi <martin@strongswan.org>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Berg Sept. 28, 2020, 11:03 a.m. UTC | #1
Hi Martin,

> With the recent additions of new features, non-split phy dumps exceed the
> maximum Netlink size of 4096 bytes. Depending on their feature set, not all
> radios are affected, but for example hwsim is.

Hmm, ok. I wonder which features in particular?

> While userspace dumping phys can request a split dump as a work around,
> legacy tools without split support may get oversized dumps. Much more
> problematic are phy new/del notifications, which are always limited to
> a page size: Generating these messages fails, and Netlink notifications
> are silently dropped. This breaks userspace relying on these events.

Right, not good.

> There is no single commit that broke these events, as their size highly
> depends on the phy feature set. Finding attributes to strip is challenging:
> The largest attributes are the frequency lists, but they are already
> reduced to the minimum and have rather useful information.

Right.

>  HE information
> probably could be stripped,

Right, bad. We should strip that entire stuff.

> but the saving is about 200 bytes, not enough
> to fix dumps for many cases. 

:(

> The next larger attributes are usually the
> RX/TX frame attributes. Removing these attributes can reduce a hwsim phy
> dump from 4576 to 3288 bytes, and it seems to be the most reasonable
> approach.

Well the problem with that approach is that it kinda results in a
different regression because the RX/TX stuff *was* present before split
wiphys were even introduced.

OTOH, I just checked, and back then wpa_supplicant wasn't using that
information, so it seems fair game to remove.

I've ended up with a patch that's a bit different - I'll post it in a
minute.

johannes
diff mbox series

Patch

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 201d029687cc..9362fa407933 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2304,7 +2304,7 @@  static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		    nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK))
 			goto nla_put_failure;
 
-		if (nl80211_send_mgmt_stypes(msg, mgmt_stypes))
+		if (state->split && nl80211_send_mgmt_stypes(msg, mgmt_stypes))
 			goto nla_put_failure;
 		state->split_start++;
 		if (state->split)