summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* core: escape percent characters for printf format stringth/printfThomas Haller2014-08-252-4/+11
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: fix NMSettingConnection:verify() not to modify interface-nameThomas Haller2014-08-221-8/+3
| | | | | | | | | | | | | 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>
* keyfile/tests: test reading minimal keyfiles that needs normalization of ↵Thomas Haller2014-08-228-0/+115
| | | | | | type and slave-type Signed-off-by: Thomas Haller <thaller@redhat.com>
* tests: refactor tests to use g_test framework (g_test_add_func)Thomas Haller2014-08-221-45/+40
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile/tests: add keyfile_read_connection_from_file() utility functionThomas Haller2014-08-221-0/+16
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: don't add [connection].type base setting which is done by ↵Thomas Haller2014-08-221-21/+0
| | | | | | | | | nm_connection_normalize() This undoes commit 9f8b7ff51dfd7cdb828fe5e7b50016c5587e8657 but the same functionality is now provided via normalize(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: remove ensure_slave_setting() when reading connectionThomas Haller2014-08-221-31/+4
| | | | | | | | | | nm_connection_normalize() can now add the slave setting as needed. Remove the duplicate functionality. This undoes commit 664d64e0c04bd4b83137a682ff9a9881966f6f94 but the same functionality is now provided via normalize(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: normalize slave-type and slave-settings of connectionsThomas Haller2014-08-221-2/+5
| | | | | | | | | | 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>
* ifcfg-rh: remove verify() connection during readingThomas Haller2014-08-221-34/+0
| | | | | | | | | | | | | 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>
* keyfile: let reader normalize() the connection, not only verify()Thomas Haller2014-08-222-10/+10
| | | | | | | | 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>
* keyfile/tests: refactor tests to use nmtst_assert_connection_equals() functionThomas Haller2014-08-221-14/+8
| | | | | | | Needed in the next commit when we have to normalize the connection before comparing. Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: add NMSettingConnection in reader if missingThomas Haller2014-08-221-30/+32
| | | | | | | | The recent change c88b832ce9510bdcb2df2bf7e02b1ded88154581 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>
* all: use _nm_utils_hash_values_to_slist()Thomas Haller2014-08-224-33/+12
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: declare NM_SETTING_COMPARE_FLAG_INFERRABLE flag in ↵Thomas Haller2014-08-221-1/+1
| | | | | | | | | "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>
* all: add nm-core-internal.h headerThomas Haller2014-08-224-13/+13
| | | | | | | | | | | | | | | | 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>
* platform: (trivial) don't shadow link(3) in NMLinuxPlatformJiří Klimeš2014-08-211-6/+6
| | | | | | Reported by Jordan Messina (cherry picked from commit c54e6a95ff0957fb9d5c51505c8c3dd036600ff5)
* trivial: don't shadown link(3) in NMFakePlatformDan Williams2014-08-201-2/+2
|
* trivial: don't shadow rand(3)Dan Williams2014-08-202-19/+19
| | | | | | Reported by Jordan Messina (cherry picked from commit 365ca198c0d688e759cd2481d9446ba16f8e78ca)
* core: print warning message when skipping invalid device plugin fileThomas Haller2014-08-201-11/+16
| | | | | | https://mail.gnome.org/archives/networkmanager-list/2014-August/msg00042.html Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: clear secrets from NMSimpleConnection and NMSettingsConnection ↵Dan Williams2014-08-204-40/+30
| | | | | | | | | | | | | | | | dispose() A few of the settings plugins were calling nm_connection_clear_secrets() from their finalize() method, but this call can emit signals, and by the time finalize() runs, the object has a refcount of 0. Signals cannot be emitted from a finalized object, but instead could be emitted from dispose() before the object is finalized. Instead of moving the nm_connection_clear_secrets() to dispose() in each plugin, make the behavior generic instead. The settings plugins' parent object is NMSettingsConnection, so clear secrets there. Plus, NMSettingsConnection caches system & agent secrets with NMSimpleConnection objects, so clear secrets in NMSimpleConnection's dispose too.
* supplicant: fix expected return type of AddBlob D-Bus callGeoffrey Thomas2014-08-201-2/+1
| | | | | | | | | | Commit fb6cde50 changed from setBlobs in the old wpa_supplicant D-Bus interface, which returned an integer status code, to AddBlob in the new one, which doesn't, but didn't account for that change. That caused error messages of the form "Couldn't set network certificates: Too few arguments in reply." on valid connection requests. Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
* settings: fix memory leak in get_settings_auth_cb()Thomas Haller2014-08-191-3/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: fix crash in NMSettingAdsl:verify()Thomas Haller2014-08-192-2/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: fix crash due to uninitialized variable when reading invalid connectionThomas Haller2014-08-171-1/+1
| | | | | Fixes: 2bfccab710f694c9f2d54033a305ba64533e3bc5 Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core, libnm, core: make NMConnection an interfaceDan Winship2014-08-1619-134/+144
| | | | | | | | | | | | | | | | | | | | | | The fact that NMRemoteConnection has to be an NMConnection and therefore can't be an NMObject means that it needs to reimplement bits of NMObject functionality (and likewise NMObject needs some special magic to deal with it). Likewise, we will need a daemon-side equivalent of NMObject as part of the gdbus port, and we would want NMSettingsConnection to be able to inherit from this as well. Solve this problem by making NMConnection into an interface, and having NMRemoteConnection and NMSettingsConnection implement it. (We use some hacks to keep the GHashTable of NMSettings objects inside nm-connection.c rather than having to be implemented by the implementations.) Since NMConnection is no longer an instantiable type, this adds NMSimpleConnection to replace the various non-D-Bus-based uses of NMConnection throughout the code. nm_connection_new() becomes nm_simple_connection_new(), nm_connection_new_from_hash() becomes nm_simple_connection_new_from_hash(), and nm_connection_duplicate() becomes nm_simple_connection_new_clone().
* libnm-core: move some fake NMConnection methods over to NMSettingDan Winship2014-08-163-5/+5
| | | | | | | nm_connection_lookup_setting_type() and nm_connection_lookup_setting_type_by_quark() have nothing to do with NMConnection. So move them to NMSetting (and rename them to nm_setting_lookup_type() and nm_setting_lookup_type_by_quark()).
* libnm-core: drop nm_connection_create_setting()Dan Winship2014-08-161-3/+8
| | | | | This was only used in one place, and is trivial to implement inline there.
* all: fix up multiple-include-guard definesDan Winship2014-08-16110-295/+295
| | | | | | | | | | | | | | | | | | | | | | | | Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include guard, which meant that nm-test-utils.h could not tell which of them was being included (and so, eg, if you tried to include nm-ip4-config.h in a libnm test, it would fail to compile because nm-test-utils.h was referring to symbols in src/nm-ip4-config.h). Fix this by changing the include guards in the non-API-stable parts of the tree: - libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H - libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__ - src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__ And likewise for all other headers. The two non-"nm"-prefixed headers, libnm/NetworkManager.h and src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and __NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely consistent with the general scheme, do still mostly make sense in isolation.
* keyfile: allow "," as unmanaged-devices separatorDan Williams2014-08-151-1/+1
| | | | Only using ";" (the GKeyFile default) often confuses people.
* core: fix build with toolchains not exporting CLOCK_BOOTTIMEPeter Korsgaard2014-08-111-0/+9
| | | | | | | | | E.G. uClibc 0.9.33 and earlier. https://bugzilla.gnome.org/show_bug.cgi?id=734599 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* dhcp: fix killing wrong process ID on dhclient releaseDan Williams2014-08-082-9/+14
| | | | | | | | The prototype of dhclient_start() changed in 30cdd1248 but that commit didn't update stop() correctly. Clearly treating a gboolean as pid_t isn't going to work. Second, we don't want to watch the child process on DHCP release because we're just going to kill it shortly after.
* core: fix a warning and a leakDan Winship2014-08-081-1/+2
| | | | | | | | | For devices where we don't set the hardware address at construct time, the first call to nm_device_update_hw_address() was hitting a return-if-fail. Also, when updating the hardware address, we were leaking the old value.
* core: update data types of some hwaddr propertiesDan Winship2014-08-0713-152/+139
| | | | | | | | | | | | | | Now that we have nm_utils_hwaddr_matches() for comparing addresses (even when one is a string and the other binary), there are now places where it's more convenient to store hardware addresses as strings rather than binary, since we want them in string form for most non-comparison purposes. So update for that. In particular, this also changes nm_device_get_hw_address() to return a string. Also, simplify the update_permanent_hw_address() implementations by assuming that they will only be called once. (Since they will.)
* libnm-core, etc: add nm_utils_hwaddr_matches()Dan Winship2014-08-0715-92/+50
| | | | | | | Add nm_utils_hwaddr_matches(), for comparing hardware addresses for equality, allowing either binary or ASCII hardware addresses to be passed, and handling the special rules for InfiniBand hardware addresses automatically. Update code to use it.
* libnm-core: include ETH_ALEN/INFINIBAND_ALEN defines in nm-utils.hDan Winship2014-08-0742-55/+4
| | | | | | | | Include <linux/if_ether.h> and <linux/if_infiniband.h> from nm-utils.h, to get ETH_ALEN and INFINIBAND_ALEN, and remove those includes (as well as <net/ethernet.h> and <netinet/ether.h>, and various headers that had been included to get the ARPHRD_* constants) from other files where they're not needed now.
* all: remove use of struct ether_addr / ether_aton()Dan Winship2014-08-0721-123/+100
| | | | | | | | | | | | | Lots of old code used struct ether_addr to store hardware addresses, and ether_aton() to parse them, but more recent code generally uses guint8 arrays, and the nm_utils_hwaddr_* methods, to be able to share code between ETH_ALEN and INFINIBAND_ALEN cases. So update the old code to match the new. (In many places, this ends up getting rid of casts between struct ether_addr and guint8* anyway.) (Also, in some places, variables were switched from struct ether_addr to guint8[] a while back, but some code still used "&" when referring to them even though that's unnecessary now. Clean that up.)
* libnm-core, etc: drop type-based hwaddr funcs, port to length-based onesDan Winship2014-08-0719-50/+49
| | | | | | | | | | Drop the arptype-based nm_utils_hwaddr funcs, and rename the length-based ones to no longer have _len in their names. This also switches nm_utils_hwaddr_atoba() to using a length rather than an arptype, and adds a length argument to nm_utils_hwaddr_valid() (making nm_utils_hwaddr_valid() now a replacement for nm_utils_hwaddr_aton() in some places, where we were only using aton() to do validity checking).
* logging: use new logging macros in NMDevice subclassesth/bgo734230_device_loggingThomas Haller2014-08-0617-811/+637
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* logging: extract logging macros for devices to nm-device-logging.hThomas Haller2014-08-063-13/+49
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* trivial: fix spacing in src/devices/wifi/nm-wifi-ap.hDan Winship2014-08-051-34/+34
| | | | This file had a bad mix of tabs and spaces. Fix it.
* platform/tests: disable platform root test 'test-link-linux' for nowThomas Haller2014-08-041-1/+1
| | | | | | | | | | This test is quite broken and fails often. It does not fail always, but the changes for a failure are high. We certainly should fix that, but for now exclude the test from `make check`. Signed-off-by: Thomas Haller <thaller@redhat.com>
* supplicant: fix invalid parameter type in AddBlob D-Bus callGeoffrey Thomas2014-08-041-1/+1
| | | | | | | | | Types passed to dbus-glib need to be GTypes, not D-Bus type. While the DBUS_TYPE_G_* macros are GTypes from libdbus-glib, the other DBUS_ types aren't. Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: cleanup getting iface for NMDevice for loggingThomas Haller2014-08-021-20/+3
| | | | | | | Since refactoring logging, these calls are not needed. Just forgot to remove them. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm: add NetworkManager.h, disallow including individual headersDan Winship2014-08-0127-0/+27
| | | | | | | | | | Add NetworkManager.h, which includes all of the other NM header, and require all external users of libnm to use that rather than the individual headers. (An exception is made for nm-dbus-interface.h, nm-vpn-dbus-interface.h, and nm-version.h, which can be included separately.)
* libnm: rename NetworkManager.h and NetworkManagerVPN.hDan Winship2014-08-0137-38/+38
| | | | | | | "NetworkManager.h"'s name (and non-standard capitalization) suggest that it's some sort of high-level super-important header, but it's really just low-level D-Bus stuff. Rename it to "nm-dbus-interface.h" and likewise "NetworkManagerVPN.h" to "nm-vpn-dbus-interface.h"
* libnm-core, etc: move NMSecretAgentCapabilities to NetworkManager.hDan Winship2014-08-011-8/+0
| | | | | | | NMSecretAgentCapabilities was being defined in both libnm/nm-secret-agent.h and in src/settings/nm-secret-agent.h. Since it's part of the D-Bus interface, move it to libnm-core/nm-dbus-interface.h.
* include: drop nm-settings-flags.h, move NMSecretAgentGetSecretsFlagsDan Winship2014-08-0113-43/+39
| | | | | | | | | | | | | | | For some reason, the flags used by o.fd.NM.SecretAgent.GetSecrets were defined as both NMSecretAgentGetSecretsFlags in libnm{,-glib}/nm-secret-agent.h, and then separately as NMSettingsGetSecretsFlags in include/nm-settings-flags.h. (NMSettingsGetSecretsFlags also had an additional internal-use-only value, but that was added later after the duplication already existed.) Fix this by moving NMSecretAgentGetSecretsFlags from libnm to nm-dbus-interface.h, adding the internal-use-only value to it as well, updating the core code to use that, and then removing nm-settings-flags.h.
* libnm: consistently use "INTERFACE" rather than "IFACE" in macrosDan Winship2014-08-012-2/+2
| | | | | | Most D-Bus interface name macros used "INTERFACE" in their name (eg, NM_DBUS_INTERFACE), but a few used "IFACE" instead (eg, NM_DBUS_IFACE_SETTINGS). Make them consistent.
* libnm, core, cli, tui: fix the capitalization of various typesDan Winship2014-08-0133-511/+511
| | | | | | | | | | | | GLib/Gtk have mostly settled on the convention that two-letter acronyms in type names remain all-caps (eg, "IO"), but longer acronyms become initial-caps-only (eg, "Tcp"). NM was inconsistent, with most long acronyms using initial caps only (Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP, PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all three-or-more-letter-long acronyms (and update nmcli and nmtui for the libnm changes).
* libnm: remove all deprecated functions and typesDan Winship2014-08-011-1/+0
| | | | | | | Remove deprecated functions and enum types. For now, deprecated properties are still around, because removing them would cause warnings when talking to older implementations.