diff --git a/src/common/privsep_commands.h b/src/common/privsep_commands.h index 6f02ed8b7..be94fb810 100644 --- a/src/common/privsep_commands.h +++ b/src/common/privsep_commands.h @@ -30,6 +30,7 @@ enum privsep_cmd { PRIVSEP_CMD_L2_UNREGISTER, PRIVSEP_CMD_L2_NOTIFY_AUTH_START, PRIVSEP_CMD_L2_SEND, + PRIVSEP_CMD_SET_MODE, }; struct privsep_cmd_associate diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c index a441e6a45..4e0a36f3c 100644 --- a/src/drivers/driver_privsep.c +++ b/src/drivers/driver_privsep.c @@ -726,6 +726,15 @@ static const u8 * wpa_driver_privsep_get_mac_addr(void *priv) } +static int wpa_driver_privsep_set_mode(void *priv, int mode) +{ + struct wpa_driver_privsep_data *drv = priv; + wpa_printf(MSG_DEBUG, "%s mode=%d", __func__, mode); + return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_MODE, &mode, sizeof(mode), + NULL, NULL); +} + + struct wpa_driver_ops wpa_driver_privsep_ops = { "privsep", "wpa_supplicant privilege separated driver", @@ -763,7 +772,9 @@ struct wpa_driver_ops wpa_driver_privsep_ops = { NULL /* mlme_remove_sta */, NULL /* update_ft_ies */, NULL /* send_ft_action */, - wpa_driver_privsep_get_scan_results2 + wpa_driver_privsep_get_scan_results2, + NULL /* set_probe_req_ie */, + wpa_driver_privsep_set_mode }; diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c index 4a8d363ad..231b962fe 100644 --- a/wpa_supplicant/wpa_priv.c +++ b/wpa_supplicant/wpa_priv.c @@ -564,6 +564,17 @@ static void wpa_priv_cmd_l2_send(struct wpa_priv_interface *iface, } +static void wpa_priv_cmd_set_mode(struct wpa_priv_interface *iface, + void *buf, size_t len) +{ + if (iface->drv_priv == NULL || iface->driver->set_mode == NULL || + len != sizeof(int)) + return; + + iface->driver->set_mode(iface->drv_priv, *((int *) buf)); +} + + static void wpa_priv_receive(int sock, void *eloop_ctx, void *sock_ctx) { struct wpa_priv_interface *iface = eloop_ctx; @@ -635,6 +646,9 @@ static void wpa_priv_receive(int sock, void *eloop_ctx, void *sock_ctx) case PRIVSEP_CMD_L2_SEND: wpa_priv_cmd_l2_send(iface, &from, cmd_buf, cmd_len); break; + case PRIVSEP_CMD_SET_MODE: + wpa_priv_cmd_set_mode(iface, cmd_buf, cmd_len); + break; } }