summaryrefslogtreecommitdiff
path: root/static/netbsd/man9/in4_cksum.9
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 15:32:58 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 15:32:58 -0400
commit5cb84ec742fd33f78c8022863fadaa8d0d93e176 (patch)
tree1a81ca3665e6153923e40db7b0d988f8573ab59c /static/netbsd/man9/in4_cksum.9
parenta59214f344567c037d5776879bcfc5fcc1d4d5f6 (diff)
feat: Added NetBSD man pages
Diffstat (limited to 'static/netbsd/man9/in4_cksum.9')
-rw-r--r--static/netbsd/man9/in4_cksum.9111
1 files changed, 111 insertions, 0 deletions
diff --git a/static/netbsd/man9/in4_cksum.9 b/static/netbsd/man9/in4_cksum.9
new file mode 100644
index 00000000..46b5d489
--- /dev/null
+++ b/static/netbsd/man9/in4_cksum.9
@@ -0,0 +1,111 @@
+.\" $NetBSD: in4_cksum.9,v 1.6 2008/04/30 13:10:58 martin Exp $
+.\"
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Bill Sommerfeld.
+.\"
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``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 FOUNDATION OR CONTRIBUTORS
+.\" 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.
+.\"
+.Dd May 22, 2001
+.Dt IN_CKSUM 9
+.Os
+.Sh NAME
+.Nm in_cksum ,
+.Nm in4_cksum ,
+.Nm in6_cksum
+.Nd compute Internet checksum
+.Sh SYNOPSIS
+.Ft uint16_t
+.Fn in_cksum "struct mbuf *m" "int len"
+.Ft uint16_t
+.Fn in4_cksum "struct mbuf *m" "uint8_t nxt" "int off" "int len"
+.Ft uint16_t
+.Fn in6_cksum "struct mbuf *m" "uint8_t nxt" "int off" "int len"
+.Sh DESCRIPTION
+These functions are used to compute the ones-complement checksum
+required by IP and IPv6.
+The
+.Fn in4_cksum
+function is used to compute the transport-layer checksum required by
+.Xr tcp 4
+and
+.Xr udp 4
+over a range of bytes starting at
+.Fa off
+and continuing on for
+.Fa len
+bytes within the mbuf
+.Fa m .
+.Pp
+If the
+.Fa nxt
+parameter is non-zero, it is assumed to be an IP protocol number.
+It is also assumed that the data within
+.Fa m
+starts with an IP header, and the transport-layer header starts at
+.Fa off ;
+a pseudo-header is constructed as specified
+in RFC768 and RFC793, and the pseudo-header is prepended to the data
+covered by the checksum.
+.Pp
+The
+.Fn in6_cksum
+function is similar; if
+.Fa nxt
+is non-zero, it is assumed that
+.Fa m
+starts with an IPv6 header, and that the transport-layer header starts
+after
+.Fa off
+bytes.
+.Pp
+The
+.Fn in_cksum
+function is equivalent to
+.Fn in4_cksum "m" "0" "0" "len" .
+.Pp
+These functions are always performance critical and should be
+reimplemented in assembler or optimized C for each platform; when
+available, use of repeated full-width add-with-carry followed by
+reduction of the sum to a 16 bit width usually leads to best results.
+See RFC's 1071, 1141, 1624, and 1936 for more information about
+efficient computation of the internet checksum.
+.Sh RETURN VALUES
+All three functions return the computed checksum value.
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr inet6 4 ,
+.Xr tcp 4 ,
+.Xr udp 4 ,
+.Xr protocols 5 ,
+.Xr mbuf 9
+.Sh STANDARDS
+These functions implement the Internet transport-layer checksum as specified
+in RFC768, RFC793, and RFC2460.
+.Sh BUGS
+The
+.Fn in6_cksum
+function currently requires special handling of link-local addresses
+in the pseudo-header due to the use of embedded scope-id's within
+link-local addresses.