aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
Commit message (Collapse)AuthorAgeFilesLines
* batman-adv: fix skb->data assignmentAntonio Quartulli2012-07-041-0/+2
| | | | | | | | | | | | | | | | | | | | commit 2c995ff892313009e336ecc8ec3411022f5b1c39 upstream. skb_linearize(skb) possibly rearranges the skb internal data and then changes the skb->data pointer value. For this reason any other pointer in the code that was assigned skb->data before invoking skb_linearise(skb) must be re-assigned. In the current tt_query message handling code this is not done and therefore, in case of skb linearization, the pointer used to handle the packet header ends up in pointing to free'd memory. This bug was introduced by a73105b8d4c765d9ebfb664d0a66802127d8e4c7 (batman-adv: improved client announcement mechanism) Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: David S. Miller <davem@davemloft.net> [This patch is a backport for kernel versions 3.1 and 3.2 - Antonio] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
* batman-adv: agglomerate all batman iv ogm processing functions in a single fileMarek Lindner2011-09-081-590/+16
| | | | | | | In preparation of the upcoming improved routing algorithm the code based has to be re-organized to allow choosing the routing algorithm at compile time. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: rename all instances of batman_packet to batman_ogm_packetMarek Lindner2011-09-081-55/+63
| | | | | | | The follow-up routing code changes are going to introduce additional routing packet types which make this distinction necessary. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: merge update_transtable() into tt related codeMarek Lindner2011-08-221-63/+3
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: implement AP-isolation on the sender sideAntonio Quartulli2011-08-221-1/+1
| | | | | | | | If a node has to send a packet issued by a WIFI client to another WIFI client, the packet is dropped. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: detect clients connected through a 802.11 deviceAntonio Quartulli2011-08-221-1/+1
| | | | | | | | | Clients connected through a 802.11 device are now marked with the TT_CLIENT_WIFI flag. This flag is also advertised with the tt announcement. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: correct several typ0s in the commentsAntonio Quartulli2011-08-221-10/+9
| | | | | | | Several typos have been corrected and some sentences have been rephrased Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: request the full table if tt_crc doesn't matchAntonio Quartulli2011-07-071-0/+12
| | | | | | | | In case of tt_crc mismatching for a certain orig_node after applying the changes, the node must request the full table immediately. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: add_bcast_packet_to_list() takes the sending delay as parameterAntonio Quartulli2011-07-051-1/+1
| | | | | | | | | In order to make possible to use the broadcast list for delayed sendings the "delay" parameter is now provided instead of using 1 as hardcoded value. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect the local and the global trans-tables with rcuAntonio Quartulli2011-06-201-2/+0
| | | | | | | | | The local and the global translation-tables are now lock free and rcu protected. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: improved roaming mechanismAntonio Quartulli2011-06-201-4/+57
| | | | | | | | | | | | | | | | | | | | | | | | With the current client announcement implementation, in case of roaming, an update is triggered on the new AP serving the client. At that point the new information is spread around by means of the OGM broadcasting mechanism. Until this operations is not executed, no node is able to correctly route traffic towards the client. This obviously causes packet drops and introduces a delay in the time needed by the client to recover its connections. A new packet type called ROAMING_ADVERTISEMENT is added to account this issue. This message is sent in case of roaming from the new AP serving the client to the old one and will contain the client MAC address. In this way an out-of-OGM update is immediately committed, so that the old node can update its global translation table. Traffic reaching this node will then be redirected to the correct destination utilising the fresher information. Thus reducing the packet drops and the connection recovery delay. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: improved client announcement mechanismAntonio Quartulli2011-06-201-48/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The client announcement mechanism informs every mesh node in the network of any connected non-mesh client, in order to find the path towards that client from any given point in the mesh. The old implementation was based on the simple idea of appending a data buffer to each OGM containing all the client MAC addresses the node is serving. All other nodes can populate their global translation tables (table which links client MAC addresses to node addresses) using this MAC address buffer and linking it to the node's address contained in the OGM. A node that wants to contact a client has to lookup the node the client is connected to and its address in the global translation table. It is easy to understand that this implementation suffers from several issues: - big overhead (each and every OGM contains the entire list of connected clients) - high latencies for client route updates due to long OGM trip time and OGM losses The new implementation addresses these issues by appending client changes (new client joined or a client left) to the OGM instead of filling it with all the client addresses each time. In this way nodes can modify their global tables by means of "updates", thus reducing the overhead within the OGMs. To keep the entire network in sync each node maintains a translation table version number (ttvn) and a translation table checksum. These values are spread with the OGM to allow all the network participants to determine whether or not they need to update their translation table information. When a translation table lookup is performed in order to send a packet to a client attached to another node, the destination's ttvn is added to the payload packet. Forwarding nodes can compare the packet's ttvn with their destination's ttvn (this node could have a fresher information than the source) and re-route the packet if necessary. This greatly reduces the packet loss of clients roaming from one AP to the next. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Reduce usage of charSven Eckelmann2011-06-201-4/+4
| | | | | | | | char was used in different places to store information without really using the characteristics of that data type or by ignoring the fact that char has not a well defined signedness. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: count_real_packets() in batman-adv assumes char is signedDavid Howells2011-06-201-4/+4
| | | | | | | | | | | | | | count_real_packets() in batman-adv assumes char is signed, and returns -1 through it: net/batman-adv/routing.c: In function 'receive_bat_packet': net/batman-adv/routing.c:739: warning: comparison is always false due to limited range of data type Use int instead. Signed-off-by: David Howells <dhowells@redhat.com> [sven@narfation.org: Rebase on top of current version] Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: accept delayed rebroadcasts to avoid bogus routing under heavy loadDaniele Furlan2011-06-091-5/+4
| | | | | | | | | | | | When a link is saturated (re)broadcasts of OGMs are delayed. Under heavy load this delay may exceed the orig interval which leads to OGMs being dropped (the code would only accept an OGM rebroadcast if it arrived before the next OGM was broadcasted). With this patch batman-adv will also accept delayed OGMs in order to avoid a bogus influence on the routing metric. Signed-off-by: Daniele Furlan <daniele.furlan@gmail.com> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Ensure that we really have route changes in update_routeSven Eckelmann2011-05-301-1/+1
| | | | | | | | | | | The debug output of update_route has tests for "route deleted" and "route added". All other situations are handled as "route changed". This is not true because neigh_node and curr_router could be both NULL. The function is not called in this situation, but the code might be interpreted wrong when reading it without this test. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: use is_broadcast_ether_addr() instead of compare_eth(.., brd_addr)Antonio Quartulli2011-05-301-1/+1
| | | | | | | | | | Instead of comparing mac addresses with the broadcast address by means of compare_eth(), the is_broadcast_ether_addr() kernel function has to be used. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Acked-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Calculate sizeof using variable insead of typesSven Eckelmann2011-05-301-4/+4
| | | | | | | | | | | | | Documentation/CodingStyle recommends to use the form p = kmalloc(sizeof(*p), ...); to calculate the size of a struct and not the version where the struct name is spelled out to prevent bugs when the type of p changes. This also seems appropriate for manipulation of buffers when they are directly associated with p. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Add const type qualifier for pointersSven Eckelmann2011-05-301-21/+18
| | | | | | | | batman-adv uses pointers which are marked as const and should not violate that type qualifier by passing it to functions which force a cast to the non-const version. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: move neigh_node->if_incoming->if_status check in find_router()Antonio Quartulli2011-05-301-0/+3
| | | | | | | | | Every time that find_router() is invoked, if_status has to be compared with IF_ACTIVE. Moving this comparison inside find_router() will avoid to write it each time. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: remove duplicate code from function is_bidirectional_neigh()Daniele Furlan2011-05-081-49/+25
| | | | | | | | In function is_bidirectional_neigh the code that find out the one hop neighbor is duplicated. Signed-off-by: Daniele Furlan <daniele.furlan@gmail.com> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: rename everything from *hna* into *tt* (translation table)Antonio Quartulli2011-05-081-37/+37
| | | | | | | | To be coherent, all the functions/variables/constants have been renamed to the TranslationTable style Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Fix refcount imbalance in find_routerMarek Lindner2011-05-081-5/+9
| | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Make bat_priv->primary_if an rcu protected pointerMarek Lindner2011-05-011-6/+12
| | | | | | | | | | | The rcu protected macros rcu_dereference() and rcu_assign_pointer() for the bat_priv->primary_if need to be used, as well as spin/rcu locking. Otherwise we might end up using a primary_if pointer pointing to already freed memory. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: orig_hash_find() manages rcu_lock/unlock internallyAntonio Quartulli2011-05-011-14/+2
| | | | | | | | | orig_hash_find() manages rcu_lock/unlock internally and doesn't need to be surrounded by rcu_read_lock() / rcu_read_unlock() anymore Signed-off-by: Antonio Quartulli <ordex@autistici.org> Acked-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Protect global TQ window with a spinlockLinus Lüssing2011-04-171-0/+4
| | | | | | Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Make orig_node->router an rcu protected pointerLinus Lüssing2011-04-171-101/+93
| | | | | | | | | | | | | | The rcu protected macros rcu_dereference() and rcu_assign_pointer() for the orig_node->router need to be used, as well as spin/rcu locking. Otherwise we might end up using a router pointer pointing to already freed memory. Therefore this commit introduces the safe getter method orig_node_get_router(). Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Move bonding / iface alternating router search to own functionsLinus Lüssing2011-04-171-75/+105
| | | | | | | | | | | This decreases the size of find_router() by outsourcing the router search for the bonding and interface alternating modes to their own sub functions. This shall make it easier to keep track of the correct refcounting later. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Remove unused hdr_size variable in route_unicast_packet()Linus Lüssing2011-03-051-4/+3
| | | | | Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: rename batman_if struct to hard_ifaceMarek Lindner2011-03-051-24/+24
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: rename global if_list to hardif_listMarek Lindner2011-03-051-1/+1
| | | | | | | | Batman-adv works with "hard interfaces" as well as "soft interfaces". The new name should better make clear which kind of interfaces this list stores. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: remove orig_hash spinlockMarek Lindner2011-03-051-63/+12
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: increase refcount in create_neighbor to be consistentMarek Lindner2011-03-051-36/+27
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: Correct rcu refcounting for orig_nodeMarek Lindner2011-03-051-12/+12
| | | | | | | | | | | It might be possible that 2 threads access the same data in the same rcu grace period. The first thread calls call_rcu() to decrement the refcount and free the data while the second thread increases the refcount to use the data. To avoid this race condition all refcount operations have to be atomic. Reported-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: remove extra layer between hash and hash element - hash bucketMarek Lindner2011-03-051-27/+13
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: separate ethernet comparing calls from hash functionsMarek Lindner2011-03-051-28/+27
| | | | | | | Note: The function compare_ether_addr() provided by the Linux kernel requires aligned memory. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: make broadcast seqno operations atomicMarek Lindner2011-03-051-22/+34
| | | | | | | | | | | | Batman-adv could receive several payload broadcasts at the same time that would trigger access to the broadcast seqno sliding window to determine whether this is a new broadcast or not. If these incoming broadcasts are accessing the sliding window simultaneously it could be left in an inconsistent state. Therefore it is necessary to make sure this access is atomic. Reported-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect bit operations to count OGMs with spinlockMarek Lindner2011-03-051-31/+30
| | | | | Reported-by: Linus Lüssing <linus.luessing@saxnet.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: Correct rcu refcounting for neigh_nodeMarek Lindner2011-03-051-116/+222
| | | | | | | | | | | It might be possible that 2 threads access the same data in the same rcu grace period. The first thread calls call_rcu() to decrement the refcount and free the data while the second thread increases the refcount to use the data. To avoid this race condition all refcount operations have to be atomic. Reported-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect bonding with rcu locksSimon Wunderlich2011-03-051-150/+163
| | | | | | | | | | bonding / alternating candidates need to be secured by rcu locks as well. This patch therefore converts the bonding list from a plain pointer list to a rcu securable lists and references the bonding candidates. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect ogm counter arrays with spinlockMarek Lindner2011-03-051-4/+23
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect originator nodes with reference countersMarek Lindner2011-03-051-10/+23
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect each hash row with rcu locksMarek Lindner2011-03-051-1/+15
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect neigh_nodes used outside of rcu_locks with refcountingMarek Lindner2011-03-051-9/+31
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect neighbor list with rcu locksMarek Lindner2011-03-051-14/+27
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: convert neighbor list to hlistMarek Lindner2011-03-051-11/+18
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: protect neighbor nodes with reference countersMarek Lindner2011-03-051-0/+7
| | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: Remove duplicate types.h inclusionsLinus Lüssing2011-02-111-1/+0
| | | | | | | | | types.h is included by main.h, which is included at the beginning of any other c-file anyway. Therefore this commit removes those duplicate inclussions. Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Update copyright yearsSven Eckelmann2011-01-311-1/+1
| | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Remove unused variablesSven Eckelmann2011-01-311-7/+0
| | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>