Commit graph

674 commits

Author SHA1 Message Date
Thomas Haller
a771e2ffcf config: add macros NM_CONFIG_GET_DATA and NM_CONFIG_GET_DATA_ORIG
(cherry picked from commit 2c46003e99)
2015-07-03 09:24:04 +02:00
Jiří Klimeš
a4a92299fb 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

(cherry picked from commit a396ad2ac1)
2015-06-30 15:52:37 +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
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
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
747af368da platform: pass object type with platform changed signal
(cherry picked from commit b88c309167)
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
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
Thomas Haller
1fb84b1688 platform: refactor virtual methods for link objects in NMPlatform
Change nm_platform_link_get() to return the cached NMPlatformLink
instance. Now what all our implementations (fake and linux) have such a
cache internal object, let's just expose it directly.
Note that the lifetime of the exposed link object is possibly quite
short. A caller must copy the returned value if he intends to preserve
it for later.
Also add nm_platform_link_get_by_ifname() and modify nm_platform_link_get_by_address()
to return the instance.

Certain functions, such as nm_platform_link_get_name(),
nm_platform_link_get_ifindex(), etc. are solely implemented based
on looking at the returned NMPlatformLink object. No longer implement
them as virtual functions but instead implement them in the base class
(nm-platform.c).
This removes code and eliminates the redundancy of the exposed
NMPlatformLink instance and the nm_platform_link_get_*() accessors.
Thereby also fix a bug in NMFakePlatform that tracked the link address
in a separate "address" field, instead of using "link.addr". That was
a case where the redundancy actually led to a bug in fake platform.

Also remove some stub implementations in NMFakePlatform that just
bail out. Instead allow for a missing virtual functions and perform
the "default" action in the accessor.
An example for that is nm_platform_link_get_permanent_address().

(cherry picked from commit e8e455817b)
2015-06-22 09:56:06 +02:00
Thomas Haller
4e0af0aa52 platform: move nm_platform_query_devices() to nm-manager
nm_platform_query_devices() would raise an 'added' signal
for all its links. That is bad style because it could
confuse other listeners for platform signals which don't
expect such artificial change signals.

The public API of NMPlatform already gives NMManager the ability
to 'pull' all the links and iterate them itself.

Before, nm_platform_query_devices() would also initialize udev
devices, so there was a more compelling reason for this function.

(cherry picked from commit d7a312d17a)
2015-06-19 12:26:02 +02:00
Jiří Klimeš
5318aec2c2 core: activate slaves when master is activated (bgo #735052) (rh #1158529)
When a master connection is activated, check all its slaves and decide whether
they should be activated as well. This is done according to the
autoconnect-slaves property.

https://bugzilla.gnome.org/show_bug.cgi?id=735052
https://bugzilla.redhat.com/show_bug.cgi?id=1158529
(cherry picked from commit f4582d812c)
2015-06-19 12:18:52 +02:00
Dan Williams
dee7f89b62 core: check duplicate devices by interface name not UDI
We can't have devices with duplicate interface names so we might
as well use that for dupe checking instead of the (mostly useless)
UDI.

(cherry picked from commit 81db512997)
2015-06-17 18:52:42 +02:00
Dan Williams
ed0c228187 core: let plugins indicate links which should be ignored
Instead of hacky stuff in the Manager, let plugins themselves indicate
which links should be ignored (because they are really child links that
are controlled by a different device that the plugin handles).

(cherry picked from commit 8fa0f4690f)
2015-06-17 16:33:16 +02:00
Dan Williams
19aa9f1325 core: move virtual interface name handling into device plugins
Instead of having a bunch of logic in the Manager for determining the
VLAN and Infiniband virtual interface names, move the type-specific
logic into the plugins themselves.

(cherry picked from commit 179d56c73c)
2015-06-17 16:19:19 +02:00
Dan Williams
7473a248f4 trivial: move code
(cherry picked from commit 42b272b604)
2015-06-17 16:19:19 +02:00
Dan Williams
c174da8e13 core: let device plugins advertise supported link and setting types
Instead of looping over all plugins and asking each plugin whether it
can handle a link or a connection, have them advertise the link and
connection types they support, and use that when creating new devices.

(cherry picked from commit 71bde20c30)
2015-06-17 16:19:19 +02:00
Dan Williams
998f1cf732 vlan: don't fail if parent isn't found at construct time for existing devices
For existing devices, depending on the order that netlink sends interfaces to
us, the parent may be found after the VLAN interface and not be available when
the VLAN interface is constructed.  Instead of failing construction, when a
NMDeviceVlan has no parent keep it unavailable for activation.  Then have
the Manager notify existing devices when a new device is found, and let
NMDeviceVlan find the parent later and become available via that mechanism.

This doesn't apply to VLANs created by NM itself, because the kernel requires
a parent ifindex when creating a VLAN device.  Thus this fix only applies to
VLANs created outside NetworkManager, or existing when NM starts up.

(cherry picked from commit cd3df12c8f)
2015-06-17 16:11:56 +02:00
Dan Williams
41c92739bd platform: recognize Bluetooth BNEP devices via DEVTYPE
Instead of strcmp()-ing the device name, recognize these devices from their
driver's DEVTYPE.

(cherry picked from commit baee9080b7)
2015-06-17 16:11:55 +02:00
Thomas Haller
efec4b42e2 platform: refactor extraction of type-name for link
link_extract_type() would return the NMLinkType and a
@type_name string. If the type was unknown, this string
was rtnl_link_get_type() (IFLA_INFO_KIND).

Split up this behavior and treat those values independently.
link_extract_type() now only detects the NMLinkType. Most users
don't care about unknown types and can just use nm_link_type_to_string()
to get a string represenation.

Only nm_platform_link_get_type_name() (and NMDeviceGeneric:type_description)
cared about a more descriptive type. For that, modify link_get_type_name()
to return nm_link_type_to_string() if NMLinkType could be detected.
As fallback, return rtnl_link_get_type().

Also, rename the field NMPlatformLink:link_type to "kind". For now this
field is mostly unused. It will be used later when refactoring platform
caching.

(cherry picked from commit e2c742c77b)
2015-06-17 15:28:01 +02:00
Dan Williams
251193490a core: change activation failure messages to debug level
Otherwise any user with network control privileges can spam the logs.

(cherry picked from commit 8a5910c25c)
2015-06-17 15:28:01 +02:00
Dan Williams
285ee1fda2 platform: don't wait for udev before announcing links
(cherry picked from commit 388b7830f3)
2015-06-17 14:54:02 +02:00
Thomas Haller
3a30ccacc7 platform: add self argument to platform functions
Most nm_platform_*() functions operate on the platform
singleton nm_platform_get(). That made sense because the
NMPlatform instance was mainly to hook fake platform for
testing.

While the implicit argument saved some typing, I think explicit is
better. Especially, because NMPlatform could become a more usable
object then just a hook for testing.

With this change, NMPlatform instances can be used individually, not
only as a singleton instance.

Before this change, the constructor of NMLinuxPlatform could not
call any nm_platform_*() functions because the singleton was not
yet initialized. We could only instantiate an incomplete instance,
register it via nm_platform_setup(), and then complete initialization
via singleton->setup().
With this change, we can create and fully initialize NMPlatform instances
before/without setting them up them as singleton.

Also, currently there is no clear distinction between functions
that operate on the NMPlatform instance, and functions that can
be used stand-alone (e.g. nm_platform_ip4_address_to_string()).
The latter can not be mocked for testing. With this change, the
distinction becomes obvious. That is also useful because it becomes
clearer which functions make use of the platform cache and which not.

Inside nm-linux-platform.c, continue the pattern that the
self instance is named @platform. That makes sense because
its type is NMPlatform, and not NMLinuxPlatform what we
would expect from a paramter named @self.

This is a major diff that causes some pain when rebasing. Try
to rebase to the parent commit of this commit as a first step.
Then rebase on top of this commit using merge-strategy "ours".

(cherry picked from commit c6529a9d74)
2015-06-17 14:32:30 +02:00
Lubomir Rintel
117e62040d platform: give the platform an opportunity to override default-unmanaged
Some out of tree drivers add Ethernet devices that are supposed to be managed
by other their tooling, e.g. VirtualBox or VMWare.

Rather than hardcoding their drivers (at least VirtualBox doesn't even set a
"driver" property in sysfs) or hardcoding a logic that identifies such devices
let's just add a possibility to blacklist them in udev. This makes it possible
for whoever who ships such a driver to ship rules that prevent NetworkManager
from managing the device itself.

Furthermore it makes it possible for the user with special needs leverage the
flexibility of udev rules to override the defaults. In the end the user can
decide to let NetworkManager manage default-unmanaged interfaces such as VEth
or turn on default-unmanaged for devices on a particular bus.

An udev rule for VirtualBox would look like this:

  SUBSYSTEM=="net", ENV{INTERFACE}=="vboxnet[0-9]*", ENV{NM_UNMANAGED}="1"

(cherry picked from commit 85ee1f4a9c)
2015-06-17 13:39:42 +02:00
Thomas Haller
1d6eac884e manager: fix impl_manager_add_and_activate_connection()
Note also the comment "Just make sure we don't expect specific data being
in the connection till then (especially in validate_activation_request())."
in impl_manager_add_and_activate_connection().

Creating a connection caused a failed assertion:

  #0  0x00007ff8da3aa4e9 in g_logv (log_domain=0x7ff8ddf41036 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7ffff5a0a090) at gmessages.c:989
  #1  0x00007ff8da3aa63f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
  #2  0x00007ff8dde8c47a in nm_utils_get_ip_config_method (connection=0x7ff8def21d20, ip_setting_type=140706868598912) at NetworkManagerUtils.c:1252
  #3  0x00007ff8dde7d654 in validate_activation_request (self=0x7ff8def62150, context=0x7ff8deff5a00, connection=0x7ff8def21d20, device_path=0x7ff8def3f770 "/org/freedesktop/NetworkManager/Devices/2", out_device=0x7ffff5a0a370,
      out_vpn=0x7ffff5a0a36c, error=0x7ffff5a0a378) at nm-manager.c:3061
  #4  0x00007ff8dde7b7a2 in impl_manager_add_and_activate_connection (self=0x7ff8def62150, settings=0x7ff8def95460, device_path=0x7ff8def3f770 "/org/freedesktop/NetworkManager/Devices/2",
      specific_object_path=0x7ff8deeeced0 "/org/freedesktop/NetworkManager/AccessPoint/227", context=0x7ff8deff5a00) at nm-manager.c:3386
  #5  0x00007ff8dde6bd9c in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7ffff5a0a5f0, return_value=0x0, n_param_values=5, param_values=0x7ff8defb9d30, invocation_hint=0x0,
      marshal_data=0x7ff8dde7b660 <impl_manager_add_and_activate_connection>) at ./nm-manager-glue.h:189
  #6  0x00007ff8dc506885 in invoke_object_method (message=0x7ff8def99a00, connection=0x7ff8deeec940, method=0x7ff8de1a6878 <dbus_glib_nm_manager_methods+72>, object_info=0x7ff8de1a2e70 <dbus_glib_nm_manager_object_info>,
      object=0x7ff8def62150) at dbus-gobject.c:1899
  #7  object_registration_message (connection=0x7ff8deeec940, message=message@entry=0x7ff8def99a00, user_data=user_data@entry=0x7ff8def16da0) at dbus-gobject.c:2161
  #8  0x00007ff8dc2cef86 in _dbus_object_tree_dispatch_and_unlock (tree=0x7ff8deeec5e0, message=message@entry=0x7ff8def99a00, found_object=found_object@entry=0x7ffff5a0a814) at dbus-object-tree.c:862
  #9  0x00007ff8dc2c10d9 in dbus_connection_dispatch (connection=connection@entry=0x7ff8deeec940) at dbus-connection.c:4699
  #10 0x00007ff8dc503d65 in message_queue_dispatch (source=source@entry=0x7ff8deeee720, callback=<optimized out>, user_data=<optimized out>) at dbus-gmain.c:90
  #11 0x00007ff8da3a32a6 in g_main_dispatch (context=0x7ff8deebd320) at gmain.c:3066
  #12 g_main_context_dispatch (context=context@entry=0x7ff8deebd320) at gmain.c:3642
  #13 0x00007ff8da3a3628 in g_main_context_iterate (context=0x7ff8deebd320, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
  #14 0x00007ff8da3a3a3a in g_main_loop_run (loop=0x7ff8deebd3e0) at gmain.c:3907
  #15 0x00007ff8dddc0979 in main (argc=1, argv=0x7ffff5a0afd8) at main.c:442

Fixes: 477033b9ef
(cherry picked from commit b3944cfc71)
2015-06-16 14:25:35 +02:00
Lubomir Rintel
ade0c9e05e manager: don't attempt to activate ipv6.method=shared connections
It would be nice if we supported IPv6 network sharing (maybe RFC 7278?),
but we don't. Let's not attempt to bring it up, it would fail in stage3.

https://bugzilla.redhat.com/show_bug.cgi?id=1183015
(cherry picked from commit 477033b9ef)
2015-06-09 19:02:50 +02:00
Lubomir Rintel
33eca4b43c manager: remove a connection from device if we're activating it on another device
The connection now might be being activated on another device. Defer the
removal until we're sure the activation request will proceed and only add the
active connection afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 4cb97cf66f)
2015-06-09 18:57:12 +02:00
Lubomir Rintel
ad81316f18 manager: pick an available device if none was specified upon connection activation
This offloads some complexity from the client.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 6fc3736c7a)
2015-06-09 18:57:06 +02:00
Lubomir Rintel
f20910516d manager: reuse a device connection is active on if none was given upon activation
If a connection is already active let's keep it on the same device. This makes
it possible to reactivate a connection without client knowing which device is
it active on.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 6e94f302b2)
2015-06-09 18:56:57 +02:00
Thomas Haller
c593be5c49 core/logging: reduce info logging messages for devices
https://bugzilla.redhat.com/show_bug.cgi?id=1212196
(cherry picked from commit b91b8a035c)
2015-05-13 18:44:15 +02:00
Thomas Haller
d9f372f439 config: use flags argument in config-changed signal instead of a hash table
(cherry picked from commit 5b47462f32)
2015-05-05 16:51:54 +02:00
Thomas Haller
244cc0171a config: implement reloading of connectivity parameters
(cherry picked from commit b814c3122a)
2015-05-05 16:50:15 +02:00
Thomas Haller
b18de2309a connectivity: make NMConnectivity independent of NMConfig
(cherry picked from commit ac9dd4c832)
2015-05-05 16:50:10 +02:00
Thomas Haller
fc6f45e42a connectivity: refactor converting connectivity states to string
(cherry picked from commit 78e3b4866a)
2015-05-05 16:49:01 +02:00
Lubomir Rintel
89d96b87d8 manager: don't try to delete generated connection if it's already gone
Move the cleanup of the generated assumed connection to active connection
dispose. If the connection vanishes earlier (explicit deletion from client),
tear down the reference so that we don't try to remove it redundantly.

  NetworkManager[9221]: <info>  (eth2): device state change: deactivating -> disconnected (reason 'connection-removed') [110 30 38]
  NetworkManager[9221]: <info>  (eth2): deactivating device (reason 'connection-removed') [38]

  (NetworkManager:9221): GLib-GObject-WARNING **: g_object_weak_unref: couldn't find weak ref 0x496610(0x7c2ba0)

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x7ffff4d4f1a4 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffd860) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x00007ffff4a2cc60 in g_logv (log_domain=0x7ffff4d4f1a4 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffd860) at gmessages.c:1046
  #1  0x00007ffff4a2ce9f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
  #2  0x000000000049780b in nm_dbus_manager_unregister_object (self=0x7c2ba0 [NMDBusManager], object=0x80f3e0) at nm-dbus-manager.c:921
  #3  0x000000000047cc83 in nm_settings_connection_signal_remove (self=self@entry=0x80f3e0 [NMIfcfgConnection]) at settings/nm-settings-connection.c:1752
  #4  0x000000000047cd22 in do_delete (connection=0x80f3e0 [NMIfcfgConnection], callback=0x479d60 <ignore_cb>, user_data=0x0) at settings/nm-settings-connection.c:687
  #5  0x00000000004b1eb6 in active_connection_remove (self=self@entry=0x8701c0 [NMManager], active=active@entry=0x8b02f0) at nm-manager.c:292
  #6  0x00000000004b2174 in _active_connection_cleanup (user_data=<optimized out>) at nm-manager.c:316
  #7  0x00007ffff4a25aeb in g_main_context_dispatch (context=0x7be3a0) at gmain.c:3111
  #8  0x00007ffff4a25aeb in g_main_context_dispatch (context=context@entry=0x7be3a0) at gmain.c:3710
  #9  0x00007ffff4a25e88 in g_main_context_iterate (context=0x7be3a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #10 0x00007ffff4a261b2 in g_main_loop_run (loop=0x7be460) at gmain.c:3975
  #11 0x0000000000432f55 in main (argc=1, argv=0x7fffffffded8) at main.c:460
  (gdb)

https://bugzilla.gnome.org/show_bug.cgi?id=744812
(cherry picked from commit 74ed416d84)
2015-05-05 16:37:06 +02:00
Thomas Haller
2f53e0dfbc logging: always pass a static format string to logging functions
(cherry picked from commit bdec5e2e53)
2015-04-29 15:13:59 +02:00
Lubomir Rintel
df7f57c516 manager: don't re-assume generated connections
They're being torn down as their device is being deactivated.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
(cherry picked from commit d37f2280b7)
2015-02-24 18:55:03 +01:00
Thomas Haller
b6495b5000 device: eliminate direct calls to check_connection_available() in favor of nm_device_check_connection_available()
It was confusing to understand the difference between calling nm_device_connection_is_available()
and check_connection_available(), they behaved similar, but not really
the same. Especially nm_device_connection_is_available() would look
first into @available_connetions, and might call check_connection_available()
itself. Whereas @available_connetions was also populated by testing
check_connection_available(). This interrelation makes it hard to
understand when nm_device_connection_is_available() returned true.

Rename nm_device_connection_is_available() to nm_device_check_connection_available()
and remove all direct calls of check_connection_available() in favor of
the wrapper nm_device_check_connection_available().

Now we only call nm_device_check_connection_available() with different
parameters (@flags and @specific_object). We also have the additional
guarantee that specifying more @flags will widen the result and making
a connection "more" available, while specifying a @specific_object will
restrict it.

This also changes behavior in several cases. For example before
nm_device_connection_is_available() for user-requests would always
declare matching connections available on Wi-Fi devices (only)
regardless of the device state. Now the device state gets consistently
considered.

For default-unmanaged devices it also changes behavior in complicated
ways, because before we would put connections into @available_connetions
for every device-state, but nm_device_connection_is_available() had a
special over-ride only for unmanaged-state.

This also fixes a bug, that user can activate an unavailable Wi-Fi
device:
  nmcli radio wifi off
  nmcli connection up wlan0

(cherry picked from commit d80f1bf4f0)
2015-02-24 17:44:05 +01:00
Thomas Haller
ba52457f4d device: add flags to nm_device_is_available()
(cherry picked from commit 52dbb2398a)
2015-02-24 17:44:04 +01:00
Lubomir Rintel
e97a7613f9 manager: memleak: free the state file name on dispose
==12663== 45 bytes in 1 blocks are definitely lost in loss record 2,464 of 4,708
==12663==    at 0x4C29BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==12663==    by 0x7F4A6F5: g_malloc (gmem.c:97)
==12663==    by 0x7F6301E: g_strdup (gstrfuncs.c:356)
==12663==    by 0x4B8AE5: nm_manager_new (nm-manager.c:4793)
==12663==    by 0x432F3D: main (main.c:413)

(cherry picked from commit b1e6c9be91)
2015-02-18 18:16:31 +01:00
Dan Williams
5d6f3f5a11 core: fix WiMAX enabled state file property name
The manager wrote the user state to the state file in /var with
the key "WiMAXEnabled", but it was read from the state file as
"WimaxEnabled".  Clearly that's not going to work.

(cherry picked from commit b03a4c3f0a)
2015-02-02 09:51:18 +01:00
Jiří Klimeš
8a8af0a06a core: show better error for software device creation failures (rh #1182923)
https://bugzilla.redhat.com/show_bug.cgi?id=1182923

(cherry picked from commit 564b462dd3)
2015-01-20 14:21:34 +01:00
Dan Winship
57249a2d05 connectivity: simplify redundant code
Merge the two nm_connectivity_set_online() calls into one, after
tweaking NMConnectivity to always update its internal state before
alerting callers to the new state.

(cherry picked from commit 0997c4b245)
2015-01-15 10:25:49 -05:00
Dan Winship
e042bb09a5 connectivity: fix manager state during connectivity check (bgo #742823)
When a connection has finished activating, but we don't know yet that
we have full connectivity, then find_best_device_state() should return
CONNECTED_SITE, not CONNECTING. Fixes a bug where the manager state
would repeatedly switch between those two states.

(cherry picked from commit 5e182d5577)
2015-01-15 10:25:34 -05:00
Dan Winship
c5bca2fb90 core: allow connections to participate in NMManager:startup-complete
Add an NMSettingsConnection:ready property, which indicates if the
connection is ready to use. Add NMSettings:startup-complete, which is
TRUE when all connections are ready. Make NMManager:startup-complete
take NMSettings:startup-complete into account.

(cherry picked from commit b067ca7034)
2015-01-14 11:35:17 -05:00
Dan Williams
cd26f835f4 core: ensure manager state is updated on resume with connectivity checking enabled (rh #1162636) (bgo #742675)
On resume configured interfaces are unmanaged to clear their pre-resume
state and then re-managed.  Eventually the interface should end up moving
to the DISCONNECTED state, which should trigger an auto-activate check in
the Policy.  If connectivity checking was enabled, that auto-activate check
would fail because the Manager's state was still NM_STATE_ASLEEP.

This caused bridge slaves not to auto-activate on resume, which left bridges
without connectivity.

The manager never left NM_STATE_ASLEEP when connectivity checking was
enabled due to nm_manager_update_state() returning early when kicking
off a connectivity check.  Instead, the manager's state should always
be updated to accurately reflect the current state.

https://bugzilla.redhat.com/show_bug.cgi?id=1162636
https://bugzilla.gnome.org/show_bug.cgi?id=742675
(cherry picked from commit a687d1f9e0)
2015-01-12 09:58:19 -06:00
Dan Williams
a667241167 core: don't assume connection if device is EXTERNAL_DOWN (bgo #741694)
https://bugzilla.gnome.org/show_bug.cgi?id=741694#c1

Fixes:Beaker:NetworkManager_Test41_connection_removal_of_disapperared_device
(cherry picked from commit 12247a7271)
2014-12-18 11:11:27 -06:00
Dan Williams
680702133c trivial: add some debug messages on device destruction/removal
(cherry picked from commit 894ca75f3a)
2014-12-18 10:24:01 -06:00
Dan Williams
dc4d39a2d4 core: don't assume connections for INTERNAL or PARENT unmanaged devices
INTERNAL is actually a nop right now because the only thing that
sets it is suspend/resume, which is covered by the preceding
manager_sleeping() call.  But we may use this more in the future,
so add it while we're here.

Devices that are unmanaged because their parent is unmanaged
probably shouldn't assume connections either, per 4e105c50.
2014-12-16 16:11:02 -06:00
Lubomir Rintel
25387cd1ff device: set the master on device addition
Otherwise we won't notice the device is a slave on NM startup until someone
changes the link or tries to activate the device.
2014-12-11 11:49:29 +01:00
Dan Williams
3cf2fbbf47 core: fix leak of generated connection if device is active
Don't generate (and add to settings) a connection if we aren't going
to use it anyway.
2014-12-03 14:25:45 -06:00