From owner-freebsd-mobile@FreeBSD.ORG Wed Apr 23 23:06:16 2003 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D391E37B401; Wed, 23 Apr 2003 23:06:16 -0700 (PDT) Received: from sccrmhc03.attbi.com (sccrmhc03.attbi.com [204.127.202.63]) by mx1.FreeBSD.org (Postfix) with ESMTP id F2DD043FA3; Wed, 23 Apr 2003 23:06:15 -0700 (PDT) (envelope-from DougB@freebsd.org) Received: from master.dougb.net (12-234-22-23.client.attbi.com[12.234.22.23]) by sccrmhc03.attbi.com (sccrmhc03) with SMTP id <20030424060614003006boale>; Thu, 24 Apr 2003 06:06:15 +0000 Date: Wed, 23 Apr 2003 23:06:13 -0700 (PDT) From: Doug Barton To: John Baldwin In-Reply-To: Message-ID: <20030423223710.P7551@znfgre.qbhto.arg> References: Organization: http://www.FreeBSD.org/ X-message-flag: Outlook -- Not just for spreading viruses anymore! MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: mobile@FreeBSD.org cc: Mike Makonnen Subject: Script to automatically configure a wireless card based on ssid X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Apr 2003 06:06:17 -0000 John, I took a look at your script, and it has some really good stuff. I ran into a problem though. The premise of your script is that once you get an ssid, you'll know how to configure that interface. I'm curious about what kind of card you have. I have a netgear ma 401, and it's coming up with an ssid as soon as I bring the card up. Here is an example: ifconfig wi0 powersave: wi0: flags=8802 mtu 1500 ether 00:09:5b:31:2d:2f media: IEEE 802.11 Wireless Ethernet autoselect (none) ssid "" stationname "FreeBSD WaveLAN/IEEE node" channel -1 authmode OPEN powersavemode CAM powersavesleep 100 wepmode OFF weptxkey 1 ifconfig wi0 up: wi0: flags=8843 mtu 1500 ether 00:09:5b:31:2d:2f media: IEEE 802.11 Wireless Ethernet autoselect (DS/2Mbps) status: associated ssid WLAN 1:WLAN stationname "FreeBSD WaveLAN/IEEE node" channel 11 authmode OPEN powersavemode CAM powersavesleep 100 wepmode OFF weptxkey 1 The problem is, WLAN is not the ssid of my (freebsd) AP, and there are no other AP's in my area. As soon as I do 'ifconfig wi0 wepmode mixed' it finds my AP, and then I can configure the interface using the rest of your script. I'm not really surprised by the fact that it works when I turn on wepmode, I'm annoyed that it comes up with an ssid that doesn't exist. :) The interim solution I have is to loop through the "find an ssid I know about" part of your script with the various combinations of wepmode. My plan is to do something like this: interface up find an ssid I know and configure successfully, or wepmode mixed find an ssid I know and configure successfully, or wepmode on find an ssid I know and configure successfully, or wepmode off If I still have an ssid and status: associated, exit 0, or exit 1 The purpose of the last step is for situations where you're a guest in a place that has non-wep service enabled. I run into this at conferences all the time, so I think it's a reasonable fallthrough case. The other thing I'm interested in at this point is a good definition of "configured successfully." When I find the right ssid and set the right wep keys, I know that I'm successful if I can dhclient the interface. However, I'd really like to find a metric I can test before I take that step. So far I haven't been successful, but I'm hoping it's just due to my ignorance. I'm interested in your opinion of this plan for more general use, and also the opinion of folks on the list. For those that aren't aware of the goal here, the rc team is working on improvements to our scripts to auto-configure a system on boot, including wired/wireless, etc. Doug -- This .signature sanitized for your protection