commit 4a2b80ee97f2d6f8a08725d43ac2dcf6c314d71e
parent b2f27f3abe72c299da977f47aeb994e911d5edb5
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Tue, 3 Jul 2018 14:36:34 -0700
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.
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -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;
diff --git a/src/netdev.h b/src/netdev.h
@@ -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);