?
Solved

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

Posted on 1997-07-11
2
Medium Priority
?
208 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 100 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 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