summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/include/ap_session.h8
-rw-r--r--accel-pppd/include/ipv6_dns.h12
-rw-r--r--accel-pppd/ipv6/ipv6_dns_test.c7
-rw-r--r--accel-pppd/radius/radius.c11
-rw-r--r--accel-pppd/radius/radius_p.h3
5 files changed, 24 insertions, 17 deletions
diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h
index a0733986..3bc8360b 100644
--- a/accel-pppd/include/ap_session.h
+++ b/accel-pppd/include/ap_session.h
@@ -41,6 +41,7 @@
struct ap_session;
struct backup_data;
struct rtnl_link_stats;
+struct ipv6_dns_t;
struct ap_ctrl {
struct triton_context_t *ctx;
@@ -87,10 +88,9 @@ struct ap_session
struct ipv6db_prefix_t *ipv6_dp;
/* Per session IPv6 DNS servers, NULL when none were assigned and the
globally configured ones ([ipv6-dns]) should be advertised instead.
- Only addr_list, and only the addr member of its entries, is
- meaningful here. Owned by whoever sets it, currently the radius
- module from the DNS-Server-IPv6-Address attribute (RFC 6911) */
- struct ipv6db_item_t *ipv6_dns;
+ Owned by whoever sets it, currently the radius module from the
+ DNS-Server-IPv6-Address attribute (RFC 6911) */
+ struct ipv6_dns_t *ipv6_dns;
char *ipv4_pool_name;
char *ipv6_pool_name;
char *dpv6_pool_name;
diff --git a/accel-pppd/include/ipv6_dns.h b/accel-pppd/include/ipv6_dns.h
index b604d006..b1d74708 100644
--- a/accel-pppd/include/ipv6_dns.h
+++ b/accel-pppd/include/ipv6_dns.h
@@ -4,9 +4,17 @@
#include <netinet/in.h>
#include "list.h"
-#include "ipdb.h"
#include "ap_session.h"
+struct ipv6_dns_addr_t {
+ struct list_head entry;
+ struct in6_addr addr;
+};
+
+struct ipv6_dns_t {
+ struct list_head addr_list;
+};
+
/*
* Pick the IPv6 DNS servers to advertise to a session.
*
@@ -22,7 +30,7 @@ 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)
{
- struct ipv6db_addr_t *a;
+ struct ipv6_dns_addr_t *a;
int count = 0;
if (ses && ses->ipv6_dns) {
diff --git a/accel-pppd/ipv6/ipv6_dns_test.c b/accel-pppd/ipv6/ipv6_dns_test.c
index 72b4751c..9452e5a1 100644
--- a/accel-pppd/ipv6/ipv6_dns_test.c
+++ b/accel-pppd/ipv6/ipv6_dns_test.c
@@ -44,15 +44,14 @@ static int is(const struct in6_addr *addr, const char *str)
static struct ap_session *session_with(const char **str, int count)
{
struct ap_session *ses = calloc(1, sizeof(*ses));
- struct ipv6db_item_t *item = calloc(1, sizeof(*item));
+ struct ipv6_dns_t *item = calloc(1, sizeof(*item));
int i;
INIT_LIST_HEAD(&item->addr_list);
for (i = 0; i < count; i++) {
- struct ipv6db_addr_t *a = calloc(1, sizeof(*a));
+ struct ipv6_dns_addr_t *a = calloc(1, sizeof(*a));
a->addr = a6(str[i]);
- a->prefix_len = 128;
list_add_tail(&a->entry, &item->addr_list);
}
@@ -65,7 +64,7 @@ static void session_free(struct ap_session *ses)
{
if (ses->ipv6_dns) {
while (!list_empty(&ses->ipv6_dns->addr_list)) {
- struct ipv6db_addr_t *a = list_entry(ses->ipv6_dns->addr_list.next,
+ struct ipv6_dns_addr_t *a = list_entry(ses->ipv6_dns->addr_list.next,
typeof(*a), entry);
list_del(&a->entry);
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 89f1e398..544be09f 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -497,7 +497,7 @@ err:
static void free_ipv6_dns(struct radius_pd_t *rpd)
{
- struct ipv6db_addr_t *a;
+ struct ipv6_dns_addr_t *a;
while (!list_empty(&rpd->ipv6_dns.addr_list)) {
a = list_entry(rpd->ipv6_dns.addr_list.next, typeof(*a), entry);
@@ -512,6 +512,7 @@ int rad_proc_attrs(struct rad_req_t *req)
struct ev_dns_t dns = {};
struct rad_attr_t *attr;
struct ipv6db_addr_t *a;
+ struct ipv6_dns_addr_t *dns6;
int dns6_count = -1;
int res = 0;
struct radius_pd_t *rpd = req->rpd;
@@ -643,11 +644,9 @@ int rad_proc_attrs(struct rad_req_t *req)
dns6_count++;
break;
}
- a = _malloc(sizeof(*a));
- memset(a, 0, sizeof(*a));
- a->prefix_len = 128;
- a->addr = attr->val.ipv6addr;
- list_add_tail(&a->entry, &rpd->ipv6_dns.addr_list);
+ dns6 = _malloc(sizeof(*dns6));
+ dns6->addr = attr->val.ipv6addr;
+ list_add_tail(&dns6->entry, &rpd->ipv6_dns.addr_list);
dns6_count++;
break;
case NAS_Port:
diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h
index e4b84740..354d54fc 100644
--- a/accel-pppd/radius/radius_p.h
+++ b/accel-pppd/radius/radius_p.h
@@ -9,6 +9,7 @@
#include "radius.h"
#include "ppp.h"
#include "ipdb.h"
+#include "ipv6_dns.h"
#include "pwdb.h"
struct rad_server_t;
@@ -65,7 +66,7 @@ struct radius_pd_t {
struct ipv4db_item_t ipv4_addr;
struct ipv6db_item_t ipv6_addr;
struct ipv6db_prefix_t ipv6_dp;
- struct ipv6db_item_t ipv6_dns;
+ struct ipv6_dns_t ipv6_dns;
int acct_interim_interval;
int acct_interim_jitter;