Commit Graph

21088 Commits

Author SHA1 Message Date
Francesco Giudici
21e5e61655 man/trivial: fix heading comment in nm-openvswitch.xml 2018-07-06 17:28:28 +02:00
Olivier Gayot
d1a98d6892 device: fix order of params in nm_match_spec_device prototype
The following commit:

  b869d9cc0 device: add spec "driver:" to match devices

added two parameters ("driver" and "driver_version") to the
nm_match_spec_device() function.

However, the definition of the function and its declaration are not
consistent.

The prototype shows:
  nm_match_spec_device (const GSList *specs,
                        const char *interface_name,
                        const char *driver,
                        const char *driver_version,
                        const char *device_type,

But the definition shows:
  nm_match_spec_device (const GSList *specs,
                        const char *interface_name,
                        const char *device_type,
                        const char *driver,
                        const char *driver_version,

Since all parameters are pointers to const char, the type checking
succeeds at compile time.

All currently existing invocations of the function are correct and pass
the arguments in the order described in the definition/implementation.
This patch only changes the prototype so that potential future
invocations don't end up buggy.

Fixes: b869d9cc0d
2018-07-06 14:48:42 +02:00
Michael Biebl
7ab7dc9487 Increase timeout in test-nm-client to 30s
On slow architectures it can take longer then 3s for the test service to
start up.
2018-07-05 16:48:06 +02:00
Beniamino Galvani
f396826466 libnm: add (allow-none) annotations to nm_device_reapply()
The @connection argument can be NULL; add the (allow-none) annotation
otherwise calling the API with a NULL argument through GObject
introspection fails with:

 Argument 1 does not allow None as a value

Fixes: 278fd4fb0f
2018-07-04 14:01:53 +02:00
Beniamino Galvani
2ee76c88c1 merge: branch 'bg/ip-tunnel-gretap-bgo796645'
https://bugzilla.gnome.org/show_bug.cgi?id=796645
2018-07-02 20:39:47 +02:00
Beniamino Galvani
fc99aad378 ip-tunnel: allow wired setting for some tunnel modes
gretap and ip6gretap ip-tunnel interfaces encapsulate L2 packets over
IP. Allow adding a wired setting for such connections so that users
can change the interface MAC.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
3f9f9f7fa2 ip-tunnel: add support for ip6gre and ip6gretap tunnel connections 2018-07-02 17:55:14 +02:00
Beniamino Galvani
f9199c7fb5 ip-tunnel: add support for gretap tunnel connections 2018-07-02 17:55:14 +02:00
Beniamino Galvani
09a868a24e platform: add ip6gre/ip6gretap tunnels support
Add platform support for IP6GRE and IP6GRETAP tunnels. The former is a
virtual tunnel interface for GRE over IPv6 and the latter is the L2
variant.

The platform code internally reuses and extends the same structure
used by IPv6 tunnels.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
4c2862b958 platform: add gretap tunnels support
Add platform support for GRETAP tunnels (Virtual L2 tunnel interface
GRE over IPv4) partially reusing the existing GRE code.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
cdad8c6df9 platform: uniform logging for link-add functions
Print all the platform-lnk attributes in a consistent manner.
2018-07-02 17:55:14 +02:00
Beniamino Galvani
4b46c74af7 platform: fix printing macvtap links 2018-07-02 17:55:14 +02:00
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