Index: trunk/cgi-bin/IPDB.pm
===================================================================
--- trunk/cgi-bin/IPDB.pm	(revision 774)
+++ trunk/cgi-bin/IPDB.pm	(revision 775)
@@ -1983,5 +1983,7 @@
     }
 
-    @processlist = sort { $b->{cidr}->masklen <=> $a->{cidr}->masklen } @processlist;
+    # Sort on masklen, crudely break ties by pushing container blocks down the stack.  Multiple-nested containers
+    # of the same size are virtually guaranteed to produce strange results, but should be rare enough to not matter
+    @processlist = sort { $b->{cidr}->masklen <=> $a->{cidr}->masklen || $a->{type} =~ /^.m$/ } @processlist;
 
     foreach my $pr (@processlist) {
