- Timestamp:
- 02/09/05 17:11:19 (20 years ago)
- Location:
- branches/stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/IPDB.pm
r158 r159 58 58 59 59 # Initialize alloctypes hashes 60 $sth = $dbh->prepare("select *from alloctypes order by listorder");60 $sth = $dbh->prepare("select type,listname,dispname,listorder from alloctypes order by listorder"); 61 61 $sth->execute; 62 62 while (my @data = $sth->fetchrow_array) { … … 68 68 69 69 # City and POP listings 70 $sth = $dbh->prepare("select *from cities order by city");70 $sth = $dbh->prepare("select city,routing from cities order by city"); 71 71 $sth->execute; 72 72 return (undef,$sth->errstr) if $sth->err; … … 79 79 80 80 # Master block list 81 $sth = $dbh->prepare("select *from masterblocks order by cidr");81 $sth = $dbh->prepare("select cidr from masterblocks order by cidr"); 82 82 $sth->execute; 83 83 for (my $i=0; my @data = $sth->fetchrow_array(); $i++) { … … 120 120 # Return here if we can't select. Note that this indicates a 121 121 # problem executing the select. 122 my $sth = $dbh->prepare( 'select cidr from masterblocks');122 my $sth = $dbh->prepare("select cidr from masterblocks"); 123 123 $sth->execute(); 124 124 return (undef,$DBI::errstr) if ($sth->err); … … 154 154 } else { 155 155 # it connects, try a stmt. 156 my $sth = $dbh->prepare( 'select cidr from masterblocks');156 my $sth = $dbh->prepare("select cidr from masterblocks"); 157 157 my $err = $sth->execute(); 158 158 … … 189 189 local $dbh->{RaiseError} = 1; # step on our toes by accident. 190 190 191 if ($type =~ /^ [cdsmw]i$/) {191 if ($type =~ /^.i$/) { 192 192 $msg = "Unable to assign static IP $cidr to $custid"; 193 193 eval { 194 # We'll just have to put up with the oddities caused by SQL (un)sort order 195 $sth = $dbh->prepare("select * from poolips where pool='$alloc_from'". 196 " and available='y' order by ip"); 197 $sth->execute; 198 194 # We have to do this in two parts because otherwise we lose 195 # the ability to return the IP assigned. Should that change, 196 # the commented SQL statement below may become usable. 199 197 # update poolips set custid='$custid',city='$city',available='n', 200 198 # description='$desc',notes='$notes',circuitid='$circid' 201 199 # where ip=(select ip from poolips where pool='$alloc_from' 202 200 # and available='y' order by ip limit 1); 203 ##err Need better handling here; what if there's no free IPs when this sub gets called? 201 202 $sth = $dbh->prepare("select ip from poolips where pool='$alloc_from'". 203 " and available='y' order by ip"); 204 $sth->execute; 205 204 206 my @data = $sth->fetchrow_array; 205 $cidr = $data[ 1]; # $cidr is already declared when we get here!207 $cidr = $data[0]; # $cidr is already declared when we get here! 206 208 207 209 $sth = $dbh->prepare("update poolips set custid='$custid',". … … 234 236 " where cidr='$cidr'"); 235 237 $sth->execute; 236 $sth = $dbh->prepare("insert into routed values ('$cidr',".237 238 $sth = $dbh->prepare("insert into routed (cidr,maskbits,city)". 239 " values ('$cidr',".$cidr->masklen.",'$city')"); 238 240 $sth->execute; 239 241 } else { … … 242 244 $sth->execute; 243 245 244 $sth = $dbh->prepare("insert into allocations values ('$cidr',". 245 "'$custid','$type','$city','$desc','$notes',". 246 $sth = $dbh->prepare("insert into allocations". 247 " (cidr,custid,type,city,description,notes,maskbits,circuitid)". 248 " values ('$cidr','$custid','$type','$city','$desc','$notes',". 246 249 $cidr->masklen.",'$circid')"); 247 250 $sth->execute; 248 251 249 252 # And initialize the pool, if necessary 253 # PPPoE pools (currently dialup, DSL, and WiFi) get all IPs made available 254 # "DHCP" or "real-subnet" pools have the net, gw, and bcast IPs removed. 250 255 if ($type =~ /^.p$/) { 251 $msg = "Could not initialize IPs in new $disp_alloctypes{$type} pool $cidr"; 252 initPool($dbh,$cidr,$type,$city,(($type eq 'dp' or $type eq 'mp') ? "all" : "normal")); 256 $msg = "Could not initialize IPs in new $disp_alloctypes{$type} $cidr"; 257 my ($code,$rmsg) = initPool($dbh,$cidr,$type,$city,"all"); 258 die $rmsg if $code eq 'FAIL'; 259 } elsif ($type =~ /^.d$/) { 260 $msg = "Could not initialize IPs in new $disp_alloctypes{$type} $cidr"; 261 my ($code,$rmsg) = initPool($dbh,$cidr,$type,$city,"normal"); 262 die $rmsg if $code eq 'FAIL'; 253 263 } 254 264 … … 258 268 }; # end of eval 259 269 if ($@) { 260 $msg =$@;270 $msg .= ": ".$@; 261 271 eval { $dbh->rollback; }; 262 return ('FAIL',$ @);272 return ('FAIL',$msg); 263 273 } else { 264 274 return ('OK',"OK"); … … 297 307 # Insert the new freeblocks entries 298 308 # Note that non-routed blocks are assigned to <NULL> 299 $sth = $dbh->prepare("insert into freeblocks values (?, ?, '<NULL>','n')"); 309 # and use the default value for the routed column ('n') 310 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city)". 311 " values (?, ?, '<NULL>')"); 300 312 foreach my $block (@newfreeblocks) { 301 313 $sth->execute("$block", $block->masklen); … … 303 315 304 316 # Insert the entry in the routed table 305 $sth = $dbh->prepare("insert into routed values ('$cidr',".306 317 $sth = $dbh->prepare("insert into routed (cidr,maskbits,city)". 318 " values ('$cidr',".$cidr->masklen.",'$city')"); 307 319 $sth->execute; 308 320 # Insert the (almost) same entry in the freeblocks table 309 $sth = $dbh->prepare("insert into freeblocks values ('$cidr',".310 321 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)". 322 " values ('$cidr',".$cidr->masklen.",'$city','y')"); 311 323 $sth->execute; 312 324 … … 314 326 315 327 # Insert the new freeblocks entries 316 $sth = $dbh->prepare("insert into freeblocks values (?, ?,".317 " (select city from routed where cidr >>= '$cidr'),'y')");328 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)". 329 " values (?, ?, (select city from routed where cidr >>= '$cidr'),'y')"); 318 330 foreach my $block (@newfreeblocks) { 319 331 $sth->execute("$block", $block->masklen); … … 321 333 322 334 # Insert the allocations entry 323 $sth = $dbh->prepare("insert into allocations values ('$cidr',". 324 "'$custid','$type','$city','$desc','$notes',".$cidr->masklen. 325 ",'$circid')"); 335 $sth = $dbh->prepare("insert into allocations (cidr,custid,type,city,". 336 "description,notes,maskbits,circuitid)". 337 " values ('$cidr','$custid','$type','$city','$desc','$notes',". 338 $cidr->masklen.",'$circid')"); 326 339 $sth->execute; 327 340 328 341 # And initialize the pool, if necessary 342 # PPPoE pools (currently dialup, DSL, and WiFi) get all IPs made available 343 # "DHCP" or "real-subnet" pools have the net, gw, and bcast IPs removed. 329 344 if ($type =~ /^.p$/) { 330 345 $msg = "Could not initialize IPs in new $disp_alloctypes{$type} $cidr"; 331 initPool($dbh,$cidr,$type,$city,($type eq 'dp' ? "all" : "normal")); 346 my ($code,$rmsg) = initPool($dbh,$cidr,$type,$city,"all"); 347 die $rmsg if $code eq 'FAIL'; 348 } elsif ($type =~ /^.d$/) { 349 $msg = "Could not initialize IPs in new $disp_alloctypes{$type} $cidr"; 350 my ($code,$rmsg) = initPool($dbh,$cidr,$type,$city,"normal"); 351 die $rmsg if $code eq 'FAIL'; 332 352 } 333 353 … … 361 381 my $pool = new NetAddr::IP $_[1]; 362 382 363 my ($pooltype) = ($type =~ /^(.)p$/); 383 ##fixme Need to just replace 2nd char of type with i rather than capturing 1st char of type 384 $type =~ s/[pd]$/i/; 364 385 my $sth; 365 366 # have to insert all pool IPs into poolips table as "unallocated". 367 $sth = $dbh->prepare("insert into poolips values ('$pool',". 368 " ?, '6750400', '$city', '$pooltype', 'y', '', '', '')"); 369 my @poolip_list = $pool->hostenum; 370 if ($class eq 'all') { # (DSL-ish block - *all* IPs available 371 $sth->execute($pool->addr); 372 for (my $i=0; $i<=$#poolip_list; $i++) { 373 $sth->execute($poolip_list[$i]->addr); 374 } 375 $pool--; 376 $sth->execute($pool->addr); 377 } else { # (real netblock) 378 for (my $i=1; $i<=$#poolip_list; $i++) { 379 $sth->execute($poolip_list[$i]->addr); 380 } 386 my $msg; 387 388 # Trap errors so we can pass them back to the caller. Even if the 389 # caller is only ever supposed to be local, and therefore already 390 # trapping errors. >:( 391 local $dbh->{AutoCommit} = 0; # These need to be local so we don't 392 local $dbh->{RaiseError} = 1; # step on our toes by accident. 393 394 eval { 395 # have to insert all pool IPs into poolips table as "unallocated". 396 $sth = $dbh->prepare("insert into poolips (pool,ip,custid,city,type)". 397 " values ('$pool', ?, '6750400', '$city', '$type')"); 398 my @poolip_list = $pool->hostenum; 399 if ($class eq 'all') { # (DSL-ish block - *all* IPs available 400 $sth->execute($pool->addr); 401 for (my $i=0; $i<=$#poolip_list; $i++) { 402 $sth->execute($poolip_list[$i]->addr); 403 } 404 $pool--; 405 $sth->execute($pool->addr); 406 } else { # (real netblock) 407 for (my $i=1; $i<=$#poolip_list; $i++) { 408 $sth->execute($poolip_list[$i]->addr); 409 } 410 } 411 }; 412 if ($@) { 413 $msg = "'".$sth->errstr."'"; 414 eval { $dbh->rollback; }; 415 return ('FAIL',$msg); 416 } else { 417 return ('OK',"OK"); 381 418 } 382 419 } # end initPool() … … 406 443 407 444 eval { 408 $msg = "Unable to deallocate $ type$cidr";445 $msg = "Unable to deallocate $disp_alloctypes{$type} $cidr"; 409 446 $sth = $dbh->prepare("update poolips set custid='6750400',available='y',". 410 447 "city=(select city from allocations where cidr >>= '$cidr'),". … … 455 492 $sth->execute; 456 493 # Set up query to start compacting free blocks. 457 $sth = $dbh->prepare("select *from freeblocks where ".494 $sth = $dbh->prepare("select cidr from freeblocks where ". 458 495 "maskbits<=".$cidr->masklen." and routed='n' order by maskbits desc"); 459 496 … … 463 500 $sth->execute; 464 501 # Special case - delete pool IPs 465 if ($type =~ /^. p$/) {502 if ($type =~ /^.[pd]$/) { 466 503 # We have to delete the IPs from the pool listing. 467 504 $sth = $dbh->prepare("delete from poolips where pool='$cidr'"); … … 470 507 471 508 # Set up query for compacting free blocks. 472 $sth = $dbh->prepare("select *from freeblocks where cidr <<= ".509 $sth = $dbh->prepare("select cidr from freeblocks where cidr <<= ". 473 510 "(select cidr from routed where cidr >>= '$cidr') ". 474 511 " and maskbits<=".$cidr->masklen." and routed='y' order by maskbits desc"); … … 533 570 # insert "new" freeblocks entry 534 571 if ($type eq 'rr') { 535 $sth = $dbh->prepare("insert into freeblocks values ('$cidr',".$cidr->masklen.536 " ,'<NULL>','n')");572 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city)". 573 " values ('$cidr',".$cidr->masklen.",'<NULL>')"); 537 574 } else { 538 $sth = $dbh->prepare("insert into freeblocks values ('$cidr',".$cidr->masklen. 575 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)". 576 " values ('$cidr',".$cidr->masklen. 539 577 ",(select city from routed where cidr >>= '$cidr'),'y')"); 540 578 } -
branches/stable/cgi-bin/main.cgi
r158 r159 57 57 cleanInput(\%webvar); 58 58 59 # Stuff that gets loaded from the database60 #my @citylist;61 #my @poplist;62 #my %allocated; # Count for allocated blocks in a master block63 #my %free; # Count for free blocks (routed and unrouted) in a master block64 #my %bigfree; # Tracking largest free block in a master block65 #my %routed; # Number of routed blocks in a master block66 67 # Slurp up the master block list - we need this several places68 # While we're at it, initialize the related hashes.69 #$sth = $ip_dbh->prepare("select * from masterblocks order by cidr");70 #$sth->execute;71 #for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {72 # $masterblocks[$i] = new NetAddr::IP $data[0];73 # $allocated{"$masterblocks[$i]"} = 0;74 # $free{"$masterblocks[$i]"} = 0;75 # $bigfree{"$masterblocks[$i]"} = 128; # Larger number means smaller block.76 # # Set to 128 to prepare for IPv677 # $routed{"$masterblocks[$i]"} = 0;78 #}79 80 81 82 59 83 60 #main() … … 110 87 # Thus the "routed" flag. 111 88 112 $sth = $ip_dbh->prepare("insert into freeblocks values ('$webvar{cidr}',".113 $cidr->masklen.",'<NULL>','n')");89 $sth = $ip_dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)". 90 " values ('$webvar{cidr}',".$cidr->masklen.",'<NULL>','n')"); 114 91 $sth->execute; 115 92 … … 349 326 # Fix up types from pools (which are single-char) 350 327 # Fixing the database would be... painful. :( 328 ##fixme LEGACY CODE 351 329 if ($data[2] =~ /^[cdsmw]$/) { 352 330 $data[2] .= 'i'; … … 355 333 $data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]); 356 334 # Allow listing of pool if desired/required. 357 if ($data[2] =~ /^ [cdsmw]p$/) {335 if ($data[2] =~ /^.[pd]$/) { 358 336 $row[0] .= ' <a href="/ip/cgi-bin/main.cgi?action=listpool'. 359 337 "&pool=$data[0]\">List IPs</a>"; … … 494 472 495 473 # Fetch only the blocks relevant to this master 496 $sth = $ip_dbh->prepare("select *from routed where cidr <<= '$master' order by cidr");474 $sth = $ip_dbh->prepare("select cidr,city from routed where cidr <<= '$master' order by cidr"); 497 475 $sth->execute(); 498 476 … … 505 483 $bigfree{"$cidr"} = 128; 506 484 # Retain the routing destination 507 $routed{"$cidr"} = $data[ 2];485 $routed{"$cidr"} = $data[1]; 508 486 } 509 487 … … 597 575 my $master = new NetAddr::IP $webvar{block}; 598 576 599 $sth = $ip_dbh->prepare("select *from routed where cidr='$master'");577 $sth = $ip_dbh->prepare("select city from routed where cidr='$master'"); 600 578 $sth->execute; 601 579 my @data = $sth->fetchrow_array; 602 580 603 581 print qq(<center><div class="heading">Summarizing allocated blocks for ). 604 qq($master ($data[ 2]):</div></center><br>\n);582 qq($master ($data[0]):</div></center><br>\n); 605 583 606 584 startTable('CIDR allocation','Customer Location','Type','CustID','Description/Name'); 607 585 608 586 # Snag the allocations for this block 609 $sth = $ip_dbh->prepare("select * from allocations where cidr <<= '$master' order by cidr"); 587 $sth = $ip_dbh->prepare("select cidr,city,type,custid,description". 588 " from allocations where cidr <<= '$master' order by cidr"); 610 589 $sth->execute(); 611 590 612 591 my $count=0; 613 592 while (my @data = $sth->fetchrow_array()) { 614 # cidr,c ustid,type,city,description,notes,maskbits,circuitid593 # cidr,city,type,custid,description, as per the SELECT 615 594 my $cidr = new NetAddr::IP $data[0]; 616 595 617 596 # Clean up extra spaces that are borking things. 618 $data[2] =~ s/\s+//g;597 # $data[2] =~ s/\s+//g; 619 598 620 599 my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=edit&block=$data[0]\">$data[0]</a>", 621 $data[ 3], $disp_alloctypes{$data[2]}, $data[1], $data[4]);600 $data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]); 622 601 # If the allocation is a pool, allow listing of the IPs in the pool. 623 if ($data[2] =~ /^ [cdsmw]p$/) {602 if ($data[2] =~ /^.[pd]$/) { 624 603 $row[0] .= ' <a href="/ip/cgi-bin/main.cgi?action=listpool'. 625 604 "&pool=$data[0]\">List IPs</a>"; … … 654 633 # unrouted free blocks, but it's better to let the database do the work if we can. 655 634 $count = 0; 656 $sth = $ip_dbh->prepare("select *from freeblocks where routed='y' and cidr <<= '$master' order by cidr");635 $sth = $ip_dbh->prepare("select cidr from freeblocks where routed='y' and cidr <<= '$master' order by cidr"); 657 636 $sth->execute(); 658 637 while (my @data = $sth->fetchrow_array()) { … … 676 655 my $cidr = new NetAddr::IP $webvar{pool}; 677 656 657 my ($pooltype,$poolcity); 658 678 659 # Snag pool info for heading 679 $sth = $ip_dbh->prepare("select *from allocations where cidr='$cidr'");660 $sth = $ip_dbh->prepare("select type,city from allocations where cidr='$cidr'"); 680 661 $sth->execute; 681 my @data = $sth->fetchrow_array;682 my $type = $data[2]; # We'll need this later.662 $sth->bind_columns(\$pooltype, \$poolcity); 663 $sth->fetch() || carp $sth->errstr; 683 664 684 665 print qq(<center><div class="heading">Listing pool IPs for $cidr<br>\n). 685 qq(($disp_alloctypes{$type} in $data[3])</div></center><br>\n); 686 print qq(<div class="indent"><b>Reserved IPs:</b><br>\n); 687 print qq(<div class="indent"><table><tr class=color1><td>Network IP:</td><td>). 666 qq(($disp_alloctypes{$pooltype} in $poolcity)</div></center><br>\n); 667 # Only display net/gw/bcast if it's a "real" netblock and not a PPP(oE) lunacy 668 if ($pooltype =~ /^.d$/) { 669 print qq(<div class="indent"><b>Reserved IPs:</b><br>\n); 670 print qq(<div class="indent"><table><tr class=color1><td>Network IP:</td><td>). 688 671 $cidr->addr."</td></tr>\n"; 689 $cidr++;690 print "<tr class=color2><td>Gateway:</td><td>".$cidr->addr."</td></tr>\n";691 $cidr--; $cidr--;692 print "<tr class=color1><td>Broadcast:</td><td>".$cidr->addr."</td></tr>\n".672 $cidr++; 673 print "<tr class=color2><td>Gateway:</td><td>".$cidr->addr."</td></tr>\n"; 674 $cidr--; $cidr--; 675 print "<tr class=color1><td>Broadcast:</td><td>".$cidr->addr."</td></tr>\n". 693 676 "<tr><td>Netmask:</td><td>".$cidr->mask."</td></tr>\n". 694 677 "</table></div></div>\n"; 678 } 695 679 696 680 # probably have to add an "edit IP allocation" link here somewhere. 697 681 698 682 startTable('IP','Customer ID','Available?','Description',''); 699 $sth = $ip_dbh->prepare("select * from poolips where pool='$webvar{pool}' order by ip"); 683 $sth = $ip_dbh->prepare("select ip,custid,available,description,type". 684 " from poolips where pool='$webvar{pool}' order by ip"); 700 685 $sth->execute; 701 686 my $count = 0; 702 687 while (my @data = $sth->fetchrow_array) { 703 688 # pool,ip,custid,city,ptype,available,notes,description,circuitid 704 # If desc is null, make it not null. <g> 705 if ($data[7] eq '') { 706 $data[7] = ' '; 689 # ip,custid,available,description,type 690 # If desc is "null", make it not null. <g> 691 if ($data[3] eq '') { 692 $data[3] = ' '; 707 693 } 708 694 # Some nice hairy Perl to decide whether to allow unassigning each IP 709 # -> if $data[ 5] (aka poolips.available) == 'n' then we print the unassign link695 # -> if $data[2] (aka poolips.available) == 'n' then we print the unassign link 710 696 # else we print a blank space 711 my @row = ( qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[ 1]">$data[1]</a>),712 $data[ 2],$data[5],$data[7],713 ( ($data[ 5] eq 'n') ?714 ("<a href=\"/ip/cgi-bin/main.cgi?action=delete&block=$data[ 1]&".715 "alloctype=$data[4] i\">Unassign this IP</a>") :697 my @row = ( qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>), 698 $data[1],$data[2],$data[3], 699 ( ($data[2] eq 'n') ? 700 ("<a href=\"/ip/cgi-bin/main.cgi?action=delete&block=$data[0]&". 701 "alloctype=$data[4]\">Unassign this IP</a>") : 716 702 (" ") ) 717 703 ); … … 803 789 # + Different flavours of netblock 804 790 805 if ($webvar{alloctype} =~ /^ [cdsmw]i$/) {791 if ($webvar{alloctype} =~ /^.i$/) { 806 792 my ($base,undef) = split //, $webvar{alloctype}; # split into individual chars 807 793 my $sql; … … 810 796 # ... aside from #^%#$%#@#^%^^!!!! legacy data. GRRR. 811 797 # Note that we want to retain the requested city to relate to customer info. 798 ##fixme This needs thought. 799 ##SELECT DISTINCT pool, Count(*) FROM poolips where available='y' GROUP BY pool; 812 800 if ($base =~ /^[ds]$/) { 813 801 $sql = "select * from poolips where available='y' and". … … 863 851 ##fixme 864 852 # This section needs serious Pondering. 865 if ($webvar{alloctype} =~ /^ [cdsmw]p$/) {853 if ($webvar{alloctype} =~ /^.[pd]$/) { 866 854 if (($webvar{city} !~ /^(Sudbury|North Bay)$/) && ($webvar{alloctype} eq 'dp')) { 867 855 printError("You must chose Sudbury or North Bay for DSL pools."); … … 879 867 } 880 868 if ($webvar{allocfrom} ne '-') { 881 $sql = "select *from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".869 $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}". 882 870 " and cidr <<= '$webvar{allocfrom}' and routed='y' order by cidr,maskbits desc"; 883 871 } else { 884 $sql = "select *from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".872 $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}". 885 873 " and routed='y' order by cidr,maskbits desc"; 886 874 } … … 908 896 $cidr = $subblocks[0]; 909 897 } 910 } # if ($webvar{alloctype} =~ /^ [cdsmw]i$/)898 } # if ($webvar{alloctype} =~ /^.i$/) 911 899 912 900 open HTML, "../confirm.html" … … 974 962 "'$webvar{alloctype}' by $authuser failed: '$msg'"; 975 963 printError("Allocation of $webvar{fullcidr} as $disp_alloctypes{$webvar{alloctype}}". 976 " failed: 964 " failed:<br>\n$msg\n"); 977 965 } 978 966 … … 1083 1071 $data[2] =~ s/\s//; 1084 1072 1073 ##fixme LEGACY CODE 1085 1074 # Postfix "i" on pool IP types 1086 1075 if ($data[2] =~ /^[cdsmw]$/) { … … 1145 1134 # Relatively simple SQL transaction here. 1146 1135 my $sql; 1147 if (my $pooltype = ($webvar{alloctype} =~ /^( [cdsmw])i$/) ) {1136 if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) { 1148 1137 $sql = "update poolips set custid='$webvar{custid}',notes='$webvar{notes}',". 1149 1138 "circuitid='$webvar{circid}',description='$webvar{desc}' ". … … 1154 1143 "type='$webvar{alloctype}',circuitid='$webvar{circid}' where cidr='$webvar{block}'"; 1155 1144 } 1156 syslog "debug", $sql; 1145 # Log the details of the change. 1146 syslog "debug", $sql; 1157 1147 $sth = $ip_dbh->prepare($sql); 1158 1148 $sth->execute; … … 1232 1222 $desc = "N/A"; 1233 1223 $notes = "N/A"; 1234 } elsif ($webvar{alloctype} =~ /^ [cdsmw]i$/) { # done with alloctype=rr1224 } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=rr 1235 1225 1236 1226 # Unassigning a static IP … … 1245 1235 $alloctype .="i"; 1246 1236 1247 } else { # done with alloctype= [cdsmw]i1237 } else { # done with alloctype=~ /^.i$/ 1248 1238 1249 1239 my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes from ". … … 1270 1260 1271 1261 # Set the warning text. 1272 if ($alloctype =~ /^ [cdsmw]p$/) {1262 if ($alloctype =~ /^.[pd]$/) { 1273 1263 $html =~ s|<!--warn-->|<tr bgcolor="black"><td colspan="2"><div class="red">Warning: clicking confirm will remove this record entirely.<br>Any IPs allocated from this pool will also be removed!</div></td></tr>|; 1274 1264 } else { -
branches/stable/changes.html
r140 r159 12 12 <tr><td class="heading" colspan=2>Changes to the IPDB</td><tr> 13 13 14 <tr class="color1"> 15 <td valign=top>02/09/2005</td> 16 <td>Pool handling has been cleaned up - all PPP-ish pools (modem, DSL, WiFi) now generate a 17 full list of IPs rather than reserving the network, gateway, and broadcast IPs necessary on 18 a "real" subnet. They will also not display this incorrect and useless information. 19 </td></tr> 14 20 <tr class="color2"> 15 21 <td valign=top>01/27/2005</td>
Note:
See TracChangeset
for help on using the changeset viewer.