9#if defined(TARGET_FREEBSD)
12net_route_v4(
const char *op,
const in_addr_t *dst,
int prefixlen,
const in_addr_t *gw,
13 const char *
iface, uint32_t table,
int metric)
15 char buf1[INET_ADDRSTRLEN], buf2[INET_ADDRSTRLEN];
31 inet_ntop(AF_INET, &_dst, buf1,
sizeof(buf1)), prefixlen,
32 inet_ntop(AF_INET, &_gw, buf2,
sizeof(buf2)), table);
36 argv_printf(&
argv,
"%s %s -net %s/%d -iface %s -fib %d", ROUTE_PATH, op,
37 inet_ntop(AF_INET, &_dst, buf1,
sizeof(buf1)), prefixlen,
50net_route_v6(
const char *op,
const struct in6_addr *dst,
int prefixlen,
const struct in6_addr *gw,
51 const char *
iface, uint32_t table,
int metric)
53 char buf1[INET6_ADDRSTRLEN], buf2[INET6_ADDRSTRLEN];
65 inet_ntop(AF_INET6, dst, buf1,
sizeof(buf1)), prefixlen,
66 inet_ntop(AF_INET6, gw, buf2,
sizeof(buf2)), table);
70 argv_printf(&
argv,
"%s -6 %s -net %s/%d -iface %s -fib %d", ROUTE_PATH, op,
71 inet_ntop(AF_INET6, dst, buf1,
sizeof(buf1)), prefixlen,
85net_route_v4_add(
openvpn_net_ctx_t *ctx,
const in_addr_t *dst,
int prefixlen,
const in_addr_t *gw,
86 const char *
iface, uint32_t table,
int metric)
88 return net_route_v4(
"add", dst, prefixlen, gw,
iface, table, metric);
92net_route_v6_add(
openvpn_net_ctx_t *ctx,
const struct in6_addr *dst,
int prefixlen,
93 const struct in6_addr *gw,
const char *
iface, uint32_t table,
int metric)
95 return net_route_v6(
"add", dst, prefixlen, gw,
iface, table, metric);
99net_route_v4_del(
openvpn_net_ctx_t *ctx,
const in_addr_t *dst,
int prefixlen,
const in_addr_t *gw,
100 const char *
iface, uint32_t table,
int metric)
102 return net_route_v4(
"del", dst, prefixlen, gw,
iface, table, metric);
106net_route_v6_del(
openvpn_net_ctx_t *ctx,
const struct in6_addr *dst,
int prefixlen,
107 const struct in6_addr *gw,
const char *
iface, uint32_t table,
int metric)
109 return net_route_v6(
"del", dst, prefixlen, gw,
iface, table, metric);
void argv_msg(const msglvl_t msglevel, 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.
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
static SERVICE_STATUS status
int openvpn_execve_check(const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message)