WPS EAP fragmentation support for 60 GHz

Add support for forcing EAP fragmentation. It is needed in some 60 GHz
WPS tests.

Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
diff --git a/ap.c b/ap.c
index ac9d2a1..2d37062 100644
--- a/ap.c
+++ b/ap.c
@@ -1454,6 +1454,10 @@
 		dut->wsc_fragment = 1;
 	}
 
+	val = get_param(cmd, "WscEAPFragment");
+	if (val && strcasecmp(val, "enable") == 0)
+		dut->eap_fragment = 1;
+
 	val = get_param(cmd, "MSDUSize");
 	if (val) {
 		int mtu;
@@ -7284,6 +7288,8 @@
 			fprintf(f, "device_name=QCA AP\n"
 				"manufacturer=QCA\n");
 		}
+		if (dut->eap_fragment)
+			fprintf(f, "fragment_size=128\n");
 	}
 
 	if (dut->program == PROGRAM_VHT) {
@@ -7931,6 +7937,7 @@
 	dut->ap_pmf = AP_PMF_DISABLED;
 
 	dut->wsc_fragment = 0;
+	dut->eap_fragment = 0;
 
 	if (dut->program == PROGRAM_HT || dut->program == PROGRAM_VHT) {
 		dut->ap_wme = AP_WME_ON;
diff --git a/sigma_dut.h b/sigma_dut.h
index 72d31b0..fad77c4 100644
--- a/sigma_dut.h
+++ b/sigma_dut.h
@@ -736,6 +736,7 @@
 
 	int wps_disable; /* Used for 60G to disable PCP from sending WPS IE */
 	int wsc_fragment; /* simulate WSC IE fragmentation */
+	int eap_fragment; /* simulate EAP fragmentation */
 	enum {
 		/* no change */
 		FORCE_RSN_IE_NONE = 0,
diff --git a/sta.c b/sta.c
index 40832b3..7989b69 100644
--- a/sta.c
+++ b/sta.c
@@ -3223,6 +3223,10 @@
 			dut->force_rsn_ie = FORCE_RSN_IE_ADD;
 	}
 
+	val = get_param(cmd, "WscEAPFragment");
+	if (val && strcasecmp(val, "enable") == 0)
+		dut->eap_fragment = 1;
+
 	return 1;
 }
 
@@ -5318,6 +5322,13 @@
 		return ERROR_SEND_STATUS;
 	}
 
+	if (dut->eap_fragment) {
+		sigma_dut_print(dut, DUT_MSG_DEBUG,
+				"Set EAP fragment size to 128 bytes.");
+		if (set_network(ifname, net_id, "fragment_size", "128") < 0)
+			return ERROR_SEND_STATUS;
+	}
+
 	sigma_dut_print(dut, DUT_MSG_DEBUG,
 			"Supplicant set network with frequency");