aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv (follow)
AgeCommit message (Collapse)AuthorFilesLines
2011-11-20batman-adv: Fix range check for expected packetsSimon Wunderlich1-1/+1
The check for new packets in the future used a wrong binary operator, which makes the check expression always true and accepting too many packets. Reported-by: Thomas Jarosch <thomas.jarosch@intra2net.com> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: check for tt_reponse packet real lengthAntonio Quartulli1-0/+9
Before accessing the TT_RESPONSE packet payload, the node has to ensure that the packet is long enough as it would expect to be. Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: linearise the tt_response skb only if neededAntonio Quartulli1-5/+6
The TT_RESPONSE skb has to be linearised only if the node plans to access the packet payload (so only if the message is directed to that node). In all the other cases the node can avoid this memory operation Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: directly write tt entries without bufferingSimon Wunderlich1-55/+2
When the translation tables (global and local) are written for debugfs, it is not neccesary to allocate a buffer, we can directly use seq_printf() to print them out. This might actually be safer if the table changes between size calculation and traversal, and we can't estimate the required size wrong. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: fixed hash functions type to uint32_t instead of intAntonio Quartulli7-36/+47
There are two reasons for this fix: - the result of choose_orig() and vis_choose() is an index and therefore it can't be negative. Hence it is correct to make the return type unsigned too. - sizeof(int) may not be the same on ALL the architectures. Since we plan to use choose_orig() as DHT hash function, we need to guarantee that, given the same argument, the result is the same. Then it is correct to explicitly express the size of the return type (and the second argument). Since the expected length is currently 4, uint32_t is the most convenient choice. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: use orig_hash_find() instead of get_orig_node() in TT codeAntonio Quartulli1-3/+3
get_orig_node() tries to retrieve an orig_node object based on a mac address and creates it if not present. This is not the wanted behaviour in the translation table code as we don't want to create new orig_code objects but expect a NULL pointer if the object does not exist. Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: refactoring gateway handling codeMarek Lindner3-75/+126
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: Replace obsolete strict_strto<foo> with kstrto<foo>Sven Eckelmann2-4/+4
strict_strto<foo> is obsolete since v3.1-rc8-8466-g14acc55 and should be replaced with kstrto<foo>. Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: tt_global_del_orig() has to print the correct messageAntonio Quartulli1-2/+3
When deleting the entries, tt_global_del_orig() has to print the message passed as argument instead of a static one. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-11-20batman-adv: update internal version numberSven Eckelmann1-1/+1
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2011-10-30Merge branch 'batman-adv/maint' of git://git.open-mesh.org/linux-mergeDavid S. Miller2-3/+18
2011-10-25batman-adv: unify hash_entry field position in tt_local/global_entryAntonio Quartulli1-2/+2
Function tt_response_fill_table() actually uses a tt_local_entry pointer to iterate either over the local or the global table entries (it depends on the what hash table is passed as argument). To iterate over such entries the hlist_for_each_entry_rcu() macro has to access their "hash_entry" field which MUST be at the same position in both the tt_global/local_entry structures. 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>
2011-10-25batman-adv: add sanity check when removing global ttsSimon Wunderlich1-0/+3
After removing the batman-adv module, the hash may be already gone when tt_global_del_orig() tries to clean the hash. This patch adds a sanity check to avoid this. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Tested-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-10-25batman-adv: remove references for global tt entriesSimon Wunderlich1-1/+13
struct tt_global_entry holds a reference to an orig_node which must be decremented before deallocating the structure. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Tested-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-10-24Merge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+6
2011-10-18batman-adv: correctly set the data field in the TT_REPONSE packetAntonio Quartulli1-1/+4
In the TT_RESPONSE packet, the number of carried entries is not correctly set. This leads to a wrong interpretation of the packet payload on the receiver side causing random entries to be added to the global translation table. Therefore the latter gets always corrupted, triggering a table recovery all the time. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-10-18batman-adv: fix tt_local_reset_flags() functionAntonio Quartulli1-0/+2
Currently the counter of tt_local_entry structures (tt_local_num) is incremented each time the tt_local_reset_flags() is invoked causing the node to send wrong TT_REPONSE packets containing a copy of non-initialised memory thus corrupting other nodes global translation table and making higher level communication impossible. Reported-by: Junkeun Song <jun361@gmail.com> Signed-off-by: Antonio Quartulli <ordex@autistici.org> Acked-by: Junkeun Song <jun361@gmail.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-10-07Merge branch 'master' of github.com:davem330/netDavid S. Miller1-5/+5
Conflicts: net/batman-adv/soft-interface.c
2011-09-22batman-adv: do_bcast has to be true for broadcast packets onlyAntonio Quartulli1-5/+5
corrects a critical bug of the GW feature. This bug made all the unicast packets destined to a GW to be sent as broadcast. This bug is present even if the sender GW feature is configured as OFF. It's an urgent bug fix and should be committed as soon as possible. This was a regression introduced by 43676ab590c3f8686fd047d34c3e33803eef71f0 Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-09-08batman-adv: Remove unnecessary OOM logging messagesJoe Perches5-24/+7
Removing unnecessary messages saves code and text. Site specific OOM messages are duplications of a generic MM out of memory message and aren't really useful, so just delete them. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-09-08batman-adv: update internal version numberSven Eckelmann1-1/+1
Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-09-08batman-adv: agglomerate all batman iv ogm sending functions in the batman iv fileMarek Lindner8-599/+522
In the process the batman iv OGM aggregation code could be merged into the batman iv code base which makes the separate aggregation files superfluous. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-09-08batman-adv: move routing packet initialization into corresponding fileMarek Lindner3-32/+46
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-09-08batman-adv: agglomerate all batman iv ogm processing functions in a single fileMarek Lindner9-634/+698
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>
2011-09-08batman-adv: rename all instances of batman_packet to batman_ogm_packetMarek Lindner9-182/+204
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>
2011-08-22batman-adv: merge update_transtable() into tt related codeMarek Lindner3-74/+70
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-08-22batman-adv: reuse tt_len() to calculate tt buffer lengthMarek Lindner1-2/+1
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org>
2011-08-22batman-adv: print client flags in the local/global transtables outputAntonio Quartulli1-10/+27
Since clients can have several flags on or off, this patches make them appear in the local/global transtable output so that they can be checked for debugging purposes. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-08-22batman-adv: implement AP-isolation on the sender sideAntonio Quartulli5-12/+29
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>
2011-08-22batman-adv: implement AP-isolation on the receiver sideAntonio Quartulli5-0/+50
When a node receives a unicast packet it checks if the source and the destination client can communicate or not due to the AP isolation Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-08-22batman-adv: detect clients connected through a 802.11 deviceAntonio Quartulli9-11/+55
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>
2011-08-22batman-adv: correct several typ0s in the commentsAntonio Quartulli12-37/+36
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>
2011-08-22batman-adv: hash_add() has to discriminate on the return valueAntonio Quartulli3-9/+22
hash_add() returns 0 on success while returns -1 either on error and on entry already present. The caller could use such information to select its behaviour. For this reason it is useful that hash_add() returns -1 in case on error and returns 1 in case of entry already present. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-12netdevice: Kill 'feature' test macros.David S. Miller1-16/+0
Almost all of these have long outstayed their welcome. And for every one of these macros, there are 10 features for which we didn't add macros. Let's just delete them all, and get out of habit of doing things this way. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
2011-07-08Merge branch 'batman-adv/next' of git://git.open-mesh.org/linux-mergeDavid S. Miller6-32/+147
2011-07-07batman-adv: request the full table if tt_crc doesn't matchAntonio Quartulli1-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>
2011-07-07batman-adv: keep global table consistency in case of roamingAntonio Quartulli1-2/+8
To keep consistency of other originator tables, new clients detected as roamed, are kept in the global table but are marked as TT_CLIENT_PENDING They are purged only when the new ttvn is received by the corresponding originator. Moreover they need to be considered as removed in case of global transtable lookup. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-07batman-adv: keep local table consistency for further TT_RESPONSEAntonio Quartulli4-30/+125
To keep transtable consistency among all the nodes, an originator must not send not yet announced clients within a full table TT_RESPONSE. Instead, deleted client have to be kept in the table in order to be sent within an immediate TT_RESPONSE. In this way all the nodes in the network will always provide the same response for the same request. All the modification are committed at the next ttvn increment event. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-07batman-adv: initialise last_ttvn and tt_crc for the orig_node structureAntonio Quartulli1-0/+2
The last_ttvn and tt_crc fields of the orig_node structure were not initialised causing an immediate TT_REQ/RES dialogue even if not needed. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-05Merge branch 'batman-adv/next' of git://git.open-mesh.org/linux-mergeDavid S. Miller13-59/+71
2011-07-05batman-adv: Replace version info instead of appending themSven Eckelmann4-21/+9
The version number of modules build outside of the tree can get revision numbers added. This is useful to give hints about the revision of a distribution package and the used patchset. The prepended source number or branch name doesn't add any additional information which would help to identify problems and can therefore be omitted. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-05batman-adv: aggregation checks should use the primary_if pointerMarek Lindner1-5/+20
The packet aggregation needs to ensure that only compatible packets are aggregated. Some of the checks are based on the interface number while assuming that the first interface also is the primary interface which is not always the case. This patch addresses the issue by using the primary_if pointer. Reported-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-05batman-adv: broadcast primary OGM on all active hard-interfacesMarek Lindner1-4/+13
The primary interface OGM has to be broadcasted on all hard-interfaces even if the primary interface is not the first interface (if_num = 0). Therefore the code has to compare the originating interface with the primary interface instead of checking the if_num. Reported-by: Linus Luessing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-05batman-adv: pass a unique flag arg instead of a sequence of bool onesAntonio Quartulli1-11/+10
now tt_local_event() takes a flags argument instead of a sequence of boolean values which would grow up with the time. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-07-05batman-adv: add_bcast_packet_to_list() takes the sending delay as parameterAntonio Quartulli4-5/+5
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>
2011-07-05batman-adv: unify flags for tt_change/tt_local_entry/tt_global_entryAntonio Quartulli4-15/+16
The tt_local_entry structure now has a 'flags' field. This helps to unify the flags format to all the client related structures (tt_global_entry and tt_change). The 'never_purge' field is now encoded in the 'flags' one. To optimise the usage of this field, its length has been increased to 16bit in order to use the eight leading bits (from 0 to 7) to store flags that have to be sent on the wire, while the eight ending ones are used for local computation only. Moreover 'enum tt_change_flags' is now called 'enum tt_client_flags' and the defined values apply to the tt_local_entry, tt_global_entry and the tt_change 'flags' field. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
2011-06-20Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-mergeDavid S. Miller27-462/+2080
2011-06-20batman-adv: improved gateway tq-based selectionAntonio Quartulli4-6/+104
If a client issues a DHCPREQUEST for renewal, the packet is dropped if the old destination (the old gateway for the client) TQ is smaller than the current best gateway TQ less GW_THRESHOLD 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>
2011-06-20batman-adv: throw uevent in userspace on gateway add/change/del eventAntonio Quartulli1-0/+6
In case of new default gw, changing the default gw or deleting the default gw a uevent is triggered with type=gw, action=add/change/del and data={GW_ORIG_ADDRESS} (if any). 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>
2011-06-20batman-adv: gateway election code refactoringAntonio Quartulli3-56/+82
The gateway election mechanism has been a little revised. Now the gw_election is trigered by an atomic_t flag (gw_reselect) which is set to 1 in case of election needed, avoding to set curr_gw to NULL. 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>