From: Brian Norris Date: Tue, 31 Mar 2020 23:28:33 +0000 (-0700) Subject: iw: 'phy reg get' shouldn't dump all domains X-Git-Tag: v5.8~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83689ee22f992cea4477c1c372b79e4daac3f1a5;p=thirdparty%2Fiw.git iw: 'phy reg get' shouldn't dump all domains 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 Link: https://lore.kernel.org/r/20200331232833.142026-1-briannorris@chromium.org Signed-off-by: Johannes Berg --- diff --git a/reg.c b/reg.c index db1b129..3dc4b0e 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);