Add generic host-up and host-down scripts.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 12 Jun 2006 21:45:39 +0000 (21:45 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 12 Jun 2006 21:45:39 +0000 (21:45 +0000)
Thanks to Menno Smits for a patch.

doc/tinc.conf.5.in
doc/tinc.texi
src/graph.c

index d1d781a5775b10cec695a6362c3ebb01a559018d..750e0cf2b77fd7cc7603d5fa792b0095c26568c3 100644 (file)
@@ -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.
index bf504095c55ed69e05bf0870cec52dd835b5c55b..82a0be46b21e90173937f66c8c671100f4bca97a 100644 (file)
@@ -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.
index 691a5adb0bda04f97226d96510aaef9271305e51..2fc3b744c4e13fde81ed1d583f6d3b70df304628 100644 (file)
@@ -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);