Commit Graph

72 Commits

Author SHA1 Message Date
Sven Eckelmann 0908d7d5a6 batman-adv: update to version 2024.1
* support latest kernels (4.19 - 6.9)
* coding style cleanups and refactoring
* bugs squashed:
  - avoid infinite loop while trying to resize local translation table

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2024-04-05 21:43:16 +02:00
Sven Eckelmann 6a7a1a5dab batman-adv: update to version 2024.0
* 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>
2024-02-03 14:13:47 +01:00
Sven Eckelmann 28b8a5eafe batman-adv: update to version 2023.3
* 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>
2023-11-17 21:31:47 +01:00
Sven Eckelmann 364379c056 batman-adv: Fix lock assert after fragmentation change
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>
2023-08-22 18:54:26 +02:00
Sven Eckelmann 04bbb0a87e batman-adv: Drop support for kernel < 5.15
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>
2023-05-27 12:15:47 +02:00
Sven Eckelmann 6afc0452c2 batman-adv: update to version 2023.1
* 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>
2023-05-27 12:09:02 +02:00
Alexandru Gagniuc 2eb71d7d7a batman-adv: fix compilation bug in batadv_is_cfg80211_netdev()
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>
2023-04-07 09:03:04 -05:00
Sven Eckelmann 081291592e batman-adv: update to version 2022.3
* 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>
2022-11-10 21:44:20 +01:00
Sven Eckelmann b65a8ca03a batman-adv: update to version 2022.1
* 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>
2022-05-06 22:09:55 +02:00
Sven Eckelmann 500352d44f batman-adv: Drop unused compat patches
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>
2022-04-17 14:00:29 +02:00
Sven Eckelmann 73195d63da batman-adv: compat: Add atomic mc_forwarding support for stable kernels
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>
2022-04-17 13:25:16 +02:00
Sven Eckelmann a7b79a1d4f batman-adv: update to version 2021.3
* support latest kernels (4.4 - 5.15)
* coding style cleanups and refactoring
* reduced memory copy overhead when sending broadcasts

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-09-14 21:14:11 +02:00
Sven Eckelmann 5eda02f74c batman-adv: Refresh patches with quilt
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>
2021-08-20 13:14:35 +02:00
Sven Eckelmann 47cd2a4b62 batman-adv: update to version 2021.2
* support latest kernels (4.4 - 5.14)
* coding style cleanups and refactoring
* add MRD + routable IPv4 multicast with bridges support
* rewrite of broadcast queuing
* bugs squashed:

  - avoid kernel warnings on timing related checks

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-08-20 13:14:22 +02:00
Sven Eckelmann 39da22d04a batman-adv: Always send iface index+name in genlmsg
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>
2021-05-18 18:51:26 +02:00
Sven Eckelmann 1c3233ca67 batman-adv: update to version 2021.1
* support latest kernels (4.4 - 5.13)
* coding style cleanups and refactoring
* bugs squashed:

  - correctly initialize padding when sending out translation table TVLVs

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-05-18 18:48:52 +02:00
Sven Eckelmann 6c81fc2916 batman-adv: upgrade package to latest release 2021.0
* 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>
2021-01-28 21:08:27 +01:00
Sven Eckelmann aca51f8149 batman-adv: upgrade package to latest release 2020.4
* support latest kernels (4.4 - 5.10)
* coding style cleanups and refactoring
* bugs squashed:

  - fix incorrect reroute handling of multicast packets
  - improve handling of multicast packets by bridge loop avoidance

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-10-27 14:46:11 +01:00
Sven Eckelmann ce3569e159 batman-adv: upgrade package to latest release 2019.3
* support latest kernels (3.16 - 5.3)
* coding style cleanups and refactoring
* add routable multicast optimizations
* bugs squashed:

  - fix duplicated OGMs on NETDEV_UP
  - fix dumping of multicast flags

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-08-01 17:53:51 +02:00
Sven Eckelmann 9e7dbf9ba9 batman-adv: Use Linux 5.2 API again
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>
2019-07-22 10:02:46 +02:00
Sven Eckelmann e26096ae1d batman-adv: Fix duplicated OGMs on NETDEV_UP
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>
2019-06-02 14:08:16 +02:00
Sven Eckelmann 1ff00eebae batman-adv: upgrade package to latest release 2019.2
* 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>
2019-05-23 20:21:54 +02:00
Sven Eckelmann 203ee34d9c batman-adv: Drop unused compat-hacks.patch
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>
2019-02-22 20:04:35 +01:00
Sven Eckelmann afba8ae2c0 batman-adv: upgrade package to latest release 2018.2
* 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>
2018-07-17 21:23:54 +02:00
Sven Eckelmann 87cba7f899 batman-adv: add patches from 2018.1-maint 2018-06-12
* compat: initialize sinfo in cfg80211_get_station
* Avoid storing non-TT-sync flags on singular entries too
* Fix multicast TT issues with bogus ROAM flags

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-06-12 22:54:22 +02:00
Sven Eckelmann 2dfb228764 batman-adv: add patches from 2018.1-maint 2018-06-03
* Avoid race in TT TVLV allocator helper
* Fix TT sync flags for intermediate TT responses
* prevent TT request storms by not sending inconsistent TT TLVLs
* don't implement skb_postpush_rcsum() for linux >=4.4.47
* Fix bat_ogm_iv best gw refcnt after netlink dump
* Fix bat_v best gw refcnt after netlink dump
* Fix debugfs path for renamed hardif
* Fix debugfs path for renamed softif

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-06-03 18:43:22 +02:00
Sven Eckelmann 3bb75b0035 batman-adv: upgrade package to latest release 2018.0
* 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>
2018-02-27 13:59:03 +01:00
Sven Eckelmann 14daec66ef batman-adv: upgrade package to latest release 2017.3
* support latest kernels (3.2 - 4.14)
 * coding style cleanups and refactoring
 * bugs squashed:
   - fix TT sync flag inconsistencies
   - ignore invalid throughput values from wifi interfaces

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2017-09-28 18:42:27 +02:00
Sven Eckelmann 77a88d5d0b batman-adv: fix TT sync flag inconsistencies
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>
2017-07-29 10:18:28 +02:00
Sven Eckelmann e7ccf38057 batman-adv: upgrade package to latest release 2017.1
* 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>
2017-05-25 17:02:31 +02:00
Sven Eckelmann 1c0419755d batman-adv: Add bugfixes for 2017.0.1
* batman-adv: average: change to declare precision, not factor
 * batman-adv: Keep fragments equally sized
 * batman-adv: Initialize gw sel_class via batadv_algo

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2017-03-04 17:49:18 +01:00
Sven Eckelmann f5b1fe1a60 batman-adv: upgrade package to latest release 2017.0
* 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>
2017-02-28 19:35:09 +01:00
Sven Eckelmann 0a4df2c301 batman-adv: add patches from 2016.5-maint 2017-02-21
* 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>
2017-02-26 15:17:46 +01:00
Sven Eckelmann 0e8b0976f5 batman-adv: add patches from 2016.4-maint 2017-01-04
* batman-adv: Decrease hardif refcnt on fragmentation send error

Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
2017-01-30 15:02:53 +01:00
Sven Eckelmann a80e868772 batman-adv: upgrade package to latest release 2016.5
* 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>
2016-12-16 10:00:44 +01:00
Sven Eckelmann 3e7f211fee batman-adv: Add get_link_net compat code for Linux < 4.0.0
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>
2016-12-02 15:48:47 +01:00
Sven Eckelmann 8387f7c9d4 batman-adv: add patches from 2016.4-maint 2016-12-02
* 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>
2016-12-02 15:48:18 +01:00
Sven Eckelmann 215d6b834f batman-adv: upgrade package to latest release 2016.4
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2016-10-28 18:03:42 +02:00
Sven Eckelmann 549909f89d batman-adv: upgrade package to latest release 2016.3
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2016-09-30 10:04:48 +02:00
Sven Eckelmann 7f6956b5bb batman-adv: Fix speedy join in gateway client mode
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>
2016-07-05 12:13:44 +02:00
Sven Eckelmann af8eeab86f batman-adv: Add reference counting + nullptr fixes
* 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>
2016-07-05 12:12:07 +02:00
Sven Eckelmann fd4a2d7b6d batman-adv: upgrade package to latest release 2016.2
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2016-06-09 19:14:57 +02:00
Marek Lindner 8dec3dc38b batman-adv: 2016.1 bugfixes & stability updates
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2016-05-07 20:42:44 +08:00
Marek Lindner 0db26614ec batman-adv: upgrade package to latest release 2015.2
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-12-28 07:50:16 +08:00
Marek Lindner d34224e9f0 batman-adv: 2015.1 bugfixes & stability updates
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-09-06 16:53:06 +08:00
Marek Lindner 99a3f8dcb5 batman-adv: upgrade package to latest release 2015.1
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-08-05 03:00:59 +08:00
Marek Lindner 96867471b7 batman-adv: 2015.0 bugfixes & stability updates
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-07-07 16:51:36 +08:00
Marek Lindner 8a0a7fa06d batman-adv: 2015.0 bugfixes & stability updates
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-28 22:18:50 +08:00
Marek Lindner 54b696ef52 batman-adv: 2015.0 bugfixes & stability updates
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-21 19:04:04 +08:00
Marek Lindner f5205d7d24 batman-adv: upgrade package to latest release 2014.2.0
* remove batctl tool into separate package
 * support for vlan options added

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2014-06-07 13:33:28 +08:00