Let's assume I have 3 zones: lan, wan and other. For -t filter -A FORWARD, LuCI creates iptables rules which roughly look like this:
-A delegate_forward -i lanif -j zone_lan_forward
-A delegate_forward -i wanif -j zone_wan_forward
-A delegate_forward -i otherif -j zone_other_forward
-A delegate_forward -j GLOBAL_POLICY
...with each -A zone_..._forward being like this:
-A zone_x_forward -j zone_x_dest_POLICY
POLICY corresponds to the value of the Format option in the LuCI for the corresponding zone (x).
zone_x_dest_POLICY itself looks like this:
-A zone_x_dest_POLICY -o xif -j POLICY
So if we merge all this we get essentially these rules:
-A delegate_forward -i lanif -o lanif -j POLICY_for_lan
-A delegate_forward -i wanif -o wanif -j POLICY_for_wan
-A delegate_forward -i otherif -o otherif -j POLICY_for_other
-A delegate_forward -j GLOBAL_POLICY
The question is: does zone policy affect anything? Can there be a packet that is forwarded from a given interface to the same interface? My understanding is that iptables forwarding always have different input/output interfaces but these rules have -i = -o so they must never match.
(This is what the wiki suggests too: "FORWARD rules for a zone describe what happens to traffic passing between different interfaces in that zone.". wiki.openwrt.org/doc/uci/firewall)
If I am correct then it means the zone's policy will never be applied and the global policy will be in effect instead. I think zone_x_forward is supposed to never return but if its final -j zone_x_dest_POLICY doesn't match then zone_x_forward returns (since it's a user chain) and GLOBAL_POLICY is used instead. This may well be undesired.
Should I post this to the bug tracker?
CHAOS CALMER (15.05, r46767)
(Last edited by hofferen on 27 Feb 2017, 16:56)