summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index f001054..c6e9757 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -848,7 +848,6 @@ static void ipoe_session_started(struct ap_session *s)
static void ipoe_session_free(struct ipoe_session *ses)
{
- struct unit_cache *uc;
if (ses->started)
__sync_sub_and_fetch(&stat_active, 1);
@@ -872,18 +871,6 @@ static void ipoe_session_free(struct ipoe_session *ses)
if (ses->data)
_free(ses->data);
- if (ses->ifindex != -1) {
- if (uc_size < conf_unit_cache && ipoe_nl_modify(ses->ifindex, 0, 0, "", NULL)) {
- uc = mempool_alloc(uc_pool);
- uc->ifindex = ses->ifindex;
- pthread_mutex_lock(&uc_lock);
- list_add_tail(&uc->entry, &uc_list);
- ++uc_size;
- pthread_mutex_unlock(&uc_lock);
- } else
- ipoe_nl_delete(ses->ifindex);
- }
-
mempool_free(ses);
}
@@ -891,6 +878,7 @@ static void ipoe_session_finished(struct ap_session *s)
{
struct ipoe_session *ses = container_of(s, typeof(*ses), ses);
int serv_close;
+ struct unit_cache *uc;
log_ppp_info1("ipoe: session finished\n");
@@ -899,6 +887,18 @@ static void ipoe_session_finished(struct ap_session *s)
serv_close = (ses->serv->vid || ses->serv->need_close) && list_empty(&ses->serv->sessions);
pthread_mutex_unlock(&ses->serv->lock);
+ if (ses->ifindex != -1) {
+ if (uc_size < conf_unit_cache && ipoe_nl_modify(ses->ifindex, 0, 0, "", NULL)) {
+ uc = mempool_alloc(uc_pool);
+ uc->ifindex = ses->ifindex;
+ pthread_mutex_lock(&uc_lock);
+ list_add_tail(&uc->entry, &uc_list);
+ ++uc_size;
+ pthread_mutex_unlock(&uc_lock);
+ } else
+ ipoe_nl_delete(ses->ifindex);
+ }
+
if (ses->dhcp_addr)
dhcpv4_put_ip(ses->serv->dhcpv4, ses->yiaddr);