diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-03-15 21:48:25 +0100 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2013-03-16 08:34:46 +0400 |
commit | 23eb9d4294a70ae725718ccd46ef04a01657d6b2 (patch) | |
tree | 1d13cf61d428e8571a15e2f4424da0f938eae9d0 /accel-pppd | |
parent | 092df3b1c82a64a8c61e7dd3e6e69d54404ba0b2 (diff) | |
download | accel-ppp-23eb9d4294a70ae725718ccd46ef04a01657d6b2.tar.gz accel-ppp-23eb9d4294a70ae725718ccd46ef04a01657d6b2.zip |
l2tp: Don't depent on StopCCN for tunnel disconnection
Always disconnect tunnel once l2tp_tunnel_disconnect() is called,
even if sending StopCCN failed.
Change the way unknown message types are handled to comply with
new l2tp_tunnel_disconnect() signature.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index ed4364f..87c1267 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -543,20 +543,16 @@ out_err: return -1; } -static int l2tp_tunnel_disconnect(struct l2tp_conn_t *conn, int res, int err) +static void l2tp_tunnel_disconnect(struct l2tp_conn_t *conn, int res, int err) { log_ppp_debug("l2tp: terminate (%i, %i)\n", res, err); - if (l2tp_send_StopCCN(conn, res, err) < 0) { + if (l2tp_send_StopCCN(conn, res, err) < 0) log_tunnel(log_error, conn, "impossible to notify peer of tunnel disconnection," " disconnecting anyway\n"); - return -1; - } conn->state = STATE_FIN; - - return 0; } static void __l2tp_session_free(void *data) @@ -3079,9 +3075,17 @@ static int l2tp_conn_read(struct triton_md_handler_t *h) if (conf_verbose) log_warn("l2tp: unknown Message-Type %i\n", msg_type->val.uint16); if (msg_type->M) { - if (l2tp_tunnel_disconnect(conn, 2, 8)) - goto drop; - } + log_tunnel(log_error, conn, + "impossible to handle unknown message type" + " %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", + msg_type->val.uint16); + break; } l2tp_packet_free(pack); |