Commit Graph

13873 Commits

Author SHA1 Message Date
Thomas Haller
3e3bceb6db gitignore: ignore test-utils test binary
Fixes: e603c86926
2015-11-16 16:32:51 +01:00
Thomas Haller
42ab7c8ec1 gitignore: ignore test-lldp file
Fixes: ff31171a1c
2015-11-16 16:30:36 +01:00
Thomas Haller
47008aaaf9 valgrind: add suppression for glib's g_thread_return() 2015-11-16 15:58:42 +01:00
Thomas Haller
8c01dc59f8 valgrind: update suppression file for glib's thread pool 2015-11-16 15:58:42 +01:00
Jiří Klimeš
2c8c4ce2e4 nm-online: do not put \r to a translatable string (bgo #758102)
msgmerge complains with
"warning: internationalized messages should not contain the '\r' escape sequence"

Found by Anders Jonsson <anders.jonsson@norsjovallen.se>

https://bugzilla.gnome.org/show_bug.cgi?id=758102
2015-11-16 15:19:53 +01:00
Jiří Klimeš
b92397f925 all: fix typos in the code and update translations for that (bgo #758102)
Found by Anders Jonsson <anders.jonsson@norsjovallen.se>

https://bugzilla.gnome.org/show_bug.cgi?id=758102
2015-11-16 14:29:14 +01:00
Yuri Chornoivan
32ea25eaf2 pi: update Ukrainian (uk) translation (bgo #758136)
https://bugzilla.gnome.org/show_bug.cgi?id=758136
2015-11-16 13:24:43 +01:00
Piotr Drąg
ec46ddf113 po: update Polish (pl) translation (bgo #758067)
https://bugzilla.gnome.org/show_bug.cgi?id=758067
2015-11-16 13:01:12 +01:00
Beniamino Galvani
ac78c18855 libnm-core/tests: fix bit shift
Use a maximum shift amount of 63 for guint64.

Fixes: 0a3c1f5774
2015-11-15 11:13:41 +01:00
Beniamino Galvani
bc9d034775 macros: avoid signed overflow in nm_utils_is_power_of_two()
If __x is signed and its value is the minimum allowed for the type,
(__x - 1) causes a signed overflow, which has an undefined
behavior. Compiling with -fsanitize=undefined produces the warnings:

test-general.c:4499:619: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
test-general.c:4506:681: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'TEST_IS_POWER_OF_TWP_ENUM_SIGNED'
test-general.c:4501:619: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int'
test-general.c:4509:691: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'TEST_IS_POWER_OF_TWP_ENUM_UNSIGNED_64'

Change the order of expressions to avoid this.

Fixes: 0a3c1f5774
2015-11-15 11:13:29 +01:00
Beniamino Galvani
f1b4eb9558 core: fix failed assertion when D-Bus service is already taken
When exiting after an error we must set the quitting flag in
nm-exported-object.c because during program destruction there can be
still exported objects which get disposed.

Fixes the following assertion:

 NetworkManager[14241]: (nm-exported-object.c:826):nm_exported_object_dispose: code should not be reached

 Process terminating with default action of signal 5 (SIGTRAP)
    at 0x7ACFD3B: _g_log_abort (gmessages.c:315)
    by 0x7ACFD3B: g_logv (gmessages.c:1041)
    by 0x7ACFEAE: g_log (gmessages.c:1079)
    by 0x7AD0196: g_warn_message (gmessages.c:1112)
    by 0x20F5B0:  nm_exported_object_dispose (nm-exported-object.c:826)
    by 0x316FC4:  dispose (nm-settings.c:2222)
    by 0x7841A5B: g_object_unref (gobject.c:3137)
    by 0x2330F3:  dispose (nm-manager.c:5249)
    by 0x7841A5B: g_object_unref (gobject.c:3137)
    by 0x23C511:  _nm_singleton_instance_destroy (NetworkManagerUtils.c:174)
    by 0x400FBE6: _dl_fini (in /usr/lib64/ld-2.21.so)
    by 0x8009647: __run_exit_handlers (in /usr/lib64/libc-2.21.so)
    by 0x8009694: exit (in /usr/lib64/libc-2.21.so)
2015-11-13 18:01:33 +01:00
Glenn Washburn
61948913c5 build: add backward compatibility define for missing CLOCK_BOOTTIME
[thaller@redhat.com: modified original patch]

https://bugzilla.gnome.org/show_bug.cgi?id=757911
2015-11-13 17:19:40 +01:00
Glenn Washburn
6263703286 build: disable Pragmas for pre 4.6 gcc
Gcc 4.6 introduced Pragma "GCC diagnostic" (https://gcc.gnu.org/gcc-4.6/changes.html)
Don't use them for older gcc.

[thaller@redhat.com: modified original patch]

https://bugzilla.gnome.org/show_bug.cgi?id=757910
2015-11-13 17:19:40 +01:00
Lubomir Rintel
faae84370f dispatcher: don't abort when VPN connections have no IPv4
They don't need it. Also, we shouldn't assert on something that can be
done via a D-Bus API.
2015-11-13 16:13:40 +01:00
Lubomir Rintel
42ee2e6792 vpn-service-plugin: correctly emit ip6-config signal on dbus skeleton 2015-11-13 16:13:40 +01:00
Dan Williams
46b46fd1ca wifi: clean up removal of current AP if it fails during association (bgo #733105)
Now that NM follows the supplicant's scan list and CurrentBSS, any AP that isn't
known to the supplicant will be 'fake', and priv->current_ap always tracks
CurrentBSS.

We can then simplify link_timeout_cb() because any AP that would have been
force-removed before will now be marked "fake" if it's unknown to the supplicant,
and will always be removed by set_current_ap(), so we can remove the force
argument.  To better fix #733105 we never want to remove an AP known to
the supplicant, even if it we failed to connect to it.

https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-11-12 13:32:45 -06:00
Lubomir Rintel
ec4d653532 agent-manager: add a missing break in case 2015-11-12 14:24:57 +01:00
Lubomir Rintel
4b7cb5a634 nmcli/bash-completion: fix --show-password parsing
Fixes: 2f52a10be1
2015-11-12 13:49:55 +01:00
Lubomir Rintel
9f92bb1f63 device: don't try to re-add addresses that vanish on device disconnection
They are not DAD failures. Also, we must not try adding link-local address when
disconnecting.
2015-11-12 13:37:31 +01:00
Lubomir Rintel
f8973a7f42 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, ...}
2015-11-11 19:42:17 +01:00
Thomas Haller
99ff6681b7 wifi: minor refactoring logging BSSID in supplicant_iface_new_bss_cb() 2015-11-11 18:07:34 +01:00
Thomas Haller
d5373959f9 Revert "wifi: do no crash when getting BSSID fails"
Since commit 7cb323d923,
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 e9bc18d2a7.
2015-11-11 18:05:22 +01:00
Dan Williams
7cb323d923 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
2015-11-11 17:49:53 +01:00
Beniamino Galvani
a74e98bfc6 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
2015-11-11 17:24:39 +01:00
Thomas Haller
efe1d66c31 valgrind: drop unused suppressions for libnl-route-3 (rtnl)
Since we no longer link against libnl-route-3.so, these suppressions are
obsolete. Drop them.
2015-11-11 17:08:24 +01:00
Thomas Haller
549ec35d7b libnm/keyfile: fix leak in ip6-addr-gen-mode writer
Fixes: f70c8f3d29
2015-11-11 16:15:41 +01:00
Thomas Haller
8d1233e67e 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
2015-11-11 10:56:05 +01:00
Jiří Klimeš
0dc48370b4 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
2015-11-11 09:47:51 +01:00
Jiří Klimeš
98b0b4b402 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
2015-11-11 09:45:53 +01:00
Thomas Haller
af10948e87 core/dbus: merge branch 'dcbw/gdbus-object-manager' (early part)
https://bugzilla.gnome.org/show_bug.cgi?id=753566
2015-11-10 18:24:55 +01:00
Thomas Haller
f6272144e9 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
2015-11-10 18:12:12 +01:00
Thomas Haller
cf146e9a0d ifcfg-rh: use distinct D-Bus connection for ifcfg-rh service
Prevsiouly, the ifcfg-rh service and the regular NetworkManager
were both exported on the same D-Bus connection. That had the
effect, that on both services ("com.redhat.ifcfgrh1" and
"org.freedesktop.NetworkManager") all objects were visible.

This is also problematic later when we use GDBusObjectManager
for the org.freedesktop.NetworkManager service.

Export the ifcfg service on a separate bus connection.

One downside is, that we don't bother exporting the service
on the private socket and thus the service is not available
without D-Bus daemon.
Also, if the bus disconnects, we don't retry or recover. Instead
the D-Bus service is dead until restart.
2015-11-10 18:12:12 +01:00
Thomas Haller
57128494e0 exported-object: split out the creation of interface skeletons
Will be reused for ifcfg-rh plugin, which also has a skeleton,
but will not implement NMExportedObject.
2015-11-10 18:12:12 +01:00
Dan Williams
f9ee20a7b2 core: explicitly unexport objects when we're done with them
Previously most objects were implicitly unexported when they were
destroyed, but since refcounts may make the object live longer than
intended, we should explicitly unexport them when they should no
longer be present on the bus.

This means we can assume that objects will always be un-exported
already when they are destroyed, *except* when quitting where most
objects will live until exit because NM leaves interfaces up and
running on quit.
2015-11-10 18:12:12 +01:00
Thomas Haller
d518278011 wifi/ap: use direct-hashing for aps hash
The @aps hash has the D-Bus path of the exported
object as key. It already rightly saved to additionally
copy the string and relied on the path being stable.

When doing that, we can just go one step further and
use direct-hashing instead of string-hashing.

Note that NMExportedObject already promises that
the path will not change as long as the object is
exported. See code comments in the export/unexport
functions.
2015-11-10 18:12:12 +01:00
Thomas Haller
96f40dcdcd wifi/ap: explicitly unexport AP and refactor add/remove AP
For future use of ObjectManager, we must explicitly unexport
the AP and no longer depend on having it unexported during
deconstruction (because object manager keeps the instance alive).

Also refactor adding/removal of APs and move the export/unexport
calls to the place where we emit the signal.
2015-11-10 18:12:12 +01:00
Thomas Haller
0c1e290c97 wifi/ap: set the current-ap after adding the new AP
First add the new AP, before setting it as current.

Also set the AP *after* thawing the notifications. Otherwise
it is not clear which notification gets raised first as their
order is undefined. But we want that the client first sees
the new AP and later gets a notification about having a new
current.
2015-11-10 18:12:12 +01:00
Thomas Haller
8a8ecc46ca core: fix wrongly exporting object before instance is fully constructed
Exporting the object already in the *_init() function will later
break because the object is not yet fully initialized at that point.

Add a convenient flag so that the NMExportedObject parent implementation
automatically can export itself. This saves the derived class from
overwriting the constructed() method.

Also add an assertion to catch such bugs.
2015-11-10 18:12:12 +01:00
Thomas Haller
ae5cfba05c ifcfg-rh: fix chaining constructed() method for SettingsPluingIfcfg 2015-11-10 18:12:12 +01:00
Dan Williams
09a2be3b65 core: fix builds with older gcc (like 4.4.x) 2015-11-10 11:10:03 -06:00
Lubomir Rintel
4ce43fd5e6 device: don't call into rdisc when there's none 2015-11-10 16:48:17 +01:00
Lubomir Rintel
e02afcff09 device: fix a dad6_failed_addrs use-after-free 2015-11-10 16:48:17 +01:00
Lubomir Rintel
833e126cf8 device: avoid removing a list element while iterating it 2015-11-10 16:48:17 +01:00
Thomas Haller
caa2de563d build: avoid invalid compiler warning
NetworkManagerUtils.c:3308:93: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
   key_len = (((key_len) > (((guint32) 0xffffffff))) ? (((guint32) 0xffffffff)) : (((key_len) < (0)) ? (0) : (key_len)));
                                                                                    ~~~~~~~~~ ^ ~~~

Fixes: e603c86926
2015-11-10 15:31:49 +01:00
Beniamino Galvani
33d626b295 merge: branch 'bg/lldp-test-bgo757005'
https://bugzilla.gnome.org/show_bug.cgi?id=757005
2015-11-10 14:25:45 +01:00
Beniamino Galvani
ff31171a1c lldp: add test case
Add a test for the LLDP listener to ensure that things don't
accidentally break when we import new code from systemd upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=757005
2015-11-10 14:25:05 +01:00
Beniamino Galvani
6bfa0674c1 lldp: decouple NMLldpListener from platform
Make NMLldpListener independent from platform code so that it can be
tested more easily.
2015-11-10 14:17:42 +01:00
Beniamino Galvani
5b3137984d cli: add command for displaying LLDP neighbors
The list of LLDP neighbors is available through the D-Bus interface
and libnm already provides functions to retrieve it; make the list
available through nmcli as well. Sample output:

  $ nmcli device lldp
  NEIGHBOR[0].DEVICE:                     eth0
  NEIGHBOR[0].CHASSIS-ID:                 00:13:21:58:CA:42
  NEIGHBOR[0].PORT-ID:                    1
  NEIGHBOR[0].PORT-DESCRIPTION:           1
  NEIGHBOR[0].SYSTEM-NAME:                ProCurve Switch 2600-8-PWR
  NEIGHBOR[0].SYSTEM-DESCRIPTION:         ProCurve J8762A Switch 2600-8-PWR, revision H.08.89
  NEIGHBOR[0].SYSTEM-CAPABILITIES:        20 (mac-bridge,router)
  NEIGHBOR[1].DEVICE:                     eth2
  NEIGHBOR[1].CHASSIS-ID:                 00:01:30:F8:AD:A2
  NEIGHBOR[1].PORT-ID:                    1/1
  NEIGHBOR[1].PORT-DESCRIPTION:           Summit300-48-Port 1001
  NEIGHBOR[1].SYSTEM-NAME:                Summit300-48
  NEIGHBOR[1].SYSTEM-DESCRIPTION:         Summit300-48 - Version 7.4e.1 (Build 5)
  NEIGHBOR[1].SYSTEM-CAPABILITIES:        20 (mac-bridge,router)

https://bugzilla.gnome.org/show_bug.cgi?id=757307
2015-11-10 14:06:02 +01:00
Jiří Klimeš
2b4b78eba1 merge: add 'nmcli device wifi hotspot' command (bgo #756081)
Synopsis:
nmcli device wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>]
                          [band a|bg] [channel <channel>]
                          [password <password>] [--show-password]

https://bugzilla.gnome.org/show_bug.cgi?id=756081
2015-11-10 09:30:39 +01:00
Jiří Klimeš
fe5927ae48 nmcli: add a hotspot example to nmcli manual page 2015-11-10 09:15:41 +01:00