This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XP + cygwin version 1.7: problem with /proc/net/if_inet6 format and if_indextoname


Corinna Vinschen wrote:
The scope values are not always equal to the index, as you can see in your
above output as well for the loopback.  It's also 0 for the addresses
with global scope.  The values are taken from the sin6_scope_id field
returned by the Win32 function GetAdaptersAddresses.  Compare with the
scope values printed by `ipconfig /all'.  Apparently the v6 stack in
XP uses (not quite) arbitrary numbers for local interfaces.  I don't
know the rules behind the choice, but apparently it has been fixed in
Vista.
According to http://msdn.microsoft.com/en-us/library/ms803554.aspx and http://msdn.microsoft.com/en-us/library/aa366357(VS.85).aspx the SCOPE_LEVEL for link local addresses should be 2.

BUT:

The output of ipconfig /all varies between XP and Vista for link local addresses:
Vista: fe80:...%8
XP: fe80:...%4


The same values can be found in the /proc/net/if_inet6 scope field. IMHO this makes it impossible to rely on these values.

Maybe there should be some scope tests (by IN6_IS_ADDR_* macros) in winsup/cygwin/fhandler_procnet.cc to provide a consistent value.

My question: Did I hit a bug? Is there any documentation what's the meaning of the values for scope and interface flags (they don't seem to follow the referenced definitions of the Linux kernel).

The flags field is the DAD state right now. I'm looking through what I did when I implemented that but I can't figure out anymore why I put the DAD state into this field. It looks like it should actually contain the interface flags (IFF_* values). Can somebody confirm or deny that? If that's correct, it's probably not a big deal to change that.
Well the DAD field is perfectly OK for me - because it's as close as possible to the original definition. I just could not figure out the meaning at the first glance ;-)

Further it seems that if_indextoname(...) does not work for XP while it works for Vista. Don't know if this problem is related. Did I miss something? I would appreciate any hint.

*How* does it not work. A *very* simply testcase in plain C might be helpful...
Try something like:
        int i;
        char name[IFNAMSIZ];
        for(i=0;i<255;i++) {
                if (if_indextoname (i, name)) {
                        printf("Index: %d, Name: %s\n",i, name);
                }
        }


Compare the output between XP and Vista. In my place I get many {UUIDS} on Vista:
Index: 1, Name: {3D4E88D4-6A70-11DB-B1BA-806E6F6E6963}
Index: 2, Name: {2F1F689C-4E19-439F-970B-9D3953DD3745}
Index: 3, Name: {F26D997E-07E4-4F14-9784-6D2C161038B5}
Index: 4, Name: {A3F04F10-FC76-46FC-9E8F-27B734564D1C}
Index: 5, Name: {0BFB37A4-FFB2-4AA9-B2AB-290F24210160}
Index: 6, Name: {D5445FB9-2700-4624-8C7D-A3ABDF67108A}
Index: 7, Name: {4DC0A780-6F97-4FBC-BB56-D161370E236E}
Index: 8, Name: {92F7E3A1-A7C4-4D89-A80F-C62EF31CE0DE}
Index: 9, Name: {333E49EF-C763-4F8B-ADCB-FB700E9E76DB}
Index: 10, Name: {B3B050EF-8A68-4ECC-8FEB-7E6C0EDB93F2}
Index: 11, Name: {3D4E8912-6A70-11DB-B1BA-0014220F8C51}
Index: 12, Name: {3D4E8913-6A70-11DB-B1BA-0014220F8C51}
Index: 13, Name: {65086859-22B7-11DD-BEB6-F5B211E8BF66}
Index: 14, Name: {7BE6018E-84C7-4AA5-80D9-36C0C5611E20}
Index: 15, Name: {4ED2AC47-6055-4483-8441-D89E3B1B3CD3}
Index: 16, Name: {D509BF11-3528-11DD-95EC-00163E6554AE}


On XP the function returns only few interfaces in UUID style and in a fully resolved interface-name-style:

Index: 0, Name: {571E18F0-10E9-4D0F-A998-FE68B6C687EC}
Index: 1, Name: MS TCP Loopback interface

IMHO it should return the same interface name as shown by ipconfig - otherwise there should exist a function to convert the UUID value into a human readable interface name.

Deti

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]