Commit Graph

961 Commits

Author SHA1 Message Date
Andrew Zaborowski 061dad2ff5 Add handshake_state object
struct handshake_state is an object that stores all the key data and other
authentication state and does the low level operations on the keys.  Together
with the next patch this mostly just splits eapol.c into two layers
so that the key operations can also be used in Fast Transitions which don't
use eapol.
2016-11-03 10:23:41 -05:00
Andrew Zaborowski 19afcb3582 device: Pass FT-related data to eapol and netdev
If device_select_akm_suite selects Fast Transition association then pass
the MD IE and other bits needed for eapol and netdev to do an FT
association and 4-Way Handshake.
2016-11-03 10:15:11 -05:00
Andrew Zaborowski a35e0c2690 netdev: FT version of association messages
If an MD IE is supplied to netdev_connect, pass that MD IE in the
associate request, then validate and handle the MD IE and FT IE in the
associate response from AP.
2016-11-03 10:12:44 -05:00
Andrew Zaborowski d03f4d72f1 eapol: Handle FT-version of step 3 of 4-way handshake 2016-11-03 10:04:34 -05:00
Andrew Zaborowski 9d54a3082e eapol: Build FT-version step 2 of 4-way handshake
If an FT AKM suite is selected, build the FT version of the step 2
of the 4-way handshake frame.  Step 1 is same as non-FT version.
2016-11-03 10:03:45 -05:00
Andrew Zaborowski 0d2e5b9849 eapol: Add setters for the FT handshake input data
Add space in the eapol_sm struct for the pieces of information required
for the FT 4-Way Handshake and add setters for device.c and netdev.c to
be able to provide the data.
2016-11-03 10:01:41 -05:00
Andrew Zaborowski 67a5b68a16 device: Drop the bss->sha256 flag usage
Don't decide on the AKM suite to use when the bss entries are received
and processed, instead select the suite when the connection is triggered
using a new function device_select_akm_suite, similar to
wiphy_select_cipher().  Describing the AKM suite through flags will be
more difficult when more than 2 suites per security type are supported.
Also handle the wiphy_select_cipher 0 return value when no cipher can be
selected.
2016-11-03 10:00:35 -05:00
Andrew Zaborowski 1b99521e98 ie: Implement ie_parse_neighbor_report 2016-11-03 09:59:49 -05:00
Denis Kenzior 2340c7790c device: Avoid leaking memory
In case we bail out early when setting up the RSN element
2016-11-02 16:42:12 -05:00
Rahul Rahul e6311557fe device: set mfp and group mgmt cipher if AP supports it 2016-11-02 16:39:20 -05:00
Rahul Rahul b47c82102e network: update network_bss_select for mfp
Update network_bss_select for MFP.  Particularly the scenario when all
BSSes inside the bss_list have MFPR set, but we're not BIP capable.
2016-11-02 16:36:13 -05:00
Tim Kourt 17527d4570 main: init iwd config 2016-11-02 16:06:10 -05:00
Tim Kourt 410d34c21b iwd: Add accessor for iwd_config 2016-11-02 15:44:19 -05:00
Daniel Wagner dee6a6f082 network: Add Type property to D-Bus API 2016-11-02 10:04:24 -05:00
Daniel Wagner 6a6f3c8865 network: Add Device property to D-Bus API 2016-11-02 10:00:30 -05:00
Daniel Wagner d9f2d40f6f device: Add Adapter property to D-Bus API 2016-11-02 09:57:21 -05:00
Rahul Rahul 5e0b24dcb2 netdev: implement netdev_set_igtk 2016-10-31 09:53:04 -05:00
Andrew Zaborowski 424ceb58a3 eapol: Drop len parameter to eapol_sm_set_rsn/wpa
The len parameter was only used so it could be validated against ie[1],
but since it was not checked to be > 2, it must have been validated
already, the check was redundant.  In any case all users directly
passed ie[1] as len anyway.  This makes it consistent with the ie
parsers and builders which didn't require a length.
2016-10-29 23:09:10 -05:00
Andrew Zaborowski b29f333bb4 scan: Parse the Country String IE
and save to struct scan_bss
2016-10-29 22:58:36 -05:00
Andrew Zaborowski 1720edfc0e scan: Save Neighbor Report capability bit in bss scan entry 2016-10-29 22:57:07 -05:00
Andrew Zaborowski da435326aa scan: Save the MD IE in bss scan entry 2016-10-29 22:53:40 -05:00
Andrew Zaborowski e4c168cc3b ie: Fast BSS Transition IE utilities 2016-10-29 22:53:14 -05:00
Andrew Zaborowski b20f1a2d50 ie: Mobility Domain IE utilities 2016-10-28 11:28:21 -05:00
Denis Kenzior 90ea26bec5 netdev: Squash kernel warning
netlink: 16 bytes leftover after parsing attributes in
process `iwd'.
2016-10-28 09:27:02 -05:00
Rahul Rahul c16ae02056 eapol: refactor eapol_find_kde and add install_igtk 2016-10-26 16:34:52 -05:00
Denis Kenzior 318d3a2d35 scan: Refactor bss_get_supported_ciphers
In many cases the pairwise and group cipher information is not the only
information needed from the BSS RSN/WPA elements in order to make a
decision.  For example, th MFPC/MFPR bits might be needed, or
pre-authentication capability bits, group management ciphers, etc.

This patch refactors bss_get_supported_ciphers into the more general
scan_bss_get_rsn_info function
2016-10-24 22:12:25 -05:00
Denis Kenzior bdd676a23a wiphy: Add support for BIP in wiphy_select_cipher 2016-10-24 21:29:37 -05:00
Denis Kenzior 2899315828 wiphy: Rename pairwise_ciphers to supported_ciphers
Since the ciphers stored here are not only for pairwise, but also group
and management ciphers.
2016-10-24 21:29:03 -05:00
Denis Kenzior 13f83fda81 wiphy: Also print whether we support BIP 2016-10-24 21:25:04 -05:00
Tim Kourt 85db443b37 eap-wsc: Use header length constant for readability 2016-10-24 11:21:01 -05:00
Tim Kourt da433a1c56 eap-wsc: Clean up packet ptr ops 2016-10-24 11:18:53 -05:00
Tim Kourt 79d5353531 src: Introduce iwd.conf 2016-10-24 11:10:26 -05:00
Tim Kourt 884ef2e15f src: Rename dbus config. file
Rename dbus config. file to avoid future configuration with the IWD
config. file.
2016-10-24 11:10:23 -05:00
Marcel Holtmann 88909947e2 build: Remove support for usage of kdbus 2016-10-16 19:41:27 +02:00
Denis Kenzior cc2052d33e eapol: In case of timeout, mark as NULL 2016-10-15 16:26:41 -05:00
Andrew Zaborowski c548898635 eapol: Cache early EAPoL frames until ready to process
Split eapol_start into two calls, one to register the state machine so
that the PAE read handler knows not to discard frames for that ifindex,
and eapol_start to actually start processing the frames.  This is needed
because, as per the comment in netdev.c, due to scheduling the PAE
socket read handler may trigger before the CMD_CONNECT event handler,
which needs to parse the FTE from the Associate Response frame and
supply it to the eapol SM before it can do anything with the message 1
of 4 of the FT handshake.

Another issue is that depending on the driver or timing, the underlying
link might not be marked as 'ready' by the kernel.  In this case, our
response to Message 1 of the 4-way Handshake is written and accepted by
the kernel, but gets dropped on the floor internally.  Which leads to
timeouts if the AP doesn't retransmit.
2016-10-15 16:25:37 -05:00
Denis Kenzior d8cb8d7810 eapol: Default to EAPoL 2001 if unset
If protocol auto-detection is enabled (e.g. protocol_version is zero),
default to EAPOL 2001 version for EAPOL-Start messages.
2016-10-11 02:33:46 -05:00
Denis Kenzior d1d08a33ab wsc: Treat disconnect_by_ap as handshake_failed 2016-10-11 01:54:32 -05:00
Denis Kenzior eaee379e53 netdev: Allow disconnect_by_ap to be re-entrant 2016-10-11 01:53:59 -05:00
Denis Kenzior 30b7b46aa1 wsc: Tell eapol that EAPOL-Start might be needed 2016-10-11 01:36:59 -05:00
Denis Kenzior 91d35987fd eapol: Add provision to use EAPOL-Start 2016-10-11 01:36:48 -05:00
Denis Kenzior a16abfdc92 network: Don't fail if network config file exists 2016-10-10 15:59:36 -05:00
Denis Kenzior e7e6326179 device: honor autoconnect in device_disassociated 2016-10-10 15:38:03 -05:00
Denis Kenzior 8242e9b9aa device: on connect error use network_connect_failed 2016-10-10 14:53:01 -05:00
Denis Kenzior 63e11979ee network: free/zero psk in network_settings_close 2016-10-10 14:52:43 -05:00
Marcel Holtmann e72b2f8daf util: Include sys/uio.h for struct iovec 2016-10-10 20:42:48 +02:00
Andrew Zaborowski 92bc1d6896 scan: Implement scan_oper_class_to_band
This function takes an Operating Channel and a Country String to convert
it into a band.  Using scan_oper_class_to_band and scan_channel_to_freq,
an Operating Channel, a Country String and a Channel Number together can
be converted into an actual frequency.  EU and US country codes based on
wpa_supplicant's tables.
2016-10-04 21:34:24 -05:00
Andrew Zaborowski 859dcf0d59 scan: Implement scan_freq_set_foreach 2016-10-04 15:15:51 -05:00
Andrew Zaborowski c4941a82a4 scan: Implement scan_channel_to_freq
This function does the inverse of scan_freq_to_channel
2016-10-04 15:15:51 -05:00
Andrew Zaborowski 911aebc844 scan: Fix the supported rates factor in bss ranking 2016-10-04 14:20:01 -05:00
Andrew Zaborowski 09861f4ebe eapol: Free the checksum in eapol_verify_mic 2016-10-04 14:11:42 -05:00
Andrew Zaborowski 721be04f95 eapol: Pass actual PTK size to crypto_derive_pairwise_ptk()
It doesn't matter for crypto_derive_pairwise_ptk in non-SHA256 mode
but in the FT PTK derivation function, as well as in SHA256 mode all
bytes of the output do actually change with the PTK size.
2016-10-04 14:10:23 -05:00
Andrew Zaborowski 7b20f57239 network: Fix autoconnect candidate logic
Fix autoconnect trying to connect to networks never used before as found
by Tim Kourt.  Update the comments to be consistent with the use of the
is_known field and the docs, in that a Known Network is any network that
has a config file in the iwd storage, and an autoconnect candidate is a
network that has been connected to before.
2016-09-27 11:52:07 -05:00
Denis Kenzior 0eea6ad4b7 netdev: Make sure to set disconnect_cmd_id to 0 2016-09-22 21:16:19 -05:00
Denis Kenzior a51ae8ce0e wsc: Let Cancel() abort WSC associations as well 2016-09-22 21:16:19 -05:00
Denis Kenzior efd4b3462a wsc: trigger autoconnect if no useful credential 2016-09-22 21:16:17 -05:00
Denis Kenzior a6cad89fbe netdev: Start eapol earlier 2016-09-22 17:34:27 -05:00
Denis Kenzior 5329ddceb8 netdev: Tweak netdev_disconnect semantics
If the handshake fails, we trigger a deauthentication prior to reporting
NETDEV_RESULT_HANDSHAKE_FAILED.  If a netdev_disconnect is invoked in
the meantime, then the caller will receive -ENOTCONN.  This is
incorrect, since we are in fact logically connected until the connect_cb
is notified.

Tweak the behavior to keep the connected variable as true, but check
whether disconnect_cmd_id has been issued in the netdev_disconnect_event
callback.
2016-09-22 17:23:49 -05:00
Denis Kenzior 9c2d61db2c wsc: Optionally disconnect before starting EAP-WSC
If the device is currently connected, we will initiate a disconnection
(or wait for the disconnection to complete) prior to starting the
WSC-EAP association.
2016-09-22 16:29:19 -05:00
Denis Kenzior 9a63ab6712 netdev: Make invoking disconnect_cb reentrant safe 2016-09-22 16:20:33 -05:00
Denis Kenzior 886ffc2edb netdev: keep track of operational state
We should not attempt to call connect_failed if we're have become
operational.  E.g. successfully associated, ran eapol if necessary and
set operstate.
2016-09-22 16:19:30 -05:00
Denis Kenzior 2d87556b6b device: destroy state watchlist after removed event 2016-09-22 15:28:56 -05:00
Denis Kenzior 42d26089e9 watchlist: Make re-entrant safe 2016-09-22 15:28:29 -05:00
Denis Kenzior d2ccc367ef device: modify autoconnect behavior
In case Disconnect() is called for any reason, make sure autoconnect is
off.  Set autoconnect to true whenever we successfully connect.
2016-09-22 15:28:14 -05:00
Denis Kenzior a766823ffc device: Make scanning into a bitfield 2016-09-22 13:48:05 -05:00
Denis Kenzior ecacdd88e4 device: Add device_get_state 2016-09-22 13:48:05 -05:00
Denis Kenzior 1585ccc897 netdev: Return -EINPROGRESS if already disconnecting 2016-09-22 11:55:32 -05:00
Denis Kenzior 47fa0435ba wsc: Start walk timer
PBC mode mandates a 120-second walk timer.  The PBC transaction must be
completed within that time or be aborted.
2016-09-22 11:32:18 -05:00
Andrew Zaborowski 0ffec2e481 dbus: Switch to using org.freedesktop.DBus.Properties
Use the org.freedesktop.DBus.Properties interfaces on objects with
properties and drop the old style GetProperty/SetProperty methods on
individual interfaces.  Agent and KnownNetworks have no properties at
this time so don't add org.freedesktop.DBus.Properties interfaces.
2016-09-21 16:46:34 -05:00
Andrew Zaborowski c6e38dacac scan: Zero destroy callback in scan_cancel
Otherwise it may be called again in get_scan_done.
2016-09-21 16:39:05 -05:00
Denis Kenzior 31ba824acc wsc: Try using credentials
We send the scan results where we obtained a PushButton target over to
device object.  If EAP-WSC transaction is successful, then the scan
results are searched to find a network/bss combination found in the
credentials obtained.  If found, the network is connected to
automatically.
2016-09-21 16:21:53 -05:00
Denis Kenzior 5fa37b9a1d wsc: Write credentials to storage 2016-09-21 16:21:28 -05:00
Denis Kenzior 3fd51c2d72 network: Add network_set_psk 2016-09-21 16:20:09 -05:00
Denis Kenzior c380940b43 netdev: Deauthenticate prior to calling connect_cb 2016-09-21 16:19:47 -05:00
Denis Kenzior 92a51805c4 netdev: Finalize disconnects on device removal
When device is removed or otherwise freed, netdev_connect callbacks are
invoked.  Treat disconnects similarly
2016-09-21 15:23:06 -05:00
Denis Kenzior 29387e012a network: Use uint8_t instead of unsigned char 2016-09-21 14:38:43 -05:00
Denis Kenzior 954f4ebca2 network: Close settings if ineligible for autoconnect 2016-09-21 14:35:30 -05:00
Denis Kenzior 7661f1b7c0 network: Expose network_bss_select 2016-09-21 14:00:59 -05:00
Denis Kenzior 38a4a9668f wsc: Record credentials obtained from EAP-WSC
Multiple credentials can be obtained via the event, record them until we
are ready to process them.
2016-09-21 13:51:11 -05:00
Denis Kenzior 42fb2a7c0f device: Add device_set_scan_results 2016-09-19 20:35:57 -05:00
Denis Kenzior 9c9e6f6f29 network: Add network_bss_find_by_addr 2016-09-19 20:26:41 -05:00
Denis Kenzior dc3a6a2f77 device: Add device_network_find 2016-09-19 20:19:34 -05:00
Denis Kenzior 29d5eeb3ca network: Use const char * to represent ssid
This also fixes a potential buffer overflow since the ssid was cast to a
string inside network_create.  However, ssid is a buffer of 32 bytes,
and would not be null-terminated in the case of a 32-byte SSID.
2016-09-19 20:18:53 -05:00
Denis Kenzior 12fca8b7f7 network: Make network_settings_close private 2016-09-19 17:04:51 -05:00
Denis Kenzior a239b49707 network: Make network_load_settings static 2016-09-19 17:03:51 -05:00
Denis Kenzior 69ea4db15c wsc: Base RF freq on BSS we're connecting to 2016-09-16 12:42:58 -05:00
Denis Kenzior 099e2a028d wsc: Add support for initial WSC association 2016-09-14 21:56:20 -05:00
Denis Kenzior 15ac5c3f38 wscutil: Fix uninitialized warning
==5362== Conditional jump or move depends on uninitialised value(s)
==5362==    at 0x419B62: wsc_wfa_ext_iter_next (wscutil.c:52)
==5362==    by 0x41B869: wsc_parse_probe_response (wscutil.c:1016)
==5362==    by 0x41FD77: scan_results (wsc.c:218)
==5362==    by 0x415669: get_scan_done (scan.c:892)
==5362==    by 0x432932: destroy_request (genl.c:134)
==5362==    by 0x433245: process_unicast (genl.c:394)
==5362==    by 0x43361A: received_data (genl.c:506)
==5362==    by 0x42FDC2: io_callback (io.c:120)
==5362==    by 0x42EABE: l_main_run (main.c:381)
==5362==    by 0x402F90: main (main.c:234)
2016-09-14 21:56:18 -05:00
Denis Kenzior 9b0113018f scan: Fix running active scans
A wildcard SSID of zero length is needed
2016-09-14 21:56:18 -05:00
Denis Kenzior a3fdb88a9a device: add device_get_netdev 2016-09-14 21:56:18 -05:00
Denis Kenzior 959ebd505b device: Free eapol_sm on netdev_connect failure 2016-09-14 21:56:18 -05:00
Denis Kenzior 09dcd78e30 device: Convert device watches to watchlist 2016-09-14 21:56:18 -05:00
Denis Kenzior ef18c03322 device: Make device_enter_state static 2016-09-14 21:56:18 -05:00
Denis Kenzior 4419a6325a device: Add state watch api 2016-09-14 21:56:16 -05:00
Denis Kenzior 6d410b0bec watchlist: Add watchlist utilities 2016-09-14 20:26:49 -05:00
Denis Kenzior d9c18deed7 device: Remove extra whitespace 2016-09-14 00:17:27 -05:00
Denis Kenzior f77d363840 netdev: Add netdev_connect_wsc 2016-09-13 20:50:24 -05:00
Denis Kenzior 8a50054925 device: Make device_disassociated static 2016-09-13 20:49:36 -05:00
Denis Kenzior db8794460f eapol: Remove io argument from eapol_start 2016-09-13 17:37:13 -05:00
Denis Kenzior 047a196c70 wscutil: Add wsc_build_association_response 2016-09-13 17:26:18 -05:00