25#if defined(TARGET_LINUX) && defined(ENABLE_IPROUTE)
37#include <netinet/in.h>
84 msg(
M_WARN,
"%s: operation not supported by iproute2 backend", __func__);
139 "%s link set addr " MAC_FMT " dev %s",
144 "Linux ip link set addr failed"))
156 const in_addr_t *addr,
int prefixlen)
163 addr_str, prefixlen);
174 const struct in6_addr *addr,
int prefixlen)
179 argv_printf(&
argv,
"%s -6 addr add %s/%d dev %s", iproute_path, addr_str,
183 "Linux ip -6 addr add failed");
192 const in_addr_t *addr,
int prefixlen)
198 addr_str, prefixlen);
210 const struct in6_addr *addr,
int prefixlen)
216 addr_str, prefixlen,
iface);
227 const in_addr_t *local,
const in_addr_t *remote)
233 argv_printf(&
argv,
"%s addr add dev %s local %s peer %s", iproute_path,
234 iface, local_str, remote_str);
245 const in_addr_t *local,
const in_addr_t *remote)
251 argv_printf(&
argv,
"%s addr del dev %s local %s peer %s", iproute_path,
252 iface, local_str, remote_str);
263 const in_addr_t *gw,
const char *
iface, uint32_t table,
270 argv_printf(&
argv,
"%s route add %s/%d", iproute_path, dst_str, prefixlen);
302 int prefixlen,
const struct in6_addr *gw,
const char *
iface,
303 uint32_t table,
int metric)
309 argv_printf(&
argv,
"%s -6 route add %s/%d dev %s", iproute_path, dst_str,
337 const in_addr_t *gw,
const char *
iface, uint32_t table,
344 argv_printf(&
argv,
"%s route del %s/%d", iproute_path, dst_str, prefixlen);
364 int prefixlen,
const struct in6_addr *gw,
const char *
iface,
365 uint32_t table,
int metric)
371 argv_printf(&
argv,
"%s -6 route del %s/%d dev %s", iproute_path, dst_str,
void argv_msg(const int msglev, const struct argv *a)
Write the arguments stored in a struct argv via the msg() command.
void argv_free(struct argv *a)
Frees all memory allocations allocated by the struct argv related functions.
bool argv_printf(struct argv *argres, const char *format,...)
printf() variant which populates a struct argv.
bool argv_printf_cat(struct argv *argres, const char *format,...)
printf() inspired argv concatenation.
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
static void gc_reset(struct gc_arena *a)
static void gc_free(struct gc_arena *a)
static struct gc_arena gc_new(void)
#define MAC_PRINT_ARG(_mac)
static void net_ctx_reset(openvpn_net_ctx_t *ctx)
void * openvpn_net_iface_t
#define IFACE_TYPE_LEN_MAX
static int net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
static void net_ctx_free(openvpn_net_ctx_t *ctx)
int openvpn_execve_check(const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message)
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
Contains all state information for one tunnel.
struct env_set * es
Set of environment variables.