summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
Commit message (Collapse)AuthorAgeFilesLines
...
| * batman-adv: Correct rcu refcounting for gw_nodeMarek Lindner2011-03-052-22/+17Star
| | | | | | | | | | | | | | | | | | | | | | 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: Correct rcu refcounting for neigh_nodeMarek Lindner2011-03-057-174/+313
| | | | | | | | | | | | | | | | | | | | | | 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-057-163/+195
| | | | | | | | | | | | | | | | | | | | 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-053-6/+33
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: protect originator nodes with reference countersMarek Lindner2011-03-054-19/+78
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: protect each hash row with rcu locksMarek Lindner2011-03-058-45/+141
| | | | | | | | 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: free neighbors when an interface is deactivatedMarek Lindner2011-03-051-2/+7
| | | | | | | | | | | | | | | | | | hardif_disable_interface() calls purge_orig_ref() to immediately free all neighbors associated with the interface that is going down. purge_orig_neighbors() checked if the interface status is IF_INACTIVE which is set to IF_NOT_IN_USE shortly before calling purge_orig_ref(). Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: protect neighbor list with rcu locksMarek Lindner2011-03-053-21/+57
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: convert neighbor list to hlistMarek Lindner2011-03-053-28/+35
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: protect neighbor nodes with reference countersMarek Lindner2011-03-054-8/+28
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: Remove two duplicate includes.Jesper Juhl2011-02-141-2/+0Star
| | | | | | | | | | | | | | | | Remove duplicate inclusion of "send.h" and "routing.h" from net/batman-adv/soft-interface.c Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-mergeDavid S. Miller2011-02-1211-26/+7Star
|\|
| * batman-adv: Disallow originator addressing within mesh layerLinus Lüssing2011-02-111-6/+1Star
| | | | | | | | | | | | | | | | | | | | | | For a host in the mesh network, the batman layer should be transparent. However, we had one exception, data packets within the mesh network which have the same destination as a originator are being routed to that node, although there is no host that node's bat0 interface and therefore gets dropped anyway. This commit removes this exception. Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch> Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Remove duplicate types.h inclusionsLinus Lüssing2011-02-1110-14/+0Star
| | | | | | | | | | | | | | | | | | 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: Split combined variable declarationsMarek Lindner2011-02-111-2/+2
| | | | | | | | | | | | | | | | | | Multiple variable declarations in a single statements over multiple lines can be split into multiple variable declarations without changing the actual behavior. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Use successive sequence numbers for fragmentsSven Eckelmann2011-02-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two fragments of an unicast packet must have successive sequence numbers to allow the receiver side to detect matching fragments and merge them again. The current implementation doesn't provide that property because a sequence of two atomic_inc_return may be interleaved with another sequence which also changes the variable. The access to the fragment sequence number pool has either to be protected by correct locking or it has to reserve two sequence numbers in a single fetch. The latter one can easily be done by increasing the value of the last used sequence number by 2 in a single step. The generated window of two currently unused sequence numbers can now be scattered across the two fragments. Reported-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | Merge branch 'master' of ↵David S. Miller2011-02-091-5/+10
|\ \ | | | | | | | | | | | | | | | | | | master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/e1000e/netdev.c
| * | batman-adv: Linearize fragment packets before mergeSven Eckelmann2011-02-081-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We access the data inside the skbs of two fragments directly using memmove during the merge. The data of the skb could span over multiple skb pages. An direct access without knowledge about the pages would lead to an invalid memory access. Signed-off-by: Sven Eckelmann <sven@narfation.org> [lindner_marek@yahoo.de: Move return from function to the end] Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | | Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-mergeDavid S. Miller2011-01-3139-94/+93Star
|\ \ \ | |/ / |/| / | |/
| * batman-adv: Update copyright yearsSven Eckelmann2011-01-3139-39/+39
| | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Remove unused variablesSven Eckelmann2011-01-312-10/+1Star
| | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Remove declaration of batman_skb_recvSven Eckelmann2011-01-312-6/+9
| | | | | | | | | | | | | | batman_skb_recv can be defined in hard-interface.c as static because it is never used outside of that file. Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Remove unused definitionsSven Eckelmann2011-01-311-15/+0Star
| | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Remove dangling declaration of hash_remove_elementSven Eckelmann2011-01-311-5/+0Star
| | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: remove unused parametersSimon Wunderlich2011-01-314-14/+10Star
| | | | | | | | | | | | | | | | Some function parameters are obsolete now and can be removed. Reported-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Calculate correct size for merged packetsSven Eckelmann2011-01-314-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The routing algorithm must be able to decide if a fragment can be merged with the missing part and still be passed to a forwarding interface. The fragments can only differ by one byte in case that the original payload had an uneven length. In that situation the sender has to inform all possible receivers that the tail is one byte longer using the flag UNI_FRAG_LARGETAIL. The combination of UNI_FRAG_LARGETAIL and UNI_FRAG_HEAD flag makes it possible to calculate the correct length for even and uneven sized payloads. The original formula missed to add the unicast header at all and forgot to remove the fragment header of the second fragment. This made the results highly unreliable and only useful for machines with large differences between the configured MTUs. Reported-by: Russell Senior <russell@personaltelco.net> Reported-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Create roughly equal sized fragmentsSven Eckelmann2011-01-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The routing algorithm must know how large two fragments are to be able to decide that it is safe to merge them or if it should resubmit without waiting for the second part. When these two fragments have a too different size, it is not possible to guess right in every situation. The user could easily configure the MTU of the attached cards so that one fragment is forwarded and the other one is added to the fragments table to wait for the missing part. For even sized packets, it is possible to split it so that the resulting packages are equal sized by ignoring the old non-fragment header at the beginning of the original packet. This still creates different sized fragments for uneven sized packets. Reported-by: Russell Senior <russell@personaltelco.net> Reported-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Make vis info stack traversal threadsafeSven Eckelmann2011-01-301-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The batman-adv vis server has to a stack which stores all information about packets which should be send later. This stack is protected with a spinlock that is used to prevent concurrent write access to it. The send_vis_packets function has to take all elements from the stack and send them to other hosts over the primary interface. The send will be initiated without the lock which protects the stack. The implementation using list_for_each_entry_safe has the problem that it stores the next element as "safe ptr" to allow the deletion of the current element in the list. The list may be modified during the unlock/lock pair in the loop body which may make the safe pointer not pointing to correct next element. It is safer to remove and use the first element from the stack until no elements are available. This does not need reduntant information which would have to be validated each time the lock was removed. Reported-by: Russell Senior <russell@personaltelco.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Remove vis info element in free_infoSven Eckelmann2011-01-301-0/+1
| | | | | | | | | | | | | | | | | | The free_info function will be called when no reference to the info object exists anymore. It must be ensured that the allocated memory gets freed and not only the elements which are managed by the info object. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Remove vis info on hashing errorsSven Eckelmann2011-01-301-1/+1
| | | | | | | | | | | | | | | | A newly created vis info object must be removed when it couldn't be added to the hash. The old_info which has to be replaced was already removed and isn't related to the hash anymore. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Fix kernel panic when fetching vis data on a vis serverLinus Lüssing2011-01-251-2/+2
|/ | | | | | | | | | The hash_iterate removal introduced a bug leading to a kernel panic when fetching the vis data on a vis server. That commit forgot to rename one variable name, which this commit fixes now. Reported-by: Russell Senior <russell@personaltelco.net> Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Use "__attribute__" shortcut macrosSven Eckelmann2011-01-163-12/+12
| | | | | | | | | | | | Linux 2.6.21 defines different macros for __attribute__ which are also used inside batman-adv. The next version of checkpatch.pl warns about the usage of __attribute__((packed))). Linux 2.6.33 defines an extra macro __always_unused which is used to assist source code analyzers and can be used to removed the last existing __attribute__ inside the source code. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Even Batman should not dereference NULL pointersJesper Juhl2011-01-131-2/+4
| | | | | | | | | | | | | | | | There's a problem in net/batman-adv/unicast.c::frag_send_skb(). dev_alloc_skb() allocates memory and may fail, thus returning NULL. If this happens we'll pass a NULL pointer on to skb_split() which in turn hands it to skb_split_inside_header() from where it gets passed to skb_put() that lets skb_tail_pointer() play with it and that function dereferences it. And thus the bat dies. While I was at it I also moved the call to dev_alloc_skb() above the assignment to 'unicast_packet' since there's no reason to do that assignment if the memory allocation fails. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Return hna count on local buffer fillSven Eckelmann2010-12-201-1/+1
| | | | | | | | hna_local_fill_buffer must return the number of added hna entries and not the last checked hash bucket. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: Add batman-adv meshing protocolSven Eckelmann2010-12-1640-0/+9944
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is a routing protocol for multi-hop ad-hoc mesh networks. The networks may be wired or wireless. See http://www.open-mesh.org/ for more information and user space tools. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: David S. Miller <davem@davemloft.net>