patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 75b1d6632e367f655aa52eba1d404b2d2af46cc5 1123 bytes (raw)
name: vm/sys/net/xdp-forwarder/default.nix 	 # note: path name is non-authoritative(*)

 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
 
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>

{ lib, runCommand, stdenv, llvmPackages, libbpf, linux, bpftools }:

stdenv.mkDerivation {
  pname = "xdp-forwarder";
  version = "0";

  src = lib.fileset.toSource {
    root = ./.;
    fileset = lib.fileset.fileFilter
      ({ hasExt, ... }: !(hasExt "nix") && !(hasExt "md")) ./.;
  };

  buildInputs = [ libbpf ];
  nativeBuildInputs = [ llvmPackages.clang-unwrapped bpftools ];

  buildPhase = ''
    bpftool btf dump file ${linux.dev}/vmlinux format c > include/vmlinux.h
    for prog in physical router; do
      clang $NIX_CFLAGS_COMPILE -O2 -g -Wall -target bpf -I include -c prog_$prog.c -o prog_$prog.o
      substituteInPlace load_$prog --replace-fail prog_$prog.o $out/lib/prog_$prog.o
    done
    $CC -lbpf -I include -o set_router_iface set_router_iface.c
  '';

  installPhase = ''
    for prog in physical router; do
      install -Dm644 prog_$prog.o $out/lib/prog_$prog.o
      install -Dm755 load_$prog $out/bin/load_$prog
    done
    install -Dm755 set_router_iface $out/bin/set_router_iface
  '';
}

debug log:

solving 75b1d66 ...
found 75b1d66 in https://inbox.spectrum-os.org/spectrum-devel/20250823222134.1772413-2-yureka@cyberchaos.dev/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20250823222134.1772413-2-yureka@cyberchaos.dev/
diff --git a/vm/sys/net/xdp-forwarder/default.nix b/vm/sys/net/xdp-forwarder/default.nix
new file mode 100644
index 0000000..75b1d66

Checking patch vm/sys/net/xdp-forwarder/default.nix...
Applied patch vm/sys/net/xdp-forwarder/default.nix cleanly.

index at:
100644 75b1d6632e367f655aa52eba1d404b2d2af46cc5	vm/sys/net/xdp-forwarder/default.nix

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).