This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Ethernet interface names with cygwin 1.7.5

Hello !

I am using a very simple to find all ethernet on my PC with cygwin :

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>

int get_iface_list(struct ifconf *ifconf)
   int sock, rval;

   sock = socket(AF_INET,SOCK_STREAM,0);
   if(sock < 0)
     return (-1);

   if((rval = ioctl(sock, SIOCGIFCONF , (char*) ifconf  )) < 0 )


   return rval;

int main()
   static struct ifreq ifreqs[20];
   struct ifconf ifconf;
   int  nifaces, i;

   ifconf.ifc_buf = (char*) (ifreqs);
   ifconf.ifc_len = sizeof(ifreqs);

   if(get_iface_list(&ifconf) < 0) exit(-1);

   nifaces =  ifconf.ifc_len/sizeof(struct ifreq);

   printf("Interfaces (count = %d):\n", nifaces);
   for(i = 0; i < nifaces; i++)
     printf("\t%-10s\n", ifreqs[i].ifr_name);

With cygwin 1.7.5 the result is :
$ ./a.exe
Interfaces (count = 5):
        MS TCP Loopback interface

with release 1.5.25, the result was using the well-known names (lo0, eth0, 
eth1, etc...).

How can retrieve the standard names with release 1.7.5 ? Is it a new 
naming convention ?

Thanks for your help.

Best Regards,

Laurent Métais
Software Designer 

CP Technocenter 

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]