We need to match IP ranges of connections, were ranges are specified in the “/” notation (e.g. 10.10.2.0/24)

What is the best way to do this without consuming too much CPU resources when the connection rate is very high?