diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-02-08 21:46:57 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-02-08 21:46:57 +0300 |
commit | a04cc1eba9bdf614eea9d7858db4581fc22474d7 (patch) | |
tree | e827a28279c57c27e8836e3aea307076a27a5f5a /accel-pppd/radius/radius.c | |
parent | 38077f9b9d9e86f4a7d2317b3697ea4370889999 (diff) | |
download | accel-ppp-a04cc1eba9bdf614eea9d7858db4581fc22474d7.tar.gz accel-ppp-a04cc1eba9bdf614eea9d7858db4581fc22474d7.zip |
snapshot
Diffstat (limited to 'accel-pppd/radius/radius.c')
-rw-r--r-- | accel-pppd/radius/radius.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index edf3120..64ce90f 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -94,9 +94,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: @@ -167,15 +167,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); @@ -406,7 +416,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 = { |