lwIP  2.1.0
Lightweight IP stack
icmp.c File Reference
#include "lwip/opt.h"
#include "lwip/icmp.h"
#include "lwip/inet_chksum.h"
#include "lwip/ip.h"
#include "lwip/def.h"
#include "lwip/stats.h"
#include <string.h>
#include "path/to/my/lwip_hooks.h"

Macros

#define LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN   1
 

Functions

void icmp_input (struct pbuf *p, struct netif *inp)
 
void icmp_dest_unreach (struct pbuf *p, enum icmp_dur_type t)
 
void icmp_time_exceeded (struct pbuf *p, enum icmp_te_type t)
 

Detailed Description

ICMP - Internet Control Message Protocol

Macro Definition Documentation

◆ LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN

#define LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN   1

Small optimization: set to 0 if incoming PBUF_POOL pbuf always can be used to modify and send a response packet (and to 1 if this is not the case, e.g. when link header is stripped off when receiving)

Function Documentation

◆ icmp_dest_unreach()

void icmp_dest_unreach ( struct pbuf p,
enum icmp_dur_type  t 
)

Send an icmp 'destination unreachable' packet, called from ip_input() if the transport layer protocol is unknown and from udp_input() if the local port is not bound.

Parameters
pthe input packet for which the 'unreachable' should be sent, p->payload pointing to the IP header
ttype of the 'unreachable' packet

◆ icmp_input()

void icmp_input ( struct pbuf p,
struct netif inp 
)

Processes ICMP input packets, called from ip_input().

Currently only processes icmp echo requests and sends out the echo response.

Parameters
pthe icmp echo request packet, p->payload pointing to the icmp header
inpthe netif on which this packet was received

◆ icmp_time_exceeded()

void icmp_time_exceeded ( struct pbuf p,
enum icmp_te_type  t 
)

Send a 'time exceeded' packet, called from ip_forward() if TTL is 0.

Parameters
pthe input packet for which the 'time exceeded' should be sent, p->payload pointing to the IP header
ttype of the 'time exceeded' packet