From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 18 13:41:19 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8A91D313 for ; Thu, 18 Apr 2013 13:41:19 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward18.mail.yandex.net (forward18.mail.yandex.net [IPv6:2a02:6b8:0:1402::3]) by mx1.freebsd.org (Postfix) with ESMTP id 3ED06EBA for ; Thu, 18 Apr 2013 13:41:19 +0000 (UTC) Received: from smtp19.mail.yandex.net (smtp19.mail.yandex.net [95.108.252.19]) by forward18.mail.yandex.net (Yandex) with ESMTP id E042C1780842; Thu, 18 Apr 2013 17:41:16 +0400 (MSK) Received: from smtp19.mail.yandex.net (localhost [127.0.0.1]) by smtp19.mail.yandex.net (Yandex) with ESMTP id AF902BE06F0; Thu, 18 Apr 2013 17:41:16 +0400 (MSK) Received: from v10-166-111.yandex.net (v10-166-111.yandex.net [84.201.166.111]) by smtp19.mail.yandex.net (nwsmtp/Yandex) with ESMTP id oIvgLmNh5a-fGT8eIRD; Thu, 18 Apr 2013 17:41:16 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1366292476; bh=WWP+PWONMkLoo7CrBd9otgjann+n1bxGljEXUoVncOQ=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:X-Enigmail-Version:Content-Type: Content-Transfer-Encoding; b=PKRaFHc1MCkQs2NQpXgbDyzOy63RBvqRWdKit7K2fPhfVuZIzYiBATPX8fp2OYtn6 HsRP4ADjo5OItEB9PzYVRcvil5tbkJxOHTgwiEeiWU5Is1MfM4lFYDSrQaUdSJSk5W oMtQspzs2ZAXQEiGcG1ur+y6JBaYXVINRrsaApRA= Authentication-Results: smtp19.mail.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <516FF783.1040609@yandex.ru> Date: Thu, 18 Apr 2013 17:39:15 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Sreenivasa Honnur Subject: Re: PV6 bind fails with 49 (#define EADDRNOTAVAIL 49 /* Can't assign requested address */) References: In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Apr 2013 13:41:19 -0000 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