3 # Find a subnet with a certain address and re-direct to its editing form
5 require './dhcpd-lib.pl';
7 $in{'subnet'} || &error($text{'lookup_esubnetname'});
9 # Recursively find subnets
10 $conf = &get_config();
11 @subnets = &find_recursive("subnet", $conf);
14 %access = &get_module_acl();
15 foreach $s (@subnets) {
16 local $can_view = &can('r', \%access, $s);
17 next if !$can_view && $access{'hide'};
18 if (&search_re($s->{'values'}->[0], $in{'subnet'}) ||
19 &search_re($s->{'values'}->[0]."/".$s->{'values'}->[2], $in{'subnet'})) {
25 # Go to the subnet or show an error
27 ($gidx, $uidx, $sidx) = &find_parents($subnet);
28 &redirect("edit_subnet.cgi?idx=$subnet->{'index'}".
29 (defined($gidx) ? "&gidx=$gidx" : "").
30 (defined($uidx) ? "&uidx=$uidx" : "").
31 (defined($sidx) ? "&sidx=$sidx" : ""));
34 &error(&text('lookup_esubnet', $in{'subnet'}));