Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: csum: Clean up recv_verify_packet_ipv6

Rename ip_len to payload_len since the length in this case refers only
to the payload, and not the entire IP packet like for IPv4. While we're
at it, just use the variable directly when calling
recv_verify_packet_udp/tcp.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240930162935.980712-1-sean.anderson@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Sean Anderson and committed by
Jakub Kicinski
d772cc25 be4e3235

+5 -7
+5 -7
tools/testing/selftests/net/lib/csum.c
··· 675 675 { 676 676 struct ipv6hdr *ip6h = nh; 677 677 uint16_t proto = cfg_encap ? IPPROTO_UDP : cfg_proto; 678 - uint16_t ip_len; 678 + uint16_t payload_len; 679 679 680 680 if (len < sizeof(*ip6h) || ip6h->nexthdr != proto) 681 681 return -1; 682 682 683 - ip_len = ntohs(ip6h->payload_len); 684 - if (ip_len > len - sizeof(*ip6h)) 683 + payload_len = ntohs(ip6h->payload_len); 684 + if (payload_len > len - sizeof(*ip6h)) 685 685 return -1; 686 686 687 - len = ip_len; 688 687 iph_addr_p = &ip6h->saddr; 689 - 690 688 if (proto == IPPROTO_TCP) 691 - return recv_verify_packet_tcp(ip6h + 1, len); 689 + return recv_verify_packet_tcp(ip6h + 1, payload_len); 692 690 else 693 - return recv_verify_packet_udp(ip6h + 1, len); 691 + return recv_verify_packet_udp(ip6h + 1, payload_len); 694 692 } 695 693 696 694 /* return whether auxdata includes TP_STATUS_CSUM_VALID */