diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-03-15 21:48:18 +0100 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2013-03-16 08:34:46 +0400 |
commit | 092df3b1c82a64a8c61e7dd3e6e69d54404ba0b2 (patch) | |
tree | 544bb60e256be1f5cb0e5af0e1c3dfcf63799a46 /accel-pppd | |
parent | 16575d28ed0092ec5e1ea90ec7c6ef2b975191ec (diff) | |
download | accel-ppp-092df3b1c82a64a8c61e7dd3e6e69d54404ba0b2.tar.gz accel-ppp-092df3b1c82a64a8c61e7dd3e6e69d54404ba0b2.zip |
l2tp: Improve error handling of duplicate messages
Don't terminate tunnel in case of error while handling a duplicate
message. Such errors aren't critical enough to justify termination
of a tunnel and all of its sessions.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index c65bcd8a..ed4364f5 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -1297,7 +1297,7 @@ out_err: return -1; } -static void l2tp_retransmit(struct l2tp_conn_t *conn) +static int l2tp_retransmit(struct l2tp_conn_t *conn) { struct l2tp_packet_t *pack; @@ -1311,7 +1311,10 @@ static void l2tp_retransmit(struct l2tp_conn_t *conn) if (l2tp_packet_send(conn->hnd.fd, pack) < 0) { log_tunnel(log_error, conn, "packet retransmission failure\n"); + return -1; } + + return 0; } static void l2tp_rtimeout(struct triton_timer_t *t) @@ -2953,9 +2956,13 @@ static int l2tp_conn_read(struct triton_md_handler_t *h) ntohs(pack->hdr.Ns), ntohs(pack->hdr.Nr), conn->Ns, conn->Nr); if (!list_empty(&conn->send_queue)) - l2tp_retransmit(conn); - else if (l2tp_send_ZLB(conn)) - goto drop; + res = l2tp_retransmit(conn); + else + res = l2tp_send_ZLB(conn); + if (res < 0) + log_tunnel(log_warn, conn, + "replying to duplicate message" + " failed, continuing anyway\n"); l2tp_packet_free(pack); continue; } else if (res > 0) { |