Commit Graph

2759 Commits

Author SHA1 Message Date
Denis Kenzior 412a03f236 unit: drop unit tests for removed functions 2018-07-30 08:59:55 -05:00
Denis Kenzior 67e590cfeb client: Utilize l_parse_args 2018-07-30 08:59:55 -05:00
Andrew Zaborowski 215162a49e network: Don't free known networks in network_info_put
Fix a double free resulting from network.c freeing a known network when
it goes out of range due to a missing check.
2018-07-30 08:55:27 -05:00
Denis Kenzior 2cd8480feb README: Add a link to the wiki 2018-07-25 16:47:37 -05:00
Tim Kourt 527c0060bc client: add property completion for set-property cmd
In addition, it defines the value options for the Power, WDS and
Mode properties. The builder variant appenders for 'Set' cmd
are also defined here.
2018-07-25 16:05:18 -05:00
Tim Kourt 5549219217 client: switch adapter to use proxy property completion
In addition, it defines the value options for the Power property
2018-07-25 16:05:16 -05:00
Tim Kourt 687dcc6145 client: add variant appender for the on/off properties 2018-07-25 16:05:12 -05:00
Tim Kourt 6ba707fca8 client: add completion for proxy property names and values 2018-07-25 16:05:09 -05:00
Tim Kourt 1e78ed5a7d client: add property setter for device 2018-07-25 16:04:59 -05:00
Tim Kourt f7171665d1 client: add property setter for adapter 2018-07-25 15:26:48 -05:00
Tim Kourt d3742ba651 client: add property setter for proxy
v2: renamed builder_append_value_variant -> append
2018-07-25 15:26:31 -05:00
Tim Kourt 243a574d75 unit: add client token finder test 2018-07-25 11:47:49 -05:00
Tim Kourt c5cf3b083f client: add cmd line token finder
This allows to inspect the cmd line for the existence of a provided
token. This enables the completers to look back to what was entered
before them and make decisions based on that information. For
example, this can be used in completion of the property values
to identify the property for which the value is being completed.
2018-07-25 11:47:10 -05:00
Tim Kourt bb1a0adec7 client: introduce proxy property utils
All of the shared functions related to the processing of the
proxy properties will reside in this collection.
2018-07-25 11:21:14 -05:00
Tim Kourt 2df7f76393 client: rename all local setters to follow nomenclature 2018-07-25 11:17:32 -05:00
Tim Kourt 46a188eb39 client: rename property setters
As the local objects are updated from DBus, the new name is more
appropriate for the purpose.
2018-07-25 11:16:54 -05:00
Tim Kourt dbe36df5ae client: remove wsc capability indicator 2018-07-25 11:16:33 -05:00
Tim Kourt a865f60c54 client: add 'Mode' property to device 2018-07-25 11:16:23 -05:00
Andrew Zaborowski 97913c6f9a network: Refactor and move Known Networks management
Until now network.c managed the list of network_info structs including
for known networks and networks that are seen in at least one device's
scan results, with the is_known flag to distinguish known networks.
Each time the list was processed though the code was either interested
in one subset of networks or the other.  Split the list into a Known
Networks list and the list of other networks seen in scans.  Move all
code related to Known Networks to knownnetworks.c, this simplifies
network.h.  It also gets rid of network_info_get_known which actually
returned the list of all network_infos (not just for known networks),
which logically should have been private to network.c.  Update device.c
and scan.c to use functions specific to Known Networks instead of
filtering the lists by the is_known flag.

This will also allow knownnetworks.c to export DBus objects and/or
properties for the Known Networks information because it now knows when
Known Networks are added, removed or modified by IWD.
2018-07-25 09:40:14 -05:00
Marcel Holtmann 4b9cdd8d7c Release 0.4 2018-07-25 06:18:45 +02:00
James Prestwood fc9cfdc0fe auto-t: Removed unused PSKAgent in EAP-AKA test 2018-07-24 11:53:42 -05:00
Andrew Zaborowski c2abc212ad network: Make networks_connected return void
The return value from network_connected is not checked and even if one
of the storage operations fails the function should probably continue
so only print a message on error.
2018-07-23 11:46:49 -05:00
Andrew Zaborowski ea2b83e5a7 ap: Remove unused psk field 2018-07-23 11:46:15 -05:00
Andrew Zaborowski e084b11d39 autotests: Wait for ConnectHiddenNetwork to finish
This lets the testHiddenNetworks tests check if exceptions have been
raised, makes exceptions_test.py pass.
2018-07-23 11:46:03 -05:00
Andrew Zaborowski 2ca2d080d5 build: Add fswatch.[ch] from ell 2018-07-23 11:45:29 -05:00
James Prestwood c6a35d9005 test: utility to set device mode
There was no way to stop ap/adhoc once started.
2018-07-19 11:22:33 -05:00
James Prestwood a68e958f29 ap: fixed crash in AP
If the device mode it toggled from 'ap' back to 'station' without actually
starting the access point ap_free attempts to zero out the psk, which
causes a crash because it had never been allocated (Start() never was
called). Since ap->psk is actually never used this was removed. Also added
a memset to zero out the pmk on cleanup.

This is the crash observed:

++++++++ backtrace ++++++++
0  0x7f6ffe978a80 in /lib64/libc.so.6
1  0x7f6ffe9d6766 in /lib64/libc.so.6
2  0x42dd51 in memset() at /usr/include/bits/string3.h:90
3  0x42ddd9 in ap_free() at src/ap.c:144
4  0x445ec6 in interface_instance_free() at ell/dbus-service.c:513
5  0x448650 in _dbus_object_tree_remove_interface() at ell/dbus-service.c:1595
6  0x40d980 in device_set_mode_sta() at src/device.c:2113
7  0x447d4c in properties_set() at ell/dbus-service.c:1861
8  0x448a33 in _dbus_object_tree_dispatch() at ell/dbus-service.c:1691
9  0x442587 in message_read_handler() at ell/dbus.c:285
10 0x43cac9 in io_callback() at ell/io.c:123
11 0x43bf5e in l_main_iterate() at ell/main.c:376
12 0x43c01c in l_main_run() at ell/main.c:419
13 0x40379d in main() at src/main.c:460
14 0x7f6ffe96288a in /lib64/libc.so.6
+++++++++++++++++++++++++++
2018-07-19 11:21:43 -05:00
Denis Kenzior 46a797043a ie: Add AKMs from 802.11-2016 2018-07-19 11:09:08 -05:00
Denis Kenzior c4a2654703 ie: Split RSN & WPA akm suite builders 2018-07-19 10:56:46 -05:00
Denis Kenzior 438af4aebc ie: Don't fail RSNE parsing with unknown AKMs 2018-07-19 10:36:18 -05:00
Denis Kenzior c37146d403 wsc: Rework wsc_init & wsc_exit
- wsc module does not need nl80211 any longer, so remove it.
- Move wsc_init & wsc_exit declarations to iwd.h and remove wsc.h
- re-arrange how wsc_init & wsc_exit is called inside main.c.
2018-07-17 19:19:09 -05:00
Denis Kenzior 17bfbbd397 main: Re-arrange _exit order
The plugin_exit was in the wrong place, it should be triggered in case
genl creation fails.  Also adhoc_exit was in the wrong sequence compared
to _init()
2018-07-17 19:15:08 -05:00
Denis Kenzior 6b58ab1a08 main: Simplify sim_auth_init
There's no real reason why sim_auth_init should fail, so simplify the
procedure and move declarations to iwd.h
2018-07-17 19:12:48 -05:00
James Prestwood 8cf44499d1 device: added DEVICE_EVENT_MODE_CHANGED
Rather than have device.c manage the creation/removal of
AP/AdHoc interfaces this new event was introduced. Now
anyone can listen for device events and if the mode changes
handle accordingly. This fixes potential memory leaks
in WSC when switching modes as well.
2018-07-17 18:52:59 -05:00
James Prestwood 06c2d227c8 test: adhoc test script 2018-07-17 17:03:18 -05:00
James Prestwood bea6a9f522 auto-t: Adhoc autotests 2018-07-17 17:03:08 -05:00
James Prestwood 12b3ac47fd auto-t: Added adhoc util functions to IWD class 2018-07-17 17:02:59 -05:00
James Prestwood 6051bdb360 docs: added documentation for Ad-Hoc interface 2018-07-17 16:59:19 -05:00
James Prestwood bf3a171e3a device: added ad-hoc mode
As with station/ap, a new mode was added for ad-hoc
2018-07-17 16:55:59 -05:00
James Prestwood 682c844239 main: added adhoc init to main 2018-07-17 16:46:21 -05:00
James Prestwood 55cb9aa2e9 adhoc: adhoc implementation 2018-07-17 16:46:18 -05:00
James Prestwood 88bd69269e netdev: add join_adhoc/leave_adhoc API's
These will issue a JOIN/LEAVE_IBSS to the kernel. There is
a TODO regarding network configuration. For now, only the
SSID is configurable. This configuration is also required
for AP, but needs to be thought out. Since the current
AP Dbus API has nothing related to configuration items
such as freq/channel or RSN elements they are hard coded,
and will be for Ad-Hoc as well (for now).
2018-07-17 16:25:33 -05:00
James Prestwood e10d79b53f netdev: ensure proper iftype on connect/disconnect
Now that the device mode can be changed, netdev must check that
the iftype is correct before starting a connection or disconnecting.
netdev_connect, netdev_connect_wsc, and netdev_disconnect now check
that the iftype is station before continuing.
2018-07-17 16:16:17 -05:00
James Prestwood 515985afed netdev: choose correct address on NEW_KEY/SET_STATION
With the introduction of Ad-Hoc, its not as simple as choosing
aa/spa addresses when setting the keys. Since Ad-Hoc acts as
both the authenticator and supplicant we must check how the netdev
address relates to the particular handshake object as well as
choose the correct key depending on the value of the AA/SPA address.
802.11 states that the higher of the two addresses is to be used
to set the key for the Ad-Hoc connection.

A simple helper was added to choose the correct addressed based on
netdev type and handshake state. netdev_set_tk also checks that
aa > spa in the handshake object when in Ad-Hoc mode. If this is
true then the keys from that handshake are used, otherwise return
and the other handshake key will be used (aa will be > spa).

The station/ap mode behaves exactly the same as before.
2018-07-17 11:13:53 -05:00
James Prestwood 27430287ab dbus: added Ad-Hoc dbus interface 2018-07-17 10:53:08 -05:00
James Prestwood 42fe517d4e netdev: added station watch
For Ad-Hoc networks, the kernel takes care of auth/assoc
and issues a NEW_STATION event when that is complete. This
provides a way to notify when NEW_STATION events occur as
well as forward the MAC of the station to Ad-Hoc.

The two new API's added:
 - netdev_station_watch_add()
 - netdev_station_watch_remove()
2018-07-17 10:50:34 -05:00
James Prestwood 54cd428c94 netdev: Add IFTYPE_ADHOC interface type
netdev_set_iftype and get_iftype were also changed to
account for all three interface types.
2018-07-17 10:49:10 -05:00
Denis Kenzior efecce772f eapol: Fix memory allocation issues
When the EAPOL-Key data field is encrypted using AES Wrap, check
that the data field is large enough before calculating the expected
plaintext length.

Previously, if the encrypted data field was smaller than 8 bytes, an
integer underflow would occur when calculating the expected plaintext
data length. This would cause iwd to try to allocate a huge amount of
memory, which causes it to abort and terminate. If the data field was
equal to 8 bytes, iwd would try to allocate 0 bytes of memory, making
l_new return NULL, which subsequently causes iwd to crash on a NULL
pointer deference.

Reported-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
2018-07-16 10:51:13 -05:00
Denis Kenzior 49d011dabe client: Use connect-hidden instead of create-hidden 2018-07-13 12:36:09 -05:00
Denis Kenzior 57c3aa2589 scan: Fix triggered flag setting
triggered flag was being reset to false in all cases.  However, due to
how scan_finished logic works, it should have remained true if no more
commands were left to be sent (e.g. the scan was finished).
2018-07-13 12:34:59 -05:00