On Mon, Jul 25, 2005 at 09:36:58AM +0200, Marc Winiger wrote:
> Hi
> 
> On wi(4) wlan cards it is possible to get the desired nwid with
> WI_RID_DESIRED_SSID, independent whether the card is associated to an 
> access point or not.
> 

it's a useless button, you can do it with SIOCG80211NWID as well.

> Cards with other drivers, are using SIOCG80211NWID to get the nwid. But 
> this value contains the actual nwid associated to, not the one I set.
> 

that's wrong. if you set the nwid with ifconfig, it always sets the
desired nwid. SIOCG80211NWID returns the desired nwid or ANY if not
associated to an accesspoint, otherwise it will return the actual nwid
of the accesspoint (which should be, if set, identical to the desired
nwid).

> I have to decide, whether the nwid is set to a name or ANY. Does anybody 
> know if that is possible?
> 

only if you haven't been associated to an accesspoint. try the
attached patch (does not work with wi(4)).

reyk

Index: net80211/ieee80211_ioctl.c
===================================================================
RCS file: /cvs/src/sys/net80211/ieee80211_ioctl.c,v
retrieving revision 1.12
diff -u -p -r1.12 ieee80211_ioctl.c
--- net80211/ieee80211_ioctl.c  25 May 2005 07:40:49 -0000      1.12
+++ net80211/ieee80211_ioctl.c  2 Aug 2005 12:24:30 -0000
@@ -190,6 +190,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
                        memcpy(nwid.i_nwid, ic->ic_bss->ni_essid, nwid.i_len);
                        break;
                }
+               nwid.i_mode = ic->ic_des_esslen ?
+                   IEEE80211_NWID_DESIRED : IEEE80211_NWID_AUTO;
                error = copyout(&nwid, ifr->ifr_data, sizeof(nwid));
                break;
        case SIOCS80211NWKEY:
Index: net80211/ieee80211_ioctl.h
===================================================================
RCS file: /cvs/src/sys/net80211/ieee80211_ioctl.h,v
retrieving revision 1.4
diff -u -p -r1.4 ieee80211_ioctl.h
--- net80211/ieee80211_ioctl.h  25 May 2005 07:40:49 -0000      1.4
+++ net80211/ieee80211_ioctl.h  2 Aug 2005 12:24:31 -0000
@@ -92,7 +92,11 @@ struct ieee80211_stats {
 struct ieee80211_nwid {
        u_int8_t        i_len;
        u_int8_t        i_nwid[IEEE80211_NWID_LEN];
+       int             i_mode;
 };
+
+#define IEEE80211_NWID_AUTO    0
+#define IEEE80211_NWID_DESIRED 1
 
 #define        SIOCS80211NWID          _IOWR('i', 230, struct ifreq)
 #define        SIOCG80211NWID          _IOWR('i', 231, struct ifreq)

Reply via email to