PV6 bind fails with 49 (#define EADDRNOTAVAIL 49 /* Can't assign requested address */)

Andrey V. Elsukov bu7cher at yandex.ru
Thu Apr 18 13:41:19 UTC 2013


On 18.04.2013 15:37, Sreenivasa Honnur wrote:
> I have a ipv6 interface(ping6 to a remove ipv6 works) when I try to
> bind to this address through a socket program "sobind" fails with "49"
> as return value. If I give "saddr6.sin6_addr = in6addr_any;" sobind
> works.
> 
> Any idea what could be going wrong here?

> ifa_ifwithaddr_internal(struct sockaddr *addr, int getref)
> {
> ........
> ........
> 
> TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
>                 IF_ADDR_RLOCK(ifp);
>                 printf("ifp->xname:%s ifp->dname:%s\n",ifp->if_xname, ifp->if_dname);
>                 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
>                         if (ifa->ifa_addr->sa_family != addr->sa_family) ==>  ifa->ifa_addr->sa_family=18 & addr->sa_family=28. Even though the interface is in IPV6 mode its sa_family is not  set properly,
>                                                         continue;
> }

This tailq contains any addresses assigned to the interface,
sa_fimily=18 is for AF_LINK address, so it's ok.

-- 
WBR, Andrey V. Elsukov


More information about the freebsd-hackers mailing list