Unable to connect to wireless 802.11 AP with hidden SSID

From: Rudolf Cejka <cejkar_at_fit.vutbr.cz>
Date: Thu, 25 Aug 2005 15:49:24 +0200
Hello,
  after an upgrade from 5.x to 7.x (Aug 22), I'm unable to connect to
wireless 802.11 access point, which hides its own SSID, using dhclient
(manual settings do work, however it is not very good workaround...).
My wireless card is

ndis0: <BUFFALO WLI-CB-G54 Wireless LAN Adapter> mem 0x88000000-0x88001fff
  irq 9 at device 0.0 on cardbus0

and I use commands

$ ifconfig ndis0 up
$ ifconfig ndis0 authmode shared wepmode on weptxkey 1 wepkey 1:XXX \
  ssid "XXX"

for ndis0 interface setup. However, when I run

$ dhclient ndis0

ssid is lost. It seems that "empty" ssid received from AP is forced to
be a new ssid, when ifconfig ndis0 up is called by dhclient on interface
already set up. I do not know, what should be fixed - ndis layer, 802.11
layer, dhclient, or ifconfig, however the following patch to ifconfig.c
helps to me - if SIOCSIFFLAGS would not change any flag (something is
changed again, what has been changed in the past), ioctl() is simply
skipped.

I'm sure, that connecting to AP with hidden SSID worked in the past.

--- sbin/ifconfig/ifconfig.c.orig	Thu Aug 25 15:13:54 2005
+++ sbin/ifconfig/ifconfig.c	Thu Aug 25 15:15:03 2005
_at__at_ -82,6 +82,7 _at__at_
 
 char	name[IFNAMSIZ];
 int	flags;
+int	saveflags;
 int	setaddr;
 int	setipdst;
 int	setmask;
_at__at_ -714,15 +715,18 _at__at_
 	strncpy(my_ifr.ifr_name, name, sizeof (my_ifr.ifr_name));
 	flags = (my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16);
 
+	saveflags = flags;
 	if (value < 0) {
 		value = -value;
 		flags &= ~value;
 	} else
 		flags |= value;
-	my_ifr.ifr_flags = flags & 0xffff;
-	my_ifr.ifr_flagshigh = flags >> 16;
-	if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0)
-		Perror(vname);
+	if (flags != saveflags) {
+		my_ifr.ifr_flags = flags & 0xffff;
+		my_ifr.ifr_flagshigh = flags >> 16;
+		if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0)
+			Perror(vname);
+	}
 }
 
 void
-- 
Rudolf Cejka <cejkar at fit.vutbr.cz> http://www.fit.vutbr.cz/~cejkar
Brno University of Technology, Faculty of Information Technology
Bozetechova 2, 612 66  Brno, Czech Republic
Received on Thu Aug 25 2005 - 11:49:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:42 UTC