Getting MAC address?

2004-06-25 Thread Ivan Voras
How to get the MAC address for an (ethernet) interface? The linux code does this: retval = ioctl(thisint->sockInt, SIOCGIFHWADDR, &ifr); After some searching, I found SIOCSIFLLADDR ioctl, but it appears there isn't a "GET" counterpart. (I've got interface name & index available...) -- What par

Re: Getting MAC address?

2004-06-25 Thread Dmitry Morozovsky
On Sat, 26 Jun 2004, Ivan Voras wrote: IV> How to get the MAC address for an (ethernet) interface? The linux code IV> does this: IV> retval = ioctl(thisint->sockInt, SIOCGIFHWADDR, &ifr); IV> IV> After some searching, I found SIOCSIFLLADDR ioctl, but it appears there IV> isn't a "GET" counterp

Re: Getting MAC address?

2004-06-26 Thread Ivan Voras
Dmitry Morozovsky wrote: On Sat, 26 Jun 2004, Ivan Voras wrote: IV> How to get the MAC address for an (ethernet) interface? The linux code IV> does this: IV> retval = ioctl(thisint->sockInt, SIOCGIFHWADDR, &ifr); IV> IV> After some searching, I found SIOCSIFLLADDR ioctl, but it appears there IV> i

Re: Getting MAC address?

2004-06-26 Thread Doug Rabson
On Saturday 26 June 2004 10:15, Ivan Voras wrote: > Dmitry Morozovsky wrote: > > On Sat, 26 Jun 2004, Ivan Voras wrote: > > > > IV> How to get the MAC address for an (ethernet) interface? The > > linux code IV> does this: > > IV> retval = ioctl(thisint->sockInt, SIOCGIFHWADDR, &ifr); > > IV

Re: Getting MAC address?

2004-06-26 Thread Ivan Voras
Doug Rabson wrote: Its really not that hard: > [code] Don't get me wrong - it's not hard, and I've done it already, it's just that I felt there could/should be an ioctl for it :) Onto another subject: despite the recommendations (thanks!) I wanted to try the non-bpf,non-ng approach to things (if

Re: Getting MAC address?

2004-06-28 Thread Alecs King
On Sat, Jun 26, 2004 at 11:15:45AM +0200, Ivan Voras wrote: > > I was looking at it and came across getifaddrs(). This function does not > depend on a open socket (yes, mine is AF_LINK, sockaddr_dl), and > apparently returns a list of all interfaces. Is there really no other > way than to trave

Re: Getting MAC address?

2004-06-29 Thread Alecs King
On Sat, Jun 26, 2004 at 11:15:45AM +0200, Ivan Voras wrote: > > I was looking at it and came across getifaddrs(). This function does not > depend on a open socket (yes, mine is AF_LINK, sockaddr_dl), and > apparently returns a list of all interfaces. Is there really no other > way than to trave