since inet_addr is deprecated anyway, it seems like an sscanf instead would be the easiest thing to do. or separate the code that is used to do index genearation/lookup from the code that is determining if a given ip is within a cidr block.