History log of /linux-master/net/batman-adv/main.h
Revision Date Author Comments
# df3fc228 12-Jan-2024 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 6.9.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# e4679a1b 24-Sep-2023 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 6.8.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 2744cefe 03-Aug-2023 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 6.6.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 55307f51 16-Dec-2022 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 6.3.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# ea92882b 16-Aug-2022 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 6.1.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# cfa4e7b1 22-Apr-2022 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 5.19.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 94ea9392 11-Jan-2022 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 5.18.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# c2262123 02-Sep-2021 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 5.17.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 53972e43 13-Jun-2021 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 5.15.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 3f693390 16-May-2021 Linus Lüssing <linus.luessing@c0d3.blue>

batman-adv: bcast: queue per interface, if needed

Currently we schedule a broadcast packet like:

3x: [ [(re-)queue] --> for(hard-if): maybe-transmit ]

The intention of queueing a broadcast packet multiple times is to
increase robustness for wireless interfaces. However on interfaces
which we only broadcast on once the queueing induces an unnecessary
penalty. This patch restructures the queueing to be performed on a per
interface basis:

for(hard-if):
- transmit
- if wireless: [queue] --> transmit --> [requeue] --> transmit

Next to the performance benefits on non-wireless interfaces this
should also make it easier to apply alternative strategies for
transmissions on wireless interfaces in the future (for instance sending
via unicast transmissions on wireless interfaces, without queueing in
batman-adv, if appropriate).

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 9a959cab 17-May-2021 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 5.14.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# cfa55c6d 31-Dec-2020 Sven Eckelmann <sven@narfation.org>

batman-adv: Drop publication years from copyright info

The batman-adv source code was using the year of publication (to net-next)
as "last" year for the copyright statement. The whole source code mentioned
in the MAINTAINERS "BATMAN ADVANCED" section was handled as a single entity
regarding the publishing year.

This avoided having outdated (in sense of year information - not copyright
holder) publishing information inside several files. But since the simple
"update copyright year" commit (without other changes) in the file was not
well received in the upstream kernel, the option to not have a copyright
year (for initial and last publication) in the files are chosen instead.
More detailed information about the years can still be retrieved from the
SCM system.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 03fd39ed 28-Dec-2020 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

This version will contain all the (major or even only minor) changes for
Linux 5.12.

The version number isn't a semantic version number with major and minor
information. It is just encoding the year of the expected publishing as
Linux -rc1 and the number of published versions this year (starting at 0).

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# aff6f5a6 17-Aug-2020 Sven Eckelmann <sven@narfation.org>

batman-adv: Drop deprecated debugfs support

The debugfs support in batman-adv was marked as deprecated by the commit
00caf6a2b318 ("batman-adv: Mark debugfs functionality as deprecated") and
scheduled for removal in 2021.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# fee3e955 27-Oct-2020 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 426988ee 31-Jul-2020 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# bccb48c8 01-Jun-2020 Sven Eckelmann <sven@narfation.org>

batman-adv: Fix typos and grammar in documentation

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# d528510e 26-Jun-2020 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 2a7e9786 13-Apr-2020 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# edddb366 12-Feb-2020 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 68e039f9 31-Dec-2019 Sven Eckelmann <sven@narfation.org>

batman-adv: Update copyright years for 2020

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# a7c4a547 25-Nov-2019 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 79f0a485 21-Sep-2019 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# bc986391 06-Jul-2019 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 68a600de 24-May-2019 Sven Eckelmann <sven@narfation.org>

batman-adv: Use includes instead of fwdecls

While it can be slightly beneficial for the build performance to use
forward declarations instead of includes, the handling of them together
with changes in the included headers makes it unnecessary complicated and
fragile. Just replace them with actual includes since some parts (hwmon,
..) of the kernel even request avoidance of forward declarations and net/
is mostly not using them in *.c file.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 47d4522d 24-May-2019 Sven Eckelmann <sven@narfation.org>

batman-adv: Add missing include for atomic functions

main.h is using atomic_add_unless and log.h atomic_read. The main
header linux/atomic.h should be included for these files.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# eef98918 07-Apr-2019 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# bdc76fd2 07-Apr-2019 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 0fa4c30d 03-Mar-2019 Sven Eckelmann <sven@narfation.org>

batman-adv: Make sysfs support optional

The sysfs files will be marked as deprecated in the near future. They are
already replaced by the batadv generic netlink family. Add an Kconfig
option to disable the sysfs support for users who want to test their tools
or want to safe some space. This setting should currently still be enabled
by default to keep backward compatible with legacy tools.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 0d5f20c4 03-Mar-2019 Sven Eckelmann <sven@narfation.org>

batman-adv: Drop license boilerplate

All files got a SPDX-License-Identifier with commit 7db7d9f369a4
("batman-adv: Add SPDX license identifier above copyright header"). All the
required information about the license conditions can be found in
LICENSES/.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7a79d717 31-Dec-2018 Sven Eckelmann <sven@narfation.org>

batman-adv: Update copyright years for 2019

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 25c097ca 30-Dec-2018 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# fb69be69 30-Oct-2018 Sven Eckelmann <sven@narfation.org>

batman-adv: Add inconsistent hardif netlink dump detection

The netlink dump functionality transfers a large number of entries from the
kernel to userspace. It is rather likely that the transfer has to
interrupted and later continued. During that time, it can happen that
either new entries are added or removed. The userspace could than either
receive some entries multiple times or miss entries.

Commit 670dc2833d14 ("netlink: advertise incomplete dumps") introduced a
mechanism to inform userspace about this problem. Userspace can then decide
whether it is necessary or not to retry dumping the information again.

The netlink dump functions have to be switched to exclusive locks to avoid
changes while the current message is prepared. And an external generation
sequence counter is introduced which tracks all modifications of the list.

Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 3987b6a4 04-Nov-2018 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# dabeb13e 14-Sep-2018 Sven Eckelmann <sven@narfation.org>

batman-adv: Increase version number to 2018.3

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 138c72ef 14-Sep-2018 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# f546a99d 19-Apr-2018 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 84d0a394 05-Jan-2018 Sven Eckelmann <sven@narfation.org>

batman-adv: Fix indentation of batadv_seq_before

Also multiline macros should have their statements start on a tabstop. This
was detected by checkpatch.pl after commit a134f8de9f40 ("checkpatch:
improve the TABSTOP test to include declarations").

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 6b1aea8c 31-Dec-2017 Sven Eckelmann <sven@narfation.org>

batman-adv: Update copyright years for 2018

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7e81c55e 27-Feb-2018 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# fec149f5 21-Dec-2017 Sven Eckelmann <sven.eckelmann@openmesh.com>

batman-adv: Convert packet.h to uapi header

The header file is used by different userspace programs to inject packets
or to decode sniffed packets. It should therefore be available to them as
userspace header.

Also other components in the kernel (like the flow dissector) require
access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
packets.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4e58452b 21-Dec-2017 Sven Eckelmann <sven.eckelmann@openmesh.com>

batman-adv: Let packet.h include its headers directly

The headers used by packet.h should also be included by it directly. main.h
is currently dealing with it in batman-adv, but this will no longer work
when this header is moved to include/uapi/linux/.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e57acf8e 02-Dec-2017 Sven Eckelmann <sven@narfation.org>

batman-adv: Add kernel-doc to functions in headers

Externally visible functions should be documented with kernel-doc. This
usually refers to non-static functions but also static inline files in
headers are visible in other files and should therefore be documented.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 73844a8c 02-Dec-2017 Sven Eckelmann <sven@narfation.org>

batman-adv: Add kernel-doc to enums in headers

All enums in types.h are already documented. But some other headers
still have private enums which also should be documented.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7e9a8c2c 02-Dec-2017 Sven Eckelmann <sven@narfation.org>

batman-adv: Use parentheses in function kernel-doc

The documentation describing kernel-doc comments for functions ("How to
format kernel-doc comments") uses parentheses at the end of the function
name. Using this format allows to use a consistent style when adding
documentation to a function and when referencing this function in a
different kernel-doc section.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7db7d9f3 19-Nov-2017 Sven Eckelmann <sven@narfation.org>

batman-adv: Add SPDX license identifier above copyright header

The "Linux kernel licensing rules" require that each file has a SPDX
license identifier as first line (and sometimes as second line).

The FSFE REUSE practices [1] would also require the same tags but have no
restrictions on the placement in the source file. Using the "Linux kernel
licensing rules" is therefore also fulfilling the FSFE REUSE practices
requirements at the same time.

[1] https://reuse.software/practices/

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 02dd9a8a 04-Dec-2017 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7e7c1afb 28-Sep-2017 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# a311abdf 28-Jul-2017 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 8ea026b1 22-Feb-2017 Matthias Schiffer <mschiffer@universe-factory.net>

batman-adv: decrease maximum fragment size

With this patch the maximum fragment size is reduced from 1400 to 1280
bytes.

Fragmentation v2 correctly uses the smaller of 1400 and the interface
MTU, thus generally supporting interfaces with an MTU < 1400 bytes, too.

However, currently "Fragmentation v2" does not support re-fragmentation.
Which means that once a packet is split into two packets of 1400 + x
bytes for instance and the next hop provides an interface with an even
smaller MTU of 1280 bytes, then the larger fragment is lost.

A maximum fragment size of 1280 bytes is a safer option as this is the
minimum MTU required by IPv6, making interfaces with an MTU < 1280
rather exotic.

Regarding performance, this should have no negative impact on unicast
traffic: Having some more bytes in the smaller and some less in the
larger does not change the sum of both fragments.

Concerning TT, choosing 1280 bytes fragments might result in more TT
messages than necessary when a large network is bridged into batman-adv.
However, the TT overhead in general is marginal due to its reactive
nature, therefore such a performance impact on TT should not be
noticeable for a user.

Cc: Matthias Schiffer <mschiffer@universe-factory.net>
[linus.luessing@c0d3.blue: Added commit message]
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# b1d2cf3d 23-May-2017 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# f7a2bd65 22-Feb-2017 Sven Eckelmann <sven@narfation.org>

batman-adv: Convert BATADV_PRINT_VID macro to function

The BATADV_PRINT_VID is not free of of possible side-effects. This can be
avoided when the the macro is converted to a simple inline function.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# b96a8981 28-Feb-2017 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# ac79cbb9 31-Dec-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: update copyright years for 2017

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 32bcad4b 15-Dec-2016 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# cbebd363 06-Aug-2016 Linus Lüssing <linus.luessing@c0d3.blue>

batman-adv: Use own timer for multicast TT and TVLV updates

Instead of latching onto the OGM period, this patch introduces a worker
dedicated to multicast TT and TVLV updates.

The reasoning is, that upon roaming especially the translation table
should be updated timely to minimize connectivity issues.

With BATMAN V, the idea is to greatly increase the OGM interval to
reduce overhead. Unfortunately, right now this could lead to
a bad user experience if multicast traffic is involved.

Therefore this patch introduces a fixed 500ms update interval for
multicast TT entries and the multicast TVLV.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 4c7da0f6 21-Sep-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: Avoid precedence issues in macros

It must be avoided that arguments to a macro are evaluated ungrouped (which
enforces normal operator precendence). Otherwise the result of the macro
is not well defined.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# c408c1b9 21-Jul-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: Move batadv_sum_counter to soft-interface.c

The function batadv_sum_counter is only used in soft-interface.c and has no
special relevance for main.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 4a2d09e3 17-Oct-2016 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7d0a5533 08-Aug-2016 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 33a3bb4a 05-May-2016 Antonio Quartulli <antonio.quartulli@open-mesh.com>

batman-adv: throughput meter implementation

The throughput meter module is a simple, kernel-space replacement for
throughtput measurements tool like iperf and netperf. It is intended to
approximate TCP behaviour.

It is invoked through batctl: the protocol is connection oriented, with
cumulative acknowledgment and a dynamic-size sliding window.

The test *can* be interrupted by batctl. A receiver side timeout avoids
unlimited waitings for sender packets: after one second of inactivity, the
receiver abort the ongoing test.

Based on a prototype from Edo Monticelli <montik@autistici.org>

Signed-off-by: Antonio Quartulli <antonio.quartulli@open-mesh.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# ba412080 15-May-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: Consolidate logging related functions

There are several places in batman-adv which provide logging related
functions. These should be grouped together in the log.* files to make them
easier to find.

Reported-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 72f7b2de 10-May-2016 Linus Lüssing <linus.luessing@c0d3.blue>

batman-adv: Adding logging of mcast flag changes

With this patch changes relevant to a node's own multicast flags are
printed to the 'mcast' log level.

Tested-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 01d350d1 15-May-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: move bat_algo functions into a separate file

The bat_algo functionality in main.c is mostly unrelated to the rest of the
content. It still takes up a large portion of this source file (~15%, 103
lines). Moving it to a separate file makes it better visible as a main
component of the batman-adv implementation and hides it less in the other
helper functions in main.c.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 1f8dce49 15-May-2016 Markus Pargmann <mpa@pengutronix.de>

batman-adv: split tvlv into a separate file

The tvlv functionality in main.c is mostly unrelated to the rest of the
content. It still takes up a large portion of this source file (~45%, 588
lines). Moving it to a separate file makes it better visible as a main
component of the batman-adv implementation and hides it less in the other
helper functions in main.c

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
[sven@narfation.org: fix conflicts with current version, fix includes,
rewrote commit message]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# fcafa5e7 15-May-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: Keep includes ordered by filename

It is easier to detect if a include is already there for a used
functionality when the includes are ordered. Using an alphabetic order
together with the grouping in commit 1e2c2a4fe4a5 ("batman-adv: Add
required includes to all files") makes includes better manageable.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# 7bed2ab8 09-Jun-2016 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 4b426b10 22-Feb-2016 Sven Eckelmann <sven@narfation.org>

batman-adv: Use bool as return type for boolean functions

It is easier to understand that the returned value of a specific function
doesn't have to be 0 when the functions was successful when the actual
return type is bool. This is especially true when all surrounding functions
with return type int use negative values to return the error code.

Reported-by: Nicholas Krause <xerofoify@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# cd9c7bfb 12-Mar-2016 Simon Wunderlich <simon.wunderlich@open-mesh.com>

batman-adv: add detection for complex bridge loops

There are network setups where the current bridge loop avoidance can't
detect bridge loops. The minimal setup affected would consist of two
LANs and two separate meshes, connected in a ring like that:

A...(mesh1)...B
| |
(LAN1) (LAN2)
| |
C...(mesh2)...D

Since both the meshes and backbones are separate, the bridge loop
avoidance has not enough information to detect and avoid the loop
in this case. Even if these scenarios can't be fixed easily,
these kind of loops can be detected.

This patch implements a periodic check (running every 60 seconds for
now) which sends a broadcast frame with a random MAC address on
each backbone VLAN. If a broadcast frame with the same MAC address
is received shortly after on the mesh, we know that there must be a
loop and report that incident as well as throw an uevent to let others
handle that problem.

Signed-off-by: Simon Wunderlich <simon.wunderlich@open-mesh.com>
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 6d030de8 11-Mar-2016 Antonio Quartulli <a@unstable.cc>

batman-adv: fix wrong names in kerneldoc

Signed-off-by: Antonio Quartulli <a@unstable.cc>
[sven@narfation.org: Fix additional names]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 565489df 14-Apr-2016 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 97575407 19-Jan-2016 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 8d2d499e 10-Nov-2015 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: ELP - send unicast ELP packets for throughput sampling

In case of an unused wireless link, the mac80211 throughput estimation
won't get updated further. Consequently, the reported throughput metric
will become obsolete.

With this patch unicast sampling is introduced by periodically sending
unicast ELP packets to each neighbor on idle WiFi links. These sampling
packets will fill an entire frame, so that the measurement is as
reliable as possible

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# c833484e 10-Nov-2015 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: ELP - compute the metric based on the estimated throughput

In case of wireless interface retrieve the throughput by
querying cfg80211. To perform this call a separate work
must be scheduled because the function may sleep and this
is not allowed within an RCU protected context (RCU in this
case is used to iterate over all the neighbours).

Use ethtool to retrieve information about an Ethernet link
like HALF/FULL_DUPLEX and advertised bandwidth (e.g.
100/10Mbps).

The metric is updated each time a new ELP packet is sent,
this way it is possible to timely react to a metric
variation which can imply (for example) a neighbour
disconnection.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 9323158e 16-Jan-2016 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: OGMv2 - implement originators logic

Add the support for recognising new originators in the
network and rebroadcast their OGMs.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 0da00359 16-Jan-2016 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: OGMv2 - add basic infrastructure

This is the initial implementation of the new OGM protocol
(version 2). It has been designed to work on top of the
newly added ELP.

In the previous version the OGM protocol was used to both
measure link qualities and flood the network with the metric
information. In this version the protocol is in charge of
the latter task only, leaving the former to ELP.

This means being able to decouple the interval used by the
neighbor discovery from the OGM broadcasting, which revealed
to be costly in dense networks and needed to be relaxed so
leading to a less responsive routing protocol.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 162bd64c 16-Jan-2016 Linus Lüssing <linus.luessing@c0d3.blue>

batman-adv: ELP - creating neighbor structures

Initially developed by Linus during a 6 months trainee study
period in Ascom (Switzerland) AG.

Signed-off-by: Linus Luessing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>


# e9ccd7e3 11-Jan-2016 Antonio Quartulli <a@unstable.cc>

batman-adv: remove unused BATADV_BONDING_TQ_THRESHOLD constant

BATADV_BONDING_TQ_THRESHOLD is not used anymore since the implementation
of the bat_neigh_is_similar_or_better() API function.
Such function uses the more generic BATADV_TQ_SIMILARITY_THRESHOLD
constant.

Therefore, remove definition of the unused BATADV_BONDING_TQ_THRESHOLD
constant.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 81f02683 23-Nov-2015 Simon Wunderlich <simon@open-mesh.com>

batman-adv: add seqno maximum age and protection start flag parameters

To allow future use of the window protected function with different
maximum sequence numbers, add a parameter to set this value which
was previously hardcoded. Another parameter added for future use is a
flag to return whether the protection window has started.

While at it, also fix the kerneldoc.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 0046b040 31-Dec-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: update copyright years for 2016

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 7afcbbef 30-Oct-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: Fix kerneldoc of main functions

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 62fe710f 15-Sep-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: Fix kerneldoc parsing of return description

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# e1544f3c 09-Nov-2015 Simon Wunderlich <simon@open-mesh.com>

batman-adv: increase BLA wait periods to 6

If networks take a long time to come up, e.g. due to lossy links, then
the bridge loop avoidance wait time to suppress broadcasts may not wait
long enough and detect a backbone before the mesh is brought up.
Increasing the wait period further to 60 seconds makes this scenario
less likely.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 4a4d045e 23-Nov-2015 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <a@unstable.cc>


# 07c48eca 04-Aug-2015 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 6b5e971a 26-May-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: Replace C99 int types with kernel type

(s|u)(8|16|32|64) are the preferred types in the kernel. The use of the
standard C99 types u?int(8|16|32|64)_t are objected by some people and even
checkpatch now warns about using them.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# a2f2b6cd 23-Apr-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: Clarify calculation precedence for '&' and '?'

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 1e2c2a4f 17-Apr-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: Add required includes to all files

The header files could not be build indepdent from each other. This is
happened because headers didn't include the files for things they've used.
This was problematic because the success of a build depended on the
knowledge about the right order of local includes.

Also source files were not including everything they've used explicitly.
Instead they required that transitive includes are always stable. This is
problematic because some transitive includes are not obvious, depend on
config settings and may not be stable in the future.

The order for include blocks are:

* primary headers (main.h and the *.h file of a *.c file)
* global linux headers
* required local headers
* extra forward declarations for pointers in function/struct declarations

The only exceptions are linux/bitops.h and linux/if_ether.h in packet.h.
This header file is shared with userspace applications like batctl and must
therefore build together with userspace applications. The header
linux/bitops.h is not part of the uapi headers and linux/if_ether.h
conflicts with the musl implementation of netinet/if_ether.h. The
maintainers rejected the use of __KERNEL__ preprocessor checks and thus
these two headers are only in main.h. All files using packet.h first have
to include main.h to work correctly.

Reported-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 36fd61cb 01-Mar-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: Use common Jenkins Hash implementation

An unoptimized version of the Jenkins one-at-a-time hash function is used
and partially copied all over the code wherever an hashtable is used.
Instead the optimized version shared between the whole kernel should be
used to reduce code duplication and use better optimized code.

Only the DAT code must use the old implementation because it is used as
distributed hash function which has to be common for all nodes.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# f2d5cf2a 25-Dec-2014 Markus Pargmann <mpa@pengutronix.de>

batman-adv: main, batadv_compare_eth return bool

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>


# e8ad3b1a 25-Dec-2014 Markus Pargmann <mpa@pengutronix.de>

batman-adv: main, Convert is_my_mac() to bool

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>


# fc1f8693 18-Feb-2015 Marek Lindner <mareklindner@neomailbox.ch>

batman-adv: checkpatch - spaces preferred around that '*'

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 9f6446c7 23-Apr-2015 Sven Eckelmann <sven@narfation.org>

batman-adv: update copyright years for 2015

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 70e71776 28-Apr-2015 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>


# dcba6c9b 29-Dec-2014 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 9687a31c 01-Sep-2014 Antonio Quartulli <antonio@meshcoding.com>

batman-adv: checkpatch - No space is necessary after a cast

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# a0e28775 15-Jul-2014 Martin Hundebøll <martin@hundeboll.net>

batman-adv: kernel doc fixes for main.{c, h}

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>


# 71b75d0e 21-Jul-2014 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 23c4ec10 10-Jun-2014 André Gaul <gaul@web-yard.de>

batman-adv: remove unnecessary logspam

This patch removes unnecessary logspam which resulted from superfluous
calls to net_ratelimit(). With the supplied patch, net_ratelimit() is
called after the loglevel has been checked.

Signed-off-by: André Gaul <gaul@web-yard.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 871d3d9f 16-May-2014 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 3f2532fc 12-Mar-2014 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# ab49886e 15-Feb-2014 Linus Lüssing <linus.luessing@c0d3.blue>

batman-adv: Add IPv4 link-local/IPv6-ll-all-nodes multicast support

With this patch a node may additionally perform the dropping or
unicasting behaviour for a link-local IPv4 and link-local-all-nodes
IPv6 multicast packet, too.

The extra counter and BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag is needed
because with a future bridge snooping support integration a node with a
bridge on top of its soft interface is not able to reliably detect its
multicast listeners for IPv4 link-local and the IPv6
link-local-all-nodes addresses anymore (see RFC4541, section 2.1.2.2
and section 3).

Even though this new flag does make "no difference" now, it'll ensure
a seamless integration of multicast bridge support without needing to
break compatibility later.

Also note, that even with multicast bridge support it won't be possible
to optimize 224.0.0.x and ff02::1 towards nodes with bridges, they will
always receive these ranges.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# c5caf4ef 15-Feb-2014 Linus Lüssing <linus.luessing@c0d3.blue>

batman-adv: Multicast Listener Announcements via Translation Table

With this patch a node which has no bridge interface on top of its soft
interface announces its local multicast listeners via the translation
table.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 8d90d775 04-Jan-2014 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# e19f9759 04-Jan-2014 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: update copyright years for 2014

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 89652331 13-Nov-2013 Simon Wunderlich <simon@open-mesh.com>

batman-adv: split tq information in neigh_node struct

For the network wide multi interface optimization it is required to save
metrics per outgoing interface in one neighbor. Therefore a new type is
introduced to keep interface-specific information. This also requires
some changes in access and list management.

The compare and equiv_or_better API calls are changed to take the
outgoing interface into consideration.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# eceb22ae 15-Nov-2013 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: create helper function to get AP isolation status

The AP isolation status may be evaluated in different spots.
Create an helper function to avoid code duplication.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 9464d071 15-Nov-2013 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: mark a local client as isolated when needed

A client sending packets which mark matches the value
configured via sysfs has to be identified as isolated using
the TT_CLIENT_ISOLA flag.

The match is mask based, meaning that only bits set in the
mask are compared with those in the mark value.

If the configured mask is equal to 0 no operation is
performed.

Such flag is then advertised within the classic client
announcement mechanism.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# ebf38fb7 03-Nov-2013 Antonio Quartulli <antonio@meshcoding.com>

batman-adv: remove FSF address from GPL disclaimer

As suggested by checkpatch, remove all the references to the
FSF address since the kernel already has one reference in
its documentation.

In this way it is easier to update it in case of future
changes.

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# d9cd4fe5 06-Dec-2013 Joe Perches <joe@perches.com>

batadv: Slight optimization of batadv_compare_eth

Use the newly added generic routine ether_addr_equal_unaligned
to test if possibly unaligned to u16 Ethernet addresses are equal.

This slightly improves comparison time for systems with
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 15c33da6 14-Oct-2013 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# c43c981e 01-Sep-2013 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: add bat_neigh_is_equiv_or_better API function

Each routing protocol has its own metric semantic and
therefore is the protocol itself the only component able to
compare two metrics to check their "similarity".

This new API allows each routing protocol to implement its
own logic and make the external code protocol agnostic.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 16052789 03-Jun-2013 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: print the VID together with the TT entries

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# c018ad3d 03-Jun-2013 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: add the VLAN ID attribute to the TT entry

To make the translation table code VLAN-aware, each entry
must carry the VLAN ID which it belongs to. This patch adds
such attribute to the related TT structures.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# bc58eeef 12-Oct-2013 Marek Lindner <mareklindner@neomailbox.ch>

batman-adv: update email address for Marek Lindner

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# c679ff8f 10-Oct-2013 Simon Wunderlich <sw@simonwunderlich.de>

batman-adv: update email address for Simon Wunderlich

My university will stop email service for alumni in january 2014, please
use my new e-mail address instead.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>


# 411d6ed9 07-May-2013 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: consider network coding overhead when calculating required mtu

The module prints a warning when the MTU on the hard interface is too
small to transfer payload traffic without fragmentation. The required
MTU is calculated based on the encapsulation header size. If network
coding is compild into the module its header size is taken into
account as well.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 610bfc6bc 23-May-2013 Martin Hundebøll <martin@hundeboll.net>

batman-adv: Receive fragmented packets and merge

Fragments arriving at their destination are buffered for later merge.
Merged packets are passed to the main receive function as had they never
been fragmented.

Fragments are forwarded without merging if the MTU of the outgoing
interface is smaller than the size of the merged packet.

Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# 9f4980e6 25-Apr-2013 Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

batman-adv: remove vis functionality

This is replaced by a userspace program, we don't need this
functionality to bloat the kernel.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# ef261577 23-Apr-2013 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: tvlv - basic infrastructure

The goal is to provide the infrastructure for sending, receiving and
parsing information 'containers' while preserving backward
compatibility. TVLV (based on the commonly known Type Length Value
technique) was chosen as the format for those containers. Even if a
node does not know the tvlv type of a certain container it can simply
skip the current container and proceed with the next. Past experience
has shown features evolve over time, so a 'version' field was added
right from the start to allow differentiating between feature
variants - hence the name: T(ype) V(ersion) L(ength) V(alue).

This patch introduces the basic TVLV infrastructure:
* register / unregister tvlv containers to be sent with each OGM
(on primary interfaces only)
* register / unregister callback handlers to be called upon
finding the corresponding tvlv type in a tvlv buffer
* unicast tvlv send / receive API calls

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Spyros Gasteratos <morfeas3000@gmail.com>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>


# c3923b7a 01-Sep-2013 Joe Perches <joe@perches.com>

batman: Remove reference to compare_ether_addr

This function is being removed, rename the reference.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c00a072d 21-Jul-2013 Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# c54f38c9 29-Jul-2013 Simon Wunderlich <simon@open-mesh.com>

batman-adv: set skb priority according to content

The skb priority field may help the wireless driver to choose the right
queue (e.g. WMM queues). This should be set in batman-adv, as this
information is only available here.

This patch adds support for IPv4/IPv6 DS fields and VLAN PCP. Note that
only VLAN PCP is used if a VLAN header is present. Also initially set
TC_PRIO_CONTROL only for self-generated packets, and keep the priority
set by higher layers.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 6715fd3f 20-Apr-2013 Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# eb2deb6b 19-Apr-2013 Antonio Quartulli <antonio@open-mesh.com>

batman-adv: change VID semantic in the BLA code

In order to make batman-adv fully vlan aware later, the
semantic used for variables storing the VLAN ID values has
to be changed in order to be adapted to the new one which
will be used batman-adv wide.

In particular, the VID has to be an "_unsigned_ short int"
and its 4 MSB will be used as a flag bitfield, while the
remaining 12 bits are used to store the real VID value

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>


# caf65bfc 09-Mar-2013 Matthias Schiffer <mschiffer@universe-factory.net>

batman-adv: send each broadcast only once on non-wireless interfaces

While it makes sense to send each broadcast thrice on 802.11 (WLAN) interfaces
as broadcasts are often unreliable on these, there is no reason to do so on
other interface types.

The increased the overhead can be harmful on low-bandwidth links like VPN
connections over slow internet lines, therefore it is better to reduce the
number of broadcast packets sent on non-wireless links to one.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# fe8a93b9 03-Apr-2013 Antonio Quartulli <ordex@autistici.org>

batman-adv: make is_my_mac() check for the current mesh only

On a multi-mesh node (a node running more than one batman-adv
virtual interface) batadv_is_my_mac() has to check MAC
addresses of hard interfaces belonging to the current mesh
only.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 9998bb73 03-Mar-2013 Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# a4ac28c0 11-Feb-2013 Sven Eckelmann <sven@narfation.org>

batman-adv: Allow to use rntl_link for device creation/deletion

The sysfs configuration interface of batman-adv to add/remove soft-interfaces
is not deadlock free and doesn't follow the currently common way to create new
virtual interfaces.

An additional interface though rtnl_link is introduced which provides easy device
creation/deletion with tools like "ip":

$ ip link add dev bat0 type batadv
$ ip link del dev bat0

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 3c12de9a 25-Jan-2013 Martin Hundebøll <martin@hundeboll.net>

batman-adv: network coding - code and transmit packets if possible

Before adding forward-skbs to the coding buffer, the buffer is searched
for a potential coding opportunity. If one is found, the two packets are
network coded and transmitted right away. If not, the forward-skb is
added to the buffer.

Network coded packets are transmitted with information about the two
receivers and the two coded packets. The first receiver is given by the
MAC header, while the second is given in the payload/bat-header. The
second receiver uses promiscuous mode to receive the packet and check
the second destination.

Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# d56b1705 25-Jan-2013 Martin Hundebøll <martin@hundeboll.net>

batman-adv: network coding - detect coding nodes and remove these after timeout

To use network coding efficiently, a relay must know when neighbor nodes
are likely to have enough information to be able to decode a network
coded packet. This is detected by using OGMs from batman-adv to discover
when one neighbor is in range of another neighbor. The relay check the
TLL to detect when an OGM is forwarded from one neighbor by another
neighbor, and thereby knows that the two neighbors are in range and thus
overhear packets sent by each other.

This information is saved in the orig_node struct to be used when
searching for coding opportunities. Two lists are added to the
orig_node struct: One for neighbors that can hear the orig_node
(outgoing nc_nodes) and one for neighbors that the orig_node can hear
(incoming nc_nodes).

Information about nc_nodes is kept for 10 seconds and is available
through debugfs in batman_adv/nc_nodes to use when debugging network
coding.

Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# d353d8d4 25-Jan-2013 Martin Hundebøll <martin@hundeboll.net>

batman-adv: network coding - add the initial infrastructure code

Network coding exploits the 802.11 shared medium to allow multiple
packets to be sent in a single transmission. In brief, a relay can XOR
two packets, and send the coded packet to two destinations. The
receivers can decode one of the original packets by XOR'ing the coded
packet with the other original packet. This will lead to increased
throughput in topologies where two packets cross one relay.

In a simple topology with three nodes, it takes four transmissions
without network coding to get one packet from Node A to Node B and one
from Node B to Node A:

1. Node A ---- p1 ---> Node R Node B
2. Node A Node R <--- p2 ---- Node B
3. Node A <--- p2 ---- Node R Node B
4. Node A Node R ---- p1 ---> Node B

With network coding, the relay only needs one transmission, which saves
us one slot of valuable airtime:

1. Node A ---- p1 ---> Node R Node B
2. Node A Node R <--- p2 ---- Node B
3. Node A <- p1 x p2 - Node R - p1 x p2 -> Node B

The same principle holds for a topology including five nodes. Here the
packets from Node A and Node B are overheard by Node C and Node D,
respectively. This allows Node R to send a network coded packet to save
one transmission:

Node A Node B

| \ / |
| p1 p2 |
| \ / |
p1 > Node R < p2
| |
| / \ |
| p1 x p2 p1 x p2 |
v / \ v
/ \
Node C < > Node D

More information is available on the open-mesh.org wiki[1].

This patch adds the initial code to support network coding in
batman-adv. It sets up a worker thread to do house keeping and adds a
sysfs file to enable/disable network coding. The feature is disabled by
default, as it requires a wifi-driver with working promiscuous mode, and
also because it adds a small delay at each hop.

[1] http://www.open-mesh.org/projects/batman-adv/wiki/Catwoman

Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 5ac2a177 02-Jan-2013 Antonio Quartulli <ordex@autistici.org>

batman-adv: Start new development cycle

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 0b873931 03-Jan-2013 Antonio Quartulli <ordex@autistici.org>

batman-adv: update copyright years

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 72414442 25-Dec-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: a delayed_work has to be initialised once

A delayed_work struct does not need to be initialized each
every time before being enqueued. Therefore the
INIT_DELAYED_WORK() macro should be used during the
initialization process only.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 7cf4d520 08-Nov-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: reduce local TT entry timeout to 10 minutes

The current timeout is set to one hour. However a client connected to the mesh
network will always generate traffic. In the worst case it will send ARP
requests every 4 or 5 minutes. On the other hand having a long timeout means
storing dead entries for one hour and it leads to very big trans-tables
containing useless clients.

This patch reduces the timeout to 10 minutes

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 56917443 12-Nov-2012 Shan Wei <davidshan@tencent.com>

batman-adv: use per_cpu_add helper

this_cpu_add is an atomic operation.
and be more faster than per_cpu_ptr operation.

Signed-off-by: Shan Wei <davidshan@tencent.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# d81f78ec 29-Oct-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Start new development cycle

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 95a066d8 17-Oct-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Add function to calculate crc32c for the skb payload

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 28709878 13-Sep-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

batman-adv: wait multiple periods before activating bla

For some reasons (bridge forward delay, network device setup order, etc)
the initial bridge loop avoidance announcement packets may be lost. This
may lead to problems in finding other backbone gws, and therfore create
loops in the startup time.

Fix this by extending the waiting periods to 3 (define can be changed)
before allowing broadcast traffic.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# c384ea3e 25-Jun-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: Distributed ARP Table - add snooping functions for ARP messages

In case of an ARP message going in or out the soft_iface, it is intercepted and
a special action is performed. In particular the DHT helper functions previously
implemented are used to store all the ARP entries belonging to the network in
order to provide a fast and unicast lookup instead of the classic broadcast
flooding mechanism.
Each node stores the entries it is responsible for (following the DHT rules) in
its soft_iface ARP table. This makes it possible to reuse the kernel data
structures and functions for ARP management.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 2f1dfbe1 30-Jun-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: Distributed ARP Table - implement local storage

Since batman-adv cannot inter-operate with the host ARP table, this patch
introduces a batman-adv private storage for ARP entries exchanged within DAT.
This storage will represent the node local cache in the DAT protocol.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 785ea114 23-Nov-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: Distributed ARP Table - create DHT helper functions

Add all the relevant functions in order to manage a Distributed Hash Table over
the B.A.T.M.A.N.-adv network. It will later be used to store several ARP entries
and implement DAT (Distributed ARP Table)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 0e861a3c 01-Oct-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: Distributed ARP Table - add a new debug log level

A new log level has been added to concentrate messages regarding DAT: ARP
snooping, requests, response and DHT related messages.
The new log level is named BATADV_DBG_DAT

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 0aca86cd 27-Aug-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: add kernel-doc for enum batadv_dbg_level

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# bd5b80d5 20-Aug-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Check return value of try_module_get

New operations should not be started when they need an increased module
reference counter and try_module_get failed.

This patch addresses Coverity #712284: Unchecked return value

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 30da63a6 03-Aug-2012 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: consolidate duplicated primary_if checking code

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# fa4f0afc 19-Aug-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Start new development cycle

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 30cfd02b 05-Jul-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: detect not yet announced clients

With the current TT mechanism a new client joining the network is not
immediately able to communicate with other hosts because its MAC address has not
been announced yet. This situation holds until the first OGM containing its
joining event will be spread over the mesh network.

This behaviour can be acceptable in networks where the originator interval is a
small value (e.g. 1sec) but if that value is set to an higher time (e.g. 5secs)
the client could suffer from several malfunctions like DHCP client timeouts,
etc.

This patch adds an early detection mechanism that makes nodes in the network
able to recognise "not yet announced clients" by means of the broadcast packets
they emitted on connection (e.g. ARP or DHCP request). The added client will
then be confirmed upon receiving the OGM claiming it or purged if such OGM
is not received within a fixed amount of time.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 8de47de5 08-Jul-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Use BIT(x) macro to calculate bit positions

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# a51fb9b2 01-Jul-2012 Antonio Quartulli <ordex@autistici.org>

batman-adv: fix typos in comments

the word millisecond is misspelled in several comments. This patch fixes it.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 2c53040f 10-Jul-2012 Ben Hutchings <bhutchings@solarflare.com>

net: Fix (nearly-)kernel-doc comments for various functions

Fix incorrect start markers, wrapped summary lines, missing section
breaks, incorrect separators, and some name mismatches.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0c5e45b6 23-Jun-2012 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: fix counter summary length

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 56303d34 05-Jun-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix types structs with batadv_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 39c75a51 03-Jun-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix main enum with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 42d0b044 03-Jun-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix main defines with BATADV_

Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 3e34819e 16-May-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix remaining function like macros with batadv_

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 1eda58bf 12-May-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix main static inline functions with batadv_

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>


# 9cfc7bd6 11-May-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Reformat multiline comments to consistent style

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>


# 3193e8fd 11-May-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix main non-static functions with batadv_

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>


# 40a072d7 11-May-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Prefix bat_debugfs non-static functions with batadv_

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>


# f8214865 20-Apr-2012 Martin Hundebøll <martin@hundeboll.net>

batman-adv: Add get_ethtool_stats() support

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>


# 284fefd5 17-Jun-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: update internal version number

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# e0157265 30-Mar-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Start new development cycle

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# ffa995e0 01-Mar-2012 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: introduce packet type handler array for incoming packets

The packet handler array replaces the growing switch statement, thus
dealing with incoming packets in a more efficient way. It also adds
to possibility to register packet handlers on the fly.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# fe2da6ff 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

batman-adv: add broadcast duplicate check

When multiple backbone gateways relay the same broadcast from the
backbone into the mesh, other nodes in the mesh may receive this
broadcast multiple times. To avoid this, the crc checksums of
received broadcasts are recorded and new broadcast packets with
the same content may be dropped if received by another gateway.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 23721387 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

batman-adv: add basic bridge loop avoidance code

This second version of the bridge loop avoidance for batman-adv
avoids loops between the mesh and a backbone (usually a LAN).

By connecting multiple batman-adv mesh nodes to the same ethernet
segment a loop can be created when the soft-interface is bridged
into that ethernet segment. A simple visualization of the loop
involving the most common case - a LAN as ethernet segment:

node1 <-- LAN --> node2
| |
wifi <-- mesh --> wifi

Packets from the LAN (e.g. ARP broadcasts) will circle forever from
node1 or node2 over the mesh back into the LAN.

With this patch, batman recognizes backbone gateways, nodes which are
part of the mesh and backbone/LAN at the same time. Each backbone
gateway "claims" clients from within the mesh to handle them
exclusively. By restricting that only responsible backbone gateways
may handle their claimed clients traffic, loops are effectively
avoided.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# a7f6ee94 22-Jan-2012 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

batman-adv: remove old bridge loop avoidance code

The functionality is to be replaced by an improved implementation,
so first clean up.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 0079d2ce 04-Feb-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Replace bitarray operations with bitmap

bitarray.c consists mostly of functionality that is already available as part
of the standard kernel API. batman-adv could use architecture optimized code
and reduce the binary size by switching to the standard functions.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>


# 21a1236b 07-Mar-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Don't begin block comments with only a /* line

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# fdc8ff10 05-Feb-2012 Sven Eckelmann <sven@narfation.org>

batman-adv: Start new development cycle

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 567db7b0 31-Dec-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Update copyright years

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 032b7969 20-Dec-2011 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: convert time_after instances to has_timed_out

To increase readability the has_timed_out() functions has been introduced.
This patch converts existing time_after() calls to use this wrapper
function (if applicable).
This patch also converts all timeouts to miliseconds to be consistent.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>


# 1c280471 28-Nov-2011 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: add infrastructure to change routing algorithm at runtime

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# a04ccd59 08-Dec-2011 Martin Hundebøll <martin@hundeboll.net>

batman-adv: Move is_out_of_time() to main.h for general use

Both translation tables and network coding use timeouts to do house
keeping, so we might as well share the function used to compare a
timestamp+timeout with current time.

For readability and simplicity, the function is renamed to
has_timed_out() and uses time_is_before_jiffies() instead of
time_after().

Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# c20186b9 14-Nov-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: update internal version number

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 45485ad7 21-Aug-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: update internal version number

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# bc279080 07-Jul-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: detect clients connected through a 802.11 device

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>


# 015758d0 09-Jul-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: correct several typ0s in the comments

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>


# 44c4349a 05-Jul-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Replace version info instead of appending them

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>


# 43676ab5 26-Apr-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: improved gateway tq-based selection

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>


# c6bda689 26-Apr-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: add wrapper function to throw uevent in userspace

Using throw_uevent() is now possible to trigger uevent signal that can
be recognised in userspace. Uevents will be triggered through the
/devices/virtual/net/{MESH_IFACE} kobject.

A triggered uevent has three properties:
- type: the event class. Who generates the event (only 'gw' is currently
defined). Corresponds to the BATTYPE uevent variable.
- action: the associated action with the event ('add'/'change'/'del' are
currently defined). Corresponds to the BATACTION uevent variable.
- data: any useful data for the userspace. Corresponds to the BATDATA
uevent variable.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# cc47f66e 27-Apr-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: improved roaming mechanism

With the current client announcement implementation, in case of roaming,
an update is triggered on the new AP serving the client. At that point
the new information is spread around by means of the OGM broadcasting
mechanism. Until this operations is not executed, no node is able to
correctly route traffic towards the client. This obviously causes packet
drops and introduces a delay in the time needed by the client to recover
its connections.

A new packet type called ROAMING_ADVERTISEMENT is added to account this
issue.

This message is sent in case of roaming from the new AP serving the
client to the old one and will contain the client MAC address. In this
way an out-of-OGM update is immediately committed, so that the old node
can update its global translation table. Traffic reaching this node will
then be redirected to the correct destination utilising the fresher
information. Thus reducing the packet drops and the connection recovery
delay.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# a73105b8 27-Apr-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: improved client announcement mechanism

The client announcement mechanism informs every mesh node in the network
of any connected non-mesh client, in order to find the path towards that
client from any given point in the mesh.

The old implementation was based on the simple idea of appending a data
buffer to each OGM containing all the client MAC addresses the node is
serving. All other nodes can populate their global translation tables
(table which links client MAC addresses to node addresses) using this
MAC address buffer and linking it to the node's address contained in the
OGM. A node that wants to contact a client has to lookup the node the
client is connected to and its address in the global translation table.

It is easy to understand that this implementation suffers from several
issues:
- big overhead (each and every OGM contains the entire list of
connected clients)
- high latencies for client route updates due to long OGM trip time and
OGM losses

The new implementation addresses these issues by appending client
changes (new client joined or a client left) to the OGM instead of
filling it with all the client addresses each time. In this way nodes
can modify their global tables by means of "updates", thus reducing the
overhead within the OGMs.

To keep the entire network in sync each node maintains a translation
table version number (ttvn) and a translation table checksum. These
values are spread with the OGM to allow all the network participants to
determine whether or not they need to update their translation table
information.

When a translation table lookup is performed in order to send a packet
to a client attached to another node, the destination's ttvn is added to
the payload packet. Forwarding nodes can compare the packet's ttvn with
their destination's ttvn (this node could have a fresher information
than the source) and re-route the packet if necessary. This greatly
reduces the packet loss of clients roaming from one AP to the next.

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>


# b4e17054 15-Jun-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Reduce usage of char

char was used in different places to store information without really
using the characteristics of that data type or by ignoring the fact that
char has not a well defined signedness.

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# ecbd5321 09-Jun-2011 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: use NO_FLAGS define instead of hard-coding 0

The definition NO_FLAGS was introduced to make the code more
readable and shall be used to initialize flag fields.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# e8958dbf 04-Jun-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Use enums for related constants

CodingStyle "Chapter 12: Macros, Enums and RTL" recommends to use enums
for several related constants. Internal states can be used without
defining the actual value, but all values which are visible to the
outside must be defined as before. Normal values are assigned as usual
and flags are defined by shifts of a bit.

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 0bb85751 19-May-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Check type of x and y in seq_(before|after)

seq_before and seq_after depend on the fact that both sequence numbers
have the same type and thus the same bitwidth. We can ensure that by
compile time checking using a compare between the pointer to the
temporary buffers which were created using the typeof of both
parameters. For example gcc would create a warning like
"warning: comparison of distinct pointer types lacks a cast".

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# f5d33d37 18-May-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: move smallest_signed_int(), seq_before() and seq_after() into main.h

smallest_signed_int(), seq_before() and seq_after() are very useful
functions that help to handle comparisons between sequence numbers.
However they were only defined in vis.c. With this patch every
batman-adv function will be able to use them.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 747e4221 14-May-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Add const type qualifier for pointers

batman-adv uses pointers which are marked as const and should not
violate that type qualifier by passing it to functions which force a
cast to the non-const version.

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# d3a547be 14-May-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Annotate functions with format strings

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 6e215fd8 07-May-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Remove multiline comments from line ending

It is slightly irritating that comments after a long line span over
multiple lines without any code. It is easier to put them before the
actual code and reduce the number of lines which the eye has to read.

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 2dafb49d 05-May-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: rename everything from *hna* into *tt* (translation table)

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>


# 5f657ec0 20-Apr-2011 Antonio Quartulli <ordex@autistici.org>

batman-adv: Move definition of atomic_dec_not_zero() into main.h

atomic_dec_not_zero() is very useful and it is currently defined
multiple times. So it is possible to move it in main.h

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 4389e47a 17-Feb-2011 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: rename global if_list to hardif_list

Batman-adv works with "hard interfaces" as well as "soft interfaces".
The new name should better make clear which kind of interfaces this
list stores.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 39901e71 17-Feb-2011 Marek Lindner <lindner_marek@yahoo.de>

batman-adv: separate ethernet comparing calls from hash functions

Note: The function compare_ether_addr() provided by the Linux kernel
requires aligned memory.

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>


# 64afe353 27-Jan-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Update copyright years

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# 335f94c9 27-Jan-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Remove unused definitions

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# aa0adb1a 15-Jan-2011 Sven Eckelmann <sven@narfation.org>

batman-adv: Use "__attribute__" shortcut macros

Linux 2.6.21 defines different macros for __attribute__ which are also
used inside batman-adv. The next version of checkpatch.pl warns about
the usage of __attribute__((packed))).

Linux 2.6.33 defines an extra macro __always_unused which is used to
assist source code analyzers and can be used to removed the last
existing __attribute__ inside the source code.

Signed-off-by: Sven Eckelmann <sven@narfation.org>


# c6c8fea2 13-Dec-2010 Sven Eckelmann <sven@narfation.org>

net: Add batman-adv meshing protocol

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>