When no DOMAIN is received from push/pull, do not add either domain or
search to the resolv.conf. Fix typo in comment resolv.con[f]. Only add
new line when using domain or search.
URL: https://github.com/OpenVPN/openvpn/pull/34
Acked-by: Steffan Karger <steffan@karger.me>
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1463736310-17846-1-git-send-email-samuli@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11682
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
... | ... |
@@ -50,9 +50,10 @@ nl=' |
50 | 50 |
# or |
51 | 51 |
# "dhcp-option DNS 10.10.10.10" (multiple allowed) |
52 | 52 |
|
53 |
-# each DNS option becomes a "nameserver" option in resolv.con |
|
53 |
+# each DNS option becomes a "nameserver" option in resolv.conf |
|
54 | 54 |
# if we get one DOMAIN, that becomes "domain" in resolv.conf |
55 | 55 |
# if we get multiple DOMAINS, those become "search" lines in resolv.conf |
56 |
+# if we get no DOMAINS, then don't use either domain or search. |
|
56 | 57 |
|
57 | 58 |
while true; do |
58 | 59 |
eval fopt=\$foreign_option_${i} |
... | ... |
@@ -78,13 +79,15 @@ while true; do |
78 | 78 |
i=$((i + 1)) |
79 | 79 |
done |
80 | 80 |
|
81 |
-ds=domain |
|
82 |
-if [ $ndoms -gt 1 ]; then |
|
83 |
- ds=search |
|
81 |
+ds="" |
|
82 |
+if [ $ndoms -eq 1 ]; then |
|
83 |
+ ds="${nl}domain" |
|
84 |
+elif [ $ndoms -gt 1 ]; then |
|
85 |
+ ds="${nl}search" |
|
84 | 86 |
fi |
85 | 87 |
|
86 | 88 |
# This is the complete file - "$domains" has a leading space already |
87 |
-out="# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${nl}${ds}${domains}" |
|
89 |
+out="# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${ds}${domains}" |
|
88 | 90 |
|
89 | 91 |
# use resolvconf if it's available |
90 | 92 |
if type resolvconf >/dev/null 2>&1; then |