netdev: Add sanity checks

In the case we get a connect or authenticate event, make sure we're
actually trying to connect.  Otherwise, it could be another supplicant
is running
This commit is contained in:
Denis Kenzior 2017-03-24 11:44:26 -05:00
parent 303490261f
commit 4e421cfc8f
1 changed files with 15 additions and 3 deletions

View File

@ -1277,12 +1277,14 @@ static void netdev_connect_event(struct l_genl_msg *msg,
const uint8_t *rsne = NULL;
const uint8_t *mde = NULL;
const uint8_t *fte = NULL;
bool is_rsn = netdev->handshake->own_ie != NULL;
l_debug("");
if (!netdev->connected)
if (!netdev->connected) {
l_warn("Unexpected connection related event -- "
"is another supplicant running?");
return;
}
if (!l_genl_attr_init(&attr, msg)) {
l_debug("attr init failed");
@ -1355,6 +1357,8 @@ static void netdev_connect_event(struct l_genl_msg *msg,
}
if (netdev->in_ft) {
bool is_rsn = netdev->handshake->own_ie != NULL;
netdev->in_ft = false;
netdev->operational = true;
@ -1566,10 +1570,16 @@ static void netdev_authenticate_event(struct l_genl_msg *msg,
const uint8_t *mde = NULL;
const uint8_t *fte = NULL;
struct handshake_state *hs = netdev->handshake;
bool is_rsn = hs->own_ie != NULL;
bool is_rsn;
l_debug("");
if (!netdev->connected) {
l_warn("Unexpected connection related event -- "
"is another supplicant running?");
return;
}
/*
* During Fast Transition we use the authenticate event to start the
* reassociation step because the FTE necessary before we can build
@ -1650,6 +1660,8 @@ static void netdev_authenticate_event(struct l_genl_msg *msg,
}
}
is_rsn = hs->own_ie != NULL;
/*
* In an RSN, check for an RSNE containing the PMK-R0-Name and
* the remaining fields same as in the advertised RSNE.