summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/l2tp
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2013-03-13 18:43:15 +0100
committerKozlov Dmitry <xeb@mail.ru>2013-03-15 23:59:32 +0400
commit2ba26d60341771b4852587aaf548a73d123ccaa1 (patch)
tree87613094b9f247f439ecff61097a3c71df2370a7 /accel-pppd/ctrl/l2tp
parent7004505febb3560fa2188bb852a6366fa8180bad (diff)
downloadaccel-ppp-2ba26d60341771b4852587aaf548a73d123ccaa1.tar.gz
accel-ppp-2ba26d60341771b4852587aaf548a73d123ccaa1.zip
l2tp: Handle l2tp_session_free() failures
Update l2tp_session_free's prototype to return its error status. Do the opposite for l2tp_tunnel_cancel_session (make it return void) as it never fails. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ctrl/l2tp')
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 1b32f26..f5a5d3c 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -597,7 +597,7 @@ static void l2tp_tunnel_free_sessionid(void *data)
l2tp_tunnel_free_session(sess);
}
-static void l2tp_session_free(struct l2tp_sess_t *sess)
+static int l2tp_session_free(struct l2tp_sess_t *sess)
{
intptr_t sid = sess->sid;
@@ -605,7 +605,10 @@ static void l2tp_session_free(struct l2tp_sess_t *sess)
l2tp_tunnel_free_sessionid, (void *)sid) < 0) {
log_session(log_error, sess, "impossible to free session:"
" call to parent tunnel failed\n");
+ return -1;
}
+
+ return 0;
}
static void l2tp_tunnel_free(struct l2tp_conn_t *conn)
@@ -706,7 +709,11 @@ static int l2tp_session_disconnect(struct l2tp_sess_t *sess,
"impossible to notify peer of session"
" disconnection, disconnecting anyway\n");
- l2tp_session_free(sess);
+ if (l2tp_session_free(sess) < 0) {
+ log_session(log_error, sess, "impossible to free session,"
+ " session data have been kept\n");
+ return -1;
+ }
return 0;
}
@@ -723,7 +730,10 @@ static void l2tp_ppp_finished(struct ap_session *ses)
log_session(log_error, sess,
"impossible to notify peer of session"
" disconnection, disconnecting anyway\n");
- l2tp_session_free(sess);
+ if (l2tp_session_free(sess) < 0)
+ log_session(log_error, sess,
+ "impossible to free session,"
+ " session data have been kept\n");
} else {
/* Called by __l2tp_session_free() via ap_session_terminate().
Now, call __l2tp_session_free() again to finish cleanup. */
@@ -856,7 +866,7 @@ static int l2tp_tunnel_confirm_session(struct l2tp_sess_t *sess)
return 0;
}
-static int l2tp_tunnel_cancel_session(struct l2tp_sess_t *sess)
+static void l2tp_tunnel_cancel_session(struct l2tp_sess_t *sess)
{
tdelete(sess, &sess->paren_conn->sessions, sess_cmp);
if (sess->ctrl.calling_station_id)
@@ -864,8 +874,6 @@ static int l2tp_tunnel_cancel_session(struct l2tp_sess_t *sess)
if (sess->ctrl.called_station_id)
_free(sess->ctrl.called_station_id);
mempool_free(sess);
-
- return 0;
}
static void l2tp_conn_close(struct triton_context_t *ctx)