mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 15:45:06 -05:00
Add option to limit clientlog memory
This commit is contained in:
28
conf.c
28
conf.c
@@ -83,6 +83,7 @@ static void parse_cmddeny(const char *);
|
||||
static void parse_cmdport(const char *);
|
||||
static void parse_rtconutc(const char *);
|
||||
static void parse_noclientlog(const char *);
|
||||
static void parse_clientloglimit(const char *);
|
||||
static void parse_logchange(const char *);
|
||||
static void parse_mailonchange(const char *);
|
||||
static void parse_bindaddress(const char *);
|
||||
@@ -146,6 +147,9 @@ static double mail_change_threshold = 0.0;
|
||||
memory */
|
||||
static int no_client_log = 0;
|
||||
|
||||
/* Limit memory allocated for the clients log */
|
||||
static unsigned long client_log_limit = 524288;
|
||||
|
||||
/* IP address (host order) for binding the NTP socket to. 0 means INADDR_ANY
|
||||
will be used */
|
||||
static unsigned long bind_address = 0UL;
|
||||
@@ -200,6 +204,7 @@ static const Command commands[] = {
|
||||
{"cmdport", 7, parse_cmdport},
|
||||
{"rtconutc", 8, parse_rtconutc},
|
||||
{"noclientlog", 11, parse_noclientlog},
|
||||
{"clientloglimit", 14, parse_clientloglimit},
|
||||
{"logchange", 9, parse_logchange},
|
||||
{"mailonchange", 12, parse_mailonchange},
|
||||
{"bindaddress", 11, parse_bindaddress},
|
||||
@@ -634,6 +639,21 @@ parse_noclientlog(const char *line)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_clientloglimit(const char *line)
|
||||
{
|
||||
if (sscanf(line, "%lu", &client_log_limit) != 1) {
|
||||
LOG(LOGS_WARN, LOGF_Configure, "Could not read clientlog memory limit at line %d", line_number);
|
||||
}
|
||||
|
||||
if (client_log_limit == 0) {
|
||||
/* unlimited */
|
||||
client_log_limit = (unsigned long)-1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_logchange(const char *line)
|
||||
{
|
||||
@@ -1195,6 +1215,14 @@ CNF_GetNoClientLog(void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
unsigned long
|
||||
CNF_GetClientLogLimit(void)
|
||||
{
|
||||
return client_log_limit;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
CNF_GetBindAddress(unsigned long *addr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user