LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-05-2004, 01:41 AM   #1
Hammo
Member
 
Registered: Feb 2003
Posts: 31

Rep: Reputation: 1
Question interface list and mac addresses? (pcap or libnet)


Hi guys!

I need to write an application (using pcap and libnet) which at first lists ALL the available ethernet adapters on the system.

Now when using libpcap, lookupdev() searches for the first device available it finds and no other (as far as I tried).

How can I check the other ones?
If there is a way to achieve this with libnet please tell me, I am still new at it but will eventually use it in the application.

second question: how can I get the mac address of the adapters?

Thanks in advance.

PS: If someone has used winpcap before, I need something like pcap_findalldevs()

Last edited by Hammo; 01-05-2004 at 01:49 AM.
 
Old 01-05-2004, 08:44 AM   #2
GAVollink
Member
 
Registered: Apr 2002
Location: Bronx, NY
Distribution: Ubuntu
Posts: 371

Rep: Reputation: 34
Why can you NOT use "pcap_findalldevs"? Otherwise, your best off parsing /proc/net/dev yourself.
 
Old 01-05-2004, 08:53 AM   #3
Hammo
Member
 
Registered: Feb 2003
Posts: 31

Original Poster
Rep: Reputation: 1
thanks for your reply.

I cannot use findalldevs() because it is only supported in wpcap(windows) not in libpcap(linux).

sorry, but i don't understand what you mean with parsing proc/...

I am still a with linux.

PS:I still need to know the MAC addresses
 
Old 01-05-2004, 11:42 AM   #4
GAVollink
Member
 
Registered: Apr 2002
Location: Bronx, NY
Distribution: Ubuntu
Posts: 371

Rep: Reputation: 34
pcap_findalldevs does exist in libpcap.so.0.6 (and pcap.h) on my RedHat linux 9, so you may want to upgrade your pcap package.

The /proc filesystem is an interface into a lot of things that the kernel knows. If you open for reading or cat from the command line like so...

cat /proc/net/dev

You will see the output of your available devices.

Finding the MAC addresses is something that I don't know about though - I've never had a need. You may want to look into the source code for "arp" or "rarp" (reverse arp).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Libnet Baix Linux - Software 2 09-29-2009 08:22 AM
Libnet performance fr_laz Linux - Networking 0 10-31-2005 11:42 AM
Libnet gr33ndata Programming 2 10-14-2003 02:24 PM
Libnet - Libnids Shu Linux - Software 0 07-15-2003 06:42 PM
libnet problems vexer Slackware 4 06-08-2003 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration