From b95734f0b939697e504747c4abb69d599fe45ad3 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Fri, 15 Mar 2013 21:48:31 +0100 Subject: l2tp: Notify peer upon tunnel/session timeout If tunnel or session establishment timeout expires, send StopCCN or CDN to notify peer before closing tunnel/session. Signed-off-by: Guillaume Nault --- accel-pppd/ctrl/l2tp/l2tp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 87c12678..958eeb4f 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -794,7 +794,8 @@ static void l2tp_session_timeout(struct triton_timer_t *t) timeout_timer); log_ppp_debug("l2tp: session timeout\n"); - l2tp_session_free(sess); + if (l2tp_session_disconnect(sess, 10, 0) < 0) + log_session(log_error, sess, "session disconnection failed\n"); } static struct l2tp_sess_t *l2tp_tunnel_new_session(struct l2tp_conn_t *conn) @@ -1337,8 +1338,11 @@ static void l2tp_rtimeout(struct triton_timer_t *t) static void l2tp_timeout(struct triton_timer_t *t) { - struct l2tp_conn_t *conn = container_of(t, typeof(*conn), timeout_timer); + struct l2tp_conn_t *conn = container_of(t, typeof(*conn), + timeout_timer); + log_ppp_debug("l2tp: timeout\n"); + l2tp_tunnel_disconnect(conn, 1, 0); l2tp_tunnel_free(conn); } -- cgit v1.2.3