add direction matching patch for qos-scripts from #1708
authorFelix Fietkau <nbd@openwrt.org>
Mon, 11 Jun 2007 16:32:38 +0000 (16:32 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 11 Jun 2007 16:32:38 +0000 (16:32 +0000)
SVN-Revision: 7571

package/qos-scripts/files/usr/lib/qos/generate.sh

index 9181d0b6f3e6b4c758e123e0818a456f65bb1a0a..844bd70f9a6a77bbd0f70de3576a3671bc3dccb9 100755 (executable)
@@ -116,6 +116,14 @@ parse_matching_rule() {
                                add_insmod ipt_connbytes
                                append "$var" "-m connbytes --connbytes $value --connbytes-dir both --connbytes-mode bytes"
                        ;;
+                       *:direction)
+                               value="$(echo "$value" | sed -e 's,-,:,g')"
+                               if [ "$value" = "out" ]; then
+                                       append "$var" "-o $device"
+                               elif [ "$value" = "in" ]; then
+                                       append "$var" "-i $device"
+                               fi
+                       ;;
                        1:pktsize)
                                value="$(echo "$value" | sed -e 's,-,:,g')"
                                add_insmod ipt_length
@@ -357,6 +365,7 @@ start_cg() {
                                append down "iptables -t mangle -A POSTROUTING -o $device -j IMQ --todev $imqdev" "$N"
                        }
                        append down "iptables -t mangle -A PREROUTING -i $device -j ${cg}" "$N"
+                       append down "iptables -t mangle -A POSTROUTING -o $device -j ${cg}" "$N"
                        append down "iptables -t mangle -A PREROUTING -i $device -j IMQ --todev $imqdev" "$N"
                }
        done