Commit graph

16767 commits

Author SHA1 Message Date
Thomas Haller
8d18e13ace build: fix out-of-tree build generating "man/common.ent"
Fixes: 4de6f603e3
(cherry picked from commit 03efe8dba7)
2017-02-15 23:29:55 +01:00
Thomas Haller
d5b98617ad build: use sed instead of AC_SUBST() to generate man/common.ent
Otherwise, substitions are not properly expanded.

For example

- "AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state directory])"
  gives ${runstatedir}/NetworkManager/resolv.conf

- "AC_SUBST(nmrundir, "${runstatedir}/$PACKAGE", [NetworkManager runtime state directory])"
  gives ${prefix}/var/run/NetworkManager/resolv.conf

(cherry picked from commit 4de6f603e3)
2017-02-15 21:47:14 +01:00
Lubomir Rintel
0770d7e68e release: bump version to 1.6.3 (development) 2017-02-15 15:59:50 +01:00
Lubomir Rintel
037a12f96e release: bump version to 1.6.2 2017-02-15 13:26:14 +01:00
Lubomir Rintel
cef2c19623 release: update NEWS 2017-02-15 13:16:21 +01:00
Beniamino Galvani
78f2ab7cb8 dhcp: dhclient: reset the request list if conf file contains 'request'
After commit 2049e97d9e ("dhcp: refactor parsing of 'request' and
'also request' options") NM parses all the existing 'request' and
'also request' from the original configuration file and appends them
as 'also request' to avoid duplicates and conflicts.

So if the original file contains 'request x' (which means "request
only option x instead of builtin defaults"), we would translate it
into 'also request x', which appends the option to the builtin
defaults, causing duplicates in the DHCP request as dhclient seems not
smart enough to sanitize the list by itself.

To fix this, ensure that the request list is reset if the
configuration file contains a 'request'.

Fixes: 2049e97d9e

https://bugzilla.gnome.org/show_bug.cgi?id=778430
(cherry picked from commit f71e1379d6)
2017-02-14 11:37:11 +01:00
Beniamino Galvani
e940198c37 cli: fix setting of private key password
We can't pass the password obtained from
nm_setting_802_1x_get_*private_key_password() to
nm_setting_802_1x_set_*private_key() as the latter also frees the old
password.

Fixes: afd2811028
(cherry picked from commit b2146a43e5)
2017-02-13 15:53:31 +01:00
Thomas Haller
85140df117 all: merge branch 'th/device-pending-action-bgo777831' (part 2, wifi-scan)
Delay startup complete until Wi-Fi device completed scan and
autoactivation.

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

(cherry picked from commit f3504c9bc2)
2017-02-10 14:47:38 +01:00
Thomas Haller
8b95169791 device/wifi: prevent clearing pending wifi scan action during inactive supplicant
<debug> [1486325858.0691] device[0x563b8fba42e0] (wlp3s0): wifi-scan: scan-done callback: successful
    <debug> [1486325858.0692] device[0x563b8fba42e0] (wlp3s0): wifi-scan: scheduled in 23 seconds (interval now 33 seconds)
    <debug> [1486325858.0692] device[0x563b8fba42e0] (wlp3s0): remove_pending_action (0): 'wifi-scan'
    <trace> [1486325858.0692] properties-changed[0x563b8fba42e0]: ignoring notification for prop has-pending-action on type NMDeviceWifi
    <debug> [1486325858.0692] manager: check_if_startup_complete returns FALSE because of enp0s25
    <info>  [1486325858.0697] device (wlp3s0): supplicant interface state: ready -> inactive
    <debug> [1486325858.0698] device[0x563b8fba42e0] (wlp3s0): wifi-scan: scanning requested
    <debug> [1486325858.0698] device[0x563b8fba42e0] (wlp3s0): wifi-scan: (0) probe scanning SSID <hidden>
    <debug> [1486325858.0698] device[0x563b8fba42e0] (wlp3s0): wifi-scan: (1) probe scanning SSID "aaa"
    <trace> [1486325858.0699] device[0x563b8fba42e0] (wlp3s0): set-hw-addr: no MAC address change needed (2A:71:5D:54:85:1F)
    <debug> [1486325858.0699] device[0x563b8fba42e0] (wlp3s0): add_pending_action (1): 'wifi-scan'

(cherry picked from commit 94127d3f9e)
2017-02-10 14:47:18 +01:00
Thomas Haller
29b6ba0cd4 device/wifi: don't emit wrong SCAN_DONE signal when "Scan" request completes
scan_request_cb() handles the answer from the D-Bus "Scan" method.
At that point, the scan is not yet done, it merely started. It is
wrong to already signal SCAN_DONE.

The only place where we want to signal SCAN_DONE is when we actually
receive the "ScanDone" D-Bus signal.

(cherry picked from commit 75356841fb)
2017-02-10 14:47:18 +01:00
Thomas Haller
9977609b7a device/wifi: first emit NEW_BSS signals before SCAN_DONE
In the SCAN_DONE handler, NMDeviceWifi resets the flag that indicates
that a current scan request is pending. We need to first obtain the
new APs (NEW_BSS) before signalling SCAN_DONE.

(cherry picked from commit 40a4cc5b2d)
2017-02-10 14:47:18 +01:00
Thomas Haller
442ea0348d device/wifi: don't reschedule idle handler for schedule_ap_list_dump()
(cherry picked from commit e4a9942ba8)
2017-02-10 14:47:18 +01:00
Thomas Haller
f9c95bdd23 device/wifi: cache GObject property "scanning"
Cache the value for accessing the GObject property
NM_DEVICE_WIFI_SCANNING.

Re-evaluating the property every time by checking the
supplicant interface is ugly because it might change
under the hood. It should only change if (and only if)
we emit a notify changed signal.

Also, avoid accessing
  nm_supplicant_interface_get_scanning (priv->sup_iface)
without checking whether priv->sup_iface is not NULL.

(cherry picked from commit 4e84472b47)
2017-02-10 14:47:18 +01:00
Thomas Haller
a57a1940c2 device/wifi/trivial: reorder code in "nm-device-wifi.c"
(cherry picked from commit 1b7f03d1a5)
2017-02-10 14:47:18 +01:00
Thomas Haller
b8f3039d87 device/wifi: give wifi-scan related logging message common prefix
Add a prefix "wifi-scan: " to related logging messages for easier searching
the logfiles.

(cherry picked from commit a2798c18b6)
2017-02-10 14:47:18 +01:00
Thomas Haller
023bceb41c device/wifi: ensure consistent timestamp for dumping Wi-Fi AP
When we dump a list of APs, determine one timestamp for "now",
instead of re-evaluating it every time.

This ensures that all APs are printed with the same understanding
of the current timestamp.

(cherry picked from commit 5e4d13271c)
2017-02-10 14:47:18 +01:00
Thomas Haller
1272f3cc04 device/wifi: log scanning related messages with LOGD_WIFI instead of LOGD_WIFI_SCAN
LOGD_WIFI_SCAN is there to avoid flodding the log with continous scan
results. It should not be used for messages related to scheduling scan
requests.

This is especially important, because LOGD_WIFI_SCAN domain is not
included in LOGD_DEFAULT.

(cherry picked from commit d5657d003c)
2017-02-10 14:47:18 +01:00
Thomas Haller
36196b5a82 device/wifi: refactor logging of Wi-Fi AP by preserving logging context of device
The _LOGD() macros of NMDeviceWifi print a logging context for each
line, that is, they add a prefix with the device name.

Replace nm_wifi_ap_dump() by nm_wifi_ap_to_string() and let device
log a message about the AP.

Also, update the format for printing the AP. Now, all fields are
separated by space.

(cherry picked from commit d98fa31ddd)
2017-02-10 14:47:18 +01:00
Thomas Haller
8b455abab2 device: cleanup handling queued state change in NMDevice
- no longer bother clearing .state and .reason when the .id
  field is unset. The fields just don't matter and no user
  accesses these fields when the glib source id is not set.
- unify logging and give them all a prefix "queue-state[%s, %s, %u]: ".
- drop nm_device_queued_state_peek(), it only had one caller,
  thus inline the trivial check.
- make nm_device_queued_state_clear() a static function
  queued_state_clear()
- rename queued_set_state() to queued_state_set().

(cherry picked from commit 96b167cd97)
2017-02-10 14:47:18 +01:00
Thomas Haller
57111e356d device/trivial: reorder defines in "nm-device.c"
Reorder code to be like in other source files:
- first includes and generic defines
- then various helper structs
- then GObject related declarations, with first signal and property
  enums, then the private data, then the G_DEFINE_TYPE() itself.
- finally, forward declarations for functions.

(cherry picked from commit f97d8b86fb)
2017-02-10 14:47:18 +01:00
Thomas Haller
dc7e984422 device: change hw_addr_type field to bitfield type
We don't want to waste a full "int" size to store the @hw_addr_type
in NMDevicePrivate. Previously, that was hacked around by using guint8.

Now, instead use a bitfield which has the right type.

(cherry picked from commit cac0738723)
2017-02-10 14:47:18 +01:00
Thomas Haller
e61e872574 device: inline device helper structs QueuedState and PingInfo
These two structs are only used at exactly one place: as the type
for a field in NMDevicePrivate.

Having additional structs (that are only used at one place) only
add noise. Also, there are already prior-acts of using unnamed
structs in NMDevicePrivate in case of structs that only serve
to group/namespace a set of fields.

(cherry picked from commit 5151a6071f)
2017-02-10 14:47:18 +01:00
Thomas Haller
b1be460863 device: prepend pending actions list
The order doesn't matter, so prepend instead of append new items
to the pending-actions list.

(cherry picked from commit e347d96596)
2017-02-10 14:47:18 +01:00
Thomas Haller
aebff6a1ac device: don't clone pending-action string
All callers either use a static @action argument or keep a clone
of the string that lives as long as the action is pending. So,
save cloning the string.

(cherry picked from commit 3bc1e02adf)
2017-02-10 14:47:18 +01:00
Thomas Haller
78eaabf98f device: implement queued_state_to_string() via NM_UTILS_LOOKUP_STR_DEFINE_STATIC()
(cherry picked from commit 8ac14b5400)
2017-02-10 14:47:18 +01:00
Thomas Haller
9822299d41 device: refactor pending-action strings as named defines
(cherry picked from commit e234673a4a)
2017-02-10 14:47:18 +01:00
Thomas Haller
3a438a1431 device: queue recheck-available before removing "wait for supplicant" pending action
While we still recheck-available, we want to queue a pending action to block
startup-complete. However, we have to queue that before removing the pending
action for "wait for supplicant".

  <debug> [...] device[0x563abbcca400] (wlp2s0): remove_pending_action (0): 'waiting for supplicant'
  <info>  [...] manager: startup complete
  <debug> [...] device[0x563abbcca400] (wlp2s0): add_pending_action (1): 'queued state change to disconnected'

(cherry picked from commit 252e95c113)
2017-02-10 14:47:18 +01:00
Thomas Haller
45ac6d8c12 device: add pending-action "recheck-available"
Startup-complete means that all devices have settled in a state
and no further activation is pending. When we have a recheck-available
scheduled, we clearly should not yet declare startup-complete.

Add a new pending-action "recheck-available" to avoid:

  <info>  [1485520408.3920] device (wlp2s0): supplicant interface state: starting -> ready
  <debug> [1485520408.3920] device[0x563abbcca400] (wlp2s0): remove_pending_action (0): 'waiting for supplicant'
  <info>  [1485520408.3920] manager: startup complete
  <debug> [1485520408.3924] device[0x563abbcca400] (wlp2s0): add_pending_action (1): 'queued state change to disconnected'

(cherry picked from commit 11744b090e)
2017-02-10 14:47:18 +01:00
Thomas Haller
e3dc1a0cc5 core: use define for GObject property name NM_SUPPLICANT_INTERFACE_SCANNING
grep-ing for '\<scanning\>' yields 42 hits under src. But only 2 are actual
references to the "scanning" GObject property of NMDeviceWifi.

Use a #define with a unique name where we mean NMDeviceWifi's property.

(cherry picked from commit 95a95b3e48)
2017-02-10 14:47:17 +01:00
Thomas Haller
256bfe54e7 build: allow configuring path to binutils's nm tool during build
`nm` is used by "tools/create-exports-NetworkManager.sh" script.
Alloc configuring an explicit path during configure.

  BINUTILS_NM=/usr/bin/nm ./configure

(cherry picked from commit 8bc88bcc7c)
2017-02-08 17:01:04 +01:00
Beniamino Galvani
acf9a5c699 platform: fix detection of primary/secondary addresses
ip4_addr_subnets_is_secondary() should fill the list of addresses in
the same subnet also when returning FALSE, because
nm_platform_ip4_address_sync() uses it.

Fixes: 2f68a50041
(cherry picked from commit a347962831)
2017-02-08 15:10:30 +01:00
Beniamino Galvani
b6a34b9c39 core: fix nm_utils_file_set_contents() handling of -1 length
nm_utils_file_set_contents() must compute the content size when
@length is -1.

Fixes: 21358edc54
(cherry picked from commit 0a0893280b)
2017-02-08 12:41:53 +01:00
Thomas Haller
d2d7a0aafc nm-online: fix wrong assertion failure during nm-online
_return() assigns the return value @retval and asserts that
currently no return-value is assigned -- in order not to overwrite
a once set value.

That requires, that we call _return() and exit the main-loop right
away, without possibility to call _return() again.

However, during client_properties_changed() we easily might
receive the "notify" signal multiple times, and thus call
quit_if_connected() and _return() multiple times. That would
lead to a wrong assertion failure.

Avoid that, by disconnecting the signal handler once we reach
_return().

Fixes: f7875a42b0
(cherry picked from commit ec91f950b8)
2017-02-07 19:44:04 +01:00
Thomas Haller
7ada0e0bc3 device/wifi: drop messing with wpa-supplicant's support for MAC address randomization
We no longer use wpa_supplicant for MAC address randomization. Instead, NetworkManager
handles it on it's own. It is actually important that supplicant does not interfere
when setting the MAC address of the device.

The code was only in effect when supplicant has a PreassocMacAddr property.
As this is a recent feature, the left-over code wasn't noticed until now.

https://mail.gnome.org/archives/networkmanager-list/2017-February/msg00003.html

Fixes: 767abfa690
(cherry picked from commit 0cb85f161e)
2017-02-07 14:39:13 +01:00
Beniamino Galvani
a0149376f6 bond: fix crash in update_connection()
The value read from sysfs can be NULL.

Fixes: 2324410a75
(cherry picked from commit 0683ad5db2)
2017-02-07 11:13:20 +01:00
Thomas Haller
64242f5e6a build: merge branch 'th/build-warn-wextra'
(cherry picked from commit 029784b1cc)
2017-02-06 19:43:01 +01:00
Thomas Haller
053bc1de9e build: reorder flags in "m4/compiler_options.m4"
Mostly sort alphabetically, but
  - keep -Wextra first
  - move "-Wno-*" flags to the end

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