Commit graph

12060 commits

Author SHA1 Message Date
Thomas Haller
35ea2389be team: fix potential crash if team binary doesn't exist
warning: Access to field 'message' results in a dereference of a null pointer (loaded from variable 'error')
   #   552|   			if (!teamd_kill (self, NULL, &error)) {
   #   553|-> 				_LOGW (LOGD_TEAM, "existing teamd config mismatch; failed to kill existing teamd: %s", error->message);
   #   554|   				*reason = NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED;

Fixes: 24a764e831
(cherry picked from commit 4fa01c7dc9)
2015-06-25 20:50:54 +02:00
Thomas Haller
9d0c9733a5 platform/coverity: add workarounds to suppress coverify warnings
(cherry picked from commit cd5b260545)
2015-06-25 20:50:54 +02:00
Thomas Haller
55d2489950 platform/test: minor test fix in "test-nmp-object.c"
(cherry picked from commit 0d8f4bbc45)
2015-06-25 20:50:54 +02:00
Thomas Haller
b0a33247c3 libnm-glib: avoid coverity warning
5. NetworkManager-1.0.3/libnm-glib/nm-remote-settings.c:493: var_compare_op: Comparing "error" to null implies that "error" might be null.
  8. NetworkManager-1.0.3/libnm-glib/nm-remote-settings.c:508: var_deref_op: Dereferencing null pointer "error".
  #   506|   			g_hash_table_remove (priv->pending, path);
  #   507|
  #   508|-> 		if (print_once && error->code == DBUS_GERROR_LIMITS_EXCEEDED) {
  #   509|   			g_printerr ("Warning: libnm-glib:%s(): a D-Bus limit exceeded: %s. The application might not work properly.\n"
  #   510|   			            "Consider increasing max_replies_per_connection limit in /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf "

(cherry picked from commit c157e3233d)
2015-06-25 20:50:54 +02:00
Beniamino Galvani
2a5eea7e76 device: fix handling of ignore-auto-dns and ignore-auto-routes
Since commit ab6548c621 ("device: better accept external IP
changes"), ipX_config_merge_and_apply() applies the configuration
static settings to an intermediate, initially empty configuration
(priv->con_ipX_config) instead of the composite configuration, and
thus the handling of ignore-auto-routes and ignore-auto-dns options
done in nm_ipX_config_merge_setting() has no effect.

Fix this by clearing the routes and the DNS information when needed
before merging static settings to the composite configuration.

Fixes: ab6548c621
(cherry picked from commit 79630c11e5)
2015-06-25 16:56:01 +02:00
Jiří Klimeš
bfab4d79e6 update NEWS file 2015-06-25 16:22:41 +02:00
Jiří Klimeš
0e00801196 cli: allow multiple devices for 'nmcli device disconnect/delete' (bgo #746097)
Allow disconnecting and deleting multiple interfaces at a time. It is much
more user friendly. TAB and bash completions are supported as well.

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

(cherry picked from commit b8a2f42a38)
2015-06-25 16:16:07 +02:00
Jiří Klimeš
a932c75015 cli: fix TAB completion for multiple connections in 'nmcli con down/delete'
(cherry picked from commit f8366c8b1c)
2015-06-25 16:16:07 +02:00
Jiří Klimeš
12a68a523b cli: don't return empty strings in nmc_string_to_arg_array()
and unquote strings in the array if required.

(cherry picked from commit 661ef3cd46)
2015-06-25 16:16:07 +02:00
Jiří Klimeš
a702b550f0 trivial: fix typos in NEWS 2015-06-25 09:56:53 +02:00
Jiří Klimeš
c05350be1a core: return more meaningful error when no device is found for activation
Example:
 $ nmcli con add type eth con-name profile ifname nosuch
 $ nmcli con up profile
or
 # ip link set eth0 down
 $ nmcli con add type eth con-name my-eth0 ifname eth0
 $ nmcli con up my-eth0

Related to: 6fc3736c7a

(cherry picked from commit 02989896af)
2015-06-25 09:43:47 +02:00
Lubomir Rintel
f423c9750e release: update NEWS
Let's just add there what do we have do far.
2015-06-25 09:40:07 +02:00
Lubomir Rintel
f245b49ae7 manager: reuse an active connection, if the same activation is pending
When a master & slaves get activated at the same time, they all submit separate
active connections which race for the device after activation.

(cherry picked from commit 7a066a35ad)
2015-06-24 18:27:06 +02:00
Lubomir Rintel
17353c1b0a active-connection: fail the activation if the master AC disconnect
The master may not have successfully activated even though we know the device
already.

(cherry picked from commit 4078834999)
2015-06-24 18:27:06 +02:00
Lubomir Rintel
8c1e848401 ifcfg-rh,vlan: fall back to VLAN_ID if vlan id can't be determined from DEVICE
If the device begins with "vlan", but a VLAN ID does not follow, the reader
would fail and ignore the actual VLAN_ID.

(cherry picked from commit f23a46d4b7)
2015-06-24 18:27:06 +02:00
Lubomir Rintel
525a2b1d95 manager: log the address, not the path of the master active connection
The connection might not be exported on D-Bus at that point yet and thus shows
up as (null) in logs, which is not too helpful.

(cherry picked from commit edbf766e96)
2015-06-24 18:27:06 +02:00
Thomas Haller
39da025990 default-route-manager: merge platform signal handler
(cherry picked from commit c4e6dd71a5)
2015-06-24 16:40:11 +02:00
Thomas Haller
fc92787573 device: merge device_ipx_changed() signal handler
(cherry picked from commit 7f8f0d04b0)
2015-06-24 16:40:11 +02:00
Thomas Haller
747af368da platform: pass object type with platform changed signal
(cherry picked from commit b88c309167)
2015-06-24 16:40:11 +02:00
Thomas Haller
2313c6c811 platform/trivial: fix name of enum value OBJECT_TYPE_UNKNOWN
Fixes: 518cf76de7
(cherry picked from commit 7bd3b0b304)
2015-06-24 16:40:11 +02:00
Thomas Haller
28c79aaa33 platform: declare NMPObjectType in nm-types.h
We want to use it outside of NMPlatform, but users should not be required
to include "nmp-object.h".

(cherry picked from commit b6061b3cd5)
2015-06-24 16:40:11 +02:00
Thomas Haller
3845b7706c platform: generate gtype for NMPObjectType enum
(cherry picked from commit 4010d779a7)
2015-06-24 16:40:11 +02:00
Thomas Haller
e7e2bdd8c8 core: delay handling of link-changed platform event in manager
Backtrace:

    NetworkManager[10972]: <debug> [1435142179.593334] [platform/nm-platform.c:2962] log_ip4_route(): signal: route   4 removed: 0.0.0.0/0 via 192.168.100.1 dev 85 metric 300 mss 0 src user scope global
    NetworkManager[10972]: <debug> [1435142179.593421] [platform/nm-platform.c:2944] log_link(): signal: link removed: 85: bond0 <DOWN;broadcast,multicast,master> mtu 1500 arp 1 bond* init addr 7A:AB:BE:0D:19:3D driver bond
    NetworkManager[10972]: <debug> [1435142179.593446] [nm-manager.c:779] remove_device(): (bond0): removing device (allow_unmanage 1, managed 1)
    NetworkManager[10972]: <debug> [1435142179.596995] [devices/nm-device.c:7232] nm_device_set_unmanaged(): [0x5555559d2a40] (bond0): now unmanaged
    NetworkManager[10972]: (devices/nm-device.c:8040):_set_state_full: runtime check failed: (priv->in_state_changed == FALSE)

    #0  0x00007ffff4a538c3 in g_logv () at /lib64/libglib-2.0.so.0
    #1  0x00007ffff4a53a3f in g_log () at /lib64/libglib-2.0.so.0
    #2  0x00007ffff4a53d56 in g_warn_message () at /lib64/libglib-2.0.so.0
    #3  0x00005555555b9dca in _set_state_full (self=0x5555559d2a40, state=NM_DEVICE_STATE_UNMANAGED, reason=NM_DEVICE_STATE_REASON_REMOVED, quitting=0) at devices/nm-device.c:8040
    #4  0x0000555555626d7b in remove_device (manager=0x5555559631e0, device=0x5555559d2a40, quitting=0, allow_unmanage=<optimized out>) at nm-manager.c:801
    #5  0x00007ffff28b7dac in ffi_call_unix64 () at /lib64/libffi.so.6
    #6  0x00007ffff28b76d5 in ffi_call () at /lib64/libffi.so.6
    #7  0x00007ffff4d4a628 in g_cclosure_marshal_generic () at /lib64/libgobject-2.0.so.0
    #8  0x00007ffff4d49de8 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
    #9  0x00007ffff4d5b70d in signal_emit_unlocked_R () at /lib64/libgobject-2.0.so.0
    #10 0x00007ffff4d63471 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
    #11 0x00007ffff4d63c78 in g_signal_emit_by_name () at /lib64/libgobject-2.0.so.0
    #12 0x00005555555ce4ea in do_emit_signal (platform=platform@entry=0x55555594c8b0, obj=0x555555a74c50, cache_op=NMP_CACHE_OPS_REMOVED, was_visible=<optimized out>, reason=reason@entry=
        NM_PLATFORM_REASON_INTERNAL) at platform/nm-linux-platform.c:1425
    #13 0x00005555555ce826 in cache_prune_candidates_prune (platform=platform@entry=0x55555594c8b0) at platform/nm-linux-platform.c:1704
    #14 0x00005555555d32d3 in do_request_link (platform=platform@entry=0x55555594c8b0, ifindex=ifindex@entry=85, name=name@entry=0x0, handle_delayed_action=handle_delayed_action@entry=0)
        at platform/nm-linux-platform.c:1951
    #15 0x00005555555d356b in delayed_action_handle_all (ifindex=85, platform=0x55555594c8b0) at platform/nm-linux-platform.c:1491
    #16 0x00005555555d356b in delayed_action_handle_all (platform=0x55555594c8b0) at platform/nm-linux-platform.c:1573
    #17 0x00005555555d356b in delayed_action_handle_all (platform=platform@entry=0x55555594c8b0, read_netlink=read_netlink@entry=0) at platform/nm-linux-platform.c:1588
    #18 0x00005555555d32e2 in do_request_link (platform=platform@entry=0x55555594c8b0, ifindex=ifindex@entry=7, name=name@entry=0x0, handle_delayed_action=handle_delayed_action@entry=1)
        at platform/nm-linux-platform.c:1954
    #19 0x00005555555d5177 in do_change_link (platform=platform@entry=0x55555594c8b0, nlo=nlo@entry=0x55555597f0f0, complete_from_cache=complete_from_cache@entry=1) at platform/nm-linux-platform.c:2753
    #20 0x00005555555d56b4 in link_enslave (platform=0x55555594c8b0, master=0, slave=7) at platform/nm-linux-platform.c:3141
    #21 0x00005555555976de in release_slave (device=0x5555559d2a40, slave=0x5555559c6be0, configure=<optimized out>) at devices/nm-device-bond.c:437
    #22 0x00005555555b7bc3 in nm_device_release_one_slave (self=self@entry=0x5555559d2a40, slave=0x5555559c6be0, configure=configure@entry=1, reason=reason@entry=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED)
        at devices/nm-device.c:1049
    #23 0x00005555555b7f0e in nm_device_master_release_slaves (self=self@entry=0x5555559d2a40) at devices/nm-device.c:1781
    #24 0x00005555555b9592 in nm_device_cleanup (self=0x5555559d2a40, reason=<optimized out>, deconfigure=1) at devices/nm-device.c:7752
    #25 0x00005555555ba161 in _set_state_full (self=self@entry=0x5555559d2a40, state=state@entry=NM_DEVICE_STATE_DISCONNECTED, reason=reason@entry=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, quitting=quitting@entry=0) at devices/nm-device.c:8128
    #26 0x00005555555bb297 in nm_device_state_changed (self=self@entry=0x5555559d2a40, state=state@entry=NM_DEVICE_STATE_DISCONNECTED, reason=reason@entry=NM_DEVICE_STATE_REASON_CONNECTION_REMOVED)
        at devices/nm-device.c:8319
    #27 0x00005555555bd9a5 in queued_set_state (user_data=<optimized out>) at devices/nm-device.c:8343
    #28 0x00007ffff4a4c79a in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
    #29 0x00007ffff4a4cae8 in g_main_context_iterate.isra.24 () at /lib64/libglib-2.0.so.0
    #30 0x00007ffff4a4cdba in g_main_loop_run () at /lib64/libglib-2.0.so.0
    #31 0x000055555559556f in main (argc=1, argv=0x7fffffffdb88) at main.c:518

(cherry picked from commit d48902e605)
2015-06-24 16:40:11 +02:00
Jiří Klimeš
bbc44c9d4d device: split IP config changes signal handling to IPv4 and IPv6
So that we don't process IPv4 changes for IPv6 and vice versa.

(cherry picked from commit 84b5fa21ed)
2015-06-24 15:30:19 +02:00
Jiří Klimeš
ee022bb688 device: split ensure_ipx_config() into IPv4 and IPv6 (bgo #751430)
Without that we can remove addresses from con-ip6-config due to external
changes *before* it is applied and thus manual IPv6 addresses are not applied
together with ipv6.method=auto.

Testcase:
$ nmcli con add type ether con-name AAA ifname eth0 autoconnect no
$ nmcli con mod AAA ipv4.addresses 1.1.1.1/24 ipv6.addresses 99::99/64
$ nmcli con up AAA

Fixes:Beaker:NetworkManager_Test37_run_once_new_connection
Fixes:Beaker:NetworkManager_Test84_ipv6_addresses_no_when_static_switch_asked

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

(cherry picked from commit 0a00eb67dd)
2015-06-24 15:30:12 +02:00
Jiří Klimeš
ab9d36c4c4 platform: (trivial) rename @managed to @unmanaged in link_get_unmanaged()
It returns unmanaged state (reads NM_UNMANAGED from udev), so "managed" was
very misleading.

Fixes: 85ee1f4a9c
(cherry picked from commit b77fba3939)
2015-06-24 15:16:47 +02:00
Lubomir Rintel
649f88de67 nmcli: don't hang activation of masters that progress beyond ip-config
Some master connetions are able to progress beyond activating/ip-config -- the
slaves might have appeared during the activation, or the connection doesn't
need slaves to obtain the configuration (it could be method=manual or shared).

(cherry picked from commit 2e958baceb)
2015-06-23 13:04:44 +02:00
Lubomir Rintel
9c83d18da6 manager: fix a typo when iterating possible master connection
Compare against the interface of the candidate master connection, not the slave
connection itself.

Fixes: 179d56c73c
(cherry picked from commit 33f954e251)
2015-06-22 18:50:46 +02:00
Lubomir Rintel
a4b063f8a9 libnm,dbus-helpers: include glib-compat for g_test_initialized()
(cherry picked from commit 4a4f703c94)
2015-06-22 17:57:03 +02:00
Dan Williams
cf6cd7f28e bridge/bond/team: device availability shouldn't depend on IFF_UP (bgo #746918)
The merge of lr/udev-unmanaged-fd731014 made all devices wait until
udev found them, but that makes these three device types fail activate
when created by NM itself.

Since their availability depended on IFF_UP, they could not be
activated (eg, 'nmcli con up team0') until they were IFF_UP.  But
when they are created by NM, although NM knows the ifindex the
platform ignores the interface until udev finds it.  Thus immediately
after creating the interface in _internal_activate_device() it
won't be known to the platform, so the nm_device_is_available()
check that controls whether the device moves to DISCONNECTED
will fail.  This prevents any activation and emits the message:

"Connection 'foo' is not available on the device %s at this time."

because the device is still in the UNAVAILABLE state.

danw asked why we care about IFF_UP for these devices, and I can't
remember why, and I don't think it makes sense to require now.

https://bugzilla.gnome.org/show_bug.cgi?id=746918
(cherry picked from commit 568a8d1da9)
2015-06-22 17:33:16 +02:00
Lubomir Rintel
2d4bd3818f platform: g_hash_table_add doesn't return a value before 2.40
(cherry picked from commit 14bfd55361)
2015-06-22 17:05:11 +02:00
Lubomir Rintel
55e4ab8dd6 glib-compat: include string.h
Needed for memmove().

(cherry picked from commit 2a6e8d9f3f)
2015-06-22 16:25:42 +02:00
Lubomir Rintel
a8aed11cf0 platform: fix build on 32-bit systems
The decimal literals are signed by default and these are too large to fit in a
signed 32-bit int.

(cherry picked from commit a1868dcfc3)
2015-06-22 13:15:05 +02:00
Thomas Haller
154e14a681 route-manager/build: fix out-of-tree builds for route-manager tests
Fixes: 0659a67c8f
(cherry picked from commit ea0d0b3086)
2015-06-22 13:15:05 +02:00
Thomas Haller
c14d41377a route-manager/test: fix missing initialization of temporary variables on stack
Up to now, this code was correct. Later we will add another field
to NMPlatformIP4Route which causes the test to operate on
uninitialized data.

Instead of explicitly initializing the field, just clear the whole
struct.

(cherry picked from commit 4bdd83127d)
2015-06-22 13:15:05 +02:00
Thomas Haller
8a17a5cf5b logging: define _LOGT() macro to check valid arguments
With NM_MORE_LOGGING disabled, we still want the compiler to evaluate
the argument list. By wrapping it in "if(FALSE)", we get compile time
checks, but the logging statement will be optimized out.

(cherry picked from commit cb6bafb9af)
2015-06-22 13:15:05 +02:00
Thomas Haller
fe721ce7e9 logging: use _nm_log() to avoid duplicate check of whether logging is enabled
Use _nm_log() in places that already checked whether logging
is enabled. No need to check again as done by nm_log().

(cherry picked from commit 4526b55a51)
2015-06-22 13:15:05 +02:00
Thomas Haller
8306500b2d make use of NM_MORE_ASSERTS, nm_assert() and NM_MORE_LOGGING
(cherry picked from commit 1eaddced10)
2015-06-22 13:15:05 +02:00
Thomas Haller
647bdb789e route-manager/test: add variations to test code
(cherry picked from commit bd0c44c1cf)
2015-06-22 13:15:05 +02:00
Thomas Haller
23d747c77e route-manager: refactor route-manager and route_sync()
Refactor the implementation of nm_route_manager_ip4_route_sync()
and nm_route_manager_ip6_route_sync().

- merge the implementations for IPv4 and IPv6.

- pre-sort the routes and iterate them in a way that we don't
  need to lookup a route in other lists. Do this by iterating
  two sorted lists at a time in a merge-sort way.
  The runtime complexity of sync is now O(n*ln(n)).

- previously, the algorithm would merge routes it found in platform
  to priv->ipx_routes. That was wrong, because then we loose the
  information which routes we wanted to configure internally and which
  are present externally.
  Instead, priv->ipx_routes now contains all the routes that were
  explicitly configured via sync(). Hence, it knows what should be
  configured (@ipx_routes) and can compare to what is configured
  (@plat_routes).

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

(cherry picked from commit 62c652c352)
2015-06-22 13:15:05 +02:00
Thomas Haller
33de86e08e util: add nm_utils_array_remove_at_indexes() function
(cherry picked from commit e65639bde9)
2015-06-22 13:15:05 +02:00
Thomas Haller
f28cda4d79 route-manager/test: fix usage of g_assert_expect_message()
Tests that use g_assert_expect_message() must initialize with
nmtst_init_assert_logging().

Otherwise, the caller can change the logging level via
  NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT
which breaks the assertions.

nmtst_init_assert_logging() allows the caller to turn of
checking of assertions via
  NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT,no-expect-message

Also, don't use g_message() in platform tests otherwise the test fail
because nmtst now sets g_log_set_always_fatal().

(cherry picked from commit 5fd3827e49)
2015-06-22 13:15:05 +02:00
Thomas Haller
0a0615fcbe route-manager: fix memleaks in nm_route_manager_ip4_route_sync()
Fixes: 4c3ba29b40
(cherry picked from commit 65729cb740)
2015-06-22 13:15:05 +02:00
Lubomir Rintel
7d1d5b160b route-manager: refactor: a readability improvement
(cherry picked from commit 6c5d93b847)
2015-06-22 13:15:05 +02:00
Thomas Haller
449a5c28ba route-manager: define singelton using NM_DEFINE_SINGLETON_GETTER()
Fixes: 874e4a7595
(cherry picked from commit f3ad60b434)
2015-06-22 13:15:05 +02:00
Lubomir Rintel
1602b038f3 route-manager: add test
(cherry picked from commit 0659a67c8f)
2015-06-22 13:15:05 +02:00
Lubomir Rintel
5eb314f39f route-manager: remember routes that should be active
Kernel likes to remove a route in case an equivalent route is added to another
interface. Avoid this situation and only apply the new routes in case the ones
that would cause a conflict are removed.

https://bugzilla.redhat.com/show_bug.cgi?id=1164441
https://bugzilla.gnome.org/show_bug.cgi?id=740064

(cherry picked from commit 4c3ba29b40)
2015-06-22 13:15:05 +02:00
Lubomir Rintel
3ed98d2a42 route-manager: normalize ipv6 route metrics during comparison
IPv6 metric of zero is equal to 1024.

(cherry picked from commit 7c52d094ed)
2015-06-22 13:15:05 +02:00
Lubomir Rintel
af36a41440 core: split route management code out from platform
Create a NMRouteManager singleton.

Refactor, no functional changes apart from change of log domain from
LOGD_PLATFORM to LOGD_CORE.

Subsequent commit will keep track of the conflicting routes, avoid overwriting
older ones with newer ones and apply the new ones when the old ones go away.

(cherry picked from commit 874e4a7595)
2015-06-22 13:15:05 +02:00
Thomas Haller
f45bd84433 device: backports for handling default-route of devices
(cherry picked from commit 0c136c1e2c)
(cherry picked from commit 2297333bb1)
2015-06-22 10:39:04 +02:00