Commit Graph

21088 Commits

Author SHA1 Message Date
Beniamino Galvani
0683ad5db2 bond: fix crash in update_connection()
The value read from sysfs can be NULL.

Fixes: 2324410a75
2017-02-07 11:05:01 +01:00
Thomas Haller
029784b1cc build: merge branch 'th/build-warn-wextra' 2017-02-06 19:34:07 +01:00
Thomas Haller
4a72c121ed build: reorder flags in "m4/compiler_options.m4"
Mostly sort alphabetically, but
  - keep -Wextra first
  - move "-Wno-*" flags to the end
2017-02-06 19:27:21 +01:00
Thomas Haller
5120205f98 build: enable -Wextra warning 2017-02-06 19:27:21 +01:00
Thomas Haller
cb365b33f3 build: fix -Wold-style-declaration warnings
libnm-core/nm-setting-bond.c:502:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]
     const static struct {
     ^~~~~

    In file included from clients/cli/common.c:32:0:
    ./clients/common/nm-vpn-helpers.h:27:1: error: ‘typedef’ is not at beginning of declaration [-Werror=old-style-declaration]
     } typedef VpnPasswordName;
    ^
2017-02-06 19:27:21 +01:00
Thomas Haller
e68cc17f43 build: fix -Wignored-qualifiers warnings
./src/nm-config-data.h:163:1: error: 'const' type qualifier on return type has no effect [-Werror,-Wignored-qualifiers]
    const guint nm_config_data_get_connectivity_interval (const NMConfigData *config_data);
    ^~~~~~
2017-02-06 19:27:21 +01:00
Thomas Haller
1a190b9038 shared: fix -Wtype-limits warning in nm_glib_check_version() macro
Fix it by converting the macro to an inline function. It's anyway
nicer.

    $ make src/src_libNetworkManagerBase_la-main-utils.lo
      CC       src/src_libNetworkManagerBase_la-main-utils.lo
    In file included from ./shared/nm-utils/nm-macros-internal.h:29:0,
                     from ./shared/nm-default.h:178,
                     from src/main-utils.c:22:
    src/main-utils.c: In function ‘nm_main_utils_setup_signals’:
    ./shared/nm-utils/nm-glib.h:144:36: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
                  && glib_micro_version >= (micro))))
                                        ^
    src/main-utils.c:82:6: note: in expansion of macro ‘nm_glib_check_version’
      if (nm_glib_check_version (2, 36, 0)) {
          ^~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    Makefile:12312: recipe for target 'src/src_libNetworkManagerBase_la-main-utils.lo' failed
2017-02-06 19:27:21 +01:00
Thomas Haller
31c0c66c0e settings: drop redundant range check from NMSettingBridgePort::verify()
priv->path_cost and priv->priority can only be set as GObject properties,
which already does the same range check. Hence, the checks are never reached.

This also avoids a compiler warning:

    libnm-core/nm-setting-bridge-port.c: In function ‘verify’:
    libnm-core/nm-setting-bridge-port.c:132:22: error: comparison is always false due to limited range of data type [-Werror=type-limits]
      if (priv->path_cost > BR_MAX_PATH_COST) {
                          ^
2017-02-06 19:27:21 +01:00
Thomas Haller
77140cafe3 build: merge branch 'th/build-gcc7-warnings' 2017-02-06 17:41:29 +01:00
Thomas Haller
705e63a292 build: disable -Wformat-truncation warning
The warning seems questionable and overly strict.
For now, just disable it to allow building with gcc7.

    src/systemd/src/basic/time-util.c: In function ‘format_timespan’:
    src/systemd/src/basic/time-util.c:509:46: error: ‘%0*lu’ directive output between 1 and 2147483648 bytes may cause result to exceed ‘INT_MAX’ [-Werror=format-truncation=]
                                                  "%s"USEC_FMT".%0*"PRI_USEC"%s",
                                                  ^~~~
    src/systemd/src/basic/time-util.c:509:60: note: format string is defined here
                                                  "%s"USEC_FMT".%0*"PRI_USEC"%s",
    src/systemd/src/basic/time-util.c:509:46: note: directive argument in the range [0, 18446744073709551614]
                                                  "%s"USEC_FMT".%0*"PRI_USEC"%s",
                                                  ^~~~

https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00001.html
2017-02-06 16:53:37 +01:00
Thomas Haller
4b9cebd8ad build: enable -Wimplicit-fallthrough warning from gcc7 2017-02-06 16:45:20 +01:00
Thomas Haller
7c6c8f0d8b all: cleanup switch fall-through comments for -Wimplicit-fallthrough warning
The -Wimplicit-fallthrough=3 warning is quite flexible of accepting
a fall-through warning.

Some comments were missing or not detected correctly.

Thereby, also change all other comments to follow the exact
same pattern.
2017-02-06 16:45:20 +01:00
Thomas Haller
6bd9f5361f m4/compiler_options.m4: add line breaks for compiler options to check
No change in behavior.
2017-02-06 14:24:28 +01:00
Thomas Haller
1859b90c48 systemd: merge branch systemd into master 2017-02-06 13:45:51 +01:00
Thomas Haller
c2d0b9eec0 systemd: fix memleak in dhcp6_option_parse_domainname
https://github.com/systemd/systemd/pull/5114
419eaa8f8d
2017-02-06 13:44:45 +01:00
Thomas Haller
7cd2dfabec systemd: fix memleak in dhcp6_lease_set_domains
https://github.com/systemd/systemd/pull/5113
0b75a95ace
2017-02-06 13:42:14 +01:00
Thomas Haller
e52235a781 systemd: update code from upstream
This is a direct dump from systemd git on 2017-02-05, git commit
52e634271fe96ec23a22705ffb87df59a09d1618.

======

SYSTEMD_DIR=../systemd
COMMIT=52e634271fe96ec23a22705ffb87df59a09d1618

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.h"
nm_copy_sd "src/basic/extract-word.c"
nm_copy_sd "src/basic/extract-word.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/signal-util.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.c"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2017-02-06 13:12:07 +01:00
Thomas Haller
11bc3f191e all: use nm_utils_strv_find_first() from shared/nm-utils 2017-02-04 17:55:30 +01:00
Thomas Haller
a165907554 shared: add nm_utils_strv_find_first() helper
Make _nm_utils_strv_find_first() accessible outside of libnm-core
by copying it from "libnm-core/nm-core-internal.h" (and rename it).
2017-02-04 17:54:49 +01:00
Lubomir Rintel
6404c79e4d core: kill nm_spawn_process()
It's not used anymore. Which is a good thing, because if it was used
we'd have to get rid of the uses.

It did accept a whitespace separated string for an argument, which is
never useful for us; it indicated error either on g_spawn_sync()
failure or an error status code of the program spawned, but only set the
error in the former case which had let to errors.

The would would be a bit nicer place without it.
(But not much)
2017-02-03 18:53:40 +01:00
Lubomir Rintel
55a5bf580d dns-unbound: avoid using nm_spawn_process()
It doesn't improve anything and is the last user of said function.
2017-02-03 18:53:40 +01:00
Lubomir Rintel
46c534d7e9 dns-manager: get rid of the nm_spawn_process() use
There's no point in making our lives more complicated by concatenating
the argument into a string and then splitting it up again.
2017-02-03 18:53:39 +01:00
Lubomir Rintel
4e8eddd100 dns-manager: fix a NULL dereference in error handling
nm_spawn_process() only sets error if the g_spawn_sync() itself fails,
not when the program ran returns a non-zero code.

  <debug> [148  059915.1567] dns-mgr: update-dns: updating resolv.conf
  <info>  [148  059915.1568] dns-mgr: Removing DNS information from /usr/bin/resolvconf
  No resolv.conf for interface NetworkManager
  Thread 1 "NetworkManager" received signal SIGSEGV, Segmentation fault.
  0x0000555555  7c325 in nm_dns_manager_end_updates
  1532  _LOGW ("could not commit DNS changes: %s", error->message);
  (gdb) bt full
  #0  0x0000555555  7c325 in nm_dns_manager_end_updates
          error = 0x0
2017-02-03 18:53:24 +01:00
Mickaël Thomas
5216754b1e nm-online: fix countdown to not show 0 seconds until finished
When using nm-online -t N, the countdown shows "0s" during the last second.

The countdown value should be rounded up so that "0s" is only shown when the
timeout is actually elapsed.

https://bugzilla.gnome.org/show_bug.cgi?id=778093
2017-02-03 00:10:44 +01:00
Beniamino Galvani
660bb1a48f libnm-core: return NULL from _nm_utils_slist_to_strv for empty lists
The function is used, among others, in the get_property() of many
objects to return a boxed strv from a list. The default value for a
boxed strv property is NULL, but _nm_utils_slist_to_strv() returns a
pointer to an array with zero elements when the list is empty.

Change the function to return NULL if the input list is empty.
2017-02-02 13:45:27 +01:00
Thomas Haller
f7875a42b0 nm-online: refactor and fix nm-online
Moving nm-online to async init introduced various issues:
- with a timeout of zero, nm-online would terminate with failure
  before initializing the NMClient instance.
- add a timeout for safeguarding the async creation of NMClient
- fix adding trailing newline for the progress bar.

While at it, refactor:
- use defines for the exit codes
- don't use exit(), but instead always properly quit the mainloop
  and cleanup all resources.
- in non-quiet mode, print the result [online] or [offline] at
  the end.

Fixes: c5f17a97ea

https://bugzilla.gnome.org/show_bug.cgi?id=777914
2017-02-02 11:23:14 +01:00
Thomas Haller
34acecf544 nm-online: fix division-by-zero with zero timeout
$ nm-online -t 0
  Floating point exception (core dumped)

Fixes: c5f17a97ea

https://bugzilla.gnome.org/show_bug.cgi?id=777914
2017-01-31 00:12:48 +01:00
Lubomir Rintel
7399cf3b16 cli: add missing NULL-check
Only the connection down operation is cancellable, the other actions are not.

Fixes: 73b560c215
2017-01-29 12:56:31 +01:00
Lubomir Rintel
cc1491401f contrib/rpm: don't recreate files that make install installs 2017-01-29 12:28:55 +01:00
Lubomir Rintel
a1464f0cfa contrib/rpm: don't own the legacy VPN directory
The plugins should own it instead.
2017-01-29 12:28:55 +01:00
Lubomir Rintel
d9ebd31d40 build: install all necessary directories 2017-01-29 12:28:55 +01:00
Lubomir Rintel
b4e1d4794e build: don't install /run files
They're volatile and created during runtime.
2017-01-29 12:28:55 +01:00
Thomas Haller
cd267cceed build: add missing GLIB_CFLAGS for compiling adsl device plugin 2017-01-29 12:25:05 +01:00
Thomas Haller
7f63c875f9 libnm-core: clear wifi.mac-address-randomization when unsetting wifi.cloned-mac-address
When a client clears wifi.cloned-mac-address, he clearly also want
to clear the deprected wifi.mac-address-randomization property.

Do that automatically in libnm.

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00060.html
2017-01-28 17:17:14 +01:00
Thomas Haller
27cba47957 ifcfg-rh: fix interpreting missing MAC_ADDRESS_RANDOMIZATION as permanent address
With commit 4f6c91d696, we aimed to
enable mac-address-randomization by default for Wi-Fi. That however
is not possible by default because it breaks various scenarios.
Also, later wifi.mac-address-randomization was deprecated in favor
of wifi.cloned-mac-address setting.

Both wifi.mac-address-randomization and wifi.cloned-mac-address support
global default values, so it is wrong to read a missing
MAC_ADDRESS_RANDOMIZATION setting as "NEVER" -- which due to
normalization also results in cloned-mac-address=permanent.

See also commit 46d53e1101 which does
something similar for keyfile.

This bug also prevents a user from clearing the cloned-mac-address:

  $ nmcli connection show "$CONN"
  ...
  802-11-wireless.cloned-mac-address:        permanent
  802-11-wireless.mac-address-randomization: never
  ...
  $ nmcli connection modify "$CONN: wifi.cloned-mac-address ''
  # ^ takes no effect

As workaround, you also need to clear mac-address-randomization:

  $ nmcli connection modify "$CONN: wifi.cloned-mac-address '' \
          wifi.mac-address-randomization default

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00060.html
2017-01-28 16:04:32 +01:00
James McCoy
dbd365c3f9 nm-online: return from quit_if_connected after setting retval
c5f17a97ea changed nm-online to determine
the status asynchronously, however this introduced a regression with
"nm-online -x -q" when there is connectivity.

        if (   state == NM_STATE_CONNECTED_LOCAL
            || state == NM_STATE_CONNECTED_SITE
            || state == NM_STATE_CONNECTED_GLOBAL) {
            data->retval = 0;
            g_main_loop_quit (data->loop);
        }
    }
    if (data->exit_no_nm && (state != NM_STATE_CONNECTING)) {
        data->retval = 1;
        g_main_loop_quit (data->loop);
    }

After setting data->retval = 0 in the "state is connected" branch, the
function falls through to the "exit_no_nm and !connecting" branch,
overwriting data->retval.  This causes "nm-online -x -q" to incorrectly
report an offline state.

Adding an explicit "return;" after any state where data->retval is set
ensures that the value isn't overwritten before main() uses it.

Fixes: c5f17a97ea

https://mail.gnome.org/archives/networkmanager-list/2017-January/msg00058.html
2017-01-28 10:54:04 +01:00
Lubomir Rintel
73b560c215 cli: avoid use-after free on connection deletion
If the connection spontaneously disappears (perhaps along with the whole
daemon on crash) while we're deleting it, then the removal callback
would free up the context structure the delete operation is using.

Let's cancel the in-flight delete operations so that they won't touch
the structure after it's gone.
2017-01-27 13:33:28 +01:00
Lubomir Rintel
1db6b01b2f manager: avoid an extra path to ac translation
The ac might already be unexported which would lead to a crash.
In any case, it's just unnecessary.
2017-01-27 13:33:28 +01:00
Lubomir Rintel
59b497f0f0 manager: guard the flag setting by the actual device presence
The parent might be an active connection w/o the device being determined.
2017-01-27 13:33:28 +01:00
Thomas Haller
93b632a7fa release: bump version to 1.7.1-dev after 1.6.0 release
After 1.6.0 is released, merge it back into master so that
1.6.0 is part of the history of master. That means,
  $ git log --first-parent master
will also traverse 1.6.0 and 1.6-rc*.

Also bump the micro version to 1.7.1-dev to indicate that this is
after 1.6.0 is out.
2017-01-25 18:30:55 +01:00
Lubomir Rintel
2554a8736d release: bump version to 1.6.0 2017-01-25 18:18:09 +01:00
Piotr Drąg
034d75fb79 po: update Polish (pl) translation (bgo #777402)
https://bugzilla.gnome.org/show_bug.cgi?id=777402
(cherry picked from commit 2131e98511)
2017-01-25 18:18:09 +01:00
Piotr Drąg
2131e98511 po: update Polish (pl) translation (bgo #777402)
https://bugzilla.gnome.org/show_bug.cgi?id=777402
2017-01-25 17:49:47 +01:00
Thomas Haller
a101e0dc6a release: update NEWS 2017-01-25 17:38:43 +01:00
Thomas Haller
146f2c0bd1 device: track exported-object path for NMActRequest from device
The public property NM_DEVICE_ACTIVATION_REQUEST exposes the exported
D-Bus path. So, it's not sufficient to emit property changed signals
when changing the priv->act_request pointer, we must also react on
exporting/unexporting.

It's not clear whether this fixes an actual bug. Maybe, we never
export/unexport priv->act_request while the device tracks it.
But the code is pretty hard to follow and it's hard to verify
whether this is the case.
By hooking up to "notify::path", we can easily verify that such
a situtation cannot arise.

(cherry picked from commit 9ae5e6a54d)
2017-01-25 17:27:42 +01:00
Beniamino Galvani
91d0c036de build: libnm-wwan.so depends on linker script
(cherry picked from commit 8134d72f49)
2017-01-25 17:21:29 +01:00
Thomas Haller
1b38632d5d exported-object: fix adding get_property() function for "path" property
Fixes: e4e0daeed4
(cherry picked from commit aba850609b)
2017-01-25 17:19:16 +01:00
Thomas Haller
183d49f759 exported-object: add "path" GObject property to have notify signal
(cherry picked from commit e4e0daeed4)
2017-01-25 17:19:11 +01:00
Lubomir Rintel
cd8e8ab1ca manager: don't let a master device go unmanaged on a slave activation
If a slave device activates, we should keep the master up even though it
was taken over before.

This fixes an issue, where a single slave to a master would be
reactivated after a daemon restart. The daemon restart would cause the
master to be treated externally created (would go unmanaged when all the
slaves are gone) while the reactivation would leave the master without
slaves for a while.

(cherry picked from commit b605fb2712)
2017-01-25 17:18:24 +01:00
Lubomir Rintel
8b9f3055bf active-connection: unhook the settings connection removed signal on dispose
Fixes: f0e3dfdace
(cherry picked from commit f541cef958)
2017-01-25 17:17:45 +01:00