Commit graph

19189 commits

Author SHA1 Message Date
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
Lubomir Rintel
3b7211a096 nmcli/agent: fix handling of polkit agent failure
On "nmcli agent all", when the polkit agent fails (while the NM agent
succeeds), the failure is not communicated until the client exits.

(cherry picked from commit 7e8a84ae10)
2018-01-24 09:55:18 +01:00
Lubomir Rintel
356f1131f3 shared/utils: don't warn of unknown warning disables with clang
When pushing a warning disable with clang, always disable
-Wunknown-warning-option first -- it might be that clang wouldn't warn
of what we're trying to disable because it doesn't recognize it in the
first place. That is entierely okay.

With clang-5.0.0:

    CC       libnm/tests/libnm_tests_test_secret_agent-test-secret-agent.o
  In file included from libnm/tests/test-secret-agent.c:29:
  In file included from ./shared/nm-test-libnm-utils.h:23:
  ./shared/nm-utils/nm-test-utils.h:432:3: error: unknown warning group '-Wunused-but-set-variable', ignored [-Werror,-Wunknown-warning-option]
                  NM_PRAGMA_WARNING_DISABLE("-Wunused-but-set-variable")
                  ^
  ./shared/nm-utils/nm-macros-internal.h:223:9: note: expanded from macro 'NM_PRAGMA_WARNING_DISABLE'
          _Pragma(_NM_PRAGMA_WARNING_DO(warning))
          ^
  <scratch space>:204:25: note: expanded from here
   GCC diagnostic ignored "-Wunused-but-set-variable"
                          ^
  1 error generated.

(cherry picked from commit fc4552d391)
2018-01-24 09:55:18 +01:00
Francesco Giudici
e3affd7fd5 cli: merge branch 'fg/team_link_watchers_overwrite-rh1533926'
https://bugzilla.redhat.com/show_bug.cgi?id=1533926

(cherry picked from commit 72bf38cad6)
2018-01-22 19:34:07 +01:00
Francesco Giudici
4f76b01f10 doc: fix describe message for team link watchers
(cherry picked from commit d7f3c79881)
2018-01-22 19:31:29 +01:00
Francesco Giudici
97d153d9e3 nmcli: clear link-watchers before adding the new ones we want to set
(cherry picked from commit ff16252a71)
2018-01-22 19:31:04 +01:00
Francesco Giudici
fa3efd3ed6 libnm-core: ensure alignment of team.config and other team properties
https://bugzilla.redhat.com/show_bug.cgi?id=1533830
(cherry picked from commit 381c1a19b6)
2018-01-22 19:18:32 +01:00
Beniamino Galvani
a169247b7d device: skip IP configuration phase for external devices
We already avoid committing the IP configuration for external devices
(see commit 60334a2893). However, we still start DHCP/IPv6-autoconf
and, especially, we change sysctl values of the device.

To be sure that no action is taken on the device, return early from
the IP configuration phase, as in the method=disabled/ignore case.

https://bugzilla.redhat.com/show_bug.cgi?id=1530288
(cherry picked from commit 22f32a16f5)
2018-01-19 14:14:30 +01:00
Francesco Giudici
ba7c7c8402 team: merge branch 'fg/team_sys_prio_default-rh1533810'
https://bugzilla.redhat.com/show_bug.cgi?id=1533810

(cherry picked from commit 345d34b369)
2018-01-18 18:50:27 +01:00
Francesco Giudici
c34cd5e09a libnm-core: team: fix runner sys_prio default value
(cherry picked from commit 2c99eba42f)
2018-01-18 18:49:42 +01:00
Francesco Giudici
f219090fdd cli: get team defaults from setting header files
this allows centralizing default values definition and allows quicker
and safer update of default values.

(cherry picked from commit c6448f724b)
2018-01-18 18:49:28 +01:00
Beniamino Galvani
3c60d63540 device: increase carrier wait time to 6 seconds
Some NICs need longer to establish the link, increase the timeout from
5 to 6 seconds.

https://bugzilla.redhat.com/show_bug.cgi?id=1520826
(cherry picked from commit 156344b8be)
2018-01-18 15:29:24 +01:00
Lubomir Rintel
c778d9a252 ifcfg: don't forget master of ovs interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=1519179
(cherry picked from commit 1440fe6a88)
2018-01-18 13:31:30 +01:00
Pavel Šimerda
a30b2fcd84 libnm: fix empty statements that were supposed to return NULL
Discovered thanks to `-Wunused-value` when building on openSUSE Leap 42.3.

(cherry picked from commit c4f655579c)
2018-01-17 19:21:10 +01:00
Lubomir Rintel
7ea865ef49 rpm: disable libnm-glib for Fedora 29 and RHEL 8
While at it, move the API documentation to libnm-devel.
There doesn't seem to be a better place for it.

(cherry picked from commit 8ba46ff4c6)
2018-01-16 17:26:15 +01:00
Lubomir Rintel
59e8eed447 build: don't install NetworkManager.pc when libnm-glib is disabled
(cherry picked from commit bfff3ecfb0)
2018-01-16 17:26:12 +01:00
Thomas Haller
c17315d555 platform: fix wrong cleanup function in ip_route_get()
Fixes: 33a2a7c3e3
(cherry picked from commit 3de3f59ffd)
2018-01-15 20:33:47 +01:00
Thomas Haller
55845e84da libnm/vpn: unexport and destroy D-Bus glue instance with NMVpnServicePlugin
Otherwise, we might still be called back with D-Bus requests, after
the NMVpnServicePlugin instance is already destroyed.

(cherry picked from commit 929f36c56f)
2018-01-15 14:45:02 +01:00
Francesco Giudici
bcababf612 libnm-core: docs update requires also settings-docs.c.in update
Fixes: c6e1b3abc0
2018-01-12 15:20:23 +01:00
Francesco Giudici
c6e1b3abc0 libnm-core: update team.runner description
https://bugzilla.redhat.com/show_bug.cgi?id=1533799
(cherry picked from commit 112f8bd5af)
2018-01-12 14:25:29 +01:00
Lubomir Rintel
78ef571972 secret-agent: construct the dbus proxy for async agent with the correct bus name
The asynchronous secret agent initialization doesn't work at all due to a
rather silly typo. Oops.

While at it, fix a whitespace error too.

(cherry picked from commit 603daa5b25)
2018-01-11 11:53:01 +01:00
Thomas Haller
8998ce629d dhcp: fix check for client-id in _set_client_id()
Fixes: 686afe531a
(cherry picked from commit 0e1fb1dbd2)
2018-01-09 15:56:20 +01:00
Lubomir Rintel
ccd98ba214 platform-linux: reload qdiscs and tfilters after removing them
Kernel (as of 4.14) merely ACKs our RTM_DELQDISC and RTM_DELTFILTER, not
bothering to signal the full RTM_DEL* message unless the removal is
external to NetworkManager.

https://bugzilla.redhat.com/show_bug.cgi?id=1527197
(cherry picked from commit f3b4053a91)
2018-01-08 17:51:54 +01:00
Thomas Haller
41a89aeeba dhcp: cleanup handling of ipv4.dhcp-client-id and avoid assertion failure
The internal client asserts that the length of the client ID is not more
than MAX_CLIENT_ID_LEN. Avoid that assert by truncating the string.

Also add new nm_dhcp_client_set_client_id_*() setters, that either
set the ID based on a string (in our common dhclient specific
format), or based on the binary data (as obtained from systemd client).

Also, add checks and assertions that the client ID which is
set via nm_dhcp_client_set_client_id() is always of length
of at least 2 (as required by rfc2132, section-9.14).

(cherry picked from commit 686afe531a)
2018-01-04 18:53:34 +01:00
Beniamino Galvani
207eb3266f all: add more meaningful error code for unsupported IP method
Add a new device state reason code for unsupported IP method. It is
returned, for example, when users select manual IP configuration for
WWAN connections:

 # nmcli connection mod Gsm ipv4.method manual ipv4.address 1.2.3.4/32
 # nmcli connection up Gsm
 Error: Connection activation failed: The selected IP method is not
 supported

compared to the old:

 Error: Connection activation failed: IP configuration could not be
 reserved (no available address, timeout, etc.)

Note that we could instead fail the connection validation if the
method is not supported by the connection type, but adding such
limitation now could make existing connections invalid.

https://bugzilla.redhat.com/show_bug.cgi?id=1459529
(cherry picked from commit aa820e9386)
2017-12-21 10:07:12 +01:00
Beniamino Galvani
8a570a41cf device: add a new state-reason for DAD failures
(cherry picked from commit 12a49cbdc7)
2017-12-21 10:07:07 +01:00
Beniamino Galvani
b86df65bba wwan: merge branch 'bg/modem-default-route-rh1527934'
https://bugzilla.redhat.com/show_bug.cgi?id=1527934
(cherry picked from commit e7968b0048)
2017-12-21 09:45:43 +01:00
Beniamino Galvani
4ca7e3d0cf wwan: clear idle source id when the callback runs
Fixes: f0996d0eb8
(cherry picked from commit 5d372fd30e)
2017-12-21 09:45:01 +01:00
Beniamino Galvani
d9512bc807 wwan: add default route even if modem didn't return a gateway
If the modem didn't return a gateway, add a device route.

Fixes: 5c299454b4
(cherry picked from commit ec32edb21f)
2017-12-21 09:45:00 +01:00
Beniamino Galvani
f4dc5bd782 wwan: fix checks on IP configuration
Don't call nm_utils_parse_inaddr_bin() if the string returned by
mm_bearer_ip_config_get_address() and mm_bearer_ip_config_get_gateway()
is NULL, as the function requires a valid pointer. Throw an error if the
address is NULL, but allow an empty gateway.

Fixes: 7837afe87f
(cherry picked from commit 8ddc6caf98)
2017-12-21 09:44:59 +01:00
Beniamino Galvani
b1b463d0dc settings: clear unsaved flag on new settings-connection
When a new settings-connection is populated with the actual settings
read from disk by the plugin, calling nm_settings_connection_update()
with KEEP mode also marks it as unsaved, which should not happen on a
new connection just written to (or read from) disk.

Introduce a new KEEP_SAVED persist mode that is similar to KEEP but
clears the UNSAVED flag.

Fixes: 023ce50d21

https://bugzilla.redhat.com/show_bug.cgi?id=1525078
(cherry picked from commit 5fff928a6b)
2017-12-20 15:40:05 +01:00
Thomas Haller
fa53c715d1 core: persist aspired default route-metric in device's state file
NMManager tries to assign unique route-metrics in an increasing manner
so that the device which activates first keeps to have the best routes.

This information is also persisted in the device's state file, however
we not only need to persist the effective route-metric which was
eventually chosen by NMManager, but also the aspired metric.

The reason is that when a metric is chosen for a device, the entire
range between aspired and effective route-metric is reserved for that
device. We must remember the entire range so that after restart the
entire range is still considered to be in use.

Fixes: 6a32c64d8f
(cherry picked from commit 4277bc0ee0)
2017-12-20 14:26:30 +01:00
Thomas Haller
782b85bf13 settings: drop unused define for HOSTNAME_FILE
Fixes: 5bfb7c3c89
(cherry picked from commit 7deb3b4fb5)
2017-12-20 14:26:30 +01:00