summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/unicast.c
Commit message (Collapse)AuthorAgeFilesLines
* batman-adv: rename everything from *hna* into *tt* (translation table)Antonio Quartulli2011-05-081-1/+1
| | | | | | | | 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: Make bat_priv->primary_if an rcu protected pointerMarek Lindner2011-05-011-5/+11
| | | | | | | | | | | 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: concentrate all curr_gw related rcu operations in ↵Marek Lindner2011-04-171-1/+1
| | | | | | | select/deselect functions Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-mergeDavid S. Miller2011-03-071-47/+46
|\
| * batman-adv: rename batman_if struct to hard_ifaceMarek Lindner2011-03-051-4/+4
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: remove orig_hash spinlockMarek Lindner2011-03-051-23/+13
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: Correct rcu refcounting for orig_nodeMarek Lindner2011-03-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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-12/+9
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: Increase orig_node refcount before releasing rcu read lockLinus Lüssing2011-03-051-3/+2
| | | | | | | | | | | | | | | | | | When unicast_send_skb() is increasing the orig_node's refcount another thread might have been freeing this orig_node already. We need to increase the refcount in the rcu read lock protected area to avoid that. Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
| * batman-adv: Correct rcu refcounting for neigh_nodeMarek Lindner2011-03-051-23/+34
| | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | 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 each hash row with rcu locksMarek Lindner2011-03-051-0/+2
| | | | | | | | 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-02-111-12/+7
|\ \ | |/
| * batman-adv: Disallow originator addressing within mesh layerLinus Lüssing2011-02-111-6/+1
| | | | | | | | | | | | | | | | | | | | | | 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: 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-081-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>
* | batman-adv: Update copyright yearsSven Eckelmann2011-01-311-1/+1
| | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Calculate correct size for merged packetsSven Eckelmann2011-01-311-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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>
* net: Add batman-adv meshing protocolSven Eckelmann2010-12-161-0/+343
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>
OpenPOWER on IntegriCloud