]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commit
firewall: Fix perl coding error.
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 31 Mar 2014 11:16:26 +0000 (13:16 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 31 Mar 2014 11:16:26 +0000 (13:16 +0200)
commit025741919a54ceb2ce96961e74f3afd1ad10706b
tree877a9ff812e86d1517552de2d5f47345be7a6245
parentc5fb845c4eb6fdc4ef7d1e10495566a7689bf451
firewall: Fix perl coding error.

Example:
my @as = (1, 2, 3);
foreach my $a (@as) {
$a += 1;
print "$a\n";
}

$a will be a reference to the number in the array and not
copied. Therefore $a += 1 will change the numbers in the
array as well, so that after the loop the content of @as
would be (2, 3, 4).
To avoid that, the number needs to be copied into a new
variable like: my $b = $a; and we are fine.

This caused that the content of the @sources and @destinations
array has been altered for the second run of the loop and
incorrect (i.e. no) rules were created.
config/firewall/rules.pl