static bool
print_chains(enum fw3_table table, enum fw3_family family,
- const char *fmt, const char *name, uint8_t targets,
+ const char *fmt, const char *name, uint16_t targets,
const struct chain *chains, int n)
{
bool rv = false;
if (c->table != table)
continue;
- if ((c->target != FW3_TARGET_UNSPEC) && !(targets & (1 << c->target)))
+ if ((c->target != FW3_TARGET_UNSPEC) && !hasbit(targets, c->target))
continue;
snprintf(cn, sizeof(cn), c->name, name);
if (zone->masq)
{
- zone->has_dest_target |= (1 << FW3_TARGET_SNAT);
+ setbit(zone->dst_flags, FW3_TARGET_SNAT);
zone->conntrack = true;
}
- zone->has_src_target |= (1 << zone->policy_input);
- zone->has_dest_target |= (1 << zone->policy_output);
- zone->has_dest_target |= (1 << zone->policy_forward);
+ setbit(zone->src_flags, zone->policy_input);
+ setbit(zone->dst_flags, zone->policy_output);
+ setbit(zone->dst_flags, zone->policy_forward);
list_add_tail(&zone->list, &state->zones);
}
return;
if (!zone->conntrack && !disable_notrack)
- zone->has_dest_target |= (1 << FW3_TARGET_NOTRACK);
+ setbit(zone->dst_flags, FW3_TARGET_NOTRACK);
s = print_chains(table, family, ":%s - [0:0]\n", zone->name,
- zone->has_src_target, src_chains, ARRAY_SIZE(src_chains));
+ zone->src_flags, src_chains, ARRAY_SIZE(src_chains));
d = print_chains(table, family, ":%s - [0:0]\n", zone->name,
- zone->has_dest_target, dst_chains, ARRAY_SIZE(dst_chains));
+ zone->dst_flags, dst_chains, ARRAY_SIZE(dst_chains));
if (s || d)
info(" * Zone '%s'", zone->name);
{
for (t = FW3_TARGET_ACCEPT; t <= FW3_TARGET_DROP; t++)
{
- if (zone->has_src_target & (1 << t))
+ if (hasbit(zone->src_flags, t))
{
fw3_pr("-A zone_%s_src_%s", zone->name, targets[t*2]);
fw3_format_in_out(dev, NULL);
fw3_pr(" -j %s\n", targets[t*2+1]);
}
- if (zone->has_dest_target & (1 << t))
+ if (hasbit(zone->dst_flags, t))
{
fw3_pr("-A zone_%s_dest_%s", zone->name, targets[t*2]);
fw3_format_in_out(NULL, dev);
}
else if (table == FW3_TABLE_NAT)
{
- if (zone->has_dest_target & (1 << FW3_TARGET_DNAT))
+ if (hasbit(zone->dst_flags, FW3_TARGET_DNAT))
{
fw3_pr("-A delegate_prerouting");
fw3_format_in_out(dev, NULL);
fw3_pr(" -j zone_%s_prerouting\n", zone->name);
}
- if (zone->has_dest_target & (1 << FW3_TARGET_SNAT))
+ if (hasbit(zone->dst_flags, FW3_TARGET_SNAT))
{
fw3_pr("-A delegate_postrouting");
fw3_format_in_out(NULL, dev);
{
for (t = FW3_TARGET_REJECT; t <= FW3_TARGET_DROP; t++)
{
- if (zone->has_src_target & (1 << t))
+ if (hasbit(zone->src_flags, t))
{
fw3_pr("-A zone_%s_src_%s", zone->name, targets[t]);
fw3_format_limit(&zone->log_limit);
targets[t], zone->name);
}
- if (zone->has_dest_target & (1 << t))
+ if (hasbit(zone->dst_flags, t))
{
fw3_pr("-A zone_%s_dest_%s", zone->name, targets[t]);
fw3_format_limit(&zone->log_limit);