OpenVPN
|
#include "syshead.h"
#include "pool.h"
#include "buffer.h"
#include "error.h"
#include "socket.h"
#include "otime.h"
#include "memdbg.h"
Go to the source code of this file.
Functions | |
static void | ifconfig_pool_entry_free (struct ifconfig_pool_entry *ipe, bool hard) |
static int | ifconfig_pool_find (struct ifconfig_pool *pool, const char *common_name) |
bool | ifconfig_pool_verify_range (const int msglevel, const in_addr_t start, const in_addr_t end) |
struct ifconfig_pool * | ifconfig_pool_init (const bool ipv4_pool, enum pool_type type, in_addr_t start, in_addr_t end, const bool duplicate_cn, const bool ipv6_pool, const struct in6_addr ipv6_base, const int ipv6_netbits) |
void | ifconfig_pool_free (struct ifconfig_pool *pool) |
ifconfig_pool_handle | ifconfig_pool_acquire (struct ifconfig_pool *pool, in_addr_t *local, in_addr_t *remote, struct in6_addr *remote_ipv6, const char *common_name) |
bool | ifconfig_pool_release (struct ifconfig_pool *pool, ifconfig_pool_handle hand, const bool hard) |
static ifconfig_pool_handle | ifconfig_pool_ip_base_to_handle (const struct ifconfig_pool *pool, const in_addr_t addr) |
static ifconfig_pool_handle | ifconfig_pool_ipv6_base_to_handle (const struct ifconfig_pool *pool, const struct in6_addr *in_addr) |
static in_addr_t | ifconfig_pool_handle_to_ip_base (const struct ifconfig_pool *pool, ifconfig_pool_handle hand) |
static struct in6_addr | ifconfig_pool_handle_to_ipv6_base (const struct ifconfig_pool *pool, ifconfig_pool_handle hand) |
static void | ifconfig_pool_set (struct ifconfig_pool *pool, const char *cn, ifconfig_pool_handle h, const bool fixed) |
static void | ifconfig_pool_list (const struct ifconfig_pool *pool, struct status_output *out) |
static void | ifconfig_pool_msg (const struct ifconfig_pool *pool, int msglevel) |
struct ifconfig_pool_persist * | ifconfig_pool_persist_init (const char *filename, int refresh_freq) |
void | ifconfig_pool_persist_close (struct ifconfig_pool_persist *persist) |
bool | ifconfig_pool_write_trigger (struct ifconfig_pool_persist *persist) |
void | ifconfig_pool_read (struct ifconfig_pool_persist *persist, struct ifconfig_pool *pool) |
void | ifconfig_pool_write (struct ifconfig_pool_persist *persist, const struct ifconfig_pool *pool) |
ifconfig_pool_handle ifconfig_pool_acquire | ( | struct ifconfig_pool * | pool, |
in_addr_t * | local, | ||
in_addr_t * | remote, | ||
struct in6_addr * | remote_ipv6, | ||
const char * | common_name | ||
) |
Definition at line 306 of file pool.c.
References add_in6_addr(), ASSERT, ifconfig_pool::base, ifconfig_pool_entry::common_name, ifconfig_pool::enabled, IFCONFIG_POOL_30NET, ifconfig_pool_entry_free(), ifconfig_pool_find(), IFCONFIG_POOL_INDIV, ifconfig_pool_entry::in_use, ifconfig_pool::ipv4, ifconfig_pool::ipv6, ifconfig_pool::list, string_alloc(), and ifconfig_pool::type.
Referenced by multi_select_virtual_addr().
|
static |
Definition at line 39 of file pool.c.
References ifconfig_pool_entry::common_name, ifconfig_pool_entry::in_use, ifconfig_pool_entry::last_release, and now.
Referenced by ifconfig_pool_acquire(), ifconfig_pool_free(), ifconfig_pool_release(), and ifconfig_pool_set().
|
static |
Definition at line 58 of file pool.c.
References ifconfig_pool_entry::common_name, ifconfig_pool::duplicate_cn, ifconfig_pool_entry::fixed, ifconfig_pool_entry::in_use, ifconfig_pool_entry::last_release, ifconfig_pool::list, and ifconfig_pool::size.
Referenced by ifconfig_pool_acquire().
void ifconfig_pool_free | ( | struct ifconfig_pool * | pool | ) |
Definition at line 290 of file pool.c.
References ifconfig_pool_entry_free(), ifconfig_pool::list, and ifconfig_pool::size.
Referenced by multi_uninit().
|
static |
Definition at line 446 of file pool.c.
References ASSERT, ifconfig_pool::base, ifconfig_pool::enabled, IFCONFIG_POOL_30NET, IFCONFIG_POOL_INDIV, ifconfig_pool::ipv4, and ifconfig_pool::type.
Referenced by ifconfig_pool_list().
|
static |
Definition at line 475 of file pool.c.
References add_in6_addr().
Referenced by ifconfig_pool_list().
struct ifconfig_pool* ifconfig_pool_init | ( | const bool | ipv4_pool, |
enum pool_type | type, | ||
in_addr_t | start, | ||
in_addr_t | end, | ||
const bool | duplicate_cn, | ||
const bool | ipv6_pool, | ||
const struct in6_addr | ipv6_base, | ||
const int | ipv6_netbits | ||
) |
Definition at line 146 of file pool.c.
References ALLOC_ARRAY_CLEAR, ALLOC_OBJ_CLEAR, ASSERT, ifconfig_pool::base, D_IFCONFIG_POOL, ifconfig_pool::duplicate_cn, ifconfig_pool::enabled, gc_free(), gc_new(), IFCONFIG_POOL_30NET, IFCONFIG_POOL_INDIV, IFCONFIG_POOL_MAX, ifconfig_pool::ipv4, ifconfig_pool::ipv6, ifconfig_pool::list, M_FATAL, M_INFO, M_WARN, msg, print_in6_addr(), print_in_addr_t(), ifconfig_pool::size, and ifconfig_pool::type.
Referenced by multi_init().
|
static |
Definition at line 375 of file pool.c.
References ASSERT, ifconfig_pool::base, IFCONFIG_POOL_30NET, IFCONFIG_POOL_INDIV, ifconfig_pool::ipv4, ifconfig_pool::size, and ifconfig_pool::type.
Referenced by ifconfig_pool_read().
|
static |
Definition at line 406 of file pool.c.
References ifconfig_pool::base, ifconfig_pool::ipv6, and ifconfig_pool::size.
Referenced by ifconfig_pool_read().
|
static |
Definition at line 500 of file pool.c.
References ifconfig_pool_entry::common_name, ifconfig_pool::enabled, gc_free(), gc_new(), ifconfig_pool_handle_to_ip_base(), ifconfig_pool_handle_to_ipv6_base(), ifconfig_pool::ipv4, ifconfig_pool::ipv6, ifconfig_pool::list, print_in6_addr(), print_in_addr_t(), ifconfig_pool::size, and status_printf().
Referenced by ifconfig_pool_msg(), and ifconfig_pool_write().
|
static |
Definition at line 537 of file pool.c.
References ASSERT, ifconfig_pool_list(), status_output::msglevel, status_close(), status_open(), and status_printf().
Referenced by ifconfig_pool_read().
void ifconfig_pool_persist_close | ( | struct ifconfig_pool_persist * | persist | ) |
Definition at line 572 of file pool.c.
References ifconfig_pool_persist::file, and status_close().
Referenced by do_close_ifconfig_pool_persist().
struct ifconfig_pool_persist* ifconfig_pool_persist_init | ( | const char * | filename, |
int | refresh_freq | ||
) |
Definition at line 551 of file pool.c.
References ALLOC_OBJ_CLEAR, ASSERT, ifconfig_pool_persist::file, ifconfig_pool_persist::fixed, status_open(), STATUS_OUTPUT_READ, and STATUS_OUTPUT_WRITE.
Referenced by do_open_ifconfig_pool_persist().
void ifconfig_pool_read | ( | struct ifconfig_pool_persist * | persist, |
struct ifconfig_pool * | pool | ||
) |
Definition at line 598 of file pool.c.
References ALLOC_ARRAY_CLEAR_GC, alloc_buf_gc(), ASSERT, BLEN, BSTR, buf_init, buf_parse(), D_IFCONFIG_POOL, ifconfig_pool_persist::file, ifconfig_pool_persist::fixed, gc_free(), gc_new(), get_ipv6_addr(), getaddr(), GETADDR_HOST_ORDER, ifconfig_pool_ip_base_to_handle(), ifconfig_pool_ipv6_base_to_handle(), ifconfig_pool_msg(), ifconfig_pool_set(), M_INFO, M_WARN, msg, status_read(), and update_time().
Referenced by multi_init().
bool ifconfig_pool_release | ( | struct ifconfig_pool * | pool, |
ifconfig_pool_handle | hand, | ||
const bool | hard | ||
) |
Definition at line 357 of file pool.c.
References ifconfig_pool_entry_free(), and ifconfig_pool::list.
Referenced by multi_close_instance(), and multi_select_virtual_addr().
|
static |
Definition at line 488 of file pool.c.
References ifconfig_pool_entry::common_name, ifconfig_pool_entry::fixed, ifconfig_pool_entry_free(), ifconfig_pool_entry::in_use, ifconfig_pool_entry::last_release, ifconfig_pool::list, now, and string_alloc().
Referenced by ifconfig_pool_read().
bool ifconfig_pool_verify_range | ( | const int | msglevel, |
const in_addr_t | start, | ||
const in_addr_t | end | ||
) |
Definition at line 121 of file pool.c.
References gc_free(), gc_new(), IFCONFIG_POOL_MAX, msg, and print_in_addr_t().
Referenced by add_option(), and helper_client_server().
void ifconfig_pool_write | ( | struct ifconfig_pool_persist * | persist, |
const struct ifconfig_pool * | pool | ||
) |
Definition at line 733 of file pool.c.
References ifconfig_pool_persist::file, ifconfig_pool_list(), status_flush(), STATUS_OUTPUT_WRITE, status_reset(), and status_rw_flags().
Referenced by multi_ifconfig_pool_persist().
bool ifconfig_pool_write_trigger | ( | struct ifconfig_pool_persist * | persist | ) |
Definition at line 585 of file pool.c.
References ifconfig_pool_persist::file, and status_trigger().
Referenced by multi_ifconfig_pool_persist().