All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, Brian Norris <briannorris@chromium.org>
Subject: [PATCH] iw: 'phy <name> reg get' shouldn't dump all domains
Date: Tue, 31 Mar 2020 16:28:33 -0700	[thread overview]
Message-ID: <20200331232833.142026-1-briannorris@chromium.org> (raw)

Right now, 'iw phy ... reg get' gets translated to NLM_F_DUMP, which
dumps all domains. But this command really is looking for non-DUMP
semantics -- it only wants the domain for the specified wiphy, or (per
the kernel's choice) the global, if the wiphy doesn't have its own.

We can achieve this by skipping the handle_reg_get() -> "reg dump"
indirection.

[ with a wiphy-specific domain ]
Before:
  # iw phy phy0 reg get
  global
  country XX: DFS-YYY
  [...]
  phy#0
  country AA: DFS-BBB
  [...]

After:
  # iw phy phy0 reg get
  phy#0
  country AA: DFS-BBB
  [...]

[ without a wiphy-specific domain ]
Before and after (unchanged):
  # iw phy phy0 reg get
  global
  country XX: DFS-YYY
  [...]

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/reg.c b/reg.c
index db1b12906519..3dc4b0eec679 100644
--- a/reg.c
+++ b/reg.c
@@ -256,7 +256,7 @@ static int handle_reg_get(struct nl80211_state *state,
 }
 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_NONE, handle_reg_get,
 	"Print out the kernel's current regulatory domain information.");
-COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_get,
+COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_dump,
 	"Print out the devices' current regulatory domain information.");
 HIDDEN(reg, dump, NULL, NL80211_CMD_GET_REG, NLM_F_DUMP, CIB_NONE,
        handle_reg_dump);
-- 
2.26.0.rc2.310.g2932bb562d-goog


                 reply	other threads:[~2020-03-31 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200331232833.142026-1-briannorris@chromium.org \
    --to=briannorris@chromium.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.