Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [RFC PATCH 07/27] shared/arp: Add random_ip()
(Peter Meerwald-Stadler)
2. [RFC PATCH 09/27] Add Address Conflict Detection support (RFC
5227) (Peter Meerwald-Stadler)
3. [RFC PATCH 10/27] doc: Add documentation for
AddressConflictDetection (Peter Meerwald-Stadler)
4. [RFC PATCH 12/27] acd: add functions start/stop_listening
(Peter Meerwald-Stadler)
5. [RFC PATCH 13/27] acd: add send_probe_packet
(Peter Meerwald-Stadler)
----------------------------------------------------------------------
Message: 1
Date: Wed, 21 Mar 2018 14:42:17 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 07/27] shared/arp: Add random_ip()
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
and drop gdhcp/ipv4ll.h|.c
---
Makefile.am | 2 +-
gdhcp/client.c | 5 ++---
gdhcp/ipv4ll.c | 57 --------------------------------------------------------
gdhcp/ipv4ll.h | 39 --------------------------------------
src/shared/arp.c | 18 ++++++++++++++++++
src/shared/arp.h | 5 +++++
6 files changed, 26 insertions(+), 100 deletions(-)
delete mode 100644 gdhcp/ipv4ll.c
delete mode 100644 gdhcp/ipv4ll.h
diff --git a/Makefile.am b/Makefile.am
index 23c5171c..aa58691c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,7 +33,7 @@ gdbus_libgdbus_internal_la_SOURCES = gdbus/gdbus.h \
gdbus/object.c gdbus/client.c gdbus/polkit.c
gdhcp_sources = gdhcp/gdhcp.h gdhcp/common.h gdhcp/common.c gdhcp/client.c \
- gdhcp/server.c gdhcp/ipv4ll.h gdhcp/ipv4ll.c gdhcp/unaligned.h
+ gdhcp/server.c gdhcp/unaligned.h
gweb_sources = gweb/gweb.h gweb/gweb.c gweb/gresolv.h gweb/gresolv.c
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 05c322cc..320b7819 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -47,7 +47,6 @@
#include "shared/arp.h"
#include "gdhcp.h"
#include "common.h"
-#include "ipv4ll.h"
#define DISCOVER_TIMEOUT 5
#define DISCOVER_RETRIES 6
@@ -544,7 +543,7 @@ static gboolean send_probe_packet(gpointer dhcp_data)
/* if requested_ip is not valid, pick a new address*/
if (dhcp_client->requested_ip == 0) {
debug(dhcp_client, "pick a new random address");
- dhcp_client->requested_ip = ipv4ll_random_ip();
+ dhcp_client->requested_ip = random_ip();
}
debug(dhcp_client, "sending IPV4LL probe request");
@@ -1343,7 +1342,7 @@ static void ipv4ll_start(GDHCPClient *dhcp_client)
dhcp_client->retry_times = 0;
dhcp_client->requested_ip = 0;
- dhcp_client->requested_ip = ipv4ll_random_ip();
+ dhcp_client->requested_ip = random_ip();
/*first wait a random delay to avoid storm of arp request on boot*/
timeout = random_delay_ms(PROBE_WAIT);
diff --git a/gdhcp/ipv4ll.c b/gdhcp/ipv4ll.c
deleted file mode 100644
index eebf8938..00000000
--- a/gdhcp/ipv4ll.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * IPV4 Local Link library with GLib integration
- *
- * Copyright (C) 2009-2010 Aldebaran Robotics. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netpacket/packet.h>
-#include <net/ethernet.h>
-#include <netinet/if_ether.h>
-
-#include <arpa/inet.h>
-
-#include <glib.h>
-
-#include "shared/random.h"
-#include "shared/arp.h"
-#include "ipv4ll.h"
-#include "common.h"
-
-/**
- * Return a random link local IP (in host byte order)
- */
-uint32_t ipv4ll_random_ip(void)
-{
- unsigned tmp;
- uint64_t rand;
-
- do {
- get_random(&rand);
- tmp = rand;
- tmp = tmp & IN_CLASSB_HOST;
- } while (tmp > (IN_CLASSB_HOST - 0x0200));
- return ((LINKLOCAL_ADDR + 0x0100) + tmp);
-}
-
diff --git a/gdhcp/ipv4ll.h b/gdhcp/ipv4ll.h
deleted file mode 100644
index 315ca3db..00000000
--- a/gdhcp/ipv4ll.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * IPV4 Local Link library with GLib integration
- *
- * Copyright (C) 2009-2010 Aldebaran Robotics. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef __G_IPV4LL_H
-#define __G_IPV4LL_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 169.254.0.0 */
-#define LINKLOCAL_ADDR 0xa9fe0000
-
-uint32_t ipv4ll_random_ip(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !IPV4LL_H_ */
diff --git a/src/shared/arp.c b/src/shared/arp.c
index 985dd20d..c8fd0c54 100644
--- a/src/shared/arp.c
+++ b/src/shared/arp.c
@@ -38,6 +38,7 @@
#include <arpa/inet.h>
#include "shared/arp.h"
+#include "shared/random.h"
int send_arp_packet(uint8_t* source_eth, uint32_t source_ip,
uint32_t target_ip, int ifindex)
@@ -112,6 +113,23 @@ int arp_socket(int ifindex)
return fd;
}
+/**
+ * Return a random link local IP (in host byte order)
+ */
+uint32_t random_ip(void)
+{
+ unsigned tmp;
+
+ do {
+ uint64_t rand;
+ get_random(&rand);
+ tmp = rand;
+ tmp = tmp & IN_CLASSB_HOST;
+ } while (tmp > (IN_CLASSB_HOST - 0x0200));
+
+ return (LINKLOCAL_ADDR + 0x0100) + tmp;
+}
+
void get_interface_mac_address(int index, uint8_t *mac_address)
{
struct ifreq ifr;
diff --git a/src/shared/arp.h b/src/shared/arp.h
index 6df9ba0a..d7f885c8 100644
--- a/src/shared/arp.h
+++ b/src/shared/arp.h
@@ -34,10 +34,15 @@
#define RATE_LIMIT_INTERVAL 60
#define DEFEND_INTERVAL 10
+/* 169.254.0.0 */
+#define LINKLOCAL_ADDR 0xa9fe0000
+
int send_arp_packet(uint8_t* source_eth, uint32_t source_ip,
uint32_t target_ip, int ifindex);
int arp_socket(int ifindex);
+uint32_t random_ip(void);
+
void get_interface_mac_address(int index, uint8_t *mac_address);
#endif
--
2.16.2
------------------------------
Message: 2
Date: Wed, 21 Mar 2018 14:42:19 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 09/27] Add Address Conflict Detection support (RFC
5227)
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
---
Makefile.am | 6 ++++--
include/acd.h | 36 ++++++++++++++++++++++++++++++++++++
include/service.h | 2 ++
src/acd.c | 16 ++++++++++++++++
src/main.c | 13 +++++++++++++
src/network.c | 17 +++++++++++++++++
src/service.c | 18 ++++++++++++++++++
7 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 include/acd.h
create mode 100644 src/acd.c
diff --git a/Makefile.am b/Makefile.am
index aa58691c..1e54d884 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,8 @@ include_HEADERS = include/log.h include/plugin.h \
include/device.h include/network.h include/inet.h \
include/storage.h include/provision.h \
include/session.h include/ipaddress.h include/agent.h \
- include/inotify.h include/peer.h include/machine.h
+ include/inotify.h include/peer.h include/machine.h \
+ include/acd.h
nodist_include_HEADERS = include/version.h
@@ -125,7 +126,8 @@ src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources)
$(backtrace_sources) \
src/stats.c src/6to4.c \
src/ippool.c src/bridge.c src/nat.c src/ipaddress.c \
src/inotify.c src/ipv6pd.c src/peer.c \
- src/peer_service.c src/machine.c src/util.c
+ src/peer_service.c src/machine.c src/util.c \
+ src/acd.c
if INTERNAL_DNS_BACKEND
src_connmand_SOURCES += src/dnsproxy.c
diff --git a/include/acd.h b/include/acd.h
new file mode 100644
index 00000000..6d98c289
--- /dev/null
+++ b/include/acd.h
@@ -0,0 +1,36 @@
+/*
+ *
+ * Address Conflict Detection (RFC 5227)
+ *
+ * based on DHCP client library with GLib integration,
+ * Copyright (C) 2009-2014 Intel Corporation. All rights reserved.
+ *
+ * Copyright (C) 2018 Commend International. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __CONNMAN_ACD_H
+#define __CONNMAN_ACD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _ACDHost;
+
+typedef struct _ACDHost ACDHost;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONNMAN_ACD_H */
diff --git a/include/service.h b/include/service.h
index 958e7fd1..3dcc8e75 100644
--- a/include/service.h
+++ b/include/service.h
@@ -137,6 +137,8 @@ void connman_service_create_ip4config(struct
connman_service *service,
void connman_service_create_ip6config(struct connman_service *service,
int index);
+int connman_service_start_acd(struct connman_service *service);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/acd.c b/src/acd.c
new file mode 100644
index 00000000..6db816f2
--- /dev/null
+++ b/src/acd.c
@@ -0,0 +1,16 @@
+/*
+ * Connection Manager, Address Conflict Detection (ACD) RFC 5227
+ *
+ * Copyright (C) 2018 Commend International GmbH. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+
diff --git a/src/main.c b/src/main.c
index dda54bb8..4a07d606 100644
--- a/src/main.c
+++ b/src/main.c
@@ -82,6 +82,7 @@ static struct {
char *vendor_class_id;
bool enable_online_check;
bool auto_connect_roaming_services;
+ bool acd;
} connman_settings = {
.bg_scan = true,
.pref_timeservers = NULL,
@@ -101,6 +102,7 @@ static struct {
.vendor_class_id = NULL,
.enable_online_check = true,
.auto_connect_roaming_services = false,
+ .acd = false,
};
#define CONF_BG_SCAN "BackgroundScanning"
@@ -121,6 +123,7 @@ static struct {
#define CONF_VENDOR_CLASS_ID "VendorClassID"
#define CONF_ENABLE_ONLINE_CHECK "EnableOnlineCheck"
#define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices"
+#define CONF_ACD "AddressConflictDetection"
static const char *supported_options[] = {
CONF_BG_SCAN,
@@ -141,6 +144,7 @@ static const char *supported_options[] = {
CONF_VENDOR_CLASS_ID,
CONF_ENABLE_ONLINE_CHECK,
CONF_AUTO_CONNECT_ROAMING_SERVICES,
+ CONF_ACD,
NULL
};
@@ -432,6 +436,12 @@ static void parse_config(GKeyFile *config)
connman_settings.auto_connect_roaming_services = boolean;
g_clear_error(&error);
+
+ boolean = __connman_config_get_bool(config, "General", CONF_ACD,
&error);
+ if (!error)
+ connman_settings.acd = boolean;
+
+ g_clear_error(&error);
}
static int config_init(const char *file)
@@ -645,6 +655,9 @@ bool connman_setting_get_bool(const char *key)
if (g_str_equal(key, CONF_AUTO_CONNECT_ROAMING_SERVICES))
return connman_settings.auto_connect_roaming_services;
+ if (g_str_equal(key, CONF_ACD))
+ return connman_settings.acd;
+
return false;
}
diff --git a/src/network.c b/src/network.c
index 4757d0d7..3306e4ed 100644
--- a/src/network.c
+++ b/src/network.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <string.h>
+#include <connman/acd.h>
#include "connman.h"
/*
@@ -171,6 +172,14 @@ static void dhcp_success(struct connman_network *network)
if (!ipconfig_ipv4)
return;
+ if (connman_setting_get_bool("AddressConflictDetection")) {
+ err = connman_service_start_acd(service);
+ if (!err)
+ return;
+
+ /* On error proceed without ACD. */
+ }
+
err = __connman_ipconfig_address_add(ipconfig_ipv4);
if (err < 0)
goto err;
@@ -237,6 +246,14 @@ static int set_connected_manual(struct connman_network
*network)
if (!__connman_ipconfig_get_local(ipconfig))
__connman_service_read_ip4config(service);
+ if (connman_setting_get_bool("AddressConflictDetection")) {
+ err = connman_service_start_acd(service);
+ if (!err)
+ return err;
+
+ /* On error proceed without ACD. */
+ }
+
err = __connman_ipconfig_address_add(ipconfig);
if (err < 0)
goto err;
diff --git a/src/service.c b/src/service.c
index ab5b2c6a..8abdaea4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -34,6 +34,7 @@
#include <connman/storage.h>
#include <connman/setting.h>
#include <connman/agent.h>
+#include <connman/acd.h>
#include "connman.h"
@@ -96,6 +97,7 @@ struct connman_service {
char **domains;
bool mdns;
bool mdns_config;
+ ACDHost *acdhost;
char *hostname;
char *domainname;
char **timeservers;
@@ -4831,6 +4833,7 @@ static void service_free(gpointer user_data)
g_free(service->phase2);
g_free(service->config_file);
g_free(service->config_entry);
+ g_free(service->acdhost);
if (service->stats.timer)
g_timer_destroy(service->stats.timer);
@@ -4887,6 +4890,8 @@ static void service_initialize(struct connman_service
*service)
service->wps = false;
service->wps_advertizing = false;
+
+ service->acdhost = NULL;
}
/**
@@ -7490,3 +7495,16 @@ void __connman_service_cleanup(void)
dbus_connection_unref(connection);
}
+
+int connman_service_start_acd(struct connman_service *service)
+{
+ if (!service)
+ return -EINVAL;
+
+ if (!service->ipconfig_ipv4) {
+ connman_error("Service has no IPv4 configuration");
+ return -EINVAL;
+ }
+
+ return 0;
+}
--
2.16.2
------------------------------
Message: 3
Date: Wed, 21 Mar 2018 14:42:20 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], Peter
Meerwald-Stadler <[email protected]>
Subject: [RFC PATCH 10/27] doc: Add documentation for
AddressConflictDetection
Message-ID: <[email protected]>
Signed-off-by: Peter Meerwald-Stadler <[email protected]>
---
doc/connman.conf.5.in | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index 809a0a47..12454093 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -161,6 +161,16 @@ Default value is true.
Automatically connect roaming services. This is not recommended unless you know
you won't have any billing problem.
Default value is false.
+.TP
+.BI AddressConflictDetection=true\ \fR|\fB\ false
+Enable or disable the implementation of IPv4 address conflict detection
+according to RFC5227. ConnMan will send probe ARP packets to see if an
+IPv4 address is already in use before assigning the address to an interface.
+If an address conflict occurs for a statically configured address, an IPv4LL
+address will be chosen instead (according to RFC3927). If an address conflict
+occurs for an address offered via DHCP, ConnMan send a DHCP DECLINE once and
+for the second conflict resort to finding an IPv4LL address.
+Default value is false.
.SH "EXAMPLE"
The following example configuration disables hostname updates and enables
ethernet tethering.
--
2.16.2
------------------------------
Message: 4
Date: Wed, 21 Mar 2018 14:42:22 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 12/27] acd: add functions start/stop_listening
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
---
src/acd.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
diff --git a/src/acd.c b/src/acd.c
index 19384515..a19edbe4 100644
--- a/src/acd.c
+++ b/src/acd.c
@@ -19,6 +19,10 @@
#include <connman/inet.h>
#include <shared/arp.h>
#include <glib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
typedef enum _acd_state {
ACD_PROBE,
@@ -42,6 +46,25 @@ struct _ACDHost {
guint listener_watch;
};
+static int start_listening(ACDHost *acd);
+static void stop_listening(ACDHost *acd);
+static gboolean acd_listener_event(GIOChannel *channel, GIOCondition condition,
+ gpointer acd_data);
+static int acd_recv_arp_packet(ACDHost *acd);
+
+static void debug(ACDHost *acd, const char *format, ...)
+{
+ char str[256];
+ va_list ap;
+
+ va_start(ap, format);
+
+ if (vsnprintf(str, sizeof(str), format, ap) > 0)
+ connman_info("ACD index %d: %s", acd->ifindex, str);
+
+ va_end(ap);
+}
+
ACDHost *acdhost_new(int ifindex)
{
ACDHost *acd;
@@ -84,3 +107,69 @@ error:
g_free(acd);
return NULL;
}
+
+static int start_listening(ACDHost *acd)
+{
+ GIOChannel *listener_channel;
+ int listener_sockfd;
+
+ if (acd->listen_on)
+ return 0;
+
+ debug(acd, "start listening");
+
+ listener_sockfd = arp_socket(acd->ifindex);
+ if (listener_sockfd < 0)
+ return -EIO;
+
+ listener_channel = g_io_channel_unix_new(listener_sockfd);
+ if (!listener_channel) {
+ /* Failed to create listener channel */
+ close(listener_sockfd);
+ return -EIO;
+ }
+
+ acd->listen_on = TRUE;
+ acd->listener_sockfd = listener_sockfd;
+
+ g_io_channel_set_close_on_unref(listener_channel, TRUE);
+ acd->listener_watch =
+ g_io_add_watch_full(listener_channel, G_PRIORITY_HIGH,
+ G_IO_IN | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
+ acd_listener_event, acd,
+ NULL);
+ g_io_channel_unref(listener_channel);
+
+ return 0;
+}
+
+static void stop_listening(ACDHost *acd)
+{
+ if (!acd->listen_on)
+ return;
+
+ if (acd->listener_watch > 0)
+ g_source_remove(acd->listener_watch);
+ acd->listen_on = FALSE;
+ acd->listener_sockfd = -1;
+ acd->listener_watch = 0;
+}
+
+static gboolean acd_listener_event(GIOChannel *channel, GIOCondition condition,
+ gpointer acd_data)
+{
+ ACDHost *acd = acd_data;
+
+ if (condition & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
+ acd->listener_watch = 0;
+ return FALSE;
+ }
+
+ if (!acd->listen_on)
+ return FALSE;
+
+ acd_recv_arp_packet(acd);
+
+ return TRUE;
+}
+
--
2.16.2
------------------------------
Message: 5
Date: Wed, 21 Mar 2018 14:42:23 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 13/27] acd: add send_probe_packet
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
---
src/acd.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/src/acd.c b/src/acd.c
index a19edbe4..78b8a582 100644
--- a/src/acd.c
+++ b/src/acd.c
@@ -18,6 +18,7 @@
#include <connman/log.h>
#include <connman/inet.h>
#include <shared/arp.h>
+#include <shared/random.h>
#include <glib.h>
#include <stdio.h>
#include <errno.h>
@@ -51,6 +52,8 @@ static void stop_listening(ACDHost *acd);
static gboolean acd_listener_event(GIOChannel *channel, GIOCondition condition,
gpointer acd_data);
static int acd_recv_arp_packet(ACDHost *acd);
+static void send_probe_packet(gpointer acd_data);
+static gboolean acd_probe_timeout(gpointer acd_data);
static void debug(ACDHost *acd, const char *format, ...)
{
@@ -173,3 +176,51 @@ static gboolean acd_listener_event(GIOChannel *channel,
GIOCondition condition,
return TRUE;
}
+static void send_probe_packet(gpointer acd_data)
+{
+ guint timeout;
+ ACDHost *acd = acd_data;
+
+ debug(acd, "sending ARP probe request");
+ if (acd->retry_times == 1) {
+ acd->state = ACD_PROBE;
+ start_listening(acd);
+ }
+ send_arp_packet(acd->mac_address, 0,
+ acd->requested_ip, acd->ifindex);
+
+ if (acd->retry_times < PROBE_NUM) {
+ /* Add a random timeout in range of PROBE_MIN to PROBE_MAX. */
+ timeout = random_delay_ms(PROBE_MAX-PROBE_MIN);
+ timeout += PROBE_MIN * 1000;
+ } else
+ timeout = ANNOUNCE_WAIT * 1000;
+
+ acd->timeout = g_timeout_add_full(G_PRIORITY_HIGH,
+ timeout,
+ acd_probe_timeout,
+ acd,
+ NULL);
+}
+
+static gboolean acd_probe_timeout(gpointer acd_data)
+{
+ ACDHost *acd = acd_data;
+
+ acd->timeout = 0;
+
+ debug(acd, "acd probe timeout (retries %d)", acd->retry_times);
+ if (acd->retry_times == PROBE_NUM) {
+ acd->state = ACD_ANNOUNCE;
+ acd->retry_times = 1;
+
+ send_announce_packet(acd);
+ return FALSE;
+ }
+
+ acd->retry_times++;
+ send_probe_packet(acd);
+
+ return FALSE;
+}
+
--
2.16.2
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 29, Issue 21
***************************************