From patchwork Tue Sep 29 20:48:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Seeger X-Patchwork-Id: 1485 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.27.255.51]) by backend30.mail.ord1d.rsapps.net with LMTP id wBH4OsMqdF+qZgAAIUCqbw (envelope-from ) for ; Wed, 30 Sep 2020 02:50:43 -0400 Received: from proxy2.mail.iad3a.rsapps.net ([172.27.255.51]) by director12.mail.ord1d.rsapps.net with LMTP id +M3lOsMqdF86CQAAIasKDg (envelope-from ) for ; Wed, 30 Sep 2020 02:50:43 -0400 Received: from smtp26.gate.iad3a ([172.27.255.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.iad3a.rsapps.net with LMTPS id sGiKNMMqdF/xRgAABcWvHw (envelope-from ) for ; Wed, 30 Sep 2020 02:50:43 -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: smtp26.gate.iad3a.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=thenybble.de; dmarc=none (p=nil; dis=none) header.from=thenybble.de X-Suspicious-Flag: YES X-Classification-ID: 4219cb78-02e9-11eb-93f2-52540063aac2-1-1 Received: from [216.105.38.7] ([216.105.38.7:51906] helo=lists.sourceforge.net) by smtp26.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id DF/71-30481-3CA247F5; Wed, 30 Sep 2020 02:50:43 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kNVvR-0002CM-Kf; Wed, 30 Sep 2020 06:49:17 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNVvP-0002Az-Jy for openvpn-devel@lists.sourceforge.net; Wed, 30 Sep 2020 06:49:16 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=QDOtIM6tOYOOA/8+++87yBrsTydgpsHe34azlJHt77I=; b=W79IUiYp81FM2J3nDhotr+QOP7 WGLBXrTOqG6jYcbzvF5rQsJcp04jizzsdMuCsDRcTmkaN8xeL1W0jH1riOaXEB0xKBcbbI0+7CQpW fZwpjPTeEQ9RKX631JDdhCnbJPxnlYTme08bVtIpvml/xZZo4U+IU1WorgNJIeDh81RE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=QDOtIM6tOYOOA/8+++87yBrsTydgpsHe34azlJHt77I=; b=c qLZZt7R2eXFIPY5J5t3GG0SiB9hQQ5+no/NgdtdgIPAbV6Zdju/lrn0yiOgLdCFNvtqY2Zt+rSucA vBgWExyPggXwXi6tjfLy2kiMmnuS9OjuESRf5kk1J0dMgtHE0ZIjRpsiQ/y97z74i50SUH/SaWJIu nxL/elxRx9em8rCk=; Received: from thenybble.de ([91.250.101.8]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kNVvE-00DzWc-Qf for openvpn-devel@lists.sourceforge.net; Wed, 30 Sep 2020 06:49:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thenybble.de; s=two; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=QDOtIM6tOYOOA/8+++87yBrsTydgpsHe34azlJHt77I=; b=rE2MyE+binxmE2sfjnKzOxak9W deX76+VPof7WTnigRFrinVzReV11AgvxLEFfEqiIPiqfD2Rb0AWK5A9+AVifG9pYXkzPMFf+chp5f fLaK6F7p6DBYyY/WrkL0XkF0394yNVOR6iBA30OK+NYLy1JsHqm3pPuH8Bsxuwk9n8oA=; Received: from [2001:16b8:a0ca:6b00:13a0:366d:955c:ca24] (helo=bean) by thenybble.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1kNVv2-0007vm-FG; Wed, 30 Sep 2020 08:48:53 +0200 Received: by bean (sSMTP sendmail emulation); Wed, 30 Sep 2020 08:48:53 +0200 From: Jan Seeger To: openvpn-devel@lists.sourceforge.net Date: Wed, 30 Sep 2020 08:48:45 +0200 Message-Id: <20200930064845.28022-1-jan.seeger@thenybble.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Helo-Check: bad, Forged Random Domain (thenybble.de) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.5 VA_HELO_CHECK Host Used Invalid or Forged HELO/EHLO -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches 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: 1kNVvE-00DzWc-Qf Subject: [Openvpn-devel] [PATCH] Added environment variable for IPv6 route metric. 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 --- doc/man-sections/script-options.rst | 8 ++++---- src/openvpn/route.c | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) Acked-by: Gert Doering diff --git a/doc/man-sections/script-options.rst b/doc/man-sections/script-options.rst index a4df6732..03b3dd77 100644 --- a/doc/man-sections/script-options.rst +++ b/doc/man-sections/script-options.rst @@ -709,10 +709,10 @@ instances. A set of variables which define each IPv6 route to be added, and are set prior to **--up** script execution. - ``parm`` will be one of :code:`network` or :code:`gateway` - (:code:`netmask` is contained as :code:`/nnn` in the - ``route_ipv6_network_{n}``, unlike IPv4 where it is passed in a - separate environment variable). + ``parm`` will be one of :code:`network`, :code:`gateway` or + :code:`metric`. ``route_ipv6_network_{n}`` contains :code:`netmask` + as :code:`/nnn`, unlike IPv4 where it is passed in a separate environment + variable. ``n`` is the OpenVPN route number, starting from 1. diff --git a/src/openvpn/route.c b/src/openvpn/route.c index d75aa5f4..30cdabba 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1479,6 +1479,13 @@ setenv_route_ipv6(struct env_set *es, const struct route_ipv6 *r6, int i) buf_printf( &name2, "route_ipv6_gateway_%d", i ); setenv_str( es, BSTR(&name2), print_in6_addr( r6->gateway, 0, &gc )); + + if (r6->flags & RT_METRIC_DEFINED) + { + struct buffer name3 = alloc_buf_gc( 256, &gc ); + buf_printf( &name3, "route_ipv6_metric_%d", i) ; + setenv_int( es, BSTR(&name3), r6->metric); + } } gc_free(&gc); }