From patchwork Thu Jan 5 02:27:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2974 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp13678dyk; Wed, 4 Jan 2023 18:28:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXtNEwyZ9C2RGq2PIVdB3M8dNpZk62fDVhcJi+cxUhIDHMHq8MXjXPzlLv4o7oMCBIB/HdZG X-Received: by 2002:a17:90b:3d86:b0:226:1566:a976 with SMTP id pq6-20020a17090b3d8600b002261566a976mr28602262pjb.18.1672885709229; Wed, 04 Jan 2023 18:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672885709; cv=none; d=google.com; s=arc-20160816; b=hHKoUES9TgRXkL5z/QznZuknjpLnONd5oQHaA8EsC27/GIJQGPj2fHtJvisN8Ar8Po u6QKpOJfcrPWWO7oMffnpY0dXUb7axvY+FvqAqFsuEgk95+/2PtBV/NSs33zN8yTmRzN +vpMdV0cM959tl3C17g3+73JewJ01STbbun4Eq0g1lnwkTuu7QUBsAxohQj78k9Vx2BJ 4PirowjZW5RCFq+Q5EMb4PyfFlYQFZCYd2iM5Itw8HsJGs4BR+hL5Y7ht90IzBuwFhgi 0FSGj7a1KHnzfvOXuvgIrU6xaNuACANw4vxnieYU4gsLd8SqCGBgzRO9TTV9tvmFMP1H 1O0A== 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=tdv57JK4grGuqh30QxKoJWyHPIynwlAnsv0vj9Bt8IY=; b=K6Q9gy9u4uGiyUkHuHALP7a6q7lQey2m24HkAJx7tPoYgUSEfYtEllTXWbY/G3yBZP 7b0/X8e2U8duGn+6YWi3al8mqQf5F0FdzgeGLKlWLZWIEQkXLEaCWeTp/0IdazkCHnrp p2hB+zVpfYOd+vVISZ+EgpMqXMkq4wL4uhDmaEgc2NOTVChBiPXP9adDJcBciTezo5P+ Sbtph3bpCL0EySpUA+tShLdMcNxbCVEywShHKBCkZdgCEWC6bY7IgkGLrsNTypfcqp6f XvdxK3Ly6dWVj+54Ipt3YsBhomofeJ30P8DGn5jGMkfqHdmwiKR2Is5oPxbN0RYcqrTV v9rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Jq0TVnQY; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ftFUYbg1; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ZTR25yTV; 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 pa2-20020a17090b264200b00226952323a1si542774pjb.152.2023.01.04.18.28.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jan 2023 18:28:29 -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=Jq0TVnQY; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ftFUYbg1; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ZTR25yTV; 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 1pDFyj-0000tq-LH; Thu, 05 Jan 2023 02:27:37 +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 1pDFyi-0000tk-9i for openvpn-devel@lists.sourceforge.net; Thu, 05 Jan 2023 02:27:36 +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=y10Lmu52Kt7wRwmrw/LNz65vV8kznyYOVczJ5Mk16BE=; b=Jq0TVnQYSErqn4IxXfPDksr/Qq SyUmvGmJSM5IlconSy9LZBqgVcjynoU4N0apzByo36Q1WuxvmZKz7uSUo8rtKZOUc3antqLaY6vRI rzLbg+6T9NrRsLSfGzI9GLGlL12GdOp1nJUeOmhzhxA8JF01uka2jK8nObmpgtnguJ/E=; 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=y10Lmu52Kt7wRwmrw/LNz65vV8kznyYOVczJ5Mk16BE=; b=ftFUYbg1ZBsyXPCToT1UOZzvtw MEtpgb/u0YE1X2pbz/mlFzkIScwBSvDS6aL60yt5dZcrprPa0o2QZu0rjIv4FrcEETBKsLNMwta/h hdjUL+zMH6z3Zed1gRXfvLIAXbRvPqksy1xfhbgK5A1vv/tFTcRtDSYfzhD3qK1atR3E=; Received: from mail-il1-f177.google.com ([209.85.166.177]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pDFye-0006s2-2Z for openvpn-devel@lists.sourceforge.net; Thu, 05 Jan 2023 02:27:36 +0000 Received: by mail-il1-f177.google.com with SMTP id p15so9468077ilg.9 for ; Wed, 04 Jan 2023 18:27:32 -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=y10Lmu52Kt7wRwmrw/LNz65vV8kznyYOVczJ5Mk16BE=; b=ZTR25yTVhqGW8aPaxVZCZ/NNfEh2c3L2vG0ULPuXSBFuI47ZEG3MVDSqrqcBjANDVX nP5MZ0IBj112gjjxLEsGGtIxnjZ1NQ70iIy0J5FCfIDqjHn3bjCazT39p6dJ96YgU3sO ekyhJxcDDLY8HFXXAr33B8VxNrbUD2xeweerPpZ51mf3BuvG5h2YFHDWY7h3WV/sFL0W Rh/1jcRHFvlQ5vrQEvWadJ0scgeI9ivzYwIv7rB7w+Ooob6WFuP7K5GK5yc7kAvlNSzQ y6JTAlnwas14zuSBDPIreKd4Dy8xzeBByEs8j9L/H+l/zFBuWGdhQTlDbf/mNVlenLlE J32w== 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=y10Lmu52Kt7wRwmrw/LNz65vV8kznyYOVczJ5Mk16BE=; b=YkxR7BP4Sxwyk0J2avVeKqYVG6X5n4fQDmtWekIv0XWyOdG0RNpgoOO85Uv5KH5Hhc uBXWKz+4KB21Q/COeZ4OaxkS67upKWjUvurtyReG3PK6G0O8R5R+bDHrZ/88qZuA4V4V +eQdrNOXrzBSVHtBaV5oDCyNSCv3mlpMDGLsKcDM42qIgCicIKN+YRFYii8yKp9p/20y uw9zLf5rOcVp4A3O+eyRNeA+zOBBqDrprUBeyCuERoKZNiR0xqrNkPfL8wtTcrD85mMH LquKDtt8Xw/7E0HSRKv1CU0u38TSrQgjyZKo560NMLuf35fuRpvUgUmccwIIYGLW9PoG l4jQ== X-Gm-Message-State: AFqh2koL8Uu/9zNSxk4gkOqv6kaZNjlr5RItTLSUUYcjesldICv8bZ5l qD2AX39jB2y2YmvF2dxcL76PyVDoPqosWb5r X-Received: by 2002:a92:c9cb:0:b0:304:c683:3c8a with SMTP id k11-20020a92c9cb000000b00304c6833c8amr6584215ilq.3.1672885645325; Wed, 04 Jan 2023 18:27:25 -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 g4-20020a05663810e400b0037477c3d04asm10968971jae.130.2023.01.04.18.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 18:27:25 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Wed, 4 Jan 2023 21:27:17 -0500 Message-Id: <20230105022718.1641751-2-selva.nair@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230105022718.1641751-1-selva.nair@gmail.com> References: <20230105022718.1641751-1-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-1.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 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.177 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1pDFye-0006s2-2Z Subject: [Openvpn-devel] [PATCH 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?1754147805395386575?= 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. Signed-off-by: Selva Nair --- 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..b4a9d56a 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/skipped" : "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/skipped" : "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)