Send connman mailing list submissions to connman@lists.01.org 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 connman-requ...@lists.01.org
You can reach the person managing the list at connman-ow...@lists.01.org When replying, please edit your Subject line so it is more specific than "Re: Contents of connman digest..." Today's Topics: 1. [PATCH v3 01/27] util: Add function __connman_util_random_delay_ms (Christian Spielberger) 2. [PATCH v3 08/27] doc: Add documentation for AddressConflictDetection (Christian Spielberger) 3. [PATCH v3 05/27] shared/arp: Add arp_random_ip() (Christian Spielberger) 4. [PATCH v3 07/27] Add Address Conflict Detection support (RFC 5227) (Christian Spielberger) ---------------------------------------------------------------------- Message: 1 Date: Tue, 15 May 2018 12:35:08 +0200 From: Christian Spielberger <christian.spielber...@gmail.com> To: Daniel Wagner <w...@monom.org> Cc: connman@lists.01.org, Christian Spielberger <christian.spielber...@gmail.com> Subject: [PATCH v3 01/27] util: Add function __connman_util_random_delay_ms Message-ID: <1526380534-23540-2-git-send-email-christian.spielber...@gmail.com> ACD needs random IPv4 addresses as fallback (IPv4LL address) and random delays between sent ARP probe and ARP announce packets. Hence, this patch moves ipv4ll_random_delay_ms() to src/util.c in order to be available generally. It replaces the calls of the obsolete function in gdhcp/client.c. --- Makefile.am | 14 ++++++++++---- gdhcp/client.c | 7 ++++--- gdhcp/ipv4ll.c | 12 +----------- gdhcp/ipv4ll.h | 1 - src/connman.h | 1 + src/util.c | 12 ++++++++++++ tools/dhcp-server-test.c | 5 +++-- tools/dhcp-test.c | 5 +++-- 8 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Makefile.am b/Makefile.am index c94164f..edd1969 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,10 @@ gdbus_libgdbus_internal_la_SOURCES = gdbus/gdbus.h \ gdbus/mainloop.c gdbus/watch.c \ gdbus/object.c gdbus/client.c gdbus/polkit.c +if BACKTRACE +backtrace_sources = src/backtrace.c +endif + 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 @@ -355,11 +359,13 @@ tools_wpad_test_LDADD = @GLIB_LIBS@ -lresolv tools_stats_tool_LDADD = @GLIB_LIBS@ -tools_dhcp_test_SOURCES = $(gdhcp_sources) tools/dhcp-test.c -tools_dhcp_test_LDADD = @GLIB_LIBS@ +tools_dhcp_test_SOURCES = $(backtrace_sources) src/log.c \ + src/util.c $(gdhcp_sources) tools/dhcp-test.c +tools_dhcp_test_LDADD = @GLIB_LIBS@ -ldl -tools_dhcp_server_test_SOURCES = $(gdhcp_sources) tools/dhcp-server-test.c -tools_dhcp_server_test_LDADD = @GLIB_LIBS@ +tools_dhcp_server_test_SOURCES = $(backtrace_sources) src/log.c src/util.c \ + $(gdhcp_sources) tools/dhcp-server-test.c +tools_dhcp_server_test_LDADD = @GLIB_LIBS@ -ldl tools_dbus_test_SOURCES = tools/dbus-test.c tools_dbus_test_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@ diff --git a/gdhcp/client.c b/gdhcp/client.c index 6735778..1f01b57 100644 --- a/gdhcp/client.c +++ b/gdhcp/client.c @@ -43,6 +43,7 @@ #include <glib.h> +#include "../src/connman.h" #include "gdhcp.h" #include "common.h" #include "ipv4ll.h" @@ -556,7 +557,7 @@ static gboolean send_probe_packet(gpointer dhcp_data) if (dhcp_client->retry_times < PROBE_NUM) { /*add a random timeout in range of PROBE_MIN to PROBE_MAX*/ - timeout = ipv4ll_random_delay_ms(PROBE_MAX-PROBE_MIN); + timeout = __connman_util_random_delay_ms(PROBE_MAX-PROBE_MIN); timeout += PROBE_MIN*1000; } else timeout = (ANNOUNCE_WAIT * 1000); @@ -1376,7 +1377,7 @@ static void ipv4ll_start(GDHCPClient *dhcp_client) dhcp_client->requested_ip = ipv4ll_random_ip(); /*first wait a random delay to avoid storm of arp request on boot*/ - timeout = ipv4ll_random_delay_ms(PROBE_WAIT); + timeout = __connman_util_random_delay_ms(PROBE_WAIT); dhcp_client->retry_times++; dhcp_client->timeout = g_timeout_add_full(G_PRIORITY_HIGH, @@ -1466,7 +1467,7 @@ static int ipv4ll_recv_arp_packet(GDHCPClient *dhcp_client) dhcp_client->retry_times++; dhcp_client->timeout = g_timeout_add_full(G_PRIORITY_HIGH, - ipv4ll_random_delay_ms(PROBE_WAIT), + __connman_util_random_delay_ms(PROBE_WAIT), send_probe_packet, dhcp_client, NULL); diff --git a/gdhcp/ipv4ll.c b/gdhcp/ipv4ll.c index d900198..82e6c44 100644 --- a/gdhcp/ipv4ll.c +++ b/gdhcp/ipv4ll.c @@ -33,6 +33,7 @@ #include <arpa/inet.h> #include <glib.h> + #include "ipv4ll.h" #include "common.h" @@ -52,17 +53,6 @@ uint32_t ipv4ll_random_ip(void) return ((LINKLOCAL_ADDR + 0x0100) + tmp); } -/** - * Return a random delay in range of zero to secs*1000 - */ -guint ipv4ll_random_delay_ms(guint secs) -{ - uint64_t rand; - - dhcp_get_random(&rand); - return rand % (secs * 1000); -} - int ipv4ll_send_arp_packet(uint8_t* source_eth, uint32_t source_ip, uint32_t target_ip, int ifindex) { diff --git a/gdhcp/ipv4ll.h b/gdhcp/ipv4ll.h index bee8138..bf8c363 100644 --- a/gdhcp/ipv4ll.h +++ b/gdhcp/ipv4ll.h @@ -44,7 +44,6 @@ extern "C" { #define DEFEND_INTERVAL 10 uint32_t ipv4ll_random_ip(void); -guint ipv4ll_random_delay_ms(guint secs); int ipv4ll_send_arp_packet(uint8_t* source_eth, uint32_t source_ip, uint32_t target_ip, int ifindex); int ipv4ll_arp_socket(int ifindex); diff --git a/src/connman.h b/src/connman.h index 82e77d3..8f8d26a 100644 --- a/src/connman.h +++ b/src/connman.h @@ -1072,5 +1072,6 @@ int __connman_machine_init(void); void __connman_machine_cleanup(void); int __connman_util_get_random(uint64_t *val); +unsigned int __connman_util_random_delay_ms(unsigned int secs); int __connman_util_init(void); void __connman_util_cleanup(void); diff --git a/src/util.c b/src/util.c index 732d451..7aba7b7 100644 --- a/src/util.c +++ b/src/util.c @@ -91,3 +91,15 @@ void __connman_util_cleanup(void) f = -1; } + +/** + * Return a random delay in range of zero to secs*1000 milli seconds. + */ +unsigned int __connman_util_random_delay_ms(unsigned int secs) +{ + uint64_t rand; + + __connman_util_get_random(&rand); + return rand % (secs * 1000); +} + diff --git a/tools/dhcp-server-test.c b/tools/dhcp-server-test.c index b7d2e54..d6f198d 100644 --- a/tools/dhcp-server-test.c +++ b/tools/dhcp-server-test.c @@ -28,6 +28,7 @@ #include <string.h> #include <gdhcp/gdhcp.h> +#include <connman/log.h> static GMainLoop *main_loop; @@ -86,7 +87,7 @@ int main(int argc, char *argv[]) index = atoi(argv[1]); - printf("Create DHCP server for interface %d\n", index); + DBG("Create DHCP server for interface %d\n", index); dhcp_server = g_dhcp_server_new(G_DHCP_IPV4, index, &error); if (!dhcp_server) { @@ -104,7 +105,7 @@ int main(int argc, char *argv[]) "192.168.0.102"); main_loop = g_main_loop_new(NULL, FALSE); - printf("Start DHCP Server operation\n"); + DBG("Start DHCP Server operation\n"); g_dhcp_server_start(dhcp_server); diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c index c34e10a..cb64690 100644 --- a/tools/dhcp-test.c +++ b/tools/dhcp-test.c @@ -36,6 +36,7 @@ #include <linux/if_arp.h> #include <gdhcp/gdhcp.h> +#include <connman/log.h> static GTimer *timer; @@ -140,7 +141,7 @@ int main(int argc, char *argv[]) index = atoi(argv[1]); - printf("Create DHCP client for interface %d\n", index); + DBG("Create DHCP client for interface %d\n", index); dhcp_client = g_dhcp_client_new(G_DHCP_IPV4, index, &error); if (!dhcp_client) { @@ -166,7 +167,7 @@ int main(int argc, char *argv[]) main_loop = g_main_loop_new(NULL, FALSE); - printf("Start DHCP operation\n"); + DBG("Start DHCP operation\n"); timer = g_timer_new(); -- 2.7.4 ------------------------------ Message: 2 Date: Tue, 15 May 2018 12:35:15 +0200 From: Christian Spielberger <christian.spielber...@gmail.com> To: Daniel Wagner <w...@monom.org> Cc: connman@lists.01.org, Peter Meerwald-Stadler <pme...@pmeerw.net> Subject: [PATCH v3 08/27] doc: Add documentation for AddressConflictDetection Message-ID: <1526380534-23540-9-git-send-email-christian.spielber...@gmail.com> From: Peter Meerwald-Stadler <pme...@pmeerw.net> Signed-off-by: Peter Meerwald-Stadler <pme...@pmeerw.net> --- 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 0e3f8de..caf7052 100644 --- a/doc/connman.conf.5.in +++ b/doc/connman.conf.5.in @@ -160,6 +160,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.7.4 ------------------------------ Message: 3 Date: Tue, 15 May 2018 12:35:12 +0200 From: Christian Spielberger <christian.spielber...@gmail.com> To: Daniel Wagner <w...@monom.org> Cc: connman@lists.01.org, Christian Spielberger <christian.spielber...@gmail.com> Subject: [PATCH v3 05/27] shared/arp: Add arp_random_ip() Message-ID: <1526380534-23540-6-git-send-email-christian.spielber...@gmail.com> Following feature ACD also needs a random IPv4 address as fallback. This patch moves the function ipv4ll_random_ip() from gdhcp/ipv4ll.h to src/shared/arp.h. The gdhcp/ipv4ll.h is now empty and can be removed. The function arp_random_ip uses __connman_util_get_random() from src/util.c. In Makefile.am this patch removes arp.c from target netlink-test to avoid depenencies of arp.c (src/util.c, src/log.c and src/backtrace.c). --- Makefile.am | 5 +++-- gdhcp/client.c | 5 ++--- gdhcp/ipv4ll.h | 39 --------------------------------------- src/shared/arp.c | 18 ++++++++++++++++++ src/shared/arp.h | 5 +++++ 5 files changed, 28 insertions(+), 44 deletions(-) delete mode 100644 gdhcp/ipv4ll.h diff --git a/Makefile.am b/Makefile.am index 841aef8..5aa77be 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 @@ -396,7 +396,8 @@ endif tools_dnsproxy_test_SOURCES = tools/dnsproxy-test.c tools_dnsproxy_test_LDADD = @GLIB_LIBS@ -tools_netlink_test_SOURCES = $(shared_sources) tools/netlink-test.c +tools_netlink_test_SOURCES = src/shared/util.c src/shared/netlink.c \ + tools/netlink-test.c tools_netlink_test_LDADD = @GLIB_LIBS@ endif diff --git a/gdhcp/client.c b/gdhcp/client.c index eac8b3d..826e8cc 100644 --- a/gdhcp/client.c +++ b/gdhcp/client.c @@ -47,7 +47,6 @@ #include "../src/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 = arp_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 = arp_random_ip(); /*first wait a random delay to avoid storm of arp request on boot*/ timeout = __connman_util_random_delay_ms(PROBE_WAIT); diff --git a/gdhcp/ipv4ll.h b/gdhcp/ipv4ll.h deleted file mode 100644 index 315ca3d..0000000 --- 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 02b5003..6cd611f 100644 --- a/src/shared/arp.c +++ b/src/shared/arp.c @@ -33,6 +33,7 @@ #include <arpa/inet.h> #include "src/shared/arp.h" +#include "src/connman.h" int arp_send_packet(uint8_t* source_eth, uint32_t source_ip, uint32_t target_ip, int ifindex) @@ -106,3 +107,20 @@ int arp_socket(int ifindex) return fd; } + +/** + * Return a random link local IP (in host byte order) + */ +uint32_t arp_random_ip(void) +{ + unsigned tmp; + + do { + uint64_t rand; + __connman_util_get_random(&rand); + tmp = rand; + tmp = tmp & IN_CLASSB_HOST; + } while (tmp > (IN_CLASSB_HOST - 0x0200)); + + return (LINKLOCAL_ADDR + 0x0100) + tmp; +} diff --git a/src/shared/arp.h b/src/shared/arp.h index e0d26e7..03e2168 100644 --- a/src/shared/arp.h +++ b/src/shared/arp.h @@ -35,8 +35,13 @@ #define RATE_LIMIT_INTERVAL 60 #define DEFEND_INTERVAL 10 +/* 169.254.0.0 */ +#define LINKLOCAL_ADDR 0xa9fe0000 + int arp_send_packet(uint8_t* source_eth, uint32_t source_ip, uint32_t target_ip, int ifindex); int arp_socket(int ifindex); +uint32_t arp_random_ip(void); + #endif -- 2.7.4 ------------------------------ Message: 4 Date: Tue, 15 May 2018 12:35:14 +0200 From: Christian Spielberger <christian.spielber...@gmail.com> To: Daniel Wagner <w...@monom.org> Cc: connman@lists.01.org, Christian Spielberger <christian.spielber...@gmail.com> Subject: [PATCH v3 07/27] Add Address Conflict Detection support (RFC 5227) Message-ID: <1526380534-23540-8-git-send-email-christian.spielber...@gmail.com> Add first acd.h, acd.c, a configuration ACD on/off switch and a first version of start_acd in network.c which does nothing for the moment. --- Makefile.am | 6 ++++-- include/acd.h | 39 +++++++++++++++++++++++++++++++++++++++ src/acd.c | 24 ++++++++++++++++++++++++ src/main.c | 13 +++++++++++++ src/network.c | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 include/acd.h create mode 100644 src/acd.c diff --git a/Makefile.am b/Makefile.am index 5aa77be..3d5dc5f 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 @@ -129,7 +130,8 @@ src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) $(stats_sources) \ src/session.c src/tethering.c src/wpad.c src/wispr.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 0000000..baca508 --- /dev/null +++ b/include/acd.h @@ -0,0 +1,39 @@ +/* + * + * Connection Manager + * + * 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. + * + */ + +/* + * Address Conflict Detection (RFC 5227) + * + * based on DHCP client library with GLib integration, + * Copyright (C) 2009-2014 Intel Corporation. All rights reserved. + * + */ + +#ifndef __CONNMAN_ACD_H +#define __CONNMAN_ACD_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct acd_host; + +#ifdef __cplusplus +} +#endif + +#endif /* __CONNMAN_ACD_H */ diff --git a/src/acd.c b/src/acd.c new file mode 100644 index 0000000..70505b3 --- /dev/null +++ b/src/acd.c @@ -0,0 +1,24 @@ +/* + * + * Connection Manager + * + * 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. + * + */ + +/* + * Address Conflict Detection (RFC 5227) + * + * based on DHCP client library with GLib integration, + * Copyright (C) 2009-2014 Intel Corporation. All rights reserved. + * + */ diff --git a/src/main.c b/src/main.c index 318bf02..5c732ae 100644 --- a/src/main.c +++ b/src/main.c @@ -81,6 +81,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, @@ -100,6 +101,7 @@ static struct { .vendor_class_id = NULL, .enable_online_check = true, .auto_connect_roaming_services = false, + .acd = false, }; #define CONF_BG_SCAN "BackgroundScanning" @@ -120,6 +122,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, @@ -140,6 +143,7 @@ static const char *supported_options[] = { CONF_VENDOR_CLASS_ID, CONF_ENABLE_ONLINE_CHECK, CONF_AUTO_CONNECT_ROAMING_SERVICES, + CONF_ACD, NULL }; @@ -431,6 +435,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) @@ -644,6 +654,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 4757d0d..134aaf0 100644 --- a/src/network.c +++ b/src/network.c @@ -27,6 +27,7 @@ #include <string.h> #include "connman.h" +#include <connman/acd.h> /* * How many times to send RS with the purpose of @@ -67,6 +68,7 @@ struct connman_network { int index; int router_solicit_count; int router_solicit_refresh_count; + struct acd_host *acd_host; struct connman_network_driver *driver; void *driver_data; @@ -154,6 +156,24 @@ static void set_configuration(struct connman_network *network, type); } +static int start_acd(struct connman_network *network) +{ + struct connman_service *service; + struct connman_ipconfig *ipconfig_ipv4; + + service = connman_service_lookup_from_network(network); + if (!service) + return -EINVAL; + + ipconfig_ipv4 = __connman_service_get_ip4config(service); + if (!ipconfig_ipv4) { + connman_error("Service has no IPv4 configuration"); + return -EINVAL; + } + + return 0; +} + static void dhcp_success(struct connman_network *network) { struct connman_service *service; @@ -171,6 +191,14 @@ static void dhcp_success(struct connman_network *network) if (!ipconfig_ipv4) return; + if (connman_setting_get_bool("AddressConflictDetection")) { + err = start_acd(network); + if (!err) + return; + + /* On error proceed without ACD. */ + } + err = __connman_ipconfig_address_add(ipconfig_ipv4); if (err < 0) goto err; @@ -237,6 +265,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 = start_acd(network); + if (!err) + return 0; + + /* On error proceed without ACD. */ + } + err = __connman_ipconfig_address_add(ipconfig); if (err < 0) goto err; @@ -920,6 +956,7 @@ static void network_destruct(struct connman_network *network) g_free(network->node); g_free(network->name); g_free(network->identifier); + g_free(network->acd_host); network->device = NULL; @@ -955,6 +992,7 @@ struct connman_network *connman_network_create(const char *identifier, network->type = type; network->identifier = ident; + network->acd_host = NULL; network_list = g_slist_prepend(network_list, network); -- 2.7.4 ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list connman@lists.01.org https://lists.01.org/mailman/listinfo/connman ------------------------------ End of connman Digest, Vol 31, Issue 7 **************************************