diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-03-23 13:13:06 +0100 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2014-03-23 19:51:52 +0100 |
commit | e719a0535345db8f0781c0b80408ca5417597469 (patch) | |
tree | 82080da0cedbd3e52b11816b759f0294c64452f3 /src/openvpn/buffer.c | |
parent | fb69bfd05eef20547848f901bb66d394f64308a2 (diff) | |
download | openvpn-e719a0535345db8f0781c0b80408ca5417597469.tar.gz openvpn-e719a0535345db8f0781c0b80408ca5417597469.tar.xz openvpn-e719a0535345db8f0781c0b80408ca5417597469.zip |
Introduce an option to resolve dns names in advance for --remote, --local and --http-proxy
Also introduce x_gc_addspeical function that allows to add objects with a
custom free function to the gc.
Some additional addrinfo cleanup
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1395576786-17507-1-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8386
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/buffer.c')
-rw-r--r-- | src/openvpn/buffer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index fb3b52d..3661141 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -372,6 +372,44 @@ x_gc_free (struct gc_arena *a) } /* + * Functions to handle special objects in gc_entries + */ + +void +x_gc_freespecial (struct gc_arena *a) +{ + struct gc_entry_special *e; + e = a->list_special; + a->list_special = NULL; + + while (e != NULL) + { + struct gc_entry_special *next = e->next; + e->free_fnc (e->addr); + free(e); + e = next; + } +} + +void gc_addspecial (void *addr, void (free_function)(void*), struct gc_arena *a) +{ + ASSERT(a); + struct gc_entry_special *e; +#ifdef DMALLOC + e = (struct gc_entry_special *) openvpn_dmalloc (file, line, sizeof (struct gc_entry_special)); +#else + e = (struct gc_entry_special *) malloc (sizeof (struct gc_entry_special)); +#endif + check_malloc_return (e); + e->free_fnc = free_function; + e->addr = addr; + + e->next = a->list_special; + a->list_special = e; +} + + +/* * Transfer src arena to dest, resetting src to an empty arena. */ void |