From 57cfc6f19da7d3cd290ff39e3403acaae65f0878 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 8 Sep 2018 10:24:20 +0200 Subject: [PATCH 01/63] release: bump version to 1.15.0 (development) --- configure.ac | 4 ++-- libnm-core/nm-version.h | 14 ++++++++++++++ meson.build | 2 +- shared/nm-version-macros.h.in | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 67b1ecd6f4..d53335ac24 100644 --- a/configure.ac +++ b/configure.ac @@ -7,8 +7,8 @@ dnl - add corresponding NM_VERSION_x_y_z macros in dnl "shared/nm-version-macros.h.in" dnl - update number in meson.build m4_define([nm_major_version], [1]) -m4_define([nm_minor_version], [13]) -m4_define([nm_micro_version], [90]) +m4_define([nm_minor_version], [15]) +m4_define([nm_micro_version], [0]) m4_define([nm_version], [nm_major_version.nm_minor_version.nm_micro_version]) diff --git a/libnm-core/nm-version.h b/libnm-core/nm-version.h index 59482d4eeb..7fe2e45b59 100644 --- a/libnm-core/nm-version.h +++ b/libnm-core/nm-version.h @@ -174,4 +174,18 @@ # define NM_AVAILABLE_IN_1_14 #endif +#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_16 +# define NM_DEPRECATED_IN_1_16 G_DEPRECATED +# define NM_DEPRECATED_IN_1_16_FOR(f) G_DEPRECATED_FOR(f) +#else +# define NM_DEPRECATED_IN_1_16 +# define NM_DEPRECATED_IN_1_16_FOR(f) +#endif + +#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_16 +# define NM_AVAILABLE_IN_1_16 G_UNAVAILABLE(1,16) +#else +# define NM_AVAILABLE_IN_1_16 +#endif + #endif /* NM_VERSION_H */ diff --git a/meson.build b/meson.build index 00e958e590..9374136f78 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ project( # - add corresponding NM_VERSION_x_y_z macros in # "shared/nm-version-macros.h.in" # - update number in configure.ac - version: '1.13.90', + version: '1.15.0', license: 'GPL2+', default_options: [ 'buildtype=debugoptimized', diff --git a/shared/nm-version-macros.h.in b/shared/nm-version-macros.h.in index 6f2a186779..22af1428be 100644 --- a/shared/nm-version-macros.h.in +++ b/shared/nm-version-macros.h.in @@ -74,6 +74,7 @@ #define NM_VERSION_1_10 (NM_ENCODE_VERSION (1, 10, 0)) #define NM_VERSION_1_12 (NM_ENCODE_VERSION (1, 12, 0)) #define NM_VERSION_1_14 (NM_ENCODE_VERSION (1, 14, 0)) +#define NM_VERSION_1_16 (NM_ENCODE_VERSION (1, 16, 0)) /* For releases, NM_API_VERSION is equal to NM_VERSION. * From baa0008313e9bdfd469274e91ccf5b13d991884a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 10:21:14 +0200 Subject: [PATCH 02/63] device: make device incompatible with profiles by default Currently, NMDeviceWireguard does neither set connection_type_check_compatible nor implement check_connection_compatible. That means, it appears to be compatible with every connection profile, which is obviously wrong. Allow devices not to implement check_connection_compatible() and avoid the issue by rejecting profiles by default. --- src/devices/nm-device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 515e6334a2..4160b8af2f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -5596,6 +5596,14 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError ** klass->connection_type_check_compatible, error)) return FALSE; + } else if (klass->check_connection_compatible == check_connection_compatible) { + /* the device class does not implement check_connection_compatible nor set + * connection_type_check_compatible. That means, it is by default not compatible + * with any connection type. */ + nm_utils_error_set_literal (error, + NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE, + "device does not support any connections"); + return FALSE; } conn_iface = nm_manager_get_connection_iface (nm_manager_get (), From 3635f462b07cb82b07272deb24aaf9b7c64fd80c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 10:31:10 +0200 Subject: [PATCH 03/63] device: detect loopback device explicitly Don't use NM_UNMANAGED_LOOPBACK for that. --- src/devices/nm-device.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4160b8af2f..fd50a149ed 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -80,6 +80,8 @@ #include "nm-audit-manager.h" #include "nm-connectivity.h" #include "nm-dbus-interface.h" + +#include "nm-device-generic.h" #include "nm-device-vlan.h" #include "nm-device-logging.h" @@ -823,6 +825,13 @@ _ethtool_state_set (NMDevice *self) /*****************************************************************************/ +static gboolean +is_loopback (NMDevice *self) +{ + return NM_IS_DEVICE_GENERIC (self) + && NM_DEVICE_GET_PRIVATE (self)->ifindex == 1; +} + NMSettings * nm_device_get_settings (NMDevice *self) { @@ -2460,7 +2469,7 @@ concheck_is_possible (NMDevice *self) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if ( !nm_device_is_real (self) - || NM_FLAGS_HAS (priv->unmanaged_flags, NM_UNMANAGED_LOOPBACK)) + || is_loopback (self)) return FALSE; /* we enable periodic checks for every device state (except UNKNOWN). Especially with @@ -4292,7 +4301,7 @@ realize_start_setup (NMDevice *self, /* Unmanaged the loopback device with an explicit NM_UNMANAGED_LOOPBACK flag. * Later we might want to manage 'lo' too. Currently that doesn't work because * NetworkManager might down the interface or remove the 127.0.0.1 address. */ - nm_device_set_unmanaged_flags (self, NM_UNMANAGED_LOOPBACK, priv->ifindex == 1); + nm_device_set_unmanaged_flags (self, NM_UNMANAGED_LOOPBACK, is_loopback (self)); nm_device_set_unmanaged_by_user_udev (self); nm_device_set_unmanaged_by_user_conf (self); From 045a36b33bfe8e8758da9cc258083681d598f7bf Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 10:33:23 +0200 Subject: [PATCH 04/63] device: rename NM_UNMANAGED_LOOPBACK to NM_UNMANAGED_BY_TYPE It is generally useful, not only for loopback. Rename. --- src/devices/nm-device.c | 8 ++++---- src/devices/nm-device.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index fd50a149ed..95a2bc5a9e 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4298,10 +4298,10 @@ realize_start_setup (NMDevice *self, NM_UNMANAGED_EXTERNAL_DOWN, is_unmanaged_external_down (self, TRUE)); - /* Unmanaged the loopback device with an explicit NM_UNMANAGED_LOOPBACK flag. + /* Unmanaged the loopback device with an explicit NM_UNMANAGED_BY_TYPE flag. * Later we might want to manage 'lo' too. Currently that doesn't work because * NetworkManager might down the interface or remove the 127.0.0.1 address. */ - nm_device_set_unmanaged_flags (self, NM_UNMANAGED_LOOPBACK, is_loopback (self)); + nm_device_set_unmanaged_flags (self, NM_UNMANAGED_BY_TYPE, is_loopback (self)); nm_device_set_unmanaged_by_user_udev (self); nm_device_set_unmanaged_by_user_conf (self); @@ -4497,7 +4497,7 @@ nm_device_unrealize (NMDevice *self, gboolean remove_resources, GError **error) nm_device_set_unmanaged_flags (self, NM_UNMANAGED_PARENT | - NM_UNMANAGED_LOOPBACK | + NM_UNMANAGED_BY_TYPE | NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_USER_EXPLICIT | NM_UNMANAGED_EXTERNAL_DOWN | @@ -12876,7 +12876,7 @@ NM_UTILS_FLAGS2STR_DEFINE (nm_unmanaged_flags2str, NMUnmanagedFlags, NM_UTILS_FLAGS2STR (NM_UNMANAGED_SLEEPING, "sleeping"), NM_UTILS_FLAGS2STR (NM_UNMANAGED_QUITTING, "quitting"), NM_UTILS_FLAGS2STR (NM_UNMANAGED_PARENT, "parent"), - NM_UTILS_FLAGS2STR (NM_UNMANAGED_LOOPBACK, "loopback"), + NM_UTILS_FLAGS2STR (NM_UNMANAGED_BY_TYPE, "by-type"), NM_UTILS_FLAGS2STR (NM_UNMANAGED_PLATFORM_INIT, "platform-init"), NM_UTILS_FLAGS2STR (NM_UNMANAGED_USER_EXPLICIT, "user-explicit"), NM_UTILS_FLAGS2STR (NM_UNMANAGED_BY_DEFAULT, "by-default"), diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 7d74e5b91d..6342a657b4 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -583,7 +583,7 @@ void nm_device_copy_ip6_dns_config (NMDevice *self, NMDevice *from_device); * @NM_UNMANAGED_SLEEPING: %TRUE when unmanaged because NM is sleeping. * @NM_UNMANAGED_QUITTING: %TRUE when unmanaged because NM is shutting down. * @NM_UNMANAGED_PARENT: %TRUE when unmanaged due to parent device being unmanaged - * @NM_UNMANAGED_LOOPBACK: %TRUE for unmanaging loopback device + * @NM_UNMANAGED_BY_TYPE: %TRUE for unmanaging device by type, like loopback. * @NM_UNMANAGED_PLATFORM_INIT: %TRUE when unmanaged because platform link not * yet initialized. Unrealized device are also unmanaged for this reason. * @NM_UNMANAGED_USER_EXPLICIT: %TRUE when unmanaged by explicit user decision @@ -614,7 +614,7 @@ typedef enum { /*< skip >*/ NM_UNMANAGED_SLEEPING = (1LL << 0), NM_UNMANAGED_QUITTING = (1LL << 1), NM_UNMANAGED_PARENT = (1LL << 2), - NM_UNMANAGED_LOOPBACK = (1LL << 3), + NM_UNMANAGED_BY_TYPE = (1LL << 3), NM_UNMANAGED_PLATFORM_INIT = (1LL << 4), NM_UNMANAGED_USER_EXPLICIT = (1LL << 5), NM_UNMANAGED_USER_SETTINGS = (1LL << 6), From e3bd482329344b1d7f31b29fea2814ba5ce97d79 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 10:36:49 +0200 Subject: [PATCH 05/63] device: mark wireguard devices as unmanaged Later we want to fully support wireguard devices. Also, possibly activating a generic profile in a wireguard device would make sense. Anyway, for the moment, just prevent that from happening by explicitly marking the device as unmanaged. --- src/devices/nm-device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 95a2bc5a9e..c5f30ea28a 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -83,6 +83,7 @@ #include "nm-device-generic.h" #include "nm-device-vlan.h" +#include "nm-device-wireguard.h" #include "nm-device-logging.h" _LOG_DECLARE_SELF (NMDevice); @@ -4301,7 +4302,10 @@ realize_start_setup (NMDevice *self, /* Unmanaged the loopback device with an explicit NM_UNMANAGED_BY_TYPE flag. * Later we might want to manage 'lo' too. Currently that doesn't work because * NetworkManager might down the interface or remove the 127.0.0.1 address. */ - nm_device_set_unmanaged_flags (self, NM_UNMANAGED_BY_TYPE, is_loopback (self)); + nm_device_set_unmanaged_flags (self, + NM_UNMANAGED_BY_TYPE, + is_loopback (self) + || NM_IS_DEVICE_WIREGUARD (self)); nm_device_set_unmanaged_by_user_udev (self); nm_device_set_unmanaged_by_user_conf (self); From c87faf07a10900804b914057a2673e0e070b0af4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 14:31:23 +0200 Subject: [PATCH 06/63] dhcp: fix leak in dhclient's dhclient_start() Fixes: 5d6d5cd136e36ed2815b7c719ada32bc6d22b481 --- src/dhcp/nm-dhcp-dhclient.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index 8408e3f902..d384da8a4f 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -374,11 +374,15 @@ dhclient_start (NMDhcpClient *client, if (g_file_copy (src, dst, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) { /* Success; use the preferred leasefile path */ g_free (priv->lease_file); - priv->lease_file = g_strdup (g_file_get_path (dst)); + priv->lease_file = g_file_get_path (dst); } else { + gs_free char *s_path = NULL; + gs_free char *d_path = NULL; + /* Failure; just use the existing leasefile */ _LOGW ("failed to copy leasefile %s to %s: %s", - g_file_get_path (src), g_file_get_path (dst), + (s_path = g_file_get_path (src)), + (d_path = g_file_get_path (dst)), error->message); g_clear_error (&error); } From 32506c8788c4481f7b33448c3e31661d4b50ab1a Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sat, 8 Sep 2018 04:03:47 +0200 Subject: [PATCH 07/63] wifi/iwd: handle new GetOrderedNetworks() return type The Station.GetOrderedNetworks dbus method's return type has changed in IWD commit 0a42f63d42be903a46c595693884772c1c84d39f as the last incompatible API change before IWD 0.8 (docs change was made earlier in 0453308134a3aadb6a2ec6a78ea642e19427704c) so that network names and types are no longer included in the reply. Expect this new reply signature although still handle the old signature if we're using the Device interface for IWD <= 0.7 compatibility. It may be good idea to eventually pass the object manager instance from nm-iwd-manager.c to nm-device-iwd.c to avoid using g_dbus_proxy_new_sync and g_dbus_proxy_new_for_bus_sync in act_stage2_config, which possibly generates a lot of DBus property queries. https://github.com/NetworkManager/NetworkManager/pull/197 --- src/devices/wifi/nm-device-iwd.c | 148 ++++++++++++++++++++----------- 1 file changed, 94 insertions(+), 54 deletions(-) diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index 56b1f85311..32d4991679 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -228,6 +228,85 @@ vardict_from_network_type (const char *type) return g_variant_new ("a{sv}", &builder); } +static void +insert_ap_from_network (GHashTable *aps, GDBusProxy *proxy, const char *path, int16_t signal, uint32_t ap_id) +{ + gs_unref_object GDBusProxy *network_proxy = NULL; + gs_unref_variant GVariant *name_value = NULL, *type_value = NULL; + const char *name, *type; + GVariantBuilder builder; + gs_unref_variant GVariant *props = NULL; + GVariant *rsn; + uint8_t bssid[6]; + NMWifiAP *ap; + GError *error; + + network_proxy = g_dbus_proxy_new_sync (g_dbus_proxy_get_connection (proxy), + G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, + NULL, + NM_IWD_SERVICE, + path, + NM_IWD_NETWORK_INTERFACE, + NULL, &error); + if (!network_proxy) { + g_clear_error (&error); + return; + } + + name_value = g_dbus_proxy_get_cached_property (network_proxy, "Name"); + type_value = g_dbus_proxy_get_cached_property (network_proxy, "Type"); + if ( !name_value + || !g_variant_is_of_type (name_value, G_VARIANT_TYPE_STRING) + || !type_value + || !g_variant_is_of_type (type_value, G_VARIANT_TYPE_STRING)) + return; + + name = g_variant_get_string (name_value, NULL); + type = g_variant_get_string (type_value, NULL); + + /* What we get from IWD are networks, or ESSs, that may contain + * multiple APs, or BSSs, each. We don't get information about any + * specific BSSs within an ESS but we can safely present each ESS + * as an individual BSS to NM, which will be seen as ESSs comprising + * a single BSS each. NM won't be able to handle roaming but IWD + * already does that. We fake the BSSIDs as they don't play any + * role either. + */ + bssid[0] = 0x00; + bssid[1] = 0x01; + bssid[2] = 0x02; + bssid[3] = ap_id >> 16; + bssid[4] = ap_id >> 8; + bssid[5] = ap_id; + + /* WEP not supported */ + if (nm_streq (type, "wep")) + return; + + g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); + g_variant_builder_add (&builder, "{sv}", "BSSID", + g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, bssid, 6, 1)); + g_variant_builder_add (&builder, "{sv}", "Mode", + g_variant_new_string ("infrastructure")); + + rsn = vardict_from_network_type (type); + if (rsn) + g_variant_builder_add (&builder, "{sv}", "RSN", rsn); + + props = g_variant_new ("a{sv}", &builder); + + ap = nm_wifi_ap_new_from_properties (path, props); + + nm_wifi_ap_set_ssid_arr (ap, + (const guint8 *) name, + NM_MIN (32, strlen (name))); + + nm_wifi_ap_set_strength (ap, nm_wifi_utils_level_to_quality (signal / 100)); + nm_wifi_ap_set_freq (ap, 2417); + nm_wifi_ap_set_max_bitrate (ap, 65000); + g_hash_table_insert (aps, (gpointer) nm_wifi_ap_get_supplicant_path (ap), ap); +} + static void get_ordered_networks_cb (GObject *source, GAsyncResult *res, gpointer user_data) { @@ -242,9 +321,16 @@ get_ordered_networks_cb (GObject *source, GAsyncResult *res, gpointer user_data) gboolean changed = FALSE; GHashTableIter ap_iter; gs_unref_hashtable GHashTable *new_aps = NULL; + /* Depending on whether we're using the Station interface or the Device + * interface for compatibility with IWD <= 0.7, the return signature of + * GetOrderedNetworks will be different. + */ + gboolean compat = priv->dbus_station_proxy == priv->dbus_device_proxy; + const char *return_sig = compat ? "(a(osns))" : "(a(on))"; + static uint32_t ap_id = 0; variant = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (source), res, - G_VARIANT_TYPE ("(a(osns))"), + G_VARIANT_TYPE (return_sig), &error); if (!variant) { _LOGE (LOGD_WIFI, "Station.GetOrderedNetworks failed: %s", @@ -254,60 +340,14 @@ get_ordered_networks_cb (GObject *source, GAsyncResult *res, gpointer user_data) new_aps = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref); - g_variant_get (variant, "(a(osns))", &networks); + g_variant_get (variant, return_sig, &networks); - while (g_variant_iter_next (networks, "(&o&sn&s)", &path, &name, &signal, &type)) { - GVariantBuilder builder; - gs_unref_variant GVariant *props = NULL; - GVariant *rsn; - static uint32_t ap_id = 0; - uint8_t bssid[6]; - - /* - * What we get from IWD are networks, or ESSs, that may - * contain multiple APs, or BSSs, each. We don't get - * information about any specific BSSs within an ESS but - * we can safely present each ESS as an individual BSS to - * NM, which will be seen as ESSs comprising a single BSS - * each. NM won't be able to handle roaming but IWD already - * does that. We fake the BSSIDs as they don't play any - * role either. - */ - bssid[0] = 0x00; - bssid[1] = 0x01; - bssid[2] = 0x02; - bssid[3] = ap_id >> 16; - bssid[4] = ap_id >> 8; - bssid[5] = ap_id++; - - /* WEP not supported */ - if (!strcmp (type, "wep")) - continue; - - g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); - g_variant_builder_add (&builder, "{sv}", "BSSID", - g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, bssid, 6, 1)); - g_variant_builder_add (&builder, "{sv}", "Mode", - g_variant_new_string ("infrastructure")); - - rsn = vardict_from_network_type (type); - if (rsn) - g_variant_builder_add (&builder, "{sv}", "RSN", rsn); - - props = g_variant_new ("a{sv}", &builder); - - ap = nm_wifi_ap_new_from_properties (path, props); - - nm_wifi_ap_set_ssid_arr (ap, - (const guint8 *) name, - NM_MIN (32, strlen (name))); - - nm_wifi_ap_set_strength (ap, nm_wifi_utils_level_to_quality (signal / 100)); - nm_wifi_ap_set_freq (ap, 2417); - nm_wifi_ap_set_max_bitrate (ap, 65000); - g_hash_table_insert (new_aps, - (gpointer) nm_wifi_ap_get_supplicant_path (ap), - ap); + if (compat) { + while (g_variant_iter_next (networks, "(&o&sn&s)", &path, &name, &signal, &type)) + insert_ap_from_network (new_aps, priv->dbus_station_proxy, path, signal, ap_id++); + } else { + while (g_variant_iter_next (networks, "(&on)", &path, &signal)) + insert_ap_from_network (new_aps, priv->dbus_station_proxy, path, signal, ap_id++); } g_variant_iter_free (networks); From e66e4d0e718b0f9102160e98fb6a1bf059677d71 Mon Sep 17 00:00:00 2001 From: Frederic Danis Date: Tue, 11 Sep 2018 18:56:49 +0200 Subject: [PATCH 08/63] ppp-manager: fix pppd not exiting correctly on modem hangup When unplugging an USB 3G modem device, pppd does not exit correctly and we have the following traces: Sep 10 07:58:24.616465 ModemManager[1158]: (tty/ttyUSB0): released by device '/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb4/4-1' Sep 10 07:58:24.620314 pppd[2292]: Modem hangup Sep 10 07:58:24.621368 ModemManager[1158]: (tty/ttyUSB1): released by device '/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb4/4-1' Sep 10 07:58:24.621835 ModemManager[1158]: (ttyUSB1): could not re-acquire serial port lock: (5) Input/output error Sep 10 07:58:24.621358 NetworkManager[1871]: ppp-manager: set-ifindex 4 Sep 10 07:58:24.621369 NetworkManager[1871]: ppp-manager: can't change the ifindex from 4 to 4 Sep 10 07:58:24.623982 NetworkManager[1871]: device (ttyUSB0): state change: activated -> unmanaged (reason 'removed', sys-iface-state: 'removed') Sep 10 07:58:24.624411 NetworkManager[1871]: kill child process 'pppd' (2292): wait for process to terminate after sending SIGTERM (15) (send SIGKILL in 1500 milliseconds)... Sep 10 07:58:24.624440 NetworkManager[1871]: modem-broadband[ttyUSB0]: notifying ModemManager about the modem disconnection Sep 10 07:58:24.626591 NetworkManager[1871]: modem-broadband[ttyUSB0]: notifying ModemManager about the modem disconnection Sep 10 07:58:24.681016 NetworkManager[1871]: modem-broadband[ttyUSB0]: failed to disconnect modem: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.ModemManager1.Modem.Simple' on object at path /org/freedesktop/ModemManager1/Modem/0 Sep 10 07:58:26.126817 NetworkManager[1871]: kill child process 'pppd' (2292): process not terminated after 1502368 usec. Sending SIGKILL signal Sep 10 07:58:26.128121 NetworkManager[1871]: device (ppp0): state change: disconnected -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed') Sep 10 07:58:26.135571 NetworkManager[1871]: kill child process 'pppd' (2292): terminated by signal 9 (1511158 usec elapsed) This is due to nm-ppp-plugin waiting on SetIfIndex call until timeout, which is longer than termination process timeout. Calling g_dbus_method_invocation_return_value() on error fixes this. Fixes: dd98ada33f33820e0d0874d9aa97e0c2bfc7cdd0 https://mail.gnome.org/archives/networkmanager-list/2018-September/msg00010.html --- src/ppp/nm-ppp-manager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c index fdec4763dc..b1dfe665ba 100644 --- a/src/ppp/nm-ppp-manager.c +++ b/src/ppp/nm-ppp-manager.c @@ -442,7 +442,7 @@ impl_ppp_manager_set_ifindex (NMDBusObject *obj, if (priv->ifindex >= 0) { _LOGW ("can't change the ifindex from %d to %d", priv->ifindex, (int) ifindex); - return; + goto out; } if (ifindex > 0) { @@ -463,6 +463,8 @@ impl_ppp_manager_set_ifindex (NMDBusObject *obj, obj_keep_alive = nmp_object_ref (NMP_OBJECT_UP_CAST (plink)); g_signal_emit (self, signals[IFINDEX_SET], 0, ifindex, plink->name); + +out: g_dbus_method_invocation_return_value (invocation, NULL); } From 30a469e0bba5ac052bc29914783e62ed24b2bd67 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 11 Sep 2018 21:23:42 +0200 Subject: [PATCH 09/63] ppp-manager: avoid crash with nonexisting link in impl_ppp_manager_set_ifindex() Fixes: dd98ada33f33820e0d0874d9aa97e0c2bfc7cdd0 --- src/ppp/nm-ppp-manager.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c index b1dfe665ba..fe2adf578e 100644 --- a/src/ppp/nm-ppp-manager.c +++ b/src/ppp/nm-ppp-manager.c @@ -462,7 +462,11 @@ impl_ppp_manager_set_ifindex (NMDBusObject *obj, obj_keep_alive = nmp_object_ref (NMP_OBJECT_UP_CAST (plink)); - g_signal_emit (self, signals[IFINDEX_SET], 0, ifindex, plink->name); + g_signal_emit (self, + signals[IFINDEX_SET], + 0, + ifindex, + plink ? plink->name : NULL); out: g_dbus_method_invocation_return_value (invocation, NULL); From 4d11eba8c59b6dc00a0cc4b644104b19873699c9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 11 Sep 2018 21:53:04 +0200 Subject: [PATCH 10/63] ppp: avoid strncpy() in ppp plugin nm_phasechange() strncpy() is deemed insecure, and it raises at least an eyebrow. While it's save in this case, just avoid it. --- src/ppp/nm-pppd-plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ppp/nm-pppd-plugin.c b/src/ppp/nm-pppd-plugin.c index 989f74339d..0919634006 100644 --- a/src/ppp/nm-pppd-plugin.c +++ b/src/ppp/nm-pppd-plugin.c @@ -147,7 +147,7 @@ nm_phasechange (void *data, int arg) if ( if_indextoname (index, new_name) && !nm_streq0 (ifname, new_name)) { g_message ("nm-ppp-plugin: interface name changed from '%s' to '%s'", ifname, new_name); - strncpy (ifname, new_name, IF_NAMESIZE); + g_strlcpy (ifname, new_name, IF_NAMESIZE); } } } From 4a4439835dde96fc81f9e09889d8f82436b0331a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 11 Sep 2018 21:54:48 +0200 Subject: [PATCH 11/63] ppp: downgrade warning about repeated SetIfindex calls from ppp plugin In src/ppp/nm-pppd-plugin.c, it seems that pppd can invoke phasechange(PHASE_RUNNING:) multiple times. Hence, the plugin calls SetIfindex multiple times too. In nm-ppp-manager.c, we want to make sure that the ifindex does not change after it was set once. However, calling SetIfindex with the same ifindex is not something worth warning. Just log a debug message and nothing. Maybe the plugin should remember that it already set the ifindex, and avoid multiple D-Bus calls. But it's unclear that that is desired. For now, just downgrade the warning. --- src/ppp/nm-ppp-manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c index fe2adf578e..e168613947 100644 --- a/src/ppp/nm-ppp-manager.c +++ b/src/ppp/nm-ppp-manager.c @@ -441,7 +441,10 @@ impl_ppp_manager_set_ifindex (NMDBusObject *obj, _LOGD ("set-ifindex %d", (int) ifindex); if (priv->ifindex >= 0) { - _LOGW ("can't change the ifindex from %d to %d", priv->ifindex, (int) ifindex); + if (priv->ifindex == ifindex) + _LOGD ("ignore repeated calls setting ifindex to %d", (int) ifindex); + else + _LOGW ("can't change the ifindex from %d to %d", priv->ifindex, (int) ifindex); goto out; } From 2a45c32e8c5b25889dc10a8b954f79a3539d39b7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 11 Sep 2018 22:03:11 +0200 Subject: [PATCH 12/63] ppp: cleanup logging in impl_ppp_manager_set_ifindex() It's enough that all code paths in impl_ppp_manager_set_ifindex() log exactly one message. Also, give all messages the same prefix, so that it's clear where they come from. --- src/ppp/nm-ppp-manager.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c index e168613947..b231ff2059 100644 --- a/src/ppp/nm-ppp-manager.c +++ b/src/ppp/nm-ppp-manager.c @@ -438,13 +438,11 @@ impl_ppp_manager_set_ifindex (NMDBusObject *obj, g_variant_get (parameters, "(i)", &ifindex); - _LOGD ("set-ifindex %d", (int) ifindex); - if (priv->ifindex >= 0) { if (priv->ifindex == ifindex) - _LOGD ("ignore repeated calls setting ifindex to %d", (int) ifindex); + _LOGD ("set-ifindex: ignore repeated calls setting ifindex to %d", (int) ifindex); else - _LOGW ("can't change the ifindex from %d to %d", priv->ifindex, (int) ifindex); + _LOGW ("set-ifindex: can't change the ifindex from %d to %d", priv->ifindex, (int) ifindex); goto out; } @@ -457,14 +455,15 @@ impl_ppp_manager_set_ifindex (NMDBusObject *obj, } if (!plink) { - _LOGW ("unknown interface with ifindex %d", ifindex); + _LOGW ("set-ifindex: unknown interface with ifindex %d", ifindex); ifindex = 0; + } else { + obj_keep_alive = nmp_object_ref (NMP_OBJECT_UP_CAST (plink)); + _LOGD ("set-ifindex: %d, name \"%s\"", (int) ifindex, plink->name); } priv->ifindex = ifindex; - obj_keep_alive = nmp_object_ref (NMP_OBJECT_UP_CAST (plink)); - g_signal_emit (self, signals[IFINDEX_SET], 0, From 4186ddb58bb0b1de30e6e4f7433718d74ca7af4c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 14:54:13 +0200 Subject: [PATCH 13/63] shared: add nm_errno() and nm_utils_error_set_errno() helper --- shared/nm-utils/nm-shared-utils.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h index b3099738f3..5125bd3d85 100644 --- a/shared/nm-utils/nm-shared-utils.h +++ b/shared/nm-utils/nm-shared-utils.h @@ -480,6 +480,19 @@ _nm_g_slice_free_fcn_define (16) /*****************************************************************************/ +static inline int +nm_errno (int errsv) +{ + /* several API returns negative errno values as errors. Normalize + * negative values to positive values. + * + * As a special case, map G_MININT to G_MAXINT. If you care about the + * distinction, then check for G_MININT before. */ + return errsv >= 0 + ? errsv + : ((errsv == G_MININT) ? G_MAXINT : -errsv); +} + /** * NMUtilsError: * @NM_UTILS_ERROR_UNKNOWN: unknown or unclassified error @@ -542,6 +555,14 @@ nm_utils_error_set_literal (GError **error, int error_code, const char *literal) #define nm_utils_error_set(error, error_code, ...) \ g_set_error ((error), NM_UTILS_ERROR, error_code, __VA_ARGS__) +#define nm_utils_error_set_errno(error, errsv, fmt, ...) \ + g_set_error ((error), \ + NM_UTILS_ERROR, \ + NM_UTILS_ERROR_UNKNOWN, \ + fmt, \ + ##__VA_ARGS__, \ + g_strerror (nm_errno (errsv))) + /*****************************************************************************/ gboolean nm_g_object_set_property (GObject *object, From 1a4fe308e85f0980bc9acf75047659a0e4571d2c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 12:22:20 +0200 Subject: [PATCH 14/63] dhcp: return error reason from DHCP client start --- src/devices/nm-device.c | 40 +++++--- src/dhcp/nm-dhcp-client.c | 14 ++- src/dhcp/nm-dhcp-client.h | 14 +-- src/dhcp/nm-dhcp-dhclient.c | 175 +++++++++++++++++++++-------------- src/dhcp/nm-dhcp-dhcpcanon.c | 90 ++++++++++-------- src/dhcp/nm-dhcp-dhcpcd.c | 62 +++++++------ src/dhcp/nm-dhcp-manager.c | 42 ++++++--- src/dhcp/nm-dhcp-manager.h | 6 +- src/dhcp/nm-dhcp-systemd.c | 79 ++++++++-------- src/nm-iface-helper.c | 9 +- 10 files changed, 318 insertions(+), 213 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index c5f30ea28a..8ca899a28e 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -7561,6 +7561,7 @@ dhcp4_start (NMDevice *self) gs_unref_bytes GBytes *hwaddr = NULL; gs_unref_bytes GBytes *client_id = NULL; NMConnection *connection; + GError *error = NULL; connection = nm_device_get_applied_connection (self); g_return_val_if_fail (connection, FALSE); @@ -7591,10 +7592,14 @@ dhcp4_start (NMDevice *self) client_id, get_dhcp_timeout (self, AF_INET), priv->dhcp_anycast_address, - NULL); + NULL, + &error); - if (!priv->dhcp4.client) + if (!priv->dhcp4.client) { + _LOGW (LOGD_DHCP4, "failure to start DHCP: %s", error->message); + g_clear_error (&error); return NM_ACT_STAGE_RETURN_FAILURE; + } priv->dhcp4.state_sigid = g_signal_connect (priv->dhcp4.client, NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, @@ -8396,6 +8401,7 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection) gs_unref_bytes GBytes *hwaddr = NULL; gs_unref_bytes GBytes *duid = NULL; gboolean enforce_duid = FALSE; + GError *error = NULL; const NMPlatformIP6Address *ll_addr = NULL; @@ -8435,23 +8441,29 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection) priv->dhcp_anycast_address, (priv->dhcp6.mode == NM_NDISC_DHCP_LEVEL_OTHERCONF) ? TRUE : FALSE, nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6)), - priv->dhcp6.needed_prefixes); - - if (priv->dhcp6.client) { - priv->dhcp6.state_sigid = g_signal_connect (priv->dhcp6.client, - NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, - G_CALLBACK (dhcp6_state_changed), - self); - priv->dhcp6.prefix_sigid = g_signal_connect (priv->dhcp6.client, - NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED, - G_CALLBACK (dhcp6_prefix_delegated), - self); + priv->dhcp6.needed_prefixes, + &error); + if (!priv->dhcp6.client) { + _LOGW (LOGD_DHCP6, "failure to start DHCPv6: %s", error->message); + g_clear_error (&error); + if (nm_device_sys_iface_state_is_external_or_assume (self)) + priv->dhcp6.was_active = TRUE; + return FALSE; } + priv->dhcp6.state_sigid = g_signal_connect (priv->dhcp6.client, + NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, + G_CALLBACK (dhcp6_state_changed), + self); + priv->dhcp6.prefix_sigid = g_signal_connect (priv->dhcp6.client, + NM_DHCP_CLIENT_SIGNAL_PREFIX_DELEGATED, + G_CALLBACK (dhcp6_prefix_delegated), + self); + if (nm_device_sys_iface_state_is_external_or_assume (self)) priv->dhcp6.was_active = TRUE; - return !!priv->dhcp6.client; + return TRUE; } static gboolean diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index 9fc7d2c1cd..16db830681 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -510,7 +510,8 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self, GBytes *client_id, const char *dhcp_anycast_addr, const char *hostname, - const char *last_ip4_address) + const char *last_ip4_address, + GError **error) { NMDhcpClientPrivate *priv; @@ -531,7 +532,10 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self, g_clear_pointer (&priv->hostname, g_free); priv->hostname = g_strdup (hostname); - return NM_DHCP_CLIENT_GET_CLASS (self)->ip4_start (self, dhcp_anycast_addr, last_ip4_address); + return NM_DHCP_CLIENT_GET_CLASS (self)->ip4_start (self, + dhcp_anycast_addr, + last_ip4_address, + error); } static GBytes * @@ -548,7 +552,8 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self, const struct in6_addr *ll_addr, const char *hostname, NMSettingIP6ConfigPrivacy privacy, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { NMDhcpClientPrivate *priv; gs_free char *str = NULL; @@ -584,7 +589,8 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self, ll_addr, privacy, priv->duid, - needed_prefixes); + needed_prefixes, + error); } void diff --git a/src/dhcp/nm-dhcp-client.h b/src/dhcp/nm-dhcp-client.h index b50ea515b9..86d60e3874 100644 --- a/src/dhcp/nm-dhcp-client.h +++ b/src/dhcp/nm-dhcp-client.h @@ -76,18 +76,18 @@ typedef enum { typedef struct { GObjectClass parent; - /* Methods */ - gboolean (*ip4_start) (NMDhcpClient *self, const char *anycast_addr, - const char *last_ip4_address); + const char *last_ip4_address, + GError **error); gboolean (*ip6_start) (NMDhcpClient *self, const char *anycast_addr, const struct in6_addr *ll_addr, NMSettingIP6ConfigPrivacy privacy, GBytes *duid, - guint needed_prefixes); + guint needed_prefixes, + GError **error); void (*stop) (NMDhcpClient *self, gboolean release, @@ -151,7 +151,8 @@ gboolean nm_dhcp_client_start_ip4 (NMDhcpClient *self, GBytes *client_id, const char *dhcp_anycast_addr, const char *hostname, - const char *last_ip4_address); + const char *last_ip4_address, + GError **error); gboolean nm_dhcp_client_start_ip6 (NMDhcpClient *self, GBytes *client_id, @@ -160,7 +161,8 @@ gboolean nm_dhcp_client_start_ip6 (NMDhcpClient *self, const struct in6_addr *ll_addr, const char *hostname, NMSettingIP6ConfigPrivacy privacy, - guint needed_prefixes); + guint needed_prefixes, + GError **error); void nm_dhcp_client_stop (NMDhcpClient *self, gboolean release); diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index d384da8a4f..46d2339bf2 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -174,13 +174,14 @@ merge_dhclient_config (NMDhcpDhclient *self, GBytes **out_new_client_id, GError **error) { - char *orig = NULL, *new; - gboolean success = FALSE; + gs_free char *orig = NULL; + gs_free char *new = NULL; - g_return_val_if_fail (iface != NULL, FALSE); - g_return_val_if_fail (conf_file != NULL, FALSE); + g_return_val_if_fail (iface, FALSE); + g_return_val_if_fail (conf_file, FALSE); - if (orig_path && g_file_test (orig_path, G_FILE_TEST_EXISTS)) { + if ( orig_path + && g_file_test (orig_path, G_FILE_TEST_EXISTS)) { GError *read_error = NULL; if (!g_file_get_contents (orig_path, &orig, NULL, &read_error)) { @@ -190,14 +191,22 @@ merge_dhclient_config (NMDhcpDhclient *self, } } - new = nm_dhcp_dhclient_create_config (iface, addr_family, client_id, anycast_addr, hostname, timeout, - use_fqdn, orig_path, orig, out_new_client_id); + new = nm_dhcp_dhclient_create_config (iface, + addr_family, + client_id, + anycast_addr, + hostname, + timeout, + use_fqdn, + orig_path, + orig, + out_new_client_id); g_assert (new); - success = g_file_set_contents (conf_file, new, -1, error); - g_free (new); - g_free (orig); - return success; + return g_file_set_contents (conf_file, + new, + -1, + error); } static char * @@ -282,13 +291,14 @@ create_dhclient_config (NMDhcpDhclient *self, gboolean use_fqdn, GBytes **out_new_client_id) { - char *orig = NULL, *new = NULL; + gs_free char *orig = NULL; + char *new = NULL; GError *error = NULL; - gboolean success = FALSE; g_return_val_if_fail (iface != NULL, NULL); new = g_strdup_printf (NMSTATEDIR "/dhclient%s-%s.conf", _addr_family_to_path_part (addr_family), iface); + _LOGD ("creating composite dhclient config %s", new); orig = find_existing_config (self, addr_family, iface, uuid); @@ -297,15 +307,12 @@ create_dhclient_config (NMDhcpDhclient *self, else _LOGD ("no existing dhclient configuration to merge"); - error = NULL; - success = merge_dhclient_config (self, addr_family, iface, new, client_id, dhcp_anycast_addr, - hostname, timeout, use_fqdn, orig, out_new_client_id, &error); - if (!success) { + if (!merge_dhclient_config (self, addr_family, iface, new, client_id, dhcp_anycast_addr, + hostname, timeout, use_fqdn, orig, out_new_client_id, &error)) { _LOGW ("error creating dhclient configuration: %s", error->message); - g_error_free (error); + g_clear_error (&error); } - g_free (orig); return new; } @@ -315,13 +322,14 @@ dhclient_start (NMDhcpClient *client, GBytes *duid, gboolean release, pid_t *out_pid, - int prefixes) + int prefixes, + GError **error) { NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client); NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self); gs_unref_ptrarray GPtrArray *argv = NULL; pid_t pid; - GError *error = NULL; + gs_free_error GError *local = NULL; const char *iface; const char *uuid; const char *system_bus_address; @@ -339,7 +347,7 @@ dhclient_start (NMDhcpClient *client, dhclient_path = nm_dhcp_dhclient_get_path (); if (!dhclient_path) { - _LOGW ("dhclient could not be found"); + nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhclient binary not found"); return FALSE; } @@ -371,11 +379,7 @@ dhclient_start (NMDhcpClient *client, gs_unref_object GFile *dst = g_file_new_for_path (preferred_leasefile_path); /* Try to copy the existing leasefile to the preferred location */ - if (g_file_copy (src, dst, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) { - /* Success; use the preferred leasefile path */ - g_free (priv->lease_file); - priv->lease_file = g_file_get_path (dst); - } else { + if (!g_file_copy (src, dst, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &local)) { gs_free char *s_path = NULL; gs_free char *d_path = NULL; @@ -383,8 +387,12 @@ dhclient_start (NMDhcpClient *client, _LOGW ("failed to copy leasefile %s to %s: %s", (s_path = g_file_get_path (src)), (d_path = g_file_get_path (dst)), - error->message); - g_clear_error (&error); + local->message); + g_clear_error (&local); + } else { + /* Success; use the preferred leasefile path */ + g_free (priv->lease_file); + priv->lease_file = g_file_get_path (dst); } } @@ -393,9 +401,12 @@ dhclient_start (NMDhcpClient *client, gs_free char *escaped = NULL; escaped = nm_dhcp_dhclient_escape_duid (duid); - if (!nm_dhcp_dhclient_save_duid (priv->lease_file, escaped, &error)) { - _LOGW ("failed to save DUID to %s: %s", priv->lease_file, error->message); - g_clear_error (&error); + if (!nm_dhcp_dhclient_save_duid (priv->lease_file, escaped, &local)) { + nm_utils_error_set (error, + NM_UTILS_ERROR_UNKNOWN, + "failed to save DUID to '%s': %s", + priv->lease_file, + local->message); return FALSE; } } @@ -455,9 +466,11 @@ dhclient_start (NMDhcpClient *client, if (!g_spawn_async (NULL, (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, - nm_utils_setpgid, NULL, &pid, &error)) { - _LOGW ("dhclient failed to start: '%s'", error->message); - g_error_free (error); + nm_utils_setpgid, NULL, &pid, &local)) { + nm_utils_error_set (error, + NM_UTILS_ERROR_UNKNOWN, + "dhclient failed to start: %s", + local->message); return FALSE; } @@ -473,36 +486,46 @@ dhclient_start (NMDhcpClient *client, } static gboolean -ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address) +ip4_start (NMDhcpClient *client, + const char *dhcp_anycast_addr, + const char *last_ip4_address, + GError **error) { NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client); NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self); GBytes *client_id; gs_unref_bytes GBytes *new_client_id = NULL; - const char *iface, *uuid, *hostname; - guint32 timeout; - gboolean success = FALSE; - gboolean use_fqdn; - iface = nm_dhcp_client_get_iface (client); - uuid = nm_dhcp_client_get_uuid (client); client_id = nm_dhcp_client_get_client_id (client); - hostname = nm_dhcp_client_get_hostname (client); - timeout = nm_dhcp_client_get_timeout (client); - use_fqdn = nm_dhcp_client_get_use_fqdn (client); - priv->conf_file = create_dhclient_config (self, AF_INET, iface, uuid, client_id, dhcp_anycast_addr, - hostname, timeout, use_fqdn, &new_client_id); - if (priv->conf_file) { - if (new_client_id) { - nm_assert (!client_id); - nm_dhcp_client_set_client_id (client, new_client_id); - } - success = dhclient_start (client, NULL, NULL, FALSE, NULL, 0); - } else - _LOGW ("error creating dhclient configuration file"); + priv->conf_file = create_dhclient_config (self, + AF_INET, + nm_dhcp_client_get_iface (client), + nm_dhcp_client_get_uuid (client), + client_id, + dhcp_anycast_addr, + nm_dhcp_client_get_hostname (client), + nm_dhcp_client_get_timeout (client), + nm_dhcp_client_get_use_fqdn (client), + &new_client_id); + if (!priv->conf_file) { + nm_utils_error_set_literal (error, + NM_UTILS_ERROR_UNKNOWN, + "error creating dhclient configuration file"); + return FALSE; + } - return success; + if (new_client_id) { + nm_assert (!client_id); + nm_dhcp_client_set_client_id (client, new_client_id); + } + return dhclient_start (client, + NULL, + NULL, + FALSE, + NULL, + 0, + error); } static gboolean @@ -511,22 +534,26 @@ ip6_start (NMDhcpClient *client, const struct in6_addr *ll_addr, NMSettingIP6ConfigPrivacy privacy, GBytes *duid, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client); NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self); - const char *iface, *uuid, *hostname; - guint32 timeout; - iface = nm_dhcp_client_get_iface (client); - uuid = nm_dhcp_client_get_uuid (client); - hostname = nm_dhcp_client_get_hostname (client); - timeout = nm_dhcp_client_get_timeout (client); - - priv->conf_file = create_dhclient_config (self, AF_INET6, iface, uuid, NULL, dhcp_anycast_addr, - hostname, timeout, TRUE, NULL); + priv->conf_file = create_dhclient_config (self, + AF_INET6, + nm_dhcp_client_get_iface (client), + nm_dhcp_client_get_uuid (client), + NULL, + dhcp_anycast_addr, + nm_dhcp_client_get_hostname (client), + nm_dhcp_client_get_timeout (client), + TRUE, + NULL); if (!priv->conf_file) { - _LOGW ("error creating dhclient configuration file"); + nm_utils_error_set_literal (error, + NM_UTILS_ERROR_UNKNOWN, + "error creating dhclient configuration file"); return FALSE; } @@ -534,7 +561,11 @@ ip6_start (NMDhcpClient *client, nm_dhcp_client_get_info_only (NM_DHCP_CLIENT (self)) ? "-S" : "-N", - duid, FALSE, NULL, needed_prefixes); + duid, + FALSE, + NULL, + needed_prefixes, + error); } static void @@ -560,7 +591,13 @@ stop (NMDhcpClient *client, gboolean release, GBytes *duid) if (release) { pid_t rpid = -1; - if (dhclient_start (client, NULL, duid, TRUE, &rpid, 0)) { + if (dhclient_start (client, + NULL, + duid, + TRUE, + &rpid, + 0, + NULL)) { /* Wait a few seconds for the release to happen */ nm_dhcp_client_stop_pid (rpid, nm_dhcp_client_get_iface (client)); } diff --git a/src/dhcp/nm-dhcp-dhcpcanon.c b/src/dhcp/nm-dhcp-dhcpcanon.c index 92aa7f8ca3..de40302062 100644 --- a/src/dhcp/nm-dhcp-dhcpcanon.c +++ b/src/dhcp/nm-dhcp-dhcpcanon.c @@ -82,28 +82,36 @@ dhcpcanon_start (NMDhcpClient *client, GBytes *duid, gboolean release, pid_t *out_pid, - int prefixes) + guint needed_prefixes, + GError **error) { NMDhcpDhcpcanon *self = NM_DHCP_DHCPCANON (client); NMDhcpDhcpcanonPrivate *priv = NM_DHCP_DHCPCANON_GET_PRIVATE (self); - GPtrArray *argv = NULL; + gs_unref_ptrarray GPtrArray *argv = NULL; pid_t pid; - GError *error = NULL; - const char *iface, *system_bus_address, *dhcpcanon_path = NULL; - char *binary_name, *cmd_str, *pid_file = NULL, *system_bus_address_env = NULL; + gs_free_error GError *local = NULL; + const char *iface; + const char *system_bus_address; + const char *dhcpcanon_path; + gs_free char *binary_name = NULL; + gs_free char *pid_file = NULL; + gs_free char *system_bus_address_env = NULL; int addr_family; - g_return_val_if_fail (priv->pid_file == NULL, FALSE); + g_return_val_if_fail (!priv->pid_file, FALSE); iface = nm_dhcp_client_get_iface (client); + addr_family = nm_dhcp_client_get_addr_family (client); + dhcpcanon_path = nm_dhcp_dhcpcanon_get_path (); - _LOGD ("dhcpcanon_path: %s", dhcpcanon_path); if (!dhcpcanon_path) { - _LOGW ("dhcpcanon could not be found"); + nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcanon binary not found"); return FALSE; } + _LOGD ("dhcpcanon_path: %s", dhcpcanon_path); + pid_file = g_strdup_printf (RUNSTATEDIR "/dhcpcanon%c-%s.pid", nm_utils_addr_family_to_char (addr_family), iface); @@ -112,7 +120,6 @@ dhcpcanon_start (NMDhcpClient *client, /* Kill any existing dhcpcanon from the pidfile */ binary_name = g_path_get_basename (dhcpcanon_path); nm_dhcp_client_stop_existing (pid_file, binary_name); - g_free (binary_name); argv = g_ptr_array_new (); g_ptr_array_add (argv, (gpointer) dhcpcanon_path); @@ -120,10 +127,8 @@ dhcpcanon_start (NMDhcpClient *client, g_ptr_array_add (argv, (gpointer) "-sf"); /* Set script file */ g_ptr_array_add (argv, (gpointer) nm_dhcp_helper_path); - if (pid_file) { - g_ptr_array_add (argv, (gpointer) "-pf"); /* Set pid file */ - g_ptr_array_add (argv, (gpointer) pid_file); - } + g_ptr_array_add (argv, (gpointer) "-pf"); /* Set pid file */ + g_ptr_array_add (argv, (gpointer) pid_file); if (priv->conf_file) { g_ptr_array_add (argv, (gpointer) "-cf"); /* Set interface config file */ @@ -144,33 +149,43 @@ dhcpcanon_start (NMDhcpClient *client, g_ptr_array_add (argv, (gpointer) iface); g_ptr_array_add (argv, NULL); - cmd_str = g_strjoinv (" ", (char **) argv->pdata); - g_free (cmd_str); - - if (g_spawn_async (NULL, (char **) argv->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, - nm_utils_setpgid, NULL, &pid, &error)) { - g_assert (pid > 0); - _LOGI ("dhcpcanon started with pid %d", pid); - nm_dhcp_client_watch_child (client, pid); - priv->pid_file = pid_file; - } else { - _LOGW ("dhcpcanon failed to start: '%s'", error->message); - g_error_free (error); - g_free (pid_file); + if (!g_spawn_async (NULL, + (char **) argv->pdata, + NULL, + G_SPAWN_DO_NOT_REAP_CHILD + | G_SPAWN_STDOUT_TO_DEV_NULL + | G_SPAWN_STDERR_TO_DEV_NULL, + nm_utils_setpgid, + NULL, + &pid, + &local)) { + nm_utils_error_set (error, + NM_UTILS_ERROR_UNKNOWN, + "dhcpcanon failed to start: %s", + local->message); + return FALSE; } - g_ptr_array_free (argv, TRUE); - g_free (system_bus_address_env); - return pid > 0 ? TRUE : FALSE; + nm_assert (pid > 0); + _LOGI ("dhcpcanon started with pid %d", pid); + nm_dhcp_client_watch_child (client, pid); + priv->pid_file = g_steal_pointer (&pid_file); + return TRUE; } static gboolean -ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address) +ip4_start (NMDhcpClient *client, + const char *dhcp_anycast_addr, + const char *last_ip4_address, + GError **error) { - gboolean success = FALSE; - success = dhcpcanon_start (client, NULL, NULL, FALSE, NULL, 0); - return success; + return dhcpcanon_start (client, + NULL, + NULL, + FALSE, + NULL, + 0, + error); } static gboolean @@ -179,11 +194,10 @@ ip6_start (NMDhcpClient *client, const struct in6_addr *ll_addr, NMSettingIP6ConfigPrivacy privacy, GBytes *duid, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { - NMDhcpDhcpcanon *self = NM_DHCP_DHCPCANON (client); - - _LOGW ("the dhcpcd backend does not support IPv6"); + nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcanon plugin does not support IPv6"); return FALSE; } static void diff --git a/src/dhcp/nm-dhcp-dhcpcd.c b/src/dhcp/nm-dhcp-dhcpcd.c index 10094e5c2f..de04bbda86 100644 --- a/src/dhcp/nm-dhcp-dhcpcd.c +++ b/src/dhcp/nm-dhcp-dhcpcd.c @@ -81,15 +81,21 @@ nm_dhcp_dhcpcd_get_path (void) } static gboolean -ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address) +ip4_start (NMDhcpClient *client, + const char *dhcp_anycast_addr, + const char *last_ip4_address, + GError **error) { NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client); NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self); - GPtrArray *argv = NULL; + gs_unref_ptrarray GPtrArray *argv = NULL; pid_t pid = -1; - GError *error = NULL; - char *pid_contents = NULL, *binary_name, *cmd_str; - const char *iface, *dhcpcd_path, *hostname; + GError *local = NULL; + gs_free char *cmd_str = NULL; + gs_free char *binary_name = NULL; + const char *iface; + const char *dhcpcd_path; + const char *hostname; g_return_val_if_fail (priv->pid_file == NULL, FALSE); @@ -102,14 +108,13 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last dhcpcd_path = nm_dhcp_dhcpcd_get_path (); if (!dhcpcd_path) { - _LOGW ("dhcpcd could not be found"); + nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcd binary not found"); return FALSE; } /* Kill any existing dhcpcd from the pidfile */ binary_name = g_path_get_basename (dhcpcd_path); nm_dhcp_client_stop_existing (priv->pid_file, binary_name); - g_free (binary_name); argv = g_ptr_array_new (); g_ptr_array_add (argv, (gpointer) dhcpcd_path); @@ -153,24 +158,30 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last g_ptr_array_add (argv, (gpointer) iface); g_ptr_array_add (argv, NULL); - cmd_str = g_strjoinv (" ", (char **) argv->pdata); - _LOGD ("running: %s", cmd_str); - g_free (cmd_str); + _LOGD ("running: %s", + (cmd_str = g_strjoinv (" ", (char **) argv->pdata))); - if (g_spawn_async (NULL, (char **) argv->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, - nm_utils_setpgid, NULL, &pid, &error)) { - g_assert (pid > 0); - _LOGI ("dhcpcd started with pid %d", pid); - nm_dhcp_client_watch_child (client, pid); - } else { - _LOGW ("dhcpcd failed to start, error: '%s'", error->message); - g_error_free (error); + if (!g_spawn_async (NULL, + (char **) argv->pdata, NULL, + G_SPAWN_DO_NOT_REAP_CHILD + | G_SPAWN_STDOUT_TO_DEV_NULL + | G_SPAWN_STDERR_TO_DEV_NULL, + nm_utils_setpgid, + NULL, + &pid, + &local)) { + nm_utils_error_set (error, + NM_UTILS_ERROR_UNKNOWN, + "dhcpcd failed to start: %s", + local->message); + g_error_free (local); + return FALSE; } - g_free (pid_contents); - g_ptr_array_free (argv, TRUE); - return pid > 0 ? TRUE : FALSE; + nm_assert (pid > 0); + _LOGI ("dhcpcd started with pid %d", pid); + nm_dhcp_client_watch_child (client, pid); + return TRUE; } static gboolean @@ -179,11 +190,10 @@ ip6_start (NMDhcpClient *client, const struct in6_addr *ll_addr, NMSettingIP6ConfigPrivacy privacy, GBytes *duid, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { - NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client); - - _LOGW ("the dhcpcd backend does not support IPv6"); + nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "dhcpcd plugin does not support IPv6"); return FALSE; } diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c index 672543237e..2fa86f7c98 100644 --- a/src/dhcp/nm-dhcp-manager.c +++ b/src/dhcp/nm-dhcp-manager.c @@ -172,22 +172,22 @@ client_start (NMDhcpManager *self, gboolean info_only, NMSettingIP6ConfigPrivacy privacy, const char *last_ip4_address, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { NMDhcpManagerPrivate *priv; NMDhcpClient *client; gboolean success = FALSE; - g_return_val_if_fail (self, NULL); g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL); g_return_val_if_fail (ifindex > 0, NULL); g_return_val_if_fail (uuid != NULL, NULL); g_return_val_if_fail (!dhcp_client_id || g_bytes_get_size (dhcp_client_id) >= 2, NULL); + g_return_val_if_fail (!error || !*error, NULL); priv = NM_DHCP_MANAGER_GET_PRIVATE (self); - if (!priv->client_factory) - return NULL; + nm_assert (priv->client_factory); /* Kill any old client instance */ client = get_client_for_ifindex (self, addr_family, ifindex); @@ -216,10 +216,24 @@ client_start (NMDhcpManager *self, c_list_link_tail (&priv->dhcp_client_lst_head, &client->dhcp_client_lst); g_signal_connect (client, NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, G_CALLBACK (client_state_changed), self); - if (addr_family == AF_INET) - success = nm_dhcp_client_start_ip4 (client, dhcp_client_id, dhcp_anycast_addr, hostname, last_ip4_address); - else - success = nm_dhcp_client_start_ip6 (client, dhcp_client_id, enforce_duid, dhcp_anycast_addr, ipv6_ll_addr, hostname, privacy, needed_prefixes); + if (addr_family == AF_INET) { + success = nm_dhcp_client_start_ip4 (client, + dhcp_client_id, + dhcp_anycast_addr, + hostname, + last_ip4_address, + error); + } else { + success = nm_dhcp_client_start_ip6 (client, + dhcp_client_id, + enforce_duid, + dhcp_anycast_addr, + ipv6_ll_addr, + hostname, + privacy, + needed_prefixes, + error); + } if (!success) { remove_client_unref (self, client); @@ -245,7 +259,8 @@ nm_dhcp_manager_start_ip4 (NMDhcpManager *self, GBytes *dhcp_client_id, guint32 timeout, const char *dhcp_anycast_addr, - const char *last_ip_address) + const char *last_ip_address, + GError **error) { NMDhcpManagerPrivate *priv; const char *hostname = NULL; @@ -282,7 +297,7 @@ nm_dhcp_manager_start_ip4 (NMDhcpManager *self, return client_start (self, AF_INET, multi_idx, iface, ifindex, hwaddr, uuid, route_table, route_metric, NULL, dhcp_client_id, 0, timeout, dhcp_anycast_addr, hostname, - use_fqdn, FALSE, 0, last_ip_address, 0); + use_fqdn, FALSE, 0, last_ip_address, 0, error); } /* Caller owns a reference to the NMDhcpClient on return */ @@ -304,7 +319,8 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self, const char *dhcp_anycast_addr, gboolean info_only, NMSettingIP6ConfigPrivacy privacy, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { NMDhcpManagerPrivate *priv; const char *hostname = NULL; @@ -319,7 +335,7 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self, return client_start (self, AF_INET6, multi_idx, iface, ifindex, hwaddr, uuid, route_table, route_metric, ll_addr, duid, enforce_duid, timeout, dhcp_anycast_addr, hostname, TRUE, info_only, - privacy, NULL, needed_prefixes); + privacy, NULL, needed_prefixes, error); } void @@ -409,7 +425,7 @@ nm_dhcp_manager_init (NMDhcpManager *self) } } - nm_assert (client_factory); + g_return_if_fail (client_factory); nm_log_info (LOGD_DHCP, "dhcp-init: Using DHCP client '%s'", client_factory->name); diff --git a/src/dhcp/nm-dhcp-manager.h b/src/dhcp/nm-dhcp-manager.h index 7eb32c37da..1d9e5c21dc 100644 --- a/src/dhcp/nm-dhcp-manager.h +++ b/src/dhcp/nm-dhcp-manager.h @@ -59,7 +59,8 @@ NMDhcpClient * nm_dhcp_manager_start_ip4 (NMDhcpManager *manager, GBytes *dhcp_client_id, guint32 timeout, const char *dhcp_anycast_addr, - const char *last_ip_address); + const char *last_ip_address, + GError **error); NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager, struct _NMDedupMultiIndex *multi_idx, @@ -78,7 +79,8 @@ NMDhcpClient * nm_dhcp_manager_start_ip6 (NMDhcpManager *manager, const char *dhcp_anycast_addr, gboolean info_only, NMSettingIP6ConfigPrivacy privacy, - guint needed_prefixes); + guint needed_prefixes, + GError **error); /* For testing only */ extern const char* nm_dhcp_helper_path; diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index 2d0202bb70..b51c6e7b24 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -567,7 +567,10 @@ get_arp_type (GBytes *hwaddr) } static gboolean -ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last_ip4_address) +ip4_start (NMDhcpClient *client, + const char *dhcp_anycast_addr, + const char *last_ip4_address, + GError **error) { NMDhcpSystemd *self = NM_DHCP_SYSTEMD (client); NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self); @@ -590,7 +593,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last r = sd_dhcp_client_new (&priv->client4, FALSE); if (r < 0) { - _LOGW ("failed to create client (%d)", r); + nm_utils_error_set_errno (error, r, "failed to create dhcp-client: %s"); return FALSE; } @@ -598,8 +601,8 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last r = sd_dhcp_client_attach_event (priv->client4, NULL, 0); if (r < 0) { - _LOGW ("failed to attach event (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to attach event: %s"); + goto errout; } hwaddr = nm_dhcp_client_get_hw_addr (client); @@ -613,21 +616,21 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last len, get_arp_type (hwaddr)); if (r < 0) { - _LOGW ("failed to set MAC address (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set MAC address: %s"); + goto errout; } } r = sd_dhcp_client_set_ifindex (priv->client4, nm_dhcp_client_get_ifindex (client)); if (r < 0) { - _LOGW ("failed to set ififindex (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set ifindex: %s"); + goto errout; } r = sd_dhcp_client_set_callback (priv->client4, dhcp_event_cb, client); if (r < 0) { - _LOGW ("failed to set callback (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set callback: %s"); + goto errout; } dhcp_lease_load (&lease, priv->lease_file); @@ -640,8 +643,8 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last if (last_addr.s_addr) { r = sd_dhcp_client_set_request_address (priv->client4, &last_addr); if (r < 0) { - _LOGW ("failed to set last IPv4 address (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set last IPv4 address: %s"); + goto errout; } } @@ -681,25 +684,25 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last */ r = sd_dhcp_client_set_hostname (priv->client4, hostname); if (r < 0) { - _LOGW ("failed to set DHCP hostname to '%s' (%d)", hostname, r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set DHCP hostname: %s"); + goto errout; } } r = sd_dhcp_client_start (priv->client4); if (r < 0) { - _LOGW ("failed to start client (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to start DHCP client: %s"); + goto errout; } nm_dhcp_client_start_timeout (client); success = TRUE; -error: +errout: sd_dhcp_lease_unref (lease); if (!success) - priv->client4 = sd_dhcp_client_unref (priv->client4); + sd_dhcp_client_unref (g_steal_pointer (&priv->client4)); return success; } @@ -864,7 +867,8 @@ ip6_start (NMDhcpClient *client, const struct in6_addr *ll_addr, NMSettingIP6ConfigPrivacy privacy, GBytes *duid, - guint needed_prefixes) + guint needed_prefixes, + GError **error) { NMDhcpSystemd *self = NM_DHCP_SYSTEMD (client); NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self); @@ -888,7 +892,7 @@ ip6_start (NMDhcpClient *client, r = sd_dhcp6_client_new (&priv->client6); if (r < 0) { - _LOGW ("failed to create client (%d)", r); + nm_utils_error_set_errno (error, r, "failed to create dhcp-client: %s"); return FALSE; } @@ -907,14 +911,14 @@ ip6_start (NMDhcpClient *client, &duid_arr[2], duid_len - 2); if (r < 0) { - _LOGW ("failed to set DUID (%d)", r); + nm_utils_error_set_errno (error, r, "failed to set DUID: %s"); return FALSE; } r = sd_dhcp6_client_attach_event (priv->client6, NULL, 0); if (r < 0) { - _LOGW ("failed to attach event (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to attach event: %s"); + goto errout; } hwaddr = nm_dhcp_client_get_hw_addr (client); @@ -928,21 +932,21 @@ ip6_start (NMDhcpClient *client, len, get_arp_type (hwaddr)); if (r < 0) { - _LOGW ("failed to set MAC address (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set MAC address: %s"); + goto errout; } } r = sd_dhcp6_client_set_ifindex (priv->client6, nm_dhcp_client_get_ifindex (client)); if (r < 0) { - _LOGW ("failed to set ifindex (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set ifindex: %s"); + goto errout; } r = sd_dhcp6_client_set_callback (priv->client6, dhcp6_event_cb, client); if (r < 0) { - _LOGW ("failed to set callback (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set callback: %s"); + goto errout; } /* Add requested options */ @@ -953,30 +957,29 @@ ip6_start (NMDhcpClient *client, r = sd_dhcp6_client_set_local_address (priv->client6, ll_addr); if (r < 0) { - _LOGW ("failed to set local address (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set local address: %s"); + goto errout; } hostname = nm_dhcp_client_get_hostname (client); r = sd_dhcp6_client_set_fqdn (priv->client6, hostname); if (r < 0) { - _LOGW ("failed to set DHCP hostname to '%s' (%d)", hostname, r); - goto error; + nm_utils_error_set_errno (error, r, "failed to set DHCP hostname: %s"); + goto errout; } r = sd_dhcp6_client_start (priv->client6); if (r < 0) { - _LOGW ("failed to start client (%d)", r); - goto error; + nm_utils_error_set_errno (error, r, "failed to start client: %s"); + goto errout; } nm_dhcp_client_start_timeout (client); return TRUE; -error: - sd_dhcp6_client_unref (priv->client6); - priv->client6 = NULL; +errout: + sd_dhcp6_client_unref (g_steal_pointer (&priv->client6)); return FALSE; } diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 308c9e1f5a..805c6e4fd2 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -380,7 +380,7 @@ int main (int argc, char *argv[]) { char *bad_domains = NULL; - GError *error = NULL; + gs_free_error GError *error = NULL; gboolean wrote_pidfile = FALSE; gs_free char *pidfile = NULL; gs_unref_object NMDhcpClient *dhcp4_client = NULL; @@ -516,8 +516,11 @@ main (int argc, char *argv[]) client_id, NM_DHCP_TIMEOUT_DEFAULT, NULL, - global_opt.dhcp4_address); - g_assert (dhcp4_client); + global_opt.dhcp4_address, + &error); + if (!dhcp4_client) + g_error ("failure to start DHCP: %s", error->message); + g_signal_connect (dhcp4_client, NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, G_CALLBACK (dhcp4_state_changed), From 34af574d5810ab2b0d6d354cbc28135cde4a55b1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 15:22:28 +0200 Subject: [PATCH 15/63] systemd/dhcp: fix assertion starting DHCP client without MAC address An assertion in dhcp_network_bind_raw_socket() is triggered when starting an sd_dhcp_client without setting setting a MAC address first. - sd_dhcp_client_start() - client_start() - client_start_delayed() - dhcp_network_bind_raw_socket() In that case, the arp-type and MAC address is still unset. Note that dhcp_network_bind_raw_socket() already checks for a valid arp-type and MAC address below, so we should just gracefully return -EINVAL. Maybe sd_dhcp_client_start() should fail earlier when starting without MAC address. But the failure here will be correctly propagated and the start aborted. See-also: https://github.com/systemd/systemd/pull/10054 --- src/systemd/src/libsystemd-network/dhcp-network.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/systemd/src/libsystemd-network/dhcp-network.c b/src/systemd/src/libsystemd-network/dhcp-network.c index 90fe29d046..80e9577cd5 100644 --- a/src/systemd/src/libsystemd-network/dhcp-network.c +++ b/src/systemd/src/libsystemd-network/dhcp-network.c @@ -128,8 +128,6 @@ int dhcp_network_bind_raw_socket(int ifindex, union sockaddr_union *link, const uint8_t *bcast_addr = NULL; uint8_t dhcp_hlen = 0; - assert_return(mac_addr_len > 0, -EINVAL); - if (arp_type == ARPHRD_ETHER) { assert_return(mac_addr_len == ETH_ALEN, -EINVAL); memcpy(ð_mac, mac_addr, ETH_ALEN); From e8fa75ce061c1dddd607a8b1fd77ba1f09f4b9e0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 15:45:04 +0200 Subject: [PATCH 16/63] dhcp: abort DHCP on devices without MAC address early Internal DHCPv4 client requires a valid MAC address for functioning. Just always require a MAC address to start DHCP, both v4 and v6. We have no MAC address for example on Layer3 devices like tun or wireguard. Also, before "34af574d58 systemd/dhcp: fix assertion starting DHCP client without MAC address", if we tired to start sd_dhcp_client without setting a MAC address, an assertion was triggered. --- src/dhcp/nm-dhcp-manager.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c index 2fa86f7c98..6c71af9d0b 100644 --- a/src/dhcp/nm-dhcp-manager.c +++ b/src/dhcp/nm-dhcp-manager.c @@ -178,6 +178,7 @@ client_start (NMDhcpManager *self, NMDhcpManagerPrivate *priv; NMDhcpClient *client; gboolean success = FALSE; + gsize hwaddr_len; g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL); g_return_val_if_fail (ifindex > 0, NULL); @@ -185,6 +186,22 @@ client_start (NMDhcpManager *self, g_return_val_if_fail (!dhcp_client_id || g_bytes_get_size (dhcp_client_id) >= 2, NULL); g_return_val_if_fail (!error || !*error, NULL); + if (!hwaddr) { + nm_utils_error_set (error, + NM_UTILS_ERROR_UNKNOWN, + "missing MAC address"); + return NULL; + } + + hwaddr_len = g_bytes_get_size (hwaddr); + if ( hwaddr_len == 0 + || hwaddr_len > NM_UTILS_HWADDR_LEN_MAX) { + nm_utils_error_set (error, + NM_UTILS_ERROR_UNKNOWN, + "invalid MAC address"); + g_return_val_if_reached (NULL) ; + } + priv = NM_DHCP_MANAGER_GET_PRIVATE (self); nm_assert (priv->client_factory); From ac73c6f019c14b762676c2a8d4683a1eefeebb73 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Sep 2018 10:16:49 +0200 Subject: [PATCH 17/63] platform/trivial: adjust coding style in nm-netlink.c --- src/platform/nm-netlink.c | 142 +++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/src/platform/nm-netlink.c b/src/platform/nm-netlink.c index fa8a812cec..e730b7def0 100644 --- a/src/platform/nm-netlink.c +++ b/src/platform/nm-netlink.c @@ -251,7 +251,7 @@ nlmsg_reserve (struct nl_msg *n, size_t len, int pad) n->nm_nlh->nlmsg_len += tlen; if (tlen > len) - memset(buf + len, 0, tlen - len); + memset (buf + len, 0, tlen - len); return buf; } @@ -267,17 +267,17 @@ nla_reserve (struct nl_msg *msg, int attrtype, int attrlen) if (attrlen < 0) return NULL; - tlen = NLMSG_ALIGN(msg->nm_nlh->nlmsg_len) + nla_total_size(attrlen); + tlen = NLMSG_ALIGN (msg->nm_nlh->nlmsg_len) + nla_total_size (attrlen); if (tlen > msg->nm_size) return NULL; - nla = (struct nlattr *) nlmsg_tail(msg->nm_nlh); + nla = (struct nlattr *) nlmsg_tail (msg->nm_nlh); nla->nla_type = attrtype; - nla->nla_len = nla_attr_size(attrlen); + nla->nla_len = nla_attr_size (attrlen); if (attrlen) - memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen)); + memset ((unsigned char *) nla + nla->nla_len, 0, nla_padlen (attrlen)); msg->nm_nlh->nlmsg_len = tlen; return nla; @@ -337,7 +337,7 @@ nlmsg_alloc_convert (struct nlmsghdr *hdr) struct nl_msg *nm; nm = nlmsg_alloc_size (NLMSG_ALIGN (hdr->nlmsg_len)); - memcpy(nm->nm_nlh, hdr, hdr->nlmsg_len); + memcpy (nm->nm_nlh, hdr, hdr->nlmsg_len); return nm; } @@ -374,7 +374,7 @@ nlmsg_append (struct nl_msg *n, void *data, size_t len, int pad) if (tmp == NULL) return -ENOMEM; - memcpy(tmp, data, len); + memcpy (tmp, data, len); return 0; } @@ -384,11 +384,11 @@ int nlmsg_parse (struct nlmsghdr *nlh, int hdrlen, struct nlattr *tb[], int maxtype, const struct nla_policy *policy) { - if (!nlmsg_valid_hdr(nlh, hdrlen)) + if (!nlmsg_valid_hdr (nlh, hdrlen)) return -NLE_MSG_TOOSHORT; - return nla_parse (tb, maxtype, nlmsg_attrdata(nlh, hdrlen), - nlmsg_attrlen(nlh, hdrlen), policy); + return nla_parse (tb, maxtype, nlmsg_attrdata (nlh, hdrlen), + nlmsg_attrlen (nlh, hdrlen), policy); } struct nlmsghdr * @@ -407,7 +407,7 @@ nlmsg_put (struct nl_msg *n, uint32_t pid, uint32_t seq, nlh->nlmsg_seq = seq; if (payload > 0 && - nlmsg_reserve(n, payload, NLMSG_ALIGNTO) == NULL) + nlmsg_reserve (n, payload, NLMSG_ALIGNTO) == NULL) return NULL; return nlh; @@ -418,8 +418,8 @@ nla_get_u64 (const struct nlattr *nla) { uint64_t tmp = 0; - if (nla && nla_len(nla) >= sizeof (tmp)) - memcpy(&tmp, nla_data(nla), sizeof (tmp)); + if (nla && nla_len (nla) >= sizeof (tmp)) + memcpy (&tmp, nla_data (nla), sizeof (tmp)); return tmp; } @@ -427,8 +427,8 @@ nla_get_u64 (const struct nlattr *nla) size_t nla_strlcpy (char *dst, const struct nlattr *nla, size_t dstsize) { - size_t srclen = nla_len(nla); - const char *src = nla_data(nla); + size_t srclen = nla_len (nla); + const char *src = nla_data (nla); if (srclen > 0 && src[srclen - 1] == '\0') srclen--; @@ -436,8 +436,8 @@ nla_strlcpy (char *dst, const struct nlattr *nla, size_t dstsize) if (dstsize > 0) { size_t len = (srclen >= dstsize) ? dstsize - 1 : srclen; - memset(dst, 0, dstsize); - memcpy(dst, src, len); + memset (dst, 0, dstsize); + memcpy (dst, src, len); } return srclen; @@ -452,7 +452,7 @@ nla_memcpy (void *dest, const struct nlattr *src, int count) return 0; minlen = NM_MIN (count, (int) nla_len (src)); - memcpy(dest, nla_data(src), minlen); + memcpy (dest, nla_data (src), minlen); return minlen; } @@ -462,7 +462,7 @@ nla_put (struct nl_msg *msg, int attrtype, int datalen, const void *data) { struct nlattr *nla; - nla = nla_reserve(msg, attrtype, datalen); + nla = nla_reserve (msg, attrtype, datalen); if (!nla) { if (datalen < 0) g_return_val_if_reached (-NLE_BUG); @@ -471,7 +471,7 @@ nla_put (struct nl_msg *msg, int attrtype, int datalen, const void *data) } if (datalen > 0) - memcpy (nla_data(nla), data, datalen); + memcpy (nla_data (nla), data, datalen); return 0; } @@ -495,21 +495,21 @@ nla_nest_cancel (struct nl_msg *msg, const struct nlattr *attr) { ssize_t len; - len = (char *) nlmsg_tail(msg->nm_nlh) - (char *) attr; + len = (char *) nlmsg_tail (msg->nm_nlh) - (char *) attr; if (len < 0) g_return_if_reached (); else if (len > 0) { msg->nm_nlh->nlmsg_len -= len; - memset(nlmsg_tail(msg->nm_nlh), 0, len); + memset (nlmsg_tail (msg->nm_nlh), 0, len); } } struct nlattr * nla_nest_start (struct nl_msg *msg, int attrtype) { - struct nlattr *start = (struct nlattr *) nlmsg_tail(msg->nm_nlh); + struct nlattr *start = (struct nlattr *) nlmsg_tail (msg->nm_nlh); - if (nla_put(msg, attrtype, 0, NULL) < 0) + if (nla_put (msg, attrtype, 0, NULL) < 0) return NULL; return start; @@ -520,7 +520,7 @@ _nest_end (struct nl_msg *msg, struct nlattr *start, int keep_empty) { size_t pad, len; - len = (char *) nlmsg_tail(msg->nm_nlh) - (char *) start; + len = (char *) nlmsg_tail (msg->nm_nlh) - (char *) start; if ( len > USHRT_MAX || (!keep_empty && len == NLA_HDRLEN)) { @@ -528,7 +528,7 @@ _nest_end (struct nl_msg *msg, struct nlattr *start, int keep_empty) * Max nlattr size exceeded or empty nested attribute, trim the * attribute header again */ - nla_nest_cancel(msg, start); + nla_nest_cancel (msg, start); /* Return error only if nlattr size was exceeded */ return (len == NLA_HDRLEN) ? 0 : -NLE_ATTRSIZE; @@ -536,7 +536,7 @@ _nest_end (struct nl_msg *msg, struct nlattr *start, int keep_empty) start->nla_len = len; - pad = NLMSG_ALIGN(msg->nm_nlh->nlmsg_len) - msg->nm_nlh->nlmsg_len; + pad = NLMSG_ALIGN (msg->nm_nlh->nlmsg_len) - msg->nm_nlh->nlmsg_len; if (pad > 0) { /* * Data inside attribute does not end at a alignment boundry. @@ -544,7 +544,7 @@ _nest_end (struct nl_msg *msg, struct nlattr *start, int keep_empty) * the message. nlmsg_reserve() may never fail in this situation, * the allocate message buffer must be a multiple of NLMSG_ALIGNTO. */ - if (!nlmsg_reserve(msg, pad, 0)) + if (!nlmsg_reserve (msg, pad, 0)) g_return_val_if_reached (-NLE_BUG); } @@ -572,7 +572,7 @@ validate_nla (const struct nlattr *nla, int maxtype, { const struct nla_policy *pt; unsigned int minlen = 0; - int type = nla_type(nla); + int type = nla_type (nla); if (type < 0 || type > maxtype) return 0; @@ -587,15 +587,15 @@ validate_nla (const struct nlattr *nla, int maxtype, else if (pt->type != NLA_UNSPEC) minlen = nla_attr_minlen[pt->type]; - if (nla_len(nla) < minlen) + if (nla_len (nla) < minlen) return -NLE_UNSPEC; - if (pt->maxlen && nla_len(nla) > pt->maxlen) + if (pt->maxlen && nla_len (nla) > pt->maxlen) return -NLE_UNSPEC; if (pt->type == NLA_STRING) { - const char *data = nla_data(nla); - if (data[nla_len(nla) - 1] != '\0') + const char *data = nla_data (nla); + if (data[nla_len (nla) - 1] != '\0') return -NLE_UNSPEC; } @@ -609,16 +609,16 @@ nla_parse (struct nlattr *tb[], int maxtype, struct nlattr *head, int len, struct nlattr *nla; int rem, err; - memset(tb, 0, sizeof (struct nlattr *) * (maxtype + 1)); + memset (tb, 0, sizeof (struct nlattr *) * (maxtype + 1)); - nla_for_each_attr(nla, head, len, rem) { - int type = nla_type(nla); + nla_for_each_attr (nla, head, len, rem) { + int type = nla_type (nla); if (type > maxtype) continue; if (policy) { - err = validate_nla(nla, maxtype, policy); + err = validate_nla (nla, maxtype, policy); if (err < 0) goto errout; } @@ -839,7 +839,7 @@ nl_socket_alloc (void) sk->s_fd = -1; sk->s_local.nl_family = AF_NETLINK; sk->s_peer.nl_family = AF_NETLINK; - sk->s_seq_expect = sk->s_seq_next = time(NULL); + sk->s_seq_expect = sk->s_seq_next = time (NULL); return sk; } @@ -914,7 +914,7 @@ nl_socket_set_nonblocking (const struct nl_sock *sk) if (sk->s_fd == -1) return -NLE_BAD_SOCK; - if (fcntl(sk->s_fd, F_SETFL, O_NONBLOCK) < 0) + if (fcntl (sk->s_fd, F_SETFL, O_NONBLOCK) < 0) return -nl_syserr2nlerr (errno); return 0; @@ -958,25 +958,25 @@ nl_socket_add_memberships (struct nl_sock *sk, int group, ...) if (sk->s_fd == -1) return -NLE_BAD_SOCK; - va_start(ap, group); + va_start (ap, group); while (group != 0) { if (group < 0) { - va_end(ap); + va_end (ap); g_return_val_if_reached (-NLE_BUG); } err = setsockopt (sk->s_fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &group, sizeof (group)); if (err < 0) { - va_end(ap); + va_end (ap); return -nl_syserr2nlerr (errno); } - group = va_arg(ap, int); + group = va_arg (ap, int); } - va_end(ap); + va_end (ap); return 0; } @@ -1019,7 +1019,7 @@ nl_connect (struct nl_sock *sk, int protocol) goto errout; } - err = nl_socket_set_buffer_size(sk, 0, 0); + err = nl_socket_set_buffer_size (sk, 0, 0); if (err < 0) goto errout; @@ -1057,7 +1057,7 @@ nl_connect (struct nl_sock *sk, int protocol) errout: if (sk->s_fd != -1) { - close(sk->s_fd); + close (sk->s_fd); sk->s_fd = -1; } return err; @@ -1076,7 +1076,7 @@ _cb_init (struct nl_cb *dst, const struct nl_cb *src) memset (dst, 0, sizeof (*dst)); } -static int ack_wait_handler(struct nl_msg *msg, void *arg) +static int ack_wait_handler (struct nl_msg *msg, void *arg) { return NL_STOP; } @@ -1144,7 +1144,7 @@ continue_reading: nrecv++; /* Only do sequence checking if auto-ack mode is enabled */ - if (!(sk->s_flags & NL_NO_AUTO_ACK)) { + if (! (sk->s_flags & NL_NO_AUTO_ACK)) { if (hdr->nlmsg_seq != sk->s_seq_expect) { err = -NLE_SEQ_MISMATCH; goto out; @@ -1178,7 +1178,7 @@ continue_reading: * this action by skipping this packet. */ if (hdr->nlmsg_type == NLMSG_DONE) { multipart = 0; - NL_CB_CALL(cb, finish, msg); + NL_CB_CALL (cb, finish, msg); } /* Message to be ignored, the default action is to @@ -1198,9 +1198,9 @@ continue_reading: /* Message carries a nlmsgerr */ else if (hdr->nlmsg_type == NLMSG_ERROR) { - struct nlmsgerr *e = nlmsg_data(hdr); + struct nlmsgerr *e = nlmsg_data (hdr); - if (hdr->nlmsg_len < nlmsg_size(sizeof (*e))) { + if (hdr->nlmsg_len < nlmsg_size (sizeof (*e))) { /* Truncated error message, the default action * is to stop parsing. The user may overrule * this action by returning NL_SKIP or @@ -1227,16 +1227,16 @@ continue_reading: goto out; } } else - NL_CB_CALL(cb, ack, msg); + NL_CB_CALL (cb, ack, msg); } else { /* Valid message (not checking for MULTIPART bit to * get along with broken kernels. NL_SKIP has no * effect on this. */ - NL_CB_CALL(cb, valid, msg); + NL_CB_CALL (cb, valid, msg); } skip: err = 0; - hdr = nlmsg_next(hdr, &n); + hdr = nlmsg_next (hdr, &n); } if (multipart) { @@ -1268,7 +1268,7 @@ nl_sendmsg (struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr) nlmsg_set_src (msg, &sk->s_local); - ret = sendmsg(sk->s_fd, hdr, 0); + ret = sendmsg (sk->s_fd, hdr, 0); if (ret < 0) return -nl_syserr2nlerr (errno); @@ -1286,28 +1286,28 @@ nl_send_iovec (struct nl_sock *sk, struct nl_msg *msg, struct iovec *iov, unsign .msg_iov = iov, .msg_iovlen = iovlen, }; - char buf[CMSG_SPACE(sizeof (struct ucred))]; + char buf[CMSG_SPACE (sizeof (struct ucred))]; /* Overwrite destination if specified in the message itself, defaults * to the peer address of the socket. */ - dst = nlmsg_get_dst(msg); + dst = nlmsg_get_dst (msg); if (dst->nl_family == AF_NETLINK) hdr.msg_name = dst; /* Add credentials if present. */ - creds = nlmsg_get_creds(msg); + creds = nlmsg_get_creds (msg); if (creds != NULL) { struct cmsghdr *cmsg; hdr.msg_control = buf; hdr.msg_controllen = sizeof (buf); - cmsg = CMSG_FIRSTHDR(&hdr); + cmsg = CMSG_FIRSTHDR (&hdr); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_CREDENTIALS; - cmsg->cmsg_len = CMSG_LEN(sizeof (struct ucred)); - memcpy(CMSG_DATA(cmsg), creds, sizeof (struct ucred)); + cmsg->cmsg_len = CMSG_LEN (sizeof (struct ucred)); + memcpy (CMSG_DATA (cmsg), creds, sizeof (struct ucred)); } return nl_sendmsg (sk, msg, &hdr); @@ -1318,9 +1318,9 @@ nl_complete_msg (struct nl_sock *sk, struct nl_msg *msg) { struct nlmsghdr *nlh; - nlh = nlmsg_hdr(msg); + nlh = nlmsg_hdr (msg); if (nlh->nlmsg_pid == NL_AUTO_PORT) - nlh->nlmsg_pid = nl_socket_get_local_port(sk); + nlh->nlmsg_pid = nl_socket_get_local_port (sk); if (nlh->nlmsg_seq == NL_AUTO_SEQ) nlh->nlmsg_seq = sk->s_seq_next++; @@ -1338,14 +1338,14 @@ int nl_send (struct nl_sock *sk, struct nl_msg *msg) { struct iovec iov = { - .iov_base = (void *) nlmsg_hdr(msg), - .iov_len = nlmsg_hdr(msg)->nlmsg_len, + .iov_base = (void *) nlmsg_hdr (msg), + .iov_len = nlmsg_hdr (msg)->nlmsg_len, }; - return nl_send_iovec(sk, msg, &iov, 1); + return nl_send_iovec (sk, msg, &iov, 1); } -int nl_send_auto(struct nl_sock *sk, struct nl_msg *msg) +int nl_send_auto (struct nl_sock *sk, struct nl_msg *msg) { nl_complete_msg (sk, msg); @@ -1379,7 +1379,7 @@ nl_recv (struct nl_sock *sk, struct sockaddr_nl *nla, flags |= MSG_PEEK | MSG_TRUNC; if (page_size == 0) - page_size = getpagesize() * 4; + page_size = getpagesize () * 4; iov.iov_len = sk->s_bufsize ?: page_size; iov.iov_base = g_malloc (iov.iov_len); @@ -1391,7 +1391,7 @@ nl_recv (struct nl_sock *sk, struct sockaddr_nl *nla, } retry: - n = recvmsg(sk->s_fd, &msg, flags); + n = recvmsg (sk->s_fd, &msg, flags); if (!n) { retval = 0; goto abort; @@ -1447,12 +1447,12 @@ retry: if (creds && (sk->s_flags & NL_SOCK_PASSCRED)) { struct cmsghdr *cmsg; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { + for (cmsg = CMSG_FIRSTHDR (&msg); cmsg; cmsg = CMSG_NXTHDR (&msg, cmsg)) { if (cmsg->cmsg_level != SOL_SOCKET) continue; if (cmsg->cmsg_type != SCM_CREDENTIALS) continue; - tmpcreds = nm_memdup (CMSG_DATA(cmsg), sizeof (*tmpcreds)); + tmpcreds = nm_memdup (CMSG_DATA (cmsg), sizeof (*tmpcreds)); break; } } From f4de941d98d4329f652d419dc5fd47bc39700f44 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 14:54:13 +0200 Subject: [PATCH 18/63] platform/netlink: cleanup error number handling Rename variables for the error number. Commonly the naming is: - errno: the error number from itself - errsv: a copy of errno - nlerr: a netlink error number - err: an error code, but not a errno/errsv and not a netlink error number. --- src/platform/nm-netlink.c | 94 +++++++++++++++++++++------------------ src/platform/nm-netlink.h | 48 +++++++++++++------- 2 files changed, 82 insertions(+), 60 deletions(-) diff --git a/src/platform/nm-netlink.c b/src/platform/nm-netlink.c index e730b7def0..3e2ad9112a 100644 --- a/src/platform/nm-netlink.c +++ b/src/platform/nm-netlink.c @@ -83,18 +83,18 @@ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_geterror, int, ) const char * -nl_geterror (int err) +nl_geterror (int nlerr) { const char *s; - err = nl_errno (err); + nlerr = nl_errno (nlerr); - if (err >= _NLE_BASE) { - s = _geterror (err); + if (nlerr >= _NLE_BASE) { + s = _geterror (nlerr); if (s) return s; } - return g_strerror (err); + return g_strerror (nlerr); } /*****************************************************************************/ @@ -406,8 +406,8 @@ nlmsg_put (struct nl_msg *n, uint32_t pid, uint32_t seq, nlh->nlmsg_pid = pid; nlh->nlmsg_seq = seq; - if (payload > 0 && - nlmsg_reserve (n, payload, NLMSG_ALIGNTO) == NULL) + if ( payload > 0 + && nlmsg_reserve (n, payload, NLMSG_ALIGNTO) == NULL) return NULL; return nlh; @@ -607,7 +607,7 @@ nla_parse (struct nlattr *tb[], int maxtype, struct nlattr *head, int len, const struct nla_policy *policy) { struct nlattr *nla; - int rem, err; + int rem, nlerr; memset (tb, 0, sizeof (struct nlattr *) * (maxtype + 1)); @@ -618,17 +618,17 @@ nla_parse (struct nlattr *tb[], int maxtype, struct nlattr *head, int len, continue; if (policy) { - err = validate_nla (nla, maxtype, policy); - if (err < 0) + nlerr = validate_nla (nla, maxtype, policy); + if (nlerr < 0) goto errout; } tb[type] = nla; } - err = 0; + nlerr = 0; errout: - return err; + return nlerr; } /*****************************************************************************/ @@ -969,8 +969,10 @@ nl_socket_add_memberships (struct nl_sock *sk, int group, ...) err = setsockopt (sk->s_fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &group, sizeof (group)); if (err < 0) { + int errsv = errno; + va_end (ap); - return -nl_syserr2nlerr (errno); + return -nl_syserr2nlerr (errsv); } group = va_arg (ap, int); @@ -1006,7 +1008,7 @@ void nl_socket_disable_msg_peek (struct nl_sock *sk) int nl_connect (struct nl_sock *sk, int protocol) { - int err; + int err, nlerr; socklen_t addrlen; struct sockaddr_nl local = { 0 }; @@ -1015,12 +1017,12 @@ nl_connect (struct nl_sock *sk, int protocol) sk->s_fd = socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, protocol); if (sk->s_fd < 0) { - err = -nl_syserr2nlerr (errno); + nlerr = -nl_syserr2nlerr (errno); goto errout; } - err = nl_socket_set_buffer_size (sk, 0, 0); - if (err < 0) + nlerr = nl_socket_set_buffer_size (sk, 0, 0); + if (nlerr < 0) goto errout; nm_assert (sk->s_local.nl_pid == 0); @@ -1028,7 +1030,7 @@ nl_connect (struct nl_sock *sk, int protocol) err = bind (sk->s_fd, (struct sockaddr*) &sk->s_local, sizeof (sk->s_local)); if (err != 0) { - err = -nl_syserr2nlerr (errno); + nlerr = -nl_syserr2nlerr (errno); goto errout; } @@ -1036,17 +1038,17 @@ nl_connect (struct nl_sock *sk, int protocol) err = getsockname (sk->s_fd, (struct sockaddr *) &local, &addrlen); if (err < 0) { - err = -nl_syserr2nlerr (errno); + nlerr = -nl_syserr2nlerr (errno); goto errout; } if (addrlen != sizeof (local)) { - err = -NLE_UNSPEC; + nlerr = -NLE_UNSPEC; goto errout; } if (local.nl_family != AF_NETLINK) { - err = -NLE_UNSPEC; + nlerr = -NLE_UNSPEC; goto errout; } @@ -1060,7 +1062,7 @@ errout: close (sk->s_fd); sk->s_fd = -1; } - return err; + return nlerr; } /*****************************************************************************/ @@ -1097,19 +1099,21 @@ do { \ const struct nl_cb *_cb = (cb); \ \ if (_cb->type##_cb) { \ - err = _cb->type##_cb ((msg), _cb->type##_arg); \ - switch (err) { \ + /* the returned value here must be either a negative + * netlink error number, or one of NL_SKIP, NL_STOP, NL_OK. */ \ + nlerr = _cb->type##_cb ((msg), _cb->type##_arg); \ + switch (nlerr) { \ case NL_OK: \ - err = 0; \ + nlerr = 0; \ break; \ case NL_SKIP: \ goto skip; \ case NL_STOP: \ goto stop; \ default: \ - if (err >= 0) { \ + if (nlerr >= 0) { \ nm_assert_not_reached (); \ - err = -NLE_BUG; \ + nlerr = -NLE_BUG; \ } \ goto out; \ } \ @@ -1119,7 +1123,7 @@ do { \ int nl_recvmsgs (struct nl_sock *sk, const struct nl_cb *cb) { - int n, err = 0, multipart = 0, interrupted = 0, nrecv = 0; + int n, nlerr = 0, multipart = 0, interrupted = 0, nrecv = 0; gs_free unsigned char *buf = NULL; struct nlmsghdr *hdr; struct sockaddr_nl nla = { 0 }; @@ -1146,7 +1150,7 @@ continue_reading: /* Only do sequence checking if auto-ack mode is enabled */ if (! (sk->s_flags & NL_NO_AUTO_ACK)) { if (hdr->nlmsg_seq != sk->s_seq_expect) { - err = -NLE_SEQ_MISMATCH; + nlerr = -NLE_SEQ_MISMATCH; goto out; } } @@ -1192,7 +1196,7 @@ continue_reading: * quit parsing. The user may overrule this action by retuning * NL_SKIP or NL_PROCEED (dangerous) */ else if (hdr->nlmsg_type == NLMSG_OVERRUN) { - err = -NLE_MSG_OVERFLOW; + nlerr = -NLE_MSG_OVERFLOW; goto out; } @@ -1205,25 +1209,27 @@ continue_reading: * is to stop parsing. The user may overrule * this action by returning NL_SKIP or * NL_PROCEED (dangerous) */ - err = -NLE_MSG_TRUNC; + nlerr = -NLE_MSG_TRUNC; goto out; } if (e->error) { /* Error message reported back from kernel. */ if (cb->err_cb) { - err = cb->err_cb (&nla, e, - cb->err_arg); - if (err < 0) + /* the returned value here must be either a negative + * netlink error number, or one of NL_SKIP, NL_STOP, NL_OK. */ + nlerr = cb->err_cb (&nla, e, + cb->err_arg); + if (nlerr < 0) goto out; - else if (err == NL_SKIP) + else if (nlerr == NL_SKIP) goto skip; - else if (err == NL_STOP) { - err = -nl_syserr2nlerr (e->error); + else if (nlerr == NL_STOP) { + nlerr = -nl_syserr2nlerr (e->error); goto out; } - nm_assert (err == NL_OK); + nm_assert (nlerr == NL_OK); } else { - err = -nl_syserr2nlerr (e->error); + nlerr = -nl_syserr2nlerr (e->error); goto out; } } else @@ -1235,7 +1241,7 @@ continue_reading: NL_CB_CALL (cb, valid, msg); } skip: - err = 0; + nlerr = 0; hdr = nlmsg_next (hdr, &n); } @@ -1248,14 +1254,14 @@ skip: } stop: - err = 0; + nlerr = 0; out: if (interrupted) - err = -NLE_DUMP_INTR; + nlerr = -NLE_DUMP_INTR; - nm_assert (err <= 0); - return err ?: nrecv; + nm_assert (nlerr <= 0); + return nlerr ?: nrecv; } int diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h index 187685d824..1fccddb997 100644 --- a/src/platform/nm-netlink.h +++ b/src/platform/nm-netlink.h @@ -52,32 +52,48 @@ #endif static inline int -nl_errno (int err) +nl_errno (int nlerr) { - /* the error codes from our netlink implementation are plain errno - * extended with our own error in a particular range starting from - * _NLE_BASE. + /* Normalizes an netlink error to be positive. Various API returns negative + * error codes, and this function converts the negative value to its + * positive. * - * However, often we encode errors as negative values. This function - * normalizes the error and returns its positive value. */ - return err >= 0 - ? err - : ((err == G_MININT) ? NLE_BUG : -err); + * It's very similar to nm_errno(), but not exactly. The difference is that + * nm_errno() is for plain errno, while nl_errno() is for netlink error numbers. + * Yes, netlink error number are ~almost~ the same as errno, except that a particular + * range (_NLE_BASE, _NLE_BASE_END) is reserved. The difference between the two + * functions is only how G_MININT is mapped. + * + * See also nl_syserr2nlerr() below. */ + return nlerr >= 0 + ? nlerr + : ((nlerr == G_MININT) ? NLE_BUG : -nlerr); } static inline int -nl_syserr2nlerr (int err) +nl_syserr2nlerr (int errsv) { - if (err == G_MININT) + /* this maps a native errno to a (always non-negative) netlink error number. + * + * Note that netlink error numbers are embedded into the range of regular + * errno. The only difference is, that netlink error numbers reserve a + * range (_NLE_BASE, _NLE_BASE_END) for their own purpose. + * + * That means, converting an errno to netlink error number means in + * most cases just returning itself (negative values are normalized + * to be positive). Only values G_MININT and [_NLE_BASE, _NLE_BASE_END] + * are coerced to the special value NLE_NATIVE_ERRNO, as they cannot + * otherwise be represented in netlink error number domain. */ + if (errsv == G_MININT) return NLE_NATIVE_ERRNO; - if (err < 0) - err = -err; - return (err >= _NLE_BASE && err < _NLE_BASE_END) + if (errsv < 0) + errsv = -errsv; + return (errsv >= _NLE_BASE && errsv < _NLE_BASE_END) ? NLE_NATIVE_ERRNO - : err; + : errsv; } -const char *nl_geterror (int err); +const char *nl_geterror (int nlerr); /*****************************************************************************/ From 1fad494c3464ded6c59cd321a2c6e5f88064e757 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sat, 8 Sep 2018 11:52:46 +0200 Subject: [PATCH 19/63] gitignore: Fix *.stamp ignore ripgrep complains about the invalid `**`. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 968c444584..f71f1f88a8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ *.la *-*.gir *.typelib -**.stamp +*.stamp .dirstamp *-enum-types.[ch] *-glue.h From 5b042b16ca19931df887709570b13a4dada374ba Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sat, 8 Sep 2018 12:09:30 +0200 Subject: [PATCH 20/63] meson: Use libexecdir for dnssec-trigger-script fallback Use an `if` to keep line length down. --- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 9374136f78..5ff8d9546c 100644 --- a/meson.build +++ b/meson.build @@ -660,7 +660,11 @@ config_h.set_quoted('DNSMASQ_PATH', find_program(get_option('dnsmasq')).path()) # dnssec-trigger-script path dnssec_trigger_script = find_program(get_option('dnssec_trigger'), required: false) -config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', (dnssec_trigger_script.found() ? dnssec_trigger_script.path() : '/usr/libexec/dnssec-trigger-script')) +if dnssec_trigger_script.found() + config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', dnssec_trigger_script.path()) +else + config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', join_paths(nm_libexecdir, 'dnssec-trigger-script')) +endif # system CA certificates path system_ca_path = get_option('system_ca_path') From 4bfd0bab0d15d0b5d15f53c5b76e980a1aab1efd Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sat, 8 Sep 2018 12:01:00 +0200 Subject: [PATCH 21/63] meson: Fix libnm-util build This was broken by e01f7f2c6dccad7a950c1af4c31737a9628e809e. Port the commit's changes from libnm to libnm-util. --- libnm-util/meson.build | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/libnm-util/meson.build b/libnm-util/meson.build index da807bc6a8..44d9e73579 100644 --- a/libnm-util/meson.build +++ b/libnm-util/meson.build @@ -57,7 +57,6 @@ libnm_utils_enum = gnome.mkenums( sources = files( 'crypto.c', - 'crypto_' + crypto + '.c', 'nm-connection.c', 'nm-param-spec-specialized.c', 'nm-setting-8021x.c', @@ -93,7 +92,6 @@ sources = files( sources += shared_files_libnm_util deps = [ - crypto_dep, dbus_dep, dbus_glib_dep, shared_dep, @@ -108,6 +106,32 @@ cflags = common_cflags + [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_util_name) ] +if crypto_gnutls_dep.found() + libnm_util_crypto_gnutls = static_library( + 'nm-util-crypto-gnutls', + sources: [ 'crypto_gnutls.c' ], + dependencies: deps + [ crypto_gnutls_dep ], + c_args: cflags + ) +endif + +if crypto_nss_dep.found() + libnm_util_crypto_nss = static_library( + 'nm-util-crypto-nss', + sources: [ 'crypto_nss.c' ], + dependencies: deps + [ crypto_nss_dep ], + c_args: cflags + ) +endif + +if crypto == 'gnutls' + libnm_util_crypto = libnm_util_crypto_gnutls +elif crypto == 'nss' + libnm_util_crypto = libnm_util_crypto_nss +else + error('bug') +endif + linker_script = join_paths(meson.current_source_dir(), 'libnm-util.ver') libnm_util = shared_library( @@ -120,6 +144,7 @@ libnm_util = shared_library( '-Wl,--version-script,@0@'.format(linker_script), ], link_depends: linker_script, + link_with: libnm_util_crypto, install: true ) @@ -174,11 +199,9 @@ test( sources = files( 'crypto.c', - 'crypto_' + crypto + '.c' ) deps = [ - crypto_dep, shared_dep ] @@ -186,6 +209,7 @@ libtest_crypto = static_library( 'test-crypto', sources: sources, dependencies: deps, + link_with: libnm_util_crypto, c_args: cflags ) From 44f14e969bd4bf56efac28d01c0f9823abee0e5c Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sat, 8 Sep 2018 12:58:57 +0200 Subject: [PATCH 22/63] meson: Fix vapi build Apparently vapigen can't find the NetworkManager-1.0.gir belonging to libnm-util.vapi. --- vapi/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vapi/meson.build b/vapi/meson.build index 835a0b9aaf..37e5090c5a 100644 --- a/vapi/meson.build +++ b/vapi/meson.build @@ -18,12 +18,11 @@ if enable_libnm_glib install: true ) - packages += libnm_util_vapi - gnome.generate_vapi( libnm_glib_name, sources: libnm_glib_gir[0], - packages: packages, + packages: packages + [libnm_util_vapi], + gir_dirs: [join_paths(meson.current_build_dir(), '..', 'libnm-util')], install: true ) endif From e8934059279106728cd4255ab4f9203f83a3ede2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Sep 2018 15:33:46 +0200 Subject: [PATCH 23/63] travis: enabling building more optional components during CI A few components are still disabled. Most notably, team support which is not available on Ubuntu 14.04 (trusty). All other components which are disabled are bugs in our build tools. It should be possible to enable them, but currently breaks on travis. Those needs additional fixes. In particular, the DHCP plugins and ifcfg-rh plugin with meson. Also, netconfig plugin with autotools requires that the path exists. --- .travis.yml | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5108aee11..0458b63c53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,9 +97,19 @@ script: -D introspection=false \ -D qt=false \ -D crypto=$CRYPTO \ - \ -D docs=true \ \ + -D libnm_glib=true \ + -D iwd=true \ + -D ofono=true \ + -D teamdctl=false \ + \ + -D dhcpcanon=/bin/true \ + -D dhclient=/bin/true \ + \ + -D netconfig=true \ + -D resolvconf=true \ + \ -D ifcfg_rh=false \ -D ibft=true \ -D ifupdown=true \ @@ -118,7 +128,30 @@ script: NOCONFIGURE=1 ./autogen.sh && mkdir ./build && pushd ./build && - ../configure --prefix="$PWD/INST" --with-systemd-logind=no --enable-more-warnings=no --enable-ifcfg-rh --enable-config-plugin-ibft --enable-ifupdown --enable-tests --with-crypto=$CRYPTO && + ../configure \ + --prefix="$PWD/INST" \ + --enable-gtk-doc=yes \ + --with-systemd-logind=no \ + --enable-more-warnings=no \ + --enable-tests=yes \ + --with-crypto=$CRYPTO \ + \ + --with-libnm-glib=yes \ + --with-iwd=yes \ + --with-ofono=yes \ + --enable-teamdctl=no \ + \ + --with-dhcpcanon=yes \ + --with-dhcpcd=yes \ + --with-dhclient=yes \ + \ + --with-netconfig=no \ + --with-resolvconf=yes \ + \ + --enable-ifcfg-rh=yes \ + --enable-config-plugin-ibft=yes \ + --enable-ifupdown=yes \ + && make -j4 && if [ "$CC" == gcc ]; then sudo locale-gen pl_PL.UTF-8 && From d8a972c575c44b39dd170ab58d6a8937f7893d3f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 12 Sep 2018 18:27:06 +0200 Subject: [PATCH 24/63] contrib/rpm: fix mode of ghost ifup/ifdown files Set the execution bit on /usr/sbin/{ifup,ifdown} ghost files to match the mode of same files installed by initscripts. Otherwise, they will appear as changed according to rpm verify: .M....... g /usr/sbin/ifdown .M....... g /usr/sbin/ifup when the alternatives mechanism is not in place. # ll /usr/sbin/if{up,down} -rwxr-xr-x. 1 root root 1651 Aug 24 06:23 /usr/sbin/ifdown -rwxr-xr-x. 1 root root 5010 Aug 24 06:23 /usr/sbin/ifup https://bugzilla.redhat.com/show_bug.cgi?id=1626517 --- contrib/fedora/rpm/NetworkManager.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 18edf64a9c..f24cc8b70f 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -685,9 +685,9 @@ fi %config(noreplace) %{_sysconfdir}/%{name}/NetworkManager.conf %{_bindir}/nm-online %{_libexecdir}/nm-ifup -%ghost %{_sbindir}/ifup +%ghost %attr(755, root, root) %{_sbindir}/ifup %{_libexecdir}/nm-ifdown -%ghost %{_sbindir}/ifdown +%ghost %attr(755, root, root) %{_sbindir}/ifdown %{_libexecdir}/nm-dhcp-helper %{_libexecdir}/nm-dispatcher %{_libexecdir}/nm-iface-helper From 220dea0948a22dfbdddb91ed76a23ae20d2c5810 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:52:09 +0200 Subject: [PATCH 25/63] build: meson: fix setting iptables/dnsmasq/dnssec-trigger paths Handle the iptables, dnsmasq and dnssec-trigger paths in the same way through common code. The path set by user must be accepted as is, even if does not exist, because this is a requirement for cross-compilation. When user does not specify a path, search a predefined set of paths and fall back to an hardcoded one. --- meson.build | 37 ++++++++++++++++++++++++++----------- meson_options.txt | 6 +++--- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/meson.build b/meson.build index 5ff8d9546c..0f9fe088aa 100644 --- a/meson.build +++ b/meson.build @@ -652,19 +652,34 @@ endif config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default) -# iptables path -config_h.set_quoted('IPTABLES_PATH', find_program(get_option('iptables')).path()) +# external misc tools paths +default_paths = ['/sbin', '/usr/sbin'] +dnssec_ts_paths = ['/usr/local/libexec', + '/usr/local/lib', + '/usr/local/lib/dnssec-trigger', + '/usr/libexec', + '/usr/lib', + '/usr/lib/dnssec-trigger'] -# dnsmasq path -config_h.set_quoted('DNSMASQ_PATH', find_program(get_option('dnsmasq')).path()) +# 0: cmdline option, 1: paths, 2: fallback, 3: config.h option +progs = [['iptables', default_paths, '/sbin/iptables'], + ['dnsmasq', default_paths, ''], + ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script'), 'DNSSEC_TRIGGER_SCRIPT'], + ] -# dnssec-trigger-script path -dnssec_trigger_script = find_program(get_option('dnssec_trigger'), required: false) -if dnssec_trigger_script.found() - config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', dnssec_trigger_script.path()) -else - config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', join_paths(nm_libexecdir, 'dnssec-trigger-script')) -endif +foreach prog : progs + path = get_option(prog[0]) + if path == '' + search_paths = [ prog[0] ] + foreach path : prog[1] + search_paths += (path + '/' + prog[0]) + endforeach + exe = find_program(search_paths, required : false) + path = exe.found() ? exe.path() : prog[2] + endif + name = prog.length() > 3 ? prog[3] : (prog[0].to_upper() + '_PATH') + config_h.set_quoted(name, path) +endforeach # system CA certificates path system_ca_path = get_option('system_ca_path') diff --git a/meson_options.txt b/meson_options.txt index 25ec7ae4e9..6bd1eec3c9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,9 +7,9 @@ option('dbus_ifaces_dir', type: 'string', value: '', description: 'where D-Bus i option('dbus_sys_dir', type: 'string', value: '', description: 'where D-Bus system service directory is') option('polkit_dir', type: 'string', value: '', description: 'where PolicyKit policy directory is') option('kernel_firmware_dir', type: 'string', value: '/lib/firmware', description: 'where kernel firmware directory is (default is /lib/firmware)') -option('iptables', type: 'array', value: ['iptables', '/sbin/iptables', '/usr/sbin/iptables'], description: 'path to iptables') -option('dnsmasq', type: 'array', value: ['dnsmasq', '/sbin/dnsmasq', '/usr/sbin/dnsmasq'], description: 'path to dnsmasq') -option('dnssec_trigger', type: 'array', value: ['dnssec-trigger-script', '/usr/local/libexec/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger/dnssec-trigger-script', '/usr/libexec/dnssec-trigger-script', '/usr/lib/dnssec-trigger-script', '/usr/lib/dnssec-trigger/dnssec-trigger-script'], description: 'path to unbound dnssec-trigger-script') +option('iptables', type: 'string', value: '', description: 'path to iptables') +option('dnsmasq', type: 'string', value: '', description: 'path to dnsmasq') +option('dnssec_trigger', type: 'string', value: '', description: 'path to unbound dnssec-trigger-script') # platform option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string') From 794e499ab8b8825d9794d7c2e320b10909fc3ba3 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:52:59 +0200 Subject: [PATCH 26/63] build: meson: fix pppd path Allow specifying a non-existent path. --- meson.build | 13 ++++++++----- meson_options.txt | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 0f9fe088aa..cfc82cad88 100644 --- a/meson.build +++ b/meson.build @@ -505,11 +505,14 @@ enable_ppp = get_option('ppp') if enable_ppp assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required') - locations = get_option('pppd') - pppd = find_program(locations, required: false) - assert(pppd.found(), 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it') + pppd_path = get_option('pppd') + if pppd_path == '' + pppd = find_program('pppd', '/sbin/pppd', '/usr/sbin/pppd', required: false) + assert(pppd.found(), 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it') + pppd_path = pppd.path() + endif - config_h.set_quoted('PPPD_PATH', pppd.path()) + config_h.set_quoted('PPPD_PATH', pppd_path) pppd_plugin_dir = get_option('pppd_plugin_dir') if pppd_plugin_dir == '' @@ -984,7 +987,7 @@ output += ' wifi: ' + enable_wifi.to_string() + '\n' output += ' iwd: ' + enable_iwd.to_string() + '\n' output += ' pppd: ' + enable_ppp.to_string() if enable_ppp - output += ' ' + pppd.path() + output += ' ' + pppd_path endif output += '\n' output += ' modemmanager-1: ' + enable_modem_manager.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 6bd1eec3c9..82971e5527 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -30,7 +30,7 @@ option('wext', type: 'boolean', value: true, description: 'Enable or disable Lin option('wifi', type: 'boolean', value: true, description: 'enable Wi-Fi support') option('iwd', type: 'boolean', value: false, description: 'enable iwd support (experimental)') option('ppp', type: 'boolean', value: true, description: 'enable PPP/PPPoE support') -option('pppd', type: 'array', value: ['pppd', '/sbin/pppd', '/usr/sbin/pppd'], description: 'path to pppd binary') +option('pppd', type: 'string', value: '', description: 'path to pppd binary') option('pppd_plugin_dir', type: 'string', value: '', description: 'path to the pppd plugins directory') option('modem_manager', type: 'boolean', value: true, description: 'Enable new ModemManager1 interface support') option('ofono', type: 'boolean', value: false, description: 'Enable oFono support (experimental)') From 9e61ea70402b5d8140de512bdcf84252fcb0d11c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:53:40 +0200 Subject: [PATCH 27/63] build: remove check on dhclient version dhclient 4.0 was released more than 10 years ago. I think it is reasonable to expect that nobody is using an older version today. https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=shortlog;h=refs/tags/v4_0_0 --- configure.ac | 6 +----- meson.build | 5 ----- meson_options.txt | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index d53335ac24..23004cd1fe 100644 --- a/configure.ac +++ b/configure.ac @@ -842,7 +842,7 @@ AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes") # DHCP client support AC_ARG_WITH([dhclient], - AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support])) + AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support])) if test "$with_dhclient" != "no"; then with_dhclient_="$with_dhclient" AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin) @@ -851,10 +851,6 @@ if test "$with_dhclient" != "no"; then AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient]) with_dhclient=/usr/sbin/dhclient fi - else - if ! $with_dhclient --version 2>&1 | grep -q "^isc-dhclient-4\."; then - AC_MSG_WARN([Seems version of dhclient $with_dhclient is too old, version 4.x or newer is required.]) - fi fi fi if test "$with_dhclient" != "no"; then diff --git a/meson.build b/meson.build index cfc82cad88..f23f4c388f 100644 --- a/meson.build +++ b/meson.build @@ -560,11 +560,6 @@ if enable_dhclient enable_dhclient = dhclient.found() if enable_dhclient - res = run_command(dhclient, '--version') - # FIXME: dhcp outputs the version string through stderr!? - if not res.stderr().strip().contains('isc-dhclient-4.') - message('Seems version of dhclient ' + dhclient.path() + ' is too old, version 4.x or newer is required') - endif config_h.set_quoted('DHCLIENT_PATH', dhclient.path()) endif endif diff --git a/meson_options.txt b/meson_options.txt index 82971e5527..73e0602c4f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -55,7 +55,7 @@ option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'fil # dhcp clients option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') -option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient 4.x support') +option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient support') option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd 4.x support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') option('dhcpcd_supports_ipv6', type: 'boolean', value: true, description: 'Whether using dhcpcd >= 6.x which has IPv6 support') From e0c49d7341a0329e2c40e25fee5d3ce249f5ebe6 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:54:07 +0200 Subject: [PATCH 28/63] build: remove check on dhcpcd version number dhcpcd version 6, the first supporting IPv6, was released more than 5 years ago. Remove all checks on version number and IPv6 support. --- config.h.meson | 3 --- configure.ac | 32 -------------------------------- meson.build | 19 ------------------- meson_options.txt | 3 +-- src/dhcp/nm-dhcp-dhcpcd.c | 2 -- 5 files changed, 1 insertion(+), 58 deletions(-) diff --git a/config.h.meson b/config.h.meson index ce77952bec..07129b2e00 100644 --- a/config.h.meson +++ b/config.h.meson @@ -10,9 +10,6 @@ /* Define to path of dhcpcd binary */ #mesondefine DHCPCD_PATH -/* Define if dhcpcd supports IPv6 (6.x+) */ -#mesondefine DHCPCD_SUPPORTS_IPV6 - /* Define to path of dnsmasq binary */ #mesondefine DNSMASQ_PATH diff --git a/configure.ac b/configure.ac index 23004cd1fe..1c9be4b87c 100644 --- a/configure.ac +++ b/configure.ac @@ -862,10 +862,6 @@ fi AC_ARG_WITH([dhcpcd], AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support])) -AC_ARG_WITH([dhcpcd-supports-ipv6], - AS_HELP_STRING([--with-dhcpcd-supports-ipv6=yes|no|auto], - [Whether using dhcpcd >= 6.x which has IPv6 support]), - [with_dhcpcd_supports_ipv6=$withval], [with_dhcpcd_supports_ipv6=auto]) if test "$with_dhcpcd" != "no"; then with_dhcpcd_="$with_dhcpcd" AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin) @@ -873,36 +869,9 @@ if test "$with_dhcpcd" != "no"; then if test "$with_dhcpcd_" == yes; then AC_MSG_WARN([dhcpcd not found, assume path /usr/sbin/dhcpcd]) with_dhcpcd=/usr/sbin/dhcpcd - if test "$with_dhcpcd_supports_ipv6" == auto; then - with_dhcpcd_supports_ipv6=yes - fi - fi - else - if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[456789]]\."; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd is too old, version 4.x or newer is required]) fi fi fi -if test "$with_dhcpcd" != "no"; then - if $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[6789]]\."; then - if test "$with_dhcpcd_supports_ipv6" == no; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd supports IPv6, but compiling --with-dhcpcd-supports-ipv6=no]) - else - with_dhcpcd_supports_ipv6=yes - fi - else - if test "$with_dhcpcd_supports_ipv6" == yes; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd does not support IPv6, but compiling --with-dhcpcd-supports-ipv6=yes]) - else - with_dhcpcd_supports_ipv6=no - fi - fi - if test "$with_dhcpcd_supports_ipv6" != no; then - AC_DEFINE(DHCPCD_SUPPORTS_IPV6, 1, [Define if dhcpcd supports IPv6 (6.x+)]) - fi -else - with_dhcpcd_supports_ipv6=no -fi if test "$with_dhcpcd" != "no"; then AC_DEFINE(WITH_DHCPCD, 1, [Define if you have dhcpcd]) AC_SUBST(DHCPCD_PATH, $with_dhcpcd) @@ -1380,7 +1349,6 @@ echo "DHCP clients (default $config_dhcp_default):" echo " dhcpcanon: $with_dhcpcanon" echo " dhclient: $with_dhclient" echo " dhcpcd: $with_dhcpcd" -echo " dhcpcd-supports-ipv6: $with_dhcpcd_supports_ipv6" echo echo "Miscellaneous:" diff --git a/meson.build b/meson.build index f23f4c388f..14a655d3cd 100644 --- a/meson.build +++ b/meson.build @@ -567,29 +567,11 @@ config_h.set10('WITH_DHCLIENT', enable_dhclient) locations = get_option('dhcpcd') enable_dhcpcd = (locations != ['no']) -enable_dhcpcd_supports_ipv6 = false if enable_dhcpcd dhcpcd = find_program(locations, required: false) enable_dhcpcd = dhcpcd.found() if enable_dhcpcd - res = run_command(dhcpcd, '--version').stdout().strip() - dhcpcd_version = res.split(' ')[1] - if not dhcpcd_version.version_compare('> 4') - message('Seems version of dhcpcd ' + dhcpcd.path() + ' is too old, version 4.x or newer is required') - endif - - enable_dhcpcd_supports_ipv6 = get_option('dhcpcd_supports_ipv6') - if dhcpcd_version.version_compare('> 6') - if not enable_dhcpcd_supports_ipv6 - message('Seems version of dhcpcd ' + dhcpcd.path() + ' supports IPv6, but compiling without IPv6 support.') - endif - else - if enable_dhcpcd_supports_ipv6 - message('Seems version of dhcpcd ' + dhcpcd.path() +' does not support IPv6, but compiling with IPv6 support.') - endif - endif - config_h.set('DHCPCD_SUPPORTS_IPV6', enable_dhcpcd_supports_ipv6) config_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) endif endif @@ -1025,7 +1007,6 @@ if enable_dhcpcd output += ' ' + dhcpcd.path() endif output += '\n' -output += ' dhcpcd-supports-ipv6: ' + enable_dhcpcd_supports_ipv6.to_string() + '\n' output += '\nMiscellaneous:\n' output += ' have introspection: ' + enable_introspection.to_string() + '\n' output += ' build documentation and manpages: ' + enable_docs.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 73e0602c4f..294c955a83 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -56,9 +56,8 @@ option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'fil # dhcp clients option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient support') -option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd 4.x support') +option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') -option('dhcpcd_supports_ipv6', type: 'boolean', value: true, description: 'Whether using dhcpcd >= 6.x which has IPv6 support') # miscellaneous option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build') diff --git a/src/dhcp/nm-dhcp-dhcpcd.c b/src/dhcp/nm-dhcp-dhcpcd.c index de04bbda86..98ab5342ce 100644 --- a/src/dhcp/nm-dhcp-dhcpcd.c +++ b/src/dhcp/nm-dhcp-dhcpcd.c @@ -133,13 +133,11 @@ ip4_start (NMDhcpClient *client, g_ptr_array_add (argv, (gpointer) "-c"); /* Set script file */ g_ptr_array_add (argv, (gpointer) nm_dhcp_helper_path); -#ifdef DHCPCD_SUPPORTS_IPV6 /* IPv4-only for now. NetworkManager knows better than dhcpcd when to * run IPv6, and dhcpcd's automatic Router Solicitations cause problems * with devices that don't expect them. */ g_ptr_array_add (argv, (gpointer) "-4"); -#endif hostname = nm_dhcp_client_get_hostname (client); From 087c367d626a4c5b58dae5bc11670f3ab34b0e44 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:55:54 +0200 Subject: [PATCH 29/63] build: move paths of dhcp clients from config-extra.h to config.h Some path variable like $(bindir), $(datadir), etc. are special for autotools and must be handled separately through config-extra.h. But dhcp path variables are just normal variables defined through the configure script and should go into config.h. --- Makefile.am | 3 --- config-extra.h.meson | 3 --- configure.ac | 6 +++--- meson.build | 9 --------- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index c1615108a1..3490aed28e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -120,9 +120,6 @@ config-extra.h: Makefile echo "/* Generated by Makefile.am */" >$@ && \ echo "#define BINDIR \"$(bindir)\"" >>$@ && \ echo "#define DATADIR \"$(datadir)\"" >>$@ && \ - echo "#define DHCLIENT_PATH \"$(DHCLIENT_PATH)\"" >>$@ && \ - echo "#define DHCPCANON_PATH \"$(DHCPCANON_PATH)\"" >>$@ && \ - echo "#define DHCPCD_PATH \"$(DHCPCD_PATH)\"" >>$@ && \ echo "#define LIBEXECDIR \"$(libexecdir)\"" >>$@ && \ echo "#define LOCALSTATEDIR \"$(localstatedir)\"" >>$@ && \ echo "#define NMCONFDIR \"$(nmconfdir)\"" >>$@ && \ diff --git a/config-extra.h.meson b/config-extra.h.meson index dbe077d4fa..34c962fdd5 100644 --- a/config-extra.h.meson +++ b/config-extra.h.meson @@ -1,8 +1,5 @@ #mesondefine BINDIR #mesondefine DATADIR -#mesondefine DHCLIENT_PATH -#mesondefine DHCPCANON_PATH -#mesondefine DHCPCD_PATH #mesondefine LIBEXECDIR #mesondefine LOCALSTATEDIR #mesondefine NMCONFDIR diff --git a/configure.ac b/configure.ac index 1c9be4b87c..4cbe1cfc74 100644 --- a/configure.ac +++ b/configure.ac @@ -822,7 +822,7 @@ if test "$with_dhcpcanon" != "no"; then fi if test "$with_dhcpcanon" != "no"; then AC_DEFINE(WITH_DHCPCANON, 1, [Define if you have dhcpcanon]) - AC_SUBST(DHCPCANON_PATH, $with_dhcpcanon) + AC_DEFINE_UNQUOTED(DHCPCANON_PATH, "$with_dhcpcanon", [Define path to dhcpcanon]) else AC_DEFINE(WITH_DHCPCANON, 0, [Define if you have dhcpcanon]) fi @@ -855,7 +855,7 @@ if test "$with_dhclient" != "no"; then fi if test "$with_dhclient" != "no"; then AC_DEFINE(WITH_DHCLIENT, 1, [Define if you have dhclient]) - AC_SUBST(DHCLIENT_PATH, $with_dhclient) + AC_DEFINE_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient]) else AC_DEFINE(WITH_DHCLIENT, 0, [Define if you have dhclient]) fi @@ -874,7 +874,7 @@ if test "$with_dhcpcd" != "no"; then fi if test "$with_dhcpcd" != "no"; then AC_DEFINE(WITH_DHCPCD, 1, [Define if you have dhcpcd]) - AC_SUBST(DHCPCD_PATH, $with_dhcpcd) + AC_DEFINE_UNQUOTED(DHCPCD_PATH, "$with_dhcpcd", [Define path to dhcpcd]) else AC_DEFINE(WITH_DHCPCD, 0, [Define if you have dhcpcd]) fi diff --git a/meson.build b/meson.build index 14a655d3cd..469739e854 100644 --- a/meson.build +++ b/meson.build @@ -885,15 +885,6 @@ config_extra_h = configuration_data() config_extra_h.set_quoted('BINDIR', nm_bindir) config_extra_h.set_quoted('DATADIR', nm_datadir) -if enable_dhclient - config_extra_h.set_quoted('DHCLIENT_PATH', dhclient.path()) -endif -if enable_dhcpcanon - config_extra_h.set_quoted('DHCPCANON_PATH', dhcpcanon.path()) -endif -if enable_dhcpcd - config_extra_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) -endif config_extra_h.set_quoted('LIBEXECDIR', nm_libexecdir) config_extra_h.set_quoted('LOCALSTATEDIR', nm_localstatedir) config_extra_h.set_quoted('NMCONFDIR', nm_pkgconfdir) From 36b0e46146ec7f67acb365e83e306d781f198d1c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 17:02:59 +0200 Subject: [PATCH 30/63] build: meson: uniform handling of dhcp client paths Handle all dhcp client paths through the same code. --- meson.build | 95 ++++++++++++++++------------------------------- meson_options.txt | 6 +-- 2 files changed, 34 insertions(+), 67 deletions(-) diff --git a/meson.build b/meson.build index 469739e854..bac71fdf9f 100644 --- a/meson.build +++ b/meson.build @@ -539,58 +539,39 @@ config_h.set10('WITH_BLUEZ5_DUN', enable_bluez5_dun) enable_ofono = get_option('ofono') config_h.set10('WITH_OFONO', enable_ofono) -# DHCP client support with dhcpcanon -locations = get_option('dhcpcanon') -enable_dhcpcanon = (locations != ['no']) -if enable_dhcpcanon - dhcpcanon = find_program(locations, required: false) - enable_dhcpcanon = dhcpcanon.found() - - if enable_dhcpcanon - config_h.set_quoted('DHCPCANON_PATH', dhcpcanon.path()) - endif -endif -config_h.set10('WITH_DHCPCANON', enable_dhcpcanon) - # DHCP client support -locations = get_option('dhclient') -enable_dhclient = (locations != ['no']) -if enable_dhclient - dhclient = find_program(locations, required: false) - enable_dhclient = dhclient.found() - - if enable_dhclient - config_h.set_quoted('DHCLIENT_PATH', dhclient.path()) - endif -endif -config_h.set10('WITH_DHCLIENT', enable_dhclient) - -locations = get_option('dhcpcd') -enable_dhcpcd = (locations != ['no']) -if enable_dhcpcd - dhcpcd = find_program(locations, required: false) - enable_dhcpcd = dhcpcd.found() - - if enable_dhcpcd - config_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) - endif -endif -config_h.set10('WITH_DHCPCD', enable_dhcpcd) - config_dhcp_default = get_option('config_dhcp_default') -if config_dhcp_default == 'dhcpcanon' and not enable_dhcpcanon - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - -if config_dhcp_default == 'dhclient' and not enable_dhclient - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - -if config_dhcp_default == 'dhcpcd' and not enable_dhcpcd - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default) +dhcp_summary = '' +foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ] + client_path = get_option(client) + client_enable = (client_path != 'no') + if client_enable + if client_path == '' + client_prog = find_program(client, + '/sbin/' + client, + '/usr/sbin/pppd/' + client, + '/usr/local/sbin/' + client, + required : false) + if client_prog.found() + client_path = client_prog.path() + else + client_path = '/usr/sbin/' + client + message('@0@ not found, assume path @1@'.format(client, client_path)) + endif + endif + config_h.set_quoted(client.to_upper() + '_PATH', client_path) + endif + if config_dhcp_default == client and not client_enable + error(client + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') + endif + config_h.set10('WITH_' + client.to_upper(), client_enable) + dhcp_summary += (' ' + client + ': ' + client_enable.to_string()) + if (client_enable) + dhcp_summary += (' ' + client_path) + endif + dhcp_summary += '\n' +endforeach # OpenVSwitch integration enable_ovs = get_option('ovs') @@ -982,21 +963,7 @@ if enable_netconfig endif output += '\n' output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n' -output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' -output += ' dhcpcanon: ' + enable_dhcpcanon.to_string() -if enable_dhcpcanon - output += ' ' + dhcpcanon.path() -endif -output += '\n' -output += ' dhclient: ' + enable_dhclient.to_string() -if enable_dhclient - output += ' ' + dhclient.path() -endif -output += '\n' -output += ' dhcpcd: ' + enable_dhcpcd.to_string() -if enable_dhcpcd - output += ' ' + dhcpcd.path() -endif +output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary output += '\n' output += '\nMiscellaneous:\n' output += ' have introspection: ' + enable_introspection.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 294c955a83..5e5fd726ac 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -54,9 +54,9 @@ option('netconfig', type: 'array', value: ['netconfig', '/sbin/netconfig', '/usr option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'file', 'netconfig', 'resolvconf'], value: 'symlink', description: 'Configure default value for main.rc-manager setting') # dhcp clients -option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') -option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient support') -option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd support') +option('dhclient', type: 'string', value: '', description: 'Enable dhclient support') +option('dhcpcanon', type: 'string', value: '', description: 'Enable dhcpcanon support (experimental)') +option('dhcpcd', type: 'string', value: '', description: 'Enable dhcpcd support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') # miscellaneous From 2fd7559819c2de392d6964cacc0032d2066d0d6e Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 17:12:31 +0200 Subject: [PATCH 31/63] build: meson: uniform handling of rc managers Handle all rc managers paths through the same code. --- meson.build | 75 +++++++++++++++++++++-------------------------- meson_options.txt | 4 +-- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/meson.build b/meson.build index bac71fdf9f..433bc1a1f7 100644 --- a/meson.build +++ b/meson.build @@ -579,39 +579,41 @@ if enable_ovs assert(jansson_dep.found(), 'jansson is needed for OpenVSwitch integration. Use -Dovs=false to disable it') endif -# resolvconf and netconfig support -locations = get_option('resolvconf') -enable_resolvconf = (locations != ['no']) -if enable_resolvconf - resolvconf = find_program(locations, required: false) - enable_resolvconf = resolvconf.found() - - if enable_resolvconf - config_h.set_quoted('RESOLVCONF_PATH', resolvconf.path()) - endif -endif - -locations = get_option('netconfig') -enable_netconfig = (locations != ['no']) -if enable_netconfig - netconfig = find_program(locations, required: false) - enable_netconfig = netconfig.found() - - if enable_netconfig - config_h.set_quoted('NETCONFIG_PATH', netconfig.path()) - endif -endif - +# DNS resolv.conf managers config_dns_rc_manager_default = get_option('config_dns_rc_manager_default') -if config_dns_rc_manager_default == 'resolvconf' and not enable_resolvconf - error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') -endif - -if config_dns_rc_manager_default == 'netconfig' and not enable_netconfig - error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') -endif - config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default) +resolv_conf_summary = '' +foreach prog_name : ['resolvconf', 'netconfig'] + prog_path = get_option(prog_name) + prog_enable = (prog_path != 'no') + + if prog_enable + if prog_path == '' + prog = find_program(prog_name, + '/usr/' + prog_name, + '/usr/sbin/' + prog_name, + '/usr/local/sbin' + prog_name, + required : false) + if prog.found() + prog_path = prog.path() + else + prog_enable = false + endif + endif + endif + + if prog_enable + config_h.set_quoted(prog_name.to_upper() + '_PATH', prog_path) + elif config_dns_rc_manager_default == prog_name + error(prog_name + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') + endif + + resolv_conf_summary += ' ' + prog_name + ': ' + prog_enable.to_string() + if prog_enable + resolv_conf_summary += ' ' + prog_path + endif + resolv_conf_summary += '\n' +endforeach # external misc tools paths default_paths = ['/sbin', '/usr/sbin'] @@ -951,16 +953,7 @@ output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ') output += ' ibft: ' + enable_ibft.to_string() + '\n' output += ' ifcfg-rh: ' + enable_ifcfg_rh.to_string() + '\n' output += ' ifupdown: ' + enable_ifupdown.to_string() + '\n' -output += '\nHandlers for /etc/resolv.conf:\n' -output += ' resolvconf: ' + enable_resolvconf.to_string() -if enable_resolvconf - output += ' ' + resolvconf.path() -endif -output += '\n' -output += ' netconfig: ' + enable_netconfig.to_string() -if enable_netconfig - output += ' ' + netconfig.path() -endif +output += '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary output += '\n' output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n' output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary diff --git a/meson_options.txt b/meson_options.txt index 5e5fd726ac..7f06d53a71 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -49,8 +49,8 @@ option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') # handlers for resolv.conf -option('resolvconf', type: 'array', value: ['resolvconf', '/sbin/resolvconf', '/usr/sbin/resolvconf', '/usr/local/sbin/resolvconf'], description: 'Enable resolvconf support') -option('netconfig', type: 'array', value: ['netconfig', '/sbin/netconfig', '/usr/sbin/netconfig', '/usr/local/sbin/netconfig'], description: 'Enable SUSE netconfig support') +option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support') +option('netconfig', type: 'string', value: '', description: 'Enable SUSE netconfig support') option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'file', 'netconfig', 'resolvconf'], value: 'symlink', description: 'Configure default value for main.rc-manager setting') # dhcp clients From 8b313d4c549b33f0cff163f6fc0d951e7e9e480a Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 17:15:02 +0200 Subject: [PATCH 32/63] build: autotools: remove unused defines Remove AC_DEFINE()s that add unused entries to config.h. --- configure.ac | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/configure.ac b/configure.ac index 4cbe1cfc74..c2523504ef 100644 --- a/configure.ac +++ b/configure.ac @@ -603,9 +603,6 @@ if (test "${enable_teamdctl}" = "yes"); then fi # temporary bug workaround LIBTEAMDCTL_CFLAGS=`echo $LIBTEAMDCTL_CFLAGS | sed -e 's:/teamdctl.h::'` - AC_DEFINE(WITH_TEAMDCTL, 1, [Define if you have Teamd control support]) -else - AC_DEFINE(WITH_TEAMDCTL, 0, [Define if you have Teamd control support]) fi AM_CONDITIONAL(WITH_TEAMDCTL, test "${enable_teamdctl}" = "yes") @@ -674,16 +671,6 @@ if test "${have_crypto_nss}" = "yes"; then fi AM_CONDITIONAL(HAVE_CRYPTO_GNUTLS, test "${have_crypto_gnutls}" = 'yes') AM_CONDITIONAL(HAVE_CRYPTO_NSS, test "${have_crypto_nss}" = 'yes') -if test "${have_crypto_gnutls}" = 'yes'; then - AC_DEFINE(HAVE_CRYPTO_GNUTLS, 1, [Define if you have gnutls support]) -else - AC_DEFINE(HAVE_CRYPTO_GNUTLS, 0, [Define if you have gnutls support]) -fi -if test "${have_crypto_nss}" = 'yes'; then - AC_DEFINE(HAVE_CRYPTO_NSS, 1, [Define if you have nss support]) -else - AC_DEFINE(HAVE_CRYPTO_NSS, 0, [Define if you have nss support]) -fi AC_ARG_WITH(crypto, AS_HELP_STRING([--with-crypto=nss|gnutls], @@ -773,12 +760,6 @@ if (test "${with_modem_manager_1}" != "no"); then with_modem_manager_1="yes" fi fi - -if (test "${with_modem_manager_1}" = "yes"); then - AC_DEFINE(WITH_MODEM_MANAGER_1, 1, [Define if you have ModemManager1 support]) -else - AC_DEFINE(WITH_MODEM_MANAGER_1, 0, [Define if you have ModemManager1 support]) -fi AM_CONDITIONAL(WITH_MODEM_MANAGER_1, test "${with_modem_manager_1}" = "yes") # Bluez5 DUN support @@ -834,9 +815,6 @@ if test "${enable_ovs}" != "no"; then if test "$have_jansson" = "no"; then AC_MSG_ERROR(Jansson is required for ovs support) fi - AC_DEFINE(WITH_OPENVSWITCH, 1, [Define if you have OpenVSwitch support]) -else - AC_DEFINE(WITH_OPENVSWITCH, 0, [Define if you have OpenVSwitch support]) fi AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes") From bd556c8937d65b7828f6ec42725afc001aefebdb Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 10 Sep 2018 15:58:49 +0200 Subject: [PATCH 33/63] ifcfg-rh: fix build with meson The shared object was missing some files. --- src/settings/plugins/ifcfg-rh/meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 5d9689a52c..e4bce09b2a 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -18,7 +18,7 @@ libnmdbus_ifcfg_rh = static_library( dependencies: glib_dep, ) -sources = files( +core_sources = files( 'nm-inotify-helper.c', 'nms-ifcfg-rh-reader.c', 'nms-ifcfg-rh-utils.c', @@ -32,11 +32,11 @@ deps = [ libnms_ifcfg_rh_core = static_library( 'nms-ifcfg-rh-core', - sources: sources, + sources: core_sources, dependencies: deps, ) -sources = [dbus_sources] + files('nms-ifcfg-rh-connection.c') +sources = [dbus_sources] + core_sources + files('nms-ifcfg-rh-connection.c', 'nms-ifcfg-rh-plugin.c') libnm_settings_plugin_ifcfg_rh = shared_module( 'nm-settings-plugin-ifcfg-rh', From 5ebe5efa7adeb42ee4fbf6eb7e5409f12d244f2b Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 10 Sep 2018 16:26:57 +0200 Subject: [PATCH 34/63] build: add config-extra.h.meson to EXTRA_DIST Reported-by: Michael Biebl https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/22 --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 3490aed28e..f525a6d6e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4746,6 +4746,7 @@ EXTRA_DIST += \ meson_options.txt \ meson_post_install.py \ config.h.meson \ + config-extra.h.meson \ docs/meson.build \ \ po/meson.build \ From 9b4bc0824c1d8925f1ecfa4856757d322f030427 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 13:48:40 +0200 Subject: [PATCH 35/63] build: support meson builds in create-exports script --- Makefile.am | 2 +- tools/create-exports-NetworkManager.sh | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index f525a6d6e3..5b0feefa40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1850,7 +1850,7 @@ $(src_libNetworkManagerTest_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) ############################################################################### src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)" + $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-build "$(srcdir)" CLEANFILES += src/NetworkManager.ver diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh index 3c2494e1dc..7d359005b7 100755 --- a/tools/create-exports-NetworkManager.sh +++ b/tools/create-exports-NetworkManager.sh @@ -35,7 +35,7 @@ call_nm() { } get_symbols_nm () { - call_nm ./src/.libs/libNetworkManager.a | + call_nm ./src/${libs}libNetworkManager.a | sed -n 's/^[tTDGRBS] //p' | _sort } @@ -47,9 +47,9 @@ EOF } get_symbols_missing() { - (for f in $(find ./src/settings/plugins/*/.libs/ \ - ./src/devices/*/.libs/ \ - ./src/ppp/.libs/ -name '*.so'); do + (for f in $(find ./src/settings/plugins/*/${libs} \ + ./src/devices/*/${libs} \ + ./src/ppp/${libs} -name '*.so'); do call_nm "$f" | sed -n 's/^\([U]\) \(\(nm_\|nmp_\|_nm\|NM\|_NM\|c_siphash_\).*\)$/\2/p' done) | @@ -90,16 +90,25 @@ local: EOF } -test -f ./src/.libs/libNetworkManager.a || die "must be called from NetworkManager \$(top_builddir) after building the tree" +if [ -f "build.ninja" ]; then + from_meson=1 + libs= +else + libs=.libs/ +fi + +test -f ./src/${libs}libNetworkManager.a || die "must be called from NetworkManager top build dir after building the tree" case "$1" in rebuild) + [ -n "$from_meson" ] && die "can't do a build when called from meson" do_rebuild ;; build) + [ -n "$from_meson" ] && die "can't do a build when called from meson" do_build ;; - '--called-from-make') + --called-from-build) if test -z "${NM_BUILD_NO_CREATE_EXPORTS+x}"; then do_update else From dfa2a2b40c866bf7a5484b72639464c31b80e7da Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 14:12:10 +0200 Subject: [PATCH 36/63] build: meson: generate and use a linker script for NM binary Generate the NetworkManager.ver link script to link the NM binary so that unneeded symbol are unexported and can be dropped, reducing the binary size. Reported-by: Michael Biebl https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/33 --- src/meson.build | 80 ++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/src/meson.build b/src/meson.build index 83fc3eacaf..f46366a904 100644 --- a/src/meson.build +++ b/src/meson.build @@ -143,7 +143,7 @@ sources = files( 'nm-sleep-monitor.c' ) -deps = [ +nm_deps = [ dl_dep, libndp_dep, libudev_dep, @@ -153,70 +153,29 @@ deps = [ ] if enable_concheck - deps += libcurl_dep + nm_deps += libcurl_dep endif if enable_libaudit - deps += libaudit_dep + nm_deps += libaudit_dep endif if enable_libpsl - deps += libpsl_dep + nm_deps += libpsl_dep endif if enable_selinux - deps += selinux_dep + nm_deps += selinux_dep endif libnetwork_manager = static_library( nm_name, sources: sources, - dependencies: deps, + dependencies: nm_deps, c_args: cflags, link_with: [libnetwork_manager_base, libsystemd_nm] ) -ldflags = ['-rdynamic'] - -# FIXME: this doesn't work and it depends on libtool -''' -src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)" - -src_NetworkManager_LDFLAGS = \ - -rdynamic \ - -Wl,--version-script="src/NetworkManager.ver" - -nm = find_program('gcc-nm', 'nm') -create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') - -symbol_map_name = 'NetworkManager.ver' - -linker_script = custom_target( - symbol_map_name, - input: meson.source_root(), - output: symbol_map_name, - capture: true, - #command: ['NM=' + nm.path(), create_exports_networkmanager, '--called-from-make', '@INPUT@'] - command: [create_exports_networkmanager, '--called-from-make', '@INPUT@'] -) - -ldflags += '-Wl,--version-script,@0@'.format(linker_script) -''' - -network_manager = executable( - nm_name, - 'main.c', - dependencies: deps, - c_args: cflags, - link_with: libnetwork_manager, - link_args: ldflags, - #FIXME - #link_depends: linker_script, - install: true, - install_dir: nm_sbindir -) - deps = [ dl_dep, libndp_dep, @@ -287,3 +246,30 @@ endif subdir('devices') subdir('settings/plugins') + +# NetworkManager binary + +create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') +symbol_map_name = 'NetworkManager.ver' + +ver_script = custom_target( + symbol_map_name, + input: meson.source_root(), + output: symbol_map_name, + depends: [ libnetwork_manager, core_plugins ], + command: [create_exports_networkmanager, '--called-from-build', '@INPUT@'] +) + +ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())] + +network_manager = executable( + nm_name, + 'main.c', + dependencies: nm_deps, + c_args: nm_cflags, + link_with: libnetwork_manager, + link_args: ldflags, + link_depends: ver_script, + install: true, + install_dir: nm_sbindir +) From e2522c8c2d776a72fec5f5961c7224cd0dc82a52 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 14:42:21 +0200 Subject: [PATCH 37/63] build: meson: add missing libnm-core header file Reported-by: Michael Biebl Fixes: df30651b8906cfe6a5cb7aef01a220d1f21b80f3 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/31 --- libnm-core/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/libnm-core/meson.build b/libnm-core/meson.build index eb6fcce94b..ac13a1be0d 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -16,6 +16,7 @@ libnm_core_headers = files( 'nm-setting-connection.h', 'nm-setting-dcb.h', 'nm-setting-dummy.h', + 'nm-setting-ethtool.h', 'nm-setting-generic.h', 'nm-setting-gsm.h', 'nm-setting-infiniband.h', From 8c77ca1a6dc87c70c7c61e442accf7fdd2f5d063 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 14:58:56 +0200 Subject: [PATCH 38/63] build: meson: fix NMSTATEDIR path Reported-by: Michael Biebl --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 433bc1a1f7..1584626d26 100644 --- a/meson.build +++ b/meson.build @@ -50,7 +50,7 @@ nm_pkgdatadir = join_paths(nm_datadir, nm_name) nm_pkgincludedir = join_paths(nm_includedir, nm_name) nm_pkglibdir = join_paths(nm_prefix, 'lib', nm_name) nm_pkgrundir = join_paths(nm_runstatedir, nm_name) -nm_pkgstatedir = join_paths(nm_localstatedir, nm_name) +nm_pkgstatedir = join_paths(nm_localstatedir, 'lib', nm_name) nm_vpndir = join_paths(nm_libdir, nm_name) nm_plugindir = join_paths(nm_libdir, nm_name, dist_version) From ff837b2686cf8f88bbdb95b2ddd8efd7fc9f809e Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 15:05:03 +0200 Subject: [PATCH 39/63] build: print both pppd path and plugins path in configure summary Reported-by: Michael Biebl https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/25 --- configure.ac | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c2523504ef..d695a1c99b 100644 --- a/configure.ac +++ b/configure.ac @@ -1299,7 +1299,7 @@ echo echo "Features:" echo " wext: $ac_with_wext" echo " wifi: $enable_wifi" -echo " ppp: $enable_ppp ${PPPD_PLUGIN_DIR}" +echo " ppp: $enable_ppp ${PPPD_PATH} plugins:${PPPD_PLUGIN_DIR}" echo " modemmanager-1: $with_modem_manager_1" echo " ofono: $with_ofono" echo " concheck: $enable_concheck" diff --git a/meson.build b/meson.build index 1584626d26..40c337dfb7 100644 --- a/meson.build +++ b/meson.build @@ -938,7 +938,7 @@ output += ' wifi: ' + enable_wifi.to_string() + '\n' output += ' iwd: ' + enable_iwd.to_string() + '\n' output += ' pppd: ' + enable_ppp.to_string() if enable_ppp - output += ' ' + pppd_path + output += ' ' + pppd_path + ' plugins:' + pppd_plugin_dir endif output += '\n' output += ' modemmanager-1: ' + enable_modem_manager.to_string() + '\n' From 8e776955ee53b80536f017d2c5bbfc7c9a7b0f10 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 12 Sep 2018 15:53:13 +0200 Subject: [PATCH 40/63] build: rename DNSSEC_TRIGGER_SCRIPT to DNSSEC_TRIGGER_PATH Rename the define for consistency, since the configure option is named 'dnssec-trigger'. --- config.h.meson | 2 +- configure.ac | 8 ++++---- meson.build | 6 +++--- src/dns/nm-dns-unbound.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.h.meson b/config.h.meson index 07129b2e00..e79f9dcb54 100644 --- a/config.h.meson +++ b/config.h.meson @@ -14,7 +14,7 @@ #mesondefine DNSMASQ_PATH /* Define to path of unbound dnssec-trigger-script */ -#mesondefine DNSSEC_TRIGGER_SCRIPT +#mesondefine DNSSEC_TRIGGER_PATH /* Gettext package */ #mesondefine GETTEXT_PACKAGE diff --git a/configure.ac b/configure.ac index d695a1c99b..527d6e8c85 100644 --- a/configure.ac +++ b/configure.ac @@ -941,13 +941,13 @@ AC_SUBST(DNSMASQ_PATH) AC_ARG_WITH(dnssec_trigger, AS_HELP_STRING([--with-dnssec-trigger=/path/to/dnssec-trigger-script], [path to unbound dnssec-trigger-script])) if test "x${with_dnssec_trigger}" = x; then - AC_PATH_PROG(DNSSEC_TRIGGER_SCRIPT, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script, + AC_PATH_PROG(DNSSEC_TRIGGER_PATH, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script, /usr/local/libexec:/usr/local/lib:/usr/local/lib/dnssec-trigger:/usr/libexec:/usr/lib:/usr/lib/dnssec-trigger) else - DNSSEC_TRIGGER_SCRIPT="$with_dnssec_trigger" + DNSSEC_TRIGGER_PATH="$with_dnssec_trigger" fi -AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_SCRIPT, "$DNSSEC_TRIGGER_SCRIPT", [Define to path of unbound dnssec-trigger-script]) -AC_SUBST(DNSSEC_TRIGGER_SCRIPT) +AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_PATH, "$DNSSEC_TRIGGER_PATH", [Define to path of unbound dnssec-trigger-script]) +AC_SUBST(DNSSEC_TRIGGER_PATH) # system CA certificates path AC_ARG_WITH(system-ca-path, diff --git a/meson.build b/meson.build index 40c337dfb7..d2cef289fa 100644 --- a/meson.build +++ b/meson.build @@ -624,10 +624,10 @@ dnssec_ts_paths = ['/usr/local/libexec', '/usr/lib', '/usr/lib/dnssec-trigger'] -# 0: cmdline option, 1: paths, 2: fallback, 3: config.h option +# 0: cmdline option, 1: paths, 2: fallback progs = [['iptables', default_paths, '/sbin/iptables'], ['dnsmasq', default_paths, ''], - ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script'), 'DNSSEC_TRIGGER_SCRIPT'], + ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script') ], ] foreach prog : progs @@ -640,7 +640,7 @@ foreach prog : progs exe = find_program(search_paths, required : false) path = exe.found() ? exe.path() : prog[2] endif - name = prog.length() > 3 ? prog[3] : (prog[0].to_upper() + '_PATH') + name = prog[0].to_upper() + '_PATH' config_h.set_quoted(name, path) endforeach diff --git a/src/dns/nm-dns-unbound.c b/src/dns/nm-dns-unbound.c index e06128aa91..b900f29e22 100644 --- a/src/dns/nm-dns-unbound.c +++ b/src/dns/nm-dns-unbound.c @@ -43,7 +43,7 @@ update (NMDnsPlugin *plugin, const CList *ip_config_lst_head, const char *hostname) { - char *argv[] = { DNSSEC_TRIGGER_SCRIPT, "--async", "--update", NULL }; + char *argv[] = { DNSSEC_TRIGGER_PATH, "--async", "--update", NULL }; int status; /* TODO: We currently call a script installed with the dnssec-trigger From 0dda7586e4ec3a35031ad2578821d056d99103f1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Sep 2018 15:33:46 +0200 Subject: [PATCH 41/63] travis: enabling building more optional components during CI with meson After fixing meson build for these components, enable them for build in travis. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0458b63c53..1bf7e8d515 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,8 +104,9 @@ script: -D ofono=true \ -D teamdctl=false \ \ - -D dhcpcanon=/bin/true \ - -D dhclient=/bin/true \ + -D dhclient=/bin/nowhere/dhclient \ + -D dhcpcanon=/bin/nowhere/dhcpcanon \ + -D dhcpcd=/bin/nowhere/dhcpd \ \ -D netconfig=true \ -D resolvconf=true \ From 5b36585a3ddd9bc54419e71aef0c244c8015d6d6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Sep 2018 21:01:24 +0200 Subject: [PATCH 42/63] build/autotools: fail configure if netconfig/resolveconf tool is not found If the user explicitly passes --with-netconfig=$PATH or --with-resolvconf=$PATH, the path is accepted as is. We only do autodetection, if the binary was not found. In that case, if the binary cannot be found in the common paths fail compilation. --- .travis.yml | 8 ++++---- configure.ac | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bf7e8d515..de6ff770a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,8 +108,8 @@ script: -D dhcpcanon=/bin/nowhere/dhcpcanon \ -D dhcpcd=/bin/nowhere/dhcpd \ \ - -D netconfig=true \ - -D resolvconf=true \ + -D netconfig=/bin/nowhere/netconfig \ + -D resolvconf=/bin/nowhere/resolvconf \ \ -D ifcfg_rh=false \ -D ibft=true \ @@ -146,8 +146,8 @@ script: --with-dhcpcd=yes \ --with-dhclient=yes \ \ - --with-netconfig=no \ - --with-resolvconf=yes \ + --with-netconfig=/bin/nowhere/netconfig \ + --with-resolvconf=/bin/nowhere/resolvconf \ \ --enable-ifcfg-rh=yes \ --enable-config-plugin-ibft=yes \ diff --git a/configure.ac b/configure.ac index 527d6e8c85..f244d214e4 100644 --- a/configure.ac +++ b/configure.ac @@ -871,13 +871,12 @@ test -z "$config_dhcp_default" && config_dhcp_defaul AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting]) AC_SUBST(NM_CONFIG_DEFAULT_MAIN_DHCP, $config_dhcp_default) -# resolvconf and netconfig support AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support])) AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support])) AC_ARG_WITH(config-dns-rc-manager-default, AS_HELP_STRING([--with-config-dns-rc-manager-default=symlink|file|netconfig|resolvconf], [Configure default value for main.rc-manager setting]), [config_dns_rc_manager_default=$withval]) -if test "$config_dns_rc_manager_default" != symlink -a \ +if test "$config_dns_rc_manager_default" != "" -a \ "$config_dns_rc_manager_default" != file -a \ - "$config_dns_rc_manager_default" != "" -a \ + "$config_dns_rc_manager_default" != symlink -a \ "$config_dns_rc_manager_default" != netconfig -a \ "$config_dns_rc_manager_default" != resolvconf; then AC_MSG_WARN([Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting.]) @@ -888,21 +887,29 @@ AS_IF([test -z "$with_netconfig" -a -f /etc/SuSE-release], with_netconfig=yes) # Otherwise default to "no" AS_IF([test -z "$with_resolvconf"], with_resolvconf=no) AS_IF([test -z "$with_netconfig"], with_netconfig=no) -# Find resolvconf and netconfig + if test "$with_resolvconf" = "yes"; then - AC_PATH_PROGS(with_resolvconf, resolvconf, no, /sbin:/usr/sbin:/usr/local/sbin) + AC_PATH_PROGS(with_resolvconf, resolvconf, 'yes', /sbin:/usr/sbin:/usr/local/sbin) + if test "$with_resolvconf" = "yes"; then + AC_MSG_ERROR(cannot find resolvconf in path. Set the path explicitly via --with-resolvconf=PATH.) + fi fi if test "$with_resolvconf" != "no"; then AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=resolvconf) fi + if test "$with_netconfig" = "yes"; then - AC_PATH_PROGS(with_netconfig, netconfig, no, /sbin:/usr/sbin:/usr/local/sbin) + AC_PATH_PROGS(with_netconfig, netconfig, yes, /sbin:/usr/sbin:/usr/local/sbin) + if test "$with_netconfig" = "yes"; then + AC_MSG_ERROR(cannot find netconfig in path. Set the path explicitly via --with-netconfig=PATH.) + fi fi if test "$with_netconfig" != "no"; then AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=netconfig) fi + AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=symlink) -# Define resolvconf and netconfig paths + if test "$with_resolvconf" != "no"; then AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf]) fi From f0c075f05082e4c77fac75ad06d303e7538e4fc7 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 13 Sep 2018 14:50:32 +0200 Subject: [PATCH 43/63] dns: dnsmasq: avoid crash when no reverse domains exist ip_data->domains.reverse can be NULL when the device is being removed and has no IP configuration for a short moment. Fixes: 6409e7719c0341baedfdb063366457e390894ed9 https://bugzilla.gnome.org/show_bug.cgi?id=797022 --- src/dns/nm-dns-dnsmasq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dns/nm-dns-dnsmasq.c b/src/dns/nm-dns-dnsmasq.c index 90a08d599a..cb7a626c2d 100644 --- a/src/dns/nm-dns-dnsmasq.c +++ b/src/dns/nm-dns-dnsmasq.c @@ -183,10 +183,12 @@ add_ip_config (NMDnsDnsmasq *self, GVariantBuilder *servers, const NMDnsIPConfig domain[0] ? domain : NULL); } - for (j = 0; ip_data->domains.reverse[j]; j++) { - add_dnsmasq_nameserver (self, servers, - ip_addr_to_string_buf, - ip_data->domains.reverse[j]); + if (ip_data->domains.reverse) { + for (j = 0; ip_data->domains.reverse[j]; j++) { + add_dnsmasq_nameserver (self, servers, + ip_addr_to_string_buf, + ip_data->domains.reverse[j]); + } } } } From 54e1f73e0ca2ad87e14f4eacfe532eb444959ba6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Sep 2018 16:12:51 +0200 Subject: [PATCH 44/63] libnm: fix memleak in _nm_utils_ssid_to_string_arr() Fixes: 5cd4e6f3e68bc4564656f0bb00b5261a8f6adeb7 --- libnm-core/nm-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 47ec7a4ea2..9151a0109c 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -431,7 +431,7 @@ nm_utils_escape_ssid (const guint8 *ssid, gsize len) char * _nm_utils_ssid_to_string_arr (const guint8 *ssid, gsize len) { - char *s_copy; + gs_free char *s_copy = NULL; const char *s_cnst; if (len == 0) From ef61d7909f594c4f3ec145d141387956a6d9c73e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Sep 2018 16:20:17 +0200 Subject: [PATCH 45/63] wifi: fix leaking fake AP in NMDeviceWifi's act_stage1_prepare() Fixes: 96f40dcdcd8b2df204d64026f0315ff6370048fa --- src/devices/wifi/nm-device-wifi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 64ab82cb0c..ec1150bb3c 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -2593,6 +2593,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) set_current_ap (self, ap, FALSE); nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), nm_dbus_object_get_path (NM_DBUS_OBJECT (ap))); + g_object_unref (ap); return NM_ACT_STAGE_RETURN_SUCCESS; done: From 69b4b28bb8388437842010a2ace3e9a797ff3df8 Mon Sep 17 00:00:00 2001 From: AsciiWolf Date: Thu, 13 Sep 2018 14:06:26 +0000 Subject: [PATCH 46/63] po: update Czech (cz) translation https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/13 --- po/cs.po | 561 +++++++++++++++++++++++++------------------------------ 1 file changed, 252 insertions(+), 309 deletions(-) diff --git a/po/cs.po b/po/cs.po index 007000bc73..7490c7aa47 100644 --- a/po/cs.po +++ b/po/cs.po @@ -17,7 +17,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-29 17:44+0200\n" -"PO-Revision-Date: 2018-03-29 17:52+0200\n" +"PO-Revision-Date: 2018-09-13 16:02+0200\n" "Last-Translator: Daniel Rusek \n" "Language-Team: Czech \n" "Language: cs\n" @@ -25,7 +25,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Poedit 2.0.6\n" +"X-Generator: Poedit 2.1.1\n" #: ../clients/cli/agent.c:40 #, c-format @@ -208,9 +208,9 @@ msgstr "" #. We should not really come here #: ../clients/cli/common.c:434 ../clients/cli/connections.c:3095 #: ../clients/cli/connections.c:3155 -#, fuzzy, c-format +#, c-format msgid "Unknown error" -msgstr "Neznámý" +msgstr "Neznámá chyba" #: ../clients/cli/common.c:437 msgid "Device is now managed" @@ -964,9 +964,8 @@ msgid "activated" msgstr "aktivováno" #: ../clients/cli/connections.c:530 -#, fuzzy msgid "deactivated" -msgstr "aktivováno" +msgstr "deaktivováno" #: ../clients/cli/connections.c:542 msgid "VPN connecting (prepare)" @@ -1617,9 +1616,9 @@ msgstr "" #: ../clients/cli/connections.c:6047 ../clients/cli/connections.c:6184 #: ../clients/cli/connections.c:6610 ../clients/cli/connections.c:7569 -#, fuzzy, c-format +#, c-format msgid "Unknown command: '%s'\n" -msgstr "Neznámá doména evidence „%s“" +msgstr "Neznámý příkaz: „%s“\n" #. TRANSLATORS: do not translate command names and keywords before :: #. * However, you should translate terms enclosed in <>. @@ -2739,9 +2738,8 @@ msgid "%s: device removed\n" msgstr "" #: ../clients/cli/devices.c:2609 -#, fuzzy msgid "Wi-Fi scan list" -msgstr "Seznam prohledání WiFi" +msgstr "Seznam prohledání Wi-Fi" #: ../clients/cli/devices.c:2657 #, fuzzy, c-format @@ -2947,9 +2945,8 @@ msgid "running" msgstr "běží" #: ../clients/cli/general.c:201 -#, fuzzy msgid "starting" -msgstr "aktivuje se" +msgstr "spouští se" #: ../clients/cli/general.c:201 msgid "started" @@ -3263,7 +3260,7 @@ msgstr "připojeno" #: ../clients/cli/general.c:1183 msgid "fw missing" -msgstr "" +msgstr "fw chybí" #: ../clients/cli/general.c:1188 #, fuzzy @@ -3272,11 +3269,11 @@ msgstr "Chyba: schází argument %s." #: ../clients/cli/general.c:1193 msgid "sw" -msgstr "" +msgstr "sw" #: ../clients/cli/general.c:1195 msgid "hw" -msgstr "" +msgstr "hw" #: ../clients/cli/general.c:1200 msgid "iface" @@ -3284,11 +3281,11 @@ msgstr "" #: ../clients/cli/general.c:1203 msgid "port" -msgstr "" +msgstr "port" #: ../clients/cli/general.c:1206 msgid "mtu" -msgstr "" +msgstr "mtu" #: ../clients/cli/general.c:1223 msgid "master" @@ -3301,16 +3298,16 @@ msgstr "VPN" #: ../clients/cli/general.c:1229 msgid "ip4 default" -msgstr "" +msgstr "ip4 výchozí" #: ../clients/cli/general.c:1231 msgid "ip6 default" -msgstr "" +msgstr "ip6 výchozí" #: ../clients/cli/general.c:1314 -#, fuzzy, c-format +#, c-format msgid "%s VPN connection" -msgstr "VPN se připojuje" +msgstr "%s VPN připojení" #: ../clients/cli/general.c:1384 #, c-format @@ -3503,9 +3500,9 @@ msgid "Warning: %s\n" msgstr "" #: ../clients/cli/settings.c:385 -#, fuzzy, c-format +#, c-format msgid "Info: %s\n" -msgstr "Chyba: %s." +msgstr "Info: %s\n" #: ../clients/cli/settings.c:477 msgid "don't know how to get the property value" @@ -3755,14 +3752,14 @@ msgid "invalid option '%s', use one of [%s]" msgstr "" #: ../clients/common/nm-meta-setting-desc.c:1316 -#, fuzzy, c-format +#, c-format msgid "%d (key)" -msgstr "%d (hex-ascii-klíč)" +msgstr "%d (klíč)" #: ../clients/common/nm-meta-setting-desc.c:1318 -#, fuzzy, c-format +#, c-format msgid "%d (passphrase)" -msgstr "%d (104/128bitové heslo)" +msgstr "%d (heslo)" #: ../clients/common/nm-meta-setting-desc.c:1321 #: ../clients/common/nm-meta-setting-desc.c:1410 @@ -3772,52 +3769,50 @@ msgstr "%d (neznámé)" #: ../clients/common/nm-meta-setting-desc.c:1353 msgid "0 (NONE)" -msgstr "" +msgstr "0 (ŽÁDNÉ)" #: ../clients/common/nm-meta-setting-desc.c:1359 msgid "REORDER_HEADERS, " -msgstr "" +msgstr "REORDER_HEADERS, " #: ../clients/common/nm-meta-setting-desc.c:1361 msgid "GVRP, " -msgstr "" +msgstr "GVRP, " #: ../clients/common/nm-meta-setting-desc.c:1363 msgid "LOOSE_BINDING, " -msgstr "" +msgstr "LOOSE_BINDING, " #: ../clients/common/nm-meta-setting-desc.c:1365 msgid "MVRP, " -msgstr "" +msgstr "MVRP, " #: ../clients/common/nm-meta-setting-desc.c:1404 -#, fuzzy, c-format +#, c-format msgid "%d (disabled)" -msgstr "zakázáno" +msgstr "%d (zakázáno)" #: ../clients/common/nm-meta-setting-desc.c:1406 #, c-format msgid "%d (enabled, prefer public IP)" -msgstr "" +msgstr "%d (povoleno, preferovat veřejnou IP)" #: ../clients/common/nm-meta-setting-desc.c:1408 #, c-format msgid "%d (enabled, prefer temporary IP)" -msgstr "" +msgstr "%d (povoleno, preferovat dočasnou IP)" #: ../clients/common/nm-meta-setting-desc.c:1423 -#, fuzzy msgid "0 (none)" -msgstr "(nic)" +msgstr "0 (žádné)" #: ../clients/common/nm-meta-setting-desc.c:1429 msgid "agent-owned, " msgstr "" #: ../clients/common/nm-meta-setting-desc.c:1431 -#, fuzzy msgid "not saved, " -msgstr "nenastaveno" +msgstr "neuloženo, " #: ../clients/common/nm-meta-setting-desc.c:1433 msgid "not required, " @@ -3950,14 +3945,12 @@ msgid "the property doesn't contain UUID '%s'" msgstr "" #: ../clients/common/nm-meta-setting-desc.c:2634 -#, fuzzy msgid "0 (disabled)" -msgstr "zakázáno" +msgstr "0 (zakázáno)" #: ../clients/common/nm-meta-setting-desc.c:2640 -#, fuzzy msgid "enabled, " -msgstr "povoleno" +msgstr "povoleno, " #: ../clients/common/nm-meta-setting-desc.c:2642 msgid "advertise, " @@ -4011,9 +4004,9 @@ msgid "default" msgstr "" #: ../clients/common/nm-meta-setting-desc.c:3134 -#, fuzzy, c-format +#, c-format msgid "%d (off)" -msgstr "%d (neznámé)" +msgstr "%d (vypnuto)" #: ../clients/common/nm-meta-setting-desc.c:3171 #: ../clients/common/nm-meta-setting-desc.c:3190 @@ -4296,14 +4289,14 @@ msgstr "" #: ../clients/common/nm-secret-agent-simple.c:328 #: ../clients/tui/nmt-page-dsl.c:66 ../clients/tui/nmt-page-wifi.c:321 msgid "Username" -msgstr "" +msgstr "Uživatelské jméno" #: ../clients/common/nm-meta-setting-desc.c:4774 #: ../clients/common/nm-meta-setting-desc.c:4952 #: ../clients/common/nm-meta-setting-desc.c:5221 #: ../clients/common/nm-meta-setting-desc.c:5788 msgid "Password [none]" -msgstr "" +msgstr "Heslo [žádné]" #: ../clients/common/nm-meta-setting-desc.c:4821 msgid "Bluetooth device address" @@ -4396,23 +4389,22 @@ msgid "" msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5232 -#, fuzzy msgid "APN" -msgstr "AP" +msgstr "APN" #: ../clients/common/nm-meta-setting-desc.c:5284 #: ../clients/common/nm-meta-setting-desc.c:6276 #: ../clients/common/nm-meta-setting-desc.c:6422 msgid "MTU [auto]" -msgstr "" +msgstr "MTU [automaticky]" #: ../clients/common/nm-meta-setting-desc.c:5303 msgid "P_KEY [none]" -msgstr "" +msgstr "P_KLÍČ [žádný]" #: ../clients/common/nm-meta-setting-desc.c:5312 msgid "Parent interface [none]" -msgstr "" +msgstr "Rodičovské rozhraní [žádné]" #: ../clients/common/nm-meta-setting-desc.c:5335 msgid "" @@ -4420,10 +4412,13 @@ msgid "" "\n" "Example: 8.8.8.8, 8.8.4.4\n" msgstr "" +"Vložte seznam IPv4 adres DNS serverů.\n" +"\n" +"Například: 8.8.8.8, 8.8.4.4\n" #: ../clients/common/nm-meta-setting-desc.c:5367 msgid "IPv4 address (IP[/plen]) [none]" -msgstr "" +msgstr "IPv4 adresa (IP[/plen]) [žádná]" #: ../clients/common/nm-meta-setting-desc.c:5369 msgid "" @@ -4436,7 +4431,7 @@ msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5382 msgid "IPv4 gateway [none]" -msgstr "" +msgstr "IPv4 brána [žádná]" #: ../clients/common/nm-meta-setting-desc.c:5390 msgid "" @@ -4465,7 +4460,7 @@ msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5494 msgid "IPv6 address (IP[/plen]) [none]" -msgstr "" +msgstr "IPv6 adresa (IP[/plen]) [žádná]" #: ../clients/common/nm-meta-setting-desc.c:5496 msgid "" @@ -4478,7 +4473,7 @@ msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5509 msgid "IPv6 gateway [none]" -msgstr "" +msgstr "IPv6 brána [žádná]" #: ../clients/common/nm-meta-setting-desc.c:5517 msgid "" @@ -4506,7 +4501,7 @@ msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5608 #: ../clients/common/nm-meta-setting-desc.c:6156 msgid "Remote" -msgstr "" +msgstr "Vzdálené" #: ../clients/common/nm-meta-setting-desc.c:5645 msgid "MACsec parent device or connection UUID" @@ -4514,16 +4509,16 @@ msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5666 msgid "Enable encryption [yes]" -msgstr "" +msgstr "Povolit šifrování [ano]" #: ../clients/common/nm-meta-setting-desc.c:5672 #: ../clients/common/nm-secret-agent-simple.c:520 msgid "MKA CAK" -msgstr "" +msgstr "MKA CAK" #: ../clients/common/nm-meta-setting-desc.c:5682 msgid "MKA_CKN" -msgstr "" +msgstr "MKA_CKN" #: ../clients/common/nm-meta-setting-desc.c:5688 msgid "SCI port [1]" @@ -4553,13 +4548,12 @@ msgid "DHCP anycast MAC address [none]" msgstr "" #: ../clients/common/nm-meta-setting-desc.c:5775 -#, fuzzy msgid "Service [none]" -msgstr "Služba" +msgstr "Služba [žádná]" #: ../clients/common/nm-meta-setting-desc.c:5782 msgid "PPPoE username" -msgstr "" +msgstr "Uživatelské jméno PPPoE" #: ../clients/common/nm-meta-setting-desc.c:5881 msgid "Browser only [no]" @@ -4665,7 +4659,7 @@ msgstr "" #. *************************************************************************** #: ../clients/common/nm-meta-setting-desc.c:6708 msgid "802-1x settings" -msgstr "" +msgstr "802-1x nastavení" #: ../clients/common/nm-meta-setting-desc.c:6709 #: ../src/devices/adsl/nm-device-adsl.c:137 @@ -4673,23 +4667,20 @@ msgid "ADSL connection" msgstr "ADSL připojení" #: ../clients/common/nm-meta-setting-desc.c:6710 -#, fuzzy msgid "bluetooth connection" -msgstr "připojuje se" +msgstr "bluetooth připojení" #: ../clients/common/nm-meta-setting-desc.c:6711 msgid "Bond device" -msgstr "" +msgstr "Zařízení Bond" #: ../clients/common/nm-meta-setting-desc.c:6712 -#, fuzzy msgid "Bridge device" -msgstr "Aktivní připojení" +msgstr "Zařízení Most" #: ../clients/common/nm-meta-setting-desc.c:6713 -#, fuzzy msgid "Bridge port" -msgstr "Aktivní připojení" +msgstr "Port Most" #: ../clients/common/nm-meta-setting-desc.c:6714 msgid "CDMA mobile broadband connection" @@ -4697,19 +4688,19 @@ msgstr "Mobilní širokopásmové připojení CDMA" #: ../clients/common/nm-meta-setting-desc.c:6715 msgid "General settings" -msgstr "" +msgstr "Obecné nastavení" #: ../clients/common/nm-meta-setting-desc.c:6716 msgid "DCB settings" -msgstr "" +msgstr "DCB nastavení" #: ../clients/common/nm-meta-setting-desc.c:6717 msgid "Dummy settings" -msgstr "" +msgstr "Prázdné nastavení" #: ../clients/common/nm-meta-setting-desc.c:6718 msgid "Generic settings" -msgstr "" +msgstr "Generické nastavení" #: ../clients/common/nm-meta-setting-desc.c:6719 msgid "GSM mobile broadband connection" @@ -4717,68 +4708,64 @@ msgstr "Mobilní širokopásmové připojení GSM" #: ../clients/common/nm-meta-setting-desc.c:6720 #: ../src/devices/nm-device-infiniband.c:192 -#, fuzzy msgid "InfiniBand connection" -msgstr "Drátové připojení %d" +msgstr "InfiniBand připojení" #: ../clients/common/nm-meta-setting-desc.c:6721 msgid "IPv4 protocol" -msgstr "" +msgstr "IPv4 protokol" #: ../clients/common/nm-meta-setting-desc.c:6722 msgid "IPv6 protocol" -msgstr "" +msgstr "IPv6 protokol" #: ../clients/common/nm-meta-setting-desc.c:6723 msgid "IP-tunnel settings" -msgstr "" +msgstr "IP-tunel nastavení" #: ../clients/common/nm-meta-setting-desc.c:6724 msgid "MACsec connection" -msgstr "" +msgstr "MACsec připojení" #: ../clients/common/nm-meta-setting-desc.c:6725 -#, fuzzy msgid "macvlan connection" -msgstr "připojuje se" +msgstr "macvlan připojení" #: ../clients/common/nm-meta-setting-desc.c:6726 -#, fuzzy msgid "OLPC Mesh connection" -msgstr "Připojení CDMA %d" +msgstr "OLPC Mesh připojení" #: ../clients/common/nm-meta-setting-desc.c:6727 msgid "PPP settings" -msgstr "" +msgstr "Nastavení PPP" #: ../clients/common/nm-meta-setting-desc.c:6728 msgid "PPPoE" -msgstr "" +msgstr "PPPoE" #: ../clients/common/nm-meta-setting-desc.c:6729 msgid "Proxy" -msgstr "" +msgstr "Proxy" #: ../clients/common/nm-meta-setting-desc.c:6730 msgid "Serial settings" -msgstr "" +msgstr "Nastavení Serial" #: ../clients/common/nm-meta-setting-desc.c:6731 msgid "Team device" -msgstr "" +msgstr "Zařízení Team" #: ../clients/common/nm-meta-setting-desc.c:6732 msgid "Team port" -msgstr "" +msgstr "Port Team" #: ../clients/common/nm-meta-setting-desc.c:6733 -#, fuzzy msgid "Tun device" -msgstr "Zařízení" +msgstr "Zařízení Tun" #: ../clients/common/nm-meta-setting-desc.c:6734 msgid "User settings" -msgstr "" +msgstr "Uživatelské nastavení" #: ../clients/common/nm-meta-setting-desc.c:6735 #: ../src/devices/nm-device-vlan.c:433 @@ -4808,11 +4795,11 @@ msgstr "Wi-Fi připojení" #: ../clients/common/nm-meta-setting-desc.c:6741 msgid "Wi-Fi security settings" -msgstr "" +msgstr "Nastavení zabezpečení Wi-Fi" #: ../clients/common/nm-meta-setting-desc.c:7013 msgid "name" -msgstr "" +msgstr "název" #: ../clients/common/nm-polkit-listener.c:212 msgid "An authentication session is already underway." @@ -4832,20 +4819,20 @@ msgstr "" #: ../clients/tui/nmt-page-wifi.c:266 ../clients/tui/nmt-page-wifi.c:297 #: ../clients/tui/nmt-page-wifi.c:330 msgid "Password" -msgstr "" +msgstr "Heslo" #: ../clients/common/nm-secret-agent-simple.c:241 msgid "Identity" -msgstr "" +msgstr "Identita" #: ../clients/common/nm-secret-agent-simple.c:248 msgid "Private key password" -msgstr "" +msgstr "Heslo soukromého klíče" #: ../clients/common/nm-secret-agent-simple.c:289 #: ../clients/tui/nmt-page-wifi.c:278 msgid "Key" -msgstr "" +msgstr "Klíč" #: ../clients/common/nm-secret-agent-simple.c:335 #: ../clients/tui/nmt-page-dsl.c:78 @@ -4885,7 +4872,7 @@ msgstr "pro připojení „%s“ nebylo nalezeno žádné zařízení" #: ../clients/common/nm-secret-agent-simple.c:489 msgid "PIN code required" -msgstr "" +msgstr "Požadován PIN kód" #: ../clients/common/nm-secret-agent-simple.c:490 #, fuzzy @@ -4893,9 +4880,8 @@ msgid "PIN code is needed for the mobile broadband device" msgstr "Povolit nebo zakázat mobilní širokopásmová zařízení" #: ../clients/common/nm-secret-agent-simple.c:492 -#, fuzzy msgid "PIN" -msgstr "VPN" +msgstr "PIN" #: ../clients/common/nm-secret-agent-simple.c:500 #: ../clients/common/nm-secret-agent-simple.c:534 @@ -7009,9 +6995,8 @@ msgid "" msgstr "" #: ../clients/nm-online.c:91 -#, fuzzy msgid "Connecting" -msgstr "připojuje se" +msgstr "Připojuje se" #: ../clients/nm-online.c:189 #, fuzzy, c-format @@ -7058,7 +7043,7 @@ msgstr "" #: ../clients/tui/nmt-route-editor.c:122 ../clients/tui/nmtui-hostname.c:69 #: ../clients/tui/nmtui.c:136 msgid "OK" -msgstr "" +msgstr "OK" #: ../clients/tui/newt/nmt-newt-utils.c:325 #: ../clients/tui/newt/nmt-newt-utils.c:357 @@ -7089,7 +7074,7 @@ msgstr "Nelze dekódovat soubor PKCS#8: %s" #: ../clients/tui/nm-editor-utils.c:146 ../libnm-glib/nm-device.c:1821 #: ../libnm/nm-device.c:1517 msgid "Ethernet" -msgstr "" +msgstr "Drátové připojení" #: ../clients/tui/nm-editor-utils.c:150 #, c-format @@ -7099,7 +7084,7 @@ msgstr "Drátové připojení %d" #: ../clients/tui/nm-editor-utils.c:154 ../libnm-glib/nm-device.c:1823 #: ../libnm/nm-device.c:1519 msgid "Wi-Fi" -msgstr "" +msgstr "Wi-Fi" #: ../clients/tui/nm-editor-utils.c:158 #, c-format @@ -7109,12 +7094,12 @@ msgstr "Wi-Fi připojení %d" #: ../clients/tui/nm-editor-utils.c:163 ../libnm-core/nm-connection.c:1939 #: ../libnm-glib/nm-device.c:1833 ../libnm/nm-device.c:1529 msgid "InfiniBand" -msgstr "" +msgstr "InfiniBand" #: ../clients/tui/nm-editor-utils.c:167 -#, fuzzy, c-format +#, c-format msgid "InfiniBand connection %d" -msgstr "Drátové připojení %d" +msgstr "InfiniBand připojení %d" #: ../clients/tui/nm-editor-utils.c:172 ../libnm-glib/nm-device.c:1831 #: ../libnm/nm-device.c:1527 @@ -7127,9 +7112,8 @@ msgid "Mobile broadband connection %d" msgstr "Mobilní širokopásmové připojení %d" #: ../clients/tui/nm-editor-utils.c:181 ../clients/tui/nmt-page-dsl.c:62 -#, fuzzy msgid "DSL" -msgstr "DNS" +msgstr "DSL" #: ../clients/tui/nm-editor-utils.c:185 #, c-format @@ -7144,39 +7128,39 @@ msgid "Bond" msgstr "Svazek" #: ../clients/tui/nm-editor-utils.c:194 -#, fuzzy, c-format +#, c-format msgid "Bond connection %d" -msgstr "Drátové připojení %d" +msgstr "Připojení Bond %d" #: ../clients/tui/nm-editor-utils.c:199 ../libnm-core/nm-connection.c:1935 #: ../libnm-glib/nm-device.c:1839 ../libnm-util/nm-connection.c:1630 #: ../libnm/nm-device.c:1535 #: ../src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c:4766 msgid "Bridge" -msgstr "" +msgstr "Most" #: ../clients/tui/nm-editor-utils.c:204 -#, fuzzy, c-format +#, c-format msgid "Bridge connection %d" -msgstr "Drátové připojení %d" +msgstr "Připojení Most %d" #: ../clients/tui/nm-editor-utils.c:208 ../libnm-core/nm-connection.c:1933 #: ../libnm-glib/nm-device.c:1837 ../libnm-util/nm-connection.c:1628 #: ../libnm/nm-device.c:1533 #: ../src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c:4579 msgid "Team" -msgstr "" +msgstr "Team" #: ../clients/tui/nm-editor-utils.c:213 -#, fuzzy, c-format +#, c-format msgid "Team connection %d" -msgstr "Drátové připojení %d" +msgstr "Team připojení %d" #: ../clients/tui/nm-editor-utils.c:217 ../clients/tui/nmt-page-vlan.c:82 #: ../libnm-core/nm-connection.c:1937 ../libnm-glib/nm-device.c:1841 #: ../libnm-util/nm-connection.c:1632 ../libnm/nm-device.c:1537 msgid "VLAN" -msgstr "" +msgstr "VLAN" #: ../clients/tui/nm-editor-utils.c:221 #, c-format @@ -7184,14 +7168,13 @@ msgid "VLAN connection %d" msgstr "VLAN připojení %d" #: ../clients/tui/nm-editor-utils.c:225 ../clients/tui/nmt-page-ip-tunnel.c:136 -#, fuzzy msgid "IP tunnel" -msgstr "Aktivní připojení" +msgstr "IP tunel" #: ../clients/tui/nm-editor-utils.c:229 -#, fuzzy, c-format +#, c-format msgid "IP tunnel connection %d" -msgstr "Aktivní připojení" +msgstr "IP tunel připojení %d" #: ../clients/tui/nm-editor-utils.c:244 #, c-format @@ -7200,30 +7183,30 @@ msgstr "VPN připojení %d" #: ../clients/tui/nmt-device-entry.c:370 msgid "Select..." -msgstr "" +msgstr "Vybrat..." #: ../clients/tui/nmt-edit-connection-list.c:110 msgid "Add" -msgstr "" +msgstr "Přidat" #: ../clients/tui/nmt-edit-connection-list.c:113 #: ../clients/tui/nmt-page-ip4.c:169 ../clients/tui/nmt-page-ip6.c:167 #: ../clients/tui/nmt-page-team-port.c:109 ../clients/tui/nmt-page-team.c:173 msgid "Edit..." -msgstr "" +msgstr "Upravit..." #: ../clients/tui/nmt-edit-connection-list.c:116 #: ../clients/tui/nmtui-edit.c:531 msgid "Delete" -msgstr "" +msgstr "Odstranit" #: ../clients/tui/nmt-editor-section.c:103 msgid "Hide" -msgstr "" +msgstr "Skrýt" #: ../clients/tui/nmt-editor-section.c:103 msgid "Show" -msgstr "" +msgstr "Zobrazit" #: ../clients/tui/nmt-editor.c:98 #, c-format @@ -7252,7 +7235,7 @@ msgstr "nelze se připojit ke skupině netlink: %s" #: ../clients/tui/nmt-editor.c:333 msgid "Profile name" -msgstr "" +msgstr "Název profilu" #: ../clients/tui/nmt-editor.c:344 msgid "Ethernet device" @@ -7265,17 +7248,17 @@ msgstr "Zařízení" #. And finally the bottom widgets #: ../clients/tui/nmt-editor.c:406 msgid "Automatically connect" -msgstr "" +msgstr "Automaticky připojit" #: ../clients/tui/nmt-editor.c:412 msgid "Available to all users" -msgstr "" +msgstr "Dostupné pro všechny uživatele" #: ../clients/tui/nmt-editor.c:427 ../clients/tui/nmt-password-dialog.c:171 #: ../clients/tui/nmt-route-editor.c:115 ../clients/tui/nmtui-edit.c:222 #: ../clients/tui/nmtui-edit.c:530 ../clients/tui/nmtui-hostname.c:67 msgid "Cancel" -msgstr "" +msgstr "Zrušit" #: ../clients/tui/nmt-mtu-entry.c:86 ../clients/tui/nmt-mtu-entry.c:117 msgid "bytes" @@ -7291,7 +7274,7 @@ msgstr "" #: ../clients/tui/nmt-page-bond.c:87 msgid "XOR" -msgstr "" +msgstr "XOR" #: ../clients/tui/nmt-page-bond.c:88 msgid "Broadcast" @@ -7314,9 +7297,8 @@ msgid "MII (recommended)" msgstr "" #: ../clients/tui/nmt-page-bond.c:98 -#, fuzzy msgid "ARP" -msgstr "AP" +msgstr "ARP" #: ../clients/tui/nmt-page-bond.c:359 msgid "BOND" @@ -7386,7 +7368,7 @@ msgstr "" #: ../clients/tui/nmt-page-bridge.c:81 msgid "BRIDGE" -msgstr "" +msgstr "MOST" #: ../clients/tui/nmt-page-bridge.c:96 ../clients/tui/nmt-page-bridge.c:127 #: ../clients/tui/nmt-page-bridge.c:137 ../clients/tui/nmt-page-bridge.c:147 @@ -7426,29 +7408,27 @@ msgstr "" #: ../clients/tui/nmt-page-ip-tunnel.c:186 ../clients/tui/nmt-page-vlan.c:116 #: ../clients/tui/nmt-page-wifi.c:359 msgid "MTU" -msgstr "" +msgstr "MTU" #: ../clients/tui/nmt-page-infiniband.c:47 msgid "Datagram" msgstr "" #: ../clients/tui/nmt-page-infiniband.c:48 -#, fuzzy msgid "Connected" -msgstr "připojeno" +msgstr "je připojeno" #: ../clients/tui/nmt-page-infiniband.c:81 msgid "INFINIBAND" -msgstr "" +msgstr "INFINIBAND" #: ../clients/tui/nmt-page-infiniband.c:88 msgid "Transport mode" msgstr "" #: ../clients/tui/nmt-page-ip4.c:38 -#, fuzzy msgid "Disabled" -msgstr "zakázáno" +msgstr "je zakázáno" #: ../clients/tui/nmt-page-ip4.c:39 ../clients/tui/nmt-page-ip6.c:39 msgid "Automatic" @@ -7456,7 +7436,7 @@ msgstr "" #: ../clients/tui/nmt-page-ip4.c:40 ../clients/tui/nmt-page-ip6.c:41 msgid "Link-Local" -msgstr "" +msgstr "Link-Local" #: ../clients/tui/nmt-page-ip4.c:41 ../clients/tui/nmt-page-ip6.c:42 msgid "Manual" @@ -7480,15 +7460,15 @@ msgstr[2] "" #: ../clients/tui/nmt-page-ip4.c:128 msgid "IPv4 CONFIGURATION" -msgstr "" +msgstr "IPv4 KONFIGURACE" #: ../clients/tui/nmt-page-ip4.c:136 ../clients/tui/nmt-page-ip6.c:136 msgid "Addresses" -msgstr "" +msgstr "Adresy" #: ../clients/tui/nmt-page-ip4.c:150 ../clients/tui/nmt-page-ip6.c:150 msgid "DNS servers" -msgstr "" +msgstr "DNS servery" #: ../clients/tui/nmt-page-ip4.c:156 ../clients/tui/nmt-page-ip6.c:156 msgid "Search domains" @@ -7496,7 +7476,7 @@ msgstr "" #: ../clients/tui/nmt-page-ip4.c:171 ../clients/tui/nmt-page-ip6.c:169 msgid "Routing" -msgstr "" +msgstr "Směrování" #: ../clients/tui/nmt-page-ip4.c:173 ../clients/tui/nmt-page-ip6.c:171 msgid "Never use this network for default route" @@ -7508,110 +7488,108 @@ msgstr "" #: ../clients/tui/nmt-page-ip4.c:187 msgid "Require IPv4 addressing for this connection" -msgstr "" +msgstr "Požadovat adresování IPv4 pro toto připojení" #: ../clients/tui/nmt-page-ip6.c:38 msgid "Ignore" -msgstr "" +msgstr "Ignorovat" #: ../clients/tui/nmt-page-ip6.c:40 msgid "Automatic (DHCP-only)" -msgstr "" +msgstr "Automatické (pouze DHCP)" #: ../clients/tui/nmt-page-ip6.c:128 msgid "IPv6 CONFIGURATION" -msgstr "" +msgstr "IPv6 KONFIGURACE" #: ../clients/tui/nmt-page-ip6.c:185 msgid "Require IPv6 addressing for this connection" -msgstr "" +msgstr "Požadovat adresování IPv6 pro toto připojení" #. The order must match the NM_IP_TUNNEL_MODE_* enum #: ../clients/tui/nmt-page-ip-tunnel.c:78 msgid "IPIP" -msgstr "" +msgstr "IPIP" #: ../clients/tui/nmt-page-ip-tunnel.c:79 msgid "GRE" -msgstr "" +msgstr "GRE" #: ../clients/tui/nmt-page-ip-tunnel.c:80 msgid "SIT" -msgstr "" +msgstr "SIT" #: ../clients/tui/nmt-page-ip-tunnel.c:81 msgid "ISATAP" -msgstr "" +msgstr "ISATAP" #: ../clients/tui/nmt-page-ip-tunnel.c:82 msgid "VTI" -msgstr "" +msgstr "VTI" #: ../clients/tui/nmt-page-ip-tunnel.c:83 msgid "IP6IP6" -msgstr "" +msgstr "IP6IP6" #: ../clients/tui/nmt-page-ip-tunnel.c:84 msgid "IPIP6" -msgstr "" +msgstr "IPIP6" #: ../clients/tui/nmt-page-ip-tunnel.c:85 msgid "IP6GRE" -msgstr "" +msgstr "IP6GRE" #: ../clients/tui/nmt-page-ip-tunnel.c:86 msgid "VTI6" -msgstr "" +msgstr "VTI6" #: ../clients/tui/nmt-page-ip-tunnel.c:150 ../clients/tui/nmt-page-vlan.c:87 msgid "Parent" -msgstr "" +msgstr "Rodič" #: ../clients/tui/nmt-page-ip-tunnel.c:157 msgid "Local IP" -msgstr "" +msgstr "Lokální IP" #: ../clients/tui/nmt-page-ip-tunnel.c:163 msgid "Remote IP" -msgstr "" +msgstr "Vzdálená IP" #: ../clients/tui/nmt-page-ip-tunnel.c:169 msgid "Input key" -msgstr "" +msgstr "Vstupní klíč" #: ../clients/tui/nmt-page-ip-tunnel.c:176 msgid "Output key" -msgstr "" +msgstr "Výstupní klíč" #: ../clients/tui/nmt-page-ppp.c:131 msgid "PPP CONFIGURATION" -msgstr "" +msgstr "PPP KONFIGURACE" #: ../clients/tui/nmt-page-ppp.c:140 msgid "Allowed authentication methods:" -msgstr "" +msgstr "Povolené metody autentizace:" #: ../clients/tui/nmt-page-ppp.c:147 -#, fuzzy msgid "EAP" -msgstr "AP" +msgstr "EAP" #: ../clients/tui/nmt-page-ppp.c:155 -#, fuzzy msgid "PAP" -msgstr "AP" +msgstr "PAP" #: ../clients/tui/nmt-page-ppp.c:163 msgid "CHAP" -msgstr "" +msgstr "CHAP" #: ../clients/tui/nmt-page-ppp.c:171 msgid "MSCHAPv2" -msgstr "" +msgstr "MSCHAPv2" #: ../clients/tui/nmt-page-ppp.c:179 msgid "MSCHAP" -msgstr "" +msgstr "MSCHAP" #: ../clients/tui/nmt-page-ppp.c:195 msgid "Use point-to-point encryption (MPPE)" @@ -7643,120 +7621,116 @@ msgstr "" #: ../clients/tui/nmt-page-team-port.c:92 msgid "TEAM PORT" -msgstr "" +msgstr "TEAM PORT" #: ../clients/tui/nmt-page-team-port.c:99 ../clients/tui/nmt-page-team.c:163 msgid "JSON configuration" -msgstr "" +msgstr "JSON konfigurace" #: ../clients/tui/nmt-page-team.c:145 msgid "TEAM" -msgstr "" +msgstr "TEAM" #: ../clients/tui/nmt-page-vlan.c:102 msgid "VLAN id" -msgstr "" +msgstr "VLAN id" #: ../clients/tui/nmt-page-wifi.c:57 msgctxt "Wi-Fi" msgid "Client" -msgstr "" +msgstr "Klient" #: ../clients/tui/nmt-page-wifi.c:58 msgid "Access Point" -msgstr "" +msgstr "Přístupový bod" #: ../clients/tui/nmt-page-wifi.c:59 -#, fuzzy msgid "Ad-Hoc Network" -msgstr "Ad-Hoc" +msgstr "Ad-Hoc síť" #: ../clients/tui/nmt-page-wifi.c:64 msgctxt "Wi-Fi" msgid "Automatic" -msgstr "" +msgstr "Automaticky" #. 802.11a Wi-Fi network #: ../clients/tui/nmt-page-wifi.c:66 msgid "A (5 GHz)" -msgstr "" +msgstr "A (5 GHz)" #. 802.11b / 802.11g Wi-Fi network #: ../clients/tui/nmt-page-wifi.c:68 msgid "B/G (2.4 GHz)" -msgstr "" +msgstr "B/G (2.4 GHz)" #: ../clients/tui/nmt-page-wifi.c:73 msgctxt "Wi-Fi security" msgid "None" -msgstr "" +msgstr "Žádné" #: ../clients/tui/nmt-page-wifi.c:74 msgid "WPA & WPA2 Personal" -msgstr "" +msgstr "WPA & WPA2 Personal" #: ../clients/tui/nmt-page-wifi.c:75 -#, fuzzy msgid "WPA & WPA2 Enterprise" -msgstr "Podnikové " +msgstr "WPA & WPA2 Enterprise" #: ../clients/tui/nmt-page-wifi.c:76 msgid "WEP 40/128-bit Key (Hex or ASCII)" -msgstr "" +msgstr "WEP 40/128-bit klíč (Hex nebo ASCII)" #: ../clients/tui/nmt-page-wifi.c:77 -#, fuzzy msgid "WEP 128-bit Passphrase" -msgstr "%d (104/128bitové heslo)" +msgstr "WEP 128-bit heslo" #: ../clients/tui/nmt-page-wifi.c:78 msgid "Dynamic WEP (802.1x)" -msgstr "" +msgstr "Dynamický WEP (802.1x)" #: ../clients/tui/nmt-page-wifi.c:79 msgid "LEAP" -msgstr "" +msgstr "LEAP" #: ../clients/tui/nmt-page-wifi.c:84 msgctxt "WEP key index" msgid "1 (Default)" -msgstr "" +msgstr "1 (Výchozí)" #: ../clients/tui/nmt-page-wifi.c:85 msgctxt "WEP key index" msgid "2" -msgstr "" +msgstr "2" #: ../clients/tui/nmt-page-wifi.c:86 msgctxt "WEP key index" msgid "3" -msgstr "" +msgstr "3" #: ../clients/tui/nmt-page-wifi.c:87 msgctxt "WEP key index" msgid "4" -msgstr "" +msgstr "4" #: ../clients/tui/nmt-page-wifi.c:92 -#, fuzzy msgid "Open System" -msgstr "Systém" +msgstr "Otevřený systém" #: ../clients/tui/nmt-page-wifi.c:93 msgid "Shared Key" -msgstr "" +msgstr "Sdílený klíč" #: ../clients/tui/nmt-page-wifi.c:203 msgid "WI-FI" -msgstr "" +msgstr "WI-FI" #: ../clients/tui/nmt-page-wifi.c:245 msgid "Channel" -msgstr "" +msgstr "Kanál" #: ../clients/tui/nmt-page-wifi.c:250 msgid "Security" -msgstr "" +msgstr "Zabezpečení" #. "wpa-enterprise" #. FIXME @@ -7765,13 +7739,12 @@ msgid "(No support for wpa-enterprise yet...)" msgstr "" #: ../clients/tui/nmt-page-wifi.c:281 ../clients/tui/nmt-page-wifi.c:300 -#, fuzzy msgid "WEP index" -msgstr "WEP " +msgstr "WEP index" #: ../clients/tui/nmt-page-wifi.c:289 ../clients/tui/nmt-page-wifi.c:308 msgid "Authentication" -msgstr "" +msgstr "Autentizace" #. "dynamic-wep" #. FIXME @@ -7789,11 +7762,11 @@ msgstr "" #: ../clients/tui/nmt-password-fields.c:129 msgid "Show password" -msgstr "" +msgstr "Zobrazit heslo" #: ../clients/tui/nmt-route-table.c:191 msgid "Destination" -msgstr "" +msgstr "Cíl" #: ../clients/tui/nmt-route-table.c:191 msgid "Prefix" @@ -7801,11 +7774,11 @@ msgstr "Předčíslí" #: ../clients/tui/nmt-route-table.c:200 msgid "Next Hop" -msgstr "" +msgstr "Další skok" #: ../clients/tui/nmt-route-table.c:208 msgid "Metric" -msgstr "" +msgstr "Metrika" #: ../clients/tui/nmt-route-table.c:228 msgid "No custom routes are defined." @@ -7817,11 +7790,11 @@ msgstr "" #: ../clients/tui/nmt-widget-list.c:139 msgid "Add..." -msgstr "" +msgstr "Přidat..." #: ../clients/tui/nmt-widget-list.c:202 msgid "Remove" -msgstr "" +msgstr "Odstranit" #: ../clients/tui/nmtui-connect.c:54 msgid "" @@ -7845,48 +7818,43 @@ msgid "openconnect failed with signal %d" msgstr "" #: ../clients/tui/nmtui-connect.c:178 -#, fuzzy msgid "Activation failed" -msgstr "připojení se nezdařilo" +msgstr "Aktivace se nezdařila" #: ../clients/tui/nmtui-connect.c:233 -#, fuzzy msgid "Connecting..." -msgstr "připojuje se" +msgstr "připojuje se..." #: ../clients/tui/nmtui-connect.c:271 ../clients/tui/nmtui-connect.c:302 -#, fuzzy, c-format +#, c-format msgid "Could not activate connection: %s" -msgstr "žádné aktivní připojení nebo zařízení „%s“" +msgstr "Nelze aktivovat připojení: %s" #: ../clients/tui/nmtui-connect.c:362 ../clients/tui/nmtui-connect.c:411 -#, fuzzy msgid "Activate" -msgstr "aktivováno" +msgstr "Aktivovat" #: ../clients/tui/nmtui-connect.c:364 -#, fuzzy msgid "Deactivate" -msgstr "aktivováno" +msgstr "Deaktivovat" #: ../clients/tui/nmtui-connect.c:416 ../clients/tui/nmtui-edit.c:120 #: ../clients/tui/nmtui.c:130 msgid "Quit" -msgstr "" +msgstr "Ukončit" #: ../clients/tui/nmtui-connect.c:416 ../clients/tui/nmtui-edit.c:120 msgid "Back" -msgstr "" +msgstr "Zpět" #: ../clients/tui/nmtui-connect.c:439 -#, fuzzy, c-format +#, c-format msgid "No such connection '%s'" -msgstr "Připojení PAN %d" +msgstr "Připojení „%s“ neexistuje" #: ../clients/tui/nmtui-connect.c:441 -#, fuzzy msgid "Connection is already active" -msgstr "Připojení aktivováno\n" +msgstr "Připojení je již aktivní" #: ../clients/tui/nmtui-edit.c:230 msgid "Create" @@ -7903,9 +7871,8 @@ msgid "" msgstr "" #: ../clients/tui/nmtui-edit.c:416 ../clients/tui/nmtui-edit.c:432 -#, fuzzy msgid "New Connection" -msgstr "VPN se připojuje" +msgstr "Nové připojení" #: ../clients/tui/nmtui-edit.c:471 #, fuzzy, c-format @@ -7942,41 +7909,36 @@ msgid "Unable to set hostname: %s" msgstr "" #: ../clients/tui/nmtui.c:53 ../clients/tui/nmtui.c:56 -#, fuzzy msgid "connection" -msgstr "připojuje se" +msgstr "připojení" #: ../clients/tui/nmtui.c:54 -#, fuzzy msgid "Edit a connection" -msgstr "odpojuje se" +msgstr "Upravit připojení" #: ../clients/tui/nmtui.c:57 -#, fuzzy msgid "Activate a connection" -msgstr "Aktivní připojení" +msgstr "Aktivovat připojení" #: ../clients/tui/nmtui.c:59 msgid "new hostname" -msgstr "" +msgstr "nový název počítače" #: ../clients/tui/nmtui.c:60 -#, fuzzy msgid "Set system hostname" -msgstr "Měnit trvalý systémový název počítače" +msgstr "Nastavit systémový název počítače" #: ../clients/tui/nmtui.c:104 -#, fuzzy msgid "NetworkManager TUI" -msgstr "Stav správce sítě NetworkManager" +msgstr "NetworkManager TUI" #: ../clients/tui/nmtui.c:112 msgid "Please select an option" -msgstr "" +msgstr "Prosím vyberte možnost" #: ../clients/tui/nmtui.c:160 msgid "Usage" -msgstr "" +msgstr "Použití" #: ../clients/tui/nmtui.c:241 msgid "Could not parse arguments" @@ -7988,9 +7950,8 @@ msgid "Could not contact NetworkManager: %s.\n" msgstr "" #: ../clients/tui/nmtui.c:256 -#, fuzzy msgid "NetworkManager is not running." -msgstr "Chyba: NetworkManager neběží." +msgstr "NetworkManager neběží." #: ../libnm-core/crypto.c:118 ../libnm-util/crypto.c:131 #, c-format @@ -8350,9 +8311,8 @@ msgid "property is missing" msgstr "Chyba: schází argument %s." #: ../libnm-core/nm-connection.c:1942 -#, fuzzy msgid "IP Tunnel" -msgstr "Aktivní připojení" +msgstr "IP tunel" #: ../libnm-core/nm-dbus-utils.c:188 #, c-format @@ -9701,39 +9661,39 @@ msgstr "" #: ../libnm-glib/nm-device.c:1825 ../libnm/nm-device.c:1521 msgid "Bluetooth" -msgstr "" +msgstr "Bluetooth" #: ../libnm-glib/nm-device.c:1827 ../libnm/nm-device.c:1523 msgid "OLPC Mesh" -msgstr "" +msgstr "OLPC Mesh" #: ../libnm-glib/nm-device.c:1829 ../libnm/nm-device.c:1525 msgid "WiMAX" -msgstr "" +msgstr "WiMAX" #: ../libnm-glib/nm-device.c:1843 ../libnm/nm-device.c:1539 msgid "ADSL" -msgstr "" +msgstr "ADSL" #: ../libnm-glib/nm-device.c:1845 ../libnm/nm-device.c:1541 msgid "MACVLAN" -msgstr "" +msgstr "MACVLAN" #: ../libnm-glib/nm-device.c:1847 ../libnm/nm-device.c:1543 msgid "VXLAN" -msgstr "" +msgstr "VXLAN" #: ../libnm-glib/nm-device.c:1849 ../libnm/nm-device.c:1545 msgid "IPTunnel" -msgstr "" +msgstr "IPTunnel" #: ../libnm-glib/nm-device.c:1851 ../libnm/nm-device.c:1547 msgid "Tun" -msgstr "" +msgstr "Tun" #: ../libnm-glib/nm-device.c:1853 ../libnm/nm-device.c:1549 msgid "Veth" -msgstr "" +msgstr "Veth" #: ../libnm-glib/nm-device.c:1885 ../libnm/nm-device.c:1585 msgid "Wired" @@ -9741,11 +9701,11 @@ msgstr "Drátové" #: ../libnm-glib/nm-device.c:1916 ../libnm/nm-device.c:1616 msgid "PCI" -msgstr "" +msgstr "PCI" #: ../libnm-glib/nm-device.c:1918 ../libnm/nm-device.c:1618 msgid "USB" -msgstr "" +msgstr "USB" #. TRANSLATORS: the first %s is a bus name (eg, "USB") or #. * product name, the second is a device type (eg, @@ -10020,16 +9980,16 @@ msgstr "" #: ../libnm/nm-device.c:1551 msgid "MACsec" -msgstr "" +msgstr "MACsec" #: ../libnm/nm-device.c:1553 msgid "Dummy" -msgstr "" +msgstr "Prázdné" #: ../libnm/nm-device.c:2444 -#, fuzzy, c-format +#, c-format msgid "The connection was not valid: %s" -msgstr "připojení odstraněno" +msgstr "Připojení nebylo platné: %s" #: ../libnm/nm-device.c:2453 #, c-format @@ -10045,9 +10005,8 @@ msgid "Connection removed before it was initialized" msgstr "" #: ../libnm/nm-vpn-plugin-old.c:957 ../libnm/nm-vpn-service-plugin.c:979 -#, fuzzy msgid "No service name specified" -msgstr "Chyba: nebylo určeno rozhraní." +msgstr "Nebyl určen název služby" #: ../data/org.freedesktop.NetworkManager.policy.in.in.h:1 msgid "Enable or disable system networking" @@ -10058,14 +10017,12 @@ msgid "System policy prevents enabling or disabling system networking" msgstr "Systémová zásada zamezuje povolit nebo zakázat systémovou síť" #: ../data/org.freedesktop.NetworkManager.policy.in.in.h:3 -#, fuzzy msgid "Reload NetworkManager configuration" -msgstr "Stav správce sítě NetworkManager" +msgstr "Znovu načíst konfiguraci NetworkManageru" #: ../data/org.freedesktop.NetworkManager.policy.in.in.h:4 -#, fuzzy msgid "System policy prevents reloading NetworkManager" -msgstr "Systémová zásada zamezuje povolit nebo zakázat systémovou síť" +msgstr "Systémová zásada zamezuje opětovnému načtení NetworkManageru" #: ../data/org.freedesktop.NetworkManager.policy.in.in.h:5 msgid "" @@ -10178,14 +10135,12 @@ msgid "System policy prevents the creation of a checkpoint or its rollback" msgstr "Systémová zásada zabránila změně trvalého systémového názvu počítače" #: ../data/org.freedesktop.NetworkManager.policy.in.in.h:29 -#, fuzzy msgid "Enable or disable device statistics" -msgstr "Povolit nebo zakázat zařízení WiFi" +msgstr "Povolit nebo zakázat statistiky zařízení" #: ../data/org.freedesktop.NetworkManager.policy.in.in.h:30 -#, fuzzy msgid "System policy prevents enabling or disabling device statistics" -msgstr "Systémová zásada zamezuje povolit nebo zakázat zařízení WiFi" +msgstr "Systémová zásada zamezuje povolení nebo zakázání statistik zařízení" #: ../shared/nm-utils/nm-shared-utils.c:345 #, c-format @@ -10231,15 +10186,14 @@ msgid "%s %d" msgstr "" #: ../src/main.c:179 ../src/main.c:318 -#, fuzzy, c-format +#, c-format msgid "Failed to read configuration: %s\n" -msgstr "Selhalo nastavení IV pro šifrování: %s / %s." +msgstr "Selhalo čtení konfigurace: %s\n" #. Logging/debugging #: ../src/main.c:193 ../src/nm-iface-helper.c:309 -#, fuzzy msgid "Print NetworkManager version and exit" -msgstr "Stav správce sítě NetworkManager" +msgstr "Vypsat verzi NetworkManageru a skončit" #: ../src/main.c:194 ../src/nm-iface-helper.c:310 msgid "Don't become a daemon" @@ -10286,9 +10240,9 @@ msgid "Ignoring unrecognized log domain(s) '%s' passed on command line.\n" msgstr "" #: ../src/main.c:333 -#, fuzzy, c-format +#, c-format msgid "Error in configuration file: %s.\n" -msgstr "Chyba: Selhala aktivace připojení: %s" +msgstr "Chyba v konfiguračním souboru: %s.\n" #: ../src/main.c:338 #, c-format @@ -10346,7 +10300,7 @@ msgstr "" #: ../src/devices/bluetooth/nm-bluez-device.c:210 #, c-format msgid "%s Network" -msgstr "" +msgstr "Síť %s" #: ../src/devices/bluetooth/nm-device-bt.c:264 msgid "PAN requested, but Bluetooth device does not support NAP" @@ -10357,9 +10311,8 @@ msgid "PAN connections cannot specify GSM, CDMA, or serial settings" msgstr "" #: ../src/devices/bluetooth/nm-device-bt.c:287 -#, fuzzy msgid "PAN connection" -msgstr "Připojení PAN %d" +msgstr "Připojení PAN" #: ../src/devices/bluetooth/nm-device-bt.c:294 msgid "DUN requested, but Bluetooth device does not support DUN" @@ -10371,9 +10324,8 @@ msgstr "" #: ../src/devices/bluetooth/nm-device-bt.c:314 #: ../src/devices/wwan/nm-modem-broadband.c:706 -#, fuzzy msgid "GSM connection" -msgstr "Připojení GSM %d" +msgstr "GSM připojení" #: ../src/devices/bluetooth/nm-device-bt.c:318 #: ../src/devices/wwan/nm-modem-broadband.c:730 @@ -10393,19 +10345,16 @@ msgid "connection does not match device" msgstr "žádné aktivní připojení nebo zařízení" #: ../src/devices/nm-device-bond.c:109 -#, fuzzy msgid "Bond connection" -msgstr "připojuje se" +msgstr "Připojení Bond" #: ../src/devices/nm-device-bridge.c:115 -#, fuzzy msgid "Bridge connection" -msgstr "Aktivní připojení" +msgstr "Připojení Most" #: ../src/devices/nm-device-dummy.c:70 -#, fuzzy msgid "Dummy connection" -msgstr "Připojení GSM %d" +msgstr "Prázdné připojení" #: ../src/devices/nm-device-ethernet.c:1435 msgid "PPPoE connection" @@ -10421,29 +10370,24 @@ msgid "Wired connection %d" msgstr "Drátové připojení %d" #: ../src/devices/nm-device-ip-tunnel.c:340 -#, fuzzy msgid "IP tunnel connection" -msgstr "Aktivní připojení" +msgstr "IP tunel připojení" #: ../src/devices/nm-device-macvlan.c:407 -#, fuzzy msgid "MACVLAN connection" -msgstr "VPN se připojuje" +msgstr "MACVLAN připojení" #: ../src/devices/nm-device-tun.c:146 -#, fuzzy msgid "TUN connection" -msgstr "Připojení DUN %d" +msgstr "TUN připojení" #: ../src/devices/team/nm-device-team.c:135 -#, fuzzy msgid "Team connection" -msgstr "Aktivní připojení" +msgstr "Team připojení" #: ../src/devices/wifi/nm-device-olpc-mesh.c:156 -#, fuzzy msgid "Mesh" -msgstr "Mesh %d" +msgstr "Mesh" #: ../src/devices/wifi/nm-device-wifi.c:905 msgid "WPA Ad-Hoc disabled due to kernel bugs" @@ -10658,9 +10602,8 @@ msgid "The interface to manage" msgstr "" #: ../src/nm-iface-helper.c:292 -#, fuzzy msgid "Connection UUID" -msgstr "Seznam připojení" +msgstr "UUID připojení" #: ../src/nm-iface-helper.c:293 #, fuzzy @@ -10767,4 +10710,4 @@ msgstr "Neznámá úroveň evidence „%s“" #: ../src/nm-logging.c:369 #, c-format msgid "Unknown log domain '%s'" -msgstr "Neznámá doména evidence „%s“" +msgstr "Neznámá doména evidence „%s“" \ No newline at end of file From b4e2f83403e45e039fdaeb825f04324dc7220cb2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 13 Sep 2018 11:02:32 +0200 Subject: [PATCH 47/63] contrib/rpm: disable --with-more-asserts for devel-builds The NetworkManager spec file used to determine devel builds as those that have an odd minor version number. In that case, the built package would enable more-asserts. -- By the way, why is '1.13.3-dev' considered a delopment version worthy of more asserts, but a build from the development phase of the next minor release on 'nm-1-12' branch not? Note that during the development phase of Fedora (and sometimes even afterwards), we commonly package development versions from 'master'. For example '1.12.0-0.1', which is some snapshot with version number '1.11.x-dev' (or '1.12-rc1' in this case), but before the actual '1.12.0' release. It's problematic that for part of the devel phase we compile the package for the distribution with more assertions. This package is significanly different and rpmdiff and coverity give different results for them. For example, the binary size of debug packages is larger, so first rpmdiff will complain that the binary sized increased (compare to the previous version) and then later it decreases again. Likewise, coverity finds significantly different issues on a debug build. For example, it sees assertions against NULL and takes that as a hint as to whether the parameter can/shall be NULL. Keeping coverity warnings low is already high effort to sort out false positives. We should not invest time in checking debug builds with coverity, at least not as long as there are more important issues. But more importantly, the --with-more-asserts configure option governs whether nm_assert() is enabled. The only point of existance of nm_assert() -- compared to g_assert(), g_return_*() and assert() -- is that this variant is disabled by default. It's only used for checks that are really really not supposed to fail and/or which may be expensive to do. This is useful for developing and CI, but it's not right to put into the distribution. It really enables assertions that you don't want in such a scenario. Enabling them even for distribution builds defeats their purpose. If you care about an assertion to be usually/always enabled, you should use g_assert() or g_return_*() instead. What this changes, that "devel" builds in koji/brew do not have more-asserts enabled. When manually building the SRPM one still can enable it, for example via $ ./contrib/fedora/rpm/build_clean.sh -w debug Also our CI has an option to build packages with or without more-asserts (defaulting to more asserts already). --- contrib/fedora/rpm/NetworkManager.spec | 6 ------ 1 file changed, 6 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index f24cc8b70f..d31a548417 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -43,8 +43,6 @@ %global real_version_major %(printf '%s' '%{real_version}' | sed -n 's/^\\([1-9][0-9]*\\.[1-9][0-9]*\\)\\.[1-9][0-9]*$/\\1/p') -%global is_devel_build %(printf '%s' '%{real_version}' | sed -n 's/^1\\.\\([0-9]*[13579]\\)\\..*/1/p') - ############################################################################### %bcond_without adsl @@ -57,11 +55,7 @@ %bcond_without ppp %bcond_without nmtui %bcond_without regen_docs -%if 0%{is_devel_build} -%bcond_without debug -%else %bcond_with debug -%endif %bcond_without test %bcond_with sanitizer %if 0%{?fedora} > 28 || 0%{?rhel} > 7 From 815834aebcdf4b65311952163a8d38805e950407 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 8 Sep 2018 11:27:15 +0200 Subject: [PATCH 48/63] build: fix error message in configure script about gtk-doc --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f244d214e4..17ff1a6f65 100644 --- a/configure.ac +++ b/configure.ac @@ -1217,7 +1217,7 @@ else if test "$enable_gtk_doc" = "yes"; then # large parts of the documentation require introspection/pygobject to extract # the documentation out of the source files. You cannot enable gtk-doc without alone. - AC_MSG_ERROR(["--with-gtk-doc requires --enable-introspection"]) + AC_MSG_ERROR(["--enable-gtk-doc requires --enable-introspection"]) fi have_introspection=no fi From 02464c052e2f8a1e88b012e0a29f5f66fce310ad Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 9 Sep 2018 21:41:40 +0200 Subject: [PATCH 49/63] docs/test: add check that gtk-doc contains patch to generate proper documentation In libnm, we prefer opaque typedefs. gtk-doc needs to be patched to properly generate documentation. Add a check for that. Add a test. By default, this does not fail but just prints a warning. The test can be made failing by setting NMTST_CHECK_GTK_DOC=1. See-also: https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/2 --- docs/libnm/Makefile.am | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index c5f2b836ba..7aa9810e81 100644 --- a/docs/libnm/Makefile.am +++ b/docs/libnm/Makefile.am @@ -1,6 +1,8 @@ ## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = 1.6 +check_local = + # The name of the module DOC_MODULE=libnm @@ -94,3 +96,13 @@ CLEANFILES += \ tmpl/* \ xml/* +if GTK_DOC_BUILD_HTML +check-local-gtk-doc-patch: + @if grep -q -F 'nm-setting-user' "$(top_builddir)/docs/libnm/html/index.html"; then \ + echo "WARNING: The generated documentation has issues. Patch your gtk-doc (see https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/2). Let this check fail with NMTST_CHECK_GTK_DOC=1"; \ + test "$$NMTST_CHECK_GTK_DOC" != 1; \ + fi +check_local += check-local-gtk-doc-patch +endif + +check-local: $(check_local) From 5894da67dc040fccd40c014ab73f31e1d9e1e661 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 07:49:51 +0200 Subject: [PATCH 50/63] contrib/rpm: add --release option to build_clean.sh script The correct way to create a tarball for release is ./contrib/fedora/rpm/build_clean.sh -r Just ensure to issue this from a clean shell environment. --- contrib/fedora/rpm/build_clean.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh index 1bf932f5cb..c6d08f538c 100755 --- a/contrib/fedora/rpm/build_clean.sh +++ b/contrib/fedora/rpm/build_clean.sh @@ -24,6 +24,7 @@ usage() { echo " -w|--with \$OPTION: pass --with \$OPTION to rpmbuild. For example --with debug" echo " -W|--without \$OPTION: pass --without \$OPTION to rpmbuild. For example --without debug" echo " -s|--snapshot TEXT: use TEXT as the snapshot version for the new package (overwrites \$NM_BUILD_SNAPSHOT environment)" + echo " -r|--release: built a release tarball (this option must be alone)" } @@ -44,6 +45,8 @@ WITH_LIST=() SOURCE_FROM_GIT=0 SNAPSHOT="$NM_BUILD_SNAPSHOT" +NARGS=$# + while [[ $# -gt 0 ]]; do A="$1" shift @@ -55,6 +58,11 @@ while [[ $# -gt 0 ]]; do -f|--force) IGNORE_DIRTY=1 ;; + -r|--release) + [[ $NARGS -eq 1 ]] || die "--release option must be alone" + export NMTST_CHECK_GTK_DOC=1 + BUILDTYPE=SRPM + ;; -c|--clean) GIT_CLEAN=1 ;; From 58b030f39a3241313fd500a67bff5d1b07019b30 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 09:48:02 +0200 Subject: [PATCH 51/63] contrib/rpm: always run tests and enable more compiler warnings in package build - always enable more compiler warnings. They are not marked as breaking the build anyway. - also, always build with '--with-tests=yes'. Note that our autotools is actually very nice. Even if you build '--with-tests=no', you still can run `make check` and the tests are build on demand. The only difference here is whether the tests are build during `make` or during `make check`. While little difference, build everything during the `make` step. - when running tests, use `make -k check`. Even if they fail, we want to run the entire test suite. - also running tests are disabled, still run them. But don't let them fail the build. --- contrib/fedora/rpm/NetworkManager.spec | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index d31a548417..c48a82c330 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -540,12 +540,8 @@ intltoolize --automake --copy --force --with-systemdsystemunitdir=%{systemd_dir} \ --with-system-ca-path=/etc/pki/tls/cert.pem \ --with-dbus-sys-dir=%{dbus_sys_dir} \ -%if %{with test} --with-tests=yes \ -%else --enable-more-warnings=yes \ - --with-tests=no \ -%endif --with-valgrind=no \ --enable-ifcfg-rh=yes \ %if %{with ppp} @@ -605,7 +601,9 @@ touch %{buildroot}%{_sbindir}/ifup %{buildroot}%{_sbindir}/ifdown %check %if %{with test} -make %{?_smp_mflags} check +make -k %{?_smp_mflags} check +%else +make -k %{?_smp_mflags} check || : %endif From ad850c4f03a93a21d745b2e46cca78525bdad843 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 09:59:57 +0200 Subject: [PATCH 52/63] contrib/rpm: disable tests by default and use fatal-warnings with tests In general, when we build a package, we want no compiler warnings and all unit tests to pass. That is in particular true when building a package for the distribution in koji. When builing in koji, we (rightly) cannot pass rpmbuild options, so the default whether tests/compiler-warnings are fatal matter very much. One could argue: let's have the tests/compiler-warnings fatal and fail the build. During a build in koji for a Fedora release, we want them all pass. And if somebody does a manual build, the person can patch the spec file (or use rpmbuild flags). However, note how commit "f7b5e48cdb contrib/rpm: don't force fatal warnings with tests" already disabled fatal compiler warnings. Why? It seems compiler warnings should be even more stable than our unit tests, as long as you target a particular Fedora release and compiler version. So this was done to support rebuilding an SRPM for a different Fedora release, or to be more graceful during early development phase of a Fedora release, where things are not as stable yet. The exactly same reasoning applies to treating unit-tests failures as fatal. For example, a recent iproute2 issue broke unit tests. That meant, with that iproute2 release in build root, the NetworkManager RPM could not be built. Very annoying. Now: - if "test" is enabled, that means both `make check` and compiler warnings are treated fatal. If "test" is disabled, `make check` and compiler warnings are still done, just not fatal. - "test" is now disabled by default via the spec file. They are not fatal when building in koji or when rebuilding the package manually. - tests can be enabled optionally. Note that the "build_clean.sh" script enables them by default. So, a user using this script would need to explicitly "--without test". --- contrib/fedora/rpm/NetworkManager.spec | 6 +++++- contrib/fedora/rpm/build_clean.sh | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index c48a82c330..753ff08fc2 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -56,7 +56,7 @@ %bcond_without nmtui %bcond_without regen_docs %bcond_with debug -%bcond_without test +%bcond_with test %bcond_with sanitizer %if 0%{?fedora} > 28 || 0%{?rhel} > 7 %bcond_with libnm_glib @@ -541,7 +541,11 @@ intltoolize --automake --copy --force --with-system-ca-path=/etc/pki/tls/cert.pem \ --with-dbus-sys-dir=%{dbus_sys_dir} \ --with-tests=yes \ +%if %{with test} + --enable-more-warnings=error \ +%else --enable-more-warnings=yes \ +%endif --with-valgrind=no \ --enable-ifcfg-rh=yes \ %if %{with ppp} diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh index c6d08f538c..888cac8cbb 100755 --- a/contrib/fedora/rpm/build_clean.sh +++ b/contrib/fedora/rpm/build_clean.sh @@ -41,7 +41,7 @@ IGNORE_DIRTY=0 GIT_CLEAN=0 QUICK=0 NO_DIST=0 -WITH_LIST=() +WITH_LIST=(--with test) SOURCE_FROM_GIT=0 SNAPSHOT="$NM_BUILD_SNAPSHOT" @@ -157,10 +157,6 @@ if [[ $NO_DIST != 1 ]]; then fi fi -if [[ $QUICK == 1 ]]; then - WITH_LIST=(--without test "${WITH_LIST[@]}") -fi - export SOURCE_FROM_GIT export BUILDTYPE export NM_RPMBUILD_ARGS="${WITH_LIST[@]}" From cc8c207120a766946b25d39ab5211840a12d20cb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 14:22:06 +0200 Subject: [PATCH 53/63] contrib/rpm: fix handling of --with test default Seems rpmbuild does not honor the latest occurance with --with test --without test to disable tests. Work around that. Fixes: ad850c4f03a93a21d745b2e46cca78525bdad843 --- contrib/fedora/rpm/build_clean.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/fedora/rpm/build_clean.sh b/contrib/fedora/rpm/build_clean.sh index 888cac8cbb..4ceedf40ac 100755 --- a/contrib/fedora/rpm/build_clean.sh +++ b/contrib/fedora/rpm/build_clean.sh @@ -41,10 +41,12 @@ IGNORE_DIRTY=0 GIT_CLEAN=0 QUICK=0 NO_DIST=0 -WITH_LIST=(--with test) +WITH_LIST=() SOURCE_FROM_GIT=0 SNAPSHOT="$NM_BUILD_SNAPSHOT" +ADD_WITH_TEST=1 + NARGS=$# while [[ $# -gt 0 ]]; do @@ -90,11 +92,17 @@ while [[ $# -gt 0 ]]; do -w|--with) [[ $# -gt 0 ]] || die "Missing argument to $A" WITH_LIST=("${WITH_LIST[@]}" "--with" "$1") + if [[ "$1" == test ]]; then + ADD_WITH_TEST=0 + fi shift ;; -W|--without) [[ $# -gt 0 ]] || die "Missing argument to $A" WITH_LIST=("${WITH_LIST[@]}" "--without" "$1") + if [[ "$1" == test ]]; then + ADD_WITH_TEST=0 + fi shift ;; *) @@ -157,6 +165,10 @@ if [[ $NO_DIST != 1 ]]; then fi fi +if [[ "$ADD_WITH_TEST" == 1 ]]; then + WITH_LIST=("${WITH_LIST[@]}" "--with" "test") +fi + export SOURCE_FROM_GIT export BUILDTYPE export NM_RPMBUILD_ARGS="${WITH_LIST[@]}" From 5815ae8c60961f088e4e54b41ddf8254cb83574a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 11:13:05 +0200 Subject: [PATCH 54/63] cli: fix reading "vpn.secrets.*" from passwd-file Due to a bug, we required VPN secrets to be prefixed with "vpn.secret." instead of "vpn.secrets.". This was a change in behavior with 1.12.0 release. Fix it, to restore the old behavior. For backward compatibility to the broken behavior, adjust parse_passwords() to treat accept that as well. https://bugzilla.redhat.com/show_bug.cgi?id=1628833 https://github.com/NetworkManager/NetworkManager/pull/201 Fixes: 0601b5d725b072bd3ce4ec60be867898a16f85cd --- clients/cli/common.c | 6 +++--- clients/cli/connections.c | 10 +++++++++- clients/common/nm-secret-agent-simple.c | 2 +- clients/common/nm-secret-agent-simple.h | 2 +- clients/tui/nmtui-connect.c | 6 +++--- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/clients/cli/common.c b/clients/cli/common.c index ede447bad0..88e9815455 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -645,13 +645,13 @@ vpn_openconnect_get_secrets (NMConnection *connection, GPtrArray *secrets) if (!nm_streq0 (secret->vpn_type, NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT)) continue; - if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "cookie")) { + if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "cookie")) { g_free (secret->value); secret->value = g_steal_pointer (&cookie); - } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gateway")) { + } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gateway")) { g_free (secret->value); secret->value = g_steal_pointer (&gateway); - } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gwcert")) { + } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gwcert")) { g_free (secret->value); secret->value = g_steal_pointer (&gwcert); } diff --git a/clients/cli/connections.c b/clients/cli/connections.c index ad0b767215..bcd257ac2e 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -2607,7 +2607,15 @@ parse_passwords (const char *passwd_file, GError **error) return NULL; } - pwd_spec = g_strdup_printf ("%s.%s", setting, prop); + if ( nm_streq (setting, "vpn") + && g_str_has_prefix (prop, "secret.")) { + /* in 1.12.0, we wrongly required the VPN secrets to be named + * "vpn.secret". It should be "vpn.secrets". Work around it + * (rh#1628833). */ + pwd_spec = g_strdup_printf ("vpn.secrets.%s", &prop[NM_STRLEN ("secret.")]); + } else + pwd_spec = g_strdup_printf ("%s.%s", setting, prop); + g_hash_table_insert (pwds_hash, pwd_spec, g_strdup (pwd)); } return g_steal_pointer (&pwds_hash); diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index 7048e0ef3e..cab0c15ab8 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -195,7 +195,7 @@ nm_secret_agent_simple_secret_new (NMSecretAgentSecretType secret_type, real->base.is_secret = (secret_type != NM_SECRET_AGENT_SECRET_TYPE_PROPERTY); break; case NM_SECRET_AGENT_SECRET_TYPE_VPN_SECRET: - vpn_prefix = NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET; + vpn_prefix = NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS; value = nm_setting_vpn_get_secret (NM_SETTING_VPN (setting), property); real->base.entry_id = g_strdup_printf ("%s%s", vpn_prefix, property); nm_assert (vpn_type); diff --git a/clients/common/nm-secret-agent-simple.h b/clients/common/nm-secret-agent-simple.h index 505987dfd9..529aaeaca9 100644 --- a/clients/common/nm-secret-agent-simple.h +++ b/clients/common/nm-secret-agent-simple.h @@ -56,7 +56,7 @@ typedef struct { gboolean is_secret; } NMSecretAgentSimpleSecret; -#define NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "vpn.secret." +#define NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "vpn.secrets." #define NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT NM_DBUS_INTERFACE".openconnect" diff --git a/clients/tui/nmtui-connect.c b/clients/tui/nmtui-connect.c index 2a954fb8cb..6f29e13e9e 100644 --- a/clients/tui/nmtui-connect.c +++ b/clients/tui/nmtui-connect.c @@ -121,13 +121,13 @@ secrets_requested (NMSecretAgentSimple *agent, continue; if (!nm_streq0 (secret->vpn_type, NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT)) continue; - if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "cookie")) { + if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "cookie")) { g_free (secret->value); secret->value = g_steal_pointer (&cookie); - } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gateway")) { + } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gateway")) { g_free (secret->value); secret->value = g_steal_pointer (&gateway); - } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRET "gwcert")) { + } else if (nm_streq0 (secret->entry_id, NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "gwcert")) { g_free (secret->value); secret->value = g_steal_pointer (&gwcert); } From 92344dd0848f2353b81eab5b0b294eb92aaf59c0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 11:53:27 +0200 Subject: [PATCH 55/63] vpn: fix assertion during "SecretsRequired" in unexpected state Got this assertion: NetworkManager[12939]: [1536917977.4868] active-connection[0x563d8fd34540]: set state deactivated (was deactivating) ... NetworkManager[12939]: nm-openvpn[1106] openvpn[1132]: send SIGTERM NetworkManager[12939]: nm-openvpn[1106] wait for 1 openvpn processes to terminate... NetworkManager[12939]: nm-openvpn[1106] openvpn[1132] exited with error code 1 NetworkManager[12939]: [1536917977.5035] vpn-connection[0x563d8fd34540,2fdeaea3-975f-4325-8305-83ebca5eaa26,"my-openvpn-Red-Hat",0]: VPN plugin: requested secrets; state disconnected (9) NetworkManager[12939]: plugin_interactive_secrets_required: assertion 'priv->vpn_state == STATE_CONNECT || priv->vpn_state == STATE_NEED_AUTH' failed Meaning. We should either ensure that secrets_required_cb() signal callback is disconnected from proxy's signal, or we gracefully handle callbacks at unexpected moments. Do the latter. --- src/vpn/nm-vpn-connection.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index d1aaa7c991..3a866200c0 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -2684,12 +2684,16 @@ plugin_interactive_secrets_required (NMVpnConnection *self, gs_free const char **hints = NULL; gs_free char *message_hint = NULL; + if (!NM_IN_SET (priv->vpn_state, STATE_CONNECT, + STATE_NEED_AUTH)) { + _LOGD ("VPN plugin: requested secrets; state %s (%d); ignore request in current state", + vpn_state_to_string (priv->vpn_state), priv->vpn_state); + return; + } + _LOGI ("VPN plugin: requested secrets; state %s (%d)", vpn_state_to_string (priv->vpn_state), priv->vpn_state); - g_return_if_fail (priv->vpn_state == STATE_CONNECT || - priv->vpn_state == STATE_NEED_AUTH); - priv->secrets_idx = SECRETS_REQ_INTERACTIVE; _set_vpn_state (self, STATE_NEED_AUTH, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE); From 6ebb9091d272c7af4e1eaab4a110f7de37fb2b4d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 14:11:48 +0200 Subject: [PATCH 56/63] vpn: disconnect signal handlers from proxy in NMVpnConnection::dispose() We cannot be sure who holds a reference to the proxy, and who is gonna call us back after the VPN connection instance is destroyed. --- src/vpn/nm-vpn-connection.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index 3a866200c0..bd847d75c5 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -2760,6 +2760,9 @@ dispose (GObject *object) NMVpnConnection *self = NM_VPN_CONNECTION (object); NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self); + if (priv->proxy) + g_signal_handlers_disconnect_by_data (priv->proxy, self); + nm_clear_g_source (&priv->start_timeout); g_clear_pointer (&priv->connect_hash, g_variant_unref); From a10156f5165f644e344fa5163a5958080a2a7393 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 16:01:45 +0200 Subject: [PATCH 57/63] libnm: drop API nm_connection_get_setting_{6lowpan,sriov,wpan}() Note that NMSettingEthtool and NMSettingMatch don't have such functions either. We have API nm_connection_get_setting (NMConnection *, GType) nm_connection_get_setting_by_name (NMConnection *, const char *) which can be used generically, meaning: the requested setting type is an argument to the function. That is generally more useful and flexible. Don't add API which duplicates existing functionality and is (arguably) inferiour. Drop it now. This is an ABI/API break for the current development cycle where the 1.14.0 API is still unstable. Indeed it's already after 1.14-rc1, which is ugly. But it's also unlikely that somebody already uses this API/ABI and is badly impacted by this change. Note that nm_connection_get_setting() and nm_connection_get_setting_by_name() are slightly inconvenient in C still, because they usually require a cast. We should fix that by changing the return type to "void *". Such a change may be possibly any time without breaking API/ABI (almost, it'd be an API change when taking a function pointer without casting). --- libnm-core/nm-connection.c | 50 +------------------ libnm-core/nm-connection.h | 6 --- libnm/libnm.ver | 3 -- src/devices/nm-device-6lowpan.c | 10 ++-- src/devices/nm-device-wpan.c | 8 +-- .../plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 2 +- .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 2 +- 7 files changed, 12 insertions(+), 69 deletions(-) diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index a5df08142f..172f9c99e4 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -1216,7 +1216,7 @@ _normalize_sriov_vf_order (NMConnection *self, GHashTable *parameters) { NMSettingSriov *s_sriov; - s_sriov = nm_connection_get_setting_sriov (self); + s_sriov = NM_SETTING_SRIOV (nm_connection_get_setting (self, NM_TYPE_SETTING_SRIOV)); if (!s_sriov) return FALSE; @@ -2278,22 +2278,6 @@ nm_connection_get_virtual_device_description (NMConnection *connection) /*****************************************************************************/ -/** - * nm_connection_get_setting_6lowpan: - * @connection: the #NMConnection - * - * A shortcut to return any #NMSetting6Lowpan the connection might contain. - * - * Returns: (transfer none): an #NMSetting6Lowpan if the connection contains one, otherwise %NULL - * - * Since: 1.14 - **/ -NMSetting6Lowpan * -nm_connection_get_setting_6lowpan (NMConnection *connection) -{ - return _connection_get_setting_check (connection, NM_TYPE_SETTING_6LOWPAN); -} - /** * nm_connection_get_setting_802_1x: * @connection: the #NMConnection @@ -2700,22 +2684,6 @@ nm_connection_get_setting_serial (NMConnection *connection) return _connection_get_setting_check (connection, NM_TYPE_SETTING_SERIAL); } -/** - * nm_connection_get_setting_sriov: - * @connection: the #NMConnection - * - * A shortcut to return any #NMSettingSriov the connection might contain. - * - * Returns: (transfer none): an #NMSettingSriov if the connection contains one, otherwise %NULL - * - * Since: 1.14 - **/ -NMSettingSriov * -nm_connection_get_setting_sriov (NMConnection *connection) -{ - return _connection_get_setting_check (connection, NM_TYPE_SETTING_SRIOV); -} - /** * nm_connection_get_setting_tc_config: * @connection: the #NMConnection @@ -2876,22 +2844,6 @@ nm_connection_get_setting_vlan (NMConnection *connection) return _connection_get_setting_check (connection, NM_TYPE_SETTING_VLAN); } -/** - * nm_connection_get_setting_wpan: - * @connection: the #NMConnection - * - * A shortcut to return any #NMSettingWpan the connection might contain. - * - * Returns: (transfer none): an #NMSettingWpan if the connection contains one, otherwise %NULL - * - * Since: 1.14 - **/ -NMSettingWpan * -nm_connection_get_setting_wpan (NMConnection *connection) -{ - return _connection_get_setting_check (connection, NM_TYPE_SETTING_WPAN); -} - NMSettingBluetooth * _nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection) { diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h index 312760f157..af91b11839 100644 --- a/libnm-core/nm-connection.h +++ b/libnm-core/nm-connection.h @@ -193,8 +193,6 @@ const char * nm_connection_get_connection_type (NMConnection *connection); gboolean nm_connection_is_virtual (NMConnection *connection); char * nm_connection_get_virtual_device_description (NMConnection *connection); -NM_AVAILABLE_IN_1_14 -NMSetting6Lowpan * nm_connection_get_setting_6lowpan (NMConnection *connection); NMSetting8021x * nm_connection_get_setting_802_1x (NMConnection *connection); NMSettingBluetooth * nm_connection_get_setting_bluetooth (NMConnection *connection); NMSettingBond * nm_connection_get_setting_bond (NMConnection *connection); @@ -231,8 +229,6 @@ NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnec NM_AVAILABLE_IN_1_6 NMSettingProxy * nm_connection_get_setting_proxy (NMConnection *connection); NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection); -NM_AVAILABLE_IN_1_14 -NMSettingSriov * nm_connection_get_setting_sriov (NMConnection *connection); NM_AVAILABLE_IN_1_12 NMSettingTCConfig * nm_connection_get_setting_tc_config (NMConnection *connection); NMSettingTun * nm_connection_get_setting_tun (NMConnection *connection); @@ -245,8 +241,6 @@ NMSettingWirelessSecurity *nm_connection_get_setting_wireless_security (NMConnec NMSettingVlan * nm_connection_get_setting_vlan (NMConnection *connection); NM_AVAILABLE_IN_1_2 NMSettingVxlan * nm_connection_get_setting_vxlan (NMConnection *connection); -NM_AVAILABLE_IN_1_14 -NMSettingWpan * nm_connection_get_setting_wpan (NMConnection *connection); G_END_DECLS diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 00dd06e4f5..476cfcc9eb 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1382,9 +1382,6 @@ libnm_1_12_2 { libnm_1_14_0 { global: - nm_connection_get_setting_6lowpan; - nm_connection_get_setting_sriov; - nm_connection_get_setting_wpan; nm_connection_multi_connect_get_type; nm_device_6lowpan_get_type; nm_device_wireguard_get_fwmark; diff --git a/src/devices/nm-device-6lowpan.c b/src/devices/nm-device-6lowpan.c index 600d1b80b1..b6b9157ca4 100644 --- a/src/devices/nm-device-6lowpan.c +++ b/src/devices/nm-device-6lowpan.c @@ -114,7 +114,7 @@ create_and_realize (NMDevice *device, NMSetting6Lowpan *s_6lowpan; int parent_ifindex; - s_6lowpan = nm_connection_get_setting_6lowpan (connection); + s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN)); g_return_val_if_fail (s_6lowpan, FALSE); parent_ifindex = parent ? nm_device_get_ifindex (parent) : 0; @@ -192,7 +192,7 @@ complete_connection (NMDevice *device, NULL, TRUE); - s_6lowpan = nm_connection_get_setting_6lowpan (connection); + s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN)); if (!s_6lowpan) { g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION, "A '6lowpan' setting is required."); @@ -215,7 +215,7 @@ complete_connection (NMDevice *device, static void update_connection (NMDevice *device, NMConnection *connection) { - NMSetting6Lowpan *s_6lowpan = nm_connection_get_setting_6lowpan (connection); + NMSetting6Lowpan *s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN)); if (!s_6lowpan) { s_6lowpan = (NMSetting6Lowpan *) nm_setting_6lowpan_new (); @@ -310,7 +310,7 @@ get_connection_parent (NMDeviceFactory *factory, NMConnection *connection) g_return_val_if_fail (nm_connection_is_type (connection, NM_SETTING_6LOWPAN_SETTING_NAME), NULL); - s_6lowpan = nm_connection_get_setting_6lowpan (connection); + s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN)); g_assert (s_6lowpan); return nm_setting_6lowpan_get_parent (s_6lowpan); @@ -326,7 +326,7 @@ get_connection_iface (NMDeviceFactory *factory, g_return_val_if_fail (nm_connection_is_type (connection, NM_SETTING_6LOWPAN_SETTING_NAME), NULL); - s_6lowpan = nm_connection_get_setting_6lowpan (connection); + s_6lowpan = NM_SETTING_6LOWPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_6LOWPAN)); g_assert (s_6lowpan); if (!parent_iface) diff --git a/src/devices/nm-device-wpan.c b/src/devices/nm-device-wpan.c index dd2ebac149..f910b0b899 100644 --- a/src/devices/nm-device-wpan.c +++ b/src/devices/nm-device-wpan.c @@ -69,7 +69,7 @@ complete_connection (NMDevice *device, NULL, TRUE); - s_wpan = nm_connection_get_setting_wpan (connection); + s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN)); if (!s_wpan) { g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'wpan' setting is required."); @@ -82,7 +82,7 @@ complete_connection (NMDevice *device, static void update_connection (NMDevice *device, NMConnection *connection) { - NMSettingWpan *s_wpan = nm_connection_get_setting_wpan (connection); + NMSettingWpan *s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN)); if (!s_wpan) { s_wpan = (NMSettingWpan *) nm_setting_wpan_new (); @@ -99,7 +99,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection, GError if (!NM_DEVICE_CLASS (nm_device_wpan_parent_class)->check_connection_compatible (device, connection, error)) return FALSE; - s_wpan = nm_connection_get_setting_wpan (connection); + s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN)); mac = nm_setting_wpan_get_mac_address (s_wpan); if (mac) { @@ -143,7 +143,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) connection = nm_device_get_applied_connection (device); g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE); - s_wpan = nm_connection_get_setting_wpan (connection); + s_wpan = NM_SETTING_WPAN (nm_connection_get_setting (connection, NM_TYPE_SETTING_WPAN)); g_return_val_if_fail (s_wpan, NM_ACT_STAGE_RETURN_FAILURE); hwaddr = nm_platform_link_get_address (platform, ifindex, &hwaddr_len); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index e1a2289e4d..b70690cc9f 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -2223,7 +2223,7 @@ write_sriov_setting (NMConnection *connection, shvarFile *ifcfg) svUnsetAll (ifcfg, SV_KEY_TYPE_SRIOV_VF); - s_sriov = nm_connection_get_setting_sriov (connection); + s_sriov = NM_SETTING_SRIOV (nm_connection_get_setting (connection, NM_TYPE_SETTING_SRIOV)); if (s_sriov) num = nm_setting_sriov_get_total_vfs (s_sriov); if (num == 0) { diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 7069386103..0c0dd64ee5 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -9721,7 +9721,7 @@ test_sriov_read (void) g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "eth0"); - s_sriov = nm_connection_get_setting_sriov (connection); + s_sriov = NM_SETTING_SRIOV (nm_connection_get_setting (connection, NM_TYPE_SETTING_SRIOV)); g_assert (s_sriov); g_assert_cmpint (nm_setting_sriov_get_total_vfs (s_sriov), ==, 16); From c1b647d54f659da3f72b449ead5c24fb338c3533 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 16:48:51 +0200 Subject: [PATCH 58/63] autoptr: add missing autoptr cleanup functions --- libnm/nm-autoptr.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnm/nm-autoptr.h b/libnm/nm-autoptr.h index 665c28c0e4..e96a03a099 100644 --- a/libnm/nm-autoptr.h +++ b/libnm/nm-autoptr.h @@ -37,6 +37,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMClient, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMConnection, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSetting, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSetting6Lowpan, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSetting8021x, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingAdsl, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingBluetooth, g_object_unref) @@ -57,6 +58,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingIPConfig, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingIPTunnel, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingMacsec, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingMacvlan, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingMatch, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOlpcMesh, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOvsBridge, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingOvsInterface, g_object_unref) @@ -66,6 +68,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingPpp, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingPppoe, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingProxy, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingSerial, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingSriov, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingTCConfig, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingTeam, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingTeamPort, g_object_unref) @@ -78,6 +81,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWimax, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWired, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWireless, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWirelessSecurity, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMSettingWpan, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMVpnEditor, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (NMVpnEditorPlugin, g_object_unref) From bbc93a2e3072438f16102463bfa0ed97a3ddb009 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 16:44:28 +0200 Subject: [PATCH 59/63] libnm: add missing NM_AVAILABLE_IN_1_14 macro to new API Fixes: df30651b8906cfe6a5cb7aef01a220d1f21b80f3 --- libnm-core/nm-setting-ethtool.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libnm-core/nm-setting-ethtool.h b/libnm-core/nm-setting-ethtool.h index 6a0458a516..66a9448993 100644 --- a/libnm-core/nm-setting-ethtool.h +++ b/libnm-core/nm-setting-ethtool.h @@ -84,6 +84,7 @@ G_BEGIN_DECLS #define NM_ETHTOOL_OPTNAME_FEATURE_TX_UDP_TNL_SEGMENTATION "feature-tx-udp_tnl-segmentation" #define NM_ETHTOOL_OPTNAME_FEATURE_TX_VLAN_STAG_HW_INSERT "feature-tx-vlan-stag-hw-insert" +NM_AVAILABLE_IN_1_14 gboolean nm_ethtool_optname_is_feature (const char *optname); /*****************************************************************************/ From a525b12c5a17dba46ae4323d112284e1c6cf4ddc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 16:54:33 +0200 Subject: [PATCH 60/63] libnm: add missing NM_AVAILABLE_IN_1_2 macro for nm_connection_get_setting_tun() --- libnm-core/nm-connection.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h index af91b11839..802f68ba5a 100644 --- a/libnm-core/nm-connection.h +++ b/libnm-core/nm-connection.h @@ -231,6 +231,7 @@ NMSettingProxy * nm_connection_get_setting_proxy (NMConnec NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection); NM_AVAILABLE_IN_1_12 NMSettingTCConfig * nm_connection_get_setting_tc_config (NMConnection *connection); +NM_AVAILABLE_IN_1_2 NMSettingTun * nm_connection_get_setting_tun (NMConnection *connection); NMSettingVpn * nm_connection_get_setting_vpn (NMConnection *connection); NMSettingWimax * nm_connection_get_setting_wimax (NMConnection *connection); From e645aeb12ccefb1fbe18bb33d046ee649de86da0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 17:06:36 +0200 Subject: [PATCH 61/63] libnm: document nm_utils_parse_variant_attributes() returning floating references See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1594887 --- libnm-core/nm-utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 9151a0109c..ab2902a637 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -6035,7 +6035,9 @@ attribute_unescape (const char *start, const char *end) * Parse attributes from a string. * * Returns: (transfer full) (element-type utf8 GVariant): a #GHashTable mapping - * attribute names to #GVariant values. + * attribute names to #GVariant values. Warning: the variant are still floating + * references, owned by the hash table. If you take a reference, ensure to sink + * the one of the hash table first. * * Since: 1.8 */ From 31bda1b8373c71ecb41d8208aa2bc9c88999d988 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 27 Jun 2018 09:57:41 +0200 Subject: [PATCH 62/63] clients: fix memory leak when parsing routes The new hash table should destroy elements stolen from the hash table returned by nm_utils_parse_variant_attributes(). Fixes: d0949141203f6a546317277ed788ea114d401dd8 --- clients/common/nm-meta-setting-desc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 8c27779e26..f794c67b2b 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -192,11 +192,20 @@ _parse_ip_route (int family, return NULL; } - if (!attrs) - attrs = g_hash_table_new (nm_str_hash, g_str_equal); + if (!attrs) { + attrs = g_hash_table_new_full (nm_str_hash, + g_str_equal, + g_free, + (GDestroyNotify) g_variant_unref); + } g_hash_table_iter_init (&iter, tmp_attrs); while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) { + + /* need to sink the reference, because nm_utils_parse_variant_attributes() returns + * floating refs. */ + g_variant_ref_sink (iter_value); + if (!nm_ip_route_attribute_validate (iter_key, iter_value, family, NULL, error)) { g_prefix_error (error, "%s: ", iter_key); g_hash_table_unref (tmp_attrs); From 3b5912f08d1a813fff64ac0e3ef82f9b4fa37763 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 14 Sep 2018 17:24:46 +0200 Subject: [PATCH 63/63] libnm/trivial: whitespace --- libnm-core/nm-utils.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index ab2902a637..f6e1555ef8 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -2141,10 +2141,10 @@ _tc_read_common_opts (const char *str, gs_unref_hashtable GHashTable *ht = NULL; GVariant *variant; - ht = nm_utils_parse_variant_attributes (str, - ' ', ' ', FALSE, - tc_object_attribute_spec, - error); + ht = nm_utils_parse_variant_attributes (str, + ' ', ' ', FALSE, + tc_object_attribute_spec, + error); if (!ht) return FALSE; @@ -2504,10 +2504,10 @@ nm_utils_tc_tfilter_from_str (const char *str, GError **error) return NULL; if (rest) { - ht = nm_utils_parse_variant_attributes (rest, - ' ', ' ', FALSE, - tc_tfilter_attribute_spec, - error); + ht = nm_utils_parse_variant_attributes (rest, + ' ', ' ', FALSE, + tc_tfilter_attribute_spec, + error); if (!ht) return NULL;