Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
4ae958757b core: don't use libnm-core private header outside of libnm-core/
Code outside of libnm-core/ should not include the private headers.
nm-core-internal.h should be used instead.

Fixes: 98fe073fb9

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 21:12:07 +01:00
Thomas Haller
d0535cafe5 core: merge branch 'th/bgo738941_dbus_stop' (bgo #738941)
https://bugzilla.gnome.org/show_bug.cgi?id=738941

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:48:45 +01:00
Thomas Haller
3423e54c4e settings: pass valid error code to g_set_error() in load_plugins()
Fixes: 7d04618645
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:45:23 +01:00
Thomas Haller
c7227ac734 wifi: avoid assertion about duplicate nm_device_add_pending_action()
This can be triggered by stopping the DBUS service. The assertion happens
because when the supplicant stops (due to the name-owner-change, which is triggered
because dbus-daemon quit), the supplicant manager sets all supplicant interfaces
to DOWN state so that they can be cleaned up. That does two things:

  1) calls supplicant_interface_acquire() to attempt to re-launch wpa_supplicant
     in case wpa_supplicant segfaulted

  2) moves the NMDevicWifi to UNAVAILABLE state because the supplicant is gone,
     the device is no longer usable and we must terminate the connection and wait
     for the supplicant to come back

But #2 also ends up calling supplicant_interface_acquire(), because that's what
we want to do when the NMDeviceWifi is first managed (at startup) and when the
supplicant dies.  The code just doesn't differentiate between the two cases.

To fix this, just allow duplicate "waiting for supplicant" pending
actions, which is fine because the operation doesn't care about strict
added/removed sequencing.

    #0  0x000000381d0504e9 in g_logv (log_domain=0x59cd5b "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff8cccc1a0) at gmessages.c:989
    #1  0x000000381d05063f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
    #2  0x000000000044f53b in nm_device_add_pending_action (self=0xa60310, action=0x7febecd1d37d "waiting for supplicant", assert_not_yet_pending=1) at devices/nm-device.c:6466
    #3  0x00007febecd0bc56 in supplicant_interface_acquire (self=0xa60310) at nm-device-wifi.c:262
    #4  0x00007febecd0b240 in device_state_changed (device=0xa60310, new_state=NM_DEVICE_STATE_UNAVAILABLE, old_state=NM_DEVICE_STATE_ACTIVATED, reason=NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED) at nm-device-wifi.c:3136
    #5  0x000000381dc05d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #6  0x000000381dc056bc in ffi_call (cif=cif@entry=0x7fff8cccc6c0, fn=0x7febecd0b050 <device_state_changed>, rvalue=0x7fff8cccc630, avalue=avalue@entry=0x7fff8cccc5b0) at ../src/x86/ffi64.c:522
    #7  0x000000381e010ad8 in g_cclosure_marshal_generic (closure=0xa30a40, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>,
        marshal_data=0x7febecd0b050 <device_state_changed>) at gclosure.c:1454
    #8  0x000000381e010298 in g_closure_invoke (closure=closure@entry=0xa30a40, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7fff8cccc8c0, invocation_hint=invocation_hint@entry=0x7fff8cccc860)
        at gclosure.c:777
    #9  0x000000381e02211b in signal_emit_unlocked_R (node=node@entry=0xa322b0, detail=detail@entry=0, instance=instance@entry=0xa60310, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff8cccc8c0) at gsignal.c:3624
    #10 0x000000381e02a0f2 in g_signal_emit_valist (instance=instance@entry=0xa60310, signal_id=signal_id@entry=63, detail=detail@entry=0, var_args=var_args@entry=0x7fff8ccccaf8) at gsignal.c:3330
    #11 0x000000381e02a8f8 in g_signal_emit_by_name (instance=0xa60310, detailed_signal=0x59a8d1 "state-changed") at gsignal.c:3426
    #12 0x00000000004514a4 in _set_state_full (self=0xa60310, state=NM_DEVICE_STATE_UNAVAILABLE, reason=NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED, quitting=0) at devices/nm-device.c:6820
    #13 0x0000000000449ec6 in nm_device_state_changed (self=0xa60310, state=NM_DEVICE_STATE_UNAVAILABLE, reason=NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED) at devices/nm-device.c:6949
    #14 0x00007febecd0f247 in supplicant_iface_state_cb (iface=0x9b9290, new_state=13, old_state=12, disconnect_reason=0, user_data=0xa60310) at nm-device-wifi.c:2276
    #15 0x000000381dc05d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #16 0x000000381dc056bc in ffi_call (cif=cif@entry=0x7fff8cccd230, fn=0x7febecd0eb20 <supplicant_iface_state_cb>, rvalue=0x7fff8cccd160, avalue=avalue@entry=0x7fff8cccd0e0) at ../src/x86/ffi64.c:522
    #17 0x000000381e010f35 in g_cclosure_marshal_generic_va (closure=0xa2f490, return_value=0x0, instance=0x9b9290, args_list=<optimized out>, marshal_data=0x0, n_params=3, param_types=0xa422e0) at gclosure.c:1550
    #18 0x000000381e0104c7 in _g_closure_invoke_va (closure=closure@entry=0xa2f490, return_value=return_value@entry=0x0, instance=instance@entry=0x9b9290, args=args@entry=0x7fff8cccd470, n_params=3, param_types=0xa422e0) at gclosure.c:840
    #19 0x000000381e029749 in g_signal_emit_valist (instance=0x9b9290, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fff8cccd470) at gsignal.c:3238
    #20 0x000000381e02a3af in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
    #21 0x00000000004b0e4b in set_state (self=0x9b9290, new_state=13) at supplicant-manager/nm-supplicant-interface.c:344
    #22 0x00000000004b0916 in smgr_avail_cb (smgr=0xa3c890, pspec=0xa3c8d0, user_data=0x9b9290) at supplicant-manager/nm-supplicant-interface.c:930
    #23 0x000000381e010298 in g_closure_invoke (closure=0x9a68b0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fff8cccd770, invocation_hint=invocation_hint@entry=0x7fff8cccd710) at gclosure.c:777
    #24 0x000000381e02235d in signal_emit_unlocked_R (node=node@entry=0x990da0, detail=detail@entry=610, instance=instance@entry=0xa3c890, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff8cccd770) at gsignal.c:3586
    #25 0x000000381e02a0f2 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff8cccd900) at gsignal.c:3330
    #26 0x000000381e02a3af in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
    #27 0x000000381e014945 in g_object_dispatch_properties_changed (object=0xa3c890, n_pspecs=1, pspecs=0x0) at gobject.c:1047
    #28 0x000000381e017019 in g_object_notify_by_spec_internal (pspec=<optimized out>, object=0xa3c890) at gobject.c:1141
    #29 g_object_notify (object=0xa3c890, property_name=<optimized out>) at gobject.c:1183
    #30 0x00000000004b56f1 in set_running (self=0xa3c890, now_running=0) at supplicant-manager/nm-supplicant-manager.c:228
    #31 0x00000000004b5002 in name_owner_changed (dbus_mgr=0x99f740, name=0x9ba910 "fi.w1.wpa_supplicant1", old_owner=0xa945a0 ":1.25", new_owner=0xac2ce0 "", user_data=0xa3c890) at supplicant-manager/nm-supplicant-manager.c:294
    #32 0x000000381dc05d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #33 0x000000381dc056bc in ffi_call (cif=cif@entry=0x7fff8cccdd10, fn=0x4b4d50 <name_owner_changed>, rvalue=0x7fff8cccdc80, avalue=avalue@entry=0x7fff8cccdc00) at ../src/x86/ffi64.c:522
    #34 0x000000381e010ad8 in g_cclosure_marshal_generic (closure=0xa530a0, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at gclosure.c:1454
    #35 0x000000381e010298 in g_closure_invoke (closure=0xa530a0, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7fff8cccdf10, invocation_hint=invocation_hint@entry=0x7fff8cccdeb0) at gclosure.c:777
    #36 0x000000381e02235d in signal_emit_unlocked_R (node=node@entry=0x99cce0, detail=detail@entry=0, instance=instance@entry=0x99f740, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff8cccdf10) at gsignal.c:3586
    #37 0x000000381e02a0f2 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff8ccce0d0) at gsignal.c:3330
    #38 0x000000381e02a3af in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
    #39 0x00000000004c4026 in proxy_name_owner_changed (proxy=0x998210, name=0xa3ad50 "fi.w1.wpa_supplicant1", old_owner=0x9cffc0 ":1.25", new_owner=0x99d230 "", user_data=0x99f740) at nm-dbus-manager.c:708
    #40 0x000000381dc05d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #41 0x000000381dc056bc in ffi_call (cif=cif@entry=0x7fff8ccce410, fn=0x4c3fd0 <proxy_name_owner_changed>, rvalue=0x7fff8ccce380, avalue=avalue@entry=0x7fff8ccce300) at ../src/x86/ffi64.c:522
    #42 0x000000381e010ad8 in g_cclosure_marshal_generic (closure=closure@entry=0x9beb80, return_gvalue=return_gvalue@entry=0x0, n_param_values=<optimized out>, param_values=<optimized out>,
        invocation_hint=invocation_hint@entry=0x7fff8ccce630, marshal_data=marshal_data@entry=0x0) at gclosure.c:1454
    #43 0x0000003829a10864 in marshal_dbus_message_to_g_marshaller (closure=0x9beb80, return_value=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=0x7fff8ccce630, marshal_data=0x0) at dbus-gproxy.c:1736
    #44 0x000000381e010298 in g_closure_invoke (closure=0x9beb80, return_value=return_value@entry=0x0, n_param_values=3, param_values=param_values@entry=0x7fff8ccce690, invocation_hint=invocation_hint@entry=0x7fff8ccce630) at gclosure.c:777
    #45 0x000000381e02235d in signal_emit_unlocked_R (node=node@entry=0x9be290, detail=detail@entry=347, instance=instance@entry=0x998210, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff8ccce690) at gsignal.c:3586
    #46 0x000000381e02a0f2 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff8ccce840) at gsignal.c:3330
    #47 0x000000381e02a3af in g_signal_emit (instance=instance@entry=0x998210, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
    #48 0x0000003829a111c0 in dbus_g_proxy_emit_remote_signal (message=0xa6c2b0, proxy=0x998210) at dbus-gproxy.c:1789
    #49 dbus_g_proxy_manager_filter (connection=<optimized out>, message=0xa6c2b0, user_data=0x9be520) at dbus-gproxy.c:1356
    #50 0x000000382001006e in dbus_connection_dispatch (connection=connection@entry=0x9badb0) at dbus-connection.c:4631
    #51 0x0000003829a0ad65 in message_queue_dispatch (source=source@entry=0x9bdcc0, callback=<optimized out>, user_data=<optimized out>) at dbus-gmain.c:90
    #52 0x000000381d0492a6 in g_main_dispatch (context=0x99b4b0) at gmain.c:3066
    #53 g_main_context_dispatch (context=context@entry=0x99b4b0) at gmain.c:3642
    #54 0x000000381d049628 in g_main_context_iterate (context=0x99b4b0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
    #55 0x000000381d049a3a in g_main_loop_run (loop=0x99b5d0) at gmain.c:3907
    #56 0x0000000000443c28 in main (argc=1, argv=0x7fff8cccf268) at main.c:704

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:43:58 +01:00
Thomas Haller
a7afa746f5 supplicant: avoid assertion when DBUS connection closes
Calling dbus_g_proxy_begin_call() on a closed DBUS connection will
return NULL. All the call sites of nm_call_store_add() don't check
for NULL and therefore might hit an assertion.

This can easily reproduced by stopping the DBUS daemon.
Backtrace:
    #0  0x000000381d0504e9 in g_logv (log_domain=0x59cd8b "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff42cce5c0) at gmessages.c:989
    #1  0x000000381d05063f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
    #2  0x00000000004b64e9 in nm_call_store_add (store=0x7f8e1c003d20, proxy=0x219c0d0, call=0x0) at supplicant-manager/nm-call-store.c:47
    #3  0x00000000004b0b7b in interface_add (self=0x20e2500, is_wireless=1) at supplicant-manager/nm-supplicant-interface.c:907
    #4  0x00000000004b0865 in nm_supplicant_interface_new (smgr=0x216c870, ifname=0x211e840 "wlp3s0", is_wireless=1, fast_supported=1, ap_support=AP_SUPPORT_YES, start_now=1) at supplicant-manager/nm-supplicant-interface.c:1355
    #5  0x00000000004b47da in nm_supplicant_manager_iface_get (self=0x216c870, ifname=0x211e840 "wlp3s0", is_wireless=1) at supplicant-manager/nm-supplicant-manager.c:91
    #6  0x00007f8e250f8b3f in supplicant_interface_acquire (self=0x218a350) at nm-device-wifi.c:253
    #7  0x00007f8e250fc22e in supplicant_iface_state_cb (iface=0x20e2290, new_state=13, old_state=9, disconnect_reason=0, user_data=0x218a350) at nm-device-wifi.c:2274
    #8  0x000000381dc05d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #9  0x000000381dc056bc in ffi_call (cif=cif@entry=0x7fff42cced00, fn=0x7f8e250fbb20 <supplicant_iface_state_cb>, rvalue=0x7fff42ccec30, avalue=avalue@entry=0x7fff42ccebb0) at ../src/x86/ffi64.c:522
    #10 0x000000381e010f35 in g_cclosure_marshal_generic_va (closure=0x20fd2b0, return_value=0x0, instance=0x20e2290, args_list=<optimized out>, marshal_data=0x0, n_params=3, param_types=0x2189ee0) at gclosure.c:1550
    #11 0x000000381e0104c7 in _g_closure_invoke_va (closure=closure@entry=0x20fd2b0, return_value=return_value@entry=0x0, instance=instance@entry=0x20e2290, args=args@entry=0x7fff42ccef40, n_params=3, param_types=0x2189ee0)
        at gclosure.c:840
    #12 0x000000381e029749 in g_signal_emit_valist (instance=0x20e2290, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fff42ccef40) at gsignal.c:3238
    #13 0x000000381e02a3af in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
    #14 0x00000000004b0e4b in set_state (self=0x20e2290, new_state=13) at supplicant-manager/nm-supplicant-interface.c:344

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:43:58 +01:00
Thomas Haller
20085b9da8 core: ignore SIGPIPE
Ignoring SIGPIPE signal, otherwise it causes problems.

For example, running `NetworkManager --debug 2>&1 | tee log.txt` in a
terminal and killing it with CTRL+C (SIGINT), will abruplty terminate
NetworkManager without clean shutdown.
Note, that with this patch and above example, NetworkManager will both
receive SIGINT and SIGPIPE. Since we now ignore SIGPIPE, NetworkManager
will shut down cleanly. Any logging output after killing `tee` is of
lost however.

Also, there might be other cases where NM reads/writes to a pipe/socket
and unexpectedly received SIGPIPE. For example nm-dns-manager.c
spawns netconfig (run_netconfig()) and writes the configuration
to its stdin. If netconfig dies, the write might fail with EPIPE.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:42:37 +01:00
Lubomir Rintel
38bf08ec44 wifi: Empty AP BSSID is NULL, not an invalid address
Since 3a54d050 the AP address is not a gbyte[], but a char *. The fake AP BSSID
fixup could trigger an assertion failure:

Oct 26 11:14:45 goatlord.localdomain NetworkManager[540]: nm_ethernet_address_is_valid: assertion 'addr != NULL' failed

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

Fixes: 3a54d05098
2014-10-27 20:34:15 +01:00
Thomas Haller
d3ebe386cc wifi: avoid assertion in nm_ap_check_compatible() when comparing AP with missing BSSID
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:32:39 +01:00
Thomas Haller
cc9251d631 wifi: ensure not passing NULL bssid as string to printf logging functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 20:32:36 +01:00
Dan Williams
6153e9e78d merge: fix default-unmanaged devices being unavailable for activation (bgo #738588) 2014-10-27 13:46:30 -05:00
Dan Williams
d147c26517 core: autoconnect fixes for default-unmanaged devices and property notification
Previously the only thing preventing default-unmanaged devices from
being auto-activated was luck and the fact that they didn't have any
available connections when in the UNMANAGED state.  That's no longer
true, so we must be more explicit about their behavior.

Furthermore it makes no sense to allow default-unmanaged devices
to set priv->autoconnect=TRUE since that is never supposed to
happen, so enforce that both in NM itself and if the change
request comes in over the D-Bus interface.

Lastly, internal priv->autoconnect=TRUE changes never emitted a
property change notification, meaning the NMPolicy would never
schedule an autoconnect check if the device's priv->autoconnect
was set to TRUE as a result of re-activating or waking from sleep.
2014-10-27 13:46:06 -05:00
Dan Williams
2bf7d6b5db core: loosen master device carrier check before IP configuration
Previously a master device would wait for a carrier before starting
IP configuration only for 'manual' connections, but that's not quite
broad enough.  We also want to allow SHARED methods to proceed
immediately since they are also effectively static/manual configuration.

Use the newly split out methods for checking whether a connection
requires a carrier or not to allow the SHARED method to proceed
for master devices without a carrier.

For example, this allows bridge configurations with tun/tap ports
to set up SHARED addressing before the tun/tap gets a carrier which
only happens when something opens the other side of the tun/tap
(like the VM or container).
2014-10-27 13:46:06 -05:00
Dan Williams
9e1d31763b trivial: move connection_requires_carrer() up
No code change, only move above a future user.
2014-10-27 13:46:06 -05:00
Dan Williams
37da01b517 core: refactor connection_requires_carrier() to split out method checking
The split out functions will be used next for master/slave decisions.
2014-10-27 13:46:06 -05:00
Dan Williams
98fe073fb9 core: use _nm_utils_string_in_list() instead of private function 2014-10-27 13:46:06 -05:00
Dan Williams
07e086dd0d core: shared connections don't require a carrier
They are effectively static connections since the address is manually
assigned, so they do not require a carrier.
2014-10-27 13:46:06 -05:00
Dan Williams
82d62c2c4e core: allow default unmanaged devices to have available connections when unmanaged
Default unmanaged devices become managed when the user explicitly activated
a connection on the device, but the user can't do that unless the device
has some available connections.  Fix things up so that default unmanaged
devices can have available connections.
2014-10-27 13:46:06 -05:00
Thomas Haller
7afdd9c979 dhclient: allow single hex digits in hexadecimal dhcp_client_id
When checking whether the dhcp-client-identifier is a hex string,
we expected pairs of hexadecimal digits separated by colon.
Relax this check to also allow single hex digits.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-27 16:45:57 +01:00
Dan Winship
dc46e2c67b build: fix srcdir != builddir
callouts/tests/ needs -I$(top_builddir)/callouts to get
nmdbus-dispatcher.h
2014-10-24 14:41:19 -04:00
Lubomir Rintel
5f840abd7f contrib/rpm: Avoid unowned directories 2014-10-24 19:29:27 +02:00
Lubomir Rintel
4496b69e47 libnm: Ignore NoReply errors when NM has vanished from the bus
This fixes the /libnm/client-nm-running test failure when a race condition is hit:

test-nm-client:10350): libnm-WARNING **: updated_properties:
	error reading NMRemoteSettings properties:
	GDBus.Error:org.freedesktop.DBus.Error.NoReply:
	Message did not receive a reply (timeout by message bus)

What actually happens is that nm_running_changed_cb() calls GetAll() for a
NMRemoteSettings object when NM appears on the bus. If it disappears shortly
afterwards, another nm_running_changed_cb() is called which suppresses further
object updates, but the original GetAll() might not have finished yet and DBus
will generate a NoReply() response for it. We ought to ignore it.
2014-10-24 19:24:32 +02:00
Lubomir Rintel
b54030de22 core: Fall back to CLOCK_MONOTONIC if CLOCK_BOOTTIME unsupported
It was added fairly recently (2.6.39), this breaks run (and test run in mock)
on RHEL-6 with 2.6.32.
2014-10-24 19:24:32 +02:00
Lubomir Rintel
e9bfd0e29c tests: Don't run session-long dbus daemons for tests
They require a tty or X11 displays, thus are not suitable for headless runs
(such as in mock). Furthermore, they die with the tty or X11 session, which
is somehow late -- a lot of them may accumulate. Let's kill them right away.
2014-10-24 19:16:33 +02:00
Dan Williams
c459d5872f ibft: fix uninitialized variable 2014-10-23 13:52:10 -05:00
Ryan Lortie
07dba25404 core: add PrimaryConnectionType property to NMManager (bgo #739080)
This will provide an extremely easy way for applications to find out
what type of connection the system is currently using.  They might want
to do this to avoid using data if a phone is on a 3G connection, for
example.

Having this as a separate property provides at least two advantages:

 1) it reduces code complexity for those wanting only this one simple
    piece of information

 2) we could allow access to this property (but nothing else) to
    privilege-separated applications in the future

This patch adds the missing nm_active_connection_get_connection_type()
which was in the header file but never actually implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=739080
2014-10-23 13:39:08 -05:00
Jiří Klimeš
8b1447a3a4 ifcfg-rh: add support for MODE=Ap
It is an extension against initscripts. However, we have many other Wi-Fi
related extensions. So the NM-written ifcfg file will not be 100% backwards
compatible anyway.
Moreover, initscripts changed from using iwconfig to iw and dropped support
(accidently?) for some traditional variable, like KEY1-KEY4, CHANNEL, etc.
They should be fixed bring back by initscripts.
https://git.fedorahosted.org/cgit/initscripts.git/commit/sysconfig/network-scripts/ifup-wireless?id=ddda5f6f818831b1fa37337be0ac9c0f619df1ca
2014-10-23 18:34:39 +02:00
Lubomir Rintel
1c9b16b2f2 cli: Add mode option for wifi connecitons
Only default (infrastructure) mode connections can be created and as it's not
possible to write mode=ap connections with ifcfg-rh plugins, they can't be
switched to mode=ap.
2014-10-23 18:34:39 +02:00
Lubomir Rintel
3a6c618a4a wifi: Use SSID from connection also if AP is not configured
Creating a mode=ap connection (as GNOME control center does) would otherwise
assert in complete_connection despite having a proper SSID set:

NetworkManager-wifi:ERROR:nm-device-wifi.c:1118:complete_connection: assertion failed: (ssid)
Aborted
2014-10-23 18:34:39 +02:00
Jiří Klimeš
0bc11cb730 man: add an example for ifcfg configuration of bridges 2014-10-23 17:37:39 +02:00
Jiří Klimeš
d7bee60ed7 Merge: fix some memory leaks (bgo #739013)
https://bugzilla.gnome.org/show_bug.cgi?id=739013
2014-10-23 09:38:17 +02:00
Jiří Klimeš
d51976843d libnm-core: fix a leak in process_properties_changed() 2014-10-23 09:15:58 +02:00
Jiří Klimeš
171c970beb libnm-core: do not leak GValue in _nm_setting_new_from_dbus() 2014-10-23 09:15:58 +02:00
Jiří Klimeš
7dfb842873 libnm-core: do not leak the path in connections 2014-10-23 09:15:58 +02:00
Jiří Klimeš
6354a0e450 all: fix g_dbus_proxy_get_name_owner() leaks 2014-10-23 09:15:58 +02:00
Dan Winship
db95e213c7 wwan: fix wwan-exports.ver 2014-10-22 10:16:31 -04:00
Lubomir Rintel
020bc95232 core: Remove use of NM_SESSION_MONITOR_ERROR domain
It no longer exists.

Also, the special case of ENOENT handling in nm-session-monitor-ck is removed;
it's not worth keeping it around just to print a log message when the error is
ignored nayway.
2014-10-22 09:48:58 -04:00
Dan Winship
558cbe5c11 all: consolidate error domains and fix up D-Bus error mapping (bgo #735900) 2014-10-22 08:29:29 -04:00
Dan Winship
da8d79f1c5 core: drop all remaining core-internal error domains
A number of classes in core had their own error domains that aren't
really necessary.

In the case of NMDcbError, NMDhcpManagerError, NMDnsManagerError,
NMDnsmasqManagerError, NMPppManagerError, and NMSessionMonitorError,
most of the codes they defined weren't even being used, and at any
rate, the errors were always returned into contexts where they would
just have their message extracted and then get thrown away without
anyone ever looking at the domain or code. So all uses of those
domains can just be replaced with NM_MANAGER_ERROR_FAILED without any
loss of information.

NMAuthManagerError only had 1 error code, and it just indicated
"something went wrong", so it can be replaced with
NM_MANAGER_ERROR_FAILED without loss of information.
(nm-auth-manager.c has also been fixed to return
NM_MANAGER_ERROR_FAILED when the CheckAuthorization D-Bus call fails,
rather than returning whatever error domain/code the D-Bus call
returned.)

NMVpnManagerError used 2 of its 4 error codes, and they could actually
end up getting returned across D-Bus in some cases. But there are
NMManagerError codes that are semantically similar enough to make the
NMVpnManagerError ones unnecessary.
2014-10-22 08:29:10 -04:00
Dan Winship
388a0c5e78 libnm: consolidate NMClientError and NMObjectError
Consolidate NMClientError and NMObjectError (such that there is now
only one libnm-API-specific error domain). In particular, merge
NM_CONNECTION_ERROR_CONNECTION_REMOVED with
NM_OBJECT_ERROR_OBJECT_CREATION_FAILURE as the new
NM_CONNECTION_ERROR_OBJECT_CREATION_FAILED.

Also make object_creation_failed() be a plain method rather than a
signal, since there's no reason for anyone to be connecting to it on
another object. And remove its GError argument because the subclass
can just create its own more-specific error.
2014-10-22 08:29:10 -04:00
Dan Winship
2ff4a7d4b0 libnm: strip GDBus gunk from GErrors
Call g_dbus_error_strip_remote_error() on all errors returned from
gdbus calls. (Blah!)
2014-10-22 08:29:10 -04:00
Dan Winship
3adc2b800a libnm: drop _nm_dbus_register_error_domain()
All D-Bus error domains are registered from libnm-core now.
2014-10-22 08:29:10 -04:00
Dan Winship
5a181bcaae libnm-core, libnm: move NMVpnPluginError to nm-errors
Move the definition of NMVpnPluginError to nm-errors and register it
with D-Bus. Rename GENERAL to FAILED, and CONNECTION_INVALID to
INVALID_CONNECTION, for consistency.

(As with the NMSecretAgentError renamings, the renaming here is not an
ABI break, because the daemon currently never checks for any specific
error codes other than INTERACTIVE_NOT_SUPPORTED.)
2014-10-22 08:29:10 -04:00
Dan Winship
821258048b libnm-core, libnm, settings: move NMSecretAgentError to nm-errors
Move the definition of NMSecretAgentError to nm-errors, register it
with D-Bus, and verify in the tests that it maps correctly.

NM_SECRET_AGENT_ERROR_INTERNAL_ERROR is renamed to
NM_SECRET_AGENT_ERROR_FAILED, and NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED
to NM_SECRET_AGENT_ERROR_PERMISSION_DENIED, for consistency with other
error domains. While NMSecretAgentError, unlike most other error
domains, has always been correctly mapped across D-Bus, the renaming
is not an ABI break, because the daemon never checks for either of
those values, so all versions of the daemon will treat
"org.freedesktop.NetworkManager.SecretAgent.InternalError" and
"org.freedesktop.NetworkManager.SecretAgent.Failed" the same (by just
ignoring the error name and keeping only the error message).
2014-10-22 08:29:09 -04:00
Dan Winship
86331d9ef4 libnm-core, settings: move NMAgentManagerError to nm-errors
Move the definition of NMAgentManagerError to nm-errors, register it
with D-Bus, and verify in the tests that it maps correctly.
2014-10-22 08:29:09 -04:00
Dan Winship
d13bfe3cf8 settings: drop plugin-specific error domains
Each plugin defined its own error domain, though none actually defined
any errors. Replace these with appropriate uses of
NM_SETTINGS_ERROR_INVALID_CONNECTION and NM_SETTINGS_ERROR_FAILED.
2014-10-22 08:29:09 -04:00
Dan Winship
3be53899fa libnm-core, settings: move NMSettingsError to nm-errors
Move the definition of NMSettingsError to nm-errors, register it with
D-Bus, and verify in the tests that it maps correctly.

Remove a few unused error codes, simplify a few others, and rename
GENERAL to FAILED and HOSTNAME_INVALID to INVALID_HOSTNAME, for
consistency.
2014-10-22 08:29:09 -04:00
Dan Winship
115f8bead8 libnm-core, core: merge NMLoggingError into NMManagerError
NMManagerError has other operation-specific errors (like
NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE), so it makes sense to move
NM_LOGGING_ERROR_UNKNOWN_LEVEL and NM_LOGGING_ERROR_UNKNOWN_DOMAIN
there too rather than having them in their own tiny error domain.
2014-10-22 08:29:09 -04:00
Dan Winship
862d4efeac libnm-core, core: move NMManagerError to nm-errors
Move the definition of NMManagerError to nm-errors, register it with
D-Bus, and verify in the tests that it maps correctly.

NM_MANAGER_ERROR_INTERNAL gets renamed to NM_MANAGER_ERROR_FAILED for
consistency. NM_MANAGER_ERROR_UNMANAGED_DEVICE is dropped since that
name doesn't really describe the one place it was previously used in.
NM_MANAGER_ERROR_SYSTEM_CONNECTION is dropped because it was't being
used. NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE is dropped because
it can be replaced with an NM_CONNECTION_ERROR.
NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED is turned into the more
generic NM_MANAGER_ERROR_CONNECTION_NOT_AVAILABLE.

Also, remove the <tp:possible-errors> sections from nm-manager.xml,
since they were completely out of date.
2014-10-22 08:29:09 -04:00
Dan Winship
fd7b9df47d devices: drop device-type-specific error domains
Most NMDevice types defined their own error domain but then never used
it. A few did use their errors, but some of those errors are redundant
with NMDeviceError, and others can be added to it.
2014-10-22 08:29:08 -04:00
Dan Winship
4f75ff92b4 libnm-core, libnm, devices: merge client and daemon NMDeviceError
Merge libnm's NMDeviceError and the daemon's NMDeviceError into a
single enum (in nm-errors.h). Register the domain with D-Bus, and add
a test that the client side decodes it correctly.

The daemon's NM_DEVICE_ERROR_CONNECTION_INVALID gets absorbed into
libnm's NM_DEVICE_ERROR_INVALID_CONNECTION, and
NM_DEVICE_ERROR_UNSUPPORTED_DEVICE_TYPE gets dropped, since it was
only returned from one place, which is now using
NM_DEVICE_ERROR_FAILED, since (a) it ought to be a "can't happen", and
(b) the only caller of that function just logs error->message and then
frees the error without ever looking at the code.
2014-10-22 08:29:08 -04:00