aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_bsd.c
diff options
context:
space:
mode:
authorRui Paulo <rpaulo@FreeBSD.org>2013-08-07 08:01:12 (GMT)
committerJouni Malinen <j@w1.fi>2013-08-07 08:01:12 (GMT)
commit70a867c26814da1957f926e7e2d6dc21b7d331b4 (patch)
tree56f6b37ebe7e1ea6763102c46f48a5257c09b681 /src/drivers/driver_bsd.c
parent89f4690005814cb2ce0aa5e40a1a6b92ee764fcd (diff)
downloadhostap-70a867c26814da1957f926e7e2d6dc21b7d331b4.zip
hostap-70a867c26814da1957f926e7e2d6dc21b7d331b4.tar.gz
hostap-70a867c26814da1957f926e7e2d6dc21b7d331b4.tar.bz2
bsd: Mark the interface down before opening the routing socket
Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
Diffstat (limited to 'src/drivers/driver_bsd.c')
-rw-r--r--src/drivers/driver_bsd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 4dd611a..cb898c1 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -1507,6 +1507,12 @@ wpa_driver_bsd_init(void *ctx, const char *ifname)
drv->sock = socket(PF_INET, SOCK_DGRAM, 0);
if (drv->sock < 0)
goto fail1;
+
+ os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
+ /* Down interface during setup. */
+ if (bsd_ctrl_iface(drv, 0) < 0)
+ goto fail;
+
drv->route = socket(PF_ROUTE, SOCK_RAW, 0);
if (drv->route < 0)
goto fail;
@@ -1514,11 +1520,6 @@ wpa_driver_bsd_init(void *ctx, const char *ifname)
wpa_driver_bsd_event_receive, ctx, drv);
drv->ctx = ctx;
- os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
-
- /* Down interface during setup. */
- if (bsd_ctrl_iface(drv, 0) < 0)
- goto fail;
if (!GETPARAM(drv, IEEE80211_IOC_ROAMING, drv->prev_roaming)) {
wpa_printf(MSG_DEBUG, "%s: failed to get roaming state: %s",