Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-02-08 01:50:50 +0300
committerCorinna Vinschen <corinna@vinschen.de>2001-02-08 01:50:50 +0300
commit9182099c105321c24a12b53183f92cc58f4e0580 (patch)
treeec80e1de7965359155d6ff7c68d4d5450e1641a0 /winsup/cygwin/fhandler_socket.cc
parent93ac44870753d7b4650d2575ae5d68bd0432f59e (diff)
* autoload.cc: Add LoadDLLinitfunc for iphlpapi.dll.
Add LoadDLLfuncEx statements for GetIfTable@12 and GetIpAddrTable@12. * fhandler_socket.cc (fhandler_socket::ioctl): Move variable definitions to the beginning of the function to allow better debugging. Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. * net.cc: Include iphlpapi.h. (get_2k_ifconf): Rewritten. Uses IP Helper API now. (get_nt_ifconf): Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. (get_95_ifconf): Ditto. Renamed from `get_9x_ifconf'. (get_ifconf): Name loopback `lo' instead of `lo0' as in Linux. Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. Call `get_95_ifconf' only on Windows 95, `get_nt_ifconf' only on Windows NT < Service Pack 3, `get_2k_ifconf otherwise. * include/asm/socket.h: Add defines for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. * include/cygwin/if.h: Add `ifr_hwaddr', `ifr_metric' and `ifr_mtu'. (struct ifreq): Add `ifru_hwaddr'.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 17a6ff42b..e80a7f24b 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -159,20 +159,20 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
{
extern int get_ifconf (struct ifconf *ifc, int what); /* net.cc */
int res;
- struct ifconf *ifc;
- struct ifreq *ifr;
+ struct ifconf ifc, *ifcp;
+ struct ifreq *ifr, *ifrp;
sigframe thisframe (mainthread);
switch (cmd)
{
case SIOCGIFCONF:
- ifc = (struct ifconf *) p;
- if (ifc == 0)
+ ifcp = (struct ifconf *) p;
+ if (!ifcp)
{
set_errno (EINVAL);
return -1;
}
- res = get_ifconf (ifc, cmd);
+ res = get_ifconf (ifcp, cmd);
if (res)
debug_printf ("error in get_ifconf\n");
break;
@@ -194,14 +194,14 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
case SIOCGIFBRDADDR:
case SIOCGIFNETMASK:
case SIOCGIFADDR:
+ case SIOCGIFHWADDR:
+ case SIOCGIFMETRIC:
+ case SIOCGIFMTU:
{
- char buf[2048];
- struct ifconf ifc;
- ifc.ifc_len = sizeof (buf);
- ifc.ifc_buf = buf;
- struct ifreq *ifrp;
+ ifc.ifc_len = 2048;
+ ifc.ifc_buf = (char *) alloca (2048);
- struct ifreq *ifr = (struct ifreq *) p;
+ ifr = (struct ifreq *) p;
if (ifr == 0)
{
debug_printf ("ifr == NULL\n");
@@ -235,6 +235,15 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
case SIOCGIFNETMASK:
ifr->ifr_netmask = ifrp->ifr_netmask;
break;
+ case SIOCGIFHWADDR:
+ ifr->ifr_hwaddr = ifrp->ifr_hwaddr;
+ break;
+ case SIOCGIFMETRIC:
+ ifr->ifr_metric = ifrp->ifr_metric;
+ break;
+ case SIOCGIFMTU:
+ ifr->ifr_mtu = ifrp->ifr_mtu;
+ break;
}
break;
}