1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-24 20:38:57 +02:00

[package] 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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21392 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2010-05-07 01:22:48 +00:00
parent 7f0eb037a2
commit b62840e4e7
3 changed files with 11 additions and 15 deletions

View File

@ -140,7 +140,7 @@ define Package/ppp/install
$(INSTALL_BIN) ./files/etc/ppp/ipv6-up $(1)/etc/ppp/ $(INSTALL_BIN) ./files/etc/ppp/ipv6-up $(1)/etc/ppp/
$(INSTALL_BIN) ./files/etc/ppp/ipv6-down $(1)/etc/ppp/ $(INSTALL_BIN) ./files/etc/ppp/ipv6-down $(1)/etc/ppp/
$(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/ $(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/
ln -sf /tmp/resolv.conf.auto $(1)/etc/ppp/resolv.conf ln -sf /tmp/resolv.conf.ppp $(1)/etc/ppp/resolv.conf
endef endef
define Package/ppp-mod-pppoa/install define Package/ppp-mod-pppoa/install

View File

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
. /etc/functions.sh . /etc/functions.sh
. /lib/network/config.sh
PPP_IFACE="$1" PPP_IFACE="$1"
PPP_TTY="$2" PPP_TTY="$2"
PPP_SPEED="$3" 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" uci_set_state network "$PPP_IPPARAM" gateway "$PPP_REMOTE"
local dns="$DNS1${DNS2:+ $DNS2}" 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" [ -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 ] && { [ -d /etc/ppp/ip-up.d ] && {

View File

@ -4,10 +4,7 @@ stop_interface_ppp() {
local proto local proto
config_get proto "$cfg" proto config_get proto "$cfg" proto
local ifname local link="$proto-$cfg"
config_get ifname "$cfg" ifname
local link="$proto-${ifname#$proto-}"
[ -f "/var/run/ppp-${link}.pid" ] && { [ -f "/var/run/ppp-${link}.pid" ] && {
local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)" local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
local try=0 local try=0
@ -18,6 +15,8 @@ stop_interface_ppp() {
rm -f "/var/run/ppp-${link}.pid" rm -f "/var/run/ppp-${link}.pid"
} }
remove_dns "$cfg"
local lock="/var/lock/ppp-$link" local lock="/var/lock/ppp-$link"
[ -f "$lock" ] && lock -u "$lock" [ -f "$lock" ] && lock -u "$lock"
} }
@ -85,17 +84,11 @@ start_pppd() {
local peerdns local peerdns
config_get_bool peerdns "$cfg" peerdns $peer_default 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" -eq 1 ] && {
peerdns="usepeerdns" peerdns="usepeerdns"
} || { } || {
peerdns="" peerdns=""
for dns in $dns; do add_dns "$cfg" $dns
echo "nameserver $dns" >> /tmp/resolv.conf.auto
done
} }
local demand local demand
@ -104,8 +97,7 @@ start_pppd() {
local demandargs local demandargs
[ "$demand" -eq 1 ] && { [ "$demand" -eq 1 ] && {
demandargs="precompiled-active-filter /etc/ppp/filter demand idle" demandargs="precompiled-active-filter /etc/ppp/filter demand idle"
[ "$has_dns" -eq 0 ] && \ [ "$has_dns" -eq 0 ] && add_dns "$cfg" 1.1.1.1
echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto
} || { } || {
demandargs="persist" demandargs="persist"
} }