Commit graph

19221 commits

Author SHA1 Message Date
Francesco Giudici
b6d2ad3312 device: enable DHCPv6 retries on lease renewal failure
https://bugzilla.gnome.org/show_bug.cgi?id=792745
(cherry picked from commit 1289450146)
2018-02-20 18:45:26 +01:00
Francesco Giudici
56353bfb82 device: never stop trying renewing the lease
Always reschedule a lease renewal attempt: just clear the scheduled
renewal if the connection is really deactivated.

(cherry picked from commit 1a20ff86d5)
2018-02-20 18:45:09 +01:00
Francesco Giudici
2d98ce9018 device: always consider both ip families when deciding to fail
Example: when dhcpv4 lease renewal fails, if ipv4.may-fail was "yes",
check also if we have a successful ipv6 conf: if not fail.
Previously we just ignored the other ip family status.

(cherry picked from commit da0fee4d9f)
2018-02-20 18:44:55 +01:00
Lubomir Rintel
19c22a13b2 core/connection: don't emit Updated on Connection.GetSecrets
The secrets are transient -- when they are loaded into the connections and
subsequently cleared the connection itself doesn't change. The Update
signal is to be emmited only on explicit Update()/Update2() or
ClearSecrets() which is already the case.

Apart from Update being wrong, it has the ill effect of causing libnm to
drop secrets from the cached connection.

(cherry picked from commit 66ae0cc306)
2018-02-20 17:04:13 +01:00
Beniamino Galvani
9479a014bc settings: preserve agent-owned secrets on connection update
After writing the connection to disk and rereading it, in addition to
restoring agent-owned secrets in the cache we must also restore
agent-owned secrets from the original connections since they are lost
during the write.

Reported-by: Märt Bakhoff <anon@sigil.red>

https://bugzilla.gnome.org/show_bug.cgi?id=793324
(cherry picked from commit f9c50bf3d3)
2018-02-15 10:16:49 +01:00
Lubomir Rintel
f71a1cfbd9 cli/polkit-agent: drop an extra newline
It looks bad and makes everyone super-sad:

  $ nmcli --ask c modify 'Oracle HQ' 802-11-wireless-security.psk solaris666
  System policy prevents modification of network settings for all users
  (action_id: org.freedesktop.NetworkManager.settings.modify.system)
  Password (lkundrak): *********

  $

(cherry picked from commit de9b74452c)
2018-02-13 15:14:36 +01:00
Lubomir Rintel
57b347e69b cli/connections: avoid using synchronous get_secrets()
With --ask it might call back to nmcli's agent, causing a deadlock
while the client is waiting for the response. Let's give the client
a chance to service the agent requests while waiting:

  $ nmcli --ask --show-secrets c show 'Oracle HQ'
  <hang>

This is probably still rather suboptimal and inefficient, since we
still serialize the calls and block on response. However, if we submit
multiple calls to GetSecrets, the daemon would start authorizing the
first one and fail the other ones immediately before the authorization
succeeds.

This could perhaps be addressed in the daemon, but let's settle for a
fix that's compatible with the current daemon for now.

(cherry picked from commit 9bf0b32cd1)
2018-02-13 15:14:35 +01:00
Lubomir Rintel
0d991026fe platform/test: drop the /sys/devices dance
The bridge test (and no other either) no longer sets sysfs properties,
so this whole madness is no longer needed. That is good, because Linux
got somewhat stricter (at least in 4.15) about mounting sysfs and the
whole thing wouldn't work with containers where /sys is red-only from
the start.

(cherry picked from commit 6788ced98d)
2018-02-13 11:53:55 +01:00
Lubomir Rintel
e7341d219b platform/netns: don't try to overlay ro /sys with a rw one
Linux 4.15 won't allow us. No problem.

(cherry picked from commit d7c70dd9ec)
2018-02-13 11:53:54 +01:00
Lubomir Rintel
04a6600a60 ppp/plugin: use g_strlcpy()
It's nicer but also doesn't annoy gcc 8: "error: ‘strncpy’ specified bound
depends on the length of the source argument [-Werror=stringop-overflow=]"

(cherry picked from commit 85c0dc4a92)
2018-02-13 11:53:54 +01:00
Lubomir Rintel
1ace7832c8 platform/tests: (trivial) fix a typo
(cherry picked from commit 7f847d71f3)
2018-02-13 11:53:53 +01:00
Lubomir Rintel
c3e6e752e6 platform/tests: disable tests touching sysctl when they're not writable
This is basically the case in the COPR build system where this
(mount -o bind,ro /proc/sys /proc/sys) is the case for reasons unknown.

(cherry picked from commit 984e9d5655)
2018-02-13 11:53:49 +01:00
Francesco Giudici
11f0ca1f23 nmcli: team: do strict checking on runner-tx-hashes
Substrings matching the heading of valid values were allowed if not
ambiguous (e.g.: "et" for "eth"). Moreover, upper case variants were
accepted too.
Do a plain string comparison check against the valid values.
Improve also the error message: give a list of valid tx-hashes.

(cherry picked from commit fd5b3f802e)
2018-02-12 12:16:10 +01:00
Francesco Giudici
01d1f64ad4 nmcli: team: clear runner-tx-hash before adding new hashes
https://bugzilla.redhat.com/show_bug.cgi?id=1541922
(cherry picked from commit 350dbb55ab)
2018-02-12 11:46:46 +01:00
Thomas Haller
36d767e6d5 contrib/rpm: make "snapshot" for package version configurable via script
Will be used by CI trigger to name packages that are build during testing
of a github pull request with the corresponding pull request ID.

"build_clean.sh" now supports a command line option -s|--snapshot. But the
same paramter can also be set via $NM_BUILD_SNAPSHOT environment
variable. Using the environment variable is useful to support older versions
and new versions of "build_clean.sh", so that the script can just ignore the
snapshot setting if it doesn't understand it yet.

(cherry picked from commit 86a18b2df2)
2018-02-09 17:39:38 +01:00
Beniamino Galvani
1c27ee350d dns: on quit only update resolv.conf if dns=dnsmasq
Previously we always updated resolv.conf on quit. When we are using
systemd-resolved the update is not necessary because the resolver on
127.0.0.53 would still be reachable after NM quits. Also, when NM
manages resolv.conf directly there is no need to update the file
again. Let's rewrite resolv.conf only when using dnsmasq.

https://bugzilla.redhat.com/show_bug.cgi?id=1541031
(cherry picked from commit 37eed6984b)
2018-02-09 13:19:53 +01:00
Philip Withnall
338b4e6b21 libnm-util: Fix a minor type problem with GValue
The code was passing the gpointer alias of the GValue, rather than the
GValue* itself. This doesn’t matter normally, but broke an experimental
patch in GLib to remove a cast from G_VALUE_TYPE.

We’ve reverted the patch in GLib (see
https://bugzilla.gnome.org/show_bug.cgi?id=793186), but this should be
fixed in NetworkManager anyway.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=793302
(cherry picked from commit daadb8fbe9)
2018-02-08 17:48:09 +01:00
Lubomir Rintel
88cea63dfa contrib/rpm: build verbosely
The RPM build should be not use silent output -- it better be possible
to check whether the correct compiler flags were present at the build
time.

(cherry picked from commit c4c8ffd113)
2018-02-08 17:47:42 +01:00
Beniamino Galvani
258f4fc769 ppp: don't start IPv6 configuration on the device
If IPV6CP terminates before IPCP, pppd enters the RUNNING phase and we
start IP configuration without having an IP interface set, which
triggers assertions. Instead, reimplement stage3_ip6_config_start to
be a no-op. Note that IPv6 configuration on PPP devices has never been
supported by NM.

This is a simpler version of upstream commit dd98ada33f ("ppp:
introduce SetIfindex pppd plugin D-Bus method") that doesn't require
changing the internal plugin API.

https://bugzilla.redhat.com/show_bug.cgi?id=1515829
2018-02-08 09:49:26 +01:00
Thomas Haller
167ca04f37 device: merge branch 'th/device-activation-fix-rh1537160'
I was unable to actually reproduce the crash from rh1537160. But
these fixes seem right either way and might even fix the bug.

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

(cherry picked from commit 665d47466a)
2018-02-07 12:56:33 +01:00
Thomas Haller
33cdfd8e0c device: gracefully handle unmanaged device during _device_activate()
(cherry picked from commit bbaa603a72)
2018-02-07 12:56:06 +01:00
Thomas Haller
26121eff14 device: don't return value from _device_activate()
It was only used at one place for an assertion. And it's not clear that the
assertion always holds.

(cherry picked from commit 9c094f93fb)
2018-02-07 12:54:53 +01:00
Thomas Haller
c7b1d4a2d3 device: clear priv->queued_act_request before setting state
Setting the state of NMActiveConnection results in invoking callbacks
in NMManager. Hence, it might be far-reaching. Clear
priv->queued_act_request before invoking the callbacks.

(cherry picked from commit ecf3677e57)
2018-02-07 12:54:53 +01:00
Thomas Haller
1be09bfbe3 device: minor cleanup unqueuing queued_act_request
Use gs_unref_object and g_steal_pointer() to move ownership around.

(cherry picked from commit edc4dd5167)
2018-02-07 12:54:53 +01:00
Thomas Haller
ff380c37bb core: transit to DISCONNECTING state for NMActiveConnection
Don't just directly switch to DISCONNECTED state. If we are ACTIVATING
or ACTIVATED, first transition to DISCONNECTING state.

(cherry picked from commit 6d623825f6)
2018-02-07 12:54:53 +01:00
Thomas Haller
5769d357c7 manager: use nm_active_connection_set_state_fail() instead of _internal_activation_failed()
There is a small change in behavior:

Previously, the DEACTIVATING/DEACTIVATED states were set if and only if
the previous state was less or equal then ACTIVATED. For example,
if the state was already DEACTIVATING, it would have done nothing.

Now, nm_active_connection_set_state_fail() transitions the states
depending on the previous state. E.g. it would only set DEACTIVATING
state, if the previous state was ACTIVATING/ACTIVATED. On the other hand,
it would always progress the state to DEACTIVATED.

The new behavior makes more sense to me, although I doubt that there is
a visible difference.

(cherry picked from commit c5a97ad265)
2018-02-07 12:54:53 +01:00
Thomas Haller
4b35d0c109 core: add nm_active_connection_set_state_fail() helper
(cherry picked from commit c027fc5d82)
2018-02-07 12:54:53 +01:00
Thomas Haller
e127a54ba6 manager: abort activation if the device is still unmanaged
unmanaged_to_disconnected() is supposed to mark the device as managed.
However, it may easily be unable to do so, for example if the device
is unmanaged by NM_UNMANAGED_USER_SETTINGS.

Shortly before actually enqueuing the activation request, check and
error out. Otherwise, we might hit an assertion later in
_device_activate().

(cherry picked from commit c6d0fbe7b0)
2018-02-07 12:54:53 +01:00
Thomas Haller
51a73e23e4 manager: reorder adding active-connection and queueing activation
Note how recheck_assume_connection() called:

    nm_exported_object_export (NM_EXPORTED_OBJECT (active));
    active_connection_add (self, active);
    nm_device_queue_activation (device, NM_ACT_REQUEST (active));

That differs from the order during _internal_activate_generic(), where
we would end up with:

    nm_exported_object_export (NM_EXPORTED_OBJECT (active));
    nm_device_queue_activation (device, NM_ACT_REQUEST (active));
    active_connection_add (self, active);

It makes more sense to me to *first* add the connection, and only then
starting the activation with nm_device_queue_activation().

Also, let active_connection_add() always export the new active
connection object, if it is not already exported. All callers of
active_connection_add() ensured that the new object is already
exported.

(cherry picked from commit 6b08d2dda2)
2018-02-07 12:54:52 +01:00
Thomas Haller
883698482f manager: refactor active_connection_parent_active() to return-early
Replace the if-else-if construct with "if(failure) return;". It reads nicer.

(cherry picked from commit 61380c0d87)
2018-02-07 12:54:52 +01:00
Thomas Haller
9da9f22fed manager: reorder conditions in unmanaged_to_disconnected() to check cheaper condition first
Getting nm_device_get_state() is cheap, contrary to nm_device_is_available().
Reorder the checks.

(cherry picked from commit 6075348f0f)
2018-02-07 12:54:52 +01:00
Thomas Haller
8c0f322892 core/trivial: add comment in set_property() for construct-only properties
(cherry picked from commit fc0430b1ab)
2018-02-07 12:54:52 +01:00
Thomas Haller
33d33be6af core/trivial: add FIXME comment about uncancellable async action
(cherry picked from commit 80b95f8b5f)
2018-02-07 12:54:52 +01:00
Thomas Haller
9c137d7e42 manager: use cleanup functions for impl_manager_activate_connection()
Also, drop two redundant g_assert(). If we proceed, we will very soon afterwards
hit a SEGFAULT or a g_return_val_if_fail(), which is just as good.

(cherry picked from commit 0df3837656)
2018-02-07 12:54:52 +01:00
Lubomir Rintel
9777492dde m4: disable -Wcast-function-type
This fixes the GCC 8 build. It disables the warning conditionally so that we
get the warning back if glib gets fixed.

(cherry picked from commit 631982a796)
2018-02-07 11:47:19 +01:00
Francesco Giudici
10760b100c libnm-core: team: add support to runner "random"
https://bugzilla.redhat.com/show_bug.cgi?id=1538699
(cherry picked from commit 31d9a9de14)
2018-02-06 12:45:18 +01:00
Thomas Haller
5159c34ea8 ovs: fix compiler error for passing NMDevice pointer to NM_DEVICE_OVS_INTERFACE_GET_PRIVATE()
NM_DEVICE_OVS_INTERFACE_GET_PRIVATE() is implemented via the _NM_GET_PRIVATE()
macro. This macro uses C11's _Generic() to provide additional compiler checks
when casting from an incompatible pointer type.

As such,

  NMDevice *device = ...;
  NMDeviceOvsInterfacePrivate *priv;

  priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);

causes a compilation error:

    error: ‘_Generic’ selector of type ‘NMDevice * {aka struct _NMDevice *}’ is not compatible with any association

One workaround would be to cast the pointer first:

  priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE ((NMDeviceOvsInterface *) device);

A better fix is to mark NMDevice as a compatible pointer in _NM_GET_PRIVATE(),
which this patch does.

Previously, this went unnoticed, because due to bug "a43bf3388 build: fix configure
check for CC support of _Generic() and __auto_type", we failed to detect support
for _Generic() when compiling with -Werror. That essentially disables this check,
and NM_DEVICE_OVS_INTERFACE_GET_PRIVATE() would do a direct cast.

A workaround for this build failure might be to build with -Werror, which accidentally
results in not using _Generic().

https://bugzilla.gnome.org/show_bug.cgi?id=793183

Fixes: 8ad310f8e3
(cherry picked from commit 782578122c)
2018-02-05 14:04:06 +01:00
Thomas Haller
640673f75b build: fix configure check for CC support of _Generic() and __auto_type
autotools' AC_LANG_PROGRAM() generates a main() function which triggers
a compiler warning (for which we fail with -WError).

    conftest.c:92:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
     main ()
     ^~~~
    cc1: all warnings being treated as errors

Fixes: 557d83bf2d
(cherry picked from commit a43bf33888)
2018-02-05 13:01:30 +01:00
Lubomir Rintel
2405959132 release: bump version to 1.10.5 (development) 2018-02-05 11:04:49 +01:00
Lubomir Rintel
f781411ceb release: bump version to 1.10.4 2018-02-05 11:03:52 +01:00
Lubomir Rintel
f32367d4c6 release: update NEWS 2018-02-05 10:58:33 +01:00
Lubomir Rintel
60eb596b0d ovs-interface: avoid starting ip[46] configuration more than once
OvsInterface can postpone the stage3_ip[46]_config until the link
actually appears. It ought to restart the stage only when the link
appears, not upon further changes to it (which would trip an assertion
when starting the DHCP client while one already exists).

https://bugzilla.redhat.com/show_bug.cgi?id=1540063
(cherry picked from commit 8ad310f8e3)
2018-02-05 10:58:33 +01:00
Piotr Drąg
f9f55afa18 po: update Polish (pl) translation (bgo #792436)
https://bugzilla.gnome.org/show_bug.cgi?id=792436
2018-02-04 16:28:28 +01:00
Thomas Haller
ec630dc256 libnm: cleanup include in "libnm-core/nm-json.c"
We already define _GNU_SOURCE in "config.h", depending
on configure checks.

Also, we always should first include "config.h" (which means
to first include "nm-default.h").

Also, we don't need the entire <link.h>, <dlfcn.h> suffices.

(cherry picked from commit 84576ce861)
2018-01-25 18:26:34 +01:00
Thomas Haller
5269978e37 libnm: add include guard to nm-json.h
(cherry picked from commit ee56c9250f)
2018-01-25 18:23:34 +01:00
Thomas Haller
0aa9273d33 libnm: fix spelling for NM_JAONSSON_C define
(cherry picked from commit 2888778480)
2018-01-25 18:23:07 +01:00
Thomas Haller
bbcb9ebefc libnm: rename "libnm-core/nm-jansson.h" to "libnm-core/nm-json.h"
We already have "shared/nm-utils/nm-jansson.h". Avoid reusing the same file name.

(cherry picked from commit b6b6baa773)
2018-01-25 18:23:01 +01:00
Thomas Haller
75dfbfcef4 libnm/trivial: don't use non-leading tabs
(cherry picked from commit 950a14128b)
2018-01-25 18:22:26 +01:00
Lubomir Rintel
66ae13f012 core: load jansson on demand
Avoid using it if the symbols clash is detected.

(cherry picked from commit cd476e4dc9)
2018-01-25 18:19:59 +01:00
Lubomir Rintel
2f991e379b nmcli: fix signal handling
Hook the signal handlers right before the main loop. Prior to that
the default handlers are good enough and our one crashes (due to
loop being instantialized).

Also, set the return value properly to indicate a termination by a
signal.

(cherry picked from commit edf6f826b5)
2018-01-24 09:55:18 +01:00