about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/trelay/default.nix
blob: 48148a0b1a0da84d82f3775616981c6a01f2effb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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";
  };
}