Hi,
I have written a c program to retrieve all the network interfaces.
But when I iterate through the ifaddr elements of the linklist it returns same interface many times. When I prints the ifa_name s it prints like as follow.Code:getifaddrs(&ifaddr)
lo
eth0 *
irda0
wmaster0
wlan0
pan0
lo
eth0 *
lo
eth0 *
* - repeats
I want to eliminate this repeating and need to retrieve the address that return with ifconfig -a command.
How can I overcome this ?
when I command $ifconfig -a its list as follows.
eth0 Link encap:Ethernet
irda0 Link encap:IrLAP
lo Link encap:Local
pan0 Link encap:Ethernet
wlan0 Link encap:Ethernet
wmaster0 Link encap:UNSPEC
Thank you very much.
Reg,
Nuwan Gunarathne