Solved

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

Posted on 1997-07-11
2
194 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

831 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