]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/dhcpv6.c
allow disabling "client fqdn" and "accept reconfiguration" options
[odhcp6c.git] / src / dhcpv6.c
index 973ca8f03502a8830158316a063ae73ff221683f..eab9cbfa8565a785b688145c9b594683fdb6b799 100644 (file)
@@ -105,8 +105,13 @@ static bool accept_reconfig = false;
 // Reconfigure key
 static uint8_t reconf_key[16];
 
-int init_dhcpv6(const char *ifname, bool strict_options, int sol_timeout)
+// client options
+static unsigned int client_options = 0;
+
+
+int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout)
 {
+       client_options = options;
        dhcpv6_retx[DHCPV6_MSG_SOLICIT].max_timeo = sol_timeout;
 
        sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP);
@@ -156,7 +161,7 @@ int init_dhcpv6(const char *ifname, bool strict_options, int sol_timeout)
        }
 
        // Create ORO
-       if (!strict_options) {
+       if (!(client_options & DHCPV6_STRICT_OPTIONS)) {
                uint16_t oro[] = {
                        htons(DHCPV6_OPT_SIP_SERVER_D),
                        htons(DHCPV6_OPT_SIP_SERVER_A),
@@ -413,6 +418,12 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
        if (na_mode == IA_MODE_NONE)
                iov[7].iov_len = 0;
 
+       if (!(client_options & DHCPV6_ACCEPT_RECONFIGURE))
+               iov[5].iov_len = 0;
+
+       if (!(client_options & DHCPV6_CLIENT_FQDN))
+               iov[6].iov_len = 0;
+
        struct sockaddr_in6 srv = {AF_INET6, htons(DHCPV6_SERVER_PORT),
                0, ALL_DHCPV6_RELAYS, ifindex};
        struct msghdr msg = {&srv, sizeof(srv), iov, cnt, NULL, 0, 0};