Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Feb 2013 23:51:35 +0800
From:      Ihsan Junaidi Ibrahim <ihsan@grep.my>
To:        freebsd-net@freebsd.org
Subject:   getifaddrs() gif tunnel src/dst address
Message-ID:  <B471D580-B1BE-48A1-9EA0-66C3615E018C@grep.my>

index | next in thread | raw e-mail

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.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B471D580-B1BE-48A1-9EA0-66C3615E018C>