Neue Version V963

git-svn-id: svn://svn.compuextreme.de/Viitor/V963/Viitor_iproute@5933 504e572c-2e33-0410-9681-be2bf7408885
This commit is contained in:
kueller 2011-01-03 10:48:06 +00:00
commit bf2c977d83
3 changed files with 169 additions and 0 deletions

96
etc/init.d/adrouting Normal file
View File

@ -0,0 +1,96 @@
#!/bin/sh
#
#Dieses script nutzt in verbindung mit dem iproute packet die
#advanced routing funktionalitaeten des Linux Kernels
#Entsprechende funktionalitaet muss in den kernel einkompiliert sein.
#
#(c) Rainmaker MultiMedia OHG
#
#$Author$
#$Date$
#$Revision$
#
#$Log$
#Revision 1.2 2003/04/19 07:47:37 kueller
#Restart funktion und defaultverhalten (usage ausgabe) eingebaut
#
#Revision 1.1.1.1 2002/06/20 15:05:07 hkueller
#Start Scripten für advanced kernel routing
#
#
source /etc/init.d/functions
#DEBUG=echo
case "$1" in
start)
if [ -f /etc/sysconfig/net/routetable ]; then
sed -e "/^#/d" /etc/sysconfig/net/routetable | \
sed -e "/^ *$/d" >/tmp/routetable
exec 3</tmp/routetable
read <&3 NETWORK DEVICE TABLE
while [ "$NETWORK" ]; do
echo -n "Adding routing for net $NETWORK over device $DEVICE to table $TABLE"
$DEBUG ip route add $NETWORK dev $DEVICE table $TABLE
evaluate_retval
read <&3 NETWORK DEVICE TABLE
done
exec 3>&-
rm /tmp/routetable
fi
if [ -f /etc/sysconfig/net/routerule ]; then
sed -e "/^#/d" /etc/sysconfig/net/routerule | \
sed -e "/^ *$/d" >/tmp/routerule
exec 3</tmp/routerule
read <&3 RULTYPE RULOPT RULDEST
while [ "$RULTYPE" ]; do
echo -n "Adding routing rule $ROUTETYPE $ROUTOPT with destination $RULDEST"
$DEBUG ip rule add $RULTYPE $RULOPT table $RULDEST
evaluate_retval
read <&3 RULTYPE RULOPT RULDEST
done
exec 3>&-
rm /tmp/routerule
fi
;;
stop)
if [ -f /etc/sysconfig/net/routerule ]; then
sed -e "/^#/d" /etc/sysconfig/net/routerule | \
sed -e "/^ *$/d" >/tmp/routerule
exec 3</tmp/routerule
read <&3 RULTYPE RULOPT RULDEST
while [ "$RULTYPE" ]; do
echo -n "deleting rule $RULTYPE $RULOPT from table $RULDEST"
$DEBUG ip rule del $RULTYPE $RULOPT table $RULDEST
evaluate_retval
read <&3 RULTYPE RULOPT RULDEST
done
exec 3>&-
rm /tmp/routerule
fi
if [ -f /etc/sysconfig/net/routetable ]; then
sed -e "/^#/d" /etc/sysconfig/net/routetable | \
sed -e "/^ *$/d" >/tmp/routetable
exec 3</tmp/routetable
read <&3 NETWORK DEVICE TABLE
while [ "$NETWORK" ]; do
echo -n "deleting routeentry for $NETWORK from table $TABLE"
$DEBUG ip route del $NETWORK dev $DEVICE table $TABLE
evaluate_retval
read <&3 NETWORK DEVICE TABLE
done
exec 3>&-
rm /tmp/routetable
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
;;
esac
#end /etc/inet.d/network

38
etc/init/adrouting.conf Normal file
View File

@ -0,0 +1,38 @@
description "Setup Routing depending on several config files"
author "Harald Kueller <harald.kueller@compuextreme.de>"
version 1.0
emits none special
start on stopped routing
console output
script
source /etc/init/functions
if [ -f /etc/sysconfig/net/routetable ]; then
sed -e "/^#/d" /etc/sysconfig/net/routetable | \
sed -e "/^ *$/d" >/tmp/routetable
exec 3</tmp/routetable
read <&3 NETWORK DEVICE TABLE
while [ "$NETWORK" ]; do
$DEBUG ip route add $NETWORK dev $DEVICE table $TABLE
status_message "Added routing for net $NETWORK over device $DEVICE to table $TABLE"
read <&3 NETWORK DEVICE TABLE
done
exec 3>&-
rm /tmp/routetable
fi
if [ -f /etc/sysconfig/net/routerule ]; then
sed -e "/^#/d" /etc/sysconfig/net/routerule | \
sed -e "/^ *$/d" >/tmp/routerule
exec 3</tmp/routerule
read <&3 RULTYPE RULOPT RULDEST
while [ "$RULTYPE" ]; do
$DEBUG ip rule add $RULTYPE $RULOPT table $RULDEST
status_message "Adding routing rule $ROUTETYPE $ROUTOPT whith destination $RULDEST"
read <&3 RULTYPE RULOPT RULDEST
done
exec 3>&-
rm /tmp/routerule
fi
end script

35
init/genpkg Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
#genpkg für iproute
#(c) Rainmaker MultiMedia OHG
#
#$Author$
#$Date$
#$Revision$
#
#$Log$
#Revision 1.1 2002/06/20 15:05:07 hkueller
#Initial revision
#
#
if [ -d /var/install/sysvinit* ]; then
WDIR=`pwd`
cd etc/init.d
for i in *; do
if [ -f $i ]; then
chmod 755 $i
fi
done
mkdir rc{0,1,2,3,4,5,6}.d
for i in 0 1 2 6; do
cd rc$i.d
ln -s ../adrouting K73adrouting
cd ..
done
for i in 3 4 5; do
cd rc$i.d
ln -s ../adrouting S14adrouting
cd ..
done
cd $WDIR
fi