Commit Graph

15047 Commits

Author SHA1 Message Date
Jiří Klimeš
31ea5a99cb libnm: add NMSettingIPConfig 'dad-timeout' property
The property is used to control duplicate address detection:
 * -1 means default value
 * 0 means no DAD is performed
 * > 0 means timeout (in milliseconds) for arping responses

[bgalvani: moved setting from NMSettingIP4Config]
2016-01-20 11:53:47 +01:00
Beniamino Galvani
f607a16994 device/macvlan: implement dispose()
When the object gets disposed, parent must be unreferenced and signals
disconnected.

Fixes: 4de8851eca

https://bugzilla.redhat.com/show_bug.cgi?id=1299803
2016-01-20 11:41:59 +01:00
Mathieu Trudel-Lapierre
15ab4bda5b Set the default powersave value to enabled
This is an Ubuntu-specific patch to enable wireless powersave by default.

Should it not work for you for some reason, you can safely add:

powersave=0

to the section:
[802-11-wireless]

In the configuration file for your connection under
/etc/NetworkManager/system-connections/.
2016-01-20 11:27:47 +01:00
Thomas Haller
26721b8a88 core: use guint type for glib's source ids 2016-01-20 10:27:36 +01:00
Thomas Haller
a99a0d194d dhcp: clear watch_id in child-watch callback 2016-01-20 10:27:36 +01:00
Beniamino Galvani
701d98acc5 device: fix check on device state in carrier_changed()
The function can now be called on unrealized devices before the
initial unmanaged flags are set and for those devices
nm_device_get_managed() will return TRUE. Since we only accept
states > UNMANAGED, return early when the condition is not met.

Fixes the following failed assertion:

carrier_changed: assertion 'priv->state >= NM_DEVICE_STATE_UNAVAILABLE' failed

https://bugzilla.gnome.org/show_bug.cgi?id=760844
2016-01-20 09:53:10 +01:00
Thomas Haller
7231626d31 core: use NM_GOBJECT_PROPERTIES_DEFINE() 2016-01-19 21:20:36 +01:00
Thomas Haller
f427909bf8 shared: add NM_GOBJECT_PROPERTIES_DEFINE()
Helper macros to define GObject property enum,
the obj_properties array, and a _notify() function.

We should move away from invoking property changed notifications by
string, as we already do for signals. This macro simplifies the
implementation of establishes a pattern for naming and usage.
2016-01-19 21:20:36 +01:00
Lubomir Rintel
ecd729706e relese: fix NEWS formatting
The double spacing was probably a mistake. Also, there was an extra line break.
2016-01-19 15:10:35 +01:00
Lubomir Rintel
83d043b112 release: bump version to 1.1.90 (1.2-beta1) 2016-01-19 14:45:36 +01:00
Thomas Haller
76f90812f4 device: clear queued_state callback in dispose
dispose() calls _cleanup_generic_pre() which in turn already calls
nm_device_queued_state_clear(). So we would expect that at the end
of dispose() no queued-state is pending.

However, there there are crashes reports in queued_set_state() with the
device instance already destructed (rh#1270247). Add this check trying
to avoid the crash and closing in on the cause.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1180827
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1270247
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1298009
2016-01-19 13:00:20 +01:00
Christian Kirbach
9e0ca0058b po: update German (de) translation (bgo #760806)
https://bugzilla.gnome.org/show_bug.cgi?id=760806
2016-01-19 12:04:28 +01:00
Beniamino Galvani
9bc5600aa4 man: document the effects of supported signals 2016-01-19 11:48:49 +01:00
Thomas Haller
1e90ef2043 device: remove unrealized device without connections on idle handler
Emitting the NM_DEVICE_REMOVED signal can cause the destruction of the
device, thus it should be emitted on an idle handler.
2016-01-19 11:38:29 +01:00
Thomas Haller
b0fc51841a config: implement nm_config_change_flags_to_string() via NM_UTILS_FLAGS2STR_DEFINE() 2016-01-19 11:14:51 +01:00
Thomas Haller
a841d40039 callouts: always print the environment even if no scripts are present
Commit ac6522bbf1 moved logging of the environment
after the check for @error_message to avoid a crash. However, in case of no
scripts (request->scripts->len == 0) we still want to log the environment,
so move it back to where it was, but avoid the crash.
2016-01-19 11:01:33 +01:00
Lubomir Rintel
f7c76b372c device: don't remove a devices on connection availability checks
The availability checks are called from places that don't assume the device
will be removed mid-air. Call the removal routine only when we're the very
last thing that's being done.
2016-01-18 21:09:28 +01:00
Lubomir Rintel
ac6522bbf1 dispatcher: only dump environment when there's no error
(gdb) bt
  #0  0x00007f206bd1ec58 in handle_action (dbus_dispatcher=<optimized out>, context=0x7f2058003190, str_action=<optimized out>, connection_dict=0x7f205800bc40, connection_props=0x7f205800b900,
      device_props=0x7f205800b150, device_ip4_props=0x7f205800b120, device_ip6_props=0x7f205800b0f0, device_dhcp4_props=0x7f205800b0c0, device_dhcp6_props=0x7f205800b090, vpn_ip_iface=0x7f206c257990 "",
      vpn_ip4_props=0x7f205800b000, vpn_ip6_props=0x7f205800af90, request_debug=1, user_data=0x7f206c242980) at nm-dispatcher.c:722
  #1  0x00007f2068313dac in ffi_call_unix64 () at ../src/x86/unix64.S:76
  #2  0x00007f20683136d5 in ffi_call (cif=cif@entry=0x7ffdfde6d2f0, fn=<optimized out>, rvalue=0x7ffdfde6d260, avalue=avalue@entry=0x7ffdfde6d140) at ../src/x86/ffi64.c:522
  #3  0x00007f2069ba4678 in g_cclosure_marshal_generic (closure=0x7f206c23a9e0, return_gvalue=0x7ffdfde6d440, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>,
      marshal_data=0x0) at gclosure.c:1454
  #4  0x00007f2069ba3e38 in g_closure_invoke (closure=0x7f206c23a9e0, return_value=return_value@entry=0x7ffdfde6d440, n_param_values=14, param_values=param_values@entry=0x7f206c256d10,
      invocation_hint=invocation_hint@entry=0x7ffdfde6d490) at gclosure.c:768
  #5  0x00007f2069bb575d in signal_emit_unlocked_R (node=node@entry=0x7f206c2505a0, detail=detail@entry=0, instance=instance@entry=0x7f206c2442a0, emission_return=emission_return@entry=0x7ffdfde6d5d0,
      instance_and_params=instance_and_params@entry=0x7f206c256d10) at gsignal.c:3553
  #6  0x00007f2069bbc641 in g_signal_emitv (instance_and_params=instance_and_params@entry=0x7f206c256d10, signal_id=signal_id@entry=6, detail=detail@entry=0, return_value=return_value@entry=0x7ffdfde6d5d0)
      at gsignal.c:3048
  #7  0x00007f206bd21aa1 in _nmdbus_dispatcher_skeleton_handle_method_call (connection=<optimized out>, sender=<optimized out>, object_path=<optimized out>,
      interface_name=0x7f2058010b20 "org.freedesktop.nm_dispatcher", method_name=0x7f205800ab00 "Action", parameters=<optimized out>, invocation=0x7f2058003190, user_data=0x7f206c2442a0)
      at nmdbus-dispatcher.c:1066
  #8  0x00007f2069ec8ba6 in g_dbus_interface_method_dispatch_helper (invocation=0x7f2058003190, method_call_func=0x7f206bd218d0 <_nmdbus_dispatcher_skeleton_handle_method_call>, interface=0x7f206c2442a0)
      at gdbusinterfaceskeleton.c:609
  #9  skeleton_intercept_handle_method_call (connection=<optimized out>, sender=sender@entry=0x7f205800ee50 ":1.1007", object_path=object_path@entry=0x7f20580108d0 "/org/freedesktop/nm_dispatcher",
      interface_name=interface_name@entry=0x7f2058010b20 "org.freedesktop.nm_dispatcher", method_name=method_name@entry=0x7f205800ab00 "Action", parameters=parameters@entry=0x7f205800af00,
      invocation=invocation@entry=0x7f2058003190, user_data=user_data@entry=0x7f206c2442a0) at gdbusinterfaceskeleton.c:650
  #10 0x00007f2069eb0bc1 in call_in_idle_cb (user_data=0x7f2058003190) at gdbusconnection.c:4873
  #11 0x00007f20696a279a in g_main_dispatch (context=0x7f206c23f9a0) at gmain.c:3109
  #12 g_main_context_dispatch (context=context@entry=0x7f206c23f9a0) at gmain.c:3708
  #13 0x00007f20696a2ae8 in g_main_context_iterate (context=0x7f206c23f9a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3779
  #14 0x00007f20696a2dba in g_main_loop_run (loop=0x7f206c23fa80) at gmain.c:3973
  #15 0x00007f206bd1dcd4 in main (argc=1, argv=0x7ffdfde6da88) at nm-dispatcher.c:948
  (gdb) print error_message
  $4 = 0x7f206bd22980 "Missing or invalid required value path!"
  (gdb)
2016-01-18 19:12:17 +01:00
Thomas Haller
988ad91976 manager: refactor construction of manager singleton instance
nm_manager_setup() should only call g_object_new() and leave
most of the initialization to the GObject constructor.
2016-01-18 18:12:15 +01:00
Thomas Haller
be9ff2c51a manager: initilize NETWORKING_ENABLED as constructor paramter 2016-01-18 14:22:50 +01:00
Thomas Haller
c8e7957c63 core: add NMLOG macros to nm-manager.c 2016-01-18 14:04:56 +01:00
Thomas Haller
4b917123ef platform: use NM_UTILS_ENUM2STR_DEFINE() to implement to-string functions 2016-01-18 13:10:18 +01:00
Thomas Haller
1d15d8c3ef core: add nm_utils_enum2str() 2016-01-18 13:10:18 +01:00
Thomas Haller
94fabafc1a platform: use RT_SCOPE_* names in nm_platform_route_scope2str() 2016-01-18 13:10:18 +01:00
Thomas Haller
262ba62708 core/trivial: add code comment explaining route-handling and gateway 2016-01-18 13:10:18 +01:00
Lubomir Rintel
636380d19d release: update NEWS 2016-01-18 13:06:30 +01:00
Thomas Haller
320a3dee14 device: merge branch 'lr/default-unmanaged-bgo746566' (part 4)
Merge an early part of 'lr/default-unmanaged-bgo746566' to fix
issues related to realizing devices.

https://bugzilla.gnome.org/show_bug.cgi?id=746566
2016-01-18 11:56:26 +01:00
Thomas Haller
3d463e2f69 device: only set NMDevice as "real" at the end of nm_device_realize_finish()
Only set the device as "real" at the end of nm_device_realize_finish(),
not already during nm_device_realize_start()/realize_start_setup().
2016-01-17 22:40:09 +01:00
Thomas Haller
9c2266741b device: cleanup unrealized device without connection
During nm_device_unrealize(), the connection might still
have some connections that only get removed later. We must
garbage collect unrealized devices when they loose their
available-connections, not during unrealize.

Fixes: 436ec5b8e3
2016-01-17 22:40:09 +01:00
Thomas Haller
eab9cca87c device: refactor cp_connection* functions to use @self pointer 2016-01-17 22:40:09 +01:00
Thomas Haller
2292cb63bf core: always unrealize software devices when platform link disappears
We possibly need the unrealized device for connections that need
this. nm_device_unrealize() will check if there are still any
available-connections and possibly emit DEVICE_REMOVED signal.

Fixes: 7e5f27a21c
2016-01-17 22:40:04 +01:00
Thomas Haller
7830b79d50 device: minor logging changes to device creation 2016-01-17 22:38:28 +01:00
Thomas Haller
ae7e468630 trivial: fix whitespace 2016-01-17 22:38:28 +01:00
Thomas Haller
7a2a96f8ef platform/tests: add test for handling IPv4 zero gateways
Adding a route via iproute2 with explicit gateway 0.0.0.0
sets the route scope to GLOBAL, contrary to a on-link device-route
which has scope LINK.

Add a test adding two such routes.
2016-01-16 21:27:12 +01:00
Thomas Haller
4c79b605bc platform: implement nmp_object_is_visible() based on nmp_object_is_alive()
An object should only be visible if it is also alive.
Hence, refactor nmp_object_is_visible() to be reject
object that fail nmp_object_is_alive().
2016-01-16 13:43:23 +01:00
Thomas Haller
3294e06c28 platform: add "link" scope to nm_platform_route_scope2str() 2016-01-16 13:43:23 +01:00
Lubomir Rintel
c4bd0cc5cb device: always process hop limit and MTU from the RA
Apply MTU and hop limit when managed or other flag is set as well. This wasn't
the case for the first RA and the previous commit made it slightly worse by
always ignoring it.

Fixes: ad2584c375
2016-01-15 12:08:24 +01:00
Beniamino Galvani
5996565ca9 manager: retry virtual connections when a device is added or changes
When a new device gets added or when an existing one changes name,
virtual connections that refer to it as parent device may become
ready, so let's try to activate them.

Previously we tried to activate virtual connections only on startup
and, after commit d8e1590c50 ("manager: retry device creation for
connection that would use a newly created device"), also when a
connection was added/changed, but this doesn't cover the case in which
a parent device appears or changes name at runtime.

https://bugzilla.redhat.com/show_bug.cgi?id=1275875
2016-01-15 09:36:19 +01:00
Lubomir Rintel
ad2584c375 device: apply the iv6 configuration as soon as we get the RA
With DHCPv6 it might be quite some time (we may even time out) until we get all
the information to finish activation, but we already have the addresses and
routes.
2016-01-14 21:00:59 +01:00
Thomas Haller
3dc28b2b23 device: don't progress to ip-check if the DHCPv6 is still pending 2016-01-14 21:00:59 +01:00
Lubomir Rintel
ac457aa322 device: use the REMOVED only when unmanaging an active device while quitting
For the devices that are not active we still want to run the cleanup path.

Fixes: 3e2fce288a
2016-01-14 17:46:20 +01:00
Lubomir Rintel
3e2fce288a device: use the REMOVED reason when unmanaging the device while quitting
With the final removal the reason of NOW_UNMANAGED causes the cleanup on the
device to be run, which downs the device:

  #0  nm_platform_link_set_down (self=0x555555a29bb0, ifindex=1711) at platform/nm-platform.c:1111
  #1  0x00005555555d6ccf in nm_device_take_down (self=self@entry=0x555555c07c70, block=block@entry=1) at devices/nm-device.c:8175
  #2  0x00005555555df0c7 in _set_state_full (self=0x555555c07c70, state=NM_DEVICE_STATE_UNMANAGED, reason=NM_DEVICE_STATE_REASON_NOW_UNMANAGED, quitting=quitting@entry=0) at devices/nm-device.c:9825
  #3  0x00005555555dfa97 in nm_device_state_changed (self=<optimized out>, state=<optimized out>, reason=<optimized out>) at devices/nm-device.c:10084
  #4  0x00005555555e472c in nm_device_set_unmanaged_flags (self=<optimized out>, flag=flag@entry=NM_UNMANAGED_INTERNAL, unmanaged=unmanaged@entry=1, reason=reason@entry=NM_DEVICE_STATE_REASON_NOW_UNMANAGED)
      at devices/nm-device.c:8745
  #5  0x00005555555e54a9 in nm_device_set_unmanaged_quitting (self=<optimized out>) at devices/nm-device.c:8806
  #6  0x000055555565b1aa in remove_device (manager=manager@entry=0x555555a4a2c0, device=0x555555c07c70, quitting=quitting@entry=1, allow_unmanage=allow_unmanage@entry=1) at nm-manager.c:833
  #7  0x0000555555660b81 in nm_manager_stop (self=0x555555a4a2c0) at nm-manager.c:4389
  #8  0x00005555555b3f9b in main (argc=1, argv=0x7fffffffdba8) at main.c:493
2016-01-14 12:29:03 +01:00
Lubomir Rintel
cdc8a92b37 device: the unrealized devices can attempt to autoconnect 2016-01-13 18:10:25 +01:00
Lubomir Rintel
71f92bf72d device: trivial: streamline nm_device_autoconnect_allowed()
The function returns early when autoconnect is off, so there's no reason to
branch for that case below. The signal is only generated for autoconnect=true.
2016-01-13 18:10:17 +01:00
Lubomir Rintel
8b18c613ab manager: don't reject all internal activations on non-autoconnectable devices
When there's a slave that allows autoconnection and an unrealized master this
would cause the master activation to fail.

For the actual auto-activations the proper check is already done in NMPolicy's
auto_activate_device().
2016-01-13 17:21:31 +01:00
Lubomir Rintel
a6c8a45463 platform: fix a typo when comparing the peer addresses 2016-01-12 17:59:23 +01:00
Lubomir Rintel
5e8e81e2cf ip4-config: be a bit more tolerant when dumping the connection
This one single commit magically turns a nightmare into a summer breeze.
2016-01-12 17:59:23 +01:00
Thomas Haller
466a081c0f dispatcher: add assertion and code comment to complete_script() 2016-01-12 16:24:38 +01:00
Thomas Haller
2b54bd6a53 dispatcher: fix use-after-free in complete_script()
complete_request() possibly frees the request, making the @script and @request
a dangling pointer. We must not use those pointers, except a plain pointer-
comparison.
2016-01-12 16:24:38 +01:00
Lubomir Rintel
ddc6d97f00 dispatcher: only evaluate the number of the scripts if the request is still there
The request could have been completed by the call to complete_request() just above.
In that case we should just return instead of looking for nowait scripts to run.

  Core was generated by `/usr/libexec/nm-dispatcher'.
  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  0x00007f6c916ad0fb in complete_script (script=<error reading variable: value has been optimized out>, script=<error reading variable: value has been optimized out>) at nm-dispatcher.c:349
  349                     if (   script->request->num_scripts_nowait == 0
  (gdb) bt
  #0  0x00007f6c916ad0fb in complete_script (script=<error reading variable: value has been optimized out>, script=<error reading variable: value has been optimized out>) at nm-dispatcher.c:349
  #1  0x00007f6c8f02d484 in g_child_watch_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at gmain.c:5148
  #2  0x00007f6c8f03079a in g_main_context_dispatch (context=0x7f6c9358d9a0) at gmain.c:3109
  #3  0x00007f6c8f03079a in g_main_context_dispatch (context=context@entry=0x7f6c9358d9a0) at gmain.c:3708
  #4  0x00007f6c8f030ae8 in g_main_context_iterate (context=0x7f6c9358d9a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3779
  #5  0x00007f6c8f030dba in g_main_loop_run (loop=0x7f6c9358da80) at gmain.c:3973
  #6  0x00007f6c916abcd4 in main (argc=1, argv=0x7ffee4326768) at nm-dispatcher.c:935
  (gdb)

Fixes: e97a334e37

https://bugzilla.redhat.com/show_bug.cgi?id=1297826
2016-01-12 15:48:03 +01:00