1 # Copyright (C) 2009-2010 OpenWrt.org
3 FW_LIBDIR
=${FW_LIBDIR:-/lib/firewall}
14 echo "firewall already loaded" >&2
17 uci_set_state firewall core
"" firewall_state
23 echo "Loading defaults"
24 fw_config_once fw_load_defaults defaults
27 config_foreach fw_load_zone zone
29 echo "Loading forwardings"
30 config_foreach fw_load_forwarding forwarding
32 echo "Loading redirects"
33 config_foreach fw_load_redirect redirect
36 config_foreach fw_load_rule rule
38 echo "Loading includes"
39 config_foreach fw_load_include include
41 [ -n "$FW_NOTRACK_DISABLED" ] && {
42 echo "Optimizing conntrack"
43 config_foreach fw_load_notrack_zone zone
46 echo "Loading interfaces"
47 config_foreach fw_configure_interface interface add
51 uci_set_state firewall core loaded
1
63 uci_revert_state firewall
79 config_get_bool bool core loaded
0
85 echo "Error:" "$@" >&2
97 logger
-t firewall
-p user.
$level "$@"
102 [ -z "$FW_INITIALIZED" ] ||
return 0
104 .
$FW_LIBDIR/config.sh
107 fw_config_append firewall
109 local hooks
="core stop defaults zone notrack synflood"
111 for file in $FW_LIBDIR/core_
*.sh
; do
113 hk
=$
(basename $file .sh
)
117 for file in $FW_LIBDIR/*.sh
; do
118 lib
=$
(basename $file .sh
)
119 lib
=${lib##[0-9][0-9]_}
121 core
*|fw|config|uci_firewall
) continue ;;
125 for pp
in pre post
; do
126 type ${lib}_${pp}_${hk}_cb
>/dev
/null
&&
127 append FW_CB_
${pp}_${hk} ${lib}
132 fw_callback post init