From 7c9e0484e9842bb9b0e7a63a0a0857cc3d59bb21 Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Sun, 2 Jun 2013 23:53:23 +0000 Subject: contrib/freifunk-policyrouting: Make it work with firewall3 and make use of the new ip rule support in /etc/config/network --- .../files/etc/hotplug.d/iface/30-policyrouting | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'contrib/package/freifunk-policyrouting/files/etc/hotplug.d') 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 5c4eb38e98..327e8793be 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 @@ -9,9 +9,9 @@ proto="4" config_load freifunk-policyrouting config_get enable pr enable config_get fallback pr fallback +config_get strict pr strict config_get zones pr zones - if [ "$ACTION" = "ifup" ] && [ "$enable" = "1" ]; then network_get_subnet net $INTERFACE network_get_subnet6 net6 $INTERFACE @@ -54,6 +54,9 @@ if [ "$ACTION" = "ifup" ] && [ "$enable" = "1" ]; then for p in $proto; do if [ ! "$(ip -$p ru s | grep "from all iif $dev lookup olsr-default")" ]; then ip -$p rule add dev "$dev" lookup olsr-default prio 20000 + if [ "$strict" != 0 ]; then + ip -$p rule add dev "$dev" unreachable prio 20001 + fi if [ "$?" = 0 ]; then logger -s -t policyrouting "Use mesh gateway for interface $dev (IPv$p)" if [ -z "$(uci -P /var/state get freifunk-policyrouting.${INTERFACE})" ]; then @@ -87,6 +90,7 @@ if [ "$ACTION" = "ifdown" ]; then for p in $proto; do if [ "$(ip -$p ru s | grep "from all iif $dev lookup olsr-default")" ]; then ip -$p rule del dev "$dev" lookup olsr-default prio 20000 + ip -$p rule del dev "$dev" unreachable prio 20001 if [ "$?" = 0 ]; then logger -s -t policyrouting "Remove rule: dev "$dev" lookup olsr-default prio 20000 (IPv$p)" else -- cgit v1.2.3