wapi: Extend "WAPI_ESSID_DELAY_ON" flag to support customized connection behavior

The current essid setting(SIOCSIWESSID) are not satisfactory in case
of specified bssid connection, if there are multiple essids with same name,
we need additional bssid information to connect to the specified softap.
The extended flag "WAPI_ESSID_DELAY_ON" instructs the driver to delay the
connection behavior of essid, so that which can accept more accurate
information before generating a connection.

About flow of wapi command, drivers that support WAPI_ESSID_DELAY_ON semantics
will have the following behavior changes:

1. Station mode without bssid set:

$ ifup wlan0
$ wapi mode wlan0 2
$ wapi psk wlan0 12345678 3
$ wapi essid wlan0 archer 1
$ renew wlan0

2. Station mode with bssid set:

$ ifup wlan0
$ wapi mode wlan0 2
$ wapi psk wlan0 12345678 3
$ wapi essid wlan0 archer 2       <----- WAPI_ESSID_DELAY_ON will indicate the driver delay
$                                        the connection event late to bssid set (SIOCSIWAP).
$ wapi ap wlan0 ec:41:18:e0:76:7e
$ renew wlan0

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-01-19 16:56:20 +08:00 committed by Xiang Xiao
parent a53f2ad270
commit 623a668baa
2 changed files with 31 additions and 2 deletions

View File

@ -126,7 +126,36 @@ enum wapi_route_target_e
enum wapi_essid_flag_e
{
WAPI_ESSID_OFF,
WAPI_ESSID_ON
WAPI_ESSID_ON,
/* Extended flag "WAPI_ESSID_DELAY_ON" instructs the driver
* to delay the connection behavior of essid, so that which can accept
* more accurate information before generating a connection.
*
* About flow of wapi command, drivers that support WAPI_ESSID_DELAY_ON
* semantics will have the following behavior changes:
*
* 1. Station mode without bssid set:
*
* $ ifup wlan0
* $ wapi mode wlan0 2
* $ wapi psk wlan0 12345678 3
* $ wapi essid wlan0 archer 1
* $ renew wlan0
*
* 2. Station mode with bssid set:
*
* $ ifup wlan0
* $ wapi mode wlan0 2
* $ wapi psk wlan0 12345678 3
* $ wapi essid wlan0 archer 2 <-- WAPI_ESSID_DELAY_ON will indicate the
* $ driver delay the connection event late
* $ to bssid set (SIOCSIWAP).
* $ wapi ap wlan0 ec:41:18:e0:76:7e
* $ renew wlan0
*/
WAPI_ESSID_DELAY_ON
};
/* Supported operation modes. */

View File

@ -740,7 +740,7 @@ int wapi_set_essid(int sock, FAR const char *ifname, FAR const char *essid,
wrq.u.essid.pointer = buf;
wrq.u.essid.length =
snprintf(buf, ((WAPI_ESSID_MAX_SIZE + 1) * sizeof(char)), "%s", essid);
wrq.u.essid.flags = (flag == WAPI_ESSID_ON);
wrq.u.essid.flags = flag;
strncpy(wrq.ifr_name, ifname, IFNAMSIZ);
ret = ioctl(sock, SIOCSIWESSID, (unsigned long)((uintptr_t)&wrq));