Mail Archives: cygwin/2010/12/02/08:33:19
On Dec 2 12:40, Corinna Vinschen wrote:
> On Dec 1 22:30, Jason Curl wrote:
> > Hello,
> >
> > I've seen an issue when using getifaddrs() using Cygwin 1.7.x
> > (snapshot build from 2010-11-24, shortly after the ARP fixes from
> > Corinna). Operating System is Windows 7 x64_86 Ultimate.
> >
> > When I use getifaddrs() I get a list of interface names, some are
> > appended with ":1".
> [...]
> However, there's still a problem which I can't fix, due to the nature of
> the information returned by Windows. There's just no unique identifier
> for each address of an interface available. That means, if you ask for
> the IPv4 address of an interface, then remove another IPv4 address from
> the interface, then the next ioctl/getifaddrs call might return another
> interface alias. The numbering scheme depends on the stability of the
> configuration.
I think there's a potential solution to this problem. It just depends on
how important it is.
The maximum name length for the interface is 43 chars + trailing \0.
The length of the current GUID name is 38 chars, for instance:
{371D57D9-0FF3-402C-AB69-E88FF9D85BC3}
So, subtracting the required colon there are only 4 chars left for a
unique alias name.
The only unique value we could use for the alias name is the IPv4 address
itself. However, it doesn't fit into 4 bytes in a readable manner.
So here's the idea. If we remove the braces from the GUID name, we drop
2 chars, so we have 6 chars left. 6 chars are enough to convert the
IPv4 address into a radix-64 like string, using the l64a function.
For instance, in my case the aforementioned interface has the IPv4
address 192.168.129.107. That's 0xc0a8816b as long, which translates
into "f36e.1" as radix-64 value per the l64a function.
So, for the above interface we get
371D57D9-0FF3-402C-AB69-E88FF9D85BC3:f36e.1
as the unique alias name for the given IPv4 address.
Of course, if we do that, then all configured IPv4 address will always
get an alias name like this. Just skipping the alias extension for the
first IPv4 address of an interface would not be an option. Only the
IPv6 addresses would use the interface name without alias. I don't
think that's actually a problem, though, but I'm not sure.
Any thoughts on this? Is it worth it?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -