Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

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.
0
b123coder
Asked:
b123coder
  • 3
  • 2
1 Solution
 
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
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now