Commit Graph

13873 Commits

Author SHA1 Message Date
Jiří Klimeš
54a5f4513b settings: do not clear secrets on Update() without any secrets (bgo #728920)
When a connection is updated by Update() and the new settings contain *no*
secrets, leave the previous secrets untouched. This makes updating connection
parameters much easier. Users (clients) need not to bother with secrets when
they only want adjust a parameter.

Use case:
 - GetSettings()
 - modify the settings
 - Update()

E.g. nmcli con mod my-wifi connection.zone home

https://bugzilla.gnome.org/show_bug.cgi?id=728920
2014-09-26 13:53:15 +02:00
Jiří Klimeš
c9b9229c2e core: do not assert when a device is enslaved externally
Test case:
 # ip link add name BR type bridge
 # brctl addif BR eth0

Monitoring external master/slave changes was intruduced by
08e0cfb484.
2014-09-26 11:17:57 +02:00
Shantha kumar
53f3967026 po: update Tamil (ta) translation (bgo #736652)
https://bugzilla.gnome.org/show_bug.cgi?id=736652
2014-09-26 11:02:46 +02:00
Jiří Klimeš
accaedbc37 ifcfg-rh: fix handling VLAN connections as bond/bridge slaves (bgo #737377)
MASTER=something denotes a bond slave. Thus we cannot write it for VLAN
setting. When reading, set the correct 'bond' slave type, not 'vlan'.

https://bugzilla.gnome.org/show_bug.cgi?id=737377
2014-09-26 10:11:52 +02:00
Dan Williams
6ae3c1bb82 trivial: quiet error setting userspace IPv6LL if link no longer exists 2014-09-25 16:05:31 -05:00
Jiří Klimeš
9eb7daaa0d merge: nmcli: displaying devices info (bgo #737250)
https://bugzilla.gnome.org/show_bug.cgi?id=737250
2014-09-25 19:09:14 +02:00
Jiří Klimeš
9eabe9c5f6 cli: move "CONNECTIONS" group lower in the output 2014-09-25 19:09:06 +02:00
Jiří Klimeš
6c27af6385 cli: show capabilities for Bluetooth devices 2014-09-25 19:09:05 +02:00
Jiří Klimeš
0b6bd87848 cli: also show team and bridge specific details for devices
Now it is only SLAVES field, common for bond, team and bridge devices.
2014-09-25 19:09:05 +02:00
Thomas Haller
4d675ce0fc platform: fix parsing vxlan netlink message for older kernel
vxlan_info_data_parser() must take care of missing netlink attributes.
Otherwise, older kernels will crash NM.

Also, workaround compilation against old kernel headers which are
missing 'struct ifla_vxlan_port_range'. We do this by defining our
own 'struct nm_ifla_vxlan_port_range' version.

Reported-by: Javier Jardón <jjardon@gnome.org>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-25 17:45:53 +02:00
Thomas Haller
6d65f1d56f libnm: fix compilation for wrong g_return call on void/non-void function
Fixes: 41eca3ea49
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-25 17:39:56 +02:00
Dan Winship
c772530ec5 libnm: make sync/async APIs more GLib-like (bgo #736988) 2014-09-25 09:30:22 -04:00
Dan Winship
41eca3ea49 libnm: add some missing sync/async method variants
Add the missing variant in most places in the API where previously
there was either only a synchronous version or only an asynchronous
version.

There is not yet a synchronous nm_client_activate_connection(),
nm_client_add_and_activate_connection(), or
nm_remote_settings_add_connection(), because the existing async code
depends on waiting for other asynchronous events, so making them run
synchronously is slightly more complicated. But these APIs can be
added later.
2014-09-25 09:29:21 -04:00
Dan Winship
2237ea3ddb libnm: make sync/async APIs more GLib-like
Make synchronous APIs take GCancellables, and make asynchronous APIs
use GAsyncReadyCallbacks and have names ending in "_async", with
"_finish" functions to retrieve the results.

Also, make nm_client_activate_connection_finish(),
nm_client_add_and_activate_finish(), and
nm_remote_settings_add_connection_finish() be (transfer full) rather
than (transfer none), because the refcounting semantics become
slightly confusing in some edge cases otherwise.
2014-09-25 09:29:20 -04:00
Dan Winship
6ca10677d6 libnm: merge saved and unsaved connection methods
Merge nm_remote_settings_add_connection() and
nm_remote_settings_add_connection_unsaved(), and likewise
nm_remote_connection_commit_changes() and
nm_remote_connection_commit_changes_unsaved(), by adding a boolean
flag to each saying whether to save to disk.
2014-09-25 09:29:20 -04:00
Thomas Haller
dfdb4b8e6f core: merge branch 'th/bgo731937_delete_nm_generated_connection'
https://bugzilla.gnome.org/show_bug.cgi?id=731937

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 17:04:44 +02:00
Thomas Haller
54f6666c66 core: recheck_assume_connection() do nothing if the device is not disconnected
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:45:21 +02:00
Thomas Haller
c9ece92a48 core: clean up nm-generated-assumed connections when assumption fails or connection disconnects
https://bugzilla.gnome.org/show_bug.cgi?id=731937

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:45:21 +02:00
Thomas Haller
ae680efa15 bluez: simplify cleanup of generated PAN connection
For PAN devices we create an unsaved connection if no matching
connection exists. After the device gets removed, we want to clean
up that connection, unless it was modified/saved in the meantime.

Before this was accomplished by creating a clone of the original
connection. When deciding whether the temporary connection was
modified, we would compare the current state with the original.

This can now be simplified, because we have the nm-generated flag
that gets cleared whenever the user modifies or saves the connection.
This code is also more robust, because the previous implementation
was a hack, but could not reliably detect whether the connection
was modified by the user.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:45:21 +02:00
Thomas Haller
6546e9d1ae core: use "nm-generated-assumed" flag instead of "nm-generated" for assumed connections
At a few places, we checked for nm_device_uses_generated_connection()
whether to touch the device or not. nm_device_uses_generated_connection() used
to look at the "nm-generated" property of the NMSettingsConnection.

We are about to change the meaning of "nm-generated", which will mean
"any connection generated by NM, for whatever reason".

Instead now use the new "nm-generated-assumed" connection flag that has
the meaning "nm-generated" used to have.
So rename nm_device_uses_generated_connection() to nm_device_uses_generated_assumed_connection()
which looks at the "nm-generated-assumed" flag instead.

Also, be more strict in nm_device_uses_generated_assumed_connection() to require
both an "nm-generated-assumed" connection *and* an active connection that is
nm_active_connection_get_assumed().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:32:11 +02:00
Thomas Haller
87739dbdf4 core: add "nm-generated-assumed" flag to NMSettingsConnection
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED is a special kind of
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED, that was generated for
connection assumption.

At the moment, the flag is used identical to NM_GENERATED. Later,
NM_GENERATED will get a slightly different meaning.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:32:11 +02:00
Thomas Haller
e5c719c0c0 settings: implement 'unsaved' and 'nm-generated' as #NMSettingsConnectionFlags
Before, NMSettingsConnection had two internal properties 'unsaved' and
'nm-generated'. Now, implement these properties as #NMSettingsConnectionFlags.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:32:11 +02:00
Thomas Haller
ec6d8385d3 settings: add NMSettingsConnection:flags
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:32:11 +02:00
Thomas Haller
388d4d9030 platform: add @peer_address argument to nm_platform_ip4_address_delete()
Deleting an IPv4 address using libnl requires the proper peer address.
Pass the address of the peer on to nm_platform_ip4_address_delete().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:32:11 +02:00
Thomas Haller
64851f9559 platform: log ifindex and ifname when deleting addresses or routes
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:32:11 +02:00
Thomas Haller
fa18bd6e0a platform/trivial: move code in nm-platform.c
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:12:45 +02:00
Thomas Haller
3744544920 core: log when emitting RECHECK_ASSUME signal
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:12:45 +02:00
Thomas Haller
bda076bb3c core: add macros NM_FLAGS_HAS(), NM_FLAGS_ANY() and NM_FLAGS_ALL()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-24 16:12:45 +02:00
Dan Williams
3adeffe1f1 man: clarify that keyfile is a fallback if no distro plugin is present
Distro plugins are intended to be used by default, and keyfile only if
distro plugins cannot read/write certain connection types.
2014-09-23 12:22:22 -05:00
Jiří Klimeš
37f12088e4 tui: additional fix for 'primary' option
The entry can't be empty. Otherwise removing the value and saving connection
would result in the primary option containing only the first character of the
original value.
2014-09-23 08:27:49 +02:00
Thomas Haller
54ed36e3c0 nmtst: fix compiler warnings and make initialization of macro variables explict
clang warns about uninitialized variables @__cur_setting_name and
@__cur_property_name as used inside @__code. Before calling to @__code,
explicitly initialize the values.

    Making all in tests
    make[4]: Entering directory `./NetworkManager/libnm-core/tests'
      CC       test-general.o
    test-general.c:2730:24: error: variable '__cur_property_name' is uninitialized when used here [-Werror,-Wuninitialized]
                                  NMTST_VARIANT_DROP_PROPERTY (NM_SETTING_CONNECTION_SETTING_NAME,
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../include/nm-test-utils.h:1079:20: note: expanded from macro 'NMTST_VARIANT_DROP_PROPERTY'
                                && !strcmp (__cur_property_name, __property_name)) \
                                            ^~~~~~~~~~~~~~~~~~~
    ../../include/nm-test-utils.h:1023:3: note: expanded from macro 'NMTST_VARIANT_EDITOR'
                    __code; \
                    ^
    test-general.c:2729:2: note: variable '__cur_property_name' is declared here
            NMTST_VARIANT_EDITOR (connection_dict,
            ^
    ../../include/nm-test-utils.h:1015:3: note: expanded from macro 'NMTST_VARIANT_EDITOR'
                    const char *__cur_setting_name, *__cur_property_name; \
                    ^
    [...]

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-22 16:34:18 +02:00
Thomas Haller
1aeb0c6df3 nmtst: move #endif to hide NMTST_VARIANT_* macros if not needed
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-22 16:32:01 +02:00
Thomas Haller
351cf9b328 libnm: fix warning about returning zero instead of %NULL in _nm_object_create()
clang warns:
    make[4]: Entering directory `./NetworkManager/libnm'
      CC       nm-object.lo
    nm-object.c:640:11: error: expression which evaluates to zero treated as a null pointer constant of type 'GObject *' (aka 'struct _GObject *') [-Werror,-Wnon-literal-null-conversion]
                            return G_TYPE_INVALID;
                                   ^~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:57:26: note: expanded from macro 'G_TYPE_INVALID'
    #define G_TYPE_INVALID                  G_TYPE_MAKE_FUNDAMENTAL (0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:221:36: note: expanded from macro 'G_TYPE_MAKE_FUNDAMENTAL'
    #define G_TYPE_MAKE_FUNDAMENTAL(x)      ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    nm-object.c:655:11: error: expression which evaluates to zero treated as a null pointer constant of type 'GObject *' (aka 'struct _GObject *') [-Werror,-Wnon-literal-null-conversion]
                            return G_TYPE_INVALID;
                                   ^~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:57:26: note: expanded from macro 'G_TYPE_INVALID'
    #define G_TYPE_INVALID                  G_TYPE_MAKE_FUNDAMENTAL (0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:221:36: note: expanded from macro 'G_TYPE_MAKE_FUNDAMENTAL'
    #define G_TYPE_MAKE_FUNDAMENTAL(x)      ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2 errors generated.

Fixes: b3c4917b0f
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-22 16:32:01 +02:00
Thomas Haller
85566e46d9 libnm-core: fix crash in update-secrets when trying to clear all settings without providing a connection variant
When the caller wants to clear all settings (thus providing
@setting_name NULL), a NM_VARIANT_TYPE_CONNECTION variant is
expected. This would lead to a crash when constructing the
@error literal due to uninitialized @key.

Clang also warns:

    Making all in .
    make[4]: Entering directory `./NetworkManager/libnm-core'
      CC       nm-connection.lo
    ../libnm-core/nm-connection.c:1016:25: error: variable 'key' is uninitialized when used here [-Werror,-Wuninitialized]
                                                 key);
                                                 ^~~
    ../libnm-core/nm-connection.c:962:17: note: initialize the variable 'key' to silence this warning
            const char *key;
                           ^
                            = NULL
    1 error generated.

Fixes: acf86f68b3
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-22 16:16:41 +02:00
Jiří Klimeš
3784678177 cli: create a connection if none exist in 'nmcli dev connect' (rh #1113941)
https://bugzilla.redhat.com/show_bug.cgi?id=1113941
2014-09-22 13:10:43 +02:00
Jiří Klimeš
cb4c9d9dba merge: enhance nmcli checks whether NetworkManager is running (bgo #698060) 2014-09-22 12:54:18 +02:00
Jiří Klimeš
dc1c17fd30 cli: get NMClient early and remove duplicated code 2014-09-22 12:53:46 +02:00
Jiří Klimeš
f27a259ee6 cli: when NM is not running, give this error in 'nmcli connection'
Check whether NM is running before comparing nmcli and NM versions. Returning
NMC_RESULT_ERROR_NM_NOT_RUNNING is in accordance with other nmcli commands.
2014-09-22 12:53:46 +02:00
Lubomir Rintel
82947737b1 cli: return a failure status when the daemon is not running (bgo #698060)
Applies to status commands such as "nmcli radio" or "nmcli g status".
This is consistent with other commands.

The "RUNNING" field is now always "running", the tool will just return
an error instead of setting it to "not running". It never signalled
whether the daemon was actually running anyway, only whether the client
managed to connect to it.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2014-09-22 12:53:46 +02:00
Jiří Klimeš
2f369559cb tui: fix displaying bond ARP IP targets
GLib-GObject-WARNING **: g_object_set_valist: object class `NmtAddressList' has no property named `string'
2014-09-22 12:30:44 +02:00
Jiří Klimeš
b0b51ec5ef tui: don't call g_strv_length() on NULL
GLib-CRITICAL **: g_strv_length: assertion `str_array != NULL' failed
2014-09-22 12:25:20 +02:00
Lubomir Rintel
efd09845c4 platform: increase NL buffer for systems with lots of interfaces (rh #1141256)
Seems like 128k is not enough for systems with many interfaces. This adds 4k
per device, while keeping the 128k minimum. Therefore this change only
affects systems with more than 32 interfaces.

https://bugzilla.redhat.com/show_bug.cgi?id=1141256
2014-09-22 11:17:12 +02:00
Lubomir Rintel
a36a3a9a52 tui/bond: remove primary option if mode is not active-backup (rh #1142864)
Just drop it as we disable the widget in UI.

https://bugzilla.redhat.com/show_bug.cgi?id=1142864
2014-09-22 10:54:15 +02:00
Jiří Klimeš
8ee53b79f6 cli: fix crash by getting addresses and routes
Broken by commit 6793a32a8c that changed
return values from GSlist to GPtrArray.
2014-09-19 22:59:39 +02:00
Jiří Klimeš
7966b6c05f ifcfg-rh: fix typo in function name and enhance testcase
The testcase now includes an invalid value too.

Added by commit  8657b4229c.
2014-09-19 21:19:18 +02:00
Dan Williams
24ab568826 core: fix stray 'break' in switch
From 82222d389 "core: move carrier handling to NMDevice"
2014-09-19 12:07:00 -05:00
Dan Williams
e4f218875d core: fix 'tun' device owner/group property getters
The properties are int64, but get_property() was was using
g_value_set_uint().
2014-09-19 12:07:00 -05:00
Dan Winship
f6f79aa433 libnm: simplify private D-Bus connection tracking
dcbw points out that g_dbus_connection_get_unique_name() can be used
to distinguish private from bus connections without us needing to keep
track ourselves.
2014-09-19 10:45:12 -04:00
Dan Winship
8f7b1e87c2 libnm: fix private bus async codepaths
_nm_dbus_new_connection_async() wasn't marking the connection as
private when it was private, causing
_nm_dbus_new_proxy_for_connection*() to pass the wrong args. Fix that.
2014-09-19 10:35:04 -04:00
Dan Winship
c6f4c354fe tui: fix an earlier bugfix
Fix to f69842aa; the arguments weren't swapped, one of them was just
completely superfluous.
2014-09-19 10:05:46 -04:00