+ struct {
+ uint16_t type;
+ uint16_t len;
+ } dhcpv6_sntp;
+
+ /* NTP */
+ uint8_t *ntp_ptr = iface->dhcpv6_ntp;
+ uint16_t ntp_len = iface->dhcpv6_ntp_len;
+ size_t ntp_cnt = 0;
+
+ struct {
+ uint16_t type;
+ uint16_t len;
+ } ntp;
+
+ uint16_t otype, olen;
+ uint16_t *reqopts = NULL;
+ uint8_t *odata;
+ size_t reqopts_len = 0;
+
+ dhcpv6_for_each_option(opts, opts_end, otype, olen, odata) {
+ if (otype == DHCPV6_OPT_ORO) {
+ reqopts_len = olen;
+ reqopts = (uint16_t *)odata;
+ }
+ }
+
+ for(size_t opt = 0; opt < reqopts_len/2; opt++) {
+ if (iface->dhcpv6_sntp_cnt != 0 &&
+ DHCPV6_OPT_SNTP_SERVERS == ntohs(reqopts[opt])) {
+ sntp_cnt = iface->dhcpv6_sntp_cnt;
+ dhcpv6_sntp.type = htons(DHCPV6_OPT_SNTP_SERVERS);
+ dhcpv6_sntp.len = htons(sntp_cnt * sizeof(*sntp_addr_ptr));
+ } else if (iface->dhcpv6_ntp_cnt != 0 &&
+ DHCPV6_OPT_NTP_SERVERS == ntohs(reqopts[opt])) {
+ ntp_cnt = iface->dhcpv6_ntp_cnt;
+ ntp.type = htons(DHCPV6_OPT_NTP_SERVERS);
+ ntp.len = htons(ntp_len);
+ }
+ }