help to separate implemenation of IP and LINK layers in ip_output.c

Hi,
            I want to split ip_output.c file into 2 files for kernel 2.4.24 in ipv4 directory. the purpose for doing this is to separate the IP layer and Ethernet Layer. In ip_output.c both layers are implemented in that single file. what changes i required to that?
              Help to split that file.
b123coderAsked:
Who is Participating?
 
scnCommented:
I think you can't implement such a functionality at IP layer because it can manipulate only IP packets, i.e. skbuffs beginning with an IP header, which is not respected if you add a private header before it.
My suggestion would be to implement it inside a virtual network interface. You may have a look at Alessandro Rubini's article available at http://www.linux-mag.com/2000-04/gear_01.html.
0
 
da99rmdCommented:
Hi b123coder,
Dont understand the problem with the separation.
/Rob
0
 
scnCommented:
What do you mean by ip_output.c implements both IP and Ethernet layer?

After the IP_POST_ROUTING netfilter hook, the only function called is ip_finish_output2() which:
- if the network driver associated to the routing table entry implements a dev->hard_header function and if the network interface has the flag ARP up, the function tries to resolve the IP address and prepends the hardware header to the skbuff,
- calls dev_queue_xmit()

Perhaps, you could explain for which purpose you need this split?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
b123coderAuthor Commented:
Hi scn and da99rmd,
          By IP layer I mean IP header is added by ip_queue_xmit() for TCP packets and  ip_build_xmit(),ip_build_xmit_slow() for ICMP,IP,UDP packets. then as you told After the IP_POST_ROUTING netfilter hook, the only function called is ip_finish_output2() which is used for addindg HW header to send that packet on network.
        If this is correct then Can I say ip_output.c file implements both IP and Ethernet Layer?
         The purpose is that i want to add a new protocol handler instead of ip_rcv handler by inserting a new functionality to IP Layer.
0
 
scnCommented:
The usual way to add a new functionality to the IP layer is to register the new kernel module near one or several netfilter hooks of the IP layer. For instance, if this module registers a function near the IP_PRE_ROUTING hook, it will be called from the ip_rcv function for each IP packet and will be able to consult, modify, steal or discard each packet.
The netfilter framework is flexible and has a lot of chances to respond to your needs.
Modifying directly the kernel sources (e.g. ip_output.c) is not recommended as your functionality would be hardly portable to different kernel versions.
0
 
b123coderAuthor Commented:
Hi scn,
          Let me tell you my full implementation requirement. I want to add 8 byte header in between IP layer and Ethernet Layer for that i want to separate the file and make ip_output.c for IP layer and My_output.c for My own header and Ethernet header and add new protocol handler. so what i want to know is that That is require me to modify kernel source or write a kernel module ?
       Does this thing require me to use netfilter files or  NF_HOOKS ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.