From patchwork Wed Sep 23 02:58:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Seeger X-Patchwork-Id: 1471 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.27.255.51]) by backend30.mail.ord1d.rsapps.net with LMTP id 6PaBAwNHa19vUwAAIUCqbw (envelope-from ) for ; Wed, 23 Sep 2020 09:00:51 -0400 Received: from proxy6.mail.iad3a.rsapps.net ([172.27.255.51]) by director11.mail.ord1d.rsapps.net with LMTP id GIDYAgNHa1+VJQAAvGGmqA (envelope-from ) for ; Wed, 23 Sep 2020 09:00:51 -0400 Received: from smtp31.gate.iad3a ([172.27.255.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy6.mail.iad3a.rsapps.net with LMTPS id mCOfNgJHa18regAA8udqhg (envelope-from ) for ; Wed, 23 Sep 2020 09:00:50 -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: smtp31.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: cd205806-fd9c-11ea-af3c-5254003d9392-1-1 Received: from [216.105.38.7] ([216.105.38.7:49618] helo=lists.sourceforge.net) by smtp31.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 34/89-32532-1074B6F5; Wed, 23 Sep 2020 09:00:49 -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.90_1) (envelope-from ) id 1kL4N3-0006Qi-38; Wed, 23 Sep 2020 12:59:41 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL4Mz-0006QA-Sf for openvpn-devel@lists.sourceforge.net; Wed, 23 Sep 2020 12:59:40 +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=Wb6rigHdnllT5IfsbzTPBvhpSEzvmTwsH9ybf8kYdjE=; b=DngV6NOH8ey6OpEjTctULHUQ9J xbCe6T4ZYWIi0A390QdPmgzAD0NLT0rBjy+VIbk+WFOtHCnK5196ARKYs73D4t6Wot2KmSNAE1F2t 8TKriTZOk1XzAsGq3oftydxSXCGoK5oEI3VADuMjUJ6VomCHnfGICPPkIoWHwudPjX84=; 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=Wb6rigHdnllT5IfsbzTPBvhpSEzvmTwsH9ybf8kYdjE=; b=fIumGw+XG5eAgkANb+Xhx/DDXY Htmp8SXQVeoXaEgTeDDaRivNaQdvj+SbNfsfA26z22iKAz1qjo3h00Hek9/9Wq8VtQdwqJM2SC9AU XG1PKjoHflb/u43QtcOwVEbtFsgPzVUMDvS8EYrT181dinUIqhTYZQvl6WlJcuHqLJEA=; 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 1kL4Mj-004X7D-GH for openvpn-devel@lists.sourceforge.net; Wed, 23 Sep 2020 12:59:37 +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: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=Wb6rigHdnllT5IfsbzTPBvhpSEzvmTwsH9ybf8kYdjE=; b=GyzJBbqlJLeiPwYihFi1YB+NfV 1qAEYRExDsDx1oHJbwaFqIU/jrjDhrQjj6qxY7JFsYC5/XaeLfe2KWMPsaln25iQWU6gZfPXIBeYO +3BCv1Q8jrrYZbiY6gwPg2X2Gu5v40/ieaV7utTNWgiyFQLcRpDorlZkCCE01xhAuPkw=; Received: from [2001:16b8:a0a4:8100:dbe0:75de:1206:9b98] (helo=bean) by thenybble.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1kL4MU-0000KW-TU; Wed, 23 Sep 2020 14:59:07 +0200 Received: by bean (sSMTP sendmail emulation); Wed, 23 Sep 2020 14:59:07 +0200 From: Jan Seeger To: openvpn-devel@lists.sourceforge.net Date: Wed, 23 Sep 2020 14:58:40 +0200 Message-Id: <20200923125839.7519-2-jan.seeger@thenybble.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923125839.7519-1-jan.seeger@thenybble.de> References: <20200923111242.GH976@greenie.muc.de> <20200923125839.7519-1-jan.seeger@thenybble.de> 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 TIME_LIMIT_EXCEEDED Exceeded time limit / deadline X-Headers-End: 1kL4Mj-004X7D-GH 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 | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/man-sections/script-options.rst b/doc/man-sections/script-options.rst index a4df6732..0bf68c43 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` + ``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 bd6b968b..bab9b8e9 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); }