Skip to content

Commit 8a49ad6

Browse files
ben42424242davem330
authored andcommitted
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: Ben McKeegan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 21ca54e commit 8a49ad6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/net/ppp/ppp_generic.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp)
20242024
continue;
20252025
}
20262026
if (PPP_MP_CB(p)->sequence != seq) {
2027+
u32 oldseq;
20272028
/* Fragment `seq' is missing. If it is after
20282029
minseq, it might arrive later, so stop here. */
20292030
if (seq_after(seq, minseq))
20302031
break;
20312032
/* Fragment `seq' is lost, keep going. */
20322033
lost = 1;
2034+
oldseq = seq;
20332035
seq = seq_before(minseq, PPP_MP_CB(p)->sequence)?
20342036
minseq + 1: PPP_MP_CB(p)->sequence;
2037+
2038+
if (ppp->debug & 1)
2039+
netdev_printk(KERN_DEBUG, ppp->dev,
2040+
"lost frag %u..%u\n",
2041+
oldseq, seq-1);
2042+
20352043
goto again;
20362044
}
20372045

@@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp)
20762084
struct sk_buff *tmp2;
20772085

20782086
skb_queue_reverse_walk_from_safe(list, p, tmp2) {
2087+
if (ppp->debug & 1)
2088+
netdev_printk(KERN_DEBUG, ppp->dev,
2089+
"discarding frag %u\n",
2090+
PPP_MP_CB(p)->sequence);
20792091
__skb_unlink(p, list);
20802092
kfree_skb(p);
20812093
}
@@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp)
20912103
/* If we have discarded any fragments,
20922104
signal a receive error. */
20932105
if (PPP_MP_CB(head)->sequence != ppp->nextseq) {
2106+
skb_queue_walk_safe(list, p, tmp) {
2107+
if (p == head)
2108+
break;
2109+
if (ppp->debug & 1)
2110+
netdev_printk(KERN_DEBUG, ppp->dev,
2111+
"discarding frag %u\n",
2112+
PPP_MP_CB(p)->sequence);
2113+
__skb_unlink(p, list);
2114+
kfree_skb(p);
2115+
}
2116+
20942117
if (ppp->debug & 1)
20952118
netdev_printk(KERN_DEBUG, ppp->dev,
20962119
" missed pkts %u..%u\n",

0 commit comments

Comments
 (0)