summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
Commit message (Collapse)AuthorAgeFilesLines
* batman-adv: Don't leak information through uninitialized packet fieldsSven Eckelmann2012-07-011-0/+1
| | | | | | | | | | The reserved fields in batman-adv packets are not set to a constant value. The content of these memory regions is leaked unintentionally to the network. This regression was introduced in 3b27ffb00fbe9d9189715ea13ce8712e2f0cb0c5 Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: Prefix types structs with batadv_Sven Eckelmann2012-07-011-215/+231
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix packet structs with batadv_Sven Eckelmann2012-07-011-54/+65
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix hash struct and typedef with batadv_Sven Eckelmann2012-07-011-15/+15
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix main enum with BATADV_Sven Eckelmann2012-07-011-17/+18
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix packet enum with BATADV_Sven Eckelmann2012-07-011-93/+98
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix types enum with BATADV_Sven Eckelmann2012-07-011-4/+4
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix hard-interface enum with BATADV_Sven Eckelmann2012-07-011-2/+2
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix main defines with BATADV_Sven Eckelmann2012-06-281-37/+50
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix packet defines with BATADV_Sven Eckelmann2012-06-281-4/+4
| | | | | Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: beautify tt_global_add() argument listAntonio Quartulli2012-06-281-15/+9Star
| | | | | | | | Instead of adding a new bool argument each time it is needed, it is better (and simpler) to pass an 8bit flag argument which contains all the needed flags Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: clear ADD+DEL (and viceversa) events in the same orig-intervalAntonio Quartulli2012-06-281-3/+37
| | | | | | | | | | | | | | During an OGM-interval (time between two different OGM sendings) the same client could roam away and then roam back to us. In this case the node would add two events to the events list (that is going to be sent appended to the next OGM). A DEL one and an ADD one. Obviously they will only increase the overhead (either in the air and on the receiver side) and eventually trigger wrong states/events without producing any real effect. For this reason we can safely delete any ADD event with its related DEL one. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Prefix remaining function like macros with batadv_Sven Eckelmann2012-06-281-2/+2
| | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: fix global TT entry deletionAntonio Quartulli2012-06-261-0/+2
| | | | | | | | During the last merge involving translation-table.c something went wrong and two lines disappeared from translation-table.c. This patch recovers them. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* batman-adv: fix condition in AP isolationAntonio Quartulli2012-06-261-1/+1
| | | | | | | | | During the last conflict resolution involving translation-table.c something went wrong and a condition in the AP isolation code was reversed. This patch fixes this problem. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-mergeDavid S. Miller2012-06-261-359/+385
|\ | | | | | | | | | | | | | | | | | | Included changes: - yet another batch of 'namespace cleaning' patches Conflicts: net/batman-adv/translation-table.c Signed-off-by: David S. Miller <davem@davemloft.net>
| * batman-adv: Prefix translation-table local static functions with batadv_Sven Eckelmann2012-06-251-258/+282
| | | | | | | | | | | | | | | | All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Prefix main static inline functions with batadv_Sven Eckelmann2012-06-251-74/+75
| | | | | | | | | | | | | | | | All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Prefix originator static inline functions with batadv_Sven Eckelmann2012-06-241-10/+11
| | | | | | | | | | | | | | | | All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Prefix hash static inline functions with batadv_Sven Eckelmann2012-06-241-11/+13
| | | | | | | | | | | | | | | | All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
| * batman-adv: Prefix hard-interface static inline functions with batadv_Sven Eckelmann2012-06-241-14/+14
| | | | | | | | | | | | | | | | All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2012-06-261-6/+6
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/net/usb/qmi_wwan.c net/batman-adv/translation-table.c net/ipv6/route.c qmi_wwan.c resolution provided by Bjørn Mork. batman-adv conflict is dealing merely with the changes of global function names to have a proper subsystem prefix. ipv6's route.c conflict is merely two side-by-side additions of network namespace methods. Signed-off-by: David S. Miller <davem@davemloft.net>
| * batman-adv: fix race condition in TT full-table replacementAntonio Quartulli2012-06-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug introduced with cea194d90b11aff7fc289149e4c7f305fad3535a In the current TT code, when a TT_Response containing a full table is received from an originator, first the node purges all the clients for that originator in the global translation-table and then merges the newly received table. During the purging phase each client deletion is done by means of a call_rcu() invocation and at the end of this phase the global entry counter for that originator is set to 0. However the invoked rcu function decreases the global entry counter for that originator by one too and since the rcu invocation is likely to be postponed, the node will end up in first setting the counter to 0 and then decreasing it one by one for each deleted client. This bug leads to having a wrong global entry counter for the related node, say X. Then when the node with the broken counter will answer to a TT_REQUEST on behalf of node X, it will create faulty TT_RESPONSE that will generate an unrecoverable situation on the node that asked for the full table recover. The non-recoverability is given by the fact that the node with the broken counter will keep answering on behalf of X because its knowledge about X's state (ttvn + tt_crc) is correct. To solve this problem the counter is not explicitly set to 0 anymore and the counter decrement is performed right before the invocation of call_rcu(). Signed-off-by: Antonio Quartulli <ordex@autistici.org>
| * batman-adv: only drop packets of known wifi clientsMarek Lindner2012-06-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | bug introduced with 59b699cdee039d75915c354da06937102d1f9a84 If the source or destination mac address of an ethernet packet could not be found in the translation table the packet was dropped if AP isolation was turned on. This behavior would make it impossible to send broadcast packets over the mesh as the broadcast address will never enter the translation table. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org>
* | batman-adv: Reformat multiline comments to consistent styleSven Eckelmann2012-06-201-29/+49
| | | | | | | | | | | | | | | | batman-adv doesn't follow the style for multiline comments that David S. Miller prefers. All comments should be reformatted to follow this consistent style to make the code slightly more readable. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix main non-static functions with batadv_Sven Eckelmann2012-06-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix translation-table non-static functions with batadv_Sven Eckelmann2012-06-201-39/+45
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix send non-static functions with batadv_Sven Eckelmann2012-06-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix originator non-static functions with batadv_Sven Eckelmann2012-06-201-16/+16
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix hash non-static functions with batadv_Sven Eckelmann2012-06-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix hard-interface non-static functions with batadv_Sven Eckelmann2012-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Prefix bridge_loop_avoidance non-static functions with batadv_Sven Eckelmann2012-06-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem. Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: turn tt commit code into routing protocol agnostic APIMarek Lindner2012-06-181-20/+104
| | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch the translation table code made assumptions about how the routing protocol works and where its buffers are stored (to directly modify them). Each protocol now calls the tt code with the relevant pointers, thereby abstracting the code. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: don't bother flipping ->tt_dataAl Viro2012-06-181-4/+6
| | | | | | | | | | | | | | | | | | just keep it net-endian all along Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> [lindner_marek@yahoo.de: fix checkpatch warnings] Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Return error codes instead of -1 on failuresSven Eckelmann2012-06-181-10/+14
| | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: return added entries instead of number of possibly added entriesMarek Lindner2012-06-181-1/+1
| | | | | | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Add get_ethtool_stats() supportMartin Hundebøll2012-06-181-0/+8
|/ | | | | | | | | | | | | | | | | | | Added additional counters in a bat_stats structure, which are exported through the ethtool api. The counters are specific to batman-adv and includes: forwarded packets and bytes management packets and bytes (aggregated OGMs at this point) translation table packets New counters are added by extending "enum bat_counters" in types.h and adding corresponding descriptive string(s) to bat_counters_strings in soft-iface.c. Counters are increased by calling batadv_add_counter() and incremented by one by calling batadv_inc_counter(). Signed-off-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: unset the TT_CLIENT_PENDING flag if the new local entry already ↵Antonio Quartulli2012-05-141-0/+2
| | | | | | | | | | | exists When trying to add a new tt_local_entry, if such entry already exists, we have to ensure that the TT_CLIENT_PENDING flag is not set, otherwise the entry will be deleted soon. Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: improve unicast packet (re)routingAntonio Quartulli2012-05-131-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of a client X roaming from a generic node A to another node B, it is possible that a third node C gets A's OGM but not B's. At this point in time, if C wants to send data to X it will send a unicast packet destined to A. The packet header will contain A's last ttvn (C got A's OGM and so it knows it). The packet will travel towards A without being intercepted because the ttvn contained in its header is the newest for A. Once A will receive the packet, A's state will not report to be in a "roaming phase" (because, after a roaming, once A sends out its OGM, all the changes are committed and the node is considered not to be in the roaming state anymore) and it will match the ttvn carried by the packet. Therefore there is no reason for A to try to alter the packet's route, thus dropping the packet because the destination client is not there anymore. However, C is well aware that it's routing information towards the client X is outdated as it received an OGM from A saying that the client roamed away. Thanks to this detail, this patch introduces a small change in behaviour: as long as C is in the state of not knowing the new location of client X it will forward the traffic to its last known location using ttvn-1 of the destination. By using an older ttvn node A will be forced to re-route the packet. Intermediate nodes are also allowed to update the packet's destination as long as they have the information about the client's new location. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: add contributor nameAntonio Quartulli2012-05-111-1/+1
| | | | | | | translation_table.{c,h} have been heavily modified by another contributor and for legal purposes it is better to include his name into the contributor list Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: convert the tt_crc to network orderAntonio Quartulli2012-04-181-1/+1
| | | | | | | | Before sending out a TT_Request packet we must convert the tt_crc field value to network order (since it is 16bits long). Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: don't let backbone gateways exchange tt entriesSimon Wunderlich2012-04-111-2/+16
| | | | | | | | As the backbone gateways are connected to the same backbone, they should announce the same clients on the backbone non-exclusively. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: allow multiple entries in tt_global_entriesSimon Wunderlich2012-04-111-92/+303
| | | | | | | | | as backbone gateways will all independently announce the same clients, also the tt global table must be able to hold multiple originators per client entry. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: Remove declaration of only locally used functionsSven Eckelmann2012-04-111-8/+14
| | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org> Acked-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* batman-adv: Ignore 80-chars per line limits for stringsSven Eckelmann2012-03-101-46/+43Star
| | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: Fix indentation of multiline statementsSven Eckelmann2012-02-281-13/+13
| | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: TT_CLIENT_PENDING is never set in struct tt_global_entryAntonio Quartulli2012-02-161-8/+1Star
| | | | | | | | | Actually the TT_CLIENT_PENDING flag is never set in the tt_global_entry structure, therefore this code is useless and can be removed. Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: code refactoring - move debug print into tt_local_set_pendingAntonio Quartulli2012-02-161-9/+6Star
| | | | | | | | Each tt_local_set_pending is always followed by a bat_dbg invocation. This can be simplified by moving the bat_dbg() call. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: set TT_CLIENT_NEW flag before invoking hash_add()Antonio Quartulli2012-02-161-5/+5
| | | | | | | | | In case of a new tt_local_entry, the TT_CLIENT_NEW flag has to be set before adding such entry to the hash table. Otherwise, it opens a race condition in which the entry can be found but the flag has not been set. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* batman-adv: Update copyright yearsSven Eckelmann2012-02-161-1/+1
| | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>