diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-05-06 16:45:26 -0700 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-05-06 16:45:26 -0700 |
commit | de83e33569c929d29a0581a240e81b1d2e8884f0 (patch) | |
tree | c3501038e00081682a73dcdab58b62a4edd4bfd8 /lib | |
parent | 81f3abcb7db6944451a53c88afe6527252ed56cd (diff) | |
download | vyatta-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-x | lib/Vyatta/Zone.pm | 15 |
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); |