Commit graph

23544 commits

Author SHA1 Message Date
Thomas Haller
a8fa015a4e core: fix mangling static IPv6 routes in nm_ip6_config_merge_setting()
https://bugzilla.redhat.com/show_bug.cgi?id=1727193

Fixes: 433d2f8659 ('core: merge IPv4 and IPv6 version of _nm_ip_config_merge_route_attributes()')
2019-07-09 14:33:57 +02:00
Francesco Giudici
7dd95221b7 man: update nm-openswitch example
Seems that a quite common openswitch basic configuration consist of a
one bridge, one port and one interface, all with the same interface
name. When performing such configuration in NetworkManager you need to
specify the slave-type for the ovs-interface, otherwise the master
interface specified there may match the bridge interface, resulting in
an error.
So, let's specify the slave-type for the ovs-interface, so that the
example will work also when the same interface name is specified for
both the ovs-bridge and the ovs-port.

https://bugzilla.redhat.com/show_bug.cgi?id=1638038
2019-07-09 12:05:32 +02:00
Thomas Haller
6a62314968 platform/tests: relax check for accepting platform signals
nmtst: initialize nmtst_get_rand() with NMTST_SEED_RAND=0
    /link/bogus: OK
    /link/loopback: OK
    /link/internal: OK
    /link/external: OK
    /link/software/bridge: OK
    /link/software/bond: OK
    /link/software/team: NMPlatformSignalAssert: ../src/platform/tests/test-link.c:331, test_slave(): failure to accept signal [0,2] times: 'link-changed-changed' ifindex 15 (3 times received)
    --- stderr ---
    /builds/NetworkManager/NetworkManager/tools/run-nm-test.sh: line 264: 106682 Trace/breakpoint trap      --quiet --error-exitcode= --leak-check=full --gen-suppressions=all  --num-callers=100 --log-file=
    The test failed. Also check the valgrind log at '/builds/NetworkManager/NetworkManager/build/src/platform/tests/test-link-linux.valgrind-log'
2019-07-09 10:59:57 +02:00
Thomas Haller
3d35ea645e libnm/crypto: use memmem() instead of naive O(n*m) search in find_tag() 2019-07-08 22:13:17 +02:00
Lubomir Rintel
c610667286 settings: fix a reversed conditional in have_connection_for_device()
https://bugzilla.redhat.com/show_bug.cgi?id=1727411

Fixes: be0018382d ('settings: in have_connection_for_device() first skip over irrelevant connection types')
2019-07-08 18:07:01 +02:00
Beniamino Galvani
deba9c4b86 build: add missing dependency for shared/systemd/src/shared
In file included from ./shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h:21,
                  from shared/systemd/src/shared/dns-domain.c:3:
 ./shared/nm-default.h:106:10: fatal error: config-extra.h: No such file or directory
  #include "config-extra.h"
          ^~~~~~~~~~~~~~~~
 compilation terminated.
 make[1]: *** [Makefile:12933: shared/systemd/src/shared/libnm_systemd_shared_la-dns-domain.lo] Error 1

Fixes: 7d3098ff90 ('systemd: add dns-domain utils to systemd static library')
2019-07-08 15:03:54 +02:00
Beniamino Galvani
fb4823c8ae core: merge branch 'bg/slaves-autoconnect-managed'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/197/commits
2019-07-08 13:52:15 +02:00
Beniamino Galvani
ba7b427aec manager: propagate the for-user-request flag for slaves autoconnection
If the master is activated by user, propagate the for-user-request to
slaves activations when autoconnecting slaves, so that they can manage
slaves device as needed.

Reproducer:

 ip l add eth1 type veth peer name eth2
 ip l set eth1 up
 ip l set eth2 up
 sleep 2

 echo " * Initial state"
 echo " - eth1: $(nmcli -g general.state device show eth1)"

 nmcli con add type ethernet ifname eth1 con-name slave-test+ master br-test slave-type bridge
 nmcli con add type bridge ifname br-test con-name br-test+ connection.autoconnect-slaves yes ip4 172.25.1.1/24

 nmcli con up br-test+

 echo " * After user activation"
 echo " - br-test: $(nmcli -g general.state device show br-test)"
 echo " - eth1: $(nmcli -g general.state device show eth1)"

should give:

 * Initial state
 - eth1: 10 (unmanaged)
 * After user activation
 - br-test: 100 (connected)
 - eth1: 100 (connected)
2019-07-08 13:51:30 +02:00
Beniamino Galvani
c7fd4aeecf device: properly honor flags when checking connection availability
The previous code returned that the device was available when it had
only unmanaged-flags that can be overridden by user, without actually
considering the @flags argument.

Fixes: 920346a5b9 ('device: add and use overrule-unmanaged flag for nm_device_check_connection_available()')
2019-07-08 13:51:30 +02:00
Francesco Giudici
7d8f20b00e dhcp: merge branch 'fg/dhcp_options2env-rh1663253'
https://bugzilla.redhat.com/show_bug.cgi?id=1663253

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/161
2019-07-05 17:54:52 +02:00
Francesco Giudici
b3a5541111 dispatcher: add MS Azure endpoint env var expected by cloud-init
Some linux distros (e.g., RHEL, CentOS and Fedora) ship a dispatcher
script with their dhclient package in order to run user dhclient hook
scripts also when connections are run by NetworkManager.
The scripts convert the var names in the environment to the ones
expected in the dhclient hook scripts.
This feature is currently use by cloud-init to retrieve the MS Azure
server endpoint address, which is sent in the private dhcp option 245.
We just redefined the default dhclient var names for the private options
from "unknown_xyz" to "private_xyz". In order to let current cloud-init
version to be able to retrieve the Azure server endpoint address, add
the legacy var name "unknown_245" to the dispatcher script environment.
2019-07-05 15:17:04 +02:00
Francesco Giudici
b2915e20d1 dispatcher/trivial: fix typo in comment 2019-07-05 15:17:04 +02:00
Francesco Giudici
f9314526d0 dhcp/dhclient: expose the private_xyz labels for dhcp private options
alias the default "unknown_xyz" labels when found.
2019-07-05 15:15:11 +02:00
Francesco Giudici
eed205bff3 dhcp/internal: move dhcp options management to shared dhcp codebase 2019-07-05 15:13:09 +02:00
Francesco Giudici
f42754c8d7 dhcp/internal: expose on D-Bus all the private dhcp options
when dhclient is used as the dhcp client in NetworkManager we expose on
D-Bus all the variables that are passed to our script file. In
particular, we use the variable names there as labels (stripping the
heading "new") taking whatever dhclient passes us.
There are few exception to this. Dhclient allows to redefine option
variable names and we use this functionality for a few dhcp options:
dhcp option code 121 --> "rfc3442_classless_static_routes"
dhcp option code 249 --> "ms_classless_static_routes"
dhcp option code 252 --> "wpad"

Note that for private dhcp options (224-254) default dhclient labels are
in the form "unknown_$OPTNUM".
2019-07-05 15:08:31 +02:00
Francesco Giudici
a6036b2352 dhcp: access internal systemd structure to retrieve dhcp private options 2019-07-05 14:12:21 +02:00
Francesco Giudici
5008a25f62 dhcp/internal: expose on D-Bus some more dhcp options
When using the internal dhcp client we skip exporting on D-Bus many of
the dhcp options received from the dhcp server. We instead export almost
all of them when using the dhclient dhcp client, using the variable
names passed by dhclient itself.
Map more DHCP options to dhclient variable names in order to allow the
internal client to retrieve them easily, namely: the server identifier,
the broadcast address, the renewal time, the rebinding time and the timezone.
Note that not all the DHCP options can be exported at this time because
systemd-networkd code drops many it won't process, so we have no way to
retrieve them without changing core systemd-networkd code.
2019-07-05 14:12:21 +02:00
Francesco Giudici
3775f31cb9 dhcp/internal: expose on D-Bus the lease time dhcp option
It was already exposed implicity as the expiration time: add also the
explicit option using same format of dhclient dhcp plugin.
In the meanwhile, drop the SD_DHCP_OPTION_CLIENT_IDENTIFIER as not used.
2019-07-05 14:12:21 +02:00
Francesco Giudici
97ce488f5f dhcp/internal: decrease logging level when retrieving dhcp options
Use DEBUG logging level for the parsing result of lease file.
Moreover, use consistent labels for the dhcp options: same labels of
what is exposed on D-Bus.
2019-07-05 14:12:21 +02:00
Beniamino Galvani
f3b831aba1 dhcp: merge branch 'bg/nettools'
Introduce the nettools DHCPv4 backend.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/171
2019-07-05 11:17:16 +02:00
Beniamino Galvani
106c156b0f n-dhcp4: client/probe: fix memory leak
The probe takes a reference to the current lease and so it must
release it upon destruction.

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>

https://github.com/nettools/n-dhcp4/pull/1
2019-07-05 11:09:28 +02:00
Beniamino Galvani
46f81e18f7 n-dhcp4: client/connection: fix memory leak
Free the request when the connection gets destroyed.

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>

https://github.com/nettools/n-dhcp4/pull/1
2019-07-05 11:09:03 +02:00
Beniamino Galvani
40babe1c44 dhcp: pass broadcast address to clients
Read the broadcast address from platform and pass it to
clients. Currently only the nettool backends uses it.
2019-07-05 11:06:01 +02:00
Beniamino Galvani
1609f50866 core: drop nm_platform_link_get_address_as_bytes()
Drop nm_platform_link_get_address_as_bytes() and introduce
nmp_link_address_get_as_bytes() so that it becomes possible to obtain
also the broadcast address without an additional lookup of the link.
2019-07-05 11:06:01 +02:00
Beniamino Galvani
36348c7dc5 dhcp: nettools: improve error messages
Add the reason to error messages to make debugging easier.

Note that n_dhcp4_client_new() also returns positive internal error
values, so we can't use nm_utils_error_set_errno().
2019-07-05 11:04:32 +02:00
Beniamino Galvani
7332c7343d dhcp: nettools: decrease initial delay
I think that artificially slowing down DHCP is not going to make users
happier, so let's decrease it to the minimum allowed value (1 ms).
Note that also dhclient and the internal client have it disabled. From
the dhclient.conf man page:

 *initial-delay* parameter sets the maximum time client can wait after
 start before commencing first transmission.  According to RFC2131
 Section 4.4.1, client should wait a random time between startup and
 the actual first trans‐ mission. Previous versions of ISC DHCP client
 used to wait random time up to 5 seconds, but that was unwanted due
 to impact on startup time. As such, new versions have the default
 initial delay set to 0. To restore old behavior, please set
 initial-delay to 5.
2019-07-05 11:04:32 +02:00
Beniamino Galvani
584298b7da dhcp: nettools: support the FQDN option
Add option 81 (FQDN) when the ipv4.dhcp-fqdn property is set. We don't
support changing the FQDN flags yet.
2019-07-05 11:04:32 +02:00
Beniamino Galvani
0280fd1a80 shared: add nm_sd_dns_name_to_wire_format()
Add nm_sd_dns_name_to_wire_format() based on systemd utilities to
convert a name into its wire format according to RFC 1035 section
3.1. It will be used to build the content of the DHCP FQDN option.
2019-07-05 11:04:32 +02:00
Beniamino Galvani
7d3098ff90 systemd: add dns-domain utils to systemd static library
dns-domain.c contains useful functions for manipulating DNS names.
Add it to the systemd static library we build in shared/, similarly to
what we already do for other utility files that were originally in
src/systemd/src/basic/.
2019-07-05 11:04:32 +02:00
Beniamino Galvani
92a717e7c2 dhcp: nettools: relicense as LGPL
Acked-by: Tom Gundersen <teg@jklm.no>
2019-07-05 11:04:32 +02:00
Tom Gundersen
314134a445 n-dhcp4: avoid {net,linux}/if.h clashes on old distros
In particular, avoid including linux/netdevice.h from headers. This is
not a problem on newer distros, but required for CentOS 7.6.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-07-05 11:04:32 +02:00
Tom Gundersen
d797611df5 shared/n-dhcp4: avoid c_min() macro to work with old GCC
This is required for the CI to pass, as CentOS has a too old version
of GCC. Ideally this patch should be dropped.
2019-07-05 11:04:32 +02:00
Tom Gundersen
6adade6f21 dhcp: add nettools dhcp4 client
This is inspired by the existing systemd integration, with a few differences:

* This parses the WPAD option, which systemd requested, but did not use.
* We hook into the DAD handling, only making use of the configured address
  once DAD has completed successfully, and declining the lease if it fails.

There are still many areas of possible improvement. In particular, we need
to ensure the parsing of all options are compliant, as n-dhcp4 treats all
options as opaque, unlike sd-dhcp4. We probably also need to look at how
to handle failures and retries (in particular if we decline a lease).

We need to query the current MTU at client startu, as well as the hardware
broadcast address. Both these are provided by the kernel over netlink, so
it should simply be a matter of hooking that up with NM's netlink layer.

Contribution under LGPL2.0+, in addition to stated licenses.
2019-07-05 11:04:32 +02:00
Tom Gundersen
401fee7c20 dhcp: support notifying the client of the result of DAD
The DHCP client is not meant to use the assigned address before DAD
has completed successfully, if enabled. And if DAD fails, the server
should be notified with a DECLINE, in order to potentially blacklist
the address.

Currently, none of the clients support this, but add the required
callbacks, and allow clients to opt in if they want.
2019-07-05 11:04:32 +02:00
Beniamino Galvani
be8f7b5a5d systemd: merge branch systemd into master 2019-07-05 09:13:53 +02:00
Beniamino Galvani
55c47d4efa systemd: update code from upstream (2019-07-04)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=52d8bcd131e7f3c9b7629412302e1ea46ddb70ca

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

git ls-files -z :/src/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-utils/unaligned.h | \
  xargs -0 rm -f

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

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

nm_copy_sd_nmutils() {
    mkdir -p "./shared/nm-utils/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/shared/dns-domain.c"
nm_copy_sd_core "src/shared/dns-domain.h"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_nmutils "src/basic/unaligned.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
2019-07-04 18:13:17 +02:00
Thomas Haller
fe52a9467b shared: gracefully accept %NULL strings for NM_STR_HAS_PREFIX() and NM_STR_HAS_SUFFIX()
In case it wasn't obvious to a caller, allow %NULL as valid string
argument. Just be a bit more forgiving and fault-tolerant.
2019-07-04 17:11:24 +02:00
Beniamino Galvani
c045267837 ifcfg-rh: fix memory leak reading infiniband setting 2019-07-04 11:53:25 +02:00
Beniamino Galvani
17f4a1e794 device: ppp: check that connection has a PPPoE parent
NMDevicePPP only handles connections with the pppoe.parent property
set. match_connection() already checks this when we creating a new
device. We should also perform the same check in
check_connection_compatible().

Fixes: 6c3195931e ('core: implement activation of PPP devices')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/203
2019-07-03 17:56:37 +02:00
Lubomir Rintel
bdc57c3d70 release: bump version to 1.19.5-dev 2019-07-03 09:35:17 +02:00
Lubomir Rintel
ce89e8b9b0 merge: branch 'lr/bootif'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/195
2019-07-03 09:27:43 +02:00
Lubomir Rintel
93859d8ffd initrd/tests: add some more variations of possible BOOTIF= variables
Test the form with a hwtype and color-separated as well as
hyphen-separated.
2019-07-03 09:16:52 +02:00
Lubomir Rintel
2952953a48 initrd: skip ethernet hwtype in BOOTIF
Dracut documents the BOOTIF argument to be a MAC address and so we
accept one in any of the conventions we recognize. However, the PXE boot
loaders like to prepend a "01-" to denote an ethernet hardware type.
Accept that too.

https://bugzilla.redhat.com/show_bug.cgi?id=1726240
2019-07-03 09:16:52 +02:00
Dan Williams
f0e4137e1d cli: complete *-slave types (bond-slave, bridge-slave, team-slave)
While shorthand for "type ethernet slave-type <foo>" they are accepted
as types by nmcli so we might as well complete them.

https://bugzilla.redhat.com/show_bug.cgi?id=1654062

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/193
2019-07-02 18:04:14 +02:00
Thomas Haller
e92dca357f all: merge branch 'th/various-settings-cleanup-4'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/192
2019-07-02 17:53:41 +02:00
Thomas Haller
c163207b07 core: create virtual device on settings changes in idle handler
The callback from NMSettings about adding/updating a settings comes
from a deep call-stack already. We don't know the context of it, and
we shouldn't just right away create the profile. Instead, schedule an
action to create it in an idle handler.
2019-07-02 17:52:53 +02:00
Thomas Haller
42a034812a ifcfg-rh: refactor code re-reading profile from disk after write
The function only has one caller and it should be simple enough
to perform the necessary steps right in nms_ifcfg_rh_writer_write_connection().

More functions don't (always) simplify the code.
2019-07-02 17:52:53 +02:00
Thomas Haller
5b98f2fb01 device: fix crash releasing destroyed slave
I encountered this on a WIP branch, but I think it can happen
under regular conditions. I think there is no error condition here,
and we should do nothing if we have no ifindex.

  <debug> [1561653068.2192] platform: signal: link removed: 1699: test1p <DOWN;broadcast,multicast> mtu 1500 master 1698 arp 1 veth* init addrgenmode none addr D6:14:45:97:06:75 brd FF:FF:FF:FF:FF:FF driver veth rx:0,0 tx:38,5606
  ...
  <info>  [1561653068.2617] device (test1): state change: activated -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed')
  ...
  <trace> [1561653068.2635] device[0x564058c73750] (test1p): sys-iface-state: external -> removed
  <debug> [1561653068.2635] device[0x564058c73750] (test1p): unrealize (ifindex 1699)
  <debug> [1561653068.2636] device[0x564058c73750] (test1p): parent: clear
  <trace> [1561653068.2636] device[0x564058b98eb0] (vethbr): mtu: commit-mtu...
  <debug> [1561653068.2639] device[0x564058c73750] (test1p): unmanaged: flags set to [platform-init,!sleeping,!by-type,!user-explicit,!user-settings,!user-udev,!is-slave=0x10/0x1479/unmanaged/unrealized], set-unmanaged [platform-init=0x10])
  <debug> [1561653068.2639] device[0x564058c73750] (test1p): unmanaged: flags set to [platform-init,!sleeping,!user-settings=0x10/0x51/unmanaged/unrealized], forget [parent,by-type,user-explicit,user-udev,external-down,is-slave=0x1c2c])
  <info>  [1561653068.2639] device (test1p): state change: activated -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed')
  <debug> [1561653068.2640] device[0x564058c73750] (test1p): deactivating device (reason 'unmanaged') [3]
  <trace> [1561653068.2640] device[0x564058c73750] (test1p): ip4-state: set to 0 (none)
  <trace> [1561653068.2640] device[0x564058c73750] (test1p): ip6-state: set to 0 (none)
  <trace> [1561653068.2640] device[0x564058c73750] (test1p): remove_pending_action (0): 'dhcp6' not pending (expected)
  <trace> [1561653068.2640] device[0x564058c73750] (test1p): remove_pending_action (0): 'autoconf6' not pending (expected)
  <debug> [1561653068.2640] rules-manager: sync
  <debug> [1561653068.2640] device[0x564058c73750] (test1p): set metered value 0
  <debug> [1561653068.2641] device[0x564058c73750] (test1p): ip4-config: update (commit=1, new-config=(nil))
  <debug> [1561653068.2641] device[0x564058c73750] (test1p): ip6-config: update (commit=1, new-config=(nil))
  <debug> [1561653068.2644] device[0x564058b98eb0] (vethbr): slave test1p state change 100 (activated) -> 10 (unmanaged)
  <trace> [1561653068.2644] device[0x564058b98eb0] (vethbr): master: release one slave 0x564058c73750/test1p
  ((src/platform/nm-platform.c:2002)): assertion '<dropped>' failed

backtrace:
  ...
  #3  0x0000564057fb713e _nm_g_return_if_fail_warning (NetworkManager)
  #4  0x000056405808b37c release_slave (NetworkManager)
  #5  0x0000564058079aef nm_device_master_release_one_slave (NetworkManager)
  #6  0x00005640580844d7 slave_state_changed (NetworkManager)
  #7  0x00007efc24833fae ffi_call_unix64 (libffi.so.6)
  #8  0x00007efc2483396f ffi_call (libffi.so.6)
  #9  0x00007efc29b836e5 g_cclosure_marshal_generic (libgobject-2.0.so.0)
  #10 0x00007efc29b82c1d g_closure_invoke (libgobject-2.0.so.0)
  #11 0x00007efc29b96173 signal_emit_unlocked_R (libgobject-2.0.so.0)
  #12 0x00007efc29b9f29a g_signal_emit_valist (libgobject-2.0.so.0)
  #13 0x00007efc29b9f893 g_signal_emit (libgobject-2.0.so.0)
  #14 0x000056405807ab20 _set_state_full (NetworkManager)
  #15 0x000056405807d803 nm_device_unrealize (NetworkManager)
  #16 0x0000564057f6072c _platform_link_cb_idle (NetworkManager)
  #17 0x00007efc296a01db g_idle_dispatch (libglib-2.0.so.0)
  ...
2019-07-02 17:52:53 +02:00
Thomas Haller
7c84227c93 shared: add nm_c_list_elem_free_steal() util 2019-07-02 17:52:53 +02:00
Lubomir Rintel
add691a901 core/wired: include the invalide MAC address in error messages
Otherwise the errors don't make much sense:

  802-3-ethernet.mac-address: is not a valid MAC address
2019-07-02 16:06:03 +02:00