Commit graph

16730 commits

Author SHA1 Message Date
Thomas Haller
bbb827b4b3 build: enable -Wextra warning
(cherry picked from commit 5120205f98)
2017-02-06 19:42:43 +01:00
Thomas Haller
54584cb3ab 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;
    ^

(cherry picked from commit cb365b33f3)
2017-02-06 19:42:43 +01:00
Thomas Haller
edf6f0b600 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);
    ^~~~~~

(cherry picked from commit e68cc17f43)
2017-02-06 19:42:43 +01:00
Thomas Haller
cdf862f048 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

(cherry picked from commit 1a190b9038)
2017-02-06 19:42:43 +01:00
Thomas Haller
d6625d5111 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) {
                          ^

(cherry picked from commit 31c0c66c0e)
2017-02-06 19:42:43 +01:00
Thomas Haller
afa249e277 build: merge branch 'th/build-gcc7-warnings'
(cherry picked from commit 77140cafe3)
2017-02-06 18:04:31 +01:00
Thomas Haller
7c5a4c6842 build: enable -Wimplicit-fallthrough warning from gcc7
(cherry picked from commit 4b9cebd8ad)
2017-02-06 17:54:45 +01:00
Thomas Haller
23d9fbb858 systemd: backport fall-through comments for -Wimplicit-fallthrough warning 2017-02-06 17:54:45 +01:00
Thomas Haller
4603ce7ad0 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.

(cherry picked from commit 7c6c8f0d8b)
2017-02-06 17:54:45 +01:00
Thomas Haller
55852df7c8 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
(cherry picked from commit 705e63a292)
2017-02-06 17:54:45 +01:00
Thomas Haller
c453b46b9c m4/compiler_options.m4: add line breaks for compiler options to check
No change in behavior.

(cherry picked from commit 6bd9f5361f)
2017-02-06 17:43:09 +01:00
Thomas Haller
3a4c9676da systemd: fix memleak in dhcp6_option_parse_domainname
https://github.com/systemd/systemd/pull/5114
419eaa8f8d
(cherry picked from commit c2d0b9eec0)
2017-02-06 14:09:54 +01:00
Thomas Haller
d1fb96207e systemd: fix memleak in dhcp6_lease_set_domains
https://github.com/systemd/systemd/pull/5113
0b75a95ace
(cherry picked from commit 7cd2dfabec)
2017-02-06 14:09:53 +01:00
Mickaël Thomas
4f58ff5d37 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
(cherry picked from commit 5216754b1e)
2017-02-03 00:11:59 +01:00
Beniamino Galvani
05342d1178 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.

(cherry picked from commit 660bb1a48f)
2017-02-02 14:05:07 +01:00
Thomas Haller
45847ccee0 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
(cherry picked from commit f7875a42b0)
2017-02-02 11:24:43 +01:00
Thomas Haller
1125ed9eed 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
(cherry picked from commit 34acecf544)
2017-01-31 11:06:04 +01:00
Lubomir Rintel
5d22a96d1d cli: add missing NULL-check
Only the connection down operation is cancellable, the other actions are not.

Fixes: 73b560c215
(cherry picked from commit 7399cf3b16)
2017-01-29 14:22:45 +01:00
Lubomir Rintel
e0ed5a0c3f contrib/rpm: don't recreate files that make install installs
(cherry picked from commit cc1491401f)
2017-01-29 14:22:44 +01:00
Lubomir Rintel
9f6dfc0763 contrib/rpm: don't own the legacy VPN directory
The plugins should own it instead.

(cherry picked from commit a1464f0cfa)
2017-01-29 14:22:43 +01:00
Lubomir Rintel
2fa71901f5 build: install all necessary directories
(cherry picked from commit d9ebd31d40)
2017-01-29 14:22:43 +01:00
Lubomir Rintel
c8540ec75e build: don't install /run files
They're volatile and created during runtime.

(cherry picked from commit b4e1d4794e)
2017-01-29 14:22:42 +01:00
Thomas Haller
38cef9de7a build: add missing GLIB_CFLAGS for compiling adsl device plugin
(cherry picked from commit cd267cceed)
2017-01-29 12:25:16 +01:00
Thomas Haller
157b6d0ec4 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
(cherry picked from commit 7f63c875f9)
2017-01-28 17:19:33 +01:00
Thomas Haller
491ccd9d64 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
(cherry picked from commit 27cba47957)
2017-01-28 16:06:37 +01:00
James McCoy
6419d24620 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
(cherry picked from commit dbd365c3f9)
2017-01-28 10:54:54 +01:00
Lubomir Rintel
c758622f46 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.

(cherry picked from commit 73b560c215)
2017-01-27 13:34:16 +01:00
Lubomir Rintel
c1628a098b 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.

(cherry picked from commit 1db6b01b2f)
2017-01-27 13:34:16 +01:00
Lubomir Rintel
3a254dc6d7 manager: guard the flag setting by the actual device presence
The parent might be an active connection w/o the device being determined.

(cherry picked from commit 59b497f0f0)
2017-01-27 13:34:15 +01:00
Thomas Haller
0e7272b195 release: bump to 1.6.1 (development) 2017-01-25 18:27:17 +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
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
Thomas Haller
63d4764acf core: refactor parsing in match_device_s390_subchannels_parse()
Changes:

  - match_device_s390_subchannels_parse() should accept un-initialized
    arguments a,b,c, as they are striclty output arguments (without
    transfering ownership).
  - the output arguments should be set if (and only if) the function
    succeeds. That is, move assigning the output arguments to the end.
  - increase the BUFSIZE. It's unclear why choosing 10. Probably that
    was already sufficient as a subchannel looks like
    "0.0.f5f0,0.0.f5f1,0.0.f5f2". Still, increase it to be ample.
    If we want to restrict the parsing based on the lenght of the input,
    that should be done explicitly (but that seems not desirable).
  - use _nm_utils_ascii_str_to_int64() which checks that the range
    of the values fits in guint32.

It seems wrong that match_device_s390_subchannels_eval() only compares
the first of up to three subchannels. But leave it as is for now.

(cherry picked from commit 419151a19e)
2017-01-25 17:15:37 +01:00
Thomas Haller
78272be2ff core/tests: add test matching s390-subchannels device spec
(cherry picked from commit 0f7098b71b)
2017-01-25 17:15:37 +01:00
Lubomir Rintel
aa9e908c6a core: add missing initializers to match_data_s390_subchannels_eval()
match_device_s390_subchannels_parse() asserts that arguments point to
zeroes.

  1299     static gboolean
  1300     match_data_s390_subchannels_eval (const char *spec_str,
  1301                                       MatchDeviceData *match_data)
  1302     {
  >>>     CID 160923:  Uninitialized variables  (UNINIT)
  >>>     Declaring variable "c" without initializer.
  1303            guint32 a, b, c;

Fixes: b0aaff86b6
(cherry picked from commit 20328eaddf)
2017-01-25 17:15:36 +01:00
Thomas Haller
105d8a2447 device: fix setting minimal MTU to 1280 for IPv6
Fixes: 665e398022
(cherry picked from commit ec66135a40)
2017-01-24 16:38:21 +01:00
Thomas Haller
e56d308ba5 core: avoid unexporting active-connection that is not exported
For better or worse, nm_exported_object_unexport() asserts that the
object is currently exported.

It's not clear that an active connection at this place is always
exported.

Fixes: f0e3dfdace
(cherry picked from commit c8a649b3de)
2017-01-24 16:19:41 +01:00
Lubomir Rintel
db6e8b21e4 active-connection: drop off the bus when the settings connection disappears
The active connection has an immutable connection property, but is
cleaned asynchronously by the manager after its settings connection is
done. Fine, let's remove it from the bus first though, so that we don't
hang there with a dangling object path.

(cherry picked from commit f0e3dfdace)
2017-01-24 16:19:40 +01:00
Lubomir Rintel
701f79280f release: bump version to 1.5.91 (1.6-rc2) 2017-01-23 18:43:19 +01:00
Lubomir Rintel
57c084a611 NEWS: move the more important entries upwards 2017-01-23 18:42:55 +01:00
Thomas Haller
383d81e813 core: drop duplicate code searching for match in nm_match_spec_device()
When searching for "*", we still need to check for higher priority
"except:" matches. But don't duplicate the search loop and just
proceed with the regular searched.

It already has the "if (!except && match == NM_MATCH_SPEC_MATCH)" which
short-cuts the search.

(cherry picked from commit 9fff9f501a)
2017-01-23 09:44:14 +01:00
Thomas Haller
05d35647ec core: refactor nm_match_spec_device() to use match-data structure
Instead of passing on invdividual arguments for the match, create
a MatchDeviceData structure and pass it on.

This reduces the number of arguments and extending it later should
be easier. Also, lazily parse the hardware address as needed.

(cherry picked from commit b0aaff86b6)
2017-01-23 09:44:14 +01:00
Jiří Klimeš
283758dab3 cli: fix some TAB completions for nmcli -a con add
(cherry picked from commit 1cee85f556)
2017-01-21 21:32:31 +01:00