summaryrefslogtreecommitdiff
path: root/src/devices/wifi
AgeCommit message (Collapse)AuthorFilesLines
2016-03-24wifi: avoid autoconnecting Ad-Hoc networks with method=autoLubomir Rintel1-4/+5
This fixes the issue where all Ad-Hoc networks try to connect one after one on NM startup instead of the managed network that has AP available. Fixes: e2637760f160f8d790438f3ca26df1b888de7909 (cherry picked from commit f6d0fc3341742a9f122048b072bf8b33d391365f)
2016-03-02wifi: fix crash due to wrong ownership handling in ↵Thomas Haller1-9/+7
nm_supplicant_manager_iface_release() nm_supplicant_manager_iface_get() would cache and reuse the supplicant interface. But no ref-counting was in place so that the first user returning the interface via nm_supplicant_manager_iface_release() would destroy the instance for others. This is broken for a very long time. Which shows that we hardly ever have a cache-hit and usually create a new instance. So, instead of letting nm_supplicant_manager_create_interface() check for existing supplicant interface, always create a new instance. This also makes sense, because we would expect that per ifname only one instance is requested at a time. Also add an assertion that we don't return multiple supplicant interface instances for the same ifname. Drop nm_supplicant_manager_iface_release() in favor of requiring users to unref the returned instance. Also, use a GSList instead of a GHashTable for the cache. Also, previously callers would pass @is_wireless to nm_supplicant_manager_iface_get(), but the cache lookup did not consider that value. That doesn't matter now as we always create a new instance. https://bugzilla.redhat.com/show_bug.cgi?id=1298007 (cherry picked from commit f1fba3eb02c5d102a1b0e85c371dce81e5bd0d3b)
2016-03-02device/wifi: remove unnecessary call to ↵Thomas Haller1-2/+0
remove_supplicant_interface_error_handler() remove_supplicant_interface_error_handler() is not needed as we later disconnect all handlers for @self. (cherry picked from commit 8dcf4d32e92c3ad44327606dc2bec2d82ee09493)
2016-03-02device/wifi: replace cancel_pending_scan() with nm_clear_g_source()Thomas Haller1-19/+8
(cherry picked from commit 84828960ff4eb924e63b4aa60fdfdd376055c7d4)
2016-02-24wifi: ignore monitor interfacesDan Williams1-0/+11
If a monitor interface is created, NM will grab that interface and change it to station mode. That's not very nice. https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00068.html (cherry picked from commit 751a37bf433eb79653b6d498eea1ab01047dfd27)
2016-02-11wifi: allow autoconnect on AP/AdHoc mode connections with manual IP ↵Dan Williams1-6/+13
configuration The existing checks assumed that all AP/AdHoc connections would use the shared IP method. But what we really want to check for here is whether the connection is AP/AdHoc. Leave the existing 'shared' check for backwards compatibility. Also move the check above the timestamp check, since the user shouldn't need to manually set a timestamp just to get an AP-mode connection to autoconnect. (cherry picked from commit e2637760f160f8d790438f3ca26df1b888de7909)
2016-01-06wifi: refactor creation of NMDeviceWifi/NMDeviceOlpcMesh to initialize in ↵Thomas Haller2-34/+13
constructed() method (cherry picked from commit 1a835ad3d03ffe39a3caf4796027baaba73bf9b8)
2016-01-06wifi: don't fail construction of NMDeviceWifi in constructorThomas Haller4-25/+30
We cannot abort the construction of a GLib object instance like we did for NMDeviceWifi and NMDeviceOlpcMesh when nm_platform_wifi_get_capabilities() failed. Instead, check the capabilities first (in the factory method) and only create the object instance when the device can be handled. https://bugzilla.gnome.org/show_bug.cgi?id=760154 (cherry picked from commit 044de4cea2c82d289033e75f1e12c7d346dc5537)
2016-01-06wifi-olpc: refactor NMDeviceOlpcMesh to hold pointer to NMManagerThomas Haller1-5/+15
Objects that register to a signal of a singleton should own a reference to the singleton to ensure the proper lifetime of the singleton upon shutdown. (cherry picked from commit e2e22eb574d0c18ccd79bf8b3cee883418632a96)
2015-12-01core: declare nm_supplicant_manager_get() using NM_DEFINE_SINGLETON_GETTER()Thomas Haller1-2/+1
(cherry picked from commit d45c1b84f433da696a1c244fb6d65a26a3e26661)
2015-11-30wifi: only try adding supplicant interface 5 times on errors (bgo #753971)Jiří Klimeš1-1/+36
When wpa_supplicant keeps returning an error, NetworkManager was trying over and over again. Which resulted in endless messages: <error> [1448462154.584916] [supplicant-manager/nm-supplicant-interface.c:879] interface_add_cb(): (AAA): error adding interface: wpa_supplicant couldn't grab this interface. NetworkManager[17073]: <info> (AAA): supplicant interface state: starting -> down Testcase: $ iw list | grep -A 3 "interface combinations" interface combinations are not supported HT Capability overrides: * MCS: ff ff ff ff ff ff ff ff ff ff * maximum A-MSDU length $ sudo iw wlan0 interface add AAA type managed ... $ sudo iw dev AAA del Fixes: 3a2e6de0d30217753c825ba1f20e589c1f647780 https://bugzilla.gnome.org/show_bug.cgi?id=753971 (cherry picked from commit 7e93ceb6408cd9345222066ade3f76cc38ad7db3)
2015-11-19wifi: do update BSSID cache in activation_success_handler() (rh #1094298)Jiří Klimeš1-1/+1
Even if update_seen_bssids_cache() is called by set_current_ap() it did not really update the cache because it was called in NM_DEVICE_STATE_PREPARE state. So the cache was only updated by periodic_update() when the connection roamed to another AP. Fixes: 1283816b41695dbc46ddd63b3d1e7c3a535fe1c3 https://bugzilla.redhat.com/show_bug.cgi?id=1094298 (cherry picked from commit d4ebffcfb91a8d597908c15da3ae019774c4a651)
2015-11-12wifi: clean up removal of current AP if it fails during association (bgo ↵Dan Williams1-12/+22
#733105) There's a race between when link_timeout_cb() runs and removes priv->current_ap, and the supplicant removing priv->current_ap and finding it again. The race appears to be: * connected to AP, so ssid_found = TRUE * AP powers off * supplicant state change to DISCONNECTED * supplicant_iface_state_cb() schedules link_timeout_cb() and sets ssid_found=false * AP powers on * Supplicant announces that it found the AP again * Supplicant either doesn't try to connect to AP, or doesn't get far enough before: * NM runs link_timeout_cb(), removes AP from scan list * nothing happens because the AP isn't in the scan list We can use WPAS_REMOVED_TAG in link_timeout_cb() to figure out whether the supplicant knows about the AP or not. If it does know about the AP, then the AP shouldn't be removed from NM's scan list. https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-11-11wifi: minor refactoring logging BSSID in supplicant_iface_new_bss_cb()Thomas Haller1-6/+4
(cherry picked from commit 99ff6681b7539ad9b34ed1c410e6a3a0430da2fc)
2015-11-11Revert "wifi: do no crash when getting BSSID fails"Thomas Haller1-5/+1
Since commit ebe3320e62e6f4068467f2410b93be2a05ff6d53, nm_ap_new_from_properties() will always return an AP with BSSID set. Restore the assertion during try_fill_ssid_for_hidden_ap(). This reverts commit e0e043ef3918de54f8d19a3af07d3367962970e5. (cherry picked from commit d5373959f9245faeebb1ba32b5b2b688d073ee6c)
2015-11-11wifi: don't accept any BSSes with missing BSSIDs (rh #1276426)Dan Williams2-3/+4
The supplicant should never be sending us BSSes without BSSIDs. https://bugzilla.redhat.com/show_bug.cgi?id=1276426 (cherry picked from commit 7cb323d92303df8c87d0c40c1c67b4d3a065275c)
2015-11-11wifi: fix a crash while attempting to connect hidden AP (bgo #757814)Jiří Klimeš1-2/+2
Triggered with $ nmcli dev wifi connect 00:22:6B:EB:1D:CA hidden yes where 00:22:6B:EB:1D:CA was BSSID of the AP with hidden SSID. Program received signal SIGSEGV, Segmentation fault. nm_ap_utils_complete_connection (ap_ssid=0x0, bssid=0xc9e6b0 "00:22:6B:EB:1D:CA", ap_mode=NM_802_11_MODE_INFRA, ap_flags=1, ap_wpa_flags=0, ap_rsn_flags=0, connection=0x994ae0, lock_bssid=0, error=0x7fffffffdba0) at nm-wifi-ap-utils.c:551 551 ap_ssid_bytes = g_bytes_new (ap_ssid->data, ap_ssid->len); (gdb) bt #0 0x00007fffe2ea18ef in nm_ap_utils_complete_connection (ap_ssid=0x0, bssid=0xc9e6b0 "00:22:6B:EB:1D:CA", ap_mode=NM_802_11_MODE_INFRA, ap_flags=1, ap_wpa_flags=0, ap_rsn_flags=0, connection=0x994ae0, lock_bssid=0, error=0x7fffffffdba0) at nm-wifi-ap-utils.c:551 #1 0x00007fffe2ea178f in nm_ap_complete_connection (self=self@entry=0x8add20 [NMAccessPoint], connection=connection@entry=0x994ae0, lock_bssid=0, error=error@entry=0x7fffffffdba0) at nm-wifi-ap.c:854 #2 0x00007fffe2e9e22c in complete_connection (device=0x8c39f0 [NMDeviceWifi], connection=0x994ae0, specific_object=<optimized out>, existing_connections=0xb2ef10 = {...}, error=0x7fffffffdba0) at nm-device-wifi.c:839 #3 0x000000000045f7a1 in nm_device_complete_connection (self=<optimized out>, connection=connection@entry=0x994ae0, specific_object=specific_object@entry=0xc31850 "/org/freedesktop/NetworkManager/AccessPoint/11", existing_connections=existing_connections@entry=0xb2ef10 = {...}, error=error@entry=0x7fffffffdba0) at devices/nm-device.c:2603 #4 0x00000000004e0a66 in impl_manager_add_and_activate_connection (self=0x8b81f0 [NMManager], context=0x7fffe804bde0 [GDBusMethodInvocation], settings=<optimized out>, device_path=<optimized out>, specific_object_path=0xc31850 "/org/freedesktop/NetworkManager/AccessPoint/11") at nm-manager.c:3426 #5 0x0000003bf6c05db0 in ffi_call_unix64 () at ../src/x86/unix64.S:76 #6 0x0000003bf6c05818 in ffi_call (cif=cif@entry=0x7fffffffde10, fn=<optimized out>, rvalue=0x7fffffffdd70, avalue=avalue@entry=0x7fffffffdcf0) at ../src/x86/ffi64.c:525 #7 0x0000003bf7010464 in g_cclosure_marshal_generic (closure=closure@entry=0x8d4ae0, return_gvalue=return_gvalue@entry=0x0, n_param_values=n_param_values@entry=5, param_values=param_values@entry=0xb508f0, invocation_hint=invocation_hint@entry=0x7fffffffe020, marshal_data=0x4e0890 <impl_manager_add_and_activate_connection>) at gclosure.c:1448 #8 0x00000000004c6038 in nm_exported_object_meta_marshal (closure=0x8d4ae0, return_value=0x7fffffffdfd0, n_param_values=5, param_values=0xc2a240, invocation_hint=0x7fffffffe020, marshal_data=<optimized out>) at nm-exported-object.c:346 https://bugzilla.gnome.org/show_bug.cgi?id=757814 (cherry picked from commit 98b0b4b40228b058ff094fd0090eb703d99007a2)
2015-10-22wifi: do no crash when getting BSSID failsJiří Klimeš1-1/+5
https://bodhi.fedoraproject.org/updates/NetworkManager-1.0.6-7.fc23#comment-342089 (cherry picked from commit e9bc18d2a7befb032052555ffba22bc72c9b8c2f)
2015-10-22wifi: fix a problem in removing non-existing sourceJiří Klimeš1-0/+3
GLib-CRITICAL **: Source ID 4197 was not found when attempting to remove it (cherry picked from commit 5fa369e95cbaa33d19a1cc36068678834b7e9a24)
2015-09-30build: extract version macros from "nm-version.h" to new header file ↵Thomas Haller2-0/+2
"nm-version-macros.h" For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus paths of NetworkManager. It is desirable to have this header usable without having a dependency on "glib.h", for example for a QT application. For that, commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy. For libnm-glib library, the analog to "nm-dbus-interface.h" is "NetworkManager.h", and the same applies there. Commit 159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include. However, that broke build on PackageKit [1] which expected to get the version macros by including "NetworkManager.h". So at least for libnm-glib, we need to preserve old behavior so that a user including "NetworkManager.h" gets the version macros, but not "glib.h". Extract the version macros to a new header file "nm-version-macros.h". This header doesn't include "glib.h" and can be included from "NetworkManager.h". This gives as previous behavior and a glib-free include. For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h". Very few users will actually need the version macros, but not using libnm. Users that use libnm, should just include (libnm's) "NetworkManager.h" to get all headers. As a special case, a user who doesn't want to use glib/libnm, but still needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include them both separately. [1] https://github.com/hughsie/PackageKit/issues/85 Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b (cherry picked from commit 7bf10a75db84655e65fe6216d248f7775c58ca23)
2015-09-23supplicant: adjust fragment_size according to MTU (bgo #755145)Jiří Klimeš1-1/+4
NetworkManager set wpa_supplicant's fragment_size option to 1300. But if MTU was lower, wpa_supplicant failed with "l2_packet_send - sendto: Message too long" due to fragmentation of EAP-TLS or EAP-PEAP packets. Actually, MTU has to be 14 bytes bigger than the "fragment_size" parameter. Ideally, wpa_supplicant would take MTU in the account and adjust the fragmentation limit accordingly. See discussion in http://lists.shmoo.com/pipermail/hostap/2015-August/033546.html https://bugzilla.gnome.org/show_bug.cgi?id=755145 (cherry picked from commit 94bbe7465f35b69487f306ed60b99ae6d50784e6)
2015-09-21wifi: remove unused variablesJiří Klimeš1-4/+0
(cherry picked from commit 3b11b85753cfc681aabe0795f976d29a444c1186)
2015-09-08tests: fix 32-bit buildLubomir Rintel1-2/+2
Fixes: 874f455d6d47c5a34ed9861a6710f4b78202e0d6 (cherry picked from commit f71f9d5fcf5726f9be5ac0c97e7dbc26c3e57ecc)
2015-09-08test: fix duplicate test namesLubomir Rintel1-92/+45
New glib complains. (cherry picked from commit 874f455d6d47c5a34ed9861a6710f4b78202e0d6)
2015-08-14core: accept 'ssids':aay option in RequestScan() dictionary parameterJiří Klimeš1-12/+27
It allows specifying SSIDs that should be probe-scanned, which is useful for APs with hidden SSID, for example. (cherry picked from commit 87b2d783b6c732ab9cf3ad8ef0cdaec8d971c74a)
2015-08-07wifi: expose the last_seen property for a NMAccessPointMathieu Trudel-Lapierre2-2/+24
https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00053.html
2015-06-20wifi: fix memleak in nm_ap_update_from_properties()Beniamino Galvani1-2/+5
Fixes: 59c8192b22778ad4e025db7e60828ac8ccbcb070 (cherry picked from commit 3e8d828008fd7a282da2a851f4085cab60c346ce)
2015-06-20wifi: fix recognition of AP RSN capabilitiesDan Williams1-1/+1
Stupid C&P error made everything look like WPA1. Fixes: 59c8192b22778ad4e025db7e60828ac8ccbcb070 (cherry picked from commit fce2fa57a5b304876310744cbd65ace25ae41110)
2015-06-19supplicant: convert interface/config to GDBusDan Williams3-133/+102
(cherry picked from commit 59c8192b22778ad4e025db7e60828ac8ccbcb070)
2015-06-17core: let plugins indicate links which should be ignoredDan Williams1-1/+1
Instead of hacky stuff in the Manager, let plugins themselves indicate which links should be ignored (because they are really child links that are controlled by a different device that the plugin handles). (cherry picked from commit 8fa0f4690f6f97b046399e33de1d1d6d81235636)
2015-06-17core: move permanent and initial MAC address reading to NMDevice and NMPlatformDan Williams1-111/+46
Ethernet, WiFi, and VLAN used the same implementation for initial address. Ethernet and WiFi used the same implementation (and duplicated code) for permanent MAC address, plus they both used ethtool in what should be generic code, which is better done in the platform. (cherry picked from commit aba250a7d4e72a7a98e6d43b1fb36689671b4855)
2015-06-17core: let device plugins advertise supported link and setting typesDan Williams1-7/+8
Instead of looping over all plugins and asking each plugin whether it can handle a link or a connection, have them advertise the link and connection types they support, and use that when creating new devices. (cherry picked from commit 71bde20c302ba321688f203a8c5cd1e2d296f0d1)
2015-06-17core: add generic NMDevice function to recheck availabilityDan Williams2-26/+16
And use it everywhere. (cherry picked from commit 3006df940ca254ed999e527a6e797fd016e7ebc9)
2015-06-17platform: add self argument to platform functionsThomas Haller2-26/+28
Most nm_platform_*() functions operate on the platform singleton nm_platform_get(). That made sense because the NMPlatform instance was mainly to hook fake platform for testing. While the implicit argument saved some typing, I think explicit is better. Especially, because NMPlatform could become a more usable object then just a hook for testing. With this change, NMPlatform instances can be used individually, not only as a singleton instance. Before this change, the constructor of NMLinuxPlatform could not call any nm_platform_*() functions because the singleton was not yet initialized. We could only instantiate an incomplete instance, register it via nm_platform_setup(), and then complete initialization via singleton->setup(). With this change, we can create and fully initialize NMPlatform instances before/without setting them up them as singleton. Also, currently there is no clear distinction between functions that operate on the NMPlatform instance, and functions that can be used stand-alone (e.g. nm_platform_ip4_address_to_string()). The latter can not be mocked for testing. With this change, the distinction becomes obvious. That is also useful because it becomes clearer which functions make use of the platform cache and which not. Inside nm-linux-platform.c, continue the pattern that the self instance is named @platform. That makes sense because its type is NMPlatform, and not NMLinuxPlatform what we would expect from a paramter named @self. This is a major diff that causes some pain when rebasing. Try to rebase to the parent commit of this commit as a first step. Then rebase on top of this commit using merge-strategy "ours". (cherry picked from commit c6529a9d748ad3c8ee37431d020a7b9223992a23)
2015-04-23wifi: avoid assertion in request_wireless_scan() passing NULL to ↵Thomas Haller1-1/+3
nm_utils_ssid_to_utf8() (cherry picked from commit 7f8149bdb7b7f8feba65761429869170c5a9a22f)
2015-04-23libnm,core: don't mix up enum typesLubomir Rintel1-1/+1
Touches a weak spot on clang's soul. (cherry picked from commit fd41aa451bc83d17565bfd57f68558c9aff6358f)
2015-04-02wifi: clear WPAS_REMOVED_TAG when scanning Wi-Fi APBernd Edlinger1-3/+18
(cherry picked from commit 47c505523c72b6454dec4681c0edda535c3a2e91) (cherry picked from commit 1282b468bd88cb587b42203e18b18f818ef1fb74) https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-03-13tests: fix memleaks in test-wifi-ap-utils.cDan Williams1-0/+3
(cherry picked from commit 51b3540ae44eb2de659ea5c2f40ba90d062945e0)
2015-03-13tests: enable valgrind tests for testsThomas Haller1-0/+1
(cherry picked from commit c50f30e79c67593532392f0f251d662e4294f5b2)
2015-02-24device: accept user activation request while waiting for carrierThomas Haller1-1/+1
https://bugzilla.redhat.com/show_bug.cgi?id=1079353 (cherry picked from commit 0bfe635119facb8514e8f5824f599f4c4c3514e2)
2015-02-24device: eliminate direct calls to check_connection_available() in favor of ↵Thomas Haller1-1/+0
nm_device_check_connection_available() It was confusing to understand the difference between calling nm_device_connection_is_available() and check_connection_available(), they behaved similar, but not really the same. Especially nm_device_connection_is_available() would look first into @available_connetions, and might call check_connection_available() itself. Whereas @available_connetions was also populated by testing check_connection_available(). This interrelation makes it hard to understand when nm_device_connection_is_available() returned true. Rename nm_device_connection_is_available() to nm_device_check_connection_available() and remove all direct calls of check_connection_available() in favor of the wrapper nm_device_check_connection_available(). Now we only call nm_device_check_connection_available() with different parameters (@flags and @specific_object). We also have the additional guarantee that specifying more @flags will widen the result and making a connection "more" available, while specifying a @specific_object will restrict it. This also changes behavior in several cases. For example before nm_device_connection_is_available() for user-requests would always declare matching connections available on Wi-Fi devices (only) regardless of the device state. Now the device state gets consistently considered. For default-unmanaged devices it also changes behavior in complicated ways, because before we would put connections into @available_connetions for every device-state, but nm_device_connection_is_available() had a special over-ride only for unmanaged-state. This also fixes a bug, that user can activate an unavailable Wi-Fi device: nmcli radio wifi off nmcli connection up wlan0 (cherry picked from commit d80f1bf4f09e884db1d4e9da1f339283ef9a66f9)
2015-02-24device: remove debug logging from is_available()Thomas Haller1-9/+3
Having logging statements in a simple getter (or is_*()) means you cannot call these functions without cluttering the log. Another approach would be to add an @out_reason argument, and callers who actually care log the reason. For now, just get rid of the messages. (cherry picked from commit e524be2c345431c53bc34af6e114c73def1d5891)
2015-02-24device: add flags to nm_device_is_available()Thomas Haller2-3/+3
(cherry picked from commit 52dbb2398a89134fe2c0bc19d032b985c7464c08)
2015-02-24device: add flags argument to check_connection_available()Thomas Haller1-2/+5
(cherry picked from commit e96af59444eb2f449271bd3896c47c68ebb33a5c)
2015-02-24device: merge check_connection_available_wifi_hidden() into ↵Thomas Haller1-25/+14
check_connection_available() Only refactoring, no behavioral change. (cherry picked from commit 5a042737152b928f5cd9d0e874df5952be219c12)
2014-12-02device: Deal with links that vanish during initializationLubomir Rintel1-1/+2
nm_device_get_hw_address() may return NULL and nm_platform_link_get_type may return NM_LINK_TYPE_NONE. While it might be a good idea to check for such cases at the init time it seems easier to just ignore it and prevent blowing up in subsequent deactivation. A quick test case: # while :; do ip link add moo0 type veth peer moo1; ip link del moo0 ; done Yields: NetworkManager:ERROR:devices/nm-device-ethernet.c:268:constructor: assertion failed: (link_type == NM_LINK_TYPE_ETHERNET || link_type == NM_LINK_TYPE_VETH) nm_device_set_hw_addr: assertion 'addr != NULL' failed https://bugzilla.gnome.org/show_bug.cgi?id=740992
2014-11-13all: consistently include config.hDan Winship6-1/+11
config.h should be included from every .c file, and it should be included before any other include. Fix that. (As a side effect of how I did this, this also changes us to consistently use "config.h" rather than <config.h>. To the extent that it matters [which is not much], quotes are more correct anyway, since we're talking about a file in our own build tree, not a system include.)
2014-11-13merge: wifi bssid handling fixesLubomir Rintel2-13/+10
Avoid passing NULL bssid where it does not make sense, fix a couple of bad asserts. https://bugzilla.gnome.org/show_bug.cgi?id=739258
2014-11-07libnm-core: extract NMSettingIPConfig superclass out of IP4, IP6 classesDan Winship1-8/+8
Split a base NMSettingIPConfig class out of NMSettingIP4Config and NMSettingIP6Config, and update things accordingly. Further simplifications of now-redundant IPv4-vs-IPv6 code are possible, and should happen in the future.
2014-10-31Merge branch 'lr/ap'Lubomir Rintel1-26/+27
https://bugzilla.gnome.org/show_bug.cgi?id=738439