2014-05-30 21:32:10 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* net/icmp/icmp_input.c
|
2024-09-11 14:39:39 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2014-05-30 21:32:10 +02:00
|
|
|
*
|
2019-03-19 16:43:32 +01:00
|
|
|
* Copyright (C) 2007-2009, 2012, 2014-2015, 2017, 2019 Gregory Nutt. All
|
|
|
|
* rights reserved.
|
2014-05-30 21:32:10 +02:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
*
|
|
|
|
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
|
|
|
*
|
|
|
|
* Original author Adam Dunkels <adam@dunkels.com>
|
|
|
|
* Copyright () 2001-2003, Adam Dunkels.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote
|
|
|
|
* products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
|
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
|
|
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#ifdef CONFIG_NET
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-02-25 19:17:55 +01:00
|
|
|
#include <string.h>
|
2014-05-30 21:32:10 +02:00
|
|
|
#include <debug.h>
|
2023-05-11 13:32:30 +02:00
|
|
|
#include <sys/time.h>
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
#include <net/if.h>
|
2014-07-05 03:13:08 +02:00
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
2014-06-24 16:53:28 +02:00
|
|
|
#include <nuttx/net/netconfig.h>
|
2014-06-24 17:28:44 +02:00
|
|
|
#include <nuttx/net/netdev.h>
|
2014-06-26 17:32:39 +02:00
|
|
|
#include <nuttx/net/netstats.h>
|
2014-07-05 03:13:08 +02:00
|
|
|
#include <nuttx/net/ip.h>
|
2014-05-30 21:32:10 +02:00
|
|
|
|
2014-06-29 02:07:02 +02:00
|
|
|
#include "devif/devif.h"
|
2014-06-25 17:12:47 +02:00
|
|
|
#include "icmp/icmp.h"
|
2014-06-28 01:51:32 +02:00
|
|
|
#include "utils/utils.h"
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_NET_ICMP
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
#ifdef CONFIG_NET_ICMP_SOCKET
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct icmp_deliver_s
|
|
|
|
{
|
|
|
|
FAR struct net_driver_s *dev; /* Current network device */
|
|
|
|
uint16_t iphdrlen; /* The size of the IPv4 header */
|
|
|
|
bool delivered; /* Whether the message is delivered */
|
|
|
|
};
|
2017-10-23 16:45:12 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2017-10-24 19:23:08 +02:00
|
|
|
* Private Functions
|
2017-10-23 16:45:12 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
static bool icmp_filter(uint32_t filter, uint8_t type)
|
|
|
|
{
|
|
|
|
if (type < 32)
|
|
|
|
{
|
|
|
|
return ((1u << type) & filter) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do not block unknown ICMP types */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-10-23 16:45:12 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: icmp_datahandler
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle ICMP echo replies that are not accepted by the application.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* dev - Device instance only the input packet in d_buf, length = d_len;
|
|
|
|
* conn - A pointer to the ICMP connection structure
|
2023-05-09 13:09:53 +02:00
|
|
|
* iphdrlen - The size of the IPv4 header
|
2017-10-23 16:45:12 +02:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-10-23 16:45:12 +02:00
|
|
|
* The number of bytes actually buffered is returned. This will be either
|
|
|
|
* zero or equal to buflen; partial packets are not buffered.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-10-24 19:23:08 +02:00
|
|
|
static uint16_t icmp_datahandler(FAR struct net_driver_s *dev,
|
2023-05-09 13:09:53 +02:00
|
|
|
FAR struct icmp_conn_s *conn,
|
|
|
|
uint16_t iphdrlen)
|
2017-10-23 16:45:12 +02:00
|
|
|
{
|
|
|
|
FAR struct ipv4_hdr_s *ipv4;
|
|
|
|
struct sockaddr_in inaddr;
|
|
|
|
FAR struct iob_s *iob;
|
2022-11-23 12:39:40 +01:00
|
|
|
uint16_t buflen;
|
2017-10-23 16:45:12 +02:00
|
|
|
int ret;
|
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
iob = iob_tryalloc(false);
|
|
|
|
if (iob == NULL)
|
|
|
|
{
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2017-10-23 16:45:12 +02:00
|
|
|
/* Put the IPv4 address at the beginning of the read-ahead buffer */
|
|
|
|
|
2022-11-23 12:39:40 +01:00
|
|
|
ipv4 = IPv4BUF;
|
2017-10-23 16:45:12 +02:00
|
|
|
inaddr.sin_family = AF_INET;
|
2017-10-24 19:23:08 +02:00
|
|
|
inaddr.sin_port = 0;
|
2017-10-23 16:45:12 +02:00
|
|
|
|
|
|
|
net_ipv4addr_copy(inaddr.sin_addr.s_addr,
|
|
|
|
net_ip4addr_conv32(ipv4->srcipaddr));
|
2020-02-25 16:13:12 +01:00
|
|
|
memset(inaddr.sin_zero, 0, sizeof(inaddr.sin_zero));
|
2017-10-23 16:45:12 +02:00
|
|
|
|
2022-11-23 12:39:40 +01:00
|
|
|
/* Copy the src address info into the front of I/O buffer chain which
|
|
|
|
* overwrites the contents of the packet header field.
|
|
|
|
*/
|
|
|
|
|
|
|
|
memcpy(iob->io_data, &inaddr, sizeof(struct sockaddr_in));
|
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
iob_reserve(iob, sizeof(struct sockaddr_in));
|
2017-10-23 16:45:12 +02:00
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
/* Copy the ICMP message into the I/O buffer chain (without waiting) */
|
2017-10-23 16:45:12 +02:00
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
ret = iob_clone_partial(dev->d_iob, dev->d_iob->io_pktlen,
|
|
|
|
0, iob, 0, true, false);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
iob_free_chain(iob);
|
|
|
|
return ret;
|
|
|
|
}
|
2022-11-23 12:39:40 +01:00
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
buflen = dev->d_len;
|
2017-10-23 16:45:12 +02:00
|
|
|
|
|
|
|
/* Add the new I/O buffer chain to the tail of the read-ahead queue (again
|
|
|
|
* without waiting).
|
|
|
|
*/
|
|
|
|
|
|
|
|
ret = iob_tryadd_queue(iob, &conn->readahead);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
nerr("ERROR: Failed to queue the I/O buffer chain: %d\n", ret);
|
2022-11-23 12:39:40 +01:00
|
|
|
iob_free_chain(iob);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ninfo("Buffered %d bytes\n", buflen);
|
2017-10-23 16:45:12 +02:00
|
|
|
}
|
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
return buflen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: icmp_delivery_callback
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Copy the icmp package to the application according to the filter
|
|
|
|
* conditions, but ICMP_ECHO_REPLY is a special message type, if there
|
|
|
|
* is an application waiting, it will also copy.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - A pointer to the ICMP connection structure.
|
|
|
|
* arg - The context information
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2018-01-01 18:15:21 +01:00
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
static int icmp_delivery_callback(FAR struct icmp_conn_s *conn,
|
|
|
|
FAR void *arg)
|
|
|
|
{
|
|
|
|
FAR struct icmp_deliver_s *info = arg;
|
|
|
|
FAR struct net_driver_s *dev = info->dev;
|
|
|
|
FAR struct icmp_hdr_s *icmp = IPBUF(info->iphdrlen);
|
2018-01-01 18:15:21 +01:00
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
if (icmp_filter(conn->filter, icmp->type) &&
|
|
|
|
(icmp->type != ICMP_ECHO_REPLY || conn->id != icmp->id ||
|
|
|
|
conn->dev != dev))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->delivered = true;
|
|
|
|
if (devif_conn_event(dev, ICMP_NEWDATA, conn->sconn.list) == ICMP_NEWDATA)
|
|
|
|
{
|
|
|
|
icmp_datahandler(dev, conn, info->iphdrlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: icmp_deliver
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Copy the icmp package to the application according to the filter
|
|
|
|
* conditions, but ICMP_ECHO_REPLY is a special message type, if there
|
|
|
|
* is an application waiting, it will also copy.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* dev - Reference to a device driver structure.
|
|
|
|
* iphdrlen - The size of the IP header. This may be larger than
|
|
|
|
* IPv4_HDRLEN if IP option are present.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static bool icmp_deliver(FAR struct net_driver_s *dev, uint16_t iphdrlen)
|
|
|
|
{
|
|
|
|
struct icmp_deliver_s info;
|
|
|
|
|
|
|
|
info.dev = dev;
|
|
|
|
info.iphdrlen = iphdrlen;
|
|
|
|
info.delivered = false;
|
|
|
|
|
|
|
|
icmp_foreach(icmp_delivery_callback, &info);
|
|
|
|
|
|
|
|
return info.delivered;
|
2017-10-23 16:45:12 +02:00
|
|
|
}
|
|
|
|
#endif
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2014-06-25 17:12:47 +02:00
|
|
|
* Name: icmp_input
|
2014-05-30 21:32:10 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2015-01-14 23:10:38 +01:00
|
|
|
* Handle incoming ICMP input
|
2014-05-30 21:32:10 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-01-14 23:10:38 +01:00
|
|
|
* dev - The device driver structure containing the received ICMP
|
2014-05-30 21:32:10 +02:00
|
|
|
* packet
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2014-05-30 21:32:10 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2017-08-29 23:08:38 +02:00
|
|
|
* The network is locked.
|
2014-05-30 21:32:10 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
void icmp_input(FAR struct net_driver_s *dev)
|
2014-05-30 21:32:10 +02:00
|
|
|
{
|
2019-08-31 20:25:30 +02:00
|
|
|
FAR struct ipv4_hdr_s *ipv4 = IPv4BUF;
|
|
|
|
FAR struct icmp_hdr_s *icmp;
|
2023-05-09 13:09:53 +02:00
|
|
|
|
|
|
|
/* Get the IP header length (accounting for possible options). */
|
|
|
|
|
|
|
|
uint16_t iphdrlen = (ipv4->vhl & IPv4_HLMASK) << 2;
|
|
|
|
#ifdef CONFIG_NET_ICMP_SOCKET
|
|
|
|
bool delivered = icmp_deliver(dev, iphdrlen);
|
|
|
|
#endif
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_NET_STATISTICS
|
2014-06-26 17:32:39 +02:00
|
|
|
g_netstats.icmp.recv++;
|
2014-05-30 21:32:10 +02:00
|
|
|
#endif
|
|
|
|
|
2019-08-31 20:25:30 +02:00
|
|
|
/* The ICMP header immediately follows the IP header */
|
|
|
|
|
2022-10-26 06:35:08 +02:00
|
|
|
icmp = IPBUF(iphdrlen);
|
2019-08-31 20:25:30 +02:00
|
|
|
|
2014-05-30 21:32:10 +02:00
|
|
|
/* ICMP echo (i.e., ping) processing. This is simple, we only change the
|
|
|
|
* ICMP type from ECHO to ECHO_REPLY and adjust the ICMP checksum before
|
|
|
|
* we return the packet.
|
|
|
|
*/
|
|
|
|
|
2019-08-31 20:25:30 +02:00
|
|
|
if (icmp->type == ICMP_ECHO_REQUEST)
|
2014-05-30 21:32:10 +02:00
|
|
|
{
|
|
|
|
/* Change the ICMP type */
|
|
|
|
|
2019-08-31 20:25:30 +02:00
|
|
|
icmp->type = ICMP_ECHO_REPLY;
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
/* Swap IP addresses. */
|
|
|
|
|
2019-08-31 20:25:30 +02:00
|
|
|
net_ipv4addr_hdrcopy(ipv4->destipaddr, ipv4->srcipaddr);
|
|
|
|
net_ipv4addr_hdrcopy(ipv4->srcipaddr, &dev->d_ipaddr);
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
/* Recalculate the ICMP checksum */
|
|
|
|
|
|
|
|
#if 0
|
2019-08-31 20:25:30 +02:00
|
|
|
/* Get the IP header length (accounting for possible options). */
|
|
|
|
|
|
|
|
iphdrlen = (ipv4->vhl & IPv4_HLMASK) << 2;
|
|
|
|
|
2014-05-30 21:32:10 +02:00
|
|
|
/* The slow way... sum over the ICMP message */
|
|
|
|
|
2019-08-31 20:25:30 +02:00
|
|
|
icmp->icmpchksum = 0;
|
2021-02-19 15:01:46 +01:00
|
|
|
icmp->icmpchksum = ~icmp_chksum(dev,
|
|
|
|
(((uint16_t)ipv4->len[0] << 8) |
|
|
|
|
(uint16_t)ipv4->len[1]) - iphdrlen);
|
2019-08-31 20:25:30 +02:00
|
|
|
if (icmp->icmpchksum == 0)
|
2014-05-30 21:32:10 +02:00
|
|
|
{
|
2019-08-31 20:25:30 +02:00
|
|
|
icmp->icmpchksum = 0xffff;
|
2014-05-30 21:32:10 +02:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
/* The quick way -- Since only the type has changed, just adjust the
|
|
|
|
* checksum for the change of type
|
|
|
|
*/
|
2024-04-24 05:06:52 +02:00
|
|
|
#ifdef CONFIG_NET_ICMP_CHECKSUMS
|
2019-08-31 20:25:30 +02:00
|
|
|
if (icmp->icmpchksum >= HTONS(0xffff - (ICMP_ECHO_REQUEST << 8)))
|
2014-05-30 21:32:10 +02:00
|
|
|
{
|
2019-08-31 20:25:30 +02:00
|
|
|
icmp->icmpchksum += HTONS(ICMP_ECHO_REQUEST << 8) + 1;
|
2014-05-30 21:32:10 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-31 20:25:30 +02:00
|
|
|
icmp->icmpchksum += HTONS(ICMP_ECHO_REQUEST << 8);
|
2014-05-30 21:32:10 +02:00
|
|
|
}
|
2024-04-24 05:06:52 +02:00
|
|
|
#else
|
|
|
|
icmp->icmpchksum = 0;
|
|
|
|
#endif
|
|
|
|
|
2014-05-30 21:32:10 +02:00
|
|
|
#endif
|
|
|
|
|
2016-06-20 19:59:15 +02:00
|
|
|
ninfo("Outgoing ICMP packet length: %d (%d)\n",
|
2019-08-31 20:25:30 +02:00
|
|
|
dev->d_len, (ipv4->len[0] << 8) | ipv4->len[1]);
|
2014-05-30 21:32:10 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_NET_STATISTICS
|
2014-06-26 17:32:39 +02:00
|
|
|
g_netstats.icmp.sent++;
|
2015-01-24 15:26:12 +01:00
|
|
|
g_netstats.ipv4.sent++;
|
2014-05-30 21:32:10 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-05-11 13:32:30 +02:00
|
|
|
#if CONFIG_NET_ICMP_PMTU_ENTRIES > 0
|
|
|
|
else if (icmp->type == ICMP_DEST_UNREACHABLE)
|
|
|
|
{
|
|
|
|
if (icmp->icode == ICMP_FRAG_NEEDED)
|
|
|
|
{
|
|
|
|
FAR struct icmp_pmtu_entry *entry;
|
|
|
|
FAR struct ipv4_hdr_s *inner;
|
|
|
|
int mtu;
|
|
|
|
|
|
|
|
mtu = ntohs(icmp->data[0]) << 16 | ntohs(icmp->data[1]);
|
|
|
|
if (mtu <= 0)
|
|
|
|
{
|
|
|
|
goto typeerr;
|
|
|
|
}
|
|
|
|
|
|
|
|
inner = (FAR struct ipv4_hdr_s *)(icmp + 1);
|
|
|
|
entry = icmpv4_find_pmtu_entry(
|
|
|
|
net_ip4addr_conv32(inner->destipaddr));
|
|
|
|
if (entry == NULL)
|
|
|
|
{
|
|
|
|
icmpv4_add_pmtu_entry(
|
|
|
|
net_ip4addr_conv32(inner->destipaddr), mtu);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
entry->pmtu = mtu;
|
|
|
|
}
|
|
|
|
|
|
|
|
goto icmp_send_nothing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-05-30 21:32:10 +02:00
|
|
|
/* Otherwise the ICMP input was not processed */
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
2023-05-09 13:09:53 +02:00
|
|
|
#ifdef CONFIG_NET_ICMP_SOCKET
|
|
|
|
if (delivered)
|
|
|
|
{
|
|
|
|
goto icmp_send_nothing;
|
|
|
|
}
|
|
|
|
else if (icmp->type == ICMP_ECHO_REQUEST)
|
|
|
|
{
|
|
|
|
goto drop;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-08-31 20:25:30 +02:00
|
|
|
nwarn("WARNING: Unknown ICMP cmd: %d\n", icmp->type);
|
2014-05-30 21:32:10 +02:00
|
|
|
goto typeerr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
typeerr:
|
|
|
|
#ifdef CONFIG_NET_STATISTICS
|
2014-06-26 17:32:39 +02:00
|
|
|
g_netstats.icmp.typeerr++;
|
2017-10-23 16:45:12 +02:00
|
|
|
#endif
|
|
|
|
|
2017-10-24 23:46:32 +02:00
|
|
|
#ifdef CONFIG_NET_ICMP_SOCKET
|
2017-10-23 16:45:12 +02:00
|
|
|
drop:
|
|
|
|
#ifdef CONFIG_NET_STATISTICS
|
2014-06-26 17:32:39 +02:00
|
|
|
g_netstats.icmp.drop++;
|
2014-05-30 21:32:10 +02:00
|
|
|
#endif
|
2023-05-09 13:09:53 +02:00
|
|
|
#endif
|
2023-05-11 13:32:30 +02:00
|
|
|
|
2023-05-09 13:09:53 +02:00
|
|
|
#if defined(CONFIG_NET_ICMP_SOCKET) || CONFIG_NET_ICMP_PMTU_ENTRIES > 0
|
2023-05-11 13:32:30 +02:00
|
|
|
icmp_send_nothing:
|
|
|
|
#endif
|
|
|
|
|
2014-05-30 21:32:10 +02:00
|
|
|
dev->d_len = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET_ICMP */
|
|
|
|
#endif /* CONFIG_NET */
|