- if (redir->target == FW3_FLAG_UNSPEC)
- {
- warn_elem(e, "has no target specified, defaulting to DNAT");
- redir->target = FW3_FLAG_DNAT;
- }
- else if (redir->target < FW3_FLAG_DNAT)
- {
- warn_elem(e, "has invalid target specified, defaulting to DNAT");
- redir->target = FW3_FLAG_DNAT;
- }
+ if (!redir->enabled)
+ return false;
+
+ if (redir->src.invert)
+ {
+ warn_section("redirect", redir, e, "must not have an inverted source");
+ return false;
+ }
+ else if (redir->src.set && !redir->src.any &&
+ !(redir->_src = fw3_lookup_zone(state, redir->src.name)))
+ {
+ warn_section("redirect", redir, e, "refers to not existing zone '%s'",
+ redir->src.name);
+ return false;
+ }
+ else if (redir->dest.set && !redir->dest.any &&
+ !(redir->_dest = fw3_lookup_zone(state, redir->dest.name)))
+ {
+ warn_section("redirect", redir, e, "refers to not existing zone '%s'",
+ redir->dest.name);
+ return false;
+ }
+ else if (redir->ipset.set && state->disable_ipsets)
+ {
+ warn_section("redirect", redir, e, "skipped due to disabled ipset support");
+ return false;
+ }
+ else if (redir->ipset.set &&
+ !(redir->ipset.ptr = fw3_lookup_ipset(state, redir->ipset.name)))
+ {
+ warn_section("redirect", redir, e, "refers to unknown ipset '%s'",
+ redir->ipset.name);
+ return false;
+ }
+ else if (redir->helper.set &&
+ !(redir->helper.ptr = fw3_lookup_cthelper(state, redir->helper.name)))
+ {
+ warn_section("redirect", redir, e, "refers to unknown CT helper '%s'",
+ redir->helper.name);
+ return false;
+ }
+
+ if (!check_families(e, redir))
+ return false;