0

I am somewhat new to kernel programming but am trying to modify the functionality of the ping command in Linux. I am using Ubuntu, which I believe uses iputils to create the binary ping command located in bin on my machine. However, I also found a ping.c file in the net/ipv4 and net/ipv6 folders of the Linux source code. So my main questions are:

What is the ping.c file doing in the net folders? How would one modify the ping command, seeing as it is a part of iputils? More specifically, I have pulled iputils from here, but I don't really know how to compile it/reinstall a custom package after I have modified the source code.

Any help would be much appreciated!

1 Answer 1

5

The ping binary is indeed included with iputils. If you want to modify ping, that is the place to look. You can build the program, using the instructions included with iputils.

The ping.c file in the linux source code implements a 'Ping socket'. That is an innovation that allows a user to send and receive ICMP messages without special privileges.

1
  • 2
    just to note, the reason a user can send/receive ping is because ping binary had setuid root permission and in modern OSes it has cap_net_raw+ep capabilities. Recently in Fedora a new way has been applied. unix.stackexchange.com/a/592913/254422 Commented Sep 17, 2020 at 9:25

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.