summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-11-06 12:35:57 +0300
committerDmitry Kozlov <xeb@mail.ru>2014-11-06 12:35:57 +0300
commitb276238f8721849c364cf718f854c7b07a706254 (patch)
tree7072b043b36de7c82c6f2be745b6901c86c7ba38
parent22e13bac6488cfbb939fc1f54133f966a0cc1e62 (diff)
downloadaccel-ppp-b276238f8721849c364cf718f854c7b07a706254.tar.gz
accel-ppp-b276238f8721849c364cf718f854c7b07a706254.zip
release IP addresses before fire EV_SESSION_FINISHED (fixes segfault when using IPoE)
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c5
-rw-r--r--accel-pppd/ppp/ipcp_opt_ipaddr.c5
-rw-r--r--accel-pppd/ppp/ipv6cp_opt_intfid.c5
-rw-r--r--accel-pppd/ppp/ppp_ipcp.c5
-rw-r--r--accel-pppd/ppp/ppp_ipv6cp.c5
-rw-r--r--accel-pppd/session.c11
6 files changed, 11 insertions, 25 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index a4809b0..cdb8fb0 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1095,11 +1095,6 @@ static void ipoe_session_finished(struct ap_session *s)
if (ses->relay_addr && ses->serv->dhcpv4_relay)
dhcpv4_relay_send_release(ses->serv->dhcpv4_relay, ses->hwaddr, ses->xid, ses->yiaddr, ses->client_id, ses->relay_agent, ses->serv->ifname, conf_agent_remote_id);
- if (s->ipv4 && s->ipv4->owner) {
- ipdb_put_ipv4(s, s->ipv4);
- s->ipv4 = NULL;
- }
-
if (ses->ifcfg)
ipoe_ifcfg_del(ses, 1);
diff --git a/accel-pppd/ppp/ipcp_opt_ipaddr.c b/accel-pppd/ppp/ipcp_opt_ipaddr.c
index e5246d5..8a77848 100644
--- a/accel-pppd/ppp/ipcp_opt_ipaddr.c
+++ b/accel-pppd/ppp/ipcp_opt_ipaddr.c
@@ -58,11 +58,6 @@ static void ipaddr_free(struct ppp_ipcp_t *ipcp, struct ipcp_option_t *opt)
{
struct ipaddr_option_t *ipaddr_opt = container_of(opt, typeof(*ipaddr_opt), opt);
- if (ipcp->ppp->ses.ipv4) {
- ipdb_put_ipv4(&ipcp->ppp->ses, ipcp->ppp->ses.ipv4);
- ipcp->ppp->ses.ipv4 = NULL;
- }
-
_free(ipaddr_opt);
}
diff --git a/accel-pppd/ppp/ipv6cp_opt_intfid.c b/accel-pppd/ppp/ipv6cp_opt_intfid.c
index 11b35ff..d2b8127 100644
--- a/accel-pppd/ppp/ipv6cp_opt_intfid.c
+++ b/accel-pppd/ppp/ipv6cp_opt_intfid.c
@@ -108,11 +108,6 @@ static void ipaddr_free(struct ppp_ipv6cp_t *ipv6cp, struct ipv6cp_option_t *opt
{
struct ipaddr_option_t *ipaddr_opt=container_of(opt,typeof(*ipaddr_opt),opt);
- if (ipv6cp->ppp->ses.ipv6) {
- ipdb_put_ipv6(&ipv6cp->ppp->ses, ipv6cp->ppp->ses.ipv6);
- ipv6cp->ppp->ses.ipv6 = NULL;
- }
-
_free(ipaddr_opt);
}
diff --git a/accel-pppd/ppp/ppp_ipcp.c b/accel-pppd/ppp/ppp_ipcp.c
index c05e20b..6cb86a4 100644
--- a/accel-pppd/ppp/ppp_ipcp.c
+++ b/accel-pppd/ppp/ppp_ipcp.c
@@ -209,11 +209,6 @@ static void ipcp_layer_finished(struct ppp_fsm_t *fsm)
ap_session_terminate(&ipcp->ppp->ses, TERM_USER_ERROR, 0);
fsm->fsm_state = FSM_Closed;
-
- if (ipcp->ppp->ses.ipv4) {
- ipdb_put_ipv4(&ipcp->ppp->ses, ipcp->ppp->ses.ipv4);
- ipcp->ppp->ses.ipv4 = NULL;
- }
}
static void ipcp_layer_down(struct ppp_fsm_t *fsm)
diff --git a/accel-pppd/ppp/ppp_ipv6cp.c b/accel-pppd/ppp/ppp_ipv6cp.c
index ee66626..9a87922 100644
--- a/accel-pppd/ppp/ppp_ipv6cp.c
+++ b/accel-pppd/ppp/ppp_ipv6cp.c
@@ -209,11 +209,6 @@ static void ipv6cp_layer_finished(struct ppp_fsm_t *fsm)
ap_session_terminate(&ipv6cp->ppp->ses, TERM_USER_ERROR, 0);
fsm->fsm_state = FSM_Closed;
-
- if (ipv6cp->ppp->ses.ipv6) {
- ipdb_put_ipv6(&ipv6cp->ppp->ses, ipv6cp->ppp->ses.ipv6);
- ipv6cp->ppp->ses.ipv6 = NULL;
- }
}
static void ipv6cp_layer_down(struct ppp_fsm_t *fsm)
diff --git a/accel-pppd/session.c b/accel-pppd/session.c
index b50686c..8885cb2 100644
--- a/accel-pppd/session.c
+++ b/accel-pppd/session.c
@@ -19,6 +19,7 @@
#include "log.h"
#include "events.h"
#include "ap_session.h"
+#include "ipdb.h"
#include "backup.h"
#include "iputils.h"
#include "spinlock.h"
@@ -159,6 +160,16 @@ void __export ap_session_finished(struct ap_session *ses)
break;
}
+ if (ses->ipv4 && ses->ipv4->owner) {
+ ipdb_put_ipv4(ses, ses->ipv4);
+ ses->ipv4 = NULL;
+ }
+
+ if (ses->ipv6 && ses->ipv6->owner) {
+ ipdb_put_ipv6(ses, ses->ipv6);
+ ses->ipv6 = NULL;
+ }
+
triton_event_fire(EV_SES_FINISHED, ses);
ses->ctrl->finished(ses);