Fix some spellings, ignore others

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2022-04-22 18:25:49 +01:00
parent c82b52a9a3
commit 671a438c4d
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173
31 changed files with 71 additions and 67 deletions

View File

@ -0,0 +1,4 @@
ede
edn
nd
tre

View File

@ -111,7 +111,7 @@
#define NUM_RECHECKS 3
// Use out own syscalls handling functions that will detect possible errors
// and report accordingly in the log. This will make debugging FTL crashs
// and report accordingly in the log. This will make debugging FTL crash
// caused by insufficient memory or by code bugs (not properly dealing
// with NULL pointers) much easier.
#undef strdup // strdup() is a macro in itself, it needs special handling

View File

@ -46,7 +46,7 @@ extern char *querystr(char *desc, unsigned short type);
#define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
/* qsort comparision function (count field), sort ASC */
/* qsort comparison function (count field), sort ASC */
static int __attribute__((pure)) cmpasc(const void *a, const void *b)
{
const int *elem1 = (int*)a;
@ -551,7 +551,7 @@ void getUpstreamDestinations(const char *client_message, const int *sock)
name = ip;
if(totalqueries > 0)
// Whats the percentage of blocked queries on the total amount of queries?
// What's the percentage of blocked queries on the total amount of queries?
percentage = 1e2f * blocked / totalqueries;
}
else if(i == -2)
@ -561,7 +561,7 @@ void getUpstreamDestinations(const char *client_message, const int *sock)
name = ip;
if(totalqueries > 0)
// Whats the percentage of cached queries on the total amount of queries?
// What's the percentage of cached queries on the total amount of queries?
percentage = 1e2f * cached / totalqueries;
}
else if(i == -1)
@ -571,7 +571,7 @@ void getUpstreamDestinations(const char *client_message, const int *sock)
name = ip;
if(totalqueries > 0)
// Whats the percentage of cached queries on the total amount of queries?
// What's the percentage of cached queries on the total amount of queries?
percentage = 1e2f * others / totalqueries;
}
else
@ -1165,7 +1165,7 @@ void getRecentBlocked(const char *client_message, const int *sock)
else if(!pack_str32(*sock, domain))
return;
// Only count when sent succesfully
// Only count when sent successfully
found++;
}
@ -1238,12 +1238,12 @@ void getDBstats(const int *sock)
unsigned long long int filesize = get_FTL_db_filesize();
char prefix[2] = { 0 };
double formated = 0.0;
format_memory_size(prefix, filesize, &formated);
double formatted = 0.0;
format_memory_size(prefix, filesize, &formatted);
if(istelnet[*sock])
ssend(*sock, "queries in database: %i\ndatabase filesize: %.2f %sB\nSQLite version: %s\n",
get_number_of_queries_in_DB(NULL), formated, prefix, get_sqlite3_version());
get_number_of_queries_in_DB(NULL), formatted, prefix, get_sqlite3_version());
else {
pack_int32(*sock, get_number_of_queries_in_DB(NULL));
pack_int64(*sock, filesize);

View File

@ -214,7 +214,7 @@ static void terminate_threads(void)
if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
{
logg("Thread %s (%d) is busy, cancelling it (cannot set timout).",
logg("Thread %s (%d) is busy, cancelling it (cannot set timeout).",
thread_names[i], i);
pthread_cancel(threads[i]);
continue;

View File

@ -659,7 +659,7 @@ static bool get_client_groupids(clientsData* client)
}
// We use the default group and return early here
// if aboves lookups didn't return any results
// if above lookups didn't return any results
// (the client is not configured through the client table)
if(chosen_match_id < 0)
{
@ -1160,7 +1160,7 @@ static enum db_result domain_in_list(const char *domain, sqlite3_stmt *stmt, con
// Bind domain to prepared statement
// SQLITE_STATIC: Use the string without first duplicating it internally.
// We can do this as domain has dynamic scope that exceeds that of the binding.
// We need to bind the domain onl once even to the prepared audit statement as:
// We need to bind the domain only once even to the prepared audit statement as:
// When the same named SQL parameter is used more than once, second and
// subsequent occurrences have the same index as the first occurrence.
// (https://www.sqlite.org/c3ref/bind_blob.html)

View File

@ -1256,7 +1256,7 @@ void parse_neighbor_cache(sqlite3* db)
else
text = "ERROR";
// dbquery() above already logs the reson for why the query failed
// dbquery() above already logs the reason for why the query failed
logg("%s: Storing devices in network table (\"%s\") failed", text, sql);
pclose(arpfp);
return;
@ -1448,7 +1448,7 @@ void parse_neighbor_cache(sqlite3* db)
unmock_netDB_device(db, hwaddr, macVendor, dbID);
// Host name, count and last query timestamp will be set in the next
// loop interation for the sake of simplicity
// loop iteration for the sake of simplicity
}
// Free allocated memory
@ -1545,7 +1545,7 @@ void parse_neighbor_cache(sqlite3* db)
// Finally, loop over the available interfaces to ensure we list the
// IP addresses correctly (local addresses are NOT contained in the
// ARP/neighor cache).
// ARP/neighbor cache).
if(!add_local_interfaces_to_network_table(db, now, &additional_entries))
return;

View File

@ -486,7 +486,7 @@ int DB_save_queries(sqlite3 *db)
return DB_FAILED;
}
// Store index for next loop interation round and update last time stamp
// Store index for next loop iteration round and update last time stamp
// in the database only if all queries have been saved successfully
if(saved > 0 && !error)
{
@ -935,7 +935,7 @@ void DB_read_queries(void)
}
else if(status == QUERY_REGEX)
{
// QUERY_REGEX: Set ID regex which was the reson for blocking
// QUERY_REGEX: Set ID regex which was the reason for blocking
const int cacheID = findCacheID(query->domainID, query->clientID, query->type);
DNSCacheData *cache = getDNSCache(cacheID, true);
// Only load if

View File

@ -302,7 +302,7 @@ void change_clientcount(clientsData *client, int total, int blocked, int overTim
if(overTimeIdx > -1 && overTimeIdx < OVERTIME_SLOTS)
client->overTime[overTimeIdx] += overTimeMod;
// Also add counts to the conencted alias-client (if any)
// Also add counts to the connected alias-client (if any)
if(client->flags.aliasclient)
{
logg("WARN: Should not add to alias-client directly (client \"%s\" (%s))!",

View File

@ -438,7 +438,7 @@ static void print_dhcp_offer(struct in_addr source, dhcp_packet_data *offer_pack
unsigned int n = 0;
for(unsigned int i = 1; n < optlen; i++)
{
// Extract destionation descriptor
// Extract destination descriptor
unsigned char cidr = offer_packet->options[x+n++];
unsigned char addr[4] = { 0 };
if(cidr > 0)

View File

@ -841,7 +841,7 @@ void _FTL_iface(struct irec *recviface, const union all_addr *addr, const sa_fam
next_iface.name[0] = '-';
next_iface.name[1] = '\0';
// Check if we need to identify the receving interface by its address
// Check if we need to identify the receiving interface by its address
if(!recviface && addr &&
((addrfamily == AF_INET && addr->addr4.s_addr != INADDR_ANY) ||
(addrfamily == AF_INET6 && !IN6_IS_ADDR_UNSPECIFIED(&addr->addr6))))
@ -1723,7 +1723,7 @@ static void FTL_forwarded(const unsigned int flags, const char *name, const unio
// up in a situation where dnsmasq can answer the first level of
// the DNS result (the CNAME) from cache, hence the status of this
// query is marked as "answered from cache" in FTLDNS. However, for
// server.a.com wit the much shorter TTL, we still have to forward
// server.a.com with the much shorter TTL, we still have to forward
// something and ask the upstream server for the final IP address.
// Correct reply timer if a response time has already been calculated
@ -1948,7 +1948,7 @@ static void FTL_reply(const unsigned int flags, const char *name, const union al
}
else if(rcode == SERVFAIL)
{
// This happens on upstream destionation errors
// This happens on upstream destination errors
answer = "SERVFAIL";
}
}
@ -2071,7 +2071,7 @@ static void FTL_reply(const unsigned int flags, const char *name, const union al
// Answered from local configuration, might be a wildcard or user-provided
// Answered from a custom (user provided) cache file or because
// we're the authorative DNS server (e.g. DHCP server and this
// we're the authoritative DNS server (e.g. DHCP server and this
// is our own domain)
query_set_status(query, QUERY_CACHE);
@ -2771,7 +2771,7 @@ void FTL_fork_and_bind_sockets(struct passwd *ent_pw)
// Add our PTR record to the end of the linked list
if(daemon->ptr != NULL)
{
// Interate to the last PTR entry in dnsmasq's structure
// Iterate to the last PTR entry in dnsmasq's structure
struct ptr_record *ptr;
for(ptr = daemon->ptr; ptr && ptr->next; ptr = ptr->next);

View File

@ -26,7 +26,7 @@ static const char *eventtext(const enum events event);
static volatile atomic_flag eventqueue[EVENTS_MAX] = { ATOMIC_FLAG_INIT };
// Set/Request event
// We set the events atomically to ensure no race collisons can happen. If an
// We set the events atomically to ensure no race collisions can happen. If an
// event has already been requested, this has no consequences as event cannot be
// added multiple times
void _set_event(const enum events event, int line, const char *function, const char *file)

View File

@ -138,11 +138,11 @@ void ls_dir(const char* path)
st.st_mode & S_IXOTH ? "x":"-");
char prefix[2] = { 0 };
double formated = 0.0;
format_memory_size(prefix, (unsigned long long)st.st_size, &formated);
double formatted = 0.0;
format_memory_size(prefix, (unsigned long long)st.st_size, &formatted);
// Log output for this file
logg("%s %-15s %3.0f%s %s", permissions, usergroup, formated, prefix, filename);
logg("%s %-15s %3.0f%s %s", permissions, usergroup, formatted, prefix, filename);
}
logg("---------------------------------------------------");
@ -171,17 +171,17 @@ int get_path_usage(const char *path, char buffer[64])
// Create human-readable total size
char prefix_size[2] = { 0 };
double formated_size = 0.0;
format_memory_size(prefix_size, size, &formated_size);
double formatted_size = 0.0;
format_memory_size(prefix_size, size, &formatted_size);
// Generate human-readable "total used" size
char prefix_used[2] = { 0 };
double formated_used = 0.0;
format_memory_size(prefix_used, used, &formated_used);
double formatted_used = 0.0;
format_memory_size(prefix_used, used, &formatted_used);
// Print result into buffer passed to this subroutine
snprintf(buffer, 64, "%s: %.1f%sB used, %.1f%sB total", path,
formated_used, prefix_used, formated_size, prefix_size);
formatted_used, prefix_used, formatted_size, prefix_size);
// Return percentage of used shared memory
// Adding 1 avoids FPE if the size turns out to be zero

View File

@ -96,7 +96,7 @@ void _FTL_log(const bool newline, const bool debug, const char *format, ...)
char idstr[42];
const int pid = getpid(); // Get the process ID of the calling process
const int mpid = main_pid(); // Get the process ID of the main FTL process
const int tid = gettid(); // Get the thread ID of the callig process
const int tid = gettid(); // Get the thread ID of the calling process
// There are four cases we have to differentiate here:
if(pid == tid)
@ -197,16 +197,16 @@ void FTL_log_helper(const unsigned char n, ...)
}
void format_memory_size(char prefix[2], const unsigned long long int bytes,
double * const formated)
double * const formatted)
{
unsigned int i;
*formated = bytes;
*formatted = bytes;
// Determine exponent for human-readable display
for(i = 0; i < 7; i++)
{
if(*formated <= 1e3)
if(*formatted <= 1e3)
break;
*formated /= 1e3;
*formatted /= 1e3;
}
const char prefixes[8] = { ' ', 'K', 'M', 'G', 'T', 'P', 'E', '?' };
// Chose matching SI prefix
@ -345,7 +345,7 @@ const char __attribute__ ((const)) *get_ordinal_suffix(unsigned int number)
// For example: 2nd, 7th, 20th, 23rd, 52nd, 135th, 301st BUT 311th (covered above)
}
// Converts a buffer of specified lenth to ASCII representation as it was a C
// Converts a buffer of specified length to ASCII representation as it was a C
// string literal. Returns how much bytes from source was processed
// Inspired by https://stackoverflow.com/a/56123950
int binbuf_to_escaped_C_literal(const char *src_buf, size_t src_sz,

View File

@ -16,7 +16,7 @@
void init_FTL_log(void);
void log_counter_info(void);
void format_memory_size(char prefix[2], unsigned long long int bytes,
double * const formated);
double * const formatted);
void format_time(char buffer[42], unsigned long seconds, double milliseconds);
const char *get_FTL_version(void) __attribute__ ((malloc));
void log_FTL_version(bool crashreport);

View File

@ -196,11 +196,11 @@ bool insetupVarsArray(const char * str)
if(setupVarsArray[i][0] == '*')
{
// Copying strlen-1 chars into buffer of size strlen: OK
size_t lenght = strlen(setupVarsArray[i]);
char * domain = calloc(lenght, sizeof(char));
size_t length = strlen(setupVarsArray[i]);
char * domain = calloc(length, sizeof(char));
if(domain == NULL) return false;
// strncat() NULL-terminates the copied string (strncpy() doesn't!)
strncat(domain, setupVarsArray[i]+1, lenght-1);
strncat(domain, setupVarsArray[i]+1, length-1);
if(strstr(str, domain) != NULL)
{

View File

@ -117,12 +117,12 @@ static int get_dev_shm_usage(char buffer[64])
// Generate human-readable "used by FTL" size
char prefix_FTL[2] = { 0 };
double formated_FTL = 0.0;
format_memory_size(prefix_FTL, used_shmem, &formated_FTL);
double formatted_FTL = 0.0;
format_memory_size(prefix_FTL, used_shmem, &formatted_FTL);
// Print result into buffer passed to this subroutine
snprintf(buffer, 64, "%s, FTL uses %.1f%sB",
buffer2, formated_FTL, prefix_FTL);
buffer2, formatted_FTL, prefix_FTL);
// Return percentage
return percentage;
@ -561,14 +561,14 @@ bool init_shmem(bool create_new)
return true;
}
// CHOWN all shared memory objects to suppplied user/group
// CHOWN all shared memory objects to supplied user/group
void chown_all_shmem(struct passwd *ent_pw)
{
for(unsigned int i = 0; i < NUM_SHMEM; i++)
chown_shmem(sharedMemories[i], ent_pw);
}
// Destory mutex and, subsequently, delete all shared memory objects
// Destroy mutex and, subsequently, delete all shared memory objects
void destroy_shmem(void)
{
// First, we destroy the mutex

View File

@ -51,7 +51,7 @@ static void print_addr2line(const char *symbol, const void *address, const int j
if(strstr(symbol, BINARY_NAME) == NULL)
return;
// Find first occurence of '(' or ' ' in the obtaned symbol string and
// Find first occurrence of '(' or ' ' in the obtaned symbol string and
// assume everything before that is the file name. (Don't go beyond the
// string terminator \0)
int p = 0;
@ -185,7 +185,7 @@ static void __attribute__((noreturn)) signal_handler(int sig, siginfo_t *si, voi
switch (si->si_code)
{
case BUS_ADRALN: logg(" with code: BUS_ADRALN (Invalid address alignment)"); break;
case BUS_ADRERR: logg(" with code: BUS_ADRERR (Non-existant physical address)"); break;
case BUS_ADRERR: logg(" with code: BUS_ADRERR (Non-existent physical address)"); break;
case BUS_OBJERR: logg(" with code: BUS_OBJERR (Object specific hardware error)"); break;
case BUS_MCEERR_AR: logg(" with code: BUS_MCEERR_AR (Hardware memory error: action required)"); break;
case BUS_MCEERR_AO: logg(" with code: BUS_MCEERR_AO (Hardware memory error: action optional)"); break;

View File

@ -26,7 +26,7 @@ int FTLaccept(int sockfd, struct sockaddr *addr, socklen_t *addrlen, const char
// incoming signal
while(ret < 0 && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret < 0)
logg("WARN: Could not accept() in %s() (%s:%i): %s",

View File

@ -28,9 +28,9 @@ FILE *FTLfopen(const char *pathname, const char *mode, const char *file, const c
// incoming signal
while(file_ptr == NULL && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
// The already_writing coutner prevents a possible infinite loop
// The already_writing counter prevents a possible infinite loop
if(file_ptr == NULL && (already_writing++) == 1)
logg("WARN: Could not fopen(\"%s\", \"%s\") in %s() (%s:%i): %s",
pathname, mode, func, file, line, strerror(errno));

View File

@ -27,7 +27,7 @@ int FTLfallocate(const int fd, const off_t offset, const off_t len, const char *
// interruption by an incoming signal
while(ret == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret > 0)
logg("WARN: Could not fallocate() in %s() (%s:%i): %s",

View File

@ -28,7 +28,7 @@ int FTLpthread_mutex_lock(pthread_mutex_t *__mutex, const char *file, const char
// incoming signal
while(ret < 0 && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret < 0)
logg("WARN: Could not pthread_mutex_lock() in %s() (%s:%i): %s",

View File

@ -28,7 +28,7 @@ ssize_t FTLrecv(int sockfd, void *buf, size_t len, int flags, const char *file,
// incoming signal
while(ret < 0 && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret < 0)
logg("WARN: Could not recv() in %s() (%s:%i): %s",

View File

@ -29,7 +29,7 @@ ssize_t FTLrecvfrom(int sockfd, void *buf, size_t len, int flags, struct sockadd
// incoming signal
while(ret < 0 && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret < 0)
logg("WARN: Could not recvfrom() in %s() (%s:%i): %s",

View File

@ -28,7 +28,7 @@ int FTLselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, st
// incoming signal
while(ret < 0 && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret < 0)
logg("WARN: Could not select() in %s() (%s:%i): %s",

View File

@ -29,7 +29,7 @@ ssize_t FTLsendto(int sockfd, void *buf, size_t len, int flags, const struct soc
// incoming signal
while(ret < 0 && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(ret < 0)
logg("WARN: Could not sendto() in %s() (%s:%i): %s",

View File

@ -152,7 +152,7 @@ int FTLvfprintf(FILE *stream, const char *file, const char *func, const int line
// to an interruption by an incoming signal
while(_buffer < buffer && errno == EINTR);
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(_buffer < buffer)
{

View File

@ -36,7 +36,7 @@ ssize_t FTLwrite(int fd, const void *buf, size_t total, const char *file, const
// (b) the last write() call failed due to an interruption by an incoming signal
while((written < total && errno == 0) || (ret < 0 && errno == EINTR));
// Final error checking (may have faild for some other reason then an
// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call)
if(written < total)
logg("WARN: Could not write() everything in %s() [%s:%i]: %s",

View File

@ -56,7 +56,7 @@ check_FP_arch() {
check_file() {
filedetails="$(file -b pihole-FTL | sed "s/, BuildID[^,]*//g")"
if [[ "${filedetails}" != "${1}" ]]; then
echo "Wrong binary clasification"
echo "Wrong binary classification"
echo "Expected: ${1}"
echo "Found: ${filedetails}"
exit 1

View File

@ -6,14 +6,14 @@ log-facility=/var/log/pihole.log
dnssec
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D
# Explicity specify the local powerDNS recursor as forward destination for .ftl
# Explicitly specify the local powerDNS recursor as forward destination for .ftl
# This ensures FTL knows that ftl. is a local zone for which no DNSSEC
# validation should be done. Otherwise, we'd get BOGUS for everything as the
# root servers would tell us that ftl. does not exist
server=/ftl/127.0.0.1#5555
# Send the HTTPS/SVCB queries to the authorative server without detour over the
# recursor because the latter returns SEVFAIL (connection between authorative
# Send the HTTPS/SVCB queries to the authoritative server without detour over the
# recursor because the latter returns SEVFAIL (connection between authoritative
# server and recursor is not encrypted)
server=/https.ftl/127.0.0.1#5554
server=/svcb.ftl/127.0.0.1#5554

View File

@ -2,7 +2,7 @@
# (c) 2021 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Pi-hole testing environment configuration (authorative server)
# Pi-hole testing environment configuration (authoritative server)
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.

View File

@ -10,5 +10,5 @@
# Local DNS address and port
local-address=127.0.0.1:5555
# Use authorative server for ftl. and arpa. zones
# Use authoritative server for ftl. and arpa. zones
forward-zones=ftl=127.0.0.1:5554,168.192.in-addr.arpa=127.0.0.1:5554,ip6.arpa=127.0.0.1:5554