Commit graph

226 commits

Author SHA1 Message Date
Lubomir Rintel
502b45f0d4 tests: raise the mock service startup timeout
Python is just too slow on some machines. Needed around twice the previous
limit on BCM2835 with Pidora 20, let's add some safety margin too.

(cherry picked from commit 81cc4d27b1)
2015-08-17 10:54:05 +02:00
Jiří Klimeš
91c0555afa libnm: add new functions allowing passing options to RequestScan() D-Bus call
nm_device_wifi_request_scan_options()
nm_device_wifi_request_scan_options_async()

(cherry picked from commit 7691fe5753)
2015-08-14 13:30:17 +02:00
Dan Williams
6bd3f2637d libnm: fix nm_access_point_get_last_seen() code doc after 1e85c358
Fixes: 1e85c358
(cherry picked from commit 70f5968e9c)
2015-08-09 14:30:02 +02:00
Thomas Haller
9c7fe8c2ee libnm: add NM_AVAILABLE_IN_1_0_6 for new API nm_access_point_get_last_seen()
Fixes: fade4ded37
2015-08-09 11:04:13 +02:00
Dan Williams
fade4ded37 libnm: add Wi-Fi AP 'last-seen' property 2015-08-07 12:38:59 -05:00
Beniamino Galvani
5c11d26a2e nm-manager: add 'metered' property
This introduces a global metered property which makes easier for
clients to obtain the metered status of the current primary
connection.

(cherry picked from commit 04d5804dd5)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
4eb05767ee libnm-core: add 'metered' property to NMSettingConnection
Add a 'metered' enum property to NMSettingConnection with possible
values: unknown,yes,no. The value indicates the presence of limitations
in the amount of traffic flowing through the connection.

(cherry picked from commit 6f647fe689)
2015-07-22 13:52:45 +02:00
Beniamino Galvani
77a7e913a2 core,libnm: add 'metered' property to NMDevice
(cherry picked from commit bbbf522941)
2015-07-22 13:52:45 +02:00
Dan Williams
774170016b libnm/libnm-glib: don't quit in the middle of asking for secrets (bgo #752237)
If the VPN plugin terminated and the user started it again, then the
quit timer will still be running and it sometimes happens that the
VPN plugin will quit while the UI is asking the user for secrets.
That's not very nice, so don't do that.

Reproducer: while connect to the VPN, suspend your laptop.  Then
resume it, and immediately re-start the VPN connection.  Watch the
secrets dialog disappear within a very short time.

https://bugzilla.gnome.org/show_bug.cgi?id=752237
2015-07-16 16:52:48 -05:00
Dan Williams
d22a2a3165 libnm/libnm-glib: clean up VPN plugin timeouts
Use nm_clear_g_source().
2015-07-16 16:52:48 -05:00
Lubomir Rintel
bc82f6f690 vpn-plugin-old,dispatcher: cast unchecked g_variant_lookup() calls to void
This is done to silence coverity. In the dispatcher the existence of the
key is checked before and we're fine with leaving the value untouched
in the vpn-plugin-old.

(cherry picked from commit a9996c4f1d)
2015-07-14 13:19:28 +02:00
Thomas Haller
d407727f61 libnm: fix backported autoconnect-slaves symbols in libnm.ver
On master, we added new symbols
  nm_setting_connection_autoconnect_slaves_get_type()
  nm_setting_connection_get_autoconnect_slaves()
in the libnm_1_2_0 section.

It is wrong to extend the linker section of a stable
release. When backporting the patch we must create a
new linker section.

Move the symbols to the libnm_1_0_4 section. Note that
master (1.1) also defines the symbol there, so that the
upgrade path works.

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

Fixes: 408b631673
2015-06-26 16:33:34 +02:00
Lubomir Rintel
a4b063f8a9 libnm,dbus-helpers: include glib-compat for g_test_initialized()
(cherry picked from commit 4a4f703c94)
2015-06-22 17:57:03 +02:00
Jiří Klimeš
408b631673 libnm: add autoconnect-slaves property to NMSettingConnection
The property is used for controlling whether slaves should be brought up with
a master connection. If 0, activating the master will not activate slaves.
But if set to 1, activating the master will bring up slaves as well.
The property can have the third state (-1), meaning that the value is default.
That is either a value set in the configuration file for the property, or 0.

(cherry picked from commit 6caafab258)
2015-06-19 12:18:51 +02:00
Thomas Haller
ddfa354400 device: add nm_device_get_type_description() function
Add a function to get a concise representation of the
device type.

libnm already has nm_device_get_type_description() for that
and it is shown by

  nmcli -f GENERAL.TYPE device show

Reimplement that function for nm-core. Just take care that the
two implementations don't diverge.

(cherry picked from commit e9e9d44468)
2015-06-19 12:10:51 +02:00
Lubomir Rintel
0f95b5c345 builds: only enable TAP driver for glib >= 2.37.6
No TAP support for previous versions and --tap argument is silently ignored,
confusing the TAP driver.

(cherry picked from commit c47c06470a)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
c099e9d43b tests: don't try to connect to the private socket
Even if we're running the tests as root we still want to use the mock
service instead of whatever version of daemon runs on the test host.

(cherry picked from commit 02e3d6c286)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
fe3e32c034 tests: use the TAP formatter
The test results in standard format are easily integrated into CI systems.

(cherry picked from commit 6463ce5dd9)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
df11b267fd build: switch to parallel test harness
This will make it possible to use the TAP formatter.

(cherry picked from commit 380ed63318)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
0e20868f4f tests: always spawn private d-bus
Parallel test runs would not be possible without this.

(cherry picked from commit d0e25ac8be)
2015-06-19 11:52:50 +02:00
Thomas Haller
6099378bc6 libnm: fix take ownership of floating argument in NMSecretAgentOld:get_secrets_cb()
The previous patch 9ffcecf86a was
completely wrong.

It tried to fix callers that provided a floating GVariant reference.
We require the caller to unref @secrets, so the correct fix it to
ensure that the reference is not floating.

Fixes: 6793a32a8c

(cherry picked from commit 9ffcecf86a)
(cherry picked from commit 2071e4794f)
2015-06-03 19:45:08 +02:00
Lubomir Rintel
12a68c9e99 nm-remote-connection: take a reference to self while calling get_settings
(process:6888): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GDBusProxy'

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x3149a3b224 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffda70) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x0000003148e50c70 in g_logv (log_domain=0x3149a3b224 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffda70) at gmessages.c:1046
  #1  0x0000003148e50eaf in g_log (log_domain=log_domain@entry=0x3149a3b224 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x3149a42690 "invalid unclassed pointer in cast to '%s'") at gmessages.c:1079
  #2  0x0000003149a34171 in g_type_check_instance_cast (type_instance=type_instance@entry=0x6fc530, iface_type=<optimized out>) at gtype.c:4030
  #3  0x00007ffff7d6b016 in nmdbus_settings_connection_call_get_settings_finish (proxy=0x6fc530, out_settings=out_settings@entry=0x7fffffffdbb8, res=res@entry=0x6fe150, error=error@entry=0x0)
      at nmdbus-settings-connection.c:1303
  #4  0x00007ffff7ce8813 in updated_get_settings_cb (proxy=<optimized out>, result=0x6fe150, user_data=user_data@entry=0x6fc650) at nm-remote-connection.c:588
  #5  0x000000314a27640d in g_simple_async_result_complete (simple=0x6fe150 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #6  0x000000314a2df47c in reply_cb (connection=<optimized out>, res=0x6fe0e0, user_data=user_data@entry=0x6fe150) at gdbusproxy.c:2623
  #7  0x000000314a27640d in g_simple_async_result_complete (simple=0x6fe0e0 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #8  0x000000314a2d48cc in g_dbus_connection_call_done (source=<optimized out>, result=<optimized out>, user_data=user_data@entry=0x7fffec01a320) at gdbusconnection.c:5502
  #9  0x000000314a27640d in g_simple_async_result_complete (simple=0x6e5f40 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #10 0x000000314a27647c in complete_in_idle_cb (data=0x6e5f40) at gsimpleasyncresult.c:775
  #11 0x0000003148e49b6b in g_main_context_dispatch (context=0x687970) at gmain.c:3064
  #12 0x0000003148e49b6b in g_main_context_dispatch (context=context@entry=0x687970) at gmain.c:3663
  #13 0x0000003148e49f08 in g_main_context_iterate (context=0x687970, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3734
  #14 0x0000003148e4a232 in g_main_loop_run (loop=0x687a80) at gmain.c:3928
  #15 0x00000000004136a1 in main (argc=<optimized out>, argv=<optimized out>) at nmcli.c:632
  (gdb)

(cherry picked from commit 9d3b31e1ae)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
0d07de4f96 libnm: set error when failing registration of old secret agent
We return FALSE, we ought to return a meaningful error.

(cherry picked from commit 0ea1fb4e5e)
2015-04-28 12:29:32 +02:00
Lubomir Rintel
1fff1a3d36 libnm,core: don't mix up enum types
Touches a weak spot on clang's soul.

(cherry picked from commit fd41aa451b)
2015-04-23 13:48:51 +02:00
Lubomir Rintel
97541f055a libnm,nm-object: fix tracing of object removal
When a new connection is activated and presently active connection goes away,
the active-connection-removed signal is not emitted for the old connection.
This is what happens:

1.) Initially, nm-manager::active-connections = [ActiveConnection/old]

2.) First PropertyChange is signalled for the new connection addition:
nm-manager::active-connections = [ActiveConnection/old,ActiveConnection/new]

This triggers load of ActiveConnection/new object.

3.) Another PropertyChange is signalled for the old connection removal:
nm-manager::active-connections = [ActiveConnection/new]

This removes the ActiveConnection/old object from
nm-manager::active-connections and enqueues active-connection-removed
signal. The signal is not emmitted as there's a reload from 2.) in progress.

4.) ActiveConnection/new reload finished

object_property_complete() compares
[ActiveConnection/old,ActiveConnection/new] from its odata to current
nm-manager::active-connections and incorrectly concludes that
ActiveConnection/old was just added and removes the enqueued
active-connection-removed signal.

This patch fixes the issue by remembering the original
nm-manager::active-connections property value at 2.).

[thaller@redhat.com: fixed an integer overflow and odata->array unreffing]

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
(cherry picked from commit dba4e8ece8)
2015-03-16 10:57:09 +01:00
Lubomir Rintel
411fa7d002 test: initialize auto-destructed pointers
Otherwise the compiler complains that they could be left uninitialized in case
the function returns too early.

Fixes: 76745817c3
(cherry picked from commit 2981839bde)
2015-03-13 11:50:50 +01:00
Thomas Haller
26406d0868 libnm/tests: enable valgrind for libnm tests
(cherry picked from commit e7356ef0a6)
2015-03-13 11:50:05 +01:00
Thomas Haller
26f96871a1 libnm/tests: fix memleaks in test code for valgrind
(cherry picked from commit 76745817c3)
2015-03-13 11:50:05 +01:00
Thomas Haller
b9a8f3c059 tests: enable valgrind tests for tests
(cherry picked from commit c50f30e79c)
2015-03-13 11:50:04 +01:00
Thomas Haller
5ab76d006e libnm: fix memleak in _nm_dbus_bind_properties()
(cherry picked from commit 1567a9f712)
2015-03-13 11:50:03 +01:00
Lubomir Rintel
293a507fa8 libnm: drop libdbus-glib from pkg-config file
libnm uses GIO DBus library instead.

https://mail.gnome.org/archives/networkmanager-list/2015-January/msg00065.html
(cherry picked from commit 799820f859)
2015-01-22 13:31:45 -06:00
Lubomir Rintel
f023431aa7 libnm: make NMDhcp6Config inherit from NMDhcpConfig
Otherwise it does not register the "options" property and an assertion fails
when the user prints connection that has DHCPv6 options:

  $ LIBNM_GLIB_DEBUG=properties-changed nmcli c show yolo
  ...
  libnm-Message: Property 'options' unhandled.
  ...
  (process:13522): libnm-CRITICAL **: nm_dhcp_config_get_options: assertion 'NM_IS_DHCP_CONFIG (config)' failed

(cherry picked from commit 4615d74de0)
2015-01-02 20:39:20 +01:00
Dan Winship
a095e48f7b docs: misc small fixes
Cleans up all of the warnings that aren't overly annoying to clean up.
2014-12-18 13:46:11 -05:00
Jiří Klimeš
1c2b75c5a0 tests: mute coverity INFINITE_LOOP error
Error: INFINITE_LOOP (CWE-835): [#def17]
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:93: loop_top: Top of the loop.
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:94: loop_bottom: Bottom of the loop.
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:93: loop_condition: If "notified" is initially true then it will remain true.

Error: INFINITE_LOOP (CWE-835): [#def18]
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:191: loop_top: Top of the loop.
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:192: loop_bottom: Bottom of the loop.
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:191: loop_condition: If "result & NOTIFY_MASK" is initially true then it will remain true.
NetworkManager-0.9.11.0/libnm/tests/test-nm-client.c:191: loop_condition: If "result & SIGNAL_MASK" is initially true then it will remain true.

(cherry picked from commit ce6323d4df)
2014-12-16 21:47:01 +01:00
Dan Winship
ff362700f1 libnm: remove __libnm_local section from version script
I had argued for putting the local symbols in their own section, since
it doesn't make sense to have local symbols introduced in 1.2 in the
libnm_1_0_0 section... but apparently even if the section has no
exported symbols, rpm's find-provides still picks it up if it's there,
creating an ugly additional "provides" for libnm. So get rid of that.

(cherry picked from commit 8d96273870)
2014-12-16 09:26:25 -06:00
Lubomir Rintel
a3f9e51927 agent-manager: don't ever fail the secrets requests from GetSecrets()
VPN connections always return true for nm_connection_need_secrets(), but the
documented behavior of GetSecrets() is just to return any secrets we have
(otherwise nmcli c --show-secrets would not be useful for VPN connections).
2014-12-11 11:15:53 +01:00
Thomas Haller
2788c344c3 libnm/build: add versioning to linker script
https://bugzilla.gnome.org/show_bug.cgi?id=741069
2014-12-05 11:56:37 +01:00
Thomas Haller
6399170ff3 libnm: add function nm_utils_file_search_in_paths()
We now also use a similar function in VPN plugins. It makes
sense to provide a generic implementation in libnm.

Signed-off-by: Thomas Haller <thaller@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=740783
2014-12-05 11:07:42 +01:00
Jiří Klimeš
b11416de6a libnm: check pspec before accessing it in handle_property_changed()
Fixes: 1f8ec6122e

Coverity:
libnm/nm-object.c:926: var_deref_op: Dereferencing null pointer "pspec".
libnm/nm-object.c:924: var_deref_op: Dereferencing null pointer "pspec".
2014-12-05 09:38:40 +01:00
Jiří Klimeš
d637b3efae libnm: missing break on get_property
Coverity:
Defect type: MISSING_BREAK
libnm/nm-dhcp-config.c:117: fallthrough: The above case falls through to this one.
2014-12-05 09:38:40 +01:00
Thomas Haller
74bdaf1ad8 libnm: hide nm_utils_uuid_generate_from_string() from public API 2014-12-04 17:02:22 +01:00
Dan Winship
d91bcc4960 libnm-core: drop nm_utils_rsa_key_encrypt(), _encrypt_aes()
In general, we shouldn't end up with an unencrypted copy of a
certificate key anyway, so this function ought to be unnecessary (or
at least, not broadly useful enough to be in the public API).
nm-applet's GConf migration tool needs it, but that will eventually go
away, and until then it can just use libnm-util.
2014-12-04 08:39:54 -05:00
Dan Winship
3b86cc047e libnm: remove nm_utils_init() from the public API
Remove nm_utils_init() from the public API, and just do it as a
constructor instead.
2014-12-04 08:39:54 -05:00
Dan Winship
926f4e1473 libnm: drop nm_utils_deinit()
It was a no-op anyway.
2014-12-04 08:39:54 -05:00
Jiří Klimeš
382906c391 libnm: (trivial) correct an example in NMSecretAgentOldGetSecretsFunc docs 2014-11-26 14:07:46 +01:00
Jiří Klimeš
78068d6bae libnm: add missing (transfer) annotation for nm_device_vlan_get_parent() 2014-11-25 12:48:11 +01:00
Jiří Klimeš
21fd88c43d libnm: add :parent property for VLAN devices 2014-11-24 10:33:22 +01:00
Dan Winship
71b4c05fca libnm: rename NMSecretAgent to NMSecretAgentOld
As with NMVpnPluginOld, rename NMSecretAgent to NMSecretAgentOld, to
leave the name "NMSecretAgent" open for a new-and-improved version in
NM 1.2.
2014-11-21 12:17:41 -05:00
Dan Winship
1c4f41c610 libnm-core: add nm_utils_file_is_certificate() and _file_is_private_key()
Add nm-utils methods to check if a file is a certificate or private
key file.

nm-applet currently has its own internal versions of these, but they
ended up having to duplicate a bunch of logic that we already have in
crypto.c.
2014-11-21 08:46:07 -05:00
Lubomir Rintel
224acba8f6 cli,vpn: merge branch 'lr/nm-1-0-fixes'
Fixes for various issues identified during 1.0 testing.

https://bugzilla.gnome.org/show_bug.cgi?id=740135
2014-11-20 16:12:21 +01:00