]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ip/defrag: fix processing of last short fragment
authorFillod Stephane <stephane.fillod@grassvalley.com>
Fri, 11 Jun 2010 17:26:43 +0000 (19:26 +0200)
committerBen Warren <biggerbadderben@gmail.com>
Mon, 21 Jun 2010 05:11:32 +0000 (22:11 -0700)
TFTP'ing a file of size 1747851 bytes with CONFIG_IP_DEFRAG and
CONFIG_TFTP_BLOCKSIZE set to 4096 fails with a timeout, because
the last fragment is not taken into account. This patch fixes
IP fragments having less than 8 bytes of payload.

Signed-off-by: Stephane Fillod <stephane.fillod@grassvalley.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
net/net.c

index cda731986b721c27b917f6fb31d451e4b5fe8785..33fcd90cd429ad066da1ca5ed50efef510b85663 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1201,7 +1201,8 @@ static IP_t *__NetDefragment(IP_t *ip, int *lenp)
                h = payload + h->next_hole;
        }
 
-       if (offset8 + (len / 8) <= h - payload) {
+       /* last fragment may be 1..7 bytes, the "+7" forces acceptance */
+       if (offset8 + ((len + 7) / 8) <= h - payload) {
                /* no overlap with holes (dup fragment?) */
                return NULL;
        }