Subject: UUID and ethernet MAC addresses
To: None <port-mac68k@netbsd.org>
From: Roger Brown <rogerhb@xtra.co.nz>
List: port-mac68k
Date: 03/23/2000 08:23:31
Hello,

I am writing an application that needs to generate UUIDs. As part of that
process I need
to get an ethernet address of the host.

On Windows I use RPC4.DLL to do the whole job, on the Mac I open a
connection to any ethernet
card (using classic calls or OpenTransport).

Currently (on Linux) I create a socket bound to the default IP address and
use
SIOCGIFCONF and enumerate through the device list from ifconf.

Then calling SIOCGIFADDR magically returns the MAC address in
ifr.ifr_hwaddr.sa_data.
On DYNIX I use SIOCGIFADDR_LINK to return a dl_ifreq to do a similar job.

The Steven's UNIX Network Programming Bible says that SIOCGARP should be
able to do the job
but I can't find it in the NetBSD /usr/include headers.

The headers do define a 'sockaddr_dl' which looks promising, but no clue as
to how to get one.

Any more pointers?

Regards,

Roger