From patchwork Thu Jun 23 22:37:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2530 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend41.mail.ord1d.rsapps.net with LMTP id MCkdIDR4tWKjTwAAqwncew (envelope-from ) for ; Fri, 24 Jun 2022 04:39:16 -0400 Received: from proxy1.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id mBkBIDR4tWL+UAAAalYnBA (envelope-from ) for ; Fri, 24 Jun 2022 04:39:16 -0400 Received: from smtp35.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.ord1d.rsapps.net with LMTPS id 6JK6HzR4tWIIFwAAasrz9Q (envelope-from ) for ; Fri, 24 Jun 2022 04:39:16 -0400 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: smtp35.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; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 2037e66e-f399-11ec-a9be-525400a7b7b4-1-1 Received: from [216.105.38.7] ([216.105.38.7:41172] helo=lists.sourceforge.net) by smtp35.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 11/68-19503-23875B26; Fri, 24 Jun 2022 04:39:14 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1o4epV-0001dx-Jc; Fri, 24 Jun 2022 08:38:17 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o4epR-0001bd-2O for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 08:38:13 +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=1WpPASnBfM/JMzwvDxxwAHzd9V4d46Jqtr3PJc4Gk9Q=; b=a/0siYqIweSEF4s6Mncgta0sGp ruKFp6yWz49HYkWLiDVNubvq5agKFfXdfqrWLohlRau/wwanrVI6O28xlH7zAEtBi4RkY5HHMFLmf fjBu3gvp9a+lWKsz6zk5dwbRc4Fh9BULTz5ePTHHaO/xbWi2b1qo2rWgLvWp/Ej0WRHo=; 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=1WpPASnBfM/JMzwvDxxwAHzd9V4d46Jqtr3PJc4Gk9Q=; b=czCNZVoIcjH9wOR9jPB7h4HMQh bPyoD2gYsp4saSoKQ3+VLPM9EpjWpv6KmLVCLPfQkadcW5RA30plhtV8E8j+fTbgXNerTQXlkJ5gb YKD/rgWrlGNeDg3REpNcueZc06fOdQeqwSwaZLUrrJEovHO05MA/t2RjEa7Ovygf+Xb8=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1o4epK-0004E4-UN for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 08:38:12 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 24 Jun 2022 10:37:47 +0200 Message-Id: <20220624083809.23487-4-a@unstable.cc> In-Reply-To: <20220624083809.23487-1-a@unstable.cc> References: <20220624083809.23487-1-a@unstable.cc> MIME-Version: 1.0 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: When using DCO iroutes and routes all live in the same routing table, However, the latter should always come after the former. for this reason assign a default metric of 200 to routes. iroutes will later get a metric of 100. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1o4epK-0004E4-UN Subject: [Openvpn-devel] [PATCH 03/25] dco: use specific metric when installing routes 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: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox When using DCO iroutes and routes all live in the same routing table, However, the latter should always come after the former. for this reason assign a default metric of 200 to routes. iroutes will later get a metric of 100. Signed-off-by: Antonio Quartulli Acked-By: Arne Schwabe --- src/openvpn/dco.h | 2 ++ src/openvpn/init.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h index dcadba78..063e5028 100644 --- a/src/openvpn/dco.h +++ b/src/openvpn/dco.h @@ -38,6 +38,8 @@ struct event_set; struct options; struct tuntap; +#define DCO_DEFAULT_METRIC 200 + #if defined(ENABLE_DCO) /** diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 638fd10c..f586bfc7 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1385,6 +1385,11 @@ do_init_route_list(const struct options *options, int dev = dev_type_enum(options->dev, options->dev_type); int metric = 0; + if (dco_enabled(options)) + { + metric = DCO_DEFAULT_METRIC; + } + if (dev == DEV_TYPE_TUN && (options->topology == TOP_NET30 || options->topology == TOP_P2P)) { gw = options->ifconfig_remote_netmask; @@ -1421,6 +1426,11 @@ do_init_route_ipv6_list(const struct options *options, const char *gw = NULL; int metric = -1; /* no metric set */ + if (dco_enabled(options)) + { + metric = DCO_DEFAULT_METRIC; + } + gw = options->ifconfig_ipv6_remote; /* default GW = remote end */ if (options->route_ipv6_default_gateway) {