bool indirect;
char *name;
char *address, *port;
- char *envp[7];
+ char *envp[8] = {NULL};
int i;
todo_list = list_alloc(NULL);
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(i = 0; i < 6; i++)
+ for(i = 0; i < 7; i++)
free(envp[i]);
subnet_update(n, NULL, n->status.reachable);
char *address = NULL;
char *proxy = NULL;
char *space;
- char *envp[5];
+ char *envp[5] = {NULL};
struct addrinfo *ai, *aip, hint = {0};
bool choice;
int i, err;
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);
- for(i = 0; i < 5; i++)
+ for(i = 0; i < 4; i++)
free(envp[i]);
/* Run subnet-up scripts for our own subnets */
void close_network_connections(void) {
avl_node_t *node, *next;
connection_t *c;
- char *envp[5];
+ char *envp[5] = {NULL};
int i;
for(node = connection_tree->head; node; node = next) {
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();
void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
avl_node_t *node;
int i;
- char *envp[9] = {NULL};
+ char *envp[10] = {NULL};
char netstr[MAXNETSTR];
char *name, *address, *port;
char empty[] = "";
free(address);
}
+ xasprintf(&envp[8], "NAME=%s", myself->name);
+
name = up ? "subnet-up" : "subnet-down";
if(!subnet) {