From 09f83d2edfe7b98ad9f76688e4afac2ec0651b07 Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Sat, 2 Jun 2012 20:10:50 +0000 Subject: [PATCH] contrib/freifunk-policyrouting: Add initial support for ipv6. More work is needed, but this first commit at least makes ipv6/olsrd working again when policyrouting is used. --- .../files/etc/hotplug.d/iface/30-policyrouting | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 e3b0edeb3..68eba11cf 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 @@ -3,6 +3,9 @@ case $ACTION in ifup) pr=`uci get freifunk-policyrouting.pr.enable` + # check if ipv6 is enabled: + [ -f /proc/net/ipv6_route ] && has_ipv6=1 + if [ $pr = "1" ]; then logger -t policyrouting "Starting policy routing on $INTERFACE" @@ -59,6 +62,12 @@ case $ACTION in ip rule add fwmark 1 lookup olsr-default ip rule add lookup main ip rule add lookup olsr + if [ "$has_ipv6" = 1 ]; then + ip -6 rule del lookup main + ip -6 rule add fwmark 1 lookup olsr-default + ip -6 rule add lookup main + ip -6 rule add lookup olsr + 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 @@ -74,5 +83,9 @@ case $ACTION in logger -t policyrouting "Deleting policy rules for $INTERFACE" ip rule del fwmark 1 lookup olsr-default > /dev/null 2>&1 ip rule del lookup olsr > /dev/null 2>&1 + if [ "$has_ipv6" = 1 ]; then + ip -6 rule del fwmark 1 lookup olsr-default > /dev/null 2>&1 + ip -6 rule del lookup olsr > /dev/null 2>&1 + fi ;; esac -- 2.25.1