Solved

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

Posted on 2004-08-18
6
312 Views
Last Modified: 2010-04-21
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
Comment
Question by:b123coder
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:da99rmd
ID: 11829560
Hi b123coder,
Dont understand the problem with the separation.
/Rob
0
 
LVL 3

Expert Comment

by:scn
ID: 11830633
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
 

Author Comment

by:b123coder
ID: 11838426
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:scn
ID: 11838876
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
 

Author Comment

by:b123coder
ID: 11839609
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
 
LVL 3

Accepted Solution

by:
scn earned 50 total points
ID: 11840983
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now