diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-31 16:24:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-31 16:24:56 -0500 |
commit | a5e3c2aae23a3719105c1ae662c67ef282f213db (patch) | |
tree | f951e78782757dfc2d4b7015601f65101ac2ef73 /net/batman-adv | |
parent | 6b28ff3be829a851378551245fd6b3f9bf93b0ad (diff) | |
parent | 091b948306d2628320e77977eb7ae4a757b12180 (diff) |
Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-merge
Diffstat (limited to 'net/batman-adv')
39 files changed, 93 insertions, 94 deletions
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile index d936aeccd194..2de93d00631b 100644 --- a/net/batman-adv/Makefile +++ b/net/batman-adv/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | # | 1 | # |
2 | # Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | # Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | # | 3 | # |
4 | # Marek Lindner, Simon Wunderlich | 4 | # Marek Lindner, Simon Wunderlich |
5 | # | 5 | # |
diff --git a/net/batman-adv/aggregation.c b/net/batman-adv/aggregation.c index 3850a3ecf947..1997725a243b 100644 --- a/net/batman-adv/aggregation.c +++ b/net/batman-adv/aggregation.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/aggregation.h b/net/batman-adv/aggregation.h index 71a91b3da913..6ce305b40017 100644 --- a/net/batman-adv/aggregation.h +++ b/net/batman-adv/aggregation.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 0ae81d07f102..0e9d43509935 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
@@ -52,7 +52,6 @@ static void emit_log_char(struct debug_log *debug_log, char c) | |||
52 | 52 | ||
53 | static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) | 53 | static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) |
54 | { | 54 | { |
55 | int printed_len; | ||
56 | va_list args; | 55 | va_list args; |
57 | static char debug_log_buf[256]; | 56 | static char debug_log_buf[256]; |
58 | char *p; | 57 | char *p; |
@@ -62,8 +61,7 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) | |||
62 | 61 | ||
63 | spin_lock_bh(&debug_log->lock); | 62 | spin_lock_bh(&debug_log->lock); |
64 | va_start(args, fmt); | 63 | va_start(args, fmt); |
65 | printed_len = vscnprintf(debug_log_buf, sizeof(debug_log_buf), | 64 | vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, args); |
66 | fmt, args); | ||
67 | va_end(args); | 65 | va_end(args); |
68 | 66 | ||
69 | for (p = debug_log_buf; *p != 0; p++) | 67 | for (p = debug_log_buf; *p != 0; p++) |
diff --git a/net/batman-adv/bat_debugfs.h b/net/batman-adv/bat_debugfs.h index 72df532b7d5f..bc9cda3f01e1 100644 --- a/net/batman-adv/bat_debugfs.h +++ b/net/batman-adv/bat_debugfs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index cd7bb51825f1..f7b93a0805fe 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/bat_sysfs.h b/net/batman-adv/bat_sysfs.h index 7f186c007b4f..02f1fa7aadfa 100644 --- a/net/batman-adv/bat_sysfs.h +++ b/net/batman-adv/bat_sysfs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index bbcd8f744cdd..ad2ca925b3e0 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Simon Wunderlich, Marek Lindner | 4 | * Simon Wunderlich, Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index ac54017601b1..769c246d1fc1 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Simon Wunderlich, Marek Lindner | 4 | * Simon Wunderlich, Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 0065ffb8d96d..429a013d2e0a 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h index 4585e6549844..2aa439124ee3 100644 --- a/net/batman-adv/gateway_client.h +++ b/net/batman-adv/gateway_client.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index b962982f017e..50d3a59a3d73 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h index 5e728d0b7959..55e527a489fe 100644 --- a/net/batman-adv/gateway_common.h +++ b/net/batman-adv/gateway_common.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 4f95777ce080..f2131f45aa9b 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -34,6 +34,12 @@ | |||
34 | /* protect update critical side of if_list - but not the content */ | 34 | /* protect update critical side of if_list - but not the content */ |
35 | static DEFINE_SPINLOCK(if_list_lock); | 35 | static DEFINE_SPINLOCK(if_list_lock); |
36 | 36 | ||
37 | |||
38 | static int batman_skb_recv(struct sk_buff *skb, | ||
39 | struct net_device *dev, | ||
40 | struct packet_type *ptype, | ||
41 | struct net_device *orig_dev); | ||
42 | |||
37 | static void hardif_free_rcu(struct rcu_head *rcu) | 43 | static void hardif_free_rcu(struct rcu_head *rcu) |
38 | { | 44 | { |
39 | struct batman_if *batman_if; | 45 | struct batman_if *batman_if; |
@@ -549,8 +555,9 @@ out: | |||
549 | 555 | ||
550 | /* receive a packet with the batman ethertype coming on a hard | 556 | /* receive a packet with the batman ethertype coming on a hard |
551 | * interface */ | 557 | * interface */ |
552 | int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, | 558 | static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, |
553 | struct packet_type *ptype, struct net_device *orig_dev) | 559 | struct packet_type *ptype, |
560 | struct net_device *orig_dev) | ||
554 | { | 561 | { |
555 | struct bat_priv *bat_priv; | 562 | struct bat_priv *bat_priv; |
556 | struct batman_packet *batman_packet; | 563 | struct batman_packet *batman_packet; |
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 30ec3b8db459..ad195438428a 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -35,10 +35,6 @@ struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev); | |||
35 | int hardif_enable_interface(struct batman_if *batman_if, char *iface_name); | 35 | int hardif_enable_interface(struct batman_if *batman_if, char *iface_name); |
36 | void hardif_disable_interface(struct batman_if *batman_if); | 36 | void hardif_disable_interface(struct batman_if *batman_if); |
37 | void hardif_remove_interfaces(void); | 37 | void hardif_remove_interfaces(void); |
38 | int batman_skb_recv(struct sk_buff *skb, | ||
39 | struct net_device *dev, | ||
40 | struct packet_type *ptype, | ||
41 | struct net_device *orig_dev); | ||
42 | int hardif_min_mtu(struct net_device *soft_iface); | 38 | int hardif_min_mtu(struct net_device *soft_iface); |
43 | void update_min_mtu(struct net_device *soft_iface); | 39 | void update_min_mtu(struct net_device *soft_iface); |
44 | 40 | ||
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index 26e623eb9def..fa2693973ab8 100644 --- a/net/batman-adv/hash.c +++ b/net/batman-adv/hash.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Simon Wunderlich, Marek Lindner | 4 | * Simon Wunderlich, Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 09216ade16f1..eae24402fd0a 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Simon Wunderlich, Marek Lindner | 4 | * Simon Wunderlich, Marek Lindner |
5 | * | 5 | * |
@@ -49,11 +49,6 @@ struct hashtable_t { | |||
49 | /* allocates and clears the hash */ | 49 | /* allocates and clears the hash */ |
50 | struct hashtable_t *hash_new(int size); | 50 | struct hashtable_t *hash_new(int size); |
51 | 51 | ||
52 | /* remove element if you already found the element you want to delete and don't | ||
53 | * need the overhead to find it again with hash_remove(). But usually, you | ||
54 | * don't want to use this function, as it fiddles with hash-internals. */ | ||
55 | void *hash_remove_element(struct hashtable_t *hash, struct element_t *elem); | ||
56 | |||
57 | /* free only the hashtable and the hash itself. */ | 52 | /* free only the hashtable and the hash itself. */ |
58 | void hash_destroy(struct hashtable_t *hash); | 53 | void hash_destroy(struct hashtable_t *hash); |
59 | 54 | ||
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index ecf6d7ffab2e..5e86d6f0c0fb 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/icmp_socket.h b/net/batman-adv/icmp_socket.h index bf9b348cde27..08b185959501 100644 --- a/net/batman-adv/icmp_socket.h +++ b/net/batman-adv/icmp_socket.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index b827f6a158cb..dc9248d9ea5f 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 65106fb61b8f..e235d7bbe045 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -22,9 +22,6 @@ | |||
22 | #ifndef _NET_BATMAN_ADV_MAIN_H_ | 22 | #ifndef _NET_BATMAN_ADV_MAIN_H_ |
23 | #define _NET_BATMAN_ADV_MAIN_H_ | 23 | #define _NET_BATMAN_ADV_MAIN_H_ |
24 | 24 | ||
25 | /* Kernel Programming */ | ||
26 | #define LINUX | ||
27 | |||
28 | #define DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, " \ | 25 | #define DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, " \ |
29 | "Simon Wunderlich <siwu@hrz.tu-chemnitz.de>" | 26 | "Simon Wunderlich <siwu@hrz.tu-chemnitz.de>" |
30 | #define DRIVER_DESC "B.A.T.M.A.N. advanced" | 27 | #define DRIVER_DESC "B.A.T.M.A.N. advanced" |
@@ -54,7 +51,6 @@ | |||
54 | 51 | ||
55 | #define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE) | 52 | #define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE) |
56 | 53 | ||
57 | #define PACKBUFF_SIZE 2000 | ||
58 | #define LOG_BUF_LEN 8192 /* has to be a power of 2 */ | 54 | #define LOG_BUF_LEN 8192 /* has to be a power of 2 */ |
59 | 55 | ||
60 | #define VIS_INTERVAL 5000 /* 5 seconds */ | 56 | #define VIS_INTERVAL 5000 /* 5 seconds */ |
@@ -96,15 +92,11 @@ | |||
96 | #define DBG_ROUTES 2 /* route or hna added / changed / deleted */ | 92 | #define DBG_ROUTES 2 /* route or hna added / changed / deleted */ |
97 | #define DBG_ALL 3 | 93 | #define DBG_ALL 3 |
98 | 94 | ||
99 | #define LOG_BUF_LEN 8192 /* has to be a power of 2 */ | ||
100 | |||
101 | 95 | ||
102 | /* | 96 | /* |
103 | * Vis | 97 | * Vis |
104 | */ | 98 | */ |
105 | 99 | ||
106 | /* #define VIS_SUBCLUSTERS_DISABLED */ | ||
107 | |||
108 | /* | 100 | /* |
109 | * Kernel headers | 101 | * Kernel headers |
110 | */ | 102 | */ |
@@ -158,13 +150,6 @@ static inline void bat_dbg(char type __always_unused, | |||
158 | } | 150 | } |
159 | #endif | 151 | #endif |
160 | 152 | ||
161 | #define bat_warning(net_dev, fmt, arg...) \ | ||
162 | do { \ | ||
163 | struct net_device *_netdev = (net_dev); \ | ||
164 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ | ||
165 | bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ | ||
166 | pr_warning("%s: " fmt, _netdev->name, ## arg); \ | ||
167 | } while (0) | ||
168 | #define bat_info(net_dev, fmt, arg...) \ | 153 | #define bat_info(net_dev, fmt, arg...) \ |
169 | do { \ | 154 | do { \ |
170 | struct net_device *_netdev = (net_dev); \ | 155 | struct net_device *_netdev = (net_dev); \ |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 6b7fb6b7e6f9..54863c9385de 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -247,7 +247,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv, | |||
247 | orig_node->hna_buff_len); | 247 | orig_node->hna_buff_len); |
248 | /* update bonding candidates, we could have lost | 248 | /* update bonding candidates, we could have lost |
249 | * some candidates. */ | 249 | * some candidates. */ |
250 | update_bonding_candidates(bat_priv, orig_node); | 250 | update_bonding_candidates(orig_node); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index d474ceb2a4eb..8019fbddffd0 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index 2284e8129cb2..e7571879af3f 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -50,6 +50,7 @@ | |||
50 | 50 | ||
51 | /* fragmentation defines */ | 51 | /* fragmentation defines */ |
52 | #define UNI_FRAG_HEAD 0x01 | 52 | #define UNI_FRAG_HEAD 0x01 |
53 | #define UNI_FRAG_LARGETAIL 0x02 | ||
53 | 54 | ||
54 | struct batman_packet { | 55 | struct batman_packet { |
55 | uint8_t packet_type; | 56 | uint8_t packet_type; |
diff --git a/net/batman-adv/ring_buffer.c b/net/batman-adv/ring_buffer.c index defd37c9be1f..5bb6a619afee 100644 --- a/net/batman-adv/ring_buffer.c +++ b/net/batman-adv/ring_buffer.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/ring_buffer.h b/net/batman-adv/ring_buffer.h index 6b0cb9aaeba5..0395b2741864 100644 --- a/net/batman-adv/ring_buffer.h +++ b/net/batman-adv/ring_buffer.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 8828eddd3f72..028f73967b00 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -433,8 +433,7 @@ static char count_real_packets(struct ethhdr *ethhdr, | |||
433 | } | 433 | } |
434 | 434 | ||
435 | /* copy primary address for bonding */ | 435 | /* copy primary address for bonding */ |
436 | static void mark_bonding_address(struct bat_priv *bat_priv, | 436 | static void mark_bonding_address(struct orig_node *orig_node, |
437 | struct orig_node *orig_node, | ||
438 | struct orig_node *orig_neigh_node, | 437 | struct orig_node *orig_neigh_node, |
439 | struct batman_packet *batman_packet) | 438 | struct batman_packet *batman_packet) |
440 | 439 | ||
@@ -447,8 +446,7 @@ static void mark_bonding_address(struct bat_priv *bat_priv, | |||
447 | } | 446 | } |
448 | 447 | ||
449 | /* mark possible bond.candidates in the neighbor list */ | 448 | /* mark possible bond.candidates in the neighbor list */ |
450 | void update_bonding_candidates(struct bat_priv *bat_priv, | 449 | void update_bonding_candidates(struct orig_node *orig_node) |
451 | struct orig_node *orig_node) | ||
452 | { | 450 | { |
453 | int candidates; | 451 | int candidates; |
454 | int interference_candidate; | 452 | int interference_candidate; |
@@ -730,9 +728,8 @@ void receive_bat_packet(struct ethhdr *ethhdr, | |||
730 | update_orig(bat_priv, orig_node, ethhdr, batman_packet, | 728 | update_orig(bat_priv, orig_node, ethhdr, batman_packet, |
731 | if_incoming, hna_buff, hna_buff_len, is_duplicate); | 729 | if_incoming, hna_buff, hna_buff_len, is_duplicate); |
732 | 730 | ||
733 | mark_bonding_address(bat_priv, orig_node, | 731 | mark_bonding_address(orig_node, orig_neigh_node, batman_packet); |
734 | orig_neigh_node, batman_packet); | 732 | update_bonding_candidates(orig_node); |
735 | update_bonding_candidates(bat_priv, orig_node); | ||
736 | 733 | ||
737 | /* is single hop (direct) neighbor */ | 734 | /* is single hop (direct) neighbor */ |
738 | if (is_single_hop_neigh) { | 735 | if (is_single_hop_neigh) { |
@@ -810,13 +807,11 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv, | |||
810 | { | 807 | { |
811 | struct orig_node *orig_node; | 808 | struct orig_node *orig_node; |
812 | struct icmp_packet_rr *icmp_packet; | 809 | struct icmp_packet_rr *icmp_packet; |
813 | struct ethhdr *ethhdr; | ||
814 | struct batman_if *batman_if; | 810 | struct batman_if *batman_if; |
815 | int ret; | 811 | int ret; |
816 | uint8_t dstaddr[ETH_ALEN]; | 812 | uint8_t dstaddr[ETH_ALEN]; |
817 | 813 | ||
818 | icmp_packet = (struct icmp_packet_rr *)skb->data; | 814 | icmp_packet = (struct icmp_packet_rr *)skb->data; |
819 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | ||
820 | 815 | ||
821 | /* add data to device queue */ | 816 | /* add data to device queue */ |
822 | if (icmp_packet->msg_type != ECHO_REQUEST) { | 817 | if (icmp_packet->msg_type != ECHO_REQUEST) { |
@@ -848,7 +843,6 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv, | |||
848 | return NET_RX_DROP; | 843 | return NET_RX_DROP; |
849 | 844 | ||
850 | icmp_packet = (struct icmp_packet_rr *)skb->data; | 845 | icmp_packet = (struct icmp_packet_rr *)skb->data; |
851 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | ||
852 | 846 | ||
853 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); | 847 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); |
854 | memcpy(icmp_packet->orig, | 848 | memcpy(icmp_packet->orig, |
@@ -866,17 +860,15 @@ static int recv_my_icmp_packet(struct bat_priv *bat_priv, | |||
866 | } | 860 | } |
867 | 861 | ||
868 | static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, | 862 | static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, |
869 | struct sk_buff *skb, size_t icmp_len) | 863 | struct sk_buff *skb) |
870 | { | 864 | { |
871 | struct orig_node *orig_node; | 865 | struct orig_node *orig_node; |
872 | struct icmp_packet *icmp_packet; | 866 | struct icmp_packet *icmp_packet; |
873 | struct ethhdr *ethhdr; | ||
874 | struct batman_if *batman_if; | 867 | struct batman_if *batman_if; |
875 | int ret; | 868 | int ret; |
876 | uint8_t dstaddr[ETH_ALEN]; | 869 | uint8_t dstaddr[ETH_ALEN]; |
877 | 870 | ||
878 | icmp_packet = (struct icmp_packet *)skb->data; | 871 | icmp_packet = (struct icmp_packet *)skb->data; |
879 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | ||
880 | 872 | ||
881 | /* send TTL exceeded if packet is an echo request (traceroute) */ | 873 | /* send TTL exceeded if packet is an echo request (traceroute) */ |
882 | if (icmp_packet->msg_type != ECHO_REQUEST) { | 874 | if (icmp_packet->msg_type != ECHO_REQUEST) { |
@@ -909,7 +901,6 @@ static int recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, | |||
909 | return NET_RX_DROP; | 901 | return NET_RX_DROP; |
910 | 902 | ||
911 | icmp_packet = (struct icmp_packet *) skb->data; | 903 | icmp_packet = (struct icmp_packet *) skb->data; |
912 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | ||
913 | 904 | ||
914 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); | 905 | memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); |
915 | memcpy(icmp_packet->orig, | 906 | memcpy(icmp_packet->orig, |
@@ -978,7 +969,7 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if) | |||
978 | 969 | ||
979 | /* TTL exceeded */ | 970 | /* TTL exceeded */ |
980 | if (icmp_packet->ttl < 2) | 971 | if (icmp_packet->ttl < 2) |
981 | return recv_icmp_ttl_exceeded(bat_priv, skb, hdr_size); | 972 | return recv_icmp_ttl_exceeded(bat_priv, skb); |
982 | 973 | ||
983 | ret = NET_RX_DROP; | 974 | ret = NET_RX_DROP; |
984 | 975 | ||
@@ -1001,7 +992,6 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if) | |||
1001 | return NET_RX_DROP; | 992 | return NET_RX_DROP; |
1002 | 993 | ||
1003 | icmp_packet = (struct icmp_packet_rr *)skb->data; | 994 | icmp_packet = (struct icmp_packet_rr *)skb->data; |
1004 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | ||
1005 | 995 | ||
1006 | /* decrement ttl */ | 996 | /* decrement ttl */ |
1007 | icmp_packet->ttl--; | 997 | icmp_packet->ttl--; |
@@ -1193,7 +1183,7 @@ int route_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if, | |||
1193 | dstaddr); | 1183 | dstaddr); |
1194 | 1184 | ||
1195 | if (unicast_packet->packet_type == BAT_UNICAST_FRAG && | 1185 | if (unicast_packet->packet_type == BAT_UNICAST_FRAG && |
1196 | 2 * skb->len - hdr_size <= batman_if->net_dev->mtu) { | 1186 | frag_can_reassemble(skb, batman_if->net_dev->mtu)) { |
1197 | 1187 | ||
1198 | ret = frag_reassemble_skb(skb, bat_priv, &new_skb); | 1188 | ret = frag_reassemble_skb(skb, bat_priv, &new_skb); |
1199 | 1189 | ||
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h index f108f230bfdb..ceeca6f6ad16 100644 --- a/net/batman-adv/routing.h +++ b/net/batman-adv/routing.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -42,7 +42,6 @@ int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if); | |||
42 | int recv_bat_packet(struct sk_buff *skb, struct batman_if *recv_if); | 42 | int recv_bat_packet(struct sk_buff *skb, struct batman_if *recv_if); |
43 | struct neigh_node *find_router(struct bat_priv *bat_priv, | 43 | struct neigh_node *find_router(struct bat_priv *bat_priv, |
44 | struct orig_node *orig_node, struct batman_if *recv_if); | 44 | struct orig_node *orig_node, struct batman_if *recv_if); |
45 | void update_bonding_candidates(struct bat_priv *bat_priv, | 45 | void update_bonding_candidates(struct orig_node *orig_node); |
46 | struct orig_node *orig_node); | ||
47 | 46 | ||
48 | #endif /* _NET_BATMAN_ADV_ROUTING_H_ */ | 47 | #endif /* _NET_BATMAN_ADV_ROUTING_H_ */ |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index b89b9f7709ae..7cc620e8aa1e 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
@@ -49,7 +49,7 @@ static unsigned long own_send_time(struct bat_priv *bat_priv) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | /* when do we schedule a forwarded packet to be sent */ | 51 | /* when do we schedule a forwarded packet to be sent */ |
52 | static unsigned long forward_send_time(struct bat_priv *bat_priv) | 52 | static unsigned long forward_send_time(void) |
53 | { | 53 | { |
54 | return jiffies + msecs_to_jiffies(random32() % (JITTER/2)); | 54 | return jiffies + msecs_to_jiffies(random32() % (JITTER/2)); |
55 | } | 55 | } |
@@ -356,7 +356,7 @@ void schedule_forward_packet(struct orig_node *orig_node, | |||
356 | else | 356 | else |
357 | batman_packet->flags &= ~DIRECTLINK; | 357 | batman_packet->flags &= ~DIRECTLINK; |
358 | 358 | ||
359 | send_time = forward_send_time(bat_priv); | 359 | send_time = forward_send_time(); |
360 | add_bat_packet_to_list(bat_priv, | 360 | add_bat_packet_to_list(bat_priv, |
361 | (unsigned char *)batman_packet, | 361 | (unsigned char *)batman_packet, |
362 | sizeof(struct batman_packet) + hna_buff_len, | 362 | sizeof(struct batman_packet) + hna_buff_len, |
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h index c4cefa8e4f85..bc53adede58d 100644 --- a/net/batman-adv/send.h +++ b/net/batman-adv/send.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index e89ede192ed0..145e0f782923 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h index 02b77334d10d..e7b0e1a34a55 100644 --- a/net/batman-adv/soft-interface.h +++ b/net/batman-adv/soft-interface.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner | 4 | * Marek Lindner |
5 | * | 5 | * |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index a633b5a435e2..f6917dde42ce 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index 10c4c5c319b6..a4f3a37fd6ed 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index bf3f6f5a12c4..7270405046e9 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Marek Lindner, Simon Wunderlich | 4 | * Marek Lindner, Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index ee41fef04b21..cbf022cb3121 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Andreas Langer | 4 | * Andreas Langer |
5 | * | 5 | * |
@@ -224,7 +224,8 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
224 | struct unicast_frag_packet *frag1, *frag2; | 224 | struct unicast_frag_packet *frag1, *frag2; |
225 | int uc_hdr_len = sizeof(struct unicast_packet); | 225 | int uc_hdr_len = sizeof(struct unicast_packet); |
226 | int ucf_hdr_len = sizeof(struct unicast_frag_packet); | 226 | int ucf_hdr_len = sizeof(struct unicast_frag_packet); |
227 | int data_len = skb->len; | 227 | int data_len = skb->len - uc_hdr_len; |
228 | int large_tail = 0; | ||
228 | 229 | ||
229 | if (!bat_priv->primary_if) | 230 | if (!bat_priv->primary_if) |
230 | goto dropped; | 231 | goto dropped; |
@@ -232,10 +233,11 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
232 | frag_skb = dev_alloc_skb(data_len - (data_len / 2) + ucf_hdr_len); | 233 | frag_skb = dev_alloc_skb(data_len - (data_len / 2) + ucf_hdr_len); |
233 | if (!frag_skb) | 234 | if (!frag_skb) |
234 | goto dropped; | 235 | goto dropped; |
236 | skb_reserve(frag_skb, ucf_hdr_len); | ||
235 | 237 | ||
236 | unicast_packet = (struct unicast_packet *) skb->data; | 238 | unicast_packet = (struct unicast_packet *) skb->data; |
237 | memcpy(&tmp_uc, unicast_packet, uc_hdr_len); | 239 | memcpy(&tmp_uc, unicast_packet, uc_hdr_len); |
238 | skb_split(skb, frag_skb, data_len / 2); | 240 | skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len); |
239 | 241 | ||
240 | if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 || | 242 | if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 || |
241 | my_skb_head_push(frag_skb, ucf_hdr_len) < 0) | 243 | my_skb_head_push(frag_skb, ucf_hdr_len) < 0) |
@@ -253,8 +255,11 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
253 | memcpy(frag1->orig, bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); | 255 | memcpy(frag1->orig, bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); |
254 | memcpy(frag2, frag1, sizeof(struct unicast_frag_packet)); | 256 | memcpy(frag2, frag1, sizeof(struct unicast_frag_packet)); |
255 | 257 | ||
256 | frag1->flags |= UNI_FRAG_HEAD; | 258 | if (data_len & 1) |
257 | frag2->flags &= ~UNI_FRAG_HEAD; | 259 | large_tail = UNI_FRAG_LARGETAIL; |
260 | |||
261 | frag1->flags = UNI_FRAG_HEAD | large_tail; | ||
262 | frag2->flags = large_tail; | ||
258 | 263 | ||
259 | frag1->seqno = htons((uint16_t)atomic_inc_return( | 264 | frag1->seqno = htons((uint16_t)atomic_inc_return( |
260 | &batman_if->frag_seqno)); | 265 | &batman_if->frag_seqno)); |
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h index e32b7867a9a4..8897308281d4 100644 --- a/net/batman-adv/unicast.h +++ b/net/batman-adv/unicast.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Andreas Langer | 4 | * Andreas Langer |
5 | * | 5 | * |
@@ -22,6 +22,8 @@ | |||
22 | #ifndef _NET_BATMAN_ADV_UNICAST_H_ | 22 | #ifndef _NET_BATMAN_ADV_UNICAST_H_ |
23 | #define _NET_BATMAN_ADV_UNICAST_H_ | 23 | #define _NET_BATMAN_ADV_UNICAST_H_ |
24 | 24 | ||
25 | #include "packet.h" | ||
26 | |||
25 | #define FRAG_TIMEOUT 10000 /* purge frag list entrys after time in ms */ | 27 | #define FRAG_TIMEOUT 10000 /* purge frag list entrys after time in ms */ |
26 | #define FRAG_BUFFER_SIZE 6 /* number of list elements in buffer */ | 28 | #define FRAG_BUFFER_SIZE 6 /* number of list elements in buffer */ |
27 | 29 | ||
@@ -32,4 +34,25 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv); | |||
32 | int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | 34 | int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, |
33 | struct batman_if *batman_if, uint8_t dstaddr[]); | 35 | struct batman_if *batman_if, uint8_t dstaddr[]); |
34 | 36 | ||
37 | static inline int frag_can_reassemble(struct sk_buff *skb, int mtu) | ||
38 | { | ||
39 | struct unicast_frag_packet *unicast_packet; | ||
40 | int uneven_correction = 0; | ||
41 | unsigned int merged_size; | ||
42 | |||
43 | unicast_packet = (struct unicast_frag_packet *)skb->data; | ||
44 | |||
45 | if (unicast_packet->flags & UNI_FRAG_LARGETAIL) { | ||
46 | if (unicast_packet->flags & UNI_FRAG_HEAD) | ||
47 | uneven_correction = 1; | ||
48 | else | ||
49 | uneven_correction = -1; | ||
50 | } | ||
51 | |||
52 | merged_size = (skb->len - sizeof(struct unicast_frag_packet)) * 2; | ||
53 | merged_size += sizeof(struct unicast_packet) + uneven_correction; | ||
54 | |||
55 | return merged_size <= mtu; | ||
56 | } | ||
57 | |||
35 | #endif /* _NET_BATMAN_ADV_UNICAST_H_ */ | 58 | #endif /* _NET_BATMAN_ADV_UNICAST_H_ */ |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index de1022cacaf7..7db9ad82cc00 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2008-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2008-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Simon Wunderlich | 4 | * Simon Wunderlich |
5 | * | 5 | * |
diff --git a/net/batman-adv/vis.h b/net/batman-adv/vis.h index 2c3b33089a9b..31b820d07f23 100644 --- a/net/batman-adv/vis.h +++ b/net/batman-adv/vis.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2008-2010 B.A.T.M.A.N. contributors: | 2 | * Copyright (C) 2008-2011 B.A.T.M.A.N. contributors: |
3 | * | 3 | * |
4 | * Simon Wunderlich, Marek Lindner | 4 | * Simon Wunderlich, Marek Lindner |
5 | * | 5 | * |