From: Guus Sliepen Date: Mon, 12 Jun 2006 21:45:39 +0000 (+0000) Subject: Add generic host-up and host-down scripts. X-Git-Tag: import-tinc-1.1~716 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=2077451e07f93edc520cf5bc31815624a2b03fdd;p=meshlink Add generic host-up and host-down scripts. Thanks to Menno Smits for a patch. --- diff --git a/doc/tinc.conf.5.in b/doc/tinc.conf.5.in index d1d781a5..750e0cf2 100644 --- a/doc/tinc.conf.5.in +++ b/doc/tinc.conf.5.in @@ -346,6 +346,10 @@ becomes reachable. This script is started when the tinc daemon with name .Ar HOST becomes unreachable. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-up +This script is started when any host becomes reachable. +.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-down +This script is started when any host becomes unreachable. .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up This script is started when a Subnet becomes reachable. The Subnet and the node it belongs to are passed in environment variables. diff --git a/doc/tinc.texi b/doc/tinc.texi index bf504095..82a0be46 100644 --- a/doc/tinc.texi +++ b/doc/tinc.texi @@ -1096,6 +1096,12 @@ This script is started when the tinc daemon with name @var{host} becomes reachab @item @value{sysconfdir}/tinc/@var{netname}/hosts/@var{host}-down This script is started when the tinc daemon with name @var{host} becomes unreachable. +@item @value{sysconfdir}/tinc/@var{netname}/host-up +This script is started when any host becomes reachable. + +@item @value{sysconfdir}/tinc/@var{netname}/host-down +This script is started when any host becomes unreachable. + @item @value{sysconfdir}/tinc/@var{netname}/subnet-up This script is started when a Subnet becomes reachable. The Subnet and the node it belongs to are passed in environment variables. diff --git a/src/graph.c b/src/graph.c index 691a5adb..2fc3b744 100644 --- a/src/graph.c +++ b/src/graph.c @@ -283,6 +283,8 @@ void sssp_bfs(void) asprintf(&envp[5], "REMOTEPORT=%s", port); envp[6] = NULL; + execute_script(n->status.reachable ? "host-up" : "host-down", envp); + asprintf(&name, n->status.reachable ? "hosts/%s-up" : "hosts/%s-down", n->name);