Skip to content

Commit

Permalink
Merge pull request #1473 from pi-hole/development
Browse files Browse the repository at this point in the history
Pi-hole FTL v5.19
  • Loading branch information
PromoFaux authored Nov 14, 2022
2 parents 6f69dd5 + 9fe7fb5 commit 6075a70
Show file tree
Hide file tree
Showing 42 changed files with 1,654 additions and 617 deletions.
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

18 changes: 0 additions & 18 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

29 changes: 16 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ jobs:
steps:
-
name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v3.1.0
-
name: "Calculate required variables"
id: variables
run: |
GIT_TAG=${{ github.event.release.tag_name }}
# If GIT_TAG is set then GIT BRANCH should be "master", else set it from GITHUB_REF
GIT_BRANCH=$([ -n "${GIT_TAG}" ] && echo "master" || echo "${GITHUB_REF#refs/*/}")
echo ::set-output name=GIT_BRANCH::${GIT_BRANCH}
echo ::set-output name=GIT_TAG::${GIT_TAG}
echo ::set-output name=OUTPUT_DIR::${GIT_TAG:-${GIT_BRANCH}}
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_OUTPUT
echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_OUTPUT
echo "OUTPUT_DIR=${GIT_TAG:-${GIT_BRANCH}}" >> $GITHUB_OUTPUT
-
name: "Check git branch name depth"
env:
Expand All @@ -53,7 +53,7 @@ jobs:

needs: smoke-tests

container: ghcr.io/pi-hole/ftl-build:v1.19-${{ matrix.arch }}
container: ghcr.io/pi-hole/ftl-build:v1.23-${{ matrix.arch }}

strategy:
fail-fast: false
Expand All @@ -62,6 +62,9 @@ jobs:
include:
- arch: x86_64
bin_name: pihole-FTL-linux-x86_64
- arch: x86_64
arch_extra: _full
bin_name: pihole-FTL-linux-x86_64_full
- arch: x86_64-musl
bin_name: pihole-FTL-musl-linux-x86_64
- arch: x86_32
Expand All @@ -80,12 +83,12 @@ jobs:
bin_name: pihole-FTL-aarch64-linux-gnu

env:
CI_ARCH: ${{ matrix.arch }}
CI_ARCH: ${{ matrix.arch }}${{ matrix.arch_extra }}

steps:
-
name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.1.0
-
name: "Fix ownership of repository"
run: chown -R root .
Expand Down Expand Up @@ -116,7 +119,7 @@ jobs:
-
name: Upload artifacts to job for later processing
if: github.event_name != 'pull_request'
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
name: tmp-binary-storage
path: '${{ matrix.bin_name }}*'
Expand All @@ -128,10 +131,10 @@ jobs:
steps:
-
name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v3.1.0
-
name: Get Binaries built in previous jobs
uses: actions/[email protected].0
uses: actions/[email protected].1
id: download
with:
name: tmp-binary-storage
Expand All @@ -142,10 +145,10 @@ jobs:
working-directory: ${{steps.download.outputs.download-path}}
-
name: Install SSH Key
uses: shimataro/ssh-key-action@v2.3.1
uses: benoitchantre/setup-ssh-authentication-action@1.0.0
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
private-key: ${{ secrets.SSH_KEY }}
known-hosts: ${{ secrets.KNOWN_HOSTS }}
-
name: Transfer Builds to Pi-hole server for pihole checkout
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
-
name: Checkout repository
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.1.0
-
name: Spell-Checking
uses: codespell-project/actions-codespell@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-back-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Syncing branches
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
uses: actions/checkout@v3.1.0
- name: Opening pull request
id: pull
uses: tretuna/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
cmake_minimum_required(VERSION 2.8.12)
project(PIHOLE_FTL C)

set(DNSMASQ_VERSION pi-hole-v2.87)
set(DNSMASQ_VERSION pi-hole-v2.88test3)

add_subdirectory(src)
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ FTLDNS (`pihole-FTL`) provides an interactive API and also generates statistics
- **Interactive**: our API can be used to interface with your projects
- **Insightful**: stats normally reserved inside of `dnsmasq` are made available so you can see what's really happening on your network


# Official documentation
## Official documentation

The official *FTL*DNS documentation can be found [here](https://docs.pi-hole.net/ftldns/).

# Installation
## Installation

FTLDNS (`pihole-FTL`) is installed by default when you choose to enable the Web interface when installing Pi-hole.
FTLDNS (`pihole-FTL`) is automatically installed when installing Pi-hole.

> IMPORTANT!
### IMPORTANT

>FTLDNS will _disable_ any existing installations of `dnsmasq`. This is because FTLDNS _is_ `dnsmasq` + Pi-hole's code, so both cannot run simultaneously.
>FTLDNS will *disable* any existing installations of `dnsmasq`. This is because FTLDNS *is* `dnsmasq` + Pi-hole's code, so both cannot run simultaneously.
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,22 @@ else()
message(STATUS "Building FTL with readline support: NO")
endif()

# Do we want to compile an all-in FTL version?
if($ENV{CI_ARCH} STREQUAL "x86_64_full")
add_definitions(-DDNSMASQ_ALL_OPTS)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
find_package(DBus REQUIRED)
# Use results of find_package() call.
include_directories(${DBUS_INCLUDE_DIRS})
target_link_libraries(pihole-FTL ${DBUS_LIBRARIES})
find_library(LIBMNL mnl)
find_library(LIBNFTNL nftnl)
find_library(LIBNFTABLES nftables)
find_library(LIBNFNETLINK nfnetlink)
find_library(LIBNETFILTER_CONNTRACK netfilter_conntrack)
target_link_libraries(pihole-FTL ${LIBMNL} ${LIBNFTABLES} ${LIBNFTNL} ${LIBNFNETLINK} ${LIBNETFILTER_CONNTRACK})
endif()

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
endif()
Expand Down
59 changes: 59 additions & 0 deletions src/FindDBus.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# - Try to find DBus
# Once done, this will define
#
# DBUS_FOUND - system has DBus
# DBUS_INCLUDE_DIRS - the DBus include directories
# DBUS_LIBRARIES - link these to use DBus
#
# Copyright (C) 2012 Raphael Kubo da Costa <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1)

FIND_LIBRARY(DBUS_LIBRARIES
NAMES dbus-1
HINTS ${PC_DBUS_LIBDIR}
${PC_DBUS_LIBRARY_DIRS}
)

FIND_PATH(DBUS_INCLUDE_DIR
NAMES dbus/dbus.h
HINTS ${PC_DBUS_INCLUDEDIR}
${PC_DBUS_INCLUDE_DIRS}
)

GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH)
FIND_PATH(DBUS_ARCH_INCLUDE_DIR
NAMES dbus/dbus-arch-deps.h
HINTS ${PC_DBUS_INCLUDEDIR}
${PC_DBUS_INCLUDE_DIRS}
${_DBUS_LIBRARY_DIR}
${DBUS_INCLUDE_DIR}
PATH_SUFFIXES include
)

SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
2 changes: 1 addition & 1 deletion src/api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ static bool listInterfaces(struct if_info **head, char default_iface[IF_NAMESIZE
while ((dp = readdir(dfd)) != NULL)
{
// Skip "." and ".."
if(!dp->d_name || strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
if(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
continue;

// Create new interface record
Expand Down
24 changes: 17 additions & 7 deletions src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
#include "dnsmasq/dnsmasq.h"
#undef __USE_XOPEN

#include <nettle/bignum.h>
#if !defined(NETTLE_VERSION_MAJOR)
# define NETTLE_VERSION_MAJOR 2
# define NETTLE_VERSION_MINOR 0
#endif

#include "FTL.h"
#include "args.h"
#include "version.h"
Expand Down Expand Up @@ -258,6 +264,10 @@ void parse_args(int argc, char* argv[])
printf("\n");
printf("******************************** LUA ********************************\n");
printf(LUA_COPYRIGHT"\n");
printf("\n");
printf("***************************** LIBNETTLE *****************************\n");
printf("Version: %d.%d\n", NETTLE_VERSION_MAJOR, NETTLE_VERSION_MINOR);
printf("GMP: %s\n", NETTLE_USE_MINI_GMP ? "Mini" : "Full");
exit(EXIT_SUCCESS);
}

Expand Down Expand Up @@ -403,26 +413,26 @@ void parse_args(int argc, char* argv[])
#define COL_PURPLE "\x1b[95m" // bright foreground color
#define COL_CYAN "\x1b[96m" // bright foreground color

static inline bool __attribute__ ((const)) is_term(void)
static inline bool __attribute__ ((pure)) is_term(void)
{
// test whether STDOUT refers to a terminal
return isatty(fileno(stdout)) == 1;
}

// Returns green [✓]
const char __attribute__ ((const)) *cli_tick(void)
const char __attribute__ ((pure)) *cli_tick(void)
{
return is_term() ? "["COL_GREEN"✓"COL_NC"]" : "[✓]";
}

// Returns red [✗]
const char __attribute__ ((const)) *cli_cross(void)
const char __attribute__ ((pure)) *cli_cross(void)
{
return is_term() ? "["COL_RED"✗"COL_NC"]" : "[✗]";
}

// Returns [i]
const char __attribute__ ((const)) *cli_info(void)
const char __attribute__ ((pure)) *cli_info(void)
{
return is_term() ? COL_BOLD"[i]"COL_NC : "[i]";
}
Expand All @@ -434,19 +444,19 @@ const char __attribute__ ((const)) *cli_qst(void)
}

// Returns green "done!""
const char __attribute__ ((const)) *cli_done(void)
const char __attribute__ ((pure)) *cli_done(void)
{
return is_term() ? COL_GREEN"done!"COL_NC : "done!";
}

// Sets font to bold
const char __attribute__ ((const)) *cli_bold(void)
const char __attribute__ ((pure)) *cli_bold(void)
{
return is_term() ? COL_BOLD : "";
}

// Resets font to normal
const char __attribute__ ((const)) *cli_normal(void)
const char __attribute__ ((pure)) *cli_normal(void)
{
return is_term() ? COL_NC : "";
}
12 changes: 6 additions & 6 deletions src/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ extern bool daemonmode, cli_mode, dnsmasq_debug;
extern int argc_dnsmasq;
extern const char ** argv_dnsmasq;

const char *cli_tick(void) __attribute__ ((const));
const char *cli_cross(void) __attribute__ ((const));
const char *cli_info(void) __attribute__ ((const));
const char *cli_tick(void) __attribute__ ((pure));
const char *cli_cross(void) __attribute__ ((pure));
const char *cli_info(void) __attribute__ ((pure));
const char *cli_qst(void) __attribute__ ((const));
const char *cli_done(void) __attribute__ ((const));
const char *cli_bold(void) __attribute__ ((const));
const char *cli_normal(void) __attribute__ ((const));
const char *cli_done(void) __attribute__ ((pure));
const char *cli_bold(void) __attribute__ ((pure));
const char *cli_normal(void) __attribute__ ((pure));

// defined in dnsmasq_interface.c
int check_struct_sizes(void);
Expand Down
Loading

0 comments on commit 6075a70

Please sign in to comment.