Some countries permit a specific channel to be used only indoors.
Introduce a new restriction_flags entry to declare different restrition
of a specific channel.

Signed-off-by: Ansuel Smith <ansuels...@gmail.com>
---
v2:
- Fix spelling mistake
- Fix wrong define

 include/iwinfo.h |  4 ++++
 iwinfo_nl80211.c | 14 ++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 8469ee7..9832803 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -61,6 +61,9 @@
 #define IWINFO_FREQ_NO_160MHZ          (1 << 5)
 #define IWINFO_FREQ_NO_2160MHZ         (1 << 6)
 
+#define IWINFO_FREQ_NO_IR              (1 << 0)
+#define IWINFO_FREQ_NO_OUTDOOR         (1 << 1)
+
 extern const char *IWINFO_CIPHER_NAMES[IWINFO_CIPHER_COUNT];
 extern const char *IWINFO_KMGMT_NAMES[IWINFO_KMGMT_COUNT];
 extern const char *IWINFO_AUTH_NAMES[IWINFO_AUTH_COUNT];
@@ -168,6 +171,7 @@ struct iwinfo_freqlist_entry {
        uint8_t channel;
        uint32_t mhz;
        uint8_t restricted;
+       uint32_t restricted_flags;
        uint32_t flags;
 };
 
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index c4b0ee2..57f820a 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -2911,10 +2911,16 @@ static int nl80211_get_freqlist_cb(struct nl_msg *msg, 
void *arg)
                                        e->mhz = 
nla_get_u32(freqs[NL80211_FREQUENCY_ATTR_FREQ]);
                                        e->channel = 
nl80211_freq2channel(e->mhz);
 
-                                       e->restricted = (
-                                               
freqs[NL80211_FREQUENCY_ATTR_NO_IR] &&
-                                               
!freqs[NL80211_FREQUENCY_ATTR_RADAR]
-                                       ) ? 1 : 0;
+                                       e->restricted = 
(freqs[NL80211_FREQUENCY_ATTR_NO_IR] &&
+                                                        
!freqs[NL80211_FREQUENCY_ATTR_RADAR]) ||
+                                                        
freqs[NL80211_FREQUENCY_ATTR_INDOOR_ONLY];
+
+                                       if (freqs[NL80211_FREQUENCY_ATTR_NO_IR] 
&&
+                                           
!freqs[NL80211_FREQUENCY_ATTR_RADAR])
+                                               e->restricted_flags |= 
IWINFO_FREQ_NO_IR;
+
+                                       if 
(freqs[NL80211_FREQUENCY_ATTR_INDOOR_ONLY])
+                                               e->restricted_flags |= 
IWINFO_FREQ_NO_OUTDOOR;
 
                                        if 
(freqs[NL80211_FREQUENCY_ATTR_NO_HT40_MINUS])
                                                e->flags |= 
IWINFO_FREQ_NO_HT40MINUS;
-- 
2.33.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to