Re: getting link-layer addr of unknown interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <Pine.LNX.4.33.0112111355310.3218-100000@havoc.ittc.ku.edu> you wrote:
> I should be able to get the link-layer address of an interface by 
> specifying the interface name ie. eth0, eth1 etc.
> (mac address for ethernet)

Do it like ifconfig is doing it:

lib/interface.c
  strcpy(ifr.ifr_name, ifname);
  if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
          memset(ife->hwaddr, 0, 32);
  else
          memcpy(ife->hwaddr, ifr.ifr_hwaddr.sa_data, 8);
			  
Greetings
Bernd
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux