I've spent the better part of my spare time today on the hunt for how to handle checking an IP against a CIDR range to see if it's within that range.
ie: seeing if 220.127.116.11 falls within 18.104.22.168/15 or something.
The CIDR value could be entered via a ban command manually, or if possible calculated into the string form of 22.214.171.124/15 from the user's existing IP and added to a list for future comparisons.
Pretty much every post I've been able to find is either of the form "break it up and compare" (who never go on to explain what they mean) or consists of huge libraries that are bigger than the entire codebase, which are impractical for obvious reasons.
Does C++ not have some standard thing for this? Why does this seem like people think it's ridiculously easy to do yet can't be bothered to post their code if it really is this simple? Nobody has ever done this in MUD code before?
I have some PHP code in my blog that can do this in 7 lines of code, but it appears to be relying in part on some native libraries inside PHP that C++ doesn't have and I don't know how to translate it.
I'm hoping for a nice, clean, easy solution to this that can be trivially dropped in to use for ban comparisons.