diff options
author | Manuel Munz <freifunk@somakoma.de> | 2013-01-26 23:11:04 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2013-01-26 23:11:04 +0000 |
commit | 888f04322ba3487e0771548ec7008f4e237c542d (patch) | |
tree | 8ca069e2d007a9c9cfcc8d4cd15f9872587c5ed3 /contrib/package/freifunk-policyrouting/files/etc | |
parent | bb6ba23b3d9c170f05d6eddfb12036e799ca326a (diff) |
contrib/freifunk-policyrouting: Remove olsrd rttable options when wan goes down, thx xlizard
Diffstat (limited to 'contrib/package/freifunk-policyrouting/files/etc')
-rw-r--r-- | contrib/package/freifunk-policyrouting/files/etc/hotplug.d/iface/30-policyrouting | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/contrib/package/freifunk-policyrouting/files/etc/hotplug.d/iface/30-policyrouting b/contrib/package/freifunk-policyrouting/files/etc/hotplug.d/iface/30-policyrouting index d5136841b3..f8c59a6379 100644 --- a/contrib/package/freifunk-policyrouting/files/etc/hotplug.d/iface/30-policyrouting +++ b/contrib/package/freifunk-policyrouting/files/etc/hotplug.d/iface/30-policyrouting @@ -1,5 +1,16 @@ [ "$INTERFACE" != "wan" ] && exit 0 [ -f /proc/net/ipv6_route ] && has_ipv6=1 + +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 + /etc/init.d/olsrd restart + fi +} + case $ACTION in ifup) pr="`uci get freifunk-policyrouting.pr.enable`" @@ -77,18 +88,13 @@ case $ACTION in [ "$fallback" = 1 ] && ip -6 rule add lookup olsr-default prio 16420 fi else - # 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 - /etc/init.d/olsrd restart - fi + olsrd_rmtables fi ;; ifdown) logger -s -t policyrouting "Deleting ipv4 policy rules for $INTERFACE" + olsrd_rmtables ip rule del fwmark 1 lookup olsr-default > /dev/null 2>&1 ip rule del lookup olsr-default > /dev/null 2>&1 ip rule del lookup olsr > /dev/null 2>&1 |