The following commit has been merged in the master branch: commit fe0d8b59979ef17adfbe858241320880da0647cb Author: Sven Eckelmann sven@narfation.org Date: Tue Jan 25 22:02:31 2011 +0100
batman-adv: Calculate correct size for merged packets
The routing algorithm must be able to decide if a fragment can be merged with the missing part and still be passed to a forwarding interface. The fragments can only differ by one byte in case that the original payload had an uneven length. In that situation the sender has to inform all possible receivers that the tail is one byte longer using the flag UNI_FRAG_LARGETAIL.
The combination of UNI_FRAG_LARGETAIL and UNI_FRAG_HEAD flag makes it possible to calculate the correct length for even and uneven sized payloads.
The original formula missed to add the unicast header at all and forgot to remove the fragment header of the second fragment. This made the results highly unreliable and only useful for machines with large differences between the configured MTUs.
Reported-by: Russell Senior russell@personaltelco.net Reported-by: Marek Lindner lindner_marek@yahoo.de Signed-off-by: Sven Eckelmann sven@narfation.org
diff --git a/packet.h b/packet.h index 2284e81..03ce0d3 100644 --- a/packet.h +++ b/packet.h @@ -50,6 +50,7 @@
/* fragmentation defines */ #define UNI_FRAG_HEAD 0x01 +#define UNI_FRAG_LARGETAIL 0x02
struct batman_packet { uint8_t packet_type;