tools: Target and matches preparation function moves in iptables_test
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 27 Oct 2011 07:24:49 +0000 (10:24 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 28 Oct 2011 19:26:12 +0000 (21:26 +0200)
tools/iptables-test.c

index 6551904..eb7a164 100644 (file)
@@ -1450,10 +1450,18 @@ int main(int argc, char *argv[])
 
                case 'j':
                        target_name = optarg;
+                       xt_t = prepare_target(table, target_name);
+                       if (xt_t == NULL)
+                               goto out;
+
                        break;
 
                case 'm':
                        match_name = optarg;
+                       xt_m = prepare_matches(table, &xt_rm, match_name);
+                       if (xt_m == NULL)
+                               goto out;
+
                        break;
 
                case 'o':
@@ -1559,16 +1567,6 @@ int main(int argc, char *argv[])
        }
 
        if (chain) {
-               xt_t = prepare_target(table, target_name);
-               if (xt_t == NULL)
-                       goto out;
-
-               if (match_name != NULL) {
-                       xt_m = prepare_matches(table, &xt_rm, match_name);
-                       if (xt_m == NULL)
-                               goto out;
-               }
-
                if (delete_rule == TRUE) {
                        printf("Deleting %s to %s (match %s)\n", target_name,
                                        chain, match_name);