Description: Check for out-of-order sequence numbers Applied upstream 2007-04-24 05:13:17 Origin: http://marc.info/?l=poptop-server&m=117737453400588&w=2 Forwarded: not-needed Bug-Debian: http://bugs.debian.org/416404 --- a/pptpgre.c +++ b/pptpgre.c @@ -403,15 +403,20 @@ 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)",