git://git.onelab.eu
/
planetlab-umts-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
abccf94
)
Add support for the Huawei e620 umts card
author
giovanni
<giovanni@41d37cc5-eb28-0410-a9bf-d37491348ade>
Wed, 8 Oct 2008 14:50:16 +0000
(14:50 +0000)
committer
giovanni
<giovanni@41d37cc5-eb28-0410-a9bf-d37491348ade>
Wed, 8 Oct 2008 14:50:16 +0000
(14:50 +0000)
backend.spec
patch
|
blob
|
history
backend/96-umts-tools.rules
patch
|
blob
|
history
backend/umts
patch
|
blob
|
history
backend/umts_backend
patch
|
blob
|
history
backend/umts_functions
patch
|
blob
|
history
frontend.spec
patch
|
blob
|
history
frontend/README.PI
patch
|
blob
|
history
frontend/README.User
patch
|
blob
|
history
diff --git
a/backend.spec
b/backend.spec
index
641e542
..
f08db13
100644
(file)
--- a/
backend.spec
+++ b/
backend.spec
@@
-2,7
+2,7
@@
%define name planetlab-umts-tools-backend
%define version 0.5
%define name planetlab-umts-tools-backend
%define version 0.5
-%define release
2
+%define release
3
Summary: Umts-tools for PlanetLab - backend part
Name: %{name}
Summary: Umts-tools for PlanetLab - backend part
Name: %{name}
@@
-41,9
+41,11
@@
popd
%post
/sbin/udevadm control reload_rules
%post
/sbin/udevadm control reload_rules
+/sbin/udevtrigger
+/bin/sleep 2
/sbin/chkconfig umts on
/sbin/chkconfig umts on
-/etc/rc.d/init.d/umts start
/sbin/service vsys restart
/sbin/service vsys restart
+/etc/rc.d/init.d/umts start
%preun
/sbin/chkconfig umts off
%preun
/sbin/chkconfig umts off
diff --git
a/backend/96-umts-tools.rules
b/backend/96-umts-tools.rules
index
6215812
..
3146fac
100644
(file)
--- a/
backend/96-umts-tools.rules
+++ b/
backend/96-umts-tools.rules
@@
-1,2
+1,2
@@
KERNEL=="noz0", NAME="umts_modem"
KERNEL=="noz0", NAME="umts_modem"
-
+KERNEL=="ttyUSB*", ATTR{dev}=="188:0", ATTRS{idProduct}=="1001", ATTRS{idVendor}=="12d1", NAME="umts_modem1"
diff --git
a/backend/umts
b/backend/umts
index
c52ce10
..
641b001
100755
(executable)
--- a/
backend/umts
+++ b/
backend/umts
@@
-9,7
+9,7
@@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
case "$1" in
start)
echo "Initializing the umts component..."
case "$1" in
start)
echo "Initializing the umts component..."
- if init
; then echo "Done."; fi
+ if init
_umts
; then echo "Done."; fi
;;
*)
;;
*)
diff --git
a/backend/umts_backend
b/backend/umts_backend
index
b695763
..
29f7a53
100755
(executable)
--- a/
backend/umts_backend
+++ b/
backend/umts_backend
@@
-1,6
+1,6
@@
#!/bin/bash
#!/bin/bash
-# Vsys backend
of the planetlab-umts-tools
+# Vsys backend
sliver=$1
sliver=$1
@@
-25,10
+25,7
@@
case "$command" in
logger "Starting the umts connection for $sliver"
start_umts $sliver;
logger "Starting the umts connection for $sliver"
start_umts $sliver;
- if [[ $? == 0 ]] ; then
- #echo "OK"
- true
- else
+ if [[ $? != 0 ]] ; then
echo "Failed"
fi
;;
echo "Failed"
fi
;;
@@
-37,17
+34,14
@@
case "$command" in
logger "Stopping umts connection for $sliver"
stop_umts $sliver;
logger "Stopping umts connection for $sliver"
stop_umts $sliver;
- if [[ $? == 0 ]] ; then
- #echo "OK"
- true
- else
+ if [[ $? != 0 ]] ; then
echo "Failed"
fi
;;
add)
echo "Failed"
fi
;;
add)
- logger "Request to add a destination
for the umts connection";
+ logger "Request to add a destination
by $sliver for the umts connection";
if ! valid_dotted_quad "$rest"; then
echo "Failed"
if ! valid_dotted_quad "$rest"; then
echo "Failed"
@@
-63,7
+57,7
@@
case "$command" in
;;
del)
;;
del)
- logger "Request to del a destination for the umts connection";
+ logger "Request to del a destination
by $sliver
for the umts connection";
if ! valid_dotted_quad "$rest"; then
echo "Failed"
if ! valid_dotted_quad "$rest"; then
echo "Failed"
diff --git
a/backend/umts_functions
b/backend/umts_functions
index
c97c321
..
1d87671
100644
(file)
--- a/
backend/umts_functions
+++ b/
backend/umts_functions
@@
-1,46
+1,35
@@
#!/bin/bash
#!/bin/bash
-PPPD_PIDFILE=/var/run/umts_pppd.pid
-
-PPPD=pppd
STROK="remote IP address"
STROK="remote IP address"
-
-PPP_INT=ppp0
-
GCOM=""
GCOM=""
-
LOGF="/tmp/umtslogs"
LOGF="/tmp/umtslogs"
-
+PPPD_PIDFILE="/var/run/umts_pppd.pid"
DESTS_FILE="/tmp/umts_dest_file"
DESTS_FILE="/tmp/umts_dest_file"
-
FILE_TEMP_NID="/tmp/umts_temp_nid"
FILE_TEMP_NID="/tmp/umts_temp_nid"
-
FILE_UMTS_INT="/tmp/umts_dev"
FILE_UMTS_INT="/tmp/umts_dev"
+PPP_INT=ppp0
+PPPD=pppd
function set_umts_dev(){
function set_umts_dev(){
- echo $1 > $FILE_UMTS_INT
+ local umts_dev=$1
+ echo $umts_dev > $FILE_UMTS_INT
}
function get_umts_dev(){
}
function get_umts_dev(){
- cat $FILE_UMTS_INT
+ if [ -e $FILE_UMTS_INT ]; then
+ cat $FILE_UMTS_INT
+ fi
}
}
-
-function start_gcom(){
- if ! $GCOM -d `get_umts_dev`; then
- return 1;
- fi
-
- return 0
+function unset_umts_dev(){
+ rm -f $FILE_UMTS_INT
}
}
-function init(){
- local found=1
- modprobe nozomi
- modprobe serial_cs
+function init_umts(){
+ local found=1
if [ -f /usr/bin/gcom ]; then
GCOM=/usr/bin/gcom
if [ -f /usr/bin/gcom ]; then
GCOM=/usr/bin/gcom
@@
-51,21
+40,25
@@
function init(){
return 1;
fi
return 1;
fi
+ unset_umts_dev
+
for i in /dev/umts_modem /dev/umts_modem1; do
echo "Testing if the umts interface is present on the device $i..."
for i in /dev/umts_modem /dev/umts_modem1; do
echo "Testing if the umts interface is present on the device $i..."
- if $GCOM -d $i; then
- found=0
- set_umts_dev $i
- break
+ if [ -e $i ]; then
+ if $GCOM -d $i; then
+ found=0
+ set_umts_dev $i
+ break
+ fi
fi
done
if ! [ $found == 0 ]; then
fi
done
if ! [ $found == 0 ]; then
- echo "I couldn't find the umts device
; make a symlink from it to /dev/umts_modem
"
+ echo "I couldn't find the umts device
. Make a symlink from it to /dev/umts_modem.
"
return 1
fi
return 1
fi
- if ! grep
umts_table
/etc/iproute2/rt_tables > /dev/null 2>&1; then
+ if ! grep
"umts_table"
/etc/iproute2/rt_tables > /dev/null 2>&1; then
echo "20 umts_table" >> /etc/iproute2/rt_tables
fi
echo "20 umts_table" >> /etc/iproute2/rt_tables
fi
@@
-82,11
+75,10
@@
function get_temp_nid(){
#called when the connection is started
function conn_on(){
local sliver=$1
#called when the connection is started
function conn_on(){
local sliver=$1
- #local sliver_nid=$2
#DESTS_FILE contains added destinations
rm -f $DESTS_FILE
#DESTS_FILE contains added destinations
rm -f $DESTS_FILE
- touch $DESTS_FILE
> /dev/null 2>&1
+ touch $DESTS_FILE
set_temp_nid $sliver_nid
set_temp_nid $sliver_nid
@@
-100,7
+92,6
@@
function conn_on(){
#called when the connection is terminated
function conn_off(){
local sliver=$1
#called when the connection is terminated
function conn_off(){
local sliver=$1
- #local sliver_nid=$2
unset_routes $sliver
unset_routes $sliver
@@
-121,8
+112,14
@@
function start_umts(){
return 0;
fi
return 0;
fi
- if ! [ -c `get_umts_dev` ]; then
- echo "Umts interface not present"
+ if [[ `get_umts_dev` == "" ]]; then
+ if [[ init_umts != 0 ]]; then
+ return 1
+ fi
+ fi
+
+ if ! [ -e `get_umts_dev` ]; then
+ echo "Umts interface is not present"
return 1
fi
return 1
fi
@@
-140,10
+137,8
@@
function start_umts(){
echo $! > $PPPD_PIDFILE
echo $! > $PPPD_PIDFILE
-
sleep 5s; #waiting for the interface to establish the link
if grep "$STROK" $LOGF >/dev/null 2>&1; then
sleep 5s; #waiting for the interface to establish the link
if grep "$STROK" $LOGF >/dev/null 2>&1; then
-
conn_on $sliver $sliver_nid
else
#second try
conn_on $sliver $sliver_nid
else
#second try
@@
-162,6
+157,7
@@
function start_umts(){
function stop_umts(){
local sliver=$1
function stop_umts(){
local sliver=$1
+ local sliver_nid=`get_nid $sliver`
if ! [ -e $PPPD_PIDFILE ]; then
echo "Disconnected"
if ! [ -e $PPPD_PIDFILE ]; then
echo "Disconnected"
@@
-171,10
+167,9
@@
function stop_umts(){
PID=`cat $PPPD_PIDFILE`;
if [ -d /proc/$PID ] && grep $PPPD /proc/$PID/cmdline >/dev/null 2>&1; then
PID=`cat $PPPD_PIDFILE`;
if [ -d /proc/$PID ] && grep $PPPD /proc/$PID/cmdline >/dev/null 2>&1; then
- #del_interface $1;
- conn_off $sliver `get_nid $sliver`
+ conn_off $sliver $sliver_nid
kill $PID;
kill $PID;
- sleep
5
;
+ sleep
4
;
fi
if status_umts; then
fi
if status_umts; then
@@
-223,16
+218,16
@@
function set_routes(){
local temp_nid=`get_temp_nid`
local ppp_addr=`get_ppp_address`
local temp_nid=`get_temp_nid`
local ppp_addr=`get_ppp_address`
- #remarking of packets
to trigger rerouting
and SNAT
+ #remarking of packets
, to trigger rerouting,
and SNAT
iptables -t mangle -A OUTPUT -j MARK --copy-xid 0x00
iptables -t mangle -A OUTPUT -m mark --mark $sliver_nid -j MARK --set-mark $temp_nid
iptables -t mangle -A OUTPUT -j MARK --copy-xid 0x00
iptables -t mangle -A OUTPUT -m mark --mark $sliver_nid -j MARK --set-mark $temp_nid
- iptables -t nat -A POSTROUTING -o $PPP_INT -j SNAT --to-source
`get_ppp_address`
+ iptables -t nat -A POSTROUTING -o $PPP_INT -j SNAT --to-source
$ppp_addr
iptables -t mangle -I POSTROUTING 1 -m mark --mark $temp_nid -j MARK --set-mark $sliver_nid
#enable the explicit bind to the ppp interface
ip route flush table umts_table >/dev/null 2>&1
iptables -t mangle -I POSTROUTING 1 -m mark --mark $temp_nid -j MARK --set-mark $sliver_nid
#enable the explicit bind to the ppp interface
ip route flush table umts_table >/dev/null 2>&1
- ip rule add from $ppp_addr fwmark
`get_temp_nid`
table umts_table >/dev/null 2>&1
- ip route add default dev $PPP_INT src
`get_ppp_address`
table umts_table >/dev/null 2>&1
+ ip rule add from $ppp_addr fwmark
$temp_nid
table umts_table >/dev/null 2>&1
+ ip route add default dev $PPP_INT src
$ppp_addr
table umts_table >/dev/null 2>&1
ip route flush cache >/dev/null 2>&1
}
ip route flush cache >/dev/null 2>&1
}
@@
-245,12
+240,12
@@
function unset_routes(){
#remarking and SNAT removed
iptables -t mangle -D OUTPUT -j MARK --copy-xid 0x00
iptables -t mangle -D OUTPUT -m mark --mark $sliver_nid -j MARK --set-mark $temp_nid
#remarking and SNAT removed
iptables -t mangle -D OUTPUT -j MARK --copy-xid 0x00
iptables -t mangle -D OUTPUT -m mark --mark $sliver_nid -j MARK --set-mark $temp_nid
- iptables -t nat -D POSTROUTING -o $PPP_INT -j SNAT --to-source
`get_ppp_address`
+ iptables -t nat -D POSTROUTING -o $PPP_INT -j SNAT --to-source
$ppp_addr
iptables -t mangle -D POSTROUTING -m mark --mark $temp_nid -j MARK --set-mark $sliver_nid
#disable the explicit bind to the ppp interface
iptables -t mangle -D POSTROUTING -m mark --mark $temp_nid -j MARK --set-mark $sliver_nid
#disable the explicit bind to the ppp interface
- ip rule del from $ppp_addr fwmark
`get_temp_nid`
table umts_table >/dev/null 2>&1
- ip route del default dev $PPP_INT src
`get_ppp_address`
table umts_table >/dev/null 2>&1
+ ip rule del from $ppp_addr fwmark
$temp_nid
table umts_table >/dev/null 2>&1
+ ip route del default dev $PPP_INT src
$ppp_addr
table umts_table >/dev/null 2>&1
ip route flush cache >/dev/null 2>&1
}
ip route flush cache >/dev/null 2>&1
}
@@
-258,9
+253,7
@@
function unset_routes(){
function add_destination(){
local dest="$1"
local sliver=$2
function add_destination(){
local dest="$1"
local sliver=$2
-
local sliver_nid=`get_nid $sliver`
local sliver_nid=`get_nid $sliver`
-
local temp_nid=`get_temp_nid`
if [[ ! $dest ]]; then return 1; fi
local temp_nid=`get_temp_nid`
if [[ ! $dest ]]; then return 1; fi
@@
-281,13
+274,10
@@
function add_destination(){
function del_destination(){
local dest="$1"
local sliver=$2
function del_destination(){
local dest="$1"
local sliver=$2
-
local sliver_nid=`get_nid $sliver`
local sliver_nid=`get_nid $sliver`
-
local temp_nid=`get_temp_nid`
if [[ ! $dest ]]; then return 1; fi
local temp_nid=`get_temp_nid`
if [[ ! $dest ]]; then return 1; fi
- #old - if ip route del to "$dest" dev $PPP_INT >/dev/null 2>&1; then
if ip rule del to "$dest" fwmark $temp_nid table umts_table >/dev/null 2>&1; then
return 0;
else
if ip rule del to "$dest" fwmark $temp_nid table umts_table >/dev/null 2>&1; then
return 0;
else
@@
-305,9
+295,7
@@
function set_temp_nid(){
local sliver_nid=$1
local temp_nid=$((0x20000+$sliver_nid))
local sliver_nid=$1
local temp_nid=$((0x20000+$sliver_nid))
- #k=0
- #temp_nid=$sliver_nid
-
+ #k=0
#while grep :$temp_nid: /etc/passwd; do
# temp_nid=$((temp_nid+1))
# k=$((k+1))
#while grep :$temp_nid: /etc/passwd; do
# temp_nid=$((temp_nid+1))
# k=$((k+1))
@@
-317,13
+305,12
@@
function set_temp_nid(){
# exit 1
# fi
#done
# exit 1
# fi
#done
-
echo $temp_nid > $FILE_TEMP_NID
}
echo $temp_nid > $FILE_TEMP_NID
}
-
+# checks ip addresses
function valid_dotted_quad(){
oldIFS=$IFS
IFS=.
function valid_dotted_quad(){
oldIFS=$IFS
IFS=.
diff --git
a/frontend.spec
b/frontend.spec
index
9c21c9e
..
882c555
100644
(file)
--- a/
frontend.spec
+++ b/
frontend.spec
@@
-2,7
+2,7
@@
%define name planetlab-umts-tools-frontend
%define version 0.5
%define name planetlab-umts-tools-frontend
%define version 0.5
-%define release
2
+%define release
3
Summary: UMTS tools for PlanetLab
Name: %{name}
Summary: UMTS tools for PlanetLab
Name: %{name}
diff --git
a/frontend/README.PI
b/frontend/README.PI
index
5fd0d90
..
614e715
100644
(file)
--- a/
frontend/README.PI
+++ b/
frontend/README.PI
@@
-23,7
+23,7
@@
add_to_nodegroup.py) that can be used to do this operation automatically.
========================================================================
SUPPORTED CARDS
========================================================================
SUPPORTED CARDS
-At present the Globetrotter 3G/HSDPA and
MERLIN U530 UMTS PCMCIA
are
-supported.
Every other card supported by the nozomi driver, or by the
-
serial_cs drivers, should work as
well.
+At present the Globetrotter 3G/HSDPA and
the Huawei e620
are
+supported.
Any other card supported by the nozomi driver should work as
+well.
diff --git
a/frontend/README.User
b/frontend/README.User
index
c3b30c4
..
cbbd2a6
100644
(file)
--- a/
frontend/README.User
+++ b/
frontend/README.User
@@
-52,13
+52,13
@@
The answer is either Connected or Disconnected.
To add a destination (packets directed towards this destination will go out
of the node through the ppp interface):
To add a destination (packets directed towards this destination will go out
of the node through the ppp interface):
- umts add
network_address/netmask
+ umts add
ip_destination
The answer is OK if everything went well.
To del a destination previously added:
The answer is OK if everything went well.
To del a destination previously added:
- umts del
network_address/netmask
+ umts del
ip_destination
The answer is OK if everything went well.
The answer is OK if everything went well.