Skip to contentSkip to conversation

Help On function to get IPV6 address of an interface in kernel

DISCUSSION Mohan Reddy 3 participants 4 messages Mar 4, 2010 – Mar 6, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Is there a function or a way in kernel to get an interface ipv6 address if interface name or net_device object is known? I searched in the kernel i got a function ipv6_get_ifaddr(). But it is expecting an ipv6 address as a parameter.

Thanks for your help in advance.

-Mohan Reddy

#1 lore raw
Quoted 3 lines · Mohan Reddy

Hi,

Is there a function or a way in kernel to get an interface ipv6 address if interface name or net_device object is known? I searched in the kernel i got a function ipv6_get_ifaddr(). But it is expecting an ipv6 address as a parameter.

What type of IPv6 address? For link-locals you can use ipv6_get_lladdr(), but for others ipv6_dev_get_saddr() is more comprehensive, but you'll need a destination address. There's lots of reference code in addrconf.c to do other things.

-Brian

#2 lore raw

Thanks a lot Brain. ipv6_get_lladdr() helped me. Actually I want to get site-local or univeral(global) address. Though there is no direct function to get theseaddresses, ipv6_get_lladdr() shows how we can get the other addresses too.

Thanks,
Mohan Reddy

Quoted 11 lines · Brian Haley
Quoted 3 lines · Mohan Reddy

Hi,

Is there a function or a way in kernel to get an interface ipv6 address if interface name or net_device object is known? I searched in the kernel i got a function ipv6_get_ifaddr(). But it is expecting an ipv6 address as a parameter.

What type of IPv6 address? For link-locals you can use ipv6_get_lladdr(), but for others ipv6_dev_get_saddr() is more comprehensive, but you'll need a destination address. There's lots of reference code in addrconf.c to do other things.

-Brian

#3 lore raw
Quoted 2 lines · On Fri, 5 Mar 2010 21:19:34 +0530 Venkata Mohan Reddy <[email protected]>…

Thanks a lot Brain. ipv6_get_lladdr() helped me. Actually I want to get site-local or univeral(global) address. Though there is no direct function to get theseaddresses, ipv6_get_lladdr() shows how we can get the other addresses too.

Site-locals are deprecated (http://www.rfc-editor.org/rfc/rfc3879.txt),
so I wouldn't think you'll ever find a site-local specific address function. If you do find one, I'd be fairly sure it'd go away.

Quoted 19 lines

Thanks,
Mohan Reddy

Quoted 11 lines · Brian Haley
Quoted 3 lines · Mohan Reddy

Hi,

Is there a function or a way in kernel to get an interface ipv6 address if interface name or net_device object is known? I searched in the kernel i got a function ipv6_get_ifaddr(). But it is expecting an ipv6 address as a parameter.

What type of IPv6 address? For link-locals you can use ipv6_get_lladdr(), but for others ipv6_dev_get_saddr() is more comprehensive, but you'll need a destination address. There's lots of reference code in addrconf.c to do other things.

-Brian

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html