diff mbox series

[3/5] Update eapol_test to accept and count Protocol-Error

Message ID 20261021144744.41835-4-aland@deployingradius.com
State New
Headers show
Series [1/5] Define Protocol-Error packet type | expand

Commit Message

Alan DeKok Oct. 21, 2026, 2:46 p.m. UTC
From: "Alan T. DeKok" <aland@freeradius.org>

Signed-off-by: Alan DeKok <alan.dekok@inkbridge.io>
---
 wpa_supplicant/eapol_test.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c
index aba4d7f10..504178591 100644
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -66,6 +66,7 @@  struct eapol_test_data {
 	size_t authenticator_eap_key_name_len;
 	int radius_access_accept_received;
 	int radius_access_reject_received;
+	int radius_protocol_error_received;
 	int auth_timed_out;
 
 	u8 *eap_identity;
@@ -939,7 +940,8 @@  ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
 
 	if (hdr->code != RADIUS_CODE_ACCESS_ACCEPT &&
 	    hdr->code != RADIUS_CODE_ACCESS_REJECT &&
-	    hdr->code != RADIUS_CODE_ACCESS_CHALLENGE) {
+	    hdr->code != RADIUS_CODE_ACCESS_CHALLENGE &&
+	    hdr->code != RADIUS_CODE_PROTOCOL_ERROR) {
 		wpa_printf(MSG_INFO, "Unknown RADIUS message code");
 		return RADIUS_RX_UNKNOWN;
 	}
@@ -959,13 +961,17 @@  ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
 	case RADIUS_CODE_ACCESS_REJECT:
 		e->radius_access_reject_received = 1;
 		break;
+	case RADIUS_CODE_PROTOCOL_ERROR:
+		e->radius_protocol_error_received = 1;
+		break;
 	}
 
 	ieee802_1x_decapsulate_radius(e);
 
 	if ((hdr->code == RADIUS_CODE_ACCESS_ACCEPT &&
 	     e->eapol_test_num_reauths < 0) ||
-	    hdr->code == RADIUS_CODE_ACCESS_REJECT) {
+	    hdr->code == RADIUS_CODE_ACCESS_REJECT ||
+	    hdr->code == RADIUS_CODE_PROTOCOL_ERROR) {
 		if (!e->ctrl_iface)
 			eloop_terminate();
 	}
@@ -1598,6 +1604,8 @@  int main(int argc, char *argv[])
 		ret = -2;
 	if (eapol_test.radius_access_reject_received)
 		ret = -3;
+	if (eapol_test.radius_protocol_error_received)
+		ret = -4;
 
 	if (save_config)
 		wpa_config_write(conf, wpa_s.conf);