summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-policyrouting
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2014-08-09 12:23:27 +0000
committerManuel Munz <freifunk@somakoma.de>2014-08-09 12:23:27 +0000
commitb5ade8195ade3f927c812cb20278e66de29a472f (patch)
tree8f3ce4c5d32c200a910f7024cc338f16f45e60fe /contrib/package/freifunk-policyrouting
parenta8aaac93ec714728258479b387c922bc1c74aa2a (diff)
contrib/freifunk-policyrouting: use olsrd and olsrd6 configs
Diffstat (limited to 'contrib/package/freifunk-policyrouting')
-rwxr-xr-xcontrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting61
1 files changed, 36 insertions, 25 deletions
diff --git a/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting b/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting
index 10cb4454d5..05a75407d8 100755
--- a/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting
+++ b/contrib/package/freifunk-policyrouting/files/etc/init.d/freifunk-policyrouting
@@ -6,28 +6,35 @@ START=15
proto="4"
[ -f /proc/net/ipv6_route ] && proto="4 6"
+[ -f /etc/config/olsrd ] && cfgs="olsrd"
+[ -f /etc/config/olsrd6 ] && cfgs="$cfgs olsrd6"
config_load freifunk-policyrouting
config_get enable pr enable
config_get fallback pr fallback
config_get zones pr zones
+
olsrd_rmtables() {
- # Remove custom routing tables from olsrd
- if [ "`uci -q get olsrd.@olsrd[0].RtTable`" == "111" ] || [ "`uci -q get olsrd.@olsrd[0].RtTableDefault`" == "112" ]; then
- uci delete olsrd.@olsrd[0].RtTable
- uci delete olsrd.@olsrd[0].RtTableDefault
- uci commit
- fi
+ for cfg in $cfgs; do
+ # Remove custom routing tables from olsrd
+ if [ "`uci -q get $cfg.@olsrd[0].RtTable`" == "111" ] || [ "`uci -q get $cfg.@olsrd[0].RtTableDefault`" == "112" ]; then
+ uci delete $cfg.@olsrd[0].RtTable
+ uci delete $cfg.@olsrd[0].RtTableDefault
+ uci commit
+ fi
+ done
}
olsrd_intalltables() {
- if [ ! "`uci -q get olsrd.@olsrd[0].RtTable`" == "111" ] || [ ! "`uci -q get olsrd.@olsrd[0].RtTableDefault`" == "112" ]; then
- uci set olsrd.@olsrd[0].RtTable='111'
- uci set olsrd.@olsrd[0].RtTableDefault='112'
- uci commit olsrd
- /etc/init.d/olsrd restart 2&> /dev/null
- fi
+ for cfg in $cfgs; do
+ if [ ! "`uci -q get $cfg.@olsrd[0].RtTable`" == "111" ] || [ ! "`uci -q get $cfg.@olsrd[0].RtTableDefault`" == "112" ]; then
+ uci set $cfg.@olsrd[0].RtTable='111'
+ uci set $cfg.@olsrd[0].RtTableDefault='112'
+ uci commit $cfg
+ /etc/init.d/$cfg restart 2&> /dev/null
+ fi
+ done
}
rt_tables() {
@@ -45,26 +52,30 @@ rt_tables() {
}
disable_dyngw() {
- dyngwlib=`uci show olsrd |grep dyn_gw.so |awk {' FS="."; print $1"."$2 '}`
- if [ -n "$dyngwlib" ]; then
- uci set $dyngwlib.ignore=1
- uci commit olsrd
- fi
+ for cfg in $cfgs; do
+ local dyngwlib=`uci show $cfg |grep dyn_gw.so |awk {' FS="."; print $1"."$2 '}`
+ if [ -n "$dyngwlib" ]; then
+ uci set $dyngwlib.ignore=1
+ uci commit $cfg
+ fi
- dyngwplainlib=`uci show olsrd |grep dyn_gw_plain |awk {' FS="."; print $1"."$2 '}`
- if [ -n "$dyngwplainlib" ]; then
- rttable="$(uci -q get $dyngwplainlib.RtTable)"
- if [ -z "$rttable" ] || [ "$rttable" = "254" ]; then
- uci set $dyngwplainlib.ignore=1
- uci commit olsrd
+ dyngwplainlib=`uci show $cfg |grep dyn_gw_plain |awk {' FS="."; print $1"."$2 '}`
+ if [ -n "$dyngwplainlib" ]; then
+ rttable="$(uci -q get $dyngwplainlib.RtTable)"
+ if [ -z "$rttable" ] || [ "$rttable" = "254" ]; then
+ uci set $dyngwplainlib.ignore=1
+ uci commit $cfg
+ fi
fi
- fi
+ done
}
restart_services() {
logger -s -t policyrouting -p info "Restarting services"
/etc/init.d/network restart 2&> /dev/null
- /etc/init.d/olsrd restart 2&> /dev/null
+ for cfg in $cfgs; do
+ /etc/init.d/$cfg restart 2&> /dev/null
+ done
}
boot() {