continue;
if (c->flag &&
- !hasbit(defs->flags[handle->family == FW3_FAMILY_V6], c->flag))
+ !fw3_hasbit(defs->flags[handle->family == FW3_FAMILY_V6], c->flag))
continue;
fw3_ipt_create_chain(handle, c->format);
/* NB: forward family... */
if (forward->_dest)
{
- setbit(forward->_dest->flags[0], FW3_FLAG_ACCEPT);
- setbit(forward->_dest->flags[1], FW3_FLAG_ACCEPT);
+ fw3_setbit(forward->_dest->flags[0], FW3_FLAG_ACCEPT);
+ fw3_setbit(forward->_dest->flags[1], FW3_FLAG_ACCEPT);
if (forward->_src &&
(forward->_src->conntrack || forward->_dest->conntrack))
{
for (i = 1, p = buf; i < 32; i++)
{
- if (hasbit(time->monthdays, i))
+ if (fw3_hasbit(time->monthdays, i))
{
if (p > buf)
*p++ = ',';
}
}
- fw3_ipt_rule_addarg(r, hasbit(time->monthdays, 0), "--monthdays", buf);
+ fw3_ipt_rule_addarg(r, fw3_hasbit(time->monthdays, 0), "--monthdays", buf);
}
if (time->weekdays & 0xFE)
{
for (i = 1, p = buf; i < 8; i++)
{
- if (hasbit(time->weekdays, i))
+ if (fw3_hasbit(time->weekdays, i))
{
if (p > buf)
*p++ = ',';
}
}
- fw3_ipt_rule_addarg(r, hasbit(time->weekdays, 0), "--weekdays", buf);
+ fw3_ipt_rule_addarg(r, fw3_hasbit(time->weekdays, 0), "--weekdays", buf);
}
}
if (*val == '!')
{
- setbit(*(uint8_t *)ptr, 0);
+ fw3_setbit(*(uint8_t *)ptr, 0);
while (isspace(*++val));
}
}
}
- setbit(*(uint8_t *)ptr, w);
+ fw3_setbit(*(uint8_t *)ptr, w);
}
free(s);
if (*val == '!')
{
- setbit(*(uint32_t *)ptr, 0);
+ fw3_setbit(*(uint32_t *)ptr, 0);
while (isspace(*++val));
}
return false;
}
- setbit(*(uint32_t *)ptr, d);
+ fw3_setbit(*(uint32_t *)ptr, d);
}
free(s);
/* NB: rule family... */
if (rule->_dest)
{
- setbit(rule->_dest->flags[0], rule->target);
- setbit(rule->_dest->flags[1], rule->target);
+ fw3_setbit(rule->_dest->flags[0], rule->target);
+ fw3_setbit(rule->_dest->flags[1], rule->target);
}
else if (need_src_action_chain(rule))
{
- setbit(rule->_src->flags[0], fw3_to_src_target(rule->target));
- setbit(rule->_src->flags[1], fw3_to_src_target(rule->target));
+ fw3_setbit(rule->_src->flags[0], fw3_to_src_target(rule->target));
+ fw3_setbit(rule->_src->flags[1], fw3_to_src_target(rule->target));
}
}
}
void error(const char *format, ...);
void info(const char *format, ...);
-#define setbit(field, flag) field |= (1 << (flag))
-#define delbit(field, flag) field &= ~(1 << (flag))
-#define hasbit(field, flag) (field & (1 << (flag)))
+#define fw3_setbit(field, flag) field |= (1 << (flag))
+#define fw3_delbit(field, flag) field &= ~(1 << (flag))
+#define fw3_hasbit(field, flag) (field & (1 << (flag)))
-#define set(field, family, flag) setbit(field[family == FW3_FAMILY_V6], flag)
-#define del(field, family, flag) delbit(field[family == FW3_FAMILY_V6], flag)
-#define has(field, family, flag) hasbit(field[family == FW3_FAMILY_V6], flag)
+#define set(field, family, flag) fw3_setbit(field[family == FW3_FAMILY_V6], flag)
+#define del(field, family, flag) fw3_delbit(field[family == FW3_FAMILY_V6], flag)
+#define has(field, family, flag) fw3_hasbit(field[family == FW3_FAMILY_V6], flag)
#define fw3_foreach(p, h) \
for (p = list_empty(h) ? NULL : list_first_entry(h, typeof(*p), list); \
if (zone->masq)
{
- setbit(zone->flags[0], FW3_FLAG_SNAT);
+ fw3_setbit(zone->flags[0], FW3_FLAG_SNAT);
zone->conntrack = true;
}
if (zone->custom_chains)
{
- setbit(zone->flags[0], FW3_FLAG_SNAT);
- setbit(zone->flags[0], FW3_FLAG_DNAT);
+ fw3_setbit(zone->flags[0], FW3_FLAG_SNAT);
+ fw3_setbit(zone->flags[0], FW3_FLAG_DNAT);
}
- setbit(zone->flags[0], fw3_to_src_target(zone->policy_input));
- setbit(zone->flags[0], zone->policy_forward);
- setbit(zone->flags[0], zone->policy_output);
+ fw3_setbit(zone->flags[0], fw3_to_src_target(zone->policy_input));
+ fw3_setbit(zone->flags[0], zone->policy_forward);
+ fw3_setbit(zone->flags[0], zone->policy_output);
- setbit(zone->flags[1], fw3_to_src_target(zone->policy_input));
- setbit(zone->flags[1], zone->policy_forward);
- setbit(zone->flags[1], zone->policy_output);
+ fw3_setbit(zone->flags[1], fw3_to_src_target(zone->policy_input));
+ fw3_setbit(zone->flags[1], zone->policy_forward);
+ fw3_setbit(zone->flags[1], zone->policy_output);
list_add_tail(&zone->list, &state->zones);
}
continue;
if (c->flag &&
- !hasbit(zone->flags[handle->family == FW3_FAMILY_V6], c->flag))
+ !fw3_hasbit(zone->flags[handle->family == FW3_FAMILY_V6], c->flag))
continue;
fw3_ipt_create_chain(handle, c->format, zone->name);
list_for_each_entry(z, &state->zones, list)
{
- if (add != hasbit(z->flags[0], FW3_FLAG_HOTPLUG))
+ if (add != fw3_hasbit(z->flags[0], FW3_FLAG_HOTPLUG))
{
list_for_each_entry(d, &z->devices, list)
fw3_hotplug(add, z, d);
if (add)
- setbit(z->flags[0], FW3_FLAG_HOTPLUG);
+ fw3_setbit(z->flags[0], FW3_FLAG_HOTPLUG);
else
- delbit(z->flags[0], FW3_FLAG_HOTPLUG);
+ fw3_delbit(z->flags[0], FW3_FLAG_HOTPLUG);
}
}
}