2009-08-05 02:04:13

by Zhu Yi

[permalink] [raw]
Subject: [PATCH] wireless: display wext SSID when connected by cfg80211

cfg80211 displays correct link info when connected by wext. But if
the connection is setup by cfg80211, wext cannot display the SSID.
This patch fixed this issue.

Signed-off-by: Zhu Yi <[email protected]>
---
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 7bacbd1..48c165b 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -210,6 +210,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
data->flags = 1;
data->length = wdev->wext.connect.ssid_len;
memcpy(ssid, wdev->wext.connect.ssid, data->length);
+ } else if (wdev->ssid && wdev->ssid_len) {
+ data->flags = 1;
+ data->length = wdev->ssid_len;
+ memcpy(ssid, wdev->ssid, data->length);
} else
data->flags = 0;
wdev_unlock(wdev);


2009-08-05 05:39:03

by Zhu Yi

[permalink] [raw]
Subject: Re: [PATCH] wireless: display wext SSID when connected by cfg80211

On Wed, 2009-08-05 at 13:35 +0800, Johannes Berg wrote:
> On Wed, 2009-08-05 at 13:27 +0800, Zhu Yi wrote:
>
> > Yeah, I'm lazy to parse the current_bss.pub->information_elements for
> > SSID in the first instance. Should we implement some beacon parsing in
> > cfg80211 or move ieee802_11_parse_elems from mac80211?
>
> There's ieee80211_bss_get_ie() in cfg80211, which doesn't give you the
> length/data in two separate values, but otherwise behaves pretty
> similarly. IOW, something like
>
> const u8 *ssid = ieee80211_bss_get_ie(bss /* or &bss->pub */, WLAN_EID_SSID);
> if (ssid) {
> ssid_len = ssid[1];
> ssid_data = ssid + 2;
> }

Ah, I missed that. Will send out a patch.

Thanks,
-yi


2009-08-05 05:27:07

by Zhu Yi

[permalink] [raw]
Subject: Re: [PATCH] wireless: display wext SSID when connected by cfg80211

On Wed, 2009-08-05 at 13:19 +0800, Johannes Berg wrote:
> On Wed, 2009-08-05 at 10:05 +0800, Zhu Yi wrote:
> > cfg80211 displays correct link info when connected by wext. But if
> > the connection is setup by cfg80211, wext cannot display the SSID.
> > This patch fixed this issue.
> >
> > Signed-off-by: Zhu Yi <[email protected]>
> > ---
> > diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
> > index 7bacbd1..48c165b 100644
> > --- a/net/wireless/wext-sme.c
> > +++ b/net/wireless/wext-sme.c
> > @@ -210,6 +210,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
> > data->flags = 1;
> > data->length = wdev->wext.connect.ssid_len;
> > memcpy(ssid, wdev->wext.connect.ssid, data->length);
> > + } else if (wdev->ssid && wdev->ssid_len) {
> > + data->flags = 1;
> > + data->length = wdev->ssid_len;
> > + memcpy(ssid, wdev->ssid, data->length);
>
> Hmm. I suspect using wdev->current_bss would be less prone to breakage,
> since we've had some trouble with wdev->ssid already, and current_bss
> has to be present all the time for various nl80211 too. I guess
> ultimately it doesn't matter that much since somebody will see the
> problem.

Yeah, I'm lazy to parse the current_bss.pub->information_elements for
SSID in the first instance. Should we implement some beacon parsing in
cfg80211 or move ieee802_11_parse_elems from mac80211?

Thanks,
-yi


2009-08-05 05:35:47

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wireless: display wext SSID when connected by cfg80211

On Wed, 2009-08-05 at 13:27 +0800, Zhu Yi wrote:

> Yeah, I'm lazy to parse the current_bss.pub->information_elements for
> SSID in the first instance. Should we implement some beacon parsing in
> cfg80211 or move ieee802_11_parse_elems from mac80211?

There's ieee80211_bss_get_ie() in cfg80211, which doesn't give you the
length/data in two separate values, but otherwise behaves pretty
similarly. IOW, something like

const u8 *ssid = ieee80211_bss_get_ie(bss /* or &bss->pub */, WLAN_EID_SSID);
if (ssid) {
ssid_len = ssid[1];
ssid_data = ssid + 2;
}

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2009-08-05 05:19:57

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wireless: display wext SSID when connected by cfg80211

On Wed, 2009-08-05 at 10:05 +0800, Zhu Yi wrote:
> cfg80211 displays correct link info when connected by wext. But if
> the connection is setup by cfg80211, wext cannot display the SSID.
> This patch fixed this issue.
>
> Signed-off-by: Zhu Yi <[email protected]>
> ---
> diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
> index 7bacbd1..48c165b 100644
> --- a/net/wireless/wext-sme.c
> +++ b/net/wireless/wext-sme.c
> @@ -210,6 +210,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev,
> data->flags = 1;
> data->length = wdev->wext.connect.ssid_len;
> memcpy(ssid, wdev->wext.connect.ssid, data->length);
> + } else if (wdev->ssid && wdev->ssid_len) {
> + data->flags = 1;
> + data->length = wdev->ssid_len;
> + memcpy(ssid, wdev->ssid, data->length);

Hmm. I suspect using wdev->current_bss would be less prone to breakage,
since we've had some trouble with wdev->ssid already, and current_bss
has to be present all the time for various nl80211 too. I guess
ultimately it doesn't matter that much since somebody will see the
problem.

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part