]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: batman-adv: fragment forwarded packets
authorAndreas Langer <an.langer@gmx.de>
Sun, 21 Nov 2010 23:55:49 +0000 (00:55 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 29 Nov 2010 19:09:10 +0000 (11:09 -0800)
If a packet is too big to be forwarded over an interface it will be
fragmented on-the-fly (if fragmentation is enabled).

Signed-off-by: Andreas Langer <an.langer@gmx.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/batman-adv/routing.c
drivers/staging/batman-adv/unicast.c
drivers/staging/batman-adv/unicast.h

index 9b61d6bc37d62f4ea0faaf5511d86b057920f6de..1e101113b6ff4a81193e60803f445cb2fab080bd 100644 (file)
@@ -1165,6 +1165,12 @@ static int route_unicast_packet(struct sk_buff *skb,
 
        unicast_packet = (struct unicast_packet *)skb->data;
 
+       if (unicast_packet->packet_type == BAT_UNICAST &&
+           atomic_read(&bat_priv->frag_enabled) &&
+           skb->len > batman_if->net_dev->mtu)
+               return frag_send_skb(skb, bat_priv, batman_if,
+                                    dstaddr);
+
        /* decrement ttl */
        unicast_packet->ttl--;
 
index 57fe2de627a18615ec57bcd63c8bfbecb88d9435..12afae618ce232cf7be8b8ea1375260ca5722e53 100644 (file)
@@ -206,8 +206,8 @@ out:
        return ret;
 }
 
-static int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
-                        struct batman_if *batman_if, uint8_t dstaddr[])
+int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
+                 struct batman_if *batman_if, uint8_t dstaddr[])
 {
        struct unicast_packet tmp_uc, *unicast_packet;
        struct sk_buff *frag_skb;
index 5908b01fb1c5d538cd3d0e656bd67bbce5b6d360..e32b7867a9a4a08828cb534b7e7e76b7777da74b 100644 (file)
@@ -29,5 +29,7 @@ int frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
                        struct sk_buff **new_skb);
 void frag_list_free(struct list_head *head);
 int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv);
+int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
+                 struct batman_if *batman_if, uint8_t dstaddr[]);
 
 #endif /* _NET_BATMAN_ADV_UNICAST_H_ */