Commit Graph

141 Commits

Author SHA1 Message Date
Sven Eckelmann df9f33c522 batman-adv: Merge bugfixes from 2022.0
* allow netlink usage in unprivileged containers

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2022-02-03 20:19:34 +01:00
Sven Eckelmann 7a3e63fd45 batman-adv: Merge bugfixes from 2021.4
* fix error handling during interface initialization

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-11-19 17:20:13 +01:00
Sven Eckelmann c8734df677 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-11-19 17:17:04 +01:00
Sven Eckelmann 3c10076826 batman-adv: Merge bugfixes from 2021.2
* Avoid WARN_ON timing related checks

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-08-20 11:59:36 +02:00
Sven Eckelmann a995b62043 batman-adv: Merge bugfixes from 2021.1
* initialize "struct batadv_tvlv_tt_vlan_data"->reserved field

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-05-14 20:59:43 +02:00
Sven Eckelmann 596dc84b65 batman-adv: Merge bugfixes from 2021.0
* set .owner to THIS_MODULE
* Consider fragmentation for needed_headroom
* Reserve needed_*room for fragments
* Don't always reallocate the fragmentation skb head

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-01-28 21:44:03 +01:00
Sven Eckelmann 685968996f batman-adv: Merge bugfixes from 2020.4
* bla: fix type misuse for backbone_gw hash indexing
* mcast/TT: fix wrongly dropped or rerouted packets
* Add missing include for in_interrupt()
* mcast: fix duplicate mcast packets in BLA backbone from LAN
* mcast: fix duplicate mcast packets in BLA backbone from mesh
* mcast: fix duplicate mcast packets from BLA backbone to mesh

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-10-24 21:40:40 +02:00
Sven Eckelmann 6dea537c07 batman-adv: Merge bugfixes from 2020.3
* Avoid uninitialized chaddr when handling DHCP
* Fix own OGM check in aggregated OGMs
* bla: use netif_rx_ni when not in interrupt context

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-08-25 20:36:05 +02:00
Sven Eckelmann 4c05fe97d9 batman-adv: Merge bugfixes from 2020.2
* Revert "disable ethtool link speed detection when auto negotiation off"

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-07-06 20:08:55 +02:00
Sven Eckelmann 5dd2f44a5b batman-adv: Merge bugfixes from 2020.1
* fix batadv_nc_random_weight_tq
* Fix refcnt leak in batadv_show_throughput_override
* Fix refcnt leak in batadv_store_throughput_override
* Fix refcnt leak in batadv_v_ogm_process

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-04-24 21:06:04 +02:00
Sven Eckelmann 18a724e154 batman-adv: Merge bugfixes from 2020.0
* Don't schedule OGM for disabled interface

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2020-03-06 20:51:17 +01:00
Sven Eckelmann 242185e386 batman-adv: Merge bugfixes from 2019.5
* fix DAT candidate selection on little endian systems

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-12-13 22:16:19 +01:00
Sven Eckelmann a2f2a13386 batman-adv: Merge bugfixes from 2019.4
* fix uninit-value in batadv_netlink_get_ifindex()
* Only read OGM tvlv_len after buffer len check
* Only read OGM2 tvlv_len after buffer len check
* Avoid free/alloc race when handling OGM2 buffer
* Avoid free/alloc race when handling OGM buffer
* Introduce own OGM2 buffer mutex
* Avoid OGM workqueue synchronous cancel deadlock

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-10-25 22:25:10 +02:00
Sven Eckelmann b04d24313d batman-adv: Readd Linux 4.19.x compat patches
The patches were accidentally deleted while testing the batman-adv 2019.3
bugfixes with various OpenWrt versions. But OpenWrt 19.07 will be released
with a mac80211 package which still uses the Linux 4.19 API. And thus the
OpenWrt 19.07 openwrt-routing branch still has to retain these compat
patches.

Fixes: a93e68447a ("alfred: Merge bugfixes from 2019.3")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-08-04 08:16:01 +02:00
Sven Eckelmann 9d559fdae9 batman-adv: Merge bugfixes from 2019.3
* Fix netlink dumping of all mcast_flags buckets

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-08-01 19:47:11 +02:00
Sven Eckelmann a93e68447a alfred: Merge bugfixes from 2019.3
* vis: Use rtnl to query list of hardifs of meshif
* vis: Retrieve hardif status via generic netlink

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-08-01 19:47:11 +02:00
Sven Eckelmann e87a25f408 batman-adv: Don't try to set unconfigured ap_isolation for vlan
The ap_isolation setting only supports boolean values. So setting an empty
string as ap_isolation is not supported by batctl.

Fixes: f5205d7d24 ("batman-adv: upgrade package to latest release 2014.2.0")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-06-16 09:29:42 +02:00
Sven Eckelmann 67875e2069 batman-adv: Add support for hardif settings
B.A.T.M.A.N. V support additional settings which are hardif specific. The
batadv_hardif proto has to expose them to allow automatic configuration.
The default configuration would be:

  config interface 'bat0_hardif_eth0'
  	option proto 'batadv_hardif'
  	option master 'bat0'
  	option ifname 'eth0'
  	option mtu '1536'
  	option 'elp_interval' 500
  	# string like '1mbit' is accepted instead of kbit for override
  	option 'throughput_override' '0'

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-06-15 09:53:55 +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 312fd8afc1 batman-adv: upgrade package to latest release 2019.1
* support latest kernels (3.16 - 5.1)
* coding style cleanups and refactoring
* implement meshif, hardif and vlan config interface via netlink
* snoop DHCP ACKs to improve DAT cache efficiency
* bugs squashed:

  - avoid potential reference counter underflows and use-after free errors for
    several objects
  - fix GCC warning when B.A.T.M.A.N. V is build in but cfg80211 is not
    available
  - reject too small VLAN packets before they are processed further

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-03-28 19:50:25 +01:00
Adrian Schmutzler 1a22e00eeb batman-adv: Fix uci commit target
Although batman-adv config is cycled in config_foreach, changes
are made in the network config. Thus, this one has to be committed.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-03-19 19:49:27 +01:00
Sven Eckelmann 54af5a209e batman-adv: Split batadv proto in meshif and hardif part
batman-adv allows to configure three different objects:

* batadv hardif

  - network interface used by batadv meshif to transport the batman-adv
    packets
  - its master interface is set to the batadv meshif

* batadv (meshif/softif)

  - virtual interface that emulates a normal 802.3 interface on top
  - encapsulates traffic and forwards it via the batadv hardifs

* batadv vlan

  - potential VLAN ID on top of batadv meshif
  - allows filtering of traffic from specific VIDs

While batadv vlan objects were already represented as an own proto
"batadv_vlan", the batadv meshif could never be fully configured using
/etc/config/network. Instead, parts of its configuration were stored in
/etc/config/batman_adv and some in the interfaces with the "batadv" proto.

To increase the confusion, the "batadv" proto wasn't used to define the
batadv meshif but to identify batadv (slave) hardifs. The batman-adv
meshifs were also never created directly but only when a hardif was
configured. The actual modification of the configuration settings was then
applied using a hotplug script hack. The batadv meshif network interface
could therefore only be created when an hardif was available and not
manipulated with ifup/ifdown. Also `/etc/init.d/network reload` didn't
modify the batadv meshif interface configuration correctly.

The "batadv" is now renamed to "batadv_hardif" and a new "batadv" proto is
used to configure the main (meshif) network interface with all its
configuration.

A simple network configuration with WiFi & ethernet interfaces and static
IP on top of bat0 would look like:

  # batadv meshif bat0
  config interface 'bat0'
  	option proto 'batadv'
  	option routing_algo 'BATMAN_IV'
  	option aggregated_ogms 1
  	option ap_isolation 0
  	option bonding 0
  	option fragmentation 1
  	#option gw_bandwidth '10000/2000'
  	option gw_mode 'off'
  	#option gw_sel_class 20
  	option log_level 0
  	option orig_interval 1000
  	option bridge_loop_avoidance 1
  	option distributed_arp_table 1
  	option multicast_mode 1
  	option network_coding 0
  	option hop_penalty 30
  	option isolation_mark '0x00000000/0x00000000'

  # add *single* wifi-iface with network bat0_hardif_wlan as hardif to bat0
  config interface 'bat0_hardif_wlan'
  	option mtu '1536'
  	option proto 'batadv_hardif'
  	option master 'bat0'
  	# option ifname is filled out by the wifi-iface

  # add eth0 as hardif to bat0
  config interface 'bat0_hardif_eth0'
  	option proto 'batadv_hardif'
  	option master 'bat0'
  	option ifname 'eth0'
  	option mtu '1536'

  # configure IP on bat0
  config interface 'bat0_lan'
  	option ifname 'bat0'
  	option proto 'static'
  	option ipaddr '192.168.1.1'
  	option netmask '255.255.255.0'
  	option ip6assign '60'

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-03-07 17:01:09 +01:00
Sven Eckelmann 5882b6049d batman-adv: use batctl for configuration of hop_penalty
hop_penalty is the last remaining setting which is directly writing to
sysfs instead of using a implementation (sysfs vs. netlink) abstraction
layer. batctl now provides a wrapper function that allows the script to
directly use it to take care of communicating with the driver.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 22:49:56 +01:00
Sven Eckelmann 7d973599ef batman-adv: use batctl for configuration of gw_mode
The batctl tool should be used for modifying settings in the batman-adv
driver to keep the scripts consistent and allow to use the correct way of
communicating with the kernel (sysfs vs. netlink).

The gw_mode, gw_bandwidth and gw_sel_class options are all handled by
the same gw_mode command in batctl and thus have to be combined depending
on the "gw_mode" value.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 22:46:21 +01:00
Sven Eckelmann ad27ee7f9a batman-adv: Drop cfg80211_get_station memset workaround
The actual memset fix for cfg80211_get_station's sinfo is already part of
the mac80211 package and doesn't have to be shipped anymore with
batman-adv.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:40:11 +01:00
Sven Eckelmann fc37a1aa4d batman-adv: Drop compat-hack for __poll_t
__poll_t is already defined by the mac80211's backports and
doesn't have to be redefined in the compat-hacks.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:38:35 +01:00
Sven Eckelmann df9d2719fa batman-adv: Drop compat-hack for from_timer
from_timer is already defined by the mac80211's backports and
doesn't have to be redefined in the compat-hacks.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:37:54 +01:00
Sven Eckelmann ae9c14e8b0 batman-adv: Drop compat-hack for skb_put*
skb_put* is already defined by the mac80211's backports and
doesn't have to be redefined in the compat-hacks.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:35:39 +01:00
Sven Eckelmann 3f0a7c4880 batman-adv: Drop compat-hack for nla_put_u64_64bit
nla_put_u64_64bit is already defined by the mac80211's backports and
doesn't have to be redefined in the compat-hacks.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:24:40 +01:00
Sven Eckelmann 89bc1bc1a1 batman-adv: Drop compat-hack for netif_trans_update
netif_trans_update is already defined by the mac80211's backports and
doesn't have to be redefined in the compat-hacks.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:22:22 +01:00
Sven Eckelmann 502d1232f7 batman-adv: Drop redefinition of NL80211_STA_INFO_EXPECTED_THROUGHPUT
NL80211_STA_INFO_EXPECTED_THROUGHPUT is defined by the mac80211 package and
doesn't have to be redefined in the compat-hacks.h.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-22 20:19:42 +01: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 e6fc697d41 batman-adv: upgrade package to latest release 2019.0
* support latest kernels (3.16 - 5.0)
* coding style cleanups and refactoring
* allow to enable debug tracing without full batman-adv debugfs support
* enable inconsistency reporting for most netlink dump commands
* bugs squashed:

  - avoid unnecessary kernel warning (panic) during detection of interface loops
  - work around incorrect ethernet header offset in transmit code path

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-02-02 14:04:09 +01:00
Sven Eckelmann 498463cd59 batman-adv: use batctl for configuration
The batctl binary is currently optional for batman-adv installations. But
new configuration settings will only be exposed via generic netlink. The
batctl tool will therefore be required to modify them.

batctl must therefore no longer depend on batman-adv but batman-adv must
depend on batctl. Some already implemented settings are already moved to
batctl.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-01-27 15:31:37 +01:00
Sven Eckelmann 4167ad2c62 batman-adv: upgrade package to latest release 2018.4
* support latest kernels (3.16 - 4.20)
* coding style cleanups and refactoring
* improve tx performance by avoiding unnecessary locking
* add help messages regarding deprecation of debugfs files
* support for debug message tracepoints
* explicit ELP padding to allow TVLVs in the future
* bugs squashed:

  - fix skb_over_panic for merged fragments with small tailroom

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-11-14 21:50:38 +01:00
Sven Eckelmann 9bc898b8f4 batman-adv: Re-add kmod-lib-crc16 back to dependency line
The OpenWrt dependency builder cannot extract the crc16 dependency from
the KMOD_BATMAN_ADV_BLA dependencies. They have to be specified directly in
the OpenWrt Makefile's DEPENDS line to avoid error when BLA is enabled:

  Package kmod-batman-adv is missing dependencies for the following libraries:
  crc16.ko

Reported-by: Lech Perczak <lech.perczak@gmail.com>
Fixes: 0db66160aa ("batman-adv: Sync config options with kernel Kconfig")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-22 12:34:32 +02:00
Sven Eckelmann c3b60d4c84 batman-adv: Remove unused dependency kmod-crypto-crc32c
The translation table code from batman-adv is only using the function
crc32c which is part of kmod-lib-crc32c. The kmod-crypto-crc32c is then
only used by kmod-lib-crc32c but not batman-adv.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-14 17:41:53 +02:00
Sven Eckelmann 6a25fd5ce5 batman-adv: Use the kernel style Kconfig symbols
Kernel modules like ath9k and ath10k are using the same Kconfig option
symbols as used in the kernel. This makes it easier to share them between
these two projects. A similar approach should be used for the batman-adv
module.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-14 17:41:52 +02:00
Sven Eckelmann 0db66160aa batman-adv: Sync config options with kernel Kconfig
The kernel already provides all available kernel options for batman-adv and
even includes more verbose descriptions of each option. Importing this
Kconfig (with minor adjustments) file as Config.in allows to share most
information between kernel and OpenWrt.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-14 17:41:52 +02:00
Sven Eckelmann 45c12f406f batman-adv: Disable MCAST during compilation
The multicast optimization compile option is disabled by default in the
Kconfig of batman-adv. The out-of-tree module should keep this setting in
sync and thus has to also disable the build of multicast optimization by
default.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-14 16:58:01 +02:00
Sven Eckelmann c5092c6e78 batman-adv: Order Kconfig config symbols like kernel
The options in the kernel Kconfig have a different order than the one in
the OptionWrt Config.in. This makes it unnecessary hard to compare these
two files.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-14 16:50:23 +02:00
Sven Eckelmann 726b00dc9f batman-adv: Add DEBUG_LOG -> DEBUGFS dependency
The debug log is only available when the debugfs is also enabled. This
must be reflected in Kconfig to avoid incompatible selection of batman-adv
options.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-14 16:07:42 +02:00
Sven Eckelmann 542a63720f batman-adv: Add openwrt revision to internal version
OpenWrt is using a modified version of the software and these modifications
may introduce extra bugs (or behavior changes). It is also patched for
stable releases instead of switching to new releases. The revision should
therefore be added to the version number to make it easier understandable
which modified version the user may have installed.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-07 13:31:01 +02:00
Sven Eckelmann 8112737cdc batman-adv: Fix search for cfg80211 module symbols
The Module.symvers with the exported symbols of all other kernel modules in
OpenWrt is usually placed in the main source directory of the package. But
the actual sources for batman-adv are found in net/batman-adv. OpenWrt must
therefore be informed to move it to this subdirectory or otherwise modpost
will fail to find the symbols

  WARNING: "cfg80211_get_station" [.../batman-adv-2018.3/net/batman-adv/batman-adv.ko] undefined!

The dependency will then be missing in the .modinfo depends= option and
thus it the kernel module loader will not correctly load the cfg80211.ko
during bootup.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-07 13:29:24 +02:00
Sven Eckelmann 003607ac1e batman-adv: Rebuild automatically on mac80211 changes
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-10-07 10:42:12 +02:00
Sven Eckelmann 02e3cb6db9 batman-adv: upgrade package to latest release 2018.3
* support latest kernels (3.16 - 4.19)
* coding style cleanups and refactoring
* enable the DAT by default for the in-tree Linux module
* bugs squashed:

  - fix segfault when writing to sysfs files under batman_adv/ with
    CONFIG_BATMAN_ADV_DEBUG enabled
  - avoid information leakage in probe ELP packets
  - adjust reference counters when queue_work fails
  - prevent duplicated entries in various lists

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-09-15 10:20:02 +02: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 7a9336380a batman-adv: Simplify installation of files
It is not necessary to install each file manually to the target path. A
simple recursive copy is enough.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-07-17 21:23:54 +02:00
Sven Eckelmann 247499d2b0 batman-adv: Drop unused clean rule
The path $(BUILD_DIR)/$(PKG_NAME) is not used anymore. The rule can be
removed and the OpenWrt build system takes care of the removal of the build
directory.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-07-17 21:23:54 +02:00