3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-28 07:39:23 +01:00
Commit Graph

2443 Commits

Author SHA1 Message Date
Tim Kourt
f0b3a6cf1d rtnlutil: Add IPv6 address change helpers
Implements the IPv6 helper functions to add/delete IP addresses.
2019-09-30 11:08:01 -05:00
Tim Kourt
e3e569b75b rtnlutil: Add IPv6 address dump 2019-09-30 11:07:37 -05:00
Tim Kourt
c8eb33c2c2 rtnlutil: Add parser for IPv6 RTNL packet
At this time, we are only looking for IFA_ADDRESS attribute that
represents the IPv6 IP address.
2019-09-30 11:07:37 -05:00
Tim Kourt
d954eee0cc netconfig: Change public API
As a first step to enable the usage of netconfig in ead and
prospective transition to be a part of ell, the public API for
creation and destruction of the netconfig objects has been
renamed and changed. Instead of hiding the netconfig objects inside
of netconfig module, the object is now passed back to the caller.
The internal queue of netconfig objects remains untouched, due
to limitations in ell’s implementation of rtnl. After the proper
changes are done to ell, netconfig_list is expected to be removed
from netconfig module.
2019-09-27 16:32:05 -05:00
Tim Kourt
c8dfb6061d netconfig: Rename netconfig destructor
The old name will be repurposed for the API.
2019-09-27 16:31:56 -05:00
Denis Kenzior
3b040f5c27 main: Make rfkill an IWD_MODULE 2019-09-24 10:07:40 -05:00
Marcel Holtmann
765bb92084 build: Add skeleton manual pages for all installed binaries 2019-09-22 21:57:47 +02:00
Denis Kenzior
73f6e0b43b anqp: Use nl80211_parse_attrs 2019-09-19 23:04:06 -05:00
Denis Kenzior
91784425ec wiphy: Remove wiphy_parse_id_and_name
in favor of using nl80211_parse_attrs
2019-09-19 22:55:07 -05:00
Denis Kenzior
bf7e62fafb manager: Simplify parsing using nl80211_parse_attrs 2019-09-19 22:42:25 -05:00
Denis Kenzior
d400c7f303 manager: Simplify manager_parse_wiphy_id
using nl80211_get_attrs
2019-09-19 22:42:02 -05:00
Denis Kenzior
2772845a7b manager: Simplify manager_parse_ifindex
using nl80211_parse_attrs
2019-09-19 22:42:02 -05:00
Denis Kenzior
2dbcad3185 nl80211util: Add skeleton of nl80211_parse_attrs 2019-09-19 22:41:54 -05:00
Denis Kenzior
1fc480c007 manager: Remove stale comment
setup_timeout was removed by the previous patch, so this comment no
longer applies.
2019-09-19 21:05:57 -05:00
James Prestwood
95f1fb1663 manager: dump wiphy/iface on NEW_WIPHY
A NEW_WIPHY event may not always contain all the information about a
given phy, but GET_WIPHY will. In order to get everything we must
mimic the behavior done during initalization and dump both wiphy
and interfaces when a NEW_WIPHY comes in.

Now, any NEW_WIPHY event will initialize a wiphy, but then do a
GET_WIPHY/GET_INTERFACE to obtain all the information. Because of
this we can ignore any NEW_INTERFACE notifications since we are
dumping the interface anyways.

Once some kernel changes get merged we wont need to do this anymore
so long as the 'full' NEW_WIPHY feature is supported.
2019-09-19 20:49:41 -05:00
James Prestwood
27ae3ce14d network: validate passphrase on _set_passphrase 2019-09-18 16:48:29 -05:00
James Prestwood
42e083cf9b crypto: add crypto_passphrase_is_valid
Move this check out of crypto_psk_from_passphrase so other modules
can validate a passphrase.
2019-09-18 16:48:07 -05:00
James Prestwood
7a9891dbef wsc: store plain text passphrase if available
If the AP sent us the plain passphrase we can now store that rather
than generating the PSK. This will allow WPA3 to work properly when
WPA3 + WSC is implemented.
2019-09-18 16:47:41 -05:00
James Prestwood
2c14e73f82 network: add network_set_passphrase
This lets other modules (like WSC) to set a plain text passphrase
as opposed to only allowing a PSK to be set. network_get_psk was
also updated to generate a PSK on-the-fly if required. Since WPA3
requires the raw passphrase to work, it makes sense to just store
the passphrase if we have it.
2019-09-17 16:20:28 -05:00
James Prestwood
a8187468b5 station: optimize roam scanning
If neighbor reports are unavailable, or the report yielded no
results we can quickly scan for only known frequencies. This
changes the original behavior where we would do a full scan
in this case.
2019-09-17 11:52:55 -05:00
James Prestwood
235fd2b7e6 eap-pwd: remove old EAP-PWD-Password support
This password key was deprecated in favor of the common EAP-Password
key. Its been about a year so we are now removing support entirely
for EAP-PWD-Password.
2019-09-17 11:46:19 -05:00
James Prestwood
07e6876ef5 knownnetworks: add roam frequency getter
Gets a newly created scan_freq_set containing the most recent
frequencies for the network. The currently connected BSS frequency
(passed as a parameters) will not be included in the set.
2019-09-17 11:39:12 -05:00
James Prestwood
d9e6b2263f scan: add scan_freq_set_isempty 2019-09-17 11:28:23 -05:00
James Prestwood
09d336dbdd knownnetworks: free file_path in get_uuid 2019-09-16 15:24:49 -05:00
James Prestwood
66346712e6 knownnetworks: make frequencies/UUID forgettable
Since the UUID was being generated purely on the file path, it
would never change for a given network (unless the SSID/name changed).
In the future we would like to use this unique UUID to generate a
MAC per-SSID, and if that network is forgotten we also want the UUID
to change next time the network is connected to.

Rather than only using the file path, the mtime can also be fed into
the UUID generation. Since the mtime would be changed after forgetting
and re-adding a known network we will get a new UUID.

Now, whenever a known network is removed, we lookup the UUID we have
in network_info and remove that entry in the settings file and
sync the frequency file.
2019-09-16 13:48:48 -05:00
James Prestwood
f57b73898b knownnetwork: track/optimize UUID for known networks
The UUID was being generated every time we synced which is wasteful.
Instead we can track the UUID inside network_info and only generate
it once when needed.

Two new network_info APIs were added:
network_info_set_uuid
network_info_get_uuid

The setter is used when the frequency file is loaded. If a valid UUID
is found in the frequency file this UUID is set and used.

network_info_get_uuid will not just get the UUID, but actually generate
it if one has not been set yet. This will allow other modules to
get/generate the UUID if one has no been loaded from the frequency
file.
2019-09-16 13:39:41 -05:00
James Prestwood
96998a83c5 netdev: handle QoS Map IE/Frame
The QoS Map can come in either as a management frame or via the
Associate Response. In either case this IE simply needs to be
forwarded back to the kernel.
2019-09-13 17:29:39 -05:00
James Prestwood
74aa280b56 wiphy: set QoS bit in extended capabilities 2019-09-13 17:29:39 -05:00
James Prestwood
8d3b065022 wiphy: fix bits in extended capabilities
The extended capability bits were not being set properly inside
wiphy. Since we build the IE after the wiphy dump the first 2
bytes are the IE type and length. The way we were setting the bits
did not take this into account and were actually setting the
completely wrong bits.
2019-09-13 12:37:59 -05:00
James Prestwood
ef209c305b knownnetworks: make known frequencies its own module
The known frequency file was being loaded at the end of the known
networks initialization routine. This allowed all known networks
to be properly loaded, but since hotspot depends on known networks,
its initalization would be run afterwards meaning the frequency
loading would not have been finding any hotspot networks.

To fix this a new module was added inside known networks which
depends on hotspot. This means that first known networks will
initialize, then hotspot, then the frequency file would be loaded.
2019-09-12 12:55:30 -05:00
James Prestwood
4eaf93d26a knownnetworks: rework known frequencies
The current format for the .known_networks.freq file had a hidden
limitation of not being able to handle SSID's with some special
characters. Since the provisioning file path was used as the
group name the filename was limited to only characters supported
by l_settings groups, which conflicted with allowable SSID
characters.

Instead we can generate a unique UUID for each network and use
this as the group. For this particular case the group does not
really matter, so long as its unique. But we can utilize this unique
UUID for other purposes, including using it as a seed for changing
the MAC address per-connection in the future.

The .known_networks.freq file will now have the following format:

[<UUID>]
name=/path/to/provisioning/file
list= XXXX YYYY ZZZZ
2019-09-12 11:33:00 -05:00
James Prestwood
f5db4bfea8 network: sync frequencies per-network
The existing frequency syncing was done when IWD closes. Instead we
can sync as networks are connected to or promoted to known which
will keep the FS more up to date. This also allows hotspot networks
to use the known frequency file.
2019-09-12 11:32:50 -05:00
James Prestwood
9ed5fba57b knownnetwork: add known_network_frequency_sync
This API will sync the known frequencies of a network_info object
to disk. This will allow network to sync known frequencies as
known networks are added, rather that when IWD closes.

Since this will result in more frequent syncing that before, the
known_freqs settings pointer was moved globally in knownnetworks.c
as to only parse the file one time rather than on every sync.
2019-09-12 11:28:20 -05:00
James Prestwood
3dba205de1 hotspot: implement get_file_path op 2019-09-12 11:28:20 -05:00
James Prestwood
3b49a57bda knownnetworks: add get_file_path op
Gets the provisioning file path stored on disk
2019-09-12 11:27:38 -05:00
Denis Kenzior
0c7751485d ie: Always include RSN Capabilities bytes 2019-09-11 15:28:10 -05:00
Tim Kourt
0db5f59d07 peap: Send cleartext ACK to tunneled EAP-Success
Some of the EAP-PEAP server implementations seem to require a
cleartext ACK for the tunneled EAP-Success message similar to EAP-TLS
specification, instead of simply shutting down the tunnel like
EAP-PEAPv1 requires.

ACKing the tunneled EAP-Success seems also to work for implementations
which were relying on the tunnel close event.
2019-09-11 15:27:02 -05:00
Tim Kourt
692a15368c peap: Add debug statements 2019-09-11 13:23:46 -05:00
James Prestwood
d2162a7491 station: fix NAI realms leak
After the known network refactor this string list was no longer set
into the network object. Now it should be freed in all cases after
the search.
2019-09-11 11:55:25 -05:00
James Prestwood
6aeeb9eaad knownnetworks: check for valid info before calling op 2019-09-09 19:09:50 -05:00
James Prestwood
99483489bc module: print module name/error if it fails to start 2019-09-09 15:42:09 -05:00
James Prestwood
29a05eb402 storage: fix hotspot dir creation
create_dirs was dependent on the path ending in '/' to create the
full path. The hotspot code did not include a '/' at the end so
it was not getting created, which prevented the hotspot module
from initializing.
2019-09-09 15:42:09 -05:00
James Prestwood
2b27ec26a0 build: remove hotspot.h 2019-09-09 15:37:45 -05:00
James Prestwood
18ac43c8d8 hotspot: remove hs20_get_roaming_consortium 2019-09-09 15:37:27 -05:00
James Prestwood
cff08afd14 network: remove hotspot.h include 2019-09-09 15:37:17 -05:00
James Prestwood
45c059ccf8 station: use network_get_vendor_ies
Station was building up the HS20 elements manually. Now we can
use this new API and let network take care of the complexity
of building network specific vendor IEs.
2019-09-09 15:36:53 -05:00
James Prestwood
83cba4fb1f hotspot: implement 'get_vendor_ies'
This op builds up the vendor IEs required for hotspot 2.0. The
version, and optionally the RC are provided in order to correctly
build the HS20 Indication Element and RC Selection element.
2019-09-09 15:35:29 -05:00
James Prestwood
b2bfd58378 network: add network_get_vendor_ies
This is to encapsulate any vendor IE building required for certain
network types. Currently only hotspot requries this.
2019-09-09 15:34:45 -05:00
James Prestwood
bff0740829 knownnetworks: add get_vendor_ies operation
This will provide the hotspot module with enough info for it to
build the required vendor IEs to be provided with (Re)Association.
2019-09-09 15:33:54 -05:00
James Prestwood
689fd7b92b netdev: make vendor_ies const on netdev_connect() 2019-09-09 09:55:12 -05:00
James Prestwood
af46cc0ed2 knownnetworks: get matched RC on match_roaming_consortium
The HS20 module had its own getter for returning the matched roaming
consortium. Since we already have the network_info op for matching
we might as well return the matched RC rather than just a bool. This
allows the RC to be included in (Re)Association without the need for
a specific getter.
2019-09-09 09:44:15 -05:00
Marcel Holtmann
1104d69e29 build: Add StateDirectoryMode=0700 option to systemd service 2019-09-09 06:55:22 +02:00
Marcel Holtmann
41f865d4df build: Use NotifyAccess=main feature when running under systemd 2019-09-08 20:36:57 +02:00
Marcel Holtmann
e6a99f461a build: Start using CapabilityBoundingSet option from systemd 2019-09-08 20:26:49 +02:00
Marcel Holtmann
e9c39decda storage: Fix wrong format identifier for known frequencies file 2019-09-08 20:11:15 +02:00
Marcel Holtmann
71ae0bee9c build: Add StateDirectory= option to service files 2019-09-08 19:56:21 +02:00
Marcel Holtmann
49c4f46efc knownnetworks: Use storage_get_path to get storage directory 2019-09-08 19:21:07 +02:00
Marcel Holtmann
58d5fdf6c4 hotspot: Use storage_get_hotspot_path to get storage directory 2019-09-08 19:20:37 +02:00
Marcel Holtmann
8706be6698 storage: Add support for utilizing STATE_DIRECTORY environment 2019-09-08 19:19:34 +02:00
Marcel Holtmann
45d5c67cb4 main: Move storage directory creation into storage functionality 2019-09-08 18:24:23 +02:00
Marcel Holtmann
7e5ddb15d7 main: Remove --config command line option 2019-09-08 18:18:06 +02:00
Marcel Holtmann
351e21f7c7 build: Add ConfigurationDirectory= option to service files 2019-09-08 10:25:39 +02:00
Marcel Holtmann
4c841edfb5 main: Add support for CONFIGURATION_DIRECTORY environment variable 2019-09-08 10:22:36 +02:00
Denis Kenzior
8a0c148368 ie: Handle WPA1 elements with Capability fields 2019-09-05 21:13:10 -05:00
Henrik Stokseth
008fd6c87a ie: Fix WPA1 element parsing
The memset was done after setting the defaults when it should have been
done before.
2019-09-05 20:53:57 -05:00
Antonio Quartulli
8106d82b4e fast_transition: fix crash by parsing RSN IE only if present
When performing a fast transition to another OPEN network the RSN
element won't be there and therefore the bss->rsne is gonna be NULL.

Fix crash by not accessing the rsne member when performing a fast
transition to an AP that doe snot advertise any RSN IE.

Crash caught with gdb:

 src/station.c:station_transition_start() 186, target 34:8f:27:2f:b8:fc

 Program received signal SIGSEGV, Segmentation fault.
 handshake_state_set_authenticator_ie (s=0x555555626eb0, ie=0x0) at src/handshake.c:163
 163		s->authenticator_ie = l_memdup(ie, ie[1] + 2u);
 (gdb) bt
 #0  handshake_state_set_authenticator_ie (s=0x555555626eb0, ie=0x0) at src/handshake.c:163
 #1  0x0000555555561a98 in fast_transition (netdev=0x55555562fbe0, target_bss=0x55555561f4a0,
     over_air=over_air@entry=true, cb=0x55555556d5b0 <station_fast_transition_cb>) at src/netdev.c:3164
 #2  0x0000555555565dfd in netdev_fast_transition (netdev=<optimized out>, target_bss=<optimized out>,
     cb=<optimized out>) at src/netdev.c:3232
 #3  0x000055555556ccbd in station_transition_start (bss=0x55555561f4a0, station=0x555555617da0)
     at src/station.c:1261
 #4  station_roam_scan_notify (err=<optimized out>, bss_list=<optimized out>, userdata=0x555555617da0)
     at src/station.c:1444
 #5  0x0000555555579560 in scan_finished (sc=0x55555562bf80, err=err@entry=0, bss_list=0x55555561bd90,
     sr=0x555555626b30, wiphy=<optimized out>) at src/scan.c:1234
 #6  0x0000555555579620 in get_scan_done (user=0x555555618920) at src/scan.c:1264
 #7  0x00005555555abd23 in destroy_request (data=0x55555561b000) at ell/genl.c:673
 #8  0x00005555555ac129 in process_unicast (nlmsg=0x7fffffffc310, genl=0x55555560b7a0) at ell/genl.c:940
 #9  received_data (io=<optimized out>, user_data=0x55555560b7a0) at ell/genl.c:1039
 #10 0x00005555555a8aa3 in io_callback (fd=<optimized out>, events=1, user_data=0x55555560b840)
     at ell/io.c:126
 #11 0x00005555555a7ccd in l_main_iterate (timeout=<optimized out>) at ell/main.c:473
 #12 0x00005555555a7d9c in l_main_run () at ell/main.c:520
 #13 l_main_run () at ell/main.c:502
 #14 0x00005555555a7fac in l_main_run_with_signal (callback=<optimized out>, user_data=0x0)
    at ell/main.c:642
 #15 0x000055555555e5b8 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:519
2019-08-28 14:35:06 -05:00
James Prestwood
8500b60b13 network: fix issue with WSC not connecting
After wsc_store_credentials, wsc_try_credentials is called which
sets the PSK obtained via the protocol. After the known network
refactor network_settings_load was changed to depend on the
network_info->open() call. Since there is no known network for
this initial WSC connection this always fails and the PSK is not
set into the network object (and the connection is failed).

In this case if network_settings_load fails we can just create
an empty settings object to be filled later.
2019-08-28 13:06:40 -05:00
James Prestwood
fe9376c74f hotspot: use known_network_update
If the file was modified we no longer need to completely remove
and recreate the network_info.
2019-08-28 11:41:16 -05:00
James Prestwood
ab5e83014c knownnetworks: refactor to expose known_network_update
known_network_update was being used to both update and create known
networks as they appeared on the file system. Hotspot needs updating
capabilities so known_network_update was exposed and updated with
one major difference; it no longer can be used to create new known
networks. For creation, a new API was added (known_network_new)
which will create and add to the queue.
2019-08-28 11:40:14 -05:00
James Prestwood
a3a48da542 station: allow autoconnect to hotspot networks
Since hotspot networks may require ANQP the autoconnect loop needed to
be delayed until after the ANQP results came back and the network
objects were updated. If there are hotspot networks in range ANQP will
be performed and once complete autoconnect will begin for all networks
including hotspots. If no hotspots are in range autoconnect will
proceed as it always has.

Note: Assuming hotspots are in range this will introduce some delay
in autoconnecting to any network since ANQP must come back. The full
plan is to intellegently decide when and when not to do ANQP in order
to minimize delays but since ANQP is disabled by default the behavior
introduced with this patch is acceptable.
2019-08-28 11:27:09 -05:00
James Prestwood
d33b5357ed network: check info match for unsetting hotspot info
No need to check for matching if unsetting
2019-08-28 11:25:05 -05:00
James Prestwood
b4fb60b2c5 knownnetworks: remove redundant ops->remove()
The remove op was being called inside known_networks_remove, which only
gets called from L_DIR_WATCH events. In this case the actual provisioning
has already been removed. Calling remove() again causes the op
implementation to then try and remove the file that no longer exists.
2019-08-28 11:17:50 -05:00
Denis Kenzior
6a52590687 network: Fix incorrect comment 2019-08-28 11:17:50 -05:00
Marcel Holtmann
2dc785982d netdev: Check EXT_FEATURE_CQM_RSSI_LIST before sending CMD_SET_CQM 2019-08-28 08:36:20 +02:00
James Prestwood
5661e886d8 eap-wsc: fix valgrind warning
Valgrind does not like uninitialized bytes used in a syscall. In this
case the buffer is an out buffer but since valgrind doesn't know that
it complains. Initializing to zero fixes the warning:

Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
    at 0x5162C4D: send (send.c:28)
    by 0x457AF4: l_checksum_update (checksum.c:319)
    by 0x43C03C: eap_wsc_handle_m2 (eap-wsc.c:842)
    by 0x43CD33: eap_wsc_handle_request (eap-wsc.c:1048)
    by 0x43A3A7: __eap_handle_request.part.0 (eap.c:266)
    by 0x41A426: eapol_rx_packet.part.12 (eapol.c:2262)
    by 0x41B536: __eapol_rx_packet (eapol.c:2650)
    by 0x407C80: netdev_control_port_frame_event (netdev.c:3542)
    by 0x407C80: netdev_unicast_notify (netdev.c:3684)
    by 0x4598C5: dispatch_unicast_watches (genl.c:899)
    by 0x4598C5: process_unicast (genl.c:918)
    by 0x4598C5: received_data (genl.c:1039)
    by 0x456452: io_callback (io.c:126)
    by 0x45569D: l_main_iterate (main.c:473)
    by 0x45576B: l_main_run (main.c:520)
  Address 0x1ffeffe290 is on thread 1's stack
in frame #2, created by eap_wsc_handle_m2 (eap-wsc.c:797)
2019-08-27 20:58:01 -05:00
Denis Kenzior
b3881b84c1 eapol: Propagate noencrypt and use it
We were not using or taking into account the noencrypt flag obtained
from the kernel via CONTROL_PORT events.  For the most part this still
worked as the kernel would never include NO_ENCRYPT flag (due to a bug).
However, this was actually incorrect and led to loss of synchronization
between the AP and STA 4-Way handshake state machines when certain
packets were lost and had to be re-transmitted.
2019-08-27 20:50:07 -05:00
Andrew Zaborowski
9a9ff9f2f3 eapol: Don't l_queue_remove from state_machines while destroying it
We do an l_queue_destroy(state_machines, eapol_sm_destroy) so don't
l_queue_remove from state_machines inside eapol_sm_destroy.
2019-08-23 09:32:57 -05:00
Andrew Zaborowski
fc4685abec eap-tls: Add ServerDomainMask config option
Allow users to provide a glob string that the contents of the server
certificate's subject DN should be matched against as a primitive
protection against rogue APs using certificates purchased from
commercial CAs trusted by the client.  If the network uses an AP
certificate emitted by a commerical CA and the clients are configured
to trust those CAs so that the client configurations don't have to be
updated when the AP renews its certificate, this new option can be used
to check if the CN in the AP certificate's DN matches the known domain
name.  This logic assumes that the commercial CAs provide enough
assurance that only the owner of the domain can buy a certificate with
that domain in the CN field.

The format of this option is similar to apple's TLSTrustedServerNames
and wpa_supplicant's domain_match/domain_suffix_match format, the exact
syntax is documented in ell/tls.c.
2019-08-23 09:30:24 -05:00
Denis Kenzior
0ebe960daf netdev: Use the RM Enabled Capability IE from wiphy 2019-08-23 09:11:51 -05:00
Denis Kenzior
01cfcabfb4 wiphy: Setup RM Enabled Capabilities in wiphy 2019-08-23 08:55:54 -05:00
James Prestwood
41740ceabc scan: only set Interworking if capable
Checks that the extended capabilities has the Interworking
bit set before adding the IE.
2019-08-21 17:34:43 -05:00
James Prestwood
20887dfe1a wiphy: explicitly set extended capability bits
Some capability bits are required by the spec to be set for
probe requests for certain features (HS20, FILS, FT). Currently
these features work as-is, but depending on the hardware we may
be in violation of the spec if we assume the correct bits are
set when we get the wiphy dump.

Just to be safe we can explicity set these capability bits.

There are also two ways the kernel exposes these capabilities.
Per-type or globally. The hardware may expose one, or both of
these capability arrays. To combat this we are now always
creating a per-type capability array for stations. If the
wiphy dump has not produced a per-type capability array we
now create one based off the global capability array. That
way we can always assume there is a capability array for a
station iftype.
2019-08-21 17:24:16 -05:00
James Prestwood
76b73a1cf5 util: add util_set_bit
Sets a single bit in a uint8_t * bit field
2019-08-21 17:24:16 -05:00
James Prestwood
dd2daa4961 scan: add Interworking to scan requests 2019-08-21 16:15:07 -05:00
James Prestwood
a9473df555 scan: add Extended Capabilities to scan requests
This will be seen in Probe Requests. More IEs can and should
be added here depending on the support in IWD. E.g. HS20 indication,
Interworking, HT/VHT IE's etc.
2019-08-21 16:15:07 -05:00
James Prestwood
0d0377ede7 knownnetworks: use get_name/get_type for dbus
The name/type on the dbus object will now refect the values
returned from the network_info ops
2019-08-21 14:16:08 -05:00
James Prestwood
313553aadd hotspot: require 'Name' value in provisioning file
In order to implement get_name/get_type we need some value for the name
of the hotspot network. For simplicity we now require a 'Name' value
be provided inside the hotspot provisioning file. Eventually this may
change (e.g. obtained via ANQP).
2019-08-21 14:16:08 -05:00
James Prestwood
a6a77ddc07 knownnetworks: add get_name and get_type ops 2019-08-21 14:16:08 -05:00
James Prestwood
894cde987d storage: util: remove unused APIs
Both util_timespec_compare and storage_network_get_mtime
are now unused.
2019-08-21 14:16:08 -05:00
James Prestwood
4f14e4bb42 hotspot: set connected_time on network_info 2019-08-21 14:16:08 -05:00
James Prestwood
6ff86abb41 knownnetworks: use l_path_get_mtime
Rather than using timespec directly, ELL has a convenient API
to get the elapsed microseconds as a uint64_t. This can then
be used with the other l_time_ APIs for comparison.

This patch removes timespec from network_info and updates
to use l_time_* API's for sorting.
2019-08-21 14:16:08 -05:00
Will Dietz
690c9c2045 manager: Fix build
Attached, but basically replace 2-argument call to l_genl_msg_new
with what seems rather likely was intended instead: l_genl_msg_new_sized.
2019-08-21 12:29:22 -05:00
Denis Kenzior
9f1875fd3d manager: Use split wiphy dumps 2019-08-20 18:04:27 -05:00
James Prestwood
ed08bc35a3 network: update hotspots on knownnetwork changes 2019-08-19 17:47:16 -05:00
James Prestwood
610ef41578 network: remove all hotspot related getter/setters 2019-08-19 13:59:01 -05:00
James Prestwood
7313d3bad7 network: remove hotspot specific settings loading
The hotspot module now uses network_info ops 'open'
2019-08-19 13:58:27 -05:00
James Prestwood
8242b7e9f3 station: add network_info after ANQP
Once ANQP is complete we can try matching the NAI realm with any
known networks.
2019-08-19 13:58:18 -05:00
James Prestwood
8910da5836 network: find hotspot network_info when adding BSS
When adding a BSS to a network: if it is hs20_capable and no
'info' has been set we attempt to search for a matching
network_info for this network.
2019-08-19 13:51:08 -05:00
James Prestwood
f4ef431e8d knownnetworks: add matching ops to network_info
These operations will allow the hotspot module to implement
matching HESSID, Roaming Consortium, and NAI realms. This offloads
the matching details into the hotspot module.
2019-08-19 13:46:01 -05:00
Denis Kenzior
0577662c5b hotspot: Simplify path generation 2019-08-19 13:43:56 -05:00
James Prestwood
912fae6b2d hotspot: convert to using network_info
The hotspot module will now keep its own network_info objects to
be registered with known networks.
2019-08-19 13:27:57 -05:00
James Prestwood
cb149fe380 network: add getter/setter for network_info 2019-08-19 13:27:48 -05:00
Tim Kourt
894548dfd4 netconfig: Uninstall addresses on interface removal 2019-08-19 13:23:44 -05:00
Tim Kourt
e3921193f9 netconfig: Move removal of DNSs out of IPv4 specific logic
This way resolve_remove can be called once per interface and
remove IPv4 and IPv6 addresses at once.

In addition, this allows to remove the IP addresses and DNS
servers within the same main loop cycle. This will allow iwd
to make an attempt to remove the DNS servers on shutdown of iwd.
2019-08-19 13:20:48 -05:00
James Prestwood
c4771c4c5d station: introduce station_network_foreach
Iterates all networks for a given station object.
2019-08-19 12:40:18 -05:00
James Prestwood
630c487534 knownnetworks: add known_networks_{add,remove}
These two API's have been added to allow hotspot to add its
own networks to the known network list. This will allow any
added networks to behave exactly like they do now, including
all the dbus and watchlist functionality.
2019-08-19 12:21:00 -05:00
Denis Kenzior
c91bbe42a0 network: Make sure to update seen_count 2019-08-16 11:08:05 -05:00
James Prestwood
68c819053b knownnetworks: add hotspot flag to network_info
Hotspot will start adding its own known networks and other modules
need a way of differentiating between the two network types.
2019-08-16 11:04:07 -05:00
James Prestwood
28f484ddb8 network: knownnetworks: introduce network_info_ops
The known network APIs all revolved around the ssid/security matching
to do any operations on the provisioning file. In the near future
hotspot provisioning files (managed by hotspot.c) will be incorporated
into the known network list. Since these hotspot files do not use the
ssid as the file name hotspot.c will need other ways of matching.

This patch adds network_info_ops to the network object. This ops
structure will hold function pointers which operate on network_info
rather than ssid/security. This will allow hotspot and known networks
to both register their own operation routines.

For now open, touch, sync, remove, free, and get_path were added.

Wrappers were added for accessing these operations outside of
knownnetworks.c.
2019-08-16 11:03:06 -05:00
James Prestwood
5caf8796cd knownnetworks: move network_info into knownnetworks 2019-08-16 10:58:25 -05:00
Tim Kourt
1921990acd network: Refactor debug statement
This way the outcome of the decision whether to ask for the
passphrase or not can be seen.
2019-08-16 10:57:22 -05:00
Denis Kenzior
ed8a4ab931 treewide: Make global variables static 2019-08-15 15:06:59 -05:00
Denis Kenzior
9d177a63b7 nl80211cmd: Add additional commands 2019-08-15 15:06:59 -05:00
Marcel Holtmann
42cd872994 eap: Make global variable static 2019-08-15 19:39:27 +02:00
Marcel Holtmann
f41d85112e eapol: Make global variables static 2019-08-15 19:32:37 +02:00
Marcel Holtmann
884dcbab92 eapol: Remove unused global variable 2019-08-15 19:31:54 +02:00
James Prestwood
04b786ed2c knownnetworks: fix style issue, use tabs 2019-08-12 13:35:38 -05:00
Denis Kenzior
2c30a2f7ff network: Rely on known_networks added event 2019-08-09 15:45:05 -05:00
Denis Kenzior
0e77bf1c39 network: Rely on known_networks removed event
Instead of having known_networks call network_info_forget_known, instead
rely on the newly introduced KNOWN_NETWORKS_EVENT_REMOVED
2019-08-09 15:45:02 -05:00
Denis Kenzior
4fc8bea0a2 network: Add a skeleton known networks watch 2019-08-09 14:56:49 -05:00
James Prestwood
e3e641dff9 knownnetworks: add watch API's
Modules can watch for known network addition and removal.
2019-08-09 14:56:49 -05:00
Denis Kenzior
227bcce40b network: Move known_frequency queue management
Isolate the known_frequency queue management to a function and place
that function in knownnetworks.c where it now belongs.  Since we no
longer have network_info objects for unknown networks, only frequencies
for known networks are tracked
2019-08-09 14:56:49 -05:00
Denis Kenzior
67eeb0386d network: Move network_info_match to knownnetworks.c 2019-08-09 14:56:49 -05:00
Denis Kenzior
0d7f591d4f network: Move network_info_free to knownnetworks.c 2019-08-09 14:56:49 -05:00
Denis Kenzior
37f71fe4e4 network: Remove the networks queue
networks queue was intended to share basic network information between
multiple adapters running simultaneously.  The network_info object was
also serving double duty to carry known network information.  This made
things overly complicated and really didn't result in much savings.
This setup also made managing hotspot networks challenging as we would
have ended up with multiple network_info objects for each known hotspot
network.

So get rid of the networks queue and the is_known bit from the
network_info structure.
2019-08-09 14:56:49 -05:00
Denis Kenzior
037ba92894 network: Store the security type in the network object 2019-08-09 14:56:49 -05:00
Denis Kenzior
f800279814 network: Store SSID in the network object
And use network_get_ssid whenever possible to make future
transformations easier.
2019-08-09 14:56:46 -05:00
Denis Kenzior
72a8f2888a network: Move network offset calculation
network_find_rank_index was used to find the offset of the selected
network_info among known networks so as to compute a modifier based on
the rankmod table.  Instead of using known_networks_foreach for this,
moove it to knownnetworks.c where it can be coded and optimized
separately.

For now provide a simple for loop implementation.
2019-08-09 01:11:49 -05:00
Denis Kenzior
2d65a0030e module: Introduce a basic module dependency framework 2019-08-07 16:33:19 -05:00
Denis Kenzior
cf58657b37 resolve: Add a missing l_free 2019-08-07 11:13:10 -05:00
Denis Kenzior
37987757e1 resolve: rename RESOLVCONF_PATH
Since it is no longer a define, switch to using lower-case letters
2019-08-07 11:09:50 -05:00
Denis Kenzior
f6bb911d2c resolve: Search more places for resolvconf exe
Some distros put resolvconf in /usr/sbin instead of /sbin.  Do not try
to hard-code the path and instead search for it in more places.
2019-08-07 10:57:11 -05:00
Denis Kenzior
e7f16775ac main: Don't try to queue if name request fails
This in fact allows multiple instances of iwd to run.
2019-08-04 04:49:24 -05:00
Denis Kenzior
30315cba0d station: Add some additional roaming debugs 2019-08-04 04:49:24 -05:00
Denis Kenzior
188e6d1237 netdev: Tweak debugging for SET_CQM 2019-08-04 04:49:24 -05:00
Marcel Holtmann
deee526b98 manager: Make default_if_driver_list static 2019-08-04 00:35:14 +02:00
Marcel Holtmann
16c489490c build: Fix issue with incorrect ReadWritePaths in unit files 2019-08-03 09:52:28 +02:00
Marcel Holtmann
30821979f6 netconfig: Use different includes that also work on older systems 2019-08-02 20:33:43 +02:00
Tim Kourt
18c339beab resolve: Add resolvconf as DNS manager
Enable the systems that use resolvconf as DNS manager to be
configurable by iwd.
2019-08-02 06:24:00 -05:00
James Prestwood
8053152730 wsc: fix station lookup by ifindex
The station was being lookup up using the wdev ID rather than the
interface index.
2019-08-02 02:23:05 -05:00
Matthias Schoepfer
4ae5c38be8 iwd.service.in: remove PrivateDevices=true
Previously, the option PrivateDevices=true disabled access to
/dev/rfkill, which lead to:
  'iwctl adapter phy0 set-property Powered {off|on}'
to fail.

This patch explicitly allows access to /dev/rfkill
2019-08-01 01:55:12 -05:00
James Prestwood
236211af60 rtnlutil: fix compiler error
src/rtnlutil.c: In function ‘rtnl_route_add’:
./ell/util.h:248:2: error: ‘rtmmsg’ may be used uninitialized in
	this function [-Werror=maybe-uninitialized]
2019-07-31 12:39:41 -05:00
Denis Kenzior
66b5541970 netconfig: make ROUTE_PRIORITY_OFFSET a uint32_t
Also move it up into the static variable block
2019-07-31 12:38:40 -05:00
Denis Kenzior
1fd0dbb74b netconfig: Store rtm_protocol value directly
Instead of using a flag ipv4_static, just store the value of the rtm
protocol directly inside netconfig object.  This allows us to simplify
the logic quite significantly and avoid repeating the conditional
expression needlessly
2019-07-31 04:38:54 -05:00
Tim Kourt
2eded67c62 netconfig: Install connected and gateway routes
The routes are installed as a result of a successful installation
of the IP addresses. The gateway is fetched with netconfig_ipv4_get_gateway
helper function according to the origin of the installed IP address.

The route priority offset can be set in main.conf. The default value
of 300 is used if the offset isn’t set.
2019-07-31 03:53:32 -05:00
Denis Kenzior
be5219883c rtnlutil: Simplify error handling 2019-07-31 03:53:01 -05:00
Tim Kourt
cce59ad7f1 rtnlutil: Add connected and gateway route API
The API allows to add connected and gateway routes to the main
routing table.

rtnl_route_ipv4_add_gateway() is equivalent to the following
example 'ip route' command:
ip route add default via 10.0.0.1 dev wlan0 proto dhcp src 10.0.0.2 metric 339

rtnl_route_ipv4_add_connected()  is equivalent to the following
example 'ip route' command:
sudo ip route add 10.0.0.0/24 dev wlan0 proto dhcp src 10.0.0.2 scope link

The 'ip route' output from the above commands looks as follows:

rtnl_route_ipv4_add_connected():
10.0.0.0/24 dev wlan0 proto dhcp scope link src 10.0.0.2

rtnl_route_ipv4_add_gateway():
default via 10.0.0.1 dev wlan0 proto dhcp src 10.0.0.2 metric 339
2019-07-31 03:49:35 -05:00
Tim Kourt
a91136d4b9 netconfig: Install\uninstall DNS addresses
The DNS addresses are installed as a result of a successful
installation of the IP addresses. The DNS lists are fetched
with netconfig_ipv4_get_dns helper function according to the
origin of the installed IP address.
2019-07-31 03:42:53 -05:00
Tim Kourt
372240fe8c netconfig: Refactor Install/Uninstall for IPv4 addresses 2019-07-31 03:42:01 -05:00
Tim Kourt
72e6598c6e netconfig: Switch IPv4 DHCP event handler to use ifaddr helper 2019-07-31 03:41:47 -05:00