Clarify specification of in4_cksum; add description of in_cksum and
in6_cksum as well as makefile goo to install links.
This commit is contained in:
parent
905f1ba6a0
commit
4b6c6f444a
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.79 2001/05/23 15:59:58 sommerfeld Exp $
|
||||
# $NetBSD: Makefile,v 1.80 2001/05/24 14:04:41 sommerfeld Exp $
|
||||
|
||||
# Makefile for section 9 (kernel function and variable) manual pages.
|
||||
|
||||
|
@ -79,6 +79,8 @@ MLINKS+=extent.9 extent_create.9 extent.9 extent_destroy.9 \
|
|||
MLINKS+=fetch.9 fubyte.9 fetch.9 fuibyte.9 fetch.9 fusword.9 \
|
||||
fetch.9 fuswintr.9 fetch.9 fuword.9 fetch.9 fuiword.9
|
||||
MLINKS+=humanize_number.9 format_bytes.9
|
||||
MLINKS+=in4_cksum.9 in_cksum.9 \
|
||||
in4_cksum.9 in6_cksum.9
|
||||
MLINKS+=kprintf.9 printf.9 kprintf.9 sprintf.9 kprintf.9 snprintf.9 \
|
||||
kprintf.9 vprintf.9 kprintf.9 vsprintf.9 kprintf.9 vsnprintf.9 \
|
||||
kprintf.9 uprintf.9 kprintf.9 ttyprintf.9 \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: in4_cksum.9,v 1.2 2001/05/23 18:49:59 wiz Exp $
|
||||
.\" $NetBSD: in4_cksum.9,v 1.3 2001/05/24 14:04:41 sommerfeld Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -35,20 +35,30 @@
|
|||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd May 22, 2001
|
||||
.Dt in4_cksum 9
|
||||
.Dt in_cksum 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm in4_cksum
|
||||
.Nd compute checksum for IPv4 packets
|
||||
.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 ones-complement checksum required by the
|
||||
.Xr inet 4
|
||||
protocol family over a range of bytes starting at
|
||||
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
|
||||
|
@ -60,25 +70,50 @@ If the
|
|||
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; a pseudo-header is constructed as specified
|
||||
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
|
||||
This function is almost always performance critical and should be
|
||||
reimplemented in assembler or optimized C for each platform; use of
|
||||
repeated full-width add-with-carry followed by reduction of the sum to
|
||||
a 16 bit width usually leads to best results.
|
||||
.Sh RETURN VALUES
|
||||
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 in4_cksum
|
||||
function returns the computed checksum value.
|
||||
.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 tcp 4 ,
|
||||
.Xr udp 4 ,
|
||||
.Xr inet6 4 ,
|
||||
.Xr mbuf 9 ,
|
||||
.Xr protocols 5 ,
|
||||
.Xr mbuf 9
|
||||
.Xr tcp 4 ,
|
||||
.Xr udp 4
|
||||
.Sh STANDARDS
|
||||
These functions implement the Internet transport-layer checksum as specified
|
||||
in RFC768, RFC793, and RFC2460.
|
||||
.Sh BUGS
|
||||
The
|
||||
.Fn in4_cksum
|
||||
function implements the checksum specified in RFC768 and RFC793.
|
||||
.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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue