* support latest kernels (4.19 - 6.8)
* coding style cleanups and refactoring
* add stateless multicast packet format support
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (4.14 - 6.7)
* coding style cleanups and refactoring
* only warn about too small MTU when soft interfaces wasn't already reduced
* bugs squashed:
- Hold rtnl lock during MTU update via netlink
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The automatic recalculation of the maximum allowed MTU is usually triggered
by code sections which are already rtnl lock protected by callers outside
of batman-adv. But when the fragmentation setting is changed via
batman-adv's own batadv genl family, then the rtnl lock is not yet taken.
But dev_set_mtu requires that the caller holds the rtnl lock because it
uses netdevice notifiers. And this code will then fail the check for this
lock:
RTNL: assertion failed at net/core/dev.c (1953)
Fixes: e7ee4c55de ("batman-adv: update to version 2023.2")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
OpenWrt master is no longer providing any kernels older than 5.15. Just
drop the compat-hacks/patches for older kernels to make it easier to
maintain the package.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (4.14 - 6.4)
* drop single unicast transfer optimization for unsnoopable IP addresses
* prepare infrastructure for multicast packets with multiple unicast destination
addresses
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Because batman-adv is built under backports, not a clean linux tree,
the CONFIG_CFG80211 does not exist. The evaluation of IS_ENABLED() in
batadv_is_cfg80211_netdev() will be false, causing the funtion to
always return false.
This means that the wifi_flags of an interface don't get set, causing
batadv_is_wifi_hardif() to always return false. As a result,
batadv_v_elp_get_throughput() never tries to get the station info from
cfg80211, resulting in the following warning:
batman_adv: bat0: WiFi driver or ethtool info does not provide
information about link speeds on interface phy1-mesh0,
therefore defaulting to hardcoded throughput values of 1.0 Mbps.
So replace CONFIG_CFG80211 with CPTCFG_CFG80211, which is the correct
macro to use under backports.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
* support latest kernels (4.9 - 6.1)
* coding style cleanups and refactoring
* bugs squashed:
- limit the minimum MTU of hard-interface to avoid
"Forced to purge local tt entries" errors
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (4.9 - 5.18)
* bugs squashed:
- resolve "time-of-check-time-of-use" race condition when checking the
network namespace of a lower device
- fix sanity check of network devices in different namespaces with
colliding IDs
- prevent transmission errors after splitting large GRO packets into
smaller fragments
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The minimal kernel version in OpenWrt is now Linux 5.10.111. It already
provides various thing which needed special patches on older versions.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Eric Dumazet changed the mc_forwarding in commit 145c7a793838 ("ipv6: make
mc_forwarding atomic") the type of mc_forwarding from __s32 to an atomic_t.
This patch was then ported to various stable kernels.
This code change caused a FTBFS when in batman-adv when
CONFIG_BATMAN_ADV_MCAST was activated. To work around this problem, provide
a version for kernels with __s32 mc_forwarding and a version for kernel
with atomic_t mc_forwarding.
Fixes: #850
Reported-by: Huangbin Zhan <zhanhb88@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The test builds are now requiring quilt refreshed patches instead of git
patches. Otherwise the build check will not even try to build something.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The batman-adv netlink messages often contain the interface index and
interface name in the same message. This makes it easy for the receiver to
operate on the incoming data when it either needs to print something or
needs to operate on the interface index.
But one of the attributes was missing for:
* neighbor table dumps
* originator table dumps
* gateway list dumps
* query of hardif information
* query of vid information
The userspace therefore had to implement special workarounds using
SIOCGIFNAME or SIOCGIFINDEX depending on what was actually provided.
Providing both information simplifies the userspace code massively without
adding a lot of extra overhead in the kernel portion.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (4.4 - 5.11)
* coding style cleanups and refactoring
* drop support for sysfs+debugfs
* allow to select routing algorithm during creation of interface
* bugs squashed:
- allocate enough reserved room on fragments for lower devices
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The mac80211 package version was updated to a 5.2 based one in commit
0b2c42ced21a ("mac80211: Update to version 5.2-rc7"). The batman-adv module
must therefore no longer the pre-5.2 API.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The state of slave interfaces are handled differently depending on whether
the interface is up or not. All active interfaces (IFF_UP) will transmit
OGMs. But for B.A.T.M.A.N. IV, also non-active interfaces are scheduling
(low TTL) OGMs on active interfaces. The code which setups and schedules
the OGMs must therefore already be called when the interfaces gets added as
slave interface and the transmit function must then check whether it has to
send out the OGM or not on the specific slave interface.
But v2016.3 moved the setup code from the enable function to the activate
function. The latter is called either when the added slave was already up
when batadv_hardif_enable_interface processed the new interface or when a
NETDEV_UP event was received for this slave interfac. As result, each
NETDEV_UP would schedule a new OGM worker for the interface and thus OGMs
would be send a lot more than expected.
Fixes: 549909f89d ("batman-adv: upgrade package to latest release 2016.3")
Reported-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (3.16 - 5.2)
* coding style cleanups and refactoring
* implement multicast-to-unicast support for multiple targets
* deprecate sysfs support and make it optional
* refresh DAT entry timeouts on incoming ARP Replies
* bugs squashed:
- fix multicast tt/tvlv worker locking
- drop roam tvlv handler when unregistering mesh interface
Signed-off-by: Sven Eckelmann <sven@narfation.org>
The linux/build_bug.h is already provided by mac80211's backports. It is
not needed anymore to adjust the includes to use the older linux/bug.h
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (3.16 - 4.18)
* dropped support for kernels < 3.16 (note the removed build directory)
* coding style cleanups and refactoring
* avoid old nodes disabling multicast optimizations completely
* disable ethtool based B.A.T.M.A.N. V speed detection for virtual interfaces
* enable B.A.T.M.A.N. V compilation by default
* disable debugfs support by default
* bugs squashed:
- fix TT sync flags for intermediate TT responses
- avoid race in TT TVLV allocator helper
- prevent TT request storms by not sending inconsistent TT TVLVs
- fix best gw refcnt after netlink dump
- adjust debugfs paths for interfaces after a namechange
- fix single entry TT non-sync flag storage
- fix multicast TT issues with bogus ROAM flags
- work around insufficient memory initialization in cfg80211's station info
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (3.2 - 4.16)
* coding style cleanups and refactoring
* mark licenses clearer, change UAPI header from ISC to MIT
* bugs squashed:
- fix packet checksum handling in receive path
- fix handling of large number of interfaces
- fix netlink dumping of gateways and BLA claims+backbones
Signed-off-by: Sven Eckelmann <sven@narfation.org>
This patch fixes an issue in the translation table code potentially
leading to a TT Request + Response storm. The issue may occur for nodes
involving BLA and an inconsistent configuration of the batman-adv AP
isolation feature. However, since the new multicast optimizations, a
single, malformed packet may lead to a mesh-wide, persistent
Denial-of-Service, too.
The issue occurs because nodes are currently OR-ing the TT sync flags of
all originators announcing a specific MAC address via the
translation table. When an intermediate node now receives a TT Request
and wants to answer this on behave of the destination node then this
intermediate node now responds with an altered flag field and broken
CRC. The next OGM of the real destination will lead to a CRC mismatch
and triggering a TT Request and Response again.
Furthermore, the OR-ing is currently never undone as long as at least
one originator announcing the according MAC address remains, leading to
the potential persistency of this issue.
This patch fixes this issue by storing the flags used in the CRC
calculation on a a per TT orig entry basis to be able to respond with
the correct, original flags in an intermediate TT Response for one
thing. And to be able to correctly unset sync flags once all nodes
announcing a sync flag vanish for another.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (3.2 - 4.12)
* bridge loop avoidance improvements for various corner cases
* reduction of maximum fragment size
* coding style cleanups and refactoring
* bugs squashed:
- fix rx packet/bytes stats on local DAT ARP reply
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (3.2 - 4.11)
* remove bridge loop avoidance addresses from translation table
* allow to build B.A.T.M.A.N. V without cfg80211 integration on Linux <
* 3.16
* coding style cleanups and refactoring
* bugs squashed:
- fix interface reference counter on fragmentation errors
- avoid double free on fragment merge error
- fix support for up to 16 fragments
- fix build of multicast compatibility code on some architectures
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Fix double free during fragment merge error
* batman-adv: Fix transmission of final, 16th fragment
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* support latest kernels (3.2 - 4.10)
* change installation path back to $INSTALL_MOD_DIR/updates/net/batman-adv
* add simple (re)broadcast avoidance
* reduce multicast TT and TVLV update delays under B.A.T.M.A.N. V
* support B.A.T.M.A.N. V throughput detection when using VLANs on top of WiFi
* improve documentation of sysfs and debugfs files
* coding style cleanups and refactoring
* bugs squashed:
- detect missing primaryif during tp_send as error
- fix re-adding of previously removed interfaces via rtnetlink
- fix rare race conditions on interface removal
- handle allocation error when generating TT responses
Signed-off-by: Sven Eckelmann <sven@narfation.org>
LEDE is still using Linux 3.18 on some systems. Allow to build batman-adv
for it by not checking the netns of a possible netdev link during the
batadv-on-batadv check.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* batman-adv: Install module in $INSTALL_MOD_DIR/updates/net/batman-adv
* batman-adv: Revert "fix splat on disabling an interface"
* batman-adv: Detect missing primaryif during tp_send as error
* batman-adv: Check for alloc errors when preparing TT local data
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Speedy join only works when the received packet is either broadcast or an
4addr unicast packet. Thus packets converted from broadcast to unicast via
the gateway handling code have to be converted to 4addr packets to allow
the receiving gateway server to add the sender address as temporary entry
to the translation table.
Not doing it will make the batman-adv gateway server drop the DHCP response
in many situations because it doesn't yet have the TT entry for the
destination of the DHCP response.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
* Avoid nullptr dereference in bla after vlan_insert_tag
* Avoid nullptr dereference in dat after vlan_insert_tag
* Avoid tt_req_node list put for unhashed entry
* Fix orig_node_vlan leak on orig_node_release
* Fix non-atomic bla_claim::backbone_gw access
* Fix reference leak in batadv_find_router
* Free last_bonding_candidate on release of orig_node
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>