|
Packit |
c22fc9 |
/*
|
|
Packit |
c22fc9 |
* Soft: Keepalived is a failover program for the LVS project
|
|
Packit |
c22fc9 |
* <www.linuxvirtualserver.org>. It monitor & manipulate
|
|
Packit |
c22fc9 |
* a loadbalanced server pool using multi-layer checks.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* Part: Configuration file parser/reader. Place into the dynamic
|
|
Packit |
c22fc9 |
* data structure representation the conf file representing
|
|
Packit |
c22fc9 |
* the loadbalanced server pool.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* Author: Alexandre Cassen, <acassen@linux-vs.org>
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
c22fc9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
c22fc9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
c22fc9 |
* See the GNU General Public License for more details.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* This program is free software; you can redistribute it and/or
|
|
Packit |
c22fc9 |
* modify it under the terms of the GNU General Public License
|
|
Packit |
c22fc9 |
* as published by the Free Software Foundation; either version
|
|
Packit |
c22fc9 |
* 2 of the License, or (at your option) any later version.
|
|
Packit |
c22fc9 |
*
|
|
Packit |
c22fc9 |
* Copyright (C) 2001-2017 Alexandre Cassen, <acassen@gmail.com>
|
|
Packit |
c22fc9 |
*/
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#include "config.h"
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#include <stdlib.h>
|
|
Packit |
c22fc9 |
#include <stdint.h>
|
|
Packit |
c22fc9 |
#include <stdbool.h>
|
|
Packit |
c22fc9 |
#include <unistd.h>
|
|
Packit |
c22fc9 |
#include <pwd.h>
|
|
Packit |
c22fc9 |
#include <grp.h>
|
|
Packit |
c22fc9 |
#include <ctype.h>
|
|
Packit |
c22fc9 |
#include <sched.h>
|
|
Packit |
c22fc9 |
#include <strings.h>
|
|
Packit |
c22fc9 |
#include <sys/types.h>
|
|
Packit |
c22fc9 |
#include <sys/stat.h>
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_
|
|
Packit |
c22fc9 |
#include "snmp.h"
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#include "global_parser.h"
|
|
Packit |
c22fc9 |
#include "global_data.h"
|
|
Packit |
c22fc9 |
#include "main.h"
|
|
Packit |
c22fc9 |
#include "parser.h"
|
|
Packit |
c22fc9 |
#include "smtp.h"
|
|
Packit |
c22fc9 |
#include "utils.h"
|
|
Packit |
c22fc9 |
#include "logger.h"
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_FIREWALL_
|
|
Packit Service |
dfccb1 |
#include "vrrp_firewall.h"
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#include "memory.h"
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#if HAVE_DECL_CLONE_NEWNET
|
|
Packit |
c22fc9 |
#include "namespaces.h"
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
/* Defined in kernel source file include/linux/sched.h but
|
|
Packit Service |
dfccb1 |
* not currently exposed to userspace */
|
|
Packit Service |
dfccb1 |
#ifndef TASK_COMM_LEN
|
|
Packit Service |
dfccb1 |
#define TASK_COMM_LEN 16
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* data handlers */
|
|
Packit |
c22fc9 |
/* Global def handlers */
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_LINKBEAT_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
use_polling_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->linkbeat_use_polling = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
save_process_name(char const **dest, const char *src)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
size_t len;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!src) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Process name missing");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (*dest)
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(*dest);
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if ((len = strlen(src)) >= TASK_COMM_LEN) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Process name %s more than %d characters, truncating", src, TASK_COMM_LEN - 1);
|
|
Packit Service |
dfccb1 |
len = TASK_COMM_LEN - 1;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
*dest = STRNDUP(src, len);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
process_names_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_VRRP_
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->vrrp_process_name, "keepalived_vrrp");
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_LVS_
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->lvs_process_name, "keepalived_lvs");
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_BFD_
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->bfd_process_name, "keepalived_bfd");
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
process_name_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->process_name, strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_VRRP_
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_process_name_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->vrrp_process_name, strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_LVS_
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
lvs_process_name_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->lvs_process_name, strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_BFD_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
bfd_process_name_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
save_process_name(&global_data->bfd_process_name, strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
routerid_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "routerid name missing - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->router_id);
|
|
Packit |
c22fc9 |
global_data->router_id = set_value(strvec);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
emailfrom_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "emailfrom missing - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->email_from);
|
|
Packit |
c22fc9 |
global_data->email_from = set_value(strvec);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
smtpto_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned timeout;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* The min value should be 1, but allow 0 to maintain backward compatibility
|
|
Packit |
c22fc9 |
* with pre v2.0.7 */
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &timeout, 0, UINT_MAX / TIMER_HZ, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "smtp_connect_timeout '%s' must be in [0, %u] - ignoring", strvec_slot(strvec, 1), UINT_MAX / TIMER_HZ);
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (timeout == 0) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "smtp_conect_timeout must be greater than 0, setting to 1");
|
|
Packit |
c22fc9 |
timeout = 1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->smtp_connection_to = timeout * TIMER_HZ;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
dynamic_interfaces_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
const char *str;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->dynamic_interfaces = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
str = strvec_slot(strvec, 1);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strcmp(str, "allow_if_changes"))
|
|
Packit |
c22fc9 |
global_data->allow_if_changes = true;
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Unknown dynamic_interfaces option '%s'",str);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
no_email_faults_handler(__attribute__((unused))const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->no_email_faults = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
smtpserver_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
bool ret = true;
|
|
Packit Service |
dfccb1 |
const char *port_str = SMTP_PORT_STR;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* Has a port number been specified? */
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 3)
|
|
Packit |
c22fc9 |
port_str = strvec_slot(strvec,2);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* It can't be an IP address if it contains '-' or '/' */
|
|
Packit |
c22fc9 |
if (!strpbrk(strvec_slot(strvec, 1), "-/"))
|
|
Packit |
c22fc9 |
ret = inet_stosockaddr(strvec_slot(strvec, 1), port_str, &global_data->smtp_server);
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (ret)
|
|
Packit |
c22fc9 |
domain_stosockaddr(strvec_slot(strvec, 1), port_str, &global_data->smtp_server);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (global_data->smtp_server.ss_family == AF_UNSPEC)
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid smtp server %s %s", strvec_slot(strvec, 1), port_str);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
smtphelo_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
global_data->smtp_helo_name = STRDUP(strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
email_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
const vector_t *email_vec = read_value_block(strvec);
|
|
Packit |
c22fc9 |
unsigned int i;
|
|
Packit |
c22fc9 |
char *str;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!email_vec) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Warning - empty notification_email block");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
for (i = 0; i < vector_size(email_vec); i++) {
|
|
Packit |
c22fc9 |
str = vector_slot(email_vec, i);
|
|
Packit |
c22fc9 |
alloc_email(str);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
free_strvec(email_vec);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
smtp_alert_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global smtp_alert specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->smtp_alert = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
startup_shutdown_script(const vector_t *strvec, notify_script_t **script, bool startup)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
const char *type = startup ? "startup" : "shutdown";
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (*script) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%s script already specified", type);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%s script missing", type);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!(*script = notify_script_init(0, type))) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid %s script", type);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (startup) {
|
|
Packit Service |
dfccb1 |
if (!global_data->startup_script_timeout)
|
|
Packit Service |
dfccb1 |
global_data->startup_script_timeout = 10;
|
|
Packit Service |
dfccb1 |
} else {
|
|
Packit Service |
dfccb1 |
if (!global_data->shutdown_script_timeout)
|
|
Packit Service |
dfccb1 |
global_data->shutdown_script_timeout = 10;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
startup_shutdown_script_timeout_handler(const vector_t *strvec, bool startup)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
const char *type = startup ? "startup" : "shutdown";
|
|
Packit Service |
dfccb1 |
unsigned delay;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%s_script_timeout requires value", type);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &delay, 1, 1000, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%s_script_timeout '%s' must be in [1, 1000] - ignoring", type, strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (startup)
|
|
Packit Service |
dfccb1 |
global_data->startup_script_timeout = delay;
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
global_data->shutdown_script_timeout = delay;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
startup_script_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
startup_shutdown_script(strvec, &global_data->startup_script, true);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
startup_script_timeout_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
startup_shutdown_script_timeout_handler(strvec, true);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
shutdown_script_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
startup_shutdown_script(strvec, &global_data->shutdown_script, false);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
shutdown_script_timeout_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
startup_shutdown_script_timeout_handler(strvec, false);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
max_auto_priority_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int priority;
|
|
Packit Service |
dfccb1 |
int max_priority = sched_get_priority_max(SCHED_RR);
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
global_data->max_auto_priority = max_priority;
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!read_int_strvec(strvec, 1, &priority, -1, max_priority, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "max_auto_priority '%s' must be in [0, %d] (or -1 to disable) - ignoring", strvec_slot(strvec, 1), max_priority);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
global_data->max_auto_priority = priority;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
min_auto_priority_delay_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int delay;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "min_auto_priority_delay requires delay time");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
if (!read_int_strvec(strvec, 1, &delay, 1, 10000000, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "min_auto_priority_delay '%s' must be in [1, 10000000] - ignoring", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
global_data->min_auto_priority_delay = delay;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
smtp_alert_vrrp_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global smtp_alert_vrrp specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->smtp_alert_vrrp = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
smtp_alert_checker_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global smtp_alert_checker specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->smtp_alert_checker = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
checker_log_all_failures_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int res = true;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 2) {
|
|
Packit Service |
dfccb1 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit Service |
dfccb1 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value for checker_log_all_failures specified");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
global_data->checker_log_all_failures = res;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
default_interface_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "default_interface requires interface name");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->default_ifname);
|
|
Packit |
c22fc9 |
global_data->default_ifname = set_value(strvec);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_timeouts(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
size_t i;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 3) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "lvs_timeouts requires at least one option");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
for (i = 1; i < vector_size(strvec); i++) {
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "tcp")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_timeout tcp - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 0, LVS_MAX_TIMEOUT, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_timeout tcp (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit Service |
dfccb1 |
global_data->lvs_timeouts.tcp_timeout = val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "tcpfin")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_timeout tcpfin - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 0, LVS_MAX_TIMEOUT, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_timeout tcpfin (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit Service |
dfccb1 |
global_data->lvs_timeouts.tcp_fin_timeout = val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "udp")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_timeout udp - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 0, LVS_MAX_TIMEOUT, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_timeout udp (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit Service |
dfccb1 |
global_data->lvs_timeouts.udp_timeout = val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Unknown option %s specified for lvs_timeouts", strvec_slot(strvec, i));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#if defined _WITH_LVS_ && defined _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_syncd_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
size_t i;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (global_data->lvs_syncd.ifname) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "lvs_sync_daemon has already been specified as %s %s - ignoring", global_data->lvs_syncd.ifname, global_data->lvs_syncd.vrrp_name ? global_data->lvs_syncd.vrrp_name : "");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "lvs_sync_daemon requires interface");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (strlen(strvec_slot(strvec, 1)) >= IP_VS_IFNAME_MAXLEN) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "lvs_sync_daemon interface name '%s' too long - ignoring", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->lvs_syncd.ifname = set_value(strvec);
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
for (i = 2; i < vector_size(strvec); i++) {
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_VRRP_
|
|
Packit Service |
dfccb1 |
if (!strcmp(strvec_slot(strvec, i), "inst")) {
|
|
Packit Service |
dfccb1 |
if (global_data->lvs_syncd.vrrp_name)
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "lvs_sync_daemon vrrp instance has already been specified as %s - ignoring", global_data->lvs_syncd.vrrp_name);
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
global_data->lvs_syncd.vrrp_name = STRDUP(strvec_slot(strvec, i + 1));
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
i++; /* skip over value */
|
|
Packit Service |
dfccb1 |
continue;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "id")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_sync_daemon id, defaulting to vrid");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 0, 255, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid syncid (%s) - defaulting to vrid", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->lvs_syncd.syncid = val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#ifdef _HAVE_IPVS_SYNCD_ATTRIBUTES_
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "maxlen")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_sync_daemon maxlen - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 1, 65535 - 20 - 8, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_sync_daemon maxlen (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->lvs_syncd.sync_maxlen = (uint16_t)val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "port")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_sync_daemon port - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 1, 65535, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_sync_daemon port (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->lvs_syncd.mcast_port = (uint16_t)val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "ttl")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_sync_daemon ttl - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, i + 1, &val, 1, 255, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_sync_daemon ttl (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->lvs_syncd.mcast_ttl = (uint8_t)val;
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!strcmp(strvec_slot(strvec, i), "group")) {
|
|
Packit |
c22fc9 |
if (i == vector_size(strvec) - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No value specified for lvs_sync_daemon group - ignoring");
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (inet_stosockaddr(strvec_slot(strvec, i+1), NULL, &global_data->lvs_syncd.mcast_group))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid lvs_sync_daemon group (%s) - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if ((global_data->lvs_syncd.mcast_group.ss_family == AF_INET && !IN_MULTICAST(htonl(((struct sockaddr_in *)&global_data->lvs_syncd.mcast_group)->sin_addr.s_addr))) ||
|
|
Packit |
c22fc9 |
(global_data->lvs_syncd.mcast_group.ss_family == AF_INET6 && !IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)&global_data->lvs_syncd.mcast_group)->sin6_addr))) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "lvs_sync_daemon group address %s is not multicast - ignoring", strvec_slot(strvec, i+1));
|
|
Packit |
c22fc9 |
global_data->lvs_syncd.mcast_group.ss_family = AF_UNSPEC;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
i++; /* skip over value */
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
/* The following are for backward compatibility when lvs_sync_daemon IF VRRP_INSTANCE [SYNC_ID] could be specified */
|
|
Packit Service |
dfccb1 |
if (i == 2) {
|
|
Packit Service |
dfccb1 |
global_data->lvs_syncd.vrrp_name = STRDUP(strvec_slot(strvec, 2));
|
|
Packit Service |
dfccb1 |
continue;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (i == 3) {
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 3, &val, 0, 255, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid syncid (%s) - defaulting to vrid", strvec_slot(strvec, 3));
|
|
Packit Service |
dfccb1 |
else {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Please use keyword \"id\" before lvs_sync_daemon syncid value");
|
|
Packit Service |
dfccb1 |
global_data->lvs_syncd.syncid = val;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
continue;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
/* We haven't matched anything */
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Unknown option %s specified for lvs_sync_daemon", strvec_slot(strvec, i));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_flush_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->lvs_flush = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
lvs_flush_onstop_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) == 1)
|
|
Packit Service |
dfccb1 |
global_data->lvs_flush_onstop = LVS_FLUSH_FULL;
|
|
Packit Service |
dfccb1 |
else if (!strcmp(strvec_slot(strvec, 1), "VS"))
|
|
Packit Service |
dfccb1 |
global_data->lvs_flush_onstop = LVS_FLUSH_VS;
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Unknown lvs_flush_onstop type %s", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
static int
|
|
Packit Service |
dfccb1 |
get_realtime_priority(const vector_t *strvec, const char *process)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int min_priority;
|
|
Packit |
c22fc9 |
int max_priority;
|
|
Packit |
c22fc9 |
int priority;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No %s process real-time priority specified", process);
|
|
Packit |
c22fc9 |
return -1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
min_priority = sched_get_priority_min(SCHED_RR);
|
|
Packit |
c22fc9 |
max_priority = sched_get_priority_max(SCHED_RR);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_int_strvec(strvec, 1, &priority, INT_MIN, INT_MAX, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%s process real-time priority '%s' invalid", process, strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return -1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (priority < min_priority) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "%s process real-time priority %d less than minimum %d - setting to minimum", process, priority, min_priority);
|
|
Packit |
c22fc9 |
priority = min_priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else if (priority > max_priority) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "%s process real-time priority %d greater than maximum %d - setting to maximum", process, priority, max_priority);
|
|
Packit |
c22fc9 |
priority = max_priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
return priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
static int
|
|
Packit Service |
dfccb1 |
get_cpu_affinity(const vector_t *strvec, cpu_set_t *set, const char *process)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int cpu_id, num_cpus;
|
|
Packit Service |
dfccb1 |
unsigned i;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!strvec)
|
|
Packit Service |
dfccb1 |
return -1;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "No %s cpu_id set specified", process);
|
|
Packit Service |
dfccb1 |
return -1;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
CPU_ZERO(set);
|
|
Packit Service |
dfccb1 |
/* TODO: instead of sysconf, maybe we could fetch current cpu_set via
|
|
Packit Service |
dfccb1 |
* sched_getaffinity and use CPU_COUNT */
|
|
Packit Service |
dfccb1 |
num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
|
Packit Service |
dfccb1 |
for (i = 1; i < vector_size(strvec); i++) {
|
|
Packit Service |
dfccb1 |
if (!read_int_strvec(strvec, i, &cpu_id, 0, num_cpus-1, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid cpu_id:%d specified for %s process"
|
|
Packit Service |
dfccb1 |
, cpu_id, process);
|
|
Packit Service |
dfccb1 |
/* Reset cpu_set at first error */
|
|
Packit Service |
dfccb1 |
CPU_ZERO(set);
|
|
Packit Service |
dfccb1 |
return -1;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
CPU_SET(cpu_id, set);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
return 0;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit |
c22fc9 |
static rlim_t
|
|
Packit Service |
dfccb1 |
get_rt_rlimit(const vector_t *strvec, const char *process)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned limit;
|
|
Packit |
c22fc9 |
rlim_t rlim;
|
|
Packit Service |
dfccb1 |
size_t keyword_len;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
/* *_rlimit_rtime is deprecated since 02/02/2020. Keyword should be *_rlimit_rttime */
|
|
Packit Service |
dfccb1 |
keyword_len = strlen(strvec_slot(strvec, 0));
|
|
Packit Service |
dfccb1 |
if (strvec_slot(strvec, 0)[keyword_len - 5] == 'r')
|
|
Packit Service |
dfccb1 |
log_message(LOG_INFO, "Keyword '%s' is deprecated - please use '%.*srttime'", strvec_slot(strvec, 0), (int)keyword_len - 5, strvec_slot(strvec, 0));
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &limit, 1, UINT32_MAX, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid %s real-time limit - %s", process, strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
/* The rlim value is divided by 2 elsewhere, and the result must be
|
|
Packit Service |
dfccb1 |
* non-zero, therefore we need rlim to have a minimum value of 2. */
|
|
Packit Service |
dfccb1 |
if (limit == 1)
|
|
Packit Service |
dfccb1 |
limit = 2;
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
rlim = limit;
|
|
Packit |
c22fc9 |
return rlim;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
static int8_t
|
|
Packit Service |
dfccb1 |
get_priority(const vector_t *strvec, const char *process)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int priority;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No %s process priority specified", process);
|
|
Packit |
c22fc9 |
return 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_int_strvec(strvec, 1, &priority, -20, 19, true)) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid %s process priority specified", process);
|
|
Packit |
c22fc9 |
return 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
return (int8_t)priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_mcast_group4_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
struct sockaddr_in *mcast = &global_data->vrrp_mcast_group4;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (inet_stosockaddr(strvec_slot(strvec, 1), 0, (struct sockaddr_storage *)mcast))
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Configuration error: Cant parse vrrp_mcast_group4 [%s]. Skipping"
|
|
Packit Service |
dfccb1 |
, strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_mcast_group6_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
struct sockaddr_in6 *mcast = &global_data->vrrp_mcast_group6;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (inet_stosockaddr(strvec_slot(strvec, 1), 0, (struct sockaddr_storage *)mcast))
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Configuration error: Cant parse vrrp_mcast_group6 [%s]. Skipping"
|
|
Packit Service |
dfccb1 |
, strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_delay_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned timeout;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &timeout, 0, UINT_MAX / TIMER_HZ, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_master_delay '%s' invalid - ignoring", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_delay = timeout * TIMER_HZ;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_rep_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned repeats;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
/* The min value should be 1, but allow 0 to maintain backward compatibility
|
|
Packit |
c22fc9 |
* with pre v2.0.7 */
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &repeats, 0, UINT_MAX, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_master_repeat '%s' invalid - ignoring", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (repeats == 0) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_master_repeat must be greater than 0, setting to 1");
|
|
Packit |
c22fc9 |
repeats = 1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_rep = repeats;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_refresh_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
unsigned refresh;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &refresh, 0, UINT_MAX, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid vrrp_garp_master_refresh '%s' - ignoring", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
global_data->vrrp_garp_refresh.tv_sec = 0;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_refresh.tv_sec = refresh;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
global_data->vrrp_garp_refresh.tv_usec = 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_refresh_rep_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
unsigned repeats;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
/* The min value should be 1, but allow 0 to maintain backward compatibility
|
|
Packit Service |
dfccb1 |
* with pre v2.0.7 */
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &repeats, 0, UINT_MAX, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_master_refresh_repeat '%s' invalid - ignoring", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (repeats == 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_master_refresh_repeat must be greater than 0, setting to 1");
|
|
Packit Service |
dfccb1 |
repeats = 1;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_refresh_rep = repeats;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_lower_prio_delay_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
unsigned delay;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &delay, 0, UINT_MAX / TIMER_HZ, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_lower_prio_delay '%s' invalid - ignoring", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_lower_prio_delay = delay * TIMER_HZ;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_lower_prio_rep_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned garp_lower_prio_rep;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &garp_lower_prio_rep, 0, INT_MAX, true)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid vrrp_garp_lower_prio_repeat '%s'", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_lower_prio_rep = garp_lower_prio_rep;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_garp_interval_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
double interval;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!read_double_strvec(strvec, 1, &interval, 1.0F / TIMER_HZ, (unsigned)(UINT_MAX / TIMER_HZ), true))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_garp_interval '%s' is invalid", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_garp_interval = (unsigned)(interval * TIMER_HZ);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (global_data->vrrp_garp_interval >= 1 * TIMER_HZ)
|
|
Packit Service |
dfccb1 |
log_message(LOG_INFO, "The vrrp_garp_interval is very large - %s seconds", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_gna_interval_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
double interval;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!read_double_strvec(strvec, 1, &interval, 1.0F / TIMER_HZ, (unsigned)(UINT_MAX / TIMER_HZ), true))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_gna_interval '%s' is invalid", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_gna_interval = (unsigned)(interval * TIMER_HZ);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (global_data->vrrp_gna_interval >= 1 * TIMER_HZ)
|
|
Packit Service |
dfccb1 |
log_message(LOG_INFO, "The vrrp_gna_interval is very large - %s seconds", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_min_garp_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int res = false;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 2) {
|
|
Packit Service |
dfccb1 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit Service |
dfccb1 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value for vrrp_min_garp specified");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!res)
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
/* Set to only send 1 gratuitous ARP/NA message with no repeat, but don't
|
|
Packit Service |
dfccb1 |
* overwrite any parameters already set. */
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_garp_rep == VRRP_GARP_REP)
|
|
Packit Service |
dfccb1 |
global_data->vrrp_garp_rep = 1;
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_garp_refresh.tv_sec == VRRP_GARP_REFRESH)
|
|
Packit Service |
dfccb1 |
global_data->vrrp_garp_refresh.tv_sec = 0;
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_garp_refresh_rep == VRRP_GARP_REFRESH_REP)
|
|
Packit Service |
dfccb1 |
global_data->vrrp_garp_refresh_rep = 0;
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_garp_delay == VRRP_GARP_DELAY)
|
|
Packit Service |
dfccb1 |
global_data->vrrp_garp_delay = 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_lower_prio_no_advert_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0)
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value for vrrp_lower_prio_no_advert specified");
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_lower_prio_no_advert = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_lower_prio_no_advert = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_higher_prio_send_advert_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0)
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value for vrrp_higher_prio_send_advert specified");
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_higher_prio_send_advert = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_higher_prio_send_advert = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_IPTABLES_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_iptables_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_iptables_inchain) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "iptables already specified - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,1)) >= XT_EXTENSION_MAXNAMELEN - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : iptables in chain name too long - ignored");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_iptables_inchain = STRDUP(strvec_slot(strvec,1));
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 3) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,2)) >= XT_EXTENSION_MAXNAMELEN - 1) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : iptables out chain name too long - ignored");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_iptables_outchain = STRDUP(strvec_slot(strvec,2));
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
} else {
|
|
Packit Service |
dfccb1 |
global_data->vrrp_iptables_inchain = STRDUP(DEFAULT_IPTABLES_CHAIN_IN);
|
|
Packit Service |
dfccb1 |
global_data->vrrp_iptables_outchain = STRDUP(DEFAULT_IPTABLES_CHAIN_OUT);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#ifdef _HAVE_LIBIPSET_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_ipsets_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
size_t len;
|
|
Packit Service |
dfccb1 |
char set_name[IPSET_MAXNAMELEN];
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->vrrp_ipset_address);
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->vrrp_ipset_address6);
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->vrrp_ipset_address_iface6);
|
|
Packit Service |
dfccb1 |
#ifdef HAVE_IPSET_ATTR_IFACE
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->vrrp_ipset_igmp);
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->vrrp_ipset_mld);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
global_data->using_ipsets = false;
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,1)) >= IPSET_MAXNAMELEN - 1) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset address name too long - ignored");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_address = STRDUP(strvec_slot(strvec,1));
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 3) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,2)) >= IPSET_MAXNAMELEN - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset IPv6 address name too long - ignored");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_address6 = STRDUP(strvec_slot(strvec,2));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else {
|
|
Packit |
c22fc9 |
/* No second set specified, copy first name and add "6" */
|
|
Packit Service |
dfccb1 |
strcpy_safe(set_name, global_data->vrrp_ipset_address);
|
|
Packit Service |
dfccb1 |
set_name[IPSET_MAXNAMELEN - 2] = '\0';
|
|
Packit Service |
dfccb1 |
strcat(set_name, "6");
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_address6 = STRDUP(set_name);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 4) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,3)) >= IPSET_MAXNAMELEN - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset IPv6 address_iface name too long - ignored");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_address_iface6 = STRDUP(strvec_slot(strvec,3));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else {
|
|
Packit |
c22fc9 |
/* No third set specified, copy second name and add "_if6" */
|
|
Packit Service |
dfccb1 |
strcpy_safe(set_name, global_data->vrrp_ipset_address6);
|
|
Packit Service |
dfccb1 |
len = strlen(set_name);
|
|
Packit Service |
dfccb1 |
if (set_name[len-1] == '6')
|
|
Packit Service |
dfccb1 |
set_name[--len] = '\0';
|
|
Packit Service |
dfccb1 |
set_name[IPSET_MAXNAMELEN - 5] = '\0';
|
|
Packit Service |
dfccb1 |
strcat(set_name, "_if6");
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_address_iface6 = STRDUP(set_name);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
#ifdef HAVE_IPSET_ATTR_IFACE
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 5) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,4)) >= IPSET_MAXNAMELEN - 1) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset IGMP name too long - ignored");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_igmp = STRDUP(strvec_slot(strvec,4));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
else {
|
|
Packit Service |
dfccb1 |
/* No second set specified, copy first name and add "_igmp" */
|
|
Packit Service |
dfccb1 |
strcpy_safe(set_name, global_data->vrrp_ipset_address);
|
|
Packit Service |
dfccb1 |
set_name[sizeof(set_name) - 6] = '\0';
|
|
Packit Service |
dfccb1 |
strcat(set_name, "_igmp");
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_igmp = STRDUP(set_name);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 6) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec,5)) >= IPSET_MAXNAMELEN - 1) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error : ipset MLD name too long - ignored");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_mld = STRDUP(strvec_slot(strvec,5));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
else {
|
|
Packit Service |
dfccb1 |
/* No second set specified, copy first name and add "_mld" */
|
|
Packit Service |
dfccb1 |
strcpy_safe(set_name, global_data->vrrp_ipset_address);
|
|
Packit Service |
dfccb1 |
set_name[sizeof(set_name) - 5] = '\0';
|
|
Packit Service |
dfccb1 |
strcat(set_name, "_mld");
|
|
Packit Service |
dfccb1 |
global_data->vrrp_ipset_mld = STRDUP(set_name);
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_NFTABLES_
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_nftables_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
const char *name;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_nf_table_name) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "nftables already specified - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 2) {
|
|
Packit Service |
dfccb1 |
if (strlen(strvec_slot(strvec, 1)) >= NFT_TABLE_MAXNAMELEN) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "nftables table name too long - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
name = strvec_slot(strvec, 1);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
else {
|
|
Packit Service |
dfccb1 |
/* Table named defaults to "keepalived" */
|
|
Packit Service |
dfccb1 |
name = DEFAULT_NFTABLES_TABLE;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
global_data->vrrp_nf_table_name = STRDUP(name);
|
|
Packit Service |
dfccb1 |
global_data->vrrp_nf_chain_priority = -1;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_nftables_priority_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int priority;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (read_int_strvec(strvec, 1, &priority, INT32_MIN, INT32_MAX, false))
|
|
Packit Service |
dfccb1 |
global_data->vrrp_nf_chain_priority = priority;
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_INVALID_NUMBER, "invalid nftables chain priority '%s'", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_nftables_counters_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
global_data->vrrp_nf_counters = true;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_nftables_ifindex_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
global_data->vrrp_nf_ifindex = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_version_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int version;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_int_strvec(strvec, 1, &version, 2, 3, true)) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "VRRP Error: Version must be either 2 or 3");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_version = version;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_check_unicast_src_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->vrrp_check_unicast_src = 1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_check_adv_addr_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->vrrp_skip_check_adv_addr = 1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_strict_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->vrrp_strict = 1;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_prio_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->vrrp_process_priority = get_priority(strvec, "vrrp");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_no_swap_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->vrrp_no_swap = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_rt_priority_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int priority = get_realtime_priority(strvec, "vrrp");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (priority >= 0)
|
|
Packit |
c22fc9 |
global_data->vrrp_realtime_priority = priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_cpu_affinity_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
get_cpu_affinity(strvec, &global_data->vrrp_cpu_mask, "vrrp");
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_rt_rlimit_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->vrrp_rlimit_rt = get_rt_rlimit(strvec, "vrrp");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
notify_fifo(const vector_t *strvec, const char *type, notify_fifo_t *fifo)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No %snotify_fifo name specified", type);
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (fifo->name) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%snotify_fifo already specified - ignoring %s", type, strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) > 2) {
|
|
Packit Service |
dfccb1 |
if (set_script_uid_gid(strvec, 2, &fifo->uid, &fifo->gid)) {
|
|
Packit Service |
dfccb1 |
log_message(LOG_INFO, "Invalid user/group for %s fifo %s - ignoring", type, fifo->name);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
else {
|
|
Packit Service |
dfccb1 |
if (set_default_script_user(NULL, NULL)) {
|
|
Packit Service |
dfccb1 |
log_message(LOG_INFO, "Failed to set default user for %s fifo %s - ignoring", type, fifo->name);
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
fifo->uid = default_script_uid;
|
|
Packit Service |
dfccb1 |
fifo->gid = default_script_gid;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
fifo->name = STRDUP(strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
notify_fifo_script(const vector_t *strvec, const char *type, notify_fifo_t *fifo)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
char *id_str;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No %snotify_fifo_script specified", type);
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (fifo->script) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%snotify_fifo_script already specified - ignoring %s", type, strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
id_str = MALLOC(strlen(type) + strlen("notify_fifo") + 1);
|
|
Packit |
c22fc9 |
strcpy(id_str, type);
|
|
Packit |
c22fc9 |
strcat(id_str, "notify_fifo");
|
|
Packit |
c22fc9 |
fifo->script = notify_script_init(1, id_str);
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
FREE(id_str);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
global_notify_fifo(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
notify_fifo(strvec, "", &global_data->notify_fifo);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
global_notify_fifo_script(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
notify_fifo_script(strvec, "", &global_data->notify_fifo);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_notify_fifo(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
notify_fifo(strvec, "vrrp_", &global_data->vrrp_notify_fifo);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_notify_fifo_script(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
notify_fifo_script(strvec, "vrrp_", &global_data->vrrp_notify_fifo);
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_notify_priority_changes(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int res = true;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 2) {
|
|
Packit Service |
dfccb1 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit Service |
dfccb1 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global vrrp_notify_priority_changes specified", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
global_data->vrrp_notify_priority_changes = res;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_notify_fifo(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
notify_fifo(strvec, "lvs_", &global_data->lvs_notify_fifo);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_notify_fifo_script(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
notify_fifo_script(strvec, "lvs_", &global_data->lvs_notify_fifo);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
checker_prio_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->checker_process_priority = get_priority(strvec, "checker");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
checker_no_swap_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->checker_no_swap = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
checker_rt_priority_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int priority = get_realtime_priority(strvec, "checker");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (priority >= 0)
|
|
Packit |
c22fc9 |
global_data->checker_realtime_priority = priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
checker_cpu_affinity_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
get_cpu_affinity(strvec, &global_data->checker_cpu_mask, "checker");
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
checker_rt_rlimit_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->checker_rlimit_rt = get_rt_rlimit(strvec, "checker");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_BFD_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
bfd_prio_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->bfd_process_priority = get_priority(strvec, "bfd");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
bfd_no_swap_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->bfd_no_swap = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
bfd_rt_priority_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
int priority = get_realtime_priority(strvec, "bfd");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (priority >= 0)
|
|
Packit |
c22fc9 |
global_data->bfd_realtime_priority = priority;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
bfd_cpu_affinity_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
get_cpu_affinity(strvec, &global_data->bfd_cpu_mask, "bfd");
|
|
Packit Service |
dfccb1 |
}
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
bfd_rt_rlimit_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->bfd_rlimit_rt = get_rt_rlimit(strvec, "bfd");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
snmp_socket_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (vector_size(strvec) > 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Too many parameters specified for snmp_socket - ignoring");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "SNMP error : snmp socket name missing");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (strlen(strvec_slot(strvec,1)) > PATH_MAX - 1) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "SNMP error : snmp socket name too long - ignored");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (global_data->snmp_socket) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "SNMP socket already set to %s - ignoring", global_data->snmp_socket);
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
global_data->snmp_socket = STRDUP(strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
trap_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->enable_traps = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
snmp_vrrp_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->enable_snmp_vrrp = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFC_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
snmp_rfc_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFCV2_
|
|
Packit |
c22fc9 |
global_data->enable_snmp_rfcv2 = true;
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFCV3_
|
|
Packit |
c22fc9 |
global_data->enable_snmp_rfcv3 = true;
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFCV2_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
snmp_rfcv2_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->enable_snmp_rfcv2 = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFCV3_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
snmp_rfcv3_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->enable_snmp_rfcv3 = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_CHECKER_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
snmp_checker_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->enable_snmp_checker = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#if HAVE_DECL_CLONE_NEWNET
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
net_namespace_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "net_namespace name missing - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!global_data->network_namespace) {
|
|
Packit Service |
dfccb1 |
global_data->network_namespace = set_value(strvec);
|
|
Packit Service |
dfccb1 |
use_pid_dir = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Duplicate net_namespace definition %s - ignoring", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
net_namespace_ipvs_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
if (!strvec)
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (global_data->network_namespace_ipvs) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Duplicate net_namespace_ipvs definition %s - ignoring", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
/* No namespace name means default namespace */
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2)
|
|
Packit Service |
dfccb1 |
global_data->network_namespace_ipvs = STRDUP("");
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
global_data->network_namespace_ipvs = set_value(strvec);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
namespace_ipsets_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->namespace_with_ipsets = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_DBUS_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
enable_dbus_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
global_data->enable_dbus = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
dbus_service_name_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "dbus_service_name missing - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
FREE_CONST_PTR(global_data->dbus_service_name);
|
|
Packit |
c22fc9 |
global_data->dbus_service_name = set_value(strvec);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
instance_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) < 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "instance name missing - ignoring");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
if (!reload) {
|
|
Packit |
c22fc9 |
if (!global_data->instance_name) {
|
|
Packit |
c22fc9 |
global_data->instance_name = set_value(strvec);
|
|
Packit |
c22fc9 |
use_pid_dir = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Duplicate instance definition %s - ignoring", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
use_pid_dir_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
use_pid_dir = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
script_user_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "No script username specified");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (set_default_script_user(strvec_slot(strvec, 1), vector_size(strvec) > 2 ? strvec_slot(strvec, 2) : NULL))
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Error setting global script uid/gid");
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
script_security_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
script_security = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
child_wait_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned secs;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &secs, 0, UINT_MAX, false)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid child_wait_time %s", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
child_wait_time = secs;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_rx_bufs_policy_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned rx_buf_size;
|
|
Packit |
c22fc9 |
unsigned i;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_rx_bufs_policy missing");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
for (i = 1; i < vector_size(strvec); i++) {
|
|
Packit |
c22fc9 |
if (!strcasecmp(strvec_slot(strvec, i), "MTU"))
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_policy |= RX_BUFS_POLICY_MTU;
|
|
Packit |
c22fc9 |
else if (!strcasecmp(strvec_slot(strvec, i), "ADVERT"))
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_policy |= RX_BUFS_POLICY_ADVERT;
|
|
Packit |
c22fc9 |
else {
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &rx_buf_size, 0, UINT_MAX, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid vrrp_rx_bufs_policy %s", strvec_slot(strvec, i));
|
|
Packit |
c22fc9 |
else {
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_size = rx_buf_size;
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_policy |= RX_BUFS_SIZE;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if ((global_data->vrrp_rx_bufs_policy & RX_BUFS_SIZE) &&
|
|
Packit |
c22fc9 |
(global_data->vrrp_rx_bufs_policy & (RX_BUFS_POLICY_MTU | RX_BUFS_POLICY_ADVERT))) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Cannot set vrrp_rx_bufs_policy size and policy, ignoring policy");
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_policy &= ~(RX_BUFS_POLICY_MTU | RX_BUFS_POLICY_ADVERT);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else if ((global_data->vrrp_rx_bufs_policy & RX_BUFS_POLICY_MTU) &&
|
|
Packit |
c22fc9 |
(global_data->vrrp_rx_bufs_policy & RX_BUFS_POLICY_ADVERT)) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Cannot set both vrrp_rx_bufs_policy MTU and ADVERT, ignoring ADVERT");
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_policy &= ~RX_BUFS_POLICY_ADVERT;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_rx_bufs_multiplier_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned rx_buf_mult;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) != 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid vrrp_rx_bufs_multiplier");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &rx_buf_mult, 1, UINT_MAX, false))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid vrrp_rx_bufs_multiplier %s", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
else
|
|
Packit |
c22fc9 |
global_data->vrrp_rx_bufs_multiples = rx_buf_mult;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#if defined _WITH_VRRP_ || defined _WITH_LVS_
|
|
Packit |
c22fc9 |
static unsigned
|
|
Packit Service |
dfccb1 |
get_netlink_rcv_bufs_size(const vector_t *strvec, const char *type)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return 0;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) < 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "%s_rcv_bufs size missing", type);
|
|
Packit |
c22fc9 |
return 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!read_unsigned_strvec(strvec, 1, &val, 0, UINT_MAX, false)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "%s_rcv_bufs size (%s) invalid", type, strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return 0;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
return val;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_netlink_monitor_rcv_bufs_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
val = get_netlink_rcv_bufs_size(strvec, "vrrp_netlink_monitor");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (val)
|
|
Packit |
c22fc9 |
global_data->vrrp_netlink_monitor_rcv_bufs = val;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_netlink_monitor_rcv_bufs_force_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global vrrp_netlink_monitor_rcv_bufs_force specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_netlink_monitor_rcv_bufs_force = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_netlink_cmd_rcv_bufs_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
val = get_netlink_rcv_bufs_size(strvec, "vrrp_netlink_cmd");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (val)
|
|
Packit |
c22fc9 |
global_data->vrrp_netlink_cmd_rcv_bufs = val;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_netlink_cmd_rcv_bufs_force_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global vrrp_netlink_cmd_rcv_bufs_force specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->vrrp_netlink_cmd_rcv_bufs_force = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_CN_PROC_
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
process_monitor_rcv_bufs_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
unsigned val;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!strvec)
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
val = get_netlink_rcv_bufs_size(strvec, "process_monitor");
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (val)
|
|
Packit Service |
dfccb1 |
global_data->process_monitor_rcv_bufs = val;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
process_monitor_rcv_bufs_force_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
int res = true;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!strvec)
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) >= 2) {
|
|
Packit Service |
dfccb1 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit Service |
dfccb1 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global process_monitor_rcv_bufs_force specified", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
global_data->process_monitor_rcv_bufs_force = res;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_netlink_monitor_rcv_bufs_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
val = get_netlink_rcv_bufs_size(strvec, "lvs_netlink_monitor");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (val)
|
|
Packit |
c22fc9 |
global_data->lvs_netlink_monitor_rcv_bufs = val;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_netlink_monitor_rcv_bufs_force_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global lvs_netlink_monitor_rcv_bufs_force specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->lvs_netlink_monitor_rcv_bufs_force = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_netlink_cmd_rcv_bufs_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
unsigned val;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
val = get_netlink_rcv_bufs_size(strvec, "lvs_netlink_cmd");
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (val)
|
|
Packit |
c22fc9 |
global_data->lvs_netlink_cmd_rcv_bufs = val;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
lvs_netlink_cmd_rcv_bufs_force_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (!strvec)
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global lvs_netlink_cmd_rcv_bufs_force specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->lvs_netlink_cmd_rcv_bufs_force = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
rs_init_notifies_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global rs_init_notifies specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->rs_init_notifies = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
no_checker_emails_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
int res = true;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (vector_size(strvec) >= 2) {
|
|
Packit |
c22fc9 |
res = check_true_false(strvec_slot(strvec,1));
|
|
Packit |
c22fc9 |
if (res < 0) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global no_checker_emails specified", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
global_data->no_checker_emails = res;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
static void
|
|
Packit Service |
dfccb1 |
umask_handler(const vector_t *strvec)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
long umask_long;
|
|
Packit Service |
dfccb1 |
mode_t umask_bits = 0;
|
|
Packit Service |
dfccb1 |
const char *mask = strvec_slot(strvec, 1);
|
|
Packit |
c22fc9 |
char *endptr;
|
|
Packit |
c22fc9 |
unsigned i;
|
|
Packit Service |
dfccb1 |
const char *p;
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (umask_cmdline) {
|
|
Packit |
c22fc9 |
log_message(LOG_INFO, "umask command line option specified, ignoring config option");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
if (isdigit(mask[0])) {
|
|
Packit |
c22fc9 |
if (vector_size(strvec) != 2) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "%s parameter(s) to umask option", vector_size(strvec) == 1 ? "Missing" : "Extra");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
umask_long = strtol(mask, &endptr, 0);
|
|
Packit Service |
dfccb1 |
if (*endptr || umask_long < 0 || umask_long & ~(S_IRWXU | S_IRWXG | S_IRWXO)) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "invalid umask value %s", mask);
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit Service |
dfccb1 |
umask_bits = umask_long & (S_IRWXU | S_IRWXG | S_IRWXO);
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
else {
|
|
Packit |
c22fc9 |
bool need_or = false;
|
|
Packit |
c22fc9 |
for (i = 1; i < vector_size(strvec); i++) {
|
|
Packit |
c22fc9 |
for (p = strvec_slot(strvec, i); *p; ) {
|
|
Packit |
c22fc9 |
if (need_or) {
|
|
Packit |
c22fc9 |
if (*p == '|') {
|
|
Packit |
c22fc9 |
need_or = false;
|
|
Packit |
c22fc9 |
p++;
|
|
Packit |
c22fc9 |
continue;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "Invalid umask syntax %s", strvec_slot(strvec, i));
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
if (!strncmp(p, "IRUSR", 5)) umask_bits |= S_IRUSR;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IWUSR", 5)) umask_bits |= S_IWUSR;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IXUSR", 5)) umask_bits |= S_IXUSR;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IRGRP", 5)) umask_bits |= S_IRGRP;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IWGRP", 5)) umask_bits |= S_IWGRP;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IXGRP", 5)) umask_bits |= S_IXGRP;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IROTH", 5)) umask_bits |= S_IROTH;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IWOTH", 5)) umask_bits |= S_IWOTH;
|
|
Packit Service |
dfccb1 |
else if (!strncmp(p, "IXOTH", 5)) umask_bits |= S_IXOTH;
|
|
Packit |
c22fc9 |
else {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "Unknown umask bit %s", p);
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit |
c22fc9 |
p += 5;
|
|
Packit |
c22fc9 |
need_or = true;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
if (!need_or) {
|
|
Packit |
c22fc9 |
report_config_error(CONFIG_GENERAL_ERROR, "umask missing bit value");
|
|
Packit |
c22fc9 |
return;
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
umask_val = umask_bits;
|
|
Packit Service |
dfccb1 |
umask(umask_bits);
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
#ifdef _MEM_CHECK_
|
|
Packit Service |
dfccb1 |
update_mem_check_log_perms(umask_bits);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef ENABLE_LOG_TO_FILE
|
|
Packit Service |
dfccb1 |
update_log_file_perms(umask_bits);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_VRRP_
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_startup_delay_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
double startup_delay;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!read_double_strvec(strvec, 1, &startup_delay, 0.001F / TIMER_HZ, (unsigned)(UINT_MAX / TIMER_HZ), true))
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "vrrp_startup_delay '%s' is invalid", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
else
|
|
Packit Service |
dfccb1 |
global_data->vrrp_startup_delay = (unsigned)(startup_delay * TIMER_HZ);
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (global_data->vrrp_startup_delay >= 60 * TIMER_HZ)
|
|
Packit Service |
dfccb1 |
log_message(LOG_INFO, "The vrrp_startup_delay is very large - %s seconds", strvec_slot(strvec, 1));
|
|
Packit |
c22fc9 |
}
|
|
Packit |
c22fc9 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
vrrp_log_unknown_vrids_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
global_data->log_unknown_vrids = true;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
random_seed_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
unsigned val;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (!read_unsigned_strvec(strvec, 1, &val, 0, UINT_MAX, false)) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "random_seed %s invalid", strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
set_random_seed(val);
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
#ifndef _ONE_PROCESS_DEBUG_
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
reload_time_file_handler(const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
char *str;
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
if (vector_size(strvec) != 2) {
|
|
Packit Service |
dfccb1 |
report_config_error(CONFIG_GENERAL_ERROR, "reload_time_file invalid");
|
|
Packit Service |
dfccb1 |
return;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
global_data->reload_time_file = str = MALLOC(strlen(strvec_slot(strvec, 1)) + 1);
|
|
Packit Service |
dfccb1 |
strcpy(str, strvec_slot(strvec, 1));
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
|
|
Packit Service |
dfccb1 |
static void
|
|
Packit Service |
dfccb1 |
reload_repeat_handler(__attribute__((unused)) const vector_t *strvec)
|
|
Packit Service |
dfccb1 |
{
|
|
Packit Service |
dfccb1 |
global_data->reload_repeat = true;
|
|
Packit Service |
dfccb1 |
}
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
|
|
Packit |
c22fc9 |
void
|
|
Packit |
c22fc9 |
init_global_keywords(bool global_active)
|
|
Packit |
c22fc9 |
{
|
|
Packit |
c22fc9 |
/* global definitions mapping */
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_LINKBEAT_
|
|
Packit |
c22fc9 |
install_keyword_root("linkbeat_use_polling", use_polling_handler, global_active);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
#if HAVE_DECL_CLONE_NEWNET
|
|
Packit |
c22fc9 |
install_keyword_root("net_namespace", &net_namespace_handler, global_active);
|
|
Packit Service |
dfccb1 |
install_keyword_root("net_namespace_ipvs", &net_namespace_ipvs_handler, global_active);
|
|
Packit |
c22fc9 |
install_keyword_root("namespace_with_ipsets", &namespace_ipsets_handler, global_active);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
install_keyword_root("use_pid_dir", &use_pid_dir_handler, global_active);
|
|
Packit |
c22fc9 |
install_keyword_root("instance", &instance_handler, global_active);
|
|
Packit |
c22fc9 |
install_keyword_root("child_wait_time", &child_wait_handler, global_active);
|
|
Packit |
c22fc9 |
install_keyword_root("global_defs", NULL, global_active);
|
|
Packit Service |
dfccb1 |
install_keyword("process_names", &process_names_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("process_name", &process_name_handler);
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_VRRP_
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_process_name", &vrrp_process_name_handler);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_LVS_
|
|
Packit Service |
dfccb1 |
install_keyword("lvs_process_name", &lvs_process_name_handler);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_BFD_
|
|
Packit Service |
dfccb1 |
install_keyword("bfd_process_name", &bfd_process_name_handler);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
install_keyword("router_id", &routerid_handler);
|
|
Packit |
c22fc9 |
install_keyword("notification_email_from", &emailfrom_handler);
|
|
Packit |
c22fc9 |
install_keyword("smtp_server", &smtpserver_handler);
|
|
Packit |
c22fc9 |
install_keyword("smtp_helo_name", &smtphelo_handler);
|
|
Packit |
c22fc9 |
install_keyword("smtp_connect_timeout", &smtpto_handler);
|
|
Packit |
c22fc9 |
install_keyword("notification_email", &email_handler);
|
|
Packit |
c22fc9 |
install_keyword("smtp_alert", &smtp_alert_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("startup_script", &startup_script_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("startup_script_timeout", &startup_script_timeout_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("shutdown_script", &shutdown_script_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("shutdown_script_timeout", &shutdown_script_timeout_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("max_auto_priority", &max_auto_priority_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("min_auto_priority_delay", &min_auto_priority_delay_handler);
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("smtp_alert_vrrp", &smtp_alert_vrrp_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
install_keyword("smtp_alert_checker", &smtp_alert_checker_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("checker_log_all_failures", &checker_log_all_failures_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("dynamic_interfaces", &dynamic_interfaces_handler);
|
|
Packit |
c22fc9 |
install_keyword("no_email_faults", &no_email_faults_handler);
|
|
Packit |
c22fc9 |
install_keyword("default_interface", &default_interface_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
install_keyword("lvs_timeouts", &lvs_timeouts);
|
|
Packit |
c22fc9 |
install_keyword("lvs_flush", &lvs_flush_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("lvs_flush_onstop", &lvs_flush_onstop_handler);
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("lvs_sync_daemon", &lvs_syncd_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("vrrp_mcast_group4", &vrrp_mcast_group4_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_mcast_group6", &vrrp_mcast_group6_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_master_delay", &vrrp_garp_delay_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_master_repeat", &vrrp_garp_rep_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_master_refresh", &vrrp_garp_refresh_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_master_refresh_repeat", &vrrp_garp_refresh_rep_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_lower_prio_delay", &vrrp_garp_lower_prio_delay_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_lower_prio_repeat", &vrrp_garp_lower_prio_rep_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_garp_interval", &vrrp_garp_interval_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_gna_interval", &vrrp_gna_interval_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_min_garp", &vrrp_min_garp_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_lower_prio_no_advert", &vrrp_lower_prio_no_advert_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_higher_prio_send_advert", &vrrp_higher_prio_send_advert_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_version", &vrrp_version_handler);
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_IPTABLES_
|
|
Packit |
c22fc9 |
install_keyword("vrrp_iptables", &vrrp_iptables_handler);
|
|
Packit |
c22fc9 |
#ifdef _HAVE_LIBIPSET_
|
|
Packit |
c22fc9 |
install_keyword("vrrp_ipsets", &vrrp_ipsets_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_NFTABLES_
|
|
Packit Service |
dfccb1 |
install_keyword("nftables", &vrrp_nftables_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("nftables_priority", &vrrp_nftables_priority_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("nftables_counters", &vrrp_nftables_counters_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("nftables_ifindex", &vrrp_nftables_ifindex_handler);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
install_keyword("vrrp_check_unicast_src", &vrrp_check_unicast_src_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_skip_check_adv_addr", &vrrp_check_adv_addr_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_strict", &vrrp_strict_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_priority", &vrrp_prio_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_no_swap", &vrrp_no_swap_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_rt_priority", &vrrp_rt_priority_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_cpu_affinity", &vrrp_cpu_affinity_handler);
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_rlimit_rttime", &vrrp_rt_rlimit_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_rlimit_rtime", &vrrp_rt_rlimit_handler); /* Deprecated 02/02/2020 */
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
install_keyword("notify_fifo", &global_notify_fifo);
|
|
Packit |
c22fc9 |
install_keyword("notify_fifo_script", &global_notify_fifo_script);
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("vrrp_notify_fifo", &vrrp_notify_fifo);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_notify_fifo_script", &vrrp_notify_fifo_script);
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_notify_priority_changes", &vrrp_notify_priority_changes);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
install_keyword("lvs_notify_fifo", &lvs_notify_fifo);
|
|
Packit |
c22fc9 |
install_keyword("lvs_notify_fifo_script", &lvs_notify_fifo_script);
|
|
Packit |
c22fc9 |
install_keyword("checker_priority", &checker_prio_handler);
|
|
Packit |
c22fc9 |
install_keyword("checker_no_swap", &checker_no_swap_handler);
|
|
Packit |
c22fc9 |
install_keyword("checker_rt_priority", &checker_rt_priority_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("checker_cpu_affinity", &checker_cpu_affinity_handler);
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit Service |
dfccb1 |
install_keyword("checker_rlimit_rttime", &checker_rt_rlimit_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("checker_rlimit_rtime", &checker_rt_rlimit_handler); /* Deprecated 02/02/2020 */
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_BFD_
|
|
Packit |
c22fc9 |
install_keyword("bfd_priority", &bfd_prio_handler);
|
|
Packit |
c22fc9 |
install_keyword("bfd_no_swap", &bfd_no_swap_handler);
|
|
Packit |
c22fc9 |
install_keyword("bfd_rt_priority", &bfd_rt_priority_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("bfd_cpu_affinity", &bfd_cpu_affinity_handler);
|
|
Packit |
c22fc9 |
#if HAVE_DECL_RLIMIT_RTTIME == 1
|
|
Packit Service |
dfccb1 |
install_keyword("bfd_rlimit_rttime", &bfd_rt_rlimit_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("bfd_rlimit_rtime", &bfd_rt_rlimit_handler); /* Deprecated 02/02/2020 */
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_
|
|
Packit |
c22fc9 |
install_keyword("snmp_socket", &snmp_socket_handler);
|
|
Packit |
c22fc9 |
install_keyword("enable_traps", &trap_handler);
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("enable_snmp_vrrp", &snmp_vrrp_handler);
|
|
Packit |
c22fc9 |
install_keyword("enable_snmp_keepalived", &snmp_vrrp_handler); /* Deprecated v2.0.0 */
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFC_
|
|
Packit |
c22fc9 |
install_keyword("enable_snmp_rfc", &snmp_rfc_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFCV2_
|
|
Packit |
c22fc9 |
install_keyword("enable_snmp_rfcv2", &snmp_rfcv2_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_RFCV3_
|
|
Packit |
c22fc9 |
install_keyword("enable_snmp_rfcv3", &snmp_rfcv3_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_SNMP_CHECKER_
|
|
Packit |
c22fc9 |
install_keyword("enable_snmp_checker", &snmp_checker_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_DBUS_
|
|
Packit |
c22fc9 |
install_keyword("enable_dbus", &enable_dbus_handler);
|
|
Packit |
c22fc9 |
install_keyword("dbus_service_name", &dbus_service_name_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
install_keyword("script_user", &script_user_handler);
|
|
Packit |
c22fc9 |
install_keyword("enable_script_security", &script_security_handler);
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("vrrp_netlink_cmd_rcv_bufs", &vrrp_netlink_cmd_rcv_bufs_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_netlink_cmd_rcv_bufs_force", &vrrp_netlink_cmd_rcv_bufs_force_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_netlink_monitor_rcv_bufs", &vrrp_netlink_monitor_rcv_bufs_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_netlink_monitor_rcv_bufs_force", &vrrp_netlink_monitor_rcv_bufs_force_handler);
|
|
Packit Service |
dfccb1 |
#ifdef _WITH_CN_PROC_
|
|
Packit Service |
dfccb1 |
install_keyword("process_monitor_rcv_bufs", &process_monitor_rcv_bufs_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("process_monitor_rcv_bufs_force", &process_monitor_rcv_bufs_force_handler);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
install_keyword("lvs_netlink_cmd_rcv_bufs", &lvs_netlink_cmd_rcv_bufs_handler);
|
|
Packit |
c22fc9 |
install_keyword("lvs_netlink_cmd_rcv_bufs_force", &lvs_netlink_cmd_rcv_bufs_force_handler);
|
|
Packit |
c22fc9 |
install_keyword("lvs_netlink_monitor_rcv_bufs", &lvs_netlink_monitor_rcv_bufs_handler);
|
|
Packit |
c22fc9 |
install_keyword("lvs_netlink_monitor_rcv_bufs_force", &lvs_netlink_monitor_rcv_bufs_force_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_LVS_
|
|
Packit |
c22fc9 |
install_keyword("rs_init_notifies", &rs_init_notifies_handler);
|
|
Packit |
c22fc9 |
install_keyword("no_checker_emails", &no_checker_emails_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
#ifdef _WITH_VRRP_
|
|
Packit |
c22fc9 |
install_keyword("vrrp_rx_bufs_policy", &vrrp_rx_bufs_policy_handler);
|
|
Packit |
c22fc9 |
install_keyword("vrrp_rx_bufs_multiplier", &vrrp_rx_bufs_multiplier_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("vrrp_startup_delay", &vrrp_startup_delay_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("log_unknown_vrids", &vrrp_log_unknown_vrids_handler);
|
|
Packit |
c22fc9 |
#endif
|
|
Packit |
c22fc9 |
install_keyword("umask", &umask_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("random_seed", &random_seed_handler);
|
|
Packit Service |
dfccb1 |
#ifndef _ONE_PROCESS_DEBUG_
|
|
Packit Service |
dfccb1 |
install_keyword("reload_time_file", &reload_time_file_handler);
|
|
Packit Service |
dfccb1 |
install_keyword("reload_repeat", &reload_repeat_handler);
|
|
Packit Service |
dfccb1 |
#endif
|
|
Packit |
c22fc9 |
}
|