eapol: Use switch-case instead of if
The if statement was shorter, but a bit less readable.
This commit is contained in:
parent
a22e3394fc
commit
abc44fe98a
|
@ -202,10 +202,13 @@ const struct eapol_key *eapol_key_validate(const uint8_t *frame, size_t len)
|
||||||
|
|
||||||
ek = (const struct eapol_key *) frame;
|
ek = (const struct eapol_key *) frame;
|
||||||
|
|
||||||
if (ek->header.protocol_version != EAPOL_PROTOCOL_VERSION_2001 &&
|
switch (ek->header.protocol_version) {
|
||||||
ek->header.protocol_version !=
|
case EAPOL_PROTOCOL_VERSION_2001:
|
||||||
EAPOL_PROTOCOL_VERSION_2004)
|
case EAPOL_PROTOCOL_VERSION_2004:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (ek->header.packet_type != 3)
|
if (ek->header.packet_type != 3)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue