Set $NAME when calling host-up/down and subnet-up/down scripts.

This commit is contained in:
Guus Sliepen 2013-07-05 21:36:51 +02:00
parent b811e980e3
commit 2eba793305
3 changed files with 9 additions and 9 deletions

View file

@ -235,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 ? : "");
@ -244,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);
@ -255,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);