ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Posts: 116
Rep:
Packet Transmission in the Kernel
Dear All,
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?
Hi
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.
gud luck
Arvind
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.