summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-03-20 14:31:00 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-03-20 14:31:00 -0700
commit1693cdf87f883464a10d4a91bdc32e8a595444a2 (patch)
tree5bb0c7a147074b11339b43cdbdd7abab00a76473 /scripts
parentdb3ccf7834617fa5f278e512bb73b831acb407d3 (diff)
downloadvyatta-wanloadbalance-1693cdf87f883464a10d4a91bdc32e8a595444a2.tar.gz
vyatta-wanloadbalance-1693cdf87f883464a10d4a91bdc32e8a595444a2.zip
added final validation to address ranges and negation operators. now behavior is the same as firewall and nat.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-wanloadbalance.pl17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl
index ec361fa..69fadcd 100644
--- a/scripts/vyatta-wanloadbalance.pl
+++ b/scripts/vyatta-wanloadbalance.pl
@@ -11,6 +11,7 @@
use lib "/opt/vyatta/share/perl5/";
use VyattaConfig;
use VyattaMisc;
+use VyattaTypeChecker;
use warnings;
use strict;
@@ -88,7 +89,13 @@ sub write_rules {
print FILE_LCK "\tdestination {\n";
my $daddr = $config->returnValue("$rule destination address");
if (defined $daddr) {
- print FILE_LCK "\t\taddress \"" . $daddr . "\"\n";
+ if (VyattaTypeChecker::validate_iptables4_addr($daddr) eq "1") {
+ print FILE_LCK "\t\taddress \"" . $daddr . "\"\n";
+ }
+ else {
+ print "Error in destination address configuration\n";
+ exit 1;
+ }
}
my $option = $config->returnValue("$rule destination port");
@@ -119,7 +126,13 @@ sub write_rules {
print FILE_LCK "\tsource {\n";
my $saddr = $config->returnValue("$rule source address");
if (defined $saddr) {
- print FILE_LCK "\t\taddress \"" . $saddr . "\"\n";
+ if (VyattaTypeChecker::validate_iptables4_addr($saddr) eq "1") {
+ print FILE_LCK "\t\taddress \"" . $saddr . "\"\n";
+ }
+ else {
+ print "Error in source address configuration\n";
+ exit 1;
+ }
}
$option = $config->returnValue("$rule source port");