From 411c4f943bdfdc8ebb79582d17e93923109c95b0 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Tue, 8 Apr 2014 22:52:42 +0200 Subject: l2tp: don't free tunnel immediately upon message handling errors Upon failure, l2tp_recv_SCCRP() and l2tp_recv_SCCCN() disconnect their tunnel, which is then immediately deleted by l2tp_conn_read(). Deleting the tunnel isn't necessary at this stage and prevents retransmission of the disconnection message if it gets lost. Same applies to unknown message types with M bit set. This path avoids immediate tunnel deletion, thus allowing the disconnection process to handle acknowledgments from peer and to retransmit messages if necessary. Signed-off-by: Guillaume Nault --- accel-pppd/ctrl/l2tp/l2tp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index dc11b42..086d2a8 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -3723,12 +3723,10 @@ static int l2tp_conn_read(struct triton_md_handler_t *h) switch (msg_type->val.uint16) { case Message_Type_Start_Ctrl_Conn_Reply: - if (l2tp_recv_SCCRP(conn, pack)) - goto drop; + l2tp_recv_SCCRP(conn, pack); break; case Message_Type_Start_Ctrl_Conn_Connected: - if (l2tp_recv_SCCCN(conn, pack)) - goto drop; + l2tp_recv_SCCCN(conn, pack); break; case Message_Type_Stop_Ctrl_Conn_Notify: l2tp_recv_StopCCN(conn, pack); @@ -3771,7 +3769,6 @@ static int l2tp_conn_read(struct triton_md_handler_t *h) " %i, disconnecting tunnel\n", msg_type->val.uint16); l2tp_tunnel_disconnect(conn, 2, 8); - goto drop; } else log_tunnel(log_warn, conn, "discarding unknown message type %i\n", -- cgit v1.2.3