mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Tidy error logging in 961daf8f92
This commit is contained in:
@@ -21,6 +21,7 @@ static struct frec *lookup_frec_by_query(void *hash, unsigned int flags);
|
|||||||
|
|
||||||
static unsigned short get_id(void);
|
static unsigned short get_id(void);
|
||||||
static void free_frec(struct frec *f);
|
static void free_frec(struct frec *f);
|
||||||
|
static void query_full(time_t now);
|
||||||
|
|
||||||
/* Send a UDP packet with its source address set as "source"
|
/* Send a UDP packet with its source address set as "source"
|
||||||
unless nowild is true, when we just send it with the kernel default */
|
unless nowild is true, when we just send it with the kernel default */
|
||||||
@@ -355,14 +356,7 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
/* If we've been spammed with many duplicates, return REFUSED. */
|
/* If we've been spammed with many duplicates, return REFUSED. */
|
||||||
if (!daemon->free_frec_src)
|
if (!daemon->free_frec_src)
|
||||||
{
|
{
|
||||||
static time_t last_log = 0;
|
query_full(now);
|
||||||
|
|
||||||
if ((int)difftime(now, last_log) > 5)
|
|
||||||
{
|
|
||||||
last_log = now;
|
|
||||||
my_syslog(LOG_WARNING, _("Maximum number of concurrent DNS queries reached (max: %d)"), daemon->ftabsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
goto frec_err;
|
goto frec_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2463,17 +2457,11 @@ struct frec *get_new_frec(time_t now, int *wait, struct frec *force)
|
|||||||
/* none available, calculate time 'till oldest record expires */
|
/* none available, calculate time 'till oldest record expires */
|
||||||
if (!force && count > daemon->ftabsize)
|
if (!force && count > daemon->ftabsize)
|
||||||
{
|
{
|
||||||
static time_t last_log = 0;
|
|
||||||
|
|
||||||
if (oldest && wait)
|
if (oldest && wait)
|
||||||
*wait = oldest->time + (time_t)TIMEOUT - now;
|
*wait = oldest->time + (time_t)TIMEOUT - now;
|
||||||
|
|
||||||
if ((int)difftime(now, last_log) > 5)
|
query_full(now);
|
||||||
{
|
|
||||||
last_log = now;
|
|
||||||
my_syslog(LOG_WARNING, _("Maximum number of concurrent DNS queries reached (max: %d)"), daemon->ftabsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2484,6 +2472,18 @@ struct frec *get_new_frec(time_t now, int *wait, struct frec *force)
|
|||||||
return f; /* OK if malloc fails and this is NULL */
|
return f; /* OK if malloc fails and this is NULL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void query_full(time_t now)
|
||||||
|
{
|
||||||
|
static time_t last_log = 0;
|
||||||
|
|
||||||
|
if ((int)difftime(now, last_log) > 5)
|
||||||
|
{
|
||||||
|
last_log = now;
|
||||||
|
my_syslog(LOG_WARNING, _("Maximum number of concurrent DNS queries reached (max: %d)"), daemon->ftabsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct frec *lookup_frec(unsigned short id, int fd, void *hash)
|
static struct frec *lookup_frec(unsigned short id, int fd, void *hash)
|
||||||
{
|
{
|
||||||
struct frec *f;
|
struct frec *f;
|
||||||
|
|||||||
Reference in New Issue
Block a user