Commit Graph

104 Commits

Author SHA1 Message Date
Javier Arteaga
54df43ed52 core: introduce NMDeviceWireGuard
For now, the device only exposes partial link status (not including
peers). It cannot create new links.
2018-08-06 08:34:27 +02:00
Beniamino Galvani
f396826466 libnm: add (allow-none) annotations to nm_device_reapply()
The @connection argument can be NULL; add the (allow-none) annotation
otherwise calling the API with a NULL argument through GObject
introspection fails with:

 Argument 1 does not allow None as a value

Fixes: 278fd4fb0f
2018-07-04 14:01:53 +02:00
Timothy Redaelli
9be0c3330d contrib/rpm: Use Open vSwitch instead of OpenVSwitch
The correct naming is Open vSwitch so use it instead of OpenVSwitch

[lkundrak@v3.sk: added some more cases of the same]

https://github.com/NetworkManager/NetworkManager/pull/150

Fixes: 830a5a14cb
2018-06-28 20:31:32 +02:00
Lubomir Rintel
b7173ad7a7 devices: add NMDevice6Lowpan 2018-06-26 16:21:55 +02:00
Lubomir Rintel
179909a4f2 devices: add NMDeviceWpan 2018-06-26 16:21:54 +02:00
Thomas Haller
0aff056a63 doc: add units to nm_device_get_mtu() 2018-05-23 16:17:03 +02:00
Beniamino Galvani
1b5925ce88 all: remove consecutive empty lines
Normalize coding style by removing consecutive empty lines from C
sources and headers.

https://github.com/NetworkManager/NetworkManager/pull/108
2018-04-30 16:24:52 +02:00
Thomas Haller
684bf31150 all: unify spelling of translators hint in source code
Use the same form everywhere: "TRANSLATORS" instead of "Translators".
The manual also seems to prefer the upper-case form [1].

  $ sed 's/\<Translators\>: /TRANSLATORS: /g' $(git grep -l Translators) -i

[1] https://www.gnu.org/software/gettext/manual/gettext.html
2018-04-13 10:00:09 +02:00
Corentin Noël
468a019333 gobject-introspection: made several fixes to the annotations
https://bugzilla.gnome.org/show_bug.cgi?id=794658
2018-03-26 12:45:49 +02:00
Benjamin Berg
26c215e22d Add calls to g_simple_async_result_set_check_cancellable
If an operation is cancelled through the GCancellable, then the idiom is
that the operation is always cancelled, even if it has finished
successfully. To ensure this is the case, add calls to
g_simple_async_result_set_check_cancellable everywhere.

Without this, e.g. gnome-control-center will crash when switching away
from the power panel quickly, as the NMClient creation finishes
asynchronously and g-c-c assume that G_IO_ERROR_CANCELLED is returned to
ensure it doesn't access the now invalid user_data parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=794088
2018-03-08 14:52:45 +01:00
Lubomir Rintel
e4430e0969 libnm/device: use the type name for description if the product is empty
It's very likely that the product said something that was filtered out
by the fixup, such as "PCI Ethernet" or "Wi-Fi Adapter". Use a generic
type name in place of it.
2018-02-23 19:47:19 +01:00
Lubomir Rintel
c17155b1b9 libnm/device: (trivial) move some function upwards 2018-02-23 19:47:19 +01:00
Lubomir Rintel
22b76f4c58 libnm/device: prefer FROM_DATABASE udev properties
The database has a chance to fix up over garbage strings from the device
properties and we're now known to be reasonably good at fixing up crap
there.
2018-02-23 19:47:19 +01:00
Lubomir Rintel
0c151ae39d libnm/utils: extend the product fixup phrase list
The product names are generally of rather poor quality. The product name
is no place to enumerate product capabilities, the bus it's attached on
and similar nonsense.
2018-02-23 19:47:19 +01:00
Lubomir Rintel
8e32d8fc23 libnm/utils: split out vendor fixup
The hwdb generally contains the strings of rather poor quality,
especially when it comes to sensibly presenting them to the user and
they need various cleanups.

While the following patches add fixups, this one splits out vendor
fixups, because it turns out that a different set of fixups is needed
than for products.
2018-02-23 19:47:19 +01:00
Thomas Haller
a6be2f4aa9 all: use nm_str_hash() instead of g_str_hash()
We also do this for libnm and libnm-core, where it causes visible changes
in behavior. But if somebody would rely on the hashing implementation
for hash tables, it would be seriously flawed.
2017-11-16 11:49:52 +01:00
Lubomir Rintel
b5925d693c introspection: add o.fd.NM.Device.OvsBridge interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
6748c44cb6 introspection: add o.fd.NM.Device.OvsPort interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel
b0f3dc0add introspection: add o.fd.NM.Device.OvsInterface interface 2017-10-30 17:40:08 +01:00
Beniamino Galvani
df72cad107 device: add NMDevicePPP
The new device type represents a PPP interface, and will implement the
activation of new-style PPPoE connections, i.e. the ones that don't
claim the parent device.
2017-08-05 08:03:15 +02:00
Yuri Chornoivan
0050e8bd34 all: fix typos in documentation, translated strings and comments
https://bugzilla.gnome.org/show_bug.cgi?id=783173
2017-05-28 17:33:37 +02:00
Thomas Haller
e255ad2a03 libnm: move fixup_desc_string() to nm-libnm-utils.c 2017-05-19 12:45:45 +02:00
Thomas Haller
72104ea10a libnm: ignore phrases in fixup device description only when delimited by space 2017-05-19 12:45:45 +02:00
Thomas Haller
12c881ad40 libnm: fix device description in fixup_desc_string()
Fixes: b9e9f76165
2017-05-19 12:45:45 +02:00
Thomas Haller
b9e9f76165 libnm: UTF-8 sanitize strings from UDev in NMDevice 2017-05-19 09:46:08 +02:00
Thomas Haller
6808bf8195 udev: add and use nm_udev_utils_property_decode() function
DRY.
2017-03-22 12:41:06 +01:00
Thomas Haller
c7ccdf5fc8 libnm/udev: cache and reuse udev instance for NMDevice
No need to create a separate NMUdevClient instance for all devices.
Instead, have one "struct udev" instance in NMClient and pass
it down during object construction.
2017-03-22 12:41:06 +01:00
Thomas Haller
e32839838e udev: drop libgudev in favor of libudev
libgudev is just a wrapper around libudev. We can
use libudev directly and drop the dependency for
libgudev.
2017-03-22 12:41:06 +01:00
Thomas Haller
c033330c41 libnm: fix memleak of GUdevDevice in get_bus_name()
Fixes: f7b1b28202
2017-03-20 11:28:58 +01:00
Beniamino Galvani
b42f780e04 core: add support for dummy devices
Add support for creating dummy devices. This commit adds a D-Bus
interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used
primarily for determining the device type but does not carry any
properties.
2017-02-22 21:05:04 +01:00
Beniamino Galvani
5ae3db7515 libnm: disconnect signal from D-Bus proxies on dispose
https://bugzilla.gnome.org/show_bug.cgi?id=778615
2017-02-18 10:24:26 +01:00
Beniamino Galvani
67adbda83e core,libnm: introduce NMDeviceMacsec
At the moment the device only exposes the current link status, but
cannot create new links.
2017-01-16 17:37:14 +01:00
Lubomir Rintel
972e0d2803 all: rename the introspection data to use the interface paths in names
This makes it easier to install the files with proper names.
Also, it makes the makefile rules slightly simpler.

Lastly, the documentation is now generated into docs/api, which makes it
possible to get rid of the awkward relative file names in docbook.
2016-11-23 15:43:42 +01:00
Lubomir Rintel
4b7b518958 libnm: avoid leaking the interface proxies
_nm_object_get_proxy()'s semantics changed with the object-manager
branch merge: it now takes a reference.
2016-11-14 20:22:23 +01:00
Beniamino Galvani
5dfc571971 libnm: initialize @device_type of device objects
Before switching to the ObjectManager, the D-Bus property was used to
decide the actual type of the device and the property set manually by
each subclass in its _init() function. Now we determine objects type
based on their D-Bus interface and therefore we can handle the
property like all others, ensuring that we return a known value in
get_property() to avoid warnings in GLib.

This fixes the missing initialization of the property which causes
regressions on clients as nm-applet.

Fixes: 1f5b48a59e
2016-11-14 13:38:26 +01:00
Lubomir Rintel
1f5b48a59e libnm: use the o.fd.DBus.ObjectManager API for object management
This speeds up the initial object tree load significantly. Also, it
reduces the object management complexity by shifting the duties to
GDBusObjectManager.

The lifetime of all NMObjects is now managed by the NMClient via the
object manager. The NMClient creates the NMObjects for GDBus objects,
triggers the initialization and serves as an object registry (replaces
the nm-cache).

The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
object creation, removal and property changes. It takes care of the
property changes so that we don't have to and lets us always see a
consistent object state.  Thus at the time we learn of a new object we
already know its properties.

The NMObject unfortunately can't be made synchronously initializable as
the NMRemoteConnection's settings are not managed with standard
o.fd.DBus Properties and ObjectManager APIs and thus are not known to
the ObjectManager.  Thus most of the asynchronous object property
changing code in nm-object.c is preserved. The objects notify the
properties that reference them of their initialization in from their
init_finish() methods, thus the asynchronously created objects are not
allowed to fail creation (or the dependees would wait forever). Not a
problem -- if a connection can't get its Settings, it's either invisible
or being removed (presumably we'd learn of the removal from the object
manager soon).

The NMObjects can't be created by the object manager itself, since we
can't determine the resulting object type in proxy_type() yet (we can't
tell from the name and can't access the interface list). Therefore the
GDBusObject is coupled with a NMObject later on.

Lastly, now that all the objects are managed by the object manager, the
NMRemoteSettings and NMManager go away when the daemon is stopped. The
complexity of dealing with calls to NMClient that would require any of
the resources that these objects manage (connection or device lists,
etc.) had to be moved to NMClient. The bright side is that his allows
for removal all of the daemon presence tracking from NMObject.
2016-11-10 16:48:48 +01:00
Thomas Haller
95ab69b761 libnm: coerce empty strings to NULL for D-Bus properties
On D-Bus level, string (s) or object paths (o) cannot be NULL.
Thus, whenver server exposes such an object, it gets automatically
coerced to "" or "/", respectively.

On client side, libnm should coerce certain properties back, for which
"" is just not a sensible value.

For example, an empty NM_DEVICE_ETHERNET_HW_ADDRESS should be instead
exposed as NULL.

Technically, this is an API change. However, all users were well advised
to expect both NULL and "" as possible return values and handle them
accordingly.
2016-10-24 10:14:02 +02:00
Thomas Haller
21d7aa9204 libnm: minor refactoring by using g_clear_object() and nm_str_not_empty() 2016-10-24 10:14:02 +02:00
Dan Williams
fdf5b6941a libnm/libnm-glib: use Bluetooth device name as description (bgo #592819)
Abuse the 'name' property for this, for now, so we don't have to grab
a free slot from NMDeviceClass.

https://bugzilla.gnome.org/show_bug.cgi?id=592819
2016-06-21 10:35:53 -05:00
Thomas Haller
52bd08de05 libnm: add code comments to hint that NMConnection might not validate 2016-03-29 11:56:27 +02:00
Thomas Haller
a37c1d1e17 libnm: don't normalize connection for nm_device_get_applied_connection()
Normalizing means that we fail on invalid connections.
Which can happen when the server is newer than the libnm
version. We just want to return whatever we can. The
caller should make sense of this.

This makes libnm more accepting and thus is not going to break
existing applications. Also, nm_device_get_applied_connection()
is new API since nm-1-1.
2016-03-26 12:10:54 +01:00
Thomas Haller
2778d257cc libnm: declare internal function as static 2016-03-17 11:32:53 +01:00
Beniamino Galvani
22b3494de6 libnm,core: fix syntax of 'transfer' annotation 2016-02-24 17:23:01 +01:00
Thomas Haller
1b00009169 device: add new NMDeviceType NM_DEVICE_TYPE_VETH
Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
2016-02-23 23:15:37 +01:00
Thomas Haller
26718e989e libnm: add missing device types to get_type_name() 2016-02-23 23:15:37 +01:00
Thomas Haller
8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
2016-02-19 17:53:25 +01:00
Thomas Haller
54dc789314 device: fix signature for @flags argument of impl_device_reapply()
Thereby, also adjust the type for libnm's wrapper function -- as
we already broke ABI.
2016-02-16 11:24:49 +01:00
Thomas Haller
4bd45b9458 libnm: add nm_device_get_applied_connection() function 2016-02-16 11:24:49 +01:00
Thomas Haller
6898e2169e all: add version-id argument to device's Reapply method
This breaks API and ABI for the functions related to Reapply,
which got introduced in the current 1.1 development phase.

The version-id is here to allow users to error out if the connection
on the device was changed by a concurrent action.

https://bugzilla.gnome.org/show_bug.cgi?id=761714
2016-02-16 11:24:49 +01:00
Thomas Haller
2c2d9d2e4c build: cleanup default includes
- "gsystem-local-alloc.h" and <gio/gio.h> are already included via
  "nm-default.h". No need to include them separately.

- include "nm-macros-internal.h" via "nm-default.h" and drop all
  explict includes.

- in the modified files, ensure that we always include "config.h"
  and "nm-default.h" first. As second, include the header file
  for the current source file (if applicable). Then follow external
  includes and finally internal nm includes.

- include nm headers inside source code files with quotes

- internal header files don't need to include default headers.
  They can savely assume that "nm-default.h" is already included
  and with it glib, nm-glib.h, nm-macros-internal.h, etc.
2016-02-12 15:36:01 +01:00