- // // Length of payload (not header)
- p_ip6_hdr->ip6_plen = htons(sizeof(*pinfo) + sizeof(*p_nra));
+ // Length of payload (not header)
+ l = sizeof(*pinfo) + sizeof(*p_nra);
+
+ if (config->default_ipv6_dns1.s6_addr32[0])
+ {
+ struct in6_addr *ptr_in6_addr;
+ p_rdnss = (struct nd_opt_rdnss_info_l2tpns *) &pinfo[1];
+
+ p_rdnss->nd_opt_rdnssi_type = 25; //RDNSS OPTION INFORMATION;
+ p_rdnss->nd_opt_rdnssi_len = 3; // 1 + 2 * nb DNS
+ p_rdnss->nd_opt_rdnssi_lifetime = htonl(config->dns6_lifetime);
+ ptr_in6_addr = &p_rdnss->nd_opt_rdnssi[0];
+ memcpy(ptr_in6_addr, &config->default_ipv6_dns1, sizeof(*ptr_in6_addr));
+
+ l += sizeof(*p_rdnss) + sizeof(*ptr_in6_addr);
+ if (config->default_ipv6_dns2.s6_addr32[0])
+ {
+ ptr_in6_addr = &p_rdnss->nd_opt_rdnssi[1];
+ memcpy(ptr_in6_addr, &config->default_ipv6_dns2, sizeof(*ptr_in6_addr));
+ p_rdnss->nd_opt_rdnssi_len += 2; // 1 + 2 * nb DNS
+ l += sizeof(*ptr_in6_addr);
+ }
+ }