Index: branches/stable/cgi-bin/main.cgi
===================================================================
--- branches/stable/cgi-bin/main.cgi	(revision 193)
+++ branches/stable/cgi-bin/main.cgi	(revision 194)
@@ -416,5 +416,6 @@
 
   # Count the free blocks.
-  $sth = $ip_dbh->prepare("select count(*) from freeblocks where cidr <<= ?");
+  $sth = $ip_dbh->prepare("select count(*) from freeblocks where cidr <<= ? and ".
+	"(routed='y' or routed='n')");
   foreach my $master (@masterblocks) {
     $sth->execute("$master");
@@ -424,5 +425,6 @@
 
   # Find the largest free block in each master
-  $sth = $ip_dbh->prepare("select maskbits from freeblocks where cidr <<= ? order by maskbits limit 1");
+  $sth = $ip_dbh->prepare("select maskbits from freeblocks where cidr <<= ? and ".
+	"(routed='y' or routed='n') order by maskbits limit 1");
   foreach my $master (@masterblocks) {
     $sth->execute("$master");
@@ -498,5 +500,6 @@
 
     # Count the free blocks.
-    $sth = $ip_dbh->prepare("select count(*) from freeblocks where cidr <<= ?");
+    $sth = $ip_dbh->prepare("select count(*) from freeblocks where cidr <<= ? and ".
+	"(routed='y' or routed='n')");
     foreach my $master (@localmasters) {
       $sth->execute("$master");
@@ -506,5 +509,6 @@
 
     # Get the size of the largest free block
-    $sth = $ip_dbh->prepare("select maskbits from freeblocks where cidr <<= ? order by maskbits limit 1");
+    $sth = $ip_dbh->prepare("select maskbits from freeblocks where cidr <<= ? and ".
+	"(routed='y' or routed='n') order by maskbits limit 1");
     foreach my $master (@localmasters) {
       $sth->execute("$master");
