summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2007-11-05 06:13:07 +0000
committerthompsa <thompsa@FreeBSD.org>2007-11-05 06:13:07 +0000
commite44e0b612b3783c5c938afc92eb227e9be0c61b4 (patch)
treed7c2ab5e843f90e91144aa5e58a22c678ff797c6 /usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
parent5c2145818777785a7cf0d81c374008e2b3fdfa6f (diff)
downloadFreeBSD-src-e44e0b612b3783c5c938afc92eb227e9be0c61b4.zip
FreeBSD-src-e44e0b612b3783c5c938afc92eb227e9be0c61b4.tar.gz
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
Diffstat (limited to 'usr.sbin/wpa/wpa_supplicant/driver_freebsd.c')
-rw-r--r--usr.sbin/wpa/wpa_supplicant/driver_freebsd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c b/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
index cf9d86a..7769a8e 100644
--- a/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
+++ b/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
@@ -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));
OpenPOWER on IntegriCloud