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 25/27] network: add function for delayed dhcp
start (Peter Meerwald-Stadler)
2. [RFC PATCH 27/27] service: send DHCP decline in case of
address conflict (Peter Meerwald-Stadler)
3. [RFC PATCH 26/27] acd: add acdhost_get_conflicts_count
(Peter Meerwald-Stadler)
----------------------------------------------------------------------
Message: 1
Date: Wed, 21 Mar 2018 14:42:35 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 25/27] network: add function for delayed dhcp
start
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
---
include/network.h | 2 ++
src/network.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/include/network.h b/include/network.h
index 4fc20c1c..68925389 100644
--- a/include/network.h
+++ b/include/network.h
@@ -100,6 +100,8 @@ void connman_network_set_error(struct connman_network
*network,
int connman_network_set_connected(struct connman_network *network,
bool connected);
bool connman_network_get_connected(struct connman_network *network);
+void connman_network_set_connected_dhcp_later(struct connman_network *network,
+ uint32_t sec);
bool connman_network_get_associating(struct connman_network *network);
diff --git a/src/network.c b/src/network.c
index 3306e4ed..cec5af48 100644
--- a/src/network.c
+++ b/src/network.c
@@ -68,6 +68,7 @@ struct connman_network {
int index;
int router_solicit_count;
int router_solicit_refresh_count;
+ guint dhcp_timeout;
struct connman_network_driver *driver;
void *driver_data;
@@ -266,6 +267,14 @@ err:
return err;
}
+static void remove_dhcp_timeout(struct connman_network *network)
+{
+ if (network->dhcp_timeout > 0) {
+ g_source_remove(network->dhcp_timeout);
+ network->dhcp_timeout = 0;
+ }
+}
+
static int set_connected_dhcp(struct connman_network *network)
{
struct connman_service *service;
@@ -273,6 +282,7 @@ static int set_connected_dhcp(struct connman_network
*network)
int err;
DBG("network %p", network);
+ remove_dhcp_timeout(network);
service = connman_service_lookup_from_network(network);
ipconfig_ipv4 = __connman_service_get_ip4config(service);
@@ -288,6 +298,44 @@ static int set_connected_dhcp(struct connman_network
*network)
return 0;
}
+static gboolean set_connected_dhcp_timout(gpointer data)
+{
+ struct connman_network *network = data;
+ struct connman_service *service;
+ struct connman_ipconfig *ipconfig;
+ enum connman_ipconfig_method method;
+
+ network->dhcp_timeout = 0;
+
+ service = connman_service_lookup_from_network(network);
+ if (!service)
+ return FALSE;
+
+ ipconfig = __connman_service_get_ip4config(service);
+ if (!ipconfig)
+ return FALSE;
+
+ /* Method is still DHCP? */
+ method = __connman_ipconfig_get_method(ipconfig);
+ if (method == CONNMAN_IPCONFIG_METHOD_DHCP)
+ set_connected_dhcp(network);
+
+ return FALSE;
+}
+
+void connman_network_set_connected_dhcp_later(struct connman_network *network,
+ uint32_t sec)
+{
+ remove_dhcp_timeout(network);
+
+ network->dhcp_timeout =
+ g_timeout_add_seconds_full(G_PRIORITY_HIGH,
+ sec,
+ set_connected_dhcp_timout,
+ network,
+ NULL);
+}
+
static int manual_ipv6_set(struct connman_network *network,
struct connman_ipconfig *ipconfig_ipv6)
{
@@ -689,6 +737,7 @@ static void set_disconnected(struct connman_network
*network)
__connman_service_notify_ipv4_configuration(service);
/* fall through */
case CONNMAN_IPCONFIG_METHOD_DHCP:
+ remove_dhcp_timeout(network);
__connman_dhcp_stop(ipconfig_ipv4);
break;
}
@@ -975,6 +1024,8 @@ struct connman_network *connman_network_create(const char
*identifier,
network_list = g_slist_prepend(network_list, network);
+ network->dhcp_timeout = 0;
+
DBG("network %p identifier %s type %s", network, identifier,
type2string(type));
return network;
@@ -1562,6 +1613,7 @@ int __connman_network_clear_ipconfig(struct
connman_network *network,
__connman_ipconfig_address_remove(ipconfig);
break;
case CONNMAN_IPCONFIG_METHOD_DHCP:
+ remove_dhcp_timeout(network);
__connman_dhcp_stop(ipconfig_ipv4);
break;
}
--
2.16.2
------------------------------
Message: 2
Date: Wed, 21 Mar 2018 14:42:37 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 27/27] service: send DHCP decline in case of
address conflict
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
---
src/service.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/service.c b/src/service.c
index bef2d88d..66d5d1a0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -40,6 +40,7 @@
#include "connman.h"
#define CONNECT_TIMEOUT 120
+#define DHCP_RETRY_TIMEOUT 10
static DBusConnection *connection = NULL;
@@ -7620,11 +7621,31 @@ static void acdhost_ipv4_lost(ACDHost *acd, gpointer
user_data)
static void acdhost_ipv4_conflict(ACDHost *acd, gpointer user_data)
{
struct connman_service *service = user_data;
+ struct connman_network *network;
+ enum connman_ipconfig_method method;
- /* Start IPv4LL ACD. */
- if (service_start_ipv4ll(service) < 0)
- connman_error("Could not start IPv4LL. "
- "No address will be assigned");
+ method = __connman_ipconfig_get_method(service->ipconfig_ipv4);
+
+ connman_info("%s conflict counts=%u", __FUNCTION__,
+ acdhost_get_conflicts_count(acd));
+ if (method == CONNMAN_IPCONFIG_METHOD_DHCP &&
+ acdhost_get_conflicts_count(acd) < 2) {
+ connman_info("%s Sending DHCP decline", __FUNCTION__);
+ __connman_dhcp_decline(service->ipconfig_ipv4);
+
+ network = __connman_service_get_network(service);
+ connman_network_set_connected_dhcp_later(network,
DHCP_RETRY_TIMEOUT);
+ __connman_ipconfig_set_local(service->ipconfig_ipv4, NULL);
+ } else {
+ if (method == CONNMAN_IPCONFIG_METHOD_DHCP) {
+ __connman_ipconfig_set_method(service->ipconfig_ipv4,
+ CONNMAN_IPCONFIG_METHOD_AUTO);
+ }
+ /* Start IPv4LL ACD. */
+ if (service_start_ipv4ll(service) < 0)
+ connman_error("Could not start IPv4LL. "
+ "No address will be assigned");
+ }
}
static void acdhost_ipv4_maxconflict(ACDHost *acd, gpointer user_data)
--
2.16.2
------------------------------
Message: 3
Date: Wed, 21 Mar 2018 14:42:36 +0100
From: Peter Meerwald-Stadler <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [RFC PATCH 26/27] acd: add acdhost_get_conflicts_count
Message-ID: <[email protected]>
From: Christian Spielberger <[email protected]>
---
include/acd.h | 2 ++
src/acd.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/include/acd.h b/include/acd.h
index 4f483c86..d6272caf 100644
--- a/include/acd.h
+++ b/include/acd.h
@@ -53,6 +53,8 @@ void acdhost_register_event(ACDHost *acd,
void acdhost_append_dbus_property(ACDHost *acd, DBusMessageIter *dict);
+unsigned int acdhost_get_conflicts_count(ACDHost *acd);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/acd.c b/src/acd.c
index 9b114775..1f119ed8 100644
--- a/src/acd.c
+++ b/src/acd.c
@@ -562,3 +562,8 @@ static void report_conflict(ACDHost *acd)
connman_dbus_property_changed_dict(acd->path, CONNMAN_SERVICE_INTERFACE,
"LastAddressConflict", append_ac_property, acd);
}
+
+unsigned int acdhost_get_conflicts_count(ACDHost *acd)
+{
+ return acd->conflicts;
+}
--
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 24
***************************************