source: trunk/package/firewall/files/lib/core_forwarding.sh @ 22215

Last change on this file since 22215 was 22215, checked in by jow, 6 years ago

[package] firewall:

  • notrack support was broken in multiple ways, fix it
  • also consider a zone conntracked if any redirect references it (#7196)
File size: 1.0 KB
Line 
1# Copyright (C) 2009-2010 OpenWrt.org
2
3fw_config_get_forwarding() {
4        [ "${forwarding_NAME}" != "$1" ] || return
5        fw_config_get_section "$1" forwarding { \
6                string _name "$1" \
7                string name "" \
8                string src "" \
9                string dest "" \
10                string family "" \
11        } || return
12        [ -n "$forwarding_name" ] || forwarding_name=$forwarding__name
13}
14
15fw_load_forwarding() {
16        fw_config_get_forwarding "$1"
17
18        fw_callback pre forwarding
19
20        local chain=forward
21        [ -n "$forwarding_src" ] && {
22                chain=zone_${forwarding_src}_forward
23        }
24
25        local target=ACCEPT
26        [ -n "$forwarding_dest" ] && {
27                target=zone_${forwarding_dest}_ACCEPT
28        }
29
30        local mode=$(fw_get_family_mode ${forwarding_family:-x} ${forwarding_dest:-${forwarding_src:--}} i)
31
32        fw add $mode f $chain $target ^
33
34        # propagate masq zone flag
35        [ -n "$forwarding_src" ] && list_contains FW_CONNTRACK_ZONES $forwarding_src && {
36                append FW_CONNTRACK_ZONES $forwarding_dest
37        }
38        [ -n "$forwarding_dest" ] && list_contains FW_CONNTRACK_ZONES $forwarding_dest && {
39                append FW_CONNTRACK_ZONES $forwarding_src
40        }
41
42        fw_callback post forwarding
43}
Note: See TracBrowser for help on using the repository browser.