Commit Graph

9856 Commits

Author SHA1 Message Date
Vincent Li
e0353f023c yt6801: 6.15-rc1 kernel build error
CC [M]  fuxi-efuse.o
fuxi-gmac-phy.c: In function 'fxgmac_phy_timer_destroy':
fuxi-gmac-phy.c:493:5: error: implicit declaration of function
'del_timer_sync'; did you mean 'dev_mc_sync'?
[-Wimplicit-function-declaration]
  493 |     del_timer_sync(&pdata->expansion.phy_poll_tm);
      |     ^~~~~~~~~~~~~~
      |     dev_mc_sync
make[4]: *** [/lib/modules/6.15.0-rc1-ipfire/build/scripts/Makefile.build:203:
fuxi-gmac-phy.o] Error 1

replace del_timer_sync with timer_delete_sync

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-21 14:13:43 -07:00
Vincent Li
10df80a921 suricata: downgrade suricata to 6.0.20
suricata 7.0.7 af-packet(XDP) IPS mode
cause slow Internet access, 6.0.20 does
not have this issue.
see https://github.com/vincentmli/BPFire/issues/81

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-21 14:13:43 -07:00
Vincent Li
387bd0c744 Revert "Revert "linux: upgrade kernel to 6.15-rc1""
This reverts commit cb5313ec87.
2025-04-21 14:13:43 -07:00
Vincent Li
dd845dd9a2 suricata: legacy eBPF map to BTF map backport
legacy eBPF map is deprecated by installed libbpf,
backport the https://github.com/OISF/suricata/pull/9969
to suricata 7.0.7.

add suricata sample XDP configuration in IPS mode

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-21 14:13:43 -07:00
Vincent Li
f27e7b914c suricata: enable eBPF build
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-21 14:13:31 -07:00
Vincent Li
04f60a6291 firewall: replace echo initial optionsfw settings
use echo initial optionsfw settings seems creating
duplicated optionsfw settings.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
6eef7f8535 firewall: add firewall bridge mode
add firewall bridge mode so it can be used as
layer 2 inline bridge for either DDoS protection
or firewall filter by iptable rules configured in
netfilter filter table forward chain.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
cb5313ec87 Revert "linux: upgrade kernel to 6.15-rc1"
This reverts commit 284c7c99881b7cbec8cbd462f667789d8d726057.

yt6801 NIC driver fail to compile with 6.15-rc1, revert the
change till yt6801 driver code is updated.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
4496092bb8 linux: upgrade kernel to 6.15-rc1
6.15-rc1 officially included LoongArch BPF JIT fix

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
967a0319b4 syslog: log kernel message to kern.log
note config/etc/* is copied through lfs/stage2
so changes made in config/etc/* requires to
rm stage2 build log to rebuild stage2.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-01 17:42:01 -07:00
Vincent Li
245634dacd initscripts: add TCP DDoS XDP program init script
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-01 13:38:09 -07:00
Vincent Li
6aaec8d485 xdp-tools: Add xdp-ddos XDP main program
add xdp_ddos XDP main program with bpf tail
call table and user space xdp-ddos program
to load and insert protocol DDoS program like
TCP or UDP or ICMP into bpf tail call table.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-01 13:38:09 -07:00
Vincent Li
88c90aadcd ddos: add ddos init script
add ddos init to load/attach XDP DDoS main
program with empty tail call table as place
holder for tcp, udp, icmp...etc XDP DDoS program

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-01 13:38:02 -07:00
Vincent Li
0f9937c78f xdp-tools: Add XDP synproxy tailcall program
LoongArch does not support bpf trampoline, so
use tail call to call XDP synproxy program

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-03-25 19:41:42 -07:00
Vincent Li
bb3d53e660 loxilb: upgrade to loxilb 0.9.8.3
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-03-25 19:41:42 -07:00
Vincent Li
6d2033cf2f linux: fix loongarch bpf jit
apply two loongarch bpf jit fixes [0] [1] by Hengqi Chen

[0]: https://lore.kernel.org/loongarch/20250315080320.4193821-1-hengqi.chen@gmail.com/
[1]: https://lore.kernel.org/loongarch/20250317015755.2760716-1-hengqi.chen@gmail.com/

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-03-25 19:41:35 -07:00
Vincent Li
a19a0bf167 linux: upgrade kernel to current upstream 6.14 rc5
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-03-08 18:35:58 -08:00
Vincent Li
1e8868a1af loxilb: upgrade loxilb to upstream main branch
loxilb upstream main branch fixed issue for
kernel 6.12. test loxilb for loongfire

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-02-13 08:17:00 -08:00
Vincent Li
04a4907087 loxicmd: add loxicmd for loongarch64
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-29 08:36:00 -08:00
Vincent Li
beb7cdabf7 loxilb: add loxilb 0.9.8 addon for loongarch64
loxilb ebpf program relies on libbpf 0.8
which does not have loongarch64 support.
backported libbpf 1.2.3 loongarch support
to libbpf 0.8

loxilb 0.9.8 now load ebpf program through
libbpf, no external ntc command required, so
remove ntc

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-28 19:09:10 -08:00
Vincent Li
8d178105b1 go: add go for loongarch64
add go in build for packages depending on go

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-13 18:27:35 -08:00
Vincent Li
43dd019fb3 xdp-tools: fix XDP dns log stack smashing error
commit f938e63dc6b2cd8a271bb4aa58d8371f4a9fa94c
Author: Vincent Li <vincent.mc.li@gmail.com>
Date:   Sat Jan 11 10:55:23 2025 -0800

    xdp-dns: fix XDP dns log stack smashing error

    gdb --args xdp_dns_log /sys/fs/bpf/xdp-tailcall/dns_ringbuf

    result in backtrace:

    (gdb) bt
     0x00007ffff7d5fa80 in ?? () from /lib64/libc.so.6
     0x00007ffff7d0be1c in raise () from /lib64/libc.so.6
     0x00007ffff7cf49fc in abort () from /lib64/libc.so.6
     0x00007ffff7d50ff0 in ?? () from /lib64/libc.so.6
     0x00007ffff7de32d4 in __fortify_fail () from /lib64/libc.so.6
     0x00007ffff7de42b0 in __stack_chk_fail () from /lib64/libc.so.6
     0x000000012000f248 in handle_event ()
     0x00007ffff7eca0fc in ?? () from /usr/lib64/libbpf.so.1
     0x00007ffff7eca8c8 in ring_buffer.poll () from /usr/lib64/libbpf.so.1
     0x000000012000372c in main ()

    Paste the gdb backtrace in ChatGPT and ChatGPT suggested the fix

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-11 11:06:15 -08:00
Vincent Li
8c30bad8f8 xdp-tailcall: add xdp-tailcall init script
xdp-tailcall init script to start/stop XDP
tail call program DNS and TLS SNI on green0
interface

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-10 10:56:15 -08:00
Vincent Li
dec6a99c77 xdp-tools: add xdp-tailcall
Loongarch64 does not support bpf trampoline
and freplace, so we can't use libxdp to attach
multiple XDP program to same network interface.

Loongarch64 supports bpf tail call, so we can still
use xdp-loader to load XDP program, and use bpf tail
call to call each XDP program. now we can tail call
DNS and TLS SNI XDP program on green0 interface

change user space program to take bpf map path as
command line argument so X86 and Loongarch64 can share
same user space program

https://github.com/vincentmli/xdp-tools

commit d18f8a7b48094c861a8ee0d5c0d52e93a01edca4
Author: Vincent Li <vincent.mc.li@gmail.com>
Date:   Tue Jan 7 22:14:40 2025 -0800

    xdp-tools: add bpf map path as cmd line argument

    add XDP DNS and TLS SNI user space program command
    line argument for bpf map so X86 and Loongarch can
    share the same XDP user space program

commit 5d713b40dd2d0ce399f618179a2add6c07882e2a
Author: Vincent Li <vincent.mc.li@gmail.com>
Date:   Mon Jan 6 21:09:25 2025 -0800

    xdp-tailcall: add DNS XDP program

    add DNS XDP program as tail called program

commit ad2a4e600140f8bf7a577470566efcdf11f6e214
Author: Vincent Li <vincent.mc.li@gmail.com>
Date:   Mon Jan 6 20:36:43 2025 -0800

    xdp-tailcall: add XDP tailcall

    Loongarch64 does not support bpf trampoline and
    freplace, so use tail call to call XDP program.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-07 15:41:25 -08:00
Vincent Li
bda777582c strace: fix compile error
after moving strace to core package and
recompile strace, it errors out with:

macros.h:141:9: error: static assertion failed:

"Unexpected size of sysoff.rsv (sizeof(unsigned int) * 3 expected).
  --enabled-bundled=yes configure option may be used to work around that."

fix the error as the error log message suggested

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-25 12:43:37 -08:00
Vincent Li
bbc206cb5f flash-imgages: only double the root size
only double the root size, so dd from
usb to hard drive takes less time and
size.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-24 16:05:15 -08:00
Vincent Li
fab6187016 Revert "flash-images: add serial console linux command"
the serial change affect installing IPFire on
real Loongson hardware where no output from
the screen.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-24 16:01:47 -08:00
Vincent Li
cf5df05796 flash-images: add serial console linux command
Add the missing serial linux command so the
flash image can be converted to qcow2, the
bpfire qcow2 image can be deployed in KVM
virtual environment through serial console
installation.

for exmaple:

virsh define BPFire-VM.xml
virsh start BPFire-VM
virsh console BPFire-VM

we will have serial console access to BPFire
VM and the installation will start.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-22 17:46:39 -08:00
Vincent Li
4f473b785a flash-images: mount bpffs for XDP program
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-22 17:45:04 -08:00
Vincent Li
bc2ac2db5b yt6801: remove xz compression of driver
no need to compress since other drivers are
not compressed.

had one instance that when system boots up
from the flash image USB drive, and when
setup the network, the driver is not loaded.
it is caused when kernel is rebuilt, yt6801
also need to be rebuilt, but linux-initrd
initramfs is not rebuilt which actually
runs the module dependencies, so linux-initrd
also need to rebuilt together.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-22 11:40:38 -08:00
Vincent Li
cfefb2a884 xdp-tools: add xdp-tools
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-22 11:28:31 -08:00
Vincent Li
d88bdd74b3 perf: add linux perf tool
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-21 18:00:47 -08:00
Vincent Li
51ff36eb32 bpftool: add bpftool
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-21 17:57:09 -08:00
Vincent Li
708556b443 libbpf: add libbpf
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-21 17:56:33 -08:00
Vincent Li
379faf9f47 suricata: enable compile and install suricata
add rust back and enable compile and install suricata

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-21 15:50:47 -08:00
Vincent Li
5d628cf3bf flash-images: increase disk space
build error when create flash image, increase the size

tar: var/lib/location/ipset: Cannot mkdir: No space left on device

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-21 15:38:41 -08:00
Vincent Li
1c3c9da5cf llvm-project: add llvm/clang to compile BPF program
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-21 10:20:12 -08:00
Vincent Li
2e5f7966ac yt6801: add yt6801 driver for loongson NUC
yt6801 ethernet driver is out of kernel tree
add lfs/yt6801 to build yt6801 driver

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-20 14:05:08 -08:00
Vincent Li
e3dff6fb65 kernel: enable BPF/BTF config
rebase the kernel config from fedora loongarch kernel
6.12, and enable kernel BTF/BPF feature config

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-20 09:07:23 -08:00
Vincent Li
ae6af66e21 pahole: add pahole for kernel BTF generation
CONFIG_DEBUG_INFO_BTF=y requires pahole installed

steps to prepare pahole:

git clone --recurse-submodules  https://kernel.googlesource.com/pub/scm/devel/pahole/pahole.git
cd pahole
git checkout -b v1.28 v1.28
cd ..
mv pahole pahole-1.28
tar czvf pahole-1.28.tar.gz pahole-1.28
b2sum pahole-1.28.tar.gz

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-20 08:06:59 -08:00
Vincent Li
5a8bacb23d linux: upgrade kernel to 6.12.5
upgrade kernel to 6.12.5 with Loongson ethernet
controller driver support.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-19 11:54:06 -08:00
Vincent Li
23ae73dde4 loongarch64: major changes for flash image and iso
Initial list of changes required to build iso
and flash image successfully:

1 softwares require config.guess and config.stub
  update with loongarch support

2 no rust build and no suricata which depends on rust

3 comment out python 3.10 lib-dynload and config-3.10-xxxMACHINExxx-linux-gnu

4 lfs/cdrom lfs/Config loongarch seems requiring capital EFI boot image name
  to boot properly

5 comment out a few softwares that are not needed for now

iso can be installed to loongarch PC hard drive, but
fail to boot.

flash image can be dd to USB drive, then boot loongarch
PC from USB drive, then dd from USB drive to loongarch
PC hard drive

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-19 11:42:59 -08:00
Vincent Li
30339c14a1 toolchain: fix gcc custom linker path
Loongarch64 requires gcc/config/loongarch/gnu-user.h
change for custom linker path when compiling gcc
tool chain

fix: https://github.com/vincentmli/BPFire/issues/67

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-17 12:45:57 -08:00
Vincent Li
a0eed98b22 Add linker path to toolchain build
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-16 18:46:13 -08:00
Vincent Li
8a0ca16bae Loongarch64: initial change for tool chain build
1. add loongarch64 in make.sh

2. updated many source tar balls with config.guss
   and config.sub with loongarch64 support

3. remove rust and surricata for now

4. workaround binary env dynamic linker missing
   by symbolic link tools_loongarch64/lib to lib64
   when ./make.sh build

   cd build_loongarch64; ln -s tools_loongarch64/lib lib64

./make.sh toolchain to build tool chain
./make clean to start fresh
./make.sh gettoolchain to extract tool chaina from cache
./make.sh build to build software and image

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-12-15 09:09:28 -08:00
Michael Tremer
0d774f0db5 flash-image: Create a journal when the filesystem is being created
We recently started to have problems when a new installation was
launched from the flash image that creating the journal corrupted the
filesystem on the next mount operation.

Since we would like all IPFire installations to have a journal, we
create this now when we create the image and won't try to add it later.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-12-14 12:06:43 +00:00
Michael Tremer
f2fce26932 Config: Don't interpret file names as regular expressions
When we are searching for changes in rootfiles, we walk through each
file that we have found in the build and check if it exists in the
rootfile. That check interpreted filenames as regular expressions which
caused a problem in the case of "/usr/bin/[".

This patch changes that grep will only search for an exact string match
(-F) and the string must be the entire line (-x).

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-12-14 12:06:30 +00:00
Stefan Schantl
1a4d5cfd92 openssh: Introduce include directory for additional sshd config files
This patch adds the prosibility to place additional *.config files in /etc/ssh/sshd_config.d/
which will be included and loaded during the daemon startup process.

Because this files will not be overwritten by any update, they can be used to place custom
or other persistent settings.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-12-13 14:36:51 +00:00
Adolf Belka
38067c08c7 suricata: Update to version 7.0.8
- Update from version 7.0.7 to 7.0.8
- Update of rootfile not required
- Changelog
    7.0.8
	Security #7412: tcp: generic detection bypass using TCP urgent support (7.0.x
	 backport)(HIGH - CVE 2024-55629)
	Security #7405: dns: quadratic complexity in logging and invalid json as output
	 (7.0.x backport)(HIGH - CVE 2024-55628)
	Security #7404: tcp: segfault on StreamingBufferSlideToOffsetWithRegions (7.0.x
	 backport)(CRITICAL - CVE 2024-55627)
	Security #7367: bpf: oversized bpf file can lead to buffer overflow (7.0.x
	 backport)(LOW - CVE 2024-55626)
	Security #7306: detect: write to read-only memory in transforms (7.0.x backport)
	 (CRITICAL - CVE 2024-55605)
	Bug #7445: dpdk: RSS key length missmatch on ice (E810) card with DPDK version
	 22.11.6  (7.0.x backport)
	Bug #7434: requires: rules with unmet requirements are still loaded (7.0.x
	 backport)
	Bug #7432: detect: decoder event rules fail to match on invalid packets (7.0.x
	 backport)
	Bug #7407: detect: missing app-layer metadata in alerts (7.0.x backport)
	Bug #7368: flow: flow timeout pseudo packet triggers unexpected alert (7.0.x
	 backport)
	Bug #7362: rules: unknown internal events not being detected as errors (7.0.x
	 backport)
	Bug #7339: rust: different int types turn garbage on FFI boundary (7.0.x backport)
	Bug #7335: asan/profiling: global-buffer-overflow error (7.0.x backport)
	Bug #7327: http: FN with prefilter if the first of multi buffer did not match
	 (7.0.x backport)
	Bug #7324: mqtt: wrong and missing direction for keywords (7.0.x backport)
	Bug #7310: http: incorrect file direction handling (7.0.x backport)
	Bug #7308: conf: memleak if yaml parser is initialized before checking if file
	 exists (7.0.x backport)
	Bug #7307: detect: memleak in case of errors during initialization (7.0.x
	 backport)
	Bug #7301: output: oversized records lead to invalid json (7.0.x backport)
	Bug #7295: detect: sip.stat_code keyword uses wrong buffer name
	Bug #7294: conf: nullptr dereference if mem alloc fails for a node in yaml
	 parser (7.0.x backport)
	Optimization #7316: template: remove usage of template-rust (7.0.x backport)
	Optimization #7275: tcp/reassemble: GetBlock takes O(nlgn) in worst case (7.0.x
	 backport)
	Feature #7439: eve/alert: enrich decoder event rules (7.0.x backport)
	Task #7427:  flowint: add isnotset support (7.0.x backport)
	Task #7288: schema: add missing tls fields certificate and chain (7.0.x backport)

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-12-13 14:32:58 +00:00
Arne Fitzenreiter
58b611a6ab kernel: update to 6.6.63
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2024-11-25 18:32:27 +01:00