From owner-freebsd-net@FreeBSD.ORG Sun Feb 17 15:51:50 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 26937E4C for ; Sun, 17 Feb 2013 15:51:50 +0000 (UTC) (envelope-from ihsan@grep.my) Received: from svc02-kul.b.n3labs.my (svc02-kul.b.n3labs.my [IPv6:2400:3700:10::61]) by mx1.freebsd.org (Postfix) with ESMTP id DDD7CCD5 for ; Sun, 17 Feb 2013 15:51:49 +0000 (UTC) Received: from [IPv6:2400:3700:49::7d9c:a406:7d96:95e5] (unknown [IPv6:2400:3700:49:0:7d9c:a406:7d96:95e5]) by svc02-kul.b.n3labs.my (Postfix) with ESMTPSA id ADD8EC60237 for ; Sun, 17 Feb 2013 23:51:39 +0800 (MYT) From: Ihsan Junaidi Ibrahim Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: getifaddrs() gif tunnel src/dst address Message-Id: Date: Sun, 17 Feb 2013 23:51:35 +0800 To: freebsd-net@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) X-Mailer: Apple Mail (2.1499) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 15:51:50 -0000 Hi, I've been trying to obtain gif tunnel addresses via getifaddrs() but = I've not been able to. The tunnel addresses can be inet/inet6 depending = on the scenario. I can however get the inet/inet6 address of the interface. Is there a way to get them? Also looking at if_gif.c, I notice that there's the following ioctl = flags: - SIOCGLIFPHYADDR - SIOCGIFPSRCADDR(_IN6)/SIOCGIFPDSTADDR(_IN6) - SIOCGIFPHYADDR/SIOCIFPHYADDR_IN6 that I can use to get the addresses however due to my limited knowledge, = I can't seem to figure them out. I believe getifaddrs() invoke one of these flags to return the = inet/inet6 address of the interface when the sa_family refers to = AF_INET/AF_INET6. I've tried matching AF_LINK and managed to match sockaddr_dl.sdl_type = with IFT_GIF but I'm not sure where the tunnel addresses are stored on = that structure. I'm hoping for the collective wisdom to assist me here. Thanks.=