[OpenWrt-Devel] [PATCH firewall3] iptables: fix loading standard target

Ralph Sennhauser ralph.sennhauser at gmail.com
Sat Nov 5 12:40:38 EDT 2016


In case iptables is built with --disable-static xt_standard needs to be
loaded just like the other extensions.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser at gmail.com>
---
 iptables.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/iptables.c b/iptables.c
index 95fc0d4..bbd2b00 100644
--- a/iptables.c
+++ b/iptables.c
@@ -630,8 +630,15 @@ find_target(struct fw3_ipt_rule *r, const char *name)
 {
 	struct xtables_target *t;
 
-	if (is_chain(r->h, name))
-		return xtables_find_target(XT_STANDARD_TARGET, XTF_LOAD_MUST_SUCCEED);
+	if (is_chain(r->h, name)) {
+		t = xtables_find_target(XT_STANDARD_TARGET, XTF_DONT_LOAD);
+		if (t) {
+			return t;
+		} else {
+			load_extension(r->h, "standard");
+			return xtables_find_target(XT_STANDARD_TARGET, XTF_LOAD_MUST_SUCCEED);
+		}
+	}
 
 	t = xtables_find_target(name, XTF_DONT_LOAD);
 
-- 
2.7.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list