Commit Graph

13873 Commits

Author SHA1 Message Date
Thomas Haller
87f631f2f1 libnm/vpn: copy 'nm-vpn-plugin-old' files to 'nm-vpn-service-plugin'
Files are yet unchanged, only copy them to get a nicer history.

  /bin/cp libnm/nm-vpn-plugin-old.c libnm/nm-vpn-service-plugin.c
  /bin/cp libnm/nm-vpn-plugin-old.h libnm/nm-vpn-service-plugin.h
2015-07-29 22:34:35 +02:00
Thomas Haller
b378ae19fc tui: use NMVpnPluginInfo in vpn-helper.c
vpn-helper.c is currently not yet used. It was added for future
VPN support for nmtui. Refactor it to make use of the new vpn
helper functions in libnm.
2015-07-29 22:34:35 +02:00
Thomas Haller
d2d40cc75b vpn: refactor vpn-manager to use NMVpnPluginInfo
Use NMVpnPluginInfo to load the plugins in NMVpnManager.

This has the advantage of reusing the code from libnm
to use the same approach to read the plugin config files.

Another advantage is that we now check the file permissions
of the config file.
2015-07-29 22:34:35 +02:00
Thomas Haller
eafa6c3584 libnm: add load method to NMVpnPluginInfo
https://bugzilla.gnome.org/show_bug.cgi?id=749877
2015-07-29 22:34:35 +02:00
Thomas Haller
eed0d0c58f libnm: add nm_vpn_editor_plugin_load_from_file() function 2015-07-29 22:34:35 +02:00
Thomas Haller
b5cc017ba4 libnm: add _nm_utils_check_module_file() 2015-07-29 22:34:35 +02:00
Thomas Haller
bce040daa2 libnm: move NMVpnEditorPlugin to libnm-core/
Split the content of libnm/nm-vpn-editor-plugin.h and
move NMVpnEditorPlugin to libnm-core/nm-vpn-editor-plugin.h.

VPN plugins allow us to extend functionality about VPNs.
This can be also useful for NetworkManager core, hence
move that part to libnm-core.

The name NMVpnEditorPlugin is slightly misleading but not completely
wrong. The "editor" part stands no longer for bringing nm-applet
functionality (alone), but enable general VPN functionality in
the client.

Especially because we already have NMVpnPluginOld with a different
meaning (i.e. a base class of the plugin server implementation).
2015-07-29 22:34:35 +02:00
Thomas Haller
d6226bd987 libnm: add NMVpnPluginInfo class
NMVpnPluginInfo is little more then a wrapper around
the GKeyFile that describes the VPN plugin settings,
i.e. the name files under "/etc/NetworkManager/VPN/".

Add this class to make the VPN API more explicit. Clients
now can use NMVpnPluginInfo instead of concerning themselves
with loading the keyfile and the meaning of its properties.

Also add support for a new VPN plugins directory
"/usr/lib/NetworkManager/VPN", which should replace
"/etc/NetworkManager/VPN" in the future. But we have to
consider both locations for backward compatibility.

The content of the VPN directory is not user configuration,
hence it should not be under "/etc". See related bug 738853.
2015-07-29 22:34:35 +02:00
Thomas Haller
ed381cb1e2 libnm: add _nm_utils_check_file() util 2015-07-29 22:34:35 +02:00
Thomas Haller
ec92ecedae libnm: add NMUtilsStrStrDictKey utility
When having a hash-of-hashes where each hash is indexed by a name,
(such as GKeyFile), you can either implement it as a hash-of-hashes
or define your own version of indexes that pack both levels of names
into one key.

This is an implementation of such a key. Use it as:

  GHashTable *hash = g_hash_table_new_full (_nm_utils_strstrdictkey_hash,
                                            _nm_utils_strstrdictkey_equal,
                                            g_free, _destroy_value);

and create keys via:

  NMUtilsStrStrDictKey *k = _nm_utils_strstrdictkey_create (s1, s2);

For lookup you can use static strings (note that the static string
might increase the size of the binary):

  g_hash_table_contains (hash, _nm_utils_strstrdictkey_static ("outer", "inner"))
2015-07-29 22:34:34 +02:00
Jiří Klimeš
4f98910848 libnm: NMVpnPluginOld fixes
Change a{ss} to a{sv} because not all values are strings and never were.

https://bugzilla.gnome.org/show_bug.cgi?id=749686
2015-07-29 22:34:34 +02:00
Beniamino Galvani
5f7f38a586 wwan: trivial: fix typos in error strings
Reported-by: m.manico@gmx.at
2015-07-29 15:34:43 +02:00
Dan Winship
72953e3dc4 libnm-glib: add libnm compat defines to nm-vpn-plugin-ui-interface.h
Add a bunch of compat defines to nm-vpn-plugin-ui-interface.h, to make
it easier to compile the same code against libnm-glib's
NMVpnPluginUiInterface and libnm's NMVpnEditorPlugin.

https://bugzilla.gnome.org/show_bug.cgi?id=752500
2015-07-25 10:51:23 +02:00
Dan Winship
232d045c2e all: merge branch 'pre-gdbus-bgo622927'
Misc pre-gdbus-port stuff

https://bugzilla.gnome.org/show_bug.cgi?id=622927
2015-07-24 13:25:55 -04:00
Dan Winship
02370be7f3 core: rename NMDBusManager to NMBusManager
Our gdbus generated types use the same names as their corresponding
"real" types, but with "NM" changed to "NMDBus".

Unfortunately, that means that introspection/nmdbus-manager.c (the
generated type for src/nm-manager.c) uses the same type name as the
entirely unrelated src/nm-dbus-manager.c.

Fix this by removing the "d" from src/nm-dbus-manager.c. (We could
rename the generated type instead, but then it becomes inconsistent
with all the other generated types, and we're already using it as
"NMDBusManager" in libnm/nm-manager.c.)
2015-07-24 13:25:48 -04:00
Dan Winship
1424f249e3 settings: fix/reorganize NMSettingConnection secrets code
NMSettingConnection's for_each_secret() function works in a
slightly-too-GHashTable-specific way. Reorganize the code now to make
the change to GVariants easier later.

Also, fix a few bugs:
  - In the (unlikely) case of a non-secret being stored in
    vpn.secrets, we were treating it as though it was a secret
    with flags NONE.
  - The code was comparing against NONE when it meant !AGENT_OWNED
    in a few places. (With the current set of NMSettingSecretFlags
    values, this worked, but in the future it might not.)
  - In some cases we never called for_each_secret() with the
    @remove_non_secrets flag, meaning we might have ended up
    passing non-secrets to other code.
2015-07-24 13:25:48 -04:00
Dan Winship
2a2fd1216b settings: rework NMSecretAgent disconnection detection
Have NMSecretAgent emit "disconnected" when it detects that it has
been disconnected, rather than having both the agent and the agent
manager monitor it separately.
2015-07-24 13:25:47 -04:00
Dan Winship
1bcf42f37b bluetooth, vpn-manager: use GDBusProxies to monitor services
Create a GDBusProxy for the service to be monitored and use that to
tell whether it is running, rather than using NMDBusManager and the
global NameOwnerChanged signal.
2015-07-24 13:25:47 -04:00
Dan Winship
94078a139a core: port NMDhcp4Config/NMDhcp6Config to GVariant
In the gdbus port, the :options properties will be GVariant-valued
(and thus immutable), so having APIs that let you repeatedly modify
them would make things complicated. Since we actually only ever set
all the options at once, just change the APIs to do that, rather than
setting the options one-by-one.

Since nm-dispatcher already works in terms of GVariant, it makes
things simpler there if NMDhcp[46]Config can return its options as a
GVariant. And since we'll need it to be a GVariant internally later
anyway, just port everything to GVariant now, and convert it to a
GHashTable for dbus-glib only in get_property().
2015-07-24 13:25:47 -04:00
Dan Winship
c1dd3b6eed core: move D-Bus export/unexport into NMExportedObject
Move D-Bus export/unexport handling into NMExportedObject and remove
type-specific export/get_path methods (export paths are now specified
at the class level, and NMExportedObject handles the counters for all
exported types automatically).

Since all exportable objects now use the same get_path() method, we
can also add some helper methods to simplify get_property()
implementations for object-path and object-path-array properties.
2015-07-24 13:25:47 -04:00
Dan Winship
6fcc1deee0 core: add an NMExportedObject base class
Add NMExportedObject, make it the base class of all D-Bus-exported
types, and move the nm-properties-changed-signal logic into it. (Also,
make NMSettings use the same properties-changed code as everything
else, which it was not previously doing, presumably for historical
reasons).

(This is mostly just shuffling code around at this point, but
NMExportedObject will be more important in the gdbus port, since
gdbus-codegen doesn't do a very good job of supporting objects that
export multiple interfaces [as each NMDevice subclass does, for
example], so we will need more glue/helper code in NMExportedObject
then.)
2015-07-24 13:25:47 -04:00
Dan Winship
f3d10b3ec8 core: add missing g_dbus_error_strip_remote_error() calls 2015-07-24 13:25:47 -04:00
Dan Winship
ee707ba95a libnm-glib: drop private bus support
Anything that actually *needs* private bus support will be built
against libnm these days anyway.
2015-07-24 13:25:47 -04:00
Dan Winship
3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Dan Winship
dd0e198955 include: add nm-dbus-compat.h
Add a file containing the defines like DBUS_INTERFACE_DBUS from
dbus-shared.h, and use it from the gdbus-using files.

Also, convert a bunch of other places that were previously hardcoding
the string values to use the defines instead, and fix the ifcfg-rh
plugin to properly namespace its own D-Bus-related defines.
2015-07-24 13:25:47 -04:00
Dan Winship
f2174b623f ppp-manager: trivial: move class_init function 2015-07-24 13:25:47 -04:00
Dan Winship
d040fd18ab introspection: trivial fixes
Add some missing files to libnmdbus.la. Add missing name-fixing
annotations to the XML to make all generated NMDBus types match the
names of their corresponding NM types.
2015-07-24 13:25:47 -04:00
Thomas Haller
8bca864111 core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h
NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging.
It does not belong to "include/nm-macros-internal.h". Move it to "src/".
2015-07-24 18:07:16 +02:00
Thomas Haller
981817e998 Revert "core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h"
This reverts commit 1bca459865.

I accidentely pushed that commit. Revert.
2015-07-24 16:24:22 +02:00
Thomas Haller
a67c1ec4b5 libnm-core: fix return value in nm_utils_enum_to_str()
Fixes: 8be9814793
2015-07-24 15:48:29 +02:00
Thomas Haller
1bca459865 core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.h
NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging.
It does not belong to "include/nm-macros-internal.h". Move it to "src/".
2015-07-24 15:45:46 +02:00
Beniamino Galvani
0398ee0f4c merge: ethernet: add Wake-on-LAN support
Add support for configuring Wake-on-LAN options for Ethernet
connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1141417
2015-07-24 14:06:20 +02:00
Beniamino Galvani
996cbcd25c core: configure Wake-on-LAN parameters for Ethernet devices 2015-07-24 14:02:59 +02:00
Beniamino Galvani
de92df6c9f cli: add support for Wake-on-LAN settings 2015-07-24 14:02:59 +02:00
Beniamino Galvani
2e0d0bc050 ifcfg-rh: add support for Wake-on-LAN ethtool options
Based on branch danw/wip/ethtool by Dan Winship <danw@redhat.com>
2015-07-24 14:02:59 +02:00
Beniamino Galvani
5622461c04 libnm-core: add Wake-on-LAN properties to NMSettingWired 2015-07-24 14:02:59 +02:00
Beniamino Galvani
8be9814793 libnm-core: add enum conversion utilities
Add functions nm_utils_enum_to_str() and nm_utils_enum_from_str()
which can be used to perform conversions between enum values and
strings, passing the GType automatically generated for every enum by
glib-mkenums.
2015-07-24 14:02:59 +02:00
Josef Andersson
ea58caef36 po: update Swedish (sv) translation (bgo #752725)
https://bugzilla.gnome.org/show_bug.cgi?id=752725
2015-07-24 11:44:18 +02:00
Thomas Haller
be5f85ff63 keyfile: merge branch 'th/keyfile-write-connection-bgo740738'
https://bugzilla.gnome.org/show_bug.cgi?id=740738
2015-07-24 11:25:52 +02:00
Thomas Haller
6a5657896f keyfile: rename keyfile when user changes connection id
Originally, if you change the ID of a connection,
the existing keyfile will not be renamed. That means
after renaming a connection, it's keyfile name will
mismatch.

Now, when th user modifies a connection via D-Bus and changes
the connection it, rename the file.

https://bugzilla.gnome.org/show_bug.cgi?id=740738
2015-07-24 11:10:18 +02:00
Thomas Haller
238cb02ed6 keyfile: cleanup error messages in _internal_write_connection()
A GError should contain a nice, human readable error message. The
file:line prefix looks ugly. Also, the error messages are already
systemwide unique. So a user can easily grep for them and locate
the origin.
2015-07-24 11:04:01 +02:00
Thomas Haller
d5d34ec107 keyfile: refactor return paths in _internal_write_connection() 2015-07-24 11:04:01 +02:00
Thomas Haller
c0b03debc8 keyfile: add info logging when updating connection 2015-07-24 11:04:01 +02:00
Thomas Haller
c863d2ad0f keyfile: fix memleak of path in commit_changes() 2015-07-24 11:04:01 +02:00
Thomas Haller
47cc91bef6 core: fix handling route-metric for nm_ip4_config_merge()
Fixes: bc75cd53a8
2015-07-22 14:33:01 +02:00
Beniamino Galvani
3a7c641b02 libnm: backport symbols for metered connections support to 1.0.6
Backport to 1.0.6 the following symbols:
 - nm_device_get_metered
 - nm_metered_get_type
 - nm_setting_connection_get_metered
2015-07-22 14:06:31 +02:00
Thomas Haller
e6a8a08a57 default-route: merge branch 'th/default-route-on-unmanaged-device-rh1244483'
Fix wrongly managing the default-route on unmanaged devices. Also,
improve handling for p2p link with an 0.0.0.0 IPv4 gateway.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
2015-07-22 14:03:45 +02:00
Thomas Haller
7f129b976c libnm-core: don't assert against non-NULL @ip argument to canonicalize_ip()
Remove an assertion in canonicalize_ip() to assert that either a
non-NULL @ip is given, or @null_any is TRUE.

The condition of the assert is not easy to understand without context.
Instead the caller should already handle %NULL properly.

All callers that pass @null_any=FALSE to canonicalize_ip(), already assert
that the argument is not %NULL. With the exception of nm_ip_route_new()
which however checks for a valid @dest early on.
2015-07-22 13:49:17 +02:00
Lubomir Rintel
f14fd048ff libnm-core: 0.0.0.0 is a valid gateway too
It makes sense for point-to point links.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
2015-07-22 13:49:17 +02:00
Thomas Haller
9342568694 libnm-core: fix nm-setting-ip-config.c:valid_ip() to handle %NULL argument
We call valid_ip() from nm_ip_route_new() to check whether an untrusted string
is a valid ip address. Properly handle %NULL argument.

Fixes: 21c8a6b20e
2015-07-22 13:49:17 +02:00