aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-02-28 15:07:52 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-28 15:07:52 -0500
commit0695512a57a8ad5c0495b2a3b23b3216434e3f92 (patch)
treedcf2cfb60274bcb9428d9ca054bb916f388ba2dc /net/batman-adv
parent5bd49735db39c1c1360cb91b1f1e1c999d90eb94 (diff)
parent7c64fd98ce512de6c6dae0452dc026446bd368d5 (diff)
Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/Makefile2
-rw-r--r--net/batman-adv/bat_algo.h2
-rw-r--r--net/batman-adv/bat_debugfs.c2
-rw-r--r--net/batman-adv/bat_debugfs.h2
-rw-r--r--net/batman-adv/bat_iv_ogm.c2
-rw-r--r--net/batman-adv/bat_sysfs.c6
-rw-r--r--net/batman-adv/bat_sysfs.h2
-rw-r--r--net/batman-adv/bitarray.c10
-rw-r--r--net/batman-adv/bitarray.h2
-rw-r--r--net/batman-adv/gateway_client.c6
-rw-r--r--net/batman-adv/gateway_client.h2
-rw-r--r--net/batman-adv/gateway_common.c6
-rw-r--r--net/batman-adv/gateway_common.h2
-rw-r--r--net/batman-adv/hard-interface.c32
-rw-r--r--net/batman-adv/hard-interface.h2
-rw-r--r--net/batman-adv/hash.c2
-rw-r--r--net/batman-adv/hash.h2
-rw-r--r--net/batman-adv/icmp_socket.c2
-rw-r--r--net/batman-adv/icmp_socket.h2
-rw-r--r--net/batman-adv/main.c2
-rw-r--r--net/batman-adv/main.h17
-rw-r--r--net/batman-adv/originator.c18
-rw-r--r--net/batman-adv/originator.h2
-rw-r--r--net/batman-adv/packet.h2
-rw-r--r--net/batman-adv/ring_buffer.c2
-rw-r--r--net/batman-adv/ring_buffer.h2
-rw-r--r--net/batman-adv/routing.c13
-rw-r--r--net/batman-adv/routing.h2
-rw-r--r--net/batman-adv/send.c2
-rw-r--r--net/batman-adv/send.h2
-rw-r--r--net/batman-adv/soft-interface.c6
-rw-r--r--net/batman-adv/soft-interface.h2
-rw-r--r--net/batman-adv/translation-table.c119
-rw-r--r--net/batman-adv/translation-table.h2
-rw-r--r--net/batman-adv/types.h2
-rw-r--r--net/batman-adv/unicast.c2
-rw-r--r--net/batman-adv/unicast.h2
-rw-r--r--net/batman-adv/vis.c5
-rw-r--r--net/batman-adv/vis.h5
39 files changed, 141 insertions, 156 deletions
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile
index ce6861166499..4e392ebedb64 100644
--- a/net/batman-adv/Makefile
+++ b/net/batman-adv/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2# Copyright (C) 2007-2012 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_algo.h b/net/batman-adv/bat_algo.h
index 755379fd367d..9852a688ba43 100644
--- a/net/batman-adv/bat_algo.h
+++ b/net/batman-adv/bat_algo.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2011-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner 4 * Marek Lindner
5 * 5 *
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index a7a393eeb935..c3b0548b175d 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner 4 * Marek Lindner
5 * 5 *
diff --git a/net/batman-adv/bat_debugfs.h b/net/batman-adv/bat_debugfs.h
index bc9cda3f01e1..d605c6746428 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner 4 * Marek Lindner
5 * 5 *
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 1c483a5dd808..2b66daef1ef6 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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_sysfs.c b/net/batman-adv/bat_sysfs.c
index 480ae0a5ba43..b00101db5cc6 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner 4 * Marek Lindner
5 * 5 *
@@ -321,11 +321,11 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,
321 gw_mode_tmp = GW_MODE_OFF; 321 gw_mode_tmp = GW_MODE_OFF;
322 322
323 if (strncmp(buff, GW_MODE_CLIENT_NAME, 323 if (strncmp(buff, GW_MODE_CLIENT_NAME,
324 strlen(GW_MODE_CLIENT_NAME)) == 0) 324 strlen(GW_MODE_CLIENT_NAME)) == 0)
325 gw_mode_tmp = GW_MODE_CLIENT; 325 gw_mode_tmp = GW_MODE_CLIENT;
326 326
327 if (strncmp(buff, GW_MODE_SERVER_NAME, 327 if (strncmp(buff, GW_MODE_SERVER_NAME,
328 strlen(GW_MODE_SERVER_NAME)) == 0) 328 strlen(GW_MODE_SERVER_NAME)) == 0)
329 gw_mode_tmp = GW_MODE_SERVER; 329 gw_mode_tmp = GW_MODE_SERVER;
330 330
331 if (gw_mode_tmp < 0) { 331 if (gw_mode_tmp < 0) {
diff --git a/net/batman-adv/bat_sysfs.h b/net/batman-adv/bat_sysfs.h
index a3f75a723c56..fece77ae586e 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2010-2012 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 9bc63b209b3f..6d0aa216b232 100644
--- a/net/batman-adv/bitarray.c
+++ b/net/batman-adv/bitarray.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Simon Wunderlich, Marek Lindner 4 * Simon Wunderlich, Marek Lindner
5 * 5 *
@@ -154,8 +154,8 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,
154 154
155 /* sequence number is much newer, probably missed a lot of packets */ 155 /* sequence number is much newer, probably missed a lot of packets */
156 156
157 if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) 157 if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) &&
158 && (seq_num_diff < EXPECTED_SEQNO_RANGE)) { 158 (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
159 bat_dbg(DBG_BATMAN, bat_priv, 159 bat_dbg(DBG_BATMAN, bat_priv,
160 "We missed a lot of packets (%i) !\n", 160 "We missed a lot of packets (%i) !\n",
161 seq_num_diff - 1); 161 seq_num_diff - 1);
@@ -170,8 +170,8 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,
170 * packet should be dropped without calling this function if the 170 * packet should be dropped without calling this function if the
171 * seqno window is protected. */ 171 * seqno window is protected. */
172 172
173 if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) 173 if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
174 || (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { 174 (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
175 175
176 bat_dbg(DBG_BATMAN, bat_priv, 176 bat_dbg(DBG_BATMAN, bat_priv,
177 "Other host probably restarted!\n"); 177 "Other host probably restarted!\n");
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h
index 9c04422aeb07..c6135728a680 100644
--- a/net/batman-adv/bitarray.h
+++ b/net/batman-adv/bitarray.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2006-2012 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 24403a7350f7..0fa8e2d7c46e 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner 4 * Marek Lindner
5 * 5 *
@@ -396,7 +396,7 @@ void gw_node_purge(struct bat_priv *bat_priv)
396{ 396{
397 struct gw_node *gw_node, *curr_gw; 397 struct gw_node *gw_node, *curr_gw;
398 struct hlist_node *node, *node_tmp; 398 struct hlist_node *node, *node_tmp;
399 unsigned long timeout = 2 * PURGE_TIMEOUT * HZ; 399 unsigned long timeout = msecs_to_jiffies(2 * PURGE_TIMEOUT);
400 int do_deselect = 0; 400 int do_deselect = 0;
401 401
402 curr_gw = gw_get_selected_gw_node(bat_priv); 402 curr_gw = gw_get_selected_gw_node(bat_priv);
@@ -629,7 +629,7 @@ bool gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
629 629
630 /* check for bootp port */ 630 /* check for bootp port */
631 if ((ntohs(ethhdr->h_proto) == ETH_P_IP) && 631 if ((ntohs(ethhdr->h_proto) == ETH_P_IP) &&
632 (ntohs(udphdr->dest) != 67)) 632 (ntohs(udphdr->dest) != 67))
633 return false; 633 return false;
634 634
635 if ((ntohs(ethhdr->h_proto) == ETH_P_IPV6) && 635 if ((ntohs(ethhdr->h_proto) == ETH_P_IPV6) &&
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h
index e1edba08eb1d..bf56a5aea10b 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2009-2012 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 c4ac7b0a2a63..3ccb9c87fd19 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner 4 * Marek Lindner
5 * 5 *
@@ -93,7 +93,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
93 multi = 1024; 93 multi = 1024;
94 94
95 if ((strnicmp(tmp_ptr, "kbit", 4) == 0) || 95 if ((strnicmp(tmp_ptr, "kbit", 4) == 0) ||
96 (multi > 1)) 96 (multi > 1))
97 *tmp_ptr = '\0'; 97 *tmp_ptr = '\0';
98 } 98 }
99 99
@@ -118,7 +118,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
118 multi = 1024; 118 multi = 1024;
119 119
120 if ((strnicmp(tmp_ptr, "kbit", 4) == 0) || 120 if ((strnicmp(tmp_ptr, "kbit", 4) == 0) ||
121 (multi > 1)) 121 (multi > 1))
122 *tmp_ptr = '\0'; 122 *tmp_ptr = '\0';
123 } 123 }
124 124
diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h
index 55e527a489fe..b8fb11c4f927 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2009-2012 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 ff5ba406b1cf..409d0273c9d1 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner, Simon Wunderlich 4 * Marek Lindner, Simon Wunderlich
5 * 5 *
@@ -341,23 +341,23 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
341 if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < 341 if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
342 ETH_DATA_LEN + BAT_HEADER_LEN) 342 ETH_DATA_LEN + BAT_HEADER_LEN)
343 bat_info(hard_iface->soft_iface, 343 bat_info(hard_iface->soft_iface,
344 "The MTU of interface %s is too small (%i) to handle " 344 "The MTU of interface %s is too small (%i) to handle "
345 "the transport of batman-adv packets. Packets going " 345 "the transport of batman-adv packets. Packets going "
346 "over this interface will be fragmented on layer2 " 346 "over this interface will be fragmented on layer2 "
347 "which could impact the performance. Setting the MTU " 347 "which could impact the performance. Setting the MTU "
348 "to %zi would solve the problem.\n", 348 "to %zi would solve the problem.\n",
349 hard_iface->net_dev->name, hard_iface->net_dev->mtu, 349 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
350 ETH_DATA_LEN + BAT_HEADER_LEN); 350 ETH_DATA_LEN + BAT_HEADER_LEN);
351 351
352 if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < 352 if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
353 ETH_DATA_LEN + BAT_HEADER_LEN) 353 ETH_DATA_LEN + BAT_HEADER_LEN)
354 bat_info(hard_iface->soft_iface, 354 bat_info(hard_iface->soft_iface,
355 "The MTU of interface %s is too small (%i) to handle " 355 "The MTU of interface %s is too small (%i) to handle "
356 "the transport of batman-adv packets. If you experience" 356 "the transport of batman-adv packets. If you "
357 " problems getting traffic through try increasing the " 357 "experience problems getting traffic through try "
358 "MTU to %zi.\n", 358 "increasing the MTU to %zi.\n",
359 hard_iface->net_dev->name, hard_iface->net_dev->mtu, 359 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
360 ETH_DATA_LEN + BAT_HEADER_LEN); 360 ETH_DATA_LEN + BAT_HEADER_LEN);
361 361
362 if (hardif_is_iface_up(hard_iface)) 362 if (hardif_is_iface_up(hard_iface))
363 hardif_activate_interface(hard_iface); 363 hardif_activate_interface(hard_iface);
@@ -580,8 +580,8 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
580 goto err_free; 580 goto err_free;
581 581
582 /* expect a valid ethernet header here. */ 582 /* expect a valid ethernet header here. */
583 if (unlikely(skb->mac_len != sizeof(struct ethhdr) 583 if (unlikely(skb->mac_len != sizeof(struct ethhdr) ||
584 || !skb_mac_header(skb))) 584 !skb_mac_header(skb)))
585 goto err_free; 585 goto err_free;
586 586
587 if (!hard_iface->soft_iface) 587 if (!hard_iface->soft_iface)
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index 67f78d1a63b4..e68c5655e616 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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/hash.c b/net/batman-adv/hash.c
index d1da29da333b..117687bedf25 100644
--- a/net/batman-adv/hash.c
+++ b/net/batman-adv/hash.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2006-2012 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 4768717f07f9..d4bd7862719b 100644
--- a/net/batman-adv/hash.h
+++ b/net/batman-adv/hash.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2006-2012 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/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 5d69e103faa1..9b755f9eb182 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 462b190fa101..380ed4c2443a 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 8ae497b26bd8..08f3b3a8e883 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 586afafb1b67..1468788a9d64 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner, Simon Wunderlich 4 * Marek Lindner, Simon Wunderlich
5 * 5 *
@@ -28,7 +28,7 @@
28#define DRIVER_DEVICE "batman-adv" 28#define DRIVER_DEVICE "batman-adv"
29 29
30#ifndef SOURCE_VERSION 30#ifndef SOURCE_VERSION
31#define SOURCE_VERSION "2012.0.0" 31#define SOURCE_VERSION "2012.1.0"
32#endif 32#endif
33 33
34/* B.A.T.M.A.N. parameters */ 34/* B.A.T.M.A.N. parameters */
@@ -41,13 +41,14 @@
41 41
42/* purge originators after time in seconds if no valid packet comes in 42/* purge originators after time in seconds if no valid packet comes in
43 * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */ 43 * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */
44#define PURGE_TIMEOUT 200 44#define PURGE_TIMEOUT 200000 /* 200 seconds */
45#define TT_LOCAL_TIMEOUT 3600 /* in seconds */ 45#define TT_LOCAL_TIMEOUT 3600000 /* in miliseconds */
46#define TT_CLIENT_ROAM_TIMEOUT 600 46#define TT_CLIENT_ROAM_TIMEOUT 600000 /* in miliseconds */
47/* sliding packet range of received originator messages in sequence numbers 47/* sliding packet range of received originator messages in sequence numbers
48 * (should be a multiple of our word size) */ 48 * (should be a multiple of our word size) */
49#define TQ_LOCAL_WINDOW_SIZE 64 49#define TQ_LOCAL_WINDOW_SIZE 64
50#define TT_REQUEST_TIMEOUT 3 /* seconds we have to keep pending tt_req */ 50#define TT_REQUEST_TIMEOUT 3000 /* miliseconds we have to keep
51 * pending tt_req */
51 52
52#define TQ_GLOBAL_WINDOW_SIZE 5 53#define TQ_GLOBAL_WINDOW_SIZE 5
53#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1 54#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
@@ -56,8 +57,8 @@
56 57
57#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */ 58#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */
58 59
59#define ROAMING_MAX_TIME 20 /* Time in which a client can roam at most 60#define ROAMING_MAX_TIME 20000 /* Time in which a client can roam at most
60 * ROAMING_MAX_COUNT times */ 61 * ROAMING_MAX_COUNT times in miliseconds*/
61#define ROAMING_MAX_COUNT 5 62#define ROAMING_MAX_COUNT 5
62 63
63#define NO_FLAGS 0 64#define NO_FLAGS 0
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 847ff7e98a61..371cc93d8e17 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2009-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner, Simon Wunderlich 4 * Marek Lindner, Simon Wunderlich
5 * 5 *
@@ -143,7 +143,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu)
143 143
144 frag_list_free(&orig_node->frag_list); 144 frag_list_free(&orig_node->frag_list);
145 tt_global_del_orig(orig_node->bat_priv, orig_node, 145 tt_global_del_orig(orig_node->bat_priv, orig_node,
146 "originator timed out"); 146 "originator timed out");
147 147
148 kfree(orig_node->tt_buff); 148 kfree(orig_node->tt_buff);
149 kfree(orig_node->bcast_own); 149 kfree(orig_node->bcast_own);
@@ -282,8 +282,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
282 hlist_for_each_entry_safe(neigh_node, node, node_tmp, 282 hlist_for_each_entry_safe(neigh_node, node, node_tmp,
283 &orig_node->neigh_list, list) { 283 &orig_node->neigh_list, list) {
284 284
285 if ((time_after(jiffies, 285 if ((has_timed_out(neigh_node->last_valid, PURGE_TIMEOUT)) ||
286 neigh_node->last_valid + PURGE_TIMEOUT * HZ)) ||
287 (neigh_node->if_incoming->if_status == IF_INACTIVE) || 286 (neigh_node->if_incoming->if_status == IF_INACTIVE) ||
288 (neigh_node->if_incoming->if_status == IF_NOT_IN_USE) || 287 (neigh_node->if_incoming->if_status == IF_NOT_IN_USE) ||
289 (neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) { 288 (neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) {
@@ -327,18 +326,15 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
327{ 326{
328 struct neigh_node *best_neigh_node; 327 struct neigh_node *best_neigh_node;
329 328
330 if (time_after(jiffies, 329 if (has_timed_out(orig_node->last_valid, 2 * PURGE_TIMEOUT)) {
331 orig_node->last_valid + 2 * PURGE_TIMEOUT * HZ)) {
332
333 bat_dbg(DBG_BATMAN, bat_priv, 330 bat_dbg(DBG_BATMAN, bat_priv,
334 "Originator timeout: originator %pM, last_valid %lu\n", 331 "Originator timeout: originator %pM, last_valid %lu\n",
335 orig_node->orig, (orig_node->last_valid / HZ)); 332 orig_node->orig, (orig_node->last_valid / HZ));
336 return true; 333 return true;
337 } else { 334 } else {
338 if (purge_orig_neighbors(bat_priv, orig_node, 335 if (purge_orig_neighbors(bat_priv, orig_node,
339 &best_neigh_node)) { 336 &best_neigh_node))
340 update_route(bat_priv, orig_node, best_neigh_node); 337 update_route(bat_priv, orig_node, best_neigh_node);
341 }
342 } 338 }
343 339
344 return false; 340 return false;
@@ -372,8 +368,8 @@ static void _purge_orig(struct bat_priv *bat_priv)
372 continue; 368 continue;
373 } 369 }
374 370
375 if (time_after(jiffies, orig_node->last_frag_packet + 371 if (has_timed_out(orig_node->last_frag_packet,
376 msecs_to_jiffies(FRAG_TIMEOUT))) 372 FRAG_TIMEOUT))
377 frag_list_free(&orig_node->frag_list); 373 frag_list_free(&orig_node->frag_list);
378 } 374 }
379 spin_unlock_bh(list_lock); 375 spin_unlock_bh(list_lock);
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h
index 67765ffef731..3fe2eda85652 100644
--- a/net/batman-adv/originator.h
+++ b/net/batman-adv/originator.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 88c717b9344d..441f3db1bd91 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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/ring_buffer.c b/net/batman-adv/ring_buffer.c
index f1ccfa76ce8a..fd63951d118d 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 7cdfe62b657c..8b58bd82767d 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 b72d7f3b3c6a..f53515562a4f 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner, Simon Wunderlich 4 * Marek Lindner, Simon Wunderlich
5 * 5 *
@@ -72,7 +72,7 @@ static void _update_route(struct bat_priv *bat_priv,
72 bat_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n", 72 bat_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n",
73 orig_node->orig); 73 orig_node->orig);
74 tt_global_del_orig(bat_priv, orig_node, 74 tt_global_del_orig(bat_priv, orig_node,
75 "Deleted route towards originator"); 75 "Deleted route towards originator");
76 76
77 /* route added */ 77 /* route added */
78 } else if ((!curr_router) && (neigh_node)) { 78 } else if ((!curr_router) && (neigh_node)) {
@@ -229,10 +229,9 @@ void bonding_save_primary(const struct orig_node *orig_node,
229int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, 229int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
230 unsigned long *last_reset) 230 unsigned long *last_reset)
231{ 231{
232 if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) 232 if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
233 || (seq_num_diff >= EXPECTED_SEQNO_RANGE)) { 233 (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
234 if (time_after(jiffies, *last_reset + 234 if (has_timed_out(*last_reset, RESET_PROTECTION_MS)) {
235 msecs_to_jiffies(RESET_PROTECTION_MS))) {
236 235
237 *last_reset = jiffies; 236 *last_reset = jiffies;
238 bat_dbg(DBG_BATMAN, bat_priv, 237 bat_dbg(DBG_BATMAN, bat_priv,
@@ -430,7 +429,7 @@ int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
430 if ((hdr_size == sizeof(struct icmp_packet_rr)) && 429 if ((hdr_size == sizeof(struct icmp_packet_rr)) &&
431 (icmp_packet->rr_cur < BAT_RR_LEN)) { 430 (icmp_packet->rr_cur < BAT_RR_LEN)) {
432 memcpy(&(icmp_packet->rr[icmp_packet->rr_cur]), 431 memcpy(&(icmp_packet->rr[icmp_packet->rr_cur]),
433 ethhdr->h_dest, ETH_ALEN); 432 ethhdr->h_dest, ETH_ALEN);
434 icmp_packet->rr_cur++; 433 icmp_packet->rr_cur++;
435 } 434 }
436 435
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h
index 7aaee0fb0fdc..92ac100d83da 100644
--- a/net/batman-adv/routing.h
+++ b/net/batman-adv/routing.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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/send.c b/net/batman-adv/send.c
index 019337e3eafb..413758065323 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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/send.h b/net/batman-adv/send.h
index c8ca3ef7385b..824ef06f9b01 100644
--- a/net/batman-adv/send.h
+++ b/net/batman-adv/send.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 2d8bd2ad6ba3..8fb16d209fd9 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner, Simon Wunderlich 4 * Marek Lindner, Simon Wunderlich
5 * 5 *
@@ -396,8 +396,8 @@ void softif_neigh_purge(struct bat_priv *bat_priv)
396 hlist_for_each_entry_safe(softif_neigh, node_tmp, node_tmp2, 396 hlist_for_each_entry_safe(softif_neigh, node_tmp, node_tmp2,
397 &softif_neigh_vid->softif_neigh_list, 397 &softif_neigh_vid->softif_neigh_list,
398 list) { 398 list) {
399 if ((!time_after(jiffies, softif_neigh->last_seen + 399 if ((!has_timed_out(softif_neigh->last_seen,
400 msecs_to_jiffies(SOFTIF_NEIGH_TIMEOUT))) && 400 SOFTIF_NEIGH_TIMEOUT)) &&
401 (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE)) 401 (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE))
402 continue; 402 continue;
403 403
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h
index 001546fc96f1..756eab5b8dd4 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 a84e80409f9b..c9507057c98e 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Marek Lindner, Simon Wunderlich 4 * Marek Lindner, Simon Wunderlich
5 * 5 *
@@ -210,6 +210,11 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
210 if (compare_eth(addr, soft_iface->dev_addr)) 210 if (compare_eth(addr, soft_iface->dev_addr))
211 tt_local_entry->common.flags |= TT_CLIENT_NOPURGE; 211 tt_local_entry->common.flags |= TT_CLIENT_NOPURGE;
212 212
213 /* The local entry has to be marked as NEW to avoid to send it in
214 * a full table response going out before the next ttvn increment
215 * (consistency check) */
216 tt_local_entry->common.flags |= TT_CLIENT_NEW;
217
213 hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig, 218 hash_added = hash_add(bat_priv->tt_local_hash, compare_tt, choose_orig,
214 &tt_local_entry->common, 219 &tt_local_entry->common,
215 &tt_local_entry->common.hash_entry); 220 &tt_local_entry->common.hash_entry);
@@ -222,11 +227,6 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
222 227
223 tt_local_event(bat_priv, addr, tt_local_entry->common.flags); 228 tt_local_event(bat_priv, addr, tt_local_entry->common.flags);
224 229
225 /* The local entry has to be marked as NEW to avoid to send it in
226 * a full table response going out before the next ttvn increment
227 * (consistency check) */
228 tt_local_entry->common.flags |= TT_CLIENT_NEW;
229
230 /* remove address from global hash if present */ 230 /* remove address from global hash if present */
231 tt_global_entry = tt_global_hash_find(bat_priv, addr); 231 tt_global_entry = tt_global_hash_find(bat_priv, addr);
232 232
@@ -261,7 +261,7 @@ int tt_changes_fill_buffer(struct bat_priv *bat_priv,
261 atomic_set(&bat_priv->tt_local_changes, 0); 261 atomic_set(&bat_priv->tt_local_changes, 0);
262 262
263 list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list, 263 list_for_each_entry_safe(entry, safe, &bat_priv->tt_changes_list,
264 list) { 264 list) {
265 if (count < tot_changes) { 265 if (count < tot_changes) {
266 memcpy(buff + tt_len(count), 266 memcpy(buff + tt_len(count),
267 &entry->change, sizeof(struct tt_change)); 267 &entry->change, sizeof(struct tt_change));
@@ -333,17 +333,17 @@ int tt_local_seq_print_text(struct seq_file *seq, void *offset)
333 hlist_for_each_entry_rcu(tt_common_entry, node, 333 hlist_for_each_entry_rcu(tt_common_entry, node,
334 head, hash_entry) { 334 head, hash_entry) {
335 seq_printf(seq, " * %pM [%c%c%c%c%c]\n", 335 seq_printf(seq, " * %pM [%c%c%c%c%c]\n",
336 tt_common_entry->addr, 336 tt_common_entry->addr,
337 (tt_common_entry->flags & 337 (tt_common_entry->flags &
338 TT_CLIENT_ROAM ? 'R' : '.'), 338 TT_CLIENT_ROAM ? 'R' : '.'),
339 (tt_common_entry->flags & 339 (tt_common_entry->flags &
340 TT_CLIENT_NOPURGE ? 'P' : '.'), 340 TT_CLIENT_NOPURGE ? 'P' : '.'),
341 (tt_common_entry->flags & 341 (tt_common_entry->flags &
342 TT_CLIENT_NEW ? 'N' : '.'), 342 TT_CLIENT_NEW ? 'N' : '.'),
343 (tt_common_entry->flags & 343 (tt_common_entry->flags &
344 TT_CLIENT_PENDING ? 'X' : '.'), 344 TT_CLIENT_PENDING ? 'X' : '.'),
345 (tt_common_entry->flags & 345 (tt_common_entry->flags &
346 TT_CLIENT_WIFI ? 'W' : '.')); 346 TT_CLIENT_WIFI ? 'W' : '.'));
347 } 347 }
348 rcu_read_unlock(); 348 rcu_read_unlock();
349 } 349 }
@@ -355,7 +355,7 @@ out:
355 355
356static void tt_local_set_pending(struct bat_priv *bat_priv, 356static void tt_local_set_pending(struct bat_priv *bat_priv,
357 struct tt_local_entry *tt_local_entry, 357 struct tt_local_entry *tt_local_entry,
358 uint16_t flags) 358 uint16_t flags, const char *message)
359{ 359{
360 tt_local_event(bat_priv, tt_local_entry->common.addr, 360 tt_local_event(bat_priv, tt_local_entry->common.addr,
361 tt_local_entry->common.flags | flags); 361 tt_local_entry->common.flags | flags);
@@ -364,6 +364,9 @@ static void tt_local_set_pending(struct bat_priv *bat_priv,
364 * to be kept in the table in order to send it in a full table 364 * to be kept in the table in order to send it in a full table
365 * response issued before the net ttvn increment (consistency check) */ 365 * response issued before the net ttvn increment (consistency check) */
366 tt_local_entry->common.flags |= TT_CLIENT_PENDING; 366 tt_local_entry->common.flags |= TT_CLIENT_PENDING;
367
368 bat_dbg(DBG_TT, bat_priv, "Local tt entry (%pM) pending to be removed: "
369 "%s\n", tt_local_entry->common.addr, message);
367} 370}
368 371
369void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, 372void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
@@ -376,10 +379,7 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
376 goto out; 379 goto out;
377 380
378 tt_local_set_pending(bat_priv, tt_local_entry, TT_CLIENT_DEL | 381 tt_local_set_pending(bat_priv, tt_local_entry, TT_CLIENT_DEL |
379 (roaming ? TT_CLIENT_ROAM : NO_FLAGS)); 382 (roaming ? TT_CLIENT_ROAM : NO_FLAGS), message);
380
381 bat_dbg(DBG_TT, bat_priv, "Local tt entry (%pM) pending to be removed: "
382 "%s\n", tt_local_entry->common.addr, message);
383out: 383out:
384 if (tt_local_entry) 384 if (tt_local_entry)
385 tt_local_entry_free_ref(tt_local_entry); 385 tt_local_entry_free_ref(tt_local_entry);
@@ -413,14 +413,11 @@ static void tt_local_purge(struct bat_priv *bat_priv)
413 continue; 413 continue;
414 414
415 if (!has_timed_out(tt_local_entry->last_seen, 415 if (!has_timed_out(tt_local_entry->last_seen,
416 TT_LOCAL_TIMEOUT * 1000)) 416 TT_LOCAL_TIMEOUT))
417 continue; 417 continue;
418 418
419 tt_local_set_pending(bat_priv, tt_local_entry, 419 tt_local_set_pending(bat_priv, tt_local_entry,
420 TT_CLIENT_DEL); 420 TT_CLIENT_DEL, "timed out");
421 bat_dbg(DBG_TT, bat_priv, "Local tt entry (%pM) "
422 "pending to be removed: timed out\n",
423 tt_local_entry->common.addr);
424 } 421 }
425 spin_unlock_bh(list_lock); 422 spin_unlock_bh(list_lock);
426 } 423 }
@@ -606,7 +603,7 @@ int tt_global_seq_print_text(struct seq_file *seq, void *offset)
606 struct tt_global_entry, 603 struct tt_global_entry,
607 common); 604 common);
608 seq_printf(seq, " * %pM (%3u) via %pM (%3u) " 605 seq_printf(seq, " * %pM (%3u) via %pM (%3u) "
609 "[%c%c%c]\n", 606 "[%c%c]\n",
610 tt_global_entry->common.addr, 607 tt_global_entry->common.addr,
611 tt_global_entry->ttvn, 608 tt_global_entry->ttvn,
612 tt_global_entry->orig_node->orig, 609 tt_global_entry->orig_node->orig,
@@ -616,8 +613,6 @@ int tt_global_seq_print_text(struct seq_file *seq, void *offset)
616 (tt_global_entry->common.flags & 613 (tt_global_entry->common.flags &
617 TT_CLIENT_ROAM ? 'R' : '.'), 614 TT_CLIENT_ROAM ? 'R' : '.'),
618 (tt_global_entry->common.flags & 615 (tt_global_entry->common.flags &
619 TT_CLIENT_PENDING ? 'X' : '.'),
620 (tt_global_entry->common.flags &
621 TT_CLIENT_WIFI ? 'W' : '.')); 616 TT_CLIENT_WIFI ? 'W' : '.'));
622 } 617 }
623 rcu_read_unlock(); 618 rcu_read_unlock();
@@ -657,29 +652,31 @@ void tt_global_del(struct bat_priv *bat_priv,
657 struct tt_local_entry *tt_local_entry = NULL; 652 struct tt_local_entry *tt_local_entry = NULL;
658 653
659 tt_global_entry = tt_global_hash_find(bat_priv, addr); 654 tt_global_entry = tt_global_hash_find(bat_priv, addr);
660 if (!tt_global_entry) 655 if (!tt_global_entry || tt_global_entry->orig_node != orig_node)
661 goto out; 656 goto out;
662 657
663 if (tt_global_entry->orig_node == orig_node) { 658 if (!roaming)
664 if (roaming) { 659 goto out_del;
665 /* if we are deleting a global entry due to a roam 660
666 * event, there are two possibilities: 661 /* if we are deleting a global entry due to a roam
667 * 1) the client roamed from node A to node B => we mark 662 * event, there are two possibilities:
668 * it with TT_CLIENT_ROAM, we start a timer and we 663 * 1) the client roamed from node A to node B => we mark
669 * wait for node B to claim it. In case of timeout 664 * it with TT_CLIENT_ROAM, we start a timer and we
670 * the entry is purged. 665 * wait for node B to claim it. In case of timeout
671 * 2) the client roamed to us => we can directly delete 666 * the entry is purged.
672 * the global entry, since it is useless now. */ 667 * 2) the client roamed to us => we can directly delete
673 tt_local_entry = tt_local_hash_find(bat_priv, 668 * the global entry, since it is useless now. */
674 tt_global_entry->common.addr); 669 tt_local_entry = tt_local_hash_find(bat_priv,
675 if (!tt_local_entry) { 670 tt_global_entry->common.addr);
676 tt_global_entry->common.flags |= TT_CLIENT_ROAM; 671 if (!tt_local_entry) {
677 tt_global_entry->roam_at = jiffies; 672 tt_global_entry->common.flags |= TT_CLIENT_ROAM;
678 goto out; 673 tt_global_entry->roam_at = jiffies;
679 } 674 goto out;
680 }
681 _tt_global_del(bat_priv, tt_global_entry, message);
682 } 675 }
676
677out_del:
678 _tt_global_del(bat_priv, tt_global_entry, message);
679
683out: 680out:
684 if (tt_global_entry) 681 if (tt_global_entry)
685 tt_global_entry_free_ref(tt_global_entry); 682 tt_global_entry_free_ref(tt_global_entry);
@@ -707,7 +704,7 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
707 704
708 spin_lock_bh(list_lock); 705 spin_lock_bh(list_lock);
709 hlist_for_each_entry_safe(tt_common_entry, node, safe, 706 hlist_for_each_entry_safe(tt_common_entry, node, safe,
710 head, hash_entry) { 707 head, hash_entry) {
711 tt_global_entry = container_of(tt_common_entry, 708 tt_global_entry = container_of(tt_common_entry,
712 struct tt_global_entry, 709 struct tt_global_entry,
713 common); 710 common);
@@ -751,7 +748,7 @@ static void tt_global_roam_purge(struct bat_priv *bat_priv)
751 if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM)) 748 if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM))
752 continue; 749 continue;
753 if (!has_timed_out(tt_global_entry->roam_at, 750 if (!has_timed_out(tt_global_entry->roam_at,
754 TT_CLIENT_ROAM_TIMEOUT * 1000)) 751 TT_CLIENT_ROAM_TIMEOUT))
755 continue; 752 continue;
756 753
757 bat_dbg(DBG_TT, bat_priv, "Deleting global " 754 bat_dbg(DBG_TT, bat_priv, "Deleting global "
@@ -839,11 +836,6 @@ struct orig_node *transtable_search(struct bat_priv *bat_priv,
839 if (!atomic_inc_not_zero(&tt_global_entry->orig_node->refcount)) 836 if (!atomic_inc_not_zero(&tt_global_entry->orig_node->refcount))
840 goto out; 837 goto out;
841 838
842 /* A global client marked as PENDING has already moved from that
843 * originator */
844 if (tt_global_entry->common.flags & TT_CLIENT_PENDING)
845 goto out;
846
847 orig_node = tt_global_entry->orig_node; 839 orig_node = tt_global_entry->orig_node;
848 840
849out: 841out:
@@ -970,8 +962,7 @@ static void tt_req_purge(struct bat_priv *bat_priv)
970 962
971 spin_lock_bh(&bat_priv->tt_req_list_lock); 963 spin_lock_bh(&bat_priv->tt_req_list_lock);
972 list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) { 964 list_for_each_entry_safe(node, safe, &bat_priv->tt_req_list, list) {
973 if (has_timed_out(node->issued_at, 965 if (has_timed_out(node->issued_at, TT_REQUEST_TIMEOUT)) {
974 TT_REQUEST_TIMEOUT * 1000)) {
975 list_del(&node->list); 966 list_del(&node->list);
976 kfree(node); 967 kfree(node);
977 } 968 }
@@ -990,7 +981,7 @@ static struct tt_req_node *new_tt_req_node(struct bat_priv *bat_priv,
990 list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) { 981 list_for_each_entry(tt_req_node_tmp, &bat_priv->tt_req_list, list) {
991 if (compare_eth(tt_req_node_tmp, orig_node) && 982 if (compare_eth(tt_req_node_tmp, orig_node) &&
992 !has_timed_out(tt_req_node_tmp->issued_at, 983 !has_timed_out(tt_req_node_tmp->issued_at,
993 TT_REQUEST_TIMEOUT * 1000)) 984 TT_REQUEST_TIMEOUT))
994 goto unlock; 985 goto unlock;
995 } 986 }
996 987
@@ -1583,8 +1574,7 @@ static void tt_roam_purge(struct bat_priv *bat_priv)
1583 1574
1584 spin_lock_bh(&bat_priv->tt_roam_list_lock); 1575 spin_lock_bh(&bat_priv->tt_roam_list_lock);
1585 list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) { 1576 list_for_each_entry_safe(node, safe, &bat_priv->tt_roam_list, list) {
1586 if (!has_timed_out(node->first_time, 1577 if (!has_timed_out(node->first_time, ROAMING_MAX_TIME))
1587 ROAMING_MAX_TIME * 1000))
1588 continue; 1578 continue;
1589 1579
1590 list_del(&node->list); 1580 list_del(&node->list);
@@ -1611,8 +1601,7 @@ static bool tt_check_roam_count(struct bat_priv *bat_priv,
1611 if (!compare_eth(tt_roam_node->addr, client)) 1601 if (!compare_eth(tt_roam_node->addr, client))
1612 continue; 1602 continue;
1613 1603
1614 if (has_timed_out(tt_roam_node->first_time, 1604 if (has_timed_out(tt_roam_node->first_time, ROAMING_MAX_TIME))
1615 ROAMING_MAX_TIME * 1000))
1616 continue; 1605 continue;
1617 1606
1618 if (!atomic_dec_not_zero(&tt_roam_node->counter)) 1607 if (!atomic_dec_not_zero(&tt_roam_node->counter))
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index 30efd49881a3..c753633b1da1 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-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 650ce5fb1192..302efb523475 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2007-2012 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 6f3c65952f53..0897dfa72c59 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Andreas Langer 4 * Andreas Langer
5 * 5 *
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h
index 8fd5535544b9..a9faf6b1db19 100644
--- a/net/batman-adv/unicast.h
+++ b/net/batman-adv/unicast.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2010-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Andreas Langer 4 * Andreas Langer
5 * 5 *
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index ac7e66100590..c4a5b8cafada 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2008-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2008-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Simon Wunderlich 4 * Simon Wunderlich
5 * 5 *
@@ -714,8 +714,7 @@ static void purge_vis_packets(struct bat_priv *bat_priv)
714 if (info == bat_priv->my_vis_info) 714 if (info == bat_priv->my_vis_info)
715 continue; 715 continue;
716 716
717 if (time_after(jiffies, 717 if (has_timed_out(info->first_seen, VIS_TIMEOUT)) {
718 info->first_seen + VIS_TIMEOUT * HZ)) {
719 hlist_del(node); 718 hlist_del(node);
720 send_list_del(info); 719 send_list_del(info);
721 kref_put(&info->refcount, free_info); 720 kref_put(&info->refcount, free_info);
diff --git a/net/batman-adv/vis.h b/net/batman-adv/vis.h
index 31b820d07f23..ee2e46e5347b 100644
--- a/net/batman-adv/vis.h
+++ b/net/batman-adv/vis.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2008-2011 B.A.T.M.A.N. contributors: 2 * Copyright (C) 2008-2012 B.A.T.M.A.N. contributors:
3 * 3 *
4 * Simon Wunderlich, Marek Lindner 4 * Simon Wunderlich, Marek Lindner
5 * 5 *
@@ -22,7 +22,8 @@
22#ifndef _NET_BATMAN_ADV_VIS_H_ 22#ifndef _NET_BATMAN_ADV_VIS_H_
23#define _NET_BATMAN_ADV_VIS_H_ 23#define _NET_BATMAN_ADV_VIS_H_
24 24
25#define VIS_TIMEOUT 200 /* timeout of vis packets in seconds */ 25#define VIS_TIMEOUT 200000 /* timeout of vis packets
26 * in miliseconds */
26 27
27int vis_seq_print_text(struct seq_file *seq, void *offset); 28int vis_seq_print_text(struct seq_file *seq, void *offset);
28void receive_server_sync_packet(struct bat_priv *bat_priv, 29void receive_server_sync_packet(struct bat_priv *bat_priv,