Ticket #6852: openwrt-fix-pptp-route-and-domain-handling.patch

File openwrt-fix-pptp-route-and-domain-handling.patch, 954 bytes (added by abramm@…, 6 years ago)

pptp.sh patch

  • package/pptp/files/pptp.sh

     
    33} 
    44 
    55find_gw() { 
    6         route -n | awk '$1 == "0.0.0.0" { print $2; exit }' 
     6         
     7        ip r g $1 | grep $1 | awk '{print $3; exit}' 
    78} 
    89 
    910 
     
    1314         
    1415        config_get device "$config" device 
    1516        config_get ipproto "$config" ipproto 
    16         config_get server "$config" server 
     17        config_get server_domain "$config" server 
    1718 
    1819        for module in slhc ppp_generic ppp_async ip_gre; do 
    1920                /sbin/insmod $module 2>&- >&- 
     
    2122        sleep 1 
    2223 
    2324        setup_interface "$device" "$config" "${ipproto:-dhcp}" 
    24         local gw="$(find_gw)" 
     25         
     26        server=`ping $server_domain -c 1 -q 2&>1|grep PING|awk '{print $3}'|sed 's/(//;s/)//;s/://'` 
     27         
     28        local gw="$(find_gw $server)" 
    2529        [ -n "$gw" ] && { 
    2630                route delete "$server" 2>/dev/null >/dev/null 
    2731                route add "$server" gw "$gw"