From patchwork Thu Dec 19 00:18:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 945 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id UALIJt9c+113cQAAIUCqbw for ; Thu, 19 Dec 2019 06:19:59 -0500 Received: from proxy19.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id GNpuJt9c+11wFAAAfY0hYg ; Thu, 19 Dec 2019 06:19:59 -0500 Received: from smtp15.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.ord1d.rsapps.net with LMTP id 6E1dJt9c+127OgAAyH2SIw ; Thu, 19 Dec 2019 06:19:59 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp15.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 7de6a41a-2251-11ea-9cfd-5254007ab6c8-1-1 Received: from [216.105.38.7] ([216.105.38.7:56104] helo=lists.sourceforge.net) by smtp15.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 9B/A8-18613-FDC5BFD5; Thu, 19 Dec 2019 06:19:59 -0500 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.90_1) (envelope-from ) id 1ihtpd-0004Hf-Mw; Thu, 19 Dec 2019 11:19:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ihtpc-0004HX-93 for openvpn-devel@lists.sourceforge.net; Thu, 19 Dec 2019 11:19:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9JjSFJxdEmB7GKIQQs8wdSnjs/fpad1DDEywlSnzpDQ=; b=X5UKmXmZ2GnF9mvCUDUWgf/8gf gDTtNV3ZeFSzzKQTRhxQClF2ImnGl91L7JCGwasVPvA718lpUoSq8g8y2YtTyF3rAcGhC3UoT9Edx 4S2i+iyPD/sd8eO3DMaGqkky90ZATQcVG0hEr1xgvNxz92T+Hc2ZrBKO6o2j9eKYmHmE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9JjSFJxdEmB7GKIQQs8wdSnjs/fpad1DDEywlSnzpDQ=; b=QYzOG+4nAvC9m5D9kuQOt7B+qP c2SY+tk/cN8lEtRP+T3Y/VXQtFcd0tve1UWPjiq6rzWStEalUnzT0hdxhYfuxrKCJ5zOSdqYWxCOT S6WJL+tzc4o8Ko59uYCE0oDv5Mp3X2rjGq9Nh8pbiW71v1AAeanzy7FD/tS5waUai5ls=; Received: from mail-wm1-f48.google.com ([209.85.128.48]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1ihtpY-009oot-6w for openvpn-devel@lists.sourceforge.net; Thu, 19 Dec 2019 11:19:00 +0000 Received: by mail-wm1-f48.google.com with SMTP id u2so5202841wmc.3 for ; Thu, 19 Dec 2019 03:18:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9JjSFJxdEmB7GKIQQs8wdSnjs/fpad1DDEywlSnzpDQ=; b=L2mZ6hBHdPpCn4BcwZ1hdBo0V+DIu3ihM5L4RAmFNzCIBBUJgYh+baka1WBpH9d7NN Gplw6Bu4LPlysVj3a8egMqz6XfhmSvKmyvL/QA9zzyl+BMgoeG/l9mgxKnmUczShHhgG 9Zg70yWatf4X3XUTQR7wrxCX7ogp0ekcss56OJ0Z8ClvSe8ALJ10MbovjIouifr7Z1YN uSlEZX1d12hhjxoS6R2I/FboqVcmmYou6KY2OMywF2GgYjbdqdTVndSfg/B+73PHbUcU lCVYtUaVOS021DWFtW0MrMipwE1YXR3kra8VcKcZNeXkhxZY/0g/usOWcFu++KULOp0O vqPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9JjSFJxdEmB7GKIQQs8wdSnjs/fpad1DDEywlSnzpDQ=; b=W9n4fzieJDOch0Y7kb/g6n2nhwmA2p1dyt/hwDYod/dePqdBBcFZ8JK7IxETM+5ZlS K0y25rzYeNlIC36yktVZYr7mdRHjQ6WtMhuPbd5R4B+Cq6TxX4mxM2F/uqJ0IZgtfQu4 XOqfVXjReOIt6kX3N8whrZvMl7/f3X9b2Ukdbbn/B3WOSzgLH7kZSfcZspt7NNRwE6Eg hpmDaJ841IFt2XFJNCvq62u779yVKToQ3OIPn1HWUXg81oc4zFKDuUrzUABdBLk7mhh0 R9HEhvZYDiqXE5BKwPo+f5JOl+b9SemhZQzWvX55bEAuRXUxL15i4JKv5gaKJ8Zd8nig AsiQ== X-Gm-Message-State: APjAAAUO2q1uXBy+4g8dlGWJ3gFTU/tjMIUmBTdpKzGMPTuwtoUBNG3s a7D5O8zzMFgI4cJpuiP3OULsGavwl08= X-Google-Smtp-Source: APXvYqwf7AelanQjB3/K87cHXI3BY5dSbyhSH4G9tGaoFbuuQJsKi6BcE2gCvmdZzQMSu/vBJQ0BYA== X-Received: by 2002:a05:600c:211:: with SMTP id 17mr9322247wmi.60.1576754329342; Thu, 19 Dec 2019 03:18:49 -0800 (PST) Received: from LAPTOP-4L3N7KFS.panoulu.local (nat2.panoulu.net. [185.38.2.2]) by smtp.gmail.com with ESMTPSA id t125sm2359042wmf.17.2019.12.19.03.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 03:18:48 -0800 (PST) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Thu, 19 Dec 2019 13:18:21 +0200 Message-Id: <20191219111821.313-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.48 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1ihtpY-009oot-6w Subject: [Openvpn-devel] [PATCH] tun.c: do not add/remove routes on tun open/close 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: , Cc: Lev Stipakov MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov Commit 1c4a47f added route manipulation to open/close tun functions, which is not really needed: - routes are added in check_add_routes(), triggered by timer - routes are removed in delete_routes(), called by do_close_tun() Signed-off-by: Lev Stipakov Acked-by: Simon Rozman --- src/openvpn/route.c | 2 +- src/openvpn/route.h | 3 --- src/openvpn/tun.c | 17 ----------------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index cc6d5519..97e90e56 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -3019,7 +3019,7 @@ out: return ret; } -bool +static bool 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); diff --git a/src/openvpn/route.h b/src/openvpn/route.h index 27b652cd..7dd96091 100644 --- a/src/openvpn/route.h +++ b/src/openvpn/route.h @@ -321,9 +321,6 @@ void setenv_routes(struct env_set *es, const struct route_list *rl); void setenv_routes_ipv6(struct env_set *es, const struct route_ipv6_list *rl6); -bool do_route_ipv4_service(const bool add, const struct route_ipv4 *r, - const struct tuntap *tt); - bool is_special_addr(const char *addr_str); void get_default_gateway(struct route_gateway_info *rgi, diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 8d87ac41..ad497a71 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -860,21 +860,6 @@ delete_route_connected_v6_net(struct tuntap *tt, } #endif /* if defined(_WIN32) || defined(TARGET_DARWIN) || defined(TARGET_NETBSD) || defined(TARGET_OPENBSD) */ -#if defined(_WIN32) -void -do_route_ipv4_service_tun(bool add, const struct tuntap *tt) -{ - struct route_ipv4 r4; - CLEAR(r4); - r4.network = tt->local & tt->remote_netmask; - r4.netmask = tt->remote_netmask; - r4.gateway = tt->local; - r4.metric = 0; /* connected route */ - r4.flags = RT_DEFINED | RT_METRIC_DEFINED; - do_route_ipv4_service(add, &r4, tt); -} -#endif - #if defined(TARGET_FREEBSD) || defined(TARGET_DRAGONFLY) \ || defined(TARGET_NETBSD) || defined(TARGET_OPENBSD) /* we can't use true subnet mode on tun on all platforms, as that @@ -1406,7 +1391,6 @@ do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu, if (tt->options.msg_channel && tt->wintun) { do_address_service(true, AF_INET, tt); - do_route_ipv4_service_tun(true, tt); do_dns_service(true, AF_INET, tt); } else @@ -6489,7 +6473,6 @@ close_tun(struct tuntap *tt, openvpn_net_ctx_t *ctx) { if (tt->options.msg_channel) { - do_route_ipv4_service_tun(false, tt); do_address_service(false, AF_INET, tt); do_dns_service(false, AF_INET, tt); }