What is the path of ip_input.c?

0

1

The ip_rcv funcion defined in the ip_input.c file, is responsible for delivering the datagrams to a higher layer protocol or forwarding it to another host. It consists of functions and netfilter hooks that process an incoming datagram.

I use Ubuntu but I can't find ip_input.c. I need direct path of ip_input.c before install... enter image description here

during install... enter image description here after install... enter image description here and resutl... enter image description here

m-tech

Posted 2016-09-14T19:51:23.637

Reputation: 178

You do not have any kernel sources installed. Also, why even bother doing this locally when there's tons of sites that let you browse the Linux source code? – Daniel B – 2016-09-14T20:29:46.087

@DanielB: grep, find etc. work much better on a local copy. – dirkt – 2016-09-14T20:41:47.647

Answers

0

Use find for it on your local copy of the kernel sources:

$ cd /usr/src/linux
$ find . -name ip_input.c 
./net/ipv4/ip_input.c

And there you have the path.

dirkt

Posted 2016-09-14T19:51:23.637

Reputation: 11 627

dear you can see above image .i use ubuntu 16 but i cant find ip_input.c. what is your linux distribution and what is its version? – m-tech – 2016-09-14T20:20:35.640

You have only installed the kernel headers, not the kernel source. apt-cache search linux-source shows you what versions of the kernel source you can install (using apt-get install, or whatever you prefer to install packages). It will install the sources under /usr/src/linux-source-*version*. It's recommended to make a symlink /usr/src/linux to the source that you used to compile the kernel or to the kernel version that is running on your machine (some utilities make use of this). – dirkt – 2016-09-14T20:38:59.267

Oh, and you don't need to be root to inspect the kernel sources. Don't login as root unless you want to do sysadmin work. And even then sudo is better - less room for mistakes. – dirkt – 2016-09-14T20:48:34.523

Tanks dear,I installed it but now I want to know if I change contents of ip_input.c ,this change effect on my Linux? – m-tech – 2016-09-14T20:55:49.357

dirkt in ip_input.c there are functions that kernel need to use them.so when ip_input.c there was not in my linux how my kernel have used that funcions? you know 10 min ago i download ip_input.c – m-tech – 2016-09-14T21:04:57.237

Ubuntu and every other distribution uses a precompiled kernel image (dpkg -i '*linux-image*' | grep ^ii to see which ones you have installed). This image contains the compiled functions in ip_input.c, among lots of others. If you tell us why you are interested in these functions (if you don't just want to read the source code, which, from your questions, is maybe not what you want, though I initially assumed it was), we may be able to help you better. :-) – dirkt – 2016-09-15T06:51:21.437

Dear dirkt , you are kind .I want to change Linux function. But i have basic knowledge about Linux.I have installed Linux and want to change some function.i mean ,i want to customize my Linux . what should i do? Should i download kernel and change then compile it? or should i change my current Ubuntu without compiling?Please help me if you can. – m-tech – 2016-09-15T09:12:38.480

Yes, if you want to change the Linux function, you need to change the source, compile it, and install the kernel. However, with just basic knowledge, you won't be able to do that, because you won't how how to change the source. What do you want to change, and why do you want to change it? What is your goal? Modify datagrams? There's probably a different way to do it.(like the network filter features of the kernel). – dirkt – 2016-09-15T10:23:00.553

Dear dirkt ,I have new view on network and can't accept this roles for network.i want to create new network protocol,i think if i focus on issue i can do that.i know TCP/IP but i don't like work with simulator.i think i can. Dirkt, you are polite and kind person.thanks for your help . – m-tech – 2016-09-15T11:04:08.683