Date: Tue, 28 Jun 2005 22:33:35 -0700 From: Brooks Davis <brooks@one-eyed-alien.net> To: current@freebsd.org Subject: dhclient/wpa_supplicant patch Message-ID: <20050629053335.GA18808@odin.ac.hmc.edu>
next in thread | raw e-mail | index | archive | help
--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Below you will find a patch which I believe solves the major issues with
the removable_interfaces variable, and adds wpa_supplicant support to
the startup scripts. The significant behavioral changes are starting
wpa_supplicant it the ifconfig_<ifn> entry contains WPA, always
including removable interfaces in the list of potential interfaces,
always running /etc/rc.d/netif's start/stop code when passed a list of
interfaces on all interfaces, even if they don't exist, and replacing
pccard_ifconfig with a new ifconfig_DEFAULT variable which applies to
all interfaces that lack an ifconfig_<ifn> line.
Please review and test. I plan to commit tomorrow PDT unless there are
issues.
-- Brooks
Index: network.subr
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/cvs/src/etc/network.subr,v
retrieving revision 1.162
diff -u -p -u -r1.162 network.subr
--- network.subr 7 Jun 2005 23:59:45 -0000 1.162
+++ network.subr 29 Jun 2005 01:22:03 -0000
@@ -48,7 +48,7 @@ ifconfig_up()
fi
=20
if wpaif $1; then
- #/etc/rc.d/wpa_supplicant start $1
+ /etc/rc.d/wpa_supplicant start $1
_cfg=3D0 # XXX: not sure this should count
fi
=20
@@ -89,7 +89,7 @@ ifconfig_down()
IFS=3D"$oldifs"
=20
if wpaif $1; then
- #/etc/rc.d/wpa_supplicant stop $1
+ /etc/rc.d/wpa_supplicant stop $1
_cfg=3D0
fi
=20
@@ -113,16 +113,11 @@ _ifconfig_getargs()
fi
=20
eval _args=3D\$ifconfig_$1
- if [ -z "$_args" -a -n "${pccard_ifconfig}" ]; then
- for _if in ${removable_interfaces} ; do
- if [ "$_if" =3D "$_ifn" ] ; then
- _args=3D${pccard_ifconfig}
- break
- fi
- done
+ if [ -z "$_args" ]; then
+ _args=3D$ifconfig_DEFAULT
fi
=20
- echo $_args
+ echo "$_args"
}
=20
# ifconfig_getargs if
@@ -394,7 +389,7 @@ list_net_interfaces()
_tmplist=3D"`ifconfig -l`"
;;
*)
- _tmplist=3D"${network_interfaces} ${cloned_interfaces}"
+ _tmplist=3D"${network_interfaces} ${removable_interfaces} ${cloned_inter=
faces}"
;;
esac
=20
@@ -408,37 +403,15 @@ list_net_interfaces()
_aprefix=3D
_bprefix=3D
for _if in ${_tmplist} ; do
- eval _ifarg=3D"\$ifconfig_${_if}"
- case "$_ifarg" in
- [Dd][Hh][Cc][Pp])
+ if dhcpif $_if; then
_dhcplist=3D"${_dhcplist}${_aprefix}${_if}"
[ -z "$_aprefix" ] && _aprefix=3D' '
- ;;
- ''|*)
+ elif [ -n "`_ifconfig_getargs $if`" ]; then
_nodhcplist=3D"${_nodhcplist}${_bprefix}${_if}"
[ -z "$_bprefix" ] && _bprefix=3D' '
- ;;
- esac
+ fi
done
=20
- case ${pccard_ifconfig} in
- [Dd][Hh][Cc][Pp])
- for _if in ${removable_interfaces} ; do
- _test_if=3D`ifconfig ${_if} 2>&1`
- case "$_test_if" in
- "ifconfig: interface $_if does not exist")
- ;;
- *)
- _dhcplist=3D"${_dhcplist}${_aprefix}${_if}"
- [ -z "$_aprefix" ] && _aprefix=3D' '
- ;;
- esac
- done
- ;;
- *)
- ;;
- esac
-
case "$type" in
nodhcp)
echo $_nodhcplist
Index: rc.d/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/cvs/src/etc/rc.d/Makefile,v
retrieving revision 1.52
diff -u -p -u -r1.52 Makefile
--- rc.d/Makefile 29 Apr 2005 23:02:56 -0000 1.52
+++ rc.d/Makefile 29 Jun 2005 01:23:12 -0000
@@ -36,7 +36,7 @@ FILES=3D DAEMON LOGIN NETWORKING SERVERS \
timed tmp \
ugidfw usbd \
var virecover \
- watchdogd \
+ watchdogd wpa_supplicant \
ypbind yppasswdd ypserv \
ypset ypupdated ypxfrd
FILESDIR=3D /etc/rc.d
Index: rc.d/netif
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/cvs/src/etc/rc.d/netif,v
retrieving revision 1.13
diff -u -p -u -r1.13 netif
--- rc.d/netif 7 Jun 2005 04:49:12 -0000 1.13
+++ rc.d/netif 29 Jun 2005 02:13:48 -0000
@@ -109,13 +109,10 @@ network_common()
#
_cooked_list=3D
if [ -n "$_cmdifn" ]; then
- for i in $_cmdifn ; do
- eval _if=3D\"`expr "$_ifn_list" : ".*\(${i}\).*"`\"
- if [ -z "$_if" ]; then
- err 1 "No such network interface: $i"
- fi
- _cooked_list=3D"$_cooked_list $_if"
- done
+ # Don't check that the interfaces exist. We need to run
+ # the down code even when the interface doesn't exist to
+ # kill off wpa_supplicant.
+ _cooked_list=3D"$_cmdifn"
else
_cooked_list=3D"$_ifn_list"
fi
--- rc.d/wpa_supplicant Tue Jun 28 22:24:18 2005
+++ rc.d/wpa_supplicant Tue Jun 28 18:51:32 2005
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: wpa_supplicant
+# REQUIRE: mountcritremote
+# KEYWORD: nojail nostart
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name=3D"wpa_supplicant"
+rcvar=3D
+command=3D"/usr/sbin/${name}"
+conf_file=3D"/etc/wpa_supplicant.conf"
+
+ifn=3D"$2"
+if [ -z "$ifn" ]; then
+ return 1
+fi
+
+load_rc_config $name
+
+if ! wpaif $ifn; then
+ return 1
+fi
+
+pid_file=3D"/var/run/${name}/${ifn}.pid"
+command_args=3D"-B -q -i $ifn -P $pid_file -c $conf_file"
+required_files=3D$conf_file
+
+run_rc_command "$1"
--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
--EVF5PPMfhYS0aIcm
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQFCwjKuXY6L6fI4GtQRAjD1AKDd2Yg9sRklMnfTBkyWXo8T5yUwWgCeLGhz
2YL701IxMcU8Q1Wbub+UjgU=
=3LGn
-----END PGP SIGNATURE-----
--EVF5PPMfhYS0aIcm--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050629053335.GA18808>
