projects
/
project
/
firewall3.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1ccbcc2
)
convert remaining occurences to hasbit() / setbit() helper macros
author
Jo-Philipp Wich
<jow@openwrt.org>
Tue, 19 Feb 2013 18:07:13 +0000
(19:07 +0100)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Tue, 19 Feb 2013 18:07:13 +0000
(19:07 +0100)
defaults.c
patch
|
blob
|
history
zones.c
patch
|
blob
|
history
diff --git
a/defaults.c
b/defaults.c
index
886da2f
..
d59c5bf
100644
(file)
--- a/
defaults.c
+++ b/
defaults.c
@@
-101,7
+101,7
@@
print_chains(enum fw3_table table, enum fw3_family family,
if (c->table != table)
continue;
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);
continue;
fw3_pr(fmt, c->name);
@@
-142,7
+142,7
@@
fw3_load_defaults(struct fw3_state *state, struct uci_package *p)
defs->tcp_window_scaling = true;
defs->custom_chains = true;
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)
{
uci_foreach_element(&p->sections, e)
{
diff --git
a/zones.c
b/zones.c
index
584ebca
..
3195a32
100644
(file)
--- a/
zones.c
+++ b/
zones.c
@@
-96,7
+96,7
@@
print_chains(enum fw3_table table, enum fw3_family family,
if (c->table != table)
continue;
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);
continue;
snprintf(cn, sizeof(cn), c->name, name);
@@
-253,7
+253,7
@@
print_interface_rule(enum fw3_table table, enum fw3_family family,
{
for (t = FW3_TARGET_ACCEPT; t <= FW3_TARGET_DROP; t++)
{
{
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("-A zone_%s_src_%s", zone->name, targets[t*2]);
fw3_format_in_out(dev, NULL);
@@
-262,7
+262,7
@@
print_interface_rule(enum fw3_table table, enum fw3_family family,
fw3_pr(" -j %s\n", targets[t*2+1]);
}
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);
{
fw3_pr("-A zone_%s_dest_%s", zone->name, targets[t*2]);
fw3_format_in_out(NULL, dev);
@@
-292,7
+292,7
@@
print_interface_rule(enum fw3_table table, enum fw3_family family,
}
else if (table == FW3_TABLE_NAT)
{
}
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("-A delegate_prerouting");
fw3_format_in_out(dev, NULL);
@@
-301,7
+301,7
@@
print_interface_rule(enum fw3_table table, enum fw3_family family,
fw3_pr(" -j zone_%s_prerouting\n", zone->name);
}
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);
{
fw3_pr("-A delegate_postrouting");
fw3_format_in_out(NULL, dev);
@@
-404,7
+404,7
@@
print_zone_rule(enum fw3_table table, enum fw3_family family,
{
for (t = FW3_TARGET_REJECT; t <= FW3_TARGET_DROP; t++)
{
{
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);
{
fw3_pr("-A zone_%s_src_%s", zone->name, targets[t]);
fw3_format_limit(&zone->log_limit);
@@
-412,7
+412,7
@@
print_zone_rule(enum fw3_table table, enum fw3_family family,
targets[t], zone->name);
}
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);
{
fw3_pr("-A zone_%s_dest_%s", zone->name, targets[t]);
fw3_format_limit(&zone->log_limit);