Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Char kernel driver with network support (UDP)

Posted on 2006-05-16
12
Medium Priority
?
325 Views
Last Modified: 2010-05-18
Hello, experts. I am ne to Linux programming at all.
  I need some help in writing such basic char kernel driver. Will be thank for some info in this topic.
  Maybe, there is a sample. I can't find it.
  The functionality I need is:
    - char driver that could send and receive UDP packs.
    - it can do that sync or async.

  Thanks.
 
P.S> have already wrote some simple driver under linux, but how to connect to network card device and what sys calls should I execute - I don't knew... :(((
0
Comment
Question by:-Thespian-
10 Comments
 
LVL 1

Expert Comment

by:jainrah
ID: 16700308
Reading through the code of any of the network drivers should help you. One that I went through was sundance.c
0
 
LVL 5

Author Comment

by:-Thespian-
ID: 16700319
can u post here the source?
0
 
LVL 1

Expert Comment

by:jainrah
ID: 16700497
Its a pretty big file. You can find it in the src directory of the kernel distribution. Or you can read the code here

http://lxr.linux.no/source/drivers/net/sundance.c
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Author Comment

by:-Thespian-
ID: 16700521
Where do u see the socket functions there?
0
 
LVL 1

Accepted Solution

by:
jainrah earned 1000 total points
ID: 16700764
There are no socket functions. sundance.c is the NIC driver. Sockets are implemented and executed above the TCP layer. The code in sundance.c will help you understand how to interact with the NIC. When talking at a kernel level, one seldom talks about sockets.

Looking closely at your question, LDD3 (Linux Device Driver ed. 3) might be of help to you. You can also read up on Netfilter Hooks. Google for them and you will find good links for both.
0
 
LVL 5

Author Comment

by:-Thespian-
ID: 16700798
I have already found the solvation, but in different sources. now I am trying to combine them. Already have made a char driver. And now trying to fill it with socket functionality...
0
 
LVL 5

Author Comment

by:-Thespian-
ID: 16701788
Now I only need the working sample of source code, where I can find the function which receives buffer and its size and form the message on this message and broadcast it.
0
 
LVL 3

Expert Comment

by:leisner
ID: 16704146
hmmm....maybe you should say what you want to accomplish...why is this a device driver instead of an application?

If you can find a way to map the solution into user space, it becomes much much simpler.
0
 
LVL 5

Author Comment

by:-Thespian-
ID: 16704154
I need it at my work...:( it is in TD.
0
 
LVL 27

Assisted Solution

by:Nopius
Nopius earned 1000 total points
ID: 16706232
As jainrah recommended, read Linux Device Drivers 3rd edition, it's available online (one PDF file per chapter): http://lwn.net/Kernel/LDD3/
It's extremely importent for device driver writers.

Next. Inside kernel sources (I have version 2.6.16-11) you may find code, that performs UDP packets sending and receiving via NIC.
This code is for IP autoconfiguration via BOOTP/DHCP when kernel is booting. Look inside this file: net/ipv4/ipconfig.c below kernel sources top level directory.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

804 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