Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Any chance you've figured this out? I'm having the same problem. I'm trying to use ioctl to find my ipv6 addresses but I'm only getting back ipv4. I'm using kernel 2.6.18
use this method instead of ioctl it will work. Hope this helps
/******************************************************************
* FUNCTION: my_get_ipv6_ifindex_from_addr
*
* DESCRIPTION: this function returns ifindex for a given IPV6 address string
*
* PARAMETERS: 'ipv6_addr_str' char string in the format given by inet_ntop()
*
* RETURN VALUE: On Success return value is greater than Zero,
* Zero or Negetive on Error.
*******************************************************************/
int my_get_ipv6_ifindex_from_addr(char *ipv6_addr_str)
{
struct ifaddrs *if_addr, *ifap;
int family, res;
char host_id[NI_MAXHOST], *host_addr;
int ifcount;
int ifindex_matched = -1;
if (getifaddrs(&if_addr) == -1)
{
perror("getif_addrs");
return(ERROR);
}
ifcount = 0;
for (ifap = if_addr; ifap != NULL; ifap = ifap->ifa_next)
{
if (ifap->ifa_addr == NULL)
{
ifcount++;
continue;
}
family = ifap->ifa_addr->sa_family;
if (family == AF_INET6)
{
res = getnameinfo(ifap->ifa_addr, sizeof(struct sockaddr_in6),
host_id, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if (res != 0)
{ /* failure to get IPv6 address */
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.