]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: allow for parse-less extensions
authorJan Engelhardt <jengelh@medozas.de>
Fri, 12 Jun 2009 18:35:42 +0000 (20:35 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Fri, 26 Jun 2009 19:13:09 +0000 (21:13 +0200)
This means we can do some code removal in extensions.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
ip6tables.c
iptables.c

index 31c4b451a42e2b084e9b1171a4694a301639a7d0..71ff46f5bc5b095719f9c26a933a31789b1c0b73 100644 (file)
@@ -1699,13 +1699,14 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand
                        exit_tryhelp(2);
 
                default:
-                       if (!target
-                           || !(target->parse(c - target->option_offset,
+                       if (target == NULL || target->parse == NULL ||
+                           !target->parse(c - target->option_offset,
                                               argv, invert,
                                               &target->tflags,
-                                              &fw, &target->t))) {
+                                              &fw, &target->t)) {
                                for (matchp = matches; matchp; matchp = matchp->next) {
-                                       if (matchp->completed)
+                                       if (matchp->completed ||
+                                           matchp->match->parse == NULL)
                                                continue;
                                        if (matchp->match->parse(c - matchp->match->option_offset,
                                                     argv, invert,
index 7c075daceb6e1e47fb35a99b699c927b4173ba28..cc17576732a672e4c97e117ae002ca57c333c319 100644 (file)
@@ -1727,13 +1727,14 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
                        exit_tryhelp(2);
 
                default:
-                       if (!target
-                           || !(target->parse(c - target->option_offset,
+                       if (target == NULL || target->parse == NULL ||
+                           !target->parse(c - target->option_offset,
                                               argv, invert,
                                               &target->tflags,
-                                              &fw, &target->t))) {
+                                              &fw, &target->t)) {
                                for (matchp = matches; matchp; matchp = matchp->next) {
-                                       if (matchp->completed)
+                                       if (matchp->completed ||
+                                           matchp->match->parse == NULL)
                                                continue;
                                        if (matchp->match->parse(c - matchp->match->option_offset,
                                                     argv, invert,