Commit Graph

626 Commits

Author SHA1 Message Date
Thomas Haller
fbcabeb7f7 libnm-glib: fix crash by taking additional ref in nm-remote-connection/result_cb
result_cb invokes a function pointer provided by the user. Nothing prevents
the user from destroying the NMRemoteConnection in the callback, which leads
to a crash. Take an additional ref of NMRemoteConnection to keep it
alive.

This probably caused a crash for nm-applet:
https://bugzilla.redhat.com/show_bug.cgi?id=1030403

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-18 23:01:35 +01:00
Jiří Klimeš
de36db0af1 libnm-glib: fix return value in nm_remote_settings_load_connections()
when g_return_val_if_fail() fails.
2013-11-18 09:06:23 +01:00
Dan Winship
a52ebc74b5 libnm-glib: add nm_remote_settings_load_connections()
https://bugzilla.gnome.org/show_bug.cgi?id=709830
2013-11-15 13:38:48 -05:00
Dan Winship
1981323b19 libnm-glib: fix a crash in NMObject
deferred_notify_cb() needs to take a ref on the object around emitting
its deferred signals, since otherwise if a notify:: handler drops the
last reference on an object, a following g_object_notify() call would
crash.
2013-11-14 13:01:55 -05:00
Thomas Haller
97935382f4 coverity: fix various warnings detected with Coverity
These are (most likely) only warnings and not severe bugs.
Some of these changes are mostly made to get a clean run of
Coverity without any warnings.

Error found by running Coverity scan

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

Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Dan Winship
47cc8b25f2 libnm-glib: add NMDevice:physical-port-id property
Add the physical-port-id property to NMDevice so that clients can
recognize NPAR/SR-IOV devices.
2013-11-06 10:26:16 -05:00
Dan Williams
4ec5f5c8e3 libnm-glib: add support for NULL connections to nm_client_activate_connection()
Pass along to NetworkManager, which picks the best available connection for the
device and activates it.
2013-10-31 15:33:58 -05:00
Thomas Haller
3eb1d5e902 core: cleanup freeing of glib collections of pointers
When freeing one of the collections such as GArray, GPtrArray, GSList,
etc. it is common that the items inside the connections must be
freed/unrefed too.

The previous code often iterated over the collection first with
e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument.
For one, this has the problem, that g_free has a different signature
GDestroyNotify then the expected GFunc. Moreover, this can be
simplified either by setting a clear function
(g_ptr_array_set_clear_func) or by passing the destroy function to the
free function (g_slist_free_full).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:57 +02:00
Thomas Haller
5a0d3c724d libnm-glib: fix use proper unref function in libnm-glib/nm-ip4-config.c
NMIP4Address and NMIP4Route instances must be released
with a special nm_ip4_*_unref function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:22:59 +02:00
Yuri Chornoivan
61de24ba35 Fix typos
https://bugzilla.gnome.org/show_bug.cgi?id=710505
2013-10-19 11:49:18 -04:00
Dan Williams
fe9dee6bc8 libnm-glib: remove bogus warning
When connecting to a hidden SSID, the Access Point object that NetworkManager
creates will have no frequency, because the frequency is unknown until the
connection succeeds.  The warning has no use; if the AP doesn't have a
frequency then it even match a connection with a specified frequency.
2013-10-15 16:53:05 -05:00
Thomas Haller
9d0167c374 trivial: whitespace fix
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-14 12:08:53 +02:00
Jiří Klimeš
570b9b362d libnm-glib: fix a crash in nm_client_new() (rh #1010288)
We have to check if 'client' is valid when calling _nm_object_ensure_inited().
Creation of NMClient object can fail, because its parent NMObject's
constructor() returns NULL for D-Bus errors.

https://bugzilla.redhat.com/show_bug.cgi?id=1010288
2013-10-14 08:48:06 +02:00
Dan Winship
76cc2bd9df libnm-util, libnm-glib: fix up some gtk-doc comments
gtk-doc recognizes that #NMFoos is the plural of #NMFoo now, so you
don't need to put an empty comment between the type name and the "s"
to make it work. (Unfortunately, it's not smart enough to realize that
"NMIP4Addresses" is the plural of "NMIP4Address".)

Also, add some missing "#"s noticed along the way.
2013-10-11 10:16:14 -04:00
Thomas Haller
6868076e3c test: launch dbus for test-remote-settings-client
Running `make check` on systems without running dbus failed
in test-remote-settings-client.c:383

    make[4]: Entering directory `/tmp/NetworkManager/libnm-glib/tests'
    /tmp/NetworkManager/libnm-glib/tests/test-remote-settings-client /tmp/NetworkManager/libnm-glib/tests test-remote-settings-service.py

    ** (/tmp/NetworkManager/libnm-glib/tests/.libs/lt-test-remote-settings-client:26983): WARNING **: Error connecting to D-Bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    make[4]: *** [check-local] Trace/breakpoint trap (core dumped)

Modify the Makefile to start the dbus-daemon, if it is not yet
running.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-04 17:02:43 +02:00
Dan Winship
cbe261caa2 libnm: more valgrinding fixes 2013-10-03 11:04:45 -04:00
Dan Winship
28e67c7d73 libnm-glib: fix the leak that breaks the shell network status icon
All NMObjects created in response to property changes were getting
leaked, which in particular included all NMAccessPoint objects, which
meant that after disconnecting and reconnecting a wifi interface some
number of times (depending on how many access points were in the
area), gnome-shell would be watching so many D-Bus AccessPoint objects
(most of which didn't exist any more) that it would hit dbus-daemon's
limit on the number of match rules you can register, which meant that
NMActiveConnections created after that point wouldn't be able to
register for PropertiesChanged notifications, which meant that the
network status icon would get out of sync.
2013-10-03 11:04:45 -04:00
Dan Williams
b573de0408 trivial: whitespace fix 2013-10-02 10:13:18 -05:00
Dan Williams
1b773f4e6e libnm-glib: make properties-changed debugging available at runtime
Use an environment variable LIBNM_GLIB_DEBUG=properties-changed to
indicate that properties-changed debugging messages should be printed.
Also cleans up the debug output formatting.
2013-10-01 11:17:59 -05:00
Jiří Klimeš
282b9df60d vpn: fix VPN plugin D-Bus errors
The errors were documented as org.freedesktop.NetworkManager.VPN.Error.*,
but the actual values were org.freedesktop.NetworkManager.VPN.Plugin.*

Also update the errors documentation.
2013-09-27 13:26:29 +02:00
Jiří Klimeš
9dff830692 vpn: fix connecting to VPN (bgo #708255)
The ConnectInteractive() -> Connect() fallback code doesn't work, because
_connect_internal() changes the state to NM_VPN_SERVICE_STATE_STARTING before
checking if it can implement ConnectInteractive(), and then when the Connect()
call comes in, the VPN is not in STOPPED or INIT, so it returns an error.

The commit moves setting state to STARTING after the ConnectInteractive() check
availability, in the plugin. We introduce new plugin error and set it when the
the plugin does not implement ConnectInteractive(). NetworkManager uses this
error for ConnectInteractive() -> Connect() fallback.

https://bugzilla.gnome.org/show_bug.cgi?id=708255
2013-09-27 13:26:09 +02:00
Dan Winship
e98eb83a1a libnm-glib: fix cut+pasteo 2013-09-26 17:19:18 -04:00
Thomas Haller
db9b7e10ac core: update existing IP[46]Config of device instead of replacing it (bgo #707617)
When the IP[46]Config changes, a new configuration gets assembled.
Before, whenever the new configuration was different than the current
one, the IP[46]Config of the device was completely replaced. This also
meant, that the old dbus IP[46]Config object was removed and the new one
was exported.

Now instead of recreating a new configuration, it updates the existing
(already exported) configuration in-place.

Also, add new gobject properties 'gateway' and 'searches' to the config class,
they will be exported over dbus.

Also, whenever any of the exported properties changes, make sure that a
notify signal gets emitted.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-25 23:12:37 +02:00
Thomas Haller
a7c7b9f5aa trivial: fixup whitespace
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-25 23:12:37 +02:00
Dan Winship
4959936704 libnm-util, libnm-glib: bump .so versions to be higher than 0.9.8.4's 2013-09-25 10:16:55 -04:00
Dan Winship
17607e74a2 infiniband: only check the last 8 bytes when doing hwaddr matches
IPoIB "hardware addresses" are only partly based on the hardware, and
partly based on the InfiniBand configuration. So when checking if a
configuration matches a device, we should only match the fixed part.
2013-09-24 11:54:35 -04:00
Dan Williams
0f5f6da1a5 libnm-glib: fix NMDeviceModem connection compatible check for LTE connections
The 3GPP checks didn't include LTE capabilities, so the modem connection_compatible
check would fail for LTE connections with LTE compatible devices.
2013-09-14 18:46:32 -05:00
Dan Winship
066b592241 all: standardize on NMSettingWired:mac-address for all VLANs
Currently, ethernet-based VLANs can specify the hardware address of
the parent device (and, in theory, the cloned hardware address and MTU
of the VLAN device) by using an NMSettingWired in addition to the
NMSettingVlan.

The theory was that non-ethernet-based VLANs, when we eventually
supported them, would likewise use the setting type corresponding to
their parent device. However, this turns out to be both complicated
(the settings plugins and connection editor would have a
hard-to-impossible time figuring out which setting type to use in some
cases) and incorrect (for most L2 settings [eg, BSSID, bond mode,
etc], the VLAN can't have its own values separate from the parent
device).

What we should have done was just have :mac-address,
:cloned-mac-address, and :mtu properties on NMSettingVlan. However, at
this point, for backward-compatibility, we will just stick with using
a combination of NMSettingVlan and NMSettingWired, but we will use
NMSettingWired regardless of the underlying hardware type.
2013-09-12 18:34:23 -04:00
Dan Winship
26544f3148 libnm-glib: change "Since: 0.9.10" to "Since: 0.9.8.6" for backported API 2013-09-11 14:10:55 -04:00
Dan Winship
ffa012f3ce libnm-glib: fix nm_remote_connection_delete() callback
If you called nm_remote_connection_delete() on a connection whose only
ref was held by the NMRemoteSettings, then the callback would never
get called, because NMRemoteSettings would drop its ref before then
(when the connection emitted the 'removed' signal), so the callback
would get cancelled.

Fix this by taking an extra ref on the connection around the D-Bus
call in this case.

https://bugzilla.redhat.com/show_bug.cgi?id=997568
https://bugzilla.gnome.org/show_bug.cgi?id=706141
2013-09-09 09:28:24 -04:00
Thomas Haller
2766829a67 libnm-glib: don't warn when dbus object initialization fails with UNKNOWN_METHOD
A common case where this warning was triggered, was the removal of
IP6Config objects. As this can happen as a regular event, do not warn in
this case.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-09-05 22:08:43 +02:00
Dan Winship
f668423832 libnm-glib: Add NMClient:primary-connection and :activating-connection
https://bugzilla.gnome.org/show_bug.cgi?id=704841
2013-08-28 11:01:43 -04:00
Dan Winship
84919405e1 libnm-glib: support new connectivity property/methods 2013-08-28 10:54:09 -04:00
Dan Winship
bfce3f7dc8 build: switch from $(INCLUDES) to $(AM_CPPFLAGS) to make automake happy
Unfortunately, $(AM_CPPFLAGS) gets overridden by per-target _CPPFLAGS
variables, which $(INCLUDES) did not, so this requires some additional
changes.

In most places, I have just gotten rid of the per-target _CPPFLAGS
variables; in directories with a single target, the per-target
variable is unnecessary, and in directories with multiple targets, the
per-target variable is often undesirable, since it forces some files
to be compiled twice, even though there ends up being no difference
between the two files.
2013-08-22 11:49:16 -04:00
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