summaryrefslogtreecommitdiffstats
path: root/ipv6.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2013-02-15 20:33:13 +0000
committerRoy Marples <roy@marples.name>2013-02-15 20:33:13 +0000
commitfbbb0875dd748a22dcf6d91a7d3cdaed5a90dc58 (patch)
treec67f12a8c0734c78e69f12614ec7bbe945547204 /ipv6.c
parentcebe222c56901ba2f943a07eaf815d9660ba836b (diff)
downloaddhcpcd-fbbb0875dd748a22dcf6d91a7d3cdaed5a90dc58.tar.xz
Instead of opening link, ipv6, ipv6rs and ipv6ns sockets globally,
only open when the first link wanting this features needs it. Hopefully fixes #263 and #264.
Diffstat (limited to 'ipv6.c')
-rw-r--r--ipv6.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ipv6.c b/ipv6.c
index 03a8dc16..fc15883d 100644
--- a/ipv6.c
+++ b/ipv6.c
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
+#include <unistd.h>
#include "common.h"
#include "dhcpcd.h"
@@ -66,14 +67,15 @@ ipv6_cleanup()
int ipv6_init(void)
{
- routes = malloc(sizeof(*routes));
- if (routes == NULL)
- return -1;
-
- TAILQ_INIT(routes);
+ if (routes == NULL) {
+ routes = malloc(sizeof(*routes));
+ if (routes == NULL)
+ return -1;
+ TAILQ_INIT(routes);
#ifdef DEBUG_MEMORY
- atexit(ipv6_cleanup);
+ atexit(ipv6_cleanup);
#endif
+ }
return 0;
}