From: Sven Eckelmann Date: Thu, 21 Jan 2016 15:04:20 +0000 (+0100) Subject: batman-adv: Use the mac80211 compat layer X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=758d919870103d6fec6d0be29b0436e41f004257;p=feed%2Frouting.git batman-adv: Use the mac80211 compat layer BATMAN_V (in the upcoming release) will use structures from the mac80211 package. These structures can be incompatible to the structures defined in the header of the kernel. This can lead to weird problems like stack overflows or memory corruptions. To avoid this, the batman-adv has to be compiled against the mac80211 headers instead of the kernel headers. But this requires that the compatibility headers of compat-wireless are used. So the batman-adv compatibility layer has (mostly) be removed and instead the compat-wireless/mac80211 compat layer has to be used. Signed-off-by: Sven Eckelmann --- diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 1eb6bbe..6e24d4d 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -27,7 +27,7 @@ define KernelPackage/batman-adv URL:=https://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c + DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +kmod-cfg80211 TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) @@ -47,20 +47,36 @@ define Package/kmod-batman-adv/conffiles /etc/config/batman-adv endef -MAKE_BATMAN_ADV_ARGS += \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - KERNELPATH="$(LINUX_DIR)" \ - ARCH="$(LINUX_KARCH)" \ - PATH="$(TARGET_PATH)" \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - PWD="$(PKG_BUILD_DIR)" \ - LINUX_VERSION="$(LINUX_VERSION)" \ +PKG_EXTRA_KCONFIG:= \ + CONFIG_BATMAN_ADV=m \ CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \ CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \ CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \ CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),y,n) \ CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \ - REVISION="" all + +PKG_EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \ + +NOSTDINC_FLAGS = \ + -I$(PKG_BUILD_DIR)/net/batman-adv \ + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211 \ + -include backport/backport.h + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)/net/batman-adv" \ + $(PKG_EXTRA_KCONFIG) \ + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \ + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ + modules +endef define Build/Prepare $(call Build/Prepare/Default) @@ -68,10 +84,6 @@ define Build/Prepare $(PKG_BUILD_DIR)/net/batman-adv/main.h endef -define Build/Compile - $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS) -endef - define Build/Clean rm -rf $(BUILD_DIR)/$(PKG_NAME)/ endef diff --git a/batman-adv/patches/0000-compat-hacks.patch b/batman-adv/patches/0000-compat-hacks.patch new file mode 100644 index 0000000..78bdc51 --- /dev/null +++ b/batman-adv/patches/0000-compat-hacks.patch @@ -0,0 +1,46 @@ +diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c +index 730cfa8..39e5694 100644 +--- a/net/batman-adv/hard-interface.c ++++ b/net/batman-adv/hard-interface.c +@@ -47,6 +47,24 @@ + #include "sysfs.h" + #include "translation-table.h" + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) ++ ++#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) ++ ++#endif /* < KERNEL_VERSION(4, 1, 0) */ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) ++ ++#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \ ++ netdev_set_master(dev, upper_dev) ++ ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) ++ ++#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \ ++ netdev_master_upper_dev_link(dev, upper_dev) ++ ++#endif /* < KERNEL_VERSION(4, 5, 0) */ ++ + /** + * batadv_hardif_release - release hard interface from lists and queue for + * free after rcu grace period +diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c +index 6c65de9..06d0330 100644 +--- a/net/batman-adv/soft-interface.c ++++ b/net/batman-adv/soft-interface.c +@@ -60,6 +60,12 @@ + #include "sysfs.h" + #include "translation-table.h" + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) ++ ++#define IFF_NO_QUEUE 0; dev->tx_queue_len = 0 ++ ++#endif /* < KERNEL_VERSION(4, 3, 0) */ ++ + static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); + static void batadv_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info);