Sean Boudreau(deleted)
|
Re: usr/include/net/if.h ifprefix changes from 6.3.2 to 6.4.1
|
Sean Boudreau(deleted)
08/24/2009 9:08 AM
post36501
|
Re: usr/include/net/if.h ifprefix changes from 6.3.2 to 6.4.1
On Thu, Aug 20, 2009 at 05:48:14PM -0400, Liam Howlett wrote:
> So in ifconfig, the struct that's used is an in6_ifreq. How do I get from an ifnet to an in6_ifreq? Or how do I get
from the sockaddr returned from the getifaddrs to an in6_ifreq?
>
> Basically I have to match up an ifnet to a prefix, but I don't know how to get the information from an ifnet or from a
sockaddr directly or indirectly.
prefixes are associated with addresses which in turn are
associated with interfaces (struct ifnet). An interface
may have more than one address and therefore more than
one prefix. As per the ifconfig example:
memset(&ifr6, 0, sizeof(ifr6));
strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
ifr6.ifr_addr = creq->ifr_addr;
if (ioctl(s, SIOCGIFNETMASK_IN6, &ifr6) == -1) {
...
...
}
You put the interface name in ifr6.ifr_name and the
address you want the prefix for in ifr6.ifr_addr.
The SIOCGIFNETMASK_IN6 ioctl will return out the
prefix for that address on that particular interface.
-seanb
|
|
|