Release tizen_2.0_beta
[framework/connectivity/connman.git] / gdhcp / client.c
index a51857f..29c30fa 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  DHCP client library with GLib integration
  *
- *  Copyright (C) 2009-2012  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2009-2010  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -69,12 +69,6 @@ typedef enum _dhcp_client_state {
        IPV4LL_ANNOUNCE,
        IPV4LL_MONITOR,
        IPV4LL_DEFEND,
-       INFORMATION_REQ,
-       SOLICITATION,
-       REQUEST,
-       RENEW,
-       REBIND,
-       RELEASE,
 } ClientState;
 
 struct _GDHCPClient {
@@ -88,7 +82,6 @@ struct _GDHCPClient {
        uint32_t server_ip;
        uint32_t requested_ip;
        char *assigned_ip;
-       time_t start;
        uint32_t lease_seconds;
        ListenMode listen_mode;
        int listener_sockfd;
@@ -116,33 +109,10 @@ struct _GDHCPClient {
        gpointer address_conflict_data;
        GDHCPDebugFunc debug_func;
        gpointer debug_data;
-       GDHCPClientEventFunc information_req_cb;
-       gpointer information_req_data;
-       GDHCPClientEventFunc solicitation_cb;
-       gpointer solicitation_data;
-       GDHCPClientEventFunc advertise_cb;
-       gpointer advertise_data;
-       GDHCPClientEventFunc request_cb;
-       gpointer request_data;
-       GDHCPClientEventFunc renew_cb;
-       gpointer renew_data;
-       GDHCPClientEventFunc rebind_cb;
-       gpointer rebind_data;
-       GDHCPClientEventFunc release_cb;
-       gpointer release_data;
        char *last_address;
-       unsigned char *duid;
-       int duid_len;
-       unsigned char *server_duid;
-       int server_duid_len;
-       uint16_t status_code;
-       uint32_t iaid;
-       uint32_t T1, T2;
-       struct in6_addr ia_na;
-       struct in6_addr ia_ta;
-       time_t last_renew;
-       time_t last_rebind;
-       time_t expire;
+#if defined TIZEN_EXT
+       gboolean init_reboot;
+#endif
 };
 
 static inline void debug(GDHCPClient *client, const char *format, ...)
@@ -162,16 +132,12 @@ static inline void debug(GDHCPClient *client, const char *format, ...)
 }
 
 /* Initialize the packet with the proper defaults */
-static void init_packet(GDHCPClient *dhcp_client, gpointer pkt, char type)
+static void init_packet(GDHCPClient *dhcp_client,
+               struct dhcp_packet *packet, char type)
 {
-       if (dhcp_client->type == G_DHCP_IPV6)
-               dhcpv6_init_header(pkt, type);
-       else {
-               struct dhcp_packet *packet = pkt;
+       dhcp_init_header(packet, type);
 
-               dhcp_init_header(packet, type);
-               memcpy(packet->chaddr, dhcp_client->mac_address, 6);
-       }
+       memcpy(packet->chaddr, dhcp_client->mac_address, 6);
 }
 
 static void add_request_options(GDHCPClient *dhcp_client,
@@ -196,135 +162,6 @@ static void add_request_options(GDHCPClient *dhcp_client,
        }
 }
 
-struct hash_params {
-       unsigned char *buf;
-       int max_buf;
-       unsigned char **ptr_buf;
-};
-
-static void add_dhcpv6_binary_option(gpointer key, gpointer value,
-                                       gpointer user_data)
-{
-       uint8_t *option = value;
-       uint16_t len;
-       struct hash_params *params = user_data;
-
-       /* option[0][1] contains option code */
-       len = option[2] << 8 | option[3];
-
-       if ((*params->ptr_buf + len + 2 + 2) > (params->buf + params->max_buf))
-               return;
-
-       memcpy(*params->ptr_buf, option, len + 2 + 2);
-       (*params->ptr_buf) += len + 2 + 2;
-}
-
-static void add_dhcpv6_send_options(GDHCPClient *dhcp_client,
-                               unsigned char *buf, int max_buf,
-                               unsigned char **ptr_buf)
-{
-       struct hash_params params = {
-               .buf = buf,
-               .max_buf = max_buf,
-               .ptr_buf = ptr_buf
-       };
-
-       if (dhcp_client->type == G_DHCP_IPV4)
-               return;
-
-       g_hash_table_foreach(dhcp_client->send_value_hash,
-                               add_dhcpv6_binary_option, &params);
-
-       *ptr_buf = *params.ptr_buf;
-}
-
-static void copy_option(uint8_t *buf, uint16_t code, uint16_t len,
-                       uint8_t *msg)
-{
-       buf[0] = code >> 8;
-       buf[1] = code & 0xff;
-       buf[2] = len >> 8;
-       buf[3] = len & 0xff;
-       if (len > 0 && msg != NULL)
-               memcpy(&buf[4], msg, len);
-}
-
-static void add_dhcpv6_request_options(GDHCPClient *dhcp_client,
-                               struct dhcpv6_packet *packet,
-                               unsigned char *buf, int max_buf,
-                               unsigned char **ptr_buf)
-{
-       GList *list;
-       uint16_t code;
-       int len;
-
-       if (dhcp_client->type == G_DHCP_IPV4)
-               return;
-
-       for (list = dhcp_client->request_list; list; list = list->next) {
-               code = (uint16_t) GPOINTER_TO_INT(list->data);
-
-               switch (code) {
-               case G_DHCPV6_CLIENTID:
-                       if (dhcp_client->duid == NULL)
-                               return;
-
-                       len = 2 + 2 + dhcp_client->duid_len;
-                       if ((*ptr_buf + len) > (buf + max_buf)) {
-                               debug(dhcp_client, "Too long dhcpv6 message "
-                                       "when writing client id option");
-                               return;
-                       }
-
-                       copy_option(*ptr_buf, G_DHCPV6_CLIENTID,
-                               dhcp_client->duid_len, dhcp_client->duid);
-                       (*ptr_buf) += len;
-                       break;
-
-               case G_DHCPV6_SERVERID:
-                       if (dhcp_client->server_duid == NULL)
-                               return;
-
-                       len = 2 + 2 + dhcp_client->server_duid_len;
-                       if ((*ptr_buf + len) > (buf + max_buf)) {
-                               debug(dhcp_client, "Too long dhcpv6 message "
-                                       "when writing server id option");
-                               return;
-                       }
-
-                       copy_option(*ptr_buf, G_DHCPV6_SERVERID,
-                               dhcp_client->server_duid_len,
-                               dhcp_client->server_duid);
-                       (*ptr_buf) += len;
-                       break;
-
-               case G_DHCPV6_RAPID_COMMIT:
-                       len = 2 + 2;
-                       if ((*ptr_buf + len) > (buf + max_buf)) {
-                               debug(dhcp_client, "Too long dhcpv6 message "
-                                       "when writing rapid commit option");
-                               return;
-                       }
-
-                       copy_option(*ptr_buf, G_DHCPV6_RAPID_COMMIT, 0, 0);
-                       (*ptr_buf) += len;
-                       break;
-
-               case G_DHCPV6_ORO:
-                       break;
-
-               case G_DHCPV6_DNS_SERVERS:
-                       break;
-
-               case G_DHCPV6_SNTP_SERVERS:
-                       break;
-
-               default:
-                       break;
-               }
-       }
-}
-
 static void add_binary_option(gpointer key, gpointer value, gpointer user_data)
 {
        uint8_t *option = value;
@@ -340,17 +177,6 @@ static void add_send_options(GDHCPClient *dhcp_client,
                                add_binary_option, packet);
 }
 
-/*
- * Return an RFC 951- and 2131-complaint BOOTP 'secs' value that
- * represents the number of seconds elapsed from the start of
- * attempting DHCP to satisfy some DHCP servers that allow for an
- * "authoritative" reply before responding.
- */
-static uint16_t dhcp_attempt_secs(GDHCPClient *dhcp_client)
-{
-       return htons(MIN(time(NULL) - dhcp_client->start, UINT16_MAX));
-}
-
 static int send_discover(GDHCPClient *dhcp_client, uint32_t requested)
 {
        struct dhcp_packet packet;
@@ -360,7 +186,6 @@ static int send_discover(GDHCPClient *dhcp_client, uint32_t requested)
        init_packet(dhcp_client, &packet, DHCPDISCOVER);
 
        packet.xid = dhcp_client->xid;
-       packet.secs = dhcp_attempt_secs(dhcp_client);
 
        if (requested)
                dhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested);
@@ -387,10 +212,12 @@ static int send_select(GDHCPClient *dhcp_client)
        init_packet(dhcp_client, &packet, DHCPREQUEST);
 
        packet.xid = dhcp_client->xid;
-       packet.secs = dhcp_attempt_secs(dhcp_client);
 
        dhcp_add_simple_option(&packet, DHCP_REQUESTED_IP,
                                        dhcp_client->requested_ip);
+#if defined TIZEN_EXT
+       if (dhcp_client->init_reboot != TRUE)
+#endif
        dhcp_add_simple_option(&packet, DHCP_SERVER_ID, dhcp_client->server_ip);
 
        add_request_options(dhcp_client, &packet);
@@ -567,284 +394,6 @@ done:
        close(sk);
 }
 
-int g_dhcpv6_create_duid(GDHCPDuidType duid_type, int index, int type,
-                       unsigned char **duid, int *duid_len)
-{
-       time_t duid_time;
-
-       switch (duid_type) {
-       case G_DHCPV6_DUID_LLT:
-               *duid_len = 2 + 2 + 4 + ETH_ALEN;
-               *duid = g_try_malloc(*duid_len);
-               if (*duid == NULL)
-                       return -ENOMEM;
-
-               (*duid)[0] = 0;
-               (*duid)[1] = 1;
-               get_interface_mac_address(index, &(*duid)[2 + 2 + 4]);
-               (*duid)[2] = 0;
-               (*duid)[3] = type;
-               duid_time = time(NULL) - DUID_TIME_EPOCH;
-               (*duid)[4] = duid_time >> 24;
-               (*duid)[5] = duid_time >> 16;
-               (*duid)[6] = duid_time >> 8;
-               (*duid)[7] = duid_time & 0xff;
-               break;
-       case G_DHCPV6_DUID_EN:
-               return -EINVAL;
-       case G_DHCPV6_DUID_LL:
-               *duid_len = 2 + 2 + ETH_ALEN;
-               *duid = g_try_malloc(*duid_len);
-               if (*duid == NULL)
-                       return -ENOMEM;
-
-               (*duid)[0] = 0;
-               (*duid)[1] = 3;
-               get_interface_mac_address(index, &(*duid)[2 + 2]);
-               (*duid)[2] = 0;
-               (*duid)[3] = type;
-               break;
-       }
-
-       return 0;
-}
-
-int g_dhcpv6_client_set_duid(GDHCPClient *dhcp_client, unsigned char *duid,
-                       int duid_len)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return -EINVAL;
-
-       g_free(dhcp_client->duid);
-
-       dhcp_client->duid = duid;
-       dhcp_client->duid_len = duid_len;
-
-       return 0;
-}
-
-uint32_t g_dhcpv6_client_get_iaid(GDHCPClient *dhcp_client)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return 0;
-
-       return dhcp_client->iaid;
-}
-
-void g_dhcpv6_client_create_iaid(GDHCPClient *dhcp_client, int index,
-                               unsigned char *iaid)
-{
-       uint8_t buf[6];
-
-       get_interface_mac_address(index, buf);
-
-       memcpy(iaid, &buf[2], 4);
-       dhcp_client->iaid = iaid[0] << 24 |
-                       iaid[1] << 16 | iaid[2] << 8 | iaid[3];
-}
-
-int g_dhcpv6_client_get_timeouts(GDHCPClient *dhcp_client,
-                               uint32_t *T1, uint32_t *T2,
-                               time_t *last_renew, time_t *last_rebind,
-                               time_t *expire)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return -EINVAL;
-
-       if (T1 != NULL)
-               *T1 = dhcp_client->T1;
-
-       if (T2 != NULL)
-               *T2 = dhcp_client->T2;
-
-       if (last_renew != NULL)
-               *last_renew = dhcp_client->last_renew;
-
-       if (last_rebind != NULL)
-               *last_rebind = dhcp_client->last_rebind;
-
-       if (expire != NULL)
-               *expire = dhcp_client->expire;
-
-       return 0;
-}
-
-static uint8_t *create_iaaddr(GDHCPClient *dhcp_client, uint8_t *buf,
-                               uint16_t len)
-{
-       buf[0] = 0;
-       buf[1] = G_DHCPV6_IAADDR;
-       buf[2] = 0;
-       buf[3] = len;
-       memcpy(&buf[4], &dhcp_client->ia_na, 16);
-       memset(&buf[20], 0, 4); /* preferred */
-       memset(&buf[24], 0, 4); /* valid */
-       return buf;
-}
-
-static void put_iaid(GDHCPClient *dhcp_client, int index, uint8_t *buf)
-{
-       uint32_t iaid;
-
-       iaid = g_dhcpv6_client_get_iaid(dhcp_client);
-       if (iaid == 0) {
-               g_dhcpv6_client_create_iaid(dhcp_client, index, buf);
-               return;
-       }
-
-       buf[0] = iaid >> 24;
-       buf[1] = iaid >> 16;
-       buf[2] = iaid >> 8;
-       buf[3] = iaid;
-}
-
-int g_dhcpv6_client_set_ia(GDHCPClient *dhcp_client, int index,
-                       int code, uint32_t *T1, uint32_t *T2,
-                       gboolean add_iaaddr)
-{
-       if (code == G_DHCPV6_IA_TA) {
-               uint8_t ia_options[4];
-
-               put_iaid(dhcp_client, index, ia_options);
-
-               g_dhcp_client_set_request(dhcp_client, G_DHCPV6_IA_TA);
-               g_dhcpv6_client_set_send(dhcp_client, G_DHCPV6_IA_TA,
-                                       ia_options, sizeof(ia_options));
-
-       } else if (code == G_DHCPV6_IA_NA) {
-
-               g_dhcp_client_set_request(dhcp_client, G_DHCPV6_IA_NA);
-
-               if (add_iaaddr == TRUE) {
-#define IAADDR_LEN (16+4+4)
-                       uint8_t ia_options[4+4+4+2+2+IAADDR_LEN];
-
-                       put_iaid(dhcp_client, index, ia_options);
-
-                       if (T1 != NULL) {
-                               ia_options[4] = *T1 >> 24;
-                               ia_options[5] = *T1 >> 16;
-                               ia_options[6] = *T1 >> 8;
-                               ia_options[7] = *T1;
-                       } else
-                               memset(&ia_options[4], 0x00, 4);
-
-                       if (T2 != NULL) {
-                               ia_options[8] = *T2 >> 24;
-                               ia_options[9] = *T2 >> 16;
-                               ia_options[10] = *T2 >> 8;
-                               ia_options[11] = *T2;
-                       } else
-                               memset(&ia_options[8], 0x00, 4);
-
-                       create_iaaddr(dhcp_client, &ia_options[12],
-                                       IAADDR_LEN);
-
-                       g_dhcpv6_client_set_send(dhcp_client, G_DHCPV6_IA_NA,
-                                       ia_options, sizeof(ia_options));
-               } else {
-                       uint8_t ia_options[4+4+4];
-
-                       put_iaid(dhcp_client, index, ia_options);
-
-                       memset(&ia_options[4], 0x00, 4); /* T1 (4 bytes) */
-                       memset(&ia_options[8], 0x00, 4); /* T2 (4 bytes) */
-
-                       g_dhcpv6_client_set_send(dhcp_client, G_DHCPV6_IA_NA,
-                                       ia_options, sizeof(ia_options));
-               }
-
-       } else
-               return -EINVAL;
-
-       return 0;
-}
-
-int g_dhcpv6_client_set_oro(GDHCPClient *dhcp_client, int args, ...)
-{
-       va_list va;
-       int i, j, len = sizeof(uint16_t) * args;
-       uint8_t *values;
-
-       values = g_try_malloc(len);
-       if (values == NULL)
-               return -ENOMEM;
-
-       va_start(va, args);
-       for (i = 0, j = 0; i < args; i++) {
-               uint16_t value = va_arg(va, int);
-               values[j++] = value >> 8;
-               values[j++] = value & 0xff;
-       }
-       va_end(va);
-
-       g_dhcpv6_client_set_send(dhcp_client, G_DHCPV6_ORO, values, len);
-
-       return 0;
-}
-
-static int send_dhcpv6_msg(GDHCPClient *dhcp_client, int type, char *msg)
-{
-       struct dhcpv6_packet *packet;
-       uint8_t buf[MAX_DHCPV6_PKT_SIZE];
-       unsigned char *ptr;
-       int ret, max_buf;
-
-       memset(buf, 0, sizeof(buf));
-       packet = (struct dhcpv6_packet *)&buf[0];
-       ptr = buf + sizeof(struct dhcpv6_packet);
-
-       debug(dhcp_client, "sending DHCPv6 %s message", msg);
-
-       init_packet(dhcp_client, packet, type);
-
-       dhcp_client->xid = packet->transaction_id[0] << 16 |
-                       packet->transaction_id[1] << 8 |
-                       packet->transaction_id[2];
-
-       max_buf = MAX_DHCPV6_PKT_SIZE - sizeof(struct dhcpv6_packet);
-
-       add_dhcpv6_request_options(dhcp_client, packet, buf, max_buf, &ptr);
-
-       add_dhcpv6_send_options(dhcp_client, buf, max_buf, &ptr);
-
-       ret = dhcpv6_send_packet(dhcp_client->ifindex, packet, ptr - buf);
-
-       debug(dhcp_client, "sent %d pkt %p len %d", ret, packet, ptr - buf);
-       return ret;
-}
-
-static int send_solicitation(GDHCPClient *dhcp_client)
-{
-       return send_dhcpv6_msg(dhcp_client, DHCPV6_SOLICIT, "solicit");
-}
-
-static int send_dhcpv6_request(GDHCPClient *dhcp_client)
-{
-       return send_dhcpv6_msg(dhcp_client, DHCPV6_REQUEST, "request");
-}
-
-static int send_dhcpv6_renew(GDHCPClient *dhcp_client)
-{
-       return send_dhcpv6_msg(dhcp_client, DHCPV6_RENEW, "renew");
-}
-
-static int send_dhcpv6_rebind(GDHCPClient *dhcp_client)
-{
-       return send_dhcpv6_msg(dhcp_client, DHCPV6_REBIND, "rebind");
-}
-
-static int send_dhcpv6_release(GDHCPClient *dhcp_client)
-{
-       return send_dhcpv6_msg(dhcp_client, DHCPV6_RELEASE, "release");
-}
-
-static int send_information_req(GDHCPClient *dhcp_client)
-{
-       return send_dhcpv6_msg(dhcp_client, DHCPV6_INFORMATION_REQ,
-                               "information-req");
-}
-
 static void remove_value(gpointer data, gpointer user_data)
 {
        char *value = data;
@@ -908,10 +457,6 @@ GDHCPClient *g_dhcp_client_new(GDHCPType type,
                                g_direct_equal, NULL, g_free);
        dhcp_client->request_list = NULL;
        dhcp_client->require_list = NULL;
-       dhcp_client->duid = NULL;
-       dhcp_client->duid_len = 0;
-       dhcp_client->last_renew = dhcp_client->last_rebind = time(NULL);
-       dhcp_client->expire = 0;
 
        *error = G_DHCP_CLIENT_ERROR_NONE;
 
@@ -1126,6 +671,7 @@ static int ipv4ll_recv_arp_packet(GDHCPClient *dhcp_client)
        int target_conflict;
 
        memset(&arp, 0, sizeof(arp));
+       bytes = 0;
        bytes = read(dhcp_client->listener_sockfd, &arp, sizeof(arp));
        if (bytes < 0)
                return bytes;
@@ -1190,33 +736,17 @@ static int ipv4ll_recv_arp_packet(GDHCPClient *dhcp_client)
        return 0;
 }
 
-static gboolean check_package_owner(GDHCPClient *dhcp_client, gpointer pkt)
+static gboolean check_package_owner(GDHCPClient *dhcp_client,
+                                       struct dhcp_packet *packet)
 {
-       if (dhcp_client->type == G_DHCP_IPV6) {
-               struct dhcpv6_packet *packet6 = pkt;
-               uint32_t xid;
-
-               if (packet6 == NULL)
-                       return FALSE;
-
-               xid = packet6->transaction_id[0] << 16 |
-                       packet6->transaction_id[1] << 8 |
-                       packet6->transaction_id[2];
-
-               if (xid != dhcp_client->xid)
-                       return FALSE;
-       } else {
-               struct dhcp_packet *packet = pkt;
-
-               if (packet->xid != dhcp_client->xid)
-                       return FALSE;
+       if (packet->xid != dhcp_client->xid)
+               return FALSE;
 
-               if (packet->hlen != 6)
-                       return FALSE;
+       if (packet->hlen != 6)
+               return FALSE;
 
-               if (memcmp(packet->chaddr, dhcp_client->mac_address, 6))
-                       return FALSE;
-       }
+       if (memcmp(packet->chaddr, dhcp_client->mac_address, 6))
+               return FALSE;
 
        return TRUE;
 }
@@ -1246,15 +776,14 @@ static int switch_listening_mode(GDHCPClient *dhcp_client,
        GIOChannel *listener_channel;
        int listener_sockfd;
 
-       if (dhcp_client->listen_mode == listen_mode)
-               return 0;
-
        debug(dhcp_client, "switch listening mode (%d ==> %d)",
                                dhcp_client->listen_mode, listen_mode);
 
+       if (dhcp_client->listen_mode == listen_mode)
+               return 0;
+
        if (dhcp_client->listen_mode != L_NONE) {
-               if (dhcp_client->listener_watch > 0)
-                       g_source_remove(dhcp_client->listener_watch);
+               g_source_remove(dhcp_client->listener_watch);
                dhcp_client->listener_channel = NULL;
                dhcp_client->listen_mode = L_NONE;
                dhcp_client->listener_sockfd = -1;
@@ -1266,16 +795,10 @@ static int switch_listening_mode(GDHCPClient *dhcp_client,
 
        if (listen_mode == L2)
                listener_sockfd = dhcp_l2_socket(dhcp_client->ifindex);
-       else if (listen_mode == L3) {
-               if (dhcp_client->type == G_DHCP_IPV6)
-                       listener_sockfd = dhcp_l3_socket(DHCPV6_CLIENT_PORT,
-                                                       dhcp_client->interface,
-                                                       AF_INET6);
-               else
-                       listener_sockfd = dhcp_l3_socket(CLIENT_PORT,
-                                                       dhcp_client->interface,
-                                                       AF_INET);
-       } else if (listen_mode == L_ARP)
+       else if (listen_mode == L3)
+               listener_sockfd = dhcp_l3_socket(CLIENT_PORT,
+                                               dhcp_client->interface);
+       else if (listen_mode == L_ARP)
                listener_sockfd = ipv4ll_arp_socket(dhcp_client->ifindex);
        else
                return -EIO;
@@ -1571,211 +1094,6 @@ static GList *get_option_value_list(char *value, GDHCPOptionType type)
        return list;
 }
 
-static inline uint32_t get_uint32(unsigned char *value)
-{
-       return value[0] << 24 | value[1] << 16 |
-               value[2] << 8 | value[3];
-}
-
-static inline uint16_t get_uint16(unsigned char *value)
-{
-       return value[0] << 8 | value[1];
-}
-
-static GList *get_addresses(GDHCPClient *dhcp_client,
-                               int code, int len,
-                               unsigned char *value,
-                               uint16_t *status)
-{
-       GList *list = NULL;
-       struct in6_addr addr;
-       uint32_t iaid, T1 = 0, T2 = 0, preferred = 0, valid = 0;
-       uint16_t option_len, option_code, st = 0, max_len;
-       int addr_count = 0, i, pos;
-       uint8_t *option;
-       char *str;
-
-       if (value == NULL || len < 4)
-               return NULL;
-
-       iaid = get_uint32(&value[0]);
-       if (dhcp_client->iaid != iaid)
-               return NULL;
-
-       if (code == G_DHCPV6_IA_NA) {
-               T1 = get_uint32(&value[4]);
-               T2 = get_uint32(&value[8]);
-
-               if (T1 > T2)
-                       /* RFC 3315, 22.4 */
-                       return NULL;
-
-               pos = 12;
-       } else
-               pos = 4;
-
-       if (len <= pos)
-               return NULL;
-
-       max_len = len - pos;
-
-       /* We have more sub-options in this packet. */
-       do {
-               option = dhcpv6_get_sub_option(&value[pos], max_len,
-                                       &option_code, &option_len);
-
-               debug(dhcp_client, "pos %d option %p code %d len %d",
-                       pos, option, option_code, option_len);
-
-               if (option == NULL)
-                       break;
-
-               if (pos >= max_len)
-                       break;
-
-               switch (option_code) {
-               case G_DHCPV6_IAADDR:
-                       i = 0;
-                       memcpy(&addr, &option[0], sizeof(addr));
-                       i += sizeof(addr);
-                       preferred = get_uint32(&option[i]);
-                       i += 4;
-                       valid = get_uint32(&option[i]);
-
-                       addr_count++;
-                       break;
-
-               case G_DHCPV6_STATUS_CODE:
-                       st = get_uint16(&option[0]);
-                       debug(dhcp_client, "error code %d", st);
-                       if (option_len > 2) {
-                               str = g_strndup((gchar *)&option[2],
-                                               option_len - 2);
-                               debug(dhcp_client, "error text: %s", str);
-                               g_free(str);
-                       }
-
-                       *status = st;
-                       break;
-               }
-
-               pos += 2 + 2 + option_len;
-
-       } while (option != NULL);
-
-       if (addr_count > 0 && st == 0) {
-               /* We only support one address atm */
-               char str[INET6_ADDRSTRLEN + 1];
-
-               if (preferred > valid)
-                       /* RFC 3315, 22.6 */
-                       return NULL;
-
-               dhcp_client->T1 = T1;
-               dhcp_client->T2 = T2;
-
-               inet_ntop(AF_INET6, &addr, str, INET6_ADDRSTRLEN);
-               debug(dhcp_client, "count %d addr %s T1 %u T2 %u",
-                       addr_count, str, T1, T2);
-
-               list = g_list_append(list, g_strdup(str));
-
-               if (code == G_DHCPV6_IA_NA)
-                       memcpy(&dhcp_client->ia_na, &addr,
-                                               sizeof(struct in6_addr));
-               else
-                       memcpy(&dhcp_client->ia_ta, &addr,
-                                               sizeof(struct in6_addr));
-
-               g_dhcpv6_client_set_expire(dhcp_client, valid);
-       }
-
-       return list;
-}
-
-static GList *get_dhcpv6_option_value_list(GDHCPClient *dhcp_client,
-                                       int code, int len,
-                                       unsigned char *value,
-                                       uint16_t *status)
-{
-       GList *list = NULL;
-       char *str;
-       int i;
-
-       if (value == NULL)
-               return NULL;
-
-       switch (code) {
-       case G_DHCPV6_DNS_SERVERS:      /* RFC 3646, chapter 3 */
-       case G_DHCPV6_SNTP_SERVERS:     /* RFC 4075, chapter 4 */
-               if (len % 16) {
-                       debug(dhcp_client,
-                               "%s server list length (%d) is invalid",
-                               code == G_DHCPV6_DNS_SERVERS ? "DNS" : "SNTP",
-                               len);
-                       return NULL;
-               }
-               for (i = 0; i < len; i += 16) {
-
-                       str = g_try_malloc0(INET6_ADDRSTRLEN+1);
-                       if (str == NULL)
-                               return list;
-
-                       if (inet_ntop(AF_INET6, &value[i], str,
-                                       INET6_ADDRSTRLEN) == NULL)
-                               g_free(str);
-                       else
-                               list = g_list_append(list, str);
-               }
-               break;
-
-       case G_DHCPV6_IA_NA:            /* RFC 3315, chapter 22.4 */
-       case G_DHCPV6_IA_TA:            /* RFC 3315, chapter 22.5 */
-               list = get_addresses(dhcp_client, code, len, value, status);
-               break;
-
-       default:
-               break;
-       }
-
-       return list;
-}
-
-static void get_dhcpv6_request(GDHCPClient *dhcp_client,
-                               struct dhcpv6_packet *packet,
-                               uint16_t pkt_len, uint16_t *status)
-{
-       GList *list, *value_list;
-       uint8_t *option;
-       uint16_t code;
-       uint16_t option_len;
-
-       for (list = dhcp_client->request_list; list; list = list->next) {
-               code = (uint16_t) GPOINTER_TO_INT(list->data);
-
-               option = dhcpv6_get_option(packet, pkt_len, code, &option_len,
-                                               NULL);
-               if (option == NULL) {
-                       g_hash_table_remove(dhcp_client->code_value_hash,
-                                               GINT_TO_POINTER((int) code));
-                       continue;
-               }
-
-               value_list = get_dhcpv6_option_value_list(dhcp_client, code,
-                                               option_len, option, status);
-
-               debug(dhcp_client, "code %d %p len %d list %p", code, option,
-                       option_len, value_list);
-
-               if (value_list == NULL)
-                       g_hash_table_remove(dhcp_client->code_value_hash,
-                                               GINT_TO_POINTER((int) code));
-               else
-                       g_hash_table_insert(dhcp_client->code_value_hash,
-                               GINT_TO_POINTER((int) code), value_list);
-       }
-}
-
 static void get_request(GDHCPClient *dhcp_client, struct dhcp_packet *packet)
 {
        GDHCPOptionType type;
@@ -1819,14 +1137,7 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
 {
        GDHCPClient *dhcp_client = user_data;
        struct dhcp_packet packet;
-       struct dhcpv6_packet *packet6 = NULL;
-       uint8_t *message_type = NULL, *client_id = NULL, *option_u8,
-               *server_id = NULL;
-       uint16_t option_len = 0, status = 0;
-       gpointer pkt;
-       unsigned char buf[MAX_DHCPV6_PKT_SIZE];
-       uint16_t pkt_len = 0;
-       int count;
+       uint8_t *message_type, *option_u8;
        int re;
 
        if (condition & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
@@ -1837,22 +1148,12 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
        if (dhcp_client->listen_mode == L_NONE)
                return FALSE;
 
-       pkt = &packet;
-
        if (dhcp_client->listen_mode == L2)
-               re = dhcp_recv_l2_packet(&packet,
-                                       dhcp_client->listener_sockfd);
-       else if (dhcp_client->listen_mode == L3) {
-               if (dhcp_client->type == G_DHCP_IPV6) {
-                       re = dhcpv6_recv_l3_packet(&packet6, buf, sizeof(buf),
-                                               dhcp_client->listener_sockfd);
-                       pkt_len = re;
-                       pkt = packet6;
-               } else
-                       re = dhcp_recv_l3_packet(&packet,
-                                               dhcp_client->listener_sockfd);
-       } else if (dhcp_client->listen_mode == L_ARP) {
-               ipv4ll_recv_arp_packet(dhcp_client);
+               re = dhcp_recv_l2_packet(&packet, dhcp_client->listener_sockfd);
+       else if (dhcp_client->listen_mode == L3)
+               re = dhcp_recv_l3_packet(&packet, dhcp_client->listener_sockfd);
+       else if (dhcp_client->listen_mode == L_ARP) {
+               re = ipv4ll_recv_arp_packet(dhcp_client);
                return TRUE;
        }
        else
@@ -1861,50 +1162,12 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
        if (re < 0)
                return TRUE;
 
-       if (check_package_owner(dhcp_client, pkt) == FALSE)
+       if (check_package_owner(dhcp_client, &packet) == FALSE)
                return TRUE;
 
-       if (dhcp_client->type == G_DHCP_IPV6) {
-               count = 0;
-               client_id = dhcpv6_get_option(packet6, pkt_len,
-                               G_DHCPV6_CLIENTID, &option_len, &count);
-
-               if (client_id == NULL || count == 0 || option_len == 0 ||
-                               memcmp(dhcp_client->duid, client_id,
-                                       dhcp_client->duid_len) != 0) {
-                       debug(dhcp_client,
-                               "client duid error, discarding msg %p/%d/%d",
-                               client_id, option_len, count);
-                       return TRUE;
-               }
-
-               option_u8 = dhcpv6_get_option(packet6, pkt_len,
-                               G_DHCPV6_STATUS_CODE, &option_len, NULL);
-               if (option_u8 != 0 && option_len > 0) {
-                       status = option_u8[0]<<8 | option_u8[1];
-                       if (status != 0) {
-                               debug(dhcp_client, "error code %d", status);
-                               if (option_len > 2) {
-                                       gchar *txt = g_strndup(
-                                               (gchar *)&option_u8[2],
-                                               option_len - 2);
-                                       debug(dhcp_client, "error text: %s",
-                                               txt);
-                                       g_free(txt);
-                               }
-                       }
-                       dhcp_client->status_code = status;
-               } else
-                       dhcp_client->status_code = 0;
-
-       } else {
-               message_type = dhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
-               if (message_type == NULL)
-                       return TRUE;
-       }
-
-       if (message_type == NULL && client_id == NULL)
-               /* No message type / client id option, ignore package */
+       message_type = dhcp_get_option(&packet, DHCP_MESSAGE_TYPE);
+       if (message_type == NULL)
+               /* No message type option, ignore package */
                return TRUE;
 
        debug(dhcp_client, "received DHCP packet (current state %d)",
@@ -1940,6 +1203,9 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
                        dhcp_client->timeout = 0;
 
                        dhcp_client->lease_seconds = get_lease(&packet);
+#if defined TIZEN_EXT
+                       debug(dhcp_client, "lease %d secs", dhcp_client->lease_seconds);
+#endif
 
                        get_request(dhcp_client, &packet);
 
@@ -1960,6 +1226,9 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
                        if (dhcp_client->timeout > 0)
                                g_source_remove(dhcp_client->timeout);
 
+#if defined TIZEN_EXT
+                       g_dhcp_client_set_address_known(dhcp_client, FALSE);
+#endif
                        dhcp_client->timeout = g_timeout_add_seconds_full(
                                                        G_PRIORITY_HIGH, 3,
                                                        restart_dhcp_timeout,
@@ -1968,128 +1237,6 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
                }
 
                break;
-       case SOLICITATION:
-               if (dhcp_client->type != G_DHCP_IPV6)
-                       return TRUE;
-
-               if (packet6->message != DHCPV6_REPLY &&
-                               packet6->message != DHCPV6_ADVERTISE)
-                       return TRUE;
-
-               count = 0;
-               server_id = dhcpv6_get_option(packet6, pkt_len,
-                               G_DHCPV6_SERVERID, &option_len, &count);
-               if (server_id == NULL || count != 1 || option_len == 0) {
-                       /* RFC 3315, 15.10 */
-                       debug(dhcp_client,
-                               "server duid error, discarding msg %p/%d/%d",
-                               server_id, option_len, count);
-                       return TRUE;
-               }
-               dhcp_client->server_duid = g_try_malloc(option_len);
-               if (dhcp_client->server_duid == NULL)
-                       return TRUE;
-               memcpy(dhcp_client->server_duid, server_id, option_len);
-               dhcp_client->server_duid_len = option_len;
-
-               if (packet6->message == DHCPV6_REPLY) {
-                       uint8_t *rapid_commit;
-                       count = 0;
-                       option_len = 0;
-                       rapid_commit = dhcpv6_get_option(packet6, pkt_len,
-                                                       G_DHCPV6_RAPID_COMMIT,
-                                                       &option_len, &count);
-                       if (rapid_commit == NULL || option_len == 0 ||
-                                                               count != 1)
-                               /* RFC 3315, 17.1.4 */
-                               return TRUE;
-               }
-
-               switch_listening_mode(dhcp_client, L_NONE);
-
-               if (dhcp_client->status_code == 0)
-                       get_dhcpv6_request(dhcp_client, packet6, pkt_len,
-                                       &dhcp_client->status_code);
-
-               if (packet6->message == DHCPV6_ADVERTISE) {
-                       if (dhcp_client->advertise_cb != NULL)
-                               dhcp_client->advertise_cb(dhcp_client,
-                                               dhcp_client->advertise_data);
-                       return TRUE;
-               }
-
-               if (dhcp_client->solicitation_cb != NULL) {
-                       /*
-                        * The dhcp_client might not be valid after the
-                        * callback call so just return immediately.
-                        */
-                       dhcp_client->solicitation_cb(dhcp_client,
-                                       dhcp_client->solicitation_data);
-                       return TRUE;
-               }
-               break;
-       case INFORMATION_REQ:
-       case REQUEST:
-       case RENEW:
-       case REBIND:
-       case RELEASE:
-               if (dhcp_client->type != G_DHCP_IPV6)
-                       return TRUE;
-
-               if (packet6->message != DHCPV6_REPLY)
-                       return TRUE;
-
-               count = 0;
-               option_len = 0;
-               server_id = dhcpv6_get_option(packet6, pkt_len,
-                               G_DHCPV6_SERVERID, &option_len, &count);
-               if (server_id == NULL || count != 1 || option_len == 0 ||
-                               (dhcp_client->server_duid_len > 0 &&
-                               memcmp(dhcp_client->server_duid, server_id,
-                                       dhcp_client->server_duid_len) != 0)) {
-                       /* RFC 3315, 15.10 */
-                       debug(dhcp_client,
-                               "server duid error, discarding msg %p/%d/%d",
-                               server_id, option_len, count);
-                       return TRUE;
-               }
-
-               switch_listening_mode(dhcp_client, L_NONE);
-
-               dhcp_client->status_code = 0;
-               get_dhcpv6_request(dhcp_client, packet6, pkt_len,
-                                               &dhcp_client->status_code);
-
-               if (dhcp_client->information_req_cb != NULL) {
-                       /*
-                        * The dhcp_client might not be valid after the
-                        * callback call so just return immediately.
-                        */
-                       dhcp_client->information_req_cb(dhcp_client,
-                                       dhcp_client->information_req_data);
-                       return TRUE;
-               }
-               if (dhcp_client->request_cb != NULL) {
-                       dhcp_client->request_cb(dhcp_client,
-                                       dhcp_client->request_data);
-                       return TRUE;
-               }
-               if (dhcp_client->renew_cb != NULL) {
-                       dhcp_client->renew_cb(dhcp_client,
-                                       dhcp_client->renew_data);
-                       return TRUE;
-               }
-               if (dhcp_client->rebind_cb != NULL) {
-                       dhcp_client->rebind_cb(dhcp_client,
-                                       dhcp_client->rebind_data);
-                       return TRUE;
-               }
-               if (dhcp_client->release_cb != NULL) {
-                       dhcp_client->release_cb(dhcp_client,
-                                       dhcp_client->release_data);
-                       return TRUE;
-               }
-               break;
        default:
                break;
        }
@@ -2182,71 +1329,6 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
        int re;
        uint32_t addr;
 
-       if (dhcp_client->type == G_DHCP_IPV6) {
-               if (dhcp_client->information_req_cb) {
-                       dhcp_client->state = INFORMATION_REQ;
-                       re = switch_listening_mode(dhcp_client, L3);
-                       if (re != 0) {
-                               switch_listening_mode(dhcp_client, L_NONE);
-                               dhcp_client->state = 0;
-                               return re;
-                       }
-                       send_information_req(dhcp_client);
-
-               } else if (dhcp_client->solicitation_cb) {
-                       dhcp_client->state = SOLICITATION;
-                       re = switch_listening_mode(dhcp_client, L3);
-                       if (re != 0) {
-                               switch_listening_mode(dhcp_client, L_NONE);
-                               dhcp_client->state = 0;
-                               return re;
-                       }
-                       send_solicitation(dhcp_client);
-
-               } else if (dhcp_client->request_cb) {
-                       dhcp_client->state = REQUEST;
-                       re = switch_listening_mode(dhcp_client, L3);
-                       if (re != 0) {
-                               switch_listening_mode(dhcp_client, L_NONE);
-                               dhcp_client->state = 0;
-                               return re;
-                       }
-                       send_dhcpv6_request(dhcp_client);
-
-               } else if (dhcp_client->renew_cb) {
-                       dhcp_client->state = RENEW;
-                       re = switch_listening_mode(dhcp_client, L3);
-                       if (re != 0) {
-                               switch_listening_mode(dhcp_client, L_NONE);
-                               dhcp_client->state = 0;
-                               return re;
-                       }
-                       send_dhcpv6_renew(dhcp_client);
-
-               } else if (dhcp_client->rebind_cb) {
-                       dhcp_client->state = REBIND;
-                       re = switch_listening_mode(dhcp_client, L3);
-                       if (re != 0) {
-                               switch_listening_mode(dhcp_client, L_NONE);
-                               dhcp_client->state = 0;
-                               return re;
-                       }
-                       send_dhcpv6_rebind(dhcp_client);
-
-               } else if (dhcp_client->release_cb) {
-                       dhcp_client->state = RENEW;
-                       re = switch_listening_mode(dhcp_client, L3);
-                       if (re != 0) {
-                               switch_listening_mode(dhcp_client, L_NONE);
-                               dhcp_client->state = 0;
-                               return re;
-                       }
-                       send_dhcpv6_release(dhcp_client);
-               }
-
-               return 0;
-       }
-
        if (dhcp_client->retry_times == DISCOVER_RETRIES) {
                ipv4ll_start(dhcp_client);
                return 0;
@@ -2262,7 +1344,6 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
                        return re;
 
                dhcp_client->xid = rand();
-               dhcp_client->start = time(NULL);
        }
 
        if (last_address == NULL) {
@@ -2276,6 +1357,15 @@ int g_dhcp_client_start(GDHCPClient *dhcp_client, const char *last_address)
                        dhcp_client->last_address = g_strdup(last_address);
                }
        }
+#if defined TIZEN_EXT
+       if (dhcp_client->init_reboot == TRUE) {
+               dhcp_client->requested_ip = addr;
+
+               start_request(dhcp_client);
+
+               return 0;
+       }
+#endif
        send_discover(dhcp_client, addr);
 
        dhcp_client->timeout = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
@@ -2334,8 +1424,6 @@ void g_dhcp_client_register_event(GDHCPClient *dhcp_client,
                dhcp_client->lease_available_data = data;
                return;
        case G_DHCP_CLIENT_EVENT_IPV4LL_AVAILABLE:
-               if (dhcp_client->type == G_DHCP_IPV6)
-                       return;
                dhcp_client->ipv4ll_available_cb = func;
                dhcp_client->ipv4ll_available_data = data;
                return;
@@ -2348,8 +1436,6 @@ void g_dhcp_client_register_event(GDHCPClient *dhcp_client,
                dhcp_client->lease_lost_data = data;
                return;
        case G_DHCP_CLIENT_EVENT_IPV4LL_LOST:
-               if (dhcp_client->type == G_DHCP_IPV6)
-                       return;
                dhcp_client->ipv4ll_lost_cb = func;
                dhcp_client->ipv4ll_lost_data = data;
                return;
@@ -2357,48 +1443,6 @@ void g_dhcp_client_register_event(GDHCPClient *dhcp_client,
                dhcp_client->address_conflict_cb = func;
                dhcp_client->address_conflict_data = data;
                return;
-       case G_DHCP_CLIENT_EVENT_INFORMATION_REQ:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->information_req_cb = func;
-               dhcp_client->information_req_data = data;
-               return;
-       case G_DHCP_CLIENT_EVENT_SOLICITATION:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->solicitation_cb = func;
-               dhcp_client->solicitation_data = data;
-               return;
-       case G_DHCP_CLIENT_EVENT_ADVERTISE:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->advertise_cb = func;
-               dhcp_client->advertise_data = data;
-               return;
-       case G_DHCP_CLIENT_EVENT_REQUEST:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->request_cb = func;
-               dhcp_client->request_data = data;
-               return;
-       case G_DHCP_CLIENT_EVENT_RENEW:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->renew_cb = func;
-               dhcp_client->renew_data = data;
-               return;
-       case G_DHCP_CLIENT_EVENT_REBIND:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->rebind_cb = func;
-               dhcp_client->rebind_data = data;
-               return;
-       case G_DHCP_CLIENT_EVENT_RELEASE:
-               if (dhcp_client->type == G_DHCP_IPV4)
-                       return;
-               dhcp_client->release_cb = func;
-               dhcp_client->release_data = data;
-               return;
        }
 }
 
@@ -2416,9 +1460,6 @@ char *g_dhcp_client_get_netmask(GDHCPClient *dhcp_client)
 {
        GList *option = NULL;
 
-       if (dhcp_client->type == G_DHCP_IPV6)
-               return NULL;
-
        switch (dhcp_client->state) {
        case IPV4LL_DEFEND:
        case IPV4LL_MONITOR:
@@ -2434,19 +1475,13 @@ char *g_dhcp_client_get_netmask(GDHCPClient *dhcp_client)
        case RELEASED:
        case IPV4LL_PROBE:
        case IPV4LL_ANNOUNCE:
-       case INFORMATION_REQ:
-       case SOLICITATION:
-       case REQUEST:
-       case RENEW:
-       case REBIND:
-       case RELEASE:
                break;
        }
        return NULL;
 }
 
 GDHCPClientError g_dhcp_client_set_request(GDHCPClient *dhcp_client,
-                                               unsigned int option_code)
+                                               unsigned char option_code)
 {
        if (g_list_find(dhcp_client->request_list,
                        GINT_TO_POINTER((int) option_code)) == NULL)
@@ -2457,64 +1492,19 @@ GDHCPClientError g_dhcp_client_set_request(GDHCPClient *dhcp_client,
        return G_DHCP_CLIENT_ERROR_NONE;
 }
 
-void g_dhcp_client_clear_requests(GDHCPClient *dhcp_client)
-{
-       g_list_free(dhcp_client->request_list);
-       dhcp_client->request_list = NULL;
-}
-
-void g_dhcp_client_clear_values(GDHCPClient *dhcp_client)
-{
-       g_hash_table_remove_all(dhcp_client->send_value_hash);
-}
-
-static uint8_t *alloc_dhcp_option(int code, const uint8_t *data, unsigned size)
+static uint8_t *alloc_dhcp_option(int code, const char *str, int extra)
 {
        uint8_t *storage;
+       int len = strnlen(str, 255);
 
-       storage = g_try_malloc(size + OPT_DATA);
-       if (storage == NULL)
-               return NULL;
-
+       storage = malloc(len + extra + OPT_DATA);
        storage[OPT_CODE] = code;
-       storage[OPT_LEN] = size;
-       memcpy(&storage[OPT_DATA], data, size);
+       storage[OPT_LEN] = len + extra;
+       memcpy(storage + extra + OPT_DATA, str, len);
 
        return storage;
 }
 
-static uint8_t *alloc_dhcp_data_option(int code, const uint8_t *data, unsigned size)
-{
-       return alloc_dhcp_option(code, data, MIN(size, 255));
-}
-
-static uint8_t *alloc_dhcp_string_option(int code, const char *str)
-{
-       return alloc_dhcp_data_option(code, (const uint8_t *)str, strlen(str));
-}
-
-GDHCPClientError g_dhcp_client_set_id(GDHCPClient *dhcp_client)
-{
-       const unsigned maclen = 6;
-       const unsigned idlen = maclen + 1;
-       const uint8_t option_code = G_DHCP_CLIENT_ID;
-       uint8_t idbuf[idlen];
-       uint8_t *data_option;
-
-       idbuf[0] = ARPHRD_ETHER;
-
-       memcpy(&idbuf[1], dhcp_client->mac_address, maclen);
-
-       data_option = alloc_dhcp_data_option(option_code, idbuf, idlen);
-       if (data_option == NULL)
-               return G_DHCP_CLIENT_ERROR_NOMEM;
-
-       g_hash_table_insert(dhcp_client->send_value_hash,
-               GINT_TO_POINTER((int) option_code), data_option);
-
-       return G_DHCP_CLIENT_ERROR_NONE;
-}
-
 /* Now only support send hostname */
 GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
                unsigned char option_code, const char *option_value)
@@ -2522,10 +1512,8 @@ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
        uint8_t *binary_option;
 
        if (option_code == G_DHCP_HOST_NAME && option_value != NULL) {
-               binary_option = alloc_dhcp_string_option(option_code,
-                                                       option_value);
-               if (binary_option == NULL)
-                       return G_DHCP_CLIENT_ERROR_NOMEM;
+               binary_option = alloc_dhcp_option(option_code,
+                                                       option_value, 0);
 
                g_hash_table_insert(dhcp_client->send_value_hash,
                        GINT_TO_POINTER((int) option_code), binary_option);
@@ -2534,76 +1522,6 @@ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
        return G_DHCP_CLIENT_ERROR_NONE;
 }
 
-static uint8_t *alloc_dhcpv6_option(uint16_t code, uint8_t *option,
-                               uint16_t len)
-{
-       uint8_t *storage;
-
-       storage = g_malloc(2 + 2 + len);
-       if (storage == NULL)
-               return NULL;
-
-       storage[0] = code >> 8;
-       storage[1] = code & 0xff;
-       storage[2] = len >> 8;
-       storage[3] = len & 0xff;
-       memcpy(storage + 2 + 2, option, len);
-
-       return storage;
-}
-
-void g_dhcpv6_client_set_send(GDHCPClient *dhcp_client,
-                                       uint16_t option_code,
-                                       uint8_t *option_value,
-                                       uint16_t option_len)
-{
-       if (option_value != NULL) {
-               uint8_t *binary_option;
-
-               debug(dhcp_client, "setting option %d to %p len %d",
-                       option_code, option_value, option_len);
-
-               binary_option = alloc_dhcpv6_option(option_code, option_value,
-                                               option_len);
-               if (binary_option != NULL)
-                       g_hash_table_insert(dhcp_client->send_value_hash,
-                                       GINT_TO_POINTER((int) option_code),
-                                       binary_option);
-       }
-}
-
-void g_dhcpv6_client_reset_renew(GDHCPClient *dhcp_client)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return;
-
-       dhcp_client->last_renew = time(NULL);
-}
-
-void g_dhcpv6_client_reset_rebind(GDHCPClient *dhcp_client)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return;
-
-       dhcp_client->last_rebind = time(NULL);
-}
-
-void g_dhcpv6_client_set_expire(GDHCPClient *dhcp_client, uint32_t timeout)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return;
-
-       dhcp_client->expire = time(NULL) + timeout;
-}
-
-uint16_t g_dhcpv6_client_get_status(GDHCPClient *dhcp_client)
-{
-       if (dhcp_client == NULL || dhcp_client->type == G_DHCP_IPV4)
-               return 0;
-
-       return dhcp_client->status_code;
-}
-
 GDHCPClient *g_dhcp_client_ref(GDHCPClient *dhcp_client)
 {
        if (dhcp_client == NULL)
@@ -2627,8 +1545,6 @@ void g_dhcp_client_unref(GDHCPClient *dhcp_client)
        g_free(dhcp_client->interface);
        g_free(dhcp_client->assigned_ip);
        g_free(dhcp_client->last_address);
-       g_free(dhcp_client->duid);
-       g_free(dhcp_client->server_duid);
 
        g_list_free(dhcp_client->request_list);
        g_list_free(dhcp_client->require_list);
@@ -2648,3 +1564,19 @@ void g_dhcp_client_set_debug(GDHCPClient *dhcp_client,
        dhcp_client->debug_func = func;
        dhcp_client->debug_data = user_data;
 }
+
+#if defined TIZEN_EXT
+void g_dhcp_client_set_address_known(GDHCPClient *dhcp_client, gboolean known)
+{
+       /* DHCPREQUEST during INIT-REBOOT state (rfc2131)
+        * 4.4.3 Initialization with known network address
+        * 4.3.2 DHCPREQUEST generated during INIT-REBOOT state
+        */
+       debug(dhcp_client, "known network address (%d)", known);
+
+       if (dhcp_client->init_reboot == known)
+               return;
+
+       dhcp_client->init_reboot = known;
+}
+#endif