Commit Graph

992 Commits

Author SHA1 Message Date
Jiří Klimeš
98ae6e06d2 all: g_type_init() has been deprecated in GLib 2.35.0
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
2014-05-27 16:58:21 +02:00
Jiří Klimeš
e3d1e176c2 libnm-util: make explicit that we only allow VPN as secondaries (rh #1094296)
https://bugzilla.redhat.com/show_bug.cgi?id=1094296
2014-05-23 12:19:29 +02:00
Jiří Klimeš
810e934892 libnm-util: add nm_utils_rsa_key_encrypt_aes() encrypting RSA key with AES 2014-05-12 10:46:41 +02:00
Jiří Klimeš
b3e39d4275 libnm-util: allow AES cipher for private keys
and add a testcase to check the encryption with AES.
2014-05-12 10:46:41 +02:00
Jiří Klimeš
a9f5494d4d libnm-util: do not call crypto_md5_hash() for empty passwords
It happens when one selected private key, but didn't provide the password yet
in nm-connection-editor.

(nm-connection-editor:11080): libnm-util-CRITICAL **: crypto_md5_hash: assertion `password_len > 0' failed
2014-05-12 10:46:41 +02:00
Jiří Klimeš
31cd3fe444 libnm-util: return better error messages on failures for _set_ functions 2014-05-12 10:46:41 +02:00
Thomas Haller
815245320d libnm-util: fix crash in NMSettingInfiniband when setting key or parent property
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-07 09:13:33 +02:00
Jiří Klimeš
b764766517 trivial: fix typo BBSID -> BSSID 2014-05-06 16:55:50 +02:00
Thomas Haller
9ef23947cc all: fix various warnings detected with coverity
https://bugzilla.gnome.org/show_bug.cgi?id=728320

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-02 15:20:30 +02:00
Thomas Haller
785c2a8c95 all/test: modify makefiles to run tests (without arguments) via autoconf TESTS=
This results in some nice coloring. Only move the tests that are called
without arguments from check-local to TESTS.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-23 21:28:55 +02:00
Dan Winship
4618a07304 libnm-util: use g_test_expect_message() in tests
Use g_test_expect_message(), to avoid spewing tons of error messages
when (successfully) running "make check".
2014-04-23 10:19:17 -04:00
Dan Winship
bea82ca98b all: set G_LOG_DOMAIN appropriately, for better g_log() messages 2014-04-23 10:19:17 -04:00
Thomas Haller
c65ed2dd6c libnm-util: add private header file nm-test-utils.h
This is intended to contain utility functions for tests. It will
be header only (containing inline functions).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-11 11:09:10 +02:00
Dan Winship
55c6d76c54 libnm-util: fix leaks in test-general 2014-04-01 15:00:33 -04:00
Dan Winship
e0832bdb79 libnm-util: add (private API) support for address labels to NMSettingIP4Config 2014-03-26 10:39:36 -04:00
Dan Winship
6f61b3b934 libnm-util: add nm-util-private.h header with nm_util_get_private() 2014-03-26 10:39:36 -04:00
Dan Williams
13c348dcd9 libnm-util: fix Bridge priority default (rh #1073664)
Due to a misread of the kernel code, the bridge priority default
when STP was enabled was 0x80 instead of 0x8000.
2014-03-14 15:29:11 -05:00
Thomas Haller
b73783b4a4 trivial: fix invalid code comment
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-14 17:06:19 +01:00
Thomas Haller
2f67105a91 libnm-util: remove assert to nm_utils_ip4_netmask_to_prefix
Commit 240c92ddb5 added an assert
to check that the input netmask is valid. Revert that commit for
the most part, some changes to the test function are not reverted.

We don't want to assert for a valid netmask, because it's
common to read the netmask from (untrusted) user input, so we
don't want to assert against it.

The caller *could* validate the netmask from untrusted sources, but
with the assert in place it cannot validate it in the most obvious way:

    prefix = nm_utils_ip4_netmask_to_prefix (netmask);
    if (netmask != nm_utils_ip4_prefix_to_netmask (prefix))
        goto fail;

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-14 16:55:51 +01:00
Thomas Haller
269ab02081 test: fix failure in make check due to invalid sorting of libnm-util/libnm-util.ver
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-06 20:09:45 +01:00
Dan Winship
4a5e2ced08 libnm-util: add nm_utils_check_virtual_device_compatibility()
Add a function encoding the logic of what virtual types support what
slave/parent types, so clients don't need to encode it themselves.
2014-03-06 09:37:20 -05:00
Dan Winship
50dea202a8 libnm-util: fix minor bugs in nm_setting_vlan_remove_priority_str_by_value()
Plug a leak, remove some dead code.
2014-03-05 11:20:54 -05:00
Jiří Klimeš
28bd3cab28 core: add 'type' and 'id' property for NMActiveConnection (rh #1061822)
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
2014-03-05 16:17:13 +01:00
Jiří Klimeš
d98a34dcda libnm-util: more specific error for missing ipv[46].adddress when method=manual 2014-03-03 12:42:05 +01:00
Dan Winship
e4a8cfd502 libnm-util: fix some parameter names to kill gtk-doc warnings 2014-02-28 16:12:49 -05:00
Jiří Klimeš
642cfdeebf libnm-util: add *_remove_*_by_value() functions for 'vlan' setting
nm_setting_vlan_remove_priority_by_value()
nm_setting_vlan_remove_priority_str_by_value()
2014-02-28 10:39:09 +01:00
Jiří Klimeš
1e5370b4d2 libnm-util: add *_remove_*_by_value() functions for '802-11-wireless-security' setting
nm_setting_wireless_security_remove_proto_by_value()
nm_setting_wireless_security_remove_pairwise_by_value()
nm_setting_wireless_security_remove_group_by_value()
2014-02-28 10:39:09 +01:00
Jiří Klimeš
de646d9588 libnm-util: add *_remove_*_by_value() functions for '802-11-wireless' setting
nm_setting_wired_remove_mac_blacklist_item_by_value()

Also add missing function nm_setting_wired_clear_mac_blacklist_items() and notify
about mac-address-blacklist changes.
2014-02-28 10:39:09 +01:00
Jiří Klimeš
ca0aa8139c libnm-util: add *_remove_*_by_value() functions for '802-3-ethernet' setting
nm_setting_wired_remove_mac_blacklist_item_by_value()
and missing
nm_setting_wired_clear_mac_blacklist_items()
2014-02-28 10:39:09 +01:00
Jiří Klimeš
b59bd75956 libnm-util: add *_remove_*_by_value() functions for 'connection' setting
nm_setting_connection_remove_permission_by_value()
nm_setting_connection_remove_secondary_by_value()
2014-02-28 10:39:09 +01:00
Jiří Klimeš
7c817d4176 libnm-util: add *_remove_*_by_value() functions for '802-1x' setting
nm_setting_802_1x_remove_eap_method_by_value()
nm_setting_802_1x_remove_altsubject_match_by_value()
nm_setting_802_1x_remove_phase2_altsubject_match_by_value()
2014-02-28 10:38:53 +01:00
Jiří Klimeš
1303ac3e9c libnm-util: add *_remove_*_by_value() functions for 'ipv4' and 'ipv6' settings
nm_setting_ip4_config_remove_dns_by_value()
nm_setting_ip4_config_remove_dns_search_by_value()
nm_setting_ip4_config_remove_address_by_value()
nm_setting_ip4_config_remove_route_by_value()

nm_setting_ip6_config_remove_dns_by_value()
nm_setting_ip6_config_remove_dns_search_by_value()
nm_setting_ip6_config_remove_address_by_value()
nm_setting_ip6_config_remove_route_by_value()
2014-02-28 10:31:41 +01:00
Jiří Klimeš
3789412160 libnm-util: fix adding values to 'phase2-altsubject-matches'
It was mixed up with 'altsubject-matches'.
2014-02-25 18:42:24 +01:00
Jiří Klimeš
68066b40f2 libnm-util: fix verify_identity() in '802-1x' setting
We need to return FALSE on error, otherwise we pile GErrors and assert in
nm_setting_verify().
2014-02-25 15:57:54 +01:00
Jiří Klimeš
c2a1cb1a44 docs: use %TRUE, %FALSE macros instead of plain TRUE, FALSE values for gtkdoc 2014-02-24 17:00:39 +01:00
Dan Winship
9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Dan Winship
95be722e54 libnm-util, libnm-glib: add some missing "Since: 0.9.10" tags
Based on diffing libnm-util.ver and libnm-glib.ver with their 0.9.8
versions.
2014-02-13 11:24:37 -05:00
Dan Winship
f7b1b28202 libnm-util, libnm-glib: add device/connection describing functions
Add functions to describe and disambiguate devices and connections for
display to the user. Originally from libnm-gtk.
2014-01-27 15:39:51 -05:00
Dan Williams
32a001f526 core: allow custom IP address ranges for Shared connections (bgo #675973)
Given an IPv4 address and prefix for a shared config, figure out
the DHCP address range automatically.  To keep things simple we
allow a max of 252 addresses (not including network address,
broadcast address, and the hotspot) no matter what prefix you use,
so if the address is 10.0.10.1, you still only get a range of
10.0.10.2 -> 10.0.10.254.

But we also leave some addresses available above the host address
for static stuff, like we did before.  This is done on a sliding
scale from 0 to 8 addresses, where about 1/10th the number of
available addresses are reserved.

https://bugzilla.gnome.org/show_bug.cgi?id=675973
2014-01-23 16:21:01 -06:00
Thomas Haller
240c92ddb5 libnm-util: add assert to nm_utils_ip4_netmask_to_prefix
g_return if the user provides an invalid netmask.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-21 21:01:56 +01:00
Dan Williams
a52c3e2e5f libnm-util: fix trivial GOI copy & paste issue 2014-01-21 10:18:23 -06:00
Jiří Klimeš
7ffbbae3a0 libnm-glib; fix introspection annotations so that <ipv6>.get_address() worked
Without the correct annotation, the functions didn't work correctly in Python
(causing segmentation fault).
2014-01-16 17:37:16 +01:00
Dan Winship
4c0ac46a99 libnm-util: add a missing GValue transform needed by nmtui 2014-01-16 09:19:06 -05:00
Thomas Haller
ff6315cbab libnm-util: only emit one CHANGED signal when adding several settings
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
123bf9eea4 libnm-util: raise CHANGED signal in nm_connection_update_secrets only on change
This changes behaviour of nm_connection_update_secrets() in that it will
now return %TRUE, if there are no secrets to be cleared. Seems more
correct, to return success if there is nothing to do.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
0f38213129 libnm-util: raise CHANGED signal in nm_connection_clear_secrets only on change
Often, nm_connection_clear_secrets does have no consequences, because
there is nothing to be cleared. Only raise a signal, if something
actually changed.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-15 17:01:53 +01:00
Thomas Haller
4dd6ab8f4b libnl-util: refactor nm_utils_ip4_prefix_to_netmask/netmask_to_prefix
- use a more efficient implementation for prefix_to_netmask
- fix netmask_to_prefix to behave consistently in case of
  invalid netmask
- remove unused duplicated functions from NetworkManagerUtils.c
- add test functions

Based-on-patch-by: Pavel Šimerda <psimerda@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Related: https://bugzilla.gnome.org/show_bug.cgi?id=721771
2014-01-10 13:34:57 -06:00
Jiří Klimeš
eac3c36bbf trivial: fix erroneous copy&paste value in libnm-glib 2013-12-18 10:06:06 +01:00
Thomas Haller
b7f6169dbd libnm-util: minor refactoring in nm_connection_compare()
Evaluate a cheaper comparison first, to fail early

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-17 17:18:14 -06:00
Dan Winship
d174825412 libnm-util: don't introspect nm_utils_inet[46]_ntop
nm_utils_inet4_ntop() and nm_utils_inet6_ntop() have arguments of
non-introspected types, so mark them (skip) to avoid warnings from
g-ir-scanner.
2013-12-16 13:06:52 -05:00