aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-01-19 17:48:01 (GMT)
committerJouni Malinen <j@w1.fi>2016-02-05 10:37:25 (GMT)
commitaf060932deada3e0822f2a53a9ef6337b16af83b (patch)
tree8d973f8adf81b295f4435ee7125bafbc1c013c1e /src/drivers/driver_bsd.c
parentdc0ad60314ad85f1983870095fa19128a0457a2e (diff)
downloadhostap-af060932deada3e0822f2a53a9ef6337b16af83b.zip
hostap-af060932deada3e0822f2a53a9ef6337b16af83b.tar.gz
hostap-af060932deada3e0822f2a53a9ef6337b16af83b.tar.bz2
BSD: Disable interface on down
Instead of removing the interface when downed, disable it. Enable it when it comes back up again. Signed-off-by: Roy Marples <roy@marples.name>
Diffstat (limited to 'src/drivers/driver_bsd.c')
-rw-r--r--src/drivers/driver_bsd.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 8d8b676..da9fc66 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -62,6 +62,7 @@ struct bsd_driver_data {
struct l2_packet_data *sock_xmit;/* raw packet xmit socket */
char ifname[IFNAMSIZ+1]; /* interface name */
+ int flags;
unsigned int ifindex; /* interface index */
void *ctx;
struct wpa_driver_capa capa; /* driver capability */
@@ -287,6 +288,7 @@ bsd_ctrl_iface(void *priv, int enable)
strerror(errno));
return -1;
}
+ drv->flags = ifr.ifr_flags;
if (enable) {
if (ifr.ifr_flags & IFF_UP)
@@ -304,6 +306,7 @@ bsd_ctrl_iface(void *priv, int enable)
return -1;
}
+ drv->flags = ifr.ifr_flags;
return 0;
}
@@ -1289,15 +1292,20 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
drv = bsd_get_drvindex(global, ifm->ifm_index);
if (drv == NULL)
return;
- if ((rtm->rtm_flags & RTF_UP) == 0) {
- os_strlcpy(event.interface_status.ifname, drv->ifname,
- sizeof(event.interface_status.ifname));
- event.interface_status.ievent = EVENT_INTERFACE_REMOVED;
+ if ((ifm->ifm_flags & IFF_UP) == 0 &&
+ (drv->flags & IFF_UP) != 0) {
wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' DOWN",
- event.interface_status.ifname);
- wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS,
- &event);
+ drv->ifname);
+ wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED,
+ NULL);
+ } else if ((ifm->ifm_flags & IFF_UP) != 0 &&
+ (drv->flags & IFF_UP) == 0) {
+ wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' UP",
+ drv->ifname);
+ wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
+ NULL);
}
+ drv->flags = ifm->ifm_flags;
break;
}
}