Hi,
Thanks, patch looks ok to me. But that does not fix the root cause yet
since basically,
connman should never start dhcp client if the device is not up.
Though I think your patch should come in anyway, it's indeed necessary
to know if the
initialization went fine before proceeding further.
We are investigating this on our side since we've got the proper steps
to reproduce it.
Tomasz
Sometimes while switching network dhcp_initialize() fails because
interface is not up and hence dhcp->dhcp_client remains NULL. Here we
don't check return type of dhcp_initialize() and go on to call function
g_dhcp_client_start() and crash occurs.
Below trace is obtained when connman crashes:
connmand[19034]: Aborting (signal 11) [/usr/local/sbin/connmand]
connmand[19034]: ++++++++ backtrace ++++++++
connmand[19034]: #0 0xb7630f38 in /lib/i386-linux-gnu/libpthread.so.0
connmand[19034]: #1 0x8055a22 in debug() at client.c:0
connmand[19034]: #2 0x8058837 in g_dhcp_client_start() at polkit.c:0
connmand[19034]: #3 0x80a4772 in __connman_dhcp_start() at polkit.c:0
connmand[19034]: #4 0x8082a80 in set_connected.part.8() at network.c:0
connmand[19034]: #5 0x8082f7f in connman_network_set_connected() at
??:0
connmand[19034]: #6 0x805f921 in eth_network_connect() at ethernet.c:0
connmand[19034]: #7 0x8082dc3 in __connman_network_connect() at
polkit.c:0
connmand[19034]: #8 0x808e7e4 in __connman_service_connect() at
polkit.c:0
connmand[19034]: #9 0x808eef0 in auto_connect_service() at service.c:0
connmand[19034]: #10 0x808efde in run_auto_connect() at service.c:0
connmand[19034]: #11 0xb76cea3f in /lib/i386-linux-gnu/libglib-2.0.so.0
connmand[19034]: #12 0xb76cdd46 in /lib/i386-linux-gnu/libglib-2.0.so.0
connmand[19034]: #13 0xb76ce0e5 in /lib/i386-linux-gnu/libglib-2.0.so.0
connmand[19034]: #14 0xb76ce52b in /lib/i386-linux-gnu/libglib-2.0.so.0
connmand[19034]: #15 0x80544cd in main() at polkit.c:0
connmand[19034]: #16 0xb739b4d3 in /lib/i386-linux-gnu/libc.so.6
connmand[19034]: +++++++++++++++++++++++++++
---
src/dhcp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/dhcp.c b/src/dhcp.c
index 132b787..a3dd3c4 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -587,6 +587,7 @@ int __connman_dhcp_start(struct connman_ipconfig
*ipconfig,
{
const char *last_addr = NULL;
struct connman_dhcp *dhcp;
+ int err;
DBG("");
@@ -615,9 +616,12 @@ int __connman_dhcp_start(struct connman_ipconfig
*ipconfig,
connman_network_ref(network);
}
- g_hash_table_insert(ipconfig_table, ipconfig, dhcp);
+ err = dhcp_initialize(dhcp);
- dhcp_initialize(dhcp);
+ if(err != 0)
+ return err;
+
+ g_hash_table_insert(ipconfig_table, ipconfig, dhcp);
}
dhcp->callback = callback;
_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman