3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-05 11:39:24 +01:00
Commit Graph

1705 Commits

Author SHA1 Message Date
James Prestwood
5e5caedb90 nl80211: added verifier/parser for GET_KEY
AdHoc will also need the same functionality to verify and parse the
key sequence from GET_KEY. This block of code was moved from AP's
GET_KEY callback into nl80211_parse_get_key_seq.
2018-10-08 21:35:24 -05:00
James Prestwood
60aba7114e nl80211: make SET_KEY/GET_KEY common
Moved AP helpers for building SET_KEY/GET_KEY commands into
nl80211_util.c
2018-10-08 21:35:12 -05:00
James Prestwood
04a9315a3c nl80211: introduce nl80211 utility API's
Netdev/AP share several NL80211 commands and each has their own
builder API's. These were moved into a common file nl80211_util.[ch].

A helper was added to AP for building NEW_STATION to make the associate
callback look cleaner (rather than manually building NEW_STATION).
2018-10-08 21:34:58 -05:00
Andrew Zaborowski
dc39c52525 station: Cancel ongoing scans in station_free
Make scan.c forget station's scan callbacks to prevent crash when
switching interface types with a scan running.
2018-10-08 11:33:53 -05:00
James Prestwood
395acc8203 netdev: simplify netdev_choose_key_address
The key address can be chosen regardless of iftype. The deciding
factor is the authenticator bit in the handshake.
2018-10-08 11:29:47 -05:00
Andrew Zaborowski
fb85b1d1a7 netdev: Check that netdev->device is not NULL
Check that netdev->device is not NULL before doing device_remove()
(which would crash) and emitting NETDEV_WATCH_EVENT_DEL.  It may be
NULL if the initial RTM_SETLINK has failed to bring device UP.
2018-10-04 20:57:33 -05:00
Andrew Zaborowski
6e70c84f8e station: Ignore ad-hoc networks in scan results
If there are Ad-hoc BSSes they should be present in the scan results
together with regular APs as far as scan.c is concerned.  But in
station mode we can't connect to them -- the Connect method will fail and
autoconnect would fail.  Since we have no property to indicate a
network is an IBSS just filter these results out for now.  There are
perhaps better solutions but the benefit is very low.
2018-10-03 16:56:19 -05:00
Tim Kourt
0682ddad37 ttls: change signature of the inner reset funcs 2018-10-01 17:30:29 -05:00
Tim Kourt
f0a86519e9 ttls: add support for tunneled CHAP 2018-10-01 17:14:19 -05:00
Tim Kourt
ba5cf86716 ttls: add support for tunneled PAP 2018-10-01 17:12:17 -05:00
Tim Kourt
aedf89ca37 ttls: remove load_settings from phase2_method 2018-10-01 17:11:39 -05:00
Tim Kourt
726ff5d2b1 ttls: exclude avp_builder_put_bytes 2018-10-01 17:11:10 -05:00
Tim Kourt
2aefd8badf ttls: improve avp build approach 2018-10-01 17:10:03 -05:00
Tim Kourt
e6bf22f8c9 ttls: add support for non eap auth settings 2018-09-26 17:55:44 -05:00
Tim Kourt
8f0c4a769a ttls: clear the obtained memory to prevent info leaks 2018-09-26 17:19:46 -05:00
Tim Kourt
3d77748bca ttls: change signature of the inner destroy funcs. 2018-09-26 17:19:05 -05:00
Tim Kourt
b2ec0c350a ttls: fix check on avp start 2018-09-25 16:23:40 -05:00
James Prestwood
50acc11f07 wiphy: added wiphy_select_akm
This is a replacement for station's static select_akm_suite. This was
done because wiphy can make a much more intellegent decision about the
akm suite by checking the wiphy supported features e.g. SAE support.

This allows a connection to hybrid WPA2/WPA3 AP's if SAE is not
supported in the kernel.
2018-09-25 10:58:04 -05:00
James Prestwood
272cb441cd wiphy: only connect to SAE if feature is supported 2018-09-25 10:56:06 -05:00
Andrew Zaborowski
36c441c945 ap: Set up the GTK and pass to handshake
Set a default GTK cipher type same as our current PTK type, generate a
random GTK when the first STA connects and set it up in the kernel, then
pass the values that EAPoL is going to need to the handshake_state.
2018-09-25 10:53:40 -05:00
Andrew Zaborowski
01edef9001 netdev: Reject setting powered while setting iftype
In netdev_set_powered also check that no NL80211_CMD_SET_INTERFACE is in
progress because once it returned we would overwrite
netdev->set_powered_cmd_id (could also add a check there but it seems
more logical to just disallow Powered property changes while Mode is
being changed, since we also disallow Mode changes while Powered is
being changed.)
2018-09-25 10:51:48 -05:00
Denis Kenzior
ebda2ce60f device: Remove unneeded includes 2018-09-24 19:29:40 -05:00
Denis Kenzior
87118959e6 device: Obtain station using station_find
Since device object no longer creates / destroys station objects, use
station_find inside ap directed roam events to direct these to the
station interface.
2018-09-24 19:27:04 -05:00
Andrew Zaborowski
8632b81397 eapol: Add GTK data to msg 3/4 of the handshake 2018-09-24 14:53:41 -05:00
Andrew Zaborowski
e4873dea5a handshake: Use enum handshake_kde in find_kde()
Since we have all the KDE types defined in enum handshake_kde use that
instead of uint8_t buffers containing the same values.
2018-09-24 14:24:41 -05:00
Andrew Zaborowski
7c779956ac handshake: Add handshake_util_build_gtk_kde utility 2018-09-24 14:24:41 -05:00
Andrew Zaborowski
68e612573e handshake: Add GTK data to handshake_state
Add places to store the GTK data, index and RSC in struct
handshake_state and add a setter function for these fields.  We may want
to also convert install_gtk to use these fields similar to install_ptk.
2018-09-24 14:24:41 -05:00
Denis Kenzior
7eb59602df netdev: Drop redundant netdev_get_device checks
As a consequence of the previous commit, netdev watches are always
called when the device object is valid.  As a result, we can drop the
netdev_get_device calls and checks from individual AP/AdHoc/Station/WSC
netdev watches
2018-09-24 14:12:43 -05:00
Andrew Zaborowski
916bde3a02 netdev: Don't emit events before NETDEV_WATCH_EVENT_NEW 2018-09-24 14:09:36 -05:00
Andrew Zaborowski
c96f44b2e6 station: Make station_create/station_free static
These two functions don't need to be used from outside of station.c
anymore so make them static and simplify the station_create arguments
slightly.
2018-09-24 14:07:03 -05:00
Andrew Zaborowski
567baed2c4 station: Create interface simliarly to AP, AdHoc interfaces
Instead of creating the Station interface in device.c create it directly
on the netdev watch event the same way that the AP and AdHoc interfaces
are created and freed.  This fixes some minor incosistencies, for
example station_free was previously called twice, once from device.c and
once from the netdev watch.

device.c would previously keep the pointer returned by station_create()
but that pointer was not actually useful so remove it.  Autotests still
seem to pass.
2018-09-24 14:05:03 -05:00
Andrew Zaborowski
daf248e1ba station: Disconnect netdev in station_free()
Call netdev_disconnect() to make netdev forget any of station.c's
callbacks for connections or transitions in progress or established.
Otherwise station.c will crash as soon as we're connected and try to
change interface mode:
==17601== Invalid read of size 8
==17601==    at 0x11DFA0: station_disconnect_event (station.c:775)
==17601==    by 0x11DFA0: station_netdev_event (station.c:1570)
==17601==    by 0x115D18: netdev_disconnect_event (netdev.c:868)
==17601==    by 0x115D18: netdev_mlme_notify (netdev.c:3403)
==17601==    by 0x14E287: l_queue_foreach (queue.c:441)
==17601==    by 0x1558B4: process_multicast (genl.c:469)
==17601==    by 0x1558B4: received_data (genl.c:532)
==17601==    by 0x152888: io_callback (io.c:123)
==17601==    by 0x151BCD: l_main_iterate (main.c:376)
==17601==    by 0x151C9B: l_main_run (main.c:423)
==17601==    by 0x10FE20: main (main.c:489)
2018-09-24 13:57:36 -05:00
Andrew Zaborowski
f9faeed7bb ap, adhoc: On NETDEV_WATCH_EVENT_NEW check device is UP
Since the interfaces are not supposed to exist when the device is DOWN
(we destroy the interfaces on NETDEV_WATCH_EVENT_DOWN too), don't
create the interfaces if the device hasn't been brought up yet.
2018-09-24 13:56:02 -05:00
Andrew Zaborowski
99e7e0d977 netdev: Update ifi_flags in rntl_set_powered callbacks
When we detect a new device we either bring it down and then up or only
up.  The IFF_UP flag in netdev->ifi_flags is updated before that, then
we send the two rtnl commands and then fire the NETDEV_WATCH_EVENT_NEW
event if either the bring up succeeded or -ERFKILL was returned, so the
device may either be UP or DOWN at that point.

It seems that a RTNL NEWLINK notification is usually received before
the RTNL command callback but I don't think this is guaranteed so update
the IFF_UP flag in the callbacks so that the NETDEV_WATCH_EVENT_NEW
handlers can reliably use netdev_get_is_up()
2018-09-24 13:54:24 -05:00
Andrew Zaborowski
ab6160b017 netdev: Drop DEFAULT_TYPES nl80211 attr of CMD_NEW_KEY
The NL80211_ATTR_KEY_DEFAULT_TYPES attribute is only parsed by the
kernel if either NL80211_ATTR_KEY_DEFAULT or
NL80211_ATTR_KEY_DEFAULT_MGMT are also present, however these are only
used with NL80211_CMD_SET_KEY and ignored for NEW_KEY.  As far as I
understand the default key concept only makes sense for a Tx key because
on Rx all keys can be tried, so we don't need this for client mode.  The
kernel decides whether the NEW_KEY is for unicast or multicast based on
whether NL80211_ATTR_KEY_MAC was supplied.
2018-09-24 13:14:27 -05:00
Denis Kenzior
b60e79b8dd eap-wsc: Do not leak device_password
device password was read from settings using l_settings_get_string which
returns a newly-allocated string due to un-escape semantics.  However,
when assigning wsc->device_password, we strdup-ed the password again
unnecessarily.

==1069== 14 bytes in 2 blocks are definitely lost in loss record 1 of 1
==1069==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
==1069==    by 0x16696A: l_malloc (util.c:62)
==1069==    by 0x16B14B: unescape_value (settings.c:108)
==1069==    by 0x16D12C: l_settings_get_string (settings.c:971)
==1069==    by 0x149680: eap_wsc_load_settings (eap-wsc.c:1270)
==1069==    by 0x146113: eap_load_settings (eap.c:556)
==1069==    by 0x12E079: eapol_start (eapol.c:2022)
==1069==    by 0x1143A5: netdev_connect_event (netdev.c:1728)
==1069==    by 0x118751: netdev_mlme_notify (netdev.c:3406)
==1069==    by 0x1734F1: notify_handler (genl.c:454)
==1069==    by 0x168987: l_queue_foreach (queue.c:441)
==1069==    by 0x173561: process_multicast (genl.c:469)
2018-09-24 12:19:27 -05:00
Denis Kenzior
3ca1aeb917 wsc: Don't use wsc_pin_is_checksum_valid on 4 digit PINs
wsc_pin_is_valid allows two types of PINs through:
  1. 4 digit numeric PIN
  2. 8 digit numeric PIN

The current code always calls wsc_pin_is_checksum_valid to determine
whether a DEFAULT or USER_SPECIFIED PIN is used.  However, this function
is not safe to call on 4 digit PINs and causes a buffer overflow.

Add simple checks to treat 4 digit PINs as DEFAULT PINs and do not call
wsc_pin_is_checksum_valid on these.

Reported-By: Matthias Gerstner <matthias.gerstner@suse.de>
2018-09-24 12:19:27 -05:00
Denis Kenzior
cc37018426 eap-wsc: Drop 8 digit PIN check
EAP-WSC handles 4 digit, 8 digit and out-of-band Device passwords.  The
latter in particular can be anything, so drop the mandatory minimum
password length check here.

This also has the effect of enabling 4-digit PINs to actually work as
they are intended.
2018-09-24 12:19:27 -05:00
Tim Kourt
a3cc68e61e ttls: add radius AVP builder and build response 2018-09-21 18:07:58 -05:00
Tim Kourt
4d8791dd3a ttls: replace old AVP processing with new 2018-09-21 15:20:18 -05:00
Tim Kourt
5d1d1ad893 ttls: add radius AVP parser 2018-09-21 15:19:13 -05:00
Tim Kourt
71ba8ac765 ttls: introduce phase2_method structure
The struct allows to support multiple types of the tunneled methods.
Previously, EAP-TTLS was supporting only the eap based ones.
This patch is also starts to move some of the phase 2 EAP
functionality into the new structure.
2018-09-21 15:19:13 -05:00
Tim Kourt
a7f5d1da21 ttls: remove unused state var 2018-09-21 12:15:28 -05:00
Tim Kourt
410ee2f6b9 eap-tls-common: introduce utility functions for eap-tls 2018-09-21 12:15:25 -05:00
James Prestwood
a553771ffe netdev: station: support FT over SAE
Boiled down, FT over SAE is no different than FT over PSK, apart from
the different AKM suite. The bulk of this change fixes the current
netdev/station logic related to SAE by rebuilding the RSNE and adding
the MDE if present in the handshake to match what the PSK logic does.

A common function was introduced into station which will rebuild the
handshake rsne's for a target network. This is used for both new
network connections as well as fast transitions.
2018-09-21 11:26:05 -05:00
James Prestwood
8064cb599a ie: introduce IE_AKM_IS_SAE macro
To prepare for FT over SAE, several case/if statements needed to include
IE_RSN_AKM_SUITE_FT_OVER_SAE. Also a new macro was introduced to remove
duplicate if statement code checking for both FT_OVER_SAE and SAE AKM's.
2018-09-21 11:26:05 -05:00
James Prestwood
996a18e934 network: free EAP_CACHE_NEVER secret types
When freeing a network secrets any secrets labeled with CACHE_NEVER
would get removed from the secret queue but never actually freed.
2018-09-19 14:33:23 -05:00
James Prestwood
74b8b6d65c watchlist: fix stale watchlist item processing
All the watchlist notify macros were broken in that they did not check
that the watchlist item was still valid before calling it. This only
came into play when a watchlist was being notified and one of the notify
functions removed an item from the same watchlist. It appears this was
already thought of since watchlist_remove checks 'in_notify' and will
mark the item's id as stale (0), but that id never got checked in the
notify macros.

This fixes testAdHoc valgrind warning:

==3347== Invalid read of size 4
==3347==    at 0x416612: eapol_rx_auth_packet (eapol.c:1871)
==3347==    by 0x416DD4: __eapol_rx_packet (eapol.c:2334)
==3347==    by 0x40725B: netdev_pae_read (netdev.c:3515)
==3347==    by 0x440958: io_callback (io.c:123)
==3347==    by 0x43FDED: l_main_iterate (main.c:376)
==3347==    by 0x43FEAB: l_main_run (main.c:423)
==3347==    by 0x40377A: main (main.c:489)
...
2018-09-19 14:17:26 -05:00
Denis Kenzior
ba248e028e station: Make station_rssi_level_changed static 2018-09-19 13:47:51 -05:00
Denis Kenzior
f06c3b645d station: Make station_state_to_string static 2018-09-19 13:45:49 -05:00
Tim Kourt
59c4c8ac6b scan: change scan triggered notification behavior
Do not notify the caller after the first scan_triggered event in
multi-segmented scans.
2018-09-19 11:53:36 -05:00
Tim Kourt
b5aefede95 network: add check for the existing settings
In the case of the open networks with hidden SSIDs
the settings object is already created.

Valgrind:
==4084==    at 0x4C2EB6B: malloc (vg_replace_malloc.c:299)
==4084==    by 0x43B44D: l_malloc (util.c:62)
==4084==    by 0x43E3FA: l_settings_new (settings.c:83)
==4084==    by 0x41D101: network_connect_new_hidden_network (network.c:1053)
==4084==    by 0x4105B7: station_hidden_network_scan_results (station.c:1733)
==4084==    by 0x419817: scan_finished (scan.c:1165)
==4084==    by 0x419CAA: get_scan_done (scan.c:1191)
==4084==    by 0x443562: destroy_request (genl.c:139)
==4084==    by 0x4437F7: process_unicast (genl.c:424)
==4084==    by 0x4437F7: received_data (genl.c:534)
==4084==    by 0x440958: io_callback (io.c:123)
==4084==    by 0x43FDED: l_main_iterate (main.c:376)
==4084==    by 0x43FEAB: l_main_run (main.c:423)
2018-09-19 11:52:33 -05:00
Denis Kenzior
88b2aefeed wiphy: Add missing blank 2018-09-18 17:06:07 -05:00
Denis Kenzior
e52204f46f station: Fix scan_pending assignment
In case an error occurs starting a scan, the scan_pending variable is
never cleared and message is never unrefed.
2018-09-18 13:58:52 -05:00
Denis Kenzior
d347100ac2 device: Remove the rest of the legacy Device properties 2018-09-14 21:53:01 -05:00
Denis Kenzior
42e5dbf6f8 device: Remove legacy GetOrderedNetworks 2018-09-14 21:49:13 -05:00
Denis Kenzior
b2e0a82225 device: Remove Scan method 2018-09-14 21:21:47 -05:00
Denis Kenzior
c47db2635f device: Remove Disconnect method 2018-09-14 21:20:33 -05:00
Marcel Holtmann
804ce5944b dbus: Make the g_dbus global variable static 2018-09-14 23:01:32 +02:00
Marcel Holtmann
2606bc73ad build: Add DAEMON_ prefix to CONFIGDIR and STORAGEDIR 2018-09-14 17:58:44 +02:00
Marcel Holtmann
1e37ef31fe eapol: Move eapol_key_validate() into eapolutil helper 2018-09-14 17:31:42 +02:00
Marcel Holtmann
c40be7a7d5 monitor: Add EAP dummy method to keep linker happy 2018-09-14 17:12:47 +02:00
Marcel Holtmann
502aac073f tools: Add configure option and D-Bus policy file for hwsim utility 2018-09-14 15:24:15 +02:00
Marcel Holtmann
5126459ecc main: Fix the order of --help and -h option handling 2018-09-14 15:19:06 +02:00
Marcel Holtmann
0c5b6e4da3 dbus: Fix policy entries and add access for group wheel 2018-09-14 15:04:15 +02:00
Denis Kenzior
b181604c18 main: Don't init nl80211 until dbus name is owned 2018-09-11 20:06:00 -05:00
Denis Kenzior
95896c10ff device: Fix crashes when outside of Station mode 2018-09-10 20:01:35 -05:00
Denis Kenzior
0a42f63d42 station: Update GetOrderedNetworks API implementation
The Station interface GetOrderedNetworks signature now matches the API
documentation.  Device.GetOrderedNetworks still uses the legacy
signature.
2018-09-08 10:34:52 -05:00
Andrew Zaborowski
854ce2b062 station: Emit PropertiesChanged on the Station interface too 2018-09-07 21:23:41 -05:00
Tim Kourt
18aa744099 eap: clarify warning message 2018-09-07 12:31:03 -05:00
Tim Kourt
bb5997c4ea peap: fix typo and add labels 2018-09-07 12:30:05 -05:00
Tim Kourt
2735e32b10 peap: handle redundant usage of the L flag
Some of the PEAP server implementations set the L flag along with
redundant TLS Message Length field for the un-fragmented packets.
This patch allows to identify and handle such occasions.
2018-09-07 12:26:23 -05:00
Tim Kourt
958bd12624 peap: accept EAP type 33 as termination mechanism for PEAPv1
EAP Extensions type 33 is used in PEAPv0 as a termination
mechanism for the tunneled EAP methods. In PEAPv1
the regular EAP-Success/Failure packets must be used to terminate
the method. Some of the server implementations of PEAPv1
rely on EAP Extensions method to terminate the conversation
instead of the required Success/Failure packets. This patch
makes iwd interoperable with such devices.
2018-09-06 18:23:24 -05:00
James Prestwood
397bf9c0bd crypto: pwd: sae: Made H function common
The "H" function used by SAE and EAP-PWD was effectively the same
function, EAP-PWD just used a zero key for its calls. This removes
the duplicate implementations and merges them into crypto.c as
"hkdf_256".

Since EAP-PWD always uses a zero'ed key, passing in a NULL key to
hkdf_256 will actually use a 32 byte zero'ed array as the key. This
avoids the need for EAP-PWD to store or create a zero'ed key for
every call.

Both the original "H" functions never called va_end, so that was
added to hkdf_256.
2018-09-05 11:12:54 -05:00
Denis Kenzior
5db022041c station: Fix up some printf type inconsistencies
The ifindex as reported by netdev is unsigned, so make sure that it is
printed as such.  It is astronomically unlikely that this causes any
actual issues, but lets be paranoid.
2018-09-05 11:09:35 -05:00
Denis Kenzior
0f34e1a0c1 station: Expose ConnectedNetwork, Scanning and State
These properties will temporarily be exposed on both interfaces
until tools such as test runner, iwctl and NetworkManager/ConnMan
are ported over.
2018-09-05 11:09:35 -05:00
Denis Kenzior
2f2ec71a6c station: Expose Scan, Disconnect, GetOrderedNetworks
These methods will temporarily be exposed on both interfaces until tools
such as test runner, iwctl and NetworkManager/ConnMan are ported over.
2018-09-05 11:09:35 -05:00
Denis Kenzior
b650a5d492 station: Move ConnectHiddenNetwork to station 2018-09-05 11:09:35 -05:00
Denis Kenzior
f61747f011 device: Allow switching mode even if station is busy
Since device will no longer be aware of what is happening on the station
interface, we should allow switching modes in any situation
2018-09-04 23:57:14 -05:00
Denis Kenzior
25f36f5644 station: Move remaining connect/re-connect/roam logic 2018-09-04 23:57:14 -05:00
Denis Kenzior
cdfcb902e4 station: move signal level agent logic from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
ac83a35b97 station: Register skeleton dbus interface 2018-09-04 23:57:14 -05:00
Denis Kenzior
f3d326b0fd adhoc: Fix comment 2018-09-04 23:57:14 -05:00
Denis Kenzior
4c8b39da3b station: Move device_disconnect_event to station 2018-09-04 23:57:14 -05:00
Denis Kenzior
d8617a5000 station: Move device_disassociate to station 2018-09-04 23:57:14 -05:00
Denis Kenzior
520d3ad6b2 station: move GetSortedNetworks implementation 2018-09-04 23:57:14 -05:00
Denis Kenzior
77b006b4e9 station: Move dbus disconnection logic from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
12ce9debec station: Move device_disconnect to station 2018-09-04 23:57:14 -05:00
Denis Kenzior
ee91cfcb7e station: Move hidden network code from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
e65c3e63be station: Move state reset code from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
f8b724d3ba wsc/device: Use station_set_autoconnect 2018-09-04 23:57:14 -05:00
Denis Kenzior
b49ec9461b station: move the remaining scanning code from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
58c8243114 device: Get rid of device_list queue 2018-09-04 23:57:14 -05:00
Denis Kenzior
553a8c1bae device/wsc: Use station_set_scan_results 2018-09-04 23:57:14 -05:00
Denis Kenzior
187ea7f5d1 device/network: Use station_is_busy 2018-09-04 23:57:14 -05:00
Denis Kenzior
f996bea880 station: Add station_is_busy 2018-09-04 23:57:14 -05:00
Denis Kenzior
5e2cce2e0b device: Remove unused device_get_connected_network 2018-09-04 23:57:14 -05:00
Denis Kenzior
1962549152 device: Remove device_network_find
Switch to using station_network_find instead
2018-09-04 23:57:14 -05:00
Denis Kenzior
dcfdd0ccde network: Use station_foreach
Instead of __iwd_device_foreach api, use the newly introduced
station_foreach API
2018-09-04 23:57:14 -05:00
Denis Kenzior
d576c28d9f device: Remove device_get_path
Use netdev_get_path instead
2018-09-04 23:57:14 -05:00
Denis Kenzior
993a69cef8 network: Make network station centric 2018-09-04 23:57:14 -05:00
Denis Kenzior
0650707eea station: Add station_get_connected_network 2018-09-04 23:57:14 -05:00
Denis Kenzior
d0ec5fcf77 station: Add station_get_netdev 2018-09-04 23:57:14 -05:00
Denis Kenzior
5837e65c40 station: Add station_get_wiphy 2018-09-04 23:57:14 -05:00
Denis Kenzior
738faa7657 network: Pass connected state to network_rank_update 2018-09-04 23:57:14 -05:00
Denis Kenzior
b69f938879 device: Get rid of connected_bss member 2018-09-04 23:57:14 -05:00
Denis Kenzior
e6c6e4f0ae device: Get rid of connected_network member 2018-09-04 23:57:14 -05:00
Denis Kenzior
575d0fa554 station: Move roam triggering & scanning code
Move the roam initiation (signal loss, ap directed roaming) and scanning
details into station from device.  Certain device functions have been
exposed temporarily to make this possible.
2018-09-04 23:57:14 -05:00
Denis Kenzior
966cad3696 network: Remove unused function 2018-09-04 23:57:14 -05:00
Denis Kenzior
e028b7019c station: Move state tracking from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
69f1c3321a station: Add station_find 2018-09-04 23:57:14 -05:00
Denis Kenzior
1378a3c945 station: Move scanning code from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
1b22af2052 scan: Add scan_bss_addr_cmp/eq 2018-09-04 23:57:14 -05:00
Denis Kenzior
9b574b5931 station: Move autoconnect logic from device 2018-09-04 23:57:14 -05:00
Denis Kenzior
977b817f3c device: Modify signature of device_set_scan_results
WSC was using this to set the scan results.  However it never needed the
autoconnect paths, so modify the signature to make this explicit.
2018-09-04 23:57:14 -05:00
Denis Kenzior
345485c506 device: Split process_bss
process_bss performs two main operations.  It adds a seen BSS to a
network object (existing or new) and if the device is in the autoconnect
state, it adds an autoconnect entry as needed.  Split this operation
into two separate & independent steps.
2018-09-04 23:57:14 -05:00
Denis Kenzior
e6060c1026 station: Move handshake setup code from device
For now we temporarily create the station object from within device so
that the code can be moved over in a more manageable manner.
2018-08-31 20:25:23 -05:00
Denis Kenzior
641e71a02f station: Add skeleton 2018-08-31 20:24:15 -05:00
Denis Kenzior
839053c952 device: Get rid of timestamp parameter in process_bss
This is no longer being used
2018-08-31 14:53:56 -05:00
James Prestwood
35231a1b2c adhoc: removed unneeded check for !sta->addr
sta->addr is is guarenteed to be valid (assuming sta is valid).
2018-08-29 12:49:06 -05:00
Andrew Zaborowski
5f3cdc2093 handshake: Rename own_ie/ap_ie and related setters
To avoid confusion in case of an authenticator side handshake_state
structure and eapol_sm structure, rename own_ie to supplicant_ie and
ap_ie to authenticator_ie.  Also rename
handshake_state_set_{own,ap}_{rsn,wpa} and fix when we call
handshake_state_setup_own_ciphers.  As a result
handshake_state_set_authenticator, if needed, should be called before
handshake_state_set_{own,ap}_{rsn,wpa}.
2018-08-27 11:42:45 -05:00
Andrew Zaborowski
ddbc49538e ap: Drop a RSNE check
After EAPOL logic was moved to eapol.c a check was added to
ap_associate_sta_cb to bitwise compare the AP's RSNE to the RSNE
received in the (Re)Association frame.  There is as far as I know no
reason for them to be the same (although they are in our autotest) and
if there was a reason we'd rather validate the (Re)Association RSNE
immediately when received.  We also must set different RSNEs as the
"own" (supplicant) and "ap" RSNEs in the handshake_state for validation
of step 2/4 in eapol.c (fixes wpa_supplicant's and MS Windows
connections being rejected)
2018-08-23 22:03:38 -05:00
Andrew Zaborowski
cb04fb6314 ap: Stop EAPOL negotiation on Disassociation
Make sure we interrupt eapol traffic (4-way handshake) if we receive a
Disassociation from station.  Actually do this in ap_del_station because
it's called from both ap_disassoc_cb and ap_success_assoc_resp_cb and
seems to make sense in both cases.
2018-08-23 21:49:53 -05:00
Andrew Zaborowski
f460a7e12c ap: eapol_sm lifecycle fixes
On one hand when we're called with HANDSHAKE_EVENT_FAILED or
HANDSHAKE_EVENT_SETTING_KEYS_FAILED the eapol_sm will be freed in
eapol.c, fix a double-free by setting it to NULL before ap_free_sta
is called.
On the other hand make sure we call eapol_sm_free before setting
sta->sm to NULL in ap_drop_rsna to avoid potential leak and avoid
the eapol_sm continuing to use the handshake_state we freed.
2018-08-23 21:45:41 -05:00
Andrew Zaborowski
c0a70cc9b7 device: Drop now unused start/stop_ap_pending fields 2018-08-23 21:43:33 -05:00
Andrew Zaborowski
58f91a741b knownnetworks: Fix timestamps comparison
timespec_compare wanted to receive network_info structures as arguments
to compare connected_time timestamps but in one instance we were passing
actual timespec structures.  Add a new function to compare plain timespec
values and switch the names for readability.
2018-08-23 21:43:30 -05:00
James Prestwood
9c71d56444 sae: fix endianness issues
Replaced all calls of l_get_u16 with l_get_le16. This fixes
failures on big-endian hardware.
2018-08-23 12:23:59 -05:00
Denis Kenzior
99253a8689 sae: Fix Wformat warning
src/sae.c:714:3: warning: format ‘%ld’ expects argument of type ‘long
int’, but argument 6 has type ‘size_t’ [-Wformat=]
2018-08-21 10:19:39 -05:00
Andrew Zaborowski
da96b5c51c network: Use is_known to save queue lookups
Now that the is_known field is back use it instead of searching the
"networks" queue where possible.
2018-08-20 11:37:07 -05:00
Denis Kenzior
7e7bf126d3 device: Remove device_get_netdev 2018-08-19 23:37:29 -05:00
Denis Kenzior
8d6f3021e3 adhoc: Do not use device
Ad-Hoc only uses information from the netdev object and doesn't really
depend on the device object.
2018-08-19 23:36:24 -05:00
Denis Kenzior
92e7e63af5 device: Remove device_get_ifindex 2018-08-19 23:30:06 -05:00
Denis Kenzior
1ad22021d2 device: Remove device_get_address 2018-08-19 23:28:58 -05:00
Denis Kenzior
e068c97409 wsc: Make WSC netdev centric 2018-08-19 23:28:07 -05:00
Denis Kenzior
2e0638d51b ap: Make AP use netdev instead of device
The information is always on the netdev object anyway, so this just
makes it explicit.
2018-08-19 23:12:29 -05:00
Denis Kenzior
0ad8f7e0d6 netdev: Add netdev_get_path 2018-08-19 23:12:14 -05:00
Denis Kenzior
a277a424f3 device: Remove unneeded typedefs/enums 2018-08-19 23:10:27 -05:00
Denis Kenzior
9ca72b9527 netdev: Issue initial SET_CQM when in STATION mode 2018-08-19 22:52:52 -05:00
Denis Kenzior
99b5c67c88 device: Update State when Mode is changed 2018-08-19 22:41:07 -05:00
Denis Kenzior
5a6c19988c device/netdev: Properly implement mode switching 2018-08-19 22:07:15 -05:00
Denis Kenzior
3628003296 wsc: Do not check device mode
There's no longer a need to do that since WSC is only created in station
mode.
2018-08-19 22:06:02 -05:00
Denis Kenzior
cc9fc8de67 knownnetworks: Fix leak of fswatch
==7330== 112 bytes in 1 blocks are still reachable in loss record 1 of 1
==7330==    at 0x4C2CF8F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7330==    by 0x14CF7D: l_malloc (util.c:62)
==7330==    by 0x152A25: l_io_new (io.c:172)
==7330==    by 0x16B217: l_fswatch_init (fswatch.c:171)
==7330==    by 0x16B217: l_fswatch_new (fswatch.c:198)
==7330==    by 0x13B9D9: known_networks_init (knownnetworks.c:401)
==7330==    by 0x110020: main (main.c:439)
2018-08-19 22:05:31 -05:00
Denis Kenzior
93985103bb device: Use netdev->iftype instead of device_mode 2018-08-19 20:39:37 -05:00
Denis Kenzior
ae223fe06c netdev: Don't bother switching iftype on shutdown 2018-08-19 20:16:16 -05:00
Denis Kenzior
52e0a7ce83 netdev: Remove redundant typedefs
Unify command specific typedefs which had the same signature into a
single netdev_command_cb_t
2018-08-19 18:25:23 -05:00
Denis Kenzior
f6eb571b67 device: Set autoconnect only if triggered via D-Bus 2018-08-18 00:41:25 -05:00
Denis Kenzior
b7fd5023f0 device: Honor autoconnect setting on power up
If the device Powered state is toggled, honor the autoconnect setting
instead of always going into AUTOCONNECT mode
2018-08-18 00:40:45 -05:00
Denis Kenzior
996a6d2546 netdev/device: Combine watches
There was somewhat overlapping functionality in the device_watch
infrastructure as well as the netdev_event_watch.  This commit combines
the two into a single watch based on the netdev object and cleans up the
various interface additions / removals.

With this commit the interfaces are created when the netdev/device is
switched to Powered=True state AND when the netdev iftype is also in the
correct state for that interface.  If the device is brought down, then
all interfaces except the .Device interface are removed.

This will make it easy to implement Device.Mode property properly since
most nl80211 devices need to be brought into Powered=False state prior
to switching the iftype.
2018-08-18 00:38:56 -05:00
Denis Kenzior
da52bcd109 netdev: Rework netdev_init/exit 2018-08-17 23:47:20 -05:00
Denis Kenzior
b3e937e11a main: Rework initialization order
Group together all the configuration settings / reading code together
for more readability.

Initialize eap, eapol and rfkill before device
2018-08-17 23:35:09 -05:00