---- Changes since 1.510 ----
Added support for multi-value options, thanks to a patch from Luke Suchocki.
Also added support for multi-value options within a bracketed expression.
+Hostname, IP address and MAC address clashes are now only checked for in the same shared network.
return @{$hr};
}
+sub get_host_shared_network
+{
+local ($h) = @_;
+local $shar;
+while($h) {
+ if ($h->{'name'} eq 'shared-network') {
+ return $h;
+ }
+ $h = $h->{'parent'};
+ }
+return undef;
+}
+
+sub get_my_shared_network_hosts
+{
+local ($h) = @_;
+local $shar = &get_host_shared_network($h);
+local @rv;
+foreach my $oh (&get_hosts()) {
+ if (&get_host_shared_network($oh) eq $shar) {
+ push(@rv, $oh);
+ }
+ }
+return @rv;
+}
+
# hash that links objtypes shortcuts with object names
%obj_names2types = qw(host hst group grp subnet sub shared-network sha);
# Check for a hostname clash
if (($in{'new'} || $in{'name'} ne $host->{'values'}->[0]) &&
$access{'uniq_hst'}) {
- foreach $h (&get_hosts()) {
+ foreach $h (&get_my_shared_network_hosts($npar)) {
&error("$text{'eacl_np'} $text{'eacl_uniq'}")
if (lc($h->{'values'}->[0]) eq lc($in{'name'}));
}
: &find("hardware", $host->{'members'});
if ((!$oldhard || $in{'hardware'} ne $oldhard->{'values'}->[1])
&& $access{'uniq_hst'}) {
- foreach $h (&get_hosts()) {
+ foreach $h (&get_my_shared_network_hosts($npar)) {
$chard = &find("hardware", $h->{'members'});
&error("$text{'eacl_np'} $text{'eacl_uniqh'}")
if ($chard && lc($chard->{'values'}->[1]) eq lc($in{'hardware'}));
if ((!$oldfixed ||
$in{'fixed-address'} ne $oldfixed->{'values'}->[0])
&& $access{'uniq_hst'}) {
- foreach $h (&get_hosts()) {
+ foreach $h (&get_my_shared_network_hosts($npar)) {
$cfixed = &find("fixed-address",
$h->{'members'});
&error("$text{'eacl_np'} $text{'eacl_uniqi'}")