summaryrefslogtreecommitdiff
path: root/package/ppp/files
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-05-07 01:22:48 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-05-07 01:22:48 +0000
commiteb51e36a780349e5c14b1c8aa91d3c5772e197e9 (patch)
tree947f40d8f515b2be981ca777196c5ee408f6ef95 /package/ppp/files
parentbe41fdd01aba63b91c0a644ed33229c5b1f74037 (diff)
downloadmtk-20170518-eb51e36a780349e5c14b1c8aa91d3c5772e197e9.zip
mtk-20170518-eb51e36a780349e5c14b1c8aa91d3c5772e197e9.tar.gz
mtk-20170518-eb51e36a780349e5c14b1c8aa91d3c5772e197e9.tar.bz2
ppp: - don't let pppd control resolv.conf.auto because it will wipe foreign dns entries - handle dns setup in ip-up handler - use add_dns() and remove_dns() to only add/remove dns entries related to the corresponding pppd instance - make pppd shutdown work for interfaces without ifname option, e.g. pptp
SVN-Revision: 21392
Diffstat (limited to 'package/ppp/files')
-rwxr-xr-xpackage/ppp/files/etc/ppp/ip-up6
-rw-r--r--package/ppp/files/ppp.sh18
2 files changed, 10 insertions, 14 deletions
diff --git a/package/ppp/files/etc/ppp/ip-up b/package/ppp/files/etc/ppp/ip-up
index 4b44b25..3895929 100755
--- a/package/ppp/files/etc/ppp/ip-up
+++ b/package/ppp/files/etc/ppp/ip-up
@@ -1,5 +1,8 @@
#!/bin/sh
+
. /etc/functions.sh
+. /lib/network/config.sh
+
PPP_IFACE="$1"
PPP_TTY="$2"
PPP_SPEED="$3"
@@ -14,8 +17,9 @@ export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
uci_set_state network "$PPP_IPPARAM" gateway "$PPP_REMOTE"
local dns="$DNS1${DNS2:+ $DNS2}"
- [ -n "$dns" ] && uci_set_state network "$PPP_IPPARAM" dns "$dns"
+ [ -n "$dns" ] && add_dns "$PPP_IPPARAM" $dns
}
+
[ -z "$PPP_IPPARAM" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
[ -d /etc/ppp/ip-up.d ] && {
diff --git a/package/ppp/files/ppp.sh b/package/ppp/files/ppp.sh
index 42daef9..53cfb1b 100644
--- a/package/ppp/files/ppp.sh
+++ b/package/ppp/files/ppp.sh
@@ -4,10 +4,7 @@ stop_interface_ppp() {
local proto
config_get proto "$cfg" proto
- local ifname
- config_get ifname "$cfg" ifname
-
- local link="$proto-${ifname#$proto-}"
+ local link="$proto-$cfg"
[ -f "/var/run/ppp-${link}.pid" ] && {
local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
local try=0
@@ -18,6 +15,8 @@ stop_interface_ppp() {
rm -f "/var/run/ppp-${link}.pid"
}
+ remove_dns "$cfg"
+
local lock="/var/lock/ppp-$link"
[ -f "$lock" ] && lock -u "$lock"
}
@@ -85,17 +84,11 @@ start_pppd() {
local peerdns
config_get_bool peerdns "$cfg" peerdns $peer_default
- if [ "$peerdns" -eq 1 ] || [ ! -e /tmp/resolv.conf.auto ]; then
- echo -n "" > /tmp/resolv.conf.auto
- fi
-
[ "$peerdns" -eq 1 ] && {
peerdns="usepeerdns"
} || {
peerdns=""
- for dns in $dns; do
- echo "nameserver $dns" >> /tmp/resolv.conf.auto
- done
+ add_dns "$cfg" $dns
}
local demand
@@ -104,8 +97,7 @@ start_pppd() {
local demandargs
[ "$demand" -eq 1 ] && {
demandargs="precompiled-active-filter /etc/ppp/filter demand idle"
- [ "$has_dns" -eq 0 ] && \
- echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto
+ [ "$has_dns" -eq 0 ] && add_dns "$cfg" 1.1.1.1
} || {
demandargs="persist"
}