diff mbox series

[iwinfo,1/2] iwinfo: add support for indoor only chan restriction

Message ID 20211118164004.25803-1-ansuelsmth@gmail.com
State Superseded
Headers show
Series [iwinfo,1/2] iwinfo: add support for indoor only chan restriction | expand

Commit Message

Christian Marangi Nov. 18, 2021, 4:40 p.m. UTC
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 <ansuelsmth@gmail.com>
---
 include/iwinfo.h |  4 ++++
 iwinfo_nl80211.c | 14 ++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

Comments

Karl Palsson Nov. 18, 2021, 5:10 p.m. UTC | #1
Ansuel Smith <ansuelsmth@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 <ansuelsmth@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
Christian Marangi Nov. 18, 2021, 5:12 p.m. UTC | #2
>
>
> Ansuel Smith <ansuelsmth@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 <ansuelsmth@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) ?
>

Yes sorry... Copy paste error and then a microstroke in my brain LOL.
Will fix in v2 with other changes if needed.

> 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
Martin Blumenstingl Nov. 19, 2021, 10:56 p.m. UTC | #3
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
Hi Ansuel,

below are a few comments from someone (me) who is not very familiar
with the whole topic. So please keep this in mind.

On Thu, Nov 18, 2021 at 5:42 PM Ansuel Smith <ansuelsmth@gmail.com> wrote:
>
> Some country permit a specific channel to be used only indoor.
country -> countries
indoor -> indoors

> Introduce a new restriction_flags entry to declare different restrition
restrition -> restrictions

[...]
> +                                       if (freqs[NL80211_FREQUENCY_ATTR_INDOOR_ONLY])
> +                                               e->restricted_flags |= IWINFO_FREQ_NO_OUTDOOR;
Is there a reason why _INDOOR_ONLY has to be translated to _NO_OUTDOOR?
Or in other words: why not simply IWINFO_FREQ_INDOOR_ONLY


Best regards,
Martin
Christian Marangi Nov. 20, 2021, 10:54 p.m. UTC | #4
>
> Hi Ansuel,
>
> below are a few comments from someone (me) who is not very familiar
> with the whole topic. So please keep this in mind.
>
> On Thu, Nov 18, 2021 at 5:42 PM Ansuel Smith <ansuelsmth@gmail.com> wrote:
> >
> > Some country permit a specific channel to be used only indoor.
> country -> countries
> indoor -> indoors
>
> > Introduce a new restriction_flags entry to declare different restrition
> restrition -> restrictions
>
> [...]
> > +                                       if (freqs[NL80211_FREQUENCY_ATTR_INDOOR_ONLY])
> > +                                               e->restricted_flags |= IWINFO_FREQ_NO_OUTDOOR;
> Is there a reason why _INDOOR_ONLY has to be translated to _NO_OUTDOOR?
> Or in other words: why not simply IWINFO_FREQ_INDOOR_ONLY
>

It seems more descriptive to declare and i think in a normal freq list it
is declared as no outdoor instead of indoor only.

>
> Best regards,
> Martin
Seo Suchan Jan. 24, 2022, 3:06 a.m. UTC | #5
Which will get priority in DFS or indoor channels? will it have setting 
to enable DFS for such channel? well we can't really enforce 
'indoorness' of out target, isn't it? Or will we have per device target 
config for 'this will be outdoor' ?

21. 11. 19. 01:40에 Ansuel Smith 이(가) 쓴 글:
> 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 <ansuelsmth@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)
> +
>   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;
diff mbox series

Patch

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)
+
 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;