The "flipflop" variable marks the index into argv where the "--insert" is at, so that when we're reloading the rules we can easily change it to "--delete" and back again. It's a rather silly name, and the next patch is going to make more use out of it, so let's use the more sane "command_idx" name. Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx> Index: libvirt/src/iptables.c =================================================================== --- libvirt.orig/src/iptables.c 2008-01-04 10:00:03.000000000 +0000 +++ libvirt.orig/src/iptables.c 2008-01-04 10:00:03.000000000 +0000 @@ -62,7 +62,7 @@ typedef struct { char *rule; char **argv; - int flipflop; + int command_idx; } iptRule; typedef struct @@ -158,7 +158,7 @@ static int iptRulesAppend(iptRules *rules, char *rule, char **argv, - int flipflop) + int command_idx) { iptRule *r; @@ -172,9 +172,9 @@ iptRulesAppend(iptRules *rules, rules->rules = r; - rules->rules[rules->nrules].rule = rule; - rules->rules[rules->nrules].argv = argv; - rules->rules[rules->nrules].flipflop = flipflop; + rules->rules[rules->nrules].rule = rule; + rules->rules[rules->nrules].argv = argv; + rules->rules[rules->nrules].command_idx = command_idx; rules->nrules++; @@ -388,7 +388,7 @@ iptablesAddRemoveRule(iptRules *rules, i char **argv; char *rule = NULL, *p; const char *s; - int n, rulelen, flipflop; + int n, rulelen, command_idx; n = 1 + /* /sbin/iptables */ 2 + /* --table foo */ @@ -422,7 +422,7 @@ iptablesAddRemoveRule(iptRules *rules, i if (!(argv[n++] = strdup(rules->table))) goto error; - flipflop = n; + command_idx = n; if (!(argv[n++] = strdup(action == ADD ? "--insert" : "--delete"))) goto error; @@ -463,7 +463,7 @@ iptablesAddRemoveRule(iptRules *rules, i goto error; if (action == ADD) { - retval = iptRulesAppend(rules, rule, argv, flipflop); + retval = iptRulesAppend(rules, rule, argv, command_idx); rule = NULL; argv = NULL; } else { @@ -543,14 +543,14 @@ iptRulesReload(iptRules *rules) iptRule *rule = &rules->rules[i]; char *orig; - orig = rule->argv[rule->flipflop]; - rule->argv[rule->flipflop] = (char *) "--delete"; + orig = rule->argv[rule->command_idx]; + rule->argv[rule->command_idx] = (char *) "--delete"; if ((retval = iptablesSpawn(WITH_ERRORS, rule->argv))) qemudLog(QEMUD_WARN, "Failed to remove iptables rule '%s' from chain '%s' in table '%s': %s", rule->rule, rules->chain, rules->table, strerror(retval)); - rule->argv[rule->flipflop] = orig; + rule->argv[rule->command_idx] = orig; } if ((retval = iptablesAddRemoveChain(rules, REMOVE)) || -- -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list