int wlmMcsRateSet(WLM_MCS_RATE mcs_rate, WLM_STF_MODE stf_mode) { uint32 nrate = 0; uint stf; nrate |= mcs_rate & NRATE_RATE_MASK; nrate |= NRATE_MCS_INUSE; if (!stf_mode) { stf = 0; if ((nrate & NRATE_RATE_MASK) <= HIGHEST_SINGLE_STREAM_MCS || (nrate & NRATE_RATE_MASK) == 32) stf = NRATE_STF_SISO; /* SISO */ else stf = NRATE_STF_SDM; /* SDM */ } else stf = stf_mode; nrate |= (stf << NRATE_STF_SHIFT) & NRATE_STF_MASK; if (wlu_iovar_setint(irh, "nrate", (int)nrate)) { printf("wlmMcsRateSet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmRateSet(WLM_RATE rate) { char aname[] = "a_rate"; char bgname[] = "bg_rate"; char *name; switch (curBand) { case WLM_BAND_AUTO : printf("wlmRateSet: must set channel or band lock first \n"); return FALSE; case WLM_BAND_DUAL : printf("wlmRateSet: must set channel or band lock first\n"); return FALSE; case WLM_BAND_5G : name = (char *)aname; break; case WLM_BAND_2G : name = (char *)bgname; break; default : return FALSE; } rate = htod32(rate); if (wlu_iovar_setint(irh, name, rate)) { printf("wlmRateSet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmFastTimerSet(int val) { if (wlu_iovar_setint(irh, "fast_timer", val)) { printf("wlmFastTimerSet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmSlowTimerSet(int val) { if (wlu_iovar_setint(irh, "slow_timer", val)) { printf("wlmGlacialTimerSet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmIovarIntegerSet(const char *iovar, int val) { if (wlu_iovar_setint(irh, iovar, val)) { printf("wlmIovarIntegerSet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmMimoPreambleSet(int type) { if (wlu_iovar_setint(irh, "mimo_preamble", type)) { printf("wlmMimoPreambleSet(): %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmSequenceDelay(int msec) { if (wlu_iovar_setint(irh, "seq_delay", msec)) { printf("wlmSequenceDelay: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmMinPowerConsumption(int enable) { if (wlu_iovar_setint(irh, "mpc", enable)) { printf("wlmMinPowerConsumption: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wlmTxPowerSet(int powerValue) { int newValue = 0; if (powerValue == -1) { newValue = 127; /* Max val of 127 qdbm */ } else { /* expected to be in units of quarter dBm */ newValue = powerValue / 250; newValue |= WL_TXPWR_OVERRIDE; } if (wlu_iovar_setint(irh, "qtxpower", newValue)) { printf("wlmTxPowerSet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wl_bssload(void *wl, int enable) { return wlu_iovar_setint(wl, "bssload", enable); }
int wl_dls_reject(void *wl, int enable) { return wlu_iovar_setint(wl, "dls_reject", enable); }
int wl_wnm(void *wl, int mask) { return wlu_iovar_setint(wl, "wnm", mask); }
int wl_dls(void *wl, int enable) { return wlu_iovar_setint(wl, "dls", enable); }
int wl_probresp_sw(void *wl, int enable) { return wlu_iovar_setint(wl, "probresp_sw", enable); }
int wl_interworking(void *wl, int enable) { return wlu_iovar_setint(wl, "interworking", enable); }
int wl_pmf(void *wl, int mode) { return wlu_iovar_setint(wl, "mfp", mode); }
int wl_p2p_disc(void *wl, int enable) { return wlu_iovar_setint(wl, "p2p_disc", enable); }
int wl_grat_arp(void *wl, int enable) { return wlu_iovar_setint(wl, "grat_arp", enable); }
int wl_gtk_per_sta(void *wl, int enable) { return wlu_iovar_setint(wl, "gtk_per_sta", enable); }
int wl_block_ping(void *wl, int enable) { return wlu_iovar_setint(wl, "block_ping", enable); }
int wl_block_sta(void *wl, int enable) { return wlu_iovar_setint(wl, "block_sta", enable); }
int wl_block_tdls(void *wl, int enable) { return wlu_iovar_setint(wl, "block_tdls", enable); }
int wl_proxy_arp(void *wl, int enable) { return wlu_iovar_setint(wl, "proxy_arp", enable); }
int wl_ap_isolate(void *wl, int enable) { return wlu_iovar_setint(wl, "ap_isolate", enable); }
int wl_dhcp_unicast(void *wl, int enable) { return wlu_iovar_setint(wl, "dhcp_unicast", enable); }
int wl_block_multicast(void *wl, int enable) { return wlu_iovar_setint(wl, "block_multicast", enable); }
int wlmSecuritySet(WLM_AUTH_TYPE authType, WLM_AUTH_MODE authMode, WLM_ENCRYPTION encryption, const char *key) { int length = 0; int wpa_auth; int sup_wpa; int primary_key = 0; wl_wsec_key_t wepKey[4]; wsec_pmk_t psk; int wsec; if (encryption != WLM_ENCRYPT_NONE && key == 0) { printf("wlmSecuritySet: invalid key\n"); return FALSE; } if (key) { length = strlen(key); } switch (encryption) { case WLM_ENCRYPT_NONE: wpa_auth = WPA_AUTH_DISABLED; sup_wpa = 0; break; case WLM_ENCRYPT_WEP: { int i; int len = length / 4; wpa_auth = WPA_AUTH_DISABLED; sup_wpa = 0; if (!(length == 40 || length == 104 || length == 128 || length == 256)) { printf("wlmSecuritySet: invalid WEP key length %d" " - expect 40, 104, 128, or 256" " (i.e. 10, 26, 32, or 64 for each of 4 keys)\n", length); return FALSE; } /* convert hex key string to 4 binary keys */ for (i = 0; i < 4; i++) { wl_wsec_key_t *k = &wepKey[i]; const char *data = &key[i * len]; unsigned int j; memset(k, 0, sizeof(*k)); k->index = i; k->len = len / 2; for (j = 0; j < k->len; j++) { char hex[] = "XX"; char *end = NULL; strncpy(hex, &data[j * 2], 2); k->data[j] = (char)strtoul(hex, &end, 16); if (*end != 0) { printf("wlmSecuritySet: invalid WEP key" " - expect hex values\n"); return FALSE; } } switch (k->len) { case 5: k->algo = CRYPTO_ALGO_WEP1; break; case 13: k->algo = CRYPTO_ALGO_WEP128; break; case 16: k->algo = CRYPTO_ALGO_AES_CCM; break; case 32: k->algo = CRYPTO_ALGO_TKIP; break; default: /* invalid */ return FALSE; } k->flags |= WL_PRIMARY_KEY; } break; } case WLM_ENCRYPT_TKIP: case WLM_ENCRYPT_AES: { if (authMode != WLM_WPA_AUTH_PSK && authMode != WLM_WPA2_AUTH_PSK) { printf("wlmSecuritySet: authentication mode must be WPA PSK or WPA2 PSK\n"); return FALSE; } wpa_auth = authMode; sup_wpa = 1; if (length < WSEC_MIN_PSK_LEN || length > WSEC_MAX_PSK_LEN) { printf("wlmSecuritySet: passphrase must be between %d and %d characters\n", WSEC_MIN_PSK_LEN, WSEC_MAX_PSK_LEN); return FALSE; } psk.key_len = length; psk.flags = WSEC_PASSPHRASE; memcpy(psk.key, key, length); break; } case WLM_ENCRYPT_WSEC: case WLM_ENCRYPT_FIPS: default: printf("wlmSecuritySet: encryption not supported\n"); return FALSE; } if (wlu_iovar_setint(irh, "auth", authType)) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } if (wlu_iovar_setint(irh, "wpa_auth", wpa_auth)) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } if (wlu_iovar_setint(irh, "sup_wpa", sup_wpa)) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } if (encryption == WLM_ENCRYPT_WEP) { int i; for (i = 0; i < 4; i++) { wl_wsec_key_t *k = &wepKey[i]; k->index = htod32(k->index); k->len = htod32(k->len); k->algo = htod32(k->algo); k->flags = htod32(k->flags); if (wlu_set(irh, WLC_SET_KEY, k, sizeof(*k))) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } } primary_key = htod32(primary_key); if (wlu_set(irh, WLC_SET_KEY_PRIMARY, &primary_key, sizeof(primary_key)) < 0) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } } else if (encryption == WLM_ENCRYPT_TKIP || encryption == WLM_ENCRYPT_AES) { psk.key_len = htod16(psk.key_len); psk.flags = htod16(psk.flags); if (wlu_set(irh, WLC_SET_WSEC_PMK, &psk, sizeof(psk))) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } } wsec = htod32(encryption); if (wlu_set(irh, WLC_SET_WSEC, &wsec, sizeof(wsec)) < 0) { printf("wlmSecuritySet: %s\n", wlmLastError()); return FALSE; } return TRUE; }
int wl_tdls_enable(void *wl, int enable) { return wlu_iovar_setint(wl, "tdls_enable", enable); }