nl80211: add support for radiation and indoor chan restriction
authorChristian Marangi <ansuelsmth@gmail.com>
Fri, 21 Jan 2022 00:07:50 +0000 (01:07 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 20 Jan 2023 16:26:57 +0000 (17:26 +0100)
Add new 'flags' bits to declare these two channel restrictions.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
include/iwinfo.h
iwinfo_nl80211.c

index d370e8f8f7526b4e7bedf6ac06ae9f506d89f1f7..d003d2cae519df45f2b3233d763f2f37e5ccdf5d 100644 (file)
@@ -136,6 +136,8 @@ enum iwinfo_freq_flag {
        IWINFO_FREQ_NO_80MHZ,
        IWINFO_FREQ_NO_160MHZ,
        IWINFO_FREQ_NO_HE,
+       IWINFO_FREQ_NO_IR,
+       IWINFO_FREQ_INDOOR_ONLY,
 
        /* keep last */
        IWINFO_FREQ_FLAG_COUNT,
@@ -148,6 +150,8 @@ enum iwinfo_freq_flag {
 #define IWINFO_FREQ_NO_80MHZ       (1 << IWINFO_FREQ_NO_80MHZ)
 #define IWINFO_FREQ_NO_160MHZ      (1 << IWINFO_FREQ_NO_160MHZ)
 #define IWINFO_FREQ_NO_HE          (1 << IWINFO_FREQ_NO_HE)
+#define IWINFO_FREQ_NO_IR          (1 << IWINFO_FREQ_NO_IR)
+#define IWINFO_FREQ_INDOOR_ONLY    (1 << IWINFO_FREQ_INDOOR_ONLY)
 
 
 enum iwinfo_opmode {
index a9e2adf33e3e157e3b831b36e554bf517c212336..630fdbfe8e897c5f3a5c7d957207a6b5eee46308 100644 (file)
@@ -3012,11 +3012,6 @@ 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;
-
                                        if (freqs[NL80211_FREQUENCY_ATTR_NO_HT40_MINUS])
                                                e->flags |= IWINFO_FREQ_NO_HT40MINUS;
                                        if (freqs[NL80211_FREQUENCY_ATTR_NO_HT40_PLUS])
@@ -3031,6 +3026,14 @@ static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg)
                                                e->flags |= IWINFO_FREQ_NO_10MHZ;
                                        if (freqs[NL80211_FREQUENCY_ATTR_NO_HE])
                                                e->flags |= IWINFO_FREQ_NO_HE;
+                                       if (freqs[NL80211_FREQUENCY_ATTR_NO_IR] &&
+                                           !freqs[NL80211_FREQUENCY_ATTR_RADAR])
+                                               e->flags |= IWINFO_FREQ_NO_IR;
+                                       if (freqs[NL80211_FREQUENCY_ATTR_INDOOR_ONLY])
+                                               e->flags |= IWINFO_FREQ_INDOOR_ONLY;
+
+                                       /* keep backwards compatibility */
+                                       e->restricted = (e->flags & IWINFO_FREQ_NO_IR) ? 1 : 0;
 
                                        e++;
                                        arr->count++;