diff mbox

wireless: display wext SSID when connected by cfg80211

Message ID 1249437950-8059-1-git-send-email-yi.zhu@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Zhu Yi Aug. 5, 2009, 2:05 a.m. UTC
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 <yi.zhu@intel.com>
---
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Johannes Berg Aug. 5, 2009, 5:19 a.m. UTC | #1
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 <yi.zhu@intel.com>
> ---
> 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
Zhu Yi Aug. 5, 2009, 5:27 a.m. UTC | #2
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 <yi.zhu@intel.com>
> > ---
> > 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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Aug. 5, 2009, 5:35 a.m. UTC | #3
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
Zhu Yi Aug. 5, 2009, 5:39 a.m. UTC | #4
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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