Added set_mode() handler for privsep

This commit is contained in:
Jouni Malinen 2008-09-29 17:09:26 +03:00 committed by Jouni Malinen
parent 147bdb3f9c
commit 38fa763405
3 changed files with 27 additions and 1 deletions

View file

@ -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

View file

@ -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
};

View file

@ -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;
}
}