Managing Communication | |
fi |
|
i=`expr $i + 1` |
|
read f1 f2 |
|
case “$f1” in |
|
address ) IPADDR=$f2 |
|
;; |
|
netmask ) NETMASK=$f2 |
|
;; |
|
broadcast ) BROADCAST=$f2 |
|
;; |
|
esac |
|
done |
|
break |
|
fi |
|
done < /etc/network/interfaces |
|
} |
|
# get the ip address of the specified interface |
|
mname= |
|
module_up() |
|
{ |
|
oIFS=$IFS |
|
IFS=‘ |
|
‘ |
|
FOUND=“no” |
|
for LINE in `lsmod` |
|
do |
|
TOK=`echo $LINE cut |
|
if [ “$TOK” = “$mname” ]; then |
|
FOUND=“yes”; |
|
break; |
|
fi |
|
done |
|
IFS=$oIFS |
|
if [ “$FOUND” = “no” ]; then |
|
modprobe $mname |
|
fi |
|
} |
|
start() |
|
{ |
|
ifcfg_vpn |
|
if [ ! \( |
|
mkdir /dev/net |
|
fi |
|
if [ ! \(
#create a device file if there is none mknod /dev/net/tun c 10 200
fi
#load modules “tun” and “bridge” mname=tun
module_up mname=bridge module_up
#create an ethernet bridge to connect tap devices, internal interface brctl addbr br0
brctl addif br0 $iface
#the bridge receives data from any port and forwards it to other ports.
i=`expr 0` while : do
#generate a tap0 interface on tun openvpn