/**
 * reload_iface2 - Part 2 of reload_iface
 * @hapd_iface: Pointer to hostapd interface data.
 */
static void reload_iface2(struct hostapd_iface *hapd_iface)
{
	struct hostapd_data *hapd = hapd_iface->bss[0];
	struct hostapd_config *newconf = hapd_iface->change->newconf;
	struct hostapd_config *oldconf = hapd_iface->change->oldconf;
	int beacon_changed = hapd_iface->change->beacon_changed;
	hostapd_iface_cb cb = hapd_iface->reload_iface_cb;

	if (newconf->preamble != oldconf->preamble) {
		if (hostapd_set_preamble(hapd, hapd->iconf->preamble))
			printf("Could not set preamble for kernel driver\n");
		beacon_changed++;
	}

	if (newconf->beacon_int != oldconf->beacon_int) {
		/* Need to change beacon interval if it has changed or if
		 * auto channel selection was used. */
		if (hostapd_set_beacon_int(hapd, newconf->beacon_int))
			printf("Could not set beacon interval for kernel "
			       "driver\n");
		if (newconf->beacon_int != oldconf->beacon_int)
			beacon_changed++;
	}

	if (newconf->cts_protection_type != oldconf->cts_protection_type)
		beacon_changed++;

	if (newconf->rts_threshold > -1 &&
	    newconf->rts_threshold != oldconf->rts_threshold &&
	    hostapd_set_rts(hapd, newconf->rts_threshold))
		printf("Could not set RTS threshold for kernel driver\n");

	if (newconf->fragm_threshold > -1 &&
	    newconf->fragm_threshold != oldconf->fragm_threshold &&
	    hostapd_set_frag(hapd, newconf->fragm_threshold))
		printf("Could not set fragmentation threshold for kernel "
		       "driver\n");

	hostapd_reconfig_tx_queue_params(hapd, newconf, oldconf);

	if (hostapd_reconfig_wme(hapd, newconf, oldconf) > 0)
		beacon_changed++;

	ap_list_reconfig(hapd_iface, oldconf);

	hapd_iface->change->beacon_changed = beacon_changed;

	hapd_iface->reload_iface_cb = NULL;
	cb(hapd_iface, 0);
}
void SET_FRAG_handle(int fd, u8 *buf, int len, void *hapd){
	struct hostapd_data *h = hapd;
	u8 tmp[MAX_BUF];
	memcpy(tmp,buf,len);
	tmp[len] = 0;

	int frag = atoi(tmp);
	wpa_printf(MSG_DEBUG, "SER FRAQ: %d",frag);
	wl.frag = frag;
	
	int ret = hostapd_set_frag(h, frag);
	u8 ret_str[10];
	sprintf(ret_str, "%d", ret);
	send_response(fd, SET_FRAG_R, ret_str, strlen(ret_str)); 
}