]> xenbits.xensource.com Git - libvirt.git/commitdiff
now that we only use built-in iptables chains, we don't
authorMark McLoughlin <markmc@redhat.com>
Thu, 10 Jan 2008 13:58:59 +0000 (13:58 +0000)
committerMark McLoughlin <markmc@redhat.com>
Thu, 10 Jan 2008 13:58:59 +0000 (13:58 +0000)
need to add or delete them

ChangeLog
src/iptables.c

index 3b7067471e647305521c07feed6b93ad0ca2b298..fe941de7960188058db93a099dceb285a04244b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jan 10 13:57:56 GMT 2008 Mark McLoughlin <markmc@redhat.com>
+
+       * src/iptables.c: now that we only use built-in iptables
+       chains, we don't need to add or delete them
+
 Thu Jan 10 13:56:33 GMT 2008 Mark McLoughlin <markmc@redhat.com>
 
        Like --with-iptables-prefix, --with-iptables-dir is no
index c865cd49eda493f572e408c1a51a2fb6d42dbf17..14153e522c665fddd9a0401dd17d64efe51f2a41 100644 (file)
@@ -395,53 +395,6 @@ iptRulesNew(const char *table,
     return NULL;
 }
 
-static int
-iptablesAddRemoveChain(iptRules *rules, int action)
-{
-    char **argv;
-    int retval = ENOMEM;
-    int n, status;
-
-    n = 1 + /* /sbin/iptables    */
-        2 + /*   --table foo     */
-        2;  /*   --new-chain bar */
-
-    if (!(argv = calloc(n + 1, sizeof(*argv))))
-        goto error;
-
-    n = 0;
-
-    if (!(argv[n++] = strdup(IPTABLES_PATH)))
-        goto error;
-
-    if (!(argv[n++] = strdup("--table")))
-        goto error;
-
-    if (!(argv[n++] = strdup(rules->table)))
-        goto error;
-
-    if (!(argv[n++] = strdup(action == ADD ? "--new-chain" : "--delete-chain")))
-        goto error;
-
-    if (!(argv[n++] = strdup(rules->chain)))
-        goto error;
-
-    if (virRun(NULL, argv, &status) < 0)
-        retval = errno;
-
-    retval = 0;
-
- error:
-    if (argv) {
-        n = 0;
-        while (argv[n])
-            free(argv[n++]);
-        free(argv);
-    }
-
-    return retval;
-}
-
 static char *
 argvToString(char **argv)
 {
@@ -530,19 +483,11 @@ iptablesAddRemoveRule(iptRules *rules, int action, const char *arg, ...)
             goto error;
     }
 
-    if (action == ADD &&
-        (retval = iptablesAddRemoveChain(rules, action)))
-        goto error;
-
     if (virRun(NULL, argv, NULL) < 0) {
         retval = errno;
         goto error;
     }
 
-    if (action == REMOVE &&
-        (retval = iptablesAddRemoveChain(rules, action)))
-        goto error;
-
     if (action == ADD) {
         retval = iptRulesAppend(rules, rule, argv, command_idx);
         rule = NULL;
@@ -634,11 +579,6 @@ iptRulesReload(iptRules *rules)
         rule->argv[rule->command_idx] = orig;
     }
 
-    if ((retval = iptablesAddRemoveChain(rules, REMOVE)) ||
-        (retval = iptablesAddRemoveChain(rules, ADD)))
-        qemudLog(QEMUD_WARN, "Failed to re-create chain '%s' in table '%s': %s",
-                 rules->chain, rules->table, strerror(retval));
-
     for (i = 0; i < rules->nrules; i++)
         if (virRun(NULL, rules->rules[i].argv, NULL) < 0)
             qemudLog(QEMUD_WARN, "Failed to add iptables rule '%s' to chain '%s' in table '%s': %s",