jablonka.czprosek.czf

sedlo

Subversion Repositories:
[/] [trunk/] [sedlo] - Diff between revs 6 and 7

Show entire file Ignore whitespace

Rev 6 Rev 7
Line 3... Line 3...
# release date : 07/09/2004 # release date : 07/09/2004
# name : sedlo # name : sedlo
# description : dynamic side routing tables tool # description : dynamic side routing tables tool
# license : GPL # license : GPL
   
sl_version="0.0.3pre4" sl_version="0.0.3pre6"
   
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
   
sl_nmcnf="sedlo.conf" sl_nmcnf="sedlo.conf"
sl_sedlocnf="/etc/$sl_nmcnf" sl_sedlocnf="/etc/$sl_nmcnf"
Line 43... Line 43...
echo "$sl_rttab not found" echo "$sl_rttab not found"
exit 1 exit 1
fi fi
   
sl_murlcfg=`cat $sl_sedlocnf | grep "^mcnf" | uniq | awk '{print $2}'` sl_murlcfg=`cat $sl_sedlocnf | grep "^mcnf" | uniq | awk '{print $2}'`
sl_local_conf_myigw=`awk '/^myigw/ { print $2 "*" $3 "*" $4 }' < $sl_sedlocnf`  
   
###################################################################### ######################################################################
s_flqq() s_flqq()
{ {
if [ $scm_info -gt 0 ]; then echo "Managing rules" ; fi if [ $scm_info -gt 0 ]; then echo "Managing rules" ; fi
Line 83... Line 82...
   
if [ $scm_info -gt 0 ]; then echo "Creating rules" ; fi if [ $scm_info -gt 0 ]; then echo "Creating rules" ; fi
   
sl_ips=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd "^ip" | $sl_awkcmd '{print $2"*"$4"*"$5"*"$6}'` sl_ips=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd "^ip" | $sl_awkcmd '{print $2"*"$4"*"$5"*"$6}'`
   
this_router="THIS_ROUTER*$sl_local_conf_myigw" for sl_ip in $sl_ips
   
# $this_router format: THIS_ROUTER*igw1name*igw2name*igw3name  
   
for sl_ip in $this_router $sl_ips  
do do
sl_ipn=`echo $sl_ip | $sl_awkcmd -F '*' '{print $1}'` sl_ipn=`echo $sl_ip | $sl_awkcmd -F '*' '{print $1}'`
sl_ipgws=`echo $sl_ip | $sl_awkcmd -F '*' '{print $2,$3,$4}'` sl_ipgws=`echo $sl_ip | $sl_awkcmd -F '*' '{print $2,$3,$4}'`
sl_ok="no" sl_ok="no"
for sl_ipgw in $sl_ipgws for sl_ipgw in $sl_ipgws
do do
sl_tbl=`$sl_ipcmd ro ls ta $sl_ipgw` sl_tbl=`$sl_ipcmd ro ls ta $sl_ipgw`
if [ "$sl_tbl x" != " x" ] && [ "$sl_ok" = "no" ] if [ "$sl_tbl x" != " x" ] && [ "$sl_ok" = "no" ]
then then
if [ $scm_info -gt 1 ]; then echo "Creating new rules to send $sl_ipn to table $sl_ipgw" ; fi if [ $scm_info -gt 1 ]; then echo "Creating new rules to send $sl_ipn to table $sl_ipgw" ; fi
case "$sl_ipn" in $sl_ipcmd ru add from $sl_ipn lookup $sl_ipgw
"THIS_ROUTER")  
$sl_ipcmd ru add iif lo table $sl_ipgw ;;  
*)  
$sl_ipcmd ru add from $sl_ipn table $sl_ipgw ;;  
esac  
sl_ok="yes" sl_ok="yes"
else else
if [ "$sl_ok" = "no" ] if [ "$sl_ok" = "no" ]
then then
if [ $scm_info -gt 1 ]; then echo "For $sl_ipn table $sl_ipgw not used because it is empty" ; fi if [ $scm_info -gt 1 ]; then echo "For $sl_ipn table $sl_ipgw not used because it is empty" ; fi
Line 131... Line 121...
for sl_igw in $sl_igws for sl_igw in $sl_igws
do do
sl_igwn=`echo $sl_igw | $sl_awkcmd -F '*' '{print $1}'` sl_igwn=`echo $sl_igw | $sl_awkcmd -F '*' '{print $1}'`
sl_igwip=`echo $sl_igw | $sl_awkcmd -F '*' '{print $2}'` sl_igwip=`echo $sl_igw | $sl_awkcmd -F '*' '{print $2}'`
sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd "^$sl_igwip " | $sl_awkcmd '{print $3}'` sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd "^$sl_igwip " | $sl_awkcmd '{print $3}'`
   
  # equal cost multipath detection - just first is taken
  if [ "$sl_igwgt x" = "zebra x" ]
  then
  sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -A 1 "^$sl_igwip " | $sl_grepcmd "nexthop" | $sl_awkcmd '{print $3}'`
  fi
   
if [ "$sl_igwgt x" = " x" ] if [ "$sl_igwgt x" = " x" ]
then then
if [ $scm_info -gt 1 ]; then echo "Route not found for igw $sl_igwn - leaving table as is" ; fi if [ $scm_info -gt 1 ]; then echo "Route not found for igw $sl_igwn - leaving table as is" ; fi
else else
sl_tbl=`$sl_ipcmd ro ls ta $sl_igwn` sl_tbl=`$sl_ipcmd ro ls ta $sl_igwn`
Line 304... Line 301...
exit 0 exit 0
fi fi
   
if [ $scm_flru -eq 1 ] if [ $scm_flru -eq 1 ]
then then
s_flqq s_flru
exit 0 exit 0
fi fi
   
if [ $scm_nogetcfg -eq 0 ] if [ $scm_nogetcfg -eq 0 ]
then then
Line 318... Line 315...
s_mktables s_mktables
s_filltables s_filltables
s_fillrules s_fillrules
   
exit 0 exit 0
   
   
   

Powered by WebSVN 2.2.1