44 #if LWIP_IPV4 && LWIP_ICMP  
   54 #ifdef LWIP_HOOK_FILENAME 
   55 #include LWIP_HOOK_FILENAME 
   61 #ifndef LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN 
   62 #define LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN 1 
   66 #define ICMP_DEST_UNREACH_DATASIZE 8 
   68 static void icmp_send_response(
struct pbuf *p, 
u8_t type, 
u8_t code);
 
   80 icmp_input(
struct pbuf *p, 
struct netif *inp)
 
   87   const struct ip_hdr *iphdr_in;
 
   89   const ip4_addr_t* src;
 
   94   iphdr_in = ip4_current_header();
 
   95   hlen = 
IPH_HL(iphdr_in) * 4;
 
  117     src = ip4_current_dest_addr();
 
  119     if (ip4_addr_ismulticast(ip4_current_dest_addr())) {
 
  120 #if LWIP_MULTICAST_PING 
  122       src = netif_ip4_addr(inp);
 
  130 #if LWIP_BROADCAST_PING 
  132       src = netif_ip4_addr(inp);
 
  143 #if CHECKSUM_CHECK_ICMP 
  154 #if LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN 
  175         LWIP_ASSERT(
"icmp_input: moving r->payload to icmp header failed\n", 0);
 
  192         LWIP_ASSERT(
"icmp_input: restoring original p->payload failed\n", 0);
 
  206       ip4_addr_copy(iphdr->src, *src);
 
  207       ip4_addr_copy(iphdr->dest, *ip4_current_src_addr());
 
  209 #if CHECKSUM_GEN_ICMP 
  218 #if LWIP_CHECKSUM_CTRL_PER_NETIF 
  282 #if LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN || !LWIP_MULTICAST_PING || !LWIP_BROADCAST_PING 
  307 #if IP_FORWARD || IP_REASSEMBLY 
  319   icmp_send_response(p, 
ICMP_TE, t);
 
  333 icmp_send_response(
struct pbuf *p, 
u8_t type, 
u8_t code)
 
  339   ip4_addr_t iphdr_src;
 
  353   LWIP_ASSERT(
"check that first pbuf can hold icmp message",
 
  358   ip4_addr_debug_print_val(
ICMP_DEBUG, iphdr->src);
 
  360   ip4_addr_debug_print_val(
ICMP_DEBUG, iphdr->dest);
 
  364   icmphdr->type = type;
 
  365   icmphdr->code = code;
 
  371           IP_HLEN + ICMP_DEST_UNREACH_DATASIZE);
 
  373   ip4_addr_copy(iphdr_src, iphdr->src);
 
  374 #ifdef LWIP_HOOK_IP4_ROUTE_SRC 
  376     ip4_addr_t iphdr_dst;
 
  377     ip4_addr_copy(iphdr_dst, iphdr->dest);
 
  378     netif = ip4_route_src(&iphdr_src, &iphdr_dst);
 
  381   netif = ip4_route(&iphdr_src);
 
  386 #if CHECKSUM_GEN_ICMP