1
0
Fork 0
forked from nuttx/nuttx-update

Remove redundant length checking

Signed-off-by: wangjunfeng0 <wangjunfeng3@xiaomi.com>
This commit is contained in:
wangjunfeng0 2022-12-14 17:42:30 +08:00 committed by Xiang Xiao
parent c74cb1aaa5
commit b2b014df0b

View file

@ -74,13 +74,6 @@ uint16_t ipv4_upperlayer_chksum(FAR struct net_driver_s *dev, uint8_t proto)
upperlen = (((uint16_t)(ipv4->len[0]) << 8) + ipv4->len[1]) - iphdrlen;
/* Verify some minimal assumptions */
if (upperlen > NETDEV_PKTSIZE(dev))
{
return 0;
}
/* First sum pseudo-header.
*
* IP protocol and length fields. This addition cannot carry.
@ -142,13 +135,6 @@ uint16_t ipv6_upperlayer_chksum(FAR struct net_driver_s *dev,
upperlen -= (iplen - IPv6_HDRLEN);
/* Verify some minimal assumptions */
if (upperlen > NETDEV_PKTSIZE(dev))
{
return 0;
}
/* The checksum is calculated starting with a pseudo-header of IPv6 header
* fields according to the IPv6 standard, which consists of the source
* and destination addresses, the packet length and the next header field.