Welcome! Log In Create A New Profile


Adding and compiling new network protocol in the linux kernel

Posted by Gaurav Suman 
This may sound like a very noob question. I'm trying to implement a UDP-based protocol in the linux kernel. I was following the UDPLite protocol implementation as a reference.

Step 1

I created a new_protocol.c in net/ipv4/
This file has a function
void _init protocol_init(void){*Code here*}
I also used

#include "udp_impl.h"
in this file as I was using some functions from the UDP protocol

Step 2

I modified the file net/ipv4/udp_impl.h to include net/new_protocol.h

Step 3

I created the file include/net/new_protocol.h where I defined the function
void protocol_init(void);

Step 4

Finally, I called the function in net/ipv4/af_inet.c. Also, I gave an include statement in this file for net/new_protocol.h

Now when I try to build the kernel, I get an error saying
undefined reference to `protocol_init()'

What am I missing here? Is my way of including header files incorrect? Do I need to include some info in the makefile to pick up the new net/ipv4/protocol.c?
Re: Adding and compiling new network protocol in the linux kernel
June 24, 2016 01:25AM
Thanx a lot gaurav for this information.

Your Email:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 17 plus 7?