# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../pptpd/pptpd-1.3.4-pptpgre-out-of-order-sequence-number.patch # Copyright (C) 2011 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From b99f5370362fe266b10dd195120c23e2bf64286f Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Wed, 24 Aug 2011 13:53:45 +0200 Subject: [PATCH] pptpgre: added check for out-of-order sequence number Origin: http://marc.info/?l=poptop-server&m=117737453400588&w=2 Debian Bugs: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=416404 --- pptpgre.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git pptpd-1.3.4.orig/pptpgre.c 1.3.4/pptpgre.c index 9efabae..d84ea9b 100644 --- pptpd-1.3.4.orig/pptpgre.c +++ 1.3.4/pptpgre.c @@ -403,15 +403,20 @@ int decaps_gre(int fd, int (*cb) (int cl, void *pack, unsigned len), int cl) stats.rx_truncated++; return 0; } - /* check for out-of-order sequence number */ - if (seq == gre.seq_recv + 1) { + /* check for out-of-order sequence number + * N.B.: some client implementations violate RFC 2637 + * and start their sequence numbers at 1 instead of 0, + * so we have to introduce a kludge to deal with it. + * on wrap we may allow an out of order packet to pass + */ + if (seq == gre.seq_recv + 1 || seq == 1) { if (pptpctrl_debug) syslog(LOG_DEBUG, "GRE: accepting packet #%d", seq); stats.rx_accepted++; gre.seq_recv = seq; return cb(cl, buffer + ip_len + headersize, payload_len); - } else if (seq == gre.seq_recv) { + } else if (!seq_greater(seq, gre.seq_recv)) { if (pptpctrl_debug) syslog(LOG_DEBUG, "GRE: discarding duplicate or old packet #%d (expecting #%d)", -- 1.6.6.2