netdev: Emit DISCONNECT_BY_SME event on eapol failures

There are situations when a CMD_DISCONNECT or deauthenticate will be
issued locally because of an error detected locally where netdev would
not be able to emit a event to the device object.   The CMD_DISCONNECT
handler can only send an event if the disconnect is triggered by the AP
because we don't have an enum value defined for other diconnects.  We
have these values defined for the connect callback but those errors may
happen when the connect callback is already NULL because a connection
has been estabilshed.  So add an event type for local errors.

These situations may occur in a transition negotiation or in an eapol
handshake failure during rekeying resulting in a call to
netdev_handshake_failed.
This commit is contained in:
Andrew Zaborowski 2016-12-12 18:34:28 +01:00 committed by Denis Kenzior
parent 4d366df23f
commit 27bdddf010
3 changed files with 9 additions and 0 deletions

View File

@ -615,6 +615,10 @@ static void device_netdev_event(struct netdev *netdev, enum netdev_event event,
break;
case NETDEV_EVENT_DISCONNECT_BY_AP:
device_disconnect_by_ap(device);
break;
case NETDEV_EVENT_DISCONNECT_BY_SME:
device_disassociated(device);
break;
};
}

View File

@ -323,6 +323,7 @@ static void netdev_connect_failed(struct l_genl_msg *msg, void *user_data)
{
struct netdev *netdev = user_data;
netdev_connect_cb_t connect_cb = netdev->connect_cb;
netdev_event_func_t event_filter = netdev->event_filter;
void *connect_data = netdev->user_data;
enum netdev_result result = netdev->result;
@ -333,6 +334,9 @@ static void netdev_connect_failed(struct l_genl_msg *msg, void *user_data)
if (connect_cb)
connect_cb(netdev, result, connect_data);
else if (event_filter)
event_filter(netdev, NETDEV_EVENT_DISCONNECT_BY_SME,
connect_data);
}
static void netdev_free(void *data)

View File

@ -43,6 +43,7 @@ enum netdev_event {
NETDEV_EVENT_SETTING_KEYS,
NETDEV_EVENT_LOST_BEACON,
NETDEV_EVENT_DISCONNECT_BY_AP,
NETDEV_EVENT_DISCONNECT_BY_SME,
};
enum netdev_watch_event {