From 3108115ec7816c99e737d3623a2fb63875af058e Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Mon, 18 Mar 2013 14:22:52 +0400 Subject: ipoe: early drop routes when dropping sessions --- accel-pppd/ctrl/ipoe/ipoe.c | 12 ++++++++++++ accel-pppd/ctrl/ipoe/ipoe.h | 1 + 2 files changed, 13 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index e7c91b1..27f801a 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -576,6 +576,9 @@ static void __ipoe_session_activate(struct ipoe_session *ses) { uint32_t addr; + if (ses->terminating) + return; + if (ses->ifindex != -1) { addr = 0; if (!ses->ses.ipv4) @@ -1292,15 +1295,24 @@ static void ipoe_drop_sessions(struct ipoe_serv *serv, struct ipoe_session *skip { struct ipoe_session *ses; + pthread_mutex_lock(&serv->lock); list_for_each_entry(ses, &serv->sessions, entry) { if (ses == skip) continue; + ses->terminating = 1; + if (ses->ifcfg) { + ipoe_ifcfg_del(ses); + ses->ifcfg = 0; + } + if (ses->ses.state == AP_STATE_ACTIVE) ap_session_ifdown(&ses->ses); triton_context_call(&ses->ctx, (triton_event_func)__terminate, &ses->ses); } + pthread_mutex_unlock(&serv->lock); + } struct ipoe_serv *ipoe_find_serv(const char *ifname) diff --git a/accel-pppd/ctrl/ipoe/ipoe.h b/accel-pppd/ctrl/ipoe/ipoe.h index 085aeda..827cba3 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.h +++ b/accel-pppd/ctrl/ipoe/ipoe.h @@ -56,6 +56,7 @@ struct ipoe_session int ifindex; struct ipv4db_item_t ipv4; int ifcfg:1; + int terminating:1; int dhcp_addr:1; int relay_addr:1; int l4_redirect:1; -- cgit v1.2.3