wok-next rev 15968
ppp: add pppnc
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Feb 24 21:03:12 2014 +0000 (2014-02-24) |
parents | b9ec43882bea |
children | fd812ac90452 |
files | ppp/receipt ppp/stuff/pppnc-server |
line diff
1.1 --- a/ppp/receipt Mon Feb 24 17:36:28 2014 +0100 1.2 +++ b/ppp/receipt Mon Feb 24 21:03:12 2014 +0000 1.3 @@ -43,6 +43,8 @@ 1.4 mkdir -p $fs/usr 1.5 cp -a $install/usr/sbin $fs/usr 1.6 cp -a $install/usr/lib $fs/usr 1.7 + cp -a $stuff/pppnc-server $fs/usr/sbin 1.8 + ln $fs/usr/sbin/pppnc-server $fs/usr/sbin/pppnc-client 1.9 # Config files. 1.10 mkdir -p $fs/etc/ppp/scripts $fs/etc/ppp/ip-up.d $fs/etc/ppp/ip-down.d 1.11 cp $stuff/README.scripts $fs/etc/ppp
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/ppp/stuff/pppnc-server Mon Feb 24 21:03:12 2014 +0000 2.3 @@ -0,0 +1,19 @@ 2.4 +#!/bin/sh 2.5 + 2.6 +ppp="/usr/sbin/pppd local noauth nodetach" 2.7 +port=1111 2.8 +ipupd=/etc/ppp/ip-up.d 2.9 + 2.10 +case "$0" in 2.11 +*server) # Usage: pppnc-server [port] [localip:remoteip] 2.12 + n=10.$(($$%256)).$(($$/256)) 2.13 + exec $ppp ${2:-$n.1:$n.2} passive proxyarp pty "nc -lp ${1:-$port}" 2.14 +esac 2.15 + 2.16 +[ -z "$1" ] && echo "Usage: $0 serverip [port] [routes]" && exit 1 2.17 +for i in $3 ; do 2.18 + echo "route add -net $i dev \$1" 2.19 +done > $ipupd/pppnc$$ 2.20 +chmod +x $ipupd/pppnc$$ 2.21 +$ppp noipdefault pty "nc $1 ${2:-$port}" ipparam pppnc$$ 2.22 +rm -f $ipupd/pppnc$$