9430 Commits

Author SHA1 Message Date
Vincent Li
4382757dff unbound: upgrade to 1.22.0
there is issue with DNS unable to resolve some domain [0], update the
unbound to 1.22.0, the issue is resolved, not sure why it broke though.

[0]: https://github.com/vincentmli/bpfire/issues/112

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-12-03 20:02:09 +00:00
Vincent Li
704a226f1f libbpf-bootstrap: add wg_handshake to log wireguard handshake message
commit 6424fa8757a3a8fd8fde1be6935a1984abe8fdb2 (HEAD -> loongfire-port, origin/loongfire-port)
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Fri Nov 7 19:17:59 2025 -0800

        wg_handshake: log wireguard handshake message

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-11-15 19:39:00 +00:00
Vincent Li
916a8aa5ed flash-images: mount debugfs
mount debugfs to allow kernel functions tracing

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-11-05 18:13:17 +00:00
Vincent Li
58b4babde2 xdp-tools: add IFB setup in tc-basic-classifier
commit f0812939ca4f6332d34715673c4fe44fbb1a491b (HEAD -> main, origin/main, origin/HEAD)
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Mon Nov 3 21:46:30 2025 -0800

        tc-basic-classifier: add IFB setup in user space

        Add the required kernel modules setup and green0 ingress mirror to ifb0
        egress setup in class_filter so it is easier for user. see [0] for
        required kernel modules and ingress shaping. also change the default
        path to /usr/lib/bpf/class_filter.bpf.o  also change the default bpf
        object path to /usr/lib/bpf/class_filter.bpf.o.

        [0]: https://std.rocks/gnulinux_network_traffic_control.html

        for example:

        Complete setup with one command (IFB mirroring + BPF attachment)

        ./class_filter -i green0 -3 10mbit -I -a -v

        Setting up IFB mirroring for ingress traffic shaping on green0
        Loading required kernel modules...
        Executing: modprobe ifb numifbs=1
        Loaded module: ifb numifbs=1
        Executing: modprobe sch_fq_codel
        Loaded module: sch_fq_codel
        Executing: modprobe act_mirred
        Loaded module: act_mirred
        Executing: modprobe act_connmark
        Loaded module: act_connmark
        Successfully loaded all required kernel modules
        Executing: ip link set dev ifb0 up
        Executing: tc qdisc del dev green0 ingress 2>/dev/null
        Executing: tc qdisc add dev green0 ingress handle ffff:
        Executing: tc filter add dev green0 parent ffff: protocol ip u32 match u32 0 0 action connmark action mirred egress redirect dev ifb0 flowid ffff:1
        Successfully setup IFB mirroring:
          - Ingress traffic from green0 mirrored to ifb0 egress

        Verification - IFB status:
        Executing: ip link show ifb0
        7: ifb0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc htb state UNKNOWN mode DEFAULT group default qlen 32
            link/ether 8e:52:c9:93:13:34 brd ff:ff:ff:ff:ff:ff

        TC configuration on green0 ingress:
        Executing: tc qdisc show dev green0
        qdisc fq_codel 8001: root refcnt 9 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
        qdisc ingress ffff: parent ffff:fff1 ----------------
        Executing: tc filter show dev green0 parent ffff:
        filter protocol ip pref 49152 u32 chain 0
        filter protocol ip pref 49152 u32 chain 0 fh 800: ht divisor 1
        filter protocol ip pref 49152 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid ffff:1 not_in_hw
          match 00000000/00000000 at 0
                action order 1: connmark zone 0 pipe
                 index 1 ref 1 bind 1

                action order 2: mirred (Egress Redirect to device ifb0) stolen
                index 1 ref 1 bind 1

        Setting up TC qdisc and classes on ifb0 for egress shaping...
        Executing: tc qdisc del dev ifb0 root 2>/dev/null
        Executing: tc qdisc add dev ifb0 root handle 1:0 htb default 30
        Executing: tc class add dev ifb0 parent 1:0 classid 1:1 htb rate 100mbit
        Warning: sch_htb: quantum of class 10001 is big. Consider r2q change.
        Executing: tc class add dev ifb0 parent 1:1 classid 1:30 htb rate 5mbit ceil 10mbit
        Successfully setup TC qdisc and classes on ifb0

        TC configuration on ifb0:
        Executing: tc qdisc show dev ifb0
        qdisc htb 1: root refcnt 2 r2q 10 default 0x30 direct_packets_stat 1 direct_qlen 32
        Executing: tc class show dev ifb0
        class htb 1:1 root rate 100Mbit ceil 100Mbit burst 1600b cburst 1600b
        class htb 1:30 parent 1:1 prio 0 rate 5Mbit ceil 10Mbit burst 1600b cburst 1600b

        Automatically attaching BPF program to ifb0 for classification...
        Attaching BPF program to ifb0...
        Executing: tc filter del dev ifb0 protocol ip parent 1:0 2>/dev/null
        Command failed but ignoring (may be normal): tc filter del dev ifb0 protocol ip parent 1:0 2>/dev/null
        Executing: tc filter add dev ifb0 protocol ip parent 1:0 bpf obj ./class_filter.bpf.o classid 1: direct-action
        Successfully attached BPF program to ifb0 egress (parent 1:0)
        BPF maps automatically pinned to /sys/fs/bpf/tc/globals/
        Verification:
        Executing: tc filter show dev ifb0 parent 1:0
        filter protocol ip pref 49152 bpf chain 0
        filter protocol ip pref 49152 bpf chain 0 handle 0x1 flowid 1: class_filter.bpf.o:[classifier] direct-action not_in_hw id 100 name cls_filter tag 7163f8c072cf7015 jited
        Pinned maps:
        Executing: ls -la /sys/fs/bpf/tc/globals/ 2>/dev/null || echo 'No pinned maps found'
        total 0
        drwx------ 2 root root 0 Nov  3 11:43 .
        drwx------ 3 root root 0 Nov  3 11:24 ..
        -rw------- 1 root root 0 Nov  3 11:43 cls_filter_ip_trie_map
        -rw------- 1 root root 0 Nov  3 11:43 cls_filter_port_map

        Complete setup finished:
          - IFB mirroring configured on green0 -> ifb0
          - TC qdisc and classes setup on ifb0
          - BPF classifier attached to ifb0 egress
          - Ready for port/IP based traffic classification!

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-11-04 02:18:19 +00:00
Vincent Li
101831d1b7 xdp-tools: tc-basic-classifier ingress shaping
commit 9b82374a47906be38eb50f6ee5cc429fc4de4a4c (HEAD -> main, origin/main, origin/HEAD)
Author: Vincent Li <vincent.mc.li@gmail.com>
Date:   Sat Nov 1 09:03:11 2025 -0700

    tc-basic-classifier: add source ip address classification

    For ingress shaping based on local network source address, according to [0] [1], iptables firewallrule mark is used to mark the packet originated from the local network source ip, but with eBPF tc, we can do the eBPF TC classification on the ifb0 interface to eliminate use of iptables, this improves programability and flexibility. so change the tc bpf program to do both destination and source ip classification, the setup is like:

    modprobe ifb numifbs=1
    modprobe sch_fq_codel
    modprobe act_mirred
    modprobe act_connmark

    ip link set ifb0 up

    tc qdisc add dev green0 ingress handle ffff:

    tc filter add dev green0 parent ffff: protocol ip u32 match u32 0 0 action connmark action mirred egress redirect dev ifb0 flowid ffff:1

    ./class_filter -a -b ./class_filter.bpf.o -i ifb0 -v

    Setting up TC qdisc and classes...
    Setting up TC qdisc and classes on ifb0
    Executing: tc qdisc del dev ifb0 root 2>/dev/null
    Command failed but ignoring (may be normal): tc qdisc del dev ifb0 root 2>/dev/null
    Executing: tc qdisc add dev ifb0 root handle 1:0 htb default 30
    Executing: tc class add dev ifb0 parent 1:0 classid 1:1 htb rate 100mbit
    Warning: sch_htb: quantum of class 10001 is big. Consider r2q change.
    Executing: tc class add dev ifb0 parent 1:1 classid 1:30 htb rate 5mbit ceil 20mbit
    Successfully setup TC qdisc and classes on ifb0

    TC qdisc configuration:
    Executing: tc qdisc show dev ifb0
    qdisc htb 1: root refcnt 2 r2q 10 default 0x30 direct_packets_stat 2 direct_qlen 32

    TC classes configuration:
    Executing: tc class show dev ifb0
    class htb 1:1 root rate 100Mbit ceil 100Mbit burst 1600b cburst 1600b
    class htb 1:30 parent 1:1 prio 0 rate 5Mbit ceil 20Mbit burst 1600b cburst 1600b
    Executing: tc filter del dev ifb0 protocol ip parent 1:0 2>/dev/null
    Command failed but ignoring (may be normal): tc filter del dev ifb0 protocol ip parent 1:0 2>/dev/null
    Executing: tc filter add dev ifb0 protocol ip parent 1:0 bpf obj ./class_filter.bpf.o classid 1: direct-action
    Successfully attached BPF program to ifb0 egress (parent 1:0)
    BPF maps automatically pinned to /sys/fs/bpf/tc/globals/
    Verification:
    Executing: tc filter show dev ifb0 parent 1:0
    filter protocol ip pref 49152 bpf chain 0
    filter protocol ip pref 49152 bpf chain 0 handle 0x1 flowid 1: class_filter.bpf.o:[classifier] direct-action not_in_hw id 93 name cls_filter tag 7163f8c072cf7015 jited
    Pinned maps:
    Executing: ls -la /sys/fs/bpf/tc/globals/ 2>/dev/null || echo 'No pinned maps found'
    total 0
    drwx------ 2 root root 0 Nov  1 09:01 .
    drwx------ 3 root root 0 Nov  1 08:01 ..
    -rw------- 1 root root 0 Nov  1 09:01 cls_filter_ip_trie_map
    -rw------- 1 root root 0 Nov  1 09:01 cls_filter_port_map

    BPF program loaded and attached successfully to ifb0 egress
    Default class configured: 1:30 (rate: 5mbit, ceil: 20mbit)

    Use --add-port to create additional classes with rates (supports single ports and ranges).

    ./class_filter -i ifb0 -r 192.168.9.13/32:40:80mbit

    Added TC class: 1:40 (rate: 5mbit, ceil: 80mbit)
    Added IP mapping: 192.168.9.13/32 -> 1:40 (rate: 80mbit)

    ./class_filter -m

    IP Range Mappings:
    CIDR            -> TC_CLASS  (BPF_VALUE)
    ----------------------------------------
    192.168.9.13/32 -> 1:40     (0x40)
    Total: 1 IP range mappings

    tc -g class show dev ifb0

    +---(1:1) htb rate 100Mbit ceil 100Mbit burst 1600b cburst 1600b
         +---(1:40) htb prio 0 rate 5Mbit ceil 80Mbit burst 1600b cburst 1600b
         +---(1:30) htb prio 0 rate 5Mbit ceil 20Mbit burst 1600b cburst 1600b

    on 192.168.9.13:

    root@vincent-iMac:~# iperf3 -t 4 -c 10.0.0.206 -p 8080
    Connecting to host 10.0.0.206, port 8080
    [  5] local 192.168.9.13 port 51072 connected to 10.0.0.206 port 8080
    [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
    [  5]   0.00-1.00   sec  9.63 MBytes  80.8 Mbits/sec    5    119 KBytes
    [  5]   1.00-2.00   sec  9.26 MBytes  77.7 Mbits/sec    7   86.3 KBytes
    [  5]   2.00-3.00   sec  9.20 MBytes  77.1 Mbits/sec    7    116 KBytes
    [  5]   3.00-4.00   sec  8.82 MBytes  74.0 Mbits/sec    2    102 KBytes
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-4.00   sec  36.9 MBytes  77.4 Mbits/sec   21             sender
    [  5]   0.00-4.05   sec  36.5 MBytes  75.6 Mbits/sec                  receiver

    [0]: https://std.rocks/gnulinux_network_traffic_control.html
    [1]: https://wiki.archlinux.org/title/Advanced_traffic_control#Shape_ingress_traffic_on_SNAT

    Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-11-03 02:56:04 +00:00
Vincent Li
0b4a8acd52 xdp-tools: a few improvement on class_filter
commit fa10708e3c87519f8e9c85cdff7a2bdd80dbd699 (HEAD -> main)
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Fri Oct 24 20:58:18 2025 -0700

        tc-basic-classifier: allow port range for classification

        Improve user space class_filter to add port range like:

        ./class_filter -i red0 --add-port "8080-8082:10:40mbit"
        or
        ./class_filter -i red0 --add-port "8083:20:60mbit"

        each port will still be added as individual entry in port map, so no
        code change required in bpf side.

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

    commit 5852f6184e3d129667df01011c4ecdf6df994266
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Wed Oct 22 19:41:05 2025 -0700

        tc-basic-classifier: make tcp and udp port classification

        make port classification for both UDP and TCP.

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

    commit 0bda902c82c755bda1d5ba40d1404051de4e9102
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Tue Oct 21 19:28:15 2025 -0700

        tc-basic-classifier: fix IP endiness and classification on red0

        the IP in user space is stored in host order but bpf program IP lookup
        by network order. also tested IP classification green0 not working. so
        should do destination IP classification on red0 interface, and the
        destination IP is going to be Internet destination IP addresses. need to
        figure out how to do IP based classification on LAN/green0 network IPs
        if required.

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-10-25 02:26:32 +00:00
Vincent Li
04033ad1a5 xdp-tools: rebase on upstream 1.5.7 and add tc classifier
commit ced17feca631f6963a2439f41ef09a7db048f316 (HEAD -> main)
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Mon Oct 20 21:28:17 2025 -0700

        tc-basic-classifier: fix tcp port Endianess bug by AI

        AI generated class_filter program stored the tcp port in network order,
        but in bpf program the tcp port is converted to host order, and result in
        tcp port lookup failure, unable to get the correct classid, fail to do rate
        classification.

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

    commit a18fe4be0374ab1efb21c1228a5c5790ded7636e
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Mon Oct 20 19:15:34 2025 -0700

        tc-basic-classifier: classify port and IP from bpf map

        add port and IP rate classification based on bpf map so user could
        add or remove port/IP rate classification dynamically at run time

        since TC class works on egress direction, so port rate classification
        works on red0 egress, and IP rate classification works on green0 egress

        port rate classification:

        class_filter -a -b ./class_filter.bpf.o -i red0 -v

        class_filter -i red0 --add-port 8080:10:80mbit
        class_filter -i red0 --add-port 8081:20:40mbit

        class_filter -i red0 --delete-port 8080

        class_filter -i red0 --list-ports

        IP rate classification:

        class_filter -a -b ./class_filter.bpf.o -i green0 -v

        class_filter -i red0 --add-ip 192.168.1.0/24:40:30mbit
        class_filter -i red0 --delete-ip 192.168.1.0/24

        class_filter -i red0 --list-ips

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

    commit 12280ef22ae49f75eda047144ed3e9dc0f73e04a
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Fri Oct 17 19:45:07 2025 -0700

        tc-basic-classifier: add user space program

        the bpf skel header is generated only if USER_TARGETS
        is added in Makefile, so add a dummy user space program.

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

    commit fe5cc1814af4c995f61ec08708110deef7a65c45
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Fri Oct 17 19:28:45 2025 -0700

        xdp-tools: rebase on upstream xdp-tools main branch

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

    commit 7dee7fd954c06a3c58bedbb5561b9ee65c3f749f
    Author: Vincent Li <vincent.mc.li@gmail.com>
    Date:   Fri Oct 17 18:39:59 2025 -0700

        tc-basic-classifier: rename the class filter

        Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-10-21 01:47:29 +00:00
Vincent Li
578eb58ea0 arpwatch: Fix the evelope sender
commit c2eba600d753df95a81707f7da0ab172ed864ab0
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Sat Sep 20 14:02:01 2025 +0000

    arpwatch: Fix the envelope sender

    arpwatch invokes sendmail without passing the envelope sender
    explicitely. This causes that mails can get rejected if the From: header
    does not match the envelope sender.

    This patch passes the correct address as the envelope sender.

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-09-26 01:05:29 +00:00
Vincent Li
a81b1f8f2b arpwatch: add arpwatch as common package
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-09-25 15:37:51 +00:00
Vincent Li
4045f9fbc2 makedumpfile: add makedumpfile for kdump tool
makedumpfile build by default in BPFire use static libdw.a, libelf.a but
libdw.a, libelf.a are not build with zstd which makdedumpfile static
build requires, so build makedumpfile dynamically, see [0].

[0]: https://github.com/vincentmli/bpfire/issues/109

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-08-16 02:58:33 +00:00
Vincent Li
1475ef5093 kexec-tools: add kexec-tool for kernel dump
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-08-15 16:05:19 +00:00
Vincent Li
ec74268fa7 linux: upgrade to stable kernel 6.15.6
6.15.6 include:

From 06a34f7db773e01efa8a90c5b4d912207a80dd60 Mon Sep 17 00:00:00 2001
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Sun, 17 Nov 2024 22:20:30 +0100
Subject: [PATCH] wireguard: device: support big tcp GSO

Advertise GSO_MAX_SIZE as TSO max size in order support BIG TCP for wireguard.
This helps to improve wireguard performance a bit when enabled as it allows
wireguard to aggregate larger skbs in wg_packet_consume_data_done() via
napi_gro_receive(), but also allows the stack to build larger skbs on xmit
where the driver then segments them before encryption inside wg_xmit().
We've seen a 15% improvement in TCP stream performance.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://patch.msgid.link/20241117212030.629159-5-Jason@zx2c4.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/wireguard/device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index a2ba71fbbed46..6cf173a008e78 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -302,6 +302,8 @@ static void wg_setup(struct net_device *dev)
 	/* We need to keep the dst around in case of icmp replies. */
 	netif_keep_dst(dev);

+	netif_set_tso_max_size(dev, GSO_MAX_SIZE);
+
 	wg->dev = dev;
 }

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-12 16:09:44 +00:00
Vincent Li
3eb0ec8b1b wireguard: install UI empty config and 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-07-03 15:56:40 +00:00
Vincent Li
2d55d3c672 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-07-03 15:43:15 +00:00
Vincent Li
c74e903b32 wireguard: Add a custom routing tables 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-07-02 18:43:53 +00:00
Vincent Li
dd9a60e720 wireguard-tools: backport IPFire wireguard-tools
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-02 16:04:52 +00:00
Vincent Li
279f1e8e86 knot: upgrade to 3.4.7 and add kxdpgun
enable XDP to 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 18:41:56 +00:00
Vincent Li
b78ee945cd xdp-tools: add dnsdist XDP program
upgrade xdp-tools to 1.5.5 and add dnsdist_xdp.bpf.o
for dnsdist xsk AF_XDP

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-21 17:40:40 +00:00
Vincent Li
d81f2b838e dnsdist: add sample xsk AF_XDP config
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-21 17:37:01 +00:00
Vincent Li
3132f7bc78 dnsdist: enable ebpf xsk AF_XDP
upgrade to 1.9.10 and enable ebpf AF_XDP

    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-21 17:27:52 +00:00
Vincent Li
2e3ea0ae64 pwru: ebpf pwru addon for network diagnosis
preparation for pwru:

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-11 23:00:56 +00:00
Vincent Li
9d50babeb9 golang: upgrade to 1.24.4
pwru requires golang > 1.24.1

Delete existing build/usr/lib/go directory before upgrade go

rm -rf build/usr/lib/go

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-06-11 22:31:03 +00:00
Vincent Li
bdee533f04 libbpf-bootstrap: base for importing libbpf-tools
add libbpf-bootstrap as base to import bcc libbpf-tools

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-23 20:05:48 +00:00
Vincent Li
465f1e2328 Perl: add Net-ISP-Balance addon
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-21 15:53:12 +00:00
Vincent Li
1726f3bd3b strace: sync strace 6.12 upgrade from ipfire
sync strace upgrade from ipfire strace 6.12

fix: https://github.com/vincentmli/BPFire/issues/90
Reported-by: Harvey Li <lhw365@gmail.com>
Signd-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-21 15:53:12 +00:00
Vincent Li
18ec4f2b87 udev: sync update from ipfire
commit d19b71301d08db94341eae1d62500a928a8f6712
Author: Arne Fitzenreiter <arne_f@ipfire.org>
Date:   Thu Dec 26 10:19:20 2024 +0100

    udev: patch to handle pidfs and bcachefs

    this is needed to build udev with kernel 6.12 headers

    Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>

fix: https://github.com/vincentmli/BPFire/issues/89
Reported-by: Harvey Li <lhw365@gmail.com>
Signd-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-21 15:53:03 +00:00
Vincent Li
93a5a7af7b xdp-tools: rebased on upstream 1.5.4
included recent changes:

1 fix for xdp-dns for [0]
2 tc-loader to load tc ebpf program

[0]: https://github.com/vincentmli/BPFire/issues/87

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-14 20:35:57 +00:00
Vincent Li
c25bc27049 dnsdist: upgrade to 1.9.9
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-09 20:19:42 +00:00
Vincent Li
58e92cbb36 loxilb: upgrade to 0.9.8.3
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-09 20:19:42 +00:00
Vincent Li
8af09f38e0 README: update README
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-09 20:19:35 +00:00
Vincent Li
e2856c1c7e loxilb-tc: remove loxilb-tc
loxilb 0.9.8 load tc BPF program through libbpf
so iproute tc utility is not needed.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-03-03 17:19:15 +00:00
Vincent Li
83cf08dfa0 loxilb: upgrade loxilb to 0.9.8.1
0.9.8.1 release workaround linux kernel 6.12 bpf
verifier issue.

git clone --recurse-submodules --branch v0.9.8.1 https://github.com/loxilb-io/loxilb.git
cd loxilb
go mod vendor
cd ..
mv loxilb loxilb-0.9.8.1
tar czvf loxilb-0.9.8.1.tar.gz loxilb-0.9.8.1

see https://github.com/loxilb-io/loxilb/issues/953

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-03-03 17:14:47 +00:00
Vincent Li
1cbd76f718 linux: upgrade kernel to 6.12.5
loxilb dev branch has fix for kernel 6.12. now
we can upgrade kernel to 6.12.5

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-02-11 23:44:14 +00:00
Vincent Li
fe2ad5da66 loxilb: upgrade to loxilb dev main branch
test out the new loxilb with fix for kernel 6.12 issue

git clone --recurse-submodules https://github.com/loxilb-io/loxilb.git
mv loxilb loxilb-0.9.9
tar czvf loxilb-0.9.9.tar.gz loxilb-0.9.9
mv loxilb-0.9.9.tar.gz <BPFire source>/cache

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-02-11 23:40:53 +00:00
Vincent Li
2daee785d4 lunatik: remove lunatik
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-02-04 17:07:13 +00:00
Vincent Li
064136634c linux: downgrade kernel to 6.10.11
workaround https://github.com/vincentmli/BPFire/issues/75

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-02-04 16:56:51 +00:00
Vincent Li
b040fb1c8a llvm-project: upgrade to 19.1.7
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-02-04 16:47:07 +00:00
Vincent Li
4e9bff5b57 loxicmd: upgrade loxicmd to 0.9.8
git clone --branch v0.9.8 https://github.com/loxilb-io/loxicmd.git
cd loxicmd
go mod vendor
cd ..
mv loxicmd loxicmd-0.9.8
tar czvf loxicmd-0.9.8.tar.gz loxicmd-0.9.8

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-29 16:27:08 +00:00
Vincent Li
017a03c86b loxilb: upgrade loxilb to 0.9.8
when upgrading loxilb to 0.9.7, running
into issue https://github.com/loxilb-io/loxilb/issues/948

following method to prepare the loxilb source tar ball
resolves the issue

git clone --recurse-submodules --branch v0.9.8 https://github.com/loxilb-io/loxilb.git
cd loxilb
go mod vendor
cd ..
mv loxilb loxilb-0.9.8
tar zcvf loxilb-0.9.8.tar.gz loxilb-0.9.8
mv loxilb-0.9.8.tar.gz <BPFire source>/cache/

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

also backported libbpf 1.2.3 lonngarch64 to libbpf 0.8
for loxilb

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-29 01:19:21 +00:00
Vincent Li
17d49c9d64 linux: upgrade kernel to 6.12.5
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-02 18:11:19 +00:00
Vincent Li
09c182c75a xdp-tools: XDP UDP DDoS for online game protection
UDP DDoS has pattern of flooding game server with
random source IP and UDP with random payload. game
server UDP traffic requires certain payload
pattern, so this XDP program can serve as example
to stop UDP DDoS attack with UDP payload that does not
match game UDP traffic payload pattern.

without UDP DDoS protection, under DDoS attack:

BPFire UI RED Traffic: in 9xx Mbit/s.

with UDP DDoS protection, under DDoS attack:

BPFire UI RED Traffic: in 1xx Mbit/s.

Tested-by: Muhammad Haikal <eykalpirates@gmail.com>
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-11-27 18:32:10 +00:00
Vincent Li
5de3f44cc7 xdp-synproxy: enable or disable window scaling
XDP generated SYNACK tcp options with window
scaling and timestamp could intermittently cause
small packet transmission on DDoS protected server.
allow user to disable window scaling when such
problem occurs. see [0]

[0]: https://github.com/vincentmli/xdp-tools/issues/7

Reported-by: DNSPROXY.ORG LLC <dnsproxyorg@gmail.com>
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-11-12 01:22:27 +00:00
Vincent Li
0a726a99ac haproxy: move haproxy to core package
move haproxy to core package

prepare /var/ipfire/haproxy for haproxy UI, use
/var/ipfire/haproxy/haproxy.cfg

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-28 02:44:48 +00:00
Vincent Li
a600787c67 xdp-synproxy: drop IP don't fragment check
When XDP DDoS syncookie program is attached
to red0 interface, green network client internet
connection to website like gmail/youtube... failed.
it is because these sites does not have IP DF flag
set for each tcp packet, and syncookie_xdp program
would drop these packets when they arrived at red0
interface.

see https://github.com/vincentmli/BPFire/issues/59

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-25 20:35:33 +00:00
Vincent Li
25da9eb467 ddos: Load/Attach XDP DDoS when reboot
fix: https://github.com/vincentmli/BPFire/issues/58

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-22 18:48:11 +00:00
Vincent Li
8b29912521 suricata-xdp: resolve memlock and stack smashing
suricata XDP support requires xdp-tools with
libbpf 1.4 to resolve stack smash issue.

also workaround memlock operation not permitted
by running suricata as root since load/attach
XDP program requires root privilige anyway.

see: https://github.com/vincentmli/BPFire/issues/54

Usage scenario:

since suricata IPS XDP capture mode works as
layer 2 bridge, BPFire netfilter firewall, NAT
IP route  will be bypassed. no IP address should
be assigned to red0 and green0 interface.

172.16.1.0/24          inline              172.16.1.0/24
red network<-->red0(xdp)<-->green0(xdp)<-->green network

we can run setup command to assign IP/Mask 0.0.0.0/0.0.0.0
to red0 and green0, then reboot BPFire, BPFire DHCP
will stops working after reboot. green network client
can get DHCP IP from upstream dhcp server.

start suricata manually

suricata -c /etc/suricata/suricata-xdp.yaml --af-packet
xdp_filter.bpf program will be attached to red0 and gree0
interface

not sure if we should add GUI for suricata XDP capture mode
since this is not common use case.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-18 19:47:59 +00:00
Vincent Li
3e17c7b30b xdp-tools: build xdp-tools with libbpf 1.4.6
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-18 17:16:17 +00:00
Vincent Li
40c097ff8a libbpf: upgrade to 1.4.6
xdp-tools libxdb requires libbpf 1.4.0 and above
to fix stack smashing issue.

see: https://github.com/xdp-project/xdp-tools/issues/446

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-18 17:16:09 +00:00
Vincent Li
1eceb143ed suricata: add suricata ebpf xdp capture mode
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-17 02:11:19 +00:00
Vincent Li
f689a70b7e Revert "Revert "lunatik: 'bpf_luaxdp_run': BTF not found in kernel""
This reverts commit 0e29b73703.

switch to libbpf 1.3
2024-10-15 15:25:50 +00:00