then what would happen if you had to do the same thing with ipv6?
Thinking about it, any tree-like data structure that includes a compression designed for handling long run-lengths would work just fine.
For example, a minor variation of roaring bitmaps would suffice.
However, another reply mentioned layer 7 firewalls, which can potentially understand DNS, HTTP headers, and apply regular expressions. Those would not be possible using this kind of naive data structure and would definitely require something like Z3.
If you wanted to do this for a gazillion rules and micro-optimize memory use, you could use indexed ip references in the memory representation, same way as vertices are addressed in GPU programming - would help for v4 as well.