#include "redirects.h"
-static struct fw3_option redirect_opts[] = {
+const struct fw3_option fw3_redirect_opts[] = {
FW3_OPT("name", string, redirect, name),
FW3_OPT("family", family, redirect, family),
FW3_OPT("reflection", bool, redirect, reflection),
FW3_OPT("target", target, redirect, target),
+
+ { }
};
redir->reflection = true;
- fw3_parse_options(redir, redirect_opts, ARRAY_SIZE(redirect_opts), s);
+ fw3_parse_options(redir, fw3_redirect_opts, s);
if (redir->src.invert)
{
continue;
}
else if (redir->src.set && !redir->src.any &&
- !(redir->_src = fw3_lookup_zone(state, redir->src.name)))
+ !(redir->_src = fw3_lookup_zone(state, redir->src.name, false)))
{
warn_elem(e, "refers to not existing zone '%s'", redir->src.name);
fw3_free_redirect(redir);
continue;
}
else if (redir->dest.set && !redir->dest.any &&
- !(redir->_dest = fw3_lookup_zone(state, redir->dest.name)))
+ !(redir->_dest = fw3_lookup_zone(state, redir->dest.name, false)))
{
warn_elem(e, "refers to not existing zone '%s'", redir->dest.name);
fw3_free_redirect(redir);
continue;
}
else if (redir->ipset.set && !redir->ipset.any &&
- !(redir->_ipset = fw3_lookup_ipset(state, redir->ipset.name)))
+ !(redir->_ipset = fw3_lookup_ipset(state, redir->ipset.name, false)))
{
warn_elem(e, "refers to unknown ipset '%s'", redir->ipset.name);
fw3_free_redirect(redir);
list_for_each_entry(redir, &state->redirects, list)
print_redirect(table, family, redir, num++);
}
-
-void
-fw3_free_redirect(struct fw3_redirect *redir)
-{
- fw3_free_list(&redir->proto);
- fw3_free_list(&redir->mac_src);
- free(redir);
-}