finding my own IPv6 address

Fredrik Thulin <>
Mon Apr 19 08:33:42 CEST 2004


Hi

In SIP, it is (unfortunately) necessary for you to know your own IP address 
from time to time. For IPv4 we (Yxa SIP-server/stack) have been using the 
undocumented and unsupported function inet:get_if() with great success. Now 
I'm wondering if there is maybe an equally undocumented and unsupported way 
of finding your own IPv6 address (without querying DNS for your hostname)?

I tried the following :

  1> {ok, S} = inet_udp:open(0,[inet6]).
  {ok,#Port<0.29>}
  2> inet:ifget(S, "vr0", [addr, flags]).
  {ok,[{addr,{130,237,95,62}},{flags,[up,broadcast,running,multicast]}]}
  3> 

to pass a v6-socket to prim_inet:ifget() instead of the default v4 socket 
inet:withsocket() would use, but unfortunately it only returns my v4 address.

Anybody know a way of doing this?

/Fredrik




More information about the erlang-questions mailing list