summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* device: refactor autoconnect blocking by introducing ↵Thomas Haller2017-11-086-53/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMDeviceAutoconnectBlockedFlags enum The flags allow for more then two reasons. Currently the only reasons for allowing or disallowing autoconnect are "user" and "intern". It's a bit odd, that NMDeviceAutoconnectBlockedFlags has a negative meaning. So nm_device_set_autoconnect_intern (device, FALSE); gets replaced by nm_device_set_autoconnect_blocked_set (device, NM_DEVICE_AUTOCONNECT_BLOCKED_INTERN); and so on. However, it's chosen this way, because autoconnect shall be allowed, unless any blocked-reason is set. That is, to check whether autoconnect is allowed, we do if (!nm_device_get_autoconnect_blocked (device, NM_DEVICE_AUTOCONNECT_BLOCKED_ALL)) The alternative check would be if (nm_device_get_autoconnect_allowed (device, NM_DEVICE_AUTOCONNECT_ALLOWED_ALL) == NM_DEVICE_AUTOCONNECT_ALLOWED_ALL) which seems odd too. So, add the inverse flags to block autoconnect. Beside refactoring and inverting the meaning of the autoconnect settings, there is no change in behavior. (cherry picked from commit 5279ab5be6326b911682e53d8c29d20a501d61b8)
* policy: don't check autoconnect flag of connection in ↵Thomas Haller2017-11-081-6/+0
| | | | | | | | | | | | | | | | | | | nm_device_can_auto_connect() nm_device_can_auto_connect() only has one caller, auto_activate_device() in NMPolicy. That caller already checks whether the connection has autoconnect enabled, so drop the duplicate check. This saves some duplication, but it also makes some sense: NMSettingsConnection has a complex blocking of autoconnect, so just looking at connection.autoconnect is not enough in any case to determine whether the connection should autoconnect. We move thus more handling of autoconnect to NMPolicy, where it belongs. (cherry picked from commit 6fff832fe3b1086c226c8e26a6c3b4d413dde086)
* policy: refactor auto_activate_device() to return earlyThomas Haller2017-11-081-37/+37
| | | | (cherry picked from commit a7ef46eaaad6e7eabc3f5ee9d6bde69321c112bd)
* policy: optimize nm_device_can_auto_connect() to not check ↵Thomas Haller2017-11-082-2/+11
| | | | | | nm_device_autoconnect_allowed() (cherry picked from commit bfe66fb8f410a003f4d2ae05cba9baff798ddbad)
* device: minor refactoring of condition in nm_device_autoconnect_allowed()Thomas Haller2017-11-081-3/+6
| | | | | | Makes it clearer what is happening (to me). (cherry picked from commit 45da11f37068059df5d36115d80bebd15fc92188)
* device/olpc-mesh: reject autoconnect requests early via ↵Thomas Haller2017-11-081-5/+2
| | | | | | | | | | get_autoconnect_allowed() OLPC devices cannot autoconnect, according to can_auto_connect(). We should instead reject any attempt to autoconnect earlier, via get_autoconnect_allowed(). (cherry picked from commit 7074b88a6a3f61066e42b3f136ac0c0f6e189b0c)
* device: inline NMDevice's implementation of can_auto_connect()Thomas Haller2017-11-082-13/+18
| | | | | | | Derived classes should not modify or overwrite this essential behavior of can_auto_connect(). It doesn't belong to the virtual function. (cherry picked from commit 715aebe08a99519fe0d6b979db00fe4dbff9d678)
* policy: remove redundant check in device_autoconnect_changed()Thomas Haller2017-11-081-4/+2
| | | | | | | schedule_activate_check() also checks for nm_device_autoconnect_allowed() and aborts if there is nothing to do. (cherry picked from commit 990af413ac56c784125fe50df64a374933396e3f)
* device: move nm_device_get_enabled() from schedule_activate_check() to ↵Thomas Haller2017-11-082-3/+3
| | | | | | nm_device_autoconnect_allowed() (cherry picked from commit fc18ff30cf74014e613e3c099a901e4e7ba82678)
* device: drop stub implementation of get_autoconnect_allowed() in NMDeviceThomas Haller2017-11-082-12/+5
| | | | (cherry picked from commit 9a7e668dbb552667e2545953a325d1d041fa0518)
* ifcfg-rh: persist the connection type for TeamPort connectionsBeniamino Galvani2017-11-064-3/+77
| | | | | | | | | | | | Currently the ifcfg-rh plugin doesn't explicitly store the connection type for team slaves and is only able to read back ethernet and vlan connections. Leave this unchanged for ethernet and vlan slaves, but store the TYPE variable for other connection types (Wi-Fi and Infiniband) so that we can properly determine their type when the connection is read. (cherry picked from commit 29a576496e23278abab310ce83cad98239908e9f)
* logging: configure dnsmasq's logging in shared mode via nm-loggingThomas Haller2017-11-061-1/+2
| | | | (cherry picked from commit cc993aa02040564c16d78c864f3c3a22d20443eb)
* ndisc: fix ordering of gatewaysBeniamino Galvani2017-11-032-5/+66
| | | | | | | | | Insert the new gateway at the end when it has the least preference. Fixes the following runtime error: src/ndisc/nm-ndisc.c:204:_ASSERT_data_gateways: assertion failed: (_preference_to_priority (item_prev->preference) >= _preference_to_priority (item->preference))
* wifi: use connection.auth-retries to handle authentication in NMDeviceWifiThomas Haller2017-11-021-27/+4
|
* device: move tracking auth_retry to NMDeviceThomas Haller2017-11-024-42/+24
| | | | | It will be also used by NMDeviceWifi. It might waste a 4 bytes for device types that don't require authentication. But it deduplicates code.
* ifcfg-rh: use svSetValueInt64_cond() in write_connection_setting()Thomas Haller2017-11-021-13/+11
|
* all: move setting 802-1x.auth-retries to connection.auth-retriesThomas Haller2017-11-026-40/+37
| | | | | | | | | | | The number of authentication retires is useful also for passwords aside 802-1x settings. For example, src/devices/wifi/nm-device-wifi.c also has a retry counter and uses a hard-coded value of 3. Move the setting, so that it can be used in general. Although it is still not implemented for other settings. This is an API and ABI break.
* ifcfg-rh: refactor write_object() to avoid coverity warningThomas Haller2017-10-311-18/+13
| | | | | | Coverity detects that the "if (blob)" condition must always be true. Reorder the code, to avoid the warning. It's a bit clearer this way anyway.
* ovs: add backward compatibility wrapper for json_object_foreach() macroThomas Haller2017-10-311-0/+8
|
* policy: move blocking autoconnect from NMDeviceModem to NMPolicyThomas Haller2017-10-312-25/+23
| | | | | | | | | | Only NMPolicy should be concerned with handling autoconnect, and blocking it. Move the code. Note that there is a slight possible change in behavior, as the order of when the connection is blocked changes, based on the different times when the device changed signal gets executed. But that shouldn't be a problem.
* policy: inline can_autoconnect check in auto_activate_device()Thomas Haller2017-10-311-27/+15
|
* policy: move nm_settings_connection_can_autoconnect() to policyThomas Haller2017-10-313-27/+30
| | | | Step by step, we move all tracking of autoconnect to NMPolicy.
* device: handle authentication retries using 802-1x.auth-retries settingThomas Haller2017-10-316-54/+86
| | | | | | | | | | | | | | | | | | | | Since commit 4a6fd0e83ec0d83547b1f3a1a916f85e9f450d8c (device: honor the connection.autoconnect-retries for 802.1X) and the related bug bgo#723084, we reuse the autoconnect-retries setting to control the retry count for requesting passwords. I think that is wrong. These are two different settings, we should not reuse the autoconnect retry counter while the device is still active. For example, the user might wish to set autoconnect-retries to infinity (zero). In that case, we would retry indefinitly to request a password. That could be problematic, if there is a different issue with the connection, that makes it appear tha the password is wrong. A full re-activation might succeed, but we would never stop retrying to authenticate. Instead, we should have two different settings for retrying to authenticate and to autoconnect. This is a change in behavior compared to 1.8.
* libnm,cli,ifcfg-rh: add NMSetting8021x:auth-retries propertyThomas Haller2017-10-312-7/+10
|
* settings: add and use nm_settings_connection_autoconnect_retries_try_next()Thomas Haller2017-10-314-10/+16
|
* device: move resetting autoconnect retries from subtype to NMDeviceThomas Haller2017-10-315-35/+31
|
* config: remove nm_config_data_get_value_cached()Thomas Haller2017-10-315-46/+25
| | | | | | | It has almost no callers, and it is a bit of a strange API. Let's not cache the last accessed value inside NMConfigData. Instead, free it right after use. It was not reused anyway, it only hangs around as convenience for the caller.
* config: add nm_config_data_get_value_int64() utilThomas Haller2017-10-312-1/+24
|
* settings/trivial: rename settings-connection's autoconnect functionsThomas Haller2017-10-316-48/+48
| | | | | | | | | | | | | | | Names like - nm_settings_connection_get_autoconnect_retries - nm_settings_connection_set_autoconnect_retries - nm_settings_connection_reset_autoconnect_retries are about the same thing, but they are cumbersome to grep because they share not a common prefix. Rename them from SUBJECT_VERB_OBJECT to SUBJECT_OBJECT_VERB, which sounds odd in English, but seems preferred to me. Now you can grep for "nm_settings_connection_autoconnect_retries_" to get all accessors of the retry count, or "nm_settings_connection_autoconnect_" to get all accessors related to autoconnect in general.
* Revert "device: log device type too"Lubomir Rintel2017-10-311-6/+3
| | | | | | | I didn't really mean to include it as it doesn't make any sense at this point and makes the logs a bit more messy. This reverts commit 340e35c09d8950e6c8151a7934d05d90b37418ea.
* device: avoid touching sysctls for devices without platform linkLubomir Rintel2017-10-311-0/+22
| | | | | | | | | | | | | | | | | Since 32b3eb1181 [core: merge IPv4 and IPv6 implementation of nm_utils_ip4_property_path()], nm_utils_sysctl_ip_conf_path() introduced in cd271d5cb1 [core: add nm_utils_sysctl_ip_conf_is_path() util] is used to cunstruct sysctl paths and it is way less tolerant towards using something that is not an interface name in the path. It's always been incorrect to assume the ifname is a linux link name and it resulted it ugly, if benign, sysctl access attempts such as "/sys/class/net/28:B2:BD:5D:23:AB/phys_port_id" etc. Now it triggers an assertion failure. Let's guard all such accesses. Fixes: 32b3eb1181 Fixes: cd271d5cb1
* ifcfg-rh: remove password-raw keys file after testBeniamino Galvani2017-10-311-1/+1
| | | | Fixes: a83ab252ee589e6c94b2c568a2954857dede706e
* devices/ovs/ovsdb: fix 32bit buildsLubomir Rintel2017-10-311-2/+2
| | | | So that we work well on VAXen.
* ifcfg-rh: add support for 802-1x.password-raw propertyBeniamino Galvani2017-10-314-12/+108
| | | | | | When the ifcfg-rh plugin writes a 802-1x setting it currently ignores the password-raw property and so the password disappears when the connection is saved. Add support for the property.
* devices/ovs/ovsdb: fix build with old JanssonLubomir Rintel2017-10-311-0/+8
|
* device: keep platform link alive in device_link_changed()Thomas Haller2017-10-301-12/+12
| | | | | | | | | | | | | | For a while now, all NMPObject instances are not modified after being cached. They are immutable, and can be passed around by keeping a reference to them. No longer copy the NMPlatformLink data to a @info variable. Instead, take a reference (which ensures that the instance stays alive). It won't change, as it's immutable. The advantage is, that whenever you see a NMPlatformLink pointer, for exmple in device_recheck_slave_status(), you can be sure that it's actually a NMPObect, and NMP_OBJECT_UP_CAST() will work.
* device: add support for OpenVSwitch devicesLubomir Rintel2017-10-309-0/+2489
|
* all: add OVSDB connection failure device state reasonLubomir Rintel2017-10-301-0/+1
|
* introspection: add o.fd.NM.Device.OvsBridge interfaceLubomir Rintel2017-10-301-0/+1
|
* introspection: add o.fd.NM.Device.OvsPort interfaceLubomir Rintel2017-10-301-0/+1
|
* introspection: add o.fd.NM.Device.OvsInterface interfaceLubomir Rintel2017-10-301-0/+2
|
* device: don't progress from ip-config state when we're enslavedLubomir Rintel2017-10-301-39/+7
| | | | | | | We now can be enslaved and have L3 configuration at the same time. This also reduces some unnecessary complexity, because the decision to progress to IP_CHECK or SECONDARIES now happens in a single place, in the check_ip_state() routine.
* device/trivial: move check_ip_state() upwardsLubomir Rintel2017-10-301-101/+101
|
* device: don't wait for a carrier before enslaving devicesLubomir Rintel2017-10-301-0/+7
| | | | | | The OpenVSwitch interfaces come into existence by their enslavement to a port. They can also bear an IP4 or IP6 configuration -- waiting on a carrier would deadlock the acitvation.
* device: log device type tooLubomir Rintel2017-10-301-3/+6
|
* device: do not limit unrealizement to devices with platform linksLubomir Rintel2017-10-301-3/+1
|
* device: ignore enslavement to ovs-masterLubomir Rintel2017-10-301-13/+24
| | | | | | That one is special. All interfaces that are attached to OpenVSwitch ports appear as slaves to that one even for our purposes we like to pretend they're slaves to the actual OpenVSwitch bridges.
* manager: add a method to get a particular device of given typeLubomir Rintel2017-10-303-10/+31
| | | | And also make the remove_device() method use it behind the scenes.
* manager: always update the device when the plink comes and goesLubomir Rintel2017-10-303-42/+43
| | | | | | | | | | | For some software devices, the platform link appears only after they've been realized. Update their properties and let them know that the link has changed so they can eventually proceed with activation. Also, reset the properties (udi, iface, driver) that are set from the platform link when the link goes away. At that point they don't reflect reality anymore. Removes some code duplication too.
* manager: don't assign a new link to a device of a different link typeLubomir Rintel2017-10-301-0/+3
|