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. connmand sometimes fails to connect into AP on service
restart. (KARBOWSKI Piotr)
2. Re: connmand sometimes fails to connect into AP on service
restart. (Daniel Wagner)
3. [PATCH v3 04/27] inet: Add
__connman_inet_get_interface_mac_address() (Christian Spielberger)
4. [PATCH v3 02/27] dhcp: Use __connman_util_get_random
(Christian Spielberger)
5. [PATCH v3 00/27] implement Address Conflict Detection
(Christian Spielberger)
----------------------------------------------------------------------
Message: 1
Date: Tue, 15 May 2018 07:32:58 +0200
From: KARBOWSKI Piotr <[email protected]>
To: connman <[email protected]>
Subject: connmand sometimes fails to connect into AP on service
restart.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi,
I noticed on my Gentoo system that sometimes (nearly 50% of time) when I
restart connman (whatever it's restart or stop && start) connman will
fail to connect to AP.
It will just deadlock on
May 15 07:27:48 [connmand] Adding interface wlan0 [ wifi ]
May 15 07:27:48 [connmand] wlan0 {RX} 5238 packets 427712 bytes
May 15 07:27:48 [connmand] wlan0 {TX} 9913 packets 8956147 bytes
May 15 07:27:48 [connmand] wlan0 {newlink} index 5 address
xx:xx:xx:xx:xx:xx mtu 1500
May 15 07:27:48 [connmand] wlan0 {newlink} index 5 operstate 2 <DOWN>
I need to restart it once more to get it working again.
Using stop && start with sleep of 3s inbetween make it always working,
no deadlock, however sleep of 1s yield the same result as no sleep.
The NIC is Intel 8265, connected to WiFi AC network with 80 Hz width.
-- Piotr.
------------------------------
Message: 2
Date: Tue, 15 May 2018 09:48:06 +0200
From: Daniel Wagner <[email protected]>
To: KARBOWSKI Piotr <[email protected]>
Cc: connman <[email protected]>
Subject: Re: connmand sometimes fails to connect into AP on service
restart.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Hi Piotr,
On 05/15/2018 07:32 AM, KARBOWSKI Piotr wrote:
> I noticed on my Gentoo system that sometimes (nearly 50% of time) when I
> restart connman (whatever it's restart or stop && start) connman will
> fail to connect to AP.
>
> It will just deadlock on
>
> May 15 07:27:48 [connmand] Adding interface wlan0 [ wifi ]
> May 15 07:27:48 [connmand] wlan0 {RX} 5238 packets 427712 bytes
> May 15 07:27:48 [connmand] wlan0 {TX} 9913 packets 8956147 bytes
> May 15 07:27:48 [connmand] wlan0 {newlink} index 5 address
> xx:xx:xx:xx:xx:xx mtu 1500
> May 15 07:27:48 [connmand] wlan0 {newlink} index 5 operstate 2 <DOWN>
Could you start ConnMan with '-d' option, e.g.
connmand -d 2>&1 | ts '[%H:%M:%.S]' | tee connman.log
?
> I need to restart it once more to get it working again.
Do you restart ConnMan or do you restart wpa_supplicant alone? If you
just restart ConnMan it would interesting to know what happens if you
just restart wpa_suppliant alone.
> Using stop && start with sleep of 3s inbetween make it always working,
> no deadlock, however sleep of 1s yield the same result as no sleep.
Can you check if there are any kernel messages?
> The NIC is Intel 8265, connected to WiFi AC network with 80 Hz width.
Did this configuration work better in the past? Or has this problem
always existed?
Thanks,
Daniel
------------------------------
Message: 3
Date: Tue, 15 May 2018 12:35:11 +0200
From: Christian Spielberger <[email protected]>
To: Daniel Wagner <[email protected]>
Cc: [email protected], Christian Spielberger
<[email protected]>
Subject: [PATCH v3 04/27] inet: Add
__connman_inet_get_interface_mac_address()
Message-ID:
<1526380534-23540-5-git-send-email-christian.spielber...@gmail.com>
Following ACD code will need this utility function. So we moved
get_interface_mac_address() from gdhcp/client.c to src/inet.c.
---
Makefile.am | 6 +++---
gdhcp/client.c | 40 ++++------------------------------------
src/connman.h | 1 +
src/inet.c | 35 +++++++++++++++++++++++++++++++++++
4 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e994ab9..841aef8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -356,12 +356,12 @@ tools_wpad_test_LDADD = @GLIB_LIBS@ -lresolv
tools_stats_tool_LDADD = @GLIB_LIBS@
-tools_dhcp_test_SOURCES = $(backtrace_sources) src/log.c \
- src/util.c $(gdhcp_sources) tools/dhcp-test.c src/shared/arp.c
+tools_dhcp_test_SOURCES = $(backtrace_sources) src/log.c src/util.c \
+ $(gdhcp_sources) src/inet.c tools/dhcp-test.c src/shared/arp.c
tools_dhcp_test_LDADD = @GLIB_LIBS@ -ldl
tools_dhcp_server_test_SOURCES = $(backtrace_sources) src/log.c src/util.c \
- $(gdhcp_sources) tools/dhcp-server-test.c src/shared/arp.c
+ $(gdhcp_sources) src/inet.c tools/dhcp-server-test.c
src/shared/arp.c
tools_dhcp_server_test_LDADD = @GLIB_LIBS@ -ldl
tools_dbus_test_SOURCES = tools/dbus-test.c
diff --git a/gdhcp/client.c b/gdhcp/client.c
index ac29814..eac8b3d 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -607,38 +607,6 @@ static gboolean send_announce_packet(gpointer dhcp_data)
return TRUE;
}
-static void get_interface_mac_address(int index, uint8_t *mac_address)
-{
- struct ifreq ifr;
- int sk, err;
-
- sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
- if (sk < 0) {
- perror("Open socket error");
- return;
- }
-
- memset(&ifr, 0, sizeof(ifr));
- ifr.ifr_ifindex = index;
-
- err = ioctl(sk, SIOCGIFNAME, &ifr);
- if (err < 0) {
- perror("Get interface name error");
- goto done;
- }
-
- err = ioctl(sk, SIOCGIFHWADDR, &ifr);
- if (err < 0) {
- perror("Get mac address error");
- goto done;
- }
-
- memcpy(mac_address, ifr.ifr_hwaddr.sa_data, 6);
-
-done:
- close(sk);
-}
-
void g_dhcpv6_client_set_retransmit(GDHCPClient *dhcp_client)
{
if (!dhcp_client)
@@ -669,7 +637,7 @@ int g_dhcpv6_create_duid(GDHCPDuidType duid_type, int
index, int type,
(*duid)[0] = 0;
(*duid)[1] = 1;
- get_interface_mac_address(index, &(*duid)[2 + 2 + 4]);
+ __connman_inet_get_interface_mac_address(index, &(*duid)[2 + 2
+ 4]);
(*duid)[2] = 0;
(*duid)[3] = type;
duid_time = time(NULL) - DUID_TIME_EPOCH;
@@ -688,7 +656,7 @@ int g_dhcpv6_create_duid(GDHCPDuidType duid_type, int
index, int type,
(*duid)[0] = 0;
(*duid)[1] = 3;
- get_interface_mac_address(index, &(*duid)[2 + 2]);
+ __connman_inet_get_interface_mac_address(index, &(*duid)[2 +
2]);
(*duid)[2] = 0;
(*duid)[3] = type;
break;
@@ -813,7 +781,7 @@ void g_dhcpv6_client_create_iaid(GDHCPClient *dhcp_client,
int index,
{
uint8_t buf[6];
- get_interface_mac_address(index, buf);
+ __connman_inet_get_interface_mac_address(index, buf);
memcpy(iaid, &buf[2], 4);
dhcp_client->iaid = iaid[0] << 24 |
@@ -1180,7 +1148,7 @@ GDHCPClient *g_dhcp_client_new(GDHCPType type,
goto error;
}
- get_interface_mac_address(ifindex, dhcp_client->mac_address);
+ __connman_inet_get_interface_mac_address(ifindex,
dhcp_client->mac_address);
dhcp_client->listener_sockfd = -1;
dhcp_client->listen_mode = L_NONE;
diff --git a/src/connman.h b/src/connman.h
index 8f8d26a..c708d33 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -161,6 +161,7 @@ int __connman_inet_modify_address(int cmd, int flags, int
index, int family,
const char *broadcast);
int __connman_inet_get_interface_address(int index, int family, void *address);
int __connman_inet_get_interface_ll_address(int index, int family, void
*address);
+int __connman_inet_get_interface_mac_address(int index, uint8_t *mac_address);
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
diff --git a/src/inet.c b/src/inet.c
index a31372b..7ed493b 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -2734,6 +2734,41 @@ out:
return err;
}
+int __connman_inet_get_interface_mac_address(int index, uint8_t *mac_address)
+{
+ struct ifreq ifr;
+ int sk, err;
+ int ret = -EINVAL;
+
+ sk = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+ if (sk < 0) {
+ DBG("Open socket error");
+ return ret;
+ }
+
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_ifindex = index;
+
+ err = ioctl(sk, SIOCGIFNAME, &ifr);
+ if (err < 0) {
+ DBG("Get interface name error");
+ goto done;
+ }
+
+ err = ioctl(sk, SIOCGIFHWADDR, &ifr);
+ if (err < 0) {
+ DBG("Get MAC address error");
+ goto done;
+ }
+
+ memcpy(mac_address, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
+ ret = 0;
+
+done:
+ close(sk);
+ return ret;
+}
+
static int iprule_modify(int cmd, int family, uint32_t table_id,
uint32_t fwmark)
{
--
2.7.4
------------------------------
Message: 4
Date: Tue, 15 May 2018 12:35:09 +0200
From: Christian Spielberger <[email protected]>
To: Daniel Wagner <[email protected]>
Cc: [email protected], Christian Spielberger
<[email protected]>
Subject: [PATCH v3 02/27] dhcp: Use __connman_util_get_random
Message-ID:
<1526380534-23540-3-git-send-email-christian.spielber...@gmail.com>
In gdhcp replace usage of local functions for random number generation by
functions in src/util.c. So dhcp_get_random() and dhcp_cleanup_random() are
removed.
---
Makefile.am | 4 ----
gdhcp/client.c | 8 ++++----
gdhcp/common.c | 39 ++-------------------------------------
gdhcp/gdhcp.h | 3 ---
gdhcp/ipv4ll.c | 3 ++-
src/dhcp.c | 2 --
6 files changed, 8 insertions(+), 51 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index edd1969..dcd803b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,10 +32,6 @@ 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
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 1f01b57..5f42e39 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -520,7 +520,7 @@ static int send_release(GDHCPClient *dhcp_client,
debug(dhcp_client, "sending DHCP release request");
init_packet(dhcp_client, &packet, DHCPRELEASE);
- dhcp_get_random(&rand);
+ __connman_util_get_random(&rand);
packet.xid = rand;
packet.ciaddr = htonl(ciaddr);
@@ -1688,7 +1688,7 @@ static gboolean continue_rebound(gpointer user_data)
/*recalculate remaining rebind time*/
dhcp_client->T2 >>= 1;
if (dhcp_client->T2 > 60) {
- dhcp_get_random(&rand);
+ __connman_util_get_random(&rand);
dhcp_client->t2_timeout =
g_timeout_add_full(G_PRIORITY_HIGH,
dhcp_client->T2 * 1000 + (rand % 2000)
- 1000,
@@ -1736,7 +1736,7 @@ static gboolean continue_renew (gpointer user_data)
dhcp_client->T1 >>= 1;
if (dhcp_client->T1 > 60) {
- dhcp_get_random(&rand);
+ __connman_util_get_random(&rand);
dhcp_client->t1_timeout = g_timeout_add_full(G_PRIORITY_HIGH,
dhcp_client->T1 * 1000 + (rand % 2000) - 1000,
continue_renew,
@@ -2830,7 +2830,7 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const
char *last_address)
if (re != 0)
return re;
- dhcp_get_random(&rand);
+ __connman_util_get_random(&rand);
dhcp_client->xid = rand;
dhcp_client->start = time(NULL);
}
diff --git a/gdhcp/common.c b/gdhcp/common.c
index 6f81671..27f14dd 100644
--- a/gdhcp/common.c
+++ b/gdhcp/common.c
@@ -39,6 +39,7 @@
#include "gdhcp.h"
#include "common.h"
+#include "../src/connman.h"
static const DHCPOption client_options[] = {
{ OPTION_IP, 0x01 }, /* subnet-mask */
@@ -60,42 +61,6 @@ static const DHCPOption client_options[] = {
{ OPTION_UNKNOWN, 0x00 },
};
-#define URANDOM "/dev/urandom"
-static int random_fd = -1;
-
-int dhcp_get_random(uint64_t *val)
-{
- int r;
-
- if (random_fd < 0) {
- random_fd = open(URANDOM, O_RDONLY);
- if (random_fd < 0) {
- r = -errno;
- *val = random();
-
- return r;
- }
- }
-
- if (read(random_fd, val, sizeof(uint64_t)) < 0) {
- r = -errno;
- *val = random();
-
- return r;
- }
-
- return 0;
-}
-
-void dhcp_cleanup_random(void)
-{
- if (random_fd < 0)
- return;
-
- close(random_fd);
- random_fd = -1;
-}
-
GDHCPOptionType dhcp_get_code_type(uint8_t code)
{
int i;
@@ -400,7 +365,7 @@ void dhcpv6_init_header(struct dhcpv6_packet *packet,
uint8_t type)
packet->message = type;
- dhcp_get_random(&rand);
+ __connman_util_get_random(&rand);
id = rand;
packet->transaction_id[0] = (id >> 16) & 0xff;
diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h
index eaf6a74..1285431 100644
--- a/gdhcp/gdhcp.h
+++ b/gdhcp/gdhcp.h
@@ -232,9 +232,6 @@ void g_dhcp_server_set_save_lease(GDHCPServer *dhcp_server,
void g_dhcp_server_set_lease_added_cb(GDHCPServer *dhcp_server,
GDHCPLeaseAddedCb cb);
-int dhcp_get_random(uint64_t *val);
-void dhcp_cleanup_random(void);
-
#ifdef __cplusplus
}
#endif
diff --git a/gdhcp/ipv4ll.c b/gdhcp/ipv4ll.c
index 82e6c44..2ee58f7 100644
--- a/gdhcp/ipv4ll.c
+++ b/gdhcp/ipv4ll.c
@@ -36,6 +36,7 @@
#include "ipv4ll.h"
#include "common.h"
+#include "../src/connman.h"
/**
* Return a random link local IP (in host byte order)
@@ -46,7 +47,7 @@ uint32_t ipv4ll_random_ip(void)
uint64_t rand;
do {
- dhcp_get_random(&rand);
+ __connman_util_get_random(&rand);
tmp = rand;
tmp = tmp & IN_CLASSB_HOST;
} while (tmp > (IN_CLASSB_HOST - 0x0200));
diff --git a/src/dhcp.c b/src/dhcp.c
index 1af1eb5..b57a794 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -761,6 +761,4 @@ void __connman_dhcp_cleanup(void)
g_hash_table_destroy(ipconfig_table);
ipconfig_table = NULL;
-
- dhcp_cleanup_random();
}
--
2.7.4
------------------------------
Message: 5
Date: Tue, 15 May 2018 12:35:07 +0200
From: Christian Spielberger <[email protected]>
To: Daniel Wagner <[email protected]>
Cc: [email protected], Christian Spielberger
<[email protected]>
Subject: [PATCH v3 00/27] implement Address Conflict Detection
Message-ID:
<1526380534-23540-1-git-send-email-christian.spielber...@gmail.com>
This patch series implements Address Conflict Detection (ACD) according to
RFC-5227. The review comments of the RFC PATCH v2 series (thanks Daniel!) have
been taken into account:
- Building with my-bootstrap-configure (from Daniel) and make distcheck each
patch. Now they build all without warnings.
- Use functions for random number generation in src/util.c.
- Renaming and further cleanup with respect to doc/coding-style.txt.
- Compared carefully each patch with patch series v2 and tested again static and
dhcp case.
Patches 1 to 6 are unrelated and move common code to src/shared and adds
utility functions.
Patch 7 to 17 adds new files for ACD functionality. The IPv4LL code in gdhcp was
used as a basis for implementing ACD.
High-level conflict handling is placed in network, Patches 18 to 20.
Patch 21 adds a DBus property to inform about ACD.
Patch 22 to 25 adds sending of DHCP decline message in case an address conflict
is detected.
Patch 26 is for sending dbus signal also after the address defend failed and
own ip address is lost.
Patch 27 adds a DHCP decline also if second DHCP lease also has a conflict.
Christian Spielberger (26):
util: Add function __connman_util_random_delay_ms
dhcp: Use __connman_util_get_random
shared: Add low-level ARP functions
inet: Add __connman_inet_get_interface_mac_address()
shared/arp: Add arp_random_ip()
inet: Add function connman_inet_is_ifup()
Add Address Conflict Detection support (RFC 5227)
acd: Add struct acd_host
acd: Add functions start/stop_listening
acd: Add send_probe_packet
acd: Add send_announce_packet
acd: Add callback function pointers
acd: Add content of acd_host_start and acd_host_stop
acd: Add acd_defend_timeout and acd_announce_timeout
acd: Add handling of received arp packets
acd: Add callback registration
network: Init and start of acd
network: Add content of acd callback functions
network: Add ipv4ll as fallback for acd
acd: Add D-Bus property for address conflict
dhcp: Add sending of DHCP decline
network: Add function for delayed dhcp start
acd: Add acd_host_get_conflicts_count
network: Send DHCP decline in case of address conflict
acd: Report address lost case per D-Bus also
network: Also send DHCP DECLINE after second DHCP try
Peter Meerwald-Stadler (1):
doc: Add documentation for AddressConflictDetection
Makefile.am | 28 ++-
doc/connman.conf.5.in | 10 +
doc/service-api.txt | 32 +++
gdhcp/client.c | 96 ++++----
gdhcp/common.c | 39 +---
gdhcp/gdhcp.h | 4 +-
gdhcp/ipv4ll.c | 87 +------
gdhcp/ipv4ll.h | 55 -----
include/acd.h | 64 ++++++
include/inet.h | 1 +
include/network.h | 7 +
include/service.h | 1 +
src/acd.c | 588 +++++++++++++++++++++++++++++++++++++++++++++++
src/connman.h | 3 +
src/dhcp.c | 26 ++-
src/inet.c | 69 ++++++
src/main.c | 13 ++
src/network.c | 335 +++++++++++++++++++++++++++
src/service.c | 11 +
src/shared/arp.c | 126 ++++++++++
src/shared/arp.h | 47 ++++
src/util.c | 12 +
tools/dhcp-server-test.c | 5 +-
tools/dhcp-test.c | 5 +-
24 files changed, 1420 insertions(+), 244 deletions(-)
delete mode 100644 gdhcp/ipv4ll.h
create mode 100644 include/acd.h
create mode 100644 src/acd.c
create mode 100644 src/shared/arp.c
create mode 100644 src/shared/arp.h
--
2.7.4
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 31, Issue 6
**************************************