diff --git a/pkgs/os-specific/linux/trelay/Makefile b/pkgs/os-specific/linux/trelay/Makefile new file mode 100644 index 000000000000..3206728dfbf7 --- /dev/null +++ b/pkgs/os-specific/linux/trelay/Makefile @@ -0,0 +1,14 @@ +KERNELRELEASE ?= $(shell uname -r) +KERNEL_DIR ?= /lib/modules/$(KERNELRELEASE)/build +PWD := $(shell pwd) + +obj-m := trelay.o + +all: + $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules + +install: + $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install + +clean: + $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean diff --git a/pkgs/os-specific/linux/trelay/default.nix b/pkgs/os-specific/linux/trelay/default.nix new file mode 100644 index 000000000000..48148a0b1a0d --- /dev/null +++ b/pkgs/os-specific/linux/trelay/default.nix @@ -0,0 +1,46 @@ +{ stdenv, lib, fetchgit, kernel, kmod }: +let + version = "22.03.5"; +in +stdenv.mkDerivation { + pname = "trelay"; + version = "${version}-${kernel.version}"; + + src = fetchgit { + url = "https://git.openwrt.org/openwrt/openwrt.git"; + rev = "v${version}"; + hash = "sha256-5f9LvaZUxtfTpTR268QMkEmHUpn/nct+MVa44SBGT5c="; + sparseCheckout = [ "package/kernel/trelay/src" ]; + }; + + sourceRoot = "openwrt/package/kernel/trelay/src"; + hardeningDisable = [ "pic" "format" ]; + nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies; + + postPatch = '' + cp '${./Makefile}' Makefile + ''; + + makeFlags = kernel.makeFlags ++ [ + "KERNELRELEASE=${kernel.modDirVersion}" + "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALL_MOD_PATH=$(out)" + ]; + + meta = with lib; { + description = "For relaying IP packets between two devices to build a IP bridge between them"; + longDescription = '' + A kernel module that relays ethernet packets between two devices (similar to a bridge), + but without any MAC address checks. + + This makes it possible to bridge client mode or ad-hoc mode wifi devices to ethernet VLANs, + assuming the remote end uses the same source MAC address as the device that packets are + supposed to exit from. + ''; + homepage = "https://github.com/openwrt/openwrt/tree/main/package/kernel/trelay"; + license = licenses.gpl2Plus; + maintainers = [ maintainers.aprl ]; + platforms = platforms.linux; + broken = lib.versionOlder kernel.version "5.10"; + }; +} diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 72840c945e15..d0710f6ef363 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -505,6 +505,8 @@ in { turbostat = callPackage ../os-specific/linux/turbostat { }; + trelay = callPackage ../os-specific/linux/trelay { }; + usbip = callPackage ../os-specific/linux/usbip { }; v86d = callPackage ../os-specific/linux/v86d { };