gdhcp: Fix spelling mistake
[framework/connectivity/connman.git] / gdhcp / client.c
index e3ae0db..55810d5 100644 (file)
@@ -43,7 +43,7 @@
 #include "common.h"
 
 #define DISCOVER_TIMEOUT 3
-#define DISCOVER_RETRIES 5
+#define DISCOVER_RETRIES 10
 
 #define REQUEST_TIMEOUT 3
 #define REQUEST_RETRIES 5
@@ -435,6 +435,7 @@ static int dhcp_l2_socket(int ifindex)
                setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter_prog,
                                                        sizeof(filter_prog));
 
+       memset(&sock, 0, sizeof(sock));
        sock.sll_family = AF_PACKET;
        sock.sll_protocol = htons(ETH_P_IP);
        sock.sll_ifindex = ifindex;
@@ -844,7 +845,7 @@ static char *malloc_option_value_string(uint8_t *option, GDHCPOptionType type)
        return ret;
 }
 
-static GList *get_option_value_list(char *value)
+static GList *get_option_value_list(char *value, GDHCPOptionType type)
 {
        char *pos = value;
        GList *list = NULL;
@@ -852,6 +853,9 @@ static GList *get_option_value_list(char *value)
        if (pos == NULL)
                return NULL;
 
+       if (type == OPTION_STRING)
+               return g_list_append(list, g_strdup(value));
+
        while ((pos = strchr(pos, ' ')) != NULL) {
                *pos = '\0';
 
@@ -890,7 +894,7 @@ static void get_request(GDHCPClient *dhcp_client, struct dhcp_packet *packet)
                        g_hash_table_remove(dhcp_client->code_value_hash,
                                                GINT_TO_POINTER((int) code));
 
-               value_list = get_option_value_list(option_value);
+               value_list = get_option_value_list(option_value, type);
 
                g_free(option_value);
 
@@ -934,7 +938,7 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
 
        message_type = dhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
        if (message_type == NULL)
-               /* No message type option, ignore pakcage */
+               /* No message type option, ignore package */
                return TRUE;
 
        debug(dhcp_client, "received DHCP packet (current state %d)",