LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-27-2005, 12:26 AM   #1
wangjinyi
Member
 
Registered: Sep 2004
Posts: 60

Rep: Reputation: 15
How to use NIC driver directly?


platform: fedora core 2.
language:c/c++

I want to use the driver of network interface card directly.
that means i can write a new protocol which is not base
on ip.

how?
any archive to follow?

i'll appreciate you for any information.
 
Old 04-27-2005, 10:15 PM   #2
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
I think you don't need to write drivers if you intend to use MAC. But i may be wrong.
 
Old 04-28-2005, 04:31 AM   #3
wangjinyi
Member
 
Registered: Sep 2004
Posts: 60

Original Poster
Rep: Reputation: 15
yes, i want not to write any drivers.
but, i want to communicate with the driver of NIC directly to send packet generated by me.

maybe the ioctl function is helpful. is it right?
 
Old 04-28-2005, 02:02 PM   #4
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
Hi,

You should investigate the usage of the SOCK_RAW type of socket construction (man socket). My understanding of it is that it will allow direct communications to the driver, so what whatever I/O occurs is up to you (after the ethernet and MAC layer of course).
 
Old 05-09-2005, 02:34 AM   #5
wangjinyi
Member
 
Registered: Sep 2004
Posts: 60

Original Poster
Rep: Reputation: 15
thx rstewart.

i have read the manual of socket. but i think there is a little different from you.
i consider the sock_raw is based on ip yet, so i can generate all type of packet based
on ip protocol. but, what is about the others.

are you true we can send packet not based on ip using the sock_raw.

maybe, you are right.

can you give me an example.
 
Old 05-09-2005, 11:42 AM   #6
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
Hello,

I don't have any code handy where I currently work. I used raw sockets a long time ago (in a galaxy far far away, no wait that is another story) in order to be able to send/receive data packets for a very simply MAC layer hub tester. Basically I simply used the socket() function "socket(int domain, int type, int protocol)" with the values of PF_PACKET for domain, and SOCK_RAW for type (I don't remember which value I used for the protocol, sorry).

Take a look at the socket, packet, and protocol man pages - they should be able to point you in the right direction.

Hope this helps you!
 
Old 05-09-2005, 08:10 PM   #7
wangjinyi
Member
 
Registered: Sep 2004
Posts: 60

Original Poster
Rep: Reputation: 15
thx rstewart.

you are right. i really appreciate your help.
 
  


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
NIC Driver Help OldManRiver Red Hat 3 11-29-2006 10:38 AM
NIC Driver for NVidia NForce onboard NIC. rajjpajj Linux - Software 9 09-28-2004 03:54 PM
NIC driver nrunge Linux - Hardware 0 07-30-2004 12:22 AM
Why have the LAN go directly to the firewall? Why not NIC to the webserver ONLY? piratebiter Linux - Networking 6 09-01-2003 11:16 AM
Switched Nics, new NIC has old driver, how to reinstall driver? Passive Linux - Hardware 3 04-29-2002 06:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:46 PM.

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