getifaddrs() gif tunnel src/dst address

Ihsan Junaidi Ibrahim ihsan at grep.my
Sun Feb 17 15:51:50 UTC 2013


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.


More information about the freebsd-net mailing list