On Wed, Oct 10, 2001 at 11:40:39PM +0900, Kim Kyung-hwan wrote: > Hello, > > In most case of printing (ethernet) link level address, > program does a SIOCGIFCONF ioctl, gets a ifconf structure(the whole > interface list), finds the very interface and prints the address. > What I want to is to use SIOCGIFADDR so that program finds the > address. > > My program does > 1) get a socket (AF_INET) > 2) make appropriate ifreq structure; > copy interface name and set sa_family to AF_LINK > 3) SIOCGIFADDR ioctl > > But returned ifreq structure doesn't have sockaddr_dl structure. > It is impossible to get link level address using SIOCGIFADDR? > Nope, not possible.
But this could be done with CTL_NET.PF_ROUTE.NET_RT_IFLIST sysctl(3), by setting the fourth level to AF_LINK. See lib/libc/net/getifaddrs.c for a working example. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, [EMAIL PROTECTED] Sunbay Software AG, [EMAIL PROTECTED] FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-net" in the body of the message