Commit 8a49ad6e authored by Ben McKeegan's avatar Ben McKeegan Committed by David S. Miller

ppp: fix 'ppp_mp_reconstruct bad seq' errors

This patch fixes a (mostly cosmetic) bug introduced by the patch
'ppp: Use SKB queue abstraction interfaces in fragment processing'
found here: http://www.spinics.net/lists/netdev/msg153312.html

The above patch rewrote and moved the code responsible for cleaning
up discarded fragments but the new code does not catch every case
where this is necessary.  This results in some discarded fragments
remaining in the queue, and triggering a 'bad seq' error on the
subsequent call to ppp_mp_reconstruct.  Fragments are discarded
whenever other fragments of the same frame have been lost.
This can generate a lot of unwanted and misleading log messages.

This patch also adds additional detail to the debug logging to
make it clearer which fragments were lost and which other fragments
were discarded as a result of losses. (Run pppd with 'kdebug 1'
option to enable debug logging.)
Signed-off-by: default avatarBen McKeegan <ben@netservers.co.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21ca54e9
...@@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp) ...@@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp)
continue; continue;
} }
if (PPP_MP_CB(p)->sequence != seq) { if (PPP_MP_CB(p)->sequence != seq) {
u32 oldseq;
/* Fragment `seq' is missing. If it is after /* Fragment `seq' is missing. If it is after
minseq, it might arrive later, so stop here. */ minseq, it might arrive later, so stop here. */
if (seq_after(seq, minseq)) if (seq_after(seq, minseq))
break; break;
/* Fragment `seq' is lost, keep going. */ /* Fragment `seq' is lost, keep going. */
lost = 1; lost = 1;
oldseq = seq;
seq = seq_before(minseq, PPP_MP_CB(p)->sequence)? seq = seq_before(minseq, PPP_MP_CB(p)->sequence)?
minseq + 1: PPP_MP_CB(p)->sequence; minseq + 1: PPP_MP_CB(p)->sequence;
if (ppp->debug & 1)
netdev_printk(KERN_DEBUG, ppp->dev,
"lost frag %u..%u\n",
oldseq, seq-1);
goto again; goto again;
} }
...@@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp) ...@@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp)
struct sk_buff *tmp2; struct sk_buff *tmp2;
skb_queue_reverse_walk_from_safe(list, p, tmp2) { skb_queue_reverse_walk_from_safe(list, p, tmp2) {
if (ppp->debug & 1)
netdev_printk(KERN_DEBUG, ppp->dev,
"discarding frag %u\n",
PPP_MP_CB(p)->sequence);
__skb_unlink(p, list); __skb_unlink(p, list);
kfree_skb(p); kfree_skb(p);
} }
...@@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp) ...@@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp)
/* If we have discarded any fragments, /* If we have discarded any fragments,
signal a receive error. */ signal a receive error. */
if (PPP_MP_CB(head)->sequence != ppp->nextseq) { if (PPP_MP_CB(head)->sequence != ppp->nextseq) {
skb_queue_walk_safe(list, p, tmp) {
if (p == head)
break;
if (ppp->debug & 1)
netdev_printk(KERN_DEBUG, ppp->dev,
"discarding frag %u\n",
PPP_MP_CB(p)->sequence);
__skb_unlink(p, list);
kfree_skb(p);
}
if (ppp->debug & 1) if (ppp->debug & 1)
netdev_printk(KERN_DEBUG, ppp->dev, netdev_printk(KERN_DEBUG, ppp->dev,
" missed pkts %u..%u\n", " missed pkts %u..%u\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment