aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/net.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-06-10 17:24:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-06-10 17:24:00 +0000
commit7a2c0a0d6bec344172130ecdcfb3b40bbcca4873 (patch)
tree70f9e5cda1eaa74483baca47bf301569d605061f /winsup/cygwin/net.cc
parent58014a9b461716e21e1b273155c379956b3cca36 (diff)
downloadnewlib-7a2c0a0d6bec344172130ecdcfb3b40bbcca4873.zip
newlib-7a2c0a0d6bec344172130ecdcfb3b40bbcca4873.tar.gz
newlib-7a2c0a0d6bec344172130ecdcfb3b40bbcca4873.tar.bz2
* fhandler_procnet.cc (format_procnet_ifinet6): Use sprintf rather than
__small_sprintf. * net.cc (if_nametoindex): Prefer IPv6IfIndex over IfIndex for consistency with /proc/net/if_inet6. (if_indextoname): Ditto. (if_nameindex): Ditto.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 3fda2d6..d8d426b 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -2048,7 +2048,7 @@ if_nametoindex (const char *name)
for (pap = pa0; pap; pap = pap->Next)
if (strcasematch (lname, pap->AdapterName))
{
- index = pap->IfIndex;
+ index = pap->Ipv6IfIndex ?: pap->IfIndex;
break;
}
free (pa0);
@@ -2070,7 +2070,7 @@ if_indextoname (unsigned ifindex, char *ifname)
&& get_adapters_addresses (&pa0, AF_UNSPEC))
{
for (pap = pa0; pap; pap = pap->Next)
- if (ifindex == pap->IfIndex)
+ if (ifindex == (pap->Ipv6IfIndex ?: pap->IfIndex))
{
name = strcpy (ifname, pap->AdapterName);
break;
@@ -2110,9 +2110,9 @@ if_nameindex (void)
for (pap = pa0, cnt = 0; pap; pap = pap->Next)
{
for (int i = 0; i < cnt; ++i)
- if (iflist[i].if_index == (pap->IfIndex ?: pap->Ipv6IfIndex))
+ if (iflist[i].if_index == (pap->Ipv6IfIndex ?: pap->IfIndex))
goto outer_loop;
- iflist[cnt].if_index = pap->IfIndex ?: pap->Ipv6IfIndex;
+ iflist[cnt].if_index = pap->Ipv6IfIndex ?: pap->IfIndex;
strcpy (iflist[cnt].if_name = ifnamelist[cnt], pap->AdapterName);
++cnt;
outer_loop: