Increase compatibility to old firewall by initializing protocol of rules and redirect...
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 22 Mar 2013 15:27:34 +0000 (16:27 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 22 Mar 2013 15:27:34 +0000 (16:27 +0100)
redirects.c
rules.c

index 4e4f5b215b12b92aebbf4a99c8dd4f4dd4a47356..7817e9b628ff7ca12e94a3b1d346a1f99931aff9 100644 (file)
@@ -237,6 +237,12 @@ fw3_load_redirects(struct fw3_state *state, struct uci_package *p)
                        }
                }
 
+               if (list_empty(&redir->proto))
+               {
+                       warn_elem(e, "does not specify a protocol, assuming TCP+UDP");
+                       fw3_parse_protocol(&redir->proto, "tcpudp", true);
+               }
+
                if (!valid)
                {
                        fw3_free_redirect(redir);
diff --git a/rules.c b/rules.c
index e6af62e4d9d87452bccda1f4bc4ea8e11b99befa..1037d2f92be7afd3cce5a5bdc8473de230c97eff 100644 (file)
--- a/rules.c
+++ b/rules.c
@@ -150,6 +150,12 @@ fw3_load_rules(struct fw3_state *state, struct uci_package *p)
                                     "- assuming an output rule");
                }
 
+               if (list_empty(&rule->proto))
+               {
+                       warn_elem(e, "does not specify a protocol, assuming TCP+UDP");
+                       fw3_parse_protocol(&rule->proto, "tcpudp", true);
+               }
+
                if (rule->target == FW3_FLAG_UNSPEC)
                {
                        warn_elem(e, "has no target specified, defaulting to REJECT");