Commit Graph

21076 Commits

Author SHA1 Message Date
Beniamino Galvani
0d5e712f73 platform: fix linux-platform link_*_add() functions signature
They should return a gboolean, not an int.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
2ac5860a06 platform: avoid double log messages
Certain platform operations are logged both in nm-platform.c and
nm-linux-platform.c, resulting in duplicate messages.  Drop log prints
from the latter.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
052d76cf82 platform: fix attribute size in link_gre_add()
Input and output flags are 16 bit.

Fixes: 91bf0efaa7
2018-07-02 17:55:14 +02:00
Beniamino Galvani
403b545ac6 core: fix wrong check of gretap hardware length
GRETAP have an Ethernet-like hardware address.

Fixes: e2270040c0
2018-07-02 17:55:14 +02:00
Thomas Haller
a0f4f40215 libnm: merge branch 'th/libnm-register-settings'
https://github.com/NetworkManager/NetworkManager/pull/147
2018-07-01 18:18:11 +02:00
Thomas Haller
9d3f01a27c libnm: add code comment about thread-safty of _nm_utils_init() and use atomic
Although we don't really need protect for thread safety in _nm_utils_init(),
avoid using static variables without lock/atomic operations. libnm is not
thread-safe, but we still should try to avoid potential issues whenever it is
easy.
2018-07-01 18:17:31 +02:00
Thomas Haller
fa9fe466db libnm: avoid constructor function for registering NMSetting types
constructor functions are ugly, because code is running before
main() starts. Instead, as the registration code for NMSetting types
is insid the GType constructor, we just need to ensure at the
right place, that the GType was created.

The right place here is _register_settings_ensure_inited(), because
that is called before we need the registration information.
2018-07-01 18:17:31 +02:00
Thomas Haller
ecd53944b3 libnm: make _nm_register_setting() thread safe
_nm_register_setting() and _nm_register_setting_impl() are called from within
the GType constructor for the NMSetting subtype. As such, at that point it
runs inside a g_once_init_enter() block. However, each implementation
for initializing the GType has a separate g_once_init_enter() variable, hence,
if two threads create GType instances for different NMSetting subclasses, there
is a race.

libnm is not thread safe. However, it should be at least thread safe
with respect to constructing the GType instances.
2018-07-01 18:17:31 +02:00
Thomas Haller
8093c9d329 libnm: avoid constructor function to initialize setting registration for NMSetting
For NMSetting subtypes, we need the static dictionaries "registered_settings" and
"registered_settings_by_type" to keep track of existing NMSetting types.

Initialize these dictionaries inside NMSetting's type initialization code.
This is guaranteed to run before any use of NMSetting type, and is also
guarded by a mutex.

Also, drop the __attribute__((constructor)) function to initialize the
hash tables. They are not needed, and it's ugly to run code before
main().
2018-07-01 18:17:31 +02:00
Javier Arteaga
0827d4c2e4 platform: add support for WireGuard links
Add support for a new wireguard link type to the platform code. For now
this only covers querying existing links via genetlink and parsing them
into platform objects.
2018-07-01 14:52:46 +02:00
Thomas Haller
b26efa5b68 libnm: fix missing symbols in libnm ABI
Also backport the ABI to 1.12.2 (and thus, don't bother
initially adding the API as libnm_1_14_0).
2018-06-30 12:29:35 +02:00
Thomas Haller
07c1e8c83c libnm: add missing symbols for 1.14 API
Fixes: c1bafea71831994b54d0d9f104005b08797d3e2d
2018-06-30 12:15:51 +02:00
Thomas Haller
4ad45b5944 libnm: fix symbol versioning for new symbols in 1.14 ABI
Fixes: 191c9c7f0d
2018-06-30 12:15:51 +02:00
Eric Renfro
b4116a6fe6 dnsmasq: fix separation from system-wide dnsmasq
This disables loading the system-wide dnsmasq from /etc/dnsmasq.conf
and defines to use the NMSTATEDIR device-unique dhcp-leasefile,
preventing it from trampling over others, and isolating it to just
the wifi-ap use.

https://github.com/NetworkManager/NetworkManager/pull/156
2018-06-30 11:56:37 +02:00
Thomas Haller
7f2b7ee4cd nm-online: print "[started|start-pending|failure]" for --wait-for-startup
`nm-online --wait-for-startup` isn't really intended to be called directly.
It is mainly for implementing "NetworkManager-wait-online.service".

Anyway, at the end, the result does not indicate the connectivty status
of the host. Hence, printing

  Connecting...............   30s [online]

is misleading. It merely means, that startup is complete. Likewise,
printing "[offline]" would not mean that there is no connectivity.
Instead, it means that startup is still in progress on timeout.

As it is now, the distinction between whether to print "start-pending"
and "failure" is not very clear. Not that it matters much. At least is
corresponds to the exit status of the program. If we sometimes confuse
EXIT_FAILURE_OFFLINE with other failure reasons, the exit status needs
to be corrected first.

https://github.com/NetworkManager/NetworkManager/pull/152
2018-06-30 10:59:08 +02:00
Lubomir Rintel
c5951f5917 libnm-core: add NMSetting{6Lowpan,Wpan}Class to a public header
This was an accidental ommission.
2018-06-29 22:34:23 +02:00
Lubomir Rintel
59ccf5dc89 examples/python: drop nmex.py
It's not an example and not actually used.

https://github.com/NetworkManager/NetworkManager/pull/141
2018-06-29 20:05:39 +02:00
Thomas Haller
cbeb34d355 release: bump version to 1.13.1-dev after 1.12.0 release
After 1.12.0 is released, merge it back into master so that
1.12.0 is part of the history of master. That means,
  $ git log --first-parent master
will also traverse 1.12.0 and 1.12-rc*.

Also bump the micro version to 1.13.1-dev to indicate that this is
after 1.12.0 is out.
2018-06-29 18:06:13 +02:00
Thomas Haller
8964dbe8bc release: bump version to 1.12.0 2018-06-29 17:06:25 +02:00
Thomas Haller
db8696f164 release: update NEWS 2018-06-29 17:01:42 +02:00
Thomas Haller
e0dc1da411 release: fix NEWS entry for NM_DISPATCHER_ACTION
This was not backported to nm-1-10 branch.
2018-06-29 17:01:42 +02:00
Thomas Haller
f3d1cf8100 device: merge branch 'th/device-dad-handling-rh1593210'
While this fixes rh#1593210 and CI test "ipv6_keep_external_routes",
it breaks CI test "ipv6_add_static_address_manually_not_active". See
related bug rh#1585078. It seems in the short term, the fix is more
important than the new issue, hence merging.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
https://github.com/NetworkManager/NetworkManager/pull/144

(cherry picked from commit 8076a6f003)
2018-06-29 16:43:31 +02:00
Thomas Haller
1609344eda device: only check for IPv6 DAD and link-local address on actively managed devices
In device_ipx_changed() we only keep track of dad6_failed_addrs
addresses if the device's state is > DISCONNECTED.

For the same reason, we should also do that in queued_ip_config_change().

But it's worse. If the device is in state disconnected, and the user
externally adds IPv6 addresses, we will end up in queued_ip_config_change().
It is easily possible that "need_ipv6ll" ends up being TRUE, which results
in a call to check_and_add_ipv6ll_addr() and later possibly

  ip_config_merge_and_apply (self, AF_INET6, TRUE);

This in turn will modify the IP configuration on the device, although
the device may be externally managed and NetworkManager shouldn't touch it.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
(cherry picked from commit 890c748643)
2018-06-29 16:43:10 +02:00
Thomas Haller
e7ea66eb1a device: emit IP address changes in queued_ip_config_change() only once
We first iterate over addresses that might have failed IPv6 DAD and
update the state in NMNDisc.

However, while we do that, don't yet invoke the changed signal.
Otherwise, we will invoke it multiple times (in case multiple addresses
failed). Instead, keep track of whether something changed, and handle
it once a bit later.

(cherry picked from commit f312620276)
2018-06-29 16:43:10 +02:00
Thomas Haller
b638edf4a0 device: refactor handling dad6_failed_addrs in queued_ip_config_change()
Whenever we process queued IP changes, we must handle all pending
dad6_failed_addrs. This is, to ensure we don't accumulate more
and more addresses in the list.

Rework the code, by stealing the entire list once at the beginning

    dad6_failed_addrs = g_steal_pointer (&priv->dad6_failed_addrs);

and free it at the end:

    g_slist_free_full (dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);

This makes it easier to see, that we always process all addresses in
priv->dad6_failed_addrs.

(cherry picked from commit e2c13af805)
2018-06-29 16:43:10 +02:00
Thomas Haller
f5b48bd973 device: split handling for dad6_failed_addrs and dad6_ip6_config in queued_ip_config_change()
There is no change in behavior, however don't handle dad6_failed_addrs
and dad6_ip6_config in the same block.

While both parts are related to IPv6 DAD, they do something rather
different:

 - the first block, checks all candidates from dad6_failed_addrs whether
   they actually indicate DAD failed, and handles them by notifying
   NMNDisc about failed addresses.

 - the second block, checks whether we have now all addresses from
   dad6_ip6_config that we are waiting for.

Split the blocks.

(cherry picked from commit 3fcdba1a19)
2018-06-29 16:43:10 +02:00
Thomas Haller
b86d8968d5 device: simplify postponing IP config change in queued_ip_config_change()
We don't need to cancel the current idle-action and schedule a new
one. Just return and wait to be called again.

Also, drop the logging. Similarly, we don't log the postponing for
the previous case either.

(cherry picked from commit 63cf5bd249)
2018-06-29 16:43:10 +02:00
Thomas Haller
171001c34d device: clear dad6_failed_addrs in _cleanup_ip_pre()
We also cancel the idle handler

  nm_clear_g_source (&priv->queued_ip_config_id_x[IS_IPv4])

which means, nobody is going to process these addresses (at least
for the moment).

The purpose of "dad6_failed_addrs" is to keep track of addresses that
might be interesting for checking about DAD failures. If we are no
longer reacting on IP changes (because the idle handler was removed),
we also no longer need these addresses.

(cherry picked from commit dbb936e5c8)
2018-06-29 16:43:10 +02:00
Thomas Haller
3ce80c8d65 device: simplify handling of IP config changes while initializing link
This simplifies commit 31ca7962f8.

We don't need the boolean flags like "queued_ip4_config_pending" to
track whether we received any platform signals while being not yet
initialized in platform (udev, NM_UNMANAGED_PLATFORM_INIT).

In general, as long as the device is NM_UNMANAGED_PLATFORM_INIT,
all platform signals are ignored. And when the device becomes managed,
we schedule anyway an initial config-change.

(cherry picked from commit 18ecc4b4f1)
2018-06-29 16:43:10 +02:00
Thomas Haller
8076a6f003 device: merge branch 'th/device-dad-handling-rh1593210'
While this fixes rh#1593210 and CI test "ipv6_keep_external_routes",
it breaks CI test "ipv6_add_static_address_manually_not_active". See
related bug rh#1585078. It seems in the short term, the fix is more
important than the new issue, hence merging.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
https://github.com/NetworkManager/NetworkManager/pull/144
2018-06-29 16:39:02 +02:00
Thomas Haller
890c748643 device: only check for IPv6 DAD and link-local address on actively managed devices
In device_ipx_changed() we only keep track of dad6_failed_addrs
addresses if the device's state is > DISCONNECTED.

For the same reason, we should also do that in queued_ip_config_change().

But it's worse. If the device is in state disconnected, and the user
externally adds IPv6 addresses, we will end up in queued_ip_config_change().
It is easily possible that "need_ipv6ll" ends up being TRUE, which results
in a call to check_and_add_ipv6ll_addr() and later possibly

  ip_config_merge_and_apply (self, AF_INET6, TRUE);

This in turn will modify the IP configuration on the device, although
the device may be externally managed and NetworkManager shouldn't touch it.

https://bugzilla.redhat.com/show_bug.cgi?id=1593210
2018-06-29 16:38:50 +02:00
Thomas Haller
f312620276 device: emit IP address changes in queued_ip_config_change() only once
We first iterate over addresses that might have failed IPv6 DAD and
update the state in NMNDisc.

However, while we do that, don't yet invoke the changed signal.
Otherwise, we will invoke it multiple times (in case multiple addresses
failed). Instead, keep track of whether something changed, and handle
it once a bit later.
2018-06-29 16:38:50 +02:00
Thomas Haller
e2c13af805 device: refactor handling dad6_failed_addrs in queued_ip_config_change()
Whenever we process queued IP changes, we must handle all pending
dad6_failed_addrs. This is, to ensure we don't accumulate more
and more addresses in the list.

Rework the code, by stealing the entire list once at the beginning

    dad6_failed_addrs = g_steal_pointer (&priv->dad6_failed_addrs);

and free it at the end:

    g_slist_free_full (dad6_failed_addrs, (GDestroyNotify) nmp_object_unref);

This makes it easier to see, that we always process all addresses in
priv->dad6_failed_addrs.
2018-06-29 16:38:50 +02:00
Thomas Haller
3fcdba1a19 device: split handling for dad6_failed_addrs and dad6_ip6_config in queued_ip_config_change()
There is no change in behavior, however don't handle dad6_failed_addrs
and dad6_ip6_config in the same block.

While both parts are related to IPv6 DAD, they do something rather
different:

 - the first block, checks all candidates from dad6_failed_addrs whether
   they actually indicate DAD failed, and handles them by notifying
   NMNDisc about failed addresses.

 - the second block, checks whether we have now all addresses from
   dad6_ip6_config that we are waiting for.

Split the blocks.
2018-06-29 16:38:50 +02:00
Thomas Haller
63cf5bd249 device: simplify postponing IP config change in queued_ip_config_change()
We don't need to cancel the current idle-action and schedule a new
one. Just return and wait to be called again.

Also, drop the logging. Similarly, we don't log the postponing for
the previous case either.
2018-06-29 16:38:50 +02:00
Thomas Haller
dbb936e5c8 device: clear dad6_failed_addrs in _cleanup_ip_pre()
We also cancel the idle handler

  nm_clear_g_source (&priv->queued_ip_config_id_x[IS_IPv4])

which means, nobody is going to process these addresses (at least
for the moment).

The purpose of "dad6_failed_addrs" is to keep track of addresses that
might be interesting for checking about DAD failures. If we are no
longer reacting on IP changes (because the idle handler was removed),
we also no longer need these addresses.
2018-06-29 16:38:50 +02:00
Thomas Haller
18ecc4b4f1 device: simplify handling of IP config changes while initializing link
This simplifies commit 31ca7962f8.

We don't need the boolean flags like "queued_ip4_config_pending" to
track whether we received any platform signals while being not yet
initialized in platform (udev, NM_UNMANAGED_PLATFORM_INIT).

In general, as long as the device is NM_UNMANAGED_PLATFORM_INIT,
all platform signals are ignored. And when the device becomes managed,
we schedule anyway an initial config-change.
2018-06-29 16:38:50 +02:00
Beniamino Galvani
5ccd7f7fd7 device: clear the dhcp grace-period source id
Fixes: 17009ed91d
(cherry picked from commit db1867bafd)
2018-06-29 16:12:14 +02:00
Beniamino Galvani
db1867bafd device: clear the dhcp grace-period source id
Fixes: 17009ed91d
2018-06-29 16:08:40 +02:00
Thomas Haller
c2b4e8b290 mailmap: minor adjustment to mailmap not to match by name
We use the email address of the user as their ID. In this case,
there is no need to restrict the match based on the name as well.

In practice, this makes no difference at all, because these email
addresses only come with the present names.

(cherry picked from commit d1aca62475)
2018-06-29 11:10:35 +02:00
Lubomir Rintel
44cca6b31f mailmap: add mailmap
This allows us to disambiguate committers. The list was compiled
manually, with preference of latter e-mail addresses if more were used
throughout the history.

(cherry picked from commit 0eafdcd572)
2018-06-29 11:10:34 +02:00
Thomas Haller
d1aca62475 mailmap: minor adjustment to mailmap not to match by name
We use the email address of the user as their ID. In this case,
there is no need to restrict the match based on the name as well.

In practice, this makes no difference at all, because these email
addresses only come with the present names.
2018-06-29 11:10:06 +02:00
Beniamino Galvani
4888ee7e83 platform: change temp variable name in NLA_PUT_TYPE()
__tmp clashes with htole16() on s390x.

Fixes: 4120ad2431

https://github.com/NetworkManager/NetworkManager/pull/151
2018-06-29 10:24:19 +02:00
Thomas Haller
863428ef26 clients/docs: fix generated documentation for Open vSwitch
Fixes: 9be0c3330d
(cherry picked from commit bf7b941502)
2018-06-29 09:59:51 +02:00
Thomas Haller
bf7b941502 clients/docs: fix generated documentation for Open vSwitch
Fixes: 9be0c3330d
2018-06-29 09:58:01 +02:00
Lubomir Rintel
225f25e041 docs: provide soft descriptions for NM{Simple,Remote}Connection
...and order them on more logical places in the libnm manual.

(cherry picked from commit e53a7365ca)
2018-06-28 20:43:29 +02:00
Lubomir Rintel
4fa1a49542 docs: include missing documentation in libnm and D-Bus docs
Check that we don't repeat the omission in future.

(cherry picked from commit cb1172ee3d)
2018-06-28 20:43:26 +02:00
Lubomir Rintel
79fe82753d examples/qt/meson: drop dbus-glib dependency
It's not actually required.

(cherry picked from commit 22813fdc60)
2018-06-28 20:41:12 +02:00
Lubomir Rintel
b478b77558 libnm/meson: make generate_setting_docs depend on the typelib
Otherwise it would attempt to use a system-wide installed one, resulting
in sadness and misery.

(cherry picked from commit d6c08691d9)
2018-06-28 20:41:12 +02:00
Lubomir Rintel
03733911cb meson: generate-setting-docs.py environment correctly
It's ugly, because meson doesnt' seem to provide any useful facilities for
dealing with environment variables. Not my fault.

(cherry picked from commit 21840f5321)
2018-06-28 20:41:12 +02:00