diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-08-20 10:05:23 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-08-20 10:05:23 +0400 |
commit | a93e43804c9a37b3cc2141d5ada3158653a7a221 (patch) | |
tree | 96e51396d3d7cd2c2ba69d274faa7a9760df457e /accel-pppd/radius | |
parent | 5ef49162ea9763ca9878c22e3736766d8f1db014 (diff) | |
parent | ef1d4c04584076dc77fc8df62c996feb1ac10c41 (diff) | |
download | accel-ppp-a93e43804c9a37b3cc2141d5ada3158653a7a221.tar.gz accel-ppp-a93e43804c9a37b3cc2141d5ada3158653a7a221.zip |
Merge branch 'ipv6'
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r-- | accel-pppd/radius/radius.c | 25 | ||||
-rw-r--r-- | accel-pppd/radius/radius_p.h | 3 |
2 files changed, 20 insertions, 8 deletions
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index 0fc42cd1..5f507cb4 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -90,9 +90,9 @@ int rad_proc_attrs(struct rad_req_t *req) if (!conf_gw_ip_address) log_ppp_warn("radius: gw-ip-address not specified, cann't assign IP address...\n"); else { - req->rpd->ipaddr.owner = &ipdb; - req->rpd->ipaddr.peer_addr = attr->val.ipaddr; - req->rpd->ipaddr.addr = conf_gw_ip_address; + req->rpd->ipv4_addr.owner = &ipdb; + req->rpd->ipv4_addr.peer_addr = attr->val.ipaddr; + req->rpd->ipv4_addr.addr = conf_gw_ip_address; } break; case Acct_Interim_Interval: @@ -163,15 +163,25 @@ static int check(struct pwdb_t *pwdb, struct ppp_t *ppp, const char *username, i return r; } -static struct ipdb_item_t *get_ip(struct ppp_t *ppp) +static struct ipv4db_item_t *get_ipv4(struct ppp_t *ppp) { struct radius_pd_t *rpd = find_pd(ppp); - if (rpd->ipaddr.peer_addr) - return &rpd->ipaddr; + if (rpd->ipv4_addr.peer_addr) + return &rpd->ipv4_addr; return NULL; } +static struct ipv6db_item_t *get_ipv6(struct ppp_t *ppp) +{ + struct radius_pd_t *rpd = find_pd(ppp); + + if (memcmp(&rpd->ipv6_addr.peer_addr, &in6addr_any, sizeof(in6addr_any))) + return &rpd->ipv6_addr; + return NULL; +} + + static void session_timeout(struct triton_timer_t *t) { struct radius_pd_t *rpd = container_of(t, typeof(*rpd), session_timeout); @@ -402,7 +412,8 @@ void __export rad_register_plugin(struct ppp_t *ppp, struct rad_plugin_t *plugin } static struct ipdb_t ipdb = { - .get = get_ip, + .get_ipv4 = get_ipv4, + .get_ipv6 = get_ipv6, }; static struct pwdb_t pwdb = { diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h index 8c3a10d5..578c7770 100644 --- a/accel-pppd/radius/radius_p.h +++ b/accel-pppd/radius/radius_p.h @@ -33,7 +33,8 @@ struct radius_pd_t struct rad_packet_t *dm_coa_req; struct sockaddr_in dm_coa_addr; - struct ipdb_item_t ipaddr; + struct ipv4db_item_t ipv4_addr; + struct ipv6db_item_t ipv6_addr; int acct_interim_interval; time_t acct_timestamp; |