From patchwork Thu Aug 20 03:49:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Seeger X-Patchwork-Id: 1397 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id qPkIMsF/Pl8cPwAAIUCqbw for ; Thu, 20 Aug 2020 09:50:57 -0400 Received: from proxy13.mail.iad3b.rsapps.net ([172.31.255.6]) by director12.mail.ord1d.rsapps.net with LMTP id 8AzvMcF/Pl9TdwAAIasKDg (envelope-from ) for ; Thu, 20 Aug 2020 09:50:57 -0400 Received: from smtp3.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy13.mail.iad3b.rsapps.net with LMTPS id GJ/OKcF/Pl+wZAAAvUvv+w (envelope-from ) for ; Thu, 20 Aug 2020 09:50:57 -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: smtp3.gate.iad3b.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: 291bd2d2-e2ec-11ea-b9f9-525400bb3479-1-1 Received: from [216.105.38.7] ([216.105.38.7:52966] helo=lists.sourceforge.net) by smtp3.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id B7/E3-13955-CBF7E3F5; Thu, 20 Aug 2020 09:50:52 -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 1k8kx8-0007e4-P8; Thu, 20 Aug 2020 13:50:02 +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 1k8kx7-0007dt-G7 for openvpn-devel@lists.sourceforge.net; Thu, 20 Aug 2020 13:50:01 +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=17e5x9gVaJjsihKl9JGMn6+iqarZIdv4wYt5FWTHcKY=; b=bHqD8C2ZIHh61L6kzyNpC3TfdL Bx2TZwGLWgFmembTPLfE1hLpW7+Fy8OiHrjT15YDwY16szUaiDpf0w75OX5pVb15EEO7R1CRVMaVB wDhnPMEskvw2NrR1lIjhUh29UkVds4JwABR4OFaFxObI0Y6+wKTBJwZOzoB6BB/iZckA=; 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=17e5x9gVaJjsihKl9JGMn6+iqarZIdv4wYt5FWTHcKY=; b=b DGvzffKfscHMY9KSlj9lzK9Dd/48RHZ7JHdr85Ruqpl97M0viOkF7pCtwnFO0wsgy97lECQTwId5W WL7H34M+Yj/hbfoltjiBLiiO53T6YNGbV+CJjNNgLQZxPMvmz3/xUDXcu4p+bhfrMf77HW/gB2iOG HT3pEgoBsGDF2Y5M=; Received: from thenybble.de ([91.250.101.8]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1k8kx5-00H5uz-H4 for openvpn-devel@lists.sourceforge.net; Thu, 20 Aug 2020 13:50:01 +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=17e5x9gVaJjsihKl9JGMn6+iqarZIdv4wYt5FWTHcKY=; b=nAQKZQ8AoburJJUJ5bwktkV7Nd xOUsDvlPAWc/eUkhDCbeXzr+3yb1Qy5SFTZViTyEdUCT/aq6XYARpZe6OqRsqKlsn0vFB7ml2gZ1Y 8/aINuitPZpYDwvEmoP2mKr5+VaD5yip/uF8xndwvMSVRMOwZQY+OIO04QZYZ4F8TSCg=; Received: from [2001:16b8:a0d2:6500:765b:44a4:1f48:94ec] (helo=bean) by thenybble.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1k8kwx-000683-4v; Thu, 20 Aug 2020 15:49:52 +0200 Received: by bean (sSMTP sendmail emulation); Thu, 20 Aug 2020 15:49:47 +0200 From: Jan Seeger To: openvpn-devel@lists.sourceforge.net Date: Thu, 20 Aug 2020 15:49:46 +0200 Message-Id: <20200820134946.10573-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: 1k8kx5-00H5uz-H4 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 | 4 ++-- src/openvpn/route.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/man-sections/script-options.rst b/doc/man-sections/script-options.rst index b4bbf52f..062646b2 100644 --- a/doc/man-sections/script-options.rst +++ b/doc/man-sections/script-options.rst @@ -710,10 +710,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` + ``parm`` will be one of :code:`network`, :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). + separate environment variable) or :code:`metric`. ``n`` is the OpenVPN route number, starting from 1. diff --git a/src/openvpn/route.c b/src/openvpn/route.c index f127a90a..7174f518 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1463,6 +1463,7 @@ setenv_route_ipv6(struct env_set *es, const struct route_ipv6 *r6, int i) struct buffer name1 = alloc_buf_gc( 256, &gc ); struct buffer val = alloc_buf_gc( 256, &gc ); struct buffer name2 = alloc_buf_gc( 256, &gc ); + struct buffer name3 = alloc_buf_gc( 256, &gc ); buf_printf( &name1, "route_ipv6_network_%d", i ); buf_printf( &val, "%s/%d", print_in6_addr( r6->network, 0, &gc ), @@ -1471,6 +1472,11 @@ 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) { + buf_printf( &name3, "route_ipv6_metric_%d", i) ; + setenv_int( es, BSTR(&name3), r6->metric); + } } gc_free(&gc); }