tech-net archive

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

Re: SIOCGIFMAC / SIOCGIFHWADDR ioctl?



On Sun, Jul 03, 2022 at 10:38:55AM -0000, Michael van Elst wrote:
> nia%NetBSD.org@localhost (nia) writes:
> 
> >I am working on porting some code from Linux / macOS / FreeBSD.
> 
> >It does this:
> 
> >#ifdef FREEBSD
> >	if (ioctl(sock, SIOCGIFMAC, &ifr) == 0)
> >#else  
> >	if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0)
> >#endif
> 
> >Do we have an equivalent to this ioctl?
> 
> getifaddrs() returns all addresses of an interface including those for
> AF_LINK.
> 
> ifconfig(8) validates these by calling SIGCGLIFADDR on them.
> 
> 

Thanks, getifaddrs ended up being the answer.


Home | Main Index | Thread Index | Old Index