summaryrefslogtreecommitdiff
path: root/src/supplicant/nm-supplicant-interface.c
Commit message (Collapse)AuthorAgeFilesLines
* shared: move "nm-dbus-compat.h" header to "nm-std-aux/nm-dbus-compat.h"Thomas Haller2019-04-181-1/+1
| | | | (cherry picked from commit 81833358786b0fdd0668ef92b0bdc1361fa980b3)
* supplicant: fix setting pmf when the supplicant doesn't advertise supportBeniamino Galvani2019-02-261-15/+16
| | | | | | | | | | | | | | wpa_supplicant only advertises pmf support since commit [1], which is after 2.6. When using a version without that commit (for example, plain 2.6), we would unconditionally set the global Pmf property to 1 (optional) and then skip setting the per-network property. The result was that pmf was enabled without the possibility to disable it by user. The correct behavior is instead to disable pmf on such versions. [1] https://w1.fi/cgit/hostap/commit/?id=3cdb4ac074f76accf24a51d143db545afad2c90b https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/129 (cherry picked from commit 560a35dd433cd6bf2268aaf757fda798f35712fe)
* supplicant: clarify ready_count usageBeniamino Galvani2019-02-261-13/+15
| | | | (cherry picked from commit cab17ff8e0f4935cd3a4b8564edd1ed765987d9f)
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-121-1/+0
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* wifi-p2p: strict validate options argument to "StartFind"Thomas Haller2019-02-051-1/+0
| | | | Don't accept any unsupported options.
* all: fix misspellingsRafael Fontenelle2019-01-241-2/+2
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/64
* supplicant: set optional PMF using global supplicant propertyBeniamino Galvani2019-01-121-0/+34
| | | | | | | | | | | | | | | | | | | wpa_supplicant is going to change the global default for PMF from 0 (disabled) to 1 (optional) [1], so NM code needs to be adjusted to work with all wpa_supplicant versions. Furthermore, it is better to set optional PMF using the 'Pmf' property instead of the 'ieee80211w' configuration option because the former better handles missing support in driver [2]. Note that each interface in wpa_supplicant has its own copy of global configuration and so 'global' options must still be set on each interface. So, let's set Pmf=1 when each interface gets created and override it with ieee80211w={0,2} if needed during association. [1] http://lists.infradead.org/pipermail/hostap/2018-November/039009.html [2] http://lists.infradead.org/pipermail/hostap/2019-January/039215.html https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/104
* supplicant: Add methods to start/stop a P2P Find operationBenjamin Berg2018-12-131-0/+47
| | | | | | | The timeout is limited to be in the range of 1-600s. This is arbitrary, but the point is that a timeout of 0 is not permitted to prevent a client from making us run a find continuously simply by forgetting to call the stop method.
* supplicant: Add API to join/cancel/disconnect a P2P GroupBenjamin Berg2018-12-131-0/+89
|
* supplicant: Export group path of active groupBenjamin Berg2018-12-131-1/+28
| | | | This can be used to check whether a peer is joined to our group.
* supplicant: Track P2P Group information, creation and destructionBenjamin Berg2018-12-131-12/+267
| | | | | Add basic tracking of P2P group information and the creation and destruction of them.
* supplicant: Allow creating an interface from object pathBenjamin Berg2018-12-131-30/+62
| | | | | | | wpa_supplicant will create a new interface for P2P devices. In this case we need to fetch the supplicant interface using the object path and then fetch the interface name via dbus to setup the IP interface of the P2P device later.
* supplicant: Monitor existance of P2P Peers foundBenjamin Berg2018-12-131-2/+197
|
* supplicant: Connect to P2PDevice supplicant interfaceBenjamin Berg2018-12-131-8/+96
| | | | | | The wpa_supplicant interface has a P2PDevice when P2P is supported. Create a proxy for this and wait for it to be ready before marking the interface as ready.
* supplicant: Detect P2P and WFD supportBenjamin Berg2018-12-131-1/+63
| | | | | Add detection for P2P and WFD support in wpa_supplicant and pass the information to the NMSupplicantInterface.
* supplicant: Handle interface removalBenjamin Berg2018-12-131-2/+39
| | | | | | | The signal was not handled, potentially creating corner cases where NetworkManager may not notice an interface removal. Add a handler and ensure the supplicant interface is brought down when it is removed from wpa_supplicant for a reason other than NetworkManager requesting it.
* wifi: don't use :1 bitfield for gboolean typeThomas Haller2018-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | gboolean is a typedef for "int". While older compilers might treat such bitfields as unsigned ([1]), commonly such a bitfield is signed and can only contain the values 0 and -1. We only want to use numeric 1 for TRUE, hence, creating such bitfields is wrong, or at least error prone. In fact, in this case it's a bug, because later we compare it with a regular gboolean if (priv->scanning != new_scanning) [1] https://lgtm.com/rules/1506024027114/ Fixes: e0f96770188eeaada70a299bd6dab7a50ec34a53
* wifi: use GBytes for ssids scan listThomas Haller2018-08-221-6/+7
| | | | | | | | | Use GBytes instead of GBytesArray. GBytes is immutable and can be shared. It is also the type that we natively get from nm_setting_wireless_get_ssid(). This way we avoid some conversions.
* wifi: use GBytes instead of GBytesArray for tracking blobs in supplicantThomas Haller2018-08-221-3/+2
|
* wifi: expose LastScan as milliseconds not secondsLubomir Rintel2018-06-151-8/+8
| | | | | This doesn't wrap around in 68 years of uptime and is consistent with o.fd.NM.Checkpoint.Created.
* core: use nm_utils_dbus_normalize_object_path() to cleanup D-Bus argumentThomas Haller2018-04-181-3/+2
|
* all: don't explicitly cast destroy function for g_clear_pointer()Thomas Haller2018-03-191-1/+1
| | | | | | | | | The g_clear_pointer() macro already contains a cast to GDestroyNotify. No need to do it ourself. In fact, with the cast, this only works with the particular g_clear_pointer() implementation, that first assigns the destroy function to a local variable. See-also: https://bugzilla.gnome.org/show_bug.cgi?id=674634#c52
* supplicant: enable FILS only when wpa_supplicant supports itMasashi Honma2018-01-161-1/+32
| | | | Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
* all: get rid of a handful of unused-but-set variablesLubomir Rintel2017-12-181-2/+0
|
* core,clients: use our own string hashing function nm_str_hash()Thomas Haller2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | Replace the usage of g_str_hash() with our own nm_str_hash(). GLib's g_str_hash() uses djb2 hashing function, just like we do at the moment. The only difference is, that we use a diffrent seed value. Note, that we initialize the hash seed with random data (by calling getrandom() or reading /dev/urandom). That is a change compared to before. This change of the hashing function and accessing the random pool might be undesired for libnm/libnm-core. Hence, the change is not done there as it possibly changes behavior for public API. Maybe we should do that later though. At this point, there isn't much of a change. This patch becomes interesting, if we decide to use a different hashing algorithm.
* supplicant: don't allow scans to trigger a supplicant roaming decisionDan Williams2017-08-111-0/+1
| | | | | | | Just because the user requested a scan doesn't mean the supplicant should use the result of that scan to jump to an AP that's slightly better than the current one. Let the supplicant handle when it's supposed to roam based on it's own logic, not random scans from users or NM clients.
* core,cli: replace wrong pattern for clearing GErrorBeniamino Galvani2017-06-271-2/+2
| | | | Use gs_free_error instead of gs_free.
* wifi: fix cancelling WPS during pending ProcessCredentialsThomas Haller2017-06-141-2/+2
| | | | | | | When we cancel WPS, we must cancel the GCancellable. Otherwise, ProcessCredentials will return and proceed with Start. Fixes: 9bfb4f0d09c20b84aac9a406b265328d267e0d8b
* supplicant: chain asynchronous requests for WPSThomas Haller2017-06-141-83/+252
| | | | | | | | | | | | | | | | | | | | | | | Don't have pending asynchronous requests in parallel, like setting "ProcessCredentials" and "Start", or "Cancel" and "Start". Instead, "Start" is only scheduled after "ProcessCredentials" completed and "ProcessCredentials" is only scheduled after "Cancel" completed. Also, handle the async response of these requests. For one, to achive the chaining mentioned above and to log what happens and possible errors. Upon new enrollment, a previously created GDBusProxy is now reused, where the first operation is to Cancel the previous action. Also, consistently <trace> log what is happening. Not doing all of this is less lines of code. It's also simpler, and faster. But in my opinion, it is (usually) better to check and wait for return values, instead of firing off async requests uncontrolled. It allows us to better know where we are and to log about each individual step. This also makes all operations cancellable. Undoubtedly, correctness and handling failures conflicts with simplicity in this case -- or at least: what I think is "correctness" conflicts.
* supplicant/trivial: move code aroundThomas Haller2017-06-141-6/+8
|
* supplicant: work-around coverify false-positive for check_return: ↵Thomas Haller2017-06-021-3/+5
| | | | | | g_async_initable_init_finish() NetworkManager-1.8.0/src/supplicant/nm-supplicant-interface.c:232: check_return: Calling "g_async_initable_init_finish" without checking return value (as is done elsewhere 7 out of 8 times).
* supplicant-interface: add support for WPS enrollmentLubomir Rintel2017-05-151-7/+170
|
* supplicant: configure PMF for each connectionBeniamino Galvani2017-04-281-48/+6
| | | | | | | Now that we have a PMF connection property, get rid of the previous code to globally enable/disable PMF and use the 'ieee80211w' configuration option for each configured network when the supplicant supports it.
* supplicant: fix detection of PMF supportBeniamino Galvani2017-04-191-1/+1
| | | | Fixes: a72ffe230bce1486fcd6bbaea8e111a9e77f33ed
* supplicant: enable stronger AKMs when PMF is enabledBeniamino Galvani2017-04-151-0/+9
|
* supplicant: enable PMF only when wpa_supplicant supports itBeniamino Galvani2017-04-151-2/+28
|
* supplicant: enable PMF based on driver typeBeniamino Galvani2017-04-151-19/+18
| | | | | Instead of adding a new flag to configuration based on connection type, use the driver-type field directly in the supplicant-interface.
* supplicant: Initial pmf support (a.k.a. MFP, a.k.a. 802.11w)Michael Cronenworth2017-04-151-0/+39
| | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=748367 Signed-off-by: Michael Cronenworth <mike@cchtml.com>
* supplicant: log the device contextLubomir Rintel2017-03-241-7/+3
|
* logging: log device and connection along with the messageLubomir Rintel2017-03-241-1/+1
|
* supplicant: delay SCAN_DONE signal until all BSS are initializedThomas Haller2017-02-171-55/+113
| | | | | | | | | | | | | | | We initialize the BSS asyncronously. Don't declare SCAN_DONE until all BSS are up. Otherwise, especially during the very first scan we declare SCAN_DONE when having no BSS yet. This wrongly removes the pending action "wifi-scan", while "autoconnect" cannot happen as there are not BSS yet. Thus we declare "startup-complete" too early. Another issue is that we may start autoconnecting with an incomplete scan list, and thus pick a non-preferred connections. https://bugzilla.gnome.org/show_bug.cgi?id=777831
* supplicant: merge NEW_BSS signal with BSS_UPDATEDThomas Haller2017-02-171-13/+4
| | | | | | | | | | | | | | | | | Before, the NEW_BSS signal was not careful to emit the signal only when the BSS is seen for the first time. Consequently, supplicant_iface_new_bss_cb() checked whether it already knows about the new BSS. Merge NEW_BSS and BSS_UPDATED. Now we emit BSS_UPDATED when either the BSS is new or changed. Also, in supplicant_iface_new_bss_cb() (now supplicant_iface_bss_updated_cb()) no longer constructs an @ap instance if we have a @found_ap. In some situations there can be a value of having a separate ADD signal. But only when there the consumers care, and if the consumers can trust that ADD is not just an UPDATE. The only consumer doesn't care and it not not be trusted, so merge the signals.
* supplicant: cleanup network when cancelling "AddNetwork" requestThomas Haller2017-02-171-6/+52
| | | | | | | | | | | | | If the assoc-request is cancelled while an "AddNetwork" request is pending, we must cleanup the added network when the request succeeds. The issue can also happen when NetworkManager shuts down and exits the mainloop. This scenario is unsolved as the cleanup action "RemoveNetwork" has no chance to run. "AddBlob" works differently in that blogs are added with a specific name, not like "AddNetwork", where a new D-Bus path is created. Maybe we should also cleanup blobs that were added by us, but currently we don't.
* supplicant: remove unused return value from ↵Thomas Haller2017-02-171-3/+2
| | | | | | nm_supplicant_interface_request_scan() It cannot fail, remove code that anticipates a failure of request-scan.
* supplicant: use nm_clear_g_cancellable() helperThomas Haller2017-02-171-14/+4
|
* supplicant/trivial: move code aroundThomas Haller2017-02-171-55/+59
|
* supplicant: rework nm_supplicant_interface_set_config() to invoke result ↵Thomas Haller2017-02-171-132/+180
| | | | | | | | | | | | | | | | | | | | | callback Instead of having a NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR signal to notify about failures during AddNetwork/SelectNetwork, accept a callback to report success/failure. Thereby, rename nm_supplicant_interface_set_config() to nm_supplicant_interface_assoc(). The async callback is guaranteed to: - be invoked exactly once, signalling success or failure - always being invoked asyncronously. The pending request can be (synchronously) cancelled via nm_supplicant_interface_disconnect() or by disposing the interface instance. In those cases the callback will be invoked too, with error code cancelled/disposing.
* wifi: introduce enum type NMSupplicantInterfaceState instead of plain intThomas Haller2017-02-141-52/+31
| | | | | | | | | Also change the signature of the NM_SUPPLICANT_INTERFACE_STATE signal, to have three "int" type arguments. Thereby also fix the subscribers to this signal that wrongly had type guint32, instead of guint (which happens to be the same underlying type, so no real problem). https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00021.html
* device/wifi: don't emit wrong SCAN_DONE signal when "Scan" request completesThomas Haller2017-02-101-2/+0
| | | | | | | | | scan_request_cb() handles the answer from the D-Bus "Scan" method. At that point, the scan is not yet done, it merely started. It is wrong to already signal SCAN_DONE. The only place where we want to signal SCAN_DONE is when we actually receive the "ScanDone" D-Bus signal.
* device/wifi: first emit NEW_BSS signals before SCAN_DONEThomas Haller2017-02-101-2/+2
| | | | | | In the SCAN_DONE handler, NMDeviceWifi resets the flag that indicates that a current scan request is pending. We need to first obtain the new APs (NEW_BSS) before signalling SCAN_DONE.