aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/eapol_sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'wpa_supplicant/eapol_sm.c')
-rw-r--r--wpa_supplicant/eapol_sm.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/wpa_supplicant/eapol_sm.c b/wpa_supplicant/eapol_sm.c
index 22baa7c..ebbef7e 100644
--- a/wpa_supplicant/eapol_sm.c
+++ b/wpa_supplicant/eapol_sm.c
@@ -1033,7 +1033,8 @@ int eapol_sm_get_status(struct eapol_sm *sm, char *buf, size_t buflen,
*/
int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen)
{
- int len;
+ size_t len;
+
if (sm == NULL)
return 0;
len = snprintf(buf, buflen,
@@ -1043,7 +1044,20 @@ int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen)
"dot1xSuppStartPeriod=%u\n"
"dot1xSuppMaxStart=%u\n"
"dot1xSuppSuppControlledPortStatus=%s\n"
- "dot1xSuppBackendPaeState=%d\n"
+ "dot1xSuppBackendPaeState=%d\n",
+ sm->SUPP_PAE_state,
+ sm->heldPeriod,
+ sm->authPeriod,
+ sm->startPeriod,
+ sm->maxStart,
+ sm->suppPortStatus == Authorized ?
+ "Authorized" : "Unauthorized",
+ sm->SUPP_BE_state);
+
+ if (len >= buflen)
+ return len;
+
+ len += snprintf(buf + len, buflen - len,
"dot1xSuppEapolFramesRx=%u\n"
"dot1xSuppEapolFramesTx=%u\n"
"dot1xSuppEapolStartFramesTx=%u\n"
@@ -1055,14 +1069,6 @@ int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen)
"dot1xSuppEapLengthErrorFramesRx=%u\n"
"dot1xSuppLastEapolFrameVersion=%u\n"
"dot1xSuppLastEapolFrameSource=" MACSTR "\n",
- sm->SUPP_PAE_state,
- sm->heldPeriod,
- sm->authPeriod,
- sm->startPeriod,
- sm->maxStart,
- sm->suppPortStatus == Authorized ?
- "Authorized" : "Unauthorized",
- sm->SUPP_BE_state,
sm->dot1xSuppEapolFramesRx,
sm->dot1xSuppEapolFramesTx,
sm->dot1xSuppEapolStartFramesTx,
@@ -1074,6 +1080,7 @@ int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen)
sm->dot1xSuppEapLengthErrorFramesRx,
sm->dot1xSuppLastEapolFrameVersion,
MAC2STR(sm->dot1xSuppLastEapolFrameSource));
+
return len;
}
@@ -1092,8 +1099,9 @@ int eapol_sm_rx_eapol(struct eapol_sm *sm, const u8 *src, const u8 *buf,
{
const struct ieee802_1x_hdr *hdr;
const struct ieee802_1x_eapol_key *key;
- int plen, data_len;
+ int data_len;
int res = 1;
+ size_t plen;
if (sm == NULL)
return 0;