Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Jul 6, 2011
1 parent
a1042f5
commit 8c458f8
Showing
9 changed files
with
99 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
echo `date` natoff >> /var/log/ppp0 | ||
|
||
# delete old configuration, if any | ||
#Flush all the rules in filter and nat tables | ||
iptables --flush | ||
iptables --table nat --flush | ||
|
||
# delete all chains that are not in default filter and nat table, if any | ||
iptables --delete-chain | ||
iptables --table nat --delete-chain | ||
|
||
echo 0 > /proc/sys/net/ipv4/ip_forward | ||
|
||
echo 0 > /sys/devices/platform/leds-gpio/leds/beagleboard::pmu_stat/brightness | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
#!/bin/bash | ||
|
||
echo `date` naton to ppp0 >> /var/log/ppp0 | ||
|
||
# delete old configuration, if any | ||
#Flush all the rules in filter and nat tables | ||
iptables --flush | ||
iptables --flush | ||
iptables --table nat --flush | ||
|
||
# delete all chains that are not in default filter and nat table, if any | ||
iptables --delete-chain | ||
iptables --delete-chain | ||
iptables --table nat --delete-chain | ||
|
||
# Set up IP FORWARDing and Masquerading (NAT) | ||
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE | ||
iptables --append FORWARD --in-interface eth1 -j ACCEPT | ||
iptables --append FORWARD --in-interface usb0 -j ACCEPT | ||
|
||
#forward some ports | ||
#iptables -A PREROUTING -t nat -i ppp0 -p tcp --dport 8080 -j DNAT --to 10.1.1.1:80 | ||
#iptables -A INPUT -p tcp -m state --state NEW --dport 80 -i ppp0 -j ACCEPT | ||
#iptables -t nat -A PREROUTING -p tcp -i usb0 -d netbox.20hz.co.uk --dport 8080 -j DNAT --to 10.1.1.1:22 | ||
#iptables -A INPUT -p tcp -m state --state NEW --dport 22 -i usb0 -j ACCEPT | ||
iptables -t nat -A PREROUTING -p tcp -i ppp0 -d netbox.hopto.org --dport 8080 -j DNAT --to 10.1.1.1:80 | ||
iptables -A FORWARD -p tcp -i ppp0 -o usb0 -d 10.1.1.1 --dport 80 -m state --state NEW -j ACCEPT | ||
|
||
#DROP | ||
iptables -I FORWARD -d swscan.apple.com -j DROP | ||
iptables -I FORWARD -d swquery.apple.com -j DROP | ||
|
||
#enable IP forwarding | ||
echo 1 > /proc/sys/net/ipv4/ip_forward | ||
service bind9 start | ||
|
||
echo 1 > /sys/devices/platform/leds-gpio/leds/beagleboard::pmu_stat/brightness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#! /bin/sh | ||
|
||
/usr/bin/poff | ||
echo `date` umtsoff >> /var/log/ppp0 | ||
|
||
/usr/bin/poff -a | ||
killall pppd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
#! /bin/sh | ||
|
||
if [ "${ACTION}" = "add" ] | ||
then | ||
echo ${DEVICE} >> /var/log/umts.log | ||
if [ -f /tmp/umtson.lock ] ; then | ||
# the lock file already exists, so what to do? | ||
if [ "$(ps -p `cat /tmp/umtson.lock` | wc -l)" -gt 1 ]; then | ||
# process is still running | ||
echo "$0: quit at start: lingering process `cat /tmp/umtson.lock`" | ||
exit 0 | ||
else | ||
# process not running, but lock file not deleted? | ||
echo " $0: orphan lock file warning. Lock file deleted." | ||
rm /tmp/umtson.lock | ||
fi | ||
fi | ||
|
||
echo $$ > /tmp/umtson.lock | ||
|
||
DEV=$1 | ||
|
||
if [ -z "$1" ] ; then | ||
DEV="/dev/ttyUSB0" | ||
DEV="/dev/ttyUSB2" | ||
fi | ||
|
||
echo `date` umtson with port $DEV >> /var/log/ppp0 | ||
|
||
set -e | ||
|
||
#killall pppd | ||
|
||
sleep 10 | ||
/usr/sbin/pppd $DEV call three | ||
naton | ||
|
||
fi | ||
#fi | ||
|
||
rm /tmp/umtson.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/dev/ttyUSB0 | ||
# /dev/ttyUSB2 | ||
460800 | ||
persist | ||
lock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
ACTION=="add", SUBSYSTEM=="tty", KERNEL=="ttyUSB0", RUN+="/usr/local/bin/umtson" | ||
ACTION=="add", SUBSYSTEM=="usb", PRODUCT=="19d2/31/0", RUN+="/usr/local/bin/umtson /dev/ttyUSB2" | ||
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1506", RUN+="/usr/local/bin/umtson /dev/ttyUSB0" | ||
|
||
ACTION=="remove", SUBSYSTEM=="usb", PRODUCT=="19d2/31/0", RUN+="/usr/local/bin/umtsoff" | ||
ACTION=="remove", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1506", RUN+="/usr/local/bin/umtsoff" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="12d1", SYSFS{idProduct}=="1446", RUN+="/usr/sbin/usb_modeswitch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
cp /etc/udev/rules.d/91-hsdpa-modem.rules rules.d/ | ||
cp /etc/udev/rules.d/92-usb-modem.rules rules.d/ | ||
cp /etc/ppp/peers/three peers/ | ||
cp /etc/ppp/peers/three peers/ | ||
cp /etc/chatscripts/three chatscripts/ | ||
cp /usr/local/bin/umtson bin/ | ||
cp /usr/local/bin/umtsoff bin/ | ||
cp /usr/local/bin/naton bin/ | ||
cp /usr/local/bin/natoff bin/ | ||
cp /etc/usb_modeswitch.d/12d1\:1446 usb_modeswitch.d/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
EnableLogging=1 | ||
|
||
DefaultVendor= 0x12d1 | ||
DefaultProduct=0x1446 | ||
|
||
TargetVendor= 0x12d1 | ||
TargetProductList="1001,1406,140b,140c,1412,141b,14ac,1506" | ||
|
||
CheckSuccess=20 | ||
|
||
MessageContent="55534243123456780000000000000011062000000100000000000000000000" |