Commit graph

792 commits

Author SHA1 Message Date
Giovanni Campagna 36963d6381 libnm-glib: add missing symbol
The symbol is part of the public API (included in the GIR file),
and gjs complains loudly if a defined symbol is not found.

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

Acked-by: Pavel Šimerda <psimerda@redhat.com>
2013-08-19 12:18:34 +02:00
Dan Winship 4d8063cd78 libnm-glib: add NMClient:startup, nm_client_get_startup()
Expose the new NMManager:startup property on NMClient.
2013-08-16 17:27:34 -04:00
Jiri Pirko c4eade715f libnm-glib: add support for team device
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Pavel Šimerda 320a9d16a3 all: replace struct in_addr with guint32 2013-08-03 00:15:07 -05:00
Dan Williams cc924d8bab libnm-glib-vpn: add support for interactive secrets requests
There are three additions to the D-Bus interface for VPN plugins as
part of this patch:

1) ConnectInteractive(): called by NM instead of Connect() to let
the plugin know that it can request additional secrets during the
connection process using SecretsRequired

2) SecretsRequired: a new signal emitted by the plugin to indicate
to NetworkManager that additional secrets are required to connect;
can only be called if NetworkManager initiated the connection by
calling the ConnectInteractive() method

3) NewSecrets(): a new method of the plugin that NetworkManager calls
when new secrets requested by the SecretsRequired signal have been
retrieved from secret agents

We need new methods because agents need to be aware of the hints that
the VPN plugins may send with the SecretsRequired signal (detailing
the specific secrets that are required) and at this time, not all
agents support passing those hints to the VPN plugin authentication
dialogs.
2013-07-31 08:16:40 -05:00
Dan Williams eacd4cf8f9 libnm-glib-vpn: consolidate connect handling code 2013-07-31 08:16:40 -05:00
Dan Williams e7dbe20526 libnm-glib: add support for agent capabilities during registration
Tries the new RegisterWithCapabilities method first, and falls back
to the old Register method for compatibility with older NetworkManager.
2013-07-31 08:16:40 -05:00
Dan Winship 1f81851017 core: add monitor-connection-files=false and ReloadConnections
Add a "monitor-connection-files" config option, which can be set to
"false" to disable automatic reloading of connections on file change.

To go with this, add a new ReloadConnections method on
o.fd.NM.Settings that can be used to manually reload connections, and
add an nm-cli command to call it.
2013-06-14 12:57:47 -03:00
Dan Williams b10c4778c0 libnm-glib: fix device description with newer udev versions
At some point ID_MODEL_FROM_DATABASE became what we should look for; fixes
device description not being constructed for many devices.
2013-06-11 12:48:15 -05:00
Dan Winship 3b498b3ec0 libnm-glib: fix the object creation warning for remote connections
NMRemoteConnection is not a NMObject, so we can't always use
nm_object_get_path(),

https://bugzilla.gnome.org/show_bug.cgi?id=701762
2013-06-08 12:27:03 -03:00
Dan Williams c41bd34570 libnm-glib: add support for new connection unsaved functionality 2013-05-28 12:26:56 -05:00
Dan Williams 7d12ede07b libnm-glib: fix documentation C&P error 2013-05-15 13:44:51 -05:00
Dan Winship d529580cbb libnm-glib, core: use g_cclosure_marshal_generic
Since we depend on new glib now, we can just use the generic
marshaller rather than generating our own.
2013-05-08 14:59:29 -04:00
Dan Williams 2940d2b3e2 libnm-glib: fix introspection for IPv6 DNS servers
Posix apparently isn't a GObject Introspection module...
2013-05-07 17:15:21 -05:00
Dan Winship ae9a389f83 libnm-glib, cli: add nm_device_get_type_description
Add a new libnm-glib method to get the type description for a device,
and use it in nmcli. For most types, the type description is based on
the class name, but for NMDeviceGeneric, it comes from the
:type-description property.
2013-05-07 12:46:56 -04:00
Dan Winship 4819df28b4 core: add NMDeviceGeneric:type-description
Use nm_platform_link_get_type_name() to get information about the
generic device, and export that via D-Bus
2013-05-07 12:46:56 -04:00
Dan Winship ce4f2a4bd6 core, libnm-glib: add NMDeviceGeneric
Add NMDeviceGeneric, to provide generic support for unknown device
types, and create NMDeviceGenerics for those devices that NM
previously was ignoring. Allow NMSettingGeneric connections to be
activated on (managed) NMDeviceGenerics.
2013-05-07 12:46:56 -04:00
Martin Pitt 57a9fb3c89 Use %NULL macro in doc strings
Mass-converted "NULL" to "%NULL" in docstrings with

  find -name '*.c'| xargs sed -i '/^ \*.*[^%]NULL/ s/NULL\b/%NULL/g'
2013-04-19 10:08:17 -04:00
Martin Pitt d5fb24b5b5 libnm-glib: Make SecretAgent introspectable
Use the correct annotation for vfuncs, so that NMClient.SecretAgent becomes
introspectable.

Use "self" as the first argument of the vfuncs in their declarations, to match
the actual name in nm-secret-agent.c. This avoids warnings from g-ir-scanner.

https://bugzilla.gnome.org/show_bug.cgi?id=698184
2013-04-19 09:40:32 -04:00
Dan Williams 55cb1b74ee libnm-glib: ensure VpnStateChanged signals also notify VpnState property listeners
Both the VpnState property and the VpnStateChanged dbus signals update the
NMVPNConnection's 'vpn-state' GObject property, so we should ensure that
when either updates it due to a D-Bus event, GObject signals are sent
out for both too.
2013-04-08 11:30:32 -05:00
Dan Williams 110a40358d libnm-glib: never call NM D-Bus methods if NM isn't running
Though the client shouldn't be calling anything when NM isn't running
(because clients have nm_client_get_manager_running()), make sure
that NMClient never calls a NetworkManager method when NM isn't
on the bus.

Next, ensure NMObject doesn't try to refresh properties when NM isn't
running.  Creating an NMClient may trigger a property refresh request,
but if NM isn't running, defer that until NM starts, to ensure that
we don't D-Bus autostart NM.

Third, ensure NMRemoteSettings doesn't attempt to list connections
unless NM is running.

This prevents service activation of NetworkManager in lieu of dbus-glib
learning about DBUS_HEADER_FLAG_NO_AUTO_START.
2013-04-08 11:30:32 -05:00
Dan Williams 4a21eb08db libnm-glib: clear and recheck permissions on NM restarts 2013-04-08 11:30:32 -05:00
Dan Williams a87b5a15df libnm-glib: use private connection before trying the system bus
Use the D-Bus connection helper whenever we need a connection to
NM, which by default tries to use a private connection instead of
the shared bus connection whenever the user is root.  Doing this
by default will not change the behavior of libnm-glib, and allows
tools like nmcli and libnm-glib-using clients to work in minimal
environments (those without a bus daemon) by default.
2013-04-08 11:30:32 -05:00
Dan Williams 661d09852d libnm-glib: use helpers to create dbus proxies
When using a private connection, we need to use dbus_g_proxy_new_for_peer()
because the bus isn't involved.  Since many parts of libnm-glib create a
proxy for their corresponding remote object, consolidate the proxy creation
logic.

A later patch will add logic to use a private connection versus a bus-based
one.
2013-04-08 11:30:32 -05:00
Dan Williams 44f350c99d libnm-glib: add helper to connect to NM's private D-Bus socket
A number of places in the code need to get a connection to NM through
D-Bus, and that connection could be either a shared bus connection or
a private connection.  Consolidate that logic.

Unfortunately only dbus-glib >= 0.100 correctly supports private
connections (commit 8b7e4a1c4ae055864e26db4addbcc2dc38ee6963 fixes
this problem) so the private connection functionality is not enabled
for older dbus-glib versions.
2013-04-08 11:30:31 -05:00
Pavel Šimerda 1680143558 libnm-glib: adapt example to python 3.x
It now works with sufficiently recent python 2.x or python 3.x, whatever
is the distribution default. This patch fixes 'make check' for
distributions where 'python' means python 3.x, like Gentoo.
2013-04-02 11:44:24 +02:00
Dan Williams afc7f17191 libnm-glib: convert DHCP option parsing to GHashTableIter 2013-04-01 17:18:54 -05:00
Dan Williams 1699a93be3 libnm-glib: fix memory leak of GSimpleAsyncResult loading object properties 2013-04-01 17:18:53 -05:00
Dan Williams b1fc88154b libnm-glib: fix memory leak of GSimpleAsyncResult getting connection settings 2013-04-01 17:18:53 -05:00
Jiří Klimeš 2109f41cc6 libnm-util: consolidate hex-string <-> bin conversion functions
and move them to libnm-util's nm-utils.s so that they are easily available.
2013-03-28 16:59:58 +01:00
Jiří Klimeš 82fb1978a4 all: use G_VALUE_INIT to initialize GValue variables
It makes the initializations more explicit.
G_VALUE_INIT is available since glib 2.30, and NM now require glib >= 2.32
2013-03-25 08:41:18 +01:00
Dan Williams d57198dfa4 libnm-glib: fix use-after-free getting device vendor and product
Because _device_update_description() freed and update *both* the
vendor and product description, if the function was not able to
read one of them the first time, it would throw both away the second
time and try re-read them.  That caused code like this:

vendor = nm_device_get_vendor (device);
product = nm_device_get_product (device);

to be left with a freed 'vendor' value if _device_update_description()
could not read the product when first called from nm_device_get_vendor(),
because it would be called a second time from nm_device_get_product()
and free priv->vendor and priv->product and then attempt to re-read them.

Fix this by making the function return only one value so that the
callers can control the liftime of the property they are trying to set.

==29355== Invalid read of size 8
==29355==    at 0x38F7289840: __GI_mempcpy (memcpy.S:122)
==29355==    by 0x38F7276F21: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1353)
==29355==    by 0x38F7247DA6: vfprintf (vfprintf.c:1615)
==29355==    by 0x38F7250E28: printf (printf.c:34)
==29355==    by 0x41E79F: print_fields (utils.c:351)
==29355==    by 0x414CAB: show_device_info (devices.c:636)
==29355==    by 0x415CE8: do_devices (devices.c:1094)
==29355==    by 0x41D9A9: start (nmcli.c:121)
==29355==    by 0x38F6E47A54: g_main_context_dispatch (gmain.c:2715)
==29355==    by 0x38F6E47D87: g_main_context_iterate.isra.24 (gmain.c:3290)
==29355==    by 0x38F6E48181: g_main_loop_run (gmain.c:3484)
==29355==    by 0x40CB89: main (nmcli.c:359)
==29355==  Address 0x50a0401 is 1 bytes inside a block of size 18 free'd
==29355==    at 0x4A077E6: free (vg_replace_malloc.c:446)
==29355==    by 0x38F6E4D79E: g_free (gmem.c:252)
==29355==    by 0x4C55F53: _device_update_description (nm-device.c:1417)
==29355==    by 0x4C56D26: nm_device_get_product (nm-device.c:1502)
==29355==    by 0x414B16: show_device_info (devices.c:620)
==29355==    by 0x415CE8: do_devices (devices.c:1094)
==29355==    by 0x41D9A9: start (nmcli.c:121)
==29355==    by 0x38F6E47A54: g_main_context_dispatch (gmain.c:2715)
==29355==    by 0x38F6E47D87: g_main_context_iterate.isra.24 (gmain.c:3290)
==29355==    by 0x38F6E48181: g_main_loop_run (gmain.c:3484)
==29355==    by 0x40CB89: main (nmcli.c:359)
2013-03-22 15:07:17 -05:00
Colin Walters ffb6df6f4a libnm-glib,libnm-util: -glib requires -util, -util requires NetworkManager
libnm-glib's public headers include headers from libnm-util. While it
does work to just $(pkg-config --cflags --libs libnm-glib), this is
only because libnm-glib has a requires on NetworkManager which happens
to use the same include directory as libnm-util.

The correct dependency chain is thus:
libnm-glib -> libnm-util -> NetworkManager

Signed-off-by: Colin Walters <walters@verbum.org>
2013-03-14 10:23:19 -05:00
Dan Winship dbbec9b7d7 libnm-glib: match interface name in nm_device_connection_compatible()
Do NMSettingConnection:interface-name matching on the client side as
well, so that, eg, nm-applet does not list connections under the wrong
device.

(Also, move some return-if-fail checks from the subclass method
implementations into the wrapper function.)

https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 16:45:19 -04:00
Dan Winship 6f44b7f3c6 all: remove redundant return-if-fail checks
NM_IS_FOO(x) returns FALSE if x is NULL, so we don't need a separate
(x != NULL) check before it.
2013-03-07 07:32:27 -05:00
Dan Williams 632c52ceea libnm-glib: fix type annotation of NMDHCP[46]Config:options
The GOI syntax changed a while back and these didn't follow.
2013-02-27 18:09:52 +01:00
Dan Williams 395228b5cf Revert "libnm-glib: fix type annotation of NMDHCP[46]Config:options"
This reverts commit 0e0b5da7e3.

Syntax actually uses () instead of <> for various docbook-related
reasons.
2013-02-27 18:09:52 +01:00
Dan Winship 0e0b5da7e3 libnm-glib: fix type annotation of NMDHCP[46]Config:options 2013-02-26 13:26:38 +01:00
Dan Winship f936400c38 tests: clean up gtester usage
Use g_test_add_func() and g_test_add_data_func() to simplify the test
cases, getting rid of the GLIB_CHECK_VERSION calls in the process.
2013-02-26 13:07:33 +01:00
Dan Williams 5f626b1c56 trivial: fix makefile typo 2013-02-22 08:57:56 -06:00
Dan Williams a2269b0974 libnm-glib: bump soname for added functions 2013-02-22 08:34:25 -06:00
Dan Williams 4f9e13fcb0 libnm-glib: add Since tags to new functions and properties 2013-02-22 08:34:13 -06:00
Dan Winship 57327a6a57 libnm-util, libnm-glib: fix NMConnection:path again
24cda2bc broke the ability to set NMConnection:path back to NULL after
it had been set, as part of a hack to try to make
NMRemoteConnection:dbus-path work. Fix that by moving the hack
entirely into NMRemoteConnection.

https://bugzilla.gnome.org/show_bug.cgi?id=693829
2013-02-14 13:47:44 -05:00
Dan Winship 43f259ee1f libnm-glib: add NMDevice:available-connections
NMDevice has a D-Bus "AvailableConnections" property, but we weren't
exposing it on NMDevice. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=693669
2013-02-14 09:31:33 -05:00
Dan Winship 24cda2bc36 libnm-util, libnm-glib: Make NMRemoteConnection instantiable by NMObject
In order to resolve NMRemoteConnection-valued properties, NMObject
needs to be able to create NMRemoteConnections. But NMObject assumes
that all the objects it will be creating have "dbus-connection" and
"dbus-path" properties. So add those properties to NMRemoteConnection,
aliasing the existing "bus" and "path" properties (and ensure that
whichever version gets set, we keep that value, rather than letting it
get overwritten by the NULL default value of the other one).

https://bugzilla.gnome.org/show_bug.cgi?id=693669
2013-02-14 09:31:33 -05:00
Dan Winship 7c5cf25366 libnm-glib: fix NMRemoteConnection GInitable implementation
apparently this never got tested...

https://bugzilla.gnome.org/show_bug.cgi?id=693669
2013-02-14 09:31:33 -05:00
Pavel Šimerda 6187b39795 trivial: fix gir warning 2013-02-12 01:25:30 +01:00
Jiří Klimeš a9fca4aa1b libnm-glib: use the same parameter names in prototypes and definitions
to calm down warning when compiling docs.
2013-01-15 12:27:00 +01:00
Jiří Klimeš 0309bdc2e0 libnm-glib: add nm_client_set_logging() for setting debugging level and domains 2013-01-09 16:47:49 +01:00
Jiří Klimeš 4ce355022c libnm-glib: add nm_client_get_logging() function
to get current logging level and domains.
2013-01-09 16:47:49 +01:00
Jiří Klimeš c875a4d205 libnm-glib: remove unused "wireless_enabled" variable from NMDeviceWifiPrivate 2013-01-09 16:47:39 +01:00
Jiří Klimeš e837098b00 libnm-glib: add nm_device_wifi_request_scan_simple() to tell NM to scan for APs
by calling RequestScan() D-Bus call on the Wi-Fi device (without any options).
2013-01-09 16:41:40 +01:00
Colin Walters 1b84012762 libnm-glib: clarify documentation of nm_client_get_devices() 2012-12-13 17:12:11 -06:00
Dan Williams 8b7287ab66 core: fix agent secret cancelation
Two issues here: first, the daemon code was using the wrong D-Bus type
(strings instead of object-path) to send the connection path to the
secret agent, which resulted in a method-not-found error and nothing
happening in the agent.

Second, the agent-side method call verification code would fail the
request anyway, becuase verify_request() determined success based
on the reconstructed connection, which isn't given when canceling
secrets requests.
2012-12-04 11:31:12 -06:00
Dan Winship 829234fd8d libnm-glib: more NMDevice::state-changed fixes
Ensure that NMDevice::state-changed signals don't get emitted out of
order, and ensure that nm_device_get_state() from a ::state-changed
handler always returns new_state.
2012-12-03 15:19:53 -05:00
Jiří Klimeš 1a7f9e661a core,libnm-glib: expose "slaves" property on NMDeviceBridge 2012-11-30 13:21:51 -06:00
Thomas Graf cfff5a63d9 bridge: add bridge device type
This adds a new device type 'bridge'. Kernel devices are created
on demand.
2012-11-30 13:21:51 -06:00
Pavel Šimerda faa1bcb540 build: improve documentation and test configure options
Use --enable-doc and --enable-tests instead of --with-docs and
--with-tests. This is consistent with other features and with
--enable-gtk-doc option. Support current variants as fallback.

Don't build tests unless --enable-tests is specified.
2012-11-13 20:23:06 +01:00
Colin Walters 1977fb6c49 build: clean up GLib-related pkg-config usage (bgo #687218)
We had separate checks for glib-2.0, gobject-2.0, gmodule-2.0, and
gio-unix-2.0.  It doesn't make sense to link a binary against all 4
because gio-unix-2.0 depends on glib-2.0 and gobject-2.0.  Doing this
actually breaks things in unusual circumstances.

Generally, few bits of NM actually just use glib, and not gio.  We
might as well coalesce those requirements together, even if it means
in some cases we "overlink".  Additionally, I chose for now to fold
gmodule-2.0 in as well, even though many fewer programs need it.  The
cost of overlinking is quite small.

The benefit of this is less repeated junk in Makefile.am, as well as
more centralized control over GLib.  A followup patch will allow us to
set -DGLIB_VERSION_MIN_REQUIRED in just one place, rather than having
to replicate it 4 times.

The NM configure is still suboptimal - for example, libpolkit-1
depends on gio-2.0, so really we should determine the compiler flags
all in one pass.  But it doesn't matter too much for now.
2012-10-31 21:08:18 +01:00
Alberto Ruiz 1277f9986c docs: clarify the connection ownership in secret agent callbacks (bgo #686915) 2012-10-29 11:00:59 +01:00
Alberto Ruiz 80734d67f3 docs: fix introspection annotation for secret agent callbacks (bgo #686915) 2012-10-29 11:00:42 +01:00
Dan Williams 9818415ad7 docs: add Since tag for nm_device_bond_get_slaves() 2012-10-26 13:04:46 -05:00
Dan Williams e3c1b60055 libnm-glib: bump soname for new bond symbols 2012-10-26 13:04:38 -05:00
Dan Winship ad74379c2c core, libnm-glib: expose "slaves" property on NMDeviceBond
https://bugzilla.gnome.org/show_bug.cgi?id=686367
2012-10-19 12:09:27 -04:00
Dan Williams 6ae1def061 libnm-glib: fix wifi device 'mode' property for AP mode 2012-10-17 14:06:54 -05:00
Jan Luebbe f9c72dee3e wifi: support ap-mode with wpa_supplicant
A new value for NM80211Mode is introduced (NM_802_11_MODE_AP) and the
new mode is passed to wpa_supplicant analogous to adhoc-mode.
The places which need to know the interface mode have been extended to
handle the new mode.

If the configuration does not contain a fixed frequency, a channel is
selected the same way as with adhoc-mode before.
2012-10-17 12:08:11 -05:00
Dan Williams cb3450b32f libnm-glib: fix introspection annotation for nm_device_adsl_new() 2012-10-16 15:53:08 -05:00
Giovanni Campagna 246633a854 NMRemoteSettings: fix async initialization
If async GetProperties completed before the GetConnections, init_left would
be 0 and thus we never connected to connections-read, causing us to terminate
initialization before connections were actually read.

https://bugzilla.gnome.org/show_bug.cgi?id=686226
2012-10-16 14:31:38 -04:00
Alberto Ruiz 48a84c1271 libnm-glib: add missing NMSettingHashFlags argument to NMSecretAgentGetSecretsFunc docs
The nm_connection_to_hash() call in the NMSecretAgentGetSecretsFunc
documentation missed the last argument. This patch adds
NM_SETTING_HASH_FLAG_ALL as the last argument in the example.
2012-10-11 09:12:47 -05:00
Dan Williams 30db13ae5a libnm-glib: don't try to query for connections synchronously when NM isn't running (bgo #685345)
And ensure we clear out properties when NM quits, and that we request them
when NM starts up again.
2012-10-05 08:54:35 -05:00
Dan Winship 6878d20ac4 all: Don't use ctype.h macros
The ctype macros (eg, isalnum(), tolower()) are locale-dependent. Use
glib's ASCII-only versions instead.

Also, replace isascii() with g_ascii_isprint(), since isascii()
accepts control characters, which isn't what the code wanted in any of
the places where it was using it.
2012-09-26 12:14:37 -04:00
Dan Winship 1eaf919bc6 libnm-glib: update properties before NMDevice:state-changed
Because object-valued properties (like ip4-config) get reloaded
asynchronously when they change, we will still have out-of-date values
for them cached at the point when we get the StateChanged signal from
the daemon. Work around this by manually reloading all properties
before emitting the client-side signal.

Also, fix a dumb bug in NMObject...
2012-08-29 15:46:15 -04:00
Dan Williams ba59beb636 trivial: fix typo in libnm-glib NMDevice documentation 2012-08-06 19:53:40 -05:00
Dan Williams 8ff38de889 docs: document VPN plugin errors 2012-08-06 19:53:39 -05:00
Dan Williams a1dc4f5627 docs: document VPN UI plugin object properties 2012-08-06 19:53:39 -05:00
Dan Williams 0b52687dfe docs: document secret agent errors 2012-08-06 19:51:23 -05:00
Dan Williams 2ecf61a29a docs: document NMClient permissions enums 2012-08-06 19:51:23 -05:00
Dan Winship a13d4e9d3d build: fix build after addition of new warnings 2012-08-01 09:48:03 -04:00
Jiří Klimeš edb85e9720 core: fix NM_IS_*_CLASS(klass) macros
The argument is 'klass' not 'obj'.
2012-07-27 13:15:54 +02:00
Dan Winship 320464490e libnm-glib: fix GAsyncInitable implementations
If a class implements init_async, it should implement init_finish too,
rather than assuming the default implementation will do the right
thing (which it briefly didn't in glib 2.33).
2012-07-17 09:43:15 -04:00
Dan Williams 0b33b42771 Revert "libnm-glib: fix vpn-state-changed signal handling"
This reverts commit 4d635b23cb.

The original commit that changed this D-Bus signal signature was
in error and we shouldn't change the D-Bus API here.
2012-06-29 15:18:12 -05:00
Jiří Klimeš b8958f27ea docs: fix some annotations in libnm-glib 2012-06-29 14:49:18 +02:00
Jiří Klimeš 4d635b23cb libnm-glib: fix vpn-state-changed signal handling
Core D-Bus VpnStateChanged signal changed. In order to receive the signal,
the parameters was fixed. This commit also adjusts libnm-glib's vpn-state-changed
signal to match the D-Bus one.
2012-06-29 14:16:45 +02:00
Dan Williams 74e262b303 agents: add a "user-requested" flag to secret agent requests
Allows agents to provide different behavior depending on whether the
secrets request was initiated by a user (eg by picking a connection
from a UI menu or by 'nmcli con up') or was automatically started by
NetworkManager.

See https://bugzilla.gnome.org/show_bug.cgi?id=660293
2012-06-27 09:42:47 -05:00
Alban Browaeys 157f184706 libnm-glib: introspection - build against internal libnm-util
https://bugzilla.gnome.org/show_bug.cgi?id=676530
2012-06-26 14:45:54 -04:00
Dan Williams 202b693bd8 libnm-glib: don't try to free unset GValues when disconnecting VPNs
IPv6-capable plugins will fill these in, but old IPv4-only won't,
so don't try to free the GValues when they aren't set.
2012-06-14 18:05:16 -05:00
Dan Winship 83760a7ffb libnm-glib: add NM_VPN_PLUGIN_UI_CAPABILITY_IPV6 2012-06-14 11:36:55 -04:00
Alberto Ruiz d2ae2dedef libnm-glib: add missing nm-connection.h header for NMConnection (bgo #678093) 2012-06-14 15:50:24 +02:00
Alberto Ruiz 9966ac45fa introspection: fix wrong symbol prefix in the Makefile (bgo #677498)
While the python and JS bindings don't have an issue with "nm_",
the Vala ones apparently do.
2012-06-11 15:03:01 -05:00
Dan Williams c114344977 docs: document some libnm-glib NMRemoteConnection callback function types 2012-06-11 14:18:24 -05:00
Dan Williams 11b8574f07 vpn: fix connect timeout issue with old IPv4-only plugins
Old plugins (ie, that aren't IPv6 capable) don't send the 'config'
signal, and thus have no way of signalling which IP methods they
have support for.  Which means they won't set priv->has_ip4 and
thus the connect timer will kill the connection after a minute.
So track whether we got a 'config' signal, and if we didn't, but
we did get an 'ip4-config' signal (which means this is an old
plugin) then we just assume that the plugin supports IPv4.  This
allows the connect timer to be canceled and the plugin to advance
to the STARTED state.
2012-06-11 10:17:12 -05:00
Jiří Klimeš 434a4f39b5 libnm-glib: add 'driver-version' and 'firmware-version' properties to NMDevice 2012-06-08 08:55:22 +02:00
Alberto Ruiz ddb28d3e1a introspection: removes redudant package names from gir files (bgo #677296)
Currently the .gir files for NetworkManager-1.0 and NMClient-1.0 declare
their dependencies twice, once with the GIR name and another one with
the pkg-config name. This causes problems with Vala bindings generation.
2012-06-01 13:57:00 -05:00
Dan Winship 960c1ae8ff vpn: support IPv6 over VPNs
Add new API to allow passing both IPv4 and IPv6 configuration
information from VPN plugins to the backend.

Now instead of a single Ip4Config, a plugin has Config, Ip4Config, and
Ip6Config. "Config" contains information which is neither IPv4 nor
IPv6 specific, and also indicates which of Ip4Config and Ip6Config are
present. Ip4Config now only contains the IPv4-specific bits of
configuration.

There is backward compatibility in both directions: if the daemon is
new and the VPN plugin is old, then NM will notice that the plugin
emitted the Ip4Config signal without having emitted the Config signal
first, and so will assume that it is IPv4-only, and that the generic
bits of configuration have been included with the Ip4Config. If the
daemon is old and the plugin is new, then NMVPNPlugin will copy the
values from the generic config into the IPv4 config as well. (In fact,
NMVPNPlugin *always* does this, because it's harmless, and it's easier
than actually checking the daemon version.)

Currently the VPN is still configured all-at-once, after both IPv4 and
IPv6 information has been received, but the APIs allow for the
possibility of configuring them one at a time in the future.
2012-05-30 14:24:46 -04:00
Dan Winship c8812563dd libnm-glib: fix indentation in nm-vpn-plugin.[ch] 2012-05-30 13:45:31 -04:00
Jiří Klimeš e0329b44c4 libnm-glib: add 'autoconnect' property for devices 2012-05-22 18:30:53 +02:00
Pantelis Koukousoulas 8039dd30d8 adsl: add libnm-glib and nmcli code
For the finale, this is the libnm-glib and nmcli part of the support,
with this you can now make a full pppoatm connection from NetworkManager
by configuring it in system scope in a keyfile.

As an example, here is mine:
(password and username snipped for obvious reasons)

[connection]
id=MYISP
uuid=34d04e69-fdd9-4231-af2c-25ed1f34dc1e
type=adsl
timestamp=1304621332

[adsl]
username=user@myisp.com
password=mypassword
vpi=8
vci=35
encapsulation=vcmux
protocol=pppoa

[ipv6]
method=ignore

[ipv4]
method=auto

Extract from logs:
NetworkManager[29155]: <info> Activation (ueagle-atm0) starting connection 'MYISP'
NetworkManager[29155]: <info> (ueagle-atm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) starting...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: prepare -> config (reason 'none') [40 50 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) successful.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: config -> ip-config (reason 'none') [50 70 0]
NetworkManager[29155]: <info> starting PPP connection
NetworkManager[29155]: <debug> [1304671146.590156] [nm-ppp-manager.c:1047] nm_ppp_manager_start(): command line: /usr/sbin/pppd nodetach lock nodefaultroute user user@myisp.com plugin pppoatm.so 8.35 noipdefault noauth usepeerdns lcp-echo-failure 0 lcp-echo-interval 0 ipparam /org/freedesktop/NetworkManager/PPP/0 plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so
NetworkManager[29155]: <info> pppd started with pid 29175
NetworkManager[29155]: <debug> [1304671146.591235] [NetworkManagerUtils.c:816] nm_utils_get_proc_sys_net_value(): (ueagle-atm0): error reading /proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra: (4) Failed to open file '/proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra': No such file or directory
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) complete.
Plugin pppoatm.so loaded.
Plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so loaded.
** Message: nm-ppp-plugin: (plugin_init): initializing
** Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
NetworkManager[29155]: <debug> [1304671146.612937] [nm-udev-manager.c:621] handle_uevent(): UDEV event: action 'add' subsys 'net' device 'ppp0'
NetworkManager[29155]: <debug> [1304671146.613134] [nm-udev-manager.c:525] net_add(): ignoring interface with type 512
NetworkManager[29155]: <debug> [1304671146.617308] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x1090
Using interface ppp0
Connect: ppp0 <--> 8.35
** Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
** Message: nm-ppp-plugin: (nm_phasechange): status 6 / phase 'authenticate'
** Message: nm-ppp-plugin: (get_credentials): passwd-hook, requesting credentials...
NetworkManager[29155]: <debug> [1304671149.639511] [nm-agent-manager.c:1044] nm_agent_manager_get_secrets(): Secrets requested for connection /org/freedesktop/NetworkManager/Settings/0 (adsl)
NetworkManager[29155]: <debug> [1304671149.639684] [nm-settings-connection.c:717] nm_settings_connection_get_secrets(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets requested flags 0x1 hint 'password'
NetworkManager[29155]: <debug> [1304671149.640950] [nm-agent-manager.c:959] get_start(): (0x9b4ad10/adsl) system settings secrets sufficient
NetworkManager[29155]: <debug> [1304671149.641332] [nm-settings-connection.c:573] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) existing secrets returned
NetworkManager[29155]: <debug> [1304671149.641541] [nm-settings-connection.c:579] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets request completed
NetworkManager[29155]: <debug> [1304671149.643074] [nm-settings-connection.c:618] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) new agent secrets processed
** Message: nm-ppp-plugin: (get_credentials): got credentials from NetworkManager
PAP authentication succeeded
** Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
local  IP address 94.70.90.201
remote IP address 80.106.108.12
primary   DNS address 195.170.0.1
secondary DNS address 195.170.2.2
** Message: nm-ppp-plugin: (nm_phasechange): status 9 / phase 'running'
** Message: nm-ppp-plugin: (nm_ip_up): ip-up event
** Message: nm-ppp-plugin: (nm_ip_up): sending Ip4Config to NetworkManager...
NetworkManager[29155]: <debug> [1304671150.607440] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x110D1
NetworkManager[29155]: <info> PPP manager(IP Config Get) reply received.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager[29155]: <debug> [1304671150.608918] [nm-system.c:222] sync_addresses(): (ppp0): syncing addresses (family 2)
NetworkManager[29155]: <info> (ueagle-atm0): device state change: ip-config -> activated (reason 'none') [70 100 0]
NetworkManager[29155]: <info> Policy set 'MYISP' (ppp0) as default for IPv4 routing and DNS.
NetworkManager[29155]: <info> Activation (ueagle-atm0) successful, device activated.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) complete.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:56 -05:00
Dan Williams 51f37ca8d5 trivial: fix distcheck in libnm-glib 2012-04-30 16:19:46 -05:00
Dan Williams 9c2c4e0591 libnm-glib: fix build on older glib without g_clear_object() 2012-04-27 15:04:29 -05:00
Jiří Klimeš 7c7e8dc692 libnm-glib: add "object-creation-failed" signal to NMObject
The signal is private for libnm-glib and should not be used externally.
It is emitted when there's an error while creating an object.
In addition, this commit makes use of the signal in NMClient to ensure
that the callbacks are always called for nm_client_activate_connection()
and nm_client_add_and_activate_connection().
2012-04-25 16:39:17 +02:00
Dan Williams 48981a6166 libnm-glib: ensure object cache is cleared when NM stops (bgo #674473)
Otherwise if a client holds references to the objects (or in the
JavaScript case, uses deferred garbage collection) they'll still
be in the cache when NM restarts, and the old object may have the
same path as some new object, which isn't good.
2012-04-23 17:10:14 -05:00
Dan Winship 17d5973ef6 libnm-glib: discard devices and active connections when NM goes down
When NMClient changes state to "not running", don't just unref all the
devices and connections: emit notify::active-connections and
device-removed signals too, so the app will drop its copies of them.

https://bugzilla.gnome.org/show_bug.cgi?id=674473
2012-04-23 16:09:58 -04:00
Dan Winship be18dd06cd libnm-glib: NULL out priv fields on dispose()
In some situations, objects might get used after being disposed, so
clear out their various priv fields so we don't try to access unreffed
objects, freed strings, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=674473
2012-04-23 16:09:58 -04:00
Dan Williams 411cb36344 libnm-glib: protect against potentially NULL changed property values (rh #808784)
No idea *why* they're NULL, unless perhaps that dbus-glib can't demarshal
the variants for some reason, but until we know why at least log the
problem so we know what properties the issue might affect.
2012-04-23 14:30:42 -05:00
Dan Williams 494f0a2e20 libnm-glib: ensure NMRemoteConnection signals are disconnected (bgo #674484) (lp:949743)
If a client keeps the connection around after NMRemoteSettings is done
with it (and has emitted 'removed' for that connection) then the
RemoteSettings object was still registered to receive signals for
that connection.  To prevent clients from being able to screw up
the RemoteSettings, disconnect any signals it may be listening for
when the connection is removed.  (it should be doing that anyway)
2012-04-23 13:40:43 -05:00
Dan Williams 614c46f87b trivial: fix spacing 2012-04-20 09:57:22 -05:00
Jiří Klimeš 8bb2789444 libnm-glib: initialize GError, else invalid free() crash can occur (rh #809123) 2012-04-02 16:37:55 +02:00
Jiří Klimeš 2b879e3a33 Revert "libnm-glib: initialize NMRemoteSettings in nm_remote_settings_new() (rh #806664)"
This reverts commit dd0460697c.

The commit dd0460697c make nm_remote_settings_new()
create the NMRemoteSettings object synchronously. It fixed getting properties,
but undid the previous ability to initialize the object asynchronously.
It can be reverted now, because a4f450aa0b commit
ensure initialization in get_property() calls.
2012-04-02 12:58:19 +02:00
Dan Winship a4f450aa0b libnm-glib: more ensure_inited() fixing
We need to do _nm_object_ensure_inited() /
_nm_remote_settings_ensure_inited() from the get_property()
implementations; in most cases, get_property() just calls another
accessor method (which will call _nm_object_ensure_inited()), but in a
few places, it reads priv->whatever directly, so we need to make sure
that it's valid.
2012-03-28 09:06:12 -04:00
Jiří Klimeš dd0460697c libnm-glib: initialize NMRemoteSettings in nm_remote_settings_new() (rh #806664)
The object was not initialized after creation in nm_remote_settings_new(). This
was a regression caused by 762df85234.
2012-03-27 22:36:55 +02:00
Jiří Klimeš b48dc05b72 libnm-glib: ensure bindings-created NMClient object work (rh #802536)
Most of the stuff was done by 762df85234.
But to allow this piece of code:

from gi.repository import NMClient
nmclient = NMClient.Client()
print nmclient.get_active_connections()

we also need to set "dbus-path" property in NMClient constuctor(),
else parent NMObject is not properly constructed.
2012-03-27 14:53:31 +02:00
Dan Williams e9b110b29e libnm-glib: bump soname minor 2012-03-23 15:55:36 -05:00
Dan Williams 762df85234 libnm-glib: ensure bindings-created objects work as expected (rh #802536)
Bindings (like GObject Introspection) almost always create objects
using g_object_new() by default and don't use our helper functions
like nm_client_new().  Thus we need to make sure that if the
object is created in that way, any property accesses or functions
that return properties ensure that the object is fully initialized,
which is what the _new() functions were supposed to do.  In one
case in NMClient that was missing (getting active connections)
and wasn't happening at all in NMRemoteSettings, which are our two
entry points into libnm-glib.

This allows this python+GI sequence to return the expected active
connection list:

from gi.repository import NMClient
nmclient = NMClient.Client(dbus_path='/org/freedesktop/NetworkManager')
active = nmclient.get_active_connections()
print(active)

where previously it returned an empty list because the NMClient
wasn't fully initialized by the time nm_client_get_active_connections()
was called.
2012-03-21 12:37:39 -05:00
Dan Williams 1da9738f1b libnm-glib: add 'registered' property for NMSecretAgent
So clients can track when the agent is actually registered and when
it's registration state changes.
2012-03-19 13:24:28 -05:00
Jiří Klimeš a11067f584 libnm-glib: add errors to device classes and nm_device_connection_compatible()
Add nm_device_connection_compatible() that returns an error when it fails.
nm_device_connection_valid() does the same work except it doesn't set GError.
2012-03-16 09:54:36 +01:00
Dan Williams 8e503afeda libnm-glib: two object uniqueness fixes
First: object creation requests get triggered each time a property
that refers to the object is read.  That can happen from a couple
of places around the same time (like initialization) and to be
expected.  But when those requests are processed (after we've
determined the type of object to create) a previous request may
have already created the object.  If that's the case don't create
a duplicate.

Second: properties can also be updated from a few places which
don't know about each other (from both regular code and the
"pseudo property" signal handlers) so when adding objects to
array properties, make sure the object hasn't already been
added to that array.
2012-03-13 14:31:26 -05:00
Dan Williams 1138f136f8 libnm-glib: fix leaked NMDevice objects due to circular refcounting
Active Device objects held a reference to their ActiveConnection
which also held a reference  back to the Device.  Ensure that's
broken so everyone can get disposed correctly.
2012-03-12 19:26:34 -05:00
Dan Williams 64edbeb322 libnm-glib: ensure nm_device_set_device_type() stays private
Internal only function and should not be exported.
2012-03-12 14:33:51 -05:00
Dan Williams 4a370a9fa5 libnm-glib: prevent possible access of freed memory
valgrind reported that 'path' is already freed by the time we get
to _nm_object_cache_remove_by_path().
2012-03-12 14:33:17 -05:00
Dan Winship 54ef8f3224 Fix names of error enum values
When NM was registering all of its enum types by hand, it was using
NamesLikeThis rather than the default names-like-this for the "nick"
values. When we switched to using glib-mkenums, this resulted in
dbus-glib using different strings for the D-Bus error names, causing
compatibility problems.

Fix this by using glib-mkenums annotations to manually fix all the
enum values back to what they were before. (This can't be done in a
more automated way, because the old names aren't 100% consistent. Eg,
"UNKNOWN" frequently becomes "UnknownError" rather than just
"Unknown".)
2012-03-12 15:29:52 -04:00
Dan Williams 5a7fdd4b88 libnm-glib: simplify setting device-type property
Instead of having the superclass check the GObject type
and translate that into an NMDeviceType, have each subclass
set its own device type.
2012-03-07 12:22:37 -06:00
Dan Williams c02702e574 libnm-glib: add NMDeviceVlan
And fix a small bug with bond devices too if their device type
isnt' set at construction time.
2012-03-07 11:45:25 -06:00
Dan Winship 6c38f0cfd1 libnm-glib: add NMDeviceBond
it exists on the server/D-Bus side, so it should exist in libnm-glib too
2012-03-05 15:55:43 -05:00
Dan Williams aef4340ec4 libnm-glib: ensure device state is updated when it changes
NM emits coalesced PropertiesChanged signals, which might be
delayed slightly and thus sent after the StateChanged signal
for devices.  Clients of libnm-glib listening for the
'state-changed' signal and then querying the state manually
using nm_device_get_state() would still see the old state until
it was updated via the delayed PropertiesChanged signal
processing.  Since when the StateChanged signal comes in the
device is already in the new state, just update the state and
leave the GObject property notify signal to the
PropertiesChanged signal handling code so that clients have
an accurate device state.
2012-02-28 12:47:04 -06:00
Jiří Klimeš ff249e871f libnm-glib: add NMDeviceOlpcMesh 2012-02-28 10:29:03 +01:00
Colin Walters 74ec56d956 build: fix srcdir != builddir for new generated headers 2012-02-22 16:27:28 -06:00
Dan Winship 2c6bade5b9 libnm-glib: fix some property-handling warnings
Fix handle_object_array_property() to deal with receiving an empty
list correctly (rather than warning and leaving the property with its
previous value still set).

Also, add two more untracked properties that shouldn't be warned about
(NMDevice:device-type and NMActiveConnection:vpn, both of which are
only used at construct time).
2012-02-20 11:48:31 -05:00
Dan Williams 8572ecfd7c libnm-glib: don't crash on unknown object types
Like when an old libnm-glib is being run against a newer NM when
a new device type has been added.
2012-02-16 12:54:47 -06:00
Dan Williams 7b48862ef6 build: fix distcheck 2012-02-15 19:38:18 -06:00
Dan Winship 839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Dan Williams a9c22166f6 libnm-glib: ensure some new private symbols stay private
_ is our "private" prefix.
2012-02-10 15:03:12 -06:00
Dan Winship c721477d11 libnm-glib: fix premature child object signal emission
The notifications for child objects (like NMClient's device-added
signal or NMDeviceWifi's access-point-added signal) could get emitted
before the child objects were actually constructed, because
object_created() decrements the properties-retrieved tracking
variable, which wasn't always incremented before calling that
function.
2012-02-09 13:25:59 -06:00
Jiří Klimeš 39d25c2abb libnm-glib: add nm_device_get_state_reason() to libnm-glib.ver to export it
It was forgotten in the previous commit
2012-02-09 15:34:19 +01:00
Jiří Klimeš 81b697c57b libnm-glib: add StateReason property for NMDevice 2012-02-08 10:27:57 +01:00
Thomas Bechtold 32157d5187 libnm-glib: fix missing G_VALUE_INIT to not depend on newer glib 2012-02-07 12:43:39 -06:00
Dan Williams 7f9fe7601e libnm-glib: better debugging of property accesses and updates
Need to initialize libnm-util to get GValue transforms registered
so the property values print out as strings.  Then actually print
some debugging information about properties.
2012-02-07 12:36:45 -06:00
Dan Williams 57bd84139f libnm-glib: ensure synchronous property updates are actually synchronous
Some property updates (mainly those dealing with properties that
hold objects themsevles) weren't being done in a synchronous manner
when synchronicity was requested.  Make sure that happens.
2012-02-07 12:35:12 -06:00
Dan Winship 410ac72325 libnm-glib: fix to not depend on newer glib 2012-02-06 17:29:49 -06:00
Dan Williams 925d5e016b docs: reference NMRemoteSettings from NMClient creators
It can be a bit confusing that one object doesn't do both
control and configuration.  So throw users a bone and tell
them how.
2012-02-03 10:38:38 -06:00
Dan Winship c619365ee3 libnm-glib: asyncify NMRemoteSettings
Add nm_remote_settings_new_async/_finish, and misc other fixes
2012-02-03 10:33:44 -06:00
Dan Winship 7844ead116 libnm-glib: nm_client_new_async, fix up NMClient asynchrony issues 2012-02-03 10:33:43 -06:00
Dan Winship 9fd98ef91b libnm-glib: implement GInitable/GAsyncInitable in NMObject
Implement GInitable and GAsyncInitable in NMObject, with
implementations that synchronously or asynchonously load all
properties, and change _nm_object_ensure_inited() to run
g_initable_init().

Update the object/object-array property handling to initialize the
objects after creating them (synchronously or asynchronously,
according to the situation), so that they will have all of their
properties preloaded before they are ever visible to the caller.

Move the non-blocking/non-failable parts of various objects'
constructor() methods to constructed(), and move the blocking/failable
parts to init(), and implement init_async() methods with non-blocking
versions of the blocking methods.

Make nm_device_new() and nm_client_new() call
_nm_object_ensure_inited(), to preserve the behaviour formerly
enforced by their construct() methods, that properties are guaranteed
to be initialized before any signals involving them are emitted.
2012-02-03 10:33:43 -06:00
Dan Winship ad5daa098c libnm-glib: add "pseudoproperties" for things like Client.GetDevices
Add generic handling for "properties" that consist of a "Get" method,
an "Added" signal, and a "Removed" signal, reusing some of the code
for handling object-array-valued properties. And load the values of
pseudo properties from _nm_object_reload/ensure_properties as well.
2012-02-03 10:33:43 -06:00
Dan Winship cc90f1010e libnm-glib: simplify handling of object and object array properties
Add an "object_type" field to NMPropertiesInfo, and use that with
DBUS_TYPE_G_OBJECT_PATH and DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH
properties so that we don't need custom marshallers for each one.

When creating an NMDevice or NMActiveConnection, we need to fetch an
extra property first to figure out the exact subclass to use, so add a
bit of infrastructure for that as well. Also, do that preprocessing
asynchronously when processing a property change notification, so that
it doesn't block the main loop.
2012-02-03 10:33:43 -06:00
Dan Winship 5afcee4693 libnm-glib: simplify property getter methods
Rather than having every property getter method have code to fetch
that specific property's value, just call the new
_nm_object_ensure_inited() (which makes sure that we've read all the
property values on the object at least once), and then return the
cached value. (After we've read the initial property values, the
PropertiesChanged signal handler will ensure that the values are kept
up to date, so we can always just return cached property values after
that point.)

This then lets us get rid of _nm_object_get_property() and its
wrappers.
2012-02-03 10:33:43 -06:00
Dan Winship 2e48cc092c libnm-glib: simplify and genericize property declaration
Rename _nm_object_handle_properties_changed(), etc, to be about
properties in general, rather than just property changes.

Interpret func==NULL in NMPropertiesInfo as meaning "use
_nm_object_demarshal_generic", and then reorder the fields so that you
can just leave that field out in the declarations when it's NULL.

Add a way to register properties that exist in D-Bus but aren't
tracked by the NMObjects, and use that for NMDevice's D-Bus Ip4Address
property, replacing the existing hack.

Also add a few other missing properties noticed along the way.
2012-02-03 10:33:43 -06:00
Dan Winship 8ad3ff24ad libnm-glib: don't use client-side generated dbus-glib bindings
Most of the code was using dbus_g_proxy_call() directly, but there
were some leftover uses of the generated bindings. Make things more
consistent by using dbus_g_proxy_call() everywhere, and stop building
the -bindings.h files.
2012-02-02 12:30:44 -06:00
Dan Winship ba4731dafd libnm-glib: remove nm-dbus-utils.[ch]
The code hasn't been used in a very long time.
2012-02-02 12:30:38 -06:00
Dan Winship efadfd8b17 libnm-glib: pre-emptively avoid some -Wshadow errors
including <gio/gio.h> will drag in some additional system headers that
result in new -Wshadow warnings. Fix those.
2012-02-02 12:30:35 -06:00
Dan Winship f32032694f libnm-glib: implement NMActiveConnection uuid property
This property existed as a #define and a get method, but the actual
GObject property itself was accidentally never implemented.
2012-02-02 12:30:32 -06:00
Dan Winship e74d729f17 libnm-glib: fix _nm_string_array_demarshal
dbus-glib returns 'as' results as G_TYPE_STRV (NULL-terminated
char**), not DBUS_TYPE_G_ARRAY_OF_STRING (GPtrArray of char*).
2012-02-02 12:28:56 -06:00
Dan Williams e281d09805 docs: update NMSecretAgent example code 2012-01-26 12:23:05 -06:00
Dan Williams 724df841a2 docs: update docs for NMSecretAgent callbacks 2012-01-26 12:21:27 -06:00
Jiří Klimeš 0558159c6b docs: fix 'connection' parameter name for nm_access_point_connection_valid() 2012-01-26 18:16:14 +01:00
Thomas Graf 1ba50e2f1b bonding: export path of master device property over DBUS
Adds a new "master" property to NMActiveConnection containing the path
of the master NMDevice if the connection has a master.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-01-25 11:12:43 -06:00
Alberto Ruiz 511bc09663 docs: added notes to the nm_device_filter_connections docs
Added some notes about how to get the connection list
2012-01-13 09:40:53 -06:00
Alberto Ruiz 4f72ed2296 docs: fix section header name for nm_access_point_connection_valid()
nm_access_point_connection_valid documentation had nm_access_point_filter_connection
as the section string, probably a typo after copy pasting
2012-01-13 09:40:26 -06:00
Alberto Ruiz fc66e85146 docs: Update NMAccessPoint documentation
Further explanation on how to get the connection list to filter against
an access point. Also noting that filtering by device is recommended.
2012-01-13 09:39:09 -06:00
Colin Walters dab7dfaf35 build: fix srcdir != builddir
nm-version.h is in ${top_builddir}/include.
2012-01-09 14:20:36 -06:00
Jiří Klimeš decfaa41ef libnm-glib: fix up nm_vpn_connection_get_banner()
We need to get current vpn_state in order for nm_vpn_connection_get_banner() to
work properly even if vpn_state had not been set before.
2012-01-05 11:37:41 +01:00
Jiří Klimeš fa5465a746 docs: update NMVPNConnection's documentation 2012-01-05 10:26:19 +01:00
Thomas Graf 5b7503e95e core: use nm_connection_get_setting_<type>() whenever possible
Leads to shorter, easier to read code and improves type casting safety.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:06:43 -06:00
Dan Winship e9cd59b654 libnm-glib: add NMDeviceInfiniband 2011-12-02 13:09:16 -06:00
Jiří Klimeš 576acdd2bf libnm-glib: get access points in constructor to prevent D-Bus errors
The errors appeared due to calling GetAccessPoints() on removed devices:
nm_device_wifi_get_access_points: error getting access points: Method "GetAccessPoints" with signature "" on interface "org.freedesktop.NetworkManager.Device.Wireless" doesn't exist
2011-11-24 17:15:39 +01:00
Jiří Klimeš 42060fdd89 libnm-glib: get devices and their properties in constructor (NMClient, NMDevice)
NMClient and NMDevice used a 'lazy' approach for getting stuff from D-Bus, i.e.
requesting data from NM when they are asked for. However, for some cases, like
removing devices it is not optimal. libnm-glib will never see a device that was
removed, but not added during NMClient's lifetime.

So let's get devices list in NMClient's constructor and device properties
in NMDevice constructor to have the data from the beginning.
2011-11-24 17:15:36 +01:00
Jiří Klimeš 43b3466b14 libnm-glib: fix demarshalling of ActiveConnection property in NMDevice 2011-11-24 14:11:52 +01:00
Dan Williams a5c2c47b3e wifi: make wireless-helper.h private to src/
The less stuff that needs WEXT the better.
2011-11-09 21:28:02 -06:00
Dan Williams d8437ffaf1 core: fix deprecated usage of g_value_[get|set]_char() (bgo #662694) 2011-10-28 11:35:59 -05:00
Dan Williams 8b1de024ba libnm-glib: fix allow-none introspection annotations (rh #747302) 2011-10-26 10:53:47 -05:00
Dan Williams a7f7e80839 libnm-glib: fix introspection annotations for callbacks and user_data (rh #747302)
user_data arguments should be annotated with (closure) and callbacks
should be marked (allow none) where it's safe to pass NULL.
2011-10-26 10:33:38 -05:00
Dan Williams 832c1aa69b release: bump version to 0.9.0
Yay!
2011-08-22 20:33:07 -05:00
Tomeu Vizoso 77e9cd53a8 libnm-glib: allow to constuct NMObject with NULL bus 2011-08-16 17:21:07 -05:00
Tomeu Vizoso dd175e3bf7 libnm-glib: warn early if an object is tried to be instantiated without a path 2011-08-16 17:20:49 -05:00
Daniel Drake 87b88fd38c libnm-glib: allow NMRemoteSettings constructor with NULL bus
NMRemoteSettings's constructor requires a DBusGConnection, but there
currently aren't any usable gobject-introspection bindings for that class.
This means that NMRemoteSettings can't be used over gobject-introspection.

Move the default fallback to the system bus into the constructor path, so
that introspection bindings are usable.

Python test case:
	from gi.repository import NMClient
	NMClient.RemoteSettings()

Before, this produced a segfault. Now it returns a usable RemoteSettings
object.
2011-08-16 17:19:15 -05:00
Dan Williams 70aba9a038 libnm-glib: VPN delete and save secrets operations are no longer used
They don't get called by anything since 0.9 reworked secrets handling
and added secret agents.  Make them nops but keep the functions.
2011-07-13 13:00:16 -05:00
Dan Williams af55e25f14 libnm-glib: fix GObject introspection annotation 2011-07-02 14:49:02 -05:00
Dan Williams 538cef0805 libnm-glib: fix make distcheck 2011-06-20 11:40:04 -05:00
Dan Williams cfd6ba1690 libnm-glib: fix demarshalling of Dhcp6Config property changes
This bit apparently got forgotten in 10ea7a911c
2011-06-18 17:16:48 -05:00
Jiří Klimeš 8d43875cbe libnm-glib: add nm_client_get_device_by_iface() for NMClient 2011-06-15 14:58:04 +02:00
Jiří Klimeš b4a72d1ad7 libnm-glib: fix crash for AddAndActivateConnection() D-Bus call (bgo #652512)
When a partial connection is passed to nm_client_add_and_activate_connection(),
but it doesn't contain any settings, nm_connection_to_hash() returns NULL and
there's a crash later on the NULL hash.
2011-06-14 19:39:23 +02:00
Dan Williams 10ea7a911c libnm-glib: fix up empty object path demarshalling after 8afce8590a
G_VALUE_HOLDS will fail if the value variable is NULL, so we only
want to check that the GValue holds the right type if the value
is valid.  NULL means "no object path" in demarshallers.
2011-06-01 12:55:54 -05:00
Dan Williams 0e7b71102b libnm-glib: add support for the "active-connection" device property 2011-05-26 19:39:12 -05:00
Dan Williams 8afce8590a libnm-glib: handle NULL object paths generically
Since D-Bus doesn't allow NULL or zero-length object paths, NM
uses "/" as a placeholder here.  Make sure the generic marshalling
code handles that so we don't have to do it in multiple places and
simplify handling of NULL objects somewhat.
2011-05-26 19:19:32 -05:00
Dan Williams 1e5cff5fa2 libnm-glib: export nm_device_get_ip_iface()
This got forgotten somehow.
2011-05-05 12:59:45 -05:00
Dan Williams b0f831ab0a Revert "libnm-glib: export nm_device_get_iface()"
This reverts commit 3116e3c980.

Commit message is wrong.
2011-05-05 12:58:45 -05:00
Dan Williams 3116e3c980 libnm-glib: export nm_device_get_iface()
This got forgotten somehow.
2011-05-05 12:38:29 -05:00
Dan Williams 429a05e675 libnm-glib: rename some internal symbols
To ensure they don't show up in the exported symbol check, even
though they aren't currently exported.
2011-05-05 12:37:21 -05:00
Dan Williams 3c6d2088e0 libnm-glib: rename some internal symbols in legacy compat library
To ensure they don't show up in the exported symbol check, even
though they aren't currently exported.
2011-05-05 12:33:49 -05:00
Dan Williams 55dde4f89d libnm-glib: fix WINS server handling
Copy & paste error, it seems.
2011-05-02 18:48:16 -05:00
Dan Williams 779215c742 libnm-glib: add *_connection_valid() utility functions
Like the *_filter_connections() functions, but for just one connection,
and now the *_filter_connections() functions call these new ones so
it's really just moving code around and not anything new.

These new functions more closely match the usage I've seen from
gnome-shell's network.js and elsewhere.
2011-04-25 17:07:38 -05:00
Dan Williams c790c95e75 libnm-glib: add a missing GObject Introspection annotation 2011-04-25 16:14:55 -05:00
Dan Williams 4cae0bb0fa settings: add a GetConnectionByUuid method
If the client knows the UUID, add a convenience function to get
the connection path directly, instead of having to iterate the
whole connection list and get each connection's details and then
check the UUID.
2011-04-22 12:29:07 -05:00
Dan Williams bb8e9a0b18 api: add "Uuid" property to ActiveConnection interface
A convenience so that clients which might key certain operations off
which connections are active (checking work mail only when on VPN for
example) can more easily get which connections are active.  This would
allow those apps to store the UUID (which they would already be doing)
and not have to create a Connection proxy and then get the connection
properties just to retrieve the UUID of the connection.  Instead they
can now get it from GetAll of the ActiveConnection object, which they
would already be doing.
2011-04-22 12:29:07 -05:00
Dan Williams df511f74f7 build: use -Wundef and fix up cases where stuff wasn't defined (bgo #647157) 2011-04-14 13:19:12 -05:00
Dan Williams fdd2727d21 libnm-glib: hook up networking enabled property writes 2011-03-31 17:38:39 -05:00
Dan Williams 0d92803ccc libnm-glib: make property set requests for wifi/wwan/wimax do something
They weren't actually poking NM, just setting internal values.
2011-03-31 17:34:13 -05:00
Michael Biebl 530f143adf use /usr/bin/env instead of /bin/env 2011-03-29 01:00:47 +02:00
Dan Williams 5ee1039067 libnm-glib: fix crash calling activation callback
Duh, need to zero the memory before reading from it.  It was
crashing in recheck_pending_activations() because the info->active_path
was random memory.
2011-03-24 23:20:32 -05:00
Dan Williams 435db3cb3d libnm-glib: test symbol exports against .ver file 2011-03-21 12:25:28 -05:00
Dan Williams 83ed56108c build: blow away all dbus-glib generated files during clean
Not just the ones we built; if you're switching often between
git branches, there will be some generated files left over from
the other branch, which then the docs generation stuff pick up
and pollute your autogenerated docs with stuff from other branches.
So just clean up everything on make clean.
2011-03-19 13:43:05 -05:00
Dan Williams 1701df4b75 core: add active connection state DEACTIVATING
Not used yet, but will be when device deactivating state gets
used.  Should be 100% backwards compatible with users that don't
know about it for now.
2011-03-17 14:23:21 -05:00
Dan Williams 14b23ba399 libnm-glib: handle new device states
The device states aren't used yet, but handle them anyway.
2011-03-17 13:42:22 -05:00
Dan Williams 4fca276e9a libnm-glib: automatically cancel secrets requests if NM goes away 2011-03-17 13:42:21 -05:00
Dan Williams 4390865bc0 libnm-glib: clarify usage of specific_object for activation calls 2011-03-17 11:27:30 -05:00
Dan Williams ab9af2277f libnm-glib: clarify some documentation 2011-03-17 11:18:35 -05:00
Dan Williams efc51d51e5 libnm-glib: more introspection annotation fixes
No connection is required for nm_client_add_and_activate_connection(),
it can be NULL.
2011-03-17 11:17:08 -05:00
Dan Williams 49c618a2a8 libnm-glib: fix introspection annotation for nm_remote_connection_delete() 2011-03-17 10:46:42 -05:00
Richard Hughes 4e73194500 libnm-glib: allow calling nm_remote_connection_delete() without a callback 2011-03-16 15:36:36 -05:00
Giovanni Campagna 4480365db7 libnm-glib: introspection annotation fixes (bgo #643011) 2011-03-16 15:25:37 -05:00
Jiří Klimeš 45521e3c68 libnm-glib: bump soname due to recent ABI break 2011-03-16 13:57:07 +01:00
Jiří Klimeš 6b2e8664a7 libnm-glib: update nm_client_activate_connection()'s description 2011-03-16 13:50:09 +01:00
Jiří Klimeš d91c68235d libnm-glib: fix calling callback when activating connection
Connections were not added to pending_activations resulting in callback
not being called.
2011-03-16 13:03:15 +01:00
Dan Williams ead5869825 libnm-glib: small activation callback rework
To make the API more consistent, instead of returning an
ActiveConnection object path, return the actual NMActiveConnection
object itself.  Suggested by Matthias Clasen.
2011-03-15 19:03:18 -05:00
Dan Williams 47a7f30682 libnm-glib: move some code around
Move the GObject boilerplate stuff to the bottom.
2011-03-15 17:16:52 -05:00
Dan Williams d4f8c43f40 libnm-glib: allow NULL device for nm_client_activate_connection() 2011-03-15 17:04:50 -05:00
Dan Williams 1c3a67aaa5 api: clarify function and usage of the Device.Udi property 2011-03-15 12:56:19 -05:00
Kjartan Maraas b224ab8e56 trivial: let g_free and g_strdup handle NULL (bgo #644763) 2011-03-15 00:08:58 -05:00
Kjartan Maraas c2b4b9c1d7 build: fix return types (bgo #644665)
Some functions were returning FALSE or 0 instead of NULL.
2011-03-14 01:05:51 -05:00
Dan Williams 16948ce927 libnm-glib: add nm_wimax_nsp_filter_connections() 2011-03-11 10:09:19 -06:00
Dan Williams f30e15a04d libnm-glib: add nm_access_point_filter_connections() 2011-03-11 09:36:41 -06:00
Dan Williams 3320764e1e libnm-glib: add nm_device_filter_connections() 2011-03-10 22:27:10 -06:00
Dan Williams fbf118e58e libnm-glib: documentation update for nm_remote_settings_list_connections() 2011-03-10 17:46:51 -06:00
Dan Williams bf76960597 libnm-glib: documentation fixes 2011-03-10 12:35:43 -06:00
Dan Williams 09b46bb269 libnm-glib: update some documentation 2011-03-10 11:55:09 -06:00
Dan Williams 0ae870bf09 libnm-glib: remove deprecated nm_ip4_config_get_hostname() function
Deprecated since 0.7 days; it always returned NULL anyway.
2011-03-10 11:48:22 -06:00
Dan Williams 8a80a62458 libnm-glib: make sure nm_device_get_dhcp6_config() is visible 2011-03-10 09:50:23 -06:00
Michael Biebl 8119ecf6b0 core: depend on stable gudev API 2011-03-10 03:19:27 -06:00
Dan Williams fa48970b4e libnm-glib: fix reply processing of AddConnection calls
It really is an object path, folks.
2011-03-10 02:03:25 -06:00
Dan Williams 9637fbfd12 libnm-glib: bump required NM version in pkgconfig file
To something modern, at least.
2011-03-10 01:55:30 -06:00
Dan Williams d35bf585d2 libnm-glib: fix bogus free
Apparently dbus-glib will pass non-NULL parameters to proxy
callbacks in the error case, so we've got to make sure we don't
touch any return parameters if there's been an error.
2011-03-10 01:35:09 -06:00
Dan Williams 36740e0182 libnm-glib-vpn: minor soname bump for new nm-vpn-plugin-utils.c functions
1.0.0 -> 1.1.0
2011-03-10 00:49:09 -06:00
Dan Williams 02f676c001 libnm-glib: document secret agent request flags 2011-03-02 02:03:12 -06:00
Dan Williams 12d7ce39a0 libnm-glib: add modem device properties
Forgot these in 2140dad5e0
2011-02-25 12:06:40 -06:00
Dan Williams 2140dad5e0 core: consolidate mobile broadband device types
These days more and more devices are showing up that support a
number of different access technology families in the same hardware,
like Qualcomm Gobi (CDMA and GSM), Pantech UM190 (CDMA and GSM),
Pantech UML290 (CDMA and LTE), LG VL600 (CDMA and LTE), Sierra
320U (GSM and LTE), etc.  The previous scheme of having device
classes based on access technology family simply cannot handle
this hardware and attempting to add LTE to both the CDMA and GSM
device classes would result in a bunch of code duplication that
we don't want.  There's a better way...

Instead, combine both CDMA and GSM device classes into a generic
"Modem" device class that provides capabilities indicating what
access technology families a modem supports, and what families
it supports immediately without a firmware reload.  (Gobi devices
for example require a firmware reload before they can switch
between GSM and CDMA).  This provides the necessary flexibility
to the client and allows us to keep the API stable when the
same consolidation change is made in ModemManager.

The current code doesn't yet allow multi-mode operation internally,
but the API is now what we want it to be and won't need to be
changed.
2011-02-25 10:16:17 -06:00
Giovanni Campagna bd933b27a1 libnm-glib: never propagate garbage values to async callbacks (bgo #642819)
When a DBus error is received, the values of the other parameters
may be undefined, but bindings will assume they're valid and fail.
Capture this case and pass NULL to the callbacks.
Also, allow passing NULL instead of a callback, for bindings that
don't support the argument types.
2011-02-23 12:02:37 -06:00
Dan Williams eab5851145 libnm-util: remove nm_warning/nm_info/nm_error macros
Clients need to do their own logging using glib or whatever; these
macros while somewhat helpful were not flexible and are not a
substitute for actual logging in the client.  g_warning, g_message,
and g_error are more suitable anyway.
2011-02-23 11:42:04 -06:00
Giovanni Campagna e77acd43b6 libnm-glib: more GObject introspection fixes (bgo #181415)
Fix some annotations and add the necessary ones for new functions.
2011-02-21 18:11:21 -06:00
Giovanni Campagna 3b57350dd6 libnm-glib: add signal documentation for NMRemoteConnection 2011-02-21 18:08:41 -06:00
Dan Williams fe5d59bc87 libnm-glib: nm_device_wifi_get_capabilities() should return NMDeviceWifiCapabilities 2011-02-18 12:01:46 -06:00
Dan Williams 7a00376b30 libnm-glib: nm_device_get_capabilities() should return NMDeviceCapabilities 2011-02-18 11:59:27 -06:00
Dan Williams 5c8d27b07b libnm-glib: add nm_device_get_device_type() 2011-02-18 11:57:13 -06:00
Dan Williams 24c429e29e libnm-glib: return enums for NMAccessPoint flags accessors 2011-02-18 11:42:55 -06:00
Richard Hughes e765fce2b4 test: don't crash libnm-glib if there are no devices for an active connection 2011-02-18 11:31:45 -06:00
Richard Hughes 0b8dd709b0 test: don't crash libnm-glib-test if there aren't any APs 2011-02-18 11:30:36 -06:00
Dan Williams c17721b360 libnm-glib: allow manual processing of properties changed events
Mostly for handling the GetAll response.
2011-02-16 15:04:39 -06:00
Dan Williams ccfc034a0d libnm-glib: make _nm_object_cache_get() return a referenced object 2011-02-16 15:04:39 -06:00
Jiří Klimeš e7d2eb43f7 libnm-glib: add code to get "Version" property 2011-02-16 14:34:19 +01:00
Jiří Klimeš d6905a8d66 libnm-glib: add GError parameter to _nm_object_get_... functions
It allows us to get the error back and have control over printing
the error.
2011-02-15 17:34:11 +01:00
Dan Williams ec115ed442 api: add additional NM daemon states
DISCONNECTING: the only active network connection is now being disconnected
LOCAL, SITE, GLOBAL: one-stop items for level of connectivity, which
we'll use to show when we think we're actually connected to the internet
or behind a captive portal or something
2011-02-14 17:55:27 -06:00
Dan Williams a661f78890 api: remove deprecated methods and signals
sleep, wake, StateChange, all deprecated in 0.8, are now removed.

sleep & wake are replaced with the Sleep() method, while
StateChange is replaced with the StateChanged signal which has
the same arguments.
2011-02-14 17:33:16 -06:00