Commit graph

12534 commits

Author SHA1 Message Date
Dan Williams
095818ac10 wifi: clean up removal of current AP if it fails during association (bgo #733105)
There's a race between when link_timeout_cb() runs and removes priv->current_ap,
and the supplicant removing priv->current_ap and finding it again.  The race appears
to be:

* connected to AP, so ssid_found = TRUE
* AP powers off
* supplicant state change to DISCONNECTED
* supplicant_iface_state_cb() schedules link_timeout_cb() and sets ssid_found=false
* AP powers on
* Supplicant announces that it found the AP again
* Supplicant either doesn't try to connect to AP, or doesn't get far enough before:
* NM runs link_timeout_cb(), removes AP from scan list
* nothing happens because the AP isn't in the scan list

We can use WPAS_REMOVED_TAG in link_timeout_cb() to figure out whether the
supplicant knows about the AP or not.  If it does know about the AP, then
the AP shouldn't be removed from NM's scan list.

https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-11-12 12:21:32 -06:00
Lubomir Rintel
d19cbabc14 nm-device: only progress with ip-config if the device is still in IP_WAIT
The device might be a slave and not need any L3 configuration in which case it
will move to IP_DONE:

  Running test bridge_manipulation_with_1000_slaves
  ...
  <debug> [1446834482.545396] [nm-dispatcher.c:304] dispatcher_results_process(): (121) 12-dhcpd succeeded
  <debug> [1446834482.545404] [nm-dispatcher.c:304] dispatcher_results_process(): (121) 20-chrony succeeded
  <debug> [1446834482.545481] [devices/nm-device.c:5374] nm_device_activate_stage3_ip_config_start(): [0x7fc77e1c0fc0] (port120): Activation: Stage 3 of 5 (IP Configure Start) started...
  <info>  (port120): device state change: config -> ip-config (reason 'none') [50 70 0]
  <debug> [1446834482.545578] [devices/nm-device.c:1683] slave_state_changed(): [0x7fc77df77020] (bridge0): slave port120 state change 50 (config) -> 70 (ip-config)
  <debug> [1446834482.545629] [devices/nm-device.c:7955] nm_device_add_pending_action(): [0x7fc77e1c0fc0] (port120): add_pending_action (2): 'queued state change to secondaries'
  <debug> [1446834482.545642] [devices/nm-device.c:8806] nm_device_queue_state(): [0x7fc77e1c0fc0] (port120): queued state change to secondaries due to none (id 11380)
  ** NetworkManager:ERROR:devices/nm-device.c:5250:nm_device_activate_stage3_ip4_start: assertion failed: (priv->ip4_state == IP_WAIT)

  5250            g_assert (priv->ip4_state == IP_WAIT);
  (gdb) print priv->ip4_state
  $1 = IP_DONE
  (gdb) print priv->master
  $3 = { ...  master = 0x7fc77df77020, enslaved = 1, master_ready_handled = 1,
    master_ready_id = 0, is_master = 0, slaves = 0x0, ...}

(cherry picked from commit f8973a7f42)
2015-11-11 19:43:42 +01:00
Thomas Haller
ae22a44ba0 wifi: minor refactoring logging BSSID in supplicant_iface_new_bss_cb()
(cherry picked from commit 99ff6681b7)
2015-11-11 18:14:47 +01:00
Thomas Haller
0ff3699af5 Revert "wifi: do no crash when getting BSSID fails"
Since commit ebe3320e62,
nm_ap_new_from_properties() will always return an
AP with BSSID set. Restore the assertion during
try_fill_ssid_for_hidden_ap().

This reverts commit e0e043ef39.

(cherry picked from commit d5373959f9)
2015-11-11 18:10:52 +01:00
Dan Williams
ebe3320e62 wifi: don't accept any BSSes with missing BSSIDs (rh #1276426)
The supplicant should never be sending us BSSes without BSSIDs.

https://bugzilla.redhat.com/show_bug.cgi?id=1276426
(cherry picked from commit 7cb323d923)
2015-11-11 17:51:39 +01:00
Beniamino Galvani
ccc4b1dd54 systemd/adapt: return G_SOURCE_REMOVE in time event callback
Differently from GLib timeout sources, systemd ones are always
one-shot and therefore we must return G_SOURCE_REMOVE in the callback,
otherwise the timer will be scheduled again.

In most cases things were working correctly because usually the
callback also unreferences the source event, but when this doesn't
happen the timer will trigger multiple times as reported in the bug
below.

https://bugzilla.redhat.com/show_bug.cgi?id=1278506

Fixes: 1b1222ffdf
(cherry picked from commit a74e98bfc6)
2015-11-11 17:32:17 +01:00
Thomas Haller
db6f8315e5 python: use gi.require_version() in generate-setting-docs.py and examples
gi now emits a warning when not loading a specific library
version [1]:

  ./generate-setting-docs.py:21: PyGIWarning: NM was imported without specifying a version first. Use gi.require_version(NM, 1.0) before import to ensure that the right version gets loaded.
    from gi.repository import NM, GObject

Seems require_version() is reasonably old to just always use it without
breaking on older versions [2].

[1] Related: https://bugzilla.gnome.org/show_bug.cgi?id=727379
[2] https://git.gnome.org/browse/pygobject/commit/?id=76758efb6579752237a0dc4d56cf9518de6c6e55

(cherry picked from commit 8d1233e67e)
2015-11-11 15:47:13 +01:00
Thomas Haller
5196c89b67 build: hack around compiler warning in g-ir-scanner
The autoconf macro for GIR passes $CFLAGS to g-ir-scanner.
g-ir-scanner extends those flags with the system-default which
includes -D_FORTIFY_SOURCE=2. Probably it should not do that,
but if you disable optimization, this results in a compler warning
in "/usr/include/features.h" [1]

    export CFLAGS='-O0'
    # Happens both with clang or gcc.
    #export CC=clang
    git clean -fdx
    ./autogen.sh
    make

Work around that by injecting -Wno-error to $CFLAGS when invoking
g-ir-scanner.

[1] Related: https://sourceware.org/bugzilla/show_bug.cgi?id=13979
Related: https://bugzilla.gnome.org/show_bug.cgi?id=757934

(cherry picked from commit f6272144e9)
2015-11-11 15:45:59 +01:00
Jiří Klimeš
84d741f106 cli: print a warning if BSSID is given instead of SSID for hidden AP
$ nmcli dev wifi connect 00:22:6B:EB:1D:CA hidden yes
Warning: '00:22:6B:EB:1D:CA' should be SSID for hidden APs; but it looks like a BSSID.
Error: Failed to add/activate new connection: 802-11-wireless.ssid: connection does not match access point

(cherry picked from commit 0dc48370b4)
2015-11-11 09:58:14 +01:00
Jiří Klimeš
36218c1be6 wifi: fix a crash while attempting to connect hidden AP (bgo #757814)
Triggered with
$ nmcli dev wifi connect 00:22:6B:EB:1D:CA hidden yes

where 00:22:6B:EB:1D:CA was BSSID of the AP with hidden SSID.

 Program received signal SIGSEGV, Segmentation fault.
 nm_ap_utils_complete_connection (ap_ssid=0x0, bssid=0xc9e6b0 "00:22:6B:EB:1D:CA", ap_mode=NM_802_11_MODE_INFRA, ap_flags=1, ap_wpa_flags=0, ap_rsn_flags=0,
     connection=0x994ae0, lock_bssid=0, error=0x7fffffffdba0) at nm-wifi-ap-utils.c:551
 551		ap_ssid_bytes = g_bytes_new (ap_ssid->data, ap_ssid->len);
 (gdb) bt
 #0  0x00007fffe2ea18ef in nm_ap_utils_complete_connection (ap_ssid=0x0, bssid=0xc9e6b0 "00:22:6B:EB:1D:CA", ap_mode=NM_802_11_MODE_INFRA, ap_flags=1, ap_wpa_flags=0, ap_rsn_flags=0, connection=0x994ae0, lock_bssid=0, error=0x7fffffffdba0) at nm-wifi-ap-utils.c:551
 #1  0x00007fffe2ea178f in nm_ap_complete_connection (self=self@entry=0x8add20 [NMAccessPoint], connection=connection@entry=0x994ae0, lock_bssid=0, error=error@entry=0x7fffffffdba0) at nm-wifi-ap.c:854
 #2  0x00007fffe2e9e22c in complete_connection (device=0x8c39f0 [NMDeviceWifi], connection=0x994ae0, specific_object=<optimized out>, existing_connections=0xb2ef10 = {...}, error=0x7fffffffdba0) at nm-device-wifi.c:839
 #3  0x000000000045f7a1 in nm_device_complete_connection (self=<optimized out>, connection=connection@entry=0x994ae0, specific_object=specific_object@entry=0xc31850 "/org/freedesktop/NetworkManager/AccessPoint/11", existing_connections=existing_connections@entry=0xb2ef10 = {...}, error=error@entry=0x7fffffffdba0)
    at devices/nm-device.c:2603
 #4  0x00000000004e0a66 in impl_manager_add_and_activate_connection (self=0x8b81f0 [NMManager], context=0x7fffe804bde0 [GDBusMethodInvocation], settings=<optimized out>, device_path=<optimized out>, specific_object_path=0xc31850 "/org/freedesktop/NetworkManager/AccessPoint/11") at nm-manager.c:3426
 #5  0x0000003bf6c05db0 in ffi_call_unix64 () at ../src/x86/unix64.S:76
 #6  0x0000003bf6c05818 in ffi_call (cif=cif@entry=0x7fffffffde10, fn=<optimized out>, rvalue=0x7fffffffdd70, avalue=avalue@entry=0x7fffffffdcf0)
    at ../src/x86/ffi64.c:525
 #7  0x0000003bf7010464 in g_cclosure_marshal_generic (closure=closure@entry=0x8d4ae0, return_gvalue=return_gvalue@entry=0x0, n_param_values=n_param_values@entry=5, param_values=param_values@entry=0xb508f0, invocation_hint=invocation_hint@entry=0x7fffffffe020, marshal_data=0x4e0890 <impl_manager_add_and_activate_connection>)
    at gclosure.c:1448
 #8  0x00000000004c6038 in nm_exported_object_meta_marshal (closure=0x8d4ae0, return_value=0x7fffffffdfd0, n_param_values=5, param_values=0xc2a240, invocation_hint=0x7fffffffe020, marshal_data=<optimized out>) at nm-exported-object.c:346

https://bugzilla.gnome.org/show_bug.cgi?id=757814
(cherry picked from commit 98b0b4b402)
2015-11-11 09:58:08 +01:00
Dan Williams
5fe23c6adc core: fix builds with older gcc (like 4.4.x)
(cherry picked from commit 09a2be3b65)
2015-11-10 11:12:33 -06:00
Adam Bk
106e222852 man: fix synopsis for nmcli connection up (bgo #757777)
'passwd' -> 'passwd-file'

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

(cherry picked from commit cfa4195e0c)
2015-11-09 15:57:33 +01:00
Lubomir Rintel
8f6995a165 agent-manager: cancel pending auth chain for the disappearing agent
If the current agent disappears and we already triggered the permission check
for it then the callback for that permission check will fire after we
progressed to the next agent:

  # nmcli c --wait 0 up vpn

When another agent, such as GNOME Shell is registered, then get_done_cb() for
the nmcli will be called after we started the permission check for GNOME Shell,
resulting in an assertion fail:

  get_done_cb: assertion 'call_id == parent->current_call_id' failed

Moved the track of the auth chain to Request from Connection request so that
it's possible to unref it in request_remove_agent().

(cherry picked from commit 553c15410e)
2015-11-06 17:18:28 +01:00
Lubomir Rintel
aa56f81751 device: set a reason when device enslave fails
Otherwise we'd hit an assert and rightly so!

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x5555556b2f80 "NetworkManager", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffcd10) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  g_logv (log_domain=0x5555556b2f80 "NetworkManager", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffcd10) at gmessages.c:1046
  #1  0x00007ffff4a4ea3f in g_log (log_domain=log_domain@entry=0x5555556b2f80 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff4ac1e4c "%s") at gmessages.c:1079
  #2  0x00007ffff4a4ed56 in g_warn_message (domain=domain@entry=0x5555556b2f80 "NetworkManager", file=file@entry=0x5555556aca93 "devices/nm-device.c", line=line@entry=1101,
      func=func@entry=0x5555556b22e0 <__FUNCTION__.35443> "nm_device_release_one_slave", warnexpr=warnexpr@entry=0x0) at gmessages.c:1112
  #3  0x00005555555ba80a in nm_device_release_one_slave (self=self@entry=0x5555559ec4c0, slave=slave@entry=0x5555559f7800, configure=configure@entry=1, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE)
      at devices/nm-device.c:1101
  #4  0x00005555555c264b in slave_state_changed (slave=0x5555559f7800, slave_new_state=NM_DEVICE_STATE_FAILED, slave_old_state=NM_DEVICE_STATE_IP_CONFIG, reason=NM_DEVICE_STATE_REASON_NONE, self=0x5555559ec4c0)
      at devices/nm-device.c:1700
  #5  0x00007ffff339cdac in ffi_call_unix64 () at ../src/x86/unix64.S:76
  #6  0x00007ffff339c6d5 in ffi_call (cif=cif@entry=0x7fffffffd1c0, fn=<optimized out>, rvalue=0x7fffffffd130, avalue=avalue@entry=0x7fffffffd0b0) at ../src/x86/ffi64.c:522
  #7  0x00007ffff4d45678 in g_cclosure_marshal_generic (closure=0x5555559b0160, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0)
      at gclosure.c:1454
  #8  0x00007ffff4d44e38 in g_closure_invoke (closure=0x5555559b0160, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7fffffffd3c0,
      invocation_hint=invocation_hint@entry=0x7fffffffd360) at gclosure.c:768
  #9  0x00007ffff4d5675d in signal_emit_unlocked_R (node=node@entry=0x55555598a6f0, detail=detail@entry=0, instance=instance@entry=0x5555559f7800, emission_return=emission_return@entry=0x0,
      instance_and_params=instance_and_params@entry=0x7fffffffd3c0) at gsignal.c:3553
  #10 0x00007ffff4d5e4c1 in g_signal_emit_valist (instance=instance@entry=0x5555559f7800, signal_id=signal_id@entry=72, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffd5f8) at gsignal.c:3309
  #11 0x00007ffff4d5ecc8 in g_signal_emit_by_name (instance=instance@entry=0x5555559f7800, detailed_signal=detailed_signal@entry=0x5555556c0405 "state-changed") at gsignal.c:3405
  #12 0x00005555555bd0e0 in _set_state_full (self=self@entry=0x5555559f7800, state=state@entry=NM_DEVICE_STATE_FAILED, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE, quitting=quitting@entry=0)
      at devices/nm-device.c:8580
  #13 0x00005555555be0e7 in nm_device_state_changed (self=self@entry=0x5555559f7800, state=state@entry=NM_DEVICE_STATE_FAILED, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE) at devices/nm-device.c:8741
  #14 0x00005555555c0a45 in queued_set_state (user_data=<optimized out>) at devices/nm-device.c:8765
  #15 0x00007ffff4a4779a in g_main_dispatch (context=0x5555559433c0) at gmain.c:3109
  #16 g_main_context_dispatch (context=context@entry=0x5555559433c0) at gmain.c:3708
  #17 0x00007ffff4a47ae8 in g_main_context_iterate (context=0x5555559433c0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3779
  #18 0x00007ffff4a47dba in g_main_loop_run (loop=0x555555943480) at gmain.c:3973
  #19 0x000055555559713d in main (argc=1, argv=0x7fffffffdb78) at main.c:512
  (gdb)

(cherry picked from commit aa05d25bef)
2015-11-06 15:44:48 +01:00
Thomas Haller
ca7d6feafd logging: swap names of logging macros _LOGT() and _LOGt()
Previsously, _LOGT() could be disabled at compile time. Thus it
was different then the other macros _LOGD(), _LOGI(), etc.

OTOH, _LOGt() was the macro that always was compiled in.

Swap the name of the macros. Now the upper-case macros are always
enabled, while the lower-case macro _LOGt() is enabled depending
on compile configuration.

(cherry picked from commit 9587867349)
2015-11-06 14:21:11 +01:00
Lubomir Rintel
8c8e88ae28 agent-manager: don't try to cancel requests that already finished
Fixes: 5d1cac81a0
(cherry picked from commit f558502278)
2015-11-05 15:34:28 +01:00
Lubomir Rintel
302914c010 build: add missing GLIB_CFLAGS
The library and the include paths are dragged in with DBUS_CFLAGS but we need
more; especially the GLIB_VERSION_{MIN/MAX}_REQUIRED macros. Otherwise we get
deprecation warnings.

No master commit, since this was fixed as a side-effect of the GDBus merge.
2015-11-05 14:48:23 +01:00
Jiří Klimeš
112f3f8aca policy: fix looping through list while removing elements (rh #1175446)
When g_slist_remove() was called, iter2 became invalid and accessing it
could cause a crash. The same was true for iter.
Fix the problem by getting the next list item before an element removal.

See a similar fix in bluez
http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=be8c5be809875ba449a10ca29f5244f0231f6b63

https://bugzilla.redhat.com/show_bug.cgi?id=1175446
https://bugzilla.redhat.com/show_bug.cgi?id=1277247

(cherry picked from commit b9da3d9320)
2015-11-05 12:54:27 +01:00
Beniamino Galvani
8b5e5a3dae device: terminate the activation chain when entering the failed state
Device activation normally fails during one of the stages and in that
case the activation chain is implicitly interrupted.

But in some cases the device fails for external events (as a failure
of master connection) while the activation sequence is still running
and so we need to ensure that any pending activation source gets
cleared upon entering the failed state.

https://bugzilla.redhat.com/show_bug.cgi?id=1270814
(cherry picked from commit c8e2339091)
2015-11-03 22:52:25 +01:00
Jiří Klimeš
b78e10a064 core: fix assuming a connection without S390 properties (rh #1276343)
When a connection should be assumed and the generated connection did not
contain a wired setting, the connection did not match due to S390 properties.
Such a connection should be allowed to match to a connection with a wired
setting with default (empty) S390 properties.

This can happen when there is a VLAN profile configured that contains a wired
setting in it and NetworkManager is (re)started.

Example/reproducer:
$ nmcli con add type vlan con-name vlan-test autoconnect no dev em1 id 44
$ nmcli con mod vlan-test eth.mtu 1450   (modify the connection, so that it has a wired setting)
$ nmcli con up vlan-test                 (activate the connection)
$ sudo systemctl restart NetworkManager
$ nmcli device
check that 'vlan-test' connection is active on em1.44 device
(and not the auto-generated em1.44)

https://bugzilla.redhat.com/show_bug.cgi?id=1276343

(cherry picked from commit 212b3e6713)
2015-11-03 08:47:32 +01:00
Dan Williams
cccb8fe5e6 bluetooth: fix missing 'connected' notifications (rh #1255284)
Because Bluez5 dropped DUN support, NM must do that manually which
includes emulating the "connected" property for Bluetooth devices when
DUN is used.  It does this by setting priv->connected = TRUE in
nm_bluez_device_connect_finish().

But for PAN, when NM does process the 'connected' property change
notification, priv->connected is already TRUE and
_take_variant_property_connected() does nothing.  Hence the
corresponding GObject property notification is not emitted,
nm-device-bt.c::check_connect_continue() will never return success, and
the activation times out.

To fix this, ensure that GObject notifications are emitted when the
device is connected, even if emulated internally.

https://mail.gnome.org/archives/networkmanager-list/2015-October/msg00053.html
https://bugzilla.redhat.com/show_bug.cgi?id=1255284
(cherry picked from commit 0e3086e8b8)
2015-10-25 19:52:39 +01:00
Lubomir Rintel
24195884cd libnm-glib,vpn-plugin: remove old connect timer when adding new one
If the plugin didn't succeed connecting once, don't let the old timer fire
during a subsequent connection.

https://bugzilla.redhat.com/show_bug.cgi?id=1271973
(cherry picked from commit 842889bc5b)
2015-10-23 18:25:11 +02:00
Lubomir Rintel
0a95f003a9 agent-manager: cancel secrets requests on an error
It might be that the user didn't supply the secrets in time and the dbus call
timed out. The agent should now hide the secrets dialog and we must let it know.

https://bugzilla.redhat.com/show_bug.cgi?id=1272023
(cherry picked from commit 5d1cac81a0)
2015-10-23 18:22:03 +02:00
Lubomir Rintel
48111a0828 dbus: add strongswan to the vpn plugin bus names
(cherry picked from commit e9c88ba9de)
2015-10-23 18:21:59 +02:00
Lubomir Rintel
b813fcdc88 dbus: allow talking to fortisslvpn plugin
(cherry picked from commit b0ba25cdbc)
2015-10-23 18:21:59 +02:00
Jiří Klimeš
b25880533e cli: improve error reporting of missing 'ifname' parameter
Example:
before:
$ nmcli c add type gsm con-nameX aaa ifname fsd
Error: 'ifname' argument is required.

now:
$ nmcli c add type gsm con-nameX aaa ifname fsd
Error: mandatory 'ifname' not seen before 'con-nameX'.

(cherry picked from commit 696a443e98)
2015-10-23 12:32:00 +02:00
Jiří Klimeš
02ad858a6d cli: trivial: correct argument description for nmc_parse_args()
(cherry picked from commit b45bd96d89)
2015-10-23 12:31:55 +02:00
Jiří Klimeš
4c9d7e7797 vlan: fix unmanaged VLAN interface problem (rh #1273879)
Commit 285ee1fda2 added NM_UNMANAGED_PLATFORM_INIT
flag marking platform uninitialized devices. The flags is set by
NM_DEVICE_PLATFORM_DEVICE property and on link changes. However, for virtual
devices, the platform device property was not set at NM device construction time
and link change event happened even before. That resulted in the device having
platform_link_initialized=FALSE and thus it was left unmanaged.

Make the change for other software devices too.

https://bugzilla.redhat.com/show_bug.cgi?id=1273879
2015-10-22 14:02:07 +02:00
Jiří Klimeš
e0e043ef39 wifi: do no crash when getting BSSID fails
https://bodhi.fedoraproject.org/updates/NetworkManager-1.0.6-7.fc23#comment-342089

(cherry picked from commit e9bc18d2a7)
2015-10-22 10:34:13 +02:00
Jiří Klimeš
f85ccf9a9e wifi: fix a problem in removing non-existing source
GLib-CRITICAL **: Source ID 4197 was not found when attempting to remove it

(cherry picked from commit 5fa369e95c)
2015-10-22 10:33:49 +02:00
Thomas Haller
2631174d4e ifcfg-rh: remove another unused variable in parse_ethtool_option()
(cherry picked from commit 58fc4381ff)
2015-10-20 17:43:40 +02:00
Thomas Haller
77f43defbe ifcfg-rh: remove unused variable in parse_ethtool_option()
(cherry picked from commit f840d9465f)
2015-10-20 17:41:25 +02:00
Thomas Haller
efa303ed82 ifcfg-rh: improve parsing of Wake-on-LAN options
Initscripts do:
    oldifs=$IFS;
    IFS=';';
    [ -n "${ETHTOOL_DELAY}" ] && /bin/usleep ${ETHTOOL_DELAY}
    for opts in $ETHTOOL_OPTS ; do
        IFS=$oldifs;
        if [[ "${opts}" =~ [[:space:]]*- ]]; then
            /sbin/ethtool $opts
        else
            /sbin/ethtool -s ${REALDEVICE} $opts
        fi
        IFS=';';
    done
    IFS=$oldifs;

thus, we want to split on ';', otherwise we parse
  "wol d;something else"
wrong.

Also, g_strsplit_set() returns multiple empty tokens. So
we must skip over empty tokens in case of "wol    d".

The @use_password was wrong, because we would warn if sopass is specified
before wol:
  "sopass AA:BB:CC:DD:EE:FF wol g"

More resilently handle wrong configurations:
  "wol pu wol m" => gives m.
  "wol pu wol" => should give NONE and warn (instead of "pu").

Also accept tab as separator.

(cherry picked from commit bd1c0086bd)
2015-10-20 17:19:59 +02:00
Beniamino Galvani
7cf30fe47e wake-on-lan: add option to keep existing settings
Add a new 'ignore' option to NMSettingWired.wake-on-lan which disables
management of wake-on-lan by NetworkManager (i.e. the pre-existing
option will not be touched). Also, change the default behavior to be
'ignore' instead of 'disabled'.

https://bugzilla.gnome.org/show_bug.cgi?id=755182
(cherry picked from commit e587dcb16e)
2015-10-20 17:13:21 +02:00
Beniamino Galvani
d952ee637f po: remove unused messages from Italian (it) translation
The messages were generated when the code contained preprocessor
strings inside translation macro. See commit 81e72d9483 and
https://bugzilla.gnome.org/show_bug.cgi?id=744998#c2
2015-10-20 15:40:21 +02:00
Jiří Klimeš
ca599fad70 nmcli: fix bash completion of words containing colon (rh #1271271)
Test:
$ sudo ip link add a🅱️c type dummy
$ nmcli device delete<Tab><Tab>
$ nmcli device delete a<Tab>

See also:
http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons
http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727

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

https://bugzilla.redhat.com/show_bug.cgi?id=1271271

(cherry picked from commit 91dde2c865)
2015-10-20 12:05:58 +02:00
Lubomir Rintel
2d8a1ae56a ifcfg-rh/tests: add a missing file to the distribution
Fixes: 68eb350ad8
(cherry picked from commit cc6b07c439)
2015-10-19 16:47:42 +02:00
Thomas Haller
4321993296 core: merge branch 'th/wait-carrier-rh1079353'
The wait-for-carrier patches from rh#1079353 had several
issues. With this, the feature should work mostly.

https://bugzilla.redhat.com/show_bug.cgi?id=1079353

(cherry picked from commit e5f7fa314c)
2015-10-19 15:51:40 +02:00
Thomas Haller
d65897222a device: properly cancel queued activation request
We would leak the NMActivationRequest when carrier didn't
come within timeout. We must properly set the state of the
activation request.

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
Fixes: 0bfe635119
(cherry picked from commit 839330cd39)
2015-10-19 15:51:05 +02:00
Thomas Haller
be3aee8b32 device: don't wait for carrier when activating static connection
When the connection to be activated doesn't require carrier,
don't queue it to wait for it.

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
Fixes: 0bfe635119
(cherry picked from commit 118de885ea)
2015-10-19 15:51:01 +02:00
Thomas Haller
971a7611bd device: refactor using nm_clear_g_source() for priv->carrier_wait_id
(cherry picked from commit c89fd1ea76)
2015-10-19 15:50:08 +02:00
Thomas Haller
31b594561c manager: fix activation without specified device
For an explicit user-request, we relax some checks when searching for a suitable
device; such as requiring-carrier.

Without this patch, a connection-up while the device has no carrier yet,
would fail right away with "No suitable device found for this connection."

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
Fixes: 0bfe635119
(cherry picked from commit cff3e93527)
2015-10-19 15:50:03 +02:00
Thomas Haller
2a8c93e940 platform: fix link-detection for s390 CTC-type devices
Commit 02c6a93343 (rh#1212118)
introduced detection of CTC devices based on the driver name.

That was broken a while ago while refactoring.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1212118
https://bugzilla.redhat.com/show_bug.cgi?id=1272974

Fixes: ddaea22332
(cherry picked from commit 8a6afe92c1)
2015-10-19 12:27:27 +02:00
Jiří Klimeš
ba46efd077 libnm: specify (transfer none) introspection annotation (bgo #756380)
Otherwise the callers would free the address and it would result in
double-free.

Ideally, the function would return const pointer, but changing it now
would require changing also other prototypes and much code due to
snowball effect of const.

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

(cherry picked from commit 237030ce2b)
2015-10-12 12:46:51 +02:00
Thomas Haller
6f06ec0aba macros: remove early return from nm_clear_g_signal_handler()
It is valid to call nm_clear_g_signal_handler() with missing
@self argument if (and only if) the @id is unspecified as well.

Remove the check for @self to get an assertion in case @id
is missing *and* @self is invalid. In this case,
g_signal_handler_disconnect() will raise a g_critical() for us.

Fixes: c33416178f
(cherry picked from commit 76958f94d4)
2015-10-12 11:14:33 +02:00
Jiří Klimeš
23313d711f macros: allow NULL pointer in nm_clear_g_signal_handler()
It does not make sense to issue an error. This should be a helper function.
"NetworkManager[18341]: nm_clear_g_signal_handler: assertion 'G_IS_OBJECT (self)' failed"
error started since commit e6d7fee5a6 due to that.

(cherry picked from commit c33416178f)
2015-10-12 11:14:31 +02:00
Thomas Haller
a77a3aa7dd device: fix wrongly managing external-down device due to not setting EXTERNAL_DOWN
The unmanaged-flag NM_UNMANAGED_EXTERNAL_DOWN is initially set during
nm_device_finish_init(). But it was only set if the device was down at
that point.

If due to a race the platform device was not yet initialized, a later
initialization in device_link_changed() would clear NM_UNMANAGED_PLATFORM_INIT.
If the device is not external-down (because it was already up during
nm_device_finish_init()), the device will be managed right away with
reason NM_DEVICE_STATE_REASON_NOW_MANAGED.

Together with commit e29ab54335, this
is a race that causes a failure to assume the external-down device.

https://bugzilla.redhat.com/show_bug.cgi?id=1269199
(cherry picked from commit 120847c8a3)
2015-10-09 23:41:34 +02:00
Thomas Haller
b15204d991 platform: downgrade logging level for "event-notification" messages
We get a lot of these debugging message, although the event is entirely
internal to NMLinuxPlatform and only interesting when debugging a problem
in platform itself.

Downgrade to TRACE level.

(cherry picked from commit 9f1eb190f7)
2015-10-09 15:40:10 +02:00
Jiří Klimeš
946c8e2152 tui: add a checkbox for ignore-auto-routes (bgo #756200)
https://bugzilla.gnome.org/show_bug.cgi?id=756200

(cherry picked from commit ce27e1e21e)
2015-10-09 09:31:49 +02:00
Beniamino Galvani
2d86d557f3 device/vlan: update VLAN MAC address when parent's one changes
When a VLAN has a bond as parent device the MAC address of the bond
may change when other devices are enslaved and then the VLAN would
have a MAC which is different from parent's one.

Let the VLAN device listen for changes in hw-address property of
parent and update its MAC address accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=1264322
(cherry picked from commit e6d7fee5a6)
2015-10-08 22:13:26 +02:00