aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/pingu.conf.5.in3
-rw-r--r--pingu_conf.c17
2 files changed, 15 insertions, 5 deletions
diff --git a/man/pingu.conf.5.in b/man/pingu.conf.5.in
index 8a8cced..a33f11e 100644
--- a/man/pingu.conf.5.in
+++ b/man/pingu.conf.5.in
@@ -62,6 +62,9 @@ gateway online.
The alternate route table for this interface.
.It Cd rule-priority
The preference value for the ip rule.
+.It Cd ping
+Host to ping to verify that gateway is still up. This is the same as defining
+a host and bind it to interface.
.El
.Sh HOST CONTEXT
diff --git a/pingu_conf.c b/pingu_conf.c
index 09fe1b1..57629b9 100644
--- a/pingu_conf.c
+++ b/pingu_conf.c
@@ -110,6 +110,14 @@ static char *pingu_conf_read_key_value(struct pingu_conf *conf, char **key,
return line;
}
+static struct pingu_host *pingu_conf_new_host(const char *hoststr)
+{
+ return pingu_host_new(xstrdup(hoststr), default_burst_interval,
+ default_max_retries, default_required_replies,
+ default_timeout, default_up_action,
+ default_down_action);
+}
+
static int pingu_conf_read_iface(struct pingu_conf *conf, char *ifname)
{
struct pingu_iface *iface;
@@ -151,6 +159,9 @@ static int pingu_conf_read_iface(struct pingu_conf *conf, char *ifname)
}
}
pingu_iface_set_balance(iface, weight);
+ } else if (strcmp(key, "ping") == 0) {
+ struct pingu_host *host = pingu_conf_new_host(value);
+ host->iface = iface;
} else {
log_error("Unknown keyword '%s' on line %i", key,
conf->lineno);
@@ -162,12 +173,8 @@ static int pingu_conf_read_iface(struct pingu_conf *conf, char *ifname)
static int pingu_conf_read_host(struct pingu_conf *conf, char *hoststr)
{
char *key, *value;
- struct pingu_host *host;
+ struct pingu_host *host = pingu_conf_new_host(hoststr);
- host = pingu_host_new(xstrdup(hoststr), default_burst_interval,
- default_max_retries, default_required_replies,
- default_timeout, default_up_action,
- default_down_action);
while (pingu_conf_read_key_value(conf, &key, &value)) {
if (key == NULL || key[0] == '}')
break;