summaryrefslogtreecommitdiff
path: root/accel-pppd/include
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-08-27 09:16:31 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-10-06 02:19:48 +0300
commit2823a07df0c88e9d98472b9248f2e9c3179f6920 (patch)
tree4dca27724df4224c23fde20ac7ae4502879f5dad /accel-pppd/include
parentd8084108cc750962dafcd3716f5d243de2e56418 (diff)
downloadaccel-ppp-2823a07df0c88e9d98472b9248f2e9c3179f6920.tar.gz
accel-ppp-2823a07df0c88e9d98472b9248f2e9c3179f6920.zip
ipv6: remove obsolete three-server DNS limit
The legacy limit matches RFC 6106's recommendation that hosts treat three learned RDNSS addresses as sufficient. That was host-side repository guidance, not a limit in the RADIUS, DHCPv6, or RDNSS encodings. RFC 8106 obsoletes RFC 6106 and explicitly removes the recommendation to limit learned RDNSS addresses to three, leaving the number to local policy. It instead recommends the ability to store at least three addresses when DNS information comes from multiple sources. Store both configured and per-session servers in reusable contiguous arrays. Start with a four-address, 64-byte allocation, grow geometrically, retain capacity across reload or reauthorization, and free session storage only at teardown. Bound advertised lists by actual DHCPv6 and router-advertisement packet space. Warn when servers have to be dropped for lack of room, as the fixed limit used to, skip the DNS search list rather than write it past the end of a full advertisement, and drop the stale three-server wording from the [ipv6-dns] documentation. Link: https://github.com/accel-ppp/accel-ppp/commit/4f562467dbdf819395e138617c2a057e02595b9e#r197212083 Link: https://www.rfc-editor.org/rfc/rfc6106.html#section-5.3.1 Link: https://www.rfc-editor.org/rfc/rfc8106.html#section-5.3.1 Link: https://www.rfc-editor.org/rfc/rfc8106.html#appendix-A
Diffstat (limited to 'accel-pppd/include')
-rw-r--r--accel-pppd/include/ipv6_dns.h46
1 files changed, 16 insertions, 30 deletions
diff --git a/accel-pppd/include/ipv6_dns.h b/accel-pppd/include/ipv6_dns.h
index b1d74708..e82812ce 100644
--- a/accel-pppd/include/ipv6_dns.h
+++ b/accel-pppd/include/ipv6_dns.h
@@ -3,18 +3,18 @@
#include <netinet/in.h>
-#include "list.h"
#include "ap_session.h"
-struct ipv6_dns_addr_t {
- struct list_head entry;
- struct in6_addr addr;
-};
+#define IPV6_DNS_INITIAL_CAPACITY 4
struct ipv6_dns_t {
- struct list_head addr_list;
+ struct in6_addr *addr;
+ unsigned int count;
+ unsigned int capacity;
};
+int ipv6_dns_reserve(struct ipv6_dns_t *dns, unsigned int count);
+
/*
* Pick the IPv6 DNS servers to advertise to a session.
*
@@ -23,34 +23,20 @@ struct ipv6_dns_t {
* precedence. Sessions without any fall back to the globally configured ones,
* which is what every session got before per session servers existed.
*
- * Up to 'max' addresses are written to 'dns', the number written is returned.
- * Callers advertise nothing when that is 0.
+ * The selected array is returned and its length is written to 'count'.
+ * Callers advertise nothing when the returned count is 0.
*/
-static inline int ipv6_dns_get(const struct ap_session *ses,
- const struct in6_addr *conf_dns, int conf_dns_count,
- struct in6_addr *dns, int max)
+static inline const struct in6_addr *ipv6_dns_get(const struct ap_session *ses,
+ const struct in6_addr *conf_dns,
+ int conf_dns_count, int *count)
{
- struct ipv6_dns_addr_t *a;
- int count = 0;
-
- if (ses && ses->ipv6_dns) {
- list_for_each_entry(a, &ses->ipv6_dns->addr_list, entry) {
- if (count == max)
- break;
- dns[count++] = a->addr;
- }
-
- /* An empty list means "nothing assigned", not "no DNS at all" */
- if (count)
- return count;
- }
-
- while (count < conf_dns_count && count < max) {
- dns[count] = conf_dns[count];
- count++;
+ if (ses && ses->ipv6_dns && ses->ipv6_dns->count) {
+ *count = ses->ipv6_dns->count;
+ return ses->ipv6_dns->addr;
}
- return count;
+ *count = conf_dns_count;
+ return conf_dns;
}
#endif