<div dir="ltr"><div>You could modify a radix tree to include a consolidation function and resulting confidence.  Then walk the nodes of the tree, check to see if the subtree meets the requirements for consolidation, if so, prune and record the confidence.  You would need to re-run the consolidation from the original data every time an individual IP was added/removed from the list as the consolidation function is lossy.</div><div><br></div><div>Alternatively, you could do consolidation on the fly losslessly if you had a custom tree walk algorithm.  That's probably the way I would do it.  I'm not a programmer so I assume there are better ways out there.<br></div><div><br></div><div>Your processing time for 5k IPs should be measured in seconds (ie: less than one) rather than minutes on any modern core.  Based on your pseudocode (sort -n | uniq) I get the impression that you're using BASH which isn't ideal for performing this sort of operation at high speed.<br></div><div><br></div><div>On the flip side, I think an extra 100k routes isn't that much unless you're suffering from hardware routing table limitations.  In my world the cost of a false positive match would far outweigh the cost of upgrading hardware.  YMMV.<br></div><div><br></div><div>Do you have a git repo?<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 27, 2019 at 9:58 PM Joe Maimon <<a href="mailto:jmaimon@jmaimon.com">jmaimon@jmaimon.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">So I went back to the drawing board, and I think I have something that <br>
seems to work much better.<br>
<br>
- convert input prefixes to single ip expressed as integer<br>
- sort -n | uniq<br>
- into a temporary list file<br>
<br>
begin<br>
<br>
read sequentially until maxhosts (or minhosts) or next subnet<br>
<br>
If matched enough single addresses, output subnet (and missing hosts <br>
without early loop termination)<br>
<br>
delete all subnet addresses read<br>
<br>
loop<br>
<br>
Total process time on a vm on old hardware, less than 2m for a 5500 line <br>
input. Now to verify results, positive and negative....<br>
<br>
Results are still raw, but anyone who wishes is welcome to it.<br>
<br>
Joe<br>
<br>
Joe Maimon wrote:<br>
> Does anyone have or seen any such tool? I have a script that seems to<br>
> work, but its terribly slow.<br>
><br>
> Currently I can produce aggregated subnets that can be mising up to a<br>
> specified number of individual addresses. Which can be fed back in for<br>
> multiple passes.<br>
><br>
> Doing RTBH on individual /32 does not scale well, if you are eyeing<br>
> collaboration with external lists. I have found likely sources that could<br>
> produce another 100k prefixes easily.<br>
><br>
> Joe<br>
><br>
><br>
<br>
</blockquote></div>