[package] pptp: don't remove server route if the gateway is 0.0.0.0, this fixes a...
[openwrt.git] / package / pptp / files / pptp.sh
1 find_gw() {
2 route -n | awk '$1 == "0.0.0.0" { print $2; exit }'
3 }
4
5 stop_interface_pptp() {
6 stop_interface_ppp "$1"
7 }
8
9 coldplug_interface_pptp() {
10 setup_interface_pptp "pptp-$1" "$1"
11 }
12
13 setup_interface_pptp() {
14 local config="$2"
15 local ifname
16
17 config_get device "$config" device
18 config_get ipproto "$config" ipproto
19 config_get server "$config" server
20
21 for module in slhc ppp_generic ppp_async ip_gre; do
22 /sbin/insmod $module 2>&- >&-
23 done
24 sleep 1
25
26 setup_interface "$device" "$config" "${ipproto:-dhcp}"
27 local gw="$(find_gw)"
28 [ -n "$gw" ] && {
29 [ "$gw" != 0.0.0.0 ] && route delete "$server" 2>/dev/null >/dev/null
30 route add "$server" gw "$gw"
31 }
32
33 # fix up the netmask
34 config_get netmask "$config" netmask
35 [ -z "$netmask" -o -z "$device" ] || ifconfig $device netmask $netmask
36
37 config_get mtu "$config" mtu
38 mtu=${mtu:-1452}
39 start_pppd "$config" \
40 pty "/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd" \
41 file /etc/ppp/options.pptp \
42 mtu $mtu mru $mtu
43 }
This page took 0.047352 seconds and 5 git commands to generate.