Commit Graph

15047 Commits

Author SHA1 Message Date
Beniamino Galvani
49832fd394 core: merge branch 'bg/vlan-hwaddr-ipv6-rh1286105'
https://bugzilla.redhat.com/show_bug.cgi?id=1286105
2016-01-12 09:59:39 +01:00
Beniamino Galvani
45b77dbcfc device/vlan: reapply IPv6 configuration after MAC change
https://bugzilla.redhat.com/show_bug.cgi?id=1286105
2016-01-12 09:56:14 +01:00
Beniamino Galvani
d26a8c2eed device: export nm_device_reactivate_ip{4,6}_config functions
nm_device_reactivate_ip6_config() will be used to reconfigure IPv6
addressing when a VLAN interface changes MAC.
2016-01-12 09:56:14 +01:00
Beniamino Galvani
9b94d33232 libnm: add versioning comments and macros to nm_device_reapply*()
Fixes: 278fd4fb0f
2016-01-12 09:51:44 +01:00
Beniamino Galvani
59dc2eb29a libnm: keep symbols sorted in libnm.ver 2016-01-12 09:51:41 +01:00
Thomas Haller
d8384aa8e6 trivial: fix whitespace 2016-01-11 14:25:38 +01:00
Thomas Haller
61f400ac03 core/device: merge branch 'th/device-realize-bgo760450'
https://bugzilla.gnome.org/show_bug.cgi?id=760450
2016-01-11 14:11:24 +01:00
Thomas Haller
a602b18f74 device: refactor virtual function NMDevice:unrealize_notify() to only clear properties
Change the meaning of unrealize_notify() similar to realize_start_notify(),
which only resets device properites during unrealize.
2016-01-11 14:05:49 +01:00
Thomas Haller
ec3613f27c device/trivial: rename virtual function NMDevice:unrealize() to unrealize_notify() 2016-01-11 14:05:49 +01:00
Thomas Haller
2550850f54 device: pass NMPlatformLink instance as const pointer 2016-01-11 14:05:49 +01:00
Thomas Haller
633e105455 device/trivial: rename realize/setup function in NMDevice 2016-01-11 14:05:49 +01:00
Thomas Haller
169c5b7a52 device: remove unused virtual function NMDevice:realize()
The idea of NMDevice:realize() was to
  (1) update the device properties
  (2) fail realization if some critical properties are missing

(1) is already done during nm_device_setup_start().
(2) was only implemented by NMDeviceVlan:realize(), but it
basically was just checking whether such a platform device exists.
Other implementations don't do that either and it opens up for a race
when the device gets deleted externally.
2016-01-11 14:05:49 +01:00
Thomas Haller
eee00a8355 device/vlan: refactor handling platform properties for NMDeviceVlan
Extract a function update_properties() similar to other device
implementations. It reads the device specific data from platform
and raises property-changed notifications.

update_properties() is now called by realize_start_notify().
NMDeviceVlan:realize() -- which previously implemented something like
update_properties() -- now does nothing. Note that previously
realize() might have failed, but this is different from other device
implementations and it was unclear what a failure really meant.
Ok, it might fail because the link was not found in the platform cache.
But other implementations don't check that either, so why vlan? And
how to handle that properly anyway?
Therefore realize()'s implementation is no longer needed because
nm_device_realize() already calls realize_start_setup(), which
calls realize_start_notify() and update_properties().

update_connection() no longer refreshes the device properties.
Instead it only modifies the passed-in NMConnection. It's a bit
ugly that update_connection() uses both cached properties from
NMDeviceVlan (vlan_id) and platform properties (xgress maps).
Also, update_connection() doesn't return early on error but continues
trying to update the NMConnection. The reason is that update_connection()
cannot return a failure status.
2016-01-11 14:05:49 +01:00
Thomas Haller
225ce48b8a device/vlan: remove unreachable code from realize()
plnk->id is unsigned. It cannot be negative.
2016-01-11 14:05:49 +01:00
Thomas Haller
492691dfb2 device: remove unneeded implementations of realize()
The virtual function NMDevice:realize() is only called by
nm_device_realize() and immediately followed by nm_device_setup_start().

Devices already overwrite setup_start_notify() to update their properties.
No need to duplicate that in realize().
2016-01-11 14:05:49 +01:00
Thomas Haller
4c6b991bb0 device: move implementation of NMDevice:setup_start() to realize_start_setup()
All implementations of NMDevice:setup_start() in derived classes
invoke the parent implementation first. Enforce that by moving
NMDevice:setup_start() to realize_start_setup() and only notify
derived classes afterwards via NMDevice:realize_start_notify().
2016-01-11 14:05:49 +01:00
Thomas Haller
0311a0eae3 device: remove unused virtual function NMDevice:setup_finish() 2016-01-11 12:22:19 +01:00
Thomas Haller
1dbee32150 device: add realize_start_setup() function
Don't call the virtual function directly. Instead add
a wrapper function.
2016-01-11 12:22:19 +01:00
Thomas Haller
72e118716e trivial: fix whitespace 2016-01-11 12:22:19 +01:00
Lubomir Rintel
4059b253b7 merge: branch 'lr/reapply'
https://bugzilla.gnome.org/show_bug.cgi?id=758463
2016-01-10 23:23:58 +01:00
Thomas Haller
7db95727d5 device: refactor reapply_connection()
Reapplying a connection should not be done by iterating over and
(unsorted) @diffs array. Instead the order matters! E.g. first layer 2
before IP settings. Thus extracting those individual updates on a per-setting
base to different reapply_*() functions is more complicated, albeit incorrect
in complex cases. We need full control over how to reapply changes, one
after the other.

Also, once we start applying changes, we cannot really abort on error.
We can only continue best-effort and hope for the best.

Also, always reapply certain settings, even if the configuration doesn't
change. That means, if the user externally deletes a static IP address,
he can call reapply() to restore it. Even though he doesn't provide a
different setting to apply.

Also revert the changes to nm_device_reapply_settings_immediately().
Effectively there is little code that can be reused.

Add audit logging.
2016-01-10 23:14:29 +01:00
Thomas Haller
06dfaeec09 audit: allow passing GDBusMethodInvocation context to audit methods 2016-01-10 23:14:29 +01:00
Lubomir Rintel
8adff4993c device: apply the firewall zone and metered state on Reapply()
Reuse some code with the immediate reapply mechanism.
2016-01-10 23:14:29 +01:00
Lubomir Rintel
02bf4db8bc device: add possibility to reapply the ipv6 settings 2016-01-10 23:14:29 +01:00
Lubomir Rintel
a5b6436a90 device: add possibility to reapply the ipv4 settings 2016-01-10 23:14:29 +01:00
Lubomir Rintel
fa6375cd8b cli: add nmcli d reapply
Client support for O.FD.NM.Device.Reapply().
2016-01-10 23:13:34 +01:00
Lubomir Rintel
278fd4fb0f libnm: add nm_device_reapply()
Client support for O.FD.NM.Device.Reapply().
2016-01-10 23:13:34 +01:00
Lubomir Rintel
1490c36bb9 device: add O.FD.NM.Device.Reapply() call
The introspection data and daemon stub. There's no settings that can be
reapplied at the moment.
2016-01-10 23:13:34 +01:00
Lubomir Rintel
21fa044df0 device: refactor the ip cleanup
Split it up and move upwards. It will be useful for runtime reconfig of
IPv4 configuration.
2016-01-10 23:12:48 +01:00
Thomas Haller
4706df11fd trivial: fix whitespace 2016-01-08 16:11:56 +01:00
Jordi Mas
d85b57946a ca: update Catalan (ca) translation (bgo #760147)
https://bugzilla.gnome.org/show_bug.cgi?id=760147
2016-01-08 15:09:43 +01:00
Thomas Haller
bc7ad75d99 contrib/rpm: install pre-up dispatcher script "10-ifcfg-rh-routes.sh" as no-wait
The main reason to introduce the "no-wait.d" dispatcher directory was
"10-ifcfg-rh-routes.sh", which (as a pre-up script) delays activation.
We even extracted the script to a separate package on RHEL to avoid
delays by default.

Invoke the script via no-wait.d.
2016-01-08 14:27:18 +01:00
Beniamino Galvani
7976edb723 manager: get rid of unused defines 2016-01-07 22:40:58 +01:00
Thomas Haller
bcd28951a4 gitignore: ignore "include/" directory
When switching between "nm-1-0" branch and "master", it is
common to have a left-over "include/" directory with build
artifacts. Add it to gitignore.
2016-01-07 17:49:38 +01:00
Thomas Haller
39d6976e89 build: minor change creating symlinks in install-exec-hook for nmtui 2016-01-07 17:41:58 +01:00
Michael Biebl
39fc73eed9 build: use symlinks for nmtui
Make /usr/bin/nmtui-* symbolic links to /usr/bin/nmtui.

https://bugzilla.gnome.org/show_bug.cgi?id=759824
2016-01-07 17:41:53 +01:00
Beniamino Galvani
3b35bf0ad7 core: merge branch 'bg/device-zero-mac-fix-rh1288110'
Fix activation for ethernet devices that appear with a zero initial
MAC address.

https://bugzilla.redhat.com/show_bug.cgi?id=1288110
2016-01-07 13:39:41 +01:00
Beniamino Galvani
92149f223f device: wait for valid MAC before making ethernet devices available
In certain situations, ethernet links first appear with a zero MAC
address and then the MAC changes some time later. Currently NM does
not deal correctly with this scenario since it initializes wrong
@initial_hwaddr and @permanent_hwaddr on the device and tries to
immediately activate it.

To fix this, initialize the device's addresses only when the MAC
becomes valid and make the device available only at that point.
2016-01-07 11:53:05 +01:00
Beniamino Galvani
2a0a9aa2e4 device/trivial: split out nm_device_update_initial_hw_address() 2016-01-07 11:52:52 +01:00
Beniamino Galvani
44789e3291 core: simplify generation of default connection for new devices
Instead of using a signal for triggering the generation of a default
connection when the device becomes managed, let the manager wait for a
transition to UNAVAILABLE or DISCONNECTED states.

This partially reverts b3b0b46250 ("device: retry creation of
default connection after link is initialized").
2016-01-07 11:52:52 +01:00
Thomas Haller
06e0595401 wifi: merge branch 'th/wifi-device-creation-bgo760154'
https://bugzilla.gnome.org/show_bug.cgi?id=760154
2016-01-06 22:19:54 +01:00
Thomas Haller
1a835ad3d0 wifi: refactor creation of NMDeviceWifi/NMDeviceOlpcMesh to initialize in constructed() method 2016-01-06 22:18:25 +01:00
Thomas Haller
044de4cea2 wifi: don't fail construction of NMDeviceWifi in constructor
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
2016-01-06 22:18:25 +01:00
Thomas Haller
e2e22eb574 wifi-olpc: refactor NMDeviceOlpcMesh to hold pointer to NMManager
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.
2016-01-06 22:18:25 +01:00
Thomas Haller
a097895a65 wifi: use "bool" members instead of gboolean in NMDeviceWifiPrivate struct 2016-01-06 22:18:24 +01:00
Beniamino Galvani
0b5264d400 merge: branch 'bg/helper-macros-bgo760149'
https://bugzilla.gnome.org/show_bug.cgi?id=760149
2016-01-06 21:28:30 +01:00
Beniamino Galvani
c37c36e7ec core: cache pointer to private-data in NMIP{4,6}Config structure
This is the same as 04c70c76bc for the
NMIP4Config and NMIP6Config structures. The new field makes debugging
of issues related to IP configuration much easier.
2016-01-06 21:25:56 +01:00
Beniamino Galvani
24d8604637 core: use NM_PLATFORM_GET instead of nm_platform_get() in function calls
Replacement was done with command:

spatch --sp-file nm_platform_get.cocci --in-place --smpl-spacing --dir src

where nm_platform_get.cocci contains:

@@
identifier func;
expression list args;
@@
- func (nm_platform_get())
+ func (NM_PLATFORM_GET)

@@
identifier func;
expression list args;
@@
- func (nm_platform_get(), args)
+ func (NM_PLATFORM_GET, args)
2016-01-06 21:25:56 +01:00
Beniamino Galvani
ea1eb94d9b core: use nm_clear_g_signal_handler() where possible
Replacement was done with command:

spatch --sp-file nm_clear_g_signal_handler.cocci --in-place --smpl-spacing --dir src

where nm_clear_g_signal_handler.cocci contains:

@@
expression obj, id;
@@
- if (id) {
-    g_signal_handler_disconnect (obj, id);
-    id = 0;
- }
+ nm_clear_g_signal_handler (obj, &id);
2016-01-06 21:25:56 +01:00
Beniamino Galvani
f96abc8be5 core: always use gulong to store signal handler ids
We inconsistently use gulong,guint,int types to store signal handler
id, but the type returned by g_signal_connect() is a gulong.

This has no practical consequences because a int/guint is enough to
store the value, however it is better to use a consistent type, also
because nm_clear_g_signal_handler() accepts a pointer to the signal id
and thus it must be always called with the same pointer type.
2016-01-06 21:25:55 +01:00