diff options
-rw-r--r-- | accel-pppd/radius/attr_defs.h | 1 | ||||
-rw-r--r-- | accel-pppd/radius/dict/dictionary | 1 | ||||
-rw-r--r-- | accel-pppd/radius/radius.c | 28 | ||||
-rw-r--r-- | accel-pppd/radius/radius_p.h | 1 |
4 files changed, 31 insertions, 0 deletions
diff --git a/accel-pppd/radius/attr_defs.h b/accel-pppd/radius/attr_defs.h index 779229e7..eb3c5de8 100644 --- a/accel-pppd/radius/attr_defs.h +++ b/accel-pppd/radius/attr_defs.h @@ -291,3 +291,4 @@ #define Login_IPv6_Host 98 #define Framed_IPv6_Route 99 #define Framed_IPv6_Pool 100 +#define Delegated_IPv6_Prefix 123 diff --git a/accel-pppd/radius/dict/dictionary b/accel-pppd/radius/dict/dictionary index 02eb7dea..15d7e15d 100644 --- a/accel-pppd/radius/dict/dictionary +++ b/accel-pppd/radius/dict/dictionary @@ -72,6 +72,7 @@ $INCLUDE dictionary.rfc3580 $INCLUDE dictionary.rfc4072 $INCLUDE dictionary.rfc4372 $INCLUDE dictionary.rfc4679 +$INCLUDE dictionary.rfc4818 $INCLUDE dictionary.rfc5176 $INCLUDE dictionary.microsoft diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index 94f6447d..2a70327a 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -130,6 +130,12 @@ int rad_proc_attrs(struct rad_req_t *req) a->addr = attr->val.ipv6prefix.prefix; list_add_tail(&a->entry, &req->rpd->ipv6_addr.addr_list); break; + case Delegated_IPv6_Prefix: + a = _malloc(sizeof(*a)); + a->prefix_len = attr->val.ipv6prefix.len; + a->addr = attr->val.ipv6prefix.prefix; + list_add_tail(&a->entry, &req->rpd->ipv6_dp.prefix_list); + break; } } @@ -195,6 +201,19 @@ static struct ipv6db_item_t *get_ipv6(struct ppp_t *ppp) return NULL; } +static struct ipv6db_prefix_t *get_ipv6_prefix(struct ppp_t *ppp) +{ + struct radius_pd_t *rpd = find_pd(ppp); + + rpd->ipv6_dp.owner = &ipdb; + + if (!list_empty(&rpd->ipv6_dp.prefix_list)) + return &rpd->ipv6_dp; + + return NULL; +} + + static void session_timeout(struct triton_timer_t *t) { @@ -221,6 +240,8 @@ static void ppp_starting(struct ppp_t *ppp) pthread_mutex_init(&rpd->lock, NULL); INIT_LIST_HEAD(&rpd->plugin_list); INIT_LIST_HEAD(&rpd->ipv6_addr.addr_list); + INIT_LIST_HEAD(&rpd->ipv6_dp.prefix_list); + list_add_tail(&rpd->pd.entry, &ppp->pd_list); pthread_rwlock_wrlock(&sessions_lock); @@ -289,6 +310,12 @@ static void ppp_finished(struct ppp_t *ppp) _free(a); } + while (!list_empty(&rpd->ipv6_dp.prefix_list)) { + a = list_entry(rpd->ipv6_dp.prefix_list.next, typeof(*a), entry); + list_del(&a->entry); + _free(a); + } + list_del(&rpd->pd.entry); mempool_free(rpd); @@ -436,6 +463,7 @@ void __export rad_register_plugin(struct ppp_t *ppp, struct rad_plugin_t *plugin static struct ipdb_t ipdb = { .get_ipv4 = get_ipv4, .get_ipv6 = get_ipv6, + .get_ipv6_prefix = get_ipv6_prefix, }; static struct pwdb_t pwdb = { diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h index f3f28e27..0a6261ee 100644 --- a/accel-pppd/radius/radius_p.h +++ b/accel-pppd/radius/radius_p.h @@ -35,6 +35,7 @@ struct radius_pd_t struct ipv4db_item_t ipv4_addr; struct ipv6db_item_t ipv6_addr; + struct ipv6db_prefix_t ipv6_dp; int acct_interim_interval; time_t acct_timestamp; |