+static void
+resolve_cthelpers(struct fw3_state *s, struct uci_element *e, struct fw3_zone *zone)
+{
+ struct fw3_cthelpermatch *match;
+
+ if (list_empty(&zone->cthelpers))
+ {
+ if (!zone->masq && zone->auto_helper)
+ {
+ fw3_setbit(zone->flags[0], FW3_FLAG_HELPER);
+ fw3_setbit(zone->flags[1], FW3_FLAG_HELPER);
+ }
+
+ return;
+ }
+
+ list_for_each_entry(match, &zone->cthelpers, list)
+ {
+ if (match->invert)
+ {
+ warn_elem(e, "must not use a negated helper match");
+ continue;
+ }
+
+ match->ptr = fw3_lookup_cthelper(s, match->name);
+
+ if (!match->ptr)
+ {
+ warn_elem(e, "refers to not existing helper '%s'", match->name);
+ continue;
+ }
+
+ if (fw3_is_family(match->ptr, FW3_FAMILY_V4))
+ fw3_setbit(zone->flags[0], FW3_FLAG_HELPER);
+
+ if (fw3_is_family(match->ptr, FW3_FAMILY_V6))
+ fw3_setbit(zone->flags[1], FW3_FLAG_HELPER);
+ }
+}
+