From 0f59114d1b05f9f039471eb6d23f614ac104aa64 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Wed, 4 Sep 2013 13:36:56 +0400 Subject: ipoe: stop virtual interfaces before stopping vlan --- accel-pppd/ctrl/ipoe/ipoe.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'accel-pppd') 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); -- cgit v1.2.3