diff options
author | Dirkjan Ochtman <djc@gentoo.org> | 2013-02-09 20:29:00 +0000 |
---|---|---|
committer | Dirkjan Ochtman <djc@gentoo.org> | 2013-02-09 20:29:00 +0000 |
commit | 3fbb55870b4fb80dcfe685cae4c29bb41b72eb27 (patch) | |
tree | 5fb47eb5ec210a8014336beb1f2a057b6fdcca05 /net-misc/openvpn | |
parent | Version bump mercurial to 2.5.1. (diff) | |
download | gentoo-2-3fbb55870b4fb80dcfe685cae4c29bb41b72eb27.tar.gz gentoo-2-3fbb55870b4fb80dcfe685cae4c29bb41b72eb27.tar.bz2 gentoo-2-3fbb55870b4fb80dcfe685cae4c29bb41b72eb27.zip |
Add metric to openresolv if possible (thanks Alon Bar-Lev, bug 391175).
(Portage version: 2.1.11.50/cvs/Linux x86_64, signed Manifest commit with key 6B065BFB)
Diffstat (limited to 'net-misc/openvpn')
-rw-r--r-- | net-misc/openvpn/ChangeLog | 5 | ||||
-rwxr-xr-x | net-misc/openvpn/files/up.sh | 20 |
2 files changed, 23 insertions, 2 deletions
diff --git a/net-misc/openvpn/ChangeLog b/net-misc/openvpn/ChangeLog index 78bbe459bcfe..0d28b2c06863 100644 --- a/net-misc/openvpn/ChangeLog +++ b/net-misc/openvpn/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for net-misc/openvpn # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/ChangeLog,v 1.245 2013/01/25 08:52:26 xarthisius Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/openvpn/ChangeLog,v 1.246 2013/02/09 20:29:00 djc Exp $ + + 09 Feb 2013; Dirkjan Ochtman <djc@gentoo.org> files/up.sh: + Add metric to openresolv if possible (thanks Alon Bar-Lev, bug 391175). 25 Jan 2013; Kacper Kowalik <xarthisius@gentoo.org> +files/openvpn.service, +files/openvpn.tmpfile, openvpn-2.3.0.ebuild: diff --git a/net-misc/openvpn/files/up.sh b/net-misc/openvpn/files/up.sh index 4a8868702de5..6ce82d6113cd 100755 --- a/net-misc/openvpn/files/up.sh +++ b/net-misc/openvpn/files/up.sh @@ -19,6 +19,23 @@ # A possible workaround would be to just list multiple domain lines # and try and let resolvconf handle it +min_route() { + local n=1 + local m + local r + + eval m="\$route_metric_$n" + while [ -n "${m}" ]; do + if [ -z "$r" ] || [ "$r" -gt "$m" ]; then + r="$m" + fi + n="$(($n+1))" + eval m="\$route_metric_$n" + done + + echo "$r" +} + if [ "${PEER_DNS}" != "no" ]; then NS= DOMAIN= @@ -48,7 +65,8 @@ if [ "${PEER_DNS}" != "no" ]; then fi DNS="${DNS}${NS}" if [ -x /sbin/resolvconf ] ; then - printf "${DNS}" | /sbin/resolvconf -a "${dev}" + metric="$(min_route)" + printf "${DNS}" | /sbin/resolvconf -a "${dev}" ${metric:+-m ${metric}} else # Preserve the existing resolv.conf if [ -e /etc/resolv.conf ] ; then |