diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-03-25 12:46:32 +0100 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-03-28 07:16:19 +0400 |
commit | ce9065f8f3885d0a3794a04117f70367539395de (patch) | |
tree | 9919d8c8386c1dc185f762123d74e3217de0cd19 /accel-pppd/ctrl/l2tp | |
parent | c50b3502ef776740f7ca7f640536f4c22869a34b (diff) | |
download | accel-ppp-ce9065f8f3885d0a3794a04117f70367539395de.tar.gz accel-ppp-ce9065f8f3885d0a3794a04117f70367539395de.zip |
l2tp: Simplify some function call sequences
* Avoid retrieving tunnel and session contexts manually; use
l2tp_{tunnel,session}_self() instead.
* Use l2tp_session_disconnect() instead of using an
l2tp_send_CDN(); l2tp_session_free() sequence.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ctrl/l2tp')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index f6a15d6..0a1d2c6 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -622,8 +622,7 @@ static void __l2tp_tunnel_free_session(void *data) static void l2tp_tunnel_free_session(void *sess) { - struct triton_context_t *ctx = triton_context_self(); - struct l2tp_conn_t *conn = container_of(ctx, typeof(*conn), ctx); + struct l2tp_conn_t *conn = l2tp_tunnel_self(); tdelete(sess, &conn->sessions, sess_cmp); __l2tp_tunnel_free_session(sess); @@ -2547,8 +2546,8 @@ static void l2tp_session_outcall_reply(void *data) return; out_err: - l2tp_send_CDN(sess, 2, 6); - l2tp_session_free(sess); + if (l2tp_session_disconnect(sess, 2, 6) < 0) + log_session(log_error, sess, "session disconnection failed\n"); } static int l2tp_recv_OCRQ(struct l2tp_conn_t *conn, @@ -2860,8 +2859,7 @@ static void l2tp_tunnel_create_session(void *data) static void l2tp_session_recv(void *data) { - struct triton_context_t *ctx = triton_context_self(); - struct l2tp_sess_t *sess = container_of(ctx, typeof(*sess), sctx); + struct l2tp_sess_t *sess = l2tp_session_self(); struct l2tp_packet_t *pack = data; const struct l2tp_attr_t *msg_type = NULL; |