contrib/freifunk-policyrouting: Fix getting the name of interfaces
authorManuel Munz <freifunk@somakoma.de>
Thu, 22 Sep 2011 13:14:22 +0000 (13:14 +0000)
committerManuel Munz <freifunk@somakoma.de>
Thu, 22 Sep 2011 13:14:22 +0000 (13:14 +0000)
contrib/package/freifunk-policyrouting/files/etc/hotplug.d/firewall/24-policyrouting

index 3e6f8155c221c1e530a70b2aafceffdef28fb389..014803a7d90a274456cf9832a991cce76af475f5 100644 (file)
@@ -46,7 +46,11 @@ if [ "$ACTION" = "add" ] && [ "$INTERFACE" = "wan" ]; then
                                if [ "`uci -q get network.$int.type`" == "bridge" ]; then 
                                        dev="br-$int"
                                else
-                                       dev=`uci get network.$int.ifname`
+                                       if  [ -n "`uci -p /var/state get network.$int.ifname`" ]; then
+                                               dev=`uci -p /var/state get network.$int.ifname`
+                                       else
+                                               dev=`uci -p /var/state get network.$int.device`
+                                       fi
                                fi
                                logger -t policyrouting "Add mark 1 to packages coming in via interface $dev"
                                iptables -t mangle -I prerouting_policy -i $dev -j MARK --set-mark 1