]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
reg: Fix getting PHY specific regulatory information
authorIlan Peer <ilan.peer@intel.com>
Sun, 19 Jul 2020 07:44:24 +0000 (10:44 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 27 Aug 2020 11:00:39 +0000 (13:00 +0200)
Commit 14ad75d3b4c3 ("iw: support multiple regdom print") added
support for dumping multiple regulatory domain, with the intent
that if a specific phy is given, only its regulatory information
would be fetched. However, the phy specific handling was ignored.
Fix it.

Change-Id: I647ef420741e528a4d6568a7d4518c9a561bd199
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
reg.c

diff --git a/reg.c b/reg.c
index 3dc4b0eec6798b401138269c9379f2ccad515a4d..feb347a61bff471392c313414cd856ca3889c142 100644 (file)
--- a/reg.c
+++ b/reg.c
@@ -244,7 +244,17 @@ static int handle_reg_get(struct nl80211_state *state,
        char *dump_args[] = { "reg", "dump" };
        int err;
 
+       /*
+        * If PHY was specifically given, get the PHY specific regulatory
+        * information. Otherwise, dump the entire regulatory information.
+        */
+       if (id == II_PHY_IDX || id == II_PHY_NAME) {
+               register_handler(print_reg_handler, NULL);
+               return 0;
+       }
+
        err = handle_cmd(state, II_NONE, 2, dump_args);
+
        /*
         * dump might fail since it's not supported on older kernels,
         * in that case the handler is still registered already