gdhcp: Remove unused variable
[framework/connectivity/connman.git] / gdhcp / client.c
index 3508b1e..4a873bf 100644 (file)
@@ -23,6 +23,7 @@
 #include <config.h>
 #endif
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
@@ -201,7 +202,6 @@ static int send_discover(GDHCPClient *dhcp_client, uint32_t requested)
 static int send_select(GDHCPClient *dhcp_client)
 {
        struct dhcp_packet packet;
-       struct in_addr addr;
 
        debug(dhcp_client, "sending DHCP select request");
 
@@ -217,8 +217,6 @@ static int send_select(GDHCPClient *dhcp_client)
 
        add_send_options(dhcp_client, &packet);
 
-       addr.s_addr = dhcp_client->requested_ip;
-
        return dhcp_send_raw_packet(&packet, INADDR_ANY, CLIENT_PORT,
                                        INADDR_BROADCAST, SERVER_PORT,
                                        MAC_BCAST_ADDR, dhcp_client->ifindex);
@@ -1413,6 +1411,30 @@ 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) {
+       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 g_strdup(option->data);
+       case INIT_SELECTING:
+       case REQUESTING:
+       case RELEASED:
+       case IPV4LL_PROBE:
+       case IPV4LL_ANNOUNCE:
+               break;
+       }
+       return NULL;
+}
+
 GDHCPClientError g_dhcp_client_set_request(GDHCPClient *dhcp_client,
                                                unsigned char option_code)
 {