Solved

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

Posted on 1997-07-11
2
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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