summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-policyrouting/files/etc/hotplug.d
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2013-03-25 16:36:36 +0000
committerManuel Munz <freifunk@somakoma.de>2013-03-25 16:36:36 +0000
commit8e9cdbea1411a68645d5e82caa7232c7f0ef2d61 (patch)
treec16e72876e36c5a079289224d563eaa3a1e082ac /contrib/package/freifunk-policyrouting/files/etc/hotplug.d
parent7f3b0af6d90e260ea119cd0a81786a97501c9541 (diff)
contrib/freifunk-policyrouting: Use a new table 'localnets' for locally attached networks and populate it
Diffstat (limited to 'contrib/package/freifunk-policyrouting/files/etc/hotplug.d')
-rw-r--r--contrib/package/freifunk-policyrouting/files/etc/hotplug.d/iface/30-policyrouting27
1 files changed, 14 insertions, 13 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 c4ae38d972..5c4eb38e98 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
@@ -11,6 +11,7 @@ config_get enable pr enable
config_get fallback pr fallback
config_get zones pr zones
+
if [ "$ACTION" = "ifup" ] && [ "$enable" = "1" ]; then
network_get_subnet net $INTERFACE
network_get_subnet6 net6 $INTERFACE
@@ -18,27 +19,26 @@ if [ "$ACTION" = "ifup" ] && [ "$enable" = "1" ]; then
if [ "$net" != "" -a -n "$dev" ]; then
eval $(/bin/ipcalc.sh $net)
- if [ "$PREFIX" != "0" ]; then
- if [ ! "$(ip r s t olsr-default |grep "throw $NETWORK/$PREFIX")" ]; then
- ip r a throw $NETWORK/$PREFIX table olsr-default
+ if [ "$PREFIX" != "0" -a "$NETWORK" != "127.0.0.0" ]; then
+ if [ ! "$(ip r s t localnets |grep "$NETWORK/$PREFIX dev")" ]; then
+ cmd="ip r a $NETWORK/$PREFIX dev $dev table localnets"
+ $cmd
if [ "$?" = 0 ]; then
- logger -s -t policyrouting "Add route: throw $NETWORK/$PREFIX table olsr-default"
+ logger -s -t policyrouting "Add route: $cmd"
else
- logger -s -t policyrouting "Error! Could not add route: throw $NETWORK/$PREFIX table olsr-default"
+ logger -s -t policyrouting "Error! Could not add route: $cmd"
fi
fi
+
fi
if [ -n "$net6" ]; then
- if [ ! "$(ip -6 r s t olsr-default |grep "throw $net6")" ]; then
- rule="throw $net6 table olsr-default dev $dev"
- ip -6 r a $rule
- if [ "$?" = 0 ]; then
- logger -s -t policyrouting "Add route: $rule (IPv6)"
- else
- logger -s -t policyrouting "Error! Could not add route: $rule (IPv6)"
- fi
+ cmd="ip -6 r a $net6 dev $dev table localnets"
+ $cmd 2>&1 > /dev/null
+ if [ "$?" = 0 ]; then
+ logger -s -t policyrouting "Add route: $cmd (IPv6)"
fi
+
fi
networks=""
@@ -68,6 +68,7 @@ if [ "$ACTION" = "ifup" ] && [ "$enable" = "1" ]; then
fi
done
fi
+
fi
if [ "$ACTION" = "ifdown" ]; then