|
In some C code, I have a pair of IPv6 addresses,
I want to know if they both refer to the same address. I can't simply use the '==' operator on these structures; nor is there a single value within a structure that I can compare with '==' (unlike with IPv4). For now I've settled on using memcmp. First like so,
And then later I created a macro, in6_equal, to make code calling this easier to read,
Is there an official API call that I should be using to do these comparisons, or does everyone roll their own; along the above lines? |
|
I believe that to be the correct way to compare 2 |
|
I have not had to do IPv6 address comparisons in C/C++, but that seems like a valid way to do it (and I can't think of any drawbacks) |
