Commit graph

17564 commits

Author SHA1 Message Date
Thomas Haller
ca116a6c9f release: update NEWS 2017-07-07 13:59:08 +02:00
Lubomir Rintel
61b1ab2fcd ifcfg: drop an unused variable
(cherry picked from commit 0d71c0569f)
2017-07-07 13:44:30 +02:00
Beniamino Galvani
75fb2897d7 checkpoint: disconnect device before reactivation during rollback
Since commit 0922a17738 ("manager: avoid that auto-activations
preempt user activations") the manager doesn't allow a internal
activation to disconnect the same connection already active on the
device.  Thus, during a rollback we must ensure that the device is
deactivated before.

Fixes: 0922a17738
(cherry picked from commit 348959cfa2)
2017-07-05 11:19:55 +02:00
Thomas Haller
e96ee7fe53 libnm: merge branch 'th/libnm-client-async-revert'
Revert the change to initialize the GDBusObjectManager
synchronously. I still maintain that GDBusObjectManager's
async initialization is severely broken on it's own, but this
change broke

  $ systemctl restart NetworkManager
  $ nmcli connection up "$NAME"

leaving nmcli hanging, as libnm fails to process some D-Bus signals.
I think that hints to another bug, but apparently the previous
version was less broken. So revert for now.

https://bugzilla.redhat.com/show_bug.cgi?id=1450075

(cherry picked from commit 95ff2b8e8a)
2017-06-29 10:03:27 +02:00
Thomas Haller
c0844be7a2 libnm: refactor name-owner check for object-manager
(cherry picked from commit 196bae36bb)
2017-06-29 10:03:03 +02:00
Thomas Haller
a90ab3a401 libnm: move check for pending_init to init_async_complete()
(cherry picked from commit a73e73eae1)
2017-06-29 10:03:03 +02:00
Thomas Haller
5a489ef03e libnm: fix leaking init_data in got_object_manager()
Only happens if there are no objects, which would be very unusual.

(cherry picked from commit 4f0a621d43)
2017-06-29 10:03:03 +02:00
Thomas Haller
5e7dedc48d libnm: assert in async_inited_obj_nm() for existing pending_init count
(cherry picked from commit 958ae36c17)
2017-06-29 10:03:03 +02:00
Thomas Haller
adeaadc1ae libnm/trivial: move code
(cherry picked from commit efac9ecadd)
2017-06-29 10:03:03 +02:00
Thomas Haller
85863b4506 libnm: clear cancellable in new_object_manager() before emitting signal
Emitting signals may have side-effects. Just clear the cancellable
first, it is handled for good.

(cherry picked from commit d5efcc1115)
2017-06-29 10:03:03 +02:00
Thomas Haller
cafa720918 libnm: fix leaking cancellable in NMClient's name_owner_changed()
(cherry picked from commit e0ddf64522)
2017-06-29 10:03:03 +02:00
Thomas Haller
388954c93c libnm: fix getting self pointer in NMClient's new_object_manager()
(cherry picked from commit df6e2e2e78)
2017-06-29 10:03:03 +02:00
Thomas Haller
3dd9a430fa libnm: clear NMClientPrivate.object_manager in name_owner_changed()
Don't leave dangling pointers.

(cherry picked from commit 880a7061f2)
2017-06-29 10:03:03 +02:00
Thomas Haller
6d8a400d3f Revert "libnm: don't use async constructor for GDBusObjectManager"
Strangely, this breaks

  systemctl restart NetworkManager
  nmcli connection up "$NAME"

It seems that with this change, libnm misses some events from D-Bus.
It looks like there is something seriously broken. Before fixing it,
revert the previous state.

https://bugzilla.redhat.com/show_bug.cgi?id=1450075

This reverts commit 529d620a59.

(cherry picked from commit 45d6147098)
2017-06-29 10:03:03 +02:00
Thomas Haller
2fae2cbf02 Revert "libnm: refactor error handling in got_object_manager()"
This reverts commit c5370ea71a.

(cherry picked from commit 7cd4711e31)
2017-06-29 10:03:03 +02:00
Beniamino Galvani
10ccdf4b81 core,cli: replace wrong pattern for clearing GError
Use gs_free_error instead of gs_free.

(cherry picked from commit 65a0208ba0)
2017-06-27 09:46:09 +02:00
Beniamino Galvani
5e74db3f38 introspection: slightly improve checkpoint documentation
Fix CheckpointCreate() arguments formatting, add link to create flags
and capitalize sentences.

(cherry picked from commit 2b405c98fb)
2017-06-26 10:02:43 +02:00
Beniamino Galvani
4b21a00ae2 bond: ignore miimon option only when it is zero
The default value for miimon, when missing in the setting, is 0 if
arp_interval is != 0, and 100 otherwise. So, when generating a
connection, let's ignore miimon=0 (which means that miimon is
disabled) and accept any other value. Adding miimon=100 does not cause
any harm to the connection assumption.

While at it, slightly improve the code: ignore_if_zero() is not useful
for 'updelay','downdelay','arp_interval' because zero is their default
value, so introduce a new function that checks if the value is the
default (and specially handles 'miimon').

Reported-by: Taketo Kabe <rkabe@vega.pgw.jp>

https://bugzilla.redhat.com/show_bug.cgi?id=1463077
(cherry picked from commit 92fc109183)
2017-06-23 11:28:15 +02:00
Beniamino Galvani
89c4ed4374 libnm-core: setting-bond: add missing xmit_hash_policy values
Add the missing values "encap2+3" and "encap3+4".

https://bugs.centos.org/view.php?id=11467
(cherry picked from commit 7ee1af5f8a)
2017-06-22 10:55:41 +02:00
Francesco Giudici
cf726a51b9 manager: when a connection is upped on a device, do an early update of its internal state
When a user forces up a connection on a device, mark earlier the
device as managed: this would allow proper clean-up on the device also
when it was previously unmanaged or assumed.
This would avoid skipping IPv6LL address generation when instead it was
needed.

Fixes: adbf383628

https://bugzilla.redhat.com/show_bug.cgi?id=1452046
(cherry picked from commit d4a033c4ad)
2017-06-21 16:15:59 +02:00
Thomas Haller
6fdf96d1d7 libnm: merge branch 'th/libnm-dbus-object-async-rh1450075'
https://bugzilla.redhat.com/show_bug.cgi?id=1450075

(cherry picked from commit 6b1dcb3641)
2017-06-19 17:29:51 +02:00
Thomas Haller
5458b36bfc libnm: remove property getter for NMObject's "dbus-object" and "dbus-object-manager"
These properties are internal and shall not be publicly accessible.
Remove the getter.

We may later no longer use GDBusObjectManager. It should be an implementation
detail, not exposed in the public API of NMObject.

(cherry picked from commit 357fd6ba82)
2017-06-19 17:29:28 +02:00
Thomas Haller
7c744c445b libnm: refactor error handling in got_object_manager()
(cherry picked from commit c5370ea71a)
2017-06-19 17:29:28 +02:00
Thomas Haller
ed9954c133 libnm: don't use async constructor for GDBusObjectManager
The current implementation of GDBusObjectManagerClient implements
GAsyncInitableIface, however it simply runs GInitableIface's
synchronous init on another thread.

I suspect that there are races in the way that is implemented.
For one, we see crashes and warnings (rh#1450075, rh#1457769,
rh#1457223). Also, it seems very wrong to me, how GDBusObjectManagerClient
mixes asynchronous signals (on_control_proxy_g_signal) with
synchronously getting all objects (process_get_all_result,
GetManagedObjects).

I think we should ditch GDBusObjectManager altogether, including the
gdbus-codegen skeletons. They add layers of code, for something that
should be simple to do directly. For now, just don't do asynchronous
initialization on another thread, so we at least avoid this kind of
multithreadding issue.

This may make the initialization of NMClient a bit slower.

(cherry picked from commit 529d620a59)
2017-06-19 17:29:28 +02:00
Thomas Haller
b071e9ade7 libnm: complete async result in got_object_manager() also when cancelled
Cancelling an operation shall not mean to not invoke the result callback.
The result callback is *always* to be invoked.

(cherry picked from commit c5a48b7a0b)
2017-06-19 17:29:28 +02:00
Beniamino Galvani
2236c3c728 manager: avoid that auto-activations preempt user activations
In _internal_activate_device(), we try to find an existing master AC
for the slave AC, and we create a new one in case of failure. The
master AC may already exist, but it may not be detected by
find_master() because it is undergoing authorization.

The result is that we auto-activate the master when there is already a
user activation in place, and the auto-activation will cancel the user
one. This is bad, as user-activation should always have precedence.

To fix this, introduce a last-minute check before activating internal
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1450219
(cherry picked from commit 0922a17738)
2017-06-19 16:00:57 +02:00
Thomas Haller
6f61497a1b dns: merge branch 'th/fix-dns-priority-for-resolved-bgo783569'
https://bugzilla.gnome.org/show_bug.cgi?id=783569

(cherry picked from commit 02d56ec87c)
2017-06-19 15:16:09 +02:00
Thomas Haller
24f4caebec dns: don't clone DNS configs list for nm_dns_plugin_update()
No need to clone the list anymore. Unfortunately, GPtrArray is not NULL
terminated (without extra effort), so we have to pass on the GPtrArray
instance for the length.

(cherry picked from commit 19a98c6f61)
2017-06-19 15:15:49 +02:00
Thomas Haller
4c81a447cc dns: fix negative ipv4.dns-priority for systemd-resolved
A negative ipv4.dns-priority and ipv6.dns-priority has the meaning to configure
the DNS information of the connection exclusively. With systemd-resolved, that means
we must explicitly unset the configuration from other interfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=783569
(cherry picked from commit 70792e51d9)
2017-06-19 15:15:49 +02:00
Thomas Haller
6ac67655be dns: make configs argument to update a const pointer
(cherry picked from commit d582176939)
2017-06-19 15:15:49 +02:00
Thomas Haller
08d8b38a81 dns/systemd: remove unused device lookup in add_interface_configuration()
(cherry picked from commit 1c9285b06e)
2017-06-19 15:15:49 +02:00
Thomas Haller
8887970713 dns: add helper method to get DNS priority from NMDnsIPConfigData
(cherry picked from commit c818e46d48)
2017-06-19 15:15:49 +02:00
Thomas Haller
c464e111a4 dns: minor refactoring in _collect_resolv_conf_data()
The code was correct previously, but it was confusing to me,
because

  - once @skip gets set to TRUE, it stays TRUE for the rest
    of the loop.
  - in each additional skipped iteration, it would still set
    plugin_confs[i] to NULL. Which is not wrong, but confusing.
  - it would set "prev_prio = prio;" in each iteration.
    After @skip is set to TRUE, that doesn't matter anymore,
    but is confusing. Before @skip is set to TRUE it also
    doesn't really matter to set it more then once, because
    we only care about the very first priority.
  - @skip sounded to me like the current iteration would
    be skipped. But really all remaining will be skipped too.

(cherry picked from commit aa347182bb)
2017-06-19 15:15:49 +02:00
Thomas Haller
b54a4cb0d6 device: merge branch 'th/device-reapply-external-rh1462223'
https://bugzilla.redhat.com/show_bug.cgi?id=1462223

(cherry picked from commit f71195b102)
2017-06-19 15:03:16 +02:00
Thomas Haller
368c7329f8 device: fix taking over device after modifying external connection
For externally managed interfaces, we create an in-memory connection
and keep the device with sys-iface-state=external.

When the user actively modifies the connection, we persist it to
storage. But we also must take over managing the device.

One problem is that nm_device_reapply() errors out if the device
is still activating. It's unclear how to reapply the connection
while the device is in the process of activation. So, if the user
modifies the created connection very quickly, reapplying the settings
will fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1462223
(cherry picked from commit 10c0632df0)
2017-06-19 15:02:11 +02:00
Thomas Haller
08c58c759a core: fix registering notify-flags hook in NMActiveConnection
We react on changes to NMSettingsConnection.flags, so that we can update
from an external activation to a managed one.

However, previously we would only register the _settings_connection_notify_flags
callback during _set_settings_connection(). So, if via constructor properties
we first set PROP_SETTINGS_CONNECTION and later PROP_ACTIVATION_TYPE, we wouldn't
register the callback.

(cherry picked from commit b84da25713)
2017-06-19 15:02:11 +02:00
Thomas Haller
653ba8b759 core: log changes to NMSettingsConnection's flags
(cherry picked from commit 2656ba8d1d)
2017-06-19 15:02:11 +02:00
Thomas Haller
98d50a72be build: fix race creating "libnm-core/tests" directory for "nm-core-tests-enum-types.c"
https://bugzilla.gnome.org/show_bug.cgi?id=783783
(cherry picked from commit b55fba8fbd)
2017-06-15 12:54:20 +02:00
Beniamino Galvani
2e181f9c4d cli: fix failed assertion in readline helper
The INT signal can arrive after a new line has been processed in
nmc_readline_helper(). In such case, the handler gets uninstalled by
readline_cb() and nmc_seen_sigint() returns TRUE. However it's an
error to call rl_callback_read_char() without handler, don't do it.

Fixes the following:
 "readline: readline_callback_read_char() called with no handler!"
 #0 __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #1 __GI_abort () at abort.c:90
 #2 rl_callback_read_char () at ../callback.c:116
 #3 nmc_readline_helper (prompt=prompt@entry=0x2aa0d229080 "nmcli> ") at clients/cli/common.c:1387
 #4 nmc_readline (prompt_fmt=prompt_fmt@entry=0x2aa0036ac9e "%s") at clients/cli/common.c:1448
 #5 do_connection_edit (connection=0x2aa0d215440, nmc=0x2aa00391298 <nm_cli>) at clients/cli/connections.c:7072

Fixes: 995229181c

https://bugzilla.redhat.com/show_bug.cgi?id=1458311
(cherry picked from commit cd3a561251)
2017-06-15 10:05:57 +02:00
Beniamino Galvani
9819ffe7d4 core: sort addresses in captured IPv4 configuration
When IPv4 addresses are synchronized to platform, the order of IPv4
addresses matters because the first address is considered the primary
one. Thus, nm_ip4_config_capture() should put the primary address as
first, otherwise during synchronization addresses will be removed and
added back with a different primary/secondary role.

https://bugzilla.redhat.com/show_bug.cgi?id=1459813
(cherry picked from commit b6fa87a4c0)
2017-06-13 23:36:07 +02:00
Thomas Haller
588841f2e0 device: don't set MTU of device unless explicitly configured
Since commit 2b51d3967 "device: merge branch 'th/device-mtu-bgo777251'",
we always set the MTU for certain device types during activation. Even
if the MTU is neither specified via the connection nor other means, like
DHCP.

Revert that change. On activation, if nothing explicitly configures the
MTU, leave it unchanged. This is like what we do with ethernet's
cloned-mac-address, which has a default value "preserve".
So, as last resort the default value for MTU is now 0 (don't change),
instead of depending on the device type.

Note that you also can override the default value in global
configuration via NetworkManager.conf.

This behavior makes sense, because whenever NM actively resets the MTU,
it remembers the previous value and restores it when deactivating
the connection. That wasn't implemented before 2b51d3967, and the
MTU would depend on which connection was previously active. That
is no longer an issue as the MTU gets reset when deactivating.

https://bugzilla.redhat.com/show_bug.cgi?id=1460760
(cherry picked from commit 4ca3002b86)
2017-06-13 15:27:21 +02:00
Beniamino Galvani
73e664e3b1 cli: remove spurious device names from output
When running one of:

 nmcli device wifi list ifname wlan0
 nmcli device wifi connect ... ifname wlan0

nmcli wrongly adds the device name to the output.

Do the completion only when requested.

Fixes: 8679793f6b
Fixes: 1a0dfd31c4
(cherry picked from commit d2b4332b36)
2017-06-11 22:43:50 +02:00
Thomas Haller
3cca3b50e2 ppp: merge branch 'th/ppp-cleanup'
(cherry picked from commit 17e7054d73)
2017-06-09 16:17:05 +02:00
Thomas Haller
1b954fe09b ppp: fix cancelling timeout when pppd process exits
Otherwise, we get pppd_timed_out() later, which will
emit a DEAD state change at unexpected times.

(cherry picked from commit b9af32b056)
2017-06-09 16:16:42 +02:00
Thomas Haller
b87327a5fe ppp: cleanup logging pppd exit reason in ppp_watch_cb
- don't use assert but be more graceful with g_return_if_fail().
- in case of failure, don't log a debug message after the warning.
  One message is sufficient, drop "pppd pid %d cleaned up".
- print GPid type as long long.
- increase log level to warning. pppd dying unexpectedly warrants a
  warning.

(cherry picked from commit 250e723951)
2017-06-09 16:16:42 +02:00
Thomas Haller
38b5d356de ppp: don't log newlines
(cherry picked from commit a814b96ebf)
2017-06-09 16:16:42 +02:00
Thomas Haller
ccda61b6fc ppp: refactor ppp_exit_code() to split out error to string conversion
ppp_exit_code() does too much or too little. Either it should log
about all reasons why pppd exited, including signals, or it should
just do the status to string conversion. Split it.

(cherry picked from commit 3f64910b52)
2017-06-09 16:16:42 +02:00
Thomas Haller
105ef99cbf ppp/trivial: fix whitespace
(cherry picked from commit 5c5fbe0a9f)
2017-06-09 16:16:42 +02:00
Thomas Haller
620adbcc7b ppp: inline and drop trivial function remove_timeout_handler()
(cherry picked from commit 0f16649ba2)
2017-06-09 16:16:42 +02:00
Thomas Haller
5e656b5872 ppp: unexport NMPPPManager instance on dispose()
Let's explicitly unexports on dispose(). Probably that already
happened, because NMExportedObject asserts that it is unexported
during !quitting.

During quitting, we probably don't tear down the manager.

Anyway, we should always unexport.

(cherry picked from commit f07dca941d)
2017-06-09 16:16:39 +02:00