Skip to content

add optional dnsmasq features to cmake#2874

Open
darkexplosiveqwx wants to merge 1 commit into
pi-hole:developmentfrom
darkexplosiveqwx:dnsmasq-features
Open

add optional dnsmasq features to cmake#2874
darkexplosiveqwx wants to merge 1 commit into
pi-hole:developmentfrom
darkexplosiveqwx:dnsmasq-features

Conversation

@darkexplosiveqwx
Copy link
Copy Markdown
Contributor

Thank you for your contribution to the Pi-hole Community!

Please read the comments below to help us consider your Pull Request.

We are all volunteers and completing the process outlined will help us review your commits quicker.

Please make sure you

  1. Base your code and PRs against the repositories developmental branch.
  2. Sign Off all commits as we enforce the DCO for all contributions
  3. Sign all your commits as they must have verified signatures
  4. File a pull request for any change that requires changes to our documentation at our documentation repo

What does this PR aim to accomplish?:

Allow to enable build-time dnsmasq features if the development headers / libraries are present.

I am using Fedora 42 and the cmake RPM macro presets from %cmake and %cmake_build
Compilation works:

$ /usr/bin/cmake         -S "."         -B "redhat-linux-build"         -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG"         -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG"         -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG"         -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON         -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF         -DCMAKE_INSTALL_PREFIX:PATH=/usr         -DCMAKE_INSTALL_FULL_SBINDIR:PATH=/usr/bin         -DCMAKE_INSTALL_SBINDIR:PATH=bin         -DINCLUDE_INSTALL_DIR:PATH=/usr/include         -DLIB_INSTALL_DIR:PATH=/usr/lib64         -DSYSCONF_INSTALL_DIR:PATH=/etc         -DSHARE_INSTALL_PREFIX:PATH=/usr/share
-- The C compiler identification is GNU 15.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiling dynamically linked executable
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for sys/random.h
-- Looking for sys/random.h - found
-- Looking for unwind.h
-- Looking for unwind.h - found
-- Building FTL with _Unwind_Backtrace support: YES
-- Looking for libnetfilter_conntrack/libnetfilter_conntrack.h
-- Looking for libnetfilter_conntrack/libnetfilter_conntrack.h - found
-- Building FTL with dnsmasq conntrack support: YES
-- Looking for nftables/libnftables.h
-- Looking for nftables/libnftables.h - found
-- Building FTL with dnsmasq nftset support: YES
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
-- Found DBus: /usr/include/dbus-1.0;/usr/lib64/dbus-1.0/include
-- Building FTL with dnsmasq DBus support: YES
-- Building FTL with readline support: YES
-- Building FTL with TLS support: NO
-- Configuring done (1.9s)
-- Generating done (0.1s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_FLAGS_RELEASE
    CMAKE_Fortran_FLAGS_RELEASE
    CMAKE_INSTALL_DO_STRIP
    CMAKE_INSTALL_FULL_SBINDIR
    CMAKE_INSTALL_SBINDIR
    INCLUDE_INSTALL_DIR
    LIB_INSTALL_DIR
    SHARE_INSTALL_PREFIX
    SYSCONF_INSTALL_DIR


-- Build files have been written to: /home/shared/Projects/fleet/pi-hole-FTL/redhat-linux-build
$ /usr/bin/cmake --build "redhat-linux-build" -j6 --verbose
[...]
$ /home/shared/Projects/fleet/pi-hole-FTL/redhat-linux-build/pihole-FTL -vv
****************************** FTL **********************************
Version:         v6.6.1-189-g590733e7-dirty
Branch:          development
Commit:          590733e7-dirty (2026-04-30 18:34:59 +0200)
Architecture:    x86_64 (compiled locally)
Compiler:        gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)
GLIBC version:   2.42

****************************** dnsmasq ******************************
Version:         pi-hole-v2.92rc1
Features:        IPv6 GNU-getopt DBus no-UBus no-i18n IDN2 DHCP DHCPv6 Lua TFTP conntrack ipset nftset auth DNSSEC loop-detect inotify dumpfile

****************************** SQLite3 ******************************
Version:         3.51.3
Features:        ATOMIC_INTRINSICS=1 COMPILER=gcc-15.2.1 20260123 (Red Hat 15.2.1-7) DEFAULT_AUTOVACUUM DEFAULT_CACHE_SIZE=4096 DEFAULT_FILE_FORMAT=4 DEFAULT_FOREIGN_KEYS DEFAULT_JOURNAL_SIZE_LIMIT=33554432 DEFAULT_MEMSTATUS=0 DEFAULT_MMAP_SIZE=0 DEFAULT_PAGE_SIZE=4096 DEFAULT_PCACHE_INITSZ=20 DEFAULT_RECURSIVE_TRIGGERS DEFAULT_SECTOR_SIZE=4096 DEFAULT_SYNCHRONOUS=1 DEFAULT_WAL_AUTOCHECKPOINT=1000 DEFAULT_WAL_SYNCHRONOUS=1 DEFAULT_WORKER_THREADS=0 DIRECT_OVERFLOW_READ DQS=0 ENABLE_CARRAY ENABLE_DBPAGE_VTAB ENABLE_EXPLAIN_COMMENTS ENABLE_PERCENTILE LIKE_DOESNT_MATCH_BLOBS MALLOC_SOFT_LIMIT=1024 MAX_ATTACHED=10 MAX_COLUMN=2000 MAX_COMPOUND_SELECT=500 MAX_DEFAULT_PAGE_SIZE=8192 MAX_EXPR_DEPTH=1000 MAX_FUNCTION_ARG=1000 MAX_LENGTH=1000000000 MAX_LIKE_PATTERN_LENGTH=50000 MAX_MMAP_SIZE=0x7fff0000 MAX_PAGE_COUNT=0xfffffffe MAX_PAGE_SIZE=65536 MAX_SQL_LENGTH=1000000000 MAX_TRIGGER_DEPTH=1000 MAX_VARIABLE_NUMBER=32766 MAX_VDBE_OP=250000000 MAX_WORKER_THREADS=8 MUTEX_PTHREADS OMIT_DEPRECATED OMIT_LOAD_EXTENSION OMIT_PROGRESS_CALLBACK OMIT_SHARED_CACHE SYSTEM_MALLOC TEMP_STORE=1 THREADSAFE=1

******************************** LUA ********************************
Version:         Lua 5.5.0
Libraries:       inspect.lua (8.27 kB) 

***************************** LIBNETTLE *****************************
Version:         3.10
GMP:             Full

****************************** CivetWeb *****************************
Version:         1.17 (modified by Pi-hole) without mbed TLS
Features:        Files: Yes, TLS: No, CGI: No, IPv6: Yes, 
                 WebSockets: No, Server-side JavaScript: No
                 Lua: Yes, Cache: Yes, Stats: No, Compression: No
                 HTTP2: No, Unix domain sockets: No

****************************** cJSON ********************************
Version:         1.7.18

Absence is correctly detected:

$ /usr/bin/cmake         -S "."         -B "redhat-linux-build"         -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG"         -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG"         -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG"         -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON         -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF         -DCMAKE_INSTALL_PREFIX:PATH=/usr         -DCMAKE_INSTALL_FULL_SBINDIR:PATH=/usr/bin         -DCMAKE_INSTALL_SBINDIR:PATH=bin         -DINCLUDE_INSTALL_DIR:PATH=/usr/include         -DLIB_INSTALL_DIR:PATH=/usr/lib64         -DSYSCONF_INSTALL_DIR:PATH=/etc         -DSHARE_INSTALL_PREFIX:PATH=/usr/share
-- The C compiler identification is GNU 15.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiling dynamically linked executable
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for sys/random.h
-- Looking for sys/random.h - found
-- Looking for unwind.h
-- Looking for unwind.h - found
-- Building FTL with _Unwind_Backtrace support: YES
-- Looking for libnetfilter_conntrack/libnetfilter_conntrack.h
-- Looking for libnetfilter_conntrack/libnetfilter_conntrack.h - not found
-- Building FTL with dnsmasq conntrack support: NO
-- Looking for nftables/libnftables.h
-- Looking for nftables/libnftables.h - not found
-- Building FTL with dnsmasq nftset support: NO
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
-- Could NOT find DBus (missing: DBUS_INCLUDE_DIRS DBUS_LIBRARIES) 
-- Building FTL with dnsmasq DBus support: NO
-- Building FTL with readline support: YES
-- Building FTL with TLS support: NO
-- Configuring done (1.1s)
-- Generating done (0.1s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_FLAGS_RELEASE
    CMAKE_Fortran_FLAGS_RELEASE
    CMAKE_INSTALL_DO_STRIP
    CMAKE_INSTALL_FULL_SBINDIR
    CMAKE_INSTALL_SBINDIR
    INCLUDE_INSTALL_DIR
    LIB_INSTALL_DIR
    SHARE_INSTALL_PREFIX
    SYSCONF_INSTALL_DIR


-- Build files have been written to: /home/shared/Projects/fleet/pi-hole-FTL/redhat-linux-build

How does this PR accomplish the above?:

The change in FindDBus.cmake is necessary, otherwise CMake will complain with:

-- Building FTL with dnsmasq nftset support: YES
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.3.0")
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:441 (message):
  The package name passed to `find_package_handle_standard_args` (DBUS) does
  not match the name of the calling package (DBus).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  src/FindDBus.cmake:59 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/CMakeLists.txt:400 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found DBUS: /usr/include/dbus-1.0;/usr/lib64/dbus-1.0/include
-- Building FTL with dnsmasq DBus support: YES

I have also removed the reference to DNSMASQ_ALL_OPTS, a quick rg yielded no other matches.
It was originally added in #1472, but the associcated CMake part was removed in #1962 (github blame only a bit helpful when searching for removed lines).
With now being able to enable the features one-by-one this is no longer needed.


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
@darkexplosiveqwx darkexplosiveqwx requested a review from a team as a code owner April 30, 2026 22:35
@darkexplosiveqwx
Copy link
Copy Markdown
Contributor Author

Some questions:
Do we want the features to be ON or OFF by default?
We don't want to add a library if they happen to have the -devel, but not the runtime library and let it fail on startup.
But D-Bus and especially libnftables are installed on almost every Linux distro (for runtime).
Conntrack should also work fine: (from src/dnsmasq/config.h)

HAVE_CONNTRACK
   define this to include code which propagates conntrack marks from
   incoming DNS queries to the corresponding upstream queries. This adds
   a build-dependency on libnetfilter_conntrack, but the resulting binary will
   still run happily on a kernel without conntrack support

And should I call it Building FTL with dnsmasq nftset support or Building FTL with nftset support?

@rdwebdesign rdwebdesign requested a review from DL6ER May 1, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant