From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 21 14:40:28 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4C3DD16A4DA for ; Thu, 21 Oct 2004 14:40:28 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3023543D55 for ; Thu, 21 Oct 2004 14:40:28 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i9LEeSSM058083 for ; Thu, 21 Oct 2004 14:40:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i9LEeSju058082; Thu, 21 Oct 2004 14:40:28 GMT (envelope-from gnats) Resent-Date: Thu, 21 Oct 2004 14:40:28 GMT Resent-Message-Id: <200410211440.i9LEeSju058082@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vlad Manilici Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DCE7316A4CE for ; Thu, 21 Oct 2004 14:35:56 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id B448043D39 for ; Thu, 21 Oct 2004 14:35:56 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i9LEZuft038940 for ; Thu, 21 Oct 2004 14:35:56 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i9LEZuR8038939; Thu, 21 Oct 2004 14:35:56 GMT (envelope-from nobody) Message-Id: <200410211435.i9LEZuR8038939@www.freebsd.org> Date: Thu, 21 Oct 2004 14:35:56 GMT From: Vlad Manilici To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: conf/72964: rc.d script needed to create wireless associations before dhclient runs X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2004 14:40:28 -0000 >Number: 72964 >Category: conf >Synopsis: rc.d script needed to create wireless associations before dhclient runs >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Oct 21 14:40:27 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Vlad Manilici >Release: FreeBSD 5.2.1 >Organization: >Environment: FreeBSD XXX 5.2.1-RELEASE-p11 FreeBSD 5.2.1-RELEASE-p11 #21: Fri Oct 8 14:12:55 CEST 2004 XXX@XXX:/usr/obj/usr/src/sys/FX i386 >Description: it would be nice to have the possibility to automatically configure wireless connections when booting. some services need an internet connection in order to start (like ntpdate). if you start wireless later, you loose the opportunity to initialize these. unfortunately, dhclient is of no use with a non-associated wireless card. the possibility to associate early with an access point is missing. i would like to thave somethink like this in rc.conf.local: wireless_enable="YES" wiereless_flags="wi0 SSID0 0xKEY0 wi1 SSID1 0xKEY1" the following script (to be installed in /etc/rc.d) does the job: #!/bin/sh # $Id: wireless,v 1.2 2004/10/21 14:10:27 root Exp $ # PROVIDE: wireless # REQUIRE: mountcritlocal # BEFORE: dhclient # KEYWORD: FreeBSD . /etc/rc.subr name="wireless" rcvar=`set_rcvar` start_cmd="wireless_start" wireless_start(){ for item in ${wireless_flags} do # read items if [ -z "$if" ]; then if=$item elif [ -z "$ssid" ]; then ssid=$item elif [ -z "$key" ]; then key=$item fi # configure if [ -n "$if" -a -n "$ssid" -a -n "$key" ]; then echo -n configuring interface $if / $ssid ... if ifconfig $if 2>&1|grep -q 'does not exist'; then echo ' does not exist' elif ifconfig $if | grep -q 'status: associated'; then echo ' already configured' else ifconfig $if inet 0.0.0.0 powersave wepmode on\ station wlan ssid $ssid wepkey $key if ifconfig $if | grep -q 'status: associated'; then echo ' ok' else echo ' no association' ifconfig $if down fi fi if='' ssid='' key='' fi done } load_rc_config $name run_rc_command "$1" >How-To-Repeat: --- >Fix: --- >Release-Note: >Audit-Trail: >Unformatted: