summaryrefslogtreecommitdiff
path: root/libnm-util
Commit message (Collapse)AuthorAgeFilesLines
* libnm-glib: add support for IP tunnel devices as generic onesBeniamino Galvani2015-12-011-0/+2
|
* libnm-glib: add support for TUN devicesBeniamino Galvani2015-11-251-0/+2
| | | | | | | | | Since libnm is the preferred way to interact with NM now, we don't want to add new device types to libnm-glib. Make libnm-glib recognize TUN devices as generic ones and modify NMDeviceGeneric to use the correct D-Bus interface based on the actual device type.
* all: fix typos in the code and update translations for that (bgo #758102)Jiří Klimeš2015-11-161-1/+1
| | | | | | Found by Anders Jonsson <anders.jonsson@norsjovallen.se> https://bugzilla.gnome.org/show_bug.cgi?id=758102
* vlan: (all) add VLAN MVRP flagJiří Klimeš2015-10-272-4/+11
| | | | http://patchwork.ozlabs.org/patch/219364/
* libnm: treat missing NMSettingVlan:flags property as old default valueThomas Haller2015-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We changed the default value of MSettingVlan:flags from 0 to 1 (NM_VLAN_FLAG_REORDER_HEADERS). That means, that old libnm clients will not serialize 0 (their default). This change broke the D-Bus API. The D-Bus API allows to omit a value when meaning the default value. That means, we cannot change the default value (in the D-Bus API!) without breaking previous assumptions. A newer libnm version should treat a missing flags argument as the old default value and thus preserve the original default value (in the D-Bus API). This has the downside that for the future we will continue to treat a missing value as the old default value (0), and in order to get the new default value (1), the client must explicitly set the flags. We also must restore the original default value in libnm-glib. libnm-glib does not support _nm_setting_class_override_property() and thus it must keep thinking that the default value for the GObject property continues to be 0. Otherwise, it would not serialize a 1, which a new libnm would now interpret as 0. https://bugzilla.redhat.com/show_bug.cgi?id=1250225 Fixes: 687b6515980c08cdbb9734bd112a594166c4d6dd
* libnm-util/test: use "nm-test-utils.h" in test-setting-dcbThomas Haller2015-10-101-14/+5
|
* libnm/vlan: default to vlan.flags=REORDER_HDR for new connections (rh #1250225)Jiří Klimeš2015-10-071-1/+1
| | | | | | | | | | | | | | | The kernel defaults REORDER_HDR to 1 when creating a new VLAN, but NetworkManager's VLAN flags property defaulted to 0. Thus REORDER_HDR was not set for NM-created VLANs with default values. We want to match the kernel default, so we change the default value for the vlan.flags property. However, we do not want to change the flags for existing connections if the property is missing in connection files. Thus we have to update plugins for that. We also make sure that vlan.flags is always written by 'keyfile' when the value is default. That way new connections have flags property explicitly written and it will be loaded as expected. https://bugzilla.redhat.com/show_bug.cgi?id=1250225
* libnm-util: add ipv4.dhcp-timeout propertyLubomir Rintel2015-10-064-0/+44
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1262922
* build: extract version macros from "nm-version.h" to new header file ↵Thomas Haller2015-09-304-53/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "nm-version-macros.h" For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus paths of NetworkManager. It is desirable to have this header usable without having a dependency on "glib.h", for example for a QT application. For that, commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy. For libnm-glib library, the analog to "nm-dbus-interface.h" is "NetworkManager.h", and the same applies there. Commit 159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include. However, that broke build on PackageKit [1] which expected to get the version macros by including "NetworkManager.h". So at least for libnm-glib, we need to preserve old behavior so that a user including "NetworkManager.h" gets the version macros, but not "glib.h". Extract the version macros to a new header file "nm-version-macros.h". This header doesn't include "glib.h" and can be included from "NetworkManager.h". This gives as previous behavior and a glib-free include. For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h". Very few users will actually need the version macros, but not using libnm. Users that use libnm, should just include (libnm's) "NetworkManager.h" to get all headers. As a special case, a user who doesn't want to use glib/libnm, but still needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include them both separately. [1] https://github.com/hughsie/PackageKit/issues/85 Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b
* Revert "libnm-util: don't include "nm-version.h" in "NetworkManager.h""Thomas Haller2015-09-261-0/+2
| | | | | | | | This breaks build of PackageKit. Revert the patch. This reverts commit 159e827a72f420048e12d318f8ba1edd3f641fc8. https://bugzilla.gnome.org/show_bug.cgi?id=755660
* libnm-core/libnm-util: fix an erroneous error messageJiří Klimeš2015-09-251-1/+0
| | | | ipv6.dns: 'this property is not allowed for '%s=%s'' not allowed for method=ignore
* libnm: include "glib.h" in "nm-version.h"Thomas Haller2015-09-251-0/+2
| | | | | | | | | | | | This is a forward port of commit 6f616d4c4b04d5478f60d0311317bc84c5459ea4 which added this patch on nm-1-0 branch. However, the reason stated there is wrong because we don't need this to fix Qt examples. Building Qt examples was fixed in that "nm-dbus-interface.h" no longer drags in "nm-version.h". On the other hand, we still want "nm-version.h" to be self-contained, and include "glib.h" as it needs it.
* libnm-util: don't include "nm-version.h" in "NetworkManager.h"Thomas Haller2015-09-251-2/+0
| | | | We want "NetworkManager.h" to have no dependancy on libnm and glib.
* libnm-core/libnm-util: fix an assertion in adsl settingJiří Klimeš2015-09-211-2/+5
| | | | (process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed
* libnm-util: fix flags for GObject introspection (rh #1255436)Jiří Klimeš2015-08-241-7/+7
| | | | | | | | | | | | | | | | | Without marking the enumeration as flags, the types will be "enumeration" instead of "bitfield". And python raises ValueError exception. Example: from gi.repository import NMClient, NetworkManager client = NMClient.Client.new() for dev in client.get_devices(): if dev.get_device_type() == NetworkManager.DeviceType.WIFI: for ap in dev.get_access_points(): ap.get_rsn_flags() raises "ValueError: invalid enum value: 648" https://bugzilla.redhat.com/show_bug.cgi?id=1255436
* core: final gdbus portingDan Winship2015-08-107-2/+157
| | | | | | | | | | Port remaining bits to gdbus and remove stray dbus-glib references Drop the dbus-glib version check from configure, since nothing depends on new dbus-glib any more. Move nm-dbus-glib-types.h and nm-gvaluearray-compat.h from include/ to libnm-util/ since they are now only used by libnm-util and libnm-glib.
* all: drop includes to <glib/gi18n.h> for "nm-default.h"Dan Winship2015-08-0531-34/+0
| | | | | | | The localization headers are now included via "nm-default.h". Also fixes several places, where we wrongly included <glib/gi18n-lib.h> instead of <glib/gi18n.h>. For example under "clients/" directory.
* nm-default: include i18n headers via "nm-default.h"Thomas Haller2015-08-051-0/+1
|
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-0520-22/+20
|
* libnm: include header in public header file with angle bracketsThomas Haller2015-08-051-1/+1
|
* libnm-glib: add libnm compat defines to nm-vpn-plugin-ui-interface.hDan Winship2015-07-251-0/+4
| | | | | | | | 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
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-2420-24/+20
| | | | | | | | | | | | | | | | 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).
* libnm: handle illegal characters in nm_utils_ssid_to_utf8() (rh #1243078)David Shea2015-07-161-0/+15
| | | | | | | | | | | | g_convert_with_fallback() will fail if the SSID contains characters that are not legal in the source encoding, which, if $LANG is not set, will be ASCII. If this happens, replace all non-ASCII and non-printable characters with '?'. It is possible that nm_utils_ssid_to_utf8() will now return an empty string (e.g., the source string is actually big-endian UTF-16 and g_strcanon() stops on the first byte), but it will not return NULL. https://bugzilla.redhat.com/show_bug.cgi?id=1243078
* all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()Thomas Haller2015-07-124-10/+4
| | | | g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
* libnm-core,libnm-util: avoid calling a constructorLubomir Rintel2015-06-021-1/+7
| | | | | | It yields completely unpredictable results on Ubuntu 12.04 (the global variable successfully comparing to NULL despite demonstrably not NULL). Possibly a toolchain bug.
* build: rename file "include/nm-utils-internal.h" to "nm-macros-internal.h"Thomas Haller2015-06-012-2/+2
| | | | | | | | | | | We already have "nm-utils*.h" and "NetworkManagerUtils.h" headers. Rename "include/nm-utils-internal.h" to "nm-macros-internal.h". I think that name is better, because this file is header-only, internal, and repository-wide. Also, it will never contain non-header-only declarations because there is no backing object file under "include/". It will only contain macros and inline functions.
* builds: only enable TAP driver for glib >= 2.37.6Lubomir Rintel2015-05-281-2/+0
| | | | | No TAP support for previous versions and --tap argument is silently ignored, confusing the TAP driver.
* tests: use the TAP formatterLubomir Rintel2015-05-261-0/+2
| | | | The test results in standard format are easily integrated into CI systems.
* tests: move all asserts into testsLubomir Rintel2015-05-263-121/+121
| | | | Otherwise the TAP formatter would produce a plan-less output.
* vlan: don't fail if parent isn't found at construct time for existing devicesDan Williams2015-05-061-0/+4
| | | | | | | | | | | | | For existing devices, depending on the order that netlink sends interfaces to us, the parent may be found after the VLAN interface and not be available when the VLAN interface is constructed. Instead of failing construction, when a NMDeviceVlan has no parent keep it unavailable for activation. Then have the Manager notify existing devices when a new device is found, and let NMDeviceVlan find the parent later and become available via that mechanism. This doesn't apply to VLANs created by NM itself, because the kernel requires a parent ifindex when creating a VLAN device. Thus this fix only applies to VLANs created outside NetworkManager, or existing when NM starts up.
* build: don't drop libnm-util/nm-version.h on cleanLubomir Rintel2015-05-051-2/+1
| | | | | Same behavior as for libnm-core/nm-version.h. It's created by configure, not built with make. Removing it breaks 'make clean; make'
* wimax: drop WiMAX support (bgo #747846)Dan Winship2015-04-172-0/+21
| | | | | | | | | | | | | | | | | | | | Even Fedora is no longer shipping the WiMAX SDK, so it's likely we'll eventually accidentally break some of the code in src/devices/wimax/ (if we haven't already). Discussion on the list showed a consensus for dropping support for WiMAX. So, remove the SDK checks from configure.ac, remove the WiMAX device plugin and associated manager support, and deprecate all the APIs. For compatibility reasons, it is still possible to create and save WiMAX connections, to toggle the software WiMAX rfkill state, and to change the "WIMAX" log level, although none of these have any effect, since no NMDeviceWimax will ever be created. nmcli was only compiling in support for most WiMAX operations when NM as a whole was built with WiMAX support, so that code has been removed now as well. (It is still possible to use nmcli to create and edit WiMAX connections, but those connections will never be activatable.)
* wifi: indicate 2ghz and 5ghz wifi device capabilitiesBeniamino Galvani2015-04-081-1/+7
| | | | | | | | | | | | Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the frequency bands supported by a Wifi device. Add also CAP_FREQ_VALID, which is set when the values of the other 2 capabilities are available. Original patch by Dan Williams <dcbw@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=723295
* device,libnm,cli: add "new-activation" reason for device state changeLubomir Rintel2015-04-081-0/+2
| | | | It will be used when the device is disconnected for new connection activation.
* crypto: only use gnutls crypto API, remove libgcrypt dependency (bgo #730294)Jiří Klimeš2015-04-012-83/+65
| | | | | | | We don't need libgcrypt, because gnutls provides an API for encryption and hashing. (Anyway gnutls itself now uses nettle instead of libgcrypt). https://bugzilla.gnome.org/show_bug.cgi?id=730294
* libnm-util: allow 0.0.0.0/1 route in verify() (rh #1203904)Jiří Klimeš2015-03-242-10/+44
| | | | | | | | | | | | | | OpenVPN uses a trick to override default route by adding these two routes: 0.0.0.0/1 and 128.0.0.0/1. We should allow this and only refuse real default route (i.e. prefix == 0). Also verify IPv6 addresses and routes. See: man openvpn (search for def1) https://community.openvpn.net/openvpn/wiki/IgnoreRedirectGateway https://bugzilla.redhat.com/show_bug.cgi?id=1203904
* libnm: don't check for valid passwords in NMSetting:verify()Thomas Haller2015-03-204-81/+4
| | | | | | | | | | | | | | | | | | | | | | | | We must never fail verification of a connection based on a password because the password is re-requested during activation. Otherwise, if the user enters an invalid password for a (previously) valid connection, the connection becomes invalid. NetworkManager does not expect or handle that requesting password can make a connection invalid. Invalid passwords should be treated as wrong passwords. Only a UI (such as nm-connection-editor or nmcli) should validate passwords against a certain scheme. Note that there is need_secrets() which on the contrary must check for valid passwords. Error scenario: Connect to a WEP Wi-Fi, via `nmcli device wifi connect SSID`. The generated connection has wep-key-type=0 (UNKNOWN) and wep-key-flags=0. When trying to connect, NM will ask for secrets and set the wep-key0 field. After that, verification can fail (e.g. if the password is longer then 64 chars).
* libnm: fix error prefix in NMSettingGsm:verify()Thomas Haller2015-03-171-1/+1
|
* libnm: only call strlen() once in NMSetting8021x:path_to_scheme_value()Thomas Haller2015-03-121-5/+7
| | | | Also assert that path is not empty.
* libnm: ensure valid blob for nm_setting_802_1x_set_*_cert()Thomas Haller2015-03-121-4/+32
| | | | | | | A valid blob cannot start with "file://", otherwise it would break the implementation of the certificate properties in NMSetting8021x. Simply reject every blob in nm_setting_802_1x_set_ca_cert() et al. that is not valid according to get_cert_scheme().
* libnm: combine get_cert_scheme() and verify_cert() and ensure valid paths ↵Thomas Haller2015-03-121-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for NMSetting8021x get_cert_scheme() would return PATH scheme for binary data that later will be rejected by verify_cert(). Even worse, get_cert_scheme() would not check whether the path is NUL terminated, hence the following can crash for an invalid connection: if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) g_print ("path: %s", nm_setting_802_1x_get_ca_cert_path (s_8021x)) Combine the two functions so that already get_cert_scheme() does the same validation as verify_cert(). Also change behavior and be more strict about invalid paths: - Now, the value is considered a PATH candidate if it starts with "file://", (sans NUL character). A change is that before, the "file://" (without NUL) would have been treated as BLOB, now it is an invalid PATH (UNKNOWN). - If the binary starts with "file://" it is considered as PATH but it is only valid, if all the fllowing is true: (a) the last character must be NUL. (b) there is no other intermediate NUL character. Before, an intermediate NUL character would have been accepted and the remainder would be ignored. (c) there is at least one non-NUL character after "file://". (d) the string must be fully valid utf8. The conditions (b) and (c) are new and some invalid(?) paths might no longer validate. Checking (d) moved from verify_cert() to get_cert_scheme(). As set_cert_prop_helper() already called verify_cert(), this causes no additional change beyond (b).
* translations: avoid preprocessor strings inside translation macroThomas Haller2015-02-241-8/+10
| | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=740381 https://bugzilla.gnome.org/show_bug.cgi?id=744998 Backport commit 943db815eeca43e5d1086b80feee77840655a781 from libnm-core to libnm-util.
* test: initialize auto-destructed pointersLubomir Rintel2015-02-093-15/+15
| | | | | | | Otherwise the compiler complains that they could be left uninitialized in case the function returns too early. Fixes: 76745817c3e77b7d6c22290a7564b73224147516
* tests: enable valgrind tests for testsThomas Haller2015-02-091-0/+1
|
* libnm/tests: fix memleaks in tests for valgrindThomas Haller2015-02-095-17/+46
|
* libnm-util: only unref and don't destroy hash in nm_connection_to_hash()Thomas Haller2015-02-092-4/+6
| | | | | The returned hash from nm_connection_to_hash() used to destroy the nested hashes, instead of only unrefing them.
* libnm: fix memleak in nm_setting_wired_get_s390_option() and refactorThomas Haller2015-02-091-18/+15
| | | | | @keys was leaked. Also refactor the function to iterate the hash only once.
* libnm: fix memleak for config in NMSettingTeamPortThomas Haller2015-02-091-0/+12
|
* libnm: fix memleak for app_fcoe_mode in NMSettingDcbThomas Haller2015-02-091-1/+13
|
* libnm/libnm-util: add Wi-Fi 'powersave' propertyDan Williams2015-01-213-0/+45
|