diff options
Diffstat (limited to 'src/openvpn/networking_iproute2.c')
-rw-r--r-- | src/openvpn/networking_iproute2.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/openvpn/networking_iproute2.c b/src/openvpn/networking_iproute2.c index 3b46052..67b8894 100644 --- a/src/openvpn/networking_iproute2.c +++ b/src/openvpn/networking_iproute2.c @@ -1,7 +1,7 @@ /* * Networking API implementation for iproute2 * - * Copyright (C) 2018 Antonio Quartulli <a@unstable.cc> + * Copyright (C) 2018-2021 Antonio Quartulli <a@unstable.cc> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -94,6 +94,29 @@ net_iface_mtu_set(openvpn_net_ctx_t *ctx, const char *iface, uint32_t mtu) } int +net_addr_ll_set(openvpn_net_ctx_t *ctx, const openvpn_net_iface_t *iface, + uint8_t *addr) +{ + struct argv argv = argv_new(); + int ret = 0; + + argv_printf(&argv, + "%s link set addr " MAC_FMT " dev %s", + iproute_path, MAC_PRINT_ARG(addr), iface); + + argv_msg(M_INFO, &argv); + if (!openvpn_execve_check(&argv, ctx->es, M_WARN, + "Linux ip link set addr failed")) + { + ret = -1; + } + + argv_free(&argv); + + return ret; +} + +int net_addr_v4_add(openvpn_net_ctx_t *ctx, const char *iface, const in_addr_t *addr, int prefixlen) { |