access NIC serial number

Hi all
I'm trying to access cards informations e.g. NIC's serial numbers. Ho can I read these informations pragmatically? I'm using FreeBSD as OS and C/C++ as programming language.
Thanks in advance.

That says that there is a command 'ifconfig' in FreeBSD that can show the MAC. Sources for ifconfig are probably available, so you should be able to identify the system functions that you need to fetch the data.
I found a function which do this job but I don't know how to use it.
Here's the explanation:
pci_get_vpd_readonly(device_t dev, const char *kw, const char **vptr);

The pci_get_vpd_readonly() function is used to fetch the value of a sin-
gle VPD read-only keyword for the device dev. The keyword to fetch is
identified by the two character string kw. If the device supports VPD
and provides a read-only value for the requested keyword, then *vptr is
set to point at a read-only, null-terminated copy of the value, and
pci_get_vpd_readonly() returns zero. If the device does not support VPD
or does not provide the requested keyword, then pci_get_vpd_readonly()
returns an error.

No problem with the two first arguments, I don't what to do with the last one!
Any help is appreciated ...
const char * result = 0;
if ( 0 == pci_get_vpd_readonly( dev, "XY", &result ) )
  // result now points to a valid string

Last edited on
Topic archived. No new replies allowed.