jablonka.czprosek.czf

sedlo

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

 

Line No. Rev Author Line
17simandl#!/bin/bash
2# author : Petr Simandl www.simandl.cz
321simandl# release date : 03/06/2007
47simandl# name : sedlo
5# description : dynamic side routing tables tool
6# license : GPL
7 
821simandlsl_version="0.0.4pre9"
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
122fi
123 
124}
125 
126######################################################################
12710simandl# here we get each ip and we create a rule to send this ip to a
128# certain table
129# this routine can be skipped when the number of ips and ip directions
130# are still the same = old and new configs are the same
1317simandls_fillrules()
132{
1338simandl 
13416simandl#this will check no default rule if exists and if not it will be created
135s_checknodefru
136 
1378simandl#flush old rules before filling new ones
138#not so nice solution - it is planned to change just what's necessary
139#by s_maru
14017simandl#s_flru
1417simandl 
14217simandlif [ $scm_info -gt 0 ]; then echo "Checking rules for ips" ; fi
1437simandl 
144sl_ips=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd "^ip" | $sl_awkcmd '{print $2"*"$4"*"$5"*"$6}'`
14517simandlsl_rules=`$sl_ipcmd ru ls | $sl_grepcmd ^$sl_priorules":" | $sl_trcmd '[:blank:]' '*'`
1467simandl 
14717simandl#for all IPs we check and leave, change or create rule
1487simandlfor sl_ip in $sl_ips
149do
150 sl_ipn=`echo $sl_ip | $sl_awkcmd -F '*' '{print $1}'`
151 sl_ipgws=`echo $sl_ip | $sl_awkcmd -F '*' '{print $2,$3,$4}'`
152 sl_ok="no"
15317simandl #for all GWs we check rules
1547simandl for sl_ipgw in $sl_ipgws
155 do
156 sl_tbl=`$sl_ipcmd ro ls ta $sl_ipgw`
15717simandl #check if table exists
1587simandl if [ "$sl_tbl x" != " x" ] && [ "$sl_ok" = "no" ]
159 then
16017simandl #we have IP and GW table
161 #check if the rule alredady exists
162 sl_oldrule=`echo $sl_rules | $sl_trcmd " " "\n" | $sl_grepcmd "\*"$sl_ipn"\*"`
163 sl_exactrule=`echo $sl_oldrule | $sl_trcmd " " "\n" | $sl_grepcmd "\*"$sl_ipgw"\*"`
164 if [ "$sl_exactrule x" == " x" ]
165 then
166 #exact rule doesn't exist so we check if an old rule for this IP is present
167 if [ "$sl_oldrule x" != " x" ]
168 then
169 #some old rule(s) for IP is present so we delete it
170 for sl_rule in $sl_oldrule
171 do
172 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
173 if [ $scm_info -gt 0 ]; then echo "Deleting old rule $sl_ipgws" ; fi
174 $sl_ipcmd ru del $sl_ipgws
175 #this should make faster applying of new routing tables
176 $sl_ipcmd ro flush cache
177 done
178 fi
179 
180 if [ $scm_info -gt 0 ]; then echo "Creating new rule to send $sl_ipn to table $sl_ipgw" ; fi
181 $sl_ipcmd ru add from $sl_ipn lookup $sl_ipgw prio $sl_priorules
182 
183 else
184 if [ $scm_info -gt 1 ]; then echo "Rule to send $sl_ipn to table $sl_ipgw already exists" ; fi
185 fi
1867simandl sl_ok="yes"
187 else
18817simandl #we have no table
1897simandl if [ "$sl_ok" = "no" ]
190 then
191 if [ $scm_info -gt 1 ]; then echo "For $sl_ipn table $sl_ipgw not used because it is empty" ; fi
192 else
19316simandl if [ $scm_info -gt 1 ]; then echo "For $sl_ipn table $sl_ipgw not used because it has lower priority" ; fi
1947simandl fi
195 fi
196 done
197done
198 
19917simandl#finally we check all rules and if there is a rule without IP from config we delete it
200for sl_rule in $sl_rules
201do
202 sl_iprule=`echo $sl_rule | $sl_awkcmd -F '*' '{print $3}'`
203 sl_ipconf=`echo $sl_ips | $sl_trcmd " " "\n" | $sl_grepcmd "^"$sl_iprule"\*"`
2047simandl 
20517simandl if [ "$sl_ipconf x" == " x" ]
206 then
207 #we have a rule without an IP in config so we delete this rule
208 sl_ipgws=`echo $sl_rule | $sl_awkcmd -F '*' '{print $2,$3,$4,$5,$6,$7}'`
209 if [ $scm_info -gt 0 ]; then echo "Deleting non config rule $sl_ipgws" ; fi
210 $sl_ipcmd ru del $sl_ipgws
211 #this should make faster applying of new routing tables
212 $sl_ipcmd ro flush cache
213 fi
214done
215 
2167simandl} # s_fillrules
2178simandl 
2187simandl######################################################################
21910simandl# here we look into the main routing table for path to our iGWs
220# and we fill these tables with two halves default nets that
221# point to appropriate direction
222# this routine can be skipped when the routing table is the same
2237simandls_filltables()
224{
22510simandlif [ $scm_info -gt 0 ]; then echo "Checking main routing table" ; fi
226 
2277simandlif [ $scm_info -gt 0 ]; then echo "Filling tables" ; fi
228 
2299simandlsl_igws=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd -E "^igw|^myigw" | $sl_awkcmd '{print $3"*"$2"*"$1}'`
2307simandl 
231for sl_igw in $sl_igws
232 do
233 sl_igwn=`echo $sl_igw | $sl_awkcmd -F '*' '{print $1}'`
234 sl_igwip=`echo $sl_igw | $sl_awkcmd -F '*' '{print $2}'`
2359simandl sl_igwtype=`echo $sl_igw | $sl_awkcmd -F '*' '{print $3}'`
23615simandl 
23714simandl#oprava falesneho routovani na lokalni iface - pokud jsme lokalni igw tak se nema najit ip
238#protoze cesta dal neni - jsme totiz uz na lokalnim iface
23915simandl#head je tam proto ze se pro prespolni(a bgp) muze objevit vice rout s ruznou metrikou tak vezmem jen prvni (head)
240#s nejmensi metrikou (sort)
241 sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -v "proto kernel" | $sl_grepcmd "^$sl_igwip " | sort | $sl_awkcmd '{print $3}' | head -n 1`
2427simandl 
2439simandl # equal cost multipath detection - just first IP is taken as way to igw
2447simandl if [ "$sl_igwgt x" = "zebra x" ]
245 then
246 sl_igwgt=`$sl_ipcmd ro ls | $sl_grepcmd -A 1 "^$sl_igwip " | $sl_grepcmd "nexthop" | $sl_awkcmd '{print $3}'`
247 fi
248 
2499simandl #if myigw then fill table for local gateway with single ip from config
250 if [ "$sl_igwtype x" = "myigw x" ]
251 then
252 sl_igwgt=$sl_igwip
253 fi
25411simandl #testing if the igw has not a route in global routing table
2557simandl if [ "$sl_igwgt x" = " x" ]
256 then
25711simandl if [ $scm_info -gt 1 ]; then echo "Route not found for igw $sl_igwn" ; fi
258 sl_myigw=`cat $sl_sedlocnf | $sl_grepcmd "^myigw" | $sl_grepcmd $sl_igwn | $sl_awkcmd '{print $3}'`
259 #testing if the igw without route is in local config
260 #if not we go to flush its table and set flag to redo rules
261 if [ "$sl_myigw x" = " x" ]
262 then
263 #getting num of routes of igw
26413simandl sl_igwnr=`$sl_ipcmd ro ls ta all | $sl_grepcmd -c "table ${sl_igwn} "`
26511simandl if [ "$sl_igwnr x" = "0 x" ]
266 then
26712simandl if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn is already empty - no action taken" ; fi
26811simandl else
26912simandl if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will be flushed and rules rearranged" ; fi
27011simandl $sl_ipcmd ro fl ta $sl_igwn
271 #because this igw dissapeared we set a flag for rules recreation
272 sl_diffigw=1
273 fi
274 else
27513simandl if [ $scm_info -gt 1 ]; then echo "Igw $sl_igwn found in local config - leaving table as is" ; fi
27611simandl fi
2777simandl else
278 sl_tbl=`$sl_ipcmd ro ls ta $sl_igwn`
27912simandl #if the table is empty we fill it and we set flag for rules recreation
280 if [ "$sl_tbl x" = " x" ]
2817simandl then
28212simandl sl_diffigw=1
283 $sl_ipcmd ro add 0.0.0.0/1 via $sl_igwgt ta $sl_igwn
284 $sl_ipcmd ro add 128.0.0.0/1 via $sl_igwgt ta $sl_igwn
285 if [ "$sl_igwtype x" = "myigw x" ]
286 then
287 if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn filled with default myigw $sl_igwgt" ; fi
288 else
289 if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn filled with default gw $sl_igwgt" ; fi
290 fi
291 #the table is not empty so we check if routes are the same
2929simandl else
29312simandl #picking default gateway from the table
294 sl_igwogt=`$sl_ipcmd ro ls ta $sl_igwn | $sl_awkcmd '{print $3}' | uniq`
295 #checking if the old default is same as the new one
296 if [ "$sl_igwogt x" = "$sl_igwgt x" ]
297 then
298 if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will not be changed and default is $sl_igwgt" ; fi
299 else
300 #the new default is different so we will flush the table, fill new default
30115simandl if [ $scm_info -gt 1 ]; then echo "Table $sl_igwn will be rewritten to default $sl_igwgt" ; fi
30212simandl #flushing old default route in the table
303 $sl_ipcmd ro fl ta $sl_igwn
304 #filling new default
305 $sl_ipcmd ro add 0.0.0.0/1 via $sl_igwgt ta $sl_igwn
306 $sl_ipcmd ro add 128.0.0.0/1 via $sl_igwgt ta $sl_igwn
307 fi
3089simandl fi
3097simandl fi
310 done
311 
312} # s_filltables
3138simandl 
3147simandl######################################################################
31510simandl# filling rttab with tables from config
316# only new tables are created with a new uniq number that is not important because
317# usually we handle tables just by their names
318# this routine acts only when a new iGW appears - only adding a table is supported
319# no deleting is implemented because it seems to be not necessary to delete an old table
320# because there is space enough and after reboot table will not be created
3217simandls_mktables()
322{
32310simandlif [ $scm_info -gt 0 ]; then echo "Checking tables" ; fi
324 
3259simandlsl_igws=`$sl_catcmd $sl_sedlocache/$sl_nmcnf | $sl_grepcmd -E "^igw|^myigw" | $sl_awkcmd '{print $3}'`
3267simandlfor sl_igw in $sl_igws
327 do
328 sl_igwrttb=`$sl_catcmd $sl_rttab | $sl_awkcmd '{print $2}' | $sl_grepcmd $sl_igw `
329 if [ "$sl_igwrttb x" = " x" ]
330 then
331 if [ $scm_info -gt 1 ]; then echo "Creating table for $sl_igw" ; fi
332 sl_cnt="$sl_rtnmax"
333 sl_ok="no"
334 until [ "$sl_cnt" -eq "$sl_rtnmin" ] || [ "$sl_ok" = "yes" ]
335 do
336 #space is used to recognized two and three digit numbers
337 sl_igwrttb=`cat $sl_rttab | awk '{print $1" "}' | grep "$sl_cnt " `
338 if [ "$sl_igwrttb x" = " x" ]
339 then
340 sl_ok="yes"
341 echo "$sl_cnt $sl_igw" >> $sl_rttab
342 fi
343 sl_cnt=$(($sl_cnt - 1 ))
34411simandl done
345 # a new table was created so we should set a flag for rules creation
346 sl_difftbl=1
3477simandl else
348 if [ $scm_info -gt 1 ]; then echo "Table found for $sl_igw no action taken" ; fi
349 fi
3509simandl done
3517simandl} # s_mktables
3528simandl 
3537simandl######################################################################
354s_getcfg()
355{
356if [ $scm_info -gt 0 ]; then echo "Getting config" ; fi
357if [ $scm_info -gt 1 ]; then echo "Using main config $sl_murlcfg" ; fi
358if [ $scm_info -gt 1 ]; then echo "Using local config $sl_sedlocnf" ; fi
359 
36010simandlrm -f "$sl_sedlocache/$sl_nmcnf.main.tmp"
3617simandl 
36210simandl$sl_wgetcmd -q -t 3 $sl_murlcfg -O "$sl_sedlocache/$sl_nmcnf.main.tmp"
363 
3647simandlif [ -s $sl_sedlocache/$sl_nmcnf.main.tmp ]
365 then
366 date > $sl_sedlocache/last_getcnf.txt
367 cp $sl_sedlocache/$sl_nmcnf.main.tmp $sl_sedlocache/$sl_nmcnf.main
36810simandl if [ $scm_info -gt 1 ]; then echo "Main config downloaded and accepted" ; fi
3697simandl else
3708simandl if [ $scm_info -gt 1 ]; then echo "Main config not downloaded - cached config will be used" ; fi
371 echo -n "Main config not downloaded " > $sl_sedlocache/last_getcnf.txt
3727simandl date >> $sl_sedlocache/last_getcnf.txt
373fi
374 
37510simandl# before generating a new cached config we store the old one for
376# comparison with the new one
377rm -f "$sl_sedlocache/$sl_nmcnf.old"
378if [ -s $sl_sedlocache/$sl_nmcnf ]
379 then
380 cp $sl_sedlocache/$sl_nmcnf $sl_sedlocache/$sl_nmcnf.old
381 else
382 touch $sl_sedlocache/$sl_nmcnf.old
383fi
384 
3857simandl# preparing cached config from local and main
386# the local config should be processed as the second to have
387# higher priority for rules from local config
388echo "# generated file" > $sl_sedlocache/$sl_nmcnf
389for sl_file in `ls $sl_sedlocache/$sl_nmcnf.main ; ls $sl_sedlocnf`
390do
391cat $sl_file | grep "^mcnf" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2}' >> $sl_sedlocache/$sl_nmcnf
392cat $sl_file | grep "^igw" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2"\t"$3}' >> $sl_sedlocache/$sl_nmcnf
393cat $sl_file | grep "^ip" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6}' >> $sl_sedlocache/$sl_nmcnf
394done
3958simandl 
396#local gateways taken from local config
397cat $sl_sedlocnf | grep "^myigw" | $sl_trcmd ';' '#' | awk '{print $1"\t"$2"\t"$3}' >> $sl_sedlocache/$sl_nmcnf
398 
3997simandl#cat $sl_sedlocache/$sl_nmcnf | sort | uniq > $sl_sedlocache/$sl_nmcnf.uniq
400#mv $sl_sedlocache/$sl_nmcnf.uniq $sl_sedlocache/$sl_nmcnf
401 
40210simandlsl_diffcfg=`diff $sl_sedlocache/$sl_nmcnf $sl_sedlocache/$sl_nmcnf.old | grep -c .`
403if [ $sl_diffcfg -gt 0 ]
404 then
405 if [ $scm_info -gt 0 ]; then echo "New config is different than the old one" ; fi
406 else
407 if [ $scm_info -gt 0 ]; then echo "New config is the same as the old one" ; fi
408fi
409 
41011simandl# showing number of rules in config and system
41110simandlsl_numru=`ip ru ls | grep -c lookup`
412sl_numip=`grep -c ^ip $sl_sedlocache/$sl_nmcnf`
413sl_numru=$(($sl_numru - 3 ))
414if [ $sl_numip -gt $sl_numru ]
415 then
416 if [ $scm_info -gt 0 ]; then echo "We have less rules ($sl_numru) than new config has ips ($sl_numip)" ; fi
41711simandl# sl_diffcfg="1"
41810simandl else
419 if [ $scm_info -gt 0 ]; then echo "We have $sl_numru rules and $sl_numip ips" ; fi
420fi
421 
4227simandl}
4238simandl 
4247simandl######################################################################
425s_version()
426{
427 echo sedlo $sl_version
428} # s_version
4298simandl 
4307simandl######################################################################
431s_report()
432{
4339simandl echo Content-type: text/html
434 echo
435 echo "Sedlo na routeru `hostname`"
436 echo "<pre>"
4377simandl echo "##### SEDLO #####"
438 echo "date : `date`"
439 echo "version : $sl_version"
440 echo "local_config : $sl_sedlocnf"
4419simandl echo "main_config : <a href=\"$sl_murlcfg\">$sl_murlcfg</a>"
4427simandl echo "last update : `cat $sl_sedlocache/last_getcnf.txt`"
443 echo "##### TABLES #####"
444 cat $sl_rttab
4459simandl echo ; echo "##### DEFAULT ROUTES IN TABLES #####"
446 $sl_ipcmd ro ls ta all | $sl_grepcmd table | $sl_grepcmd -v local | $sl_trcmd " " "\t"
447 echo ; echo "##### RULES FOR IPS #####"
448 $sl_ipcmd ru ls | $sl_trcmd " " "\t"
449 echo "</pre>"
4507simandl} # s_report
4518simandl 
4529simandl 
453 
4547simandl######################################################################
455s_help()
456{
457 echo Pouziti: sedlo [param]
458 echo param:
459 echo -V vypise verzi
460 echo -help vypise napovedu
461 echo -v malo upovidany
462 echo -vv hodne upovidany
463 echo -nogetcfg zajisti ze se nedude znovu nacitat konfigurace a pouzije se predchozi z cache
464 echo -report vypise prehled pravidel a tabulek
465 echo -flru odstrani vsechny pravidla
46611simandl echo -force bezpodminecne znovu obnovi vsechny pravidla
4677simandl} # s_help
4688simandl 
4697simandl######################################################################
470######################################################################
471 
472sl_unknown=""
473scm_nogetcfg=0
474scm_flru=0
475scm_info=0
47611simandlscm_force=0
477sl_diffigw=0
478sl_difftbl=0
4797simandl 
480# parsing input parameters
481while [ "a$1" != "a" ]
482do
483 case $1 in
484 -V)
485 s_version
486 exit 0
487 ;;
488 -h)
489 s_help
490 exit 0
491 ;;
492 -report)
493 s_report
494 exit 0
495 ;;
496 -flru)
497 scm_flru=1
498 shift
499 ;;
50011simandl -force)
501 scm_force=1
502 shift
503 ;;
5047simandl -help)
505 s_help
506 exit 0
507 ;;
508 -nogetcfg)
509 scm_nogetcfg=1
510 shift
511 ;;
512 -v)
513 scm_info=1
514 shift
515 ;;
516 -vv)
517 scm_info=2
518 shift
519 ;;
520 *)
521 sl_unknown="$sl_unknown$1 "
522 shift
523 esac
524done
525 
526# printing the list of bad parameters (if there are some)
527if [ "a$sl_unknown" != "a" ]
528then
529 echo "$slm_unknown $sl_unknown"
530 s_help
531 exit 0
532fi
533 
534if [ $scm_flru -eq 1 ]
535then
53616simandl s_flruall
5377simandl exit 0
538fi
539 
540if [ $scm_nogetcfg -eq 0 ]
541then
542 s_getcfg
543fi
544 
545s_mktables
546s_filltables
54715simandl#toto je pro ladici ucely
54811simandl#echo $sl_difftbl
549#echo $sl_diffcfg
550#echo $sl_diffigw
551#echo $scm_force
55213simandl#exit 0
55315simandl 
55411simandl#flushing and filling rules is done only when
555#new table is created
556#config is changed
557#some igw dissapears or appears
558#-force command line parameter was used
559if [ $sl_difftbl -gt 0 ] || [ $sl_diffcfg -gt 0 ] || [ $sl_diffigw -gt 0 ] || [ $scm_force -gt 0 ]
56010simandlthen
561 s_fillrules
562fi
563 
56416simandl 
5657simandlexit 0

Powered by WebSVN 2.2.1