netdev: expose netdev_del_station

This removes the need for duplicate code in AP/netdev for issuing
a DEL_STATION command. Now AP can issue a DEL_STATION with
netdev_del_station, and specify to either disassociate or deauth
depending on state.
This commit is contained in:
James Prestwood 2018-07-03 14:36:34 -07:00 committed by Denis Kenzior
parent b2f27f3abe
commit 4a2b80ee97
2 changed files with 23 additions and 0 deletions

View File

@ -912,6 +912,26 @@ static struct l_genl_msg *netdev_build_cmd_del_station(struct netdev *netdev,
return msg;
}
static void netdev_del_sta_cb(struct l_genl_msg *msg, void *user_data)
{
if (l_genl_msg_get_error(msg) < 0)
l_error("DEL_STATION failed: %i", l_genl_msg_get_error(msg));
}
int netdev_del_station(struct netdev *netdev, const uint8_t *sta,
uint16_t reason_code, bool disassociate)
{
struct l_genl_msg *msg;
msg = netdev_build_cmd_del_station(netdev, sta, reason_code,
disassociate);
if (!l_genl_family_send(nl80211, msg, netdev_del_sta_cb, NULL, NULL))
return -EIO;
return 0;
}
static void netdev_operstate_cb(bool success, void *user_data)
{
struct netdev *netdev = user_data;

View File

@ -128,6 +128,9 @@ int netdev_preauthenticate(struct netdev *netdev, struct scan_bss *target_bss,
netdev_preauthenticate_cb_t cb,
void *user_data);
int netdev_del_station(struct netdev *netdev, const uint8_t *sta,
uint16_t reason_code, bool disassociate);
int netdev_set_powered(struct netdev *netdev, bool powered,
netdev_set_powered_cb_t cb, void *user_data,
netdev_destroy_func_t destroy);