ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Packet Transmission in the Kernel
I'm doing linux kernel programming for my senior year project at college. I've studied the tcp/ip implementation in kernel 2.4 to some extent, since i'm working on 2.4. So i was trying to transmit a test IP packet from scratch. This is being done as an extension to the kernel, in a file of my own. My implementation follows the way a packet is being transmitted in the kernel, specifically in the ip_output.c file. The problem i'm having is that when i try to find out the route for my destination using the ip_route_output() function i always get a null and hence the packet transmission doesn't occur. Here's where the problem occurs:
/* Get dst_entry if not present */
ip_route_output(&rt, dest, src, 0, dev-ifindex);
if(rt == NULL)
// some error and exit code
It turns out that rt is null. src and dest are the source and destination ip addresses in network byte order in hex. rt is defined as struct rtable* and dev is the transmitting device..that is eth0 in this case.
Does anyone have any clue about why rt is turning out to be null?
Just guessing here...but you have initialized all your pointers..right and there are no "null" fields in the call itself?.For the last parameter check if you are using the right interface ; coz that parameter does look like an interface.Print out individual fields and isolate the problem and see what field is printing out as null.