diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-05 15:19:27 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-18 15:22:34 +0200 |
commit | 3886cc8e0ca64fd5279d2e64c43704d5605aa4b1 (patch) | |
tree | 6c85859f5db702485b600eb842df91b431c1b937 | |
parent | f2e143f002a3227ecb76484220ca4d17704ed39f (diff) |
core: rename 'arping' to 'acd'
Now that the ACD functionality is no longer using arping, rename
nm-arping-manager to nm-acd-manager and other occurences of arping as
well.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.am | 14 | ||||
-rw-r--r-- | src/devices/nm-acd-manager.c (renamed from src/devices/nm-arping-manager.c) | 124 | ||||
-rw-r--r-- | src/devices/nm-acd-manager.h | 43 | ||||
-rw-r--r-- | src/devices/nm-arping-manager.h | 43 | ||||
-rw-r--r-- | src/devices/nm-device.c | 72 | ||||
-rw-r--r-- | src/devices/tests/meson.build | 2 | ||||
-rw-r--r-- | src/devices/tests/test-acd.c (renamed from src/devices/tests/test-arping.c) | 46 | ||||
-rw-r--r-- | src/meson.build | 2 | ||||
-rw-r--r-- | src/nm-types.h | 4 |
10 files changed, 177 insertions, 176 deletions
diff --git a/.gitignore b/.gitignore index 15284f526..febc17298 100644 --- a/.gitignore +++ b/.gitignore @@ -243,7 +243,7 @@ test-*.trs /src/NetworkManager /src/NetworkManager.ver -/src/devices/tests/test-arping +/src/devices/tests/test-acd /src/devices/tests/test-lldp /src/devices/wifi/tests/test-general /src/dhcp/nm-dhcp-helper @@ -314,3 +314,4 @@ test-*.trs /libnm-core/tests/test-setting-dcb /src/settings/plugins/ifnet /src/tests/test-resolvconf-capture +/src/devices/tests/test-arping diff --git a/Makefile.am b/Makefile.am index bbfd1d56b..b488c37e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1497,8 +1497,8 @@ src_libNetworkManager_la_SOURCES = \ src/devices/nm-device.h \ src/devices/nm-lldp-listener.c \ src/devices/nm-lldp-listener.h \ - src/devices/nm-arping-manager.c \ - src/devices/nm-arping-manager.h \ + src/devices/nm-acd-manager.c \ + src/devices/nm-acd-manager.h \ src/devices/nm-device-ethernet-utils.c \ src/devices/nm-device-ethernet-utils.h \ src/devices/nm-device-factory.c \ @@ -2999,20 +2999,20 @@ src_devices_tests_ldflags = \ check_programs += \ src/devices/tests/test-lldp \ - src/devices/tests/test-arping + src/devices/tests/test-acd src_devices_tests_test_lldp_CPPFLAGS = $(src_tests_cppflags) src_devices_tests_test_lldp_LDFLAGS = $(src_devices_tests_ldflags) src_devices_tests_test_lldp_LDADD = \ src/libNetworkManagerTest.la -src_devices_tests_test_arping_CPPFLAGS = $(src_tests_cppflags) -src_devices_tests_test_arping_LDFLAGS = $(src_devices_tests_ldflags) -src_devices_tests_test_arping_LDADD = \ +src_devices_tests_test_acd_CPPFLAGS = $(src_tests_cppflags) +src_devices_tests_test_acd_LDFLAGS = $(src_devices_tests_ldflags) +src_devices_tests_test_acd_LDADD = \ src/libNetworkManagerTest.la $(src_devices_tests_test_lldp_OBJECTS): $(libnm_core_lib_h_pub_mkenums) -$(src_devices_tests_test_arping_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(src_devices_tests_test_acd_OBJECTS): $(libnm_core_lib_h_pub_mkenums) EXTRA_DIST += \ src/devices/tests/meson.build diff --git a/src/devices/nm-arping-manager.c b/src/devices/nm-acd-manager.c index 2133aa117..3feb9de7b 100644 --- a/src/devices/nm-arping-manager.c +++ b/src/devices/nm-acd-manager.c @@ -16,7 +16,7 @@ #include "nm-default.h" -#include "nm-arping-manager.h" +#include "nm-acd-manager.h" #include <netinet/in.h> #include <sys/types.h> @@ -39,7 +39,7 @@ typedef enum { typedef struct { in_addr_t address; gboolean duplicate; - NMArpingManager *manager; + NMAcdManager *manager; NAcd *acd; GIOChannel *channel; guint event_id; @@ -58,29 +58,29 @@ typedef struct { State state; GHashTable *addresses; guint completed; -} NMArpingManagerPrivate; +} NMAcdManagerPrivate; -struct _NMArpingManager { +struct _NMAcdManager { GObject parent; - NMArpingManagerPrivate _priv; + NMAcdManagerPrivate _priv; }; -struct _NMArpingManagerClass { +struct _NMAcdManagerClass { GObjectClass parent; }; -G_DEFINE_TYPE (NMArpingManager, nm_arping_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE (NMAcdManager, nm_acd_manager, G_TYPE_OBJECT) -#define NM_ARPING_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMArpingManager, NM_IS_ARPING_MANAGER) +#define NM_ACD_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMAcdManager, NM_IS_ACD_MANAGER) /*****************************************************************************/ #define _NMLOG_DOMAIN LOGD_IP4 -#define _NMLOG_PREFIX_NAME "arping" +#define _NMLOG_PREFIX_NAME "acd" #define _NMLOG(level, ...) \ G_STMT_START { \ char _sbuf[64]; \ - int _ifindex = (self) ? NM_ARPING_MANAGER_GET_PRIVATE (self)->ifindex : 0; \ + int _ifindex = (self) ? NM_ACD_MANAGER_GET_PRIVATE (self)->ifindex : 0; \ \ nm_log ((level), _NMLOG_DOMAIN, \ nm_platform_link_get_name (NM_PLATFORM_GET, _ifindex), \ @@ -141,8 +141,8 @@ _acd_error_to_string (int error) /*****************************************************************************/ /** - * nm_arping_manager_add_address: - * @self: a #NMArpingManager + * nm_acd_manager_add_address: + * @self: a #NMAcdManager * @address: an IP address * * Add @address to the list of IP addresses to probe. @@ -150,13 +150,13 @@ _acd_error_to_string (int error) * Returns: %TRUE on success, %FALSE if the address was already in the list */ gboolean -nm_arping_manager_add_address (NMArpingManager *self, in_addr_t address) +nm_acd_manager_add_address (NMAcdManager *self, in_addr_t address) { - NMArpingManagerPrivate *priv; + NMAcdManagerPrivate *priv; AddressInfo *info; - g_return_val_if_fail (NM_IS_ARPING_MANAGER (self), FALSE); - priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + g_return_val_if_fail (NM_IS_ACD_MANAGER (self), FALSE); + priv = NM_ACD_MANAGER_GET_PRIVATE (self); g_return_val_if_fail (priv->state == STATE_INIT, FALSE); if (g_hash_table_lookup (priv->addresses, GUINT_TO_POINTER (address))) @@ -175,8 +175,8 @@ static gboolean acd_event (GIOChannel *source, GIOCondition condition, gpointer data) { AddressInfo *info = data; - NMArpingManager *self = info->manager; - NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + NMAcdManager *self = info->manager; + NMAcdManagerPrivate *priv = NM_ACD_MANAGER_GET_PRIVATE (self); NAcdEvent *event; char address_str[INET_ADDRSTRLEN]; gs_free char *hwaddr_str = NULL; @@ -235,11 +235,11 @@ acd_event (GIOChannel *source, GIOCondition condition, gpointer data) } static gboolean -acd_probe_start (NMArpingManager *self, +acd_probe_start (NMAcdManager *self, AddressInfo *info, guint64 timeout) { - NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + NMAcdManagerPrivate *priv = NM_ACD_MANAGER_GET_PRIVATE (self); NAcdConfig *config; int r, fd; @@ -280,8 +280,8 @@ acd_probe_start (NMArpingManager *self, } /** - * nm_arping_manager_start_probe: - * @self: a #NMArpingManager + * nm_acd_manager_start_probe: + * @self: a #NMAcdManager * @timeout: maximum probe duration in milliseconds * @error: location to store error, or %NULL * @@ -291,16 +291,16 @@ acd_probe_start (NMArpingManager *self, * Returns: %TRUE if at least one probe could be started, %FALSE otherwise */ gboolean -nm_arping_manager_start_probe (NMArpingManager *self, guint timeout) +nm_acd_manager_start_probe (NMAcdManager *self, guint timeout) { - NMArpingManagerPrivate *priv; + NMAcdManagerPrivate *priv; GHashTableIter iter; AddressInfo *info; gs_free char *timeout_str = NULL; gboolean success = FALSE; - g_return_val_if_fail (NM_IS_ARPING_MANAGER (self), FALSE); - priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + g_return_val_if_fail (NM_IS_ACD_MANAGER (self), FALSE); + priv = NM_ACD_MANAGER_GET_PRIVATE (self); g_return_val_if_fail (priv->state == STATE_INIT, FALSE); priv->completed = 0; @@ -316,18 +316,18 @@ nm_arping_manager_start_probe (NMArpingManager *self, guint timeout) } /** - * nm_arping_manager_reset: - * @self: a #NMArpingManager + * nm_acd_manager_reset: + * @self: a #NMAcdManager * * Stop any operation in progress and reset @self to the initial state. */ void -nm_arping_manager_reset (NMArpingManager *self) +nm_acd_manager_reset (NMAcdManager *self) { - NMArpingManagerPrivate *priv; + NMAcdManagerPrivate *priv; - g_return_if_fail (NM_IS_ARPING_MANAGER (self)); - priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + g_return_if_fail (NM_IS_ACD_MANAGER (self)); + priv = NM_ACD_MANAGER_GET_PRIVATE (self); g_hash_table_remove_all (priv->addresses); @@ -335,38 +335,38 @@ nm_arping_manager_reset (NMArpingManager *self) } /** - * nm_arping_manager_destroy: - * @self: the #NMArpingManager + * nm_acd_manager_destroy: + * @self: the #NMAcdManager * - * Calls nm_arping_manager_reset() and unrefs @self. + * Calls nm_acd_manager_reset() and unrefs @self. */ void -nm_arping_manager_destroy (NMArpingManager *self) +nm_acd_manager_destroy (NMAcdManager *self) { - g_return_if_fail (NM_IS_ARPING_MANAGER (self)); + g_return_if_fail (NM_IS_ACD_MANAGER (self)); - nm_arping_manager_reset (self); + nm_acd_manager_reset (self); g_object_unref (self); } /** - * nm_arping_manager_check_address: - * @self: a #NMArpingManager + * nm_acd_manager_check_address: + * @self: a #NMAcdManager * @address: an IP address * * Check if an IP address is duplicate. @address must have been added with - * nm_arping_manager_add_address(). + * nm_acd_manager_add_address(). * * Returns: %TRUE if the address is not duplicate, %FALSE otherwise */ gboolean -nm_arping_manager_check_address (NMArpingManager *self, in_addr_t address) +nm_acd_manager_check_address (NMAcdManager *self, in_addr_t address) { - NMArpingManagerPrivate *priv; + NMAcdManagerPrivate *priv; AddressInfo *info; - g_return_val_if_fail (NM_IS_ARPING_MANAGER (self), FALSE); - priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + g_return_val_if_fail (NM_IS_ACD_MANAGER (self), FALSE); + priv = NM_ACD_MANAGER_GET_PRIVATE (self); g_return_val_if_fail ( priv->state == STATE_INIT || priv->state == STATE_PROBE_DONE, FALSE); @@ -377,15 +377,15 @@ nm_arping_manager_check_address (NMArpingManager *self, in_addr_t address) } /** - * nm_arping_manager_announce_addresses: - * @self: a #NMArpingManager + * nm_acd_manager_announce_addresses: + * @self: a #NMAcdManager * * Start announcing addresses. */ void -nm_arping_manager_announce_addresses (NMArpingManager *self) +nm_acd_manager_announce_addresses (NMAcdManager *self) { - NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + NMAcdManagerPrivate *priv = NM_ACD_MANAGER_GET_PRIVATE (self); GHashTableIter iter; AddressInfo *info; int r; @@ -437,26 +437,26 @@ destroy_address_info (gpointer data) /*****************************************************************************/ static void -nm_arping_manager_init (NMArpingManager *self) +nm_acd_manager_init (NMAcdManager *self) { - NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + NMAcdManagerPrivate *priv = NM_ACD_MANAGER_GET_PRIVATE (self); priv->addresses = g_hash_table_new_full (nm_direct_hash, NULL, NULL, destroy_address_info); priv->state = STATE_INIT; } -NMArpingManager * -nm_arping_manager_new (int ifindex, const guint8 *hwaddr, size_t hwaddr_len) +NMAcdManager * +nm_acd_manager_new (int ifindex, const guint8 *hwaddr, size_t hwaddr_len) { - NMArpingManager *self; - NMArpingManagerPrivate *priv; + NMAcdManager *self; + NMAcdManagerPrivate *priv; g_return_val_if_fail (hwaddr, NULL); g_return_val_if_fail (hwaddr_len == ETH_ALEN, NULL); - self = g_object_new (NM_TYPE_ARPING_MANAGER, NULL); - priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + self = g_object_new (NM_TYPE_ACD_MANAGER, NULL); + priv = NM_ACD_MANAGER_GET_PRIVATE (self); priv->ifindex = ifindex; memcpy (priv->hwaddr, hwaddr, ETH_ALEN); @@ -466,23 +466,23 @@ nm_arping_manager_new (int ifindex, const guint8 *hwaddr, size_t hwaddr_len) static void dispose (GObject *object) { - NMArpingManager *self = NM_ARPING_MANAGER (object); - NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self); + NMAcdManager *self = NM_ACD_MANAGER (object); + NMAcdManagerPrivate *priv = NM_ACD_MANAGER_GET_PRIVATE (self); g_clear_pointer (&priv->addresses, g_hash_table_destroy); - G_OBJECT_CLASS (nm_arping_manager_parent_class)->dispose (object); + G_OBJECT_CLASS (nm_acd_manager_parent_class)->dispose (object); } static void -nm_arping_manager_class_init (NMArpingManagerClass *klass) +nm_acd_manager_class_init (NMAcdManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = dispose; signals[PROBE_TERMINATED] = - g_signal_new (NM_ARPING_MANAGER_PROBE_TERMINATED, + g_signal_new (NM_ACD_MANAGER_PROBE_TERMINATED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, diff --git a/src/devices/nm-acd-manager.h b/src/devices/nm-acd-manager.h new file mode 100644 index 000000000..eeede5da7 --- /dev/null +++ b/src/devices/nm-acd-manager.h @@ -0,0 +1,43 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Copyright (C) 2015-2018 Red Hat, Inc. + */ + +#ifndef __NM_ACD_MANAGER__ +#define __NM_ACD_MANAGER__ + +#include <netinet/in.h> + +#define NM_TYPE_ACD_MANAGER (nm_acd_manager_get_type ()) +#define NM_ACD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACD_MANAGER, NMAcdManager)) +#define NM_ACD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ACD_MANAGER, NMAcdManagerClass)) +#define NM_IS_ACD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ACD_MANAGER)) +#define NM_IS_ACD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACD_MANAGER)) +#define NM_ACD_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACD_MANAGER, NMAcdManagerClass)) + +#define NM_ACD_MANAGER_PROBE_TERMINATED "probe-terminated" + +typedef struct _NMAcdManagerClass NMAcdManagerClass; + +GType nm_acd_manager_get_type (void); + +NMAcdManager *nm_acd_manager_new (int ifindex, const guint8 *hwaddr, size_t hwaddr_len); +void nm_acd_manager_destroy (NMAcdManager *self); +gboolean nm_acd_manager_add_address (NMAcdManager *self, in_addr_t address); +gboolean nm_acd_manager_start_probe (NMAcdManager *self, guint timeout); +gboolean nm_acd_manager_check_address (NMAcdManager *self, in_addr_t address); +void nm_acd_manager_announce_addresses (NMAcdManager *self); +void nm_acd_manager_reset (NMAcdManager *self); + +#endif /* __NM_ACD_MANAGER__ */ diff --git a/src/devices/nm-arping-manager.h b/src/devices/nm-arping-manager.h deleted file mode 100644 index a6585d36a..000000000 --- a/src/devices/nm-arping-manager.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Copyright (C) 2015 Red Hat, Inc. - */ - -#ifndef __NM_ARPING_MANAGER__ -#define __NM_ARPING_MANAGER__ - -#include <netinet/in.h> - -#define NM_TYPE_ARPING_MANAGER (nm_arping_manager_get_type ()) -#define NM_ARPING_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ARPING_MANAGER, NMArpingManager)) -#define NM_ARPING_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ARPING_MANAGER, NMArpingManagerClass)) -#define NM_IS_ARPING_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ARPING_MANAGER)) -#define NM_IS_ARPING_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ARPING_MANAGER)) -#define NM_ARPING_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ARPING_MANAGER, NMArpingManagerClass)) - -#define NM_ARPING_MANAGER_PROBE_TERMINATED "probe-terminated" - -typedef struct _NMArpingManagerClass NMArpingManagerClass; - -GType nm_arping_manager_get_type (void); - -NMArpingManager *nm_arping_manager_new (int ifindex, const guint8 *hwaddr, size_t hwaddr_len); -void nm_arping_manager_destroy (NMArpingManager *self); -gboolean nm_arping_manager_add_address (NMArpingManager *self, in_addr_t address); -gboolean nm_arping_manager_start_probe (NMArpingManager *self, guint timeout); -gboolean nm_arping_manager_check_address (NMArpingManager *self, in_addr_t address); -void nm_arping_manager_announce_addresses (NMArpingManager *self); -void nm_arping_manager_reset (NMArpingManager *self); - -#endif /* __NM_ARPING_MANAGER__ */ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8b8bef742..e86e19709 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -68,11 +68,11 @@ #include "nm-config.h" #include "c-list/src/c-list.h" #include "dns/nm-dns-manager.h" +#include "nm-acd-manager.h" #include "nm-core-internal.h" #include "systemd/nm-sd.h" #include "nm-lldp-listener.h" #include "nm-audit-manager.h" -#include "nm-arping-manager.h" #include "nm-connectivity.h" #include "nm-dbus-interface.h" #include "nm-device-vlan.h" @@ -129,13 +129,13 @@ typedef struct { int ifindex; } DeleteOnDeactivateData; -typedef void (*ArpingCallback) (NMDevice *, NMIP4Config **, gboolean); +typedef void (*AcdCallback) (NMDevice *, NMIP4Config **, gboolean); typedef struct { - ArpingCallback callback; + AcdCallback callback; NMDevice *device; NMIP4Config **configs; -} ArpingData; +} AcdData; typedef enum { HW_ADDR_TYPE_UNSET = 0, @@ -485,8 +485,8 @@ typedef struct _NMDevicePrivate { /* IPv4 DAD stuff */ struct { GSList * dad_list; - NMArpingManager * announcing; - } arping; + NMAcdManager * announcing; + } acd; union { const IpState ip6_state; @@ -6043,16 +6043,16 @@ get_ipv4_dad_timeout (NMDevice *self) } static void -arping_data_destroy (gpointer ptr, GClosure *closure) +acd_data_destroy (gpointer ptr, GClosure *closure) { - ArpingData *data = ptr; + AcdData *data = ptr; int i; if (data) { for (i = 0; data->configs && data->configs[i]; i++) g_object_unref (data->configs[i]); g_free (data->configs); - g_slice_free (ArpingData, data); + g_slice_free (AcdData, data); } } @@ -6072,7 +6072,7 @@ ipv4_manual_method_apply (NMDevice *self, NMIP4Config **configs, gboolean succes } static void -arping_manager_probe_terminated (NMArpingManager *arping_manager, ArpingData *data) +acd_manager_probe_terminated (NMAcdManager *acd_manager, AcdData *data) { NMDevice *self; NMDevicePrivate *priv; @@ -6087,7 +6087,7 @@ arping_manager_probe_terminated (NMArpingManager *arping_manager, ArpingData *da for (i = 0; data->configs && data->configs[i]; i++) { nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, data->configs[i], &address) { - result = nm_arping_manager_check_address (arping_manager, address->address); + result = nm_acd_manager_check_address (acd_manager, address->address); success &= result; _NMLOG (result ? LOGL_DEBUG : LOGL_WARN, @@ -6100,8 +6100,8 @@ arping_manager_probe_terminated (NMArpingManager *arping_manager, ArpingData *da data->callback (self, data->configs, success); - priv->arping.dad_list = g_slist_remove (priv->arping.dad_list, arping_manager); - nm_arping_manager_destroy (arping_manager); + priv->acd.dad_list = g_slist_remove (priv->acd.dad_list, acd_manager); + nm_acd_manager_destroy (acd_manager); } /** @@ -6115,13 +6115,13 @@ arping_manager_probe_terminated (NMArpingManager *arping_manager, ArpingData *da * be started. @configs will be unreferenced after @cb has been called. */ static void -ipv4_dad_start (NMDevice *self, NMIP4Config **configs, ArpingCallback cb) +ipv4_dad_start (NMDevice *self, NMIP4Config **configs, AcdCallback cb) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - NMArpingManager *arping_manager; + NMAcdManager *acd_manager; const NMPlatformIP4Address *address; NMDedupMultiIter ipconf_iter; - ArpingData *data; + AcdData *data; guint timeout; gboolean ret, addr_found; const guint8 *hwaddr_arr; @@ -6160,36 +6160,36 @@ ipv4_dad_start (NMDevice *self, NMIP4Config **configs, ArpingCallback cb) return; } - /* don't take additional references of @arping_manager that outlive @self. + /* don't take additional references of @acd_manager that outlive @self. * Otherwise, the callback can be invoked on a dangling pointer as we don't * disconnect the handler. */ - arping_manager = nm_arping_manager_new (nm_device_get_ip_ifindex (self), hwaddr_arr, length); - priv->arping.dad_list = g_slist_append (priv->arping.dad_list, arping_manager); + acd_manager = nm_acd_manager_new (nm_device_get_ip_ifindex (self), hwaddr_arr, length); + priv->acd.dad_list = g_slist_append (priv->acd.dad_list, acd_manager); - data = g_slice_new0 (ArpingData); + data = g_slice_new0 (AcdData); data->configs = configs; data->callback = cb; data->device = self; for (i = 0; configs[i]; i++) { nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, configs[i], &address) - nm_arping_manager_add_address (arping_manager, address->address); + nm_acd_manager_add_address (acd_manager, address->address); } - g_signal_connect_data (arping_manager, NM_ARPING_MANAGER_PROBE_TERMINATED, - G_CALLBACK (arping_manager_probe_terminated), data, - arping_data_destroy, 0); + g_signal_connect_data (acd_manager, NM_ACD_MANAGER_PROBE_TERMINATED, + G_CALLBACK (acd_manager_probe_terminated), data, + acd_data_destroy, 0); - ret = nm_arping_manager_start_probe (arping_manager, timeout); + ret = nm_acd_manager_start_probe (acd_manager, timeout); if (!ret) { - _LOGW (LOGD_DEVICE, "arping probe failed"); + _LOGW (LOGD_DEVICE, "acd probe failed"); /* DAD could not be started, signal success */ cb (self, configs, TRUE); - priv->arping.dad_list = g_slist_remove (priv->arping.dad_list, arping_manager); - nm_arping_manager_destroy (arping_manager); + priv->acd.dad_list = g_slist_remove (priv->acd.dad_list, acd_manager); + nm_acd_manager_destroy (acd_manager); } } @@ -9232,9 +9232,9 @@ arp_cleanup (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - if (priv->arping.announcing) { - nm_arping_manager_destroy (priv->arping.announcing); - priv->arping.announcing = NULL; + if (priv->acd.announcing) { + nm_acd_manager_destroy (priv->acd.announcing); + priv->acd.announcing = NULL; } } @@ -9270,19 +9270,19 @@ arp_announce (NMDevice *self) if (num == 0) return; - priv->arping.announcing = nm_arping_manager_new (nm_device_get_ip_ifindex (self), hw_addr, hw_addr_len); + priv->acd.announcing = nm_acd_manager_new (nm_device_get_ip_ifindex (self), hw_addr, hw_addr_len); for (i = 0; i < num; i++) { NMIPAddress *ip = nm_setting_ip_config_get_address (s_ip4, i); in_addr_t addr; if (inet_pton (AF_INET, nm_ip_address_get_address (ip), &addr) == 1) - nm_arping_manager_add_address (priv->arping.announcing, addr); + nm_acd_manager_add_address (priv->acd.announcing, addr); else g_warn_if_reached (); } - nm_arping_manager_announce_addresses (priv->arping.announcing); + nm_acd_manager_announce_addresses (priv->acd.announcing); } static void @@ -14907,8 +14907,8 @@ dispose (GObject *object) g_signal_handlers_disconnect_by_func (platform, G_CALLBACK (device_ipx_changed), self); g_signal_handlers_disconnect_by_func (platform, G_CALLBACK (link_changed_cb), self); - g_slist_free_full (priv->arping.dad_list, (GDestroyNotify) nm_arping_manager_destroy); - priv->arping.dad_list = NULL; + g_slist_free_full (priv->acd.dad_list, (GDestroyNotify) nm_acd_manager_destroy); + priv->acd.dad_list = NULL; arp_cleanup (self); diff --git a/src/devices/tests/meson.build b/src/devices/tests/meson.build index 64afc278d..02c61ced1 100644 --- a/src/devices/tests/meson.build +++ b/src/devices/tests/meson.build @@ -1,5 +1,5 @@ test_units = [ - 'test-arping', + 'test-acd', 'test-lldp' ] diff --git a/src/devices/tests/test-arping.c b/src/devices/tests/test-acd.c index 0fe6c0dee..8a2852a2d 100644 --- a/src/devices/tests/test-arping.c +++ b/src/devices/tests/test-acd.c @@ -20,7 +20,7 @@ #include "nm-default.h" -#include "devices/nm-arping-manager.h" +#include "devices/nm-acd-manager.h" #include "platform/tests/test-common.h" #define IFACE_VETH0 "nm-test-veth0" @@ -61,15 +61,15 @@ typedef struct { } TestInfo; static void -arping_manager_probe_terminated (NMArpingManager *arping_manager, GMainLoop *loop) +acd_manager_probe_terminated (NMAcdManager *acd_manager, GMainLoop *loop) { g_main_loop_quit (loop); } static void -test_arping_common (test_fixture *fixture, TestInfo *info) +test_acd_common (test_fixture *fixture, TestInfo *info) { - gs_unref_object NMArpingManager *manager = NULL; + gs_unref_object NMAcdManager *manager = NULL; GMainLoop *loop; int i; const guint WAIT_TIME_OPTIMISTIC = 50; @@ -83,11 +83,11 @@ test_arping_common (test_fixture *fixture, TestInfo *info) wait_time = WAIT_TIME_OPTIMISTIC; again: - manager = nm_arping_manager_new (fixture->ifindex0, fixture->hwaddr0, fixture->hwaddr0_len); + manager = nm_acd_manager_new (fixture->ifindex0, fixture->hwaddr0, fixture->hwaddr0_len); g_assert (manager != NULL); for (i = 0; info->addresses[i]; i++) - g_assert (nm_arping_manager_add_address (manager, info->addresses[i])); + g_assert (nm_acd_manager_add_address (manager, info->addresses[i])); for (i = 0; info->peer_addresses[i]; i++) { nmtstp_ip4_address_add (NULL, FALSE, fixture->ifindex1, info->peer_addresses[i], @@ -95,9 +95,9 @@ again: } loop = g_main_loop_new (NULL, FALSE); - signal_id = g_signal_connect (manager, NM_ARPING_MANAGER_PROBE_TERMINATED, - G_CALLBACK (arping_manager_probe_terminated), loop); - g_assert (nm_arping_manager_start_probe (manager, wait_time)); + signal_id = g_signal_connect (manager, NM_ACD_MANAGER_PROBE_TERMINATED, + G_CALLBACK (acd_manager_probe_terminated), loop); + g_assert (nm_acd_manager_start_probe (manager, wait_time)); g_assert (nmtst_main_loop_run (loop, 2000)); g_signal_handler_disconnect (manager, signal_id); g_main_loop_unref (loop); @@ -105,7 +105,7 @@ again: for (i = 0; info->addresses[i]; i++) { gboolean val; - val = nm_arping_manager_check_address (manager, info->addresses[i]); + val = nm_acd_manager_check_address (manager, info->addresses[i]); if (val == info->expected_result[i]) continue; @@ -124,39 +124,39 @@ again: } static void -test_arping_probe_1 (test_fixture *fixture, gconstpointer user_data) +test_acd_probe_1 (test_fixture *fixture, gconstpointer user_data) { TestInfo info = { .addresses = { ADDR1, ADDR2, ADDR3 }, .peer_addresses = { ADDR4 }, .expected_result = { TRUE, TRUE, TRUE } }; - test_arping_common (fixture, &info); + test_acd_common (fixture, &info); } static void -test_arping_probe_2 (test_fixture *fixture, gconstpointer user_data) +test_acd_probe_2 (test_fixture *fixture, gconstpointer user_data) { TestInfo info = { .addresses = { ADDR1, ADDR2, ADDR3, ADDR4 }, .peer_addresses = { ADDR3, ADDR2 }, .expected_result = { TRUE, FALSE, FALSE, TRUE } }; - test_arping_common (fixture, &info); + test_acd_common (fixture, &info); } static void -test_arping_announce (test_fixture *fixture, gconstpointer user_data) +test_acd_announce (test_fixture *fixture, gconstpointer user_data) { - gs_unref_object NMArpingManager *manager = NULL; + gs_unref_object NMAcdManager *manager = NULL; GMainLoop *loop; - manager = nm_arping_manager_new (fixture->ifindex0, fixture->hwaddr0, fixture->hwaddr0_len); + manager = nm_acd_manager_new (fixture->ifindex0, fixture->hwaddr0, fixture->hwaddr0_len); g_assert (manager != NULL); - g_assert (nm_arping_manager_add_address (manager, ADDR1)); - g_assert (nm_arping_manager_add_address (manager, ADDR2)); + g_assert (nm_acd_manager_add_address (manager, ADDR1)); + g_assert (nm_acd_manager_add_address (manager, ADDR2)); loop = g_main_loop_new (NULL, FALSE); - nm_arping_manager_announce_addresses (manager); + nm_acd_manager_announce_addresses (manager); g_assert (!nmtst_main_loop_run (loop, 200)); g_main_loop_unref (loop); } @@ -179,7 +179,7 @@ _nmtstp_init_tests (int *argc, char ***argv) void _nmtstp_setup_tests (void) { - g_test_add ("/arping/probe/1", test_fixture, NULL, fixture_setup, test_arping_probe_1, fixture_teardown); - g_test_add ("/arping/probe/2", test_fixture, NULL, fixture_setup, test_arping_probe_2, fixture_teardown); - g_test_add ("/arping/announce", test_fixture, NULL, fixture_setup, test_arping_announce, fixture_teardown); + g_test_add ("/acd/probe/1", test_fixture, NULL, fixture_setup, test_acd_probe_1, fixture_teardown); + g_test_add ("/acd/probe/2", test_fixture, NULL, fixture_setup, test_acd_probe_2, fixture_teardown); + g_test_add ("/acd/announce", test_fixture, NULL, fixture_setup, test_acd_announce, fixture_teardown); } diff --git a/src/meson.build b/src/meson.build index 845a098b8..591c9c79c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -91,7 +91,7 @@ libnetwork_manager_base = static_library( ) sources = files( - 'devices/nm-arping-manager.c', + 'devices/nm-acd-manager.c', 'devices/nm-device-bond.c', 'devices/nm-device-bridge.c', 'devices/nm-device.c', diff --git a/src/nm-types.h b/src/nm-types.h index e48a6e2a1..e1991c280 100644 --- a/src/nm-types.h +++ b/src/nm-types.h @@ -34,10 +34,10 @@ typedef struct _NMAuditManager NMAuditManager; typedef struct _NMVpnConnection NMVpnConnection; typedef struct _NMActRequest NMActRequest; typedef struct _NMAuthSubject NMAuthSubject; -typedef struct _NMDBusManager NMDBusManager; +typedef struct _NMDBusManager NMDBusManager; typedef struct _NMConfig NMConfig; typedef struct _NMConfigData NMConfigData; -typedef struct _NMArpingManager NMArpingManager; +typedef struct _NMAcdManager NMAcdManager; typedef struct _NMConnectivity NMConnectivity; typedef struct _NMDevice NMDevice; typedef struct _NMDhcp4Config NMDhcp4Config; |