From e397e59e861aa818cda12a23206dde06f7e9f660 Mon Sep 17 00:00:00 2001 From: Fillod Stephane Date: Fri, 11 Jun 2010 19:26:43 +0200 Subject: [PATCH 1/2] ip/defrag: fix processing of last short fragment 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 Acked-by: Alessandro Rubini Signed-off-by: Ben Warren --- net/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index cda731986..33fcd90cd 100644 --- 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; } From 6de27bdc788e7c4532ee0721ae291aeb5df475dc Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Sun, 20 Jun 2010 12:32:37 +0200 Subject: [PATCH 2/2] net/eth.c: eth_mac_skip() is only needed when CONFIG_NET_MULTI is set Move it inside the #ifdef CONFIG_NET_MULTI to avoid eth.c:64: warning: 'eth_mac_skip' defined but not used messages from a number of old, non-CONFIG_NET_MULTI boards. Signed-off-by: Wolfgang Denk Signed-off-by: Ben Warren --- net/eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/eth.c b/net/eth.c index 45e4a26d6..83d559c12 100644 --- a/net/eth.c +++ b/net/eth.c @@ -60,6 +60,8 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr) return eth_getenv_enetaddr(enetvar, enetaddr); } +#ifdef CONFIG_NET_MULTI + static int eth_mac_skip(int index) { char enetvar[15]; @@ -68,8 +70,6 @@ static int eth_mac_skip(int index) return ((skip_state = getenv(enetvar)) != NULL); } -#ifdef CONFIG_NET_MULTI - /* * CPU and board-specific Ethernet initializations. Aliased function * signals caller to move on