summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-06-28 03:24:27 +0000
committerRoy Marples <uberlord@gentoo.org>2007-06-28 03:24:27 +0000
commit2ed2a1d7193cf92e78b168ffc41872bebac36508 (patch)
treeffb7216d8681252d0e89e84ac6e5bf710fb67f9f /net-misc/openvpn/files
parentwhitespace (diff)
downloadhistorical-2ed2a1d7193cf92e78b168ffc41872bebac36508.tar.gz
historical-2ed2a1d7193cf92e78b168ffc41872bebac36508.tar.bz2
historical-2ed2a1d7193cf92e78b168ffc41872bebac36508.zip
Misc fixes to up.sh
Package-Manager: portage-2.1.3_rc5
Diffstat (limited to 'net-misc/openvpn/files')
-rwxr-xr-xnet-misc/openvpn/files/up.sh29
1 files changed, 26 insertions, 3 deletions
diff --git a/net-misc/openvpn/files/up.sh b/net-misc/openvpn/files/up.sh
index e84088f0bfcf..da1a527cd8fa 100755
--- a/net-misc/openvpn/files/up.sh
+++ b/net-misc/openvpn/files/up.sh
@@ -11,22 +11,41 @@
# and will use the first one that responds - maybe the LAN ones?
# non resolvconf users just the the VPN resolv.conf
+# FIXME:- if we have >1 domain, then we have to use search :/
+# We need to add a flag to resolvconf to say
+# "these nameservers should only be used for the listed search domains
+# if other global nameservers are present on other interfaces"
+# This however, will break compatibility with Debians resolvconf
+# A possible workaround would be to just list multiple domain lines
+# and try and let resolvconf handle it
+
NS=
DOMAIN=
+SEARCH=
i=1
while true ; do
eval opt=\$foreign_option_${i}
[ -z "${opt}" ] && break
if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then
- DOMAIN="${DNS}domain ${opt#dhcp-option DOMAIN *}\n"
+ if [ -z "${DOMAIN}" ] ; then
+ DOMAIN="${opt#dhcp-option DOMAIN *}"
+ else
+ SEARCH="${SEARCH:+ }${opt#dhcp-option DOMAIN *}"
+ fi
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then
- NS="${DNS}nameserver ${opt#dhcp-option DNS *}\n"
+ NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
fi
i=$((${i} + 1))
done
if [ -n "${NS}" ] ; then
- DNS="# Generated by openvpn for interface ${dev}\n${DOMAIN}${NS}"
+ DNS="# Generated by openvpn for interface ${dev}\n"
+ if [ -n "${SEARCH}" ] ; then
+ DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
+ else
+ DNS="${DNS}domain ${DOMAIN}\n"
+ fi
+ DNS="${DNS}${NS}"
if [ -x /sbin/resolvconf ] ; then
printf "${DNS}" | /sbin/resolvconf -a "${dev}"
else
@@ -39,6 +58,10 @@ if [ -n "${NS}" ] ; then
fi
fi
+# Below section is Gentoo specific
+# Quick summary - our init scripts are re-entrant and set the SVCNAME env var
+# as we could have >1 openvpn service
+
# If we have a service specific script, run this now
if [ -x /etc/openvpn/"${SVCNAME}"-up.sh ] ; then
/etc/openvpn/"${SVCNAME}"-up.sh