Skip to content

Commit

Permalink
Merge pull request #1439 from pi-hole/development
Browse files Browse the repository at this point in the history
FTL v5.18.1
  • Loading branch information
PromoFaux authored Sep 19, 2022
2 parents f95464d + 1ae0ddc commit 4c8abe6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ updates:
target-branch: development
reviewers:
- "pi-hole/ftl-maintainers"
pull-request-branch-name:
# Separate sections of the branch name with a hyphen
separator: "-"
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ on:
push:
branches:
- '**'
- '!dependabot/**'
pull_request:
branches-ignore:
- 'dependabot/**'
release:
types: [published]

Expand Down
21 changes: 20 additions & 1 deletion src/dnsmasq_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,29 @@ void FTL_hook(unsigned int flags, const char *name, union all_addr *addr, char *
// derive the real query type from the arg string
unsigned short qtype = type;
if(strcmp(arg, "dnssec-query[DNSKEY]") == 0)
{
qtype = T_DNSKEY;
arg = (char*)"dnssec-query";
}
else if(strcmp(arg, "dnssec-query[DS]") == 0)
{
qtype = T_DS;
arg = (char*)"dnssec-query";
arg = (char*)"dnssec-query";
}
else if(strcmp(arg, "dnssec-retry[DNSKEY]") == 0)
{
qtype = T_DNSKEY;
arg = (char*)"dnssec-retry";
}
else if(strcmp(arg, "dnssec-retry[DS]") == 0)
{
qtype = T_DS;
arg = (char*)"dnssec-retry";
}
else
{
arg = (char*)"dnssec-unknown";
}

_FTL_new_query(flags, name, NULL, arg, qtype, id, &edns, INTERNAL, file, line);
// forwarded upstream (type is used to store the upstream port)
Expand Down
20 changes: 14 additions & 6 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ time_t get_rate_limit_turnaround(const unsigned int rate_limit_count)
return (time_t)config.rate_limit.interval*how_often - (time(NULL) - lastRateLimitCleaner);
}

static void check_space(const char *file)
static int check_space(const char *file, int LastUsage)
{
if(config.check.disk == 0)
return;
return 0;

int perc = 0;
char buffer[64] = { 0 };
// Warn if space usage at the device holding the corresponding file
// exceeds the configured threshold
if((perc = get_filepath_usage(file, buffer)) > config.check.disk)
// exceeds the configured threshold and current usage is higher than
// usage in the last run (to prevent log spam)
perc = get_filepath_usage(file, buffer);
if(perc > config.check.disk && perc > LastUsage )
log_resource_shortage(-1.0, 0, -1, perc, file, buffer);

return perc;
}

static void check_load(void)
Expand Down Expand Up @@ -118,6 +122,10 @@ void *GC_thread(void *val)
lastRateLimitCleaner = time(NULL);
time_t lastResourceCheck = 0;

// Remember disk usage
int LastLogStorageUsage = 0;
int LastDBStorageUsage = 0;

// Run as long as this thread is not canceled
while(!killed)
{
Expand All @@ -138,8 +146,8 @@ void *GC_thread(void *val)
if(now - lastResourceCheck >= RCinterval)
{
check_load();
check_space(FTLfiles.FTL_db);
check_space(FTLfiles.log);
LastDBStorageUsage = check_space(FTLfiles.FTL_db, LastDBStorageUsage);
LastLogStorageUsage = check_space(FTLfiles.log, LastLogStorageUsage);
lastResourceCheck = now;
}

Expand Down

0 comments on commit 4c8abe6

Please sign in to comment.