1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

Change wpa_supplicant to down the interface at the start of the init routine.

wpa_supplicant expects that it has exclusive access to the net80211 state so
when its starts poking in the WEP/WPA settings and the card is already
scanning it can cause net80211 to try and associate incorrectly with a
protected AP.

This is an inconvenience for firmware based cards such as iwi where it can be
sent an auth instruction with incomplete security info and cause a firmware
error.

Remove the 'ifconfig up' from network.subr since wpa_supplicant will
immediately down the interface again.

Reported by:	Guy Helmer (and others)
Reviewed by:	sam, brooks, avatar
MFC after:	3 days
This commit is contained in:
Andrew Thompson 2007-11-05 06:13:07 +00:00
parent 13b2a31631
commit 5090437236
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173355
2 changed files with 12 additions and 6 deletions

View File

@ -49,9 +49,6 @@ ifconfig_up()
fi
if wpaif $1; then
if [ $_cfg -ne 0 ] ; then
ifconfig $1 up
fi
/etc/rc.d/wpa_supplicant start $1
_cfg=0 # XXX: not sure this should count
fi

View File

@ -687,6 +687,7 @@ wpa_driver_bsd_init(void *ctx, const char *ifname)
#define GETPARAM(drv, param, v) \
(((v) = get80211param(drv, param)) != -1)
struct wpa_driver_bsd_data *drv;
int flags;
drv = malloc(sizeof(*drv));
if (drv == NULL)
@ -707,15 +708,23 @@ wpa_driver_bsd_init(void *ctx, const char *ifname)
drv->sock = socket(PF_INET, SOCK_DGRAM, 0);
if (drv->sock < 0)
goto fail1;
drv->ctx = ctx;
strncpy(drv->ifname, ifname, sizeof(drv->ifname));
/*
* Mark the interface as down to ensure wpa_supplicant has exclusive
* access to the net80211 state machine, do this before opening the
* route socket to avoid a false event that the interface disappeared.
*/
if (getifflags(drv, &flags) == 0)
(void) setifflags(drv, flags &~ IFF_UP);
drv->route = socket(PF_ROUTE, SOCK_RAW, 0);
if (drv->route < 0)
goto fail;
eloop_register_read_sock(drv->route,
wpa_driver_bsd_event_receive, ctx, drv);
drv->ctx = ctx;
strncpy(drv->ifname, ifname, sizeof(drv->ifname));
if (!GETPARAM(drv, IEEE80211_IOC_ROAMING, drv->prev_roaming)) {
wpa_printf(MSG_DEBUG, "%s: failed to get roaming state: %s",
__func__, strerror(errno));