Commit graph

18754 commits

Author SHA1 Message Date
Lubomir Rintel
e5c19377ec libnm: add support for ovs-interface devices 2017-10-30 17:40:08 +01:00
Lubomir Rintel
b5925d693c introspection: add o.fd.NM.Device.OvsBridge interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
6748c44cb6 introspection: add o.fd.NM.Device.OvsPort interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
b0f3dc0add introspection: add o.fd.NM.Device.OvsInterface interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
cb9b024ddb libnm-core: add ovs-bridge setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel
8a1ae40a80 libnm-core: add ovs-port setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel
27790fa976 libnm-core: add ovs-interface setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel
d4a7fe4679 libnm-core: add ovs-patch setting 2017-10-30 17:40:08 +01:00
Lubomir Rintel
89c4732142 device: don't progress from ip-config state when we're enslaved
We now can be enslaved and have L3 configuration at the same time.
This also reduces some unnecessary complexity, because the decision to
progress to IP_CHECK or SECONDARIES now happens in a single place, in
the check_ip_state() routine.
2017-10-30 17:40:08 +01:00
Lubomir Rintel
44eef0cfff device/trivial: move check_ip_state() upwards 2017-10-30 17:40:08 +01:00
Lubomir Rintel
dcfe276a82 device: don't wait for a carrier before enslaving devices
The OpenVSwitch interfaces come into existence by their enslavement to a port.
They can also bear an IP4 or IP6 configuration -- waiting on a carrier would
deadlock the acitvation.
2017-10-30 17:40:08 +01:00
Lubomir Rintel
340e35c09d device: log device type too 2017-10-30 17:40:08 +01:00
Lubomir Rintel
6ac826350c device: do not limit unrealizement to devices with platform links 2017-10-30 17:40:08 +01:00
Lubomir Rintel
c843fe4783 device: ignore enslavement to ovs-master
That one is special. All interfaces that are attached to OpenVSwitch
ports appear as slaves to that one even for our purposes we like to
pretend they're slaves to the actual OpenVSwitch bridges.
2017-10-30 17:40:08 +01:00
Lubomir Rintel
6af5030cf2 manager: add a method to get a particular device of given type
And also make the remove_device() method use it behind the scenes.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
d7f7725ae8 manager: always update the device when the plink comes and goes
For some software devices, the platform link appears only after they've been
realized. Update their properties and let them know that the link has changed
so they can eventually proceed with activation.

Also, reset the properties (udi, iface, driver) that are set from the platform
link when the link goes away. At that point they don't reflect reality anymore.

Removes some code duplication too.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
abaa852866 manager: don't assign a new link to a device of a different link type 2017-10-30 17:38:37 +01:00
Lubomir Rintel
097d41b8e6 manager: match device type when removing an ip interface
Otherwise we might end up removing a wrong device of a same name.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
67b265182f utils: don't assume a device with master won't have IP configuration
Whether the ip[46]-config exists is a better way, and we already check
that.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
4391ba82dd cli/trivial: drop default branch from some cases
This way not handling a known enum value will be caught by a compiler
warning.
2017-10-30 17:38:37 +01:00
Lubomir Rintel
acd814d50a generate-setting-docs: error out on missing documentation 2017-10-30 17:38:37 +01:00
Lubomir Rintel
c3080c79dc ip-tunnel: fix a typo 2017-10-30 17:38:37 +01:00
Thomas Haller
7f84f15e06 core: avoid coverity warning in device factory's _add_factory() (3)
2. NetworkManager-1.9.2/src/devices/nm-device-factory.c:312:
returned_pointer: Assigning value from "g_slist_append(list,
g_object_ref(factory))" to "list" here, but that stored value is
overwritten before it can be used.

Fixes: 98afc76184
Fixes: 449940af1d
2017-10-30 16:55:26 +01:00
Thomas Haller
d0d962d3d1 ifcfg: fix invalid free in parse_route_line()
Cannot free NM_PTRARRAY_EMPTY(). Discovered by coverity.

Fixes: 6d675a943b
2017-10-30 16:35:02 +01:00
Thomas Haller
62a57dab49 device: workaround coverity warning
Coverity doesn't like this. Refactor a bit, hoping that it fares better.

1. Defect type: ASSERT_SIDE_EFFECT
1. NetworkManager-1.9.2/src/devices/nm-device.c:10226: assignment_where_comparison_intended: Assignment "ip_ifindex = nm_device_get_ip_ifindex(self)" has a side effect. This code will work differently in a non-debug build.
2. NetworkManager-1.9.2/src/devices/nm-device.c:10226: remediation: Did you intend to use a comparison ("==") instead?
2017-10-30 16:28:44 +01:00
Thomas Haller
449940af1d core: avoid coverity warning in device factory's _add_factory() (2)
2. NetworkManager-1.9.2/src/devices/nm-device-factory.c:312:
returned_pointer: Assigning value from "g_slist_append(list,
g_object_ref(factory))" to "list" here, but that stored value is
overwritten before it can be used.

Fixes: 98afc76184
2017-10-30 16:28:44 +01:00
Lubomir Rintel
fb8ea059e6 cli: ignore PAGER when escalating privileges
nmcli typically doesn't run setuid, nor uses file capabilities or is labelled
for a SELinux domain trainsition upon execution.

But in case anyone has any reason to do that, we should follow good
security practices and not exec whatever is set in the environment.
2017-10-30 15:27:05 +01:00
Thomas Haller
98afc76184 core: avoid coverity warning in device factory's _add_factory()
2. NetworkManager-1.9.2/src/devices/nm-device-factory.c:312:
returned_pointer: Assigning value from "g_slist_append(list,
g_object_ref(factory))" to "list" here, but that stored value is
overwritten before it can be used.
2017-10-30 14:43:42 +01:00
Thomas Haller
66e1fdb7ec core: workaround coverity/compiler warning about tautological compare in nm_log_ptr()
Coverity claims:

1. NetworkManager-1.9.2/src/devices/team/nm-device-team.c:303:
unsigned_compare: This greater-than-or-equal-to-zero comparison of an
unsigned value is always true. "0U <= LOGL_DEBUG".
2017-10-30 14:41:41 +01:00
Thomas Haller
f088afe7e9 platform: remove unreachable code from nmp_cache_lookup_link_full()
If @ifname is set, we above lookup by name (nmp_lookup_init_link_by_ifname)
and set ifname to NULL. Hence, inside the loop, the check for ifname is
never true.
2017-10-30 14:34:04 +01:00
Thomas Haller
89a9908abf ifcfg-rh: avoid Unreachable coverity warning in reader
The loops never run more then once.

unreachable: Since the loop increment "iter++;" is unreachable, the loop
body will never execute more than once.
2017-10-30 14:31:29 +01:00
Thomas Haller
e3a582202f wifi: refactor nm_wifi_utils_level_to_quality() not to assert
Apparantly, the assert might fail (on i386?). Unclear why that would possibly
happen. Anyway, replace the assert.
2017-10-30 14:14:18 +01:00
Thomas Haller
8cbb6d9e86 wifi/tests: add test whether nm_wifi_utils_level_to_quality() is in range 2017-10-30 14:14:17 +01:00
Thomas Haller
6d63b6484f systemd: avoid coverity warning about Deadcode
Coverity is unhappy about comparing the literal LOG_DEBUG value:

1. Defect type: CONSTANT_EXPRESSION_RESULT
1. NetworkManager-1.9.2/src/systemd/src/libsystemd/sd-event/sd-event.c:2652:
result_independent_of_operands: "7 >= (_level & 7)" is always true regardless
of the values of its operands. This occurs as the logical first operand of "?:".

Work around by instead using an inline function.
2017-10-30 14:14:05 +01:00
Thomas Haller
287d1aee77 all: avoid coverity warnings about "Missing Initialization"
31. NetworkManager-1.9.2/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c:974:
uninit_use_in_call: Using uninitialized value "contents_rest" when
calling "__strtok_r_1c".

33. NetworkManager-1.9.2/src/nm-core-utils.c:1957:
uninit_use: Using uninitialized value "s".

148. NetworkManager-1.9.2/src/nm-core-utils.c:1924:
uninit_use_in_call: Using uninitialized value "s" when calling
"nm_strstrip_avoid_copy".
2017-10-30 14:13:15 +01:00
Thomas Haller
f3146de41b libnm: avoid unnecessary copies accessing NMIPRoute's attributes
We want to support large number of routes. Reduce the number
of copies, by adding internal accessor functions.

Also, work around a complaint from coverity:

  46. NetworkManager-1.9.2/libnm-core/nm-utils.c:1987:
  dereference: Dereferencing a null pointer "names".
2017-10-30 14:12:41 +01:00
Thomas Haller
4a8a5495a9 all: avoid coverity warnings about "Wrong Check of Return Value"
30. NetworkManager-1.9.2/src/settings/plugins/keyfile/nms-keyfile-writer.c:218:
check_return: Calling "g_mkdir_with_parents" without checking return
value (as is done elsewhere 4 out of 5
 times).

25. NetworkManager-1.9.2/src/platform/nm-linux-platform.c:3969:
check_return: Calling "_nl_send_nlmsg" without checking return value (as
is done elsewhere 4 out of 5 times).

34. NetworkManager-1.9.2/src/nm-core-utils.c:2843:
negative_returns: "fd2" is passed to a parameter that cannot be negative.

26. NetworkManager-1.9.2/src/devices/wwan/nm-modem-broadband.c:897:
check_return: Calling "nm_utils_parse_inaddr_bin" without checking
return value (as is done elsewhere 4 out of 5 times).

3. NetworkManager-1.9.2/src/devices/bluetooth/nm-bluez5-manager.c:386:
check_return: Calling "g_variant_lookup" without checking return value
(as is done elsewhere 79 out of 83 times).

16. NetworkManager-1.9.2/libnm-util/nm-setting.c:405:
check_return: Calling "nm_g_object_set_property" without checking return
value (as is done elsewhere 4 out of 5 times).
2017-10-30 14:10:56 +01:00
Thomas Haller
de65d3da91 shared: fix nm_steal_fd() for handling zero file descriptor
Zero is a valid file descriptor.

Fixes: 956b3e8bd5
2017-10-30 11:44:37 +01:00
Thomas Haller
31facf6fad cli: fix leak in _output_selection_parse()
Reported by coverity.

Fixes: fdd40b6a68
2017-10-30 11:18:25 +01:00
Murilo Opsfelder Araujo
fa61e78d80 contrib/fedora: Add mockbuild.sh
This script comes handy to build from git tree without having to
install build dependencies on the system, the actual build happens
inside mock environment.

https://github.com/NetworkManager/NetworkManager/pull/34
2017-10-30 11:04:20 +01:00
Thomas Haller
1ee6dea02f platform/tests: relax checking for signals in test-link-linux
# random seed: R02S4ca8cfc3dace399c0f15b42411e45d2e
  1..48
  # Start of link tests
  ok 1 /link/bogus
  PASS: src/platform/tests/test-link-linux 1 /link/bogus
  ok 2 /link/loopback
  PASS: src/platform/tests/test-link-linux 2 /link/loopback

  nmtst: initialize nmtst_get_rand() with NMTST_SEED_RAND=2697682474
  ok 3 /link/internal
  PASS: src/platform/tests/test-link-linux 3 /link/internal
  ok 4 /link/external
  PASS: src/platform/tests/test-link-linux 4 /link/external
  # Start of software tests
  ./tools/run-nm-test.sh: line 193:  7589 Trace/breakpoint trap   (core dumped) "${NMTST_DBUS_RUN_SESSION[@]}" "$TEST" "$@"
  NMPlatformSignalAssert: src/platform/tests/test-link.c:298, test_slave(): failure to accept signal 0 times: 'link-changed-changed' ifindex 9 (1 times received)
  ERROR: src/platform/tests/test-link-linux - too few tests run (expected 48, got 4)
  ERROR: src/platform/tests/test-link-linux - exited with status 133 (terminated by signal 5?)
2017-10-30 11:03:55 +01:00
juga0
3aba3e38c3 dhcp: add support for dhcpcanon client
https://github.com/NetworkManager/NetworkManager/pull/31
2017-10-30 10:43:10 +01:00
Beniamino Galvani
be320e2be7 ifcfg-rh: set team and bond master for any connection type
Now the plugin can only recognize team or bond slaves of type
ethernet, vlan or infiniband.

Instead, check the presence of a team or bond master for all types of
connection to allow arbitrary stacking of interfaces.
2017-10-27 22:52:15 +02:00
Beniamino Galvani
44ffa57c5d ifcfg-rh/trivial: move code 2017-10-27 22:51:50 +02:00
Beniamino Galvani
6d21711445 device: add proxy setting to generated connections
Add a proxy setting to generated connections because after commit
6f94b16507 ("libnm: fix nm_connection_diff() for settings without
properties") the matching between a connection having the setting and
another connection without it fails.  Before the commit, since no proxy
property is marked as inferrable, such comparison succeeded.
2017-10-27 20:31:01 +02:00
Thomas Haller
88c24ffc6a tests: increase timeout for arping test
I hit an assertion failure running with valgrind on a busy machine.
Maybe the timeout is just not long enough for every case.

Increase it.
2017-10-27 11:15:51 +02:00
Thomas Haller
e1dbe35acd systemd: merge branch systemd into master 2017-10-27 10:42:32 +02:00
Thomas Haller
268a9d971c systemd: update code from upstream (2017-10-27)
This is a direct dump from systemd git on 2017-10-27, git commit
f630daaae90b48606f857c2d35a68f82e4471c8e.

======

SYSTEMD_DIR=../systemd
COMMIT=f630daaae90b48606f857c2d35a68f82e4471c8e

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

git ls-files :/src/systemd/src/ \
             :/shared/nm-utils/siphash24.c \
             :/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_shared "src/basic/siphash24.c"
nm_copy_sd_shared "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_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"
2017-10-27 10:40:31 +02:00
Thomas Haller
ba13c02e48 ifcfg-rh: merge branch 'th/ifcfg-reread-add' 2017-10-27 10:28:55 +02:00
Thomas Haller
8a1d483ca8 ifcfg-rh: reread from disk when adding new connection 2017-10-27 10:28:41 +02:00