Changeset 642 for trunk/cgi-bin
- Timestamp:
- 10/17/14 16:55:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/admin.cgi
r641 r642 140 140 141 141 my $maskbits = $cidr->masklen; 142 my $fbtmp = findAllocateFrom($ip_dbh, $maskbits, $webvar{alloctype}, '','', 142 my ($fbid, $fb, $fbparent); 143 ($fbid, $fb, $fbparent) = findAllocateFrom($ip_dbh, $maskbits, $webvar{alloctype}, '','', 143 144 (gimme => "$cidr", allowpriv => 1)); 144 145 if ($webvar{alloctype} eq 'rm') { 146 if (!$fbtmp) { 145 $page->param(fbid => $fbid); 146 $page->param(parid => $fbparent); 147 my $rdns = getBlockRDNS($ip_dbh, id => $fbparent, type => ($webvar{alloctype} =~ /^.i$/ ? 'i' : 'b'), 148 user => $authuser); 149 $page->param(rdns => $rdns); 150 if ($webvar{alloctype} =~ /^(.)i$/) { 151 my $iptype = $1; 152 my $ptmp = getBlockData($ip_dbh, $fbparent); 153 if ($ptmp->{type} =~ /^(.)[dp]$/) { 154 my $newiptype = "$1i"; 155 if ($ptmp->{type} !~ /^$iptype./) { 156 $page->param(warnmsg => "Warning: Allocating IP as '".$disp_alloctypes{$newiptype}."' instead of '". 157 $disp_alloctypes{$webvar{alloctype}}."' to match pool ".$ptmp->{block}."\n"); 158 $webvar{alloctype} = $newiptype; 159 } 160 } 161 if (!$fbid) { 162 $page->param(errmsg => "Can't allocate static IP from outside a pool!!"); 163 goto ERRJUMP; 164 } 165 } else { 166 if (!$fbid) { 147 167 $page->param(errmsg => "Can't allocate from outside a free block!!"); 148 168 goto ERRJUMP; 149 169 } 150 } elsif ($webvar{alloctype} =~ /^(.)i$/) { 151 my $iptype = $1; 152 my $ptmp = ipParent($ip_dbh, "$cidr"); 153 if ($ptmp->{type} =~ /^(.)[dp]$/) { 154 my $newiptype = "$1i"; 155 $fbtmp = $ptmp->{cidr}; 156 if ($ptmp->{type} !~ /^$iptype./) { 157 $page->param(warnmsg => "Warning: Allocating IP as '".$disp_alloctypes{$newiptype}."' instead of '". 158 $disp_alloctypes{$webvar{alloctype}}."' to match pool $fbtmp\n"); 159 $webvar{alloctype} = $newiptype; 160 } 161 } 162 if (!$fbtmp) { 163 $page->param(errmsg => "Can't allocate static IP from outside a pool!!"); 164 goto ERRJUMP; 165 } 166 } else { 167 if (!$fbtmp) { 168 $page->param(errmsg => "Can't allocate from outside a routed block!!"); 169 goto ERRJUMP; 170 } 171 } 172 173 my $alloc_from = new NetAddr::IP $fbtmp; 170 } 171 172 my $alloc_from = new NetAddr::IP $fb; 174 173 175 174 my @cities; … … 201 200 } 202 201 203 my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from}, 204 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes}, 205 $webvar{circid}); 202 my ($retcode,$msg) = allocateBlock($ip_dbh, cidr => $webvar{cidr}, fbid => $webvar{fbid}, 203 parent => $webvar{parent}, custid => $webvar{custid}, type => $webvar{alloctype}, city => $webvar{city}, 204 desc => $webvar{desc}, notes => $webvar{notes}, circid => $webvar{circid}, 205 privdata => $webvar{privdata}, nodeid => $webvar{node}, rdns => $webvar{rdns}, user => $authuser); 206 206 207 if ($retcode eq 'OK') { 207 208 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
Note:
See TracChangeset
for help on using the changeset viewer.