/*
subnet.c -- handle subnet lookups and lists
- Copyright (C) 2000-2009 Guus Sliepen <guus@tinc-vpn.org>,
+ Copyright (C) 2000-2010 Guus Sliepen <guus@tinc-vpn.org>,
2000-2005 Ivo Timmermans
This program is free software; you can redistribute it and/or modify
static bool cache_mac_valid[2];
static int cache_mac_slot;
-void subnet_cache_flush() {
+void subnet_cache_flush(void) {
cache_ipv4_valid[0] = cache_ipv4_valid[1] = false;
cache_ipv6_valid[0] = cache_ipv6_valid[1] = false;
cache_mac_valid[0] = cache_mac_valid[1] = false;
void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
splay_node_t *node;
int i;
- char *envp[9] = {0};
+ char *envp[9] = {NULL};
char netstr[MAXNETSTR];
char *name, *address, *port;
char empty[] = "";
if(!net2str(netstr, sizeof netstr, subnet))
continue;
// Strip the weight from the subnet, and put it in its own environment variable
- char *weight = strchr(netstr + 7, '#');
+ char *weight = strchr(netstr, '#');
if(weight)
*weight++ = 0;
else
execute_script(name, envp);
}
} else {
- if(net2str(netstr + 7, sizeof netstr - 7, subnet)) {
+ if(net2str(netstr, sizeof netstr, subnet)) {
// Strip the weight from the subnet, and put it in its own environment variable
- char *weight = strchr(netstr + 7, '#');
+ char *weight = strchr(netstr, '#');
if(weight)
*weight++ = 0;
else
}
}
- for(i = 0; envp[i] && i < 9; i++)
+ for(i = 0; envp[i] && i < 8; i++)
free(envp[i]);
}