Commit graph

20655 commits

Author SHA1 Message Date
Beniamino Galvani
2d4977eca0 ovs: fix dispose()
input and output must be freed only when not NULL.

Also, ovsdb_disconnect() should do nothing if there is no client.

Fixes: 830a5a14cb
(cherry picked from commit 29984c07cd)
(cherry picked from commit 583a2a2cee)
2020-01-15 13:27:32 +01:00
Beniamino Galvani
4d476fbf80 ovs: don't leak a GCancellable on connection failure
Every time we clear priv->client we should also clear the cancellable
or it will be leaked.

Fixes: 830a5a14cb
(cherry picked from commit b92f2c9323)
(cherry picked from commit 9d291821f2)
2020-01-15 13:27:32 +01:00
Beniamino Galvani
68daab633e ovs: fix leak of json objects
Fixes: 830a5a14cb
(cherry picked from commit 139b9974fa)
(cherry picked from commit 35c101011d)
2020-01-15 13:27:32 +01:00
Beniamino Galvani
836154dee3 merge: branch 'bg/ovs-restart-part2-rh1733709'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/216

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
(cherry picked from commit 5f668b81d3)
(cherry picked from commit 0581a53a46)
(cherry picked from commit e066ac5545)
(cherry picked from commit ba48493987)
(cherry picked from commit 05858995d1)
2019-08-01 10:45:32 +02:00
Beniamino Galvani
426ac8329d device: fix releasing slaves
Not all masters type have a platform link and so it's wrong to check
for it to decide whether the slave should be really released. Move the
check to master devices that need it (bond, bridge and team).

OVS ports don't need the check because they don't call to platform to
remove a slave.

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
(cherry picked from commit 57e3734b6c)
(cherry picked from commit ec1b5fb019)
(cherry picked from commit f6a90b899a)
(cherry picked from commit af2a126dc0)
(cherry picked from commit f568538904)
2019-08-01 10:45:10 +02:00
Beniamino Galvani
08f5f630be device: check platform link compatibility when setting nm-owned flag
We set nm-owned to indicate whether a software device was created by
NM or it was pre-existing. When checking the existence, we must verify
also whether the link type is compatible with the device, otherwise it
is possible to match unrelated interfaces. For example, when checking
for the existence of an ovs-bridge (which is not compatible with any
platform link) we could match a unrelated platform link with the same
name.

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
(cherry picked from commit 3cb4b36261)
(cherry picked from commit cb20d0791a)
(cherry picked from commit 511ef27d5e)
(cherry picked from commit 33309f7c9f)
(cherry picked from commit 1240565e48)
2019-08-01 10:44:06 +02:00
Beniamino Galvani
e4167a6c81 ovs: don't release slaves on quit
An OVS bridge and its slaves can continue to work even after NM has
quit. Keep the interface enslaved when the @configure argument of
device->release_slave() is FALSE, which happens on quit and in other
circumstances when we don't really want to release the slave from its
master.

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/215
(cherry picked from commit ccd4be4014)
(cherry picked from commit a1f39b69e0)
(cherry picked from commit f93018a41a)
(cherry picked from commit 647c054bce)
2019-08-01 10:43:57 +02:00
Thomas Haller
ecaf1acb76 platform/netlink: mark nested netlink attribute with NLA_F_NESTED
Kernel 5.2 is adding stricter checking for netlink messages.
In particular, for certain API it checks now that NLA_F_NESTED flag is
set for nested attributes ([1]).

Note that libnl3 does not ever set this flag, and since our netlink
implementation is copied from there, certain netlink messages are now
rejected as invalid.

On the other hand, libmnl always adds this flag ([2]). So we should do that
as well.

In particular, this affects the WireGuard netlink API causing request
from NetworkManager to be rejected ([3]).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b424e432e770d6dd572765459d5b6a96a19c5286
[2] https://git.netfilter.org/libmnl/tree/src/attr.c?id=5937dfcb0185f5cb9cf275992ea701ec4e619d9c#n535
[3] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/212

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/210
(cherry picked from commit 7811d1c187)
(cherry picked from commit 57048338ee)
(cherry picked from commit 52b52d2f7d)
(cherry picked from commit ef5c7dc0eb)
2019-07-23 14:47:21 +02:00
Marco Trevisan (Treviño)
35a31b7910 device: free temporary typename with iface variable
To create a disambiguated name for some Bluetooth devices we use its type name
with iface, however this value is allocated but never free'd when passed to
g_strdup_printf.

So use instead a temporary variable and free it once done.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/208

Fixes: 8bbda5cdff
(cherry picked from commit b621aba5c2)
(cherry picked from commit 64ed96fb5f)
(cherry picked from commit 6156720c0d)
(cherry picked from commit f66040cc16)
2019-07-22 08:32:48 +02:00
Thomas Haller
cacb80e567 device: fix reapplying changes to connection ID and UUID
4 properties are not really relevant for an already activated connection
or it makes not sense to change them. These are connection.id, connection.uuid,
connection.autoconnect and connection.stable-id.

For convenience, we allow to reapply these. This way, one can take
a different setting (e.g. with a different connection.id or
connection.uuid) and reapply them, but such changes are silently
ignored.

However this was done wrongly. Instead of reverting the change to the new
applied connection, we would change the input connection.

This is bad, for example with

  nmcli connection up uuid cb922f18-e99a-49c6-b200-1678b5070a82
  nmcli connection modify cb922f18-e99a-49c6-b200-1678b5070a82 con-name "bogus"
  nmcli device reapply eth0

the last re-apply would reset the settings-connection's connection ID to
what was before, while accepting the new name on the applied-connection
(while it should have been rejected).

Fixes: bf3b3d444c ('device: avoid changing immutable properties during reapply')

(cherry picked from commit adb51c2a7f)
(cherry picked from commit 09f37d5bd4)
(cherry picked from commit 9c72ca5ee9)
(cherry picked from commit b1209e37db)
2019-07-18 12:21:51 +02:00
Thomas Haller
ccd8afb4c1 core: fix mangling static IPv6 routes in nm_ip6_config_merge_setting()
https://bugzilla.redhat.com/show_bug.cgi?id=1727193

Fixes: 433d2f8659 ('core: merge IPv4 and IPv6 version of _nm_ip_config_merge_route_attributes()')
(cherry picked from commit a8fa015a4e)
(cherry picked from commit 44e4ed1e95)
(cherry picked from commit d3b7b0d286)
(cherry picked from commit 8f85b6a3af)
2019-07-09 14:36:23 +02:00
Patrick J. Volkerding
17709225ec hostname-manager: use fqdn for persistent hostname on Slackware
This will be the default for Slackware 15.0 and on.

This should be safe for both master and 1.12.x stable branch, as
no existing Slackware releases are expected to run NM-1.12.x or
later.

Signed-off-by: Robby Workman <rworkman@slackware.com>

https://mail.gnome.org/archives/networkmanager-list/2019-May/msg00011.html

(cherry picked from commit e1df17e0ac)
(cherry picked from commit 065e810424)
(cherry picked from commit 6160888e61)
(cherry picked from commit fb8d30a3dd)
2019-05-19 10:49:23 +02:00
Thomas Haller
2146307e1f core: fix file permissions for "/var/lib/NetworkManager/secret_key"
Ooherwise, the file has wrong permissions:

  # ls -la /var/lib/NetworkManager/secret_key
  ----r-xr-x. 1 root root 50 May 14 13:52 /var/lib/NetworkManager/secret_key

Luckily, /var/lib/NetworkManager should be already

  # ls -lad /var/lib/NetworkManager
  drwx------. 2 root root 8192 May 14 13:57 /var/lib/NetworkManager

which mitigates this a bit.

Fixes: dbcb1d6d97 ('core: let nm_utils_secret_key_read() handle failures internally')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/175
(cherry picked from commit dc3a2f9bc4)
(cherry picked from commit 2d46247c6a)
(cherry picked from commit 7a0f8520ff)
(cherry picked from commit 869ac551cf)
2019-05-14 14:06:47 +02:00
Thomas Haller
add6f1c236 settings/d-bus: fix boolean return value of "LoadConnections"
The boolean value is intended to indicate success. It would indicated
failure due to a bug.

Fixes: 297d4985ab ('core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API'):
(cherry picked from commit 22e830f046)
(cherry picked from commit e73a505866)
(cherry picked from commit 1337ebd9d0)
(cherry picked from commit 703864e2b3)
2019-05-10 15:41:41 +02:00
Thomas Haller
7a019089d4 settings: avoid assertion for LoadConnections D-Bus method with relative paths
$ busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Settings org.freedesktop.NetworkManager.Settings LoadConnections as 1 relative/filename

triggers a g_critical() assertion in nm_utils_file_is_in_path():

  ...
  #3  0x00007ffff7a19e7d in g_return_if_fail_warning
      (log_domain=log_domain@entry=0x55555586c333 "NetworkManager", pretty_function=pretty_function@entry=0x55555586c0a0 <__FUNCTION__.38585> "nm_utils_file_is_in_path", expression=expression@entry=0x55555586c010 "abs_filename && abs_filename[0] == '/'") at ../glib/gmessages.c:2767
  #4  0x00005555555f1128 in nm_utils_file_is_in_path (abs_filename=abs_filename@entry=0x555555b56670 "dfd", abs_path=<optimized out>) at src/NetworkManagerUtils.c:1077
  #5  0x00005555555a4779 in load_connection (config=<optimized out>, filename=0x555555b56670 "dfd") at src/settings/plugins/keyfile/nms-keyfile-plugin.c:522
  #6  0x00005555557ce291 in nm_settings_plugin_load_connection (self=0x5555559fd400 [NMSKeyfilePlugin], filename=0x555555b56670 "dfd") at src/settings/nm-settings-plugin.c:70
  #7  0x000055555559ccdf in impl_settings_load_connections
      (obj=<optimized out>, interface_info=<optimized out>, method_info=<optimized out>, connection=<optimized out>, sender=<optimized out>, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], parameters=<optimized out>) at src/settings/nm-settings.c:1439
  #8  0x00005555555a9bf9 in dbus_vtable_method_call
      (connection=0x5555559b91b0 [GDBusConnection], sender=sender@entry=0x555555b5c360 ":1.32283", object_path=object_path@entry=0x7fffe0019070 "/org/freedesktop/NetworkManager/Settings", interface_name=<optimized out>, interface_name@entry=0x7fffe002aa70 "org.freedesktop.NetworkManager.Settings", method_name=<optimized out>,
      method_name@entry=0x7fffe00276b0 "LoadConnections", parameters=parameters@entry=0x555555c4a690, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], user_data=0x5555559a1a00)
      at src/nm-dbus-manager.c:947
  #9  0x00007ffff7c506c4 in call_in_idle_cb (user_data=user_data@entry=0x7fffe0015ed0) at ../gio/gdbusconnection.c:4874
  #10 0x00007ffff7a0e8eb in g_idle_dispatch (source=source@entry=0x7fffe00208a0, callback=0x7ffff7c50590 <call_in_idle_cb>, user_data=0x7fffe0015ed0) at ../glib/gmain.c:5627
  #11 0x00007ffff7a11fd0 in g_main_dispatch (context=0x555555994d00) at ../glib/gmain.c:3189
  #12 0x00007ffff7a11fd0 in g_main_context_dispatch (context=context@entry=0x555555994d00) at ../glib/gmain.c:3854
  #13 0x00007ffff7a12368 in g_main_context_iterate (context=0x555555994d00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3927
  #14 0x00007ffff7a126b3 in g_main_loop_run (loop=0x555555995e60) at ../glib/gmain.c:4123
  #15 0x000055555558a741 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:444

Filter out relative filenames early.

(cherry picked from commit a1b102eae4)
(cherry picked from commit c21171e069)
(cherry picked from commit 8fe900d323)
(cherry picked from commit 6052b86304)
2019-05-10 15:12:40 +02:00
Thomas Haller
a62b377673 platform/tests: fix test-nmp-object when running on system without udev
Fix the test, to check that the nmp-object was deleted. It is
no longer visible and no longer alive.

(cherry picked from commit 581be6b8d2)
(cherry picked from commit 3505998ef7)
2019-04-18 10:18:40 +02:00
Beniamino Galvani
d939d00455 libnm: fix dns-configuration property type
Fixes: a8d6005256 ('libnm: implement support for DNS manager properties')

https://bugzilla.redhat.com/show_bug.cgi?id=1689055
(cherry picked from commit d867837d05)
(cherry picked from commit 47f1c931ee)
(cherry picked from commit 37586cada6)
2019-03-15 11:20:16 +01:00
Thomas Haller
b10a7e5786 shared/systemd: fix gettid() compat implementation shadowing function from glibc
On Fedora rawhide we get the following build failure:

    In file included from shared/systemd/src/basic/alloc-util.c:3:
    ./shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h:114:21: error: static declaration of 'gettid' follows non-static declaration
      114 | static inline pid_t gettid(void) {
          |                     ^~~~~~
    In file included from /usr/include/unistd.h:1170,
                     from /usr/include/glib-2.0/gio/gcredentials.h:32,
                     from /usr/include/glib-2.0/gio/gio.h:46,
                     from ./shared/nm-utils/nm-macros-internal.h:31,
                     from ./shared/nm-default.h:293,
                     from ./shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h:22,
                     from shared/systemd/src/basic/alloc-util.c:3:
    /usr/include/bits/unistd_ext.h:34:16: note: previous declaration of 'gettid' was here
       34 | extern __pid_t gettid (void) __THROW;
          |                ^~~~~~

glibc supports now gettid() call ([1]) which conflicts with our compat
implementation. Rename it.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92

(cherry picked from commit 10276322bd)
(cherry picked from commit cfb970b277)
(cherry picked from commit d160b7b990)
2019-03-11 19:12:43 +01:00
Marco Trevisan (Treviño)
0117156fdc nm: Fix syntax on introspection annotations
Various annotations were added using multiple colons, while only one has
to be added or g-ir-introspect will consider them part of the description

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/94
(cherry picked from commit 73005fcf5b)
(cherry picked from commit b5bbf8edc2)
(cherry picked from commit 3e24e328a6)
2019-03-07 10:13:57 +01:00
Beniamino Galvani
997302260f device: do ARP announcements only after masters have a slave
Delay ARP announcements for masters until the first interfaces gets
enslaved. There is no point in doing it before as the ARP packets
would be dropped in most cases; also, if the first slave is added when
we already started announcing, the MAC of the master is going to
change and so the remaining ARPs will have a wrong "sender mac
address" field.

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

https://github.com/NetworkManager/NetworkManager/pull/301
(cherry picked from commit 52f7e2d6d6)
2019-03-05 12:00:18 +01:00
Beniamino Galvani
a45ab9a3fb manager: ignore ovs-system master when assuming connections
This change allows NM to assume after a restart a device that has been
enslaved externally to an ovs bridge.

https://bugzilla.redhat.com/show_bug.cgi?id=1676551
(cherry picked from commit 93bbe43695)
(cherry picked from commit 526f1476db)
(cherry picked from commit 87c2a8339f)
2019-03-04 10:51:32 +01:00
Beniamino Galvani
2c2cbf89d4 core: merge branch 'bg/preserve-routes-down-rh1626004'
https://bugzilla.redhat.com/show_bug.cgi?id=1623740
https://bugzilla.redhat.com/show_bug.cgi?id=1626004

https://github.com/NetworkManager/NetworkManager/pull/210
(cherry picked from commit b1a6454b6c)
(cherry picked from commit 628c976f54)
2019-02-19 18:37:47 +01:00
Beniamino Galvani
4fc6f5f317 device: don't remove routes when the interface is down
In update update_ext_ip_config() we remove from various internal
configurations those addresses and routes that were removed externally
by users.

When the interface is brought down, the kernel automatically removes
routes associated with it and so we should not consider them as
"removed by users".

Instead, keep them so that they can be restored when the interface
comes up again.

(cherry picked from commit f069c98cc9)
(cherry picked from commit ce2d403530)
2019-02-19 18:37:18 +01:00
Beniamino Galvani
da46fcaffd ip-config: add @intersect_routes argument to intersect functions
In some cases we want to intersect two IP configurations without
considering routes.

(cherry picked from commit 8f07b3ac4f)
(cherry picked from commit bd79e67c55)
2019-02-19 18:37:15 +01:00
Beniamino Galvani
4775b1dff2 device: fix updating device information after link change
device_link_changed() can't use nm_device_update_from_platform_link()
to update the device private fields because the latter overwrites
priv->iface and priv->up, and so the checks below as:

  if (info.name[0] && strcmp (priv->iface, info.name) != 0) {

and:

  was_up = priv->up;
  priv->up = NM_FLAGS_HAS (info.n_ifi_flags, IFF_UP);
  ...
  if (priv->up && !was_up) {

never succeed.

Fixes: d7f7725ae8
(cherry picked from commit 46ed756112)
(cherry picked from commit 81aaf0ff93)
2019-02-19 18:37:13 +01:00
Beniamino Galvani
33aae9b8c4 core: improve nm_ip_config_dump()
Previously we had nm_ip{4,6}_config_dump() for debugging purposes, but
they were inconveniently printing to stdout and so the output was not
ordered in the journal.

Implement a unified nm_ip_config_dump() that logs through the usual
logging mechanism.

(cherry picked from commit 3b49d1075d)
(cherry picked from commit 0b1ffdbdb5)
2019-02-19 18:37:11 +01:00
Beniamino Galvani
c941b6fa10 device: ensure IP configuration is restored when link goes up
When the link is up and goes down link_changed_cb() schedules
device_link_changed() to be run later. If the function is dispatched
when the link is already up again, it does not detect that the link
was down.

Fix this by storing in the device state that we saw the link down so
that device_link_changed() can properly restore the IP configuration.

https://bugzilla.redhat.com/show_bug.cgi?id=1636715
https://github.com/NetworkManager/NetworkManager/pull/264
(cherry picked from commit 7bd193ef30)
(cherry picked from commit 710406e746)
2019-02-19 18:03:52 +01:00
Thomas Haller
4a49df33c6 libnm: fix leaking checkpoints from NMManager
Fixes: c3efedf54b
(cherry picked from commit 10600bdb69)
(cherry picked from commit 4c694e46ea)
2019-02-19 09:42:30 +01:00
Thomas Haller
be2da47a9d libnm: fix memleak for NMDeviceTun:hw-address
Fixes: 337304f19d
(cherry picked from commit 41ea9fffbb)
(cherry picked from commit 38890376fb)
2019-02-19 09:42:29 +01:00
Thomas Haller
3fb254fc82 libnm: fix duplicate free in nm_client_checkpoint_rollback()
#0  0x00007fffea7481e5 in _g_log_abort (breakpoint=1) at gmessages.c:554
    #1  0x00007fffea74951d in g_logv (log_domain=0x7fffea78e00e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffcbb0)
        at gmessages.c:1371
    #2  0x00007fffea7496f3 in g_log
        (log_domain=log_domain@entry=0x7fffea78e00e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fffea798320 "%s: assertion '%s' failed")
        at gmessages.c:1413
    #3  0x00007fffea749f2d in g_return_if_fail_warning
        (log_domain=log_domain@entry=0x7fffea78e00e "GLib", pretty_function=pretty_function@entry=0x7fffea799d40 <__func__.4759> "g_atomic_ref_count_dec", expression=expression@entry=0x7fffea799ca1 "g_atomic_int_get (arc) > 0") at gmessages.c:2762
    #4  0x00007fffea754c12 in g_atomic_ref_count_dec (arc=arc@entry=0x5555558c5280) at grefcount.c:260
    #5  0x00007fffea7302c6 in g_hash_table_unref (hash_table=0x5555558c5240) at ghash.c:1101
    #6  0x00007fffea4b6dbc in clear_op_res (simple=0x55555587ed90 [GSimpleAsyncResult]) at gsimpleasyncresult.c:248
    #7  0x00007fffea4b6dbc in g_simple_async_result_finalize (object=0x55555587ed90 [GSimpleAsyncResult]) at gsimpleasyncresult.c:268
    #8  0x00007fffea67b949 in g_object_unref (_object=<optimized out>) at gobject.c:3346
    #9  0x00007fffea67b949 in g_object_unref (_object=0x55555587ed90) at gobject.c:3238
    #10 0x00007fffe95dea2d in checkpoint_rollback_cb (object=<optimized out>, result=<optimized out>, user_data=0x55555587ed90) at libnm/nm-manager.c:1584
    #11 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5c80 [GTask]) at gtask.c:1148
    #12 0x00007fffea4cb196 in g_task_return (task=0x5555558b5c80 [GTask], type=<optimized out>) at gtask.c:1206
    #13 0x00007fffea5096bb in reply_cb (connection=<optimized out>, res=<optimized out>, user_data=0x5555558b5c80) at gdbusproxy.c:2596
    #14 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5d50 [GTask]) at gtask.c:1148
    #15 0x00007fffea4cb196 in g_task_return (task=0x5555558b5d50 [GTask], type=<optimized out>) at gtask.c:1206
    #16 0x00007fffea4fdd4a in g_dbus_connection_call_done (source=<optimized out>, result=0x5555558b5e20, user_data=0x5555558b5d50) at gdbusconnection.c:5715
    #17 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5e20 [GTask]) at gtask.c:1148
    #18 0x00007fffea4ca86d in complete_in_idle_cb (task=task@entry=0x5555558b5e20) at gtask.c:1162
    #19 0x00007fffea73e97b in g_idle_dispatch (source=0x7fffdc04eb90, callback=0x7fffea4ca860 <complete_in_idle_cb>, user_data=0x5555558b5e20) at gmain.c:5620
    #20 0x00007fffea74206d in g_main_dispatch (context=0x5555557c8410) at gmain.c:3182
    #21 0x00007fffea74206d in g_main_context_dispatch (context=context@entry=0x5555557c8410) at gmain.c:3847
    #22 0x00007fffea742438 in g_main_context_iterate (context=0x5555557c8410, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3920
    #23 0x00007fffea742762 in g_main_loop_run (loop=0x55555584ed00) at gmain.c:4116

Fixes: c3efedf54b
(cherry picked from commit 25a3825b51)
(cherry picked from commit a505ab423e)
2019-02-19 09:42:28 +01:00
Lubomir Rintel
58f7b55bde platform/linux: fix setting of IFA_ADDRESS without a peer
Since commit 9ecdba316 ('platform: create netlink messages directly
without libnl-route-3') we're unconditionally setting IFA_ADDRESS to
the peer address, even if there's no peer and it's all zeroes.

The kernel actually stopped caring somewhere around commit caeaba790
('ipv6: add support of peer address') in v3.10, but Ubuntu Touch likes
to run Android's v3.4 on some poorly supported hardware.

Fixes: 9ecdba316c

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/77
(cherry picked from commit ef6d461b7f)
(cherry picked from commit e2409b1888)
2019-02-05 07:16:12 +01:00
Beniamino Galvani
ef6ad04821 vpn: add route to vpn gw when parent has a default device route
When the parent device has a device default route (i.e. without
gateway) and we establish a VPN on top of it, 'ip route get' for the
VPN gateway returns a device route, which is the same result we get
for an unreachable VPN gateway. However it is necessary to add the
route to the gateway or otherwise it will possibly become unreachable
once the VPN gets activated.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/93
(cherry picked from commit 797eab2f6b)
(cherry picked from commit 6808cd48aa)
2019-02-04 11:12:51 +01:00
Beniamino Galvani
3cadc48aef clients: fix string list setter
Fixes: 5d3736ac65

https://bugzilla.redhat.com/show_bug.cgi?id=1671200
(cherry picked from commit a68b1827ec)
(cherry picked from commit bc83a5035b)
2019-01-31 09:38:58 +01:00
Beniamino Galvani
bf4e97921d supplicant: don't set PMF when the supplicant doesn't support it
When the supplicant does not support PMF we wrongly set
'ieee80211w=0', but since the option is not recognized the connection
fails. Don't set it when unsupported.

Fixes: a9ab50efb1
(cherry picked from commit 58c4cd9cc9)
(cherry picked from commit 542e340f01)
2019-01-17 11:07:44 +01:00
Thomas Haller
691d5273f1 contrib/rpm: don't depend NetworkManager-ovs package on openvswitch on RHEL
On RHEL, openvswitch package is not in the base set of packages. Hence,
we cannot depend NetworkManager-ovs package on openvswitch.

This isn't really a problem, because NetworkManager's OVS plugin must
anyway behave graceful when openvswich service is not running or not
available. It only means, that a user who wants to use the OVS plugin
needs to explicitly install the openvswitch package.

https://bugzilla.redhat.com/show_bug.cgi?id=1629178
https://bugzilla.redhat.com/show_bug.cgi?id=1633190
(cherry picked from commit 669bd33022)
(cherry picked from commit f92d2d7766)
2019-01-16 09:59:28 +01:00
Beniamino Galvani
e511f72458 supplicant: fix ready_count assignment
Fix a wrong backport.

Fixes: 1110e0bcae
(cherry picked from commit d0dd120ab4)
2019-01-14 15:19:23 +01:00
Beniamino Galvani
40adc98a6d supplicant: set optional PMF using global supplicant property
wpa_supplicant is going to change the global default for PMF from 0
(disabled) to 1 (optional) [1], so NM code needs to be adjusted to
work with all wpa_supplicant versions. Furthermore, it is better to
set optional PMF using the 'Pmf' property instead of the 'ieee80211w'
configuration option because the former better handles missing support
in driver [2].

Note that each interface in wpa_supplicant has its own copy of global
configuration and so 'global' options must still be set on each
interface. So, let's set Pmf=1 when each interface gets created and
override it with ieee80211w={0,2} if needed during association.

[1] http://lists.infradead.org/pipermail/hostap/2018-November/039009.html
[2] http://lists.infradead.org/pipermail/hostap/2019-January/039215.html

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/104
(cherry picked from commit a9ab50efb1)
(cherry picked from commit 1110e0bcae)
2019-01-14 14:01:04 +01:00
Beniamino Galvani
09d8eca1c2 cli: fix cleanup after activation from editor
progress_activation_editor_cb() is called multiple times every 120
milliseconds and it must free resources only the last time.

Fixes: f0a2686545

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/51
(cherry picked from commit d091cbdc2f)
(cherry picked from commit fd3658e25f)
2019-01-02 08:57:00 +01:00
Beniamino Galvani
5420456cf1 settings: apply agent-owned secrets from the new connection on update
When updating a connection passing agent-owned secret, they are lost
from @reread_connection after the settings-plugin persists the
connection. Therefore we need to cache and reapply them separately to
the connection so that they can be saved to secret agents later.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/82
(cherry picked from commit a3383726dc)
(cherry picked from commit 95d9fd387b)
2018-12-13 11:31:11 +01:00
Thomas Haller
18103b00d8 connectivity: fix determining the global connectivity state
Since we determine the connectivity state of each device individually,
the global connectivity state is an aggregate of all these states.

I am not sure about considering here devices that don't have the (best)
default route for their respective address family. But anyway.

When we aggregate the best connectivity, we chose the numerical largest
value. That is wrong, because PORTAL is numerically smaller than
LIMITED.

That means, if you have two devices, one with connectivity LIMITED and
one with connectivity PORTAL, then LIMITED wrongly wins.

Fixes: 6b7e9f9b22

https://bugzilla.redhat.com/show_bug.cgi?id=1619873
(cherry picked from commit ade753d06f)
(cherry picked from commit d1e98e334d)
2018-12-11 11:10:15 +01:00
Thomas Haller
c155f776fd libnm: add nm_connectivity_state_cmp() helper
(cherry picked from commit 487ee687d5)
(cherry picked from commit 51b7b10d3d)
2018-12-11 11:10:15 +01:00
Beniamino Galvani
0624814af1 device: always take device down when changing MAC for wifi devices
If the device is not taken down wpa_supplicant does not detect that
the MAC changed and the authentication can fail due to wrong key
derivation.

Fixes: e206a34732

https://bugzilla.redhat.com/show_bug.cgi?id=1656157
(cherry picked from commit 29e8f6d5a1)
(cherry picked from commit b2686110ef)
2018-12-10 13:47:55 +01:00
Beniamino Galvani
f0890cc83f man: add missing connection defaults
(cherry picked from commit a482b27593)
(cherry picked from commit 9135603c93)
2018-12-01 15:31:50 +01:00
Beniamino Galvani
a3546bb28d device: fix wrong connection default property
Fixes: 96cabbcbb8
(cherry picked from commit 218d7687a0)
(cherry picked from commit 70cbda40cb)
2018-12-01 15:31:35 +01:00
Thomas Haller
a47c3b2e24 release: bump version to 1.12.7 (development) 2018-12-01 08:18:00 +01:00
Thomas Haller
913feaed77 release: bump version to 1.12.6 2018-12-01 08:16:54 +01:00
Thomas Haller
8640180a3a release: update NEWS 2018-11-30 17:15:48 +01:00
Thomas Haller
cb46754f24 gitignore: ignore directories added in newer versions
These directories don't exist yet, however are added by newer versions.
When switching branches, the artifacts from these directories wrongly
show up in `git status`. Ignore them.
2018-11-30 17:15:48 +01:00
Thomas Haller
f009f1681e cli: minor cleanup of _set_fcn_gobject_enum()
No need to check again the gtype_class. We did it above already.

(cherry picked from commit 085105fc0e)
(cherry picked from commit 3b782ece71)
2018-11-30 16:56:17 +01:00
Thomas Haller
828a3135aa cli: fix setting "serial.parity" enum
The meta data type descriptor must set .get_gtype only for
GObject properties which are of type int or uint. That is, when
the enum type cannot be automatically detected.

However, NM_SETTING_SERIAL_PARITY is a g_param_spec_enum()
of type NM_TYPE_SETTING_SERIAL_PARITY, so setting the get_gtype()
hook is wrong and leads to a crash

   $ /bin/nmcli connection add type gsm autoconnect no con-name t ifname '*' apn xyz serial.parity 5

   (process:11086): libnmc-CRITICAL **: 15:04:35.180: file clients/common/nm-meta-setting-desc.c: line 1283 (_set_fcn_gobject_enum): should not be reached
   Segmentation fault (core dumped)

That is because the enum property setter does:

    »···if (   has_gtype
    »···    && NM_IN_SET (gtype_prop,
    »···                  G_TYPE_INT,
    »···                  G_TYPE_UINT)
    »···    && G_TYPE_IS_CLASSED (gtype)
    »···    && (gtype_class = g_type_class_ref (gtype))
    »···    && (   (is_flags = G_IS_FLAGS_CLASS (gtype_class))
    »···        || G_IS_ENUM_CLASS (gtype_class))) {
    »···»···/* valid */

meaning, it only allows "has_gtype" if the native "gtype_prop" is
G_TYPE_INT or G_TYPE_UINT.

Fixes: 9a68123827
(cherry picked from commit 127ac25ef8)
(cherry picked from commit 7c78398d3e)
2018-11-30 16:56:13 +01:00