jablonka.czprosek.czf

sedlo

Subversion Repositories:
[/] [trunk/] [sedlo] - Blame information for rev 17

 

Line No. Rev Author Line
17simandl#!/bin/bash
2# author : Petr Simandl www.simandl.cz
317simandl# release date : 23/04/2007
47simandl# name : sedlo
5# description : dynamic side routing tables tool
6# license : GPL
7 
817simandlsl_version="0.0.4pre8"
97simandl 
10PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
11 
12sl_nmcnf="sedlo.conf"
13sl_sedlocnf="/etc/$sl_nmcnf"
14sl_sedlocache="/var/cache/sedlo"
15 
16sl_rttab="/etc/iproute2/rt_tables"
17sl_rtnmin=110
18sl_rtnmax=200
1916simandl#all traffic that is handled as internal (CZF traffic)
207simandlsl_ipnodef="10.0.0.0/8"
2116simandl#this will specify rupriority in rule table
22sl_priorules=10000
23#no default traffic will have rule at higher priority
24sl_prionodef=$(($sl_priorules - 1))
257simandl 
26slm_unknown="Nezname parametry : "
27 
28sl_ipcmd=`which ip`
29sl_trcmd=`which tr`
30sl_wgetcmd=`which wget`
31sl_hnmcmd=`which hostname`
32sl_awkcmd=`which awk`
33sl_catcmd=`which cat`
34sl_grepcmd=`which grep`
3510simandlsl_diffcmd=`which diff`
367simandl 
37if [ -e $sl_sedlocnf ]
38 then
39 sl_nop=1
40 else
41 echo "$sl_sedlocnf not found"
42 exit 1
43fi
44 
45if [ -e $sl_rttab ]
46 then
47 sl_nop=1
48 else
49 echo "$sl_rttab not found"
50 exit 1
51fi
52 
539simandlsl_murlcfg=`cat $sl_sedlocnf | grep "^mcnf" | uniq | awk '{print $2" "$3" "$4}'`
547simandl 
55######################################################################
568simandls_maru()
577simandl{
58if [ $scm_info -gt 0 ]; then echo "Managing rules" ; fi
59 
60sl_rules=`($sl_ipcmd ru ls | $sl_grepcmd -v "from all lookup" | $sl_awkcmd '{print $3"*ru"}' ; \
61$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd "^ip" | $sl_awkcmd '{print $2"*ip"}') | sort | uniq`
62 
63sl_merged=`echo $sl_rules $sl_ips | sort | uniq`
64 
65echo $sl_merged
66 
678simandl} # s_maru
6816simandl 
697simandl######################################################################
7016simandl#this will delete all rules at sl_prionodef an sl_priorules priorities
71s_flruall()
72{
73if [ $scm_info -gt 0 ]; then echo "Flushing all rules" ; fi
74 
75sl_rules=`$sl_ipcmd ru ls | $sl_grepcmd "^"$sl_prionodef":" | $sl_trcmd '[:blank:]' '*'`
76for sl_rule in $sl_rules
77do
78 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
79 $sl_ipcmd ru del $sl_ipgws
80 #this should make faster applying of new routing tables
81 $sl_ipcmd ro flush cache
82done
83 
84sl_rules=`$sl_ipcmd ru ls | $sl_grepcmd "^"$sl_priorules":" | $sl_trcmd '[:blank:]' '*'`
85for sl_rule in $sl_rules
86do
87 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
88 $sl_ipcmd ru del $sl_ipgws
89 #this should make faster applying of new routing tables
90 $sl_ipcmd ro flush cache
91done
92 
93} # s_flruall
94 
95######################################################################
967simandls_flru()
97{
98if [ $scm_info -gt 0 ]; then echo "Flushing all rules" ; fi
99 
10016simandlsl_rules=`$sl_ipcmd ru ls | $sl_grepcmd ^$sl_priorules":" | $sl_trcmd '[:blank:]' '*'`
1017simandl 
102for sl_rule in $sl_rules
103do
104 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
105 $sl_ipcmd ru del $sl_ipgws
10616simandl #this should make faster applying of new routing tables
107 $sl_ipcmd ro flush cache
1087simandldone
109 
110} # s_flru
1118simandl 
1127simandl######################################################################
11316simandls_checknodefru()
114{
115#checking if we have present nodef rule and if not we create it
116sl_nodefrule=`$sl_ipcmd ru ls | $sl_grepcmd "^"$sl_prionodef":" | $sl_trcmd '[:blank:]' '*'`
117#echo $sl_nodefrule
118if [ "$sl_nodefrule x" == " x" ]
119 then
120 if [ $scm_info -gt 0 ]; then echo "Creating rule for nodef route" ; fi
121 $sl_ipcmd ru add from $sl_ipnodef to $sl_ipnodef lookup main prio $sl_prionodef
122 echo "delam novou"
123fi
124 
125}
126 
127######################################################################
12810simandl# here we get each ip and we create a rule to send this ip to a
129# certain table
130# this routine can be skipped when the number of ips and ip directions
131# are still the same = old and new configs are the same
1327simandls_fillrules()
133{
1348simandl 
13516simandl#this will check no default rule if exists and if not it will be created
136s_checknodefru
137 
1388simandl#flush old rules before filling new ones
139#not so nice solution - it is planned to change just what's necessary
140#by s_maru
14117simandl#s_flru
1427simandl 
14317simandlif [ $scm_info -gt 0 ]; then echo "Checking rules for ips" ; fi
1447simandl 
145sl_ips=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd "^ip" | $sl_awkcmd '{print $2"*"$4"*"$5"*"$6}'`
14617simandlsl_rules=`$sl_ipcmd ru ls | $sl_grepcmd ^$sl_priorules":" | $sl_trcmd '[:blank:]' '*'`
1477simandl 
14817simandl 
149 
150#for all IPs we check and leave, change or create rule
1517simandlfor sl_ip in $sl_ips
152do
153 sl_ipn=`echo $sl_ip | $sl_awkcmd -F '*' '{print $1}'`
154 sl_ipgws=`echo $sl_ip | $sl_awkcmd -F '*' '{print $2,$3,$4}'`
155 sl_ok="no"
15617simandl #for all GWs we check rules
1577simandl for sl_ipgw in $sl_ipgws
158 do
159 sl_tbl=`$sl_ipcmd ro ls ta $sl_ipgw`
16017simandl #check if table exists
1617simandl if [ "$sl_tbl x" != " x" ] && [ "$sl_ok" = "no" ]
162 then
16317simandl #we have IP and GW table
164 #check if the rule alredady exists
165 sl_oldrule=`echo $sl_rules | $sl_trcmd " " "\n" | $sl_grepcmd "\*"$sl_ipn"\*"`
166 sl_exactrule=`echo $sl_oldrule | $sl_trcmd " " "\n" | $sl_grepcmd "\*"$sl_ipgw"\*"`
167 if [ "$sl_exactrule x" == " x" ]
168 then
169 #exact rule doesn't exist so we check if an old rule for this IP is present
170 if [ "$sl_oldrule x" != " x" ]
171 then
172 #some old rule(s) for IP is present so we delete it
173 for sl_rule in $sl_oldrule
174 do
175 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
176 if [ $scm_info -gt 0 ]; then echo "Deleting old rule $sl_ipgws" ; fi
177 $sl_ipcmd ru del $sl_ipgws
178 #this should make faster applying of new routing tables
179 $sl_ipcmd ro flush cache
180 done
181 fi
182 
183 if [ $scm_info -gt 0 ]; then echo "Creating new rule to send $sl_ipn to table $sl_ipgw" ; fi
184 $sl_ipcmd ru add from $sl_ipn lookup $sl_ipgw prio $sl_priorules
185 
186 else
187 if [ $scm_info -gt 1 ]; then echo "Rule to send $sl_ipn to table $sl_ipgw already exists" ; fi
188 fi
1897simandl sl_ok="yes"
190 else
19117simandl #we have no table
1927simandl if [ "$sl_ok" = "no" ]
193 then
194 if [ $scm_info -gt 1 ]; then echo "For $sl_ipn table $sl_ipgw not used because it is empty" ; fi
195 else
19616simandl if [ $scm_info -gt 1 ]; then echo "For $sl_ipn table $sl_ipgw not used because it has lower priority" ; fi
1977simandl fi
198 fi
199 done
200done
201 
20217simandl#finally we check all rules and if there is a rule without IP from config we delete it
203for sl_rule in $sl_rules
204do
205 sl_iprule=`echo $sl_rule | $sl_awkcmd -F '*' '{print $3}'`
206 sl_ipconf=`echo $sl_ips | $sl_trcmd " " "\n" | $sl_grepcmd "^"$sl_iprule"\*"`
2077simandl 
20817simandl if [ "$sl_ipconf x" == " x" ]
209 then
210 #we have a rule without an IP in config so we delete this rule
211 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
212 if [ $scm_info -gt 0 ]; then echo "Deleting non config rule $sl_ipgws" ; fi
213 $sl_ipcmd ru del $sl_ipgws
214 #this should make faster applying of new routing tables
215 $sl_ipcmd ro flush cache
216 fi
217done
218 
2197simandl} # s_fillrules
2208simandl 
2217simandl######################################################################
22210simandl# here we look into the main routing table for path to our iGWs
223# and we fill these tables with two halves default nets that
224# point to appropriate direction
225# this routine can be skipped when the routing table is the same
2267simandls_filltables()
227{
22810simandlif [ $scm_info -gt 0 ]; then echo "Checking main routing table" ; fi
229 
2307simandlif [ $scm_info -gt 0 ]; then echo "Filling tables" ; fi
231 
2329simandlsl_igws=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd -E "^igw|^myigw" | $sl_awkcmd '{print $3"*"$2"*"$1}'`
2337simandl 
234for sl_igw in $sl_igws
235 do
236 sl_igwn=`echo $sl_igw | $sl_awkcmd -F '*' '{print $1}'`
237 sl_igwip=`echo $sl_igw | $sl_awkcmd -F '*' '{print $2}'`
2389simandl sl_igwtype=`echo $sl_igw | $sl_awkcmd -F '*' '{print $3}'`
23915simandl 
24014simandl#oprava falesneho routovani na lokalni iface - pokud jsme lokalni igw tak se nema najit ip
241#protoze cesta dal neni - jsme totiz uz na lokalnim iface
24215simandl#head je tam proto ze se pro prespolni(a bgp) muze objevit vice rout s ruznou metrikou tak vezmem jen prvni (head)
243#s nejmensi metrikou (sort)
244 sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -v "proto kernel" | $sl_grepcmd "^$sl_igwip " | sort | $sl_awkcmd '{print $3}' | head -n 1`
2457simandl 
2469simandl # equal cost multipath detection - just first IP is taken as way to igw
2477simandl if [ "$sl_igwgt x" = "zebra x" ]
248 then
249 sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -A 1 "^$sl_igwip " | $sl_grepcmd "nexthop" | $sl_awkcmd '{print $3}'`
250 fi
251 
2529simandl #if myigw then fill table for local gateway with single ip from config
253 if [ "$sl_igwtype x" = "myigw x" ]
254 then
255 sl_igwgt=$sl_igwip
256 fi
25711simandl #testing if the igw has not a route in global routing table
2587simandl if [ "$sl_igwgt x" = " x" ]
259 then
26011simandl if [ $scm_info -gt 1 ]; then echo "Route not found for igw $sl_igwn" ; fi
261 sl_myigw=`cat $sl_sedlocnf | $sl_grepcmd "^myigw" | $sl_grepcmd $sl_igwn | $sl_awkcmd '{print $3}'`
262 #testing if the igw without route is in local config
263 #if not we go to flush its table and set flag to redo rules
264 if [ "$sl_myigw x" = " x" ]
265 then
266 #getting num of routes of igw
26713simandl sl_igwnr=`$sl_ipcmd ro ls ta all | $sl_grepcmd -c "table ${sl_igwn} "`
26811simandl if [ "$sl_igwnr x" = "0 x" ]
269 then
27012simandl if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn is already empty - no action taken" ; fi
27111simandl else
27212simandl if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will be flushed and rules rearranged" ; fi
27311simandl $sl_ipcmd ro fl ta $sl_igwn
274 #because this igw dissapeared we set a flag for rules recreation
275 sl_diffigw=1
276 fi
277 else
27813simandl if [ $scm_info -gt 1 ]; then echo "Igw $sl_igwn found in local config - leaving table as is" ; fi
27911simandl fi
2807simandl else
281 sl_tbl=`$sl_ipcmd ro ls ta $sl_igwn`
28212simandl #if the table is empty we fill it and we set flag for rules recreation
283 if [ "$sl_tbl x" = " x" ]
2847simandl then
28512simandl sl_diffigw=1
286 $sl_ipcmd ro add 0.0.0.0/1 via $sl_igwgt ta $sl_igwn
287 $sl_ipcmd ro add 128.0.0.0/1 via $sl_igwgt ta $sl_igwn
288 if [ "$sl_igwtype x" = "myigw x" ]
289 then
290 if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn filled with default myigw $sl_igwgt" ; fi
291 else
292 if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn filled with default gw $sl_igwgt" ; fi
293 fi
294 #the table is not empty so we check if routes are the same
2959simandl else
29612simandl #picking default gateway from the table
297 sl_igwogt=`$sl_ipcmd ro ls ta $sl_igwn | $sl_awkcmd '{print $3}' | uniq`
298 #checking if the old default is same as the new one
299 if [ "$sl_igwogt x" = "$sl_igwgt x" ]
300 then
301 if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will not be changed and default is $sl_igwgt" ; fi
302 else
303 #the new default is different so we will flush the table, fill new default
30415simandl if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will be rewritten to default $sl_igwgt" ; fi
30512simandl #flushing old default route in the table
306 $sl_ipcmd ro fl ta $sl_igwn
307 #filling new default
308 $sl_ipcmd ro add 0.0.0.0/1 via $sl_igwgt ta $sl_igwn
309 $sl_ipcmd ro add 128.0.0.0/1 via $sl_igwgt ta $sl_igwn
310 fi
3119simandl fi
3127simandl fi
313 done
314 
315} # s_filltables
3168simandl 
3177simandl######################################################################
31810simandl# filling rttab with tables from config
319# only new tables are created with a new uniq number that is not important because
320# usually we handle tables just by their names
321# this routine acts only when a new iGW appears - only adding a table is supported
322# no deleting is implemented because it seems to be not necessary to delete an old table
323# because there is space enough and after reboot table will not be created
3247simandls_mktables()
325{
32610simandlif [ $scm_info -gt 0 ]; then echo "Checking tables" ; fi
327 
3289simandlsl_igws=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd -E "^igw|^myigw" | $sl_awkcmd '{print $3}'`
3297simandlfor sl_igw in $sl_igws
330 do
331 sl_igwrttb=`$sl_catcmd $sl_rttab | $sl_awkcmd '{print $2}' | $sl_grepcmd $sl_igw `
332 if [ "$sl_igwrttb x" = " x" ]
333 then
334 if [ $scm_info -gt 1 ]; then echo "Creating table for $sl_igw" ; fi
335 sl_cnt="$sl_rtnmax"
336 sl_ok="no"
337 until [ "$sl_cnt" -eq "$sl_rtnmin" ] || [ "$sl_ok" = "yes" ]
338 do
339 #space is used to recognized two and three digit numbers
340 sl_igwrttb=`cat $sl_rttab | awk '{print $1" "}' | grep "$sl_cnt " `
341 if [ "$sl_igwrttb x" = " x" ]
342 then
343 sl_ok="yes"
344 echo "$sl_cnt $sl_igw" >> $sl_rttab
345 fi
346 sl_cnt=$(($sl_cnt - 1 ))
34711simandl done
348 # a new table was created so we should set a flag for rules creation
349 sl_difftbl=1
3507simandl else
351 if [ $scm_info -gt 1 ]; then echo "Table found for $sl_igw no action taken" ; fi
352 fi
3539simandl done
3547simandl} # s_mktables
3558simandl 
3567simandl######################################################################
357s_getcfg()
358{
359if [ $scm_info -gt 0 ]; then echo "Getting config" ; fi
360if [ $scm_info -gt 1 ]; then echo "Using main config $sl_murlcfg" ; fi
361if [ $scm_info -gt 1 ]; then echo "Using local config $sl_sedlocnf" ; fi
362 
36310simandlrm -f "$sl_sedlocache/$sl_nmcnf.main.tmp"
3647simandl 
36510simandl$sl_wgetcmd -q -t 3 $sl_murlcfg -O "$sl_sedlocache/$sl_nmcnf.main.tmp"
366 
3677simandlif [ -s $sl_sedlocache/$sl_nmcnf.main.tmp ]
368 then
369 date > $sl_sedlocache/last_getcnf.txt
370 cp $sl_sedlocache/$sl_nmcnf.main.tmp $sl_sedlocache/$sl_nmcnf.main
37110simandl if [ $scm_info -gt 1 ]; then echo "Main config downloaded and accepted" ; fi
3727simandl else
3738simandl if [ $scm_info -gt 1 ]; then echo "Main config not downloaded - cached config will be used" ; fi
374 echo -n "Main config not downloaded " > $sl_sedlocache/last_getcnf.txt
3757simandl date >> $sl_sedlocache/last_getcnf.txt
376fi
377 
37810simandl# before generating a new cached config we store the old one for
379# comparison with the new one
380rm -f "$sl_sedlocache/$sl_nmcnf.old"
381if [ -s $sl_sedlocache/$sl_nmcnf ]
382 then
383 cp $sl_sedlocache/$sl_nmcnf $sl_sedlocache/$sl_nmcnf.old
384 else
385 touch $sl_sedlocache/$sl_nmcnf.old
386fi
387 
3887simandl# preparing cached config from local and main
389# the local config should be processed as the second to have
390# higher priority for rules from local config
391echo "# generated file" > $sl_sedlocache/$sl_nmcnf
392for sl_file in `ls $sl_sedlocache/$sl_nmcnf.main ; ls $sl_sedlocnf`
393do
394cat $sl_file | grep "^mcnf" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2}' >> $sl_sedlocache/$sl_nmcnf
395cat $sl_file | grep "^igw" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2"\t"$3}' >> $sl_sedlocache/$sl_nmcnf
396cat $sl_file | grep "^ip" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6}' >> $sl_sedlocache/$sl_nmcnf
397done
3988simandl 
399#local gateways taken from local config
400cat $sl_sedlocnf | grep "^myigw" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2"\t"$3}' >> $sl_sedlocache/$sl_nmcnf
401 
4027simandl#cat $sl_sedlocache/$sl_nmcnf | sort | uniq > $sl_sedlocache/$sl_nmcnf.uniq
403#mv $sl_sedlocache/$sl_nmcnf.uniq $sl_sedlocache/$sl_nmcnf
404 
40510simandlsl_diffcfg=`diff $sl_sedlocache/$sl_nmcnf $sl_sedlocache/$sl_nmcnf.old | grep -c .`
406if [ $sl_diffcfg -gt 0 ]
407 then
408 if [ $scm_info -gt 0 ]; then echo "New config is different than the old one" ; fi
409 else
410 if [ $scm_info -gt 0 ]; then echo "New config is the same as the old one" ; fi
411fi
412 
41311simandl# showing number of rules in config and system
41410simandlsl_numru=`ip ru ls | grep -c lookup`
415sl_numip=`grep -c ^ip $sl_sedlocache/$sl_nmcnf`
416sl_numru=$(($sl_numru - 3 ))
417if [ $sl_numip -gt $sl_numru ]
418 then
419 if [ $scm_info -gt 0 ]; then echo "We have less rules ($sl_numru) than new config has ips ($sl_numip)" ; fi
42011simandl# sl_diffcfg="1"
42110simandl else
422 if [ $scm_info -gt 0 ]; then echo "We have $sl_numru rules and $sl_numip ips" ; fi
423fi
424 
4257simandl}
4268simandl 
4277simandl######################################################################
428s_version()
429{
430 echo sedlo $sl_version
431} # s_version
4328simandl 
4337simandl######################################################################
434s_report()
435{
4369simandl echo Content-type: text/html
437 echo
438 echo "Sedlo na routeru `hostname`"
439 echo "<pre>"
4407simandl echo "##### SEDLO #####"
441 echo "date : `date`"
442 echo "version : $sl_version"
443 echo "local_config : $sl_sedlocnf"
4449simandl echo "main_config : <a href=\"$sl_murlcfg\">$sl_murlcfg</a>"
4457simandl echo "last update : `cat $sl_sedlocache/last_getcnf.txt`"
446 echo "##### TABLES #####"
447 cat $sl_rttab
4489simandl echo ; echo "##### DEFAULT ROUTES IN TABLES #####"
449 $sl_ipcmd ro ls ta all | $sl_grepcmd table | $sl_grepcmd -v local | $sl_trcmd " " "\t"
450 echo ; echo "##### RULES FOR IPS #####"
451 $sl_ipcmd ru ls | $sl_trcmd " " "\t"
452 echo "</pre>"
4537simandl} # s_report
4548simandl 
4559simandl 
456 
4577simandl######################################################################
458s_help()
459{
460 echo Pouziti: sedlo [param]
461 echo param:
462 echo -V vypise verzi
463 echo -help vypise napovedu
464 echo -v malo upovidany
465 echo -vv hodne upovidany
466 echo -nogetcfg zajisti ze se nedude znovu nacitat konfigurace a pouzije se predchozi z cache
467 echo -report vypise prehled pravidel a tabulek
468 echo -flru odstrani vsechny pravidla
46911simandl echo -force bezpodminecne znovu obnovi vsechny pravidla
4707simandl} # s_help
4718simandl 
4727simandl######################################################################
473######################################################################
474 
475sl_unknown=""
476scm_nogetcfg=0
477scm_flru=0
478scm_info=0
47911simandlscm_force=0
480sl_diffigw=0
481sl_difftbl=0
4827simandl 
483# parsing input parameters
484while [ "a$1" != "a" ]
485do
486 case $1 in
487 -V)
488 s_version
489 exit 0
490 ;;
491 -h)
492 s_help
493 exit 0
494 ;;
495 -report)
496 s_report
497 exit 0
498 ;;
499 -flru)
500 scm_flru=1
501 shift
502 ;;
50311simandl -force)
504 scm_force=1
505 shift
506 ;;
5077simandl -help)
508 s_help
509 exit 0
510 ;;
511 -nogetcfg)
512 scm_nogetcfg=1
513 shift
514 ;;
515 -v)
516 scm_info=1
517 shift
518 ;;
519 -vv)
520 scm_info=2
521 shift
522 ;;
523 *)
524 sl_unknown="$sl_unknown$1 "
525 shift
526 esac
527done
528 
529# printing the list of bad parameters (if there are some)
530if [ "a$sl_unknown" != "a" ]
531then
532 echo "$slm_unknown $sl_unknown"
533 s_help
534 exit 0
535fi
536 
537if [ $scm_flru -eq 1 ]
538then
53916simandl s_flruall
5407simandl exit 0
541fi
542 
543if [ $scm_nogetcfg -eq 0 ]
544then
545 s_getcfg
546fi
547 
548s_mktables
549s_filltables
55015simandl#toto je pro ladici ucely
55111simandl#echo $sl_difftbl
552#echo $sl_diffcfg
553#echo $sl_diffigw
554#echo $scm_force
55513simandl#exit 0
55615simandl 
55711simandl#flushing and filling rules is done only when
558#new table is created
559#config is changed
560#some igw dissapears or appears
561#-force command line parameter was used
562if [ $sl_difftbl -gt 0 ] || [ $sl_diffcfg -gt 0 ] || [ $sl_diffigw -gt 0 ] || [ $scm_force -gt 0 ]
56310simandlthen
564 s_fillrules
565fi
566 
56716simandl 
5687simandlexit 0

Powered by WebSVN 2.2.1