/* SPDX-License-Identifier: GPL-2.0 */ /* * arch/arm/include/asm/checksum.h * * IP checksum routines * * Copyright (C) Original authors of ../asm-i386/checksum.h * Copyright (C) 1996-1999 Russell King
*/ #ifndef __ASM_ARM_CHECKSUM_H #define __ASM_ARM_CHECKSUM_H
#include <linux/in6.h> #include <linux/uaccess.h>
/* * computes the checksum of a memory block at buff, length len, * and adds in "sum" (32-bit) * * returns a 32-bit number suitable for feeding into itself * or csum_tcpudp_magic * * this function must be called with even lengths, except * for the last fragment, which may be odd * * it's best to have buff aligned on a 32-bit boundary
*/
__wsum csum_partial(constvoid *buff, int len, __wsum sum);
/* * the same as csum_partial, but copies from src while it * checksums, and handles user-space pointer exceptions correctly, when needed. * * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary
*/
__wsum
csum_partial_copy_nocheck(constvoid *src, void *dst, int len);
__wsum
csum_partial_copy_from_user(constvoid __user *src, void *dst, int len);
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER #define _HAVE_ARCH_CSUM_AND_COPY staticinline
__wsum csum_and_copy_from_user(constvoid __user *src, void *dst, int len)
{ if (!access_ok(src, len)) return 0;
/* * This is a version of ip_compute_csum() optimized for IP headers, * which always checksum on 4 octet boundaries.
*/ staticinline __sum16
ip_fast_csum(constvoid *iph, unsignedint ihl)
{ unsignedint tmp1;
__wsum sum;
/* * this routine is used for miscellaneous IP-like checksums, mainly * in icmp.c
*/ staticinline __sum16
ip_compute_csum(constvoid *buff, int len)
{ return csum_fold(csum_partial(buff, len, 0));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.