summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2009-05-06 16:45:26 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2009-05-06 16:45:26 -0700
commitde83e33569c929d29a0581a240e81b1d2e8884f0 (patch)
treec3501038e00081682a73dcdab58b62a4edd4bfd8 /lib
parent81f3abcb7db6944451a53c88afe6527252ed56cd (diff)
downloadvyatta-cfg-de83e33569c929d29a0581a240e81b1d2e8884f0.tar.gz
vyatta-cfg-de83e33569c929d29a0581a240e81b1d2e8884f0.zip
* don't allow user to change zone-type on the fly
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Zone.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Vyatta/Zone.pm b/lib/Vyatta/Zone.pm
index 986ebb5..436f6fd 100755
--- a/lib/Vyatta/Zone.pm
+++ b/lib/Vyatta/Zone.pm
@@ -148,6 +148,15 @@ sub validity_checks {
"and it's not a local-zone";
return($returnstring, );
}
+ # zone defined as a local-zone
+ my @zone_intfs_orig = get_zone_interfaces("returnOrigValues", $zone);
+ if (scalar(@zone_intfs_orig) != 0) {
+ # can't change change transit zone to local-zone on the fly
+ $returnstring = "Zone $zone is a transit zone. " .
+ "Cannot convert it to local-zone.\n" .
+ "Please define another zone to create local-zone";
+ return($returnstring, );
+ }
$num_local_zones++;
# make sure only one zone is a local-zone
if ($num_local_zones > 1) {
@@ -159,6 +168,12 @@ sub validity_checks {
$returnstring = "local-zone cannot have interfaces defined";
return($returnstring, );
}
+ # make sure you're not converting local-zone to transit zone either
+ if (defined(is_local_zone("existsOrig", $zone))) {
+ $returnstring = "Cannot convert local-zone $zone to transit zone" .
+ "\nPlease define another zone for it";
+ return($returnstring, );
+ }
foreach my $interface (@zone_intfs) {
# make sure firewall is not applied to this interface
my $intf = new Vyatta::Interface($interface);