print a notification if forwards are skipped due to zone family mismatch
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 19 Feb 2013 22:53:21 +0000 (23:53 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 19 Feb 2013 23:03:17 +0000 (00:03 +0100)
forwards.c
zones.c

index e653356054d2a7616cd8810c4e367a6166f4c2cc..1715abc62c5285d0bf8e11c00506c08d8fc77f7c 100644 (file)
@@ -117,9 +117,7 @@ print_forward(enum fw3_table table, enum fw3_family family,
        if (table != FW3_TABLE_FILTER)
                return;
 
-       if (!fw3_is_family(forward, family) ||
-           (forward->_src && !fw3_is_family(forward->_src, family)) ||
-               (forward->_dest && !fw3_is_family(forward->_dest, family)))
+       if (!fw3_is_family(forward, family))
                return;
 
        s = forward->_src  ? forward->_src->name  : "*";
@@ -130,6 +128,13 @@ print_forward(enum fw3_table table, enum fw3_family family,
        else
                info("   * Forward %s->%s", s, d);
 
+       if (!fw3_is_family(forward->_src, family) ||
+           !fw3_is_family(forward->_dest, family))
+       {
+               info("     ! Skipping due to different family of zone");
+               return;
+       }
+
        print_chain(forward);
        fw3_format_comment("forwarding ", s, "->", d);
        print_target(forward);
diff --git a/zones.c b/zones.c
index 62d9e369d00b93c89af42837789588e141155c78..edd875ad8b1ee7f5131524f304f282bd9728eb0c 100644 (file)
--- a/zones.c
+++ b/zones.c
@@ -53,6 +53,7 @@ static const struct chain dst_chains[] = {
 
 static struct fw3_option zone_opts[] = {
        FW3_OPT("name",                string,   zone,     name),
+       FW3_OPT("family",              family,   zone,     family),
 
        FW3_LIST("network",            device,   zone,     networks),
        FW3_LIST("device",             device,   zone,     devices),