Add loongarch64 support by Dandan336 · Pull Request #1339 · evilsocket/opensnitch (original) (raw)

Dear maintainers,

Compiling the opensnitch failed for loong64 in the Debian Package Auto-Building environment.
Details can be found at https://buildd.debian.org/status/fetch.php?pkg=opensnitch&arch=loong64&ver=1.6.8-11&stamp=1745911996&raw=0.

Applied patch from https://github.com/evilsocket/opensnitch/blob/master/ebpf_prog/Makefile#L25, the compilation continues with the following new error,

opensnitch.c:138:38: error: Must specify a BPF target arch via __TARGET_ARCH_xxx
  138 |     struct sock *sk = (struct sock *)PT_REGS_PARM1(ctx);
      |                                      ^
./bpf_headers/bpf_tracing.h:335:29: note: expanded from macro 'PT_REGS_PARM1'
  335 | #define PT_REGS_PARM1(x) ({ _Pragma(__BPF_TARGET_MISSING); 0l; })
      |                             ^
<scratch space>:93:6: note: expanded from here
   93 |  GCC error "Must specify a BPF target arch via __TARGET_ARCH_xxx"
      |      ^
......

Based on this commit, I have built opensnitch successfully on locally.

   dh_builddeb -O--builddirectory=_build -O--buildsystem=golang
    dpkg-deb --root-owner-group --build debian/opensnitch ..
    dpkg-deb --root-owner-group --build debian/.debhelper/opensnitch/dbgsym-root ..
    dpkg-deb --root-owner-group --build debian/python3-opensnitch-ui ..
    dpkg-deb --root-owner-group --build debian/opensnitch-ebpf-modules ..
dpkg-deb: building package 'opensnitch-dbgsym' in '../opensnitch-dbgsym_1.6.8-11+loong64_loong64.deb'.
dpkg-deb: building package 'opensnitch' in '../opensnitch_1.6.8-11+loong64_loong64.deb'.
dpkg-deb: building package 'python3-opensnitch-ui' in '../python3-opensnitch-ui_1.6.8-11+loong64_all.deb'.
dpkg-deb: building package 'opensnitch-ebpf-modules' in '../opensnitch-ebpf-modules_1.6.8-11+loong64_loong64.deb'.
 dpkg-genbuildinfo -O../opensnitch_1.6.8-11+loong64_loong64.buildinfo
 dpkg-genchanges -O../opensnitch_1.6.8-11+loong64_loong64.changes

Please review.