---
 src/iptables.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/iptables.c b/src/iptables.c
index ca4681f..e74d957 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1465,10 +1465,18 @@ static int iptables_command(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':
@@ -1575,16 +1583,9 @@ static int iptables_command(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 == TRUE) {
                        DBG("Deleting %s to %s (match %s)\n",
                                        target_name, chain, match_name);
-- 
1.7.7

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to