Ansuel Smith <ansuels...@gmail.com> wrote:
> Some country permit a specific channel to be used only indoor.
> Introduce a new restriction_flags entry to declare different
> restrition of a specific channel.
> 
> Signed-off-by: Ansuel Smith <ansuels...@gmail.com>
> ---
>  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..3543b91 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               (2 << 0)

That's a pretty non-standard way of defining bits? Did you really
mean (1<<0) and (1<<1) ?

Sincerely,
Karl Palsson

> +
>  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.32.0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Attachment: OpenPGP-digital-signature.html
Description: OpenPGP Digital Signature

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

Reply via email to