Subject: Re: PPPoE?
To: None <email@example.com>
From: Justin C. Walker <firstname.lastname@example.org>
Date: 10/07/1999 21:26:53
> From: email@example.com
> Date: 1999-10-07 20:13:23 -0700
> To: der Mouse <mouse@Rodents.Montreal.QC.CA>
> Subject: Re: PPPoE?
> Cc: firstname.lastname@example.org
> In-reply-to: "07 Oct 1999 22:42:49
> X-Template-Return-Receipt-To: email@example.com
> X-Template-Reply-To: firstname.lastname@example.org
> Delivered-to: email@example.com
> X-PGP-Fingerprint: F8 24 B4 2C 8C 98 57 FD 90 5F B4 60 79 54 16 E2
> >And related to that, given an interface name, what API should I use to
> >find its MAC address? (I'm perfectly willing, for the moment, to
> >assume it's an Ethernet interface, though it'd be nice to get an error
> >rather than garbage if not.) I'd really *like* to do an AF_LINK
> >SIOCGIFADDR, but it appears to be impossible to create an AF_LINK (or
> >AF_UNSPEC) socket, and SIOCGIFADDR seems to get the address
> >the socket the ioctl is done on.
> I do not really recommend SIOCGIFADDR these days as there can be
> multiple address assigned to an interface in a family
> (for AF_LINK it may be safe to assume that there's only one,
> I think SIOCGIFCONF (then loop through the chain of addresses)
> is the best one.
There is (?) also the sysctl() approach, documented in Stevens'
UNPV12E tome (and code on his web site - www.kohala.com). It
depends on support in your particular kernel, but it's an alternative
(and "more modern"?).
The mib setup is roughly
mib = CTL_NET;
mib = AF_ROUTE;
mib = 0;
mib = family; /* only addresses of this
mib = NET_RT_IFLIST;
mib = flags; /* interface index, or 0 */
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics |
Manager, CoreOS Networking | When crypto is outlawed,
Apple Computer, Inc. | Only outlaws will have crypto.
2 Infinite Loop |
Cupertino, CA 95014 |