wok-current annotate ppp/stuff/pppnc-server @ rev 17257
Up: yad (0.27.0).
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Oct 21 16:31:29 2014 +0300 (2014-10-21) |
parents | |
children | 56c606af68bc |
rev | line source |
---|---|
pascal@15968 | 1 #!/bin/sh |
pascal@15968 | 2 |
pascal@15968 | 3 ppp="/usr/sbin/pppd local noauth nodetach" |
pascal@15968 | 4 port=1111 |
pascal@15968 | 5 ipupd=/etc/ppp/ip-up.d |
pascal@15968 | 6 |
pascal@15968 | 7 case "$0" in |
pascal@15968 | 8 *server) # Usage: pppnc-server [port] [localip:remoteip] |
pascal@15968 | 9 n=10.$(($$%256)).$(($$/256)) |
pascal@15968 | 10 exec $ppp ${2:-$n.1:$n.2} passive proxyarp pty "nc -lp ${1:-$port}" |
pascal@15968 | 11 esac |
pascal@15968 | 12 |
pascal@15968 | 13 [ -z "$1" ] && echo "Usage: $0 serverip [port] [routes]" && exit 1 |
pascal@15968 | 14 for i in $3 ; do |
pascal@15968 | 15 echo "route add -net $i dev \$1" |
pascal@15968 | 16 done > $ipupd/pppnc$$ |
pascal@15968 | 17 chmod +x $ipupd/pppnc$$ |
pascal@15968 | 18 $ppp noipdefault pty "nc $1 ${2:-$port}" ipparam pppnc$$ |
pascal@15968 | 19 rm -f $ipupd/pppnc$$ |