}
void
-fw3_print_default_chains(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state)
+fw3_print_default_chains(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload)
{
bool rv;
struct fw3_defaults *defs = &state->defaults;
}
void
-fw3_print_default_head_rules(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state)
+fw3_print_default_head_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload)
{
int i;
struct fw3_defaults *defs = &state->defaults;
}
void
-fw3_print_default_tail_rules(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state)
+fw3_print_default_tail_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload)
{
struct fw3_defaults *defs = &state->defaults;
}
void
-fw3_flush_rules(enum fw3_table table, enum fw3_family family,
- bool pass2, bool reload, struct fw3_state *state)
+fw3_flush_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, bool pass2)
{
struct fw3_defaults *defs = &state->defaults;
uint32_t custom_mask = ~0;
void fw3_load_defaults(struct fw3_state *state, struct uci_package *p);
-void fw3_print_default_chains(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state);
+void fw3_print_default_chains(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload);
-void fw3_print_default_head_rules(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state);
+void fw3_print_default_head_rules(struct fw3_state *state,
+ enum fw3_family family, enum fw3_table table,
+ bool reload);
-void fw3_print_default_tail_rules(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state);
+void fw3_print_default_tail_rules(struct fw3_state *state,
+ enum fw3_family family, enum fw3_table table,
+ bool reload);
void fw3_set_defaults(struct fw3_state *state);
-void fw3_flush_rules(enum fw3_table table, enum fw3_family family,
- bool pass2, bool reload, struct fw3_state *state);
+void fw3_flush_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, bool pass2);
void fw3_flush_all(enum fw3_table table);
}
static void
-print_forward(enum fw3_table table, enum fw3_family family,
- struct fw3_forward *forward)
+print_forward(struct fw3_forward *forward, enum fw3_family family,
+ enum fw3_table table)
{
const char *s, *d;
}
void
-fw3_print_forwards(enum fw3_table table, enum fw3_family family,
- struct fw3_state *state)
+fw3_print_forwards(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table)
{
struct fw3_forward *forward;
list_for_each_entry(forward, &state->forwards, list)
- print_forward(table, family, forward);
+ print_forward(forward, family, table);
}
extern const struct fw3_option fw3_forward_opts[];
void fw3_load_forwards(struct fw3_state *state, struct uci_package *p);
-void fw3_print_forwards(enum fw3_table table, enum fw3_family family,
- struct fw3_state *state);
+void fw3_print_forwards(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table);
#define fw3_free_forward(forward) \
fw3_free_object(forward, fw3_forward_opts)
}
if (!print_rules)
- fw3_hotplug_zones(false, state);
+ fw3_hotplug_zones(state, false);
for (family = FW3_FAMILY_V4; family <= FW3_FAMILY_V6; family++)
{
else
{
/* pass 1 */
- fw3_flush_rules(table, family, false, reload, state);
- fw3_flush_zones(table, family, false, reload, state);
+ fw3_flush_rules(state, family, table, reload, false);
+ fw3_flush_zones(state, family, table, reload, false);
/* pass 2 */
- fw3_flush_rules(table, family, true, reload, state);
- fw3_flush_zones(table, family, true, reload, state);
+ fw3_flush_rules(state, family, table, reload, true);
+ fw3_flush_zones(state, family, table, reload, true);
}
fw3_pr("COMMIT\n");
fw3_flag_names[family], fw3_flag_names[table]);
fw3_pr("*%s\n", fw3_flag_names[table]);
- fw3_print_default_chains(table, family, reload, state);
- fw3_print_zone_chains(table, family, reload, state);
- fw3_print_default_head_rules(table, family, reload, state);
- fw3_print_rules(table, family, state);
- fw3_print_redirects(table, family, state);
- fw3_print_forwards(table, family, state);
- fw3_print_zone_rules(table, family, reload, state);
- fw3_print_default_tail_rules(table, family, reload, state);
+ fw3_print_default_chains(state, family, table, reload);
+ fw3_print_zone_chains(state, family, table, reload);
+ fw3_print_default_head_rules(state, family, table, reload);
+ fw3_print_rules(state, family, table);
+ fw3_print_redirects(state, family, table);
+ fw3_print_forwards(state, family, table);
+ fw3_print_zone_rules(state, family, table, reload);
+ fw3_print_default_tail_rules(state, family, table, reload);
fw3_pr("COMMIT\n");
}
if (!print_rules)
{
fw3_run_includes(state, reload);
- fw3_hotplug_zones(true, state);
+ fw3_hotplug_zones(state, true);
fw3_write_statefile(state);
}
}
}
static void
-print_redirect(enum fw3_table table, enum fw3_family family,
- struct fw3_redirect *redir, int num)
+print_redirect(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, struct fw3_redirect *redir, int num)
{
struct list_head *ext_addrs, *int_addrs;
struct fw3_address *ext_addr, *int_addr, ref_addr;
}
void
-fw3_print_redirects(enum fw3_table table, enum fw3_family family,
- struct fw3_state *state)
+fw3_print_redirects(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table)
{
int num = 0;
struct fw3_redirect *redir;
return;
list_for_each_entry(redir, &state->redirects, list)
- print_redirect(table, family, redir, num++);
+ print_redirect(state, family, table, redir, num++);
}
extern const struct fw3_option fw3_redirect_opts[];
void fw3_load_redirects(struct fw3_state *state, struct uci_package *p);
-void fw3_print_redirects(enum fw3_table table, enum fw3_family family,
- struct fw3_state *state);
+void fw3_print_redirects(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table);
#define fw3_free_redirect(redir) \
fw3_free_object(redir, fw3_redirect_opts)
}
static void
-print_rule(enum fw3_table table, enum fw3_family family,
- struct fw3_rule *rule, struct fw3_protocol *proto,
+print_rule(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, struct fw3_rule *rule,
+ struct fw3_protocol *proto,
struct fw3_address *sip, struct fw3_address *dip,
struct fw3_port *sport, struct fw3_port *dport,
struct fw3_mac *mac, struct fw3_icmptype *icmptype)
}
static void
-expand_rule(enum fw3_table table, enum fw3_family family,
- struct fw3_rule *rule, int num)
+expand_rule(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, struct fw3_rule *rule, int num)
{
struct fw3_protocol *proto;
struct fw3_address *sip;
fw3_foreach(dport, dports)
fw3_foreach(mac, &rule->mac_src)
fw3_foreach(icmptype, icmptypes)
- print_rule(table, family, rule, proto, sip, dip, sport, dport,
- mac, icmptype);
+ print_rule(state, family, table, rule, proto, sip, dip,
+ sport, dport, mac, icmptype);
}
}
void
-fw3_print_rules(enum fw3_table table, enum fw3_family family,
- struct fw3_state *state)
+fw3_print_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table)
{
int num = 0;
struct fw3_rule *rule;
list_for_each_entry(rule, &state->rules, list)
- expand_rule(table, family, rule, num++);
+ expand_rule(state, family, table, rule, num++);
}
extern const struct fw3_option fw3_rule_opts[];
void fw3_load_rules(struct fw3_state *state, struct uci_package *p);
-void fw3_print_rules(enum fw3_table table, enum fw3_family family,
- struct fw3_state *state);
+void fw3_print_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table);
#define fw3_free_rule(rule) \
fw3_free_object(rule, fw3_rule_opts)
static void
-print_zone_chain(enum fw3_table table, enum fw3_family family,
- struct fw3_zone *zone, bool reload, struct fw3_state *state)
+print_zone_chain(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, struct fw3_zone *zone)
{
bool c, r;
uint32_t custom_mask = ~0;
}
static void
-print_interface_rule(enum fw3_table table, enum fw3_family family,
- struct fw3_zone *zone, struct fw3_device *dev,
- struct fw3_address *sub, bool reload, bool disable_notrack)
+print_interface_rule(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, struct fw3_zone *zone,
+ struct fw3_device *dev, struct fw3_address *sub)
{
+ bool disable_notrack = state->defaults.drop_invalid;
+
enum fw3_flag t;
#define jump_target(t) \
}
static void
-print_interface_rules(enum fw3_table table, enum fw3_family family,
- struct fw3_zone *zone, bool reload, bool disable_notrack)
+print_interface_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, struct fw3_zone *zone)
{
struct fw3_device *dev;
struct fw3_address *sub;
if (!dev && !sub)
continue;
- print_interface_rule(table, family, zone, dev, sub, reload, disable_notrack);
+ print_interface_rule(state, family, table, reload, zone, dev, sub);
}
}
static void
-print_zone_rule(enum fw3_table table, enum fw3_family family,
- struct fw3_zone *zone, bool reload, bool disable_notrack)
+print_zone_rule(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, struct fw3_zone *zone)
{
struct fw3_address *msrc;
struct fw3_address *mdest;
break;
}
- print_interface_rules(table, family, zone, reload, disable_notrack);
+ print_interface_rules(state, family, table, reload, zone);
}
void
-fw3_print_zone_chains(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state)
+fw3_print_zone_chains(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload)
{
struct fw3_zone *zone;
list_for_each_entry(zone, &state->zones, list)
- print_zone_chain(table, family, zone, reload, state);
+ print_zone_chain(state, family, table, reload, zone);
}
void
-fw3_print_zone_rules(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state)
+fw3_print_zone_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload)
{
struct fw3_zone *zone;
list_for_each_entry(zone, &state->zones, list)
- print_zone_rule(table, family, zone, reload, state->defaults.drop_invalid);
+ print_zone_rule(state, family, table, reload, zone);
}
void
-fw3_flush_zones(enum fw3_table table, enum fw3_family family,
- bool pass2, bool reload, struct fw3_state *state)
+fw3_flush_zones(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, bool pass2)
{
struct fw3_zone *z, *tmp;
uint32_t custom_mask = ~0;
pass2 ? "-X %s\n" : "-F %s\n", z->name);
if (pass2)
- {
del(z->flags, family, table);
- }
}
}
void
-fw3_hotplug_zones(bool add, struct fw3_state *state)
+fw3_hotplug_zones(struct fw3_state *state, bool add)
{
struct fw3_zone *z;
struct fw3_device *d;
void fw3_load_zones(struct fw3_state *state, struct uci_package *p);
-void fw3_print_zone_chains(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state);
+void fw3_print_zone_chains(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload);
-void fw3_print_zone_rules(enum fw3_table table, enum fw3_family family,
- bool reload, struct fw3_state *state);
+void fw3_print_zone_rules(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload);
-void fw3_flush_zones(enum fw3_table table, enum fw3_family family,
- bool pass2, bool reload, struct fw3_state *state);
+void fw3_flush_zones(struct fw3_state *state, enum fw3_family family,
+ enum fw3_table table, bool reload, bool pass2);
-void fw3_hotplug_zones(bool add, struct fw3_state *state);
+void fw3_hotplug_zones(struct fw3_state *state, bool add);
struct fw3_zone * fw3_lookup_zone(struct fw3_state *state, const char *name,
bool running);