diff options
| author | Roy Marples <roy@marples.name> | 2013-02-15 20:33:13 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2013-02-15 20:33:13 +0000 |
| commit | fbbb0875dd748a22dcf6d91a7d3cdaed5a90dc58 (patch) | |
| tree | c67f12a8c0734c78e69f12614ec7bbe945547204 /ipv6.c | |
| parent | cebe222c56901ba2f943a07eaf815d9660ba836b (diff) | |
| download | dhcpcd-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.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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; } |
