Hi Julien,
On Fri, Dec 10, 2010 at 11:00:34AM +0000, Julien Massot wrote:
> IPV4LL netmask can't be obtained by g_dhcp_client_get_option.
> ---
> gdhcp/client.c | 19 +++++++++++++++++++
> gdhcp/gdhcp.h | 1 +
> 2 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/gdhcp/client.c b/gdhcp/client.c
> index d110a10..ce4a2f6 100644
> --- a/gdhcp/client.c
> +++ b/gdhcp/client.c
> @@ -1414,6 +1414,25 @@ char *g_dhcp_client_get_address(GDHCPClient
> *dhcp_client)
> return g_strdup(dhcp_client->assigned_ip);
> }
>
> +char *g_dhcp_client_get_netmask(GDHCPClient *dhcp_client)
> +{
> + GList *option = NULL;
> +
> + switch(dhcp_client->state) {
switch (), not switch()
> + case IPV4LL_DEFEND:
> + case IPV4LL_MONITOR:
> + return g_strdup("255.255.0.0");
> + case BOUND:
> + case RENEWING:
> + case REBINDING:
> + option = g_dhcp_client_get_option(dhcp_client, G_DHCP_SUBNET);
> + if (option != NULL)
> + return option->data;
You need to return an allocated (g_strdup) string here, and free it from the
caller.
> + default:
> + return NULL;
So the (unwritten) rule for our switch handling is to explicitely handle all
values when switching through an enum type.
I should add a coding style document to the ConnMan documentation at some
point, sorry.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman