Commit Graph

1599 Commits

Author SHA1 Message Date
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
Denis Kenzior c5b19dc747 main: Don't call wsc_exit twice 2018-08-17 16:45:05 -05:00
Denis Kenzior 28916dc5ca netdev: Add netdev_get_device 2018-08-17 14:59:01 -05:00
Denis Kenzior 3788156f39 netdev: Don't use device_get_ifindex in join_adhoc
This is pointless as the ifindex is already available on the netdev
object.
2018-08-17 14:42:07 -05:00
Denis Kenzior 3c28c5c24c netdev: Don't crash on operstate callbacks
The way that netdev_set_linkmode_and_operstate was used resulted in
potential crashes when the netdev was destroyed.  This is because netdev
was given as data to l_netlink_send and could be destroyed between the
time of the call and the callback.  Since the result of calls to
netdev_set_linkmode_and_operstate is inconsequential, it isn't really
worthwhile tracking these calls in order to cancel them.

This patch simplies the handling of these rtnl calls, makes sure that
netdev isn't passed as user data and rewrites the
netdev_set_linkmode_and_operstate signature to be more consistent with
rtnl_set_powered.
2018-08-17 14:10:13 -05:00
Denis Kenzior ec437661b8 netdev: Don't set userdata for getlink 2018-08-17 14:10:13 -05:00
Denis Kenzior 015e8625bf netdev: Make sure set_powered calls are cancelable
Since all netdevs share the rtnl l_netlink object, it was possible for
netdevs to be destroyed with outstanding commands still executing on the
rtnl object.  This can lead to crashes and other nasty situations.

This patch makes sure that Powered requests are always tracked via
set_powered_cmd_id and the request is canceled when netdev is destroyed.
This also implies that netdev_set_powered can now return an -EBUSY error
in case a request is already outstanding.
2018-08-17 14:10:13 -05:00