if (c->table != table)
continue;
- if ((c->flag != FW3_DEFAULT_UNSPEC) && !(flags & (1 << c->flag)))
+ if ((c->flag != FW3_DEFAULT_UNSPEC) && !hasbit(flags, c->flag))
continue;
fw3_pr(fmt, c->name);
defs->tcp_window_scaling = true;
defs->custom_chains = true;
- defs->flags = (1 << FW3_DEFAULT_IPV4_LOADED);
+ setbit(defs->flags, FW3_DEFAULT_IPV4_LOADED);
uci_foreach_element(&p->sections, e)
{
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);
{
for (t = FW3_TARGET_ACCEPT; t <= FW3_TARGET_DROP; t++)
{
- if (zone->src_flags & (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->dst_flags & (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->dst_flags & (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->dst_flags & (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->src_flags & (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->dst_flags & (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);