jablonka.czprosek.czf

sedlo

Subversion Repositories:
[/] [trunk/] [sedlo] - Diff between revs 14 and 15

Show entire file Ignore whitespace

Rev 14 Rev 15
Line 1... Line 1...
#!/bin/bash #!/bin/bash
# author : Petr Simandl www.simandl.cz # author : Petr Simandl www.simandl.cz
# release date : 20/10/2006 # release date : 1/11/2006
# name : sedlo # name : sedlo
# description : dynamic side routing tables tool # description : dynamic side routing tables tool
# license : GPL # license : GPL
   
sl_version="0.0.4pre5" sl_version="0.0.4pre6"
   
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 143... Line 143...
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_igwtype=`echo $sl_igw | $sl_awkcmd -F '*' '{print $3}'` sl_igwtype=`echo $sl_igw | $sl_awkcmd -F '*' '{print $3}'`
   
#oprava falesneho routovani na lokalni iface - pokud jsme lokalni igw tak se nema najit ip #oprava falesneho routovani na lokalni iface - pokud jsme lokalni igw tak se nema najit ip
#protoze cesta dal neni - jsme totiz uz na lokalnim iface #protoze cesta dal neni - jsme totiz uz na lokalnim iface
sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -v "proto kernel" | $sl_grepcmd "^$sl_igwip " | $sl_awkcmd '{print $3}'` #head je tam proto ze se pro prespolni(a bgp) muze objevit vice rout s ruznou metrikou tak vezmem jen prvni (head)
  #s nejmensi metrikou (sort)
  sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -v "proto kernel" | $sl_grepcmd "^$sl_igwip " | sort | $sl_awkcmd '{print $3}' | head -n 1`
   
# equal cost multipath detection - just first IP is taken as way to igw # equal cost multipath detection - just first IP is taken as way to igw
if [ "$sl_igwgt x" = "zebra x" ] if [ "$sl_igwgt x" = "zebra x" ]
then then
sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -A 1 "^$sl_igwip " | $sl_grepcmd "nexthop" | $sl_awkcmd '{print $3}'` sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -A 1 "^$sl_igwip " | $sl_grepcmd "nexthop" | $sl_awkcmd '{print $3}'`
Line 205... Line 208...
if [ "$sl_igwogt x" = "$sl_igwgt x" ] if [ "$sl_igwogt x" = "$sl_igwgt x" ]
then then
if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will not be changed and default is $sl_igwgt" ; fi if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will not be changed and default is $sl_igwgt" ; fi
else else
#the new default is different so we will flush the table, fill new default #the new default is different so we will flush the table, fill new default
if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will be $sl_igwogt rewritten to default $sl_igwgt" ; fi if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will be rewritten to default $sl_igwgt" ; fi
#flushing old default route in the table #flushing old default route in the table
$sl_ipcmd ro fl ta $sl_igwn $sl_ipcmd ro fl ta $sl_igwn
#filling new default #filling new default
$sl_ipcmd ro add 0.0.0.0/1 via $sl_igwgt ta $sl_igwn $sl_ipcmd ro add 0.0.0.0/1 via $sl_igwgt ta $sl_igwn
$sl_ipcmd ro add 128.0.0.0/1 via $sl_igwgt ta $sl_igwn $sl_ipcmd ro add 128.0.0.0/1 via $sl_igwgt ta $sl_igwn
Line 451... Line 454...
s_getcfg s_getcfg
fi fi
   
s_mktables s_mktables
s_filltables s_filltables
  #toto je pro ladici ucely
#echo $sl_difftbl #echo $sl_difftbl
#echo $sl_diffcfg #echo $sl_diffcfg
#echo $sl_diffigw #echo $sl_diffigw
#echo $scm_force #echo $scm_force
#exit 0 #exit 0
   
#flushing and filling rules is done only when #flushing and filling rules is done only when
#new table is created #new table is created
#config is changed #config is changed
#some igw dissapears or appears #some igw dissapears or appears
#-force command line parameter was used #-force command line parameter was used

Powered by WebSVN 2.2.1