|
OpenVPN
|


Go to the source code of this file.
Data Structures | |
| struct | openvpn_sockaddr |
| struct | link_socket_actual |
Macros | |
| #define | PS_SHOW_PORT_IF_DEFINED (1 << 0) |
| #define | PS_SHOW_PORT (1 << 1) |
| #define | PS_SHOW_PKTINFO (1 << 2) |
| #define | PS_DONT_SHOW_ADDR (1 << 3) |
| #define | PS_DONT_SHOW_FAMILY (1 << 4) |
| #define | IA_EMPTY_IF_UNDEF (1 << 0) |
| #define | IA_NET_ORDER (1 << 1) |
| #define | SA_IP_PORT (1 << 0) |
| #define | SA_SET_IF_NONZERO (1 << 1) |
| #define | OIA_HOSTNAME 0 |
| #define | OIA_IP 1 |
| #define | OIA_ERROR -1 |
Enumerations | |
| enum | proto_num { PROTO_NONE , PROTO_UDP , PROTO_TCP , PROTO_TCP_SERVER , PROTO_TCP_CLIENT , PROTO_N } |
Functions | |
| const char * | print_sockaddr_ex (const struct sockaddr *addr, const char *separator, const unsigned int flags, struct gc_arena *gc) |
| static const char * | print_openvpn_sockaddr (const struct openvpn_sockaddr *addr, struct gc_arena *gc) |
| static const char * | print_sockaddr (const struct sockaddr *addr, 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_link_socket_actual (const struct link_socket_actual *act, 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 addr6, 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 | openvpn_inet_aton (const char *dotted_quad, struct in_addr *addr) |
| bool | ip_addr_dotted_quad_safe (const char *dotted_quad) |
| bool | ip_or_dns_addr_safe (const char *addr, const bool allow_fqdn) |
| bool | mac_addr_safe (const char *mac_addr) |
| bool | ipv6_addr_safe (const char *ipv6_text_addr) |
| static bool | proto_is_net (int proto) |
| static bool | proto_is_udp (int proto) |
| Returns if the protocol being used is UDP. | |
| static bool | proto_is_dgram (int proto) |
| Return if the protocol is datagram (UDP). | |
| static bool | proto_is_tcp (int proto) |
| returns if the proto is a TCP variant (tcp-server, tcp-client or tcp) | |
| 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 * | proto_remote (int proto, bool remote) |
| const char * | addr_family_name (int af) |
| static bool | addr_defined (const struct openvpn_sockaddr *addr) |
| static int | datagram_overhead (sa_family_t af, int proto) |
| Overhead added to packets by various protocols. | |
| static bool | link_socket_proto_connection_oriented (int proto) |
| static bool | link_socket_actual_defined (const struct link_socket_actual *act) |
| static bool | addr_match (const struct openvpn_sockaddr *a1, const struct openvpn_sockaddr *a2) |
| static bool | addrlist_match (const struct openvpn_sockaddr *a1, const struct addrinfo *addrlist) |
| static bool | addrlist_port_match (const struct openvpn_sockaddr *a1, const struct addrinfo *a2) |
| static bool | addr_port_match (const struct openvpn_sockaddr *a1, const struct openvpn_sockaddr *a2) |
| static bool | addr_match_proto (const struct openvpn_sockaddr *a1, const struct openvpn_sockaddr *a2, const int proto) |
| static bool | addrlist_match_proto (const struct openvpn_sockaddr *a1, const struct addrinfo *addr_list, const int proto) |
| static void | addr_zero_host (struct openvpn_sockaddr *addr) |
| static int | af_addr_size (sa_family_t af) |
| static bool | link_socket_actual_match (const struct link_socket_actual *a1, const struct link_socket_actual *a2) |
| #define IA_EMPTY_IF_UNDEF (1 << 0) |
Definition at line 89 of file socket_util.h.
Referenced by do_close_tun(), do_open_tun(), log_entry_print(), mroute_addr_print_ex(), multi_print_status(), print_in6_addr(), and print_in_addr_t().
| #define IA_NET_ORDER (1 << 1) |
Definition at line 90 of file socket_util.h.
Referenced by dco_win_add_iroute_ipv4(), dco_win_add_iroute_ipv6(), dco_win_del_iroute_ipv4(), dco_win_del_iroute_ipv6(), drop_if_recursive_routing(), format_route_entry(), mroute_addr_print_ex(), print_client_nat_list(), print_in_addr_t(), print_pkt(), show_dns_options(), tuntap_dhcp_mask(), and tuntap_set_ptp().
| #define OIA_ERROR -1 |
Definition at line 116 of file socket_util.h.
Referenced by openvpn_inet_aton().
| #define OIA_HOSTNAME 0 |
Definition at line 114 of file socket_util.h.
Referenced by openvpn_inet_aton().
| #define OIA_IP 1 |
Definition at line 115 of file socket_util.h.
Referenced by ip_addr_dotted_quad_safe(), and openvpn_inet_aton().
| #define PS_DONT_SHOW_ADDR (1 << 3) |
Definition at line 33 of file socket_util.h.
Referenced by print_sockaddr_ex().
| #define PS_DONT_SHOW_FAMILY (1 << 4) |
Definition at line 34 of file socket_util.h.
Referenced by log_entry_print(), and print_sockaddr_ex().
| #define PS_SHOW_PKTINFO (1 << 2) |
Definition at line 32 of file socket_util.h.
Referenced by print_link_socket_actual(), and print_link_socket_actual_ex().
| #define PS_SHOW_PORT (1 << 1) |
Definition at line 31 of file socket_util.h.
Referenced by ipchange_fmt(), link_socket_bad_incoming_addr(), log_entry_print(), print_link_socket_actual(), print_openvpn_sockaddr(), print_sockaddr(), print_sockaddr_ex(), and socket_bind().
| #define PS_SHOW_PORT_IF_DEFINED (1 << 0) |
Definition at line 30 of file socket_util.h.
Referenced by linksock_print_addr(), and print_sockaddr_ex().
| #define SA_IP_PORT (1 << 0) |
Definition at line 99 of file socket_util.h.
Referenced by setenv_sockaddr(), setenv_trusted(), and setenv_untrusted().
| #define SA_SET_IF_NONZERO (1 << 1) |
Definition at line 100 of file socket_util.h.
Referenced by multi_set_virtual_addr_env(), setenv_in6_addr(), and setenv_in_addr_t().
| enum proto_num |
| Enumerator | |
|---|---|
| PROTO_NONE | |
| PROTO_UDP | |
| PROTO_TCP | |
| PROTO_TCP_SERVER | |
| PROTO_TCP_CLIENT | |
| PROTO_N | |
Definition at line 136 of file socket_util.h.
| struct in6_addr add_in6_addr | ( | struct in6_addr | base, |
| uint32_t | add ) |
Definition at line 242 of file socket_util.c.
References add_in6_addr().
Referenced by add_in6_addr(), helper_client_server(), ifconfig_pool_acquire(), ifconfig_pool_handle_to_ipv6_base(), and test_add_in6_addr_tc().
|
inlinestatic |
Definition at line 196 of file socket_util.h.
References openvpn_sockaddr::addr, openvpn_sockaddr::in4, openvpn_sockaddr::in6, and openvpn_sockaddr::sa.
Referenced by initialization_sequence_completed(), link_socket_actual_defined(), and log_entry_print().
| const char * addr_family_name | ( | int | af | ) |
Definition at line 446 of file socket_util.c.
Referenced by dco_mp_start_vpn(), dco_p2p_new_peer(), link_socket_init_phase2(), and socket_bind().
|
inlinestatic |
Definition at line 295 of file socket_util.h.
References openvpn_sockaddr::addr, ASSERT, openvpn_sockaddr::in4, openvpn_sockaddr::in6, IN6_ARE_ADDR_EQUAL, and openvpn_sockaddr::sa.
Referenced by addr_match_proto().
|
inlinestatic |
Definition at line 395 of file socket_util.h.
References addr_match(), addr_port_match(), and link_socket_proto_connection_oriented().
Referenced by link_socket_set_outgoing_addr().
|
inlinestatic |
Definition at line 378 of file socket_util.h.
References openvpn_sockaddr::addr, ASSERT, openvpn_sockaddr::in4, openvpn_sockaddr::in6, IN6_ARE_ADDR_EQUAL, and openvpn_sockaddr::sa.
Referenced by addr_match_proto(), and link_socket_actual_match().
|
inlinestatic |
Definition at line 411 of file socket_util.h.
References openvpn_sockaddr::addr, openvpn_sockaddr::in4, openvpn_sockaddr::in6, and openvpn_sockaddr::sa.
Referenced by phase2_socks_client().
|
inlinestatic |
Definition at line 310 of file socket_util.h.
References openvpn_sockaddr::addr, ASSERT, openvpn_sockaddr::in4, openvpn_sockaddr::in6, IN6_ARE_ADDR_EQUAL, and openvpn_sockaddr::sa.
Referenced by addrlist_match_proto().
|
inlinestatic |
Definition at line 404 of file socket_util.h.
References addrlist_match(), addrlist_port_match(), and link_socket_proto_connection_oriented().
Referenced by link_socket_set_outgoing_addr(), and link_socket_verify_incoming_addr().
|
inlinestatic |
Definition at line 341 of file socket_util.h.
References openvpn_sockaddr::addr, ASSERT, openvpn_sockaddr::in4, openvpn_sockaddr::in6, IN6_ARE_ADDR_EQUAL, and openvpn_sockaddr::sa.
Referenced by addrlist_match_proto().
|
inlinestatic |
Definition at line 426 of file socket_util.h.
References ASSERT, M_ERR, and msg.
Referenced by openvpn_connect(), read_sockaddr_from_overlapped(), socket_do_accept(), and socket_recv_queue().
| sa_family_t ascii2af | ( | const char * | proto_name | ) |
Definition at line 396 of file socket_util.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 383 of file socket_util.c.
References proto_names::proto, proto_names::short_form, and SIZE.
Referenced by add_option().
|
inlinestatic |
Overhead added to packets by various protocols.
Definition at line 270 of file socket_util.h.
References PROTO_UDP.
Referenced by calc_control_channel_frame_overhead(), frame_adjust_path_mtu(), get_ip_encap_overhead(), and process_outgoing_link().
| bool ip_addr_dotted_quad_safe | ( | const char * | dotted_quad | ) |
Definition at line 522 of file socket_util.c.
References OIA_IP, and openvpn_inet_aton().
Referenced by check_route_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 608 of file socket_util.c.
References dns_addr_safe(), and ip_addr_dotted_quad_safe().
Referenced by add_option(), and check_route_option().
| bool ipv6_addr_safe | ( | const char * | ipv6_text_addr | ) |
Definition at line 572 of file socket_util.c.
Referenced by add_option(), and check_route6_option().
|
inlinestatic |
Definition at line 289 of file socket_util.h.
References addr_defined(), and link_socket_actual::dest.
Referenced by check_ping_restart(), link_socket_current_remote(), link_socket_current_remote_ipv6(), link_socket_get_outgoing_addr(), link_socket_verify_incoming_addr(), process_outgoing_link(), resolve_remote(), tls_multi_process(), tls_update_remote_addr(), and write_control_auth().
|
inlinestatic |
Definition at line 447 of file socket_util.h.
References addr_port_match(), and link_socket_actual::dest.
Referenced by handle_data_channel_packet(), multi_get_instance_udp_data(), tls_pre_decrypt(), and tls_update_remote_addr().
|
inlinestatic |
Definition at line 283 of file socket_util.h.
References proto_is_dgram().
Referenced by addr_match_proto(), addrlist_match_proto(), and link_socket_connection_oriented().
| bool mac_addr_safe | ( | const char * | mac_addr | ) |
Definition at line 625 of file socket_util.c.
Referenced by add_option().
| int openvpn_inet_aton | ( | const char * | dotted_quad, |
| struct in_addr * | addr ) |
Definition at line 498 of file socket_util.c.
References CC_DIGIT, CC_DOT, CLEAR, OIA_ERROR, OIA_HOSTNAME, OIA_IP, and string_class().
Referenced by ip_addr_dotted_quad_safe().
| const char * print_in6_addr | ( | struct in6_addr | addr6, |
| unsigned int | flags, | ||
| struct gc_arena * | gc ) |
Definition at line 216 of file socket_util.c.
References gc, gc_malloc(), and IA_EMPTY_IF_UNDEF.
Referenced by add_route_ipv6(), check_mapped_ipv4_address(), dco_win_add_iroute_ipv6(), dco_win_del_iroute_ipv6(), delete_route_ipv6(), do_address_service(), do_ifconfig_ipv6(), do_ifconfig_setenv(), drop_if_recursive_routing(), 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_route_ipv6(), show_dns_options(), show_p2mp_parms(), test_add_in6_addr_tc(), and undo_ifconfig_ipv6().
Definition at line 196 of file socket_util.c.
References CLEAR, gc, gc_malloc(), IA_EMPTY_IF_UNDEF, and IA_NET_ORDER.
Referenced by adapter_index_of_ip(), add_route(), add_route_ipapi(), check_addr_clash(), dco_win_add_iroute_ipv4(), dco_win_del_iroute_ipv4(), delete_route(), dhcp_extract_router_msg(), dhcp_masq_addr(), do_address_service(), do_close_tun(), do_ifconfig_ipv4(), do_ifconfig_setenv(), do_open_tun(), drop_if_recursive_routing(), 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_bypass_addresses(), print_client_nat_list(), print_default_gateway(), print_netmask(), print_opt_route(), print_opt_route_gateway(), print_pkt(), 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().
Definition at line 231 of file socket_util.c.
References alloc_buf_gc(), BSTR, buf_printf(), and gc.
Referenced by show_dns_options().
| const char * print_link_socket_actual | ( | const struct link_socket_actual * | act, |
| struct gc_arena * | gc ) |
Definition at line 117 of file socket_util.c.
References gc, print_link_socket_actual_ex(), PS_SHOW_PKTINFO, and PS_SHOW_PORT.
Referenced by do_pre_decrypt_check(), drop_if_recursive_routing(), handle_data_channel_packet(), link_socket_bad_incoming_addr(), link_socket_connection_initiated(), print_key_id_not_found_reason(), process_incoming_link_part1(), process_outgoing_link(), read_control_auth(), resolve_remote(), 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 127 of file socket_util.c.
References openvpn_sockaddr::addr, alloc_buf_gc(), BSTR, buf_printf(), CLEAR, link_socket_actual::dest, gc, IF_NAMESIZE, print_sockaddr_ex(), PS_SHOW_PKTINFO, and openvpn_sockaddr::sa.
Referenced by linksock_print_addr(), and print_link_socket_actual().
|
inlinestatic |
Definition at line 71 of file socket_util.h.
References openvpn_sockaddr::addr, gc, print_sockaddr_ex(), PS_SHOW_PORT, and openvpn_sockaddr::sa.
Referenced by recv_socks_reply().
|
inlinestatic |
Definition at line 77 of file socket_util.h.
References gc, print_sockaddr_ex(), and PS_SHOW_PORT.
Referenced by linksock_print_addr(), man_connect(), man_listen(), man_new_connection_post(), socket_connect(), and socket_do_listen().
| const char * print_sockaddr_ex | ( | const struct sockaddr * | addr, |
| const char * | separator, | ||
| const unsigned int | flags, | ||
| struct gc_arena * | gc ) |
Definition at line 38 of file socket_util.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), buf_puts(), gc, 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_sockaddr(), and socket_bind().
| const char * proto2ascii | ( | int | proto, |
| sa_family_t | af, | ||
| bool | display_form ) |
Definition at line 409 of file socket_util.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(), man_kill(), management_callback_remote_entry_get(), mroute_addr_print_ex(), process_incoming_link_part1(), process_outgoing_link(), setenv_local_entry(), show_connection_entry(), and x_check_status().
| const char * proto2ascii_all | ( | struct gc_arena * | gc | ) |
Definition at line 430 of file socket_util.c.
References alloc_buf_gc(), BSTR, buf_printf(), gc, and SIZE.
Referenced by add_option().
|
inlinestatic |
Return if the protocol is datagram (UDP).
Definition at line 168 of file socket_util.h.
References proto_is_udp().
Referenced by do_preresolve(), has_udp_in_local_list(), inherit_context_child(), link_socket_proto_connection_oriented(), multi_close_instance(), multi_io_process_io(), multi_io_wait(), multi_io_write_link(), multi_push_restart_schedule_exit(), multi_tcp_set_global_rw_flags(), options_postprocess_verify_ce(), process_received_occ_msg(), resolve_bind_local(), resolve_remote(), and update_options_ce_post().
|
inlinestatic |
Definition at line 147 of file socket_util.h.
References ASSERT, PROTO_N, and PROTO_NONE.
Referenced by options_postprocess_verify_ce().
|
inlinestatic |
returns if the proto is a TCP variant (tcp-server, tcp-client or tcp)
Definition at line 177 of file socket_util.h.
References ASSERT, PROTO_N, PROTO_TCP_CLIENT, and PROTO_TCP_SERVER.
Referenced by frame_calculate_protocol_header_size(), link_socket_read(), link_socket_write(), phase2_set_socket_flags(), socket_recv_queue(), and socket_send_queue().
|
inlinestatic |
Returns if the protocol being used is UDP.
Definition at line 157 of file socket_util.h.
References ASSERT, PROTO_N, and PROTO_UDP.
Referenced by ce_management_query_proxy(), do_deferred_options(), frame_calculate_protocol_header_size(), link_socket_read(), link_socket_write(), options_postprocess_mutate_ce(), options_postprocess_verify_ce(), proto_is_dgram(), socket_recv_queue(), and socket_send_queue().
| const char * proto_remote | ( | int | proto, |
| bool | remote ) |
Definition at line 472 of file socket_util.c.
References ASSERT, PROTO_N, PROTO_TCP_CLIENT, PROTO_TCP_SERVER, and PROTO_UDP.
Referenced by options_string().
| void setenv_in6_addr | ( | struct env_set * | es, |
| const char * | name_prefix, | ||
| const struct in6_addr * | addr, | ||
| const unsigned int | flags ) |
Definition at line 330 of file socket_util.c.
References openvpn_sockaddr::addr, CLEAR, 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 316 of file socket_util.c.
References openvpn_sockaddr::addr, CLEAR, 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 344 of file socket_util.c.
References link_socket_actual::dest, 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 263 of file socket_util.c.
References openvpn_sockaddr::addr, 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().