Commit Graph

10305 Commits

Author SHA1 Message Date
Dan Winship
94758eb688 nmtui: fix sensitivity of "Add" button in address lists (rh #1131434)
When you first click "Add" in an address list, it adds a new field,
and the "Add" button becomes insensitive (because the new field is
empty, and thus not valid). But if you then clicked "Remove", "Add"
stayed insensitive. Fix that.
2014-08-27 14:55:52 -04:00
Dan Winship
d168363aa2 trivial: remove a stray prototype
libnm/nm-device-bridge.h had a prototype for nm_device_bridge_new(),
which doesn't exist.
2014-08-27 13:04:04 -04:00
Thomas Haller
4b9dc30988 gitignore: ignore /libgsystem/
When switching to and fro old branches, you end up with
the (now removed) libgsystem submodule. As `git clean -fd`
refuses to remove git-repositories, this is especially annoying.

Tell git to ignore it.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-27 17:26:30 +02:00
Geoffrey Thomas
cf10c8de8e supplicant/ifnet: fix spelling of "private_key2_passwd" option
This wpa_supplicant option is not named "private_key_passwd2". Looks
like this regressed in e5ed391f28.

Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
2014-08-27 09:20:02 -05:00
Thomas Haller
86ffea8004 libnm: ensure auto-registration only when not yet registered
Calling nm_secret_agent_register() on an already registered
instance leads to a warning. Ensure to call register during
auto-registration only when needed.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-27 08:52:25 +02:00
Piotr Drąg
509ac4cae7 po: update Polish (pl) translation (bgo #735470)
https://bugzilla.gnome.org/show_bug.cgi?id=735470

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-27 08:46:00 +02:00
Dan Winship
4c14b3db2a trivial: reorganize .gitignore
alphabetize by subdir; no other changes
2014-08-26 14:42:01 -04:00
Dan Winship
2f50c9752d trivial: remove nonexistent items from .gitignore 2014-08-26 14:42:01 -04:00
Thomas Haller
e1de236db1 build: add configure option not to install udev rules
Previously, user could only change the udev base directory,
but not disabling installation entirely.

Support this now with:
  ./configure --with-udev-dir=no
or
  ./configure --without-udev-dir

Also, just passing '--with-udev-dir' equals '--with-udev-dir=yes'.
Treat 'yes' equal to the default '/lib/udev'.

Also, check that the path is an absolute path starting with a '/'.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-26 19:37:51 +02:00
Thomas Haller
fb7b08388e glib-compat: fix compatibility wrapper for g_type_ensure()
The previous implementaiton of the compatibility wrapper failed
with clang when used inside a macro. This seems like a compiler
error not to ignore the deprecation. Workaround by refactoring
the g_type_ensure() wrapper.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-25 22:05:23 +02:00
Thomas Haller
ed20177d27 core: refactor nm_utils_complete_generic() not to use a dynamic format string
For NMDeviceWifi and NMDeviceWimax, the printf format string for
nm_utils_complete_generic() was created based on ssid/nsp. Since
these input strings are untrusted, this is a serious bug.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-25 16:46:14 +02:00
Jiří Klimeš
6de4a548df po: fix an error in a plural form of a Russian translation (bgo #735186)
The error was produced by:
msgfmt -vc ru.po

https://bugzilla.gnome.org/show_bug.cgi?id=735186
2014-08-25 09:47:54 +02:00
Jiří Klimeš
a1907ec257 cli: simplify do_connections() now that we don't wait for "connection-read"
nm_remote_settings_list_connections() ensures the connections are loaded first.
We check "help" commands before getting connections, because it is time
intensive action.
2014-08-22 23:33:04 +02:00
Jiří Klimeš
3cf1131e89 cli: fix 'nmcli connection' so that it returns correct exit code
It was broken by commit 57e802f3aa, which made
nmcli always return success.

For example:
$ nmcli con add type blabla
2014-08-22 23:33:04 +02:00
Dan Winship
bc0c1247ee libnm-core: fix compile warning about unused-result 2014-08-22 23:11:59 +02:00
Thomas Haller
fdef81207f Merge branch 'th/bgo696936_normalize_settings'
https://bugzilla.gnome.org/show_bug.cgi?id=696936

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:30:50 +02:00
Thomas Haller
0fe0e62d68 libnm-util: properly disconnect "notify" signal for settings in NMConnection
When removing/replacing a NMSetting in an NMConnection, we have
to disconnect setting_changed_cb() from the "notify" signal.

Backport commit dfba4ce1e1 from
libnm-core.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:26:34 +02:00
Thomas Haller
8bb4c54090 libnm-core: fix NMSettingConnection:verify() not to modify interface-name
verify() used to modify interface-name of the base settings. This is
discouraged, because verify() should not touch the connection.

For libnm-core we can change behavior and only modify the connection
in normalize().

Also, be more strict not to verify() sucessfully on invalid
interface-name.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
4f8b45e802 libnm-core: allow nm_setting_verify() to succeed individually without @all_settings
When calling nm_setting_verify() without providing any settings in @all_settings,
we assume that the setting on its own might be valid.
Only when checked together with all settings, we want to consider the setting
in the full context. nm_connection_verify() ensures to pass on a list of settings.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
66d88dc00f libnm-core: add normalize of MTU for NMSettingInfiniband
Previously, NMSettingInfiniband:verify() silently modifies the
setting for invalid MTU. verify() should not do that.

For libnm-core we can change behavior and implement normalization
of MTU. This changes behavior for NMSettingInfiniband:verify() so
that MTU gets no longer fixed by verify() alone. Instead verify()
fails with a verification error.

Due the possibility to normalize the MTU, NM still can receive
invalid settings and fix it.

For libnm-core we don't change behavior, merely add a code comment.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
6163263b42 libnm-core: make failure cases for nm_connection_normalize() more robust against bugs
We would expect that attempts to normalize a connection
are successful as verify() indicates. This way, a connection
is not modified if it cannot be fixed, and a connection will
be valid and modified after attempts to normalization.

However, there might be subtle, unexpected ways how this can fail.

For example, if NMSettingConnection:verify() detects a missing base type
setting, it returns NORMALIZABLE_ERROR if it finds a valid
NMSettingConnection:type. Normalization then adds an empty, default
setting. However, a new verify() might fail due to other reasons.
This would be a bug in NMSettingConnection:verify() which must not
indicate that it is able to normalize the connection, when it actually
is unable to do so.

Such bugs need fixing, but the code should be more robust to this case
because there might be complex, unanticipated situations.
Especially since NM relies on having a valid connection after normalize(),
so a strict error-out behavior is important.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
c9be5a32da keyfile/tests: test reading minimal keyfiles that needs normalization of type and slave-type
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
b8a475ba3f tests: refactor tests to use g_test framework (g_test_add_func)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
9ea3653f1f core: add compatibility wrapper for g_test_add_data_func_full() to nm-glib-compat.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
78edf6f581 keyfile/tests: add keyfile_read_connection_from_file() utility function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
54ff670423 keyfile: don't add [connection].type base setting which is done by nm_connection_normalize()
This undoes commit 9f8b7ff51d
but the same functionality is now provided via normalize().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
a9e0796433 libnm-core: normalize NMSettingConnection:type property
nm_connection_normalize() can now detect the 'type' property
based on existing base settings.

It can also create a (default) base setting.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
f60256e035 libnm-core: stricter verification of NMSettingConnection:type property
Now also verify the 'type' property regardless of existing
@all_settings.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
cf44a15874 keyfile: remove ensure_slave_setting() when reading connection
nm_connection_normalize() can now add the slave setting as needed. Remove
the duplicate functionality.

This undoes commit 664d64e0c0
but the same functionality is now provided via normalize().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
7279e7e150 libnm-core: normalize slave-type and slave-settings of connections
Some NMSettingConnection:slave-type types require a matching slave #NMSetting.
Add normalization of either the 'slave-type' property or the slave-setting.

Also be more strict in NMSettingConnection:verify() to enforce an
existing slave-setting depending on the slave-type.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:31 +02:00
Thomas Haller
651daee516 libnm-core: move validation of NMSettingConnection:type to NMSettingConnection:verify()
Partly it was already there. This makes NMSettingConnection:verify() stricter
then before, but validates the same as of NMConnection:_nm_connection_verify().

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
dfba4ce1e1 libnm-core: properly disconnect "notify" signal for settings in NMConnection
When removing/replacing a NMSetting in an NMConnection, we have
to disconnect setting_changed_cb() from the "notify" signal.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
b87ed28f01 libnm-core: don't set GError on invalid @connection argument in _nm_connection_verify()
In general, we don't set errors if passing a completely invalid @self
pointer to a method. We usually also don't set the error argument
when asserting. So, just drop it.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
1effc604cb libnm-core: add _nm_setting_find_in_list_required() function
This is an utility function that can be called during verify()
to find an NMSetting from @all_settings.

This is especially useful for looking up the NMSettingConnection
which usually is present. So just get it quickly. In the unexpected
case that it is missing, it sets @error and we can return.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
686e912b82 ifcfg-rh: remove verify() connection during reading
At the end of reading the connection, reader calls nm_connection_normalize()
to normalize the connection. Normalization inplicitly verifies the
connection.

Doing a verify along the way is not needed and even harmful. Soon further
checks will be added that make verify() fail, but normalize()
can fix the connection. So, while reading, we might actually have
an invalid connection, that will be normalized as last step.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
92d8286660 keyfile: let reader normalize() the connection, not only verify()
The new nm_connection_normalize() function allows to fixup an incomplete connection.
The keyfile reader should call normalize on a connection, so that we can implement
common normalizations there instead of inside the settings plugin.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
7d924d725a keyfile/tests: refactor tests to use nmtst_assert_connection_equals() function
Needed in the next commit when we have to normalize the connection
before comparing.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
5f26a9c11f keyfile: add NMSettingConnection in reader if missing
The recent change c88b832ce9 allows for
missing 'id' and 'uuid' entries. Further make the keyfile reader
more accepting, by creating a missing NMSettingConnection.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
043ab29ca9 nmtst: add assertion functions for verify() connection
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
80e1b05c31 nmtst: add nmtst_assert_connection_equals() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
0da0293f7e nmtst: add nmtst_connection_normalize() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
e478d1fb71 all: use _nm_utils_hash_values_to_slist()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
ff142ce780 libnm-core: add _nm_utils_hash_values_to_slist()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Thomas Haller
d299c425d4 libnm: move declaration of NM_SETTING_SECRET_FLAGS_ALL to nm-core-internal.h
As NM_SETTING_SECRET_FLAGS_ALL is used in libnm/nm-vpn-plugin-utils.c,
it is exposed as internal API and should be declared in
nm-core-internal.h.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Thomas Haller
8fe1b79012 libnm-core: declare NM_SETTING_COMPARE_FLAG_INFERRABLE flag in "nm-core-internal.h"
As this flag is used by NM-core, move it to nm-core-internal.h
header file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Thomas Haller
ef32da01fa all: add nm-core-internal.h header
Add a header file to expose private utility functions from libnm-core
that can be used by NetworkManager (core) and libnm.so. The header
is also used to give privileged access to libnm-core. Since NM links
statically, these functions are not exported and not part of public ABI.

This also removes the NM_UTILS_PRIVATE_CALL() macro and libnm.so no
longer exports nm_utils_get_private().

Before, this functionality was partly declared in nm-utils-private.h.
This was wrong because nm-utils-private.h is for functionality
entirely private to libnm-core.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Sandeep Shedmake
1a9f6bcbd3 po: updated Marathi (mr) translation (bgo #735212)
https://bugzilla.gnome.org/show_bug.cgi?id=735212

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 11:10:53 +02:00
Jiří Klimeš
6999a688b0 platform: (trivial) don't shadow link(3) in NMLinuxPlatform
Reported by Jordan Messina

(cherry picked from commit c54e6a95ff0957fb9d5c51505c8c3dd036600ff5)
2014-08-21 11:16:43 +02:00
Dan Winship
449ff11b78 libnm-core: clarify a comment about InfiniBand hardware address matching 2014-08-20 16:14:15 -04:00
Dan Williams
32a53f786d trivial: don't shadown link(3) in NMFakePlatform 2014-08-20 14:57:49 -05:00