unify object freeing
[project/firewall3.git] / forwards.c
index 1715abc..9f658fc 100644 (file)
 #include "forwards.h"
 
 
-static struct fw3_option forward_opts[] = {
+const struct fw3_option fw3_forward_opts[] = {
        FW3_OPT("name",                string,   forward,     name),
        FW3_OPT("family",              family,   forward,     family),
 
        FW3_OPT("src",                 device,   forward,     src),
        FW3_OPT("dest",                device,   forward,     dest),
+
+       { }
 };
 
 
@@ -51,7 +53,7 @@ fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
 
                memset(forward, 0, sizeof(*forward));
 
-               fw3_parse_options(forward, forward_opts, ARRAY_SIZE(forward_opts), s);
+               fw3_parse_options(forward, fw3_forward_opts, s);
 
                if (forward->src.invert || forward->dest.invert)
                {
@@ -60,14 +62,14 @@ fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
                        continue;
                }
                else if (forward->src.set && !forward->src.any &&
-                        !(forward->_src = fw3_lookup_zone(state, forward->src.name)))
+                        !(forward->_src = fw3_lookup_zone(state, forward->src.name, false)))
                {
                        warn_elem(e, "refers to not existing zone '%s'", forward->src.name);
                        fw3_free_forward(forward);
                        continue;
                }
                else if (forward->dest.set && !forward->dest.any &&
-                        !(forward->_dest = fw3_lookup_zone(state, forward->dest.name)))
+                        !(forward->_dest = fw3_lookup_zone(state, forward->dest.name, false)))
                {
                        warn_elem(e, "refers to not existing zone '%s'", forward->dest.name);
                        fw3_free_forward(forward);