diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-08-03 22:19:19 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-08-03 22:19:19 +0400 |
commit | dee9aa718363d00d3cca815b137aa49ed91bc851 (patch) | |
tree | 0e5060c060eabb44c4a8d2ba5e2e0a214e1e6b5b /accel-pppd | |
parent | 994905a05a6388cb9e832e09c05bb6a363c73ecc (diff) | |
download | accel-ppp-dee9aa718363d00d3cca815b137aa49ed91bc851.tar.gz accel-ppp-dee9aa718363d00d3cca815b137aa49ed91bc851.zip |
l2tp: stop hello timer on session termination
l2tp: rertansmit last packet if duplicate packet received
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 162c9cb4..01d0c90b 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -174,6 +174,9 @@ static int l2tp_terminate(struct l2tp_conn_t *conn, int res, int err) log_ppp_debug("l2tp: terminate (%i, %i)\n", res, err); + if (conn->hello_timer.tpd) + triton_timer_del(&conn->hello_timer); + pack = l2tp_packet_alloc(2, Message_Type_Stop_Ctrl_Conn_Notify, &conn->addr); if (!pack) return -1; @@ -464,22 +467,27 @@ out_err: return -1; } +static void l2tp_retransmit(struct l2tp_conn_t *conn) +{ + struct l2tp_packet_t *pack; + + pack = list_entry(conn->send_queue.next, typeof(*pack), entry); + pack->hdr.Nr = htons(conn->Nr + 1); + if (conf_verbose) { + log_ppp_debug("send "); + l2tp_packet_print(pack, log_ppp_debug); + } + l2tp_packet_send(conn->hnd.fd, pack); +} + static void l2tp_rtimeout(struct triton_timer_t *t) { struct l2tp_conn_t *conn = container_of(t, typeof(*conn), rtimeout_timer); - struct l2tp_packet_t *pack; if (!list_empty(&conn->send_queue)) { log_ppp_debug("l2tp: retransmit (%i)\n", conn->retransmit); if (++conn->retransmit <= conf_retransmit) { - pack = list_entry(conn->send_queue.next, typeof(*pack), entry); - pack->hdr.Nr = htons(conn->Nr + 1); - if (conf_verbose) { - log_ppp_debug("send "); - l2tp_packet_print(pack, log_ppp_debug); - } - if (l2tp_packet_send(conn->hnd.fd, pack) == 0) - return; + l2tp_retransmit(conn); } else l2tp_disconnect(conn); } @@ -947,8 +955,10 @@ static int l2tp_conn_read(struct triton_md_handler_t *h) } else { if (ntohs(pack->hdr.Ns) < conn->Nr + 1 || (ntohs(pack->hdr.Ns > 32767 && conn->Nr + 1 < 32767))) { log_ppp_debug("duplicate packet\n"); - if (l2tp_send_ZLB(conn)) - goto drop; + //if (l2tp_send_ZLB(conn)) + // goto drop; + if (!list_empty(&conn->send_queue)) + l2tp_retransmit(conn); } else log_ppp_debug("reordered packet\n"); l2tp_packet_free(pack); |