Commit graph

9919 commits

Author SHA1 Message Date
Beniamino Galvani
29a576496e ifcfg-rh: persist the connection type for TeamPort connections
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.
2017-11-06 16:40:57 +01:00
Thomas Haller
cc993aa020 logging: configure dnsmasq's logging in shared mode via nm-logging 2017-11-06 12:00:28 +01:00
Beniamino Galvani
db41380c15 ndisc: fix ordering of gateways
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))
2017-11-03 10:44:48 +01:00
Thomas Haller
72756994d4 wifi: use connection.auth-retries to handle authentication in NMDeviceWifi 2017-11-02 11:41:01 +01:00
Thomas Haller
32acaccf2a device: move tracking auth_retry to NMDevice
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.
2017-11-02 11:41:01 +01:00
Thomas Haller
6705c71263 ifcfg-rh: use svSetValueInt64_cond() in write_connection_setting() 2017-11-02 11:41:01 +01:00
Thomas Haller
2730dc60de all: move setting 802-1x.auth-retries to connection.auth-retries
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.
2017-11-02 11:41:01 +01:00
Thomas Haller
53dea38834 ifcfg-rh: refactor write_object() to avoid coverity warning
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.
2017-10-31 20:15:04 +01:00
Thomas Haller
76b913a210 ovs: add backward compatibility wrapper for json_object_foreach() macro 2017-10-31 20:02:48 +01:00
Thomas Haller
cb2aa6bd4c policy: move blocking autoconnect from NMDeviceModem to NMPolicy
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.
2017-10-31 19:35:33 +01:00
Thomas Haller
3828ba3b0e policy: inline can_autoconnect check in auto_activate_device() 2017-10-31 19:35:33 +01:00
Thomas Haller
1a9d4869ed policy: move nm_settings_connection_can_autoconnect() to policy
Step by step, we move all tracking of autoconnect to NMPolicy.
2017-10-31 19:35:33 +01:00
Thomas Haller
e62e52dfe1 device: handle authentication retries using 802-1x.auth-retries setting
Since commit 4a6fd0e83e (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.
2017-10-31 19:35:33 +01:00
Thomas Haller
89e518db5a libnm,cli,ifcfg-rh: add NMSetting8021x:auth-retries property 2017-10-31 19:35:33 +01:00
Thomas Haller
18f2d272ba settings: add and use nm_settings_connection_autoconnect_retries_try_next() 2017-10-31 19:35:33 +01:00
Thomas Haller
361a199a06 device: move resetting autoconnect retries from subtype to NMDevice 2017-10-31 19:35:28 +01:00
Thomas Haller
447dc874ce config: remove nm_config_data_get_value_cached()
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.
2017-10-31 19:14:07 +01:00
Thomas Haller
262159be00 config: add nm_config_data_get_value_int64() util 2017-10-31 19:14:07 +01:00
Thomas Haller
ec9bff293b settings/trivial: rename settings-connection's autoconnect functions
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.
2017-10-31 19:14:07 +01:00
Lubomir Rintel
f0a23bf999 Revert "device: log device type too"
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 340e35c09d.
2017-10-31 18:48:41 +01:00
Lubomir Rintel
bc83bec253 device: avoid touching sysctls for devices without platform link
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
2017-10-31 18:46:17 +01:00
Beniamino Galvani
5f97430e21 ifcfg-rh: remove password-raw keys file after test
Fixes: a83ab252ee
2017-10-31 14:44:39 +01:00
Lubomir Rintel
47ebb98630 devices/ovs/ovsdb: fix 32bit builds
So that we work well on VAXen.
2017-10-31 10:57:05 +01:00
Beniamino Galvani
a83ab252ee ifcfg-rh: add support for 802-1x.password-raw property
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.
2017-10-31 10:19:49 +01:00
Lubomir Rintel
eee1553288 devices/ovs/ovsdb: fix build with old Jansson 2017-10-31 09:21:30 +01:00
Thomas Haller
f2858220e3 device: keep platform link alive in device_link_changed()
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.
2017-10-30 21:46:55 +01:00
Lubomir Rintel
830a5a14cb device: add support for OpenVSwitch devices 2017-10-30 21:46:55 +01:00
Lubomir Rintel
d0cb2050f3 all: add OVSDB connection failure device state reason 2017-10-30 17:40:09 +01:00
Lubomir Rintel
b5925d693c introspection: add o.fd.NM.Device.OvsBridge interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
6748c44cb6 introspection: add o.fd.NM.Device.OvsPort interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
b0f3dc0add introspection: add o.fd.NM.Device.OvsInterface interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
89c4732142 device: don't progress from ip-config state when we're enslaved
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.
2017-10-30 17:40:08 +01:00
Lubomir Rintel
44eef0cfff device/trivial: move check_ip_state() upwards 2017-10-30 17:40:08 +01:00
Lubomir Rintel
dcfe276a82 device: don't wait for a carrier before enslaving devices
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.
2017-10-30 17:40:08 +01:00
Lubomir Rintel
340e35c09d device: log device type too 2017-10-30 17:40:08 +01:00
Lubomir Rintel
6ac826350c device: do not limit unrealizement to devices with platform links 2017-10-30 17:40:08 +01:00
Lubomir Rintel
c843fe4783 device: ignore enslavement to ovs-master
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.
2017-10-30 17:40:08 +01:00
Lubomir Rintel
6af5030cf2 manager: add a method to get a particular device of given type
And also make the remove_device() method use it behind the scenes.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
d7f7725ae8 manager: always update the device when the plink comes and goes
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.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
abaa852866 manager: don't assign a new link to a device of a different link type 2017-10-30 17:38:37 +01:00
Lubomir Rintel
097d41b8e6 manager: match device type when removing an ip interface
Otherwise we might end up removing a wrong device of a same name.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
67b265182f utils: don't assume a device with master won't have IP configuration
Whether the ip[46]-config exists is a better way, and we already check
that.
2017-10-30 17:38:37 +01:00
Thomas Haller
7f84f15e06 core: avoid coverity warning in device factory's _add_factory() (3)
2. NetworkManager-1.9.2/src/devices/nm-device-factory.c:312:
returned_pointer: Assigning value from "g_slist_append(list,
g_object_ref(factory))" to "list" here, but that stored value is
overwritten before it can be used.

Fixes: 98afc76184
Fixes: 449940af1d
2017-10-30 16:55:26 +01:00
Thomas Haller
d0d962d3d1 ifcfg: fix invalid free in parse_route_line()
Cannot free NM_PTRARRAY_EMPTY(). Discovered by coverity.

Fixes: 6d675a943b
2017-10-30 16:35:02 +01:00
Thomas Haller
62a57dab49 device: workaround coverity warning
Coverity doesn't like this. Refactor a bit, hoping that it fares better.

1. Defect type: ASSERT_SIDE_EFFECT
1. NetworkManager-1.9.2/src/devices/nm-device.c:10226: assignment_where_comparison_intended: Assignment "ip_ifindex = nm_device_get_ip_ifindex(self)" has a side effect. This code will work differently in a non-debug build.
2. NetworkManager-1.9.2/src/devices/nm-device.c:10226: remediation: Did you intend to use a comparison ("==") instead?
2017-10-30 16:28:44 +01:00
Thomas Haller
449940af1d core: avoid coverity warning in device factory's _add_factory() (2)
2. NetworkManager-1.9.2/src/devices/nm-device-factory.c:312:
returned_pointer: Assigning value from "g_slist_append(list,
g_object_ref(factory))" to "list" here, but that stored value is
overwritten before it can be used.

Fixes: 98afc76184
2017-10-30 16:28:44 +01:00
Thomas Haller
98afc76184 core: avoid coverity warning in device factory's _add_factory()
2. NetworkManager-1.9.2/src/devices/nm-device-factory.c:312:
returned_pointer: Assigning value from "g_slist_append(list,
g_object_ref(factory))" to "list" here, but that stored value is
overwritten before it can be used.
2017-10-30 14:43:42 +01:00
Thomas Haller
66e1fdb7ec core: workaround coverity/compiler warning about tautological compare in nm_log_ptr()
Coverity claims:

1. NetworkManager-1.9.2/src/devices/team/nm-device-team.c:303:
unsigned_compare: This greater-than-or-equal-to-zero comparison of an
unsigned value is always true. "0U <= LOGL_DEBUG".
2017-10-30 14:41:41 +01:00
Thomas Haller
f088afe7e9 platform: remove unreachable code from nmp_cache_lookup_link_full()
If @ifname is set, we above lookup by name (nmp_lookup_init_link_by_ifname)
and set ifname to NULL. Hence, inside the loop, the check for ifname is
never true.
2017-10-30 14:34:04 +01:00
Thomas Haller
89a9908abf ifcfg-rh: avoid Unreachable coverity warning in reader
The loops never run more then once.

unreachable: Since the loop increment "iter++;" is unreachable, the loop
body will never execute more than once.
2017-10-30 14:31:29 +01:00