Commit Graph

724 Commits

Author SHA1 Message Date
Rahul Rahul 5853440dfa netdev: support for REKEY_OFFLOAD and its event handling 2016-06-22 18:44:46 -05:00
Rahul Rahul fb339bcc76 eapol: helper functions for REKEY_OFFLOAD 2016-06-22 18:44:17 -05:00
Denis Kenzior dc721a6ae2 netdev: Set callbacks for operstate
When setting operstate to dormant or down, give it a callback for debug
purposes.  It looks like that operstate down message does not have a
chance to go out currently.
2016-06-21 15:18:50 -05:00
Andrew Zaborowski 844c0a256c device: Add a read-only Powered property 2016-06-21 14:08:27 -05:00
Andrew Zaborowski 6667176ec9 device: React to netdev state changes 2016-06-21 14:08:24 -05:00
Andrew Zaborowski b6c22fc1b9 netdev: netdev watch support 2016-06-21 14:08:21 -05:00
Andrew Zaborowski aa7a6a4619 netdev: Track interface UP flag 2016-06-21 14:08:19 -05:00
Andrew Zaborowski c3f863f2da knownnetworks: Implement KnownNetworks interface
knownnetworks.c/.h implements the KnownNetworks interface and loads the
known networks from storage on startup.  The list of all the networks
including information on whether a network is known is managed in
network.c to avoid having two separate lists of network_info structures
and keeping them in sync.  That turns out to be difficult because the
network.c list is sorted by connected_time and connected_time changes
can be triggered in both network.c or knownnetworks.c.  Both can also
trigger a network_info to be removed completely.
2016-06-21 11:41:37 -05:00
Andrew Zaborowski 694c91db44 network: track whether network is known
network_info gets a is_known flag that is used for the
GetOrderedNetworks tracking and to implement the KnownNetworks
interface - loading of the list of known networks on startup and
forgetting networks.
2016-06-21 11:36:31 -05:00
Andrew Zaborowski 9daf1f3fcf network: Refactor network_info usage
For simplicity and future use (possibly performance), every struct network
gets a pointer to a network_info structure, there's one network_info for
every network being by any interface, not only known networks.  The SSID
and security type information is removed from struct network because the
network_info holds that information.

network_info also gets a seen_count field to count how many references
from network.info fields it has, so as to fix the removal of
network_info structures.  Previously, once they were added to the
networks list, they'd stay there forever possibly skewing the network
ranking results.

This also fixed the network ranking used by GetOrderedNetwork which
wasn't working due to a missing assignment of *index in
network_find_info also triggering valgrind alerts.
2016-06-20 23:39:42 -05:00
Denis Kenzior 311a6cf5b1 device: Make device object opaque 2016-06-16 16:37:14 -05:00
Denis Kenzior 74add19057 device: Move the rest of device specific code
.. out of wiphy.c
2016-06-16 16:37:14 -05:00
Denis Kenzior 0fe815f870 netdev: Move deauthenticate handling out of wiphy.c 2016-06-16 16:37:14 -05:00
Denis Kenzior 48c0a216d7 wiphy: Rearrange / remove #includes 2016-06-16 16:37:14 -05:00
Denis Kenzior c28e652570 device: Move device_list management out of wiphy.c 2016-06-16 16:37:14 -05:00
Denis Kenzior 49c7515ac1 netdev: Move eapol_io handling 2016-06-16 16:37:12 -05:00
Denis Kenzior 75ce550de9 netdev: Move operstate operations out of wiphy.c
Also make netdev_set_linkmode_and_operstate static
2016-06-16 15:13:43 -05:00
Denis Kenzior dd4b0dc3d3 netdev: Move key setting logic out of wiphy.c 2016-06-16 15:13:43 -05:00
Denis Kenzior c714b20102 wiphy: Move handshake_failed handler out of wiphy.c 2016-06-16 15:13:43 -05:00
Denis Kenzior 64d382cc89 netdev: Move disconnect event handling
.. out of wiphy.c
2016-06-16 15:13:43 -05:00
Denis Kenzior 0eeb71e4eb netdev: Move CQM event handling out of wiphy.c 2016-06-16 15:13:43 -05:00
Denis Kenzior d526dbc175 netdev: Move associate event handling
.. out of wiphy.c
2016-06-16 15:13:39 -05:00
Denis Kenzior 1ab6415e8c device: Handle successful connections 2016-06-16 10:53:26 -05:00
Denis Kenzior d82754636b netdev: Move deauthenticate event handling
.. out of wiphy.c
2016-06-15 14:02:24 -05:00
Denis Kenzior f5a7e204e7 device: Fix valgrind warning
Device removal should probably be managed by netdev objects going away,
but for now, silence the warning
2016-06-15 11:01:44 -05:00
Denis Kenzior 31a0e42772 wiphy: Move association logic out of wiphy.c
The eapol state machine parameters are now built inside device.c when
the network connection is attempted.  The reason is that the device
object knows about network settings, wiphy constraints and should
contain the main 'management' logic.

netdev now manages the actual low-level process of building association
messages, detecting authentication events, etc.
2016-06-15 10:54:13 -05:00
Denis Kenzior b93ae37325 eapol: Add eapol_sm_get_own_ie 2016-06-14 19:57:21 -05:00
Denis Kenzior 6d81e0a172 eapol: Add eapol_sm_get_group_cipher 2016-06-14 19:57:21 -05:00
Denis Kenzior c1ff686ed6 eapol: Add eapol_sm_get_pairwise_cipher 2016-06-14 19:57:21 -05:00
Denis Kenzior d297fbb215 netdev: Add stubs for netdev_disconnect 2016-06-14 19:57:21 -05:00
Denis Kenzior b2d8616ca4 device: Move device_get_address out of wiphy.c 2016-06-14 19:57:21 -05:00
Denis Kenzior c18cf173c3 device: Move device_get_ifindex out of wiphy.c 2016-06-14 19:57:21 -05:00
Denis Kenzior 74c8af9180 device: Move device_get_wiphy out of wiphy.c 2016-06-14 19:57:21 -05:00
Denis Kenzior e23ea59f95 device: Move device_is_busy out of wiphy.c 2016-06-14 19:57:21 -05:00
Denis Kenzior 6e57e4a00c device: Move device_get_path out of wiphy.c 2016-06-14 19:57:21 -05:00
Denis Kenzior e0c27a2ca8 device: Move device_get_connected_network
out of wiphy.c
2016-06-14 19:57:21 -05:00
Denis Kenzior aedbdd01ae device: Migrate authentication to netdev api
This also moves device_connect_network to device.c where it belongs
2016-06-14 19:57:21 -05:00
Denis Kenzior 51f89e34e9 netdev: Add initial netdev_connect logic 2016-06-14 19:57:18 -05:00
Denis Kenzior 6bd71066ff device: Move device_disassociated out of wiphy.c 2016-06-14 11:16:07 -05:00
Denis Kenzior 64604ed59c device: Expose device_enter_state 2016-06-14 11:13:34 -05:00
Denis Kenzior 1e99fc182e device: Group declarations inside header 2016-06-14 11:12:35 -05:00
Denis Kenzior 9d4baab8bd device: Move device structure definition
Temporarily move device structure definition into device.h and out of
wiphy.c.  Eventually the device structure should be opaque to device.c
2016-06-14 11:11:06 -05:00
Denis Kenzior 432ec3e69f storage: Return const char * 2016-06-10 09:59:59 -05:00
Andrew Zaborowski 9cef1490c5 network: Basic last seen time tracking 2016-06-10 09:33:54 -05:00
Andrew Zaborowski a0468fb9be device: Implement GetOrderedNetworks()
Keep an updated sorted list of networks in addition to the "networks"
hashmap.  The list can be queried through the GetOrderedNetworks dbus
method.

We also take advantage of that list to get rid of a single
l_hashmap_foreach in new_scan_results.
2016-06-10 09:33:13 -05:00
Andrew Zaborowski ca3cd12fb0 network: General network rank calculation
A function that calculates a new rank type to order all networks
currently seen by a netdev.  The order is designed for displaying the
list to user so that the networks most likely to be wanted by the user
are first on the list.
2016-06-10 09:29:43 -05:00
Andrew Zaborowski 99f99e0bc0 agent: Add reason parameter to Cancel
Add a parameter the UI can use to show user an explanation of why a
password prompt is disappearing.
2016-06-10 09:26:56 -05:00
Andrew Zaborowski b6c9508912 storage: Add storage_network_ssid_from_path
The operation opposite to get_network_file_path.
2016-06-09 15:01:32 -05:00
Andrew Zaborowski 11f23d500c network: Add network_get_signal_strength 2016-06-09 14:40:18 -05:00
Andrew Zaborowski dae897854b network: return boolean from network_rankmod
Since the rankmod value only makes sense for autoconnectable networks,
change network_rankmod to return an indication of whether the rankmod is
valid as a boolean instead of as a double, as discussed before.
2016-06-09 14:16:06 -05:00
Andrew Zaborowski e07b24e5d8 wiphy: Move NULL check to device_disassociated
Do nothing in device_disassociated if device->connected_network
indicates we are not associated.  This may happen if the device was
connected since before iwd was started, this should possibly be fixed
separately by querying device state when device is detected.
2016-06-09 14:14:20 -05:00
Andrew Zaborowski 3fa9a21a39 network: Add network_disconnected
Let network handle anything that needs to be done on a disconnection,
this way keep the settings opening and closing logic in network.c.
2016-06-09 14:13:58 -05:00
Denis Kenzior 454f7d7867 iwd: Update to the new l_main api 2016-06-09 09:56:40 -05:00
Andrew Zaborowski ab15413294 storage: Add storage_network_remove 2016-06-08 11:33:57 -05:00
Andrew Zaborowski 8be78588e2 common: Add security_from_str
The reverse operation of security_to_str.
2016-06-08 11:08:10 -05:00
Andrew Zaborowski 0cb233cdde agent: Drop unused declaration 2016-06-08 11:06:28 -05:00
Andrew Zaborowski 2285ad24ab network: Create a settings file on connection
Make sure networks of all 4 security types have a settings file created
or updated with a new modification time on a successful connect so that
autoconnect and network sorting works for networks other than PSK too.

By doing this on storage_network_touch failure we make sure we don't
overwrite anything dropped into the settings directory while we were
connecting.
2016-06-08 11:03:53 -05:00
Andrew Zaborowski 33d2ae60e9 network: Use security_to_str instead of switch(security)
Convert switch (network->security) statements to security_to_str to be
consistent across network.c in how the settings file name ending is
obtained.
2016-06-08 11:01:35 -05:00
Denis Kenzior b2bcf97373 scan: Remove unused scan_bss_address_to_string 2016-06-06 18:25:12 -05:00
Denis Kenzior c96d43a6da wiphy: Use util_address_to_string 2016-06-06 18:25:00 -05:00
Denis Kenzior 22e1c2f592 wsc: Use util_address_to_string 2016-06-06 18:24:49 -05:00
Denis Kenzior 64c388fe76 wiphy: Fix crash in device address property getter
Address is being returned as a string, even though it is actually an
array of 6 uint8_t elements
2016-06-06 18:23:53 -05:00
Denis Kenzior 92c943998f util: Add util_address_to_string 2016-06-06 18:23:17 -05:00
Denis Kenzior dcfbc74326 wiphy: Remove addr from device struct 2016-06-06 12:05:24 -05:00
Denis Kenzior cedb980f92 wiphy: Remove name from device struct 2016-06-06 12:05:20 -05:00
Denis Kenzior d6c6e4acda netdev: Move netdev enumeration to netdev.c 2016-06-06 12:03:23 -05:00
Denis Kenzior 833ed20b9a netdev: Add netdev_get_name 2016-06-03 09:53:47 -05:00
Denis Kenzior 1573bf7d99 netdev: Add netdev_get_iftype 2016-06-03 09:53:47 -05:00
Denis Kenzior 1bd7baf44b netdev: Add netdev_find 2016-06-03 09:53:46 -05:00
Denis Kenzior 8e7829e1ab netdev: Add netdev_get_address 2016-06-03 09:53:46 -05:00
Denis Kenzior 7a3f823d26 netdev: Add netdev_get_ifindex 2016-06-03 09:53:46 -05:00
Denis Kenzior 7c359ee2c2 netdev: Add netdev struct definition 2016-06-03 09:53:46 -05:00
Denis Kenzior 8113f4c64e wiphy: Add wiphy_find 2016-06-03 09:53:46 -05:00
Denis Kenzior 61b50cf81f netdev: Parse NEW_INTERFACE and DEL_INTERFACE 2016-06-03 09:53:46 -05:00
Denis Kenzior e5821f6ade netdev: Remove unneeded comment 2016-06-03 09:53:46 -05:00
Denis Kenzior 280f2d40ad netdev: Make netdev_init accept nl80211 2016-06-03 09:53:46 -05:00
Denis Kenzior 7b929181ca wiphy: Remove unused wiphy_notify_dellink 2016-06-01 13:07:04 -05:00
Denis Kenzior 3563c65111 netdev: Don't track NEWLINK & DELLINK
The plan is to use the much more reliable NEW_WIPHY, DEL_WIPHY,
NEW_INTERFACE, DEL_INTERFACE events.
2016-06-01 13:07:04 -05:00
Denis Kenzior 0b0fd5639f wiphy: Parse NEW_WIPHY and DEL_WIPHY events 2016-06-01 13:07:04 -05:00
Denis Kenzior e48ca5a5a6 wiphy: Rename netdev to device 2016-06-01 13:06:59 -05:00
Denis Kenzior af9ca22360 wiphy: Remove extraneous return 2016-05-31 11:29:48 -05:00
Andrew Zaborowski 1ba2630216 networks: Simplify parameters
for network_seen and network_connected

Only accept a struct network pointer instead of separately the ssid and
security type.  This is needed so we can do some more simplification in
the next patch by having access to the network struct.
2016-05-30 21:46:45 -05:00
Andrew Zaborowski 9fbdba0957 network: Add "const" to the getter argument types 2016-05-30 21:46:08 -05:00
Andrew Zaborowski 2e4848673a network: Check for duplicates in network_seen
It looks like with multiple netdev seeing the same networks we'd create
multiple network_info structures for each network.  Since the
"networks" list (of network_info structs) is global that's probbaly not
the intention here.
2016-05-30 21:45:52 -05:00
Andrew Zaborowski 2901cb1169 main: Restore agent_exit call before main loop exit 2016-05-25 09:57:58 -05:00
Andrew Zaborowski 176a5bcf76 storage: Encode SSIDs in file names if necessary
SSIDs with characters other than A-Z0-9_- and space are encoded with
l_util_hexstring and prefixed with a = sign to differentiate them.
2016-05-24 11:14:33 -05:00
Rahul Rahul fc7ca17558 wiphy: added hw address property to device 2016-05-23 14:54:27 -05:00
Andrew Zaborowski 7950e2d5d3 wiphy: Emit PropertyChanged signals
for Device and Network
2016-05-23 11:55:06 -05:00
Andrew Zaborowski ab1319a9d5 wiphy: Drop Device.GetNetworks and related signals
Drop the Device interface methods and properties made redundant by
the ObjectManager.
2016-05-23 11:48:41 -05:00
Andrew Zaborowski 15bab067fc dbus: Remove Manager interface, add AgentManager
Move the Agent-related methods to a new interface, AgentManager, and
drop the remaining methods and signals made redundant by the
ObjectManager.
2016-05-23 11:46:59 -05:00
Andrew Zaborowski 3e2562a5a8 dbus: Enable the ObjectManager interface 2016-05-23 11:43:13 -05:00
Denis Kenzior 74689303df network: Make network object opaque 2016-05-16 16:14:26 -05:00
Denis Kenzior 0e106d8534 wiphy: Use network_bss_* api 2016-05-16 16:14:15 -05:00
Denis Kenzior 44d9746e5f network: Add network_bss_list_clear 2016-05-16 16:13:52 -05:00
Denis Kenzior b4cebf918a network: Add network_bss_list_isempty 2016-05-16 16:13:36 -05:00
Denis Kenzior f177f75f92 network: Add network_bss_add 2016-05-16 16:06:41 -05:00
Denis Kenzior cefba4d735 wiphy: Use network_connect_failed 2016-05-16 16:03:17 -05:00
Denis Kenzior ad722cf004 network: Add network_connect_failed 2016-05-16 16:03:14 -05:00
Denis Kenzior dcadf4d2f8 wiphy: Use network_autoconnect 2016-05-16 16:00:21 -05:00
Denis Kenzior 8e8b2caa9a network: Add network_autoconnect 2016-05-16 16:00:10 -05:00
Denis Kenzior c619a71652 wiphy: Use network accessor methods 2016-05-16 15:44:27 -05:00
Denis Kenzior b79453952c network: Add network_get_settings 2016-05-16 14:37:45 -05:00
Denis Kenzior 93c8a4f090 network: Add network_get_psk 2016-05-16 14:22:24 -05:00
Denis Kenzior 9bfa0aa768 merge: device_connect_network 2016-05-16 13:48:10 -05:00
Denis Kenzior d4feeebdc1 network: Move network related code into network.c
away from wiphy.c
2016-05-16 12:37:48 -05:00
Denis Kenzior 5e4c675175 network: Use device_get_wiphy 2016-05-16 12:32:44 -05:00
Denis Kenzior 66610f1248 device: Add device_get_wiphy() 2016-05-16 12:26:00 -05:00
Denis Kenzior 68a79b23fb device: Add device_is_busy() 2016-05-16 12:24:41 -05:00
Denis Kenzior a9e9be469c wiphy: Expose wiphy_select_cipher 2016-05-16 12:21:26 -05:00
Denis Kenzior bcb2ef3e40 network: Rework connect logic 2016-05-16 12:05:28 -05:00
Denis Kenzior 2fe80a8f86 device: Add device_connect_network 2016-05-16 12:04:45 -05:00
Denis Kenzior 80aba66e98 network: Make network_emit_* static 2016-05-15 21:42:14 -05:00
Denis Kenzior a789703f6f wiphy: Use network_create, register & remove 2016-05-15 21:41:37 -05:00
Denis Kenzior 18957e504e network: Add network_remove 2016-05-15 21:37:12 -05:00
Denis Kenzior d0ae833edb network: Add network_register 2016-05-15 21:30:52 -05:00
Denis Kenzior d1948c0233 network: Add network_new 2016-05-15 21:29:47 -05:00
Denis Kenzior 54e7cced8e network: Move PSK sync to network.c 2016-05-15 21:04:02 -05:00
Denis Kenzior 24366efb32 wiphy: Use network_settings_load & _close 2016-05-15 21:01:46 -05:00
Denis Kenzior 2e46201a1e network: Add network_settings_load and _close 2016-05-15 21:01:38 -05:00
Denis Kenzior 49df40fdff network: Move network_emit_removed to network.c 2016-05-12 09:52:52 -05:00
Denis Kenzior 5dc3a892db network: Move network_emit_added to network.c 2016-05-12 09:51:02 -05:00
Denis Kenzior 3ca8dfb5ad wiphy: move & rename iwd_device_get_path
Move declaration to device.h and rename to device_get_path
2016-05-12 09:49:07 -05:00
Denis Kenzior ae1dc10c0c wiphy: Move __iwd_network_append_properties
to network.c
2016-05-11 22:32:25 -05:00
Denis Kenzior 23fe106cc5 device: Add device_get_connected_network() 2016-05-11 22:27:31 -05:00
Denis Kenzior 08d72cd213 netdev: Remove unused typedefs 2016-05-11 22:24:40 -05:00
Denis Kenzior 0c7504b5fb wiphy: Use network_get_security() 2016-05-11 22:12:25 -05:00
Denis Kenzior b166285f44 network: Add network_get_security() 2016-05-11 22:12:25 -05:00
Denis Kenzior f3ad1492c9 wiphy: Use network_get_path() 2016-05-11 22:12:25 -05:00
Denis Kenzior beea6897d3 network: Add network_get_path() 2016-05-11 22:12:23 -05:00
Denis Kenzior 2ccbf65519 wiphy: Use network_get_netdev 2016-05-11 22:04:09 -05:00
Denis Kenzior 54574dc153 network: Add network_get_netdev 2016-05-11 22:02:49 -05:00
Denis Kenzior 0847e31542 wiphy: Use network_get_ssid 2016-05-11 22:01:44 -05:00
Denis Kenzior 9e4200f2f3 network: Add network_get_ssid 2016-05-11 22:00:58 -05:00
Denis Kenzior 414bc3198d wiphy: Move network object definition 2016-05-11 21:59:32 -05:00
Denis Kenzior 17a8460835 scan: Move scan_ssid_security to iwd.h
Security type is used all over the place, so move it out to a more
common place.
2016-05-11 15:54:14 -05:00
Denis Kenzior aa7f88a78c agent: Fix bug in UnregisterAgent 2016-05-06 12:39:35 -05:00
Denis Kenzior c2c4039e79 wiphy: Rename netdev_state to device_state 2016-05-05 12:25:45 -05:00
Denis Kenzior f3fc0ea1f9 device: Refactor netdev watches
Turn netdev watches into device watches.  The intent is to refactor out
netdev specific details into its own class and move device specific
logic into device.c away from wiphy.c
2016-05-05 12:14:59 -05:00
Denis Kenzior 9a0d620800 wsc: Refactor includes 2016-05-05 12:07:46 -05:00
Denis Kenzior 0e3495488f wiphy: Move netdev_state enum 2016-05-05 11:40:54 -05:00
Denis Kenzior 08decb340e netdev: Move rta_add_u8
Move closer to where it is used
2016-05-05 11:32:11 -05:00
Denis Kenzior 97be0e87c3 scan: Fix crash
Sometimes the periodic scan is started and stopped before the timeout
was created.  If periodic_scan_stop was called before, the timeout
object was not reset to NULL, which can lead to a crash.
2016-04-13 16:03:33 -05:00
Denis Kenzior 3cbbe2cc42 main: Add backtracing support
Ported from oFono @ commit df5d691c39b0ff41d3d98a01db078f7157eb0250.
2016-04-13 14:08:10 -05:00
Denis Kenzior 45b7323e0a scan: Add support for scan abortions 2016-04-12 13:49:50 -05:00
Andrew Zaborowski 692bfa23fe wiphy: Sanity check before netdev_disassociated
The lost beacon event can be received when iwd thinks netdev is
diconnected if it was connected before iwd started, and then
netdev_disassociated will segfault.
2016-04-11 14:39:06 -05:00
Andrew Zaborowski fb1adcae2a dbus: Use recently added l_dbus_name_acquire
Use the backend-independent l_dbus_name_acquire.
2016-04-04 14:35:52 -05:00
Andrew Zaborowski a64030069e dbus: Drop unused linux/kdbus.h src/kdbus.c
Drop the functions that duplicated ell functionality and the now
unneeded kdbus.h copy.
2016-04-04 14:27:26 -05:00
Andrew Zaborowski 79839dbfd6 dbus: Use native ell kdbus calls
It seems until now dbus.c would always connect to dbus-1 (unless
DBUS_SESSION_BUS_ADDRESS pointed at kdbus) and passing -K only made
iwd create a kdbus bus and not use it.  Now use ell to actually use
kdbus instead of dbus-1 with -K.  Don't use the src/kdbus.c functions
that duplicate ell functionality.  As a side effect the connection
description and the bloom sizes are now the ell defaults.
2016-04-04 14:25:59 -05:00
Rahul Rahul 971d93a9e6 wiphy: Add ConnectedNetwork property to Device
This property is optional.  If the device is connected, it holds the
object path of the connected network.
2016-03-09 16:46:07 -06:00
Rahul Rahul 07f49bc02d dbus: Add API for adding object path value to a dict 2016-03-09 13:24:19 -06:00