mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-05-02 14:07:31 +02:00
netdev: Allow to send extra vendor IEs when connecting
This commit is contained in:
parent
79a9fdf123
commit
f57ba70235
21
src/netdev.c
21
src/netdev.c
@ -2221,11 +2221,13 @@ static void netdev_fils_tx_associate(struct iovec *iov, size_t iov_len,
|
|||||||
static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
|
static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
|
||||||
struct scan_bss *bss,
|
struct scan_bss *bss,
|
||||||
struct handshake_state *hs,
|
struct handshake_state *hs,
|
||||||
const uint8_t *prev_bssid)
|
const uint8_t *prev_bssid,
|
||||||
|
struct iovec *vendor_ies,
|
||||||
|
size_t num_vendor_ies)
|
||||||
{
|
{
|
||||||
uint32_t auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
|
uint32_t auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
|
||||||
struct l_genl_msg *msg;
|
struct l_genl_msg *msg;
|
||||||
struct iovec iov[4];
|
struct iovec iov[4 + num_vendor_ies];
|
||||||
int iov_elems = 0;
|
int iov_elems = 0;
|
||||||
bool is_rsn = hs->supplicant_ie != NULL;
|
bool is_rsn = hs->supplicant_ie != NULL;
|
||||||
const uint8_t *extended_capabilities;
|
const uint8_t *extended_capabilities;
|
||||||
@ -2329,6 +2331,12 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev,
|
|||||||
iov[iov_elems].iov_len = extended_capabilities[1] + 2;
|
iov[iov_elems].iov_len = extended_capabilities[1] + 2;
|
||||||
iov_elems += 1;
|
iov_elems += 1;
|
||||||
|
|
||||||
|
if (vendor_ies) {
|
||||||
|
memcpy(iov + iov_elems, vendor_ies,
|
||||||
|
sizeof(*vendor_ies) * num_vendor_ies);
|
||||||
|
iov_elems += num_vendor_ies;
|
||||||
|
}
|
||||||
|
|
||||||
if (iov_elems)
|
if (iov_elems)
|
||||||
l_genl_msg_append_attrv(msg, NL80211_ATTR_IE, iov, iov_elems);
|
l_genl_msg_append_attrv(msg, NL80211_ATTR_IE, iov, iov_elems);
|
||||||
|
|
||||||
@ -2379,6 +2387,8 @@ static int netdev_connect_common(struct netdev *netdev,
|
|||||||
|
|
||||||
int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
|
int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
|
||||||
struct handshake_state *hs,
|
struct handshake_state *hs,
|
||||||
|
struct iovec *vendor_ies,
|
||||||
|
size_t num_vendor_ies,
|
||||||
netdev_event_func_t event_filter,
|
netdev_event_func_t event_filter,
|
||||||
netdev_connect_cb_t cb, void *user_data)
|
netdev_connect_cb_t cb, void *user_data)
|
||||||
{
|
{
|
||||||
@ -2413,7 +2423,8 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
|
|||||||
netdev);
|
netdev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cmd_connect = netdev_build_cmd_connect(netdev, bss, hs, NULL);
|
cmd_connect = netdev_build_cmd_connect(netdev, bss, hs,
|
||||||
|
NULL, vendor_ies, num_vendor_ies);
|
||||||
|
|
||||||
if (!cmd_connect)
|
if (!cmd_connect)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -2447,7 +2458,7 @@ int netdev_connect_wsc(struct netdev *netdev, struct scan_bss *bss,
|
|||||||
if (netdev->connected)
|
if (netdev->connected)
|
||||||
return -EISCONN;
|
return -EISCONN;
|
||||||
|
|
||||||
cmd_connect = netdev_build_cmd_connect(netdev, bss, hs, NULL);
|
cmd_connect = netdev_build_cmd_connect(netdev, bss, hs, NULL, NULL, 0);
|
||||||
if (!cmd_connect)
|
if (!cmd_connect)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -2536,7 +2547,7 @@ int netdev_reassociate(struct netdev *netdev, struct scan_bss *target_bss,
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
cmd_connect = netdev_build_cmd_connect(netdev, target_bss, hs,
|
cmd_connect = netdev_build_cmd_connect(netdev, target_bss, hs,
|
||||||
orig_bss->addr);
|
orig_bss->addr, NULL, 0);
|
||||||
if (!cmd_connect)
|
if (!cmd_connect)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -146,6 +146,8 @@ struct handshake_state *netdev_get_handshake(struct netdev *netdev);
|
|||||||
|
|
||||||
int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
|
int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
|
||||||
struct handshake_state *hs,
|
struct handshake_state *hs,
|
||||||
|
struct iovec *vendor_ies,
|
||||||
|
size_t num_vendor_ies,
|
||||||
netdev_event_func_t event_filter,
|
netdev_event_func_t event_filter,
|
||||||
netdev_connect_cb_t cb, void *user_data);
|
netdev_connect_cb_t cb, void *user_data);
|
||||||
int netdev_connect_wsc(struct netdev *netdev, struct scan_bss *bss,
|
int netdev_connect_wsc(struct netdev *netdev, struct scan_bss *bss,
|
||||||
|
@ -2160,8 +2160,9 @@ int __station_connect_network(struct station *station, struct network *network,
|
|||||||
if (!hs)
|
if (!hs)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
r = netdev_connect(station->netdev, bss, hs, station_netdev_event,
|
r = netdev_connect(station->netdev, bss, hs, NULL, 0,
|
||||||
station_connect_cb, station);
|
station_netdev_event, station_connect_cb,
|
||||||
|
station);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
handshake_state_free(hs);
|
handshake_state_free(hs);
|
||||||
return r;
|
return r;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user