summaryrefslogtreecommitdiffstats
path: root/usr.sbin/npppd/l2tp
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2011-10-15 03:24:11 +0000
committeryasuoka <yasuoka@openbsd.org>2011-10-15 03:24:11 +0000
commite405d423d1799d75a821e76c725badd34bf824ac (patch)
tree2ba44f99bdce4a04f2cf5f15c42a9af172004259 /usr.sbin/npppd/l2tp
parentDelete unused field s_first in 'struct pppoe_session' that is assigned (diff)
downloadwireguard-openbsd-e405d423d1799d75a821e76c725badd34bf824ac.tar.xz
wireguard-openbsd-e405d423d1799d75a821e76c725badd34bf824ac.zip
Added "provision for rewound PPP frames" that allows receiving
reorder packets to pass to the upper layer without reorder. It will improve performance (throughput or loss rate) for PPTP or L2TP(/IPesc) on networks that latency is unstable such as mobile network. As our test environment (bandwidth: 6Mbps, latency: 50ms for 97% of traffic and 52ms for rest of traffic), throughput has changed from 0.76MB to 2.17MB on file upload by PPTP connected Windows Vista ftp.exe. Developed by UMEZAWA Takeshi at IIJ. ok jmatthew@ tested jmatthew@ and myself.
Diffstat (limited to 'usr.sbin/npppd/l2tp')
-rw-r--r--usr.sbin/npppd/l2tp/l2tp.h7
-rw-r--r--usr.sbin/npppd/l2tp/l2tp_call.c9
-rw-r--r--usr.sbin/npppd/l2tp/l2tp_ctrl.c29
3 files changed, 28 insertions, 17 deletions
diff --git a/usr.sbin/npppd/l2tp/l2tp.h b/usr.sbin/npppd/l2tp/l2tp.h
index db30d79ee89..d1927478bbd 100644
--- a/usr.sbin/npppd/l2tp/l2tp.h
+++ b/usr.sbin/npppd/l2tp/l2tp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp.h,v 1.4 2010/09/24 14:50:30 yasuoka Exp $ */
+/* $OpenBSD: l2tp.h,v 1.5 2011/10/15 03:24:11 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -30,7 +30,7 @@
/*@file
* header file for the L2TP module
*/
-/* $Id: l2tp.h,v 1.4 2010/09/24 14:50:30 yasuoka Exp $ */
+/* $Id: l2tp.h,v 1.5 2011/10/15 03:24:11 yasuoka Exp $ */
/************************************************************************
* Protocol Constants
@@ -283,6 +283,7 @@
((l2tpd_listener *)slist_get(&(ctrl)->l2tpd->listener, \
(ctrl)->listener_index))->phy_label
+#define L2TP_CALL_DELAY_LIMIT 64
/** datatype represents L2TP daemon */
struct _l2tpd;
@@ -457,7 +458,7 @@ int l2tp_call_init (l2tp_call *, l2tp_ctrl *);
void l2tp_call_destroy (l2tp_call *, int);
void l2tp_call_admin_disconnect(l2tp_call *);
int l2tp_call_recv_packet (l2tp_ctrl *, l2tp_call *, int, u_char *, int);
-void l2tp_call_ppp_input (l2tp_call *, u_char *, int);
+void l2tp_call_ppp_input (l2tp_call *, u_char *, int, int);
void l2tp_ctrl_destroy (l2tp_ctrl *);
l2tp_ctrl *l2tp_ctrl_create (void);
diff --git a/usr.sbin/npppd/l2tp/l2tp_call.c b/usr.sbin/npppd/l2tp/l2tp_call.c
index 3507ac983ee..935af5f65e3 100644
--- a/usr.sbin/npppd/l2tp/l2tp_call.c
+++ b/usr.sbin/npppd/l2tp/l2tp_call.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_call.c,v 1.7 2011/01/20 23:12:33 jasper Exp $ */
+/* $OpenBSD: l2tp_call.c,v 1.8 2011/10/15 03:24:11 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: l2tp_call.c,v 1.7 2011/01/20 23:12:33 jasper Exp $ */
+/* $Id: l2tp_call.c,v 1.8 2011/10/15 03:24:11 yasuoka Exp $ */
/**@file L2TP LNS call */
#include <sys/types.h>
#include <sys/param.h>
@@ -860,13 +860,14 @@ l2tp_call_state_string(l2tp_call *_this)
/* input packet to ppp */
void
-l2tp_call_ppp_input(l2tp_call *_this, u_char *pkt, int pktlen)
+l2tp_call_ppp_input(l2tp_call *_this, u_char *pkt, int pktlen, int delayed)
{
int rval;
npppd_ppp *ppp;
ppp = _this->ppp;
- rval = ppp->recv_packet(ppp, pkt, pktlen, 0);
+ rval = ppp->recv_packet(ppp, pkt, pktlen,
+ delayed ? PPP_IO_FLAGS_DELAYED : 0);
if (_this->ppp == NULL) /* ppp is freed */
return;
diff --git a/usr.sbin/npppd/l2tp/l2tp_ctrl.c b/usr.sbin/npppd/l2tp/l2tp_ctrl.c
index 1259eb7a347..11c9a47b4a3 100644
--- a/usr.sbin/npppd/l2tp/l2tp_ctrl.c
+++ b/usr.sbin/npppd/l2tp/l2tp_ctrl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_ctrl.c,v 1.6 2011/01/20 23:12:33 jasper Exp $ */
+/* $OpenBSD: l2tp_ctrl.c,v 1.7 2011/10/15 03:24:11 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/**@file Control connection processing functions for L2TP LNS */
-/* $Id: l2tp_ctrl.c,v 1.6 2011/01/20 23:12:33 jasper Exp $ */
+/* $Id: l2tp_ctrl.c,v 1.7 2011/10/15 03:24:11 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
@@ -903,6 +903,8 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer,
}
}
if (!is_ctrl) {
+ int delayed = 0;
+
/* L2TP data */
if (ctrl->state != L2TP_CTRL_STATE_ESTABLISHED) {
l2tp_ctrl_log(ctrl, LOG_WARNING,
@@ -929,16 +931,23 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer,
if (hdr.s != 0) {
if (SEQ_LT(hdr.ns, call->rcv_nxt)) {
- /* sequence number seems to rewind */
- /* XXX: need to log? */
- L2TP_CTRL_DBG((ctrl, LOG_DEBUG,
- "receive a out of sequence data packet: "
- "%u < %u. ", hdr.ns, call->rcv_nxt));
- return;
+ if (SEQ_LT(hdr.ns,
+ call->rcv_nxt - L2TP_CALL_DELAY_LIMIT)) {
+ /* sequence number seems to be delayed */
+ /* XXX: need to log? */
+ L2TP_CTRL_DBG((ctrl, LOG_DEBUG,
+ "receive a out of sequence "
+ "data packet: %u < %u.",
+ hdr.ns, call->rcv_nxt));
+ return;
+ }
+ delayed = 1;
+ } else {
+ call->rcv_nxt = hdr.ns + 1;
}
- call->rcv_nxt = hdr.ns + 1;
}
- l2tp_call_ppp_input(call, pkt, pktlen);
+
+ l2tp_call_ppp_input(call, pkt, pktlen, delayed);
return;
}