Commit graph

18770 commits

Author SHA1 Message Date
Thomas Haller d7d9759d56 docs: fix typo in NMSettingBridge:group-forward-mask doc
Fixes: 17ec3aef2f

https://bugzilla.gnome.org/show_bug.cgi?id=789662
2017-10-30 21:49:50 +01:00
Lubomir Rintel 79168a5434 merge: branch 'lr/ovs'
https://bugzilla.redhat.com/show_bug.cgi?id=1470282
2017-10-30 21:48:22 +01:00
Lubomir Rintel 6b532fed50 man: add OpenVSwitch overview 2017-10-30 21:46:55 +01:00
Thomas Haller 4199c976da libnm: fix normalizing and verifying OVS connections
Normalizing can be complicated, as settings depend on each other and possibly
conflict.

That is, because verify() must exactly anticipate whether normalization will
succeed and how the result will look like. That is because we only want to
modify the connection, if we are sure that the result will verify.

Hence, verify() and normalize() are strongly related. The implementation
should not be spread out between NMSettingOvsInterface:verify(),
NMSettingOvsPatch:verify() and _normalize_ovs_interface_type().

Also, add some unit-tests.
2017-10-30 21:46:55 +01:00
Thomas Haller 93315d01da tests: add nmtst_assert_connection_has_settings() helper 2017-10-30 21:46:55 +01:00
Thomas Haller 7b36a6a890 libnm: add nm_connection_get_settings()
There is no API to get all settings. You can only ask for
settings explicitly, but that requires you to probe for them
and know which ones may exist.

The alternative API might be nm_connection_for_each_setting_value(),
but that only iterates over settings' properties. If a setting has no
properties, it is ignored.
2017-10-30 21:46:55 +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 1f25ae08fb core/connection: allow address for ovs interfaces 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 aec8d36b3e clients: add support for ovs-bridge setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel 6f73b4608a clients: add support for ovs-port setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel 6dcd54b0de clients: add support for ovs-interface setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel e7ab81098a clients: add support for ovs-patch setting 2017-10-30 17:40:09 +01:00
Lubomir Rintel 3f74528a0b libnm: add support for ovs-bridge devices 2017-10-30 17:40:09 +01:00
Lubomir Rintel c536d7e666 libnm: add support for ovs-port devices 2017-10-30 17:40:09 +01:00
Lubomir Rintel e5c19377ec libnm: add support for ovs-interface devices 2017-10-30 17:40:08 +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 cb9b024ddb libnm-core: add ovs-bridge setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel 8a1ae40a80 libnm-core: add ovs-port setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel 27790fa976 libnm-core: add ovs-interface setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel d4a7fe4679 libnm-core: add ovs-patch setting 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
Lubomir Rintel 4391ba82dd cli/trivial: drop default branch from some cases
This way not handling a known enum value will be caught by a compiler
warning.
2017-10-30 17:38:37 +01:00
Lubomir Rintel acd814d50a generate-setting-docs: error out on missing documentation 2017-10-30 17:38:37 +01:00
Lubomir Rintel c3080c79dc ip-tunnel: fix a typo 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
Lubomir Rintel fb8ea059e6 cli: ignore PAGER when escalating privileges
nmcli typically doesn't run setuid, nor uses file capabilities or is labelled
for a SELinux domain trainsition upon execution.

But in case anyone has any reason to do that, we should follow good
security practices and not exec whatever is set in the environment.
2017-10-30 15:27:05 +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
Thomas Haller e3a582202f wifi: refactor nm_wifi_utils_level_to_quality() not to assert
Apparantly, the assert might fail (on i386?). Unclear why that would possibly
happen. Anyway, replace the assert.
2017-10-30 14:14:18 +01:00
Thomas Haller 8cbb6d9e86 wifi/tests: add test whether nm_wifi_utils_level_to_quality() is in range 2017-10-30 14:14:17 +01:00
Thomas Haller 6d63b6484f systemd: avoid coverity warning about Deadcode
Coverity is unhappy about comparing the literal LOG_DEBUG value:

1. Defect type: CONSTANT_EXPRESSION_RESULT
1. NetworkManager-1.9.2/src/systemd/src/libsystemd/sd-event/sd-event.c:2652:
result_independent_of_operands: "7 >= (_level & 7)" is always true regardless
of the values of its operands. This occurs as the logical first operand of "?:".

Work around by instead using an inline function.
2017-10-30 14:14:05 +01:00