Re: Getting prefix from address?
Jeroen Massar <[email protected]>
| Newsgroups | gmane.network.ipv6.general |
|---|---|
| Organization | Unfix |
| Message-ID | <[email protected]> |
Stig Venaas wrote: > On Sat, Dec 10, 2005 at 11:42:05AM +0900, JINMEI Tatuya / ?$B?@L@C#:H wrote: >>>>>>> On Fri, 9 Dec 2005 18:28:14 -0500, >>>>>>> Roy Smith <[email protected]> said: >>> Is there a standard API for getting the prefix given an address and a >>> prefix length? I.e., I've got >>> "FFEE:0200:0045:0000:0000:0000:0123:0012" and 64 and I want to get >>> "FFEE:0200:0045:0000:0000:0000:0000:0000". >>> I looked in RFC 3493 and 3542 and didn't see anything in either one >>> that looked like it did this. Did I just miss it, or does it not >>> exist? >> There's no standard API for this as far as I know. > > Pretty sure there isn't. I don't see the need for it myself, it > is easy enough to implement. There should actually not be a need for programs to use it as most programs should not be bothering with address masks and such in the first place, they should base around getaddrinfo() and struct addr_storage and not care about anything else. Referencing anything inside these structures would make the program depend on a specific IP version which is a bad design decision. See http://gsyc.escet.urjc.es/~eva/IPv6-web/ipv6.html for details about keeping your program AI independent. Of course there are programs (monitoring,routing,firewalling etc) that require to do this but people programming those tools can easily come up with the simple piece of code that Stig showed. Greets, Jeroen
signature.asc
(application/pgp-signature, 238 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Jeroen Massar / http://unfix.org/~jeroen/ iD8DBQFDnHESKaooUjM+fCMRAilVAJ447MOwzIzsqONDFchKzDWKyOLLQACgo8eI N/D65G5xF1CZbOT7j6xu6t0= =Q9GR -----END PGP SIGNATURE-----