net/wapi: remove unnecessary cast

This commit is contained in:
chao.an 2020-02-19 20:50:02 +08:00 committed by Ouss4
parent ae36b6f8a9
commit ee615f0568
4 changed files with 10 additions and 14 deletions

View File

@ -255,8 +255,8 @@ struct wpa_wconfig_s
uint8_t ssidlen; /* Length of the SSID */
uint8_t phraselen; /* Length of the passphrase */
FAR const char *ifname; /* E.g., "wlan0" */
FAR const uint8_t *ssid; /* E.g., "myApSSID" */
FAR const uint8_t *passphrase; /* E.g., "mySSIDpassphrase" */
FAR const char *ssid; /* E.g., "myApSSID" */
FAR const char *passphrase; /* E.g., "mySSIDpassphrase" */
};
/****************************************************************************
@ -678,7 +678,7 @@ int wapi_scan_coll(int sock, FAR const char *ifname,
****************************************************************************/
int wpa_driver_wext_set_key_ext(int sockfd, FAR const char *ifname,
enum wpa_alg_e alg, FAR const uint8_t *key,
enum wpa_alg_e alg, FAR const char *key,
size_t key_len);
/****************************************************************************

View File

@ -59,8 +59,6 @@
int netinit_associate(FAR const char *ifname)
{
static const char ssid[] = CONFIG_NETINIT_WAPI_SSID;
static const char passphrase[] = CONFIG_NETINIT_WAPI_PASSPHRASE;
struct wpa_wconfig_s wconfig;
int ret;
@ -70,12 +68,12 @@ int netinit_associate(FAR const char *ifname)
wconfig.auth_wpa = CONFIG_NETINIT_WAPI_AUTHWPA;
wconfig.cipher_mode = CONFIG_NETINIT_WAPI_CIPHERMODE;
wconfig.alg = CONFIG_NETINIT_WAPI_ALG;
wconfig.ssid = CONFIG_NETINIT_WAPI_SSID;
wconfig.passphrase = CONFIG_NETINIT_WAPI_PASSPHRASE;
wconfig.ifname = ifname;
wconfig.ssid = (FAR const uint8_t *)ssid;
wconfig.passphrase = (FAR const uint8_t *)passphrase;
wconfig.ssidlen = strlen(ssid);
wconfig.phraselen = strlen(passphrase);
wconfig.ssidlen = strlen(wconfig.ssid);
wconfig.phraselen = strlen(wconfig.passphrase);
/* Associate */

View File

@ -83,7 +83,7 @@
****************************************************************************/
int wpa_driver_wext_set_key_ext(int sockfd, FAR const char *ifname,
enum wpa_alg_e alg, FAR const uint8_t *key,
enum wpa_alg_e alg, FAR const char *key,
size_t key_len)
{
struct iwreq iwr;
@ -217,8 +217,7 @@ int wpa_driver_wext_associate(FAR struct wpa_wconfig_s *wconfig)
goto close_socket;
}
ret = wapi_set_essid(sockfd, wconfig->ifname,
(FAR const char *)wconfig->ssid, WAPI_ESSID_ON);
ret = wapi_set_essid(sockfd, wconfig->ifname, wconfig->ssid, WAPI_ESSID_ON);
if (ret < 0)
{
nerr("ERROR: Fail set ssid: %d\n", ret);

View File

@ -535,8 +535,7 @@ static void wapi_psk_cmd(int sock, FAR const char *ifname,
/* Set the Passphrase */
ret = wpa_driver_wext_set_key_ext(sock, ifname, alg_flag,
(FAR const uint8_t *)passphrase,
strlen(passphrase));
passphrase, strlen(passphrase));
if (ret < 0)
{
WAPI_ERROR("ERROR: wpa_driver_wext_set_key_ext() failed: %d\n", ret);