Commit Graph

15047 Commits

Author SHA1 Message Date
Beniamino Galvani
81ea812362 manager: disconnect devices before unmanaging them on suspend/sleep
So that dispatcher scripts are run and other applications notified of
the change in connectivity.

https://bugzilla.redhat.com/show_bug.cgi?id=1330694
https://bugzilla.gnome.org/show_bug.cgi?id=748531
2016-05-13 14:40:54 +02:00
Beniamino Galvani
69ab984fed sleep-monitor: add functions for delaying the suspension
To allow the execution of asynchronous actions before the system is
suspended, add a mechanism for delaying the drop of inhibitor lock.
Clients can supend the suspension by calling inhibit_take() in their
handler for SLEEPING signal and use inhibit_release() later when they
are done.

We take a "delay" type inhibitor lock, which means that the system
will proceed anyway after a certain amount of time.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
2016-05-13 14:34:53 +02:00
Beniamino Galvani
31c2e0b57c device: add nm_device_set_unmanaged_by_flags_queue()
Useful for setting a device as unmanaged during another state change.
2016-05-13 14:34:53 +02:00
Thomas Haller
81499355b0 libnm: don't require initialized @out_encrypted argument in nm_utils_file_is_private_key()
No need to require the caller to initialize the optional out-argument.
Otherwise we get:

  (nm-connection-editor:2471): libnm-CRITICAL **: nm_utils_file_is_private_key: assertion 'out_encrypted == NULL || *out_encrypted == FALSE' failed

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

Fixes: 1c4f41c610
2016-05-13 14:26:32 +02:00
Beniamino Galvani
c094ee5f90 cli: also hide phase2 private key unless --show-secrets is passed
Fixes: ca6f1e7f25
2016-05-13 13:48:43 +02:00
Beniamino Galvani
ca6f1e7f25 cli: hide secret certificate blobs unless --show-secrets is passed
Client certificate and private key blobs should be considered private
as other secrets and not shown unless the --show-secrets option is
passed.

https://bugzilla.redhat.com/show_bug.cgi?id=1184530
2016-05-13 11:49:58 +02:00
Beniamino Galvani
8da3e658f7 dns: merge branch 'bg/dns-priority-bgo758772'
Introduce connection properties to change the priority of DNS entries.

https://bugzilla.gnome.org/show_bug.cgi?id=758772
2016-05-12 17:16:12 +02:00
Beniamino Galvani
570d73979b dns: use DNS priority from IP configuration
Use the ipvx.dns-priority when sorting the array of
configurations. When a negative value is found, all following entries
with a greater value are skipped.
2016-05-12 17:14:13 +02:00
Beniamino Galvani
77ded12da4 core: use default value for ipvx.dns-priority
Fall back to system default value for ipvx.dns-priority when it's zero
in the setting. For VPNs the default value is 50; for other
connections is 100, but it depends also on the content of
[connection*] sections in NetworkManager.conf.
2016-05-12 17:13:50 +02:00
Beniamino Galvani
bfabfb05ae core: add DNS priority to NMIP6Config 2016-05-12 17:13:50 +02:00
Beniamino Galvani
f09f5e1ec8 core: add DNS priority to NMIP4Config 2016-05-12 17:13:50 +02:00
Beniamino Galvani
d5855ed807 cli: add support for DNS priority 2016-05-12 17:13:50 +02:00
Beniamino Galvani
c5f17531b9 ifcfg-rh: add support for DNS priority 2016-05-12 17:13:50 +02:00
Beniamino Galvani
bdd0e7fec0 libnm-core: add dns-priority to NMSettingIPConfig 2016-05-12 17:13:50 +02:00
Beniamino Galvani
e53aa0dcff dns: pass config data array to plugins
Export NMDnsIPConfigData to DNS plugins and use it to pass additional
information about configurations.
2016-05-12 17:13:49 +02:00
Beniamino Galvani
8e6d442477 dns: use a single array for all configurations
In a following commit configurations will be ordered by their
priority; arrange them in a single array to make this simpler. Also,
instead of using g_object_set_data() to store metadata, introduce a
NMDnsIPConfigData structure.
2016-05-12 17:13:42 +02:00
Beniamino Galvani
16d5c8222b dns: don't use the global configuration to compute initial hash
If the initial hash includes the global configuration, every update
attempt will be skipped because the configuration never changes, and
resolv.conf will never be updated. Instead, use a NULL global
configuration to compute the hash and force an initial update.
2016-05-12 16:16:16 +02:00
Joel Holdsworth
8606060121 settings: Follow symbolic link when installing file monitor
https://bugzilla.gnome.org/show_bug.cgi?id=765645
2016-05-12 15:24:11 +02:00
Thomas Haller
d3be90e3e7 utils: fix memleak in nm_utils_read_link_absolute()
Fixes: c4b88bf23f
2016-05-12 15:24:11 +02:00
Thomas Haller
05010747b2 device: merge branch 'th/device-ip-config-on-link-up-rh1309899'
https://bugzilla.redhat.com/show_bug.cgi?id=1309899
2016-05-12 15:03:32 +02:00
Thomas Haller
02e84ba1e8 platform: ensure refetching routes when link goes down
It's not enough to consider IF_LOWER_UP flag. Instead,
the important flag is actually IF_UP.

Actually, I suspect that IF_LOWER_UP is not needed. But for
now leave it, in order not to break something.
2016-05-12 14:50:01 +02:00
Thomas Haller
35a7ea77b0 device: restore IP configuration when link comes up
This is especially important, because changing MTU takes the
link down for a moment. Taking a link down deletes IP routes and
IPv6 addresses. Thus, when the link comes up again, we must restore
them.

Otherwise, we don't call merge_and_apply() until the next DHCP lease
(or possibly never in case of static addressing).

https://bugzilla.redhat.com/show_bug.cgi?id=1309899
2016-05-12 14:50:01 +02:00
Thomas Haller
f50e39fc98 device: improve logging when changing IP configuration
nm_device_set_ip4_config() is called during cleanup and
from ip4_config_merge_and_apply(). The latter, has several
call sites.

It's not easy to track whether we called set_ip4_config with
or without commit (and if we call it without commit, we might
not see a logging line at all).

(same for nm_device_set_ip6_config()/ip6_config_merge_and_apply()).
2016-05-12 14:50:00 +02:00
Thomas Haller
ba90c9601c all: replace nm_unauto() by g_steal_pointer()
They do essentially the same.
2016-05-12 14:28:44 +02:00
Thomas Haller
5d1c4ca6c4 nm-glib: backport g_steal_pointer() from glib-2.44 2016-05-12 14:25:36 +02:00
Thomas Haller
2fa4c039bc merge: merge branch 'systemd' into master 2016-05-12 14:19:12 +02:00
Thomas Haller
b4564eaa66 systemd: update code from upstream
This is a direct dump from systemd git on 2016-05-12, git commit
42d35e1301928d08dd32ec51f0205252ae658ba5.

======

SYSTEMD_DIR=../systemd
COMMIT=42d35e1301928d08dd32ec51f0205252ae658ba5

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.h"
nm_copy_sd "src/basic/extract-word.c"
nm_copy_sd "src/basic/extract-word.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/signal-util.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.c"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-05-12 13:38:16 +02:00
Thomas Haller
1ec5e0b958 vpn: fix crash when VPN service times-out to start
Previously, we took a reference when scheduling _daemon_exec_timeout().
That was changed, but we still wrongly unref'ed the VPN connection
on timeout.

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

Fixes: 6c12f04e87
2016-05-12 13:01:23 +02:00
Thomas Haller
f1dc3e0cf8 wwan: use _LOG*() macros in "nm-modem-broadband.c"
Most logging lines already had a prefix like "(%s): ". With this change,
the prefix gets added automatically by the logging macro.

Other logging lines didn't have a prefix. But since we no longer log the
file location, it's not nice to see messages without prefix/location.
2016-05-12 12:45:14 +02:00
Thomas Haller
21b50c59ce wwan: inline disconnect_context_complete_if_cancelled() check
This function is only used once, and it actually is more confusing instead
of directly seeing in disconnect() what happens.
2016-05-12 12:12:54 +02:00
Thomas Haller
80a2b27da9 wwan: cancel asyncronous request in connect_context_clear()
priv->ctx->cancellable is passed to mm_sim_send_pin() to cancel the
operation.

We must cancel the operation when the context/response is no longer
relevant.

Especially, as we don't take a reference on @self during the asyncronous
request.
2016-05-12 12:12:54 +02:00
Thomas Haller
eede9a7c78 device: merge branch 'th/device-carrier-cap-bgo766179'
https://bugzilla.gnome.org/show_bug.cgi?id=766179
2016-05-12 11:22:27 +02:00
Thomas Haller
476d4f606a device: re-read carrier-detect capability after bringing device up
https://bugzilla.gnome.org/show_bug.cgi?id=766179
2016-05-12 11:22:06 +02:00
Thomas Haller
5693ba9843 device: fix multiple subscriptions to config-changed signal for ignore-carrier
We would subscribe to config-changed signal during object-realize,
however only unsubscribe during dispose().

Avoid multiple subscributions, and unsubscribe also when unrealizing
the device.

Also, always subscribe to the signal, even without capability
NM_DEVICE_CAP_CARRIER_DETECT. In the next commit, we will re-read
capabilities later on, so just always subscribe.
2016-05-12 11:22:06 +02:00
Thomas Haller
8f77ecad8a device: don't check_carrier() during bring_up()
Don't check the carrier state inside the virtual function bring_up().
2016-05-12 11:21:39 +02:00
Thomas Haller
f3df854333 device: add function to change device capabilites 2016-05-12 11:21:39 +02:00
Thomas Haller
5feea58223 device: use "bool" type for fields in NMDevice
Contrary to gboolean, bool is only one byte in size.
Due to alignment and ordering of the fields, this saves
merely 16 bytes per NMDevicePrivate struct (on x86_64),
still.

Also, bool is coerced by the compiler to be strictly FALSE or
TRUE -- contrary to gboolean, which can be any integer.
Thus, for bool type, "g_assert (NM_IN_SET (value, FALSE, TRUE));"
never fails. That is desirable as well.

While not a large win, it seems favorable to use bool type for
fields of a struct.
2016-05-12 11:21:39 +02:00
Thomas Haller
2a2db44bc2 config/tests: use absolute path for config test
Otherwise, calling
  ./src/tests/config/test-config
fails, and we must do:
  (cd ./src/tests/config && ./test-config)

We can avoid that easily.
2016-05-12 11:21:38 +02:00
Thomas Haller
b4095a5101 auth: embed private data NMAuthSubjectPrivate in NMAuthSubject struct
... and make the structs NMAuthSubject and NMAuthSubjectClass
opaque types.

I don't want to do this for all our types, only for a few prominent
GObject instances that we create a lot and that are really not expected
to ever be subclassed.

NMAuthSubject is such a candidate. It is really a very simple object
containing a few information bits about the authentication request.
It is not ever expected to be extended/inherited or become more
complex. No need to do a full-fledged private-data implementation.
2016-05-12 10:24:36 +02:00
Thomas Haller
7aac2c8a10 core: preserve const-ness in NM_IP4_CONFIG_GET_PRIVATE()
Usually, our _GET_PRIVATE() macros cast away the const-ness of
the self argument -- also because they cannot do any better in
plain (gcc) C.

Now it is possible to preserve const-ness, it seems more correct to do so.
After all, the const should also help us not modifying arguments that are
not intended to be modified.

Although, the more important use of const is to signal that a function
promises not to modify an argument, like in memcpy(void*,const void*)
it's immediately clear which is source and destination. In C, a const
is anyway not enforcable, but can show intent.

Likewise for NM_IP6_CONFIG_GET_PRIVATE() and NMIP6Config.
2016-05-12 10:20:22 +02:00
Thomas Haller
ee29228277 shared: add define _nm_unused for __attribute__((unused))
This is both supported by clang and gcc. Using it is nicer then
casting the (void), which requires an additional line of code.
2016-05-12 09:59:09 +02:00
Thomas Haller
6c2130382a session-monitor: remove wrapper functions to connect/disconnect signal
We don't add such wrappers anywhere else, and I think they are not
desired style.

Also, keep the signal-id in a "gulong session_changed_id", instead of
guint.
2016-05-12 09:50:21 +02:00
Thomas Haller
51f2572db5 core: make NMIP4Config struct private and directly embed private data
With GObject, the object structure and class structure must be public
to be able to inherit from the type. As NMIP4Config is not inherited
(final), we don't need that and we don't expect ever needing that for
this type.

Already now, we want to have the priv pointer directly accessible via
self->priv. The main reason is improved debugging, another reason
is faster lookup.

Now with the struct private, we can directly embed the private data
inside NMIP4Config. This avoids storing the private data outside separately
inside the GObject which involves a small overhead.
It becomes more attractive to do so, as every NMDevice has a multitude of
these NMIP4Config instances.

And likewise for NMIP6Config.
2016-05-11 13:25:15 +02:00
Thomas Haller
2e710c2e10 sd/dhcp: workaround multiple "Domain Name" (option 15) entries
https://mail.gnome.org/archives/networkmanager-list/2005-April/msg00022.html
https://tools.ietf.org/html/rfc2132#section-3.17
https://bugzilla.gnome.org/show_bug.cgi?id=766191
2016-05-11 11:14:28 +02:00
Mingye Wang (Arthur2e5)
e27b571081 po: update Simplified Chinese (zh_CN) translation (bgo #765787)
https://bugzilla.gnome.org/show_bug.cgi?id=765787
2016-05-10 19:41:43 +02:00
Rafael Fontenelle
2347ec762f po: update Brazilian Portuguese (pt_BR) translation (bgo#765974)
https://bugzilla.gnome.org/show_bug.cgi?id=765974
2016-05-10 19:12:36 +02:00
Thomas Haller
37827fcafa wwan: return from send_pin_ready() when operation cancelled and fix leak
We call the asynchrnous function mm_sim_send_pin() without taking a
reference on @self. During send_pin_ready() we must first check whether
the request was cancelled because self might be a dangling pointer at
this point.

Also, avoid leaking @error if the ctx is no longer valid.

Fixes: aa0b379699
2016-05-10 19:04:57 +02:00
Beniamino Galvani
0b66eb298e device: remove pending dhcp actions also in IP_DONE state
When the IP status is IP_DONE and a DHCP transaction succeeds the
'dhcp4' and 'dhcp6' pending actions must be removed. Without this, a
temporary link loss just after the activation would cause a DHCP
restart and those actions would remain set, blocking the startup.

https://bugzilla.redhat.com/show_bug.cgi?id=1330893
2016-05-10 17:56:02 +02:00
Lubomir Rintel
702b74c9f7 modem: clear the connection context on device disconnection
If the device is disconnected, we should also disconnect the modem; and
while we disconnect the device we should clean the connection context.
Otherwise the modem will surprise us by emitting PREPARED signal when
the device is no longer PREPARED:

  NetworkManager[28469]: <info>  [1462383185.8714] (ttyACM1): modem state changed, 'disconnecting' --> 'registered' (reason: user-requested)
  NetworkManager[28469]: <info>  [1462383185.8715] (ttyACM1): modem state changed, 'registered' --> 'connecting' (reason: user-requested)
  NetworkManager[28469]: <info>  [1462383185.8716] device (ttyACM1): state change: deactivating -> disconnected (reason 'connection-removed') [110 30 38]
  NetworkManager[28469]: <info>  [1462383185.8759] (ttyACM1): modem state changed, 'connecting' --> 'disconnecting' (reason: user-requested)
  NetworkManager[28469]: <warn>  [1462383185.8937] (ttyACM1): failed to connect modem: Dial operation has been cancelled

  (NetworkManager:28469): NetworkManager-wwan-CRITICAL **: modem_prepare_result: assertion 'state == NM_DEVICE_STATE_PREPARE' failed

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x7fffea31bc47 "NetworkManager-wwan", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffcfc0) at gmessages.c:1086
  1086              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x00007ffff4ebe643 in g_logv (log_domain=0x7fffea31bc47 "NetworkManager-wwan", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffcfc0) at gmessages.c:1086
  #1  0x00007ffff4ebe7bf in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1119
  Python Exception <type 'exceptions.RuntimeError'> Cannot locate object file for block.:
  #2  0x00007ffff2ce6dac in ffi_call_unix64#3  0x00007ffff2ce66d5 in ffi_call (cif=cif@entry=0x7fffffffd300, fn=<optimized out>, rvalue=0x7fffffffd230, avalue=avalue@entry=0x7fffffffd1d0) at ../src/x86/ffi64.c:522
  #4  0x00007ffff51b55a5 in g_cclosure_marshal_generic_va (closure=0x555555b30cb0, return_value=0x0, instance=0x555555a8d360, args_list=<optimized out>, marshal_data=0x0, n_params=2, param_types=0x555555c2bb60) at gclosure.c:1600
  #5  0x00007ffff51b4b37 in _g_closure_invoke_va (closure=closure@entry=0x555555b30cb0, return_value=return_value@entry=0x0, instance=instance@entry=0x555555a8d360, args=args@entry=0x7fffffffd5b8, n_params=2, param_types=0x555555c2bb60) at gclosure.c:864
  #6  0x00007ffff51ce117 in g_signal_emit_valist (instance=instance@entry=0x555555a8d360, signal_id=signal_id@entry=168, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffd5b8) at gsignal.c:3292
  #7  0x00007ffff51cf2e8 in g_signal_emit_by_name (instance=instance@entry=0x555555a8d360, detailed_signal=detailed_signal@entry=0x7fffea074cdd "prepare-result") at gsignal.c:3479
  #8  0x00007fffea011fd3 in connect_context_step (self=self@entry=0x555555a8d360 [NMModemBroadband]) at nm-modem-broadband.c:529
  #9  0x00007fffea01264d in connect_ready (simple_iface=<optimized out>, res=<optimized out>, self=0x555555a8d360 [NMModemBroadband]) at nm-modem-broadband.c:378
  #10 0x00007ffff546a297 in g_simple_async_result_complete (simple=0x7fffe00104e0 [GSimpleAsyncResult]) at gsimpleasyncresult.c:801
  #11 0x00007fffe9d82fec in connect_context_complete_and_free (ctx=ctx@entry=0x555555c52f60) at mm-modem-simple.c:93
  #12 0x00007fffe9d83155 in simple_connect_ready (self=0x7fffdc00b9f0 [MMModemSimple], res=0x7fffdc004410, ctx=0x555555c52f60) at mm-modem-simple.c:159
  #13 0x00007ffff547af93 in g_task_return_now (task=0x7fffdc004410 [GTask]) at gtask.c:1106
  #14 0x00007ffff547b62e in g_task_return (task=0x7fffdc004410 [GTask], type=<optimized out>) at gtask.c:1164
  #15 0x00007ffff54d4239 in reply_cb (connection=<optimized out>, res=<optimized out>, user_data=0x7fffdc004410) at gdbusproxy.c:2570
  #16 0x00007ffff547af93 in g_task_return_now (task=0x7fffdc004340 [GTask]) at gtask.c:1106
  #17 0x00007ffff547b62e in g_task_return (task=0x7fffdc004340 [GTask], type=<optimized out>) at gtask.c:1164
  #18 0x00007ffff54c8c9f in g_dbus_connection_call_done (source=<optimized out>, result=0x555555a60920, user_data=0x7fffdc004340) at gdbusconnection.c:5702
  #19 0x00007ffff547af93 in g_task_return_now (task=0x555555a60920 [GTask]) at gtask.c:1106
  #20 0x00007ffff547afc9 in complete_in_idle_cb (task=0x555555a60920) at gtask.c:1120
  #21 0x00007ffff4eb7d7a in g_main_context_dispatch (context=0x555555a4a000) at gmain.c:3152
  #22 0x00007ffff4eb7d7a in g_main_context_dispatch (context=context@entry=0x555555a4a000) at gmain.c:3767
  #23 0x00007ffff4eb80b8 in g_main_context_iterate (context=0x555555a4a000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838
  #24 0x00007ffff4eb838a in g_main_loop_run (loop=0x555555a48780) at gmain.c:4032
  #25 0x00005555555aebf2 in main (argc=1, argv=0x7fffffffdc48) at main.c:477
  (gdb)
2016-05-10 16:52:59 +02:00
Lubomir Rintel
aa0b379699 modem-broadband: ignore late callbacks
If libmm invokes callbacks after the connect context has been disposed
we should just ignore them. Fixes crash on dereferencing already freed
connect context (due to explicit disconnection while the modem is
connecting):

  NetworkManager[29074]: <info>  [1462383917.8718] (ttyACM1): modem state changed, 'disconnecting' --> 'registered' (reason: user-requested)
  NetworkManager[29074]: <info>  [1462383917.8719] (ttyACM1): modem state changed, 'registered' --> 'connecting' (reason: user-requested)
  NetworkManager[29074]: <info>  [1462383917.8720] device (ttyACM1): state change: deactivating -> disconnected (reason 'connection-removed') [110 30 38]
  NetworkManager[29074]: <info>  [1462383917.8758] (ttyACM1): modem state changed, 'connecting' --> 'disconnecting' (reason: user-requested)
  NetworkManager[29074]: <warn>  [1462383917.8909] (ttyACM1): failed to connect modem: Dial operation has been cancelled

  (NetworkManager:29074): NetworkManager-wwan-CRITICAL **: modem_prepare_result: assertion 'state == NM_DEVICE_STATE_PREPARE' failed
  NetworkManager[29074]: <info>  [1462383917.8912] (ttyACM1): modem state changed, 'disconnecting' --> 'registered' (reason: user-requested)
  NetworkManager[29074]: <info>  [1462383917.8913] (ttyACM1): modem state changed, 'registered' --> 'connecting' (reason: user-requested)
  NetworkManager[29074]: <info>  [1462383917.9693] (ttyACM1): modem state changed, 'connecting' --> 'registered' (reason: user-requested)

  Program received signal SIGSEGV, Segmentation fault.
  connect_ready (simple_iface=<optimized out>, res=0x7fffe0009200, self=0x555555a8d670 [NMModemBroadband]) at nm-modem-broadband.c:329
  329                     if (!ctx->first_error) {
  (gdb) bt
  #0  0x00007fffea01272a in connect_ready (simple_iface=<optimized out>, res=0x7fffe0009200, self=0x555555a8d670 [NMModemBroadband]) at nm-modem-broadband.c:329
  #1  0x00007ffff546a297 in g_simple_async_result_complete (simple=0x7fffe0009200 [GSimpleAsyncResult]) at gsimpleasyncresult.c:801
  #2  0x00007fffe9d82fec in connect_context_complete_and_free (ctx=ctx@entry=0x7fffdc00c550) at mm-modem-simple.c:93
  #3  0x00007fffe9d83155 in simple_connect_ready (self=0x7fffdc00c960 [MMModemSimple], res=0x555555a7c2b0, ctx=0x7fffdc00c550) at mm-modem-simple.c:159
  #4  0x00007ffff547af93 in g_task_return_now (task=0x555555a7c2b0 [GTask]) at gtask.c:1106
  #5  0x00007ffff547b62e in g_task_return (task=0x555555a7c2b0 [GTask], type=<optimized out>) at gtask.c:1164
  #6  0x00007ffff54d4239 in reply_cb (connection=<optimized out>, res=<optimized out>, user_data=0x555555a7c2b0) at gdbusproxy.c:2570
  #7  0x00007ffff547af93 in g_task_return_now (task=0x7fffdc004470 [GTask]) at gtask.c:1106
  #8  0x00007ffff547b62e in g_task_return (task=0x7fffdc004470 [GTask], type=<optimized out>) at gtask.c:1164
  #9  0x00007ffff54c8c9f in g_dbus_connection_call_done (source=<optimized out>, result=0x7fffe00036f0, user_data=0x7fffdc004470) at gdbusconnection.c:5702
  #10 0x00007ffff547af93 in g_task_return_now (task=0x7fffe00036f0 [GTask]) at gtask.c:1106
  #11 0x00007ffff547afc9 in complete_in_idle_cb (task=0x7fffe00036f0) at gtask.c:1120
  #12 0x00007ffff4eb7d7a in g_main_context_dispatch (context=0x555555a4a000) at gmain.c:3152
  #13 0x00007ffff4eb7d7a in g_main_context_dispatch (context=context@entry=0x555555a4a000) at gmain.c:3767
  #14 0x00007ffff4eb80b8 in g_main_context_iterate (context=0x555555a4a000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838
  #15 0x00007ffff4eb838a in g_main_loop_run (loop=0x555555a48780) at gmain.c:4032
  #16 0x00005555555aebf2 in main (argc=1, argv=0x7fffffffdc78) at main.c:477
  (gdb)
2016-05-10 16:52:50 +02:00