X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fgraph.c;h=396e35a3e68d2e9373a6dde4a753402ad7d4228f;hb=22d804d4467cfe9f3926ab6d37b69c3760395b6c;hp=45063795893e7789b586f4dd61577915c7aa98af;hpb=4c30004cb6dc23616d7295b0ce631f066e7f1f82;p=tinc diff --git a/src/graph.c b/src/graph.c index 45063795..396e35a3 100644 --- a/src/graph.c +++ b/src/graph.c @@ -44,7 +44,6 @@ #include "system.h" -#include "config.h" #include "connection.h" #include "device.h" #include "edge.h" @@ -54,8 +53,8 @@ #include "names.h" #include "netutl.h" #include "node.h" -#include "process.h" #include "protocol.h" +#include "script.h" #include "subnet.h" #include "utils.h" #include "xalloc.h" @@ -236,7 +235,7 @@ static void check_reachability(void) { char *name; char *address; char *port; - char *envp[7]; + char *envp[8] = {NULL}; xasprintf(&envp[0], "NETNAME=%s", netname ? : ""); xasprintf(&envp[1], "DEVICE=%s", device ? : ""); @@ -245,7 +244,7 @@ static void check_reachability(void) { sockaddr2str(&n->address, &address, &port); xasprintf(&envp[4], "REMOTEADDRESS=%s", address); xasprintf(&envp[5], "REMOTEPORT=%s", port); - envp[6] = NULL; + xasprintf(&envp[6], "NAME=%s", myself->name); execute_script(n->status.reachable ? "host-up" : "host-down", envp); @@ -256,7 +255,7 @@ static void check_reachability(void) { free(address); free(port); - for(int i = 0; i < 6; i++) + for(int i = 0; i < 7; i++) free(envp[i]); subnet_update(n, NULL, n->status.reachable);