8#ifdef ENABLE_MANAGEMENT
15 unsigned int *option_types_found,
struct buffer *buf,
bool msg_sender)
49#ifdef ENABLE_MANAGEMENT
72 size_t src_len = strlen(src);
73 size_t con_len = continuation ? strlen(continuation) : 0;
149 unsigned int option_types_found = 0;
159 const char *canary =
"canary";
163 while (msgs[++
i].data && *(msgs[
i].data))
190 msg(
M_WARN,
"Failed to process push update message sent to client ID: %u",
c->c2.tls_multi->peer_id);
209 o.ifconfig_local =
NULL;
211 if (
o.ifconfig_ipv6_local && !
strcmp(
o.ifconfig_ipv6_local,
canary))
213 o.ifconfig_ipv6_local =
NULL;
256 msg(
M_WARN,
"WARN: PUSH_UPDATE messages cannot currently be sent while DCO is enabled."
257 " To send a PUSH_UPDATE message, be sure to use the --disable-dco option.");
271 ASSERT(push_bundle_size > extra);
272 const size_t safe_cap = push_bundle_size - extra;
273 size_t msgs_num = (strlen(
msg) / safe_cap) + ((strlen(
msg) % safe_cap) != 0);
341#define RETURN_UPDATE_STATUS(n_sent) \
346 msg(M_CLIENT, "SUCCESS: %d client(s) updated", (n_sent)); \
351 msg(M_CLIENT, "ERROR: no client updated"); \
bool buf_string_compare_advance(struct buffer *src, const char *match)
bool buf_printf(struct buffer *buf, const char *format,...)
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static int buf_read_u8(struct buffer *buf)
static void gc_free(struct gc_arena *a)
static struct gc_arena gc_new(void)
bool send_control_channel_string(struct context *c, const char *str, msglvl_t msglevel)
unsigned int pull_permission_mask(const struct context *c)
void hash_iterator_free(struct hash_iterator *hi)
struct hash_element * hash_iterator_next(struct hash_iterator *hi)
void hash_iterator_init(struct hash *hash, struct hash_iterator *hi)
struct multi_instance * lookup_by_cid(struct multi_context *m, const unsigned long cid)
void unlearn_ifconfig_ipv6(struct multi_context *m, struct multi_instance *mi)
void unlearn_ifconfig(struct multi_context *m, struct multi_instance *mi)
void update_vhash(struct multi_context *m, struct multi_instance *mi, const char *new_ip, const char *new_ipv6)
Update the vhash with new IP/IPv6 addresses in the multi_context when a push-update message containin...
Header file for server-mode related structures and functions.
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
bool apply_push_options(struct context *c, struct options *options, struct buffer *buf, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es, bool is_update)
#define PUSH_MSG_CONTINUATION
static struct buffer forge_msg(const char *src, const char *continuation, struct gc_arena *gc)
static bool support_push_update(struct multi_instance *mi)
int process_push_update(struct context *c, struct options *o, unsigned int permission_mask, unsigned int *option_types_found, struct buffer *buf, bool msg_sender)
Handles the receiving of a push-update message and applies updates to the specified options.
static bool message_splitter(const char *s, struct buffer *msgs, struct gc_arena *gc, const size_t safe_cap)
#define RETURN_UPDATE_STATUS(n_sent)
static int send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const size_t push_bundle_size)
A function to send a PUSH_UPDATE control message from server to client(s).
bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options)
static bool send_single_push_update(struct multi_context *m, struct multi_instance *mi, struct buffer *msgs)
static size_t find_first_comma_of_next_bundle(const char *str, size_t ix)
Return index of last , or 0 if it didn't find any.
bool management_callback_send_push_update_broadcast(void *arg, const char *options)
static char * gc_strdup(const char *src, struct gc_arena *gc)
void throw_signal_soft(const int signum, const char *signal_text)
Throw a soft global signal.
#define IV_PROTO_PUSH_UPDATE
Supports push-update.
unsigned int extract_iv_proto(const char *peer_info)
Extracts the IV_PROTO variable and returns its value or 0 if it cannot be extracted.
Wrapper structure for dynamically allocated memory.
uint8_t * data
Pointer to the allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
bool push_ifconfig_ipv6_defined
bool push_ifconfig_defined
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
Contains all state information for one tunnel.
struct context_2 c2
Level 2 context.
Garbage collection arena used to keep track of dynamically allocated memory.
Main OpenVPN server state structure.
struct hash * iter
VPN tunnel instances indexed by real address of the remote peer, optimized for iteration.
Server-mode state structure for one single VPN tunnel.
struct context context
The context structure storing state for this VPN tunnel.
const char * ifconfig_ipv6_local
const char * ifconfig_local
char * peer_info
A multi-line string of general-purpose info received from peer over control channel.