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>
This commit is contained in:
Vincent Li
2025-06-21 17:25:12 +00:00
parent 2e3ea0ae64
commit 3132f7bc78

View File

@@ -26,7 +26,7 @@ include Config
SUMMARY = A highly DNS-, DoS- and abuse-aware loadbalancer
VER = 1.9.9
VER = 1.9.10
THISAPP = dnsdist-$(VER)
DL_FILE = $(THISAPP).tar.bz2
@@ -52,7 +52,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_BLAKE2 = 54517c396d8b5b546e9bcc5890f6df0cfa8470b65d9c7dcece0c7d503fff3fc0d4e2898a7bda8e16f9935279849128293967b38865345fa4c963705b9c9b8cad
$(DL_FILE)_BLAKE2 = 4490a6faf11b6b7e48fc821be37d0cee1ad93455ec09dadc61e236704bb743d8e5189d085352c775d19933934230e1c5b68ed233b7de7c5cb196f7da4dc16719
install : $(TARGET)
@@ -92,6 +92,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
--disable-gnutls \
--enable-dns-over-tls \
--with-lua \
--with-ebpf \
--with-xsk \
--without-net-snmp
cd $(DIR_APP) && make $(MAKETUNING)