<s>
The	O
Internet	B-Protocol
checksum	I-Protocol
,	O
also	O
called	O
the	O
IPv4	B-Protocol
header	I-Protocol
checksum	I-Protocol
is	O
a	O
checksum	B-Algorithm
used	O
in	O
version	B-Protocol
4	I-Protocol
of	O
the	O
Internet	B-Protocol
Protocol	I-Protocol
(	O
IPv4	B-Protocol
)	O
to	O
detect	O
corruption	O
in	O
the	O
header	O
of	O
IPv4	B-Protocol
packets	O
.	O
</s>
<s>
The	O
IPv6	B-Protocol
protocol	O
does	O
not	O
use	O
header	B-Algorithm
checksums	I-Algorithm
.	O
</s>
<s>
Its	O
designers	O
considered	O
that	O
the	O
whole-packet	O
link	O
layer	O
checksumming	O
provided	O
in	O
protocols	O
,	O
such	O
as	O
PPP	B-Protocol
and	O
Ethernet	O
,	O
combined	O
with	O
the	O
use	O
of	O
checksums	B-Algorithm
in	O
upper	O
layer	O
protocols	O
such	O
as	O
TCP	B-Protocol
and	O
UDP	B-Protocol
,	O
are	O
sufficient	O
.	O
</s>
<s>
Thus	O
,	O
IPv6	B-Protocol
routers	O
are	O
relieved	O
of	O
the	O
task	O
of	O
recomputing	O
the	O
checksum	B-Algorithm
whenever	O
the	O
packet	O
changes	O
,	O
for	O
instance	O
by	O
the	O
lowering	O
of	O
the	O
Hop	B-Protocol
limit	I-Protocol
counter	O
on	O
every	O
hop	O
.	O
</s>
<s>
The	O
Internet	B-Protocol
checksum	I-Protocol
is	O
mandatory	O
to	O
detect	O
errors	O
in	O
IPV6	B-Protocol
UDP	B-Protocol
packets	I-Protocol
(	O
including	O
data	O
payload	O
)	O
.	O
</s>
<s>
The	O
Internet	B-Protocol
checksum	I-Protocol
is	O
used	O
to	O
detect	O
errors	O
in	O
ICMP	O
packets	O
(	O
including	O
data	O
payload	O
)	O
.	O
</s>
<s>
The	O
checksum	B-Algorithm
calculation	O
is	O
defined	O
in	O
RFC	O
791	O
:	O
</s>
<s>
The	O
checksum	B-Algorithm
field	O
is	O
the	O
16-bit	O
ones	O
 '	O
complement	O
of	O
the	O
ones	O
 '	O
complement	O
sum	O
of	O
all	O
16-bit	O
words	O
in	O
the	O
header	O
.	O
</s>
<s>
For	O
purposes	O
of	O
computing	O
the	O
checksum	B-Algorithm
,	O
the	O
value	O
of	O
the	O
checksum	B-Algorithm
field	O
is	O
zero	O
.	O
</s>
<s>
If	O
there	O
is	O
no	O
corruption	O
,	O
the	O
result	O
of	O
summing	O
the	O
entire	O
IP	O
header	O
,	O
including	O
checksum	B-Algorithm
,	O
should	O
be	O
zero	O
.	O
</s>
<s>
At	O
each	O
hop	O
,	O
the	O
checksum	B-Algorithm
is	O
verified	O
.	O
</s>
<s>
Packets	O
with	O
checksum	B-Algorithm
mismatch	O
are	O
discarded	O
.	O
</s>
<s>
The	O
router	O
must	O
adjust	O
the	O
checksum	B-Algorithm
if	O
it	O
changes	O
the	O
IP	O
header	O
(	O
such	O
as	O
when	O
decrementing	O
the	O
TTL	O
)	O
.	O
</s>
<s>
The	O
procedure	O
is	O
explained	O
in	O
detail	O
in	O
RFC	O
1071	O
"	O
Computing	O
the	O
Internet	B-Protocol
Checksum	I-Protocol
"	O
.	O
</s>
<s>
(	O
with	O
errata	O
)	O
,	O
to	O
cover	O
the	O
case	O
in	O
routers	O
which	O
need	O
to	O
recompute	O
the	O
header	B-Algorithm
checksum	I-Algorithm
during	O
packet	O
forwarding	O
when	O
only	O
a	O
single	O
field	O
has	O
changed	O
.	O
</s>
<s>
Take	O
the	O
following	O
truncated	O
excerpt	O
of	O
an	O
IPv4	B-Protocol
packet	O
.	O
</s>
<s>
The	O
header	O
is	O
shown	O
in	O
bold	O
and	O
the	O
checksum	B-Algorithm
is	O
underlined	O
.	O
</s>
<s>
To	O
calculate	O
the	O
checksum	B-Algorithm
,	O
we	O
can	O
first	O
calculate	O
the	O
sum	O
of	O
each	O
16	O
bit	O
value	O
within	O
the	O
header	O
,	O
skipping	O
only	O
the	O
checksum	B-Algorithm
field	O
itself	O
.	O
</s>
<s>
To	O
obtain	O
the	O
checksum	B-Algorithm
we	O
take	O
the	O
ones	O
 '	O
complement	O
of	O
this	O
result	O
:	O
b861	O
(	O
as	O
shown	O
underlined	O
in	O
the	O
original	O
IP	O
packet	O
header	O
)	O
.	O
</s>
<s>
When	O
verifying	O
a	O
checksum	B-Algorithm
,	O
the	O
same	O
procedure	O
is	O
used	O
as	O
above	O
,	O
except	O
that	O
the	O
original	O
header	B-Algorithm
checksum	I-Algorithm
is	O
not	O
omitted	O
.	O
</s>
<s>
IP	O
header	B-Algorithm
checksum	I-Algorithm
does	O
not	O
check	O
for	O
the	O
correct	O
order	O
of	O
16	O
bit	O
values	O
within	O
the	O
header	O
.	O
</s>
