Commit graph

17578 commits

Author SHA1 Message Date
Beniamino Galvani
2e80b66427 libnm-core: clarify the meaning of the connection.permissions property
https://bugzilla.redhat.com/show_bug.cgi?id=1457939
(cherry picked from commit 378a2f2486)
2017-07-25 18:05:38 +02:00
Beniamino Galvani
8dc198d586 libnm-core: improve documentation for ipv4.dhcp-client-id property
https://bugzilla.redhat.com/show_bug.cgi?id=1468358
(cherry picked from commit 4b51f5b1a8)
2017-07-25 17:49:10 +02:00
Thomas Haller
44c412d524 travis: fix travis build to use Ubuntu 12.04 LTS (Precise Pangolin)
Travis used by default Ubuntu 12.04 which is now EOL. Hence, the default
changed.

Eventually, we may want to upgrade the tests to run on Ubuntu 14.04.5
LTS (Trusty Tahr). But for that we need to adjust the travis test
script.

For now, explicitly select precise.

https://blog.travis-ci.com/2017-07-11-trusty-as-default-linux-is-coming?utm_source=web&utm_medium=banner&&utm_campaign=trusty-default
(cherry picked from commit e260f2a08a)
2017-07-25 16:26:34 +02:00
Thomas Haller
9b5b0eb022 travis: enable gcc+clang compiler for travis builds
(cherry picked from commit 4efab710e4)
2017-07-25 16:26:31 +02:00
Thomas Haller
faf3cef542 core: fix creating lower-case MAC address with nm_utils_hwaddr_ntoa_buf()
There is only one caller at the moment, and he passes TRUE anyway.

(cherry picked from commit f0adca00f3)
2017-07-25 15:40:34 +02:00
Richard Fontana
91cb458349 Make licensing of contributions more explicit
Signed-off-by: Richard Fontana <rfontana@redhat.com>

https://mail.gnome.org/archives/networkmanager-list/2017-July/msg00034.html
(cherry picked from commit 0c6f88d4f0)
2017-07-25 07:18:14 +02:00
Thomas Haller
39b947fc7f platform: fix return value for do_delete_object()
The return value for the delete methods checks whether the object
is actually deleted. That is questionable behavior, because if the netlink
request succeeds, there is little point in checking with the platform cache.
As it is, it is racy.

Anyway, the previous value was totally wrong.

But it also uncovers another platform bug, which currently breaks
route tests. Will be fixed next.

(cherry picked from commit 5b09f7151b)
2017-07-25 06:57:26 +02:00
Beniamino Galvani
b72b8ef34c connectivity: fix memory leak
Fixes: 9d43869e47
(cherry picked from commit 7204472de5)
2017-07-19 22:16:46 +02:00
Beniamino Galvani
e80163c713 dns: perform the public-suffix check only for the hostname-derived domain
The DNS manager drops from the search list domains that are public
suffixes to prevent a possible domain hijack when using two-labels
hostnames [1].

This is a problem now that every single-label domain can be a TLD
since this means that such domains can't be used in the search list.

While it's useful to apply such restriction to the domain
automatically derived from the system hostname, it seems wrong to drop
domains specified by users in the configuration or provided by DHCP.

This commit keeps the public-suffix check only for the
hostname-derived domain

[1] https://bugzilla.redhat.com/show_bug.cgi?id=812394

https://bugzilla.redhat.com/show_bug.cgi?id=1404350
(cherry picked from commit 5aa22ed8c9)
2017-07-17 17:04:28 +02:00
Thomas Haller
beeb8df9ac dhcp/tests: add test parsing dhclient config
(cherry picked from commit 0c23191b01)
2017-07-10 11:55:54 +02:00
Jonathan Kang
7200906a62 dhcp/dhclient: improve "interface" statement parsing
In commit d405cfd908, parsing "interface"
statement is introduced. But it leads to uncommplete parsing of the
"request" entry, if one of the lines in "request" entry is prefixed with
word "interface". For example, the default configuration of openSUSE
distribution:

request subnet-mask, broadcast-address, routers,
	rfc3442-classless-static-routes,
	interface-mtu, host-name, domain-name, domain-search,
	domain-name-servers, nis-domain, nis-servers,
	nds-context, nds-servers, nds-tree-name,
	netbios-name-servers, netbios-dd-server,
	netbios-node-type, netbios-scope, ntp-servers;

Fixes: d405cfd908

https://bugzilla.opensuse.org/show_bug.cgi?id=1047004
https://mail.gnome.org/archives/networkmanager-list/2017-July/msg00015.html
(cherry picked from commit 3646ed083d)
2017-07-10 11:55:52 +02:00
Thomas Haller
d8164d57e2 build: belatedly bump version macros 2017-07-07 17:42:28 +02:00
Thomas Haller
ec0a2e19c6 release: bump version to 1.8.3 (development) 2017-07-07 14:05:11 +02:00
Thomas Haller
9ed1921ce3 release: bump version to 1.8.2 2017-07-07 14:02:12 +02:00
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