Commit graph

20409 commits

Author SHA1 Message Date
Thomas Haller dd91d0d79c build: fix make distcheck by building --with-libnm-glib
During make-distcheck we pre-generate documentation. For that
we need to build with libnm-glib enabled.

Fixes: df58895fb3
2018-06-15 17:16:18 +02:00
Thomas Haller 9c3e52b532 all: merge branch 'lr/msec-timestamp'
https://github.com/NetworkManager/NetworkManager/pull/140
2018-06-15 16:38:03 +02:00
Lubomir Rintel 4f557db063 clients/tests: utilize nm_utils_get_timestamp_msec() 2018-06-15 16:23:30 +02:00
Lubomir Rintel 1b6127d1bc examples/python: utilize nm_utils_get_timestamp_msec() 2018-06-15 16:23:30 +02:00
Lubomir Rintel cfa3a02b91 tools/test-service: utilize nm_utils_get_timestamp_msec()
This is probably better than a hardcoded timestamp.
2018-06-15 16:23:30 +02:00
Lubomir Rintel 5269aba7b4 cli: utilize nm_utils_get_timestamp_msec() 2018-06-15 16:23:30 +02:00
Lubomir Rintel 0132da1ddb libnm: add nm_utils_get_timestamp_msec() 2018-06-15 16:23:30 +02:00
Lubomir Rintel 07fd0502f6 wifi: expose LastScan as milliseconds not seconds
This doesn't wrap around in 68 years of uptime and is consistent with
o.fd.NM.Checkpoint.Created.
2018-06-15 16:23:30 +02:00
Lubomir Rintel 1c0aa397b3 libnm: correctly demarshall (u)int64 values 2018-06-15 16:23:30 +02:00
Francesco Giudici ba5feb8ca8 man: add 'random' to the allowed values of team.runner
https://bugzilla.redhat.com/show_bug.cgi?id=1543832
2018-06-15 16:14:49 +02:00
Thomas Haller 13f860970a systemd: merge branch systemd into master 2018-06-15 15:56:04 +02:00
Thomas Haller 353810ccc1 systemd: update code from upstream (2018-06-15)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=88f375b8c28806633d22ed99f6a5f1194c78ed73

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

git ls-files :/src/systemd/src/ \
             :/shared/nm-utils/siphash24.h \
             :/shared/nm-utils/unaligned.h | \
  xargs -d '\n' rm -f

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

nm_copy_sd_shared() {
    mkdir -p "./shared/nm-utils/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${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/process-util.h"
nm_copy_sd "src/basic/process-util.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.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/stat-util.c"
nm_copy_sd "src/basic/stat-util.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_shared "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"
2018-06-15 15:18:28 +02:00
Francesco Giudici 046f759982 merge: branch 'fg/auto_neg_specmodes-rh1487477'
https://bugzilla.redhat.com/show_bug.cgi?id=1487477
2018-06-15 14:20:37 +02:00
Francesco Giudici a1aef0c7c2 libnm-core: allow speed and duplex values when auto-negotiate=yes
When link auto-negotiation is enabled, by default the network device
advertises all the supported speed and duplex modes in order to
negotiate the fastest link speed with the remote endpoint.
It is possible anyway to configure the device to just advertise and
accept a subset of supported modes.
This could be useful to properly enforce gigabit speeds on Ethernet:
as stated in IEEE 802.3 specification, auto-negotiation is mandatory
for 1000Base-T and 10GBase-T standards.
Allow specific values to 802-3-ethernet.speed and 802-3-ethernet.duplex
properties also when 802-3-ethernet.auto-negotiate=yes: this will
result in link auto-negotiation advertising the specified speed/duplex
mode as the only one available.
2018-06-15 14:19:50 +02:00
Francesco Giudici 193aae91eb ifcfg: enable writing/reading of speed and duplex when autoneg is enabled 2018-06-15 14:19:50 +02:00
Francesco Giudici 064ea1c58e device: enforce specific speed/duplex modes in link auto-configuration 2018-06-15 14:19:50 +02:00
Francesco Giudici 356addb9e6 platform: allow to force the advertised auto-negotiation link value
This will only work for network devices supporting the BASE-T specification.
2018-06-15 14:19:50 +02:00
Francesco Giudici 45170bad5d platform: move link_duplex_to_string function to platform
Expose it as a regular platform function: change its name
to nm_platform_link_duplex_type_to_string().
2018-06-15 14:19:50 +02:00
Lubomir Rintel df58895fb3 build: disable libnm-glib by default
It's deprecated and has been replaced by libnm for 6 major releases now.

Its use in modern distributions has faded to the point it can probably
be safely removed.
2018-06-15 13:07:53 +02:00
Thomas Haller 576cbb771a libnm: always return VPN connections's banner
It's not libnm's responsibility to hide the banner
depending on the VPN state. libnm should cache and expose
NetworkManager's state, and if the VPN connection has
a banner there, it should be returned.

The previous behavior was since ever in libnm, and in libnm-glib since
the banner was introduced in commit e5b834c1f9.
I think it's wrong if libnm tries too hard putting additional logic
on top of what is on D-Bus.
2018-06-15 11:56:04 +02:00
Thomas Haller 4e7ae3da6e cli: fix printing multi-line output when there is nothing to print
When a property getter returns an empty/missing strv-array, in multi-line
mode we should not print any lines.

To get that right, we must mark the cell as STRV type, even if there is no value
provided.

Previously, with text_out_flags having NM_META_ACCESSOR_GET_OUT_FLAGS_STRV
and value being NULL, we would not set
  cell->text_format = PRINT_DATA_CELL_FORMAT_TYPE_STRV;
and thus, later on the value would be treated as a missing (plain)
string.
2018-06-15 11:48:16 +02:00
Thomas Haller dba41ee1e1 cli: return NULL strv array from _ip_config_get_routes() if there are no routes
The property getter for certain properties tries to return
a strv array.

In this case, the result should be identical, whether an
empty strv array or NULL is returned.

Let _ip_config_get_routes() return %NULL if there are no routes.
This should have no practical difference, but it actually exposes
a bug in "cli/common/utils.c", which was previously hidden by
not commonly returning %NULL. This bug will be fixed in the
next commit.
2018-06-15 11:48:16 +02:00
Thomas Haller b29bf1b079 wifi: merge branch 'wake-on-wlan' (partial)
https://github.com/NetworkManager/NetworkManager/pull/124
2018-06-15 09:47:46 +02:00
Thomas Haller 36e9ec0554 wifi: fix check for valid NMSettingWirelessWakeOnWLan flag 2018-06-15 09:46:26 +02:00
Thomas Haller 8cba4d95df device/wifi: use _LOGD() macros in wake_on_wlan_enable()
_LOGD() is preferred, because it includes a common prefix depending
on the device. This macro requires, that we have a suitable @self
variable in the local scope.
2018-06-15 09:46:26 +02:00
Alfonso Sánchez-Beato e7d26cd871 NEWS: add note about new WoWLAN settings 2018-06-15 09:46:26 +02:00
Alfonso Sánchez-Beato cb8003c40d cli: add support for wake-on-wlan properties 2018-06-15 09:46:26 +02:00
Alfonso Sánchez-Beato ca3bbede74 core: don't shutdown interfaces if they have wowlan enabled
This is to support the S5 case, where usually the NM process is
stopped. If we are stopping and WoWLAN is set for the interface,
we do not deconfigure it and keep the connection alive so we
can receive packages that will potentially wake up the system.

Note that for this work, wpa_supplicant needs to be modified too
so it does not deconfigure the wireless interface either when
stopped. The needed patches for wpa_supplicant can be found in
http://lists.infradead.org/pipermail/hostap/2018-June/038644.html
2018-06-15 09:46:26 +02:00
Simon Fels ea10016d24 devices: enable wake-on-wlan when device is enabled
Co-authored-by: Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
2018-06-15 09:46:26 +02:00
Simon Fels 1621c79e7b platform: add support for wake-on-wlan
Co-authored-by: Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
2018-06-15 09:46:26 +02:00
Simon Fels 58cdc7b550 libnm-core: add wake-on-wlan configuration items
Co-authored-by: Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
2018-06-15 09:46:26 +02:00
Lubomir Rintel 7af1bc7cf0 ovs: only finish waiting for a link when we actually got one
https://bugzilla.redhat.com/show_bug.cgi?id=1546659
2018-06-15 09:44:04 +02:00
Thomas Haller 086eadd5ba device: merge branch 'th/device-reapply-metric' (partial)
https://github.com/NetworkManager/NetworkManager/pull/138
2018-06-15 09:09:54 +02:00
Thomas Haller 6e12e18c15 device: simplify nm_device_hash_check_invalid_keys()
Rather trivial change. Return-early, to completely handle the simpler
case (the success case) first. In the failure case, we only need
extra effort to generate a nice error message.
2018-06-15 09:07:19 +02:00
Thomas Haller b31bc4fa6c core/trivial: rename local variables to make code clearer 2018-06-15 09:07:19 +02:00
Thomas Haller 79159f61c7 device: check for proxy setting separately in can_reapply_change()
Proxy setting has no property NM_SETTING_IP_CONFIG_ROUTE_TABLE.
It's odd to handle it in the same if-block with IP configs.
2018-06-15 09:07:19 +02:00
Thomas Haller 9586d2794a shared: simplify nm_g_object_ref_set()
Also, assign *_pp before unref-ing the old value. Calling
g_object_unref() on the old value, might invoke callbacks
that are out of control of nm_g_object_ref_set(). During
that time, the pointer should already be assigned the new value,
instead of having an intermediate %NULL value. In most cases,
this would of course not matter, but there is no need to let
anyone see an intermediate %NULL value for a moment.

Also, don't use typeof(**_pp), which would not work with opaque
types (like we commonly have).
2018-06-15 09:07:19 +02:00
Thomas Haller fe1f5871c8 device: fix crash during reapply
Fixes: bf3b3d444c
2018-06-15 09:07:19 +02:00
Lubomir Rintel 9c0db98094 Revert "example/python: avoid falling back to CLOCK_MONOTONIC"
This breaks client tests on avery old kernel (2.6.32, RHEL 6).

  Traceback (most recent call last):
    File "./clients/tests/test-client.py", line 699, in setUp
      self.srv = NMStubServer(self._testMethodName)
    File "./clients/tests/test-client.py", line 309, in __init__
      start = nmex.nm_boot_time_ns()
    File "/builddir/build/BUILD/NetworkManager-1.11.4/examples/python/nmex.py", line 54, in nm_boot_time_ns
      return sys_clock_gettime_ns(CLOCK_BOOTTIME)
    File "/builddir/build/BUILD/NetworkManager-1.11.4/examples/python/nmex.py", line 50, in sys_clock_gettime_ns
      return _sys_clock_gettime_ns(clock_id)
    File "/builddir/build/BUILD/NetworkManager-1.11.4/examples/python/nmex.py", line 39, in f
      raise OSError(errno_, os.strerror(errno_))
  OSError: [Errno 22] Invalid argument

This reverts commit 119e828dbe.
2018-06-15 08:36:22 +02:00
Lubomir Rintel 119e828dbe example/python: avoid falling back to CLOCK_MONOTONIC
According to the D-Bus API specification we return CLOCK_BOOTTIME only.
We don't support kernels too old to have it -- the fall back to
CLOCK_MONOTONIC is only there to be able to run unit tests on RHEL 6
kernel and will eventually go away.
2018-06-14 17:30:06 +02:00
Thomas Haller 9a14f9caa5 clients/tests: fix unstable tests for Python2 vs. Python3
Currently, nmcli does not sort the list of available connections
for display. Instead, it shows them in the order as NetworkManager
exposes them on D-Bus.

Previously, test-networkmanager-service.py, would generate the list
of available connections by iterating the connections dictionary.
In Python (at least until Python 3.6), the order when iterating over
dictionaries is undefined. This inconsistancy lets tests behave
differently depending on the python version. Possibly with Python
3.4 and 3.5, tests might even behave differently between individual
runs (since Python there uses siphash with a randomized hash seed).
2018-06-14 16:38:33 +02:00
Thomas Haller fb5f555a54 clients/tests: add more tests printing wifi details in nmcli 2018-06-14 15:45:34 +02:00
Beniamino Galvani bb20f2eb61 macsec: enable send-sci by default and make the option configurable
It is safer to enable send-sci by default because, at the cost of
8-byte overhead, it makes MACsec work over bridges (note that kernel
also enables it by default). While at it, also make the option
configurable.

https://bugzilla.redhat.com/show_bug.cgi?id=1588041
2018-06-14 15:13:11 +02:00
Thomas Haller ed638b7126 clients/tests: document importance of locale for clients tests 2018-06-14 13:57:14 +02:00
Lubomir Rintel 6373196ffd merge: branch 'lr/wwan-ppp-route-rh1585611'
https://github.com/NetworkManager/NetworkManager/pull/132
2018-06-14 10:28:00 +02:00
Lubomir Rintel 650b5fd99e wwan: ensure the route parameters are set on IPv6 only configuration 2018-06-13 16:56:51 +02:00
Lubomir Rintel 267948f2b7 wwan: set the route parameters at the beginning of ip4 config
We set the metric to the routes as we receive them from the PPP plugin. We
ought to let the modem know before it starts IPv4 configuration, not right
before the commit.

https://bugzilla.redhat.com/show_bug.cgi?id=1585611
2018-06-13 16:45:24 +02:00
Andrew Zaborowski 140ada3aad cli: Actually add passwords to the AddAndActivateConnection arguments
Check the wpa_flags and rsn_flags values to see if the network needs the
password added to the 802-11-wireless-security settings.  The current
ap_flags check alone would only trigger the password to be sent for WEP
networks.  Also remove unneeded initialization of the three variables.
2018-06-13 15:59:48 +02:00
Lubomir Rintel 2a7a36494a cli: drop an unused variable
clients/cli/connections.c:1909:3: error: unused variable 'out_indices' [-Werror,-Wunused-variable]
                NMC_OUTPUT_DATA_DEFINE_SCOPED (out);
                ^
2018-06-13 15:58:20 +02:00
Lubomir Rintel 74c2a0aca4 device: drop an unused variable
src/devices/nm-device.c:7764:25: error: unused variable 'stable_hwaddr' [-Werror,-Wunused-variable]
        gs_unref_bytes GBytes *stable_hwaddr = NULL;
                               ^
2018-06-13 15:56:27 +02:00