summaryrefslogtreecommitdiff
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2011-01-25 22:02:31 +0000
committerSven Eckelmann <sven@narfation.org>2011-01-31 14:57:08 +0100
commitae361ce19fa135035c6b83ac1f07090b72fd4b8f (patch)
tree00410704b2dd5f0d7310f5cb9796385d7e8b7e91 /net/batman-adv/routing.c
parent5c77d8bb8aeb4ec6804b6c32061109ba2ea6988d (diff)
downloadlinux-3.10-ae361ce19fa135035c6b83ac1f07090b72fd4b8f.tar.gz
linux-3.10-ae361ce19fa135035c6b83ac1f07090b72fd4b8f.tar.bz2
linux-3.10-ae361ce19fa135035c6b83ac1f07090b72fd4b8f.zip
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>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 8828eddd3f7..a8cd3897b7d 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1193,7 +1193,7 @@ int route_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if,
dstaddr);
if (unicast_packet->packet_type == BAT_UNICAST_FRAG &&
- 2 * skb->len - hdr_size <= batman_if->net_dev->mtu) {
+ frag_can_reassemble(skb, batman_if->net_dev->mtu)) {
ret = frag_reassemble_skb(skb, bat_priv, &new_skb);