* 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'.
This commit is contained in:
Corinna Vinschen
2001-02-07 22:50:50 +00:00
parent 93ac448707
commit 9182099c10
6 changed files with 263 additions and 163 deletions

View File

@@ -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;
}