iptables: fix loading standard target
authorRalph Sennhauser <ralph.sennhauser@gmail.com>
Sat, 5 Nov 2016 16:40:38 +0000 (17:40 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sat, 5 Nov 2016 16:56:14 +0000 (17:56 +0100)
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@gmail.com>
[Jo-Philipp Wich: minor code style change to if/return instead of if/else]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
iptables.c

index 95fc0d45835d565217d8caad63dc4486a92c426b..fc22d1aae7bcb2e7ca763ab53a19d6b1eb42eff7 100644 (file)
@@ -630,8 +630,15 @@ find_target(struct fw3_ipt_rule *r, const char *name)
 {
        struct xtables_target *t;
 
-       if (is_chain(r->h, name))
+       if (is_chain(r->h, name)) {
+               t = xtables_find_target(XT_STANDARD_TARGET, XTF_DONT_LOAD);
+
+               if (t)
+                       return t;
+
+               load_extension(r->h, "standard");
                return xtables_find_target(XT_STANDARD_TARGET, XTF_LOAD_MUST_SUCCEED);
+       }
 
        t = xtables_find_target(name, XTF_DONT_LOAD);