Go to the documentation of this file.
40 #define ROUTE_METHOD_ADAPTIVE 0
41 #define ROUTE_METHOD_IPAPI 1
42 #define ROUTE_METHOD_EXE 2
43 #define ROUTE_METHOD_SERVICE 3
44 #define ROUTE_METHOD_MASK 3
50 #define ROUTE_DELETE_FIRST (1<<2)
51 #define ROUTE_REF_GW (1<<3)
55 #define N_ROUTE_BYPASS 8
63 #define RTSA_REMOTE_ENDPOINT (1<<0)
64 #define RTSA_REMOTE_HOST (1<<1)
65 #define RTSA_DEFAULT_METRIC (1<<2)
84 #define RG_ENABLE (1<<0)
85 #define RG_LOCAL (1<<1)
86 #define RG_DEF1 (1<<2)
87 #define RG_BYPASS_DHCP (1<<3)
88 #define RG_BYPASS_DNS (1<<4)
89 #define RG_REROUTE_GW (1<<5)
90 #define RG_AUTO_LOCAL (1<<6)
91 #define RG_BLOCK_LOCAL (1<<7)
113 #define RT_DEFINED (1<<0)
114 #define RT_ADDED (1<<1)
115 #define RT_METRIC_DEFINED (1<<2)
147 #define RGI_ADDR_DEFINED (1<<0)
148 #define RGI_NETMASK_DEFINED (1<<1)
149 #define RGI_HWADDR_DEFINED (1<<2)
150 #define RGI_IFACE_DEFINED (1<<3)
151 #define RGI_OVERFLOW (1<<4)
152 #define RGI_ON_LINK (1<<5)
158 #elif defined(TARGET_HAIKU)
159 char iface[PATH_MAX];
171 #define RGI_N_ADDRESSES 8
191 #if defined(TARGET_HAIKU)
193 #define IFNAMSIZ PATH_MAX
198 char iface[IFNAMSIZ];
208 #define RGI_N_ADDRESSES 8
214 #define RL_DID_REDIRECT_DEFAULT_GATEWAY (1<<0)
215 #define RL_DID_LOCAL (1<<1)
216 #define RL_ROUTES_ADDED (1<<2)
302 const char *remote_endpoint,
304 in_addr_t remote_host,
310 const char *remote_endpoint,
312 const struct in6_addr *remote_host,
318 const in_addr_t addr);
349 const struct in6_addr *dest,
362 #define TLA_NOT_IMPLEMENTED 0
363 #define TLA_NONLOCAL 1
389 bool netmask_to_netbits(
const in_addr_t network,
const in_addr_t netmask,
int *netbits);
393 static inline in_addr_t
396 const int addrlen =
sizeof(in_addr_t) * 8;
398 if (netbits > 0 && netbits <= addrlen)
struct in6_addr addr_ipv6
struct route_ipv6_option * routes_ipv6
void print_route_options(const struct route_option_list *rol, int level)
#define RTSA_REMOTE_ENDPOINT
void setenv_routes_ipv6(struct env_set *es, const struct route_ipv6_list *rl6)
static bool route_list_vpn_gateway_needed(const struct route_list *rl)
void add_route_to_option_list(struct route_option_list *l, const char *network, const char *netmask, const char *gateway, const char *metric)
struct route_bypass bypass
void copy_route_ipv6_option_list(struct route_ipv6_option_list *dest, const struct route_ipv6_option_list *src, struct gc_arena *a)
bool test_routes(const struct route_list *rl, const struct tuntap *tt)
struct route_ipv6_gateway_address gateway
static int route_did_redirect_default_gateway(const struct route_list *rl)
bool add_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
void print_default_gateway(const int msglevel, const struct route_gateway_info *rgi, const struct route_ipv6_gateway_info *rgi6)
struct route_ipv6_gateway_address addrs[RGI_N_ADDRESSES]
void copy_route_option_list(struct route_option_list *dest, const struct route_option_list *src, struct gc_arena *a)
bool is_special_addr(const char *addr_str)
struct route_gateway_address addrs[RGI_N_ADDRESSES]
void get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi, const struct in6_addr *dest, openvpn_net_ctx_t *ctx)
struct route_ipv4 * routes
bool init_route_list(struct route_list *rl, const struct route_option_list *opt, const char *remote_endpoint, int default_metric, in_addr_t remote_host, struct env_set *es, openvpn_net_ctx_t *ctx)
int test_local_addr(const in_addr_t addr, const struct route_gateway_info *rgi)
struct route_ipv6_option_list * new_route_ipv6_option_list(struct gc_arena *a)
bool add_route(struct route_ipv4 *r, const struct tuntap *tt, unsigned int flags, const struct route_gateway_info *rgi, const struct env_set *es, openvpn_net_ctx_t *ctx)
void print_routes(const struct route_list *rl, int level)
struct route_ipv6_option * next
void show_routes(int msglev)
struct route_ipv6 * routes_ipv6
bool netmask_to_netbits(const in_addr_t network, const in_addr_t netmask, int *netbits)
void add_route_ipv6_to_option_list(struct route_ipv6_option_list *l, const char *prefix, const char *gateway, const char *metric)
int netmask_to_netbits2(in_addr_t netmask)
struct in6_addr remote_host_ipv6
struct in6_addr remote_endpoint_ipv6
struct route_gateway_address gateway
#define IPV4_NETMASK_HOST
void get_default_gateway(struct route_gateway_info *rgi, in_addr_t dest, openvpn_net_ctx_t *ctx)
Retrieves the best gateway for a given destination based on the routing table.
bool add_route_ipv6(struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
void delete_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
struct route_option_list * new_route_option_list(struct gc_arena *a)
void route_ipv6_clear_host_bits(struct route_ipv6 *r6)
Garbage collection arena used to keep track of dynamically allocated memory.
struct iroute_ipv6 * next
struct route_ipv6_option_list * clone_route_ipv6_option_list(const struct route_ipv6_option_list *src, struct gc_arena *a)
bool block_local_needed(const struct route_list *rl)
Get the decision whether to block traffic to local networks while the VPN is connected.
void setenv_routes(struct env_set *es, const struct route_list *rl)
struct route_gateway_info rgi
static in_addr_t netbits_to_netmask(const int netbits)
void delete_route_ipv6(const struct route_ipv6 *r, const struct tuntap *tt, const struct env_set *es, openvpn_net_ctx_t *ctx)
struct route_option * routes
struct route_special_addr spec
#define RL_DID_REDIRECT_DEFAULT_GATEWAY
struct route_ipv6_gateway_info rgi6
bool init_route_ipv6_list(struct route_ipv6_list *rl6, const struct route_ipv6_option_list *opt6, const char *remote_endpoint, int default_metric, const struct in6_addr *remote_host, struct env_set *es, openvpn_net_ctx_t *ctx)
const struct route_option * option
void route_list_add_vpn_gateway(struct route_list *rl, struct env_set *es, const in_addr_t addr)
struct route_option_list * clone_route_option_list(const struct route_option_list *src, struct gc_arena *a)
in_addr_t bypass[N_ROUTE_BYPASS]
in_addr_t remote_endpoint
struct route_option * next