fix ifname in network state for pppoe and pptp, add a workaround for isps sending...
[openwrt.git] / package / pptp / files / pptp.sh
1 scan_pptp() {
2         scan_ppp "$@"
3 }
4
5 setup_interface_pptp() {
6         local config="$2"
7         local ifname
8         
9         config_get device "$config" device
10         config_get ipproto "$config" ipproto
11
12         for module in slhc ppp_generic ppp_async ip_gre; do
13                 /sbin/insmod $module 2>&- >&-
14         done
15         sleep 1
16
17         setup_interface "$device" "$config" "${ipproto:-dhcp}"
18
19         # fix up the netmask
20         config_get netmask "$config" netmask
21         [ -z "$netmask" -o -z "$device" ] || ifconfig $device netmask $netmask
22
23         # make sure the network state references the correct ifname
24         scan_ppp "$config"
25         config_get ifname "$config" ifname
26         uci set "/var/state/network.$config.ifname=$ifname"
27
28         config_get mtu "$cfg" mtu
29         config_get server "$cfg" server
30         mtu=${mtu:-1452}
31         start_pppd "$config" \
32                 pty "/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd" \
33                 file /etc/ppp/options.pptp \
34                 mtu $mtu mru $mtu
35 }