diff mbox

[v2,2/2] hostapd: Subscribe management frames for WPA_IF_AP_BSS types

Message ID 20120112114952.GA19592@hertz.marvell.com
State Accepted
Commit 3dd1d8906df9defcb84505cbc6cf0b8afa4d1eca
Headers show

Commit Message

Yogesh Ashok Powar Jan. 12, 2012, 11:49 a.m. UTC
In multiple BSSes scenario for the drivers that dont use
monitor interface and does not implement AP_SME, RX MGMT
frame subscription happens only for the default bss (first_bss).

Subscribing for RX MGMT frames for such BSSes.

V2: As suggested by Johannes
    Adding corresponding teardown_ap() call to unsubscribe
    the previously subscribed MGMT RX frames.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
---
 src/drivers/driver_nl80211.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Johannes Berg Jan. 12, 2012, 1:01 p.m. UTC | #1
On Thu, 2012-01-12 at 17:19 +0530, Yogesh Ashok Powar wrote:

>  src/drivers/driver_nl80211.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> index 69e269c..51087ba 100644
> --- a/src/drivers/driver_nl80211.c
> +++ b/src/drivers/driver_nl80211.c
> @@ -7783,6 +7783,10 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
>  		if (drv_priv)
>  			*drv_priv = new_bss;
>  		nl80211_init_bss(new_bss);
> +
> +		/* Subscribe management frames for this WPA_IF_AP_BSS */
> +		if (nl80211_setup_ap(new_bss))
> +			return -1;

Hm, another thing just occurred to me -- will this add another fd to the
monitor interface or something? IOW -- what happens when this runs w/
monitor interfaces.

johannes
Yogesh Ashok Powar Jan. 13, 2012, 5:49 a.m. UTC | #2
On Thu, Jan 12, 2012 at 05:01:02AM -0800, Johannes Berg wrote:
> On Thu, 2012-01-12 at 17:19 +0530, Yogesh Ashok Powar wrote:
> 
> >  src/drivers/driver_nl80211.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> > index 69e269c..51087ba 100644
> > --- a/src/drivers/driver_nl80211.c
> > +++ b/src/drivers/driver_nl80211.c
> > @@ -7783,6 +7783,10 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
> >  		if (drv_priv)
> >  			*drv_priv = new_bss;
> >  		nl80211_init_bss(new_bss);
> > +
> > +		/* Subscribe management frames for this WPA_IF_AP_BSS */
> > +		if (nl80211_setup_ap(new_bss))
> > +			return -1;
> 
> Hm, another thing just occurred to me -- will this add another fd to the
> monitor interface or something? IOW -- what happens when this runs w/
> monitor interfaces.
> 
If driver needs monitor interface, our current fix ends up calling
nl80211_create_monitor_interface for all the BSSes. But this
create_monitor  function will just increase the monitor_refcount and
will not create more than one monitor interface.

Same is true for nl80211_remove_monitor_interface; i.e., monitor
interface will be deleted only when the refcount is 0.
Johannes Berg Jan. 13, 2012, 7:55 a.m. UTC | #3
On Fri, 2012-01-13 at 11:19 +0530, Yogesh Ashok Powar wrote:
> On Thu, Jan 12, 2012 at 05:01:02AM -0800, Johannes Berg wrote:
> > On Thu, 2012-01-12 at 17:19 +0530, Yogesh Ashok Powar wrote:
> > 
> > >  src/drivers/driver_nl80211.c |    6 ++++++
> > >  1 files changed, 6 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> > > index 69e269c..51087ba 100644
> > > --- a/src/drivers/driver_nl80211.c
> > > +++ b/src/drivers/driver_nl80211.c
> > > @@ -7783,6 +7783,10 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
> > >  		if (drv_priv)
> > >  			*drv_priv = new_bss;
> > >  		nl80211_init_bss(new_bss);
> > > +
> > > +		/* Subscribe management frames for this WPA_IF_AP_BSS */
> > > +		if (nl80211_setup_ap(new_bss))
> > > +			return -1;
> > 
> > Hm, another thing just occurred to me -- will this add another fd to the
> > monitor interface or something? IOW -- what happens when this runs w/
> > monitor interfaces.
> > 
> If driver needs monitor interface, our current fix ends up calling
> nl80211_create_monitor_interface for all the BSSes. But this
> create_monitor  function will just increase the monitor_refcount and
> will not create more than one monitor interface.
> 
> Same is true for nl80211_remove_monitor_interface; i.e., monitor
> interface will be deleted only when the refcount is 0.

Yeah, I should've remembered that, thanks for checking!

johannes
Jouni Malinen Jan. 29, 2012, 10:36 a.m. UTC | #4
On Thu, Jan 12, 2012 at 05:19:58PM +0530, Yogesh Ashok Powar wrote:
> In multiple BSSes scenario for the drivers that dont use
> monitor interface and does not implement AP_SME, RX MGMT
> frame subscription happens only for the default bss (first_bss).
> 
> Subscribing for RX MGMT frames for such BSSes.
> 
> V2: As suggested by Johannes
>     Adding corresponding teardown_ap() call to unsubscribe
>     the previously subscribed MGMT RX frames.

Thanks! Applied.
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 69e269c..51087ba 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7783,6 +7783,10 @@  static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
 		if (drv_priv)
 			*drv_priv = new_bss;
 		nl80211_init_bss(new_bss);
+
+		/* Subscribe management frames for this WPA_IF_AP_BSS */
+		if (nl80211_setup_ap(new_bss))
+			return -1;
 	}
 #endif /* HOSTAPD */
 
@@ -7834,6 +7838,8 @@  static int wpa_driver_nl80211_if_remove(void *priv,
 		for (tbss = &drv->first_bss; tbss; tbss = tbss->next) {
 			if (tbss->next == bss) {
 				tbss->next = bss->next;
+				/* Unsubscribe management frames */
+				nl80211_teardown_ap(bss);
 				nl80211_destroy_bss(bss);
 				os_free(bss);
 				bss = NULL;