disable all kernel config options that are set to =m
[openwrt.git] / package / pptp / files / pptp.sh
1 scan_pptp() {
2 scan_ppp "$@"
3 }
4
5 find_gw() {
6 route -n | awk '$1 == "0.0.0.0" { print $2; exit }'
7 }
8
9
10 setup_interface_pptp() {
11 local config="$2"
12 local ifname
13
14 config_get device "$config" device
15 config_get ipproto "$config" ipproto
16 config_get server "$cfg" server
17
18 for module in slhc ppp_generic ppp_async ip_gre; do
19 /sbin/insmod $module 2>&- >&-
20 done
21 sleep 1
22
23 setup_interface "$device" "$config" "${ipproto:-dhcp}"
24 local gw="$(find_gw)"
25 [ -n "$gw" ] && {
26 route delete "$server" 2>/dev/null >/dev/null
27 route add "$server" gw "$gw"
28 }
29
30 # fix up the netmask
31 config_get netmask "$config" netmask
32 [ -z "$netmask" -o -z "$device" ] || ifconfig $device netmask $netmask
33
34 # make sure the network state references the correct ifname
35 scan_ppp "$config"
36 config_get ifname "$config" ifname
37 uci_set_state network "$config" ifname "$ifname"
38
39 config_get mtu "$cfg" mtu
40 mtu=${mtu:-1452}
41 start_pppd "$config" \
42 pty "/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd" \
43 file /etc/ppp/options.pptp \
44 mtu $mtu mru $mtu
45 }
This page took 0.061746 seconds and 5 git commands to generate.