[U-Boot] [PATCH/RFC] net: defragment IP packets

Robin Getz rgetz at blackfin.uclinux.org
Mon Jul 27 13:41:49 CEST 2009


On Fri 24 Jul 2009 04:04, Alessandro Rubini pondered:
[snip]
> +/* This only reassembles fragments that come in proper order */
> +static inline IP_t *NetDefragment(IP_t *ip, int *lenp)
> +{
> +	static uchar pkt_buff[16384]; /*temporary arbitrary limit */
> +	static int next_fragment;
> +	static ushort pkt_id;
[snip]
> +	/* further fragment: skip ip header (we miss offset_of...) */
> +	memcpy(pkt_buff + next_fragment, pkt, len);
> +	next_fragment += len;

Also (forgot last night) - we need to make sure the length of the packet fits 
in the reassembly buffer before you do the memcpy(). Setting the tftp block 
size to 16384 is bad if the buffer is also set to 16384.. (since it has the 
IP header on it)...

-Robin


More information about the U-Boot mailing list