Most of the implementations behind cfg80211_get_station will not initialize
sinfo to zero before manipulating it. For example, the member "filled",
which indicates the filled in parts of this struct, is often only modified
by enabling certain bits in the bitfield while keeping the remaining bits
in their original state. A caller without a preinitialized sinfo.filled can
then no longer decide which parts of sinfo were filled in by
cfg80211_get_station (or actually the underlying implementations).
cfg80211_get_station must therefore take care that sinfo is initialized to
zero. Otherwise, the caller may tries to read information which was not
filled in and which must therefore also be considered uninitialized. In
batadv_v_elp_get_throughput's case, an invalid "random" expected throughput
may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may
switch to non-optimal neighbors for certain destinations.
Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API")
Reported-by: Thomas Lauer <holminateur(a)gmail.com>
Reported-by: Marcel Schmidt <ff.z-casparistrasse(a)mailbox.org>
Cc: b.a.t.m.a.n(a)lists.open-mesh.org
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
v2:
- do a complete memset of sinfo, requested by Johannes Berg
txt.file, you may want to take care that this is integrated in your
firmware.
---
net/wireless/util.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index b5bb1c309914..3c654cd7ba56 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1746,6 +1746,8 @@ int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
if (!rdev->ops->get_station)
return -EOPNOTSUPP;
+ memset(sinfo, 0, sizeof(*sinfo));
+
return rdev_get_station(rdev, dev, mac_addr, sinfo);
}
EXPORT_SYMBOL(cfg80211_get_station);
--
2.11.0
Most of the implementations behind cfg80211_get_station will not initialize
sinfo to zero before manipulating it. The member "filled", which indicates
the filled in parts of this struct, is often only modified by enabling
certain bits in the bitfield while keeping the remaining bits in their
original state. A caller without a preinitialized sinfo.filled can then no
longer decide which parts of sinfo were filled in by cfg80211_get_station
(or actually the underlying implementations).
cfg80211_get_station must therefore take care that sinfo.filled is
initialized to zero. Otherwise, the caller may tries to read information
which was not filled in and which must therefore also be considered
uninitialized. In batadv_v_elp_get_throughput's case, an invalid "random"
expected throughput may be stored for this neighbor and thus the
B.A.T.M.A.N V algorithm may switch to non-optimal neighbors for certain
destinations.
Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API")
Reported-by: Thomas Lauer <holminateur(a)gmail.com>
Reported-by: Marcel Schmidt <ff.z-casparistrasse(a)mailbox.org>
Cc: b.a.t.m.a.n(a)lists.open-mesh.org
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Matthias, you may want to take care that this is integrated in your
firmware.
---
net/wireless/util.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index b5bb1c309914..cd6a695d1230 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1746,6 +1746,8 @@ int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
if (!rdev->ops->get_station)
return -EOPNOTSUPP;
+ sinfo->filled = 0;
+
return rdev_get_station(rdev, dev, mac_addr, sinfo);
}
EXPORT_SYMBOL(cfg80211_get_station);
--
2.11.0
batadv_v_elp_get_throughput is calling cfg80211_get_station with a pointer
(sinfo) to some uninitialized memory on the stack. But most of the
implementations behind cfg80211_get_station will not initialize sinfo to
zero before manipulating it. For example, the member
&struct station_info.filled is often only modified by using a read (of
possibly uninitialized/random memory), an OR operation and then a write of
the new value back to the original memory address. A caller without a
preinitialized &struct station_info.filled can then no longer decide which
parts of sinfo were filled in by cfg80211_get_station.
The caller of cfg80211_get_station must therefore take care that sinfo (or
at least sinfo.filled) is initialized to zero. Otherwise, the caller may
tries to read information which was not filled in and is therefore also
uninitialized. In batadv_v_elp_get_throughput's case, an invalid "random"
expected throughput may be saved for this neighbor and thus the B.A.T.M.A.N
V algorithm may switch to non-optimal neighbors for certain destinations.
Fixes: 5c3245172c01 ("batman-adv: ELP - compute the metric based on the estimated throughput")
Reported-by: Thomas Lauer <holminateur(a)gmail.com>
Reported-by: Marcel Schmidt <ff.z-casparistrasse(a)mailbox.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---
v2:
* rewrite commit message
net/batman-adv/bat_v_elp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 28687493..846316ea 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -102,6 +102,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
if (!real_netdev)
goto default_throughput;
+ memset(&sinfo, 0, sizeof(sinfo));
ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo);
dev_put(real_netdev);
--
2.17.1
cfg80211_get_station is not initializing the memory given as parameter
sinfo. The caller has to handle it. Otherwise the filled parameter may be
set incorrectly and thus uninitialized memory is used to identify the
throughput to an neighbor.
Fixes: 5c3245172c01 ("batman-adv: ELP - compute the metric based on the estimated throughput")
Reported-by: Thomas Lauer <holminateur(a)gmail.com>
Reported-by: Marcel Schmidt <ff.z-casparistrasse(a)mailbox.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Cc: Thomas Lauer <holminateur(a)gmail.com>
Cc: Marcel Schmidt <ff.z-casparistrasse(a)mailbox.org>
net/batman-adv/bat_v_elp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 71c20c1d..5f931475 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -102,6 +102,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
if (!real_netdev)
goto default_throughput;
+ memset(&sinfo, 0, sizeof(sinfo));
ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo);
dev_put(real_netdev);
--
2.11.0
batman-adv is creating special debugfs directories in the init
net_namespace for each valid hard-interface (net_device). But it is
possible to rename a net_device to a completely different name then the
original one.
It can therefore happen that a user registers a new net_device which gets
the name "wlan0" assigned by default. batman-adv is also adding a new
directory under $debugfs/batman-adv/ with the name "wlan0".
The user then decides to rename this device to "wl_pri" and registers a
different device. The kernel may now decide to use the name "wlan0" again
for this new device. batman-adv will detect it as a valid net_device and
tries to create a directory with the name "wlan0" under
$debugfs/batman-adv/. But there already exists one with this name under
this path and thus this fails. batman-adv will detect a problem and
rollback the registering of this device.
batman-adv must therefore take care of renaming the debugfs directories
for hard-interfaces whenever it detects such a net_device rename.
Fixes: 3c926a01c8e8 ("batman-adv: add debugfs structure for information per interface")
Reported-by: John Soros <sorosj(a)gmail.com>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Cc: John Soros <sorosj(a)gmail.com>
You can find a backported version of the patch at
https://git.open-mesh.org/batman-adv.git/patch/9c24af2f54e7dd138150f2e8c463…
net/batman-adv/debugfs.c | 20 ++++++++++++++++++++
net/batman-adv/debugfs.h | 6 ++++++
net/batman-adv/hard-interface.c | 3 +++
3 files changed, 29 insertions(+)
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 4229b01a..7e5de7b9 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -19,6 +19,7 @@
#include "debugfs.h"
#include "main.h"
+#include <linux/dcache.h>
#include <linux/debugfs.h>
#include <linux/err.h>
#include <linux/errno.h>
@@ -343,6 +344,25 @@ int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
return -ENOMEM;
}
+/**
+ * batadv_debugfs_rename_hardif() - Fix debugfs path for renamed hardif
+ * @hard_iface: hard interface which was renamed
+ */
+void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface)
+{
+ const char *name = hard_iface->net_dev->name;
+ struct dentry *dir;
+ struct dentry *d;
+
+ dir = hard_iface->debug_dir;
+ if (!dir)
+ return;
+
+ d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
+ if (!d)
+ pr_err("Can't rename debugfs dir to %s\n", name);
+}
+
/**
* batadv_debugfs_del_hardif() - delete the base directory for a hard interface
* in debugfs.
diff --git a/net/batman-adv/debugfs.h b/net/batman-adv/debugfs.h
index 37b06969..8538a7a7 100644
--- a/net/batman-adv/debugfs.h
+++ b/net/batman-adv/debugfs.h
@@ -32,6 +32,7 @@ void batadv_debugfs_destroy(void);
int batadv_debugfs_add_meshif(struct net_device *dev);
void batadv_debugfs_del_meshif(struct net_device *dev);
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
+void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface);
void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface);
#else
@@ -59,6 +60,11 @@ int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
return 0;
}
+static inline
+void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface)
+{
+}
+
static inline
void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
{
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index c405d15b..dc2763b1 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -1051,6 +1051,9 @@ static int batadv_hard_if_event(struct notifier_block *this,
if (batadv_is_wifi_hardif(hard_iface))
hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
break;
+ case NETDEV_CHANGENAME:
+ batadv_debugfs_rename_hardif(hard_iface);
+ break;
default:
break;
}
--
2.17.0
A reference to the best gateway is taken when the list of gateways in the
mesh is sent via netlink. This is necessary to check whether the currently
dumped entry is the currently selected gateway or not. This information is
then transferred as flag BATADV_ATTR_FLAG_BEST.
After the comparison of the current entry is done,
batadv_iv_gw_dump_entry() has to decrease the reference counter again.
Otherwise the reference will be held and thus prevents a proper shutdown of
the batman-adv interfaces (and some of the interfaces enslaved in it).
Fixes: fa3228924152 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations")
Reported-by: Andreas Ziegler <github(a)andreas-ziegler.de>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Cc: Andreas Ziegler <github(a)andreas-ziegler.de>
net/batman-adv/bat_iv_ogm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index be09a988..73bf6a93 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -2732,7 +2732,7 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
{
struct batadv_neigh_ifinfo *router_ifinfo = NULL;
struct batadv_neigh_node *router;
- struct batadv_gw_node *curr_gw;
+ struct batadv_gw_node *curr_gw = NULL;
int ret = 0;
void *hdr;
@@ -2780,6 +2780,8 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
ret = 0;
out:
+ if (curr_gw)
+ batadv_gw_node_put(curr_gw);
if (router_ifinfo)
batadv_neigh_ifinfo_put(router_ifinfo);
if (router)
--
2.17.0
The Linux Kernel 3.2 reached its end of life [1] after over 6 years.
Instead it is recommended to use at least kernel 3.16 which is also already
over 3 years old. All older kernels (v3.2 - v3.15) should therefore be
dropped to reduce the support overhead.
[1] https://lkml.kernel.org/r/a3d2d2b2c3559217eb8315d25df0c5883f922066.camel@de…
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
Makefile | 42 ++-----
README.external.rst | 2 +-
compat-include/linux/etherdevice.h | 55 ---------
compat-include/linux/export.h | 30 -----
compat-include/linux/genetlink.h | 34 ------
compat-include/linux/if_ether.h | 34 ------
compat-include/linux/if_vlan.h | 34 ------
compat-include/linux/kernel.h | 45 --------
compat-include/linux/kref.h | 47 --------
compat-include/linux/list.h | 21 ----
compat-include/linux/net.h | 40 -------
compat-include/linux/netdev_features.h | 36 ------
compat-include/linux/netdevice.h | 32 +-----
compat-include/linux/netlink.h | 18 ---
compat-include/linux/random.h | 34 ------
compat-include/linux/rculist.h | 40 -------
compat-include/linux/skbuff.h | 32 ------
compat-include/linux/slab.h | 34 ------
compat-include/linux/timer.h | 11 --
compat-include/net/genetlink.h | 147 -------------------------
compat-include/net/ipv6.h | 38 -------
compat-include/net/netlink.h | 11 --
compat-include/uapi/linux/eventpoll.h | 4 -
compat-include/uapi/linux/nl80211.h | 4 -
compat-patches/README | 25 -----
compat-patches/replacements.sh | 25 -----
compat-sources/Makefile | 6 +-
compat.h | 98 -----------------
28 files changed, 14 insertions(+), 965 deletions(-)
delete mode 100644 compat-include/linux/etherdevice.h
delete mode 100644 compat-include/linux/export.h
delete mode 100644 compat-include/linux/genetlink.h
delete mode 100644 compat-include/linux/if_ether.h
delete mode 100644 compat-include/linux/if_vlan.h
delete mode 100644 compat-include/linux/kernel.h
delete mode 100644 compat-include/linux/kref.h
delete mode 100644 compat-include/linux/net.h
delete mode 100644 compat-include/linux/netdev_features.h
delete mode 100644 compat-include/linux/random.h
delete mode 100644 compat-include/linux/rculist.h
delete mode 100644 compat-include/linux/slab.h
delete mode 100644 compat-include/net/genetlink.h
delete mode 100644 compat-include/net/ipv6.h
delete mode 100644 compat-patches/README
delete mode 100755 compat-patches/replacements.sh
diff --git a/Makefile b/Makefile
index ea995216..7c6fa1e4 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,6 @@ export CONFIG_BATMAN_ADV_MCAST=y
export CONFIG_BATMAN_ADV_BATMAN_V=y
PWD:=$(shell pwd)
-BUILD_DIR=$(PWD)/build
KERNELPATH ?= /lib/modules/$(shell uname -r)/build
# sanity check: does KERNELPATH exist?
ifeq ($(shell cd $(KERNELPATH) && pwd),)
@@ -42,30 +41,23 @@ endif
export KERNELPATH
RM ?= rm -f
-MKDIR := mkdir -p
-PATCH_FLAGS = --batch --fuzz=0 --forward --strip=1 --unified --version-control=never -g0 --remove-empty-files --no-backup-if-mismatch --reject-file=-
-PATCH := patch $(PATCH_FLAGS) -i
CP := cp -fpR
LN := ln -sf
-SOURCE = $(wildcard net/batman-adv/*.[ch]) net/batman-adv/Makefile
-SOURCE_BUILD = $(wildcard $(BUILD_DIR)/net/batman-adv/*.[ch]) $(BUILD_DIR)/net/batman-adv/Makefile
-SOURCE_STAMP = $(BUILD_DIR)/net/batman-adv/.compat-prepared
-
REVISION= $(shell if [ -d "$(PWD)/.git" ]; then \
echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
fi)
NOSTDINC_FLAGS += \
- -I$(PWD)/../compat-include/ \
- -I$(PWD)/../include/ \
- -include $(PWD)/../compat.h \
+ -I$(PWD)/compat-include/ \
+ -I$(PWD)/include/ \
+ -include $(PWD)/compat.h \
$(CFLAGS)
ifneq ($(REVISION),)
NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
endif
--include $(PWD)/../compat-sources/Makefile
+include $(PWD)/compat-sources/Makefile
obj-y += net/batman-adv/
@@ -73,8 +65,8 @@ export batman-adv-y
BUILD_FLAGS := \
- M=$(BUILD_DIR) \
- PWD=$(BUILD_DIR) \
+ M=$(PWD) \
+ PWD=$(PWD) \
REVISION=$(REVISION) \
CONFIG_BATMAN_ADV=m \
CONFIG_BATMAN_ADV_DEBUG=$(CONFIG_BATMAN_ADV_DEBUG) \
@@ -86,34 +78,18 @@ BUILD_FLAGS := \
CONFIG_BATMAN_ADV_BATMAN_V=$(CONFIG_BATMAN_ADV_BATMAN_V) \
INSTALL_MOD_DIR=updates/
-all: config $(SOURCE_STAMP)
+all: config
$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) modules
clean:
$(RM) compat-autoconf.h*
- $(RM) -r $(BUILD_DIR)
+ $(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) clean
-install: config $(SOURCE_STAMP)
+install: config
$(MAKE) -C $(KERNELPATH) $(BUILD_FLAGS) modules_install
depmod -a
config:
$(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
-$(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
- $(MKDIR) $(BUILD_DIR)/net/batman-adv/
- @$(LN) ../Makefile $(BUILD_DIR)/Makefile
- @$(RM) $(SOURCE_BUILD)
- @$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
- @set -e; \
- patches="$$(ls -1 compat-patches/|grep '.patch$$'|sort)"; \
- for i in $${patches}; do \
- echo ' COMPAT_PATCH '$${i};\
- cd $(BUILD_DIR); \
- $(PATCH) ../compat-patches/$${i}; \
- cd - > /dev/null; \
- done
- compat-patches/replacements.sh
- touch $(SOURCE_STAMP)
-
.PHONY: all clean install config
diff --git a/README.external.rst b/README.external.rst
index a6f14a03..6c3e0c85 100644
--- a/README.external.rst
+++ b/README.external.rst
@@ -12,7 +12,7 @@ and as external module. The external module allows to get
new features without upgrading to a newer kernel version
and to get batman-adv specific bugfixes for kernels that are
not supported anymore. It compiles against and should work
-with Linux 3.2 - 4.17. Supporting older versions is not
+with Linux 3.16 - 4.17. Supporting older versions is not
planned, but it's probably easy to backport it. If you work on a
backport, feel free to contact us. :-)
diff --git a/compat-include/linux/etherdevice.h b/compat-include/linux/etherdevice.h
deleted file mode 100644
index 96f560d1..00000000
--- a/compat-include/linux/etherdevice.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_
-
-#include <linux/version.h>
-#include_next <linux/etherdevice.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
-
-#define eth_hw_addr_random(dev) batadv_eth_hw_addr_random(dev)
-
-static inline void batadv_eth_hw_addr_random(struct net_device *dev)
-{
- random_ether_addr(dev->dev_addr);
-}
-
-#endif /* < KERNEL_VERSION(3, 4, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-
-static inline void eth_zero_addr(u8 *addr)
-{
- memset(addr, 0x00, ETH_ALEN);
-}
-
-#endif /* < KERNEL_VERSION(3, 7, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
-
-#define ether_addr_equal_unaligned(_a, _b) (memcmp(_a, _b, ETH_ALEN) == 0)
-#define ether_addr_copy(_a, _b) memcpy(_a, _b, ETH_ALEN)
-
-#endif /* < KERNEL_VERSION(3, 14, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_ETHERDEVICE_H_ */
diff --git a/compat-include/linux/export.h b/compat-include/linux/export.h
deleted file mode 100644
index 5fb590fc..00000000
--- a/compat-include/linux/export.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_EXPORT_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_EXPORT_H_
-
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
-#include_next <linux/export.h>
-#endif
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_EXPORT_H_ */
diff --git a/compat-include/linux/genetlink.h b/compat-include/linux/genetlink.h
deleted file mode 100644
index ec778782..00000000
--- a/compat-include/linux/genetlink.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_GENETLINK_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_GENETLINK_H_
-
-#include <linux/version.h>
-#include_next <linux/genetlink.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
-
-#define MODULE_ALIAS_GENL_FAMILY(family)
-
-#endif /* < KERNEL_VERSION(3, 5, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_GENETLINK_H_ */
diff --git a/compat-include/linux/if_ether.h b/compat-include/linux/if_ether.h
deleted file mode 100644
index d2f683f9..00000000
--- a/compat-include/linux/if_ether.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IF_ETHER_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_IF_ETHER_H_
-
-#include <linux/version.h>
-#include_next <linux/if_ether.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
-
-#define ETH_P_BATMAN 0x4305
-
-#endif /* < KERNEL_VERSION(3, 8, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_IF_ETHER_H_ */
diff --git a/compat-include/linux/if_vlan.h b/compat-include/linux/if_vlan.h
deleted file mode 100644
index 716040d8..00000000
--- a/compat-include/linux/if_vlan.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_IF_VLAN_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_IF_VLAN_H_
-
-#include <linux/version.h>
-#include_next <linux/if_vlan.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
-
-#define vlan_insert_tag(skb, proto, vid) vlan_insert_tag(skb, vid)
-
-#endif /* < KERNEL_VERSION(3, 10, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_IF_VLAN_H_ */
diff --git a/compat-include/linux/kernel.h b/compat-include/linux/kernel.h
deleted file mode 100644
index 96fd7f99..00000000
--- a/compat-include/linux/kernel.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_KERNEL_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_KERNEL_H_
-
-#include <linux/version.h>
-#include_next <linux/kernel.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
-
-#define U8_MAX ((u8)~0U)
-#define S8_MAX ((s8)(U8_MAX >> 1))
-#define S8_MIN ((s8)(-S8_MAX - 1))
-#define U16_MAX ((u16)~0U)
-#define S16_MAX ((s16)(U16_MAX >> 1))
-#define S16_MIN ((s16)(-S16_MAX - 1))
-#define U32_MAX ((u32)~0U)
-#define S32_MAX ((s32)(U32_MAX >> 1))
-#define S32_MIN ((s32)(-S32_MAX - 1))
-#define U64_MAX ((u64)~0ULL)
-#define S64_MAX ((s64)(U64_MAX >> 1))
-#define S64_MIN ((s64)(-S64_MAX - 1))
-
-#endif /* < KERNEL_VERSION(3, 14, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_KERNEL_H_ */
diff --git a/compat-include/linux/kref.h b/compat-include/linux/kref.h
deleted file mode 100644
index 0516819b..00000000
--- a/compat-include/linux/kref.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_
-
-#include <linux/version.h>
-#include_next <linux/kref.h>
-
-#include <linux/atomic.h>
-#include <linux/kernel.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
-
-/* some stable versions like Linux 3.2.44 also introduced this function
- * and would therefore break the build because they trigger a redefinition
- * of this function. Instead rename this function to be in the batadv_*
- * namespace
- */
-#define kref_get_unless_zero(__kref) batadv_kref_get_unless_zero(__kref)
-
-static inline int __must_check batadv_kref_get_unless_zero(struct kref *kref)
-{
- return atomic_add_unless(&kref->refcount, 1, 0);
-}
-
-#endif /* < KERNEL_VERSION(3, 8, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_ */
diff --git a/compat-include/linux/list.h b/compat-include/linux/list.h
index 224c600e..c542236e 100644
--- a/compat-include/linux/list.h
+++ b/compat-include/linux/list.h
@@ -25,27 +25,6 @@
#include <linux/version.h>
#include_next <linux/list.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#define hlist_entry_safe(ptr, type, member) \
- ({ typeof(ptr) ____ptr = (ptr); \
- ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
- })
-
-#undef hlist_for_each_entry
-#define hlist_for_each_entry(pos, head, member) \
- for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
- pos; \
- pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
-
-#undef hlist_for_each_entry_safe
-#define hlist_for_each_entry_safe(pos, n, head, member) \
- for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
- pos && ({ n = pos->member.next; 1; }); \
- pos = hlist_entry_safe(n, typeof(*pos), member))
-
-#endif /* < KERNEL_VERSION(3, 9, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
#define hlist_add_behind(n, prev) hlist_add_after(prev, n)
diff --git a/compat-include/linux/net.h b/compat-include/linux/net.h
deleted file mode 100644
index fe24a1fb..00000000
--- a/compat-include/linux/net.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_NET_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_NET_H_
-
-#include <linux/version.h>
-#include_next <linux/net.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
-
-#ifndef net_ratelimited_function
-#define net_ratelimited_function(func, ...) \
- do { \
- if (net_ratelimit()) \
- func(__VA_ARGS__); \
- } while (0)
-#endif /* ifndef net_ratelimited_function */
-
-#endif /* < KERNEL_VERSION(3, 5, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_NET_H_ */
diff --git a/compat-include/linux/netdev_features.h b/compat-include/linux/netdev_features.h
deleted file mode 100644
index 27b4a398..00000000
--- a/compat-include/linux/netdev_features.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_NETDEV_FEATURES_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_NETDEV_FEATURES_H_
-
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-#include_next <linux/netdev_features.h>
-#endif /* >= KERNEL_VERSION(3, 3, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
-
-#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
-
-#endif /* < KERNEL_VERSION(3, 10, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_NETDEV_FEATURES_H_ */
diff --git a/compat-include/linux/netdevice.h b/compat-include/linux/netdevice.h
index 4e03f4f4..8f099cf4 100644
--- a/compat-include/linux/netdevice.h
+++ b/compat-include/linux/netdevice.h
@@ -25,31 +25,6 @@
#include <linux/version.h>
#include_next <linux/netdevice.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-
-#include <linux/netdev_features.h>
-
-#endif /* < KERNEL_VERSION(3, 3, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#define netdev_upper_dev_unlink(slave, master) netdev_set_master(slave, NULL)
-#define netdev_master_upper_dev_get(dev) \
-({\
- ASSERT_RTNL();\
- dev->master;\
-})
-
-#endif /* < KERNEL_VERSION(3, 9, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
-
-#define NETDEV_CHANGEUPPER 0x0015
-
-#define netdev_notifier_info_to_dev(ptr) ptr
-
-#endif /* < KERNEL_VERSION(3, 11, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
/* alloc_netdev() was defined differently before 2.6.38 */
@@ -65,12 +40,7 @@
#endif /* < KERNEL_VERSION(3, 19, 0) */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info, extack) \
- netdev_set_master(dev, upper_dev)
-
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info, extack) \
netdev_master_upper_dev_link(dev, upper_dev)
diff --git a/compat-include/linux/netlink.h b/compat-include/linux/netlink.h
index 3f77265b..eb42b2b6 100644
--- a/compat-include/linux/netlink.h
+++ b/compat-include/linux/netlink.h
@@ -25,24 +25,6 @@
#include <linux/version.h>
#include_next <linux/netlink.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-
-#include <net/scm.h>
-
-struct batadv_netlink_skb_parms {
- struct ucred creds; /* Skb credentials */
- union {
- __u32 portid;
- __u32 pid;
- };
- __u32 dst_group;
-};
-
-#undef NETLINK_CB
-#define NETLINK_CB(skb) (*(struct batadv_netlink_skb_parms *)&((skb)->cb))
-
-#endif /* < KERNEL_VERSION(3, 7, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
#include_next <net/netlink.h>
diff --git a/compat-include/linux/random.h b/compat-include/linux/random.h
deleted file mode 100644
index 04d44ebc..00000000
--- a/compat-include/linux/random.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_RANDOM_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_RANDOM_H_
-
-#include <linux/version.h>
-#include_next <linux/random.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#define prandom_u32() random32()
-
-#endif /* < KERNEL_VERSION(3, 9, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_RANDOM_H_ */
diff --git a/compat-include/linux/rculist.h b/compat-include/linux/rculist.h
deleted file mode 100644
index a8878060..00000000
--- a/compat-include/linux/rculist.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_RCULIST_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_RCULIST_H_
-
-#include <linux/version.h>
-#include_next <linux/rculist.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#undef hlist_for_each_entry_rcu
-#define hlist_for_each_entry_rcu(pos, head, member) \
- for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
- typeof(*(pos)), member); \
- pos; \
- pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
- &(pos)->member)), typeof(*(pos)), member))
-
-#endif
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_RCULIST_H_ */
diff --git a/compat-include/linux/skbuff.h b/compat-include/linux/skbuff.h
index 371bb561..36e4d10d 100644
--- a/compat-include/linux/skbuff.h
+++ b/compat-include/linux/skbuff.h
@@ -25,38 +25,6 @@
#include <linux/version.h>
#include_next <linux/skbuff.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
-
-/* hack for not correctly set mac_len. This may happen for some special
- * configurations like batman-adv on VLANs.
- *
- * This is pretty dirty, but we only use skb_share_check() in main.c right
- * before mac_len is checked, and the recomputation shouldn't hurt too much.
- */
-#define skb_share_check(skb, b) \
- ({ \
- struct sk_buff *_t_skb; \
- _t_skb = skb_share_check(skb, b); \
- if (_t_skb) \
- skb_reset_mac_len(_t_skb); \
- _t_skb; \
- })
-
-#endif /* < KERNEL_VERSION(3, 8, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
-
-/* older kernels still need to call skb_abort_seq_read() */
-#define skb_seq_read(consumed, data, st) \
- ({ \
- int __len = skb_seq_read(consumed, data, st); \
- if (__len == 0) \
- skb_abort_seq_read(st); \
- __len; \
- })
-
-#endif /* < KERNEL_VERSION(3, 11, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
#define pskb_copy_for_clone pskb_copy
diff --git a/compat-include/linux/slab.h b/compat-include/linux/slab.h
deleted file mode 100644
index e74f46ab..00000000
--- a/compat-include/linux/slab.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_SLAB_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_SLAB_H_
-
-#include <linux/version.h>
-#include_next <linux/slab.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
-
-#define kmalloc_array(n, size, flags) kmalloc(n * size, flags)
-
-#endif /* < KERNEL_VERSION(3, 4, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_SLAB_H_ */
diff --git a/compat-include/linux/timer.h b/compat-include/linux/timer.h
index 74b9b9b2..262c3861 100644
--- a/compat-include/linux/timer.h
+++ b/compat-include/linux/timer.h
@@ -25,17 +25,6 @@
#include <linux/version.h>
#include_next <linux/timer.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-
-#define __setup_timer(_timer, _fn, _data, _flags) \
- do { \
- init_timer(_timer); \
- (_timer)->function = (_fn); \
- (_timer)->data = (_data); \
- } while (0)
-
-#endif /* < KERNEL_VERSION(3, 7, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
#define TIMER_DATA_TYPE unsigned long
diff --git a/compat-include/net/genetlink.h b/compat-include/net/genetlink.h
deleted file mode 100644
index f638d86d..00000000
--- a/compat-include/net/genetlink.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_
-#define _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_
-
-#include <linux/version.h>
-#include_next <net/genetlink.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
-
-#include <linux/export.h>
-
-struct batadv_genl_family {
- /* data handled by the actual kernel */
- struct genl_family family;
-
- /* data which has to be copied to family by
- * batadv_genlmsg_multicast_netns
- */
- unsigned int id;
- unsigned int hdrsize;
- char name[GENL_NAMSIZ];
- unsigned int version;
- unsigned int maxattr;
- bool netnsok;
- bool parallel_ops;
- int (*pre_doit)(struct genl_ops *ops,
- struct sk_buff *skb,
- struct genl_info *info);
- void (*post_doit)(struct genl_ops *ops,
- struct sk_buff *skb,
- struct genl_info *info);
- /* WARNING not supported
- * int (*mcast_bind)(struct net *net, int group);
- * void (*mcast_unbind)(struct net *net, int group);
- */
- struct nlattr **attrbuf; /* private */
- struct genl_ops *ops; /* private */
- struct genl_multicast_group *mcgrps; /* private */
- unsigned int n_ops; /* private */
- unsigned int n_mcgrps; /* private */
- /* unsigned int mcgrp_offset; private, WARNING unsupported */
- struct list_head family_list; /* private */
- struct module *module;
-};
-
-#define genl_family batadv_genl_family
-
-#define genlmsg_multicast_netns batadv_genlmsg_multicast_netns
-
-static inline int
-batadv_genlmsg_multicast_netns(struct batadv_genl_family *family,
- struct net *net,
- struct sk_buff *skb,
- u32 portid, unsigned int group,
- gfp_t flags)
-{
- group = family->mcgrps[group].id;
- return nlmsg_multicast(
- net->genl_sock,
- skb, portid, group, flags);
-}
-
-#define genlmsg_put(_skb, _pid, _seq, _family, _flags, _cmd) \
- genlmsg_put(_skb, _pid, _seq, &(_family)->family, _flags, _cmd)
-
-#define genl_unregister_family(_family) \
- genl_unregister_family(&(_family)->family)
-
-static inline int batadv_genl_register_family(struct genl_family *family)
-{
- unsigned int i;
- int ret;
-
- family->family.id = family->id;
- family->family.hdrsize = family->hdrsize;
- strncpy(family->family.name, family->name, sizeof(family->family.name));
- family->family.version = family->version;
- family->family.maxattr = family->maxattr;
- family->family.netnsok = family->netnsok;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
- family->family.parallel_ops = family->parallel_ops;
-#endif
- family->family.pre_doit = family->pre_doit;
- family->family.post_doit = family->post_doit;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
- family->family.module = family->module;
-#endif
-
- ret = genl_register_family(&family->family);
- if (ret < 0)
- return ret;
-
- family->attrbuf = family->family.attrbuf;
- family->id = family->family.id;
-
- for (i = 0; i < family->n_ops; i++) {
- ret = genl_register_ops(&family->family, &family->ops[i]);
- if (ret < 0)
- goto err;
- }
-
- for (i = 0; i < family->n_mcgrps; i++) {
- ret = genl_register_mc_group(&family->family,
- &family->mcgrps[i]);
- if (ret)
- goto err;
- }
-
- return 0;
-
- err:
- genl_unregister_family(family);
- return ret;
-}
-
-#define genl_register_family(family) \
- batadv_genl_register_family((family))
-
-#define __genl_const
-
-#else
-
-#define __genl_const const
-
-#endif /* < KERNEL_VERSION(3, 13, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */
diff --git a/compat-include/net/ipv6.h b/compat-include/net/ipv6.h
deleted file mode 100644
index b27d0ce0..00000000
--- a/compat-include/net/ipv6.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_NET_IPV6_H_
-#define _NET_BATMAN_ADV_COMPAT_NET_IPV6_H_
-
-#include <linux/version.h>
-#include_next <net/ipv6.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-
-#define ipv6_skip_exthdr(skb, start, nexthdrp, frag_offp) \
- ({ \
- (void)frag_offp; \
- ipv6_skip_exthdr(skb, start, nexthdrp); \
- })
-
-#endif /* < KERNEL_VERSION(3, 3, 0) */
-
-#endif /* _NET_BATMAN_ADV_COMPAT_NET_IPV6_H_ */
diff --git a/compat-include/net/netlink.h b/compat-include/net/netlink.h
index d43576e2..c395dafb 100644
--- a/compat-include/net/netlink.h
+++ b/compat-include/net/netlink.h
@@ -25,17 +25,6 @@
#include <linux/version.h>
#include_next <net/netlink.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
-
-static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
-{
- __be32 tmp = value;
-
- return nla_put(skb, attrtype, sizeof(__be32), &tmp);
-}
-
-#endif /* < KERNEL_VERSION(3, 5, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
static inline int nla_put_in_addr(struct sk_buff *skb, int attrtype,
diff --git a/compat-include/uapi/linux/eventpoll.h b/compat-include/uapi/linux/eventpoll.h
index 331687ae..1828feb4 100644
--- a/compat-include/uapi/linux/eventpoll.h
+++ b/compat-include/uapi/linux/eventpoll.h
@@ -24,11 +24,7 @@
#include <linux/version.h>
#include <linux/types.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
#include_next <uapi/linux/eventpoll.h>
-#else
-#include <linux/eventpoll.h>
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
diff --git a/compat-include/uapi/linux/nl80211.h b/compat-include/uapi/linux/nl80211.h
index 724ab2a6..3e743249 100644
--- a/compat-include/uapi/linux/nl80211.h
+++ b/compat-include/uapi/linux/nl80211.h
@@ -23,11 +23,7 @@
#define _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_NL80211_H_
#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
#include_next <uapi/linux/nl80211.h>
-#else
-#include <linux/nl80211.h>
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
diff --git a/compat-patches/README b/compat-patches/README
deleted file mode 100644
index ceafb1da..00000000
--- a/compat-patches/README
+++ /dev/null
@@ -1,25 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-WARNING
-=======
-
-Please avoid using the compat-patches/ to implement support for old kernels.
-This should be the last resort.
-
- * it is nearly always possible to use compat-includes/ to do the same with a
- lot less problems
-
- * maintaining these patches is *censored*
-
-GENERATING A PATCH
-==================
-
-If it not possible to avoid a patch then please make the patch as small as
-possible. Even refactor the code which has to be patched to reduce the
-size/number of the changes.
-
-Please use git-format-patches to generate them and order same inside via the
-XXXX- prefix of the patch name.
-
- git format-patch --abbrev=7 -U3 --diff-algorithm=histogram --no-signature \
- --format=format:'From: %an <%ae>%nDate: %aD%nSubject: [PATCH] %B' -1
diff --git a/compat-patches/replacements.sh b/compat-patches/replacements.sh
deleted file mode 100755
index 1f43c0da..00000000
--- a/compat-patches/replacements.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0
-# Copyright (C) 2007-2018 B.A.T.M.A.N. contributors:
-#
-# Marek Lindner, Simon Wunderlich
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of version 2 of the GNU General Public
-# License as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-# for kernel < 3.13 to make netlink compat code work
-sed -i \
- -e 's/^static const struct genl_multicast_group batadv_netlink_mcgrps/static __genl_const struct genl_multicast_group batadv_netlink_mcgrps/' \
- -e 's/^static const struct genl_ops batadv_netlink_ops/static __genl_const struct genl_ops batadv_netlink_ops/' \
- build/net/batman-adv/netlink.c
diff --git a/compat-sources/Makefile b/compat-sources/Makefile
index 9f3f5d4b..7aabaac6 100644
--- a/compat-sources/Makefile
+++ b/compat-sources/Makefile
@@ -15,6 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../../compat-sources/net/core/skbuff.o
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../../compat-sources/net/ipv4/igmp.o
-batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../../compat-sources/net/ipv6/mcast_snoop.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../compat-sources/net/core/skbuff.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../compat-sources/net/ipv4/igmp.o
+batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += ../../compat-sources/net/ipv6/mcast_snoop.o
diff --git a/compat.h b/compat.h
index 34f6de9f..385b629c 100644
--- a/compat.h
+++ b/compat.h
@@ -35,104 +35,6 @@
#error CONFIG_BATMAN_ADV_DEBUG=y requires CONFIG_BATMAN_ADV_DEBUGFS=y
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#include <linux/netdevice.h>
-
-#define netdev_master_upper_dev_get_rcu(dev) \
- (dev->priv_flags & IFF_BRIDGE_PORT ? dev : NULL); \
- break;
-
-#endif /* < KERNEL_VERSION(3, 9, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-
-#define batadv_interface_add_vid(x, y, z) \
-__batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid);\
-static void batadv_interface_add_vid(struct net_device *dev, unsigned short vid)\
-{\
- __batadv_interface_add_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid)
-
-#define batadv_interface_kill_vid(x, y, z) \
-__batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid);\
-static void batadv_interface_kill_vid(struct net_device *dev,\
- unsigned short vid)\
-{\
- __batadv_interface_kill_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid)
-
-#endif /* < KERNEL_VERSION(3, 3, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-
-#define snd_portid snd_pid
-
-#endif /* < KERNEL_VERSION(3, 7, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
-
-#define batadv_interface_set_mac_addr(x, y) \
-__batadv_interface_set_mac_addr(struct net_device *dev, void *p);\
-static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) \
-{\
- int ret;\
-\
- ret = __batadv_interface_set_mac_addr(dev, p);\
- if (!ret) \
- dev->addr_assign_type &= ~NET_ADDR_RANDOM;\
- return ret;\
-}\
-static int __batadv_interface_set_mac_addr(x, y)
-
-#define batadv_interface_tx(x, y) \
-__batadv_interface_tx(struct sk_buff *skb, struct net_device *soft_iface); \
-static int batadv_interface_tx(struct sk_buff *skb, \
- struct net_device *soft_iface) \
-{ \
- skb_reset_mac_header(skb); \
- return __batadv_interface_tx(skb, soft_iface); \
-} \
-static int __batadv_interface_tx(struct sk_buff *skb, \
- struct net_device *soft_iface)
-
-#endif /* < KERNEL_VERSION(3, 9, 0) */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-
-#define batadv_interface_add_vid(x, y, z) \
-__batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid);\
-static int batadv_interface_add_vid(struct net_device *dev, unsigned short vid)\
-{\
- return __batadv_interface_add_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_add_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid)
-
-#define batadv_interface_kill_vid(x, y, z) \
-__batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid);\
-static int batadv_interface_kill_vid(struct net_device *dev,\
- unsigned short vid)\
-{\
- return __batadv_interface_kill_vid(dev, htons(ETH_P_8021Q), vid);\
-}\
-static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
- unsigned short vid)
-
-#endif /* >= KERNEL_VERSION(3, 3, 0) */
-
-#endif /* < KERNEL_VERSION(3, 10, 0) */
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
/* wild hack for batadv_getlink_net only */
--
2.17.0