Here is LVM support for OpenWRT. It introduces 3 new packages:
[openwrt.git] / package / firewall / files / uci_firewall.sh
index 21485cb..207dcd8 100755 (executable)
@@ -343,6 +343,7 @@ fw_redirect() {
 
        config_get src $1 src
        config_get src_ip $1 src_ip
+       config_get src_dip $1 src_dip
        config_get src_port $1 src_port
        config_get src_dport $1 src_dport
        config_get src_mac $1 src_mac
@@ -372,6 +373,7 @@ fw_redirect() {
                $IPTABLES -A zone_${src}_prerouting -t nat \
                        ${proto:+-p $proto} \
                        ${src_ip:+-s $src_ip} \
+                       ${src_dip:+-d $src_dip} \
                        ${src_port:+--sport $src_port} \
                        ${src_dport:+--dport $src_dport} \
                        ${src_mac:+-m mac --mac-source $src_mac} \
@@ -417,7 +419,8 @@ get_interface_zones() {
 fw_event() {
        local action="$1"
        local interface="$2"
-       local ifname="$(sh -c ". /etc/functions.sh; config_load network; config_get "$interface" ifname")"
+       local ifname="$(sh -c ". /etc/functions.sh; include /lib/network; scan_interfaces; config_get "$interface" ifname")"
+       add_zone=
        local up
 
        [ -z "$ifname" ] && return 0
@@ -503,10 +506,15 @@ fw_init() {
        echo "Loading zone defaults"
        config_foreach fw_zone_defaults zone
        uci_set_state firewall core loaded 1
+       config_set core loaded 1
        config_foreach fw_check_notrack zone
-       INTERFACES="$(sh -c '. /etc/functions.sh; config_load network; config_foreach echo interface')"
+       INTERFACES="$(sh -c '
+               . /etc/functions.sh; config_load network
+               echo_up() { local up; config_get_bool up "$1" up 0; [ $up = 1 ] && echo "$1"; }
+               config_foreach echo_up interface
+       ')"
        for interface in $INTERFACES; do
-               fw_addif "$interface"
+               fw_event ifup "$interface"
        done
 }
 
This page took 0.022419 seconds and 4 git commands to generate.