Skip to content

Commit a82bb36

Browse files
authored
Merge pull request pi-hole#2673 from pi-hole/development
FTL 6.3.1
2 parents e36bf6d + 23436f0 commit a82bb36

13 files changed

Lines changed: 76 additions & 46 deletions

File tree

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
sha1sum pihole-FTL-* > ${{ matrix.bin_name }}.sha1
170170
-
171171
name: Upload pihole-FTL binary
172-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
172+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0
173173
with:
174174
name: ${{ matrix.bin_name }}-binary
175175
path: '${{ matrix.bin_name }}*'
@@ -184,21 +184,21 @@ jobs:
184184
-
185185
name: Upload documentation files
186186
if: matrix.bin_name == 'pihole-FTL-amd64'
187-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
187+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0
188188
with:
189189
name: pihole-api-docs
190190
path: 'api-docs.tar.gz'
191191
-
192192
name: Upload pihole.toml template
193193
if: matrix.bin_name == 'pihole-FTL-amd64'
194-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
194+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0
195195
with:
196196
name: pihole-toml
197197
path: 'pihole.toml'
198198
-
199199
name: Get binaries built in previous jobs
200200
if: env.DO_DEPLOY == 'true'
201-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
201+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 #v6.0.0
202202
id: download
203203
with:
204204
path: ftl_builds/
@@ -207,14 +207,14 @@ jobs:
207207
-
208208
name: Get documentation files built in previous jobs
209209
if: env.DO_DEPLOY == 'true' && matrix.bin_name == 'pihole-FTL-amd64'
210-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
210+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 #v6.0.0
211211
with:
212212
path: ftl_builds/
213213
name: pihole-api-docs
214214
-
215215
name: Get pihole.toml built in previous job
216216
if: env.DO_DEPLOY == 'true' && matrix.bin_name == 'pihole-FTL-amd64'
217-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
217+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 #v6.0.0
218218
with:
219219
path: ftl_builds/
220220
name: pihole-toml
@@ -267,6 +267,7 @@ jobs:
267267
if: github.event_name == 'release'
268268
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 #v2.4.1
269269
with:
270+
tag_name: ${{ github.event.release.tag_name }}
270271
files: |
271272
ftl_builds/*
272273
-

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
8686
# Initializes the CodeQL tools for scanning.
8787
- name: Initialize CodeQL
88-
uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 #v4.30.9
88+
uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb #v4.31.0
8989
with:
9090
languages: ${{ matrix.language }}
9191
build-mode: ${{ matrix.build-mode }}
@@ -108,7 +108,7 @@ jobs:
108108
./build.sh
109109
110110
- name: Perform CodeQL Analysis
111-
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 #v4.30.9
111+
uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb #v4.31.0
112112
with:
113113
category: "/language:${{matrix.language}}"
114114
upload: failure-only # upload only in case of failure, otherwise upload later after filtering
@@ -134,13 +134,13 @@ jobs:
134134
output: codeql-results/cpp.sarif
135135

136136
- name: Upload SARIF
137-
uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 #v4.30.9
137+
uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb #v4.31.0
138138
with:
139139
sarif_file: codeql-results/cpp.sarif
140140

141141
- name: Upload CodeQL results as an artifact
142142
if: success() || failure()
143-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
143+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0
144144
with:
145145
name: codeql-results
146146
path: codeql-results

src/api/docs/content/specs/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ components:
553553
type: boolean
554554
normalizeCPU:
555555
type: boolean
556+
hide_dnsmasq_warn:
557+
type: boolean
556558
check:
557559
type: object
558560
properties:
@@ -837,6 +839,7 @@ components:
837839
extraLogging: false
838840
readOnly: false
839841
normalizeCPU: false
842+
hide_dnsmasq_warn: false
840843
check:
841844
load: true
842845
shmem: 90

src/api/info.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -907,29 +907,15 @@ int api_info_version(struct ftl_conn *api)
907907

908908
int api_info_messages_count(struct ftl_conn *api)
909909
{
910-
// Filtering based on GET parameters?
911-
bool filter_dnsmasq_warnings = false;
912-
if(api->request->query_string != NULL)
913-
{
914-
get_bool_var(api->request->query_string, "filter_dnsmasq_warnings", &filter_dnsmasq_warnings);
915-
}
916-
917910
// Send reply
918911
cJSON *json = JSON_NEW_OBJECT();
919-
cJSON_AddNumberToObject(json, "count", count_messages(filter_dnsmasq_warnings));
912+
cJSON_AddNumberToObject(json, "count", count_messages());
920913
JSON_SEND_OBJECT(json);
921914
return 0;
922915
}
923916

924917
static int api_info_messages_GET(struct ftl_conn *api)
925918
{
926-
// Filtering based on GET parameters?
927-
bool filter_dnsmasq_warnings = false;
928-
if(api->request->query_string != NULL)
929-
{
930-
get_bool_var(api->request->query_string, "filter_dnsmasq_warnings", &filter_dnsmasq_warnings);
931-
}
932-
933919
// Create messages array
934920
cJSON *messages = cJSON_CreateArray();
935921
if(!format_messages(messages))
@@ -943,7 +929,7 @@ static int api_info_messages_GET(struct ftl_conn *api)
943929
}
944930

945931
// Filter messages if requested
946-
if(filter_dnsmasq_warnings)
932+
if(config.misc.hide_dnsmasq_warn.v.b)
947933
{
948934
// Create new array
949935
cJSON *filtered = cJSON_CreateArray();

src/config/config.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ void initConfig(struct config *conf)
742742

743743
conf->dns.reply.blocking.v6.k = "dns.reply.blocking.IPv6";
744744
conf->dns.reply.blocking.v6.h = "Custom IPv6 address for IP blocking mode";
745-
conf->dns.reply.blocking.v6.a = cJSON_CreateStringReference("Avalid IPv6 address or empty string (\"\")");
745+
conf->dns.reply.blocking.v6.a = cJSON_CreateStringReference("A valid IPv6 address or empty string (\"\")");
746746
conf->dns.reply.blocking.v6.t = CONF_STRUCT_IN6_ADDR;
747747
memset(&conf->dns.reply.blocking.v6.d.in6_addr, 0, sizeof(struct in6_addr));
748748
conf->dns.reply.blocking.v6.c = validate_stub; // Only type-based checking
@@ -1184,7 +1184,7 @@ void initConfig(struct config *conf)
11841184

11851185
conf->webserver.api.password.k = "webserver.api.password";
11861186
conf->webserver.api.password.h = "Pi-hole web interface and API password. When set to something different than \""PASSWORD_VALUE"\", this property will compute the corresponding password hash to set webserver.api.pwhash";
1187-
conf->webserver.api.password.a = cJSON_CreateStringReference("Avalid Pi-hole password");
1187+
conf->webserver.api.password.a = cJSON_CreateStringReference("A valid Pi-hole password");
11881188
conf->webserver.api.password.t = CONF_PASSWORD;
11891189
conf->webserver.api.password.f = FLAG_PSEUDO_ITEM | FLAG_INVALIDATE_SESSIONS;
11901190
conf->webserver.api.password.d.s = (char*)"";
@@ -1422,6 +1422,12 @@ void initConfig(struct config *conf)
14221422
conf->misc.normalizeCPU.d.b = true;
14231423
conf->misc.normalizeCPU.c = validate_stub; // Only type-based checking
14241424

1425+
conf->misc.hide_dnsmasq_warn.k = "misc.hide_dnsmasq_warn";
1426+
conf->misc.hide_dnsmasq_warn.h = "Should FTL hide warnings coming from dnsmasq?\n\n By default, FTL reports warnings coming from the embedded dnsmasq DNS server to the FTL log file. These warnings can be useful to identify misconfigurations or problems with the DNS server. However, some warnings may be harmless and can be ignored in certain setups. Enabling this setting will hide all dnsmasq warnings.";
1427+
conf->misc.hide_dnsmasq_warn.t = CONF_BOOL;
1428+
conf->misc.hide_dnsmasq_warn.d.b = false;
1429+
conf->misc.hide_dnsmasq_warn.c = validate_stub; // Only type-based checking
1430+
14251431
// sub-struct misc.check
14261432
conf->misc.check.load.k = "misc.check.load";
14271433
conf->misc.check.load.h = "Pi-hole is very lightweight on resources. Nevertheless, this does not mean that you should run Pi-hole on a server that is otherwise extremely busy as queuing on the system can lead to unnecessary delays in DNS operation as the system becomes less and less usable as the system load increases because all resources are permanently in use. To account for this, FTL regularly checks the system load. To bring this to your attention, FTL warns about excessive load when the 15 minute system load average exceeds the number of cores.\n\n This check can be disabled with this setting.";

src/config/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ struct config {
317317
struct conf_item extraLogging;
318318
struct conf_item readOnly;
319319
struct conf_item normalizeCPU;
320+
struct conf_item hide_dnsmasq_warn;
320321
struct {
321322
struct conf_item load;
322323
struct conf_item shmem;

src/database/message-table.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ static void format_gravity_restored_message(char *plain, const int sizeof_plain,
10131013
}
10141014
}
10151015

1016-
int count_messages(const bool filter_dnsmasq_warnings)
1016+
int count_messages(void)
10171017
{
10181018
int count = 0;
10191019

@@ -1030,7 +1030,9 @@ int count_messages(const bool filter_dnsmasq_warnings)
10301030

10311031
// Get message
10321032
sqlite3_stmt* stmt = NULL;
1033-
const char *querystr = filter_dnsmasq_warnings ? "SELECT COUNT(*) FROM message WHERE type != 'DNSMASQ_WARN'" : "SELECT COUNT(*) FROM message";
1033+
const char *querystr = config.misc.hide_dnsmasq_warn.v.b ?
1034+
"SELECT COUNT(*) FROM message WHERE type != 'DNSMASQ_WARN'" :
1035+
"SELECT COUNT(*) FROM message";
10341036
int rc = sqlite3_prepare_v2(db, querystr, -1, &stmt, NULL);
10351037
if( rc != SQLITE_OK ){
10361038
log_err("count_messages() - SQL error prepare SELECT: %s",

src/database/message-table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "sqlite3.h"
1414
#include "webserver/cJSON/cJSON.h"
1515

16-
int count_messages(const bool filter_dnsmasq_warnings);
16+
int count_messages(void);
1717
bool format_messages(cJSON *array);
1818
bool create_message_table(sqlite3 *db);
1919
bool delete_message(cJSON *ids, int *deleted);

src/enums.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ enum cert_check {
335335
CERT_NOT_YET_VALID,
336336
CERT_EXPIRES_SOON,
337337
CERT_OKAY,
338+
CERT_NOT_IN_USE
338339
} __attribute__ ((packed));
339340

340341
enum http_method {

src/lua/ftl_lua.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,25 +269,41 @@ static int pihole_format_path(lua_State *L) {
269269
// Get current page (first argument to LUA function)
270270
const char *page = luaL_checkstring(L, 1);
271271

272-
// Strip leading webhome from page (if it exists)
272+
// Duplicate string to modify it
273+
char *page_copy = strdup(page);
274+
if (page_copy == NULL)
275+
{
276+
// Memory allocation error
277+
lua_pushnil(L);
278+
return 1; // number of results
279+
}
280+
281+
// Strip leading webhome from page_copy (if it exists)
273282
if (config.webserver.paths.webhome.v.s != NULL)
274283
{
275284
const size_t webhome_len = strlen(config.webserver.paths.webhome.v.s);
276-
if (strncmp(page, config.webserver.paths.webhome.v.s, webhome_len) == 0)
277-
page += webhome_len;
285+
if (strncmp(page_copy, config.webserver.paths.webhome.v.s, webhome_len) == 0)
286+
page_copy += webhome_len;
278287
}
279288

280289
// Convert all / to -
281-
for (char *p = (char *)page; *p != '\0'; p++)
290+
for (char *p = (char *)page_copy; *p != '\0'; p++)
282291
if (*p == '/')
283292
*p = '-';
284293

285-
// Substitute "index" for empty string (dashboard landing page)
286-
if (page[0] == '\0')
287-
page = "index";
294+
if (page_copy[0] == '\0')
295+
{
296+
// Substitute "index" for empty string (dashboard landing page)
297+
lua_pushstring(L, "index");
298+
}
299+
else
300+
{
301+
// Return the formatted page string
302+
lua_pushstring(L, page_copy);
303+
}
288304

289-
// Return the formatted page string
290-
lua_pushstring(L, page);
305+
// Free allocated memory
306+
free(page_copy);
291307

292308
return 1; // number of results
293309
}

0 commit comments

Comments
 (0)