*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> in_cksum (9)              



NAME    [Toc]    [Back]

     in_cksum, in4_cksum, in6_cksum - compute Internet checksum

SYNOPSIS    [Toc]    [Back]

     in_cksum(struct mbuf *m, int len);

     in4_cksum(struct mbuf *m, uint8_t nxt, int off, int len);

     in6_cksum(struct mbuf *m, uint8_t nxt, int off, int len);

DESCRIPTION    [Toc]    [Back]

     These functions are used to compute the ones-complement checksum required
     by IP and IPv6.  The in4_cksum() function is used to compute the transport-layer
 checksum required by tcp(4) and udp(4) over a range of bytes
     starting at off and continuing on for len bytes within the mbuf m.

     If the nxt parameter is non-zero, it is assumed to be an IP protocol number.
  It is also assumed that the data within m starts with an IP header,
     and the transport-layer header starts at 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.

     The in6_cksum() function is similar; if nxt is non-zero, it is assumed
     that m starts with an IPv6 header, and that the transport-layer header
     starts after off bytes.

     The in_cksum() function is equivalent to in4_cksum(m, 0, 0, len).

     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.

RETURN VALUES    [Toc]    [Back]

     All three functions return the computed checksum value.

SEE ALSO    [Toc]    [Back]

     inet(4), inet6(4), tcp(4), udp(4), protocols(5), mbuf(9)

STANDARDS    [Toc]    [Back]

     These functions implement the Internet transport-layer checksum as specified
 in RFC768, RFC793, and RFC2460.

BUGS    [Toc]    [Back]

     The in6_cksum() function currently requires special handling of linklocal
 addresses in the pseudo-header due to the use of embedded scopeid's
 within link-local addresses.

BSD                              May 22, 2001                              BSD
[ Back ]
 Similar pages
Name OS Title
disklabel_dkcksum NetBSD compute the checksum for a disklabel
gss_verify_mic Tru64 Verify checksum of a message.
cksum Linux checksum and count the bytes in a file
sum Linux checksum and count the blocks in a file
cksum HP-UX print file checksum and sizes
cksum Tru64 Displays the checksum and byte count of a file
sum IRIX print checksum and block count of a file
md5 OpenBSD calculate a message-digest fingerprint (checksum) for a file
sum HP-UX print checksum and block or byte count of file(s)
md5 FreeBSD calculate a message-digest fingerprint (checksum) for a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service