Changeset 642
- Timestamp:
- 10/17/14 16:55:34 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 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 ". -
trunk/templates/admin/alloc.tmpl
r544 r642 5 5 <form method="POST" action="admin.cgi"> 6 6 <fieldset><legend class="noshow"> </legend> 7 <input type="hidden" name="parent" value="<TMPL_VAR NAME=parid>"> 8 <input type="hidden" name="fbid" value="<TMPL_VAR NAME=fbid>"> 7 9 <table class="regular"> 8 10 <tr class="row0"> … … 19 21 </tr> 20 22 <tr class="row1"> 23 <td>Reverse DNS pattern:</td> 24 <td><input type="text" name="rdns" value="<TMPL_VAR NAME=rdns>" size="40"><input type="button" value=" ? " onclick="helpRDNS()" class="regular"></td> 25 </tr> 26 <tr class="row0"> 21 27 <td>Customer ID:</td> 22 28 <td><TMPL_VAR NAME=custid><input type="hidden" name="custid" value="<TMPL_VAR NAME=custid>"></td> 23 29 </tr> 24 <tr class="row 0">30 <tr class="row1"> 25 31 <td>Customer location:</td> 26 32 <td> … … 31 37 </td> 32 38 </tr> 33 <tr class="row 1">39 <tr class="row0"> 34 40 <td>Circuit ID:</td><td><input name="circid" size="40"></td> 35 41 </tr> 36 <tr class="row 0">42 <tr class="row1"> 37 43 <td>Description/Name:</td><td><input name="desc" size="40"></td> 38 44 </tr> 39 <tr class="row 1">45 <tr class="row0"> 40 46 <td>Notes:</td><td><textarea name="notes" rows="3" cols="40"></textarea></td> 41 47 </tr> … … 43 49 <td class="center" colspan="2">WARNING: This will IMMEDIATELY assign this block!!</td> 44 50 </tr> 45 <tr class="row 1">51 <tr class="row0"> 46 52 <td class="center" colspan="2"><input type="submit" value=" Assign "></td> 47 53 </tr>
Note:
See TracChangeset
for help on using the changeset viewer.