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 ? : "");
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);
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);
io_add(&device_io, handle_device_data, NULL, device_fd, IO_READ);
/* Run tinc-up script to further initialize the tap interface */
- char *envp[5];
+ char *envp[5] = {NULL};
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
xasprintf(&envp[3], "NAME=%s", myself->name);
- envp[4] = NULL;
execute_script("tinc-up", envp);
close(unix_socket.fd);
#endif
- char *envp[5];
+ char *envp[5] = {NULL};
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
xasprintf(&envp[3], "NAME=%s", myself->name);
- envp[4] = NULL;
exit_requests();
exit_edges();
// Prepare environment variables to be passed to the script
- char *envp[9] = {NULL};
+ char *envp[10] = {NULL};
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
free(address);
}
+ xasprintf(&envp[8], "NAME=%s", myself->name);
+
name = up ? "subnet-up" : "subnet-down";
if(!subnet) {
}
}
- for(int i = 0; envp[i] && i < 8; i++)
+ for(int i = 0; envp[i] && i < 9; i++)
free(envp[i]);
}