netdev/eapol: removed eapol deauthenticate

This removes the need for the eapol/netdev deauthenticate function.
netdev_handshake_failed was exposed so device.c could issue the
disconnect.
This commit is contained in:
James Prestwood 2018-06-27 14:08:24 -07:00 committed by Denis Kenzior
parent 28c400499d
commit 92f1ceb3ce
5 changed files with 8 additions and 27 deletions

View File

@ -657,8 +657,11 @@ static void device_handshake_event(struct handshake_state *hs,
/* If we got here, then our PSK works. Save if required */
network_sync_psk(network);
break;
case HANDSHAKE_EVENT_COMPLETE:
case HANDSHAKE_EVENT_FAILED:
netdev_handshake_failed(device_get_netdev(device),
l_get_u16(event_data));
break;
case HANDSHAKE_EVENT_COMPLETE:
/*
* currently we dont care about any other events. The
* netdev_connect_cb will notify us when the connection is

View File

@ -42,7 +42,6 @@ struct l_queue *preauths;
struct watchlist frame_watches;
static uint32_t eapol_4way_handshake_time = 2;
eapol_deauthenticate_func_t deauthenticate = NULL;
eapol_rekey_offload_func_t rekey_offload = NULL;
eapol_tx_packet_func_t tx_packet = NULL;
@ -756,11 +755,6 @@ static inline void handshake_failed(struct eapol_sm *sm, uint16_t reason_code)
{
handshake_event(sm->handshake, HANDSHAKE_EVENT_FAILED, &reason_code);
if (deauthenticate)
deauthenticate(sm->handshake->ifindex,
sm->handshake->aa, sm->handshake->spa,
reason_code, sm->user_data);
eapol_sm_free(sm);
}
@ -2000,11 +1994,6 @@ void __eapol_set_tx_user_data(void *user_data)
tx_user_data = user_data;
}
void __eapol_set_deauthenticate_func(eapol_deauthenticate_func_t func)
{
deauthenticate = func;
}
void __eapol_set_rekey_offload_func(eapol_rekey_offload_func_t func)
{
rekey_offload = func;

View File

@ -120,10 +120,6 @@ typedef void (*eapol_rekey_offload_func_t)(uint32_t ifindex,
typedef void (*eapol_sm_event_func_t)(unsigned int event,
const void *event_data,
void *user_data);
typedef void (*eapol_deauthenticate_func_t)(uint32_t ifindex, const uint8_t *aa,
const uint8_t *spa,
uint16_t reason_code,
void *user_data);
typedef void (*eapol_preauth_cb_t)(const uint8_t *pmk, void *user_data);
typedef void (*eapol_preauth_destroy_func_t)(void *user_data);
typedef void (*eapol_frame_watch_func_t)(uint16_t proto, const uint8_t *from,
@ -183,7 +179,6 @@ void __eapol_tx_packet(uint32_t ifindex, const uint8_t *dst, uint16_t proto,
void __eapol_set_tx_packet_func(eapol_tx_packet_func_t func);
void __eapol_set_tx_user_data(void *user_data);
void __eapol_set_deauthenticate_func(eapol_deauthenticate_func_t func);
void __eapol_set_rekey_offload_func(eapol_rekey_offload_func_t func);
void __eapol_update_replay_counter(uint32_t ifindex, const uint8_t *spa,
const uint8_t *aa, uint64_t replay_counter);

View File

@ -1276,19 +1276,12 @@ invalid_key:
netdev_setting_keys_failed(nhs, rc);
}
static void netdev_handshake_failed(uint32_t ifindex,
const uint8_t *aa, const uint8_t *spa,
uint16_t reason_code, void *user_data)
void netdev_handshake_failed(struct netdev *netdev, uint16_t reason_code)
{
struct l_genl_msg *msg;
struct netdev *netdev;
netdev = netdev_find(ifindex);
if (!netdev)
return;
l_error("4-Way handshake failed for ifindex: %d, reason: %u",
ifindex, reason_code);
netdev->index, reason_code);
netdev->sm = NULL;
@ -4140,7 +4133,6 @@ bool netdev_init(struct l_genl_family *in,
__handshake_set_install_gtk_func(netdev_set_gtk);
__handshake_set_install_igtk_func(netdev_set_igtk);
__eapol_set_deauthenticate_func(netdev_handshake_failed);
__eapol_set_rekey_offload_func(netdev_set_rekey_offload);
__eapol_set_tx_packet_func(netdev_control_port_frame);

View File

@ -145,6 +145,8 @@ uint32_t netdev_frame_watch_add(struct netdev *netdev, uint16_t frame_type,
void *user_data);
bool netdev_frame_watch_remove(struct netdev *netdev, uint32_t id);
void netdev_handshake_failed(struct netdev *netdev, uint16_t reason_code);
struct netdev *netdev_find(int ifindex);
uint32_t netdev_watch_add(struct netdev *netdev, netdev_watch_func_t func,