aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-06-03batman-adv: Remove unnecessary ret variable in algo_registerMarkus Pargmann1-5/+2
Remove ret variable and all jumps. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: Remove unnecessary ret variableMarkus Pargmann1-8/+3
We can avoid this indirect return variable by directly returning the error values. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: main, batadv_compare_eth return boolMarkus Pargmann1-1/+1
Declare the returntype of batadv_compare_eth as bool. The function called inside this helper function (ether_addr_equal_unaligned) also uses bool as return value, so there is no need to return int. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: main, Convert is_my_mac() to boolMarkus Pargmann2-5/+8
It is much clearer to see a bool type as return value than 'int' for functions that are supposed to return true or false. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: Remove unnecessary check for orig_ifinfo not NULLSven Eckelmann1-2/+1
orig_ifinfo is dereferenced multiple times in batadv_iv_ogm_update_seqnos before the check for NULL is done. The function also exists at the beginning when orig_ifinfo would have been NULL. This makes the check at the end unnecessary and only confuses the reader/code analyzers. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: types, Fix comment on bcast_ownMarkus Pargmann1-3/+4
batadv_orig_bat_iv->bcast_own is actually not a bitfield, it is an array. Adjust the comment accordingly. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: iv_ogm, fix comment function nameMarkus Pargmann1-1/+1
This is a small copy paste fix for batadv_ing_buffer_avg. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: iv_ogm, fix coding styleMarkus Pargmann1-1/+3
The kernel coding style says, that there should not be multiple assignments in one row. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: iv_ogm, Fix dup_status commentMarkus Pargmann1-1/+1
Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: iv_ogm_orig_update, style, add missing bracketsMarkus Pargmann1-1/+2
CodingStyle describes that either none or both branches of a conditional have to have brackets. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: iv_ogm_queue_add, Simplify expressionsMarkus Pargmann1-2/+2
Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03batman-adv: iv_ogm_aggregate_new, simplify error handlingMarkus Pargmann1-15/+13
It is just a bit easier to put the error handling at one place and let multiple error paths use the same calls. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: Use common declaration order in *_send_skb_(packet|unicast)Antonio Quartulli1-1/+1
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
2015-05-29batman-adv: iv_ogm_orig_update, remove unnecessary bracketsMarkus Pargmann1-1/+1
Remove these unnecessary brackets inside a condition. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: iv_ogm_can_aggregate, code readabilityMarkus Pargmann1-49/+53
This patch tries to increase code readability by negating the first if block and rearranging some of the other conditional blocks. This way we save an indentation level, we also save some allocation that is not necessary for one of the conditions. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: checkpatch - spaces preferred around that '*'Marek Lindner2-2/+2
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: checkpatch - comparison to NULL could be rewrittenMarek Lindner1-1/+1
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: Use safer default config for optional featuresSven Eckelmann2-2/+2
The current default settings for optional features in batman-adv seems to be based around the idea that the user only compiles what he requires. They will automatically enabled when they are compiled in. For example the network coding part of batman-adv is by default disabled in the out-of-tree module but will be enabled when the code is compiled during the module build. But distributions like Debian just enable all features of the batman-adv kernel module and hope that more experimental features or features with possible negative effects have to be enabled using some runtime configuration interface. The network_coding feature can help in specific setups but also has drawbacks and is not disabled by default in the out-of-tree module. Disabling by default in the runtime config seems to be also quite sane. The bridge_loop_avoidance is the only feature which is disabled by default but may be necessary even in simple setups. Packet loops may even be created during the initial node setup when this is not enabled. This is different than STP on bridges because mesh is usually used on Adhoc WiFi. Having two nodes (by accident) in the same LAN segment and in the same mesh network is rather common in this situation. Signed-off-by: Sven Eckelmann <sven@narfation.org> Acked-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: iv_ogm_send_to_if, declare char* as constMarkus Pargmann1-1/+1
This string pointer is later assigned to a constant string, so it should be defined constant at the beginning. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: iv_ogm_aggr_packet, bool return valueMarkus Pargmann1-2/+2
This function returns bool values, so it should be defined to return them instead of the whole int range. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: iv_ogm_iface_enable, direct return valuesMarkus Pargmann1-6/+2
Directly return error values. No need to use a return variable. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: Makefile, Sort alphabeticallyMarkus Pargmann1-1/+1
The whole Makefile is sorted, just the multicast rule is not at the right position. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: tvlv realloc, move error handling into if blockMarkus Pargmann1-8/+8
Instead of hiding the normal function flow inside an if block, we should just put the error handling into the if block. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: debugfs, avoid compiling for !DEBUG_FSMarkus Pargmann3-9/+35
Normally the debugfs framework will return error pointer with -ENODEV for function calls when DEBUG_FS is not set. batman does not notice this error code and continues trying to create debugfs files and executes more code. We can avoid this code execution by disabling compiling debugfs.c when DEBUG_FS is not set. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: Use only queued fragments when mergingSven Eckelmann1-8/+5
The fragment queueing code now validates the total_size of each fragment, checks when enough fragments are queued to allow to merge them into a single packet and if the fragments have the correct size. Therefore, it is not required to have any other parameter for the merging function than a list of queued fragments. This change should avoid problems like in the past when the different skb from the list and the function parameter were mixed incorrectly. Signed-off-by: Sven Eckelmann <sven@narfation.org> Acked-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: Check total_size when queueing fragmentsSven Eckelmann2-2/+7
The fragmentation code was replaced in 610bfc6bc99bc83680d190ebc69359a05fc7f605 ("batman-adv: Receive fragmented packets and merge") by an implementation which handles the queueing+merging of fragments based on their size and the total_size of the non-fragmented packet. This total_size is announced by each fragment. The new implementation doesn't check if the the total_size information of the packets inside one chain is consistent. This is consistency check is recommended to allow using any of the packets in the queue to decide whether all fragments of a packet are received or not. Signed-off-by: Sven Eckelmann <sven@narfation.org> Acked-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: update copyright years for 2015Sven Eckelmann43-43/+43
Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-05-29batman-adv: Start new development cycleSimon Wunderlich1-1/+1
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
2015-04-02dev: introduce dev_get_iflink()Nicolas Dichtel1-2/+3
The goal of this patch is to prepare the removal of the iflink field. It introduces a new ndo function, which will be implemented by virtual interfaces. There is no functional change into this patch. All readers of iflink field now call dev_get_iflink(). Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-02-22batman-adv: Fix use of seq_has_overflowed()Joe Perches1-1/+1
net-next commit 6d91147d183c ("batman-adv: Remove uses of return value of seq_printf") incorrectly changed the overflow occurred return from -1 to 1. Change it back so that the test of batadv_write_buffer_text's return value in batadv_gw_client_seq_print_text works properly. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-02-20batman-adv: Remove uses of return value of seq_printfJoe Perches1-9/+10
This function is soon going to return void so remove the return value use. Convert the return value to test seq_has_overflowed() instead. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-07batman-adv: Kconfig, Add missing DEBUG_FS dependencyMarkus Pargmann1-0/+1
BATMAN_ADV_DEBUG is using debugfs files for the debugging log. So it depends on DEBUG_FS which is missing as dependency in the Kconfig file. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: Start new development cycleSimon Wunderlich1-1/+1
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: fix misspelled wordsAntonio Quartulli6-8/+8
Reported-by: checkpatch Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-07batman-adv: clear control block of received socket buffersMartin Hundebøll1-0/+3
Since other network components (and some drivers) uses the control block provided in skb's, the network coding feature might wrongly assume that an SKB has been decoded, and thus not try to code it with another packet again. This happens for instance when batman-adv is running on a bridge device. Fix this by clearing the control block for every received SKB. Introduced by 3c12de9a5c756b23fe7c9ab332474ece1568914c ("batman-adv: network coding - code and transmit packets if possible") Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: checkpatch - remove unnecessary parenthesesAntonio Quartulli1-2/+2
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-07batman-adv: checkpatch - Please don't use multiple blank linesAntonio Quartulli11-18/+0
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-07batman-adv: checkpatch - Please use a blank line after declarationsAntonio Quartulli4-0/+4
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-07batman-adv: checkpatch - No space is necessary after a castAntonio Quartulli1-4/+4
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-07batman-adv: checkpatch - else is not generally useful after a break or returnAntonio Quartulli4-9/+5
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-07batman-adv: kernel doc fixes for main.{c, h}Martin Hundebøll2-5/+4
Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: kernel doc fix for distributed-arp-table.hMartin Hundebøll1-3/+1
Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Acked-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: kernel doc fixes for bridge_loop_avoidance.cMartin Hundebøll1-1/+5
Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Acked-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: kernel doc fixes for bat_iv_ogm.cMartin Hundebøll1-4/+5
Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: remove obsolete variable primary_iface from orig_nodeSimon Wunderlich1-2/+0
This variable became obsolete when changing to the new bonding mechanism based on the multi interface optimization. Since its not used anywhere, remove it. Reported-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-07batman-adv: avoid useless return in void functionsAntonio Quartulli2-4/+0
Cc: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-01-06batman-adv: fix potential TT client + orig-node memory leakLinus Lüssing1-3/+3
This patch fixes a potential memory leak which can occur once an originator times out. On timeout the according global translation table entry might not get purged correctly. Furthermore, the non purged TT entry will cause its orig-node to leak, too. Which additionally can lead to the new multicast optimization feature not kicking in because of a therefore bogus counter. In detail: The batadv_tt_global_entry->orig_list holds the reference to the orig-node. Usually this reference is released after BATADV_PURGE_TIMEOUT through: _batadv_purge_orig()-> batadv_purge_orig_node()->batadv_update_route()->_batadv_update_route()-> batadv_tt_global_del_orig() which purges this global tt entry and releases the reference to the orig-node. However, if between two batadv_purge_orig_node() calls the orig-node timeout grew to 2*BATADV_PURGE_TIMEOUT then this call path isn't reached. Instead the according orig-node is removed from the originator hash in _batadv_purge_orig(), the batadv_update_route() part is skipped and won't be reached anymore. Fixing the issue by moving batadv_tt_global_del_orig() out of the rcu callback. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> Acked-by: Antonio Quartulli <antonio@meshcoding.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-06batman-adv: fix multicast counter when purging originatorsLinus Lüssing1-1/+2
When purging an orig_node we should only decrease counter tracking the number of nodes without multicast optimizations support if it was increased through this orig_node before. A not yet quite initialized orig_node (meaning it did not have its turn in the mcast-tvlv handler so far) which gets purged would not adhere to this and will lead to a counter imbalance. Fixing this by adding a check whether the orig_node is mcast-initalized before decreasing the counter in the mcast-orig_node-purging routine. Introduced by 60432d756cf06e597ef9da511402dd059b112447 ("batman-adv: Announce new capability via multicast TVLV") Reported-by: Tobias Hachmer <tobias@hachmer.de> Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-06batman-adv: fix counter for multicast supporting nodesLinus Lüssing1-3/+5
A miscounting of nodes having multicast optimizations enabled can lead to multicast packet loss in the following scenario: If the first OGM a node receives from another one has no multicast optimizations support (no multicast tvlv) then we are missing to increase the counter. This potentially leads to the wrong assumption that we could safely use multicast optimizations. Fixings this by increasing the counter if the initial OGM has the multicast TVLV unset, too. Introduced by 60432d756cf06e597ef9da511402dd059b112447 ("batman-adv: Announce new capability via multicast TVLV") Reported-by: Tobias Hachmer <tobias@hachmer.de> Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
2015-01-06batman-adv: fix lock class for decoding hash in network-coding.cMartin Hundebøll1-1/+1
batadv_has_set_lock_class() is called with the wrong hash table as first argument (probably due to a copy-paste error), which leads to false positives when running with lockdep. Introduced-by: 612d2b4fe0a1ff2f8389462a6f8be34e54124c05 ("batman-adv: network coding - save overheard and tx packets for decoding") Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>