www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/05/26/18:21:08

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <374C73C0.F8840BE6@cisco.com>
Date: Wed, 26 May 1999 15:20:48 -0700
From: "Ashish C. Nagre" <ashishcn AT cisco DOT com>
Reply-To: ashishcn AT cisco DOT com
Organization: Cisco Systems
X-Mailer: Mozilla 4.03 [en] (WinNT; U)
MIME-Version: 1.0
To: cygwin AT sourceware DOT cygnus DOT com, earnie_boyd AT yahoo DOT com,
khan AT xraylith DOT wisc DOT edu
CC: noer AT cygnus DOT com, ssiddiqi AT ipass DOT net
Subject: Question about socket calls

Hello,
I am a new user of cygnus and am trying to port a UNIX application to NT
4.0
My problem is as follows:
	
	One of the functions tries to get all the IP addresses associated with
a network interface. For this it creates a DGRAM socket and does a few
other things, but when it makes the following call:

  THIS ONE RIGHT HERE 
	 if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
 *********************************************************
            (void)fprintf(stderr, "Error returned %d",err
            (void)sprintf(errbuf, "SIOCGIFADDR: %s: %s",
               device,strerror(errno));

            (void)close(fd);
            return (-1);
        }

It returns errno = 22 which means Invalid argument.
SIOCGIFADDR has been defined by me as follows:

#define IOC_INOUT       (IOC_IN) /* |IOC_OUT) */
#define _IOWR(x, y, t) \
        (IOC_INOUT|((((int)sizeof (t))&IOCPARM_MASK)<<16)|(x<<8)|y)
#define SIOCGIFADDR     _IOWR('i', 13, struct ifreq)    /* get ifnet
address */

Since there was no _IOWR defined in the include/asm/socket.h

Can someone please tell me how I could get all the IP addresses
associated with an interface or why the above call does not work.
Your help is greatly appreciated.


Regards,
Ashish

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019