summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
Commit message (Collapse)AuthorAgeFilesLines
* batman-adv: Fix merge error.David S. Miller2011-12-161-1/+1
| | | | | | | | | | I didn't resolve the merge properly during the last pull of the net tree into net-next. The code in the final resolution should set flags to TT_CLIENT_ROAM not TT_CLIENT_PENDING. Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2011-12-161-4/+20
|\ | | | | | | | | | | | | Conflicts: drivers/net/ethernet/freescale/fsl_pq_mdio.c net/batman-adv/translation-table.c net/ipv6/route.c
| * batman-adv: delete global entry in case of roamingAntonio Quartulli2011-12-071-3/+18
| | | | | | | | | | | | | | | | | | | | | | When receiving a DEL change for a client due to a roaming event (change is marked with TT_CLIENT_ROAM), each node has to check if the client roamed to itself or somewhere else. In the latter case the global entry is kept to avoid having no route at all otherwise we can safely delete the global entry Signed-off-by: Antonio Quartulli <ordex@autistici.org>
| * batman-adv: in case of roaming mark the client with TT_CLIENT_ROAMAntonio Quartulli2011-12-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of a client roaming from node A to node B, the latter have to mark the corresponding global entry with TT_CLIENT_ROAM (instead of TT_CLIENT_PENDING). Marking a global entry with TT_CLIENT_PENDING will end up in keeping such entry forever (because this flag is only meant to be used with local entries and it is never checked on global ones). In the worst case (all the clients roaming to the same node A) the local and the global table will contain exactly the same clients. Batman-adv will continue to work, but the memory usage is duplicated. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
* | batman-adv: Only write requested number of byte to user bufferSven Eckelmann2011-12-121-3/+2
| | | | | | | | | | | | | | | | | | Don't write more than the requested number of bytes of an batman-adv icmp packet to the userspace buffer. Otherwise unrelated userspace memory might get overridden by the kernel. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: Directly check read of icmp packet in copy_from_userSven Eckelmann2011-12-121-6/+1
| | | | | | | | | | | | | | | | The access_ok read check can be directly done in copy_from_user since a failure of access_ok is handled the same way as an error in __copy_from_user. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: bat_socket_read missing checksPaul Kot2011-12-121-2/+2
| | | | | | | | | | | | | | | | | | | | Writing a icmp_packet_rr and then reading icmp_packet can lead to kernel memory corruption, if __user *buf is just below TASK_SIZE. Signed-off-by: Paul Kot <pawlkt@gmail.com> [sven@narfation.org: made it checkpatch clean] Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: format multi-line if in the correct wayAntonio Quartulli2011-12-071-2/+1
| | | | | | | | | | | | | | | | | | in an multi-line if statement leading edges should line up to the opening parenthesis Reported-by: David Miller <davem@davemloft.net> Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: remove extra negation in gw_out_of_range()Dan Carpenter2011-12-071-1/+1
| | | | | | | | | | | | | | | | There is a typo here where an extra '!' made the check to the opposite of what was intended. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: use unregister_netdevice() when softif_create failsSimon Wunderlich2011-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When entering softif_create(), the rtnl lock has already been acquired by store_mesh_iface(). (store_mesh_iface() -> hardif_enable_interface() -> softif_create) In case of an error, we should therefore call unregister_netdevice() instead of unregister_netdev(). unregister_netdev() tries to acquire the rtnl lock itself and deadlocks in this situation. unregister_netdevice() assumes that the rtnl lock is already been held. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: check return value for hash_add()Simon Wunderlich2011-11-201-6/+22
| | | | | | | | | | | | | | | | | | if hash_add() fails, we should remove the structure to avoid memory leaks. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Acked-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: generalise tt_local_reset_flags()Antonio Quartulli2011-11-201-12/+23
| | | | | | | | | | | | | | | | | | | | | | The tt_local_reset_flags() is actually used for one use case only. It is not generalised enough to be used indifferent situations. This patch make it general enough in order to let other code use it whenever a flag set is requested over the whole hash table (passed as parameter). The function is now called tt_set_flags() Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: create a common substructure for tt_global/local_entryAntonio Quartulli2011-11-203-140/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several functions in the translation table management code assume that the tt_global_entry and tt_local_entry structures have the same initial fields such as 'addr' and 'hash_entry'. To improve the code readability and to avoid mistakes in later changes, a common substructure that substitute the shared fields has been introduced (struct tt_common_entry). Thanks to this modification, it has also been possible to slightly reduce the code length by merging some functions like compare_ltt/gtt() and tt_local/global_hash_find() Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: report compat_version in version field in case of version mismatchMarek Lindner2011-11-201-1/+1
| | | | | | | | | | | | Reported-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven@narfation.org>
* | batman-adv: Fix range check for expected packetsSimon Wunderlich2011-11-201-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>
* | batman-adv: check for tt_reponse packet real lengthAntonio Quartulli2011-11-201-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>
* | batman-adv: linearise the tt_response skb only if neededAntonio Quartulli2011-11-201-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>
* | batman-adv: directly write tt entries without bufferingSimon Wunderlich2011-11-201-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>
* | batman-adv: fixed hash functions type to uint32_t instead of intAntonio Quartulli2011-11-207-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>
* | batman-adv: use orig_hash_find() instead of get_orig_node() in TT codeAntonio Quartulli2011-11-201-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>
* | batman-adv: refactoring gateway handling codeMarek Lindner2011-11-203-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>
* | batman-adv: Replace obsolete strict_strto<foo> with kstrto<foo>Sven Eckelmann2011-11-202-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>
* | batman-adv: tt_global_del_orig() has to print the correct messageAntonio Quartulli2011-11-201-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>
* | batman-adv: update internal version numberSven Eckelmann2011-11-201-1/+1
|/ | | | Signed-off-by: Sven Eckelmann <sven@narfation.org>
* Merge branch 'batman-adv/maint' of git://git.open-mesh.org/linux-mergeDavid S. Miller2011-10-302-3/+18
|\
| * batman-adv: unify hash_entry field position in tt_local/global_entryAntonio Quartulli2011-10-251-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>
| * batman-adv: add sanity check when removing global ttsSimon Wunderlich2011-10-251-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>
| * batman-adv: remove references for global tt entriesSimon Wunderlich2011-10-251-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>
* | Merge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/davem/netDavid S. Miller2011-10-241-1/+6
|\ \ | |/
| * batman-adv: correctly set the data field in the TT_REPONSE packetAntonio Quartulli2011-10-181-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>
| * batman-adv: fix tt_local_reset_flags() functionAntonio Quartulli2011-10-181-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>
* | Merge branch 'master' of github.com:davem330/netDavid S. Miller2011-10-071-5/+5
|\ \ | |/ | | | | | | Conflicts: net/batman-adv/soft-interface.c
| * batman-adv: do_bcast has to be true for broadcast packets onlyAntonio Quartulli2011-09-221-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>
* | batman-adv: Remove unnecessary OOM logging messagesJoe Perches2011-09-085-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>
* | batman-adv: update internal version numberSven Eckelmann2011-09-081-1/+1
| | | | | | | | | | Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: agglomerate all batman iv ogm sending functions in the batman iv ↵Marek Lindner2011-09-088-599/+522
| | | | | | | | | | | | | | | | | | | | file 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>
* | batman-adv: move routing packet initialization into corresponding fileMarek Lindner2011-09-083-32/+46
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: agglomerate all batman iv ogm processing functions in a single fileMarek Lindner2011-09-089-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>
* | batman-adv: rename all instances of batman_packet to batman_ogm_packetMarek Lindner2011-09-089-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>
* | batman-adv: merge update_transtable() into tt related codeMarek Lindner2011-08-223-74/+70
| | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
* | batman-adv: reuse tt_len() to calculate tt buffer lengthMarek Lindner2011-08-221-2/+1
| | | | | | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org>
* | batman-adv: print client flags in the local/global transtables outputAntonio Quartulli2011-08-221-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>
* | batman-adv: implement AP-isolation on the sender sideAntonio Quartulli2011-08-225-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>
* | batman-adv: implement AP-isolation on the receiver sideAntonio Quartulli2011-08-225-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>
* | batman-adv: detect clients connected through a 802.11 deviceAntonio Quartulli2011-08-229-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>
* | batman-adv: correct several typ0s in the commentsAntonio Quartulli2011-08-2212-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>
* | batman-adv: hash_add() has to discriminate on the return valueAntonio Quartulli2011-08-223-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>
* netdevice: Kill 'feature' test macros.David S. Miller2011-07-121-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>
* Merge branch 'batman-adv/next' of git://git.open-mesh.org/linux-mergeDavid S. Miller2011-07-086-32/+147
|\
| * batman-adv: request the full table if tt_crc doesn't matchAntonio Quartulli2011-07-071-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>
OpenPOWER on IntegriCloud