Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1168063pxk; Fri, 4 Sep 2020 02:24:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0IO78xm5ERDhVRHzidOMEZs2osXAsN0YR4stOvAP/2H4eLFNjYi6SM58/lSJS7lnWgMM5 X-Received: by 2002:a50:fb99:: with SMTP id e25mr7450526edq.281.1599211473789; Fri, 04 Sep 2020 02:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599211473; cv=none; d=google.com; s=arc-20160816; b=kjEgKTO7MrxWPXZIUm4QjYWzAiSEiIhOTj7r9IljZw+cLX8tUvOMFLp5SH0CLdBOip He43kIkV3WjBrIQKelG3EdzI/M5pwPq/Q2eQJFgHB/qJwAeVecilOtc+u8xfGNMLsVSo gboqHhAynWqd5RNRmGt7UeFJP3w02e8aDCAPjxSaLbWZUXAuxGPbrBxafH4kfStsBnr5 ++aI46uXONwSg1zBfOfUG6KQjvTTuzDghH9/MO9p9du5Oe3srU8aSaj9b8dWDbDWObdQ ybpn0CYdTiheHLq+PVQNL/uUwCYr7qmDdu/jsmrmgdpA2PwjcnJItGNLHAPza53vAUvJ hNFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6X/ay7By9Y8G7/zJFU5j3GsVs2coEQ+oUHAl8i2bCQE=; b=Zkrnuh2rUyFgSIFcPt5c+5Gz6/9imWZJH8CqCyhVuyqkH1eNwkfrTMyIWIsVRQW0iA QnnjCsanFbQdfH4qJcSg5qHLmmzkRPidegGJBn2LtoXpBjqbK51OMk3sPmATp9SHFgyV LIyjWUEzZdBXDZy5Cr/Q95K8h/aAPlEVUz5ITIvSOhBhUbkjUhPr+1w3f4K5+7w81CVJ 90cwO4e1jdZcQeOmjsUn7Kbdn2XtScPaWsy+6k4CPXuUT7lvkd8KC8x2DwuUKIj6PoGP fAyZeSmR5ywY/gYvt01tC/WlZU9Ex2MLIap5xW/LB68nHthBiAAtTRG+AI0fKe4AtYZu b6KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si3689881ejk.32.2020.09.04.02.23.57; Fri, 04 Sep 2020 02:24:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729959AbgIDJVA (ORCPT + 99 others); Fri, 4 Sep 2020 05:21:00 -0400 Received: from sitav-80046.hsr.ch ([152.96.80.46]:40582 "EHLO mail.strongswan.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728205AbgIDJVA (ORCPT ); Fri, 4 Sep 2020 05:21:00 -0400 X-Greylist: delayed 494 seconds by postgrey-1.27 at vger.kernel.org; Fri, 04 Sep 2020 05:20:59 EDT Received: from think.wlp.is (unknown [185.12.128.225]) by mail.strongswan.org (Postfix) with ESMTPSA id D9ED74011D; Fri, 4 Sep 2020 11:12:42 +0200 (CEST) From: Martin Willi To: Johannes Berg Cc: linux-wireless@vger.kernel.org Subject: [PATCH] nl80211: Include supported RX/TX frames in split phy dumps only Date: Fri, 4 Sep 2020 11:12:35 +0200 Message-Id: <20200904091235.11342-1-martin@strongswan.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.25.1