projects
/
project
/
firewall3.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce fw3_no_family() helper macro and use it
[project/firewall3.git]
/
forwards.c
diff --git
a/forwards.c
b/forwards.c
index
9f658fc
..
babf5e8
100644
(file)
--- a/
forwards.c
+++ b/
forwards.c
@@
-20,6
+20,8
@@
const struct fw3_option fw3_forward_opts[] = {
const struct fw3_option fw3_forward_opts[] = {
+ FW3_OPT("enabled", bool, forward, enabled),
+
FW3_OPT("name", string, forward, name),
FW3_OPT("family", family, forward, family),
FW3_OPT("name", string, forward, name),
FW3_OPT("family", family, forward, family),
@@
-53,8
+55,16
@@
fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
memset(forward, 0, sizeof(*forward));
memset(forward, 0, sizeof(*forward));
+ forward->enabled = true;
+
fw3_parse_options(forward, fw3_forward_opts, s);
fw3_parse_options(forward, fw3_forward_opts, s);
+ if (!forward->enabled)
+ {
+ fw3_free_forward(forward);
+ continue;
+ }
+
if (forward->src.invert || forward->dest.invert)
{
warn_elem(e, "must not have inverted 'src' or 'dest' options");
if (forward->src.invert || forward->dest.invert)
{
warn_elem(e, "must not have inverted 'src' or 'dest' options");
@@
-78,7
+88,7
@@
fw3_load_forwards(struct fw3_state *state, struct uci_package *p)
if (forward->_dest)
{
if (forward->_dest)
{
- setbit(forward->_dest->
dst_
flags, FW3_TARGET_ACCEPT);
+ setbit(forward->_dest->flags, FW3_TARGET_ACCEPT);
if (forward->_src &&
(forward->_src->conntrack || forward->_dest->conntrack))
if (forward->_src &&
(forward->_src->conntrack || forward->_dest->conntrack))
@@
-125,10
+135,7
@@
print_forward(enum fw3_table table, enum fw3_family family,
s = forward->_src ? forward->_src->name : "*";
d = forward->_dest ? forward->_dest->name : "*";
s = forward->_src ? forward->_src->name : "*";
d = forward->_dest ? forward->_dest->name : "*";
- if (forward->name)
- info(" * Forward '%s'", forward->name);
- else
- info(" * Forward %s->%s", s, d);
+ info(" * Forward '%s' -> '%s'", s, d);
if (!fw3_is_family(forward->_src, family) ||
!fw3_is_family(forward->_dest, family))
if (!fw3_is_family(forward->_src, family) ||
!fw3_is_family(forward->_dest, family))