Siddharth Mathur wrote:

> could somebody please tell me the problem with this
> piece of code.
> 
> i want to get the 48 bit ethernet address of my card
> in the ifreq structure.
> 
> the SIOCGIFADDR is expected to return the hw address,
> i presume...

No; use SIOCGIHWADDR instead.

> the socket system call is successful but the ioctl
> returns 'no such device'

> also if i substitute SIOCGIFADDR with SIOCGIHWADDR 
> as given in 'man netdevice' the ioctl error remains
> the same.

As Yurij said, put the device name into ifq.ifr_name.

BTW, it's probably better to use 

        s = socket(PF_INET,SOCK_DGRAM,IPPROTO_IP);

rather than

        s = socket(PF_PACKET,SOCK_DGRAM,ETH_P_IP);

as the latter requires root privilege.

-- 
Glynn Clements <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to