mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:22:51 +01:00
wsc: Replace netdev_connect_wsc with netdev_connect usage
netdev_connect can achieve the same effect as netdev_connect_wsc but is more flexible as it allows us to supply additional association IEs. We will need this capability to make P2P connections. This way we're also moving the WSC-specific bits to wsc.c from the crowded netdev.c.
This commit is contained in:
parent
0651c2c430
commit
6d3ae88a21
@ -2502,7 +2502,7 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
|
|||||||
if (!cmd_connect)
|
if (!cmd_connect)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (is_rsn)
|
if (is_rsn || hs->settings_8021x)
|
||||||
sm = eapol_sm_new(hs);
|
sm = eapol_sm_new(hs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
46
src/wsc.c
46
src/wsc.c
@ -360,12 +360,6 @@ static void wsc_credential_obtained(struct wsc *wsc,
|
|||||||
wsc->n_creds += 1;
|
wsc->n_creds += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wsc_eapol_event(uint32_t event, const void *event_data,
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
l_debug("Got event: %d", event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void wsc_netdev_event(struct netdev *netdev, enum netdev_event event,
|
static void wsc_netdev_event(struct netdev *netdev, enum netdev_event event,
|
||||||
void *event_data, void *user_data)
|
void *event_data, void *user_data)
|
||||||
{
|
{
|
||||||
@ -448,6 +442,11 @@ static void wsc_connect(struct wsc *wsc)
|
|||||||
struct handshake_state *hs;
|
struct handshake_state *hs;
|
||||||
struct l_settings *settings = l_settings_new();
|
struct l_settings *settings = l_settings_new();
|
||||||
struct scan_bss *bss = wsc->target;
|
struct scan_bss *bss = wsc->target;
|
||||||
|
int r;
|
||||||
|
struct wsc_association_request request;
|
||||||
|
uint8_t *pdu;
|
||||||
|
size_t pdu_len;
|
||||||
|
struct iovec ie_iov;
|
||||||
|
|
||||||
wsc->target = NULL;
|
wsc->target = NULL;
|
||||||
|
|
||||||
@ -490,16 +489,37 @@ static void wsc_connect(struct wsc *wsc)
|
|||||||
handshake_state_set_8021x_config(hs, settings);
|
handshake_state_set_8021x_config(hs, settings);
|
||||||
wsc->eap_settings = settings;
|
wsc->eap_settings = settings;
|
||||||
|
|
||||||
if (netdev_connect_wsc(wsc->netdev, bss, hs,
|
request.version2 = true;
|
||||||
wsc_netdev_event, wsc_connect_cb,
|
request.request_type = WSC_REQUEST_TYPE_ENROLLEE_OPEN_8021X;
|
||||||
wsc_eapol_event, wsc) < 0) {
|
|
||||||
dbus_pending_reply(&wsc->pending,
|
pdu = wsc_build_association_request(&request, &pdu_len);
|
||||||
dbus_error_failed(wsc->pending));
|
if (!pdu) {
|
||||||
handshake_state_free(hs);
|
r = -ENOMEM;
|
||||||
return;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ie_iov.iov_base = ie_tlv_encapsulate_wsc_payload(pdu, pdu_len,
|
||||||
|
&ie_iov.iov_len);
|
||||||
|
l_free(pdu);
|
||||||
|
|
||||||
|
if (!ie_iov.iov_base) {
|
||||||
|
r = -ENOMEM;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = netdev_connect(wsc->netdev, bss, hs, &ie_iov, 1, wsc_netdev_event,
|
||||||
|
wsc_connect_cb, wsc);
|
||||||
|
l_free(ie_iov.iov_base);
|
||||||
|
|
||||||
|
if (r < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
wsc->wsc_association = true;
|
wsc->wsc_association = true;
|
||||||
|
return;
|
||||||
|
error:
|
||||||
|
handshake_state_free(hs);
|
||||||
|
dbus_pending_reply(&wsc->pending,
|
||||||
|
dbus_error_failed(wsc->pending));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void station_state_watch(enum station_state state, void *userdata)
|
static void station_state_watch(enum station_state state, void *userdata)
|
||||||
|
Loading…
Reference in New Issue
Block a user