OpenVPN
|
#include "syshead.h"
#include "socket.h"
#include "fdmisc.h"
#include "misc.h"
#include "gremlin.h"
#include "plugin.h"
#include "ps.h"
#include "run_command.h"
#include "manage.h"
#include "openvpn.h"
#include "forward.h"
#include "memdbg.h"
Go to the source code of this file.
Data Structures | |
struct | proto_names |
Macros | |
#define | IF_NAMESIZE 16 |
#define | UINT8_MAX 0xff |
Functions | |
static unsigned int | sf2gaf (const unsigned int getaddr_flags, const unsigned int sockflags) |
static int | get_addr_generic (sa_family_t af, unsigned int flags, const char *hostname, void *network, unsigned int *netbits, int resolve_retry_seconds, struct signal_info *sig_info, int msglevel) |
in_addr_t | getaddr (unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded, struct signal_info *sig_info) |
Translate an IPv4 addr or hostname from string form to in_addr_t. More... | |
bool | get_ipv6_addr (const char *hostname, struct in6_addr *network, unsigned int *netbits, int msglevel) |
Translate an IPv6 addr or hostname from string form to in6_addr. More... | |
static bool | streqnull (const char *a, const char *b) |
static int | get_cached_dns_entry (struct cached_dns_entry *dns_cache, const char *hostname, const char *servname, int ai_family, int resolve_flags, struct addrinfo **ai) |
static int | do_preresolve_host (struct context *c, const char *hostname, const char *servname, const int af, const int flags) |
void | do_preresolve (struct context *c) |
int | openvpn_getaddrinfo (unsigned int flags, const char *hostname, const char *servname, int resolve_retry_seconds, struct signal_info *sig_info, int ai_family, struct addrinfo **res) |
int | openvpn_inet_aton (const char *dotted_quad, struct in_addr *addr) |
bool | ip_addr_dotted_quad_safe (const char *dotted_quad) |
bool | ipv6_addr_safe (const char *ipv6_text_addr) |
static bool | dns_addr_safe (const char *addr) |
bool | ip_or_dns_addr_safe (const char *addr, const bool allow_fqdn) |
bool | mac_addr_safe (const char *mac_addr) |
static int | socket_get_sndbuf (socket_descriptor_t sd) |
static void | socket_set_sndbuf (socket_descriptor_t sd, int size) |
static int | socket_get_rcvbuf (socket_descriptor_t sd) |
static bool | socket_set_rcvbuf (socket_descriptor_t sd, int size) |
static void | socket_set_buffers (socket_descriptor_t fd, const struct socket_buffer_size *sbs) |
static bool | socket_set_tcp_nodelay (socket_descriptor_t sd, int state) |
static void | socket_set_mark (socket_descriptor_t sd, int mark) |
static bool | socket_set_flags (socket_descriptor_t sd, unsigned int sockflags) |
bool | link_socket_update_flags (struct link_socket *ls, unsigned int sockflags) |
void | link_socket_update_buffer_sizes (struct link_socket *ls, int rcvbuf, int sndbuf) |
socket_descriptor_t | create_socket_tcp (struct addrinfo *addrinfo) |
static socket_descriptor_t | create_socket_udp (struct addrinfo *addrinfo, const unsigned int flags) |
static void | bind_local (struct link_socket *sock, const sa_family_t ai_family) |
static void | create_socket (struct link_socket *sock, struct addrinfo *addr) |
static void | socket_do_listen (socket_descriptor_t sd, const struct addrinfo *local, bool do_listen, bool do_set_nonblock) |
socket_descriptor_t | socket_do_accept (socket_descriptor_t sd, struct link_socket_actual *act, const bool nowait) |
static void | tcp_connection_established (const struct link_socket_actual *act) |
static socket_descriptor_t | socket_listen_accept (socket_descriptor_t sd, struct link_socket_actual *act, const char *remote_dynamic, const struct addrinfo *local, bool do_listen, bool nowait, volatile int *signal_received) |
void | socket_bind (socket_descriptor_t sd, struct addrinfo *local, int ai_family, const char *prefix, bool ipv6only) |
int | openvpn_connect (socket_descriptor_t sd, const struct sockaddr *remote, int connect_timeout, volatile int *signal_received) |
void | set_actual_address (struct link_socket_actual *actual, struct addrinfo *ai) |
static void | socket_connect (socket_descriptor_t *sd, const struct sockaddr *dest, const int connect_timeout, struct signal_info *sig_info) |
static void | stream_buf_init (struct stream_buf *sb, struct buffer *buf, const unsigned int sockflags, const int proto) |
static void | stream_buf_close (struct stream_buf *sb) |
static bool | stream_buf_added (struct stream_buf *sb, int length_added) |
static void | socket_frame_init (const struct frame *frame, struct link_socket *sock) |
static void | resolve_bind_local (struct link_socket *sock, const sa_family_t af) |
static void | resolve_remote (struct link_socket *sock, int phase, const char **remote_dynamic, struct signal_info *sig_info) |
struct link_socket * | link_socket_new (void) |
void | link_socket_init_phase1 (struct context *c, int mode) |
static void | phase2_set_socket_flags (struct link_socket *sock) |
static void | linksock_print_addr (struct link_socket *sock) |
static void | phase2_tcp_server (struct link_socket *sock, const char *remote_dynamic, struct signal_info *sig_info) |
static void | phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) |
static void | phase2_socks_client (struct link_socket *sock, struct signal_info *sig_info) |
static void | create_socket_dco_win (struct context *c, struct link_socket *sock, struct signal_info *sig_info) |
void | link_socket_init_phase2 (struct context *c) |
void | link_socket_close (struct link_socket *sock) |
void | setenv_trusted (struct env_set *es, const struct link_socket_info *info) |
static void | ipchange_fmt (const bool include_cmd, struct argv *argv, const struct link_socket_info *info, struct gc_arena *gc) |
void | link_socket_connection_initiated (struct link_socket_info *info, const struct link_socket_actual *act, const char *common_name, struct env_set *es) |
void | link_socket_bad_incoming_addr (struct buffer *buf, const struct link_socket_info *info, const struct link_socket_actual *from_addr) |
void | link_socket_bad_outgoing_addr (void) |
in_addr_t | link_socket_current_remote (const struct link_socket_info *info) |
const struct in6_addr * | link_socket_current_remote_ipv6 (const struct link_socket_info *info) |
const char * | socket_stat (const struct link_socket *s, unsigned int rwflags, struct gc_arena *gc) |
static void | stream_buf_reset (struct stream_buf *sb) |
static void | stream_buf_set_next (struct stream_buf *sb) |
static void | stream_buf_get_final (struct stream_buf *sb, struct buffer *buf) |
static void | stream_buf_get_next (struct stream_buf *sb, struct buffer *buf) |
bool | stream_buf_read_setup_dowork (struct link_socket *sock) |
event_t | socket_listen_event_handle (struct link_socket *s) |
const char * | print_sockaddr_ex (const struct sockaddr *sa, const char *separator, const unsigned int flags, struct gc_arena *gc) |
const char * | print_link_socket_actual (const struct link_socket_actual *act, struct gc_arena *gc) |
const char * | print_link_socket_actual_ex (const struct link_socket_actual *act, const char *separator, const unsigned int flags, struct gc_arena *gc) |
const char * | print_in_addr_t (in_addr_t addr, unsigned int flags, struct gc_arena *gc) |
const char * | print_in6_addr (struct in6_addr a6, unsigned int flags, struct gc_arena *gc) |
const char * | print_in_port_t (in_port_t port, struct gc_arena *gc) |
struct in6_addr | add_in6_addr (struct in6_addr base, uint32_t add) |
void | setenv_sockaddr (struct env_set *es, const char *name_prefix, const struct openvpn_sockaddr *addr, const unsigned int flags) |
void | setenv_in_addr_t (struct env_set *es, const char *name_prefix, in_addr_t addr, const unsigned int flags) |
void | setenv_in6_addr (struct env_set *es, const char *name_prefix, const struct in6_addr *addr, const unsigned int flags) |
void | setenv_link_socket_actual (struct env_set *es, const char *name_prefix, const struct link_socket_actual *act, const unsigned int flags) |
int | ascii2proto (const char *proto_name) |
sa_family_t | ascii2af (const char *proto_name) |
const char * | proto2ascii (int proto, sa_family_t af, bool display_form) |
const char * | proto2ascii_all (struct gc_arena *gc) |
const char * | addr_family_name (int af) |
const char * | proto_remote (int proto, bool remote) |
void | bad_address_length (int actual, int expected) |
int | link_socket_read_tcp (struct link_socket *sock, struct buffer *buf) |
int | link_socket_write_tcp (struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) |
static int | socket_get_last_error (const struct link_socket *sock) |
int | socket_recv_queue (struct link_socket *sock, int maxsize) |
int | socket_send_queue (struct link_socket *sock, struct buffer *buf, const struct link_socket_actual *to) |
int | sockethandle_finalize (sockethandle_t sh, struct overlapped_io *io, struct buffer *buf, struct link_socket_actual *from) |
unsigned int | socket_set (struct link_socket *s, struct event_set *es, unsigned int rwflags, void *arg, unsigned int *persistent) |
void | sd_close (socket_descriptor_t *sd) |
Variables | |
static const struct proto_names | proto_names [] |
struct in6_addr add_in6_addr | ( | struct in6_addr | base, |
uint32_t | add | ||
) |
Definition at line 2955 of file socket.c.
References UINT8_MAX.
Referenced by helper_client_server(), ifconfig_pool_acquire(), and ifconfig_pool_handle_to_ipv6_base().
const char* addr_family_name | ( | int | af | ) |
Definition at line 3167 of file socket.c.
Referenced by dco_create_socket(), link_socket_init_phase2(), and socket_bind().
sa_family_t ascii2af | ( | const char * | proto_name | ) |
Definition at line 3114 of file socket.c.
References proto_names::proto_af, proto_names::short_form, and SIZE.
Referenced by add_option().
int ascii2proto | ( | const char * | proto_name | ) |
Definition at line 3100 of file socket.c.
References proto_names::proto, proto_names::short_form, and SIZE.
Referenced by add_option().
void bad_address_length | ( | int | actual, |
int | expected | ||
) |
Definition at line 3219 of file socket.c.
Referenced by socket_recv_queue(), and sockethandle_finalize().
|
static |
Definition at line 1086 of file socket.c.
References link_socket_info::bind_ipv6_only, link_socket_addr::bind_local, link_socket::bind_local, link_socket::ctrl_sd, link_socket::info, link_socket_info::lsa, link_socket_info::proto, PROTO_UDP, link_socket::sd, socket_bind(), and link_socket::socks_proxy.
Referenced by create_socket(), dco_create_socket(), and show_connection_entry().
|
static |
Definition at line 1106 of file socket.c.
References link_socket_info::af, ASSERT, link_socket::bind_dev, bind_local(), create_socket_tcp(), create_socket_udp(), link_socket::ctrl_sd, link_socket::info, M_ERRNO, M_INFO, M_WARN, link_socket::mark, msg, link_socket::sd, SF_GETADDRINFO_DGRAM, link_socket::socket_buffer_sizes, socket_set_buffers(), socket_set_mark(), link_socket::sockflags, and link_socket::socks_proxy.
Referenced by link_socket_init_phase2().
|
static |
Definition at line 2133 of file socket.c.
References ALLOC_OBJ, link_socket_addr::bind_local, link_socket::bind_local, context::c1, create_dco_handle(), link_socket_addr::current_remote, dco_create_socket(), options::dev_node, context::gc, get_server_poll_remaining_time(), tuntap::hand, link_socket::info, linksock_print_addr(), link_socket_info::lsa, context::options, link_socket::sd, link_socket::server_poll_timeout, SF_DCO_WIN, signal_info::signal_received, link_socket::sockflags, static_assert, and context_1::tuntap.
Referenced by link_socket_init_phase2().
socket_descriptor_t create_socket_tcp | ( | struct addrinfo * | addrinfo | ) |
Definition at line 999 of file socket.c.
References ASSERT, M_ERR, msg, and set_cloexec().
Referenced by create_socket(), man_connect(), man_listen(), and phase2_tcp_client().
|
static |
Definition at line 1031 of file socket.c.
References ASSERT, M_ERR, msg, set_cloexec(), SF_USE_IP_PKTINFO, and SOL_IP.
Referenced by create_socket().
|
static |
Definition at line 758 of file socket.c.
References CC_ALNUM, CC_DASH, CC_DOT, and string_class().
Referenced by ip_or_dns_addr_safe().
void do_preresolve | ( | struct context * | c | ) |
Definition at line 328 of file socket.c.
References connection_entry::af, connection_list::array, connection_entry::bind_local, options::connection_list, do_preresolve_host(), connection_entry::flags, GETADDR_DATAGRAM, GETADDR_FATAL, GETADDR_MENTION_RESOLVE_RETRY, GETADDR_PASSIVE, GETADDR_RANDOMIZE, GETADDR_RESOLVE, GETADDR_UPDATE_MANAGEMENT_STATE, connection_entry::http_proxy_options, options::ip_remote_hint, connection_list::len, connection_entry::local, connection_entry::local_port, context::options, http_proxy_options::port, connection_entry::proto, proto_is_dgram(), connection_entry::remote, connection_entry::remote_port, http_proxy_options::server, SF_HOST_RANDOMIZE, options::sockflags, connection_entry::socks_proxy_port, connection_entry::socks_proxy_server, status, and throw_signal_soft().
Referenced by init_instance().
|
static |
Definition at line 274 of file socket.c.
References cached_dns_entry::ai, ALLOC_OBJ_CLEAR_GC, context::c1, context_1::dns_cache, cached_dns_entry::flags, context::gc, gc_addspecial(), gc_freeaddrinfo_callback(), get_cached_dns_entry(), GETADDR_CACHE_MASK, cached_dns_entry::hostname, cached_dns_entry::next, openvpn_getaddrinfo(), context::options, options::resolve_retry_seconds, cached_dns_entry::servname, and status.
Referenced by do_preresolve().
|
static |
Definition at line 66 of file socket.c.
References GETADDR_HOST_ORDER, M_ERRNO, M_NONFATAL, M_WARN, msg, and openvpn_getaddrinfo().
Referenced by get_ipv6_addr(), and getaddr().
|
static |
Definition at line 245 of file socket.c.
References cached_dns_entry::ai, cached_dns_entry::ai_family, cached_dns_entry::flags, GETADDR_CACHE_MASK, cached_dns_entry::hostname, cached_dns_entry::next, cached_dns_entry::servname, and streqnull().
Referenced by do_preresolve_host(), resolve_bind_local(), and resolve_remote().
bool get_ipv6_addr | ( | const char * | hostname, |
struct in6_addr * | network, | ||
unsigned int * | netbits, | ||
int | msglevel | ||
) |
Translate an IPv6 addr or hostname from string form to in6_addr.
Definition at line 211 of file socket.c.
References get_addr_generic(), and GETADDR_RESOLVE.
Referenced by add_option(), dhcp_option_dns6_parse(), ifconfig_pool_read(), init_route_ipv6(), ipv6_addr_safe_hexplusbits(), option_iroute_ipv6(), and remove_iroutes_from_push_route_list().
in_addr_t getaddr | ( | unsigned int | flags, |
const char * | hostname, | ||
int | resolve_retry_seconds, | ||
bool * | succeeded, | ||
struct signal_info * | sig_info | ||
) |
Translate an IPv4 addr or hostname from string form to in_addr_t.
In case of resolve error, it will try again for resolve_retry_seconds seconds.
Definition at line 180 of file socket.c.
References get_addr_generic(), M_WARN, and status.
Referenced by add_client_nat_to_option_list(), add_host_route_array(), add_option(), get_adapter_ip_netmask(), get_ip_addr(), ifconfig_pool_read(), init_route(), init_route_list(), init_tun(), ip_addr_string_to_array(), man_kill(), option_iroute(), and remove_iroutes_from_push_route_list().
bool ip_addr_dotted_quad_safe | ( | const char * | dotted_quad | ) |
Definition at line 686 of file socket.c.
References OIA_IP, and openvpn_inet_aton().
Referenced by add_option(), dhcp_option_address_parse(), and ip_or_dns_addr_safe().
bool ip_or_dns_addr_safe | ( | const char * | addr, |
const bool | allow_fqdn | ||
) |
Definition at line 772 of file socket.c.
References dns_addr_safe(), and ip_addr_dotted_quad_safe().
Referenced by add_option().
|
static |
Definition at line 2355 of file socket.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, argv_parse_cmd(), argv_printf(), argv_printf_cat(), link_socket_actual::dest, link_socket_info::ipchange_command, link_socket_info::lsa, print_sockaddr_ex(), PS_SHOW_PORT, and openvpn_sockaddr::sa.
Referenced by link_socket_connection_initiated().
bool ipv6_addr_safe | ( | const char * | ipv6_text_addr | ) |
Definition at line 736 of file socket.c.
Referenced by add_option().
void link_socket_bad_incoming_addr | ( | struct buffer * | buf, |
const struct link_socket_info * | info, | ||
const struct link_socket_actual * | from_addr | ||
) |
Definition at line 2422 of file socket.c.
References openvpn_sockaddr::addr, D_LINK_ERRORS, link_socket_actual::dest, gc_free(), gc_new(), buffer::len, link_socket_info::lsa, msg, print_link_socket_actual(), print_sockaddr_ex(), PS_SHOW_PORT, link_socket_addr::remote_list, and openvpn_sockaddr::sa.
Referenced by process_incoming_link_part1().
void link_socket_bad_outgoing_addr | ( | void | ) |
Definition at line 2451 of file socket.c.
References D_READ_WRITE, and dmsg.
Referenced by link_socket_get_outgoing_addr().
void link_socket_close | ( | struct link_socket * | sock | ) |
Definition at line 2297 of file socket.c.
References close_net_event_win32(), link_socket::ctrl_sd, D_LOW, free_buf(), link_socket::listen_handle, M_ERRNO, M_WARN, msg, openvpn_close_socket, overlapped_io_close(), link_socket::reads, link_socket::sd, socket_defined(), SOCKET_UNDEFINED, link_socket::stream_buf, stream_buf_close(), link_socket::stream_buf_data, and link_socket::writes.
Referenced by do_close_link_socket().
void link_socket_connection_initiated | ( | struct link_socket_info * | info, |
const struct link_socket_actual * | act, | ||
const char * | common_name, | ||
struct env_set * | es | ||
) |
Definition at line 2371 of file socket.c.
References link_socket_addr::actual, alloc_buf_gc(), argv_free(), argv_new(), BSTR, buf_printf(), link_socket_info::connection_established, es, argv::gc, gc_free(), gc_new(), link_socket_info::ipchange_command, ipchange_fmt(), link_socket_info::lsa, M_INFO, M_WARN, msg, OPENVPN_PLUGIN_FUNC_SUCCESS, OPENVPN_PLUGIN_IPCHANGE, openvpn_run_script(), plugin_call(), plugin_defined(), link_socket_info::plugins, print_link_socket_actual(), setenv_str(), and setenv_trusted().
Referenced by link_socket_set_outgoing_addr().
in_addr_t link_socket_current_remote | ( | const struct link_socket_info * | info | ) |
Definition at line 2457 of file socket.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, link_socket_addr::current_remote, link_socket_actual::dest, openvpn_sockaddr::in4, IPV4_INVALID_ADDR, link_socket_actual_defined(), link_socket_info::lsa, and openvpn_sockaddr::sa.
Referenced by do_init_route_list().
const struct in6_addr* link_socket_current_remote_ipv6 | ( | const struct link_socket_info * | info | ) |
Definition at line 2492 of file socket.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, link_socket_addr::current_remote, link_socket_actual::dest, openvpn_sockaddr::in6, link_socket_actual_defined(), link_socket_info::lsa, and openvpn_sockaddr::sa.
Referenced by do_init_route_ipv6_list().
void link_socket_init_phase1 | ( | struct context * | c, |
int | mode | ||
) |
Definition at line 1834 of file socket.c.
References context_2::accept_from, connection_entry::af, link_socket_info::af, ASSERT, link_socket::bind_dev, options::bind_dev, connection_entry::bind_ipv6_only, link_socket_info::bind_ipv6_only, connection_entry::bind_local, link_socket::bind_local, context::c1, context::c2, options::ce, context_1::dns_cache, link_socket::dns_cache, context_1::http_proxy, link_socket::http_proxy, link_socket::info, options::ipchange, link_socket_info::ipchange_command, context_2::link_socket, context_1::link_socket_addr, connection_entry::local, link_socket::local_host, connection_entry::local_port, link_socket::local_port, LS_MODE_TCP_ACCEPT_FROM, link_socket_info::lsa, link_socket::mark, options::mark, link_socket::mode, options::mode, connection_entry::mtu_discover_type, link_socket::mtu_discover_type, http_proxy_info::options, context::options, link_socket_info::plugins, context::plugins, socks_proxy_info::port, http_proxy_options::port, connection_entry::proto, link_socket_info::proto, PROTO_TCP_CLIENT, PROTO_TCP_SERVER, link_socket::proxy_dest_host, link_socket::proxy_dest_port, socket_buffer_size::rcvbuf, options::rcvbuf, connection_entry::remote, connection_entry::remote_float, link_socket_info::remote_float, link_socket::remote_host, connection_entry::remote_port, link_socket::remote_port, resolve_bind_local(), resolve_remote(), link_socket::resolve_retry_seconds, options::resolve_retry_seconds, link_socket::sd, socks_proxy_info::server, http_proxy_options::server, context_2::server_poll_interval, link_socket::server_poll_timeout, SF_PORT_SHARE, socket_buffer_size::sndbuf, options::sndbuf, link_socket::socket_buffer_sizes, link_socket::sockflags, options::sockflags, context_1::socks_proxy, and link_socket::socks_proxy.
Referenced by init_instance().
void link_socket_init_phase2 | ( | struct context * | c | ) |
Definition at line 2169 of file socket.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, addr_family_name(), link_socket_info::af, ASSERT, link_socket_addr::bind_local, link_socket::bind_local, context::c2, create_socket(), create_socket_dco_win(), link_socket_addr::current_remote, dco_enabled(), link_socket_actual::dest, context_2::frame, link_socket::info, context_2::link_socket, linksock_print_addr(), link_socket_info::lsa, M_WARN, msg, context::options, phase2_set_socket_flags(), phase2_socks_client(), phase2_tcp_client(), phase2_tcp_server(), link_socket_info::proto, PROTO_TCP_CLIENT, PROTO_TCP_SERVER, PROTO_UDP, register_signal(), link_socket::remote_host, resolve_remote(), link_socket::resolve_retry_seconds, openvpn_sockaddr::sa, link_socket::sd, context::sig, SIG_SOURCE_HARD, siginfo_static, signal_info::signal_received, signal_reset(), signal_info::signal_text, socket_frame_init(), SOCKET_UNDEFINED, link_socket::socks_proxy, signal_info::source, and throw_signal().
Referenced by init_instance().
struct link_socket* link_socket_new | ( | void | ) |
Definition at line 1823 of file socket.c.
References ALLOC_OBJ_CLEAR, link_socket::ctrl_sd, link_socket::sd, and SOCKET_UNDEFINED.
Referenced by do_link_socket_new().
int link_socket_read_tcp | ( | struct link_socket * | sock, |
struct buffer * | buf | ||
) |
Definition at line 3231 of file socket.c.
References BLEN, BPTR, buffer::len, M_INFO, msg, MSG_NOSIGNAL, link_socket::reads, stream_buf::residual_fully_formed, sockethandle_t::s, link_socket::sd, SOCKET_UNDEFINED, sockethandle_finalize(), link_socket::stream_buf, stream_buf_added(), stream_buf_get_final(), stream_buf_get_next(), stream_buf_reset(), and link_socket::stream_reset.
Referenced by link_socket_read().
void link_socket_update_buffer_sizes | ( | struct link_socket * | ls, |
int | rcvbuf, | ||
int | sndbuf | ||
) |
Definition at line 983 of file socket.c.
References socket_buffer_size::rcvbuf, link_socket::sd, socket_buffer_size::sndbuf, link_socket::socket_buffer_sizes, socket_defined(), and socket_set_buffers().
Referenced by do_deferred_options().
bool link_socket_update_flags | ( | struct link_socket * | ls, |
unsigned int | sockflags | ||
) |
Definition at line 969 of file socket.c.
References link_socket::sd, socket_defined(), socket_set_flags(), and link_socket::sockflags.
Referenced by do_deferred_options().
int link_socket_write_tcp | ( | struct link_socket * | sock, |
struct buffer * | buf, | ||
struct link_socket_actual * | to | ||
) |
Definition at line 3403 of file socket.c.
References ASSERT, BLEN, buf_write_prepend(), D_STREAM_DEBUG, dmsg, htonps, link_socket_write_win32(), stream_buf::maxlen, and buffer::offset.
Referenced by link_socket_write().
|
static |
Definition at line 1963 of file socket.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, link_socket_info::af, ASSERT, link_socket_addr::bind_local, link_socket::bind_local, D_INIT_MEDIUM, link_socket_actual::dest, gc_free(), gc_new(), link_socket::info, LS_MODE_TCP_ACCEPT_FROM, link_socket_info::lsa, M_INFO, link_socket::mode, msg, print_link_socket_actual_ex(), print_sockaddr(), link_socket_info::proto, proto2ascii(), PS_SHOW_PORT_IF_DEFINED, and openvpn_sockaddr::sa.
Referenced by create_socket_dco_win(), and link_socket_init_phase2().
bool mac_addr_safe | ( | const char * | mac_addr | ) |
Definition at line 789 of file socket.c.
Referenced by add_option().
int openvpn_connect | ( | socket_descriptor_t | sd, |
const struct sockaddr * | remote, | ||
int | connect_timeout, | ||
volatile int * | signal_received | ||
) |
Definition at line 1434 of file socket.c.
References af_addr_size(), get_signal(), management_sleep(), openvpn_errno, openvpn_fd_set(), set_nonblock(), and status.
Referenced by man_connect(), and socket_connect().
int openvpn_getaddrinfo | ( | unsigned int | flags, |
const char * | hostname, | ||
const char * | servname, | ||
int | resolve_retry_seconds, | ||
struct signal_info * | sig_info, | ||
int | ai_family, | ||
struct addrinfo ** | res | ||
) |
Definition at line 429 of file socket.c.
References ASSERT, CLEAR, D_RESOLVE_ERRORS, D_SOCKET_DEBUG, dmsg, gc_free(), gc_new(), get_signal(), GETADDR_DATAGRAM, GETADDR_FATAL, GETADDR_FATAL_ON_SIGNAL, GETADDR_HOST_ORDER, GETADDR_MENTION_RESOLVE_RETRY, GETADDR_MSG_VIRT_OUT, GETADDR_PASSIVE, GETADDR_RANDOMIZE, GETADDR_RESOLVE, GETADDR_TRY_ONCE, GETADDR_UPDATE_MANAGEMENT_STATE, GETADDR_WARN_ON_SIGNAL, hostname_randomize(), M_FATAL, M_MSG_VIRT_OUT, M_WARN, management_set_state(), management_sleep(), msg, OPENVPN_STATE_RESOLVE, signal_info::signal_received, signal_reset(), and status.
Referenced by dns_server_addr_parse(), do_preresolve_host(), get_addr_generic(), init_route(), man_settings_init(), management_post_tunnel_open(), resolve_bind_local(), resolve_remote(), and socket_listen_accept().
int openvpn_inet_aton | ( | const char * | dotted_quad, |
struct in_addr * | addr | ||
) |
Definition at line 662 of file socket.c.
References CC_DIGIT, CC_DOT, CLEAR, OIA_ERROR, OIA_HOSTNAME, OIA_IP, and string_class().
Referenced by ip_addr_dotted_quad_safe().
|
static |
Definition at line 1944 of file socket.c.
References link_socket_info::af, link_socket::info, link_socket::mtu_discover_type, link_socket::sd, set_mtu_discover_type(), set_nonblock(), socket_set_flags(), and link_socket::sockflags.
Referenced by link_socket_init_phase2().
|
static |
Definition at line 2093 of file socket.c.
References link_socket_addr::actual, addr_zero_host(), link_socket::ctrl_sd, link_socket_addr::current_remote, link_socket_actual::dest, establish_socks_proxy_udpassoc(), get_server_poll_remaining_time(), link_socket::info, link_socket_info::lsa, link_socket::proxy_dest_host, link_socket::proxy_dest_port, link_socket::remote_host, link_socket_addr::remote_list, link_socket::remote_port, resolve_remote(), link_socket::sd, link_socket::server_poll_timeout, signal_info::signal_received, socket_connect(), link_socket::socks_proxy, and link_socket::socks_relay.
Referenced by link_socket_init_phase2().
|
static |
Definition at line 2048 of file socket.c.
References create_socket_tcp(), link_socket_addr::current_remote, establish_http_proxy_passthru(), establish_socks_proxy_passthru(), get_server_poll_remaining_time(), link_socket::http_proxy, link_socket::info, link_socket_info::lsa, openvpn_close_socket, link_socket::proxy_dest_host, link_socket::proxy_dest_port, stream_buf::residual, link_socket::sd, link_socket::server_poll_timeout, signal_info::signal_received, socket_connect(), link_socket::socks_proxy, and link_socket::stream_buf.
Referenced by link_socket_init_phase2().
|
static |
Definition at line 2005 of file socket.c.
References link_socket_addr::actual, ASSERT, link_socket_addr::bind_local, link_socket::info, LS_MODE_DEFAULT, LS_MODE_TCP_ACCEPT_FROM, LS_MODE_TCP_LISTEN, link_socket_info::lsa, link_socket::mode, register_signal(), link_socket::sd, signal_info::signal_received, socket_defined(), socket_do_accept(), socket_do_listen(), socket_listen_accept(), and tcp_connection_established().
Referenced by link_socket_init_phase2().
const char* print_in6_addr | ( | struct in6_addr | a6, |
unsigned int | flags, | ||
struct gc_arena * | gc | ||
) |
Definition at line 2924 of file socket.c.
References gc_malloc(), and IA_EMPTY_IF_UNDEF.
Referenced by add_route_ipv6(), delete_route_ipv6(), do_address_service(), do_ifconfig_ipv6(), do_ifconfig_setenv(), get_default_gateway_ipv6(), helper_client_server(), ifconfig_pool_init(), ifconfig_pool_list(), init_route_ipv6_list(), log_entry_print(), mroute_addr_print_ex(), mroute_extract_addr_ip(), multi_add_iroutes(), multi_client_connect_late_setup(), multi_print_status(), multi_select_virtual_addr(), netsh_delete_address_dns(), netsh_set_dns6_servers(), prepare_push_reply(), print_default_gateway(), setenv_dns_options(), setenv_route_ipv6(), show_dns_options(), show_p2mp_parms(), and undo_ifconfig_ipv6().
const char* print_in_addr_t | ( | in_addr_t | addr, |
unsigned int | flags, | ||
struct gc_arena * | gc | ||
) |
Definition at line 2904 of file socket.c.
References CLEAR, gc_malloc(), IA_EMPTY_IF_UNDEF, and IA_NET_ORDER.
Referenced by adapter_index_of_ip(), add_route(), add_route_ipapi(), check_addr_clash(), check_subnet_conflict(), delete_route(), dhcp_extract_router_msg(), dhcp_masq_addr(), do_address_service(), do_close_tun(), do_ifconfig_ipv4(), do_ifconfig_setenv(), do_open_tun(), format_route_entry(), get_default_gateway_row(), helper_add_route(), helper_client_server(), ifconfig_options_string(), ifconfig_pool_init(), ifconfig_pool_list(), ifconfig_pool_verify_range(), ifconfig_sanity_check(), ip_addr_string_to_array(), log_entry_print(), man_kill(), mroute_addr_print_ex(), multi_add_iroutes(), multi_client_connect_late_setup(), multi_print_status(), multi_select_virtual_addr(), netsh_delete_address_dns(), netsh_ifconfig(), netsh_ifconfig_options(), prepare_push_reply(), print_client_nat_list(), print_default_gateway(), print_netmask(), print_opt_route(), print_opt_route_gateway(), print_pkt(), route_string(), setenv_dns_options(), setenv_route_addr(), show_dhcp_option_addrs(), show_dns_options(), show_p2mp_parms(), tuntap_dhcp_mask(), tuntap_set_ip_addr(), tuntap_set_ptp(), undo_ifconfig_ipv4(), verify_255_255_255_252(), verify_common_subnet(), and windows_route_find_if_index().
const char* print_in_port_t | ( | in_port_t | port, |
struct gc_arena * | gc | ||
) |
Definition at line 2940 of file socket.c.
References alloc_buf_gc(), BSTR, and buf_printf().
Referenced by setenv_dns_options(), and show_dns_options().
const char* print_link_socket_actual | ( | const struct link_socket_actual * | act, |
struct gc_arena * | gc | ||
) |
Definition at line 2823 of file socket.c.
Referenced by do_pre_decrypt_check(), drop_if_recursive_routing(), handle_data_channel_packet(), link_socket_bad_incoming_addr(), link_socket_connection_initiated(), multi_process_float(), print_key_id_not_found_reason(), process_incoming_link_part1(), process_outgoing_link(), read_control_auth(), resolve_remote(), socket_listen_accept(), tcp_connection_established(), tls_multi_process(), tls_pre_decrypt(), tls_pre_decrypt_lite(), and tls_update_remote_addr().
const char* print_link_socket_actual_ex | ( | const struct link_socket_actual * | act, |
const char * | separator, | ||
const unsigned int | flags, | ||
struct gc_arena * | gc | ||
) |
Definition at line 2833 of file socket.c.
References openvpn_sockaddr::addr, addr_defined_ipi(), alloc_buf_gc(), BSTR, buf_printf(), CLEAR, link_socket_actual::dest, IF_NAMESIZE, print_sockaddr_ex(), PS_SHOW_PKTINFO, and openvpn_sockaddr::sa.
Referenced by linksock_print_addr(), and print_link_socket_actual().
const char* print_sockaddr_ex | ( | const struct sockaddr * | sa, |
const char * | separator, | ||
const unsigned int | flags, | ||
struct gc_arena * | gc | ||
) |
Definition at line 2742 of file socket.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), buf_puts(), PS_DONT_SHOW_ADDR, PS_DONT_SHOW_FAMILY, PS_SHOW_PORT, PS_SHOW_PORT_IF_DEFINED, and status.
Referenced by ipchange_fmt(), link_socket_bad_incoming_addr(), log_entry_print(), print_link_socket_actual_ex(), print_openvpn_sockaddr(), print_openvpn_sockaddr_ex(), print_sockaddr(), and socket_bind().
const char* proto2ascii | ( | int | proto, |
sa_family_t | af, | ||
bool | display_form | ||
) |
Definition at line 3128 of file socket.c.
References proto_names::display_form, proto_names::proto, proto_names::proto_af, proto_names::short_form, and SIZE.
Referenced by ce_management_query_remote(), linksock_print_addr(), management_callback_remote_entry_get(), process_incoming_link_part1(), process_outgoing_link(), setenv_connection_entry(), show_connection_entry(), and x_check_status().
const char* proto2ascii_all | ( | struct gc_arena * | gc | ) |
Definition at line 3150 of file socket.c.
References alloc_buf_gc(), BSTR, buf_printf(), and SIZE.
Referenced by add_option().
const char* proto_remote | ( | int | proto, |
bool | remote | ||
) |
Definition at line 3191 of file socket.c.
References ASSERT, PROTO_N, PROTO_TCP_CLIENT, PROTO_TCP_SERVER, and PROTO_UDP.
Referenced by options_string().
|
static |
Definition at line 1654 of file socket.c.
References link_socket_addr::bind_local, link_socket::dns_cache, gc_free(), gc_new(), get_cached_dns_entry(), GETADDR_DATAGRAM, GETADDR_FATAL, GETADDR_PASSIVE, GETADDR_RESOLVE, GETADDR_WARN_ON_SIGNAL, link_socket::info, link_socket::local_host, link_socket::local_port, link_socket_info::lsa, M_FATAL, msg, openvpn_getaddrinfo(), link_socket_info::proto, proto_is_dgram(), and status.
Referenced by link_socket_init_phase1().
|
static |
Definition at line 1696 of file socket.c.
References link_socket_addr::actual, link_socket_info::af, ASSERT, CLEAR, link_socket_addr::current_remote, D_SOCKET_DEBUG, dmsg, link_socket::dns_cache, gc_free(), gc_new(), get_cached_dns_entry(), GETADDR_DATAGRAM, GETADDR_FATAL, GETADDR_MENTION_RESOLVE_RETRY, GETADDR_RESOLVE, GETADDR_TRY_ONCE, GETADDR_UPDATE_MANAGEMENT_STATE, link_socket::info, link_socket_actual_defined(), link_socket_info::lsa, M_INFO, msg, openvpn_getaddrinfo(), print_link_socket_actual(), link_socket_info::proto, proto_is_dgram(), register_signal(), link_socket::remote_host, link_socket_addr::remote_list, link_socket::remote_port, RESOLV_RETRY_INFINITE, link_socket::resolve_retry_seconds, set_actual_address(), sf2gaf(), signal_info::signal_received, link_socket::sockflags, and status.
Referenced by link_socket_init_phase1(), link_socket_init_phase2(), and phase2_socks_client().
void sd_close | ( | socket_descriptor_t * | sd | ) |
Definition at line 3915 of file socket.c.
References openvpn_close_socket, socket_defined(), and SOCKET_UNDEFINED.
Referenced by man_accept(), and man_connect().
void set_actual_address | ( | struct link_socket_actual * | actual, |
struct addrinfo * | ai | ||
) |
Definition at line 1530 of file socket.c.
References openvpn_sockaddr::addr, ASSERT, CLEAR, link_socket_actual::dest, openvpn_sockaddr::in4, and openvpn_sockaddr::in6.
Referenced by resolve_remote().
void setenv_in6_addr | ( | struct env_set * | es, |
const char * | name_prefix, | ||
const struct in6_addr * | addr, | ||
const unsigned int | flags | ||
) |
Definition at line 3044 of file socket.c.
References openvpn_sockaddr::addr, CLEAR, es, openvpn_sockaddr::in6, SA_SET_IF_NONZERO, and setenv_sockaddr().
Referenced by multi_set_virtual_addr_env().
void setenv_in_addr_t | ( | struct env_set * | es, |
const char * | name_prefix, | ||
in_addr_t | addr, | ||
const unsigned int | flags | ||
) |
Definition at line 3031 of file socket.c.
References openvpn_sockaddr::addr, CLEAR, es, openvpn_sockaddr::in4, SA_SET_IF_NONZERO, and setenv_sockaddr().
Referenced by multi_set_virtual_addr_env().
void setenv_link_socket_actual | ( | struct env_set * | es, |
const char * | name_prefix, | ||
const struct link_socket_actual * | act, | ||
const unsigned int | flags | ||
) |
Definition at line 3060 of file socket.c.
References link_socket_actual::dest, es, and setenv_sockaddr().
Referenced by setenv_trusted(), and setenv_untrusted().
void setenv_sockaddr | ( | struct env_set * | es, |
const char * | name_prefix, | ||
const struct openvpn_sockaddr * | addr, | ||
const unsigned int | flags | ||
) |
Definition at line 2978 of file socket.c.
References openvpn_sockaddr::addr, es, openvpn_sockaddr::in4, openvpn_sockaddr::in6, openvpn_sockaddr::sa, SA_IP_PORT, setenv_int(), and setenv_str().
Referenced by setenv_in6_addr(), setenv_in_addr_t(), and setenv_link_socket_actual().
void setenv_trusted | ( | struct env_set * | es, |
const struct link_socket_info * | info | ||
) |
Definition at line 2349 of file socket.c.
References link_socket_addr::actual, es, link_socket_info::lsa, SA_IP_PORT, and setenv_link_socket_actual().
Referenced by link_socket_connection_initiated(), multi_client_connect_setenv(), and multi_client_disconnect_setenv().
|
static |
Definition at line 49 of file socket.c.
References GETADDR_RANDOMIZE, and SF_HOST_RANDOMIZE.
Referenced by resolve_remote().
void socket_bind | ( | socket_descriptor_t | sd, |
struct addrinfo * | local, | ||
int | ai_family, | ||
const char * | prefix, | ||
bool | ipv6only | ||
) |
Definition at line 1380 of file socket.c.
References addr_family_name(), ASSERT, gc_free(), gc_new(), M_ERRNO, M_FATAL, M_INFO, M_NONFATAL, msg, print_sockaddr_ex(), and PS_SHOW_PORT.
Referenced by bind_local(), and man_listen().
|
static |
Definition at line 1553 of file socket.c.
References D_LINK_ERRORS, gc_free(), gc_new(), get_signal(), M_INFO, management_set_state(), msg, openvpn_close_socket, openvpn_connect(), OPENVPN_STATE_TCP_CONNECT, print_sockaddr(), register_signal(), signal_info::signal_received, SOCKET_UNDEFINED, and status.
Referenced by phase2_socks_client(), and phase2_tcp_client().
socket_descriptor_t socket_do_accept | ( | socket_descriptor_t | sd, |
struct link_socket_actual * | act, | ||
const bool | nowait | ||
) |
Definition at line 1214 of file socket.c.
References openvpn_sockaddr::addr, af_addr_size(), CLEAR, D_LINK_ERRORS, link_socket_actual::dest, M_ERRNO, msg, openvpn_close_socket, openvpn_sockaddr::sa, set_cloexec(), socket_defined(), and SOCKET_UNDEFINED.
Referenced by man_accept(), phase2_tcp_server(), and socket_listen_accept().
|
static |
Definition at line 1187 of file socket.c.
References ASSERT, gc_free(), gc_new(), M_ERR, M_INFO, msg, print_sockaddr(), and set_nonblock().
Referenced by phase2_tcp_server(), and socket_listen_accept().
|
static |
Definition at line 1626 of file socket.c.
References alloc_buf_sock_tun(), overlapped_io::buf_init, link_socket::info, link_socket_connection_oriented(), overlapped_io::overlapped, overlapped_io_init(), link_socket_info::proto, rw_handle::read, link_socket::reads, link_socket::rw_handle, link_socket::sockflags, link_socket::stream_buf, link_socket::stream_buf_data, stream_buf_init(), rw_handle::write, and link_socket::writes.
Referenced by link_socket_init_phase2().
|
static |
Definition at line 3505 of file socket.c.
References socket_is_dco_win().
Referenced by socket_recv_queue(), and socket_send_queue().
|
static |
Definition at line 864 of file socket.c.
Referenced by socket_set_buffers().
|
static |
Definition at line 836 of file socket.c.
Referenced by socket_set_buffers().
|
static |
Definition at line 1287 of file socket.c.
References openvpn_sockaddr::addr, addrlist_match(), CLEAR, D_LINK_ERRORS, link_socket_actual::dest, gc_free(), gc_new(), get_signal(), M_ERR, M_ERRNO, M_WARN, management_sleep(), msg, openvpn_close_socket, openvpn_fd_set(), openvpn_getaddrinfo(), print_link_socket_actual(), openvpn_sockaddr::sa, socket_defined(), socket_do_accept(), socket_do_listen(), SOCKET_UNDEFINED, status, and tcp_connection_established().
Referenced by phase2_tcp_server().
event_t socket_listen_event_handle | ( | struct link_socket * | s | ) |
Definition at line 2724 of file socket.c.
References defined_net_event_win32(), init_net_event_win32(), link_socket::listen_handle, and link_socket::sd.
Referenced by socket_set_listen_persistent().
int socket_recv_queue | ( | struct link_socket * | sock, |
int | maxsize | ||
) |
Definition at line 3516 of file socket.c.
References overlapped_io::addr, overlapped_io::addr6, overlapped_io::addr_defined, overlapped_io::addrlen, link_socket_info::af, af_addr_size(), ASSERT, bad_address_length(), BLEN, BSTR, overlapped_io::buf, overlapped_io::buf_init, D_WIN32_IO, dmsg, overlapped_io::flags, gc_free(), gc_new(), link_socket::info, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, overlapped_io::overlapped, link_socket_info::proto, proto_is_tcp(), proto_is_udp(), link_socket::reads, link_socket::sd, overlapped_io::size, socket_get_last_error(), socket_is_dco_win(), status, overlapped_io::status, link_socket::stream_buf, stream_buf_get_next(), and strerror_win32().
Referenced by socket_set().
int socket_send_queue | ( | struct link_socket * | sock, |
struct buffer * | buf, | ||
const struct link_socket_actual * | to | ||
) |
Definition at line 3633 of file socket.c.
References openvpn_sockaddr::addr, overlapped_io::addr, overlapped_io::addr6, overlapped_io::addr_defined, overlapped_io::addrlen, ASSERT, BLEN, BSTR, overlapped_io::buf, buf_copy(), overlapped_io::buf_init, D_WIN32_IO, link_socket_actual::dest, dmsg, overlapped_io::flags, gc_free(), gc_new(), openvpn_sockaddr::in4, openvpn_sockaddr::in6, link_socket::info, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, buffer::len, overlapped_io::overlapped, link_socket_info::proto, proto_is_tcp(), proto_is_udp(), openvpn_sockaddr::sa, link_socket::sd, overlapped_io::size, socket_get_last_error(), socket_is_dco_win(), status, overlapped_io::status, strerror_win32(), and link_socket::writes.
Referenced by link_socket_write_win32().
unsigned int socket_set | ( | struct link_socket * | s, |
struct event_set * | es, | ||
unsigned int | rwflags, | ||
void * | arg, | ||
unsigned int * | persistent | ||
) |
Definition at line 3878 of file socket.c.
References ASSERT, es, event_ctl(), EVENT_READ, link_socket::rwflags_debug, socket_event_handle(), socket_recv_queue(), and stream_buf_read_setup().
Referenced by io_wait_dowork(), and multi_tcp_set_global_rw_flags().
|
static |
Definition at line 894 of file socket.c.
References D_OSBUF, msg, socket_buffer_size::rcvbuf, socket_buffer_size::sndbuf, socket_get_rcvbuf(), socket_get_sndbuf(), socket_set_rcvbuf(), and socket_set_sndbuf().
Referenced by create_socket(), and link_socket_update_buffer_sizes().
|
static |
Definition at line 955 of file socket.c.
References SF_DCO_WIN, SF_TCP_NODELAY, and socket_set_tcp_nodelay().
Referenced by link_socket_update_flags(), and phase2_set_socket_flags().
|
inlinestatic |
|
static |
Definition at line 881 of file socket.c.
Referenced by socket_set_buffers().
|
static |
Definition at line 853 of file socket.c.
Referenced by socket_set_buffers().
|
static |
const char* socket_stat | ( | const struct link_socket * | s, |
unsigned int | rwflags, | ||
struct gc_arena * | gc | ||
) |
Definition at line 2525 of file socket.c.
References alloc_buf_gc(), BSTR, buf_printf(), EVENT_READ, EVENT_WRITE, overlapped_io_state_ascii(), link_socket::reads, link_socket::rwflags_debug, and link_socket::writes.
int sockethandle_finalize | ( | sockethandle_t | sh, |
struct overlapped_io * | io, | ||
struct buffer * | buf, | ||
struct link_socket_actual * | from | ||
) |
Definition at line 3752 of file socket.c.
References openvpn_sockaddr::addr, overlapped_io::addr, overlapped_io::addr6, overlapped_io::addr_defined, overlapped_io::addrlen, af_addr_size(), ASSERT, bad_address_length(), overlapped_io::buf, CLEAR, D_WIN32_IO, link_socket_actual::dest, dmsg, openvpn_sockaddr::in4, openvpn_sockaddr::in6, overlapped_io::iostate, IOSTATE_IMMEDIATE_RETURN, IOSTATE_INITIAL, IOSTATE_QUEUED, sockethandle_t::is_handle, buffer::len, M_ERRNO, msg, overlapped_io::overlapped, overlapped_io::size, SocketHandleGetLastError(), SocketHandleGetOverlappedResult(), SocketHandleSetInvalError(), SocketHandleSetLastError(), status, and overlapped_io::status.
Referenced by link_socket_read_tcp(), link_socket_read_udp_win32(), link_socket_write_win32(), read_incoming_tun(), and tun_write_win32().
|
static |
Definition at line 2646 of file socket.c.
References ASSERT, BLEN, stream_buf::buf, buf_copy_excess(), buf_init, buf_read(), D_STREAM_DEBUG, D_STREAM_ERRORS, dmsg, stream_buf::error, buffer::len, stream_buf::len, M_WARN, stream_buf::maxlen, msg, ntohps, stream_buf::residual, stream_buf_reset(), and stream_buf_set_next().
Referenced by link_socket_read_tcp(), and stream_buf_read_setup_dowork().
|
static |
Definition at line 2713 of file socket.c.
References free_buf(), and stream_buf::residual.
Referenced by link_socket_close().
|
inlinestatic |
Definition at line 2608 of file socket.c.
References ASSERT, stream_buf::buf, buf_defined(), D_STREAM_DEBUG, dmsg, and buffer::len.
Referenced by link_socket_read_tcp().
|
inlinestatic |
Definition at line 2617 of file socket.c.
References ASSERT, buf_defined(), D_STREAM_DEBUG, dmsg, buffer::len, and stream_buf::next.
Referenced by link_socket_read_tcp(), and socket_recv_queue().
|
static |
Definition at line 2572 of file socket.c.
References alloc_buf(), stream_buf::buf_init, D_STREAM_DEBUG, dmsg, stream_buf::error, buffer::len, stream_buf::maxlen, PROTO_TCP_SERVER, stream_buf::residual, SF_PORT_SHARE, and stream_buf_reset().
Referenced by socket_frame_init().
bool stream_buf_read_setup_dowork | ( | struct link_socket * | sock | ) |
Definition at line 2626 of file socket.c.
References ASSERT, stream_buf::buf, buf_copy(), buf_init, D_STREAM_DEBUG, dmsg, buffer::len, stream_buf::residual, stream_buf::residual_fully_formed, link_socket::stream_buf, stream_buf_added(), and stream_buf_set_next().
Referenced by stream_buf_read_setup().
|
inlinestatic |
Definition at line 2562 of file socket.c.
References stream_buf::buf, stream_buf::buf_init, buf_reset(), D_STREAM_DEBUG, dmsg, stream_buf::len, stream_buf::next, and stream_buf::residual_fully_formed.
Referenced by link_socket_read_tcp(), stream_buf_added(), and stream_buf_init().
|
inlinestatic |
Definition at line 2593 of file socket.c.
References ASSERT, stream_buf::buf, buf_safe(), D_STREAM_DEBUG, dmsg, buffer::len, stream_buf::len, stream_buf::maxlen, stream_buf::next, and buffer::offset.
Referenced by stream_buf_added(), and stream_buf_read_setup_dowork().
|
inlinestatic |
|
static |
Definition at line 1278 of file socket.c.
References gc_free(), gc_new(), M_INFO, msg, and print_link_socket_actual().
Referenced by phase2_tcp_server(), and socket_listen_accept().
|
static |