From patchwork Fri Jan 6 15:04:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2980 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp1062032dyk; Fri, 6 Jan 2023 07:04:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXsrhxmfqHI3FLQ5i4Pf7pRLfTVfrdnHzDigovP1ym7qmOtUe/t/LTyrBooYkfjQ8zUKuOD+ X-Received: by 2002:a17:902:c10c:b0:192:b5b1:eb1a with SMTP id 12-20020a170902c10c00b00192b5b1eb1amr24208213pli.69.1673017494187; Fri, 06 Jan 2023 07:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673017494; cv=none; d=google.com; s=arc-20160816; b=S84Kp5Xl7mEj4pRllYv5y68bNASUHzquYnSWqWxbN3LJEKVtebTR6udnZSycv67KiA 5AVw8UxVV01iSOqCKRzsLD7YyPz3ESl+Q45OdG5S6DLymh9kHEThe6Jzi6YJYRP72PGR J0S1ytavZrA6ch2HXejDKHolspI62ronZXfZ5clP0Tdq/dGScKFaIzOeWHaeiXJ8Y/9N FCAGuTEdPkeluWH0YVZpOAEXjpnAywj/Qwp91XHuY/ku+UIOtVwSs9phOYZbJtOw27gf DEJo6qxjFdKpQHX1biWeoJJADY+V+mYRoRvd6oZMaNKc5g7sUGvqMXCmcojAG93yOYvZ bxdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=6CUIJqiTMU+BCFBj2Hd/Fp+RJWLxxmJEoKqozYTQxaU=; b=iDpzGHh7mAWcmfFBmMTFtb6yK0MswzDqUxc3EaLMeT36KJRlvzJSp0Cj9GN22qtTLR 8+0e9e57258Qb99/WGznof8PUf5ccprvMNybHwFtxQe+4xIctdhkYkGb6xXMw7/4eJEZ 7s6aYzZHziJ9OYhGYRd1U12DEq9NP9YWzUYx+FVt/iHuDpernXEepOTLlYEzKkCbnh2H wwUURY9Pm1pFmihfByVcnCxhq+x7RFjp1fpRuPwiLjkGW/f3Z7WpRrnWkZVEEhEf4+cD Bk8kMRPGG83ntWFFtLrHijmmbccXJEK1vLO11T6ppUU0W4lPtfrqk8Co7bTcv329PzHK RhyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=EeoyZHEH; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ccySGU1C; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=n78gLUBG; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id o26-20020a65615a000000b004777f68f798si1619252pgv.814.2023.01.06.07.04.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2023 07:04:54 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=EeoyZHEH; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ccySGU1C; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=n78gLUBG; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pDoGp-0007UZ-MM; Fri, 06 Jan 2023 15:04:35 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pDoGm-0007US-IH for openvpn-devel@lists.sourceforge.net; Fri, 06 Jan 2023 15:04:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9jfdLv74EfwyjOnPZbAITlCBi+Up25zH3rU2vVNTehA=; b=EeoyZHEHX605dxXwRHVeKdS9VG JgT5S8YamfWTRHCdtX2o3oIaFnnwlikoPdDssDJ7D45hrM+cjdg6mX5nodxH+PXjW1ExVKwXcnmeT 2Uhzjho7ICSN3Syk//xYA1a1BuXI08nc3XCTuJInH5z2EchMpKrrJYhbfTE8kctwKk1E=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9jfdLv74EfwyjOnPZbAITlCBi+Up25zH3rU2vVNTehA=; b=ccySGU1C2nnfOr+rvbeUjO8hz6 mEmhLhWxt7yXeRZ+Zj4bqsCHCVcQSFWIMo46lNibbVjjZw9LbPmHrb0tcCcAqWIUS+ylRFZ4U0R99 BuLHpa8XfAXe4f3wBL8GOjBT6rxrXaNq+m5zrpQpjR3uOK7SVLcWnHM+OwSOIzXqxClM=; Received: from mail-io1-f48.google.com ([209.85.166.48]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pDoGf-0006b9-Ch for openvpn-devel@lists.sourceforge.net; Fri, 06 Jan 2023 15:04:32 +0000 Received: by mail-io1-f48.google.com with SMTP id b192so793707iof.8 for ; Fri, 06 Jan 2023 07:04:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9jfdLv74EfwyjOnPZbAITlCBi+Up25zH3rU2vVNTehA=; b=n78gLUBGzj/pjCOPPk2J9wCJvBVEkFD40sgigSPOwdRpHwxchmzg9C0f5yeG+3Wun1 MY3WAV3HGnfgZhOBV9PDGvoJF4JPzSM6IfnWWWDFz7fJwpXxNOY6bdfzn6MG1xrzpBgV qnKPjNEWYbIzzAtwlZPtDRbl5FOa6+q17stm0sId010Mxc9iCtu36h3bV9inpsjSgguW IdauCR7gjXBKICmCoHyjGvihVjbCi0v7HIavqxMBQdBXPDERXptOW0LtcBWGXwIVKc6x 6LeEmjU1ou/HXQsPf2WPSsuTyEr7HWP3UZ/OOOEFFWgsIDjP5Rs/fQB38DpRAfOQVWLL s/Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9jfdLv74EfwyjOnPZbAITlCBi+Up25zH3rU2vVNTehA=; b=CkBIrBi+oIyioLFKuz+XLHt7eT8nHRdS4G7lgmPeKy+G2+L28JG6KqjId0ZvECZNDW 2hc4huh0pz2yNT/poI/Y9TGBDiqHifp2yvnQDRXu1ZLm6GCXAIkvcus2mcD122oKhk12 KHehJzlI33jXjvLb7pVd1jvz4r89vr4nDOoHGrrr8r17+V5Zo+FoO4BKsNmMnSY7WSr4 byp+O7HnNyMQPLBQVWvHL8kv0NiXTxnDgNb/IU6SdGyRP4PpIVA0BUNHggA7GI1YNgMU sjxeELNXtxCxvoXyJqvOKDbLayTNlZWGy8/pJ8GLvuw9ZpIuuGUDO4oXf+EhGSwNOTvx 2T6g== X-Gm-Message-State: AFqh2krjrBteF3xyXgnxVNG4vUupxjFmCw+kSzJPUvHqJ5Qrciz9so+p LXNnunixtkaiAN1I5tltk10A9iQ7rHs= X-Received: by 2002:a6b:e812:0:b0:6f3:fed4:aa36 with SMTP id f18-20020a6be812000000b006f3fed4aa36mr6143167ioh.1.1673017459428; Fri, 06 Jan 2023 07:04:19 -0800 (PST) Received: from uranus.sansel.ca (bras-vprn-tnhlon4053w-lp130-01-70-51-222-66.dsl.bell.ca. [70.51.222.66]) by smtp.gmail.com with ESMTPSA id i64-20020a6bb843000000b006e0338b60a5sm417779iof.22.2023.01.06.07.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 07:04:19 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Fri, 6 Jan 2023 10:04:12 -0500 Message-Id: <20230106150412.1667492-1-selva.nair@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230105022718.1641751-2-selva.nair@gmail.com> References: <20230105022718.1641751-2-selva.nair@gmail.com> MIME-Version: 1.0 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Selva Nair When possible, functions that add a route now return 1 on success, or 2 if route already exists or 0 on other errors instead of true/false. Note: net_route_v4/v6_add using netlink filters out EEXIST before returning this looks like a bug as add_route() and add_route_ipv6() should set RT_ADDED only if route was really added. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.48 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.48 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1pDoGf-0006b9-Ch Subject: [Openvpn-devel] [PATCH v2 2/3] Distinguish route addition errors from route already exists X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1754147805395386575?= X-GMAIL-MSGID: =?utf-8?q?1754285992187145962?= From: Selva Nair When possible, functions that add a route now return 1 on success, or 2 if route already exists or 0 on other errors instead of true/false. Note: net_route_v4/v6_add using netlink filters out EEXIST before returning this looks like a bug as add_route() and add_route_ipv6() should set RT_ADDED only if route was really added. v2: "succeeded/skipped" --> "succeeded" in log. Signed-off-by: Selva Nair Acked-by: Lev Stipakov Acked-by: Gert Doering --- net_route_v4/v6_add when using iproute2 always returns 0 (meaning success) making it impossible to respect RT_ADDED flag or propagate errors. I think these should be fixed. src/openvpn/route.c | 91 ++++++++++++++++++++++++++++----------------- src/openvpn/route.h | 4 -- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index eabfe0a5..0d4aeaaf 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -57,15 +57,20 @@ #include "openvpn-msg.h" #define METRIC_NOT_USED ((DWORD)-1) -static bool add_route_service(const struct route_ipv4 *, const struct tuntap *); +static int add_route_service(const struct route_ipv4 *, const struct tuntap *); static bool del_route_service(const struct route_ipv4 *, const struct tuntap *); -static bool add_route_ipv6_service(const struct route_ipv6 *, const struct tuntap *); +static int add_route_ipv6_service(const struct route_ipv6 *, const struct tuntap *); static bool del_route_ipv6_service(const struct route_ipv6 *, const struct tuntap *); -static bool route_ipv6_ipapi(bool add, const struct route_ipv6 *, const struct tuntap *); +static int route_ipv6_ipapi(bool add, const struct route_ipv6 *, const struct tuntap *); + +static int add_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt, DWORD adapter_index); + +static bool del_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt); + #endif @@ -1572,7 +1577,7 @@ add_route(struct route_ipv4 *r, const struct env_set *es, openvpn_net_ctx_t *ctx) { - bool status = false; + int status = 0; int is_local_route; if (!(r->flags & RT_DEFINED)) @@ -1611,12 +1616,12 @@ add_route(struct route_ipv4 *r, metric = r->metric; } - status = true; + status = 1; if (net_route_v4_add(ctx, &r->network, netmask_to_netbits2(r->netmask), &r->gateway, iface, 0, metric) < 0) { msg(M_WARN, "ERROR: Linux route add command failed"); - status = false; + status = 0; } #elif defined (TARGET_ANDROID) @@ -1656,12 +1661,12 @@ add_route(struct route_ipv4 *r, if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_SERVICE) { status = add_route_service(r, tt); - msg(D_ROUTE, "Route addition via service %s", status ? "succeeded" : "failed"); + msg(D_ROUTE, "Route addition via service %s", (status == 1) ? "succeeded" : "failed"); } else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_IPAPI) { status = add_route_ipapi(r, tt, ai); - msg(D_ROUTE, "Route addition via IPAPI %s", status ? "succeeded" : "failed"); + msg(D_ROUTE, "Route addition via IPAPI %s", (status == 1) ? "succeeded" : "failed"); } else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_EXE) { @@ -1672,8 +1677,8 @@ add_route(struct route_ipv4 *r, else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_ADAPTIVE) { status = add_route_ipapi(r, tt, ai); - msg(D_ROUTE, "Route addition via IPAPI %s [adaptive]", status ? "succeeded" : "failed"); - if (!status) + msg(D_ROUTE, "Route addition via IPAPI %s [adaptive]", (status == 1) ? "succeeded" : "failed"); + if (status == 0) { msg(D_ROUTE, "Route addition fallback to route.exe"); netcmd_semaphore_lock(); @@ -1828,7 +1833,7 @@ add_route(struct route_ipv4 *r, #endif /* if defined(TARGET_LINUX) */ done: - if (status) + if (status == 1) { r->flags |= RT_ADDED; } @@ -1871,7 +1876,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx) { - bool status = false; + int status = 0; const char *device = tt->actual_name; bool gateway_needed = false; @@ -1942,7 +1947,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, "parameter for a --route-ipv6 option and no default was set via " "--ifconfig-ipv6 or --route-ipv6-gateway option. Not installing " "IPv6 route to %s/%d.", network, r6->netbits); - status = false; + status = 0; goto done; } @@ -1953,13 +1958,13 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, metric = r6->metric; } - status = true; + status = 1; if (net_route_v6_add(ctx, &r6->network, r6->netbits, gateway_needed ? &r6->gateway : NULL, device, 0, metric) < 0) { msg(M_WARN, "ERROR: Linux IPv6 route can't be added"); - status = false; + status = 0; } #elif defined (TARGET_ANDROID) @@ -2075,7 +2080,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, #endif /* if defined(TARGET_LINUX) */ done: - if (status) + if (status == 1) { r6->flags |= RT_ADDED; } @@ -2773,11 +2778,11 @@ done: gc_free(&gc); } -bool +static int add_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt, DWORD adapter_index) { struct gc_arena gc = gc_new(); - bool ret = false; + int ret = 0; DWORD status; const DWORD if_index = (adapter_index == TUN_ADAPTER_INDEX_INVALID) ? windows_route_find_if_index(r, tt) : adapter_index; @@ -2811,7 +2816,11 @@ add_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt, DWORD adapt if (status == NO_ERROR) { - ret = true; + ret = 1; + } + else if (status == ERROR_OBJECT_ALREADY_EXISTS) + { + ret = 2; } else { @@ -2830,7 +2839,7 @@ add_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt, DWORD adapt msg(D_ROUTE, "ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=%u and dwForwardType=%u", (unsigned int)fr.dwForwardMetric1, (unsigned int)fr.dwForwardType); - ret = true; + ret = 1; goto doublebreak; } else if (status != ERROR_BAD_ARGUMENTS) @@ -2847,6 +2856,10 @@ doublebreak: strerror_win32(status, &gc), (unsigned int)status, (unsigned int)if_index); + if (status == ERROR_OBJECT_ALREADY_EXISTS) + { + ret = 2; + } } } } @@ -2855,7 +2868,7 @@ doublebreak: return ret; } -bool +static bool del_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt) { struct gc_arena gc = gc_new(); @@ -2891,10 +2904,11 @@ del_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt) return ret; } -static bool +/* Returns 1 on success, 2 if route exists, 0 on error */ +static int do_route_service(const bool add, const route_message_t *rt, const size_t size, HANDLE pipe) { - bool ret = false; + int ret = 0; ack_message_t ack; struct gc_arena gc = gc_new(); @@ -2908,23 +2922,25 @@ do_route_service(const bool add, const route_message_t *rt, const size_t size, H msg(M_WARN, "ROUTE: route %s failed using service: %s [status=%u if_index=%d]", (add ? "addition" : "deletion"), strerror_win32(ack.error_number, &gc), ack.error_number, rt->iface.index); + ret = (ack.error_number == ERROR_OBJECT_ALREADY_EXISTS) ? 2 : 0; goto out; } - ret = true; + ret = 1; out: gc_free(&gc); return ret; } -static bool +/* Returns 1 on success, 2 if route exists, 0 on error */ +static int do_route_ipv4_service(const bool add, const struct route_ipv4 *r, const struct tuntap *tt) { DWORD if_index = windows_route_find_if_index(r, tt); if (if_index == ~0) { - return false; + return 0; } route_message_t msg = { @@ -2949,11 +2965,14 @@ do_route_ipv4_service(const bool add, const struct route_ipv4 *r, const struct t return do_route_service(add, &msg, sizeof(msg), tt->options.msg_channel); } -/* Add or delete an ipv6 route */ -static bool +/* Add or delete an ipv6 route + * Returns 1 on success, 2 if route exists, 0 on error + */ +static int route_ipv6_ipapi(const bool add, const struct route_ipv6 *r, const struct tuntap *tt) { DWORD err; + int ret = 0; PMIB_IPFORWARD_ROW2 fwd_row; struct gc_arena gc = gc_new(); @@ -3006,20 +3025,22 @@ out: { msg(M_WARN, "ROUTE: route %s failed using ipapi: %s [status=%lu if_index=%lu]", (add ? "addition" : "deletion"), strerror_win32(err, &gc), err, fwd_row->InterfaceIndex); + ret = (err == ERROR_OBJECT_ALREADY_EXISTS) ? 2 : 0; } else { msg(D_ROUTE, "IPv6 route %s using ipapi", add ? "added" : "deleted"); + ret = 1; } gc_free(&gc); - - return (err == NO_ERROR); + return ret; } -static bool +/* Returns 1 on success, 2 if route exists, 0 on error */ +static int do_route_ipv6_service(const bool add, const struct route_ipv6 *r, const struct tuntap *tt) { - bool status; + int status; route_message_t msg = { .header = { (add ? msg_add_route : msg_del_route), @@ -3062,7 +3083,8 @@ do_route_ipv6_service(const bool add, const struct route_ipv6 *r, const struct t return status; } -static bool +/* Returns 1 on success, 2 if route exists, 0 on error */ +static int add_route_service(const struct route_ipv4 *r, const struct tuntap *tt) { return do_route_ipv4_service(true, r, tt); @@ -3074,7 +3096,8 @@ del_route_service(const struct route_ipv4 *r, const struct tuntap *tt) return do_route_ipv4_service(false, r, tt); } -static bool +/* Returns 1 on success, 2 if route exists, 0 on error */ +static int add_route_ipv6_service(const struct route_ipv6 *r, const struct tuntap *tt) { return do_route_ipv6_service(true, r, tt); diff --git a/src/openvpn/route.h b/src/openvpn/route.h index 33f2b28e..74ecd343 100644 --- a/src/openvpn/route.h +++ b/src/openvpn/route.h @@ -357,10 +357,6 @@ void show_routes(int msglev); bool test_routes(const struct route_list *rl, const struct tuntap *tt); -bool add_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt, DWORD adapter_index); - -bool del_route_ipapi(const struct route_ipv4 *r, const struct tuntap *tt); - #else /* ifdef _WIN32 */ static inline bool test_routes(const struct route_list *rl, const struct tuntap *tt)