net/icmp: check the checksum field when recieve icmp message

According to RFC 792 page 4, do the icmp checksum if CONFIG_NET_ICMP_CHECKSUMS is set.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
This commit is contained in:
gaohedong
2025-09-09 19:06:24 +08:00
committed by Xiang Xiao
parent 51681a6a8b
commit 267df3a120
2 changed files with 20 additions and 3 deletions
+3 -1
View File
@@ -2,7 +2,8 @@
* include/nuttx/net/icmp.h
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-FileCopyrightText: 2007-2009, 2012, 2014 Gregory Nutt. All rights reserved.
* SPDX-FileCopyrightText: 2007-2009, 2012, 2014 Gregory Nutt. All rights
* reserved.
* SPDX-FileCopyrightText: 2001-2003, Adam Dunkels. All rights reserved.
* SPDX-FileContributor: Gregory Nutt <gnutt@nuttx.org>
* SPDX-FileContributor: Adam Dunkels <adam@dunkels.com>
@@ -159,6 +160,7 @@ struct icmp_stats_s
net_stats_t recv; /* Number of received ICMP packets */
net_stats_t sent; /* Number of sent ICMP packets */
net_stats_t typeerr; /* Number of ICMP packets with a wrong type */
net_stats_t csumerr; /* Number of ICMP packets with a wrong checksum */
};
#endif