Commit graph

9480 commits

Author SHA1 Message Date
Dan Winship
731ca771f8 dispatcher: only dispatch one request at a time (rh #1061212)
The dispatcher only runs one script at a time for any given request,
but would dispatch multiple requests in parallel. So if a device was
brought up and then back down quickly, it could end up dispatching the
"down" scripts while the "up" scripts were still running. Or if two
devices came up at the same time, two instances of the same "up"
script might run at the same time, which could cause problems if they
both tried to modify the same file.

Fix this by only dispatching the scripts for a single request at a
time.
2014-04-18 11:32:09 -04:00
Dan Winship
d9334503d7 dispatcher: bump script timeout up to 20 seconds (rh #1048345)
The dispatcher would kill scripts after 3 seconds, but on
heavily-loaded machines, that was sometimes too short even for simple
scripts. Bump the timeout up to 20 seconds instead (and change the
10-second quit-on-idle timer to not run when a script is running).

Also change the D-Bus call timeout in the daemon to 30 seconds, so
that it only triggers if something goes really wrong and the action
timeout fails.
2014-04-18 11:29:14 -04:00
Dan Winship
1796aae751 ifcfg-rh: don't write out IP config on Team connections 2014-04-17 13:00:41 -04:00
Dan Winship
6b2579fcdf keyfile: don't g_return_if_fail() on bad user input
return-if-fail is only for programmer errors
2014-04-17 13:00:37 -04:00
Dan Winship
8d9ddbee17 core: don't break Wake-on-LAN
https://bugzilla.gnome.org/show_bug.cgi?id=712745
https://bugzilla.redhat.com/show_bug.cgi?id=826652
https://bugzilla.redhat.com/show_bug.cgi?id=1025009
2014-04-17 12:48:38 -04:00
Dan Winship
1218b7e0c7 core: leave wake-on-LAN devices up over suspend/resume
Taking down a wake-on-LAN device before suspending will effectively
disable wake-on-LAN. So don't do that.

Based on a patch from Stanislaw Gruszka.

https://bugzilla.gnome.org/show_bug.cgi?id=712745
https://bugzilla.redhat.com/show_bug.cgi?id=826652
https://bugzilla.redhat.com/show_bug.cgi?id=1025009
2014-04-17 12:48:20 -04:00
Dan Winship
ddb17bef81 platform: add link_get_wake_on_lan() 2014-04-17 12:48:20 -04:00
Stanislaw Gruszka
79675fc1c9 wifi: add wifi_utils_get_wowlan() 2014-04-17 12:48:20 -04:00
Dan Winship
2b9b26d19b wifi: move wifi-utils into platform
https://bugzilla.gnome.org/show_bug.cgi?id=724365
2014-04-17 12:47:12 -04:00
Dan Winship
df435f4015 wifi: move wifi-utils into platform
Move wifi-utils into NMPlatform, and update callers to use the new
NMPlatform wrappers
2014-04-17 12:45:32 -04:00
Dan Winship
090a52217c wifi: (trivial) style / indent / whitespace fixes 2014-04-17 12:45:32 -04:00
Thomas Haller
ef770ca450 core: refactor NMManager by adding function for converting NMState to string
This will be especially nice, with lazy evaluation for NM logging.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-15 18:12:14 +02:00
Jiří Klimeš
b911d663d8 cli/bash-completion: escape spaces in profile names (rh #1041901) (bgo #709426)
We need to escape spaces and quotes in connection names, so that a connection
name containing spaces (quotes) is regarded as a single argument by bash.
See e.g. http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion

https://bugzilla.redhat.com/show_bug.cgi?id=1041901
https://bugzilla.gnome.org/show_bug.cgi?id=709426
2014-04-15 16:32:02 +02:00
Thomas Haller
05b5577815 platform: be more resilient in init_link against missing name of the rtnl link
Now we use init_link to print the rtnllink object, so be more
resilient to incompletly initilized objects and just set the
fields to NULL.

This fixes the (non harmful) warning:

  <debug> [1397563880.690580] [platform/nm-linux-platform.c:1950] link_change_flags(): link: change 3: flags set 'up' (1)
  init_link: assertion 'rtnl_link_get_name (rtnllink)' failed
  file platform/nm-linux-platform.c: line 1021 (to_string_link): should not be reached
  <error> [1397563880.690632] [platform/nm-linux-platform.c:1836] link_change(): Netlink error changing link (invalid link 0x7f88b5cf93c0): Unspecific failure

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-15 14:42:14 +02:00
Jiří Klimeš
c54faa4801 policy: check device state before changing it for secondaries (rh #1055099)
We have to check the previous base device state in process_secondaries() when
making a state change. The device might got disconnected in the meantime and
thus the transition from DISCONNECTED to ACTIVATED or FAILED would have been
incorrect.

Logs showing the problem:
NetworkManager[2655]: <info> (eth0): disconnecting for new activation request.
NetworkManager[2655]: <info> (eth0): device state change: secondaries -> deactivating (reason 'none') [90 110 0]
NetworkManager[2655]: <info> (eth0): device state change: deactivating -> disconnected (reason 'none') [110 30 0]
NetworkManager[2655]: <info> (eth0): deactivating device (reason 'none') [0]
NetworkManager[2655]: <info> (eth0): canceled DHCP transaction, DHCP client pid 11409
NetworkManager[2655]: <info> NetworkManager state is now DISCONNECTED
NetworkManager[2655]: (devices/nm-device.c:6591):nm_device_state_changed: runtime check failed: (priv->in_state_changed == FALSE)
NetworkManager[2655]: <info> (eth0): device state change: disconnected -> failed (reason 'secondary-connection-failed') [30 120 54]
NetworkManager[2655]: <warn> Activation (eth0) failed for connection '<unknown>'
NetworkManager[2655]: <warn> (eth0): add_pending_action (4): 'queued state change to disconnected' already added
NetworkManager[2655]: file devices/nm-device.c: line 7682 (nm_device_add_pending_action): should not be reached
NetworkManager[2655]: <info> Activation (eth0) starting connection 'ethernet-12'
NetworkManager[2655]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[2655]: <info> (eth0): device state change: failed -> disconnected (reason 'none') [120 30 0]
NetworkManager[2655]: <info> (eth0): deactivating device (reason 'none') [0]
NetworkManager[2655]: <warn> (eth0): remove_pending_action (2): 'queued state change to disconnected' never added
NetworkManager[2655]: file devices/nm-device.c: line 7733 (nm_device_remove_pending_action): should not be reached
NetworkManager[2655]: <info> VPN service 'openvpn' disappeared

https://bugzilla.redhat.com/show_bug.cgi?id=1055099
https://bugzilla.redhat.com/show_bug.cgi?id=1055101
2014-04-15 12:55:33 +02:00
Dan Winship
7955806a02 ppp-manager: don't use kernel pppoe (rh #1034860, rh #1061641)
The kernel PPPoE code disconnects when it receives a PADT frame, but
doesn't notify userland about it. So if the server sends a PPPoE PADT
without having sent the standard PPP LCP Termination request first,
then pppd (and thus NetworkManager) will not know that the connection
has been disconnected.

This should eventually be fixed in the kernel, but for now, work
around this by using the userland pppoe client rather than the kernel
code.
2014-04-14 10:11:05 -04:00
Dan Winship
ebc5ea0b80 ppp-manager: find pppd at build time, allow overriding
Add --with-pppd, just like --with-dnsmasq.

Also change "ppp" to "pppd" for clarity in a few places.
2014-04-14 10:11:05 -04:00
Dan Winship
3e58107fe0 ppp-manager: trivial: fix tabs/spaces 2014-04-14 10:11:05 -04:00
Dan Winship
b455d6996d ppp-manager: minor GObject boilerplate cleanups
Use constructed() rather than constructor(), and remove
priv->disposed, which isn't needed since dispose() was already
idempotent.
2014-04-14 10:11:05 -04:00
Jiří Klimeš
52dfc777bb Merge changes for connection matching on connection assumption (rh #1083196)
https://bugzilla.redhat.com/show_bug.cgi?id=1083196
2014-04-11 11:45:12 +02:00
Thomas Haller
542832eeb3 dhcp: merge branch 'th/bgo726278_div_refact_dhcp'
https://bugzilla.gnome.org/show_bug.cgi?id=726278

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:32:40 +02:00
Thomas Haller
0600fa0004 dhcp: refactor state to string conversion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:31:34 +02:00
Thomas Haller
2941109d3b dhcp: refactor using named defines for signal names instead of plain string
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:31:34 +02:00
Thomas Haller
325d89fc85 dhcp: refactor not to pass on NMSettingIP4Config objects
These settings are mostly unused. Do not pass them when starting the client,
instead only pass the argument that is actually used (dhcp_client_id).

This simplifies the code later, when we delay starting of DHCP6 clients --
because there is no need to clone the setting.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:31:34 +02:00
Thomas Haller
d14ffbdb9c dhcp: refactor dhcp code to use @dhcp_anycast_addr as #GByteArray type
At a later point, we will have to make a copy of @dhcp_anycast_addr to start
the client asynchronously. Although the length of the guint8 array *should*
always be 6 byte (being a MAC address), it's nicer to just pass on the
GByteArray instance instead, which knows how many byte are actually
set.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:30:57 +02:00
Thomas Haller
e3eb7605be core: merge branch 'th/bgo726525_sort_ip6_addresses'
https://bugzilla.gnome.org/show_bug.cgi?id=726525

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:17:53 +02:00
Thomas Haller
86f8066177 core: sort IPv6 addresses (add nm_ip6_config_addresses_sort())
Clients such as gnome-control-center or nm-applet show
at some places only one (IPv6) address. They most likely
just pick the first address from the list of addresses,
so we should order them.

Sorting has the advantage to make the order deterministic --
contrary to before where the order depended on run time conditions.

Note, that it might be desirable to show the address that the kernel
will use as source address for new connections. However, this depends
on routing and cannot be easily determined in general. Still, the
ordering tries to account for this and sorts the addresses accordingly.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:13:06 +02:00
Thomas Haller
65bc042e8f test: make use of new libnm-util/nm-test-utils.h header
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:09:10 +02:00
Thomas Haller
c65ed2dd6c libnm-util: add private header file nm-test-utils.h
This is intended to contain utility functions for tests. It will
be header only (containing inline functions).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:09:10 +02:00
Jiří Klimeš
59c0b7258c device-ethernet: add finalize() method 2014-04-11 10:06:16 +02:00
Jiří Klimeš
ff2b655691 tests: improve tests for nm_utils_match_connection() function
nm_utils_match_connection() is the main function used to match connections
when assuming connections on startup.
2014-04-11 10:06:16 +02:00
Jiří Klimeš
7251e4ea22 utils: allow matching connections with no MAC (missing HWADDR) (rh #1083196) 2014-04-11 10:06:08 +02:00
Jiří Klimeš
1301995202 device: add s390 values to connection in update_connection() (rh #1083196) 2014-04-11 09:59:48 +02:00
Jiří Klimeš
d12b2079bf utils: fix check_possible_match() function
We can only allow possible match if all the differences are exceptions.
Before, we accepted the connection if an exception was found, but it is wrong
because there may be another difference (that is fatal).
2014-04-11 09:59:12 +02:00
Jiří Klimeš
583eba3828 core: sort connections in descending timestamp order on take-over (rh #1067712)
When assuming the connections on restart we want to prefer more-recently-used
connections. That's why we have to sort connections according to timestamps in
descending order. That means connections used more recently (higher timestamp)
go before connections with lower timestamp.

https://bugzilla.redhat.com/show_bug.cgi?id=1067712
2014-04-11 08:58:28 +02:00
Dan Williams
2200687b0f libnm-glib: add documentation for NMRemoteSettings and connection addition 2014-04-10 10:51:29 -05:00
Thomas Haller
7ef622b447 Merge branch 'th/bgo726287_cleanup_read_sysctl'
https://bugzilla.gnome.org/show_bug.cgi?id=726287

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:36:42 +02:00
Thomas Haller
fe88dcd8fe platform: relax assert when checking pathnames for accessing sysctl
Asserting against "/.." is wrong, because one could rename a link to
"..em1", which is a valid ifname but would crash NetworkManager.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:20 +02:00
Thomas Haller
80d2d0ebe1 core: refactor nm_utils_ascii_str_to_int64()
No need to allocate a dynamic buffer in most of the cases.

And extended test cases to test with/without white space
and leading zeros.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:20 +02:00
Thomas Haller
cbee213781 core: use nm_platform_sysctl_get() to read wifi rfkill value
nm_platform_sysctl_get() adds logging and is our prefered way to
read sysfs.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:17 +02:00
Thomas Haller
bd08198064 core: use nm_platform_sysctl_get() to read infiniband mode
nm_platform_sysctl_get() adds logging and is our prefered way to
read sysfs.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:32:08 +02:00
Thomas Haller
8794d80509 core: use nm_platform_sysctl_get() to read sysctl in NMDeviceAdsl
nm_platform_sysctl_get() adds logging and is our prefered way to
read sysfs.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:30:52 +02:00
Thomas Haller
e739e01900 core: use ASSERT_VALID_PATH_COMPONENT
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Thomas Haller
ec7fc72e67 core: add ASSERT_VALID_PATH_COMPONENT function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Thomas Haller
0a9cfb48ff platform: add nm_platform_sysctl_get_int_checked() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Thomas Haller
2b3ef7664f core/trivial: clearify code comment on error for nm_utils_ascii_str_to_int64()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-10 16:27:02 +02:00
Dan Winship
efc72c996f ifcfg-rh: more fix build 2014-04-09 14:14:39 -04:00
Dan Williams
79a7e46bfd core: unregister removed devices from D-Bus
Instead of waiting until the device is disposed and dbus-glib does
it for us, remove them when the Manager is done with them.  If
something (like pending D-Bus calls) holds a reference to the device
when the Manager removes it, the device would previously still
service method calls until all references are released.  When
the device is removed, it's dead, and it shouldn't be exported
anymore.
2014-04-09 12:33:26 -05:00
Dan Winship
88fcf17ce0 ifcfg-rh: fix build
Rebasing the shvar changes to master added some new instances of
svNewFile() and svWriteFile() (in the aliases code) that needed to be
updated for the API changes.
2014-04-09 12:43:35 -04:00
Dan Winship
3cd17c8dc9 fixes/improvements to ifcfg-rh shvar code
https://bugzilla.gnome.org/show_bug.cgi?id=726653
2014-04-09 10:53:49 -04:00