But in this case you should not use ICMP protocol, but “just raw socket”, aka:
{:ok, socket} = :socket.open(:inet, :raw)
So this is pretty much different from your original question where you ask for the fetching list of the interfaces from raw ICMP socket.
:socket.ioctl(socket, :gifconf)
Will will return you only the configuration for the interface the socket is listening right now, not all that are available in the system.
Also I see the problem with your code - you define address map like %{:family => :inet, :port => 0} which is incorrect (weird that socket do not scream about it, or maybe it does, but you do not check the value returned by :socket.bind/2). It should be %{:family => :inet, :port => 0, :addr => address} as :addr field is mandatory according to the specs.


















