Commit Graph

22887 Commits

Author SHA1 Message Date
Vincent Li
b88c3e1a7d firewall.cgi: Highlight any deleted WireGuard peers
commit 77631ba4c738432c31cd4b6fad0da28b880fb0c7
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Tue Apr 22 18:09:31 2025 +0200

    firewall.cgi: Highlight any deleted WireGuard peers

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-27 10:38:54 -07:00
Vincent Li
60faadc84f firewall.cgi: Add dropdown to add WireGuard peers to a firewall rule
commit 468e9831d5c7b99a2dc20b66d881f43ecb0a424b
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Tue Apr 22 17:41:12 2025 +0200

    firewall.cgi: Add dropdown to add WireGuard peers to a firewall rule

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-27 10:16:47 -07:00
Vincent Li
8cb4ea1e31 firewall: Add WireGuard RW to the UI
commit 5a1c02df8973b3acc5c3101a94e86fe6df4b43b6
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Thu Sep 12 19:39:26 2024 +0200

    firewall: Add WireGuard RW to the UI

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-27 08:28:11 -07:00
Vincent Li
f4c22fcd54 wireguard.cgi: Add CGI to configure wireguard
commit 06dbc836a47160d51ab10f8b9d4ca356beaa7cdb
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Tue Apr 16 18:06:47 2024 +0200

    wireguard.cgi: Add a basic CGI to configure the global settings

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-26 15:18:50 -07:00
Vincent Li
77b71788ac wireguard: add wireguardctrl
commit f552e23da404adf4555299c887a0279016323df4
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Wed Apr 17 17:13:32 2024 +0000

    misc-progs: Add wireguardctrl

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-26 09:20:48 -07:00
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
79a6662ca7 firewall: Collect all networks that should not be NATed in an array
commit 8fa1831bff7e1d76eb83b145976211aa703062e1
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Mon Mar 31 16:31:43 2025 +0200

    firewall: Collect all networks that should not be NATed in an array

    No functional changes.

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

firewall: Explicitely don't NAT any aliases

    It seems that there is a problem with local connections that have
    preselected an outgoing interface. That will work just fine, but
    ultimately the packet will be NATed back to the primary RED IP address.
    To prevent this, we are adding some extra rules that skip the MASQUERADE
    target.

    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
799edff664 wireguard: Automatically open ports for WireGuard
commit fc32e7b9147d2eeeb6e2bc1497859fb050001eb5
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Tue Apr 16 16:20:55 2024 +0200

    firewall: Automatically open ports for WireGuard

    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
5d1364bf86 wireguard: Automatically apply MASQUERADE for peers with local address
commit 459bb750298c09990c0c8d4677f0f442887304d0
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Sat Apr 26 14:30:44 2025 +0200

    wireguard: Automatically apply MASQUERADE for peers with local address

    In this case we are the client and we cannot leak any local subnets.

    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
53443e304a wireguard: Block unauthorized traffic
commit 89b976e9a7e4da13b82de4aadadb63ffaf3031a6
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Thu Apr 25 20:32:57 2024 +0200

    wireguard: Block unauthorized traffic

    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
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
5b18e6c763 wireguard: Select the correct source IP address for N2N peers
commit 76ea485d9edb781328e307c68b1f878d933408e5
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Fri Sep 27 17:39:22 2024 +0200

    wireguard: Select the correct source IP address for N2N peers

    This is so that the firewall chooses the correct IP address when trying
    to establish connections to the remote networks.

    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
59e389cbfe dnsdist: correct xsk sample config
when use /etc/rc.d/init.d/dnsdist to start dnsdist with the sample
xsk config, it results in startup error [0].

correct the xsk sample config.

[0]: https://github.com/PowerDNS/pdns/discussions/15713

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-23 08:58:02 -07:00
Vincent Li
f2b2d9c076 README: update README
update README for feature addition and build howto

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-22 15:32:57 -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
9217ea3ca4 dnsdist: move dnsdist to core package
install the default dnsdist configuration file

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-18 11:13:34 -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
e475873eda linux: enable config kprobe multi attachment
We are going to add pwru for packet drop related
trouble shooting, pwru by default requires kernel
with kprobe multi attachment, enable kernel config
for that.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-06 17:39: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
abdbcb16ad yt6801: match yt6801 driver with kernel
kernel upgraded to 6.15.0. yt6801 kernel
modules should match to 6.15.0

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-04 17:55:27 -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
14dce6df0c firewall: allow SSH access to bridge interface
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
07fa3e0edf firewall: add firewall bridge netfilter UI
add UI to enable netfilter/firewall function
for firewall in bridge mode

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
cb07f32583 firewall: add firewall bridge IP for UI access
when firewall switched to bridge mode, we want to
have WebUI access to manage the firewall, allow user
setup IP address on the firewall bridge interface through
the UI.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -07:00
Vincent Li
57bafb9410 firewall: add UI for firewall bridge mode
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-04-17 09:13:50 -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