GSOC2025IcmpSocket: Difference between revisions

From Nsnam
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 11: Line 11:
* '''Project Goals: Develop an ICMP socket according to LINUX implementation of ICMP SOCK_DGRAM and SOCK_RAW'''  
* '''Project Goals: Develop an ICMP socket according to LINUX implementation of ICMP SOCK_DGRAM and SOCK_RAW'''  
* '''Repository:'''  
* '''Repository:'''  
* '''About Me: Hi, I am Aditya Ruhela and I am a graduate from Indian Institute of Technology, Mandi. I have been working with ns-3 for about a year now. I have worked on implementation and analysis of 802.11bd as my 4th year project.'''
* '''About Me:''' Hi, I am Aditya Ruhela and I am a graduate from Indian Institute of Technology, Mandi. I have been working with ns-3 for about a year now. I have worked on implementation and analysis of 802.11bd as my 4th year project.


* '''Design Document:'''
* '''Design Document:'''
Some highlights about the SOCK_DGRAM socket:
Some highlights about the SOCK_DGRAM socket:
1. This is an L3 socket because ICMP is an L3 aspect, unlike UDP, TCP because it neither does it have any role in Transport functionality, nor does it do port-to-port mapping like previously mentioned L4 protocols.
1. This is an L3 socket because ICMP is an L3 aspect, unlike UDP, TCP because it neither does it have any role in Transport functionality, nor does it do port-to-port mapping like previously mentioned L4 protocols.


Line 25: Line 26:
Let's see the ICMP v4 socket:
Let's see the ICMP v4 socket:


Now, let's go over the functions:
'''Now, let's go over the functions:'''
1. bind(): Sets the local address of the socket. Just like other sockets.
 
2. connect(): Sets the destination address for the packet. Again, just like other sockets.
1. '''bind():''' Sets the local address of the socket. Just like other sockets.
3. close(): Free up the socket. Just like other sockets.
 
2. '''connect()''': Sets the destination address for the packet. Again, just like other sockets.
 
3. '''close()''': Free up the socket. Just like other sockets.
 
 
 
4. '''send()''': The application will call this function to send packet. This is the function responsible for adding the icmp and then passing it to the ip protocol.
 
5. '''receive()''': It receives a packet. It then gets the type of packet: req, reply, ttl exceeded or dest unreach. It then calls the specific handler.
 
6. '''handle_echo_request()''': It creates an icmp echo reply with the same payload and sends it back to the sender. THIS PACKET IS NOT SENT UP TO THE APPLICATION.
 
7. '''handle_echo_reply()''': It sends the echo_reply up to the application. It calls the m_receivedCallback function, if set by the application using setRecvCallback.
 
8. '''handle_ttl_exceeded()''': It sends the ttl error up to the application. It calls the m_ErrorCallback function, if set by the user using setErrorCallback.
 
9. '''handle_dest_unreach()''': Just like handle_ttl_exceeded but for dest_unreach packet.


4. send(): The application will call this function to send packet. This is the function responsible for adding the icmp and then passing it to the ip protocol.
10. '''setRecvCallback, setErrorCallback''' will be used to set the m_receivedCallback and m_ErrorCallback respectively.
5. receive(): It receives a packet. It then gets the type of packet: req, reply, ttl exceeded or dest unreach. It then calls the specific handler.
6. handle_echo_request(): It creates an icmp echo reply with the same payload and sends it back to the sender. THIS PACKET IS NOT SENT UP TO THE APPLICATION.
7. handle_echo_reply(): It sends the echo_reply up to the application. It calls the m_receivedCallback function, if set by the application using setRecvCallback.
8. handle_ttl_exceeded(): It sends the ttl error up to the application. It calls the m_ErrorCallback function, if set by the user using setErrorCallback.
9. handle_dest_unreach(): Just like handle_ttl_exceeded but for dest_unreach packet.
10. setRecvCallback, setErrorCallback will be used to set the m_receivedCallback and m_ErrorCallback respectively.


= Milestones =
= Milestones =

Latest revision as of 16:14, 8 July 2025

Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects

HOWTOs - Installation - Troubleshooting - User FAQ - Samples - Models - Education - Contributed Code - Papers

Back to GSoC 2025 projects

Project Overview

  • Project Name: ICMP socket and generate/handle ICMP messages (host/net unreachable)
  • Student: Aditya Ruhela
  • Mentors: Tommaso Pecorella and Alberto Gallegos Ramonet
  • Google page:
  • Project Goals: Develop an ICMP socket according to LINUX implementation of ICMP SOCK_DGRAM and SOCK_RAW
  • Repository:
  • About Me: Hi, I am Aditya Ruhela and I am a graduate from Indian Institute of Technology, Mandi. I have been working with ns-3 for about a year now. I have worked on implementation and analysis of 802.11bd as my 4th year project.
  • Design Document:

Some highlights about the SOCK_DGRAM socket:

1. This is an L3 socket because ICMP is an L3 aspect, unlike UDP, TCP because it neither does it have any role in Transport functionality, nor does it do port-to-port mapping like previously mentioned L4 protocols.

2. The user can only send ECHO_REQUEST. The other types of packets cannot be sent.

3. The user may be notified only about ECHO_REPLY and ERRORS. For that, the user has to setRecvCallback and setErrorCallback (new).

setErrorCallback is a new function that is introduced for this specific socket. This will correctly mimic the error queue icmp socket. If wanted, setErrorCallback can be removed and we can have a single setRecvCallback and the user will have to check the packet received whether is it an error or not.

Let's see the ICMP v4 socket:

Now, let's go over the functions:

1. bind(): Sets the local address of the socket. Just like other sockets.

2. connect(): Sets the destination address for the packet. Again, just like other sockets.

3. close(): Free up the socket. Just like other sockets.


4. send(): The application will call this function to send packet. This is the function responsible for adding the icmp and then passing it to the ip protocol.

5. receive(): It receives a packet. It then gets the type of packet: req, reply, ttl exceeded or dest unreach. It then calls the specific handler.

6. handle_echo_request(): It creates an icmp echo reply with the same payload and sends it back to the sender. THIS PACKET IS NOT SENT UP TO THE APPLICATION.

7. handle_echo_reply(): It sends the echo_reply up to the application. It calls the m_receivedCallback function, if set by the application using setRecvCallback.

8. handle_ttl_exceeded(): It sends the ttl error up to the application. It calls the m_ErrorCallback function, if set by the user using setErrorCallback.

9. handle_dest_unreach(): Just like handle_ttl_exceeded but for dest_unreach packet.

10. setRecvCallback, setErrorCallback will be used to set the m_receivedCallback and m_ErrorCallback respectively.

Milestones