Commit Graph

9881 Commits

Author SHA1 Message Date
Vincent Li
95b06e6e28 wireguard: install empty config and UI functions
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Wed Sep 11 02:24:49 2024 +0200

    wireguard: Move functions into their own file

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit 85ec8363a873100fc1bb49e3c01f9f63bf97c6e1
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Wed Aug 14 15:55:06 2024 +0000

    wireguard: Install empty configuration files

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-26 08:53:27 -07:00
Vincent Li
6e6cf9e463 wireguard: Add wireguard initscript
commit b78ba3624f0a11c060ad06dbd65741b82684d93e
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Tue Apr 16 16:17:59 2024 +0200

    wireguard: Add initscript

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-26 08:07:13 -07:00
Vincent Li
457c79518d wireguard: add a custom routing table for peers
commit 43867c1e070fc96420a666b0bb21182eff16787b
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Sun Apr 27 18:30:59 2025 +0200

    wireguard: Add a custom routing table for peers

    This is a dirty hack to make connections to VPN providers actually work.

    We mark all WG packets after encryption and use a secondary routing
    table to look up any routes to the peers. That way, we can replace the
    default route in the main routing table without having to care about the
    special routes there.

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-25 17:09:00 -07:00
Vincent Li
09073df309 wireguard-tools: add wireguard tools
backport IPFire wireguard-tools to loongfire

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-25 17:08:53 -07:00
Vincent Li
9d20e54edc knot: upgrade to 3.4.7
enable XDP and add kxdpgun utility for dnsdist AF_XDP performance
test [0]

[0]: https://www.dnsdist.org/advanced/xsk.html

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-23 10:07:29 -07:00
Vincent Li
a166b8644c dnsdist: add sample xsk AF_XDP config
a simple working config sample for xsk AF_XDP

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-19 20:28:10 -07:00
Vincent Li
21b5b4abfc xdp-tools: add dnsdist_xdp.bpf.o
upgrade xdp-tools to 1.5.5 and add dnsdist_xdp.bpf.o
for dnsdist xsk AF_XDP

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-19 15:58:48 -07:00
Vincent Li
f1f13b95aa dnsdist: change the xsk v4/v6 destination map name
We use xdp-loader to load dnsdist_xdp.bpf.o for dnsdist running
AF_XDP:

xdp-loader load green0 -P 90 -p /sys/fs/bpf/dnsdist -n xdp_dns_filter /usr/lib/bpf/dnsdist_xdp.bpf.o

so the xsk v4/v6 destination map would be:

/sys/fs/bpf/dnsdist/xskDestinationsV4
/sys/fs/bpf/dnsdist/xskDestinationsV6

but dnsdist-xsk.cc has:

static std::string getDestinationMap(bool isV6)
    {
      return !isV6 ? "/sys/fs/bpf/dnsdist/xsk-destinations-v4" : "/sys/fs/bpf/dnsdist/xsk-destinations-v6";
    }

we can't use xsk-destinations-v4/v6 in dnsdist_xdp.bpf.o because bpf map
could not use '-' in map definition, '-' would result in compiling
error.

so we patch dnsdist-xsk.cc to use xskDestinationsV4/V6 that matches the
map name in dnsdist_xdp.bpf.o

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-19 09:35:23 -07:00
Vincent Li
51e2f6ff37 dnsdist: upgrade to 1.9.10
enable ebpf AF_XDP

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-13 09:29:14 -07:00
Vincent Li
31af08151a pwru: ebpf pwru tool addon for network diagnosis
pwru is ebpf based kernel tracing tool for network
issue diagnosis. pwru build issue on loongfire [0]

to prepare to run pwru on loongfire:

mount -t debugfs none /sys/kernel/debug
echo 0 > /proc/sys/kernel/kptr_restrict

[0]: https://github.com/cilium/pwru/issues/559#issuecomment-2949507451

Signed-off-by: Vinent Li <vincent.mc.li@gmail.com>
2025-06-09 09:00:18 -07:00
Vincent Li
18c621c687 go: upgrade golang to 1.24.4
pwru requires golang > 1.24.1

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-09 08:51:30 -07:00
Vincent Li
fb79d84593 ply: add ply addon for tracing
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-04 17:57:52 -07:00
Vincent Li
99358518b2 linux: upgrade to 6.15.0
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-03 09:19:20 -07:00
Vincent Li
2a075de538 libbpf-bootstrap: add netqtop
netqtop requires tracepoint, need to:

mount -t tracefs tracefs /sys/kernel/tracing

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-03 09:18:45 -07:00
Vincent Li
5376c3b290 libbpf-bootstrap: port bcc libbpf-tools profile
add bcc libbpf-tools profile to libbpf-bootstrap

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-19 11:57:54 -07:00
Vincent Li
52604d1d8f libbpf-bootstrap: add ebpf tracing program
Similar to xdp-tools to add ebpf network program.
we can use libbpf-bootstrap as facility to add ebpf
tracing program.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-19 08:38:25 -07:00
Vincent Li
8c8be5e746 bcc: add bcc libbcc for bpftrace
bpftrace depends on libbcc, so add bcc in build.
bcc build depends on zip, but loongfire does not
have zip

workaround:

copy loongson host Fedora zip command to chroot build
cp /usr/bin/zip to build_loongarch64/usr/bin

Fedora zip depends on libbz2.so.1, libbz2 is from bzip2
addon that loongfire already has, so make symbolic link

cd build_loongarch64/lib64; ln -s libbz2.so.1.0.8 libbz2.so.1

we should build zip addon for loongfire but zip has build error
need to resolve zip build error as long term solution

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-17 17:31:27 -07:00
Vincent Li
01b6865f4b Perl: Add Net ISP load balancer
Perl Net-ISP-Balance can be used for ISP Internet connection
load balancing [0], it depends on Net-Netmask module.

[0]: https://lstein.github.io/Net-ISP-Balance/

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-16 14:06:08 -07:00
Vincent Li
a43dcad754 xdp-tools: add tc-loader and tc-dummy.bpf program
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-14 11:41:23 -07:00
Vincent Li
b359042d4d xdp-tools: upgrade to upstream 1.5.4
rebase xdp-tools from upstream xdp-tools 1.5.4. there is
Makefile conflict when rebase because 1.5.4 added xdp-forward.
manually resolve the rebase conflict by put loongfire xdp program
at the end:

for example instruction from deepseek:

Open the Makefile in a text editor and locate the conflict:

makefile
ifneq ($(BPFTOOL),)
<<<<<<< HEAD
UTILS += xdp-bench xdp-forward xdp-monitor xdp-trafficgen
=======
UTILS += xdp-bench xdp-monitor xdp-trafficgen xdp-synproxy
>>>>>>> d8ebb16 (Add xdp-synproxy)
endif

Understand the conflict:

The HEAD (upstream/main) version includes xdp-forward.

Your commit (d8ebb16) adds xdp-synproxy but removes xdp-forward.

Resolve the conflict by including both changes:

Keep xdp-forward from HEAD.

Add xdp-synproxy from your commit.

The merged line should look like this:

makefile
UTILS += xdp-bench xdp-forward xdp-monitor xdp-trafficgen xdp-synproxy
Remove the conflict markers (<<<<<<<, =======, >>>>>>>).

edit result:

ifneq ($(BPFTOOL),)
UTILS += xdp-bench xdp-forward xdp-monitor xdp-trafficgen xdp-synproxy
endif

Save the file after making these changes.

Stage the resolved Makefile and continue the rebase:

git add Makefile
git rebase --continue

repeat editing Makefile and git rebase --continue for below program

xdp-dnsrrl
xdp-udp
xdp-dns
xdp-sni
xdp-geoip
xdp-udpddos
xdp-tailcall
xdp-synproxy-tailcall
xdp-ddos

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-09 10:36:54 -07:00
Vincent Li
82e8cd92a2 llvm: add lldb
llvm missing lld in Fedora result in bpf selftest build
error for liburandom_read.so [0], LoongFire build does
not build kernel bpf selftests, but still it is better
to add llvm lld in LoongFire build environment in case
future eBPF apps require llvm lld.

[0]: https://lore.kernel.org/loongarch/8f375e63-c4d5-b9cc-64c4-7563ba5c2763@loongson.cn/

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-08 11:04:56 -07:00
Vincent Li
125fb5b6d6 linux: upgrade kernel to 6.15-rc4
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-29 21:13:57 -07:00
Vincent Li
b9262e849b haproxy: move haproxy to core
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-29 09:45:28 -07:00
Vincent Li
5f3086a6f0 loxicmd: upgrade to 0.9.8.3
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-28 13:16:00 -07:00
Vincent Li
5df5d88abd loxilb: add loxilb init script
add loxilb init script and initial loxilb FW settings

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-27 10:48:42 -07:00
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