[Winpcap-users] Retireving MAC Address

Gianluca Varenni gianluca.varenni at cacetech.com
Sun Dec 21 19:43:42 GMT 2008


That will give you the IPv4/v6 address(es) of the adapter.

There's no pcap API to retrieve the MAC address of an adapter (if any).

You need to use the undocumented packet APIs to do that, the developer's pack for WinPcap has a sample showing how to do that, it's

WpdPack\Examples-remote\PacketDriver\GetMacAddress

Have a nice day
GV

  ----- Original Message ----- 
  From: ss ak 
  To: winpcap-users at winpcap.org 
  Sent: Thursday, December 18, 2008 11:16 AM
  Subject: [Winpcap-users] Retireving MAC Address


  I am working on example to get the mac address of the adapter.

  Is this the way to get the mac address of the adapter...

  char curAddr[14];
  std::string macAddrFormat("%02x:%02x:%02x:%02x:%02x:%02x");
      /* Jump to the selected adapter */
      for(d=alldevs, i=0; i< inum-1 ;d=d->next, i++);

      printf("\n adrress %02x:%02x:%02x:%02x:%02x:%02x",
          d->addresses->addr->sa_data[0],
              d->addresses->addr->sa_data[1],
              d->addresses->addr->sa_data[2],
              d->addresses->addr->sa_data[3],
              d->addresses->addr->sa_data[4],
              d->addresses->addr->sa_data[5]);


  snprintf(&curAddr[0],18,macAddrFormat.c_str(),
                  d->addresses->addr->sa_data[0],
              d->addresses->addr->sa_data[1],
              d->addresses->addr->sa_data[2],
              d->addresses->addr->sa_data[3],
              d->addresses->addr->sa_data[4],
              d->addresses->addr->sa_data[5]);

  I have to compare the mac address from my config file and only allow that adapter to  capture packets...
  Please tell me how to do...its URGENT...

  Thanks in advance,,,,




------------------------------------------------------------------------------


  _______________________________________________
  Winpcap-users mailing list
  Winpcap-users at winpcap.org
  https://www.winpcap.org/mailman/listinfo/winpcap-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20081221/da8c7ae8/attachment.htm


More information about the Winpcap-users mailing list