X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=inline;f=src%2Fdhcpd-pools.c;h=cf03db63c8bdd0a40410bca72aa26ad8b5e06c91;hb=dd5b77b62c2f2132392af4f5bacb551546cb2c5c;hp=00b7efcdef58e0a8714bc101e479845038a69bc8;hpb=f6880ed5f48e1591007246760a64cfc33d5f1eb4;p=debian%2Fdhcpd-pools.git diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 00b7efc..cf03db6 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -20,9 +20,6 @@ #endif #include -#ifdef HAVE_UNISTD_H -#include -#endif #ifdef HAVE_STDLIB_H #include #else /* Not STDC_HEADERS */ @@ -33,12 +30,12 @@ extern char *malloc(); #else #include #endif -#include -#include #include +#include +#include -#include "dhcpd-pools.h" #include "defaults.h" +#include "dhcpd-pools.h" int main(int argc, char **argv) { @@ -189,9 +186,7 @@ int main(int argc, char **argv) /* Do the job */ prepare_memory(); - parse_config(true, config.dhcpdconf_file, shared_net_names, - shared_net_names + strlen(shared_net_names) + 1, - shared_networks); + parse_config(true, config.dhcpdconf_file, shared_networks); parse_leases(); prepare_data(); @@ -213,16 +208,19 @@ int main(int argc, char **argv) /* Global allocations, counter resets etc */ int prepare_memory() { + RANGES = 64; num_ranges = num_shared_networks = 0; shared_networks = safe_malloc(sizeof(struct shared_network_t) * SHARED_NETWORKS); - shared_net_names = - safe_malloc(sizeof(char) * SHARED_NETWORKS_NAMES); ranges = safe_malloc(sizeof(struct range_t) * RANGES); macaddr = NULL; /* First shared network entry is all networks */ - strcpy(shared_net_names, "All networks"); + shared_networks->name = safe_strdup("All networks"); + shared_networks->used = 0; + shared_networks->touched = 0; + shared_networks->backups = 0; + return 0; }