This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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]

Re: SIOCIFADDR: Device not configured



All right,
It's a good new that ethernet works well with redboot.
Anyway, it's not functionning all the same while the application is running.
(For example Redboot use a light implementation of TCP/IP and doesn't
defragment streams...)

Have u checked that the MAC adress specified with fconfig is used correctly
in the packets sended by Redboot ? (use a sniffer like ethereal for example
...)

To my point a view (but i may be wrong) U got a problem in the ethernet
driver or in the way of MAC adress is stored.(often in the flash)

There is an ioctl call used by TCP/IP stack to obtain MAC adress : it's
SIOCGIFHWADDR. I think this call is not handled correctly by the ethernet
driver which return -1 (displayed as a ff:ff:ff:ff:ff:ff adress)


Here 's a little function that makes this sort of call :

int GetMAC(const char* interface,unsigned char value[ETHER_ADDR_LEN])
{
 int test_sock=0;                       // Socket PF_INET/SOCK_DGRAM
 unsigned char i=0;
 struct ifreq ifr;
 unsigned char display[16];

 test_sock = socket( PF_INET, SOCK_DGRAM, 0 );
 if( test_sock == -1 )
 {
  diag_printf("Cannot obtain socket");
  return (-1);
 }

 memset( &ifr, 0, sizeof( struct ifreq ) );
 strncpy( ifr.ifr_name,interface,IFNAMSIZ);
 if( ioctl( test_sock, SIOCGIFHWADDR, &ifr ) == -1 )
 {
  diag_printf("Cannot obtain MAC adress :%s",strerror(errno));
  close(test_sock);
  return (-1);
 }
 close(test_sock);
 for (i=0;i<ETHER_ADDR_LEN;i++)
  value[i]=ifr.ifr_hwaddr.sa_data[i];
 return(0);
}

Hope this helps.

On Thursday 05 February 2004 01:46, you wrote:
> Hello sebastien Couret
>         Thank you for your answer .
> 	    When only redboot running,The eth0 works well.It can
> ping the host and use tftp to download file for host.I think,
>  if redboot can works, eth0 drivers and hal did not
>  have any problems.After plusing FreeBSD stack, eth0 ping_test can
> works!  But, the fact is not like this.



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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