X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=blobdiff_plain;f=src%2Fdhcpv6.c;h=eab9cbfa8565a785b688145c9b594683fdb6b799;hp=973ca8f03502a8830158316a063ae73ff221683f;hb=dc30922e418be6271ad177f3f9d4ecf0c1eb3f01;hpb=b146f9adc80cc2c2cdf2b04bfeec4c861a2a0e23 diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 973ca8f..eab9cbf 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -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};