summaryrefslogtreecommitdiff
path: root/gdhcp
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-01-05 09:42:08 (GMT)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-01-05 10:52:48 (GMT)
commit19e8effd134678d9467e328090717b10cef0c208 (patch)
tree96a85b0b17beef535d9c0efd8ad7e793e2cf686c /gdhcp
parentf13255cfe3c98ce4e7598f9bda03b4dc0ac837a1 (diff)
downloadconnman-19e8effd134678d9467e328090717b10cef0c208.zip
connman-19e8effd134678d9467e328090717b10cef0c208.tar.gz
connman-19e8effd134678d9467e328090717b10cef0c208.tar.bz2
dhcpv6: Support stateless DHCPv6
See relevant parts from these RFCs: RFC 3315 - DHCP for IPv6 RFC 3646 - DNS configuration options for DHCP for IPv6 RFC 3736 - Stateless DHCP service for IPv6 RFC 4075 - SNTP configuration option for DHCPv6 The patch does not support authenticated information messages.
Diffstat (limited to 'gdhcp')
-rw-r--r--gdhcp/client.c34
-rw-r--r--gdhcp/gdhcp.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index be8905c..32ed4aa 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -254,6 +254,15 @@ static void add_dhcpv6_request_options(GDHCPClient *dhcp_client,
(*ptr_buf) += len;
break;
+ case G_DHCPV6_ORO:
+ break;
+
+ case G_DHCPV6_DNS_SERVERS:
+ break;
+
+ case G_DHCPV6_SNTP_SERVERS:
+ break;
+
default:
break;
}
@@ -1335,8 +1344,33 @@ static GList *get_dhcpv6_option_value_list(GDHCPClient *dhcp_client,
unsigned char *value)
{
GList *list = NULL;
+ char *str;
+ int i;
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;
+
default:
break;
}
diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h
index 5c0e2ee..c0385d4 100644
--- a/gdhcp/gdhcp.h
+++ b/gdhcp/gdhcp.h
@@ -73,6 +73,8 @@ typedef enum {
#define G_DHCPV6_SERVERID 2
#define G_DHCPV6_ORO 6
#define G_DHCPV6_STATUS_CODE 13
+#define G_DHCPV6_DNS_SERVERS 23
+#define G_DHCPV6_SNTP_SERVERS 31
typedef enum {
G_DHCPV6_DUID_LLT = 1,