Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
c5c612d711 route-manager: process platform events before syncing routes
Let's ensure we have a fresh platform cache before starting
to sync.
2015-07-01 16:02:10 +02:00
Thomas Haller
b79ade8975 route-manager: keep a reference of the platform instance
Soon we will subscribe to the platform instance for change signals.
If a singleton instance uses another singleton instance, it should
keep a reference to it, especially if it subscribes to a signal
(that will be disconnected on dispose()).
2015-07-01 16:02:09 +02:00
Thomas Haller
650fec81e2 libnm: add _nm_utils_ptrarray_find_binary_search() helper 2015-07-01 16:02:09 +02:00
Thomas Haller
42664e8752 platform: expose routes with "proto kernel" too
Also expose routes with "proto kernel". But add a flag
to nm_platform_ipx_route_get_all() to hide them by default.
2015-07-01 16:00:21 +02:00
Thomas Haller
d9dba6b662 platform: change NMPlatformGetRouteMode enum to NMPlatformGetRouteFlags flags
By having flags instead of an enum/mode, we can encode more combinations
of filtering the result.
2015-07-01 16:00:21 +02:00
Thomas Haller
85bf9ded2e platform/trivial: rename enum value NM_IP_CONFIG_SOURCE_RTPROT_KERNEL
This source type was platform internal up to now. Next we will expose it.
2015-07-01 16:00:21 +02:00
Thomas Haller
e7f3ccf7cd core: minor refactoring iterating and removing list of routes
The previous version causes an unsigned integer underflow. That
is not wrong, but still change it.

Also use g_array_remove_index_fast() because the list of routes
is unsorted anyway.
2015-07-01 15:47:29 +02:00
Thomas Haller
7594e31220 platform: track pref_src field of IPv4 routes 2015-07-01 15:47:28 +02:00
Thomas Haller
d0ed4de104 platform: fix setting valid lifetimes when constructing rtnl_addr object
build_rtnl_addr() has two parameters "lifetime" and "preferred". Both
count from *now*.

Fix nmp_object_to_nl() to properly set these timestamps. This bug had
not real consequences, because the only place where we use
nmp_object_to_nl() the arguments are 0.
2015-07-01 15:47:28 +02:00
Thomas Haller
626a85530e platform: move address lifetime utils function to nm-platform-utils.c 2015-07-01 15:47:28 +02:00
Thomas Haller
871c4d90c7 platform: fix initializing vlan_id for NMPlatformLink instance from libnl object
If the vlan-information is missing, we must consult the cache.

Fixes: 8a1f4beb65
2015-07-01 15:46:01 +02:00
Beniamino Galvani
e86f8354a7 device: restart ping process when it exits with an error
When ping is launched to check the connectivity to the gateway it may
return earlier than the given timeout in case of error. When this
happens we need to respawn it until the timeout is reached.

While at it, increase maximum timeout value to 600 seconds.

https://bugzilla.redhat.com/show_bug.cgi?id=1128581
2015-07-01 13:42:41 +02:00
Thomas Haller
e3348b46bd core: merge branch 'th/device-cleanup-bgo751733'
https://bugzilla.gnome.org/show_bug.cgi?id=751733
2015-07-01 11:39:46 +02:00
Thomas Haller
3b21738d9c device: fix cleanup DHCP instance when unmanaging device on removed platform link
When the platform link gets removed outside of NetworkManager, we would
unmanage the device first. By checking the device state reason
NM_DEVICE_STATE_REASON_REMOVED, we would then not deconfigure the
interface, as it is already gone.

This was not correct because we must at least stop the dhcp client.
Otherwise the dhclient process keeps running. That meant, if the device
reappeared later, we would start dhclient again. Then we would find the
PID of the still running instance in the pidfile and kill it only than.

Fix it by replacing the 'deconfigure' boolean by a tri-state
'cleanup_type'.
2015-07-01 11:16:35 +02:00
Thomas Haller
c61c71a168 dhcp: properly reap child process in nm_dhcp_client_stop_existing()
We kill the process based on the PID from the pidfile. This can be
our own child process so we must use nm_utils_kill_child_sync()
instead of nm_utils_kill_process_sync().
2015-06-30 16:15:17 +02:00
Thomas Haller
7c9eefa767 core: return parent pid from nm_utils_get_start_time_for_pid() 2015-06-30 16:15:17 +02:00
Jiří Klimeš
a396ad2ac1 core: do not manage devices that are not initialized by platform
Commit 388b7830f3 added NM_UNMANAGED_PLATFORM_INIT.

Fixes: 388b7830f3
Fixes:Beaker: NetworkManager_Test35_veth_goes_to_unmanaged_state
2015-06-30 15:49:06 +02:00
Thomas Haller
67057079a4 core: fix memleak in nm_utils_get_start_time_for_pid() and parsing start-time
It was leaking @tokens in case of error. Also the error checking of
start-time with strtoull() was erroneous.
2015-06-30 14:19:30 +02:00
Thomas Haller
4fbd42a035 dhcp: wait at most 2000 msec to kill existing dhcp process 2015-06-30 14:19:30 +02:00
Thomas Haller
7dc65df020 core: add @max_wait_msec argument to nm_utils_kill_process_sync() 2015-06-30 14:19:30 +02:00
Thomas Haller
69c98a336e core: fix nm_utils_kill_process_sync() not to hang for a zombie process
kill(pid,sig) can return success for zombie processes. This
caused nm_utils_kill_process_sync() to hang indefinitely.

Fix it by also checking the process state.
2015-06-30 14:19:15 +02:00
Thomas Haller
d90d5f5af0 device/trivial: refactor declaration of NMUnmanagedFlags enum flags 2015-06-29 15:02:43 +02:00
Lubomir Rintel
5dc23a28f8 ipx-config: fix test
Fixes: c942a8c35b
2015-06-28 21:34:47 +02:00
Lubomir Rintel
c942a8c35b ipx-config: correct nm_ipx_config_merge() setting priorities
ip[46]_config_merge_and_apply() do assume the settings that are merged later in
override the previously set ones and not the other way around. Otherwise e.g. a
gateway address from DHCP could override what's set in the connection.
2015-06-28 21:20:46 +02:00
Lubomir Rintel
4843e625a8 device: only reset ipx fields when there L3 configuration is present
Fixes: 79630c11e5
2015-06-28 20:10:58 +02:00
Thomas Haller
86520f5f60 setting: prettify logging hostname changes
Also, avoid passing NULL for "%s" format. While glibc is fine with
it, don't rely on that.

Fixes: 6dc35e66d4
2015-06-26 17:15:14 +02:00
Beniamino Galvani
7364d7f8f2 route-manager: fix return value of _vx_route_sync()
When the call to route_add() fails and the route is SOURCE_USER the
function must return an error.

Fixes: 62c652c352
2015-06-26 16:37:59 +02:00
Thomas Haller
f5cc6da8cf libnm: backport autoconnect-slaves symbols to libnm_1_0_4
https://bugzilla.gnome.org/show_bug.cgi?id=751535
2015-06-26 16:28:33 +02:00
Dan Winship
64ff214bb8 macros: add NM_BACKPORT_SYMBOL()
Add a macro to insert the necessary compiler/linker magic to add a
copy of an existing symbol to an older version. Also, update
check-exports.sh to be able to check for such symbols by listed them
commented-out in the appropriate section.

[thaller@redhat.com: patch modified]

Related: https://bugzilla.gnome.org/show_bug.cgi?id=742993
2015-06-26 16:28:33 +02:00
Lubomir Rintel
8a1f4beb65 linux-platform: don't try to read vlan id from netlink objects without type set
They just don't have the information.
2015-06-26 15:52:10 +02:00
Jiří Klimeš
348452f1e0 device: renew DHCP lease for active "ignore-carrier" devices on carrier-on (bgo #743368)
When carrier appears (e.g. the plug was re-inserted) we re-new addresses,
because the network could change.

https://bugzilla.gnome.org/show_bug.cgi?id=743368
2015-06-26 14:32:50 +02:00
Thomas Haller
7bf78d9511 config,dns: merge branch 'th/dns-update-on-sigusr1-rh1062301'
https://bugzilla.redhat.com/show_bug.cgi?id=1062301
2015-06-26 10:03:07 +02:00
Thomas Haller
68f1203c7c dns: rewrite "resolv.conf" on SIGHUP and SIGUSR1
Also rewrite resolv.conf if the configuration didn't actually change.
Especially, react on SIGUSR1 which does not reload the configuration but
only writes "resolv.conf".

https://bugzilla.redhat.com/show_bug.cgi?id=1062301
2015-06-25 22:02:18 +02:00
Thomas Haller
caed15e082 config: pass signals to nm_config_reload()
Also react on SIGUSR1 and SIGUSR2, beside SIGHUP.
Only for SIGHUP actually reload the configuration from
disc. For the other signals only emit a config-changed
signal.
2015-06-25 22:02:18 +02:00
Thomas Haller
c2754ede5c platform: fix inverting guint8 value inet6_addr_gen_mode_inv
Fixes: e8e455817b
2015-06-25 18:49:18 +02:00
Thomas Haller
4fa01c7dc9 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
2015-06-25 18:49:18 +02:00
Thomas Haller
cd5b260545 platform/coverity: add workarounds to suppress coverify warnings 2015-06-25 18:49:18 +02:00
Thomas Haller
0d8f4bbc45 platform/test: minor test fix in "test-nmp-object.c" 2015-06-25 18:17:19 +02:00
Thomas Haller
c157e3233d 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 "
2015-06-25 18:17:19 +02:00
Beniamino Galvani
79630c11e5 device: fix handling of ignore-auto-dns and ignore-auto-routes
Since commit ab6548c62134 ("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: ab6548c62134518ba2871306397e7fb9c84260ca
2015-06-25 16:53:42 +02:00
Jiří Klimeš
02989896af 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
2015-06-25 09:41:09 +02:00
Lubomir Rintel
44c36f1b16 merge: branch 'lr/master-activations'
https://bugzilla.gnome.org/show_bug.cgi?id=750595
2015-06-24 18:24:22 +02:00
Lubomir Rintel
7a066a35ad 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.
2015-06-24 18:20:47 +02:00
Lubomir Rintel
4078834999 active-connection: fail the activation if the master AC disconnect
The master may not have successfully activated even though we know the device
already.
2015-06-24 18:20:47 +02:00
Lubomir Rintel
f23a46d4b7 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.
2015-06-24 18:20:47 +02:00
Lubomir Rintel
edbf766e96 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.
2015-06-24 18:20:47 +02:00
Thomas Haller
c4e6dd71a5 default-route-manager: merge platform signal handler 2015-06-24 16:09:57 +02:00
Thomas Haller
7f8f0d04b0 device: merge device_ipx_changed() signal handler 2015-06-24 16:09:57 +02:00
Thomas Haller
b88c309167 platform: pass object type with platform changed signal 2015-06-24 16:09:57 +02:00
Thomas Haller
7bd3b0b304 platform/trivial: fix name of enum value OBJECT_TYPE_UNKNOWN
Fixes: 518cf76de7
2015-06-24 16:09:57 +02:00