diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-09-09 21:19:58 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-09-09 21:20:03 +0400 |
commit | b13905663dc570fc9631d5063468f55b0a5a628d (patch) | |
tree | 33358dfcc8a224092d3d658dfa40177707a006bf | |
parent | d371f4dd5036cf94feedbcc9d568956361c8b762 (diff) | |
download | accel-ppp-b13905663dc570fc9631d5063468f55b0a5a628d.tar.gz accel-ppp-b13905663dc570fc9631d5063468f55b0a5a628d.zip |
updated procedure to check double sessions
drop existing sessions immediately and continue rather than wait full session termination
-rw-r--r-- | accel-pppd/ifcfg.c | 22 | ||||
-rw-r--r-- | accel-pppd/session.c | 17 |
2 files changed, 19 insertions, 20 deletions
diff --git a/accel-pppd/ifcfg.c b/accel-pppd/ifcfg.c index 3190873..d3a8006 100644 --- a/accel-pppd/ifcfg.c +++ b/accel-pppd/ifcfg.c @@ -55,16 +55,9 @@ static void build_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_add *(uint64_t *)(addr->s6_addr + 8) |= intf_id & ((1 << (128 - a->prefix_len)) - 1); } +static void ifup_continue(struct ap_session *ses); void ap_session_ifup(struct ap_session *ses) { - struct ipv6db_addr_t *a; - struct ifreq ifr; - //struct rtentry rt; - struct in6_ifreq ifr6; - struct npioctl np; - struct sockaddr_in addr; - struct ppp_t *ppp; - if (ses->ifname_rename) { if (ap_session_rename(ses, ses->ifname_rename, -1)) { ap_session_terminate(ses, TERM_NAS_ERROR, 0); @@ -75,6 +68,19 @@ void ap_session_ifup(struct ap_session *ses) } triton_event_fire(EV_SES_ACCT_START, ses); + triton_context_call(ses->ctrl->ctx, (triton_event_func)ifup_continue, ses); +} + +static void ifup_continue(struct ap_session *ses) +{ + struct ipv6db_addr_t *a; + struct ifreq ifr; + //struct rtentry rt; + struct in6_ifreq ifr6; + struct npioctl np; + struct sockaddr_in addr; + struct ppp_t *ppp; + if (ses->stop_time) return; diff --git a/accel-pppd/session.c b/accel-pppd/session.c index ac8633e..cff5b30 100644 --- a/accel-pppd/session.c +++ b/accel-pppd/session.c @@ -332,21 +332,14 @@ int __export ap_session_set_username(struct ap_session *s, char *username) log_ppp_info1("%s: second session denied\n", username); return -1; } else { - if (conf_single_session == 1) { - if (ses->wakeup) - continue; - //ap_session_ifdown(ses); - ses->wakeup = s->ctrl->ctx; - wait = 1; - triton_context_call(ses->ctrl->ctx, (triton_event_func)__terminate_sec, ses); - } + ap_session_ifdown(ses); + triton_context_call(ses->ctrl->ctx, (triton_event_func)__terminate_sec, ses); + continue; } - break; } } - s->username = username; - } else - s->username = username; + } + s->username = username; pthread_rwlock_unlock(&ses_lock); if (wait) |