From 99ea9da785eaf17a85aa74a249b9727e45c5da4a Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 7 Jun 2022 07:19:53 +0200 Subject: [PATCH] ipq807x: add kmod-wireguard backport package Fixes: WIFI-7571 Signed-off-by: John Crispin --- feeds/ipq807x/wireguard/Makefile | 55 +++++++++++++++++++ .../wireguard/patches/100-compat.patch | 29 ++++++++++ feeds/ucentral/unetd/Makefile | 2 +- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 feeds/ipq807x/wireguard/Makefile create mode 100644 feeds/ipq807x/wireguard/patches/100-compat.patch diff --git a/feeds/ipq807x/wireguard/Makefile b/feeds/ipq807x/wireguard/Makefile new file mode 100644 index 000000000..3bca352d1 --- /dev/null +++ b/feeds/ipq807x/wireguard/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2016-2019 Jason A. Donenfeld +# Copyright (C) 2016 Baptiste Jonglez +# Copyright (C) 2016-2017 Dan Luedtke +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=wireguard-backport + +PKG_VERSION:=1.0.20211208 +PKG_RELEASE:=1 + +PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/ +PKG_HASH:=c0e607138a17daac656f508d8e63ea3737b5221fa5d9288191ddeb099f5a3b92 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/wireguard-linux-compat-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +# WireGuard's makefile needs this to know where to build the kernel module +export KERNELDIR:=$(LINUX_DIR) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel-defaults.mk +include $(INCLUDE_DIR)/package-defaults.mk + +define Build/Compile + $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules +endef + +define KernelPackage/wireguard-backport + SECTION:=kernel + CATEGORY:=Kernel modules + SUBMENU:=Network Support + TITLE:=WireGuard kernel module + DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4 + FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoProbe,wireguard) +endef + +define KernelPackage/wireguard-backport/description + $(call Package/wireguard/Default/description) + + This package provides the kernel module for WireGuard. +endef + +$(eval $(call KernelPackage,wireguard-backport)) diff --git a/feeds/ipq807x/wireguard/patches/100-compat.patch b/feeds/ipq807x/wireguard/patches/100-compat.patch new file mode 100644 index 000000000..299eab27e --- /dev/null +++ b/feeds/ipq807x/wireguard/patches/100-compat.patch @@ -0,0 +1,29 @@ +Index: wireguard-linux-compat-1.0.20211208/src/compat/compat.h +=================================================================== +--- wireguard-linux-compat-1.0.20211208.orig/src/compat/compat.h ++++ wireguard-linux-compat-1.0.20211208/src/compat/compat.h +@@ -11,6 +11,8 @@ + #include + #include + ++#define fallthrough ++ + #ifdef RHEL_MAJOR + #if RHEL_MAJOR == 7 + #define ISRHEL7 +@@ -686,15 +688,6 @@ struct __compat_dummy_container { char d + #define genl_dump_check_consistent(a, b) genl_dump_check_consistent(a, b, &genl_family) + #endif + +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && !defined(ISRHEL7) +-static inline void *skb_put_data(struct sk_buff *skb, const void *data, unsigned int len) +-{ +- void *tmp = skb_put(skb, len); +- memcpy(tmp, data, len); +- return tmp; +-} +-#endif +- + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) && !defined(ISRHEL7) + #define napi_complete_done(n, work_done) napi_complete(n) + #endif diff --git a/feeds/ucentral/unetd/Makefile b/feeds/ucentral/unetd/Makefile index 167dc1e72..20b9177d0 100644 --- a/feeds/ucentral/unetd/Makefile +++ b/feeds/ucentral/unetd/Makefile @@ -26,7 +26,7 @@ define Package/unetd SECTION:=utils CATEGORY:=Base system TITLE:=Wireguard network configuration service - DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +kmod-wireguard + DEPENDS:=+libubox +libubus +libblobmsg-json +libnl-tiny +TARGET_ipq807x:kmod-wireguard-backport +!TARGET_ipq807x:kmod-wireguard endef TARGET_CFLAGS += \