Solved

how to write to and read from the ethernet card directly?

Posted on 1997-07-11
2
185 Views
Last Modified: 2006-11-17
Hi,

    I am doing a series of experiments about network lantency under  
    Linux. I try to write to and read from the ethernet card
    directly.

    However, because ethernet device is dynamically detected by
    Linux, that means there is no device named ether0 under /dev.
    (like /dev/ether0 in HP-UX ), I can't use open("/dev/ether0",..)
    to create a file handler like what I did under HP-UX.
   
     My problem is that how to access to such a device (eth0)
     under Linux.

     Is there anyone who knows how to do? Thanks.



   Shih-wei Li       sli@cis.ohio-state.edu


    ====================================
    System : Redhat 4.0, kernel 2.0.30
    Ethernet Card:  3Com 3c905 Boomerang 100bassTx
   
   
    --- message when booting -----
    eth0: 3Com 3c905 Boomerang 100baseTx at 0xef00,  
    00:60:97:d4:09:25, IRQ 10
    8K word-wide RAM 3:5 Rx:Tx split, autoselect/MII interface.
    Rx Pacing bug exists, disabling bus-master receives.
0
Comment
Question by:shihwei
2 Comments
 

Expert Comment

by:unitymtg
ID: 1585418
You have to use the streams interface I belive.  As to how to do that, I don't know.
0
 
LVL 1

Accepted Solution

by:
jantypas earned 50 total points
ID: 1585419
Actually, to the previous answer, Linux doesn't have STREAMS.  AT&T would want too much money for that...

Basically, UNIX ethernet drivers are not character devices ala /dev/cua0.  They are packet devices.  In most systems, there is something called a Link Level Control (LLC) interface.  Typically, it works as follows:

- Open a socket(SOCK_RAW...)
   This gives you a handle to the IP layer

- Throw an ioctl to the socket handle to ask what
  ethernet device is bound to that socket.  You'll get
  back eth0.  It doesn't really matter though, that socket
  is now used in sending RAW IP frames in and out.

- If you really need 802.2 ethernet frames, no IP even,
  use the handle information returned in the above call
  to get the device switch ID (cdevsw) of the device from
  the kernel and then use the LLC calls to read/write
  from raw ethernet.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now