Subject: CIDR support in c-ares

CIDR support in c-ares

From: codemastr <codemstr_at_ptd.net>
Date: 2005-04-03

I'm wanting to add IPv6 support to ares_gethostbyname, and to be complete
(sortlist) this means we need CIDR support. In order to do this, there are a
couple of functions I will need. I will need inet_net_pton and bitncmp. Some
OSes already provide one or both of these functions, so we'll need more
autoconf checks. Basically, inet_net_pton is like inet_pton except it also
parses CIDR. Meaning, if I have 123.123.123.123/24, it will give me an
in_addr and an int that == 24. Bitncmp is what I think will make the CIDR
comparisons easiest. For example, I can do:

bitncmp(&addr1,&addr2,24) to compare the first 24 bits of both addresses.

If this sounds good, then do NOT commit my last IPv6 patch. The reason is,
we should ditch inet_pton.c and simply include inet_net_pton.c (it provides
all of the features of inet_pton with the addition of CIDR support). So I'd
suggest providing inet_pton as a wrapper around inet_net_pton simply so we
don't have to have an inet_pton.c and inet_net_pton.c.

Anyone have any comments?

Dominick Meglio

_______________________________________________
http://cool.haxx.se/mailman/listinfo/c-ares
Received on Sun Apr 3 19:18:44 2005