#include <config.h>
#endif
+#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
static int send_select(GDHCPClient *dhcp_client)
{
struct dhcp_packet packet;
- struct in_addr addr;
debug(dhcp_client, "sending DHCP select request");
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);
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)
{