Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-18 Thread Matthias Andree
Am 15.06.2009, 11:22 Uhr, schrieb Frédéric Bron : To fix your application, call either  struct ifconf ifc;  ifc.ifc_len = sizeof (struct ifreq) * 32;  ifc.ifc_buf = malloc (ifc.ifc_len);  if (ioctl (fd, SIOCGIFCONF, &ifc))    /* Resize ifc_buf and retry */  else    {      struct ifreq *ifr = if

Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-16 Thread Corinna Vinschen
On Jun 16 11:56, Fr?d?ric Bron wrote: > > I applied a patch to Cygwin which also reports the IPv4 addresses of > > disconnected interfaces, fetching the info from the registry.  It's > > a pity that Windows doesn't correctly report these addresses in the > > official API. > > > > This won't work fo

Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-16 Thread Frédéric Bron
> I applied a patch to Cygwin which also reports the IPv4 addresses of > disconnected interfaces, fetching the info from the registry.  It's > a pity that Windows doesn't correctly report these addresses in the > official API. > > This won't work for IPv6 and IPv6-only interfaces.  I didn't find a

Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-15 Thread Corinna Vinschen
On Jun 15 13:42, Corinna Vinschen wrote: > On Jun 15 11:22, Fr?d?ric Bron wrote: > > > To fix your application, call either > > > > > >  struct ifconf ifc; > > >  ifc.ifc_len = sizeof (struct ifreq) * 32; > > >  ifc.ifc_buf = malloc (ifc.ifc_len); > > >  if (ioctl (fd, SIOCGIFCONF, &ifc)) > > >    

Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-15 Thread Corinna Vinschen
On Jun 15 11:22, Fr?d?ric Bron wrote: > > To fix your application, call either > > > >  struct ifconf ifc; > >  ifc.ifc_len = sizeof (struct ifreq) * 32; > >  ifc.ifc_buf = malloc (ifc.ifc_len); > >  if (ioctl (fd, SIOCGIFCONF, &ifc)) > >    /* Resize ifc_buf and retry */ > >  else > >    { > >    

Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-15 Thread Frédéric Bron
> To fix your application, call either > >  struct ifconf ifc; >  ifc.ifc_len = sizeof (struct ifreq) * 32; >  ifc.ifc_buf = malloc (ifc.ifc_len); >  if (ioctl (fd, SIOCGIFCONF, &ifc)) >    /* Resize ifc_buf and retry */ >  else >    { >      struct ifreq *ifr = ifc.ifc_req; >      struct ifreq ifr

Re: ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-12 Thread Corinna Vinschen
On Jun 12 14:30, Fr?d?ric Bron wrote: > I used the following program to obtain mac address and ip of network > adpaters. It works fine with 1.5 but not with 1.7. > > Output with 1.5: > sock=3 > trying eth0 > mac: 00.1f.3c.57.XX.XX, ip: XXX.XXX.XXX.XXX > trying eth1 > mac: 00.1d.09.df.XX.XX, ip: XX

ioctl(sock, SIOCGIFHWADDR, &ifr) fails with 1.7

2009-06-12 Thread Frédéric Bron
I used the following program to obtain mac address and ip of network adpaters. It works fine with 1.5 but not with 1.7. Output with 1.5: sock=3 trying eth0 mac: 00.1f.3c.57.XX.XX, ip: XXX.XXX.XXX.XXX trying eth1 mac: 00.1d.09.df.XX.XX, ip: XXX.XXX.XXX.XXX trying eth2 mac: 08.00.27.00.XX.XX, ip: XX