Hi Marcel, thanks for the quick reply.
Le lundi 02 août 2010 à 09:04 -0700, Marcel Holtmann a écrit :
> Hi Pierre,
>
> > I have downloaded and compiled connman-0.55. It segfaults at launch,
> > before I can do anything.
> >
> > It is cross-compiled for embedded arm platform. I have disabled the dhcp
> > and udhcpc plugins (however even if I enable the udhcpc plugin the
> > problem still occurs). It seems to crash in some dhcp code (as the two
> > last debug messages are "connmand[1494]: plugins/dhcp.c:dhcp_request()
> > dhcp 0x48c78
> > connmand[1494]: src/utsname.c:connman_utsname_get_hostname()")
> >
> > I can't find any reference to a similar problem on the mailing list.
> > Here's the backtrace :
>
> if you could run this through gdb and get a real backtrace that would
> help. However I pushed a fix into the tree that checks the hostname
> first if it is valid. Maybe your system for some reasons doesn't set a
> hostname (and you are not using the loopback plugin).
You were right, I was not using the loopback plugin. That caused
connman_utsname_get_hostname to return NULL. So, in dhcp_request, when
calling g_dhcp_client_set_send, parameter option_value is NULL. Then in
get_hostname, the first test (g_strcmp0("<hostname>", host) != 0)
succeeds, so it returns a g_strdup(NULL), which leads to a segfault in
strnlen in alloc_dhcp_option.
Does this (mini)patch seem reasonable ?
Regards
--
Pierre-Rudolf Gerlach
Mindscape
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 7a44724..0a4391e 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1194,7 +1194,7 @@ static const char *get_hostname(const char *host)
{
char local_host_name[HOST_NAME_MAX + 1];
- if (g_strcmp0("<hostname>", host) != 0)
+ if (NULL != host && g_strcmp0("<hostname>", host) != 0)
return g_strdup(host);
if (gethostname(local_host_name, HOST_NAME_MAX) != 0)
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman