Re: How to find the different network interfaces present in the system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Got it,

Use pcap library. And use the function pcap_findalldevs().
This function directly gives all the interfaces that can be opened
using pcap library to capture the packets.




On Mon, 13 Sep 2004 22:13:45 +1000, Martijn van Oosterhout
<kleptog@svana.org> wrote:
> Do an strace on ifconfig to see how it does it.
> 
> My guess there is three options
> 
> 1. Read from /proc/net/dev
> 2. Use the ioctl interface used by ifconfig
> 3. Use netlink as used by the iproute tools
> 
> These's documentation on each of these, look it up.
> 
> 
> 
> On Mon, Sep 13, 2004 at 05:37:32PM +0530, vijay kalkoti wrote:
> > Hi all,
> >
> > How to find different network interfaces present in the system, using
> > a C program (Not by ifconfig shell command).
> >
> > And also how to find which protocol (IPv4 or IPv6), is supporting the interface.
> >
> > Thanks & Regards
> > vijayck
> > -
> > : send the line "unsubscribe linux-net" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> --
> Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> > tool for doing 5% of the work and then sitting around waiting for someone
> > else to do the other 95% so you can sue them.
> 
> 
> 
>
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux