tags:

views:

157

answers:

2

I am assigning ipv6 address using ioctl() system call prgramtically. I want to know if there is a way, i can find the assigned ip is tentative/duplicate ?

Thanks.

+1  A: 

Host: Enumerate the interfaces with getifaddrs().

(edit) Looks like you need to call sysctl(NET_IPV6_OPT_DAD_ENABLE) before getifaddrs()?

http://lwn.net/Articles/218597/

Network: Send an ICMP ping is the typical but not fool proof method that DHCP servers use.

It is assumed if you are setting the IP then you are implementing a form of DHCP and you control all the addresses for that segment. Otherwise just use the link-local scope already unique addresses.

Steve-o
Thanks for your response. I am checking on the host. I assign the IPv6 address and then i want to know if it is not tentative/duplicate.The getifaddrs() function gives only SIOCGIFFLAGS in which IFA_F_TENTATIVE doesn't exist. The "ip" command tells me if the IP is tentative using the command "ip addr show <interface name>
Krishna
I am going through the sources of iproute package which constitutes "ip". Didn't have any luck though... :-(
Krishna
+1  A: 

You can read TENTATIVE flag of IPv6 Address as below:

Indicates flags that are set on the multicast address. As of RFC 2373, the only flag defined is the Transient (T) flag. The T flag uses the low-order bit of the Flags field.

* If 0, the multicast address is a permanently assigned, well-known multicast address allocated by the Internet Assigned Numbers Authority (IANA).
* If 1, the multicast address is a not permanently assigned, or transient.
VirtualAssist
Hi,Thanks for your response.I think, that works only for multi-cast IPv6 addresses. It's not for Link-local,site-local and global addresses i guess. But, i am able to use netlink sockets to retrieve the flags though.Regards,-Krishna
Krishna