Commit graph

18875 commits

Author SHA1 Message Date
Thomas Haller
c449d9fe07 platform/tests: skip netns tests if we fail to create a new NMPNetns instance
nmp_netns_new () might fail with:
  netns: failed mount --make-rslave: Invalid argument

Skip the test in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=790214
(cherry picked from commit b20384fac7)
2017-11-17 12:38:26 +01:00
Thomas Haller
f4cd75d422 platform: preserve errno when creating netns fails
(cherry picked from commit 7a98ee78be)
2017-11-17 12:38:25 +01:00
Thomas Haller
9464fa0963 vpn: avoid coverity warning in print_vpn_config()
coverity thinks that @address4 might be NULL. Maybe it can. We
have an nm_assert(), but to be sure, check the value.

(cherry picked from commit 6df212ccb1)
2017-11-15 18:32:02 +01:00
Thomas Haller
2dcf08402c ifcfg-rh: avoid coverity false positive in write_secrets()
Comparing @secrets_keys indicates to coverity that it might be NULL.
Below, we access @secrets_keys without check, and coverity doesn't realize
that this cannot crash, because secrets_keys_n would be zero too.

Anyway, this way we safe the sorting, in case we only have
one element.

(cherry picked from commit cfdb962ebd)
2017-11-15 18:19:54 +01:00
Thomas Haller
ee77657727 clients: avoid crash in _complete_fcn_connection_master()
Found by coverity, but not a practical issue, because we
wouldn't actually call the function with text NULL.

(cherry picked from commit 8cb86d947c)
2017-11-15 18:13:34 +01:00
Thomas Haller
18e8f99eb3 valgrind: update glib2 suppression for Fedora 27
glib2 deprecated g_object_newv() for g_object_new_with_paramters()
in 2.52. Need to update the valgrind suppression.

(cherry picked from commit 3b85c7e05d)
2017-11-15 17:06:18 +01:00
Thomas Haller
39002a4e3c platform: fix double closing netlink socket
The file descriptor is owned by the netlink socket instance,
which we close in finalize. We most not close it when destroying
the IO channel, otherwise the file descriptor gets closed twice.

Closing an invalid file descriptor (or a descriptor that is already closed)
is a serious bug, because the integer values are re-used, so there is a race
that the close might affect an innocent file descriptor instead of just
failing with EBADF.

(cherry picked from commit 79482c9a9e)
2017-11-14 15:17:03 +01:00
Thomas Haller
fc2894508e all: use nm_close() instead of close()
(cherry picked from commit 5b29c2e5b9)
2017-11-14 15:17:02 +01:00
Thomas Haller
334846906e shared: always call close() from nm_close() wrapper
The nm_close() wrapper should behave exactly the same as calling
close() directly. This is well known, documented behavior.

The only addition on top of that, should be the nm_assert() to catch
double-closing.

Prevously, when passing a negative file descriptor, we wouldn't properly
set errno. Also, the call would not show up in strace, which it should
(at least, if libc's close actually makes the syscall).

I would argue, that passing a negative file descriptor is a bug already
and we should never do that. Maybe we should even assert non-negative
fds. I don't do that now, because I am not sufficiently confident.
Anyway, the change should have not practical effect, because we
shouldn't actually pass negative fds already.

(cherry picked from commit f4780f85ae)
2017-11-14 15:17:01 +01:00
Beniamino Galvani
8db2120979 core: allow slaves to autoactivate when master is available
When a master connection is deactivated by user, we set the
autoconnect-blocked reason 'user-request' for the connection and we
propagate the same reason to slaves. Doing so prevents the
autoactivation of slaves when the master is manually activated again,
because the only way to override the 'user-request' blocked reason is
through manual activation of slaves.

Instead what should happen is that the manual deactivation of a master
marks slaves as blocked for failed dependencies. When the master
becomes available again, slaves can autoactivate if the profile allows
it.

https://bugzilla.redhat.com/show_bug.cgi?id=1437598
(cherry picked from commit b31118cfd2)
2017-11-13 20:34:23 +01:00
Beniamino Galvani
200e714885 device: make nm_device_state_reason_to_str() public
(cherry picked from commit dcd7760eae)
2017-11-13 20:34:22 +01:00
Yuri Chornoivan
a859021815 po: update Ukrainian (uk) translation (bgo#790215)
https://bugzilla.gnome.org/show_bug.cgi?id=790215
(cherry picked from commit 1e02ee4dc0)
2017-11-13 14:43:59 +01:00
Thomas Haller
c2c1031a20 all: merge branch 'th/platform-routes-onlink-rh1428334'
https://bugzilla.redhat.com/show_bug.cgi?id=1428334

(cherry picked from commit d44a3eb80c)
2017-11-13 14:43:25 +01:00
Thomas Haller
648c580902 platform/tests: add test for onlink route attribute
(cherry picked from commit cb47ed0fcd)
2017-11-13 14:43:08 +01:00
Thomas Haller
4b890dead5 all: support route-attribute "onlink" for IPv4
Kernel doesn't support it for IPv6.

This is especially useful, if you combine static routes
with DHCP. In that case, you might want to get the device-route
to the gateway automatically, but add a static-route for it.

(cherry picked from commit 0ed49717ab)
2017-11-13 14:43:07 +01:00
Thomas Haller
b4c2219951 platform: consider RTNH_F_ONLINK onlink flag for IPv4 routes
The "onlink" flag for IPv4 routes is part of the route ID.
Consider it in nm_platform_ip4_route_cmp().

Also, allow configuring the flag when adding a route.

Note that for IPv6, the onlink flag is still ignored.
Pretty much like kernel does.

(cherry picked from commit 88a40f960c)
2017-11-13 14:43:07 +01:00
Thomas Haller
675bae5642 platform: track all rtm_flags for routes
(cherry picked from commit 81778f59f2)
2017-11-13 14:43:07 +01:00
Thomas Haller
f0bcf533f5 core: merge IPv4 and IPv6 version of _nm_ip_config_merge_route_attributes()
(cherry picked from commit 433d2f8659)
2017-11-13 14:43:07 +01:00
Thomas Haller
02b339f170 shared: add nm_ip_addr_set() helper
(cherry picked from commit a9d1f5e543)
2017-11-13 14:43:07 +01:00
Thomas Haller
cfe4d61a12 shared/trivial: move code
(cherry picked from commit 632e8ac885)
2017-11-13 14:43:07 +01:00
Thomas Haller
b3d3227c44 platform: add generic NM_PLATFORM_IP_ROUTE_CAST() macro
A cast macro, that does some static type checking (of the pointer).

(cherry picked from commit 8948dbe117)
2017-11-13 14:43:07 +01:00
Thomas Haller
6adeb5eb29 core: use NM_CONSTCAST() for NM_IP_CONFIG_CAST()
(cherry picked from commit d5c9c95e96)
2017-11-13 14:43:07 +01:00
Thomas Haller
d9c5f7c9fb build: detect compiler features _Generic() and __auto_type in configure script
There is still a fallback detection in "shared/nm-utils/nm-macros-internal.h",
so that VPN-plugins and applet don't need to bother about adding these
configure checks.

(cherry picked from commit 557d83bf2d)
2017-11-13 14:43:07 +01:00
Thomas Haller
5282469098 shared: propagate constness in _NM_GET_PRIVATE_PTR()
The _NM_GET_PRIVATE() macro already preserved and propagated
the constness of @self to the resulting private pointer.

_NM_GET_PRIVATE_PTR() didn't do that. Extend the macro,
to make that possible.

(cherry picked from commit bdfdabea51)
2017-11-13 14:43:07 +01:00
Thomas Haller
5d940b73fe shared: fix detection of _Generic() support
(cherry picked from commit 03efc9e2c9)
2017-11-13 14:43:07 +01:00
Thomas Haller
920f539d4c core: merge branch 'th/dns-ip-config-unify'
(cherry picked from commit a5b4850682)
2017-11-13 14:41:27 +01:00
Thomas Haller
384d557887 core: merge IPv4 and IPv6 implementations in NMDnsManager
(cherry picked from commit 54bcbb85d3)
2017-11-13 14:40:31 +01:00
Thomas Haller
5a9812f453 core: add NMIPConfig helpers
For now, hack some generic accessors to the NMIP4Config/NMIP6Config
type. Eventually, NMIP4Config and NMIP6Config should get merged in
one class.

(cherry picked from commit 9e25538ff5)
2017-11-13 14:40:31 +01:00
Thomas Haller
1356ba11e4 libnm: add internal helper function nm_utils_inet_ntop()
(cherry picked from commit ffcab3f653)
2017-11-13 14:40:31 +01:00
Francesco Giudici
dcdb1e5fd0 shared: trivial: add space before comment close
(cherry picked from commit 85cc5db7a4)
2017-11-13 14:37:37 +01:00
Thomas Haller
dd02e4bfce shared: make NM_CONSTCAST() macro variadic
We need to pass more alias-types. Instead of having numbered
versions, use variadic number of macro arguments.

Also, fix build failure with old compiler:

  In file included from src/nm-ip6-config.c:24:
  ./src/nm-ip6-config.h:44:29: error: controlling expression type 'typeof (ipconf_iter->current->obj)' (aka 'const void *const') not compatible with any generic association type
                  *out_address = has_next ? NMP_OBJECT_CAST_IP6_ADDRESS (ipconf_iter->current->obj) : NULL;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: b1810d7a68
(cherry picked from commit b339a2742a)
2017-11-13 14:37:30 +01:00
Thomas Haller
fda3458201 shared: rework _NM_GET_PRIVATE() to use _Generic()
_NM_GET_PRIVATE() used typeof() to propagate constness of the @self
pointer. However, that means, it could only be used with a self pointer
of the exact type. That means, you explicitly had to cast from (GObject *)
or from (void *).
The requirement is cumbersome, and often led us to either create @self
pointer we didn't need:

    NMDeviceVlan *self = NM_DEVICE_VLAN (device);
    NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (self);

or casting:

    NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE ((NMDevice *) device);

In both cases we forcefully cast the source variable, loosing help from
the compiler to detect a bug.

For "nm-linux-platform.c", instead we commonly have a pointer of type
NMPlatform. Hence, we always forcefully cast the type via _NM_GET_PRIVATE_VOID().

Rework the macro to use _Generic(). If compiler supports _Generic(), then we
will get all compile time checks as desired. If the compiler doesn't support
_Generic(), it will still work. You don't get the compile-time checking of course,
but you'd notice that something is wrong once you build with a suitable
compiler.

(cherry picked from commit b1810d7a68)
2017-11-13 14:37:21 +01:00
Thomas Haller
3c830ce5cf core: replace nm_dns_ip_config_data_get_dns_priority()
Add instead nm_ip_config_get_dns_priority(). If we want to treat NMIP4Config/NMIP6Config
generically, then the accessor should be right there.

(cherry picked from commit 6246364747)
2017-11-13 14:37:11 +01:00
Thomas Haller
a80b8a696e core: add generic opaque NMIPConfig type
One day, I hope to merge NMIP4Config and NMIP6Config implementations.
A small step, and a typesafe cast-macro.

(cherry picked from commit 10d38a950d)
2017-11-13 14:37:07 +01:00
Thomas Haller
dd4e8ef9dc policy: merge IPv4 and IPv6 implementation of update_ip_dns()
(cherry picked from commit 157932f7dd)
2017-11-13 14:37:03 +01:00
Thomas Haller
dbe2f20aba merge: core: fix build without connectivity check 2017-11-13 14:17:47 +01:00
Thomas Haller
ddc889ff6b release: bump version to 1.10.1 (development) 2017-11-13 13:58:18 +01:00
Beniamino Galvani
9b72cdb862 core: fix build without connectivity check
Fixes: 4dd30b784c

https://bugzilla.gnome.org/show_bug.cgi?id=790222
(cherry picked from commit a33baf8bf7)
2017-11-13 11:03:22 +01:00
Beniamino Galvani
1193fb1b08 release: bump version to 1.10.0 2017-11-10 16:15:23 +01:00
Beniamino Galvani
4fce1b90bf release: update NEWS 2017-11-10 16:15:23 +01:00
Beniamino Galvani
cc6c140f5e po: make update-po 2017-11-10 16:15:22 +01:00
Beniamino Galvani
6dc6b0f3d8 device: silent compiler warning
Fix the following warning:

 src/devices/nm-device.c: In function ‘activation_source_schedule’:
 src/devices/nm-device.c:4995:9: error: ‘source_func’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   new_id = g_idle_add (source_func, self);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit bdfa7d882e)
2017-11-10 16:15:22 +01:00
Beniamino Galvani
f8266cfde9 ofono: merge branch 'th/ofono-ip-config-fix'
Fixes for oFono support.
(cherry picked from commit f2ebf6dfef)
2017-11-10 15:25:29 +01:00
Thomas Haller
ef0977b7f0 ofono: refactor error handling in context_property_changed()
(cherry picked from commit 6781fad88f)
2017-11-10 15:22:32 +01:00
Thomas Haller
43987d8a60 ofono: fix creating IP config with proper ifindex of Interface
This was broken with the routing-rework. We need to determine
the ifindex on which the configuration applies.

(cherry picked from commit 52f0800987)
2017-11-10 15:22:31 +01:00
Thomas Haller
06e2d355f6 ofono: refactor error handling for missing Interface in context_property_changed()
(cherry picked from commit 481c15e287)
2017-11-10 15:22:30 +01:00
Thomas Haller
abbb62a813 ofono: fix leaks in context_property_changed()
(cherry picked from commit 99013e020b)
2017-11-10 15:22:28 +01:00
Beniamino Galvani
e4e6ed5b0a device: don't necessarily fail the connection when ipv4 DAD fails
Don't necessarily fail the entire connection if a duplicate IPv4
address is detected, but instead look at the may-fail property and at
the outcome of IPv6.

https://bugzilla.redhat.com/show_bug.cgi?id=1508001
(cherry picked from commit 14ad1d0cd1)
2017-11-09 22:30:27 +01:00
Beniamino Galvani
e25d6ad0d3 checkpoint: don't include unrealized devices
Don't include unrealized devices in checkpoint because, as the name
says, they are not real.

While at it, remove nm_manager_get_device_paths() as it is no longer
used.

(cherry picked from commit 974f21eca3)
2017-11-09 10:33:26 +01:00
Beniamino Galvani
de5de2d4ee checkpoint: specify path of already existing checkpoint on error
(cherry picked from commit 66d048023c)
2017-11-09 10:33:20 +01:00