* fhandler_socket.cc (fhandler_socket::ioctl): Don't fake results

for SIOCGIFFLAGS here.  Call get_ifconf instead.
	* net.cc (get_2k_ifconf): Clean up code to generate interface name.
	Handle SIOCGIFFLAGS here.
	(get_nt_ifconf): Fake SIOCGIFFLAGS here.
	(get_95_ifconf): Ditto.
	(get_ifconf): Don't fake loopback on systems with IP Helper Lib.
	Set MTU for loopback to a more "modern" value.
This commit is contained in:
Corinna Vinschen
2007-01-04 10:11:27 +00:00
parent 7bef7db5cc
commit bcdf742178
3 changed files with 121 additions and 123 deletions

View File

@ -1,6 +1,6 @@
/* fhandler_socket.cc. See fhandler.h for a description of the fhandler classes.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
This file is part of Cygwin.
@ -1413,21 +1413,6 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
debug_printf ("error in get_ifconf");
break;
case SIOCGIFFLAGS:
ifr = (struct ifreq *) p;
if (ifr == 0)
{
set_errno (EINVAL);
return -1;
}
ifr->ifr_flags = IFF_NOTRAILERS | IFF_UP | IFF_RUNNING;
if (!strncmp(ifr->ifr_name, "lo", 2)
|| ntohl (((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr)
== INADDR_LOOPBACK)
ifr->ifr_flags |= IFF_LOOPBACK;
else
ifr->ifr_flags |= IFF_BROADCAST;
res = 0;
break;
case SIOCGIFBRDADDR:
case SIOCGIFNETMASK:
case SIOCGIFADDR:
@ -1463,6 +1448,9 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
{
switch (cmd)
{
case SIOCGIFFLAGS:
ifr->ifr_flags = ifrp->ifr_flags;
break;
case SIOCGIFADDR:
ifr->ifr_addr = ifrp->ifr_addr;
break;